Prime Visits run time error coming

https://hack.codingblocks.com/app/practice/3/1039/problem
I was trying this problem on hackerblocks.
I have used prime sieve and that too only once.
Also I am implementing my queries in O(1)time.
But still it gives run time error in third case.
Please tell what’s wrong in my code
My code:https://ide.codingblocks.com/s/366012

also if I increase the size of my array then none of the cases pass. All three test cases then show run time error

hello @gaganwalia212

check now->

Thank You Sir. Its working now…

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.