I couldn't just pass the first test case

please help

instead of iterating over p for each test case, make an array such that ith index of array corresponds to ith prime number, so you’d be able to answer each query in O(1) instead of O(n)

I did that still it was showing some error

Check this out.I did that method

Bro check please ASAP

it is passing all the test cases

Bro it isn’t. Please check and revert back

try submitting on this link
https://hack.codingblocks.com/app/contests/1597/67/problem

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.