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

Code 1:
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
#define int long long
#define fr(i,a,b) for(int i=a;i<b;i++)

int power(int a, int b) {
    int result = 1;
    while (b) {
        if (b & 1) 
            result = result * a;
        a = a * a;
        b >>= 1;
    }
    return result;
}
int log_a_base_b(int a , int b){
    int cnt=0;
    while(a!=0){
        a/=b;
        cnt++;
    }
    return cnt;
}
void solve(){
    int n,m;
    cin >> n>>m ;
    multiset<int> s1;
    multiset<int> s2;
    fr(i,0,n){
        int x;
        cin>>x;
        s1.insert(x);
    }
    fr(i,0,m){
        int x;
        cin>>x;
        s2.insert(x);
    }
    // int f=1;
    while(!s1.empty() && !s2.empty()){
        auto it1=--s1.end(),it2=--s2.end();
        if(*it2>*it1){
            int x=floor((*it2)*1.0/2);
            int y=ceil((*it2)*1.0/2);
            s2.erase(it2);
            s2.insert(x);
            s2.insert(y);
            // cout<<x<<" "<<y;
        }
        else{
            if(*it2==*it1){
                s1.erase(it1);
                s2.erase(it2);
                // cout<<" = "  << *it1<<" = ";
            }
            else{
                // f=0;
                break;
            }
        }
        if(s2.size()>s1.size()){
            // f=0;
            break;
        }
    }
    // if(!f) cout<<"No"<<endl;
    // else{
        if(s1.empty() && s2.empty()){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    // }
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif
    int t;
    cin >> t;
    while(t--)
    {
        solve();
    }
}

Code 2:
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
#define int long long
#define fr(i,a,b) for(int i=a;i<b;i++)

int power(int a, int b) {
    int result = 1;
    while (b) {
        if (b & 1) 
            result = result * a;
        a = a * a;
        b >>= 1;
    }
    return result;
}
int log_a_base_b(int a , int b){
    int cnt=0;
    while(a!=0){
        a/=b;
        cnt++;
    }
    return cnt;
}
void solve(){
    int n,m;
    cin >> n>>m ;
    multiset<int> s1;
    multiset<int> s2;
    fr(i,0,n){
        int x;
        cin>>x;
        s1.insert(x);
    }
    fr(i,0,m){
        int x;
        cin>>x;
        s2.insert(x);
    }
    // int f=1;
    while(!s1.empty() && !s2.empty()){
        auto it1=--s1.end(),it2=--s2.end();
        if(*it2>*it1){
            s2.erase(it2);
            int x=floor((*it2)*1.0/2);
            int y=ceil((*it2)*1.0/2);
            s2.insert(x);
            s2.insert(y);
            // cout<<x<<" "<<y;
        }
        else{
            if(*it2==*it1){
                s1.erase(it1);
                s2.erase(it2);
                // cout<<" = "  << *it1<<" = ";
            }
            else{
                // f=0;
                break;
            }
        }
        if(s2.size()>s1.size()){
            // f=0;
            break;
        }
    }
    // if(!f) cout<<"No"<<endl;
    // else{
        if(s1.empty() && s2.empty()){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    // }
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif
    int t;
    cin >> t;
    while(t--)
    {
        solve();
    }
}

Answer: 1