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

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
//even=>(1->odd)(-1 odd)
//1(even) -1(even)=>
//odd+odd+even
using namespace std;
const long long MOD= 
998244353;




bool compare( vector<vector<long double>> & v,long long k,long double mid){
	
   long long n=v.size();
   vector<long double> pref(v.size(),0);
   pref[0]=v[0][0]-mid*v[0][1];
   for(long long i=1;i<n;i++){
     pref[i]=v[i][0]-mid*v[i][1];
   }
   
   sort(pref.begin(),pref.end(),greater<long double>());
  
   for(long long i=1;i<n;i++){
     pref[i]=pref[i-1]+pref[i];
   }
//    for(auto i : pref){
//      cout<<i<<" ";
//   }
   long double eps=1e-7;
   return pref[k-1]+eps>=0;
}
class DisjointSet {
    vector<int> rank, parent;
public:
    DisjointSet(int n) {
        rank.resize(n + 1, 0);
        parent.resize(n + 1);
        for (int i = 0; i <= n; i++) {
            parent[i] = i;
        }
    }

    int findUPar(int node) {
        if (node == parent[node])
            return node;
        return parent[node] = findUPar(parent[node]);
    }

    void unionByRank(int u, int v) {
        int ulp_u = findUPar(u);
        int ulp_v = findUPar(v);
        if (ulp_u == ulp_v) return;
        if (rank[ulp_u] < rank[ulp_v]) {
            parent[ulp_u] = ulp_v;
        }
        else if (rank[ulp_v] < rank[ulp_u]) {
            parent[ulp_v] = ulp_u;
        }
        else {
            parent[ulp_v] = ulp_u;
            rank[ulp_u]++;
        }
    }
};




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

   map<int,int> mp;

    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        mp[x]++;

    }
    
    
    for(int i=0;i<m;i++){
        int x;
        cin>>x;
        
        queue<int> q;
        bool flag=false;
        q.push(x);
        while(q.size()!=0){
           int sz=q.size();
           if(sz>n)
           {
              cout<<"No"<<endl;
              return;
           }
           for(int i=0;i<sz;i++){
              
               if(mp.find(q.front())!=mp.end()){
                    mp[q.front()]--;
                    if(mp[q.front()]==0)mp.erase(q.front());
                    q.pop();
               }
               else{
                   if(q.front()==1){
                      cout<<"No"<<endl;
                      return;
                     
                      
                   }
                   else{
                   int x=q.front();
                   q.pop();
                   q.push(x/2);
                   q.push(x-x/2);
                  }
               }
           }
         //   cout<<endl;
        }
    }
   
    if(mp.size()==0){
       cout<<"Yes"<<endl;
    }
    else{
       cout<<"No"<<endl;
    }
    
}

int main() {
   
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   long long t=1;
  cin>>t;
   
   while(t--){
    solve();
   }
   return 0;
}


Submission (verdict: Time limit exceeded on test 2):
#include <bits/stdc++.h>
//even=>(1->odd)(-1 odd)
//1(even) -1(even)=>
//odd+odd+even
using namespace std;
const long long MOD= 
998244353;




bool compare( vector<vector<long double>> & v,long long k,long double mid){
	
   long long n=v.size();
   vector<long double> pref(v.size(),0);
   pref[0]=v[0][0]-mid*v[0][1];
   for(long long i=1;i<n;i++){
     pref[i]=v[i][0]-mid*v[i][1];
   }
   
   sort(pref.begin(),pref.end(),greater<long double>());
  
   for(long long i=1;i<n;i++){
     pref[i]=pref[i-1]+pref[i];
   }
//    for(auto i : pref){
//      cout<<i<<" ";
//   }
   long double eps=1e-7;
   return pref[k-1]+eps>=0;
}
class DisjointSet {
    vector<int> rank, parent;
public:
    DisjointSet(int n) {
        rank.resize(n + 1, 0);
        parent.resize(n + 1);
        for (int i = 0; i <= n; i++) {
            parent[i] = i;
        }
    }

    int findUPar(int node) {
        if (node == parent[node])
            return node;
        return parent[node] = findUPar(parent[node]);
    }

    void unionByRank(int u, int v) {
        int ulp_u = findUPar(u);
        int ulp_v = findUPar(v);
        if (ulp_u == ulp_v) return;
        if (rank[ulp_u] < rank[ulp_v]) {
            parent[ulp_u] = ulp_v;
        }
        else if (rank[ulp_v] < rank[ulp_u]) {
            parent[ulp_v] = ulp_u;
        }
        else {
            parent[ulp_v] = ulp_u;
            rank[ulp_u]++;
        }
    }
};




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

   map<int,int> mp;

    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        mp[x]++;

    }
    
    
    for(int i=0;i<m;i++){
        int x;
        cin>>x;
        
        queue<int> q;
        bool flag=false;
        q.push(x);
        int op=0;
        while(q.size()!=0){
           int sz=q.size();
           if(op>n-m)
           {
              cout<<"No"<<endl;
              return;
           }
           for(int i=0;i<sz;i++){
              
               if(mp.find(q.front())!=mp.end()){
                    mp[q.front()]--;
                    if(mp[q.front()]==0)mp.erase(q.front());
                    q.pop();
               }
               else{
                   if(q.front()==1){
                      cout<<"No"<<endl;
                      return;
                     
                      
                   }
                   else{
                   int x=q.front();
                   q.pop();
                   op++;
                   q.push(x/2);
                   q.push(x-x/2);
                  }
               }
           }
         //   cout<<endl;
        }
    }
   
    if(mp.size()==0){
       cout<<"Yes"<<endl;
    }
    else{
       cout<<"No"<<endl;
    }
    
}

int main() {
   
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   long long t=1;
  cin>>t;
   
   while(t--){
    solve();
   }
   return 0;
}