What is the error

#include
using namespace std;
int main()
{
int t;
cin>>t;
while(t–){
int n;
long long int arr[1000000005];
cin>>n;
for(int i=0;i<=n;i++)
{
cin>>arr[i];
}
int startsum=arr[0];
int endsum=arr[0];
for(int i=0;i<=n;i++)
{
endsum+=arr[i];
if(endsum<0)
{
endsum=0;
break;
}
if(startsum<endsum)
{
startsum=endsum;
}

}
cout<<endsum<<endl;

}
	return 0;

}

@shdanish1508 hey, hey remove break line from if(endsum<0) bracket,it will give correct ans.

@shdanish1508 upar header file puri kro and array ka size n tk lo only itni bada array lia hua hai and 0 se less than n tk input lenge and niche wali loop bhi less than n tk chlegi equal to hta do ,ye sab changes krdo yiu will run it.

It is showing the error