# Why do I get an NZEC?

**URL:** <https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775>\
**Category:** faq\
**Tags:** faq, nzec\
**Created:** [March 20, 2013, 5:37pm UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775 "2013-03-20T17:37:27Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![tojochacko](https://discuss.codechef.com/user_avatar/discuss.codechef.com/tojochacko/32/33_2.png) [@tojochacko](https://discuss.codechef.com/u/tojochacko)\
**Post date:** [March 20, 2013, 5:37pm UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/1 "2013-03-20T17:37:27Z")

</div>

Why m i getting NZEC (Non Zero Exit Code) for my program?

---

<div class="post-metadata">

**Author:** ![admin](https://discuss.codechef.com/user_avatar/discuss.codechef.com/admin/32/212587_2.png) [@admin](https://discuss.codechef.com/u/admin)\
**Post date:** [March 20, 2013, 5:38pm UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/2 "2013-03-20T17:38:11Z")

</div>

NZEC stands for Non Zero Exit Code. For C users, this will be generated if your main method does not have a return 0; statement. Other languages like Java/C++ could generate this error if they throw an exception.

---

<div class="post-metadata">

**Author:** ![sonuk7](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@sonuk7](https://discuss.codechef.com/u/sonuk7)\
**Post date:** [April 21, 2013, 12:22am UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/3 "2013-04-21T00:22:42Z")

</div>

Why am i getting this error in python???

---

<div class="post-metadata">

**Author:** ![anupam02](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@anupam02](https://discuss.codechef.com/u/anupam02)\
**Post date:** [November 13, 2014, 11:27pm UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/4 "2014-11-13T23:27:30Z")

</div>

how to resolve this If I am using Python??

---

<div class="post-metadata">

**Author:** ![shubham\_coder](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@shubham\_coder](https://discuss.codechef.com/u/shubham_coder)\
**Post date:** [November 14, 2014, 11:14am UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/5 "2014-11-14T11:14:10Z")

</div>

Try using raw\_input() to take input instead of input() because sometimes it happens that a space is left at the end of input which results in RunTimeerror.

---

<div class="post-metadata">

**Author:** ![karnikamit](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@karnikamit](https://discuss.codechef.com/u/karnikamit)\
**Post date:** [December 13, 2014, 1:29pm UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/6 "2014-12-13T13:29:01Z")

</div>

I tried using raw\_input() but still  
 ![alt text](http://s11.postimg.org/xzg5ls377/Capture1.png)

I’m new to these coding contests, bear me.

---

<div class="post-metadata">

**Author:** ![sknash](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@sknash](https://discuss.codechef.com/u/sknash)\
**Post date:** [December 28, 2014, 12:13pm UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/7 "2014-12-28T12:13:02Z")

</div>

getting NZEC for my java code, anyone any suggestions on how to make it work ?

---

<div class="post-metadata">

**Author:** ![brobear1995](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@brobear1995](https://discuss.codechef.com/u/brobear1995)\
**Post date:** [December 28, 2014, 1:59pm UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/8 "2014-12-28T13:59:54Z")

</div>

If you are using raw\_input().split(’ ') it may cause nzec because in test cases, there are usually extra spaces at the end. try raw\_input().split() and nzec will not come.

---

<div class="post-metadata">

**Author:** ![code\_aholic](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@code\_aholic](https://discuss.codechef.com/u/code_aholic)\
**Post date:** [December 30, 2014, 12:32am UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/9 "2014-12-30T00:32:30Z")

</div>

t=float(raw\_input())

s=float(raw\_input())

if(t%5!=0 or t\>s-0.5):  
print s  
else:  
print s-t-0.5

why am i getting one in this??

---

<div class="post-metadata">

**Author:** ![rishabhprsd7](https://discuss.codechef.com/user_avatar/discuss.codechef.com/rishabhprsd7/32/109118_2.png) [@rishabhprsd7](https://discuss.codechef.com/u/rishabhprsd7)\
**Post date:** [December 30, 2014, 12:42am UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/10 "2014-12-30T00:42:53Z")

</div>

@code_aholic seems code is for problem ATM…

**One thing to note:**

```
Input:
30 120.00

Output:
89.50
```

In input two values are on same line and the way your code receives input is wrong, it will work only for newline input.

So if you want to take multiple input from single line use map().

Here is an example:

Replace these two lines

```
t=float(raw_input())
s=float(raw_input())

```

with

```
t,s=map(float, raw_input().split())

```

And your code will be able to receive multiple input from single line…!!

🙂

---

<div class="post-metadata">

**Author:** ![the\_darklord](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@the\_darklord](https://discuss.codechef.com/u/the_darklord)\
**Post date:** [December 31, 2014, 12:59pm UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/11 "2014-12-31T12:59:56Z")

</div>

Can Any one tell me why i am always getting NZEC for my java code ?? [CodeChef: Practical coding for everyone](http://www.codechef.com/viewsolution/5673178)

Thanks in advance

---

<div class="post-metadata">

**Author:** ![rishabhprsd7](https://discuss.codechef.com/user_avatar/discuss.codechef.com/rishabhprsd7/32/109118_2.png) [@rishabhprsd7](https://discuss.codechef.com/u/rishabhprsd7)\
**Post date:** [December 31, 2014, 3:27pm UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/12 "2014-12-31T15:27:09Z")

</div>

@the_darklord

I am not familiar with JAVA but when i run your code on ideone on giving test cases, your code returns stderr

```
Exception in thread "main" java.lang.NumberFormatException: For input string: "3 6"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:492)
	at java.lang.Short.parseShort(Short.java:117)
	at java.lang.Short.parseShort(Short.java:143)
	at ClosingTweet.main(Main.java:14)
```

Link : [http://ideone.com/g1HO2W](http://ideone.com/g1HO2W)

---

<div class="post-metadata">

**Author:** ![lucifer961](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@lucifer961](https://discuss.codechef.com/u/lucifer961)\
**Post date:** [December 31, 2014, 6:35pm UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/13 "2014-12-31T18:35:54Z")

</div>

i have used raw\_input().split() method but still getting a nzec.why??  
can anyone help me

---

<div class="post-metadata">

**Author:** ![the\_darklord](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@the\_darklord](https://discuss.codechef.com/u/the_darklord)\
**Post date:** [January 2, 2015, 2:08am UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/14 "2015-01-02T02:08:54Z")

</div>

Why I am getting NZEC error while using BufferedReader Input in JAVA for my solution??(while scanner type input is accepted)

---

<div class="post-metadata">

**Author:** ![sstuff](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@sstuff](https://discuss.codechef.com/u/sstuff)\
**Post date:** [January 6, 2015, 3:10pm UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/15 "2015-01-06T15:10:06Z")

</div>

hi,

i keep getting NZEC and would like to know if there is a way i can get the inputs used for testing my code.  
this is my code [http://www.codechef.com/viewsolution/5778355](http://www.codechef.com/viewsolution/5778355)

thanks  
Sivan

---

<div class="post-metadata">

**Author:** ![shortyfin](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@shortyfin](https://discuss.codechef.com/u/shortyfin)\
**Post date:** [January 24, 2015, 11:39am UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/16 "2015-01-24T11:39:49Z")

</div>

I’ve searched through forums and similar code but I’m still getting NZEC. I suspect it could be something with input/output or an index going out of bounds on an array. Any suggestions? [CodeChef: Practical coding for everyone](http://www.codechef.com/viewsolution/5973516)

---

<div class="post-metadata">

**Author:** ![figure\_it\_out](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@figure\_it\_out](https://discuss.codechef.com/u/figure_it_out)\
**Post date:** [February 24, 2015, 4:23pm UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/17 "2015-02-24T16:23:17Z")

</div>

[http://www.codechef.com/viewsolution/6345015](http://www.codechef.com/viewsolution/6345015)  
why NZEC in java code ??? any help please

---

<div class="post-metadata">

**Author:** ![sheetal1296](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@sheetal1296](https://discuss.codechef.com/u/sheetal1296)\
**Post date:** [May 28, 2015, 4:21am UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/18 "2015-05-28T04:21:50Z")

</div>

My python code is encountering the NZEC error.

How will my code be able to receive multiple input from single line, if those inputs are in the form of an array.

Please tell me what to change in this piece of code, to be able to accept an array of inputs from the user.

pies=[]

for j in range(0,np):

```
pies.append(int(raw_input()))

```

This is the code to receive input if they are printed on consecutive lines.  
The problem is that all the inputs are being entered on the same line, but how do i receive the array of inputs from the same line?

---

<div class="post-metadata">

**Author:** ![riya0303](https://www.codechef.com/sites/all/themes/abessive/images/user_default_thumb.jpg) [@riya0303](https://discuss.codechef.com/u/riya0303)\
**Post date:** [June 5, 2015, 12:51pm UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/19 "2015-06-05T12:51:23Z")

</div>

why i m getting NZEC in C code i have written the statement return 0;

---

<div class="post-metadata">

**Author:** ![anon37034924](https://discuss.codechef.com/user_avatar/discuss.codechef.com/anon37034924/32/62092_2.png) [@anon37034924](https://discuss.codechef.com/u/anon37034924)\
**Post date:** [July 19, 2015, 12:00am UTC](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775/20 "2015-07-19T00:00:04Z")

</div>

My all programs give NZEC error when submitting when using C#.  
All the programs work perfectly with IDE. Any help ?  
It’s a shame there’s no support for this problem.

[Next page](https://discuss.codechef.com/t/why-do-i-get-an-nzec/1775.md?page=2)
