I know that there are many question on the discuss forum for NZEC error in python , I had also read some but still I am unable to know why my code is giving NZEC error on submission while it is running accurately when I am trying to run it on sample test cases . I had solved the problem in c++ but since I am new to python I am having a tough time in it . The problem link
Actually I didn’t knew about Recursion error and since , I had solved the problem in c++ I thought that there couldn’t be any error other than syntax related .
NZEC stands for “Non-Zero Exit Code” which basically means “Generic runtime error” and which can come for a wide selection of reasons. I agree that this is the nastiest kind of error you can get on CodeChef (and probably on any online competition site). I have contacted CodeChef admins trying to make a point that the NZEC errors should have a little bit more feedback with them, at least in the practice mode. This far I have had no luck in getting my message through, and all I get from the admins are links to some generic pages having some hints how to debug NZEC errors. Needless to say, these pages are pretty useless.