Why only two testcases are getting passed ?
Winning CB Scholarship
@vaishnavtannu hey ,change your if condition ,in place of n-ans use n- mid as ans do not always point to mid ,here is pseudo code you can refer to,
while (l <= r) {
mid = (l + r) / 2;
if ((mid * x) <= m + ((n - mid) * y)) {
ans = mid;
l = mid + 1;
} else {
r = mid - 1;
}
}
Hope this clear your doubt 
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.