Is any better code for this problem beacuse this code shows TLE error?

#include
#include
using namespace std;
int main() {
int test,i,j,k,m,n,ms,cs=INT_MIN;
cin>>test;
for(k=0;k<test;k++)
{
cin>>m;
int cumsum[m],a[m];
cin>>a[0];
cumsum[0]=a[0];
for(i=1;i<m;i++)
{
cin>>a[i];
cumsum[i]=cumsum[i-1]+a[i];
}
ms=cumsum[0];
for(i=0;i<m;i++)
{
for(j=i;j<m;j++)
{
if(i==0)
cs=cumsum[j];
else
cs=cumsum[j]-cumsum[i-1];
ms=max(cs,ms);
}
}
cout<<ms<<endl;

}
return 0;

}

and what is the meaning of contiguous subarray ??

hello @anujsharmabadboy
yeah we have a better algorithm for this problem .it is kadane algorithm . it works in O(n).
it is covered in ur course .pls check the same playlist.

yes, i know that but it will not work when sum is -ve and in question it is not given that sum will never be -ve
???

intialise ur max sum with any array value it will work.

can you provide me that code, kadane’s algorithm that can work if sum is -ve ??