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

Previous submission (verdict: Runtime error on test 3):
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
void solve(){
    int n,m;
    cin>>n>>m;
    vector<int>a(n),b(m);
    for(auto & i : a) cin>>i;
    for(auto & i : b) cin>>i;
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    multiset<int>sb(b.begin(),b.end());
    
    if(n<m){
        cout<<"NO"<<endl;
        return;
    }
    else if(n==m){
        if(a==b){
            cout<<"YES"<<endl;
            return;
        }
        cout<<"NO"<<endl;
        return;
    }
    vector<int>na;
    int i = 0,j = 0 ;
    int prev = 0 ;
    int sum = 0 ;
    while(i<n and j<m){
        if((abs(a[i]-sum)<=1) or (prev == 0) ){
            sum+=a[i];
            //cout<<"sum is : "<<sum<<" ";
        }
        if((sb.find(sum)!=sb.end()) or (b[j]==sum)){
            sb.erase(sb.find(sum));
            //cout<<"yaha ayaa "<<endl;
            na.push_back(sum);
            sum=0;
            prev=0;
            j++;
        }
        else if(sum<b[j]){
            prev = sum;
        }
        
        i++;
    }
    if(i<n){
        cout<<"NO"<<endl;
        return;
        
    }
    //cout<<" kya hua "<<endl;
    if(na.empty()){
       // cout<<"khali h kya ?"<<endl;
    }
    //for(auto & it : na){
    //   cout<<it<<" ";
        
        
    //}
    //cout<<endl;
    sort(na.begin(),na.end());
    if(na==b){
        cout<<"YES"<<endl;
        return;
    }
    cout<<"NO"<<endl;
}
int32_t main(){
    int t; cin>>t;
    while(t--)  solve();
}

Submission (verdict: Wrong answer on test 3):
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
void solve(){
    int n,m;
    cin>>n>>m;
    vector<int>a(n),b(m);
    for(auto & i : a) cin>>i;
    for(auto & i : b) cin>>i;
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    multiset<int>sb(b.begin(),b.end());
    
    if(n<m){
        cout<<"NO"<<endl;
        return;
    }
    else if(n==m){
        if(a==b){
            cout<<"YES"<<endl;
            return;
        }
        cout<<"NO"<<endl;
        return;
    }
    vector<int>na;
    int i = 0,j = 0 ;
    int prev = 0 ;
    int sum = 0 ;
    while(i<n and j<m){
        if((abs(a[i]-sum)<=1) or (prev == 0) ){
            sum+=a[i];
            //cout<<"sum is : "<<sum<<" ";
        }
        if((sb.find(sum)!=sb.end()) or (b[j]==sum)){
            if((sb.find(sum)!=sb.end())){
                sb.erase(sb.find(sum));
            }
            
            //cout<<"yaha ayaa "<<endl;
            na.push_back(sum);
            sum=0;
            prev=0;
            j++;
        }
        else if(sum<b[j]){
            prev = sum;
        }
        
        i++;
    }
    if(i<n){
        cout<<"NO"<<endl;
        return;
        
    }
    //cout<<" kya hua "<<endl;
    if(na.empty()){
       // cout<<"khali h kya ?"<<endl;
    }
    //for(auto & it : na){
    //   cout<<it<<" ";
        
        
    //}
    //cout<<endl;
    sort(na.begin(),na.end());
    if(na==b){
        cout<<"YES"<<endl;
        return;
    }
    cout<<"NO"<<endl;
}
int32_t main(){
    int t; cin>>t;
    while(t--)  solve();
}