How to improve Python IO in challenges?

I am looking for a way to improve IO performance in Python. In many cases, I can get far with something simple like:

for i in range(int(input())):
A, B = [int( c ) for c in input().split()]

However, in a small number of challenges, the above is simply too slow when I encounter big data for the time constraints allotted.

Even in the case of sys (stdin, stdout) it doesn’t seem to pass all hurdles. Has anyone used python’s IO, specifically at the Bytes level? If so, can you provide some code examples that mimic the above?

Thanks for the help!

Here, it helped me a lot, especially in codeforces.