My issue
what can be done here as it is failing a test case ??
My code
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--)
{
int n,x,A=0;
cin>>n>>x;
int arr[n];
int arr1[n];
for(int i=0;i<n;i++) cin>>arr[i];
for(int i=0;i<n;i++) cin>>arr1[i];
for(int i=0;i<n;i++){
if(arr[i]>arr1[i]) A++;
else{
int x1=arr1[i]-arr[i];
if(x>x1){
x-=x1;
A++;
}
}
}
if(A>n/2) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
}
Problem Link: Elections Practice Coding Problem