NZEC Error Python 2.7

Can anybody please tell all the possible cases in which we receive a NZEC error.Every time I try to submit a problem i receive a NZEC error it is really discouraging receiving this error every time you try to solve a new problem?Please explain the meaning of this error in detail?

Just see this link 1:NZEC ERROR http://www.codechef.com/wiki/faq#Why_do_I_get_an_NZEC

2 Likes

Please give a link to your sample code so we can correct the mistakes

I have read the FAQ before but i donn’t understand the type of exceptions covered under NZEC error and is it necessary to return 0 in python also… Thanks

Please give a link to your sample code so we can correct the mistakes. It is not necessary to return 0 in most cases. However in some cases you need to define the main function as main(): //code here //return 0.check if this works

@nimishsinghal : It may be possible that your code is not terminating for some particular test cases . if any problem please paste your code , so that we solve it for you.

Solution is http://ideone.com/f1SjRo and the question is http://www.codechef.com/problems/ONP

@nimishsinghal , First of all just remove the line “input:” you don’t have to print it, and the place where you are popping the element check the size of the stack

1 Like

NZEC is caused when your code throws an exception. check if your code is accessing an invalid element in the list.

I removed the input from second and third line and used n=sys.stdin.readline() instead but it still shows the same error and why there is need to check the size of the stack??There is no exception when i ran the code on my pc and it would be really grateful if you could point out the exception??
Thanks

can anybody please help i am getting nzec error while submitting the code of following question
solution is http://code.geeksforgeeks.org/index.php and question is https://www.codechef.com/problems/FORGETPW

Put your code after submitting on ideone. Your code is is not visible there

@bansal1232,I updated the code link,now u can take a look
can anybody please help i am getting nzec error while submitting the code of following question solution is https://ideone.com/B09zQx and question is https://www.codechef.com/problems/FORGETPW

//