SURPRISINGLY FAILED TEST-CASES

THIS CODE WHICH IS GIVING PERFECT ANSWER ON MY LOCAL COMPILER AND ALSO GIVING THE ANSWER FOR THE GIVEN SAMPLE CASE .
STILL FAILING ALL THE TEST CASES.

THE CODE IS

#include
#include
using namespace std;
int main() {
int n;
cin>>n;
int brr[1000];
for(int i = 0;i<n;i++){
int New;
int arr[1000];
int cs=0;
int ms=0;
cin>>New;
for(int j=0;j<New;j++){
cin>>arr[j];

	}
	for(int j =0;j<New;j++){
		cs=cs+arr[j];
		if(cs<0){
			cs=0;
		}
		ms=max(cs,ms);
	}
	brr[i]=ms;
	
	
	


}
for(int i=0;i<n;i++){
		cout<<brr[i]<<endl;
	}
	

return 0;

}

check maiximum value of new and declare ur array arr with size greater than that.

also
initialise ur ms with arr[0] (this is done to handle negative cases as well)