Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)

Previous submission (verdict: Compilation error):

// ॐ
//---------------------------------------------------------------------------------------------------------------------------------------------------------------

#include <bits/stdc++.h>
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define endll '\n'
#define print(x) cout << x << endll
#define py cout << "YES\n"
#define pn cout << "NO\n"
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define fer(i, a, b) for (ll i = a; i <= b; i++)
#define frr(i, a, b) for (ll i = a; i >= b; i--)
#define pb push_back
#define ff first
#define ss second
#define sz size()
#define int int64_t
#define all(v) v.begin(), v.end()
#define all_rev(v) v.rbegin(), v.rend()
#define vecp(v)           \
    for (auto i : v)      \
        cout << i << ' '; \
    cout << endll
#define vecpp(v)     \
    for (auto i : v) \
    cout << i.ff << ' ' << i.ss << endl
#define take(x) \
    int x;      \
    cin >> x
#define popcnt(n) __builtin_popcountll(n)
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define debug(x) cout << #x << ' ' << x << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvll = vector<vll>;
using stll = set<ll>;
using mpll = map<ll, ll>;
using mpvll = map<ll, vll>;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ll N = 2e5 + 10;

// priority_queue <int, vector<int>, greater<int> > p;
//  __builtin_clz(x): the number of zeros at the beginning of the number
//  __builtin_ctz(x): the number of zeros at the end of the number
//  __builtin_popcountll(x): the number of ones in the number
//  __builtin_parity(x): the parity (even or odd) of the number of ones
//  __builtin_ffs(int) finds the index of the first (most right) set bit
void init_code()
{
    fast_io;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
#ifndef ONLINE_JUDGE
    freopen("error.txt", "w", stderr);
#endif
}
bool isPrime(const ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 or n % 3 == 0)
        return false;
    for (ll i = 5; i * i <= n; i += 6)
        if (n % i == 0 or n % (i + 2) == 0)
            return false;
    return true;
}
ull power(ll x, ll y)
{
    ull res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % MOD;
        x = (x * x) % MOD;
        y >>= 1;
    }
    return res;
}
ull modInvPow(const ll n)
{
    return power(n, MOD - 2);
}
bool sortByCond(const pair<ll, ll> &a, const pair<ll, ll> &b)
{
    /*
        if (a.ff == b.ff)
            return a.ss < b.ss;
        else
            return a.ff < b.ff;
    */
    return a.ss < b.ss;
}

void ramram()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    multiset<int> x,b;
    multiset<int> y;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        x.insert(a[i]);
    }
    for (int i = 0; i < m; i++)
    {
        int q;
        cin>>q;
        b.insert(q);
        y.insert(q);
    }
    // // cout<<a.size()<<endl;
    // cout<<x.size()<<endl;
    for (auto it : a)
    {
        if (y.find(it) != y.end())
        {
            x.erase(x.find(it));
            y.erase(y.find(it));
        }
    }
    int i=abs(x.size()-y.size());
    if(y.size()==0 && x.size()!=0)
    {
        cout<<"No"<<endl;
        return;
    }
    while(i)
    {
        int w=*y.begin();
        y.erase(y.begin());
        int a1=w/2;
        int a2=(w+1)/2;
        if(x.find(a1)!=x.end())
        {
            x.erase(x.find(a1));
        }
        else y.insert(a1);
        if(x.find(a2)!=x.end())
        {
            x.erase(x.find(a2));
        }
        else y.insert(a2);\

        i--;
    }
    (x.size() == 0 && y.size()==0) ? cout << "Yes" : cout << "No";
    cout << endl;

    return;
}

int32_t main()
{
    init_code();
    fast_io;
    ll t = 1;
    cin >> t;
    while (t--)
        ramram();
    return 0;
}

Submission (verdict: Time limit exceeded on test 2):

// ॐ
//---------------------------------------------------------------------------------------------------------------------------------------------------------------

#include <bits/stdc++.h>
#define fast_io                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define endll '\n'
#define print(x) cout << x << endll
#define py cout << "YES\n"
#define pn cout << "NO\n"
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define fer(i, a, b) for (ll i = a; i <= b; i++)
#define frr(i, a, b) for (ll i = a; i >= b; i--)
#define pb push_back
#define ff first
#define ss second
#define sz size()
#define int int64_t
#define all(v) v.begin(), v.end()
#define all_rev(v) v.rbegin(), v.rend()
#define vecp(v)           \
    for (auto i : v)      \
        cout << i << ' '; \
    cout << endll
#define vecpp(v)     \
    for (auto i : v) \
    cout << i.ff << ' ' << i.ss << endl
#define take(x) \
    int x;      \
    cin >> x
#define popcnt(n) __builtin_popcountll(n)
#define max3(a, b, c) max(a, max(b, c))
#define min3(a, b, c) min(a, min(b, c))
#define mxe(v) *max_element(v.begin(), v.end())
#define mne(v) *min_element(v.begin(), v.end())
#define debug(x) cout << #x << ' ' << x << endl
using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvll = vector<vll>;
using stll = set<ll>;
using mpll = map<ll, ll>;
using mpvll = map<ll, vll>;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ll N = 2e5 + 10;

// priority_queue <int, vector<int>, greater<int> > p;
//  __builtin_clz(x): the number of zeros at the beginning of the number
//  __builtin_ctz(x): the number of zeros at the end of the number
//  __builtin_popcountll(x): the number of ones in the number
//  __builtin_parity(x): the parity (even or odd) of the number of ones
//  __builtin_ffs(int) finds the index of the first (most right) set bit
void init_code()
{
    fast_io;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
#ifndef ONLINE_JUDGE
    freopen("error.txt", "w", stderr);
#endif
}
bool isPrime(const ll n)
{
    if (n <= 1)
        return false;
    if (n <= 3)
        return true;
    if (n % 2 == 0 or n % 3 == 0)
        return false;
    for (ll i = 5; i * i <= n; i += 6)
        if (n % i == 0 or n % (i + 2) == 0)
            return false;
    return true;
}
ull power(ll x, ll y)
{
    ull res = 1;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % MOD;
        x = (x * x) % MOD;
        y >>= 1;
    }
    return res;
}
ull modInvPow(const ll n)
{
    return power(n, MOD - 2);
}
bool sortByCond(const pair<ll, ll> &a, const pair<ll, ll> &b)
{
    /*
        if (a.ff == b.ff)
            return a.ss < b.ss;
        else
            return a.ff < b.ff;
    */
    return a.ss < b.ss;
}

void ramram()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    multiset<int> x,b;
    multiset<int> y;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        x.insert(a[i]);
    }
    for (int i = 0; i < m; i++)
    {
        int q;
        cin>>q;
        b.insert(q);
        y.insert(q);
    }
    // // cout<<a.size()<<endl;
    // cout<<x.size()<<endl;
    for (auto it : a)
    {
        if (y.find(it) != y.end())
        {
            x.erase(x.find(it));
            y.erase(y.find(it));
        }
    }
    int i=x.size()-y.size();
    if(y.size()==0 && x.size()!=0)
    {
        cout<<"No"<<endl;
        return;
    }
    while(i)
    {
        int w=*y.begin();
        y.erase(y.begin());
        int a1=w/2;
        int a2=(w+1)/2;
        if(x.find(a1)!=x.end())
        {
            x.erase(x.find(a1));
        }
        else y.insert(a1);
        if(x.find(a2)!=x.end())
        {
            x.erase(x.find(a2));
        }
        else y.insert(a2);\

        i--;
    }
    (x.size() == 0 && y.size()==0) ? cout << "Yes" : cout << "No";
    cout << endl;

    return;
}

int32_t main()
{
    init_code();
    fast_io;
    ll t = 1;
    cin >> t;
    while (t--)
        ramram();
    return 0;
}