Why getting TLE?

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