getting NZEC in TABGAME

https://www.codechef.com/viewsolution/20454458
This is my solution for TABGAME problem.I am getting NZEC error in one test case .Other test cases are giving AC.Can someone help me to fix this?