I am getting tle

i am gettig tle i my above code in 1 test case

@Chhayansh
As you can see , the constraints in this problem are extremely large so a brute force solution will not work. Optimise it using a modified binary search / divide and conquer technique. It is somewhat similar to finding the square root of a number using binary search. Binary search will solve it much faster.