Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 3):
#include<bits/stdc++.h>
#include<cmath>
#define SZ(x) ((int)x.size())
#include<vector>
#include<set>
#include<map>
#include <unordered_map>
#define pb push_back
#include<string>
#include<cmath>
#define ll long long
#define lli long long int
#define REP(i,n) for(ll i=1;i<=n;i++)
#include<cctype>
#include <sstream>
#define endl "\n"
#define pairs pair<int,int>
#define ld long double
#define mod 1000000009
#define Mod 998244353
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
using namespace std;
# pragma GCC optimize ("Ofast")
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update>
mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count());
ll ceil_div(ll a, ll b) {return a % b == 0 ? a / b : a / b + 1;}
ll pows(ll a,ll n,ll m)
{
	a=a%m;
	ll res=1;
	while(n)
	{
	if(n%2!=0)
	{
		res=(res*a)%m;
		n--;
		}
		else
		{
			a=(a*a)%m;
			n=n/2;
			}	
	}
	return res%m;
}
ll gcd(ll a,ll b)
{
	
	if(b==0)
	return a;
	else 
	return gcd(b,a%b);
}
bool isprime(ll n)
{
	if(n==1||n==0)
	{
		return false;
	}
	for(ll i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			return false;
		}
	}
	return true;
}
bool istrue(string s)
{
	int i=0;
	int j=s.size()-1;
	while(i<j)
	{
	if(s[i]==s[j])
	{
		i++;
		j--;
		}
		else
		{
		return false;
			}	
	}
	return true;
}
//D'N    G    UP
const int N = 300006;
ll n,m;
ll a[N];
ll b[N];
int main()
{ 
  auto begin = std::chrono::high_resolution_clock::now();
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin>>t;
//  t = 1;
  while(t--){
  	cin>>n>>m;
  	map<ll,ll>mp;
  	for(ll i=0;i<n;i++){
  		cin>>a[i];
  		mp[a[i]]++;
	  }
  	for(ll i=0;i<m;i++){
  		cin>>b[i];
	  }
	  
	  sort(b,b+m);
	  reverse(b,b+m);
	  ll flag = 1;
	  ll w = 0;
	  for(ll i=0;i<m;i++){
	  	if(flag == 0){
	  		break;
		  }
	  	  multiset<ll>val;
	  	  val.insert(b[i]);
	  	  	if(w >= n+m){
	  	  		flag = 0;
	  	  		break;
			}
	  	  while(!val.empty()){
	  	  	if(w >= n+m){
	  	  		flag = 0;
	  	  		break;
				}
	  	  	ll v = *val.rbegin();
	  	  	if(mp.find(v) != mp.end() && mp[v] > 0 ){
	  	  		mp[v]--;
				val.erase(val.find(v));
				continue;
			}
			val.erase(val.find(v));
			if(v %2 != 0){
				val.insert(v/2);
				val.insert((v/2)+1);
			} else{
				val.insert(v/2);
				val.insert(v/2);				
			}	
			w = w+2;
	  }
  }
  for(pair<ll,ll>x:mp){
  	if(x.second > 0){
  		flag = 0;
	  }
  }
  if(flag == 0){
  	cout<<"No"<<endl;
  }else{
  	cout<<"Yes"<<endl;
  }
}
  auto end = std::chrono::high_resolution_clock::now();
  auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin);
  cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n"; 

}



Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
#include<cmath>
#define SZ(x) ((int)x.size())
#include<vector>
#include<set>
#include<map>
#include <unordered_map>
#define pb push_back
#include<string>
#include<cmath>
#define ll long long
#define lli long long int
#define REP(i,n) for(ll i=1;i<=n;i++)
#include<cctype>
#include <sstream>
#define endl "\n"
#define pairs pair<int,int>
#define ld long double
#define mod 1000000009
#define Mod 998244353
const double PI = 3.141592653589793238460;
typedef std::complex<double> Complex;
typedef std::valarray<Complex> CArray;
using namespace std;
# pragma GCC optimize ("Ofast")
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<pair<ll,ll>, null_type, less<pair<ll,ll>>, rb_tree_tag, tree_order_statistics_node_update>
mt19937_64 RNG(chrono::steady_clock::now().time_since_epoch().count());
ll ceil_div(ll a, ll b) {return a % b == 0 ? a / b : a / b + 1;}
ll pows(ll a,ll n,ll m)
{
	a=a%m;
	ll res=1;
	while(n)
	{
	if(n%2!=0)
	{
		res=(res*a)%m;
		n--;
		}
		else
		{
			a=(a*a)%m;
			n=n/2;
			}	
	}
	return res%m;
}
ll gcd(ll a,ll b)
{
	
	if(b==0)
	return a;
	else 
	return gcd(b,a%b);
}
bool isprime(ll n)
{
	if(n==1||n==0)
	{
		return false;
	}
	for(ll i=2;i*i<=n;i++)
	{
		if(n%i==0)
		{
			return false;
		}
	}
	return true;
}
bool istrue(string s)
{
	int i=0;
	int j=s.size()-1;
	while(i<j)
	{
	if(s[i]==s[j])
	{
		i++;
		j--;
		}
		else
		{
		return false;
			}	
	}
	return true;
}
//D'N    G    UP
const int N = 300006;
ll n,m;
ll a[N];
ll b[N];
int main()
{ 
  auto begin = std::chrono::high_resolution_clock::now();
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin>>t;
//  t = 1;
  while(t--){
  	cin>>n>>m;
  	map<ll,ll>mp;
  	for(ll i=0;i<n;i++){
  		cin>>a[i];
  		mp[a[i]]++;
	  }
  	for(ll i=0;i<m;i++){
  		cin>>b[i];
	  }
	  
	  sort(b,b+m);
	  reverse(b,b+m);
	  ll flag = 1;
	  ll w = 0;
	  for(ll i=0;i<m;i++){
	  	if(flag == 0){
	  		break;
		  }
	  	  multiset<ll>val;
	  	  val.insert(b[i]);
	  	  while(!val.empty()){
	  	  	if(val.size() >= n){
	  	  		flag = 0;
	  	  		break;
			}
	  	  	ll v = *val.rbegin();
	  	  	if(mp.find(v) != mp.end() && mp[v] > 0 ){
	  	  		mp[v]--;
				val.erase(val.find(v));
				continue;
			}
			val.erase(val.find(v));
			if(v %2 != 0){
				val.insert(v/2);
				val.insert((v/2)+1);
			} else{
				val.insert(v/2);
				val.insert(v/2);				
			}	
			w = w+2;
	  }
  }
  for(pair<ll,ll>x:mp){
  	if(x.second > 0){
  		flag = 0;
	  }
  }
  if(flag == 0){
  	cout<<"No"<<endl;
  }else{
  	cout<<"Yes"<<endl;
  }
}
  auto end = std::chrono::high_resolution_clock::now();
  auto elapsed = std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin);
  cerr << "Time measured: " << elapsed.count() * 1e-9 << " seconds.\n"; 

}