TLE in BINTOUR while submitting in python but a very decent execution time with c

Regarding BINTOUR (MARCH 2014) it’s an easy question and only needed some mathematical operations to be done to arrive at solution so python was my language of choice , but my Solution in python is giving a TLE i tried to remove this but after failing for about 10 times i decided to recode it in c using the same algorithm and bang it gave me a AC with 0.46 sec execution time , what can i do with my python code to remove the TLE .

I know python is slow but more than 4 times slower than C !!!