CHEF AND GAME Editorial

Problem Link

Explanation

Given Chef’s Score- ‘A’ and Team Score - ‘B’ and according to rules of A >= 50% of B → A>=B/2 Then Chef is at 'TOP' and if A < Floor(B/4) then Chef is at ‘BOTTOM’ else Chef is at ‘MIDDLE

#include<bits/stdc++.h>
using namespace std;
void fun(int a,int b)
{
    if(a>=(b+1)/2)
    {
        cout<<"TOP\n";
        return;
    }
    if(a<b/4)
    {
        cout<<"BOTTOM\n";
        return;
    }
    cout<<"MIDDLE\n";
    
}
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int a,b;
        cin>>a>>b;
        fun(a,b);
    }
}