Time limit exceeding while compiling

https://www.codechef.com/viewsolution/18589809 my code is not compiling within time limit. may you help me optimising it?

It isn’t TLE while compiling, but instead, your code doesn’t run in the time limit specified!
I also don’t think that checking for constraints is necessary! If it is mentioned, it will be followed!

How to improve the speed of run time?