Why is it showing runtime error SIGSTP?


#1

All submissions for this problem are available.You have a stack which is initially empty. You receive instructions of the form 1 or 0. 1 denotes that you have to push in an element, and 0 denotes that you have to pop out an element. But of course you can pop something out only if it exists in the stack. So your job is to look at the instructions and see if they are valid (ie. you never have to pop from an empty stack), or not.

Input
The first line of the input contains a single integers T, which denotes the number of testcases.
The first line of each testcase contains a single integer n, which denotes the number of instructions.
The second line contains n space separated integers, which are all 0 or 1.
Output
For each testcase output either “Valid” or “Invalid”, in a new line.
Constraints
1≤T≤10
1≤n≤105
All instructions are either 0 or 1.
Sample Input
2
5
1 1 0 0 1
5
1 0 0 1 1
Sample Output
Valid
Invalid
My code
include<stdio.h>
int main()
{
int i,t,n;
scanf("%d",&t);
while(t–)
{
scanf("%d",&n);
int a[n];
int popcount=0,pushcount=0,flag=1;
for(i=0;i<n;i++)
{
scanf("%d",&a*);
if(a*==1)
{
pushcount++;
}
else
{
popcount++;
}
if(popcount>pushcount)
{
flag=0;
}
}
if(flag==0)
{
printf("Invalid
");
}
else
printf("Valid
");
}
return(0);
}