December Lunchtime Sed Sequences

In this question I used bufferedReader for my java code. Although the approach was fine but still showed RE. So i had to use scanner and it worked fine. So how to know when to use scanner and when to use bufferedreader.
Sed Sequences

Your solution didn’t give TLE. It gave Runtime Error. There might be some Exception that occured which resulted in RE. Remember, Buffered Reader will always run faster when compared to Scanner. What you should learn is how to tackle Run-time errors. Using try catch block or some other debugging techniques.

1 Like

for i in range(t):
N,K=int(input().split(" "))
for j in range(0,N):
print(“0 \n”)

        print("1 \n")

except EOFError:

i dont know why i am getting RE (NZEC) with this code …although i am using try except… can any one help

Sorry bro not good with python

I think, the input of the array was in a line i.e. a1,a2,…,an and not in separate lines. So, use a map to take input in one line and it should give AC