WHY RUN TIME ERROR?..please help i am trying to output the ith prime number but i keep gettng run time error.i can run the code in an offline compiler but not in a online compiler
#include<bits/stdc++.h>
using namespace std;
vector<long long>prima;
long long int SieveOfEratosthenes(){
bool prime[1000006];
for (long long int p = 2; p <= 1000000; p++) {
if (prime[p]==false){
prima.push_back(p);
for (long long int i = p * p; i <= 1000000; i += p){
prime[i] = true;
}
}
}
}
int main(){
long t;
cin>>t;
SieveOfEratosthenes();
while(t--){
long long int k;
cin>>k;
cout<<prima[k-1];
}
return 0;
}