WA on submission

I tried understanding the tutorial of stone game from starters 26 held few days back.

Idk why I’m getting a wrong answer when I tried coding the approach myself. Can someone help me debug this code?

My submission: CodeChef: Practical coding for everyone

Thanks in advance :wink: