I was solving problem H of a div 4 round. The first solution I wrote got MLE so in order to save some memory I decided to use arrays instead of lists, this got me a wrong answer in test 4 (solution), can anyone explain why did that happen. Looks like the program stopped executing after the first test case.