Pls check what is wrong in the code
ITS SHOWING RUNTIME ERROR
@sneha23 this is because the test cases are very large and you making an integer array .
as you only have to store 0 and 1 bitset array would be fine .
you can declare the bitset array like this
bitset<100000>p(0);
and this will help you a lot .
this is showing run error because 49999th prime number is 611951.
you code is not passing this as test cases can be even larger .
i could not understand the way you declared the array
can you please explain it?
@sneha23 wait i am giving you the simple code which can handle test cases upto 1e8 .
try this i have done this with the help of the boolean array .
Happy Learning !!