Getting error while submitting the code

#include
using namespace std;
int main() {
int n,msum=0,m,sum=0;
cin>>m;
int a[10000];
for(int d=0;d<m;d++){
cin>>n;
for(int i=0;i<n;i++)
{cin>>a[i];
}
for(int i=0;i<n;i++){
for(int j=i;j<n;j++)
{
for(int k=i;k<=j;k++)
{
sum+=a[k];
if(msum<sum)
msum=sum;
}
sum=0;
}
}
cout<<msum<<endl;
msum=0;
}
return 0;
}

@souravkhanna227 this approach will give you a tle try to submit this question using kadanes algorithm

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.