My lunchtime problem working with custom input but getting error otherwise

The link for my solution to problem SEDARR for this Lunchtime . I am getting correct output for the exact same input in custom but (NZEC Error on running ).

Traceback (most recent call last):
File “./”, line 2, in
EOFError: EOF when reading a line

I am not getting why the error is coming and was not able to correct that even after spending hours on it.