A Puzzle Game Codechef Solution