use a third party module with alternative packages,
from sys import stdin, stdout
and to input use readline
a = stdin.readline()
and to get the output try,
stdout.write(str(a))
be sure to convert to string before output
And read from here,
Python Input Methods for Competitive Programming - GeeksforGeeks
Python is an amazingly user-friendly language with the only flaw of being slow.
https://www.geeksforgeeks.org/python-input-methods-competitive-programming/