Plz help in this problem

The problem link is this: Contest Page | CodeChef

this is my solution. Getting WA