Python NZEC Runtime Error

Your suggestion to use raw_input() and print(), instead of sys.stdin.read() and sys.stdout.write() solved my problem.
Thank you!

last line should be num = int(sys.stdin.readline())

4 Likes

in your second option for print, poss[i] should be poss[0], probably.

I tried with the raw_input too… but not working …

test_case = input()
num = []
for i in range(test_case):
num.append(raw_input())

for i in num:
print next_palidro(i)

2 Likes

use:
temp = input()
a,b = temp.split(" ")
this will solve your problem as the first line of input i.e e.g if the input is 10 4
using a = input() will take the entire line as a string and not leave anything for b to take in input nad hence the problem

Hey I’m facing the same problem
My Code:
temp=input()
print(temp)
I’m using Python 3.6 still I’m getting NZEC. What should I do?

1 Like

Facing same issue in python 3.6 :
notc=input()
print(notc)
getting NZEC for above lines, really frustrating

I am also getting NZEC error when i am running below code.

num=[6,2,5,5,4,5,6,3,7,6]
t=int(input())
for i in range(t):
a,b=map(int,input().split())
c=a+b
count=0
while(c!=0):
rem=c%10
c/=10
count+=num[rem]
if(i!=n-1):
print(count)
else:
print(count,end=’’)

Can anyone please help me in correcting this error.

Please share your solution link or format your code correctly.
Use three backticks ``` before and after your code.

Example:

```
Code
```

Then it looks like:

num=[6,2,5,5,4,5,6,3,7,6]
t=int(input())
for i in range(t):
  a,b=map(int,input().split())
  c=a+b

@ankitsinla In your code, you use undefined variable n
if(i != n - 1):

Hey I’m getting NZEC error in fir line i.e T=int(input())
Please Help

    T = int(input())
while T:
    T-=1
    N,M = map(int, input().strip().split(" "))
    f = list(map(int,input().strip().split(" ")))
    p = list(map(int,input().strip().split(" ")))
    arr = [0]*M
    for i in range(0,N):
        arr[f[i]] = arr[f[i]] + p[i]
    
    arr.sort()
    for j in arr:
        if j != 0:
            print(j,end="")
            break

Have you provided custom input?

1 Like

It is happened because you probably didn’t use custom input while compile.

Thank you, this helped me.

I am getting NZEC for the following code at line 1.

inp = input()
inp = input().split(' ')
withdraw_amt, bal = float(inp[0]), float(inp[1])
if withdraw_amt%5 == 0 and withdraw_amt<bal:
    bal-=withdraw_amt+0.50
print('{:.2f}'.format(bal))

The complete error is:

Traceback (most recent call last):
File "./prog.py", line 1, in <module>
EOFError: EOF when reading a line

Are you trying to “Run” without Providing “Custom Input”?

Solution: 40881992 | CodeChef can someone tell me why i am getting nzec error in this code

Solution: 40881992 | CodeChef can someone tell me why i am getting nzec error in this code.

even I am getting a run time error though i have selected custom input with the same code

Are you trying to “Run” without Providing “Custom Input”

1 Like