TLE in python 3

coding
python
python3

#1

can anybody suggest me how to overcome time limit in python 3.
plzz share any tips . i have come with the best algorithm but still got a time limit for my code.i think my method of input is slow so plzz share a fastest method of input


#2

yeah me too!


#3

The fastest method of input is by using…
“from sys import stdin” on the top of the code and
Wherever you are using the command ‘input()’ replace it with ‘stdin.readline()’.


#4

well thanks @harsha_man it works for my code


#5

we can even print the output faster using the ‘stdout.write(str(answer))’