ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
    ll t;
    cin>>t;
    while(t--){
        string n;
        cin>>n;
        int sum=0;
        int count_2=0;
        int count_3=0;
        int count_9=0;
        for(int i=0;i<n.size();i++){
            sum+=int(n[i])-'0';
            if(int(n[i])-'0'==2){
                count_2+=1;
            }
            if(int(n[i])-'0'==3){
                count_3+=1;
            }
        }
        int flag=0;
        for(int i=0;i<=count_2;i++){
            for(int j=0;j<=count_3;j++){
                int ans=sum;
                ans=ans+2*i+3*j;
                if(ans%9==0){
                    flag=1;
                    break;
                }
            }
        }
        if(flag==1){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}
    
        

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
    ll t;
    cin>>t;
    while(t--){
        string n;
        cin>>n;
        int sum=0;
        int count_2=0;
        int count_3=0;
        int count_9=0;
        for(int i=0;i<n.size();i++){
            sum+=int(n[i])-'0';
            if(int(n[i])-'0'==2){
                count_2+=1;
            }
            if(int(n[i])-'0'==3){
                count_3+=1;
            }
        }
        int flag=0;
        for(int i=0;i<=count_3;i++){
            int ans=9-(sum+6*i)%9;
            if(ans==9){
                cout<<"YES"<<endl;
                flag=1;
                break;
            }
            else if(ans==1 && count_2>4){
                cout<<"YES"<<endl;
                flag=1;
                break;
            }
            else if(ans==2 && count_2>0){
                cout<<"YES"<<endl;
                flag=1;
                break;
            }
            else if(ans==3 && count_2>5){
                cout<<"YES"<<endl;
                flag=1;
                break;
            }
            else if(ans==4 && count_2>1){
                cout<<"YES"<<endl;
                flag=1;
                break;
            }
            else if(ans==5 && count_2>6){
                cout<<"YES"<<endl;
                flag=1;
                break;
            }
            else if(ans==6 && count_2>2){
                cout<<"YES"<<endl;
                flag=1;
                break;
            }
            else if(ans==7 && count_2>7){
                cout<<"YES"<<endl;
                flag=1;
                break;
            }
            else if(ans==8 && count_2>3){
                cout<<"YES"<<endl;
                flag=1;
                break;
            }
            else{
                continue;
            }
            }
        if(flag!=1){
            cout<<"NO"<<endl;
        }
        }
    }
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
    ll t;
    cin>>t;
    while(t--){
        string n;
        cin>>n;
        int sum=0;
        int count_2=0;
        int count_3=0;
        int count_9=0;
        for(int i=0;i<n.size();i++){
            sum+=int(n[i])-'0';
            if(int(n[i])-'0'==2){
                count_2+=1;
            }
            if(int(n[i])-'0'==3){
                count_3+=1;
            }
        }
        int flag=0;
        for(int i=0;i<=count_2;i++){
            int ans=sum;
            for(int j=0;j<=count_3;j++){
                ans=ans+2*i+3*j;
                if(ans%9==0){
                    flag=1;
                    break;
                }
            }
        }
        if(flag==1){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}
    
        

Submission (verdict: Compilation error):
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
    ll t;
    cin>>t;
    while(t--){
        string n;
        cin>>n;
        int sum=0;
        int count_2=0;
        int count_3=0;
        int count_9=0;
        for(int i=0;i<n.size();i++){
            sum+=int(n[i])-'0';
            if(int(n[i])-'0'==2){
                count_2+=1;
            }
            if(int(n[i])-'0'==3){
                count_3+=1;
            }
        }
        int flag=0;
        for(int i=0;i<=count_2;i++){
            for(int j=0;j<=count_3;j++){
                ans=sum;
                ans=ans+2*i+3*j;
                if(ans%9==0){
                    flag=1;
                    break;
                }
            }
        }
        if(flag==1){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(void){
    ll t;
    cin>>t;
    while(t--){
        string n;
        cin>>n;
        int sum=0;
        int count_2=0;
        int count_3=0;
        int count_9=0;
        for(int i=0;i<n.size();i++){
            sum+=int(n[i])-'0';
            if(int(n[i])-'0'==2){
                count_2+=1;
            }
            if(int(n[i])-'0'==3){
                count_3+=1;
            }
        }
        int flag=0;
        for(int i=0;i<=count_2;i++){
            int ans=sum;
            for(int j=0;j<=count_3;j++){
                ans=ans+2*i+3*j;
                if(ans%9==0){
                    flag=1;
                    break;
                }
            }
        }
        if(flag==1){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }
    }
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Time limit exceeded on test 6):
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define endl '\n'
#define CHOTHANI ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define lcm(a,b) a*b/(__gcd(a,b))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define print(ans) cout << ans << endl
#define pb push_back
#define pp pop_back
const int M = 1e9+7;
const int N = 1e5+10;
 
int main()
{
            CHOTHANI
    int t;
    cin >> t;
    for(int g=0;g<t;g++)
    {
        string s;
        cin >> s;

        ll n = s.size();
        ll krish=0;
        for(int k=n;k>=0;k--)
        {
            for(int i=n-1;i>n-k;i--)
            {
                if((s[i]-1) > s[i-1])
                {
                     swap(s[i], s[i-1]) ;
                     s[i-1]=s[i-1]-1;
                     krish=1;
                }
            }
            if(!krish) break;
        }
        print(s);
    }
}       

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define endl '\n'
#define CHOTHANI ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define lcm(a,b) a*b/(__gcd(a,b))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define print(ans) cout << ans << endl
#define pb push_back
#define pp pop_back
const int M = 1e9+7;
const int N = 1e5+10;
 
int main()
{
            CHOTHANI
    int t;
    cin >> t;
    for(int g=0;g<t;g++)
    {

        string s ;
        cin >> s;
        ll n = s.size();

        for(int i=0;i<n;i++)
        {
            ll val = s[i]-'0';
            ll ind= i;
            for(int j=i;j<min(i+10LL,n);j++)
            {
                if(s[j] - (j-i) -'0' > val)
                {
                    val = s[j] - (j-i) -'0';
                    ind = j;
                }
            }

            for(int j=ind; j>i;j--)
            {
                swap(s[j], s[j-1]);
            }
            s[i]  = val + '0';
            // cout << val << " ";
        }
        print(s);
    }
}

// 0 1 2 3 4 5 6 7 8 9  
// 1 2 3 4 5 6 7 8 9 10
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 3):
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define endl '\n'
#define CHOTHANI ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define lcm(a,b) a*b/(__gcd(a,b))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define print(ans) cout << ans << endl
#define pb push_back
#define pp pop_back
const int M = 1e9+7;
const int N = 1e5+10;
 
int main()
{
            CHOTHANI
    int t;
    cin >> t;
    for(int g=0;g<t;g++)
    {
        string s;
        cin >> s;

        ll n = s.size();
        for(int k=0;k<7;k++)
        {
            for(int i=n-1;i>0;i--)
            {
                if(char(s[i]-1) > s[i-1])
                {
                     swap(s[i], s[i-1]) ;
                     s[i-1]=s[i-1]-1;
                }
            }
        }
        print(s);
    }
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 3):
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define endl '\n'
#define CHOTHANI ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define lcm(a,b) a*b/(__gcd(a,b))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define print(ans) cout << ans << endl
#define pb push_back
#define pp pop_back
const int M = 1e9+7;
const int N = 1e5+10;
 
int main()
{
            CHOTHANI
    int t;
    cin >> t;
    for(int g=0;g<t;g++)
    {
        string s;
        cin >> s;

        ll n = s.size();
        for(int k=0;k<7;k++)
        {
            for(int i=n-1;i>0;i--)
            {
                if(char(s[i]-1) > s[i-1])
                {
                     swap(s[i], s[i-1]) ;
                     s[i-1]=s[i-1]-1;
                }
            }
        }
        print(s);
    }
}

Submission (verdict: Time limit exceeded on test 6):
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define endl '\n'
#define CHOTHANI ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define lcm(a,b) a*b/(__gcd(a,b))
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define print(ans) cout << ans << endl
#define pb push_back
#define pp pop_back
const int M = 1e9+7;
const int N = 1e5+10;
 
int main()
{
            CHOTHANI
    int t;
    cin >> t;
    for(int g=0;g<t;g++)
    {
        string s;
        cin >> s;

        ll n = s.size();
        ll krish=0;
        for(int k=n;k>=0;k--)
        {
            for(int i=n-1;i>n-k;i--)
            {
                if((s[i]-1) > s[i-1])
                {
                     swap(s[i], s[i-1]) ;
                     s[i-1]=s[i-1]-1;
                     krish=1;
                }
            }
            if(!krish) break;
        }
        print(s);
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include<functional> 
//using namespace __gnu_pbds;
using namespace std;
#define ull unsigned long long
#define ll long long 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rf(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(), v.end()
#define vec vector<ll>
#define pb push_back
#define Raftaar ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MEX LONG_LONG_MAX
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
/*


*/                 
            


void solve(){
	ll l,r;
	cin>>l>>r;
	ll a = l;
	ll b = r;

	ll c=0;
	rf(i,30,0){
		ll mask=(1<<i);
		if((a&mask)==0 && (b&mask)==0){
			c|=mask;
		}
		else if ((a&mask)==0 && (b&mask)!=0){
			c|=mask;
		}
	}
	if(c<l || c>r){
		if(l==r){
			c=l;
		}
		else{
			c=l+1;
		}
	}
	cout<<a<<" "<<b<<" "<<c<<endl;
}

int main(){
	Raftaar
	int t=1;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include<functional> 
//using namespace __gnu_pbds;
using namespace std;
#define ull unsigned long long
#define ll long long 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rf(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(), v.end()
#define vec vector<ll>
#define pb push_back
#define Raftaar ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MEX LONG_LONG_MAX
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
/*


*/                 
            


void solve(){
	ll l,r;
	cin>>l>>r;
	ll a = l;
	ll b = r;

	ll c=0;
	rf(i,30,0){
		ll mask=(1<<i);
		if((a&mask)==0 && (b&mask)==0){
			c|=mask;
		}
		else if ((a&mask)==0 && (b&mask)!=0){
			c|=mask;
		}
	}
	if(c<l || c>r){
		if(l==r){
			c=l;
		}
		else{
			c=l+1;
		}
	}
	cout<<a<<" "<<b<<" "<<c<<endl;
}

int main(){
	Raftaar
	int t=1;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include<functional> 
//using namespace __gnu_pbds;
using namespace std;
#define ull unsigned long long
#define ll long long 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rf(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(), v.end()
#define vec vector<ll>
#define pb push_back
#define Raftaar ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MEX LONG_LONG_MAX
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
/*


*/                 
            


void solve(){
	ll l,r;
	cin>>l>>r;
	ll a = l;
	ll b = r;

	// ll c=0;
	// rf(i,30,0){
	// 	ll mask=(1<<i);
	// 	if((a&mask)==0 && (b&mask)==0){
	// 		c|=mask;
	// 	}
	// 	else if ((a&mask)==0 && (b&mask)!=0){
	// 		c|=mask;
	// 	}
	// }
	// if(c<l || c>r){
	// 	if(l==r){
	// 		c=l;
	// 	}
	// 	else{
	// 		c=l+1;
	// 	}
	// }
	cout<<a<<" "<<b<<" "<<b-1<<endl;
}

int main(){
	Raftaar
	int t=1;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include<functional> 
//using namespace __gnu_pbds;
using namespace std;
#define ull unsigned long long
#define ll long long 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rf(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(), v.end()
#define vec vector<ll>
#define pb push_back
#define Raftaar ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MEX LONG_LONG_MAX
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
/*


*/                 
            


void solve(){
	ll l,r;
	cin>>l>>r;
	ll a = l;
	ll b = r;

	// ll c=0;
	// rf(i,30,0){
	// 	ll mask=(1<<i);
	// 	if((a&mask)==0 && (b&mask)==0){
	// 		c|=mask;
	// 	}
	// 	else if ((a&mask)==0 && (b&mask)!=0){
	// 		c|=mask;
	// 	}
	// }
	// if(c<l || c>r){
	// 	if(l==r){
	// 		c=l;
	// 	}
	// 	else{
	// 		c=l+1;
	// 	}
	// }
	cout<<a<<" "<<b<<" "<<b-1<<endl;
}

int main(){
	Raftaar
	int t=1;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}


Submission (verdict: Accepted):
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include<functional> 
//using namespace __gnu_pbds;
using namespace std;
#define ull unsigned long long
#define ll long long 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define rf(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) v.begin(), v.end()
#define vec vector<ll>
#define pb push_back
#define Raftaar ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MEX LONG_LONG_MAX
//typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
/*


*/                 
            


void solve(){
	ll l,r;
	cin>>l>>r;
	ll prev=0;
	ll a,b,c;
	rf(i,30,0){
		ll p=0,q=0;
		if(l & (1ll<<i)){
			p=1;
		}
		if(r & (1ll<<i)){
			q=1;
		}
		if(p==q){
			prev+=(p*(1ll<<i));
		}
		else{
			a=prev+(1ll<<i);
			b=a-1;
			break;
		}
	}
	f(i,l,r+1){
		if(i!=a && i!=b){
			c=i;
			break;
		}
	}
	cout<<a<<" "<<b<<" "<<c<<endl;
}

int main(){
	Raftaar
	int t=1;
	cin>>t;
	while(t--){
		solve();
	}
	return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)

Previous submission (verdict: Runtime error on test 2):
#include <bits/stdc++.h>



using namespace std;

typedef long long ll;



int main(){

ll t;

cin >> t;

while(t--){

ll n;

cin >> n;

vector<ll> arr(n);

ll j=0;

for(ll i = 0; i < n; i++){

cin >> arr[i];

if(arr[i]>arr[i+1]) j=i+1;

}



for(ll i = 0; i < j; i++){

ll mini = min(arr[i], arr[i+1]);

arr[i] -= mini;

arr[i+1] -= mini;

}



bool answer = false;

if(is_sorted(arr.begin(), arr.end())) answer = true;



if(answer) cout << "YES" << endl;

else cout << "NO" << endl;

}



return 0;

}

Submission (verdict: Runtime error on test 2):
#include <bits/stdc++.h>



using namespace std;

typedef long long ll;



int main(){

ll t;

cin >> t;

while(t--){

ll n;

cin >> n;

vector<ll> arr(n);

for(ll i = 0; i < n; i++){

cin >> arr[i];

}



ll j=0;

for(ll i = 0; i < n; i++){

if(arr[i]>arr[i+1]) j=i+1;

}



for(ll i = 0; i < j; i++){

ll mini = min(arr[i], arr[i+1]);

arr[i] -= mini;

arr[i+1] -= mini;

}



bool answer = false;

if(is_sorted(arr.begin(), arr.end())) answer = true;



if(answer) cout << "YES" << endl;

else cout << "NO" << endl;

}



return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)


Submission (verdict: Runtime error on test 2):
#include <bits/stdc++.h>



using namespace std;

typedef long long ll;



int main(){

ll t;

cin >> t;

while(t--){

ll n;

cin >> n;

vector<ll> arr(n);

ll j=0;

for(ll i = 0; i < n; i++){

cin >> arr[i];

if(arr[i]>arr[i+1]) j=i+1;

}



for(ll i = 0; i < j; i++){

ll mini = min(arr[i], arr[i+1]);

arr[i] -= mini;

arr[i+1] -= mini;

}



bool answer = false;

if(is_sorted(arr.begin(), arr.end())) answer = true;



if(answer) cout << "YES" << endl;

else cout << "NO" << endl;

}



return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)

Previous submission (verdict: Runtime error on test 2):
#include <bits/stdc++.h>



using namespace std;

typedef long long ll;



int main(){

ll t;

cin >> t;

while(t--){

ll n;

cin >> n;

vector<ll> arr(n);

for(ll i = 0; i < n; i++){

cin >> arr[i];

}



ll j=0;

for(ll i = 0; i < n; i++){

if(arr[i]>arr[i+1]) j=i+1;

}



for(ll i = 0; i < j; i++){

ll mini = min(arr[i], arr[i+1]);

arr[i] -= mini;

arr[i+1] -= mini;

}



bool answer = false;

if(is_sorted(arr.begin(), arr.end())) answer = true;



if(answer) cout << "YES" << endl;

else cout << "NO" << endl;

}



return 0;

}

Submission (verdict: Accepted):
#include <bits/stdc++.h>



using namespace std;

typedef long long ll;



int main(){

ll t;

cin >> t;

while(t--){

ll n;

cin >> n;

vector<ll> arr(n);

for(ll i = 0; i < n; i++){

cin >> arr[i];

}



ll j=0;

for(ll i = 0; i < n-1; i++){

if(arr[i]>arr[i+1]) j=i+1;

}



for(ll i = 0; i < j; i++){

ll mini = min(arr[i], arr[i+1]);

arr[i] -= mini;

arr[i+1] -= mini;

}



bool answer = false;

if(is_sorted(arr.begin(), arr.end())) answer = true;



if(answer) cout << "YES" << endl;

else cout << "NO" << endl;

}



return 0;

}
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;
// using i64 = long long;
// using i128 = __int128;

// int n,m;
// void solve(){
//     cin>>n>>m;
//     vector<int> a(n),b(m);
//     multiset<int> se1,se2;
//     for(auto &i:a) cin>>i,se1.insert(i);
//     for(auto &i:b) cin>>i,se2.insert(i);
//     for(int i )
// }

// signed main(){
//     ios::sync_with_stdio(0);cin.tie(0);
//     int t;
//     cin>>t;
//     while(t--) solve();
//     return 0;
// }
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
using i128 = __int128;

int n,m;
void solve(){
    cin>>n>>m;
    vector<int> a(n),b(m);
    multiset<int> se1,se2;
    i64 sa=0,sb=0;
    for(auto &i:a) cin>>i,se1.insert(i),sa+=i;
    for(auto &i:b) cin>>i,se2.insert(i),sb+=i;
        //int now = 0;
        if(sa!=sb){
            cout<<"No\n";
            return;
        }
    while(!se2.empty()&&se2.size()<se1.size()){
        //cout<<now<<"\n";
        multiset<int> tmp;
        for(auto i:se2){
            if(se1.find(i)==se1.end()){
                if(i/2<=0) continue;
                tmp.insert(i/2);
                tmp.insert((i+1)/2);
            }else se1.erase(se1.find(i));
        }
        se2.swap(tmp);
    }
    if(se1.size()==se2.size()){
        for(auto i:se2){
            if(se1.find(i)==se1.end()){
                cout<<"No\n";
                return;
            }
        }
        for(auto i:se1){
            if(se2.find(i)==se2.end()){
                cout<<"No\n";
                return;
            }
        }
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
}

signed main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t;
    cin>>t;
    while(t--) solve();
    return 0;
}






Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
using i128 = __int128;

int n,m;
void solve(){
    cin>>n>>m;
    vector<int> a(n),b(m);
    priority_queue<int> q;
    i64 sa=0,sb=0;
    for(auto &i:a) cin>>i,sa+=i;
    for(auto &i:b) cin>>i,sb+=i;
    if(sa!=sb){
        cout<<"No\n";
        return;
    }
    for(auto i:b) q.push(i);
    sort(a.begin(),a.end(),greater<int>());
    int idx = 0;
    //cout<<"check 1\n";
    while(!q.empty()){
       // cout<<idx<<"\n";
        if(q.top()<a[idx]){
            cout<<"No\n";
            return;
        }else if(q.top()==a[idx]){
            idx++;
            q.pop();
        }else{
            int x = q.top();
            q.pop();
            q.push(x/2);
            q.push((x+1)/2);
        }
    }
    cout<<"Yes\n";
}

signed main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t;
    cin>>t;
    while(t--) solve();
    return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)


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

int n,m;
void solve(){
    cin>>n>>m;
    vector<int> a(n),b(m);
    multiset<int> se1,se2;
    for(auto &i:a) cin>>i,se1.insert(i);
    for(auto &i:b) cin>>i,se2.insert(i);
        //int now = 0;
    while(!se2.empty()&&se2.size()<se1.size()){
        //cout<<now<<"\n";
        multiset<int> tmp;
        for(auto i:se2){
            if(se1.find(i)==se1.end()){
                if(i/2<=0) continue;
                tmp.insert(i/2);
                tmp.insert((i+1)/2);
            }else se1.erase(se1.find(i));
        }
        se2.swap(tmp);
    }
    if(se1.size()==se2.size()){
        for(auto i:se2){
            if(se1.find(i)==se1.end()){
                cout<<"No\n";
                return;
            }
        }
        cout<<"Yes\n";
    }else{
        cout<<"No\n";
    }
}

signed main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int t;
    cin>>t;
    while(t--) solve();
    return 0;
}