The problems which I solved in c and Java are getting TLE in Python. I saw many submissions in python with very less time, in current contest.
May be, I am using slower io ?? Please guide me about faster io in Python.
I am new in python see this thread … http://discuss.ww2.codechef.com/questions/8773/which-scripting-language-should-i-learn
Hoping to get some help.
Have a look at some tips
Also regarding input
n, m = map(int, sys.stdin.readline().split(' '))
is faster than
n, m = map(int, raw_input().split(' '))
did’nt worked still getting TLE.
The simplest and most powerful way to get your java program started is by using jigy Generator link text
@bugkiller, can you please tell me among these, which one is faster?
n, m = map(int, sys.stdin.readline().split(’ '))
n,m = [int(i) for i in raw_input.split()]