Can someone please explain why this code gives WA even though the answers are correct

Problem

My Solution -
https://www.codechef.com/viewsolution/93681237