My solution is showing time limit exceeded

https://www.codechef.com/viewsolution/23520641
can anyone please tell me the mistake

This is showing accessing denied. Most probably you are posting the solution for an ongoing contest. If this is the case, then you should delete this post immediately. You are not allowed to ask questions regarding the solution or approach of an ongoing contest here or elsewhere.

find efficient way to solve problem.
it means your solution is taken more time than provided and your output is not checked it may or may not be right.