Not getting correct output

#include
using namespace std;
int main() {
int m;
cin>>m;
int n;
cin>>n;
int a[1000];
int cs,ms=0;
for(int j=0;j<m;j++){
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;
}

hi @kartikayasija7057
I have corrected ur code https://ide.codingblocks.com/s/642906
its passing all test cases 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.