problem link:
solution link: https://www.codechef.com/viewsolution/27537091
Why I am getting TLE in this code ?