Run time error in one test case

Code is getting run time error in one test case, but it seems to be correct. https://ide.codingblocks.com/s/441382.
Code is performed in Python.

hello @mukuljoshi2711

your logic is correct, probably input file has elements in different lines that why it is giving run error .

try to code in c++ and then submit

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.