Problem: 2061D - Kevin and Numbers
Language: c++17 

Solution 1 (runtime: 780 ms):
#include <bits/stdc++.h>
using namespace std;

bool canTransform(int n, int m, vector<int>& a, vector<int>& b) {
    if (m > n) return false; // Cannot reduce sequence length
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    
    // Frequency map for a
    map<int, int> freq;
    for (int num : a) freq[num]++;
    
    for (int num : b) {
        bool found = false;
        // Try to find a combination of numbers in a that can sum to num
        for (auto it = freq.begin(); it != freq.end(); ++it) {
            int x = it->first;
            if (freq[x] == 0) continue;
            // Check if x can be combined with x or x+1 to form num
            if (x == num && freq[x] >= 1) {
                freq[x]--;
                found = true;
                break;
            }
            if (x + 1 == num && freq[x] >= 1 && freq[x + 1] >= 1) {
                freq[x]--;
                freq[x + 1]--;
                found = true;
                break;
            }
        }
        if (!found) return false;
    }
    return true;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int t;
    cin >> t;
    while (t--) {
        int n, m;
        cin >> n >> m;
        vector<int> a(n), b(m);
        for (int i = 0; i < n; ++i) cin >> a[i];
        for (int i = 0; i < m; ++i) cin >> b[i];
        
        if (canTransform(n, m, a, b)) cout << "Yes\n";
        else cout << "No\n";
    }
    return 0;
}

Solution 2 (runtime: 202 ms):
//      ॐ
/*For today, you might be defeated. But what will you become tomorrow?*/

#include <bits/stdc++.h>
using namespace std;

//-------Ordered_set-------
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
typedef tree<long long, null_type, less_equal<long long>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; 

#define int long long
#define all(x) begin(x), end(x)
const int N = 1e5 + 12, Mod = 1e9+7;

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

// Comparator
bool cmp(const pair<int, int> &a, const pair<int, int> &b) {
    if(a.first != b.first)
        return (a.first > b.first);
    else return(a.second > b.second);
}

void solve() {
    int n,m;
    cin>>n>>m;

    priority_queue<int>a,b;
    for(int i=0; i<n; i++){
        int x;
        cin>>x;
        a.push(x);
    }
    for(int i=0; i<m; i++){
        int x;
        cin>>x;
        b.push(x);
    }

    while(!a.empty() ){

        if(b.empty() || b.size()>a.size()){
            cout<<"NO\n";
            return;
        }

        int x = b.top();
        b.pop();

        if(a.top()>x){
            cout<<"NO\n";
            return;
        }
        if(x==a.top()){
            a.pop();
            continue;
        }
        else{
            b.push(x/2);
            b.push((x+1)/2);
        }
    }
    if(b.empty()){
        cout<<"YES\n";
    }
    else cout<<"NO\n";

}

signed main() {
    fast;
    int __ = 1;
    cin >> __;
    while (__--) {
        solve();
    }
}