NZEC error in python

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


The link to my two solution both of which showed NZEC on submission
https://www.codechef.com/viewsolution/35899136
https://www.codechef.com/viewsolution/35899008
1 Like

Your first solution fails e.g. at the input

1
100000

with the error
RecursionError: maximum recursion depth exceeded in comparison

It is always a good idea to run tests with minimal/maximal values from the allowed value range, you catch many errors this way.

@janwil thanks for the help.

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 .

Again ,Thanks for the help.

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.

1 Like