I have used sieve of eratothenes,but still it is not working
Prateek loves candy TLE error
@dsingh200021
You shouldn’t compute Sieve in every iteration of the testcase. That defies the purpose of it.
Sieve is used to precompute the prime numbers so only run the loop for Sieve once as the prime numbers are going to remain the same.
Once you are done with Sieve , then take the input for testcases and run the testcase loop .