Problem: 2061D - Kevin and Numbers
Language: c++23 

Code 1:
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include  "../debug.cpp"
#else
#define debug(...)
#define debugArr(...)
#endif

#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define ff first
#define ss second
#define pb push_back
#define BIG 998244353
#define MOD 1000000007
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvi;

void solve() {
    int n,m;
    cin >> n >> m;

    vi a(n), b(m);
    map<ll,ll> freq;
    ll cnt = n;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        freq[a[i]]++;
    }

    priority_queue<ll, vi, greater<ll>> pq;
    for (int i = 0; i < m; i++) {
        cin >> b[i];
        pq.push(b[i]);
    }

    while (!pq.empty()) {
        ll x = pq.top();
        pq.pop();
        
        if (x==0) {
            cout << "No\n";
            return;
        }

        if (freq.find(x)!=freq.end() && freq[x]) {
            freq[x]--;
            cnt--;
            continue;
        }
        else {
            ll a = x/2;
            ll b = (x+1)/2;
            pq.push(a);
            pq.push(b);
        }
    }

    if (cnt==0) cout << "Yes\n";
    else cout << "No\n";
}   

int main() {
    auto start = chrono::high_resolution_clock::now();
    fast_io;
    int t;
    cin >> t;

    while (t--) {
        solve();
    }

    #ifdef LOCAL
        auto end = chrono::high_resolution_clock::now();
        chrono::duration<double> duration = end - start;
        cerr << "Execution time: " << duration.count() << " seconds" << endl;
    #endif
}


Code 2:
#include <bits/stdc++.h>
using namespace std;

#ifdef LOCAL
#include  "../debug.cpp"
#else
#define debug(...)
#define debugArr(...)
#endif

#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define ff first
#define ss second
#define pb push_back
#define BIG 998244353
#define MOD 1000000007
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpii;
typedef vector<vi> vvi;

void solve() {
    int n,m;
    cin >> n >> m;

    vi a(n), b(m);
    for (int i = 0; i < n; i++)
        cin >> a[i];

    map<ll,ll> freq;
    ll mx = 0;
    for (int i = 0; i < m; i++) {
        cin >> b[i];
        mx = max(mx,b[i]);
        freq[b[i]]++;
    }

    if (n<m) {
        cout << "No\n";
        return;
    }

    ll cnt = m;
    priority_queue<ll, vi, greater<ll>> pq;
    for (int i = 0; i < n; i++) {
        if (freq.find(a[i])!=freq.end() && freq[a[i]]) {
            freq[a[i]]--;
            cnt--;
        }
        else pq.push(a[i]);
    }

    while (sz(pq)>1) {
        ll x = pq.top();
        pq.pop();
        ll y = pq.top();
        pq.pop();

        if (y-x>1 || y+x>mx) {
            cout << "No\n";
            return;
        }

        y += x;
        if (freq.find(y)!=freq.end() && freq[y]) {
            freq[y]--;
            cnt--;
        }
        else pq.push(y);
    }

    if (cnt==0 && sz(pq)==0) cout << "Yes\n";
    else cout << "No\n";
}   

int main() {
    auto start = chrono::high_resolution_clock::now();
    fast_io;
    int t;
    cin >> t;

    while (t--) {
        solve();
    }

    #ifdef LOCAL
        auto end = chrono::high_resolution_clock::now();
        chrono::duration<double> duration = end - start;
        cerr << "Execution time: " << duration.count() << " seconds" << endl;
    #endif
}


Answer: 1