Half test cases showing wrong.Problem winning cb scholarship

#include
using namespace std;

void Scholarship(int n,int m,int x,int y)
{
int l=0;
int h=n;
int mid=0;
int Max=0;
int a=0;
int b=0;
while(l<=h)
{
mid=(l+h)/2;
a=mid*x;
b=(m+(n-mid)*y);
if(a<=b)
{
Max=mid;
l=mid+1;
}
else
h=mid-1;

}
cout<<Max;

}

int main()
{
int n,m,x,y;
cin>>n>>m>>x>>y;
Scholarship(n,m,x,y);
}

@Mukul-Shane-1247687648773500,
your code is perfect just use long long instead of int

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.