CodechefMay 17, 2025

Pass or Fail

Hazrat Ali

Codechef

The test has a total of NN questions, each question carries 33 marks for a correct answer and −11 for an incorrect answer. Chef is a risk-averse person so he decided to attempt all the questions. It is known that Chef got XX questions correct and the rest of them incorrect. For Chef to pass the course he must score at least PP marks.

Will Chef be able to pass the exam or not?

Input Format

  • First line will contain TT, number of testcases. Then the testcases follow.
  • Each testcase contains of a single line of input, three integers N,X,PN,X,P.

Output Format

For each test case output "PASS" if Chef passes the exam and "FAIL" if Chef fails the exam.

You may print each character of the string in uppercase or lowercase (for example, the strings "pASs", "pass", "Pass" and "PASS" will all be treated as identical).

Constraints

  • 1≤T≤1000
  • 1≤N≤100
  • 0≤X≤N
  • 0≤P≤3⋅N

Sample 1:

Input
 
3
5 2 3
5 2 4
4 0 0
 
Output
 
PASS
FAIL
FAIL


Solution
F = int(input())
for i in range(F):
    (a, b, p) = map(int,input().split(' '))
   
    sum = (a-b)*1
    if (b*3)-sum >= p:
        print("Pass")
    else:
        print("Fail")
 
 

Comments