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

Code 1:
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;


#pragma GCC optimize(2)
#define debug(a) cout<<#a<<'='<<a<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repp(i,a,b) for(int i=a ;i<=b;i++)
#define per(i,b,a) for(int i=b;i>a;i--)
#define perr(i,b,a) for(int i=b;i>=a;i--)
#define pii pair<int,int>
#define mm memset
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define INF 0x7fffffffffffffff

const double eps =1e-8;
const int mod=998244353;
const int N=2e5+2;

int a[N];
int b[N];

bool dfs(int x,unordered_map<int,int>&h)
{
    if(x==1)
    {
        if(!h[1])return false;
        h[1]--;return true;
    }
    if(h[x])
    {
        h[x]--;
        return true;
    }
    else
    {
        if(x%2)
        {
            if(!dfs(x/2+1,h))
                return false ;
            if(!dfs(x/2,h))
                return false;
        }
        else
        {
            if(!dfs(x/2,h))
                return false;
            if(!dfs(x/2,h))
                return false;
        }
    }
    return true;
}
void fun(){
    int n,m;
    cin>>n>>m;
    ll sa=0,sb=0;
    unordered_map<int,int>h1,h2;
    repp(i,1,n)cin>>a[i],sa+=a[i],h1[a[i]]++;
    repp(i,1,m)cin>>b[i],sb+=b[i],h2[b[i]]++;
    if(sa!=sb)
    {
        cout<<"No"<<endl;
        return;
    }
    repp(i,1,m)
    {
        ll zong=b[i];
        if(!dfs(zong,h1))
        {
            cout<<"No"<<endl;
            return ;
        }
    }
    cout<<"Yes"<<endl;
    return ;

}

signed main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

	int t=1 ;
	cin>>t;

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



}


Code 2:
#include<bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;


#pragma GCC optimize(2)
#define debug(a) cout<<#a<<'='<<a<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repp(i,a,b) for(int i=a ;i<=b;i++)
#define per(i,b,a) for(int i=b;i>a;i--)
#define perr(i,b,a) for(int i=b;i>=a;i--)
#define pii pair<int,int>
#define mm memset
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define INF 0x7fffffffffffffff

const double eps =1e-8;
const int mod=998244353;
const int N=2e5+2;

int a[N];
int b[N];

bool dfs(int x,map<int,int>&h)
{
    if(x==1)
    {
        if(!h[1])return false;
        h[1]--;return true;
    }
    if(h[x])
    {
        h[x]--;
        return true;
    }
    else
    {
        if(x%2)
        {
            if(!dfs(x/2+1,h))
                return false ;
            if(!dfs(x/2,h))
                return false;
        }
        else
        {
            if(!dfs(x/2,h))
                return false;
            if(!dfs(x/2,h))
                return false;
        }
    }
    return true;
}
void fun(){
    int n,m;
    cin>>n>>m;
    ll sa=0,sb=0;
    map<int,int>h1,h2;
    repp(i,1,n)cin>>a[i],sa+=a[i],h1[a[i]]++;
    repp(i,1,m)cin>>b[i],sb+=b[i],h2[b[i]]++;
    if(sa!=sb)
    {
        cout<<"No"<<endl;
        return;
    }
    repp(i,1,m)
    {
        ll zong=b[i];
        if(!dfs(zong,h1))
        {
            cout<<"No"<<endl;
            return ;
        }
    }
    cout<<"Yes"<<endl;
    return ;

}

signed main(){

    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

	int t=1 ;
	cin>>t;

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



}


Answer: 2