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

Code 1:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds;

#pragma GCC optimize("O3,unroll-loops")

using ll = long long;
using ld = long double;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

constexpr ll inf=2e18;
constexpr ld eps=1e-9;
constexpr ll mod=1e9+7;

#define F first
#define S second
#define int long long
#define pb push_back
#define all(x) x.begin(), x.end()

template<typename T>
istream& operator>>(istream &istream, vector<T> &v)
{
	for(auto &it : v)
		cin>>it;
	return istream;
}

template<typename T>
ostream& operator<<(ostream &ostream, const vector<T> &c)
{
	for(auto &it : c)
		cout<<it<<" ";
	return ostream;
}

vector<int> fact_dp(2e5+2,-1);

int binpow(int a, int b, int m=mod)
{
	if(b==0)
		return 1;

	int x = binpow(a,b/2);
	if(b&1)
		return ((x*x)%m*a)%m;
	return (x*x)%m;
}

int modinv(int x, int m=mod)
{
	return binpow(x,m-2,m);
}

int fact(int x){
	if(x<=1) return 1;
	if(fact_dp[x] != -1) return fact_dp[x];

	return fact_dp[x] = (x%mod * fact(x-1)%mod)%mod;
}

int nCr(int n, int r){
	int x = (modinv(fact(r)) * modinv(fact(n-r)))%mod;
	int y = fact(n);
	return (x*y)%mod;
}

void solve()
{
	int n, m;
	cin >> n >> m;
	vector<int> a(n), b(m);
	cin >> a >> b;
	sort(all(a));
	sort(all(b));

	priority_queue<int, vector<int>, greater<int>> q;
	for(auto it : a){
		q.push(it);
	}

	int j = 0;
	while(!q.empty() && j<m){
		int cur = q.top();
		q.pop();

		if(cur==b[j]) j++;
		else{
			if(q.empty()){
				cout << "NO\n";
				return;
			}else{
				int cur2=q.top();

				if(abs(cur2-cur)<=1){
					q.pop();
					q.push(cur+cur2);
				}else{
					cout << "NO\n";
					return;
				}
			}
		}
	}

	if(q.empty() && j==m){
		cout << "YES\n";
	}else{
		cout << "NO\n";
	}
}

signed main()
{
#ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << setprecision(12) << fixed;

	int t=1;
	cin>>t;
	while(t--){
		solve();
	}

	return 0;
}

Code 2:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds;

#pragma GCC optimize("O3,unroll-loops")

using ll = long long;
using ld = long double;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

constexpr ll inf=2e18;
constexpr ld eps=1e-9;
constexpr ll mod=1e9+7;

#define F first
#define S second
#define int long long
#define pb push_back
#define all(x) x.begin(), x.end()

template<typename T>
istream& operator>>(istream &istream, vector<T> &v)
{
	for(auto &it : v)
		cin>>it;
	return istream;
}

template<typename T>
ostream& operator<<(ostream &ostream, const vector<T> &c)
{
	for(auto &it : c)
		cout<<it<<" ";
	return ostream;
}

vector<int> fact_dp(2e5+2,-1);

int binpow(int a, int b, int m=mod)
{
	if(b==0)
		return 1;

	int x = binpow(a,b/2);
	if(b&1)
		return ((x*x)%m*a)%m;
	return (x*x)%m;
}

int modinv(int x, int m=mod)
{
	return binpow(x,m-2,m);
}

int fact(int x){
	if(x<=1) return 1;
	if(fact_dp[x] != -1) return fact_dp[x];

	return fact_dp[x] = (x%mod * fact(x-1)%mod)%mod;
}

int nCr(int n, int r){
	int x = (modinv(fact(r)) * modinv(fact(n-r)))%mod;
	int y = fact(n);
	return (x*y)%mod;
}

void solve()
{
	int n, m;
	cin >> n >> m;
	priority_queue<int> a, b;
	for(int i = 0 ; i < n ; i++){
		int x ; cin >> x;
		a.push(x);
	}
	for(int i = 0 ; i < m ; i++){
		int x ; cin >> x;
		b.push(x);
	}

	while(!b.empty() && !a.empty()){

		if(a.size()<b.size()){
			cout << "NO\n";
			return;
		}

		int btop = b.top(), atop = a.top();
		b.pop();
		if(btop==atop){
			a.pop();
		}else{
			b.push(btop/2);
			b.push((btop+1)/2);
		}
	}



	if(a.empty() && b.empty())cout << "YES\n";
	else cout << "NO\n";
}

signed main()
{
#ifndef ONLINE_JUDGE
    freopen("input1.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
#endif

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << setprecision(12) << fixed;

	int t=1;
	cin>>t;
	while(t--){
		solve();
	}

	return 0;
}

Answer: 2