Runtime Error in TSECJ05

Problem link-TSECJ05 Problem - CodeChef
My code(python) is correct in this problem but still it is showing runtime error.Till date whoever has submitted in python has got runtime error in this code.Is this problem solvable in python??

My solution: CodeChef: Practical coding for everyone
@vijju123