My code is failing 1 test case and i am unable to find why so?

My code is - https://ide.codingblocks.com/s/388280

Have debugged your code here, have just increased size too 700000

Why have you increased the size of the array ?

It’s cause of the constraints given in the question the desired size would be 700000

But here it is showing 500000

It’s not mentioned in the question but the prime number
will be of order 10^7 but in your code you were only checking prime till 500000
So that’s why one case was failing

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.