DISTDILEM HELP

question : Contest Page | CodeChef

My Solution : Solution: 62165259 | CodeChef

I used same logic as in the video but used binary search to find the answer, can anyone help me and find where my code is wrong. Please

Check the following binary-search solution using the std::upper_bound function.

Accepted