My solutions for Google codejam.
Usage: for most scripts you can run like python script_name.py test_data.in
. If your input file is test_data.in, the output file is test_data.out.
The pr(...) function is for debug. To turn on debug info, just comment the 'return' line.
def pr(*a):
return
for x in a: print x,
print