Please help me out with this problem from september lunchtime sod problem

https://www.codechef.com/viewsolution/51588075

Hii bro you should take a look at time complexity , You are running a loop of 10^18 itteration in worst case which is obvious to get you TLE.
You can have atmax 10^8~10^9 iterations only for a program to avoid TLE .

You can get more information regarding TLE here :- Time Complexity Analysis and Constraints | Competitive Programming Course | EP 10 - YouTube