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

Code 1:
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 10;
int a[N], b[N];
multiset<int> s;
int find(int x){
    int y = x / 2;
    int z = ceil(x / 2.0);
    if(y == z){
        auto xx = s.lower_bound(y);
        if(xx != s.end() && *xx == y){
            s.erase(xx);
            auto yy = s.lower_bound(y);
            if(yy != s.end() && *yy == y) return 1;
            int f = find(y);
            if(f) return 1;
            return 0;
        }
        int f = find(y);
        if(f){
            f = find(y);
            if(f) return 1;
            return 0;
        }
        return 0;
    }
    auto yy = s.lower_bound(y);
    auto zz = s.lower_bound(z);
    int fy = 0, fz = 0;
    if(yy == s.end() || *yy != y) fy = 1;
    if(zz == s.end() || *zz != z) fz = 1;
    if(fy && y < *(s.begin())) return 0;
    if(fz && z < *(s.begin())) return 0;
    if(fy && fz){
        int f = find(y), g = find(z);
        if(f && g) return 1;
        return 0;
    }
    else if(fy && !fz){
        s.erase(zz);
        int f = find(y);
        if(f) return 1;
        return 0;
    }
    else if(!fy && fz){
        s.erase(yy);
        int g = find(z);
        if(g) return 1;
        return 0;
    }
    else{
        s.erase(yy); s.erase(zz);
        return 1;
    }
}
int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    int t;
    cin >> t;
    while(t --){
        int n, m;
        cin >> n >> m;
        s.clear();
        ll s1 = 0, s2 = 0;
        for (int i = 1; i <= n; i++) {
            cin >> a[i];
            s1 += a[i];
            s.insert(a[i]);
        }
        for (int i = 1; i <= m; i++) cin >> b[i], s2 += b[i];
        if(s1 != s2){cout << "No" << '\n'; continue;}
        sort(b + 1, b + m);
        int res = 0;
        for (int i = m; i >= 1; i--){
            int x = b[i];
            int f = 0;
            auto y = s.lower_bound(x);
            if(y == s.end()){
                int f = find(x);
                if(!f) {res = 1; break;}
            }
            else{
                s.erase(y);
            }
            
        }
        if(!res) cout << "Yes" << '\n';
        else cout << "No" << '\n';
    }
}

Code 2:
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int N = 2e5 + 10;
int a[N], b[N];
multiset<int> s;
int find(int x){
    int y = x / 2;
    int z = ceil(x / 2.0);
    // cout << y << ' ' << z << '\n';
    if(y == z){
        auto xx = s.lower_bound(y);
        if(xx != s.end() && *xx == y){
            s.erase(xx);
            auto yy = s.lower_bound(y);
            if(y < *(s.begin())) return 0;
            if(yy != s.end() && *yy == y) {
                s.erase(yy);
                return 1;
            }
            int f = find(y);
            if(f) return 1;
            return 0;
        }
        if(y < *(s.begin())) return 0;
        int f = find(y);
        if(f){
            f = find(y);
            if(f) return 1;
            return 0;
        }
        return 0;
    }
    auto yy = s.lower_bound(y);
    auto zz = s.lower_bound(z);
    int fy = 0, fz = 0;
    if(yy == s.end() || *yy != y) fy = 1;
    if(zz == s.end() || *zz != z) fz = 1;
    if(fy && y < *(s.begin())) return 0;
    if(fz && z < *(s.begin())) return 0;
    if(fy && fz){
        int f = find(y), g = find(z);
        if(f && g) return 1;
        return 0;
    }
    else if(fy && !fz){
        s.erase(zz);
        int f = find(y);
        if(f) return 1;
        return 0;
    }
    else if(!fy && fz){
        s.erase(yy);
        int g = find(z);
        if(g) return 1;
        return 0;
    }
    else{
        s.erase(yy); s.erase(zz);
        return 1;
    }
}
int main(){
    ios::sync_with_stdio(0); cin.tie(0);
    int t;
    cin >> t;
    while(t --){
        int n, m;
        cin >> n >> m;
        s.clear();
        ll s1 = 0, s2 = 0;
        for (int i = 1; i <= n; i++) {
            cin >> a[i];
            s1 += a[i];
            s.insert(a[i]);
        }
        for (int i = 1; i <= m; i++) cin >> b[i], s2 += b[i];
        if(s1 != s2){cout << "No" << '\n'; continue;}
        sort(b + 1, b + m + 1);
        int res = 0;
        for (int i = m; i >= 1; i--){
            int x = b[i];
            int f = 0;
            auto y = s.lower_bound(x);
            if(y == s.end() || *y != x){
                int f = find(x);
                if(!f) {res = 1; break;}
            }
            else{
                s.erase(y);
            }
            
        }
        if(!res) cout << "Yes" << '\n';
        else cout << "No" << '\n';
    }
}

Answer: 2