Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 3):
/*// Ih Badhon Chowdhury //*/

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;

// using namespace __gnu_pbds;
// template<typename T> using orderset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
// template<typename T> using ordermultiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
//(*X).find_by_order(index) /// return value (0 index)
//(X).order_of_key(value) /// return lower_bound(value)

/*
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); /// mt19937_64 (long long)
auto my_rand(long long l,long long r)
{
  return uniform_int_distribution<long long>(l,r)(rng);
}
#ifndef ONLINE_JUDGE
#include "debug.h"
#else
#define dbg(...) 42
#endif
*/

#define ll long long int
#define ld long double
#define sp " "
#define lcm(a, b) (a * b) / __gcd(a, b)
#define cinv(v)     \
  for (auto &i : v) \
    cin >> i;
#define vi vector<int>
#define vii vector<ll>
#define coutv(v)       \
  for (auto it : v)    \
    cout << it << ' '; \
  cout << endl;
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define case "Case " << test++ << ": "
#define all(v) v.begin(), v.end()
#define Faster                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);                    \
  cout.tie(NULL);
#define nl '\n'
#define PI acos(-1)

const int N = 1000001;
const int mod = 1000000007;
const ll INF = LLONG_MAX;

///.........Bit_Manipulation...........///
#define MSB(mask) 63 - __builtin_clzll(mask) /// 0 -> -1
#define LSB(mask) __builtin_ctzll(mask)      /// 0 -> 64
#define ONE(mask) __builtin_popcountll(mask)
#define CHECK(mask, bit) (mask & (1LL << bit))
#define ON(mask, bit) (mask(1LL << bit))
#define OFF(mask, bit) (mask & ~(1LL << bit))
#define CHANGE(mask, bit) (mask ^ (1LL << bit))
#define LOG2(x) (__builtin_clz(x) ^ 31)
#define LSB1(mask) (__builtin_ffs(mask) - 1)
#define STRING_TO_INT(mask) (std::bitset<64>(mask).to_ullong())

///................Graph's Move.................
/// const int dx[] = {+1,-1,+0,+0}; ///Rock's Move
/// const int dy[] = {+0,+0,+1,-1}; ///Rock's Move
/// const int dx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's Move
/// const int dy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
/// const int dx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's Move
/// const int dy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's Move
///*.....................-_-........................*///

inline ll IPOW(ll n, ll k)
{
  ll ans = 1;
  while (k)
  {
    if (k & 1)
      ans = ans * n % mod;
    n = n * n % mod;
    k >>= 1;
  }
  return ans;
}
inline ll POW(ll n, ll k)
{
  ll ans = 1;
  while (k)
  {
    if (k & 1)
      ans = ans * n;
    n = n * n;
    k >>= 1;
  }
  return ans;
}
//////

// Driver Code
int main()
{
  Faster;
  ll tc = 1, test = 1;
  cin >> tc;
  while (tc--)
  {
    ll n, m;
    cin >> n >> m;

    vii a(n), b(m);
    cinv(a);
    cinv(b);

    if (n == m)
    {
      sort(all(a));
      sort(all(b));
      if (a == b)
        yes;
      else
        no;
      continue;
    }

    map<ll, int> mp;
    for (int i = 0; i < n; i++)
    {
      mp[a[i]]++;
    }

    priority_queue<ll> pq;

    for (int i = 0; i < m; i++)
    {
      pq.push(b[i]);
    }

    ll tmp = n - m;

    while (tmp-- and !pq.empty())
    {
      ll u = pq.top();
      pq.pop();

      if (mp[u] > 0)
      {
        mp[u]--;
        n--;
        tmp++;
      }
      else
      {
        ll x = u / 2;
        ll y = (u + 1) / 2;
        if (x > 0 and mp[x] > 0)
        {
          mp[x]--;
          n--;
        }
        else
        {
          if (x > 0)
            pq.push(x);
        }

        if (y > 0 and mp[y] > 0)
        {
          mp[y]--;
          n--;
        }
        else
        {
          if (y > 0)
            pq.push(x);
        }
      }
    }

    if (pq.size() or n > 0)
      no;
    else
      yes;
  }
}


Submission (verdict: Wrong answer on test 3):
/*// Ih Badhon Chowdhury //*/

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;

// using namespace __gnu_pbds;
// template<typename T> using orderset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
// template<typename T> using ordermultiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
//(*X).find_by_order(index) /// return value (0 index)
//(X).order_of_key(value) /// return lower_bound(value)

/*
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); /// mt19937_64 (long long)
auto my_rand(long long l,long long r)
{
  return uniform_int_distribution<long long>(l,r)(rng);
}
#ifndef ONLINE_JUDGE
#include "debug.h"
#else
#define dbg(...) 42
#endif
*/

#define ll long long int
#define ld long double
#define sp " "
#define lcm(a, b) (a * b) / __gcd(a, b)
#define cinv(v)     \
  for (auto &i : v) \
    cin >> i;
#define vi vector<int>
#define vii vector<ll>
#define coutv(v)       \
  for (auto it : v)    \
    cout << it << ' '; \
  cout << endl;
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define case "Case " << test++ << ": "
#define all(v) v.begin(), v.end()
#define Faster                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);                    \
  cout.tie(NULL);
#define nl '\n'
#define PI acos(-1)

const int N = 1000001;
const int mod = 1000000007;
const ll INF = LLONG_MAX;

///.........Bit_Manipulation...........///
#define MSB(mask) 63 - __builtin_clzll(mask) /// 0 -> -1
#define LSB(mask) __builtin_ctzll(mask)      /// 0 -> 64
#define ONE(mask) __builtin_popcountll(mask)
#define CHECK(mask, bit) (mask & (1LL << bit))
#define ON(mask, bit) (mask(1LL << bit))
#define OFF(mask, bit) (mask & ~(1LL << bit))
#define CHANGE(mask, bit) (mask ^ (1LL << bit))
#define LOG2(x) (__builtin_clz(x) ^ 31)
#define LSB1(mask) (__builtin_ffs(mask) - 1)
#define STRING_TO_INT(mask) (std::bitset<64>(mask).to_ullong())

///................Graph's Move.................
/// const int dx[] = {+1,-1,+0,+0}; ///Rock's Move
/// const int dy[] = {+0,+0,+1,-1}; ///Rock's Move
/// const int dx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's Move
/// const int dy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
/// const int dx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's Move
/// const int dy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's Move
///*.....................-_-........................*///

inline ll IPOW(ll n, ll k)
{
  ll ans = 1;
  while (k)
  {
    if (k & 1)
      ans = ans * n % mod;
    n = n * n % mod;
    k >>= 1;
  }
  return ans;
}
inline ll POW(ll n, ll k)
{
  ll ans = 1;
  while (k)
  {
    if (k & 1)
      ans = ans * n;
    n = n * n;
    k >>= 1;
  }
  return ans;
}
//////

// Driver Code
int main()
{
  Faster;
  ll tc = 1, test = 1;
  cin >> tc;
  while (tc--)
  {
    ll n, m;
    cin >> n >> m;

    vii a(n), b(m);
    cinv(a);
    cinv(b);

    if (n == m)
    {
      sort(all(a));
      sort(all(b));
      if (a == b)
        yes;
      else
        no;
      continue;
    }

    multiset<ll> mp;

    for (int i = 0; i < n; i++)
    {
      mp.insert(a[i]);
    }

    priority_queue<ll> pq;

    for (int i = 0; i < b.size(); i++)
    {
      if (mp.find(b[i]) != mp.end())
      {
        n--;
        m--;
        mp.erase(mp.find(b[i]));
      }
      else
      {
        pq.push(b[i]);
        // yes;
      }
    }

    ll tmp = n - m;
    // cout << tmp << sp << pq.size() << nl;

    while (tmp-- and !pq.empty())
    {
      ll u = pq.top();
      pq.pop();

      if (mp.find(u) != mp.end())
      {
        mp.erase(mp.find(u));
        n--;
        tmp++;
      }
      else
      {
        ll x = u / 2;
        ll y = (u + 1) / 2;
        if (x > 0 and mp.find(x) != mp.end())
        {
          mp.erase(mp.find(x));
          n--;
        }
        else
        {
          if (x > 0)
            pq.push(x);
        }

        if (y > 0 and mp.find(y) != mp.end())
        {
          mp.erase(mp.find(y));
          n--;
        }
        else
        {
          if (y > 0)
            pq.push(x);
        }
      }
    }

    // cout << pq.size() << sp << n << nl;

    if (pq.size() or n > 0)
      no;
    else
      yes;
  }
}