Why am i getting a run error? output seems to be corrwct

#include
using namespace std;
int main()
{
int t;
int N;
int a[1000];
int cs=0,ms=0;
cin>>t;
for(int i=0;i<t;i++)
{cin>>N;
for(int j=0;j<N;j++)
{cin>>a[j];
}
for(int j=0;j<N;j++)
{cs=cs+a[j];
if(cs<0){
cs=0;}
ms=max(cs,ms);
}
cout<<ms<<endl;
}
return 0;

}

@hey Bhavya basically this problem having large constraint so to resolve the run error see constraints carefully