Geting the error in first two test cases

#include
#include <bits/stdc++.h>
using namespace std;
int main() {
long long int n;
cin>>n;
long long int z=nn2;
long long int sv[z]={0};
sv[0]=1;
sv[1]=1;
//int x=n;
//x++;
for(long long int i=2;i<=z;i++)
{
if(sv[i]==0)
for(long long int j=2*i;j<=z;j=j+i)
sv[j]=1;
}
vector v2;
for(long long int i=0;i<=z;i++)
{
if(sv[i]==0)
v2.push_back(i);
}
cout<<v2[n-1];
}

You have to use Prime Sieve here.Only then it will pass all the test cases.
Refer these:


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.