Test cases are not passed

//In maximum sub array problem
//here is my code
#include
using namespace std;

int main()
{
int a;
cin>>a;
for(int z=0;z<a;z++)
{
int n,i,j;
cin>>n;
int a[1000];
int cs=0;
int ms=0;

for (int i=0;i<n;i++)
{
    cin>>a[i];
}

//kadane’s Algorithm for maximum subarray sum

for(int i=0;i<n;i++)
{
    cs=cs+a[i];
    if (cs<0)
    {
        cs=0;
    }
    ms=max(cs,ms);
}   

cout<<ms<<endl;
}
return 0;
}

Please send your code in a CB IDE. Its easier to debug that way.

constraints problem occurs sir now I solved thank you but I can share my code on CB IDE

hello @Gajesh-Namdeo-1171329206542221
what issue u r facing?

test cases are not passed sir

share cb link with me , i will check the issue

declare ur array as
long long a[n];

and then it will work fine

1 Like

thank you so much sir