ENTEXAM PROBLEM

Why my code give wrong answer
https://www.codechef.com/viewsolution/21627416