 # codeforces 842A tle in python correct in c++/java

l,r,x,y,k=map(int,raw_input().split())
for i in range(x,y+1):
if ik>=l and ik<=r:
i=0
break
if i==0:
print “YES”
else:
print “NO”
my python code gives tle , while the solution of others gave correct when wrote in c++ or java , y so ?

uwi’s code is below

``````void solve()
{
long l = nl(), r = nl();
long x = nl(), y = nl();
long K = nl();
for(long i = x;i <= y;i++){
if(l <= K*i && K*i <= r){
out.println("YES");
return;
}
}
out.println("NO");

it has the same logic
``````

if anyone can hint me where i am wrong?

It’s just that python is slow… And Codeforces does not give any advantages to python solutions over c++ solution like other platforms do(CodeChef, HackerEarth etc.) For experiment… Try to run simple loop in python and in c++ and check how much time It will take to run… For python, you can increase loop upto 10^7 in ~2 second, but in c++ this can be increased upto 10^9. For problem you are talking about, upper limit on l,r,x,y was 10^7 and Time limit given in question was 2 second, on my computer this solution is taking just more than 2 seconds, ~2.055 seconds, so You got TLE. Try this test case…

1 1 2 10000000 10000000

//