Help Needed (Codeforces EDU Binary Search)

Can anyone help me with this question :
https://codeforces.com/edu/course/2/lesson/6/2/practice/contest/283932/problem/D