Please help why wrong answer on this algortihm

question link : BINSTRGAME Problem - CodeChef
solution : CodeChef: Practical coding for everyone