[Help] CHEFRECP from COOK118B

Can somebody help why I am getting WA for this problem https://www.codechef.com/COOK118B/problems/CHEFRECP?

Solution link - https://www.codechef.com/viewsolution/33637526