Constraints mentioned are wrong


The constraints mentioned in the question are up to 10^9. I have got a TLE on 2147483647 which is definitely greater than 10^9 according to me. And if I check its expected output it shows me INVALID INPUT.


yes right . use long long int in binary search.