It is a bit unfortunate that a solution to problem D in round-85 (div2) implemented in C++ passes system tests, but same solution implemented in Python times out on test case 40. Does that mean Python isn't a good pick for such time constrained problems?
C++:
int main(){int n; cin>>n;int f[100001]; for(int i=0;i<100001;i++) f[i] = -100000;for(int i=0;i<n;i++){int x, y;cin>>x>>y;int r = 0;for(int j=1;j*j<=x;j++){if(x%j==0){int p = x/j;int q = j;if(f[p]<i-y)r++;f[p] = i;if(f[q]<i-y)r++;f[q] = i;}}cout<<r<<endl;}return 0;}
Python:
import mathn = int(raw_input())f = [-100000 for i in range(0, 100001)]for j in range(0, n):x, y = tuple(int(i) for i in raw_input().strip().split(" "))c = 0for i in xrange(1, int(math.sqrt(x)+1)):if x%i==0:q = x/ip = iif(f[p]<j-y):c+=1f[p] = jif(f[q]<j-y):c+=1f[q] = jprint c
However in some cases it may happen that you've missed some better approach to the problem.
It is not honest to give more time for java/python programmers. Imagine the light athletics competition. If some sportsman prefer to wear foot fins instead of normal shoes - does it mean that all other sprinters should give him more time?
I personally use java, but I never would complain about TLE for my solutions. My favorite language is my choice and it is my responsibility!
And by the way remember - Petr uses Java - and wins anyway!