Test cases are not passing

#include
using namespace std;
const int len = 50000;
int main() {
int arr[5000] = {0};
for (int i = 2; i < 5000; i++) {
for (int j = i * i; j < 30; j+=i) {
arr[j - 1] = 1;
}
}
int k=2;
int arr2[3000]={0};
arr2[1]=2;
for (int i = 1; i < 3000; i++) {
if (arr[i]!=0)
{
arr2[k]=i;
k++;
}

}
int n;
cin>>n;
cout<<arr2[n];
return 0;
}

Jatin, I would suggest you to first go through the prime seive optimisation given in online video lecture series of the course and then edit your code accordingly.