My issue
include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t–){
int n,k;
cin>>n>>k;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
int count =0;
for(int i=0;i<n;i++){
if(a[i]%2==0){
count+=1;
}
}
if(count==k){
cout<<"YES"<<endl;
}
else cout<<"NO"<<endl;
}
} what wrong in my code
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
// your code goes here
int t;
cin>>t;
while(t--){
int n,k;
cin>>n>>k;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
int count =0;
for(int i=0;i<n;i++){
if(a[i]%2==0){
count+=1;
}
}
if(count==k){
cout<<"YES"<<endl;
}
else cout<<"NO"<<endl;
}
}
Problem Link: Chef and Gift Practice Coding Problem