Prime Visits / getting TLE
wait i`ll help u out
just run it from n to n1 do not go for the count1 - count approach
also since a & b can be at max1000000
take the for loop in the sieve atleast 1 beyond this limit else u`ll encounter time limit
code updated
Compute the sieve array before taking any inputs for the test cases. This is to make sure that it is not computed again and again for all the test cases.
why should we take atleast 1 beyond the limit ?
because a & b have upper bound 1000000 so they can assume these values
and when i ran the code till i <= 1000000 it gave me tle so… i chose to increase the limit a bit
how is tle related to increment in limit? i didn’t understand
i did it through hit and trial, i have no possible explanation for this
anyway, thank you 
after several hit and trials
of submissions , I found that TLE was because of if() [line no 20 of your code ] condition that I missed.
thank you.
what is wrong with line 20 ??
Nothing. I missed that line in my code which later resulted in TLE.
ok thanks for telling
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
