Why am I getting WA on CHFIMPRS

Here is link to my solution. Please help.
https://www.codechef.com/viewsolution/33327157