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

Code 1:
#include <bits/stdc++.h>
#define int long long
#define F first
#define S second
#define pb push_back
#define endl "\n"
const int mod = 1e9 + 7;
const int N = 300000 + 10;
using namespace std;
typedef pair<int, int> pi;
int n, m, k;
int a[N], b[N];
char c[4][4];
int gcd(int A, int b) {
    return b ? gcd(b, A % b) : A;
}
string s, s1, s2;
map<int, int>mp;
int qsm(int a, int b) {//a/b%mod,快速幂，费马小定理
    int ans = 1;
    while (b) {
        if (b & 1) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    } return ans;
}int x, y;
priority_queue<int,vector<int>, greater<int>>q;
bool cmp(int x, int y) {
    return x < y;
}
struct pai{
    int x, y;
}d[N];
void solve() {
    cin >> n >> m;
    int maxx = -1;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    while (!q.empty()) {
        q.pop();
    }
    for (int i = 1; i <= m; i++) {
        int u;
        cin >> u;
        q.push(u);
    }
    mp.clear();
    for (int i = 1; i <= n; i++) {
        if (mp.find(a[i]) != mp.end()) {
            mp[a[i]]++;
        }
        else {
            mp[a[i]] = 1;
        }
    }
    while (!q.empty()) {
        int u = q.top();
        q.pop();
        if (mp[u] > 0) {
            mp[u]--;
        }
        else {
            if (u == 1) {
                cout << "No" << endl;
                return;
            }
            else {
                if (u % 2 == 1) {
                    q.push(u / 2);
                    q.push(u / 2 + 1);
                }
                else {
                    q.push(u / 2);
                    q.push(u / 2);
                }
            }
        }
    }
    for (auto i : mp) {
        if (i.second > 0) {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12);  // 小数保留位数
    int t = 1;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Code 2:
#include <bits/stdc++.h>
#define int long long
#define F first
#define S second
#define pb push_back
#define endl "\n"
const int mod = 1e9 + 7;
const int N = 300000 + 10;
using namespace std;
typedef pair<int, int> pi;
int n, m, k;
int a[N], b[N];
char c[4][4];
int gcd(int A, int b) {
    return b ? gcd(b, A % b) : A;
}
string s, s1, s2;
map<int, int>mp;
int qsm(int a, int b) {//a/b%mod,快速幂，费马小定理
    int ans = 1;
    while (b) {
        if (b & 1) ans = ans * a % mod;
        a = a * a % mod;
        b >>= 1;
    } return ans;
}int x, y;
priority_queue<int>q;//优先队列默认，大顶堆
bool cmp(int x, int y) {
    return x < y;
}
struct pai{
    int x, y;
}d[N];
void solve() {
    cin >> n >> m;
    if (m ==1&&n==1) {
        int aaa, bbb;
        cin >> aaa >> bbb;
        if (aaa == bbb) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
        return;
    }
    int maxx = -1;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    while (!q.empty()) {
        q.pop();
    }
    for (int i = 1; i <= m; i++) {
        int u;
        cin >> u;
        q.push(u);
    }
    mp.clear();
    for (int i = 1; i <= n; i++) {
        if (mp.find(a[i]) != mp.end()) {
            mp[a[i]]++;
        }
        else {
            mp[a[i]] = 1;
        }
    }
    while (!q.empty()) {
        int u = q.top();
        q.pop();
        if (mp[u] > 0) {
            mp[u]--;
        }
        else {
            if (u == 1) {
                cout << "No" << endl;
                return;
            }
            else {
                if (u % 2 == 1) {
                    q.push(u / 2);
                    q.push(u / 2 + 1);
                }
                else {
                    q.push(u / 2);
                    q.push(u / 2);
                }
            }
        }
    }
    for (auto i : mp) {
        if (i.second > 0) {
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(12);  // 小数保留位数
    int t = 1;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Answer: 1