Runtime error Please help

https://www.codechef.com/viewsolution/53912908
Im a beginner and I cant understand Why am I getting Runtime Error on this problem.
The code looks fine and the second testcase(on the above given solution link) runs fine…
I dont know why its getting a runtime error
Thank u for your help in advance. :grinning: