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

Previous submission (verdict: Time limit exceeded on test 27):
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
 
// Global frequency map for the numbers of array A.
unordered_map<long long, int> freq;
 
// Recursive function that tries to "explain" x by matching it directly or by splitting.
bool dfs(long long x) {
    // If x is present in A, consume one occurrence and return true.
    if (freq[x] > 0) {
        freq[x]--;
        return true;
    }
    // If x is 1 and not available, we cannot split further.
    if (x == 1) return false;
    // Otherwise, split x into two parts.
    // Note: if x is even, both parts are x/2.
    //       if x is odd, the parts are x/2 and (x+1)/2.
    return dfs(x / 2) && dfs((x + 1) / 2);
}
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int t;
    cin >> t;
    
    while(t--){
        int n, m;
        cin >> n >> m;
        vector<long long> A(n), B(m);
        long long sumA = 0, sumB = 0;
        
        for (int i = 0; i < n; i++){
            cin >> A[i];
            sumA += A[i];
        }
        for (int i = 0; i < m; i++){
            cin >> B[i];
            sumB += B[i];
        }
        
        // Check the invariant: the total sum must be the same.
        if(sumA != sumB){
            cout << "No\n";
            continue;
        }
        
        // Build frequency map for array A.
        freq.clear();
        for(auto x : A)
            freq[x]++;
        
        // Try to "explain" every number in B by splitting it as needed.
        bool possible = true;
        for(auto x : B){
            if(!dfs(x)){
                possible = false;
                break;
            }
        }
        
        cout << (possible ? "Yes" : "No") << "\n";
    }
    
    return 0;
}


Submission (verdict: Compilation error):
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
 
// Global frequency map for the numbers of array A.
map<long long, int> freq;
 
// Recursive function that tries to "explain" x by matching it directly or by splitting.
bool dfs(long long x) {
    // If x is present in A, consume one occurrence and return true.
    if (freq[x] > 0) {
        freq[x]--;
        return true;
    }
    // If x is 1 and not available, we cannot split further.
    if (x == 1) return false;
    // Otherwise, split x into two parts.
    // Note: if x is even, both parts are x/2.
    //       if x is odd, the parts are x/2 and (x+1)/2.
    return dfs(x / 2) && dfs((x + 1) / 2);
}
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int t;
    cin >> t;
    
    while(t--){
        int n, m;
        cin >> n >> m;
        vector<long long> A(n), B(m);
        long long sumA = 0, sumB = 0;
        
        for (int i = 0; i < n; i++){
            cin >> A[i];
            sumA += A[i];
        }
        for (int i = 0; i < m; i++){
            cin >> B[i];
            sumB += B[i];
        }
        
        // Check the invariant: the total sum must be the same.
        if(sumA != sumB){
            cout << "No\n";
            continue;
        }
        
        // Build frequency map for array A.
        freq.clear();
        for(auto x : A)
            freq[x]++;
        
        // Try to "explain" every number in B by splitting it as needed.
        bool possible = true;
        for(auto x : B){
            if(!dfs(x)){
                possible = false;
                break;
            }
        }
        
        cout << (possible ? "Yes" : "No") << "\n";
    }
    
    return 0;
}