EOF when reading a line

I wrote a code for the August long challenge.(python 3.6)
It works perfectly on my terminal (ubuntu), works perfectly with any custom input.
(I have tried the example inputs, as well as my own) .
Yet it gives EOF when reading a line.
The line it points to is this:
T = int(input())
I have also tried input as a string ie
T = input()
But none of it works. Whats the reason for this?

1 Like

It depends what’s the input format:
2
1 2
3 4
For this the code can be:

 for test in range(int(input())):
    a,b=map(int,input().split()))
    #Main logic

1
4
1 2 3 4

For this:

for test in range(int(input())):
     n=int(input())
     l=list(map(int,input().split()))
     #Main Logic

Nope, this way doesn’t work as well. In fact, I tried another question, an the same error pops up.
The input format is as:
3
5 1
4 2
10 10

My code goes:

T = int(input())<----(“eof while reading the file on line 3”)
for x in range(T):
s = input()
N,K = (int(i) for i in s.split())
#and so on (main logic)
And to restate, I tried your way as well. Doesn’t work

are you really using python 3, first please check your python version where you get this error.

Yes, PYTH 3.6 (Python 3.6).Annotation%202019-08-11%20221229

it is showing NZEC because you haven’t provided the input XD.
please check the “Custom Input” and provide the input then it’ll work like a charm

2 Likes

As someone who migrated from Hackerrank, this initially confused the hell out of me - on Hackerrank, clicking Run without providing custom input runs your program on the sample test inputs, so I was very perplexed when clicking Run on Codechef appeared to run my program with no input at all XD

3 Likes

Oh okay! So basically, I thought that “run” means it runs on some inbuilt test cases(new to the platform).
I’m positively exuberant that I uploaded the screen shot!
Thanks @admin5 ! xD

2 Likes

Going through the same situation now.

1 Like

I was also facing the same issue. But Somewhere i saw a comment to switch to Non IDE Mode.
And that worked for me.

its also not working on submission

You need to provide the custom input to run on online IDE else you will get run time error because your code is trying to read a line but there is no input given by you.

Hope this helps you.