Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define vpp vector<pair<int, int>>
#define vii vector<vector<int>>
#define pb push_back
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define fr(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define frr(i, a, b) for (int i = (int)a; i >= (int)b; --i)
#define mx(v) *max_element(all(v))
#define mn(v) *min_element(all(v))
#define ff first
#define ss second
#define in insert
#define dbg(x) cout << #x << " = " << x << endl;
#define rd(n) \
    int n;    \
    cin >> n;
#define bs binary_search
#define setbits(n) __builtin_popcount((int)n)
#define mod 1000000007
#define vti(a, n) \
    vi a(n);      \
    fr(i, 0, n) cin >> a[(int)i];
const int N = 1e9 + 7;

typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;

/* ----------------------------------Things get better by time, hope for the best-----------------*/

void solve()
{
    int n, m;
    cin >> n >> m;
    multiset<int> a, b;
    int x;
    fr(i, 0, n)
    {
        cin >> x;
        a.insert(x);
    }
    fr(i, 0, m)
    {
        cin >> x;
        b.insert(x);
    }
    while (!a.empty() && !b.empty())
    {
        auto i = a.end(), j = b.end();
        i--, j--;
        x = (*i);
        int y = (*j);
        if (x == y)
        {
            a.erase(i);
            b.erase(j);
        }
        else
        {
            int p = ceil((1.0 * y) / 2.0), q = floor((1.0 * y) / 2.0);
            b.erase(j);
            if (x == p)
            {
                b.insert(q);
                a.erase(i);
            }
            else if (x == q)
            {
                b.insert(p);
                a.erase(i);
            }
            else
            {
                cout << "No\n";
                return;
            }
        }
    }
    if (a.empty() && b.empty())
        cout << "Yes\n";
    else
        cout << "No\n";
}
int32_t main()
{
    fast_io;
    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define vpp vector<pair<int, int>>
#define vii vector<vector<int>>
#define pb push_back
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define fr(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define frr(i, a, b) for (int i = (int)a; i >= (int)b; --i)
#define mx(v) *max_element(all(v))
#define mn(v) *min_element(all(v))
#define ff first
#define ss second
#define in insert
#define dbg(x) cout << #x << " = " << x << endl;
#define rd(n) \
    int n;    \
    cin >> n;
#define bs binary_search
#define setbits(n) __builtin_popcount((int)n)
#define mod 1000000007
#define vti(a, n) \
    vi a(n);      \
    fr(i, 0, n) cin >> a[(int)i];
const int N = 1e9 + 7;

typedef long double ld;
typedef pair<int, int> pii;
typedef pair<ld, ld> pld;

/* ----------------------------------Things get better by time, hope for the best-----------------*/

void solve()
{
    int n, m;
    cin >> n >> m;
    multiset<int> a, b;
    int x;
    fr(i, 0, n)
    {
        cin >> x;
        a.insert(x);
    }
    fr(i, 0, m)
    {
        cin >> x;
        b.insert(x);
    }
    while (!a.empty() && !b.empty())
    {
        if (b.size() > a.size())
        {
            cout << "No\n";
            return;
        }
        auto i = a.end(), j = b.end();
        i--, j--;
        x = (*i);
        int y = (*j);
        if (x == y)
        {
            a.erase(i);
            b.erase(j);
        }
        else
        {
            int p = ceil((1.0 * y) / 2.0), q = floor((1.0 * y) / 2.0);
            b.erase(j);
            if (x == p)
            {
                b.insert(q);
                a.erase(i);
            }
            else if (x == q)
            {
                b.insert(p);
                a.erase(i);
            }
            else if (x > p)
            {
                cout << "No\n";
                return;
            }
            else
            {
                b.insert(p);
                b.insert(q);
            }
        }
    }
    if (a.empty() && b.empty())
        cout << "Yes\n";
    else
        cout << "No\n";
}
int32_t main()
{
    fast_io;
    int t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}