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

Code 1:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
#include <climits>
#include <algorithm>
#include <functional>
using namespace std;
#define ll long long
#define floop(i, a, b) for (int i = (a); i < (b); i++)
#define vi vector<int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int, int>>
#define pii pair<int, int>
#define all(x) (x).begin(), (x).end()
const ll inf = 1e16;
const int mod = 1e9 + 7;
const int N = 1e6;
ll i = 0, j = 0;
ll n, m;

bool solve(priority_queue<ll> &bb, map<ll, ll> &a)
{
     for (int i = 0; i < (2 * n - m); i++)
     {
          if (bb.empty())
          {
               return false;
          }
          ll num = bb.top();
          bb.pop();

          if (a[num] == 0)
          {
               bb.push(num / 2);
               bb.push((num + 1) / 2);
          }
          else
          {
               a[num]--;
          }
     }
     if (bb.empty())
          return true;
     return false;
}
void ExoticLur3e37()
{
     ll p;
     cin >> n >> m;
     map<ll, ll> a;
     for (i = 0; i < n; i++)
     {
          cin >> p;
          a[p]++;
     }
     vector<ll> b(m);
     // vector<ll> vis(m, 0);
     priority_queue<ll> bb;
     for (i = 0; i < m; i++){
          cin >> b[i];
          bb.push(b[i]);
     }

     // for (int i = 0; i < m; i++)
     // {
     //      int num = b[i];
     //      if (a[num] > 0)
     //      {
     //           a[num]--;
     //           if (a[num] == 0)
     //                a.erase(num);
     //           vis[i] = 1;
     //      }
     // }

     // for (int i = 0; i < m; i++)
     // {
     //      if (!vis[i])
     //           bb.push(b[i]);
     // }

     bool res = solve(bb, a);
     
     res?cout<<"YES":cout<<"NO";
}
int main()
{
     ios_base::sync_with_stdio(0);
     cin.tie(0);
     cout.tie(0);
     ll t;
     cin >> t;
     // t = 1;
     while (t--)
     {
          ExoticLur3e37();
          cout << "\n";
     }
}

Code 2:
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <stack>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
#include <random>
#include <bitset>
#include <array>
#include <climits>
#include <algorithm>
#include <functional>
using namespace std;
#define ll long long
#define floop(i, a, b) for (int i = (a); i < (b); i++)
#define vi vector<int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int, int>>
#define pii pair<int, int>
#define all(x) (x).begin(), (x).end()
const ll inf = 1e16;
const int mod = 1e9 + 7;
const int N = 1e6;
ll i = 0, j = 0;
ll n, m;
void ExoticLur3e37()
{
     ll n, m, p;
     cin >> n >> m;
     map<ll, ll> a;
     for (i = 0; i < n; i++)
     {
          cin >> p;
          a[p]++;
     }
     vector<ll> b(m);
     vector<ll> vis(m, 0);
     for (i = 0; i < m; i++)
          cin >> b[i];

     for (int i = 0; i < m; i++)
     {
          int num = b[i];
          if (a[num] > 0)
          {
               a[num]--;
               vis[i] = 1;
          }
     }

     priority_queue<ll, vector<ll>, greater<ll>> aa;
     for (auto c : a)
     {
          if (c.second > 0)
          {
               int freq = c.second;
               while (freq--)
               {
                    aa.push(c.first);
               }
          }
     }
     vector<ll> bb;
     for (int i = 0; i < m; i++)
     {
          if (!vis[i])
               bb.push_back(b[i]);
     }

     if (bb.size() == 0 && aa.size() != 0)
     {
          cout << "NO";
          return;
     }

     if (bb.size() == 1 && aa.size() == 1)
     {
          bb[0] == aa.top() ? cout << "YES" : cout << "NO";
          return;
     }

     sort(all(bb));

     i = 0, j = 0;

     while (aa.size() > 1 && j < bb.size())
     {
          ll x = aa.top();
          aa.pop();
          ll y = aa.top();
          aa.pop();
          if (abs(x - y) <= 1 && (x + y) == bb[j])
               j++;
          else if (abs(x - y) <= 1)
          {
               aa.push(x + y);
          }
          else
          {
               cout << "NO";
               return;
          }
     }
     if (aa.size() == 1 && j == bb.size() - 1)
     {
          bb[j] == aa.top() ? cout << "YES" : cout << "NO";
          return;
     }
     if (j == bb.size())
          cout << "YES";
     else
          cout << "NO";
}
int main()
{
     ios_base::sync_with_stdio(0);
     cin.tie(0);
     cout.tie(0);
     ll t;
     cin >> t;
     // t = 1;
     while (t--)
     {
          ExoticLur3e37();
          cout << "\n";
     }
}

Answer: 1