Python 3 code not working

this is my first coding competition and I am having problem in submission of my code .
compiler is showing EOF error while submitting my code

Does it work on your local machine?

EOF Exception is raised if there is an error in the code, i.e, it is not complete or something
Share the code please

you didn’t close commented section (’’’ ‘’’)
you didn’t close an open bracket or string

Run the code on Command Prompt and it’ll show you the error and the line number of code where the error exists

share formatted code so that people can genuinely help you out here pal

EOF error happens when sufficient input is not provided, maybe you forgot to give enough input or didn’t properly put condition when to stop taking input.

you should input no of test cases also

put your code in try except like this
your code

ya its working on pycharm

first i ran all test cases they are working but on submission its showing me run time error

could you post your code here, if its not from live contest?

idk if you understood his point, so just clarifying:
your entire code is IN A LOOP, right? for the number of testcases…

it means it might be “array index out of bound” in that case also it gives runtime error.


There is no problem due to array index it’s showing correct answer on placing the test case while showing error on submission

one more reason for runtime error is accessing negative value in array:
ex:- a[-9] etc… so check for it

Instead of using the run test option use the custom input to give the input

no bro.

You can read about EOF error here
This includes most of the reasons why EOF takes place
Pls Like :slightly_smiling_face:,looking%20for%20the%20closing%20parenthesis.&text=Python%20will%20attempt%20to%20highlight%20the%20offending%20line%20in%20your%20source%20code.,-However%2C%20since%20it

i still confused about it… any kinds about it to explain more simple and understanding… thank you … sorry i’m newbie

@rgeez_34 listen, just try with custom input and submit . it will solve that. don’t run the program .