"Runtime error" but getting output

For the problem “Prateek Loves Candy”, where the input is T test cases with integer N, where N denotes number of primes required.
#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;

}

I am getting output but also says"Run time error"