Can anyone figure out why this code is getting only partial points. problem : CHFICRM of june long challenge
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t–)
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
cin>>a[i];
int c5=0,c10=0;
bool flag=true;
for(int i=0;i<n;i++)
{
if(a[i]==5)
{
c5++;
}
if(a[i]==10)
{
if(c5==0)
{
flag=false;
break;
}
else
{
c10++;
c5--;
}
}
if(a[i]==15)
{
if(c5>=2)
{
c5=c5-2;
}
else if(c10>0)
{
c10--;
}
else
{
flag=false;
break;
}
}
}
if(flag)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}