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

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

void solve(){
    int n, m;
    cin >> n >> m;
    int a[n], b[m];
    priority_queue<int> p1;
    priority_queue<int> p2;
    int s1=0,s2=0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        p1.push(a[i]);
        s1+=a[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> b[i];
        p2.push(b[i]);
        s2+=b[i];
    }
    // cout<<s1<<" "<<s2<<endl;
    bool flag=false;
    bool ans=false;
    while (!p2.empty()) {
        int x = p2.top();
        if(x==1){
            if(p1.top()==1 && p2.size()==p1.size()){
                flag=true;
                ans=true;   
            }else{
                flag=true;
            }
        }
        if(flag) break;
        p2.pop();
        if(p1.top()==x){
            // cout<<p1.top()<<endl;
            p1.pop();
        }else{
            int a = floor(x / 2.0);
            int b = ceil(x / 2.0);
            if (!p1.empty() && p1.top() == b) {
                // cout<<p1.top()<<endl;
                p1.pop();
            }
            else if(!p1.empty() && p1.top() >b){
                p2.push(b);
            }
            else if(!p1.empty() && p1.top() <b/2){
                flag=true;
            }
            else{
                p2.push(b);
            }
            p2.push(a);
        }
        // if(flag) break;
    }
    // cout << p1.size() << endl;
    // cout << p2.size() << endl;
    // cout << ans << endl;
    // cout << flag << endl;
    // cout << p1.top() << endl;
    // cout << p2.top() << endl;
    if ((p1.empty() && p2.empty() ) || ans) cout << "Yes" << endl;
    // while (p1.size() > 0){
    //     cout<<p1.top()<<" ";
    //     p1.pop();
    // }
    // cout<<endl;
    // while (p2.size() > 0){
    //     cout<<p2.top()<<"";
    //     p2.pop();
    // }
    // {
    //     /* code */
    // }
    
    else cout << "No" << endl;
}

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

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

void solve(){
    int n, m;
    cin >> n >> m;
    int a[n], b[m];
    priority_queue<int> p1;
    priority_queue<int> p2;
    int s1=0,s2=0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        p1.push(a[i]);
        s1+=a[i];
    }
    for (int i = 0; i < m; i++) {
        cin >> b[i];
        p2.push(b[i]);
        s2+=b[i];
    }
    // cout<<s1<<" "<<s2<<endl;
    bool flag=false;
    bool ans=false;
    while (!p2.empty()) {
        int x = p2.top();
        if(x==1){
            if(p1.top()==1 && p2.size()==p1.size()){
                flag=true;
                ans=true;   
            }else{
                flag=true;
            }
        }
        if(flag) break;
        p2.pop();
        if(p1.top()==x){
            // cout<<p1.top()<<endl;
            p1.pop();
        }else{
            int a = floor(x / 2.0);
            int b = ceil(x / 2.0);
            if (!p1.empty() && p1.top() == b) {
                // cout<<p1.top()<<endl;
                p1.pop();
            }
            else if(!p1.empty() && p1.top() >b){
                p2.push(b);
            }
            else if(!p1.empty() && p1.top() <=b/2){
                flag=true;
            }
            else{
                p2.push(b);
            }
            p2.push(a);
        }
        // if(flag) break;
    }
    // cout << p1.size() << endl;
    // cout << p2.size() << endl;
    // cout << ans << endl;
    // cout << flag << endl;
    // cout << p1.top() << endl;
    // cout << p2.top() << endl;
    if ((p1.empty() && p2.empty() ) || ans) cout << "Yes" << endl;
    // while (p1.size() > 0){
    //     cout<<p1.top()<<" ";
    //     p1.pop();
    // }
    // cout<<endl;
    // while (p2.size() > 0){
    //     cout<<p2.top()<<"";
    //     p2.pop();
    // }
    // {
    //     /* code */
    // }
    
    else cout << "No" << endl;
}

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