Why am i getting run error in 2nd and third case

for local ide I am getting the correct answer but run error in this online ide

hey @ashutosh2 Your code is not giving any error it is giving TLE that is Time limit exceeded.Since your code is not efficient for bigger testcases you have to use efficient approach for this question which is SOE(sieve of eratosthenes).

https://ide.codingblocks.com/s/647751 this is my code I have used SOE

https://ide.codingblocks.com/s/647751 this is my code I have used SOE

@ashutosh2 your code is giving Run error because your array size is is not fitted for the case when no. to be checked is 1000000.
So increase your array size.

Still the same error can you provide the changed code

@ashutosh2 I have replied you on chat.

hello @ashutosh2 is your doubt cleared?

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.