Problem cb scholarship

import java.util.;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt(), m = cin.nextInt(), x = cin.nextInt(), y = cin.nextInt();
int low = 1, high = n,ans = 0;
while(low<=high){
int mid = (low+high)/2;
int req = mid
x, avail = m + (n-mid)*y;
if(avail>req){
low++;
ans = mid;
}else if(avail<req){
high–;
}else if(avail == req){
ans = mid;
low++;
}
}
System.out.print(ans);
}
}=====what’s the error in the code

hi @AbhishekAhlawat1102
you are updating the values of low and high incorrectly .
low=mid+1;
and
high =mid -1;

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.