Help me fix the run time error(NZEC) ENCD04

Please help me fix run time error in problem with code ENCD04. I have tried generating some test cases like the example provided and the code did well with that but while submitting I keep getting run time error. Link to my solution:
https://www.codechef.com/viewsolution/32376617