Https://online.codingblocks.com/app/player/97658/content/91222/5057/code-challenge

https://online.codingblocks.com/app/player/97658/content/91222/5057/code-challenge

#include
#include
using namespace std;
void primeSieve(int *p){
long long i,j;

for(i=3;i<1000000;i+=2){
    p[i]=1;
}
for( i=3;i<1000000;i+=2){
 if(p[i]==1){
   for(j=i*i;j<1000000;j=j+i){
       p[j]=0;
   }
}
}
 p[1]=0;

p[2]=1;

}
int main() {
int prime[1000000];
int i;

primeSieve(prime);
vector<int>v;
for(i=0;i<1000000;i++){
	if(prime[i]==1){
     v.push_back(i);

	}
}

int n;
cin>>n;
cout<<v[n-1];

}

2 test cases are not getting passed.
when I take array size 10^8 segment fault