Binary Nim

In the below solution i got Runtime error i don’t know why???
Logic : just calculating number of zero with top as 0 and number of one with top as 1.
for same value, the winner will be not who have started first.

Here’s my solution.
https://www.codechef.com/viewsolution/24406964

I have solved problem yaay.