Python solution of ACCBIP

I tried solving ACCBIP(CodeChef: Practical coding for everyone) in python. I used the similar approach mentioned in editorial and similar to what majority have done in their codes using c++.
Here is my solution : CodeChef: Practical coding for everyone
It would really be helpful if anyone could help me in understanding , is it python or me who is to be blamed ?

PyPy 3
PyPy 3 with fast i/o
You need just a little more optimizations.

Thank you so much.
Later I saw this solution CodeChef: Practical coding for everyone
and got to know about the optimization required. Thanks again !!