pythoneoferror

EOF Error in python Hackerrank


Trying to solve a problem but the compiler of Hackerrank keeps on throwing error EOFError while parsing: dont know where is m i wrong.

#!usr/bin/python

b=[]
b=raw_input().split()
c=[]
d=[]
a=raw_input()
c=a.split()
f=b[1]
l=int(b[1])
if(len(c)==int(b[0])):          
    for i in range(l,len(c)):
        d.append(c[i])
        #print c[i]
    for i in range(int(f)):
        d.append(c[i])
        #print c[i]
for j in range(len(d)):
    print d[j],

i also tried try catch to solve it but then getting no input.

try:
    a=input()
    c=a.split()
except(EOFError):
    a=""

input format is 2 spaced integers at beginning and then the array

the traceback error is:

Traceback (most recent call last):
  File "solution.py", line 4, in <module>
    b=raw_input().split()
EOFError: EOF when reading a line

Solution

  • i dont know but providing a custom input and compiling it and got me in! and passed all cases without even changing anything.