I am getting WA with this code, can anyone tell what is going wrong?

```
#include<bits/stdc++.h>
using namespace std;
int main(void) {
int t,N,x,total,temp;
cin>>t;
while(t--)
{
total=0;
cin>>N;
temp=N;
while(temp--)
{
cin>>x;
if(x%2==1)
total+=x/2; //No. of 2's that can be extract from odd numbers(till 1 is left)
else
total+=x/2-1; //No. of 2's from even numbers(till 2 is left)
}
if(total%(N/2)==0) //if number of 2's that were extracted can be distributed equally
cout<<"YES"<<endl;
else
cout<<"NO"<<endl;
}
return 0;
}
```