I am getting the correct output but it says "Runtime error". Please help

#include
using namespace std;

bool prime(int n){
int u=n;
for(int i=2;i<u;i++){
if(n%i==0){

		return 0;
       
    }
	u=(n/i)+1;
}

return 1;

}

int main()
{
short int T;
cin>>T;
int N[T];
int big=0;
for(int i=0;i<T;i++){
cin>>N[i];
if(N[i]>big)
big=N[i];
}
int count=0;
int stock[1000000];
for(int i=2;count<=big;i++){
if(prime(i)){
stock[count]=i;
count++;
}
}
for(int i=0;i<T;i++){
cout<<stock[N[i]-1]<<endl;
}

return 1;

}

Plz send your code by saving on ide

Thanks.

You have to use prime seive optimisation in your code as given in online video lectures, plz include that in your code to prevent runtime error