I just got at AC on ADDREV, but I noticed that my solution is around four times slower than the best solution, and I'd like to know what part of my code could be improved. I've included my code with some added comments.
[bbone=text,90]
import sys
N=sys.stdin.readline()
d=sys.stdin.read()
d=d.split()
d = [e[::-1] for e in d] #Reverse input strings
d = [int(e) for e in d] #Convert to intergers
out=[]
for i in range(0,len(d),2):
out.append(d[i]+d[i+1]) #Calculate sums of reversed pairs
out = [str(e) for e in out] #Convert to strings
out = [e[::-1] for e in out] #reverse strings
out = [int(e) for e in out] #convert to integers in order to remove leading zeros
out = [str(e)+'\n' for e in out] #convert back to strings
for i in range(len(out)):
sys.stdout.write(out[i])
[/bbone]
So disregarding my approach which could possibly be improved, am I making any slow function calls or anything like that?
One more thing, I tried to use psyco (all you have to do is to add 'import psyco' in the beginning of you code, right?), but all it does for me is to use like ten times more memory. How come?
Thank you.