Deepak and primes


sir few test cases are failing please help

Hey @Shivanchal-Agarwal-2530139037020445
You made some errors in copying the code
Your loop was upto B while it should have been till sqr(B) + 1
You called prime sieve for each test case which was inefficient and caused TLE

sir this code on submtting is giving wrong answer


sir this code is working fine but why is it giving tle now?

@Shivanchal-Agarwal-2530139037020445
Some more optimisations need to be done
This is the editorial code
Please have a look at this

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.