NOTALLFL problem -Getting WA

https://www.codechef.com/viewsolution/30021360
I have tried for very long time to get it right , can you please also provide the corrections …to get it right.