Maximum sub array sum

the code is running perfectly on coding blocks ide and the correct output is coming but on hackerblocks , it shows a run error
#include
#include
using namespace std;
int main() {
int num;
cin>>num;
int i;
for(i=0;i<num;i++){
int n;
int a[n];
cin>>n;
int j;
for(j=0;j<n;j++){
cin>>a[j];
}
int cs=0;
int ms=0;
for(j=0;j<n;j++){
cs=cs+a[j];
if(cs<0)
cs=0;
ms=max(cs,ms);
}

cout<<ms<<endl;

}
return 0;
}

Hey Pritika, check the constraints carefully each element of the array can be of range 10^8, so you are supposed to change the data type of your variable from int to long long int.