PROBLEM LINK:
Setter: Utkasrsh Gupta
Tester: Manan Grover
Editorialist: Ajit Sharma Kasturi
DIFFICULTY:
CAKEWALK
PREREQUISITES:
None
PROBLEM:
Chef writes and exam consisting of N questions. Chef gets 3 marks for every correct answer and 1 marks for every incorrect answer.The passing marks is P for this course. Chef has answered X questions correct and the remaining questions incorrect. We need to find whether chef will pass the exam or not.
EXPLANATION:

Number of questions answered correctly is X. Therefore, number of questions answered incorrectly is NX.

The number of marks the chef will get will then be 3\cdot X  (NX).

Since the passing marks is P, chef needs atleast P marks to pass.

Therefore, if 3\cdot X  (NX) \geq P we ouput PASS, else we output FAIL.
TIME COMPLEXITY:
O(1) for each testcase.
SOLUTION:
Editorialist's solution
#include <bits/stdc++.h>
using namespace std;
int main()
{
int tests;
cin >> tests;
while (tests)
{
int n, x, p;
cin >> n >> x >> p;
if (3 * x  (n  x) >= p)
cout << "PASS" << endl;
else
cout << "FAIL" << endl;
}
}
Setter's solution
//Utkarsh.25dec
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define deb(x) cerr<<#x<<' '<<'='<<' '<<x<<'\n'
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
// ordered_set s ; s.order_of_key(val) no. of elements strictly less than val
// s.find_by_order(i) itertor to ith element (0 indexed)
typedef vector<vector<ll>> matrix;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod2);}
const int N=500023;
bool vis[N];
vector <int> adj[N];
void solve()
{
ll n,x,p;
cin>>n>>x>>p;
assert(n>=1 && n<=100);
assert(x>=0 && x<=n);
assert(p>=0 && p<=3*n);
ll marks=3*x(nx);
if(marks>=p)
cout<<"PASS\n";
else
cout<<"FAIL\n";
}
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int T=1;
cin>>T;
assert(T>=1 && T<=1000);
int t=0;
while(t++<T)
{
//cout<<"Case #"<<t<<":"<<' ';
solve();
//cout<<'\n';
}
cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}
Tester's solution
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int t;
cin>>t;
while(t){
int n,x,p;
cin>>n>>x>>p;
if(p <= 4 * x  n){
cout<<"PASS\n";
}else{
cout<<"FAIL\n";
}
}
return 0;
}
Please comment below if you have any questions, alternate solutions, or suggestions.