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

Code 1:
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define int long long
#define PII pair<int, int> 
#define _rep(i,a,b) for( int i=(a); i<=(b); ++i)
#define _per(i,a,b) for( int i=(a); i>=(b); --i)
using namespace std;
const int N = 1e6+10 ;
const int M = 1e3+10 ;
const int INF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7  ;
const double eps = 1e-9 ;
int gcd(int a, int b){ return b == 0 ? a : gcd(b, a%b); }
int lcm(int a, int b){ return a * b / gcd(a,b); } 
int qmi(int a, int b){
    int res = 1 ;
    while(b){
        if(b&1) res = a * res % MOD ;
        b >>= 1 ;
        a = a * a % MOD ;
    }
    return res ;
}
int T = 1 ;
int ans = 0 ;
int n , m, k, q ;
int a[N], b[N] ;
map<int,int> mp ;
void dfs(int x){
    if(mp[x]){
        mp[x] -- ;
        
    }else if(x!=1){
        int a = x + 1 >> 1 ;
        int b = x >> 1 ;
        dfs(a) ;
        dfs(b) ;
    }
}
void solve(){
    mp.clear() ;
    cin >> n >> m ;
    int sum = 0 ;
    for(int i = 1; i <= n ; ++ i){
        cin >> a[i] ;
        sum += a[i] ;
        mp[a[i]] ++ ;
    }
    for(int i = 1; i <= m ; ++ i){
        cin >> b[i] ;
        sum -= b[i] ;
    }
    sort(a + 1, a + 1 + n) ;
    sort(b + 1, b + 1 + m) ;
    if(sum != 0 || a[1] > b[1] || b[m] < a[n]){
        cout << "No" << endl ;
        return ;
    }
    for(int i = 1; i <= m ; ++ i){
        dfs(b[i]) ;
    }
    for(auto e: mp){
        if(e.second != 0){
            cout << "No" << endl ;
            return ;
        }
    }
    cout << "Yes" << endl ;
    
    
}
signed main(){
    IOS ;
    cin >> T ;
    while(T --){
        solve() ;
    }
    return 0;
    
}

Code 2:
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define int long long
#define PII pair<int, int> 
#define _rep(i,a,b) for( int i=(a); i<=(b); ++i)
#define _per(i,a,b) for( int i=(a); i>=(b); --i)
using namespace std;
const int N = 1e6+10 ;
const int M = 1e3+10 ;
const int INF = 0x3f3f3f3f3f3f3f3f;
const int MOD = 1e9 + 7  ;
const double eps = 1e-9 ;
int gcd(int a, int b){ return b == 0 ? a : gcd(b, a%b); }
int lcm(int a, int b){ return a * b / gcd(a,b); } 
int qmi(int a, int b){
    int res = 1 ;
    while(b){
        if(b&1) res = a * res % MOD ;
        b >>= 1 ;
        a = a * a % MOD ;
    }
    return res ;
}
int T = 1 ;
int ans = 0 ;
int n , m, k, q ;
int a[N], b[N] ;
map<int,int> mp ;
void dfs(int x){
    if(mp[x]){
        mp[x] -- ;
        
    }else if(x /2 >= a[1]){
        int a = x + 1 >> 1 ;
        int b = x >> 1 ;
        dfs(a) ;
        dfs(b) ;
    }
}
void solve(){
    mp.clear() ;
    cin >> n >> m ;
    int sum = 0 ;
    for(int i = 1; i <= n ; ++ i){
        cin >> a[i] ;
        sum += a[i] ;
        mp[a[i]] ++ ;
    }
    for(int i = 1; i <= m ; ++ i){
        cin >> b[i] ;
        sum -= b[i] ;
    }
    sort(a + 1, a + 1 + n) ;
    sort(b + 1, b + 1 + m) ;
    if(sum != 0 || a[1] > b[1] || b[m] < a[n]){
        cout << "No" << endl ;
        return ;
    }
    for(int i = 1; i <= m ; ++ i){
        dfs(b[i]) ;
    }
    for(auto e: mp){
        if(e.second != 0){
            cout << "No" << endl ;
            return ;
        }
    }
    cout << "Yes" << endl ;
    
    
}
signed main(){
    IOS ;
    cin >> T ;
    while(T --){
        solve() ;
    }
    return 0;
    
}

Answer: 2