Help me in solving CHEFWARS problem

My issue

can i please know what is the error in my code

My code

import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
	public static void main (String[] args) throws java.lang.Exception
	{
	    Scanner sc = new Scanner(System.in);
	    int T = sc.nextInt();
	    for(int i=0;i<T;i++) {
	        int P = sc.nextInt();
	        int H = sc.nextInt();
	        int A = H-P;
	        int B = Math.floorDiv(P,2);
	        if(A>B) {
	            System.out.println("0");
	        }
	        else {
	            System.out.println("1");
	        }
	    }
		// your code goes here

	}
}

Problem Link: Chef Wars - Return of the Jedi Practice Coding Problem

@nusrath_596
plzz refer my c++ code for better understanding of the logic

#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define nl "\n"
#define fastio ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define db double
#define mod 1e9 + 7
#define lb lower_bound
#define ub upper_bound
#define vlli vector<lli>
#define mslli multiset<lli>
#define inf INT_MAX
#define sp " "
#define pb push_back
#define pie 3.14159265358979323846
#define test lli t; cin>>t; while(t--)
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);*/
test
{
    lli p,h,sum=0;
    cin>>h>>p;
    while(p!=0)
    {
        sum=sum+p;
        p=p/2;
    }
    if(sum>=h)
        cout<<1;
    else
        cout<<0;
    cout<<nl;
}
}