For the problem Chef and Weird Queries was something wrong with compiler? First I submitted in Python and I got TLE. I tried 4 times. In the last, I submitted the same logic in C language and got AC. Can anyone tell why it happened? Complexity of Algorithm doesn’t change after that I got TLE so penalty.

This is my Python2 solution

```
import math
for _ in xrange(input()):
y=input()
k=0
for i in range(1,701):
p=y-i
if p<0:
break
a=int(math.sqrt(p))
k+=a
print k
```

Here is my C solution

```
\#include "stdio.h"
\#include "math.h"
int main()
{
long long int i,j,t,a,k,y;
scanf("%lld", &t);
for(i=1;i<=t;i++)
{
scanf("%lld", &y);
k=0;
for(j=1;j<=700;j++)
{
long long int p = y-i;
if(p<0) break;
a = (int)math.sqrt(p);
k+=a;
}
printf("%lld", k);
if(i!=t) printf("\n");
}
return 0;
}
```