Different outputs while testing and submitting


I am getting different output while submitting. When I run it as custom input, the output matches with the expected output. Does someone know where can the mistake be?


Generally, this happens when you make use of global variables. Don’t forget to clear them before each run, else they take random values.