What is wrong with this code

#include
using namespace std;
int main() {
long long int t,cs=0,ms=0;;
cin>>t;
while(t–)
{ cs=0;
ms=0;
long long int n;
cin>>n;
long long int a[10000];
for(int i=0;i<n;i++)
{
cin>>a[i];}
int l=0;
int h=n-1;
cs=cs+a[h];
if(cs<0)
{
cs=0;
}
while(l<h)
{ cs=cs+a[l];
if(cs<0)
{
cs=0;
}
ms=max(ms,cs);
l++;
}
cout<<ms<<endl;
}
return 0;
}

the logic does not seem to be correct

u can read about the easiest approach in this post