Maximum circular sum

This code is giving correct answers in all cases i tested but it’s not passing any of the test cases.
#include
using namespace std;
int main() {
int n,t;
cin>>t;
for(int b=0;b<t;b++){
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
int cs = 0,c=0;
int ms =a[0];
for(int i=0;i<n;i++){
if(i==n-1 && c==1){
break;
}
cs += a[i];
if(cs<0){
cs =0;
}
if(cs>ms){
ms =cs;
}
if(i==n-1){
i=-1;
c=1;
}
}
cout<<ms<<endl;

}
}

@payal_05
i have corrected your code.refer to this