PYTHON TLE JAVA AC!!

I am getting a TLE in my python code whereas a code with the same complexity of O(n^2) in java, I am getting AC!!
My solution link for python is:http://www.codechef.com/viewsolution/3971729
My java solution link is:http://www.codechef.com/viewsolution/3970249

Check and let me know.

@complexgene

  1. first of all check others submission
  2. check whether anyone submit it in python during the contest
  3. Time limit for python is adjusted such that when same algo coded in python it passes test data.

btw there is also an O(nlogn ) approach to solve this problem and with that certainly you will not get this veridict so i think you should check this out i have provided an explanation of that at the end::
http://discuss.codechef.com/questions/43403/approx2-editorial
if you like this answer dont forget to cast votes::