Why i keep getting wrong answer in MATPAN problem (Python)?

Hello!

I’m new to codeChef and i just tried to solve my first problem. I’m pretty sure that i solved it correctly but i keep getting wrong answer.

You can find the problem here

You can see my code in my last submission here