I am getting error in 4 test cases pls help me with this
this is my code
#include<bits/stdc++.h>
using namespace std;
#define MAX 5000000
bool isPrime[MAX];
int sieveOfEratosthenes(int n){
vector<int>ans;
for(int i=0;i<=MAX;i++){
isPrime[i]=true;
}
isPrime[0]=false;
isPrime[1]=false;
for(int i=2;i*i<=MAX;i++){
if(isPrime[i]==true){
ans.push_back(i);
for(int j=i*i;j<=MAX;j+=i){
isPrime[j]=false;
}
}
}
return ans[n-1];
}
int main(){
int n;
cin>>n;
int nthPrime = sieveOfEratosthenes(n);
cout<<nthPrime<<endl;
return 0;
}