How to solve run time error

I have written this code
but it is showing run time error for every case

#include
using namespace std;

int main()
{
int a[100],b[100],k,i,j,cs,ms,n;
cin>>k;
for(i=0;i<k;i++)
{
cin>>n;
for(j=0;j<n;j++)
cin>>a[j];
cs=ms=0;
for(j=0;j<n;j++)
{
cs+=a[j];
if(cs<0)
cs=0;
ms=max(cs,ms);
}
b[i]=ms;
}
for(i=0;i<k;i++)
cout<<b[i]<<endl;
}

Hey @ckaushik1799
Update array sizes according to the question

int a[100000],b[100000],k,i,j,cs,ms,n;

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.