Whats wrong in it?

#include
#include
using namespace std;
int main() {
int n;
cin>>n;
int a[1000];
int cs=0;
int ms=0;

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

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


return 0;

}

hello @deepteaman

pls check the input format , u are given t test cases and so u need to run this logic for t times.

pls save ur code at cb ide and share its url with me so that i can modify

check now-

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.