Question link:
http://www.codechef.com/problems/IITK1P07
Solution link of AC in python 2.7
http://www.codechef.com/viewsolution/4942649
Solution link of WA in python 3.1
http://www.codechef.com/viewsolution/4942676
What the error? Only difference is I/O.