JAGAM help to find where solution fails

Could someone point out, please, where this fails:

https://www.codechef.com/viewsolution/19886651