Deepak and prime

why this code is giving wrong ans in all of the test cases

Your code is giving segmentation fault.This is because you are making an array of size with order 10^7 inside the main wheres as the maxm allowed is of order 10^6. If you declare this array as global then the maximum size allowed is 10^7.
You can refer this https://ide.codingblocks.com/s/285203

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.