Python solution of ACCBIP

I tried solving ACCBIP( 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 :
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
and got to know about the optimization required. Thanks again !!