I have one of the fastest C solution, and I cannot yet do it in Python3, but in Python2 I could do it with IO like you.
I think numerix knows secrets for much faster IO for this problem, I don't know them.
So I recommend you to try it in Python2, it's feasible and not so hard.