5th test case is not working

Please tell the error in the solution of the following practice question.
https://www.codechef.com/viewsolution/57969479