ShaysXIA/CodeInsightBench huggingface dataset:
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;

#define endl '\n'
// #define int long long
// const int inf = 1e18;
// const int MOD = 1000000007;
// const int mod = 998244353;

bool func(int x,map<int,int>&mp){
    int h1 = x/2,h2 = (x+1)/2;
    if(h1==0 || h2==0)return false;

    bool mila = true;

    if(mp[h1])mp[h1]--;
    else mila&=func(h1,mp);

    if(!mila)return false;
    
    if(mp[h2])mp[h2]--;
    else mila&=func(h2,mp);

    return mila;
}   

void solve(){
    int n,m;cin>>n>>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;
        if(mp[x])mp[x]--;
        else{
            if(!func(x,mp)){
                cout << "NO" << endl;return;
            }
        }
    }
    for(auto i:mp){
        if(i.second>0){
            cout << "NO" << endl;return;
        }
    }
    cout << "YES" << endl;
}   

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int tt;cin>>tt;
    while(tt--)
    solve();
    return 0;
}



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

#define endl '\n'
// #define int long long
// const int inf = 1e18;
// const int MOD = 1000000007;
// const int mod = 998244353;

bool func(int x,map<int,int>&mp){
    int h1 = x/2,h2 = (x+1)/2;
    if(h1==0 || h2==0)return false;

    bool mila = true;

    if(mp[h1]>0)mp[h1]--;
    else mila&=func(h1,mp);

    if(!mila)return false;
    
    if(mp[h2]>0){mp[h2]--;return true;}
    else return func(h2,mp);

}   

void solve(){
    int n,m;cin>>n>>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;
        if(mp[x])mp[x]--;
        else{
            if(!func(x,mp)){
                cout << "NO" << endl;return;
            }
        }
    }
    for(auto i:mp){
        if(i.second>0){
            cout << "NO" << endl;return;
        }
    }
    cout << "YES" << endl;
}   

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int tt;cin>>tt;
    while(tt--)
    solve();
    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;

#define endl '\n'
// #define int long long
// const int inf = 1e18;
// const int MOD = 1000000007;
// const int mod = 998244353;

map<int,int>mp;

bool func(int x){
    bool mila = true;
    if(mp[x]>0){mp[x]--;return true;}
    if(x==1)return false;

    return (func(x/2)&&func((x+1)/2));
}   

void solve(){
    int n,m;cin>>n>>m;
    mp.clear();
    for(int i=0;i<n;++i){
        int x;cin>>x;mp[x]++;
    }

    for(int i=0;i<m;++i){
        int x;cin>>x;
        if(!func(x)){
            cout << "NO" << endl;return;
        }
    }
    for(auto i:mp){
        if(i.second>0){
            cout << "NO" << endl;return;
        }
    }
    cout << "YES" << endl;
}   

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int tt;cin>>tt;
    while(tt--)
    solve();
    return 0;
}



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

#define endl '\n'
// #define int long long
// const int inf = 1e18;
// const int MOD = 1000000007;
// const int mod = 998244353;

bool func(int x,map<int,int>&mp){
    int h1 = x/2,h2 = (x+1)/2;
    if(h1==0 || h2==0)return false;

    bool mila = true;

    if(mp[h1])mp[h1]--;
    else mila&=func(h1,mp);

    if(!mila)return false;
    
    if(mp[h2])mp[h2]--;
    else mila&=func(h2,mp);

    return mila;
}   

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

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

    vector<int>b(m);
    for(int i=0;i<m;++i)cin>>b[i];

    for(int i=0;i<m;++i){
        int x = b[i];
        if(mp[x])mp[x]--;
        else{
            if(!func(x,mp)){
                cout << "NO" << endl;return;
            }
        }
    }
    for(auto i:mp){
        if(i.second>0){
            cout << "NO" << endl;return;
        }
    }
    cout << "YES" << endl;
}   

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int tt;cin>>tt;
    while(tt--)
    solve();
    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;

#define endl '\n'
// #define int long long
// const int inf = 1e18;
// const int MOD = 1000000007;
// const int mod = 998244353;

bool func(int x,map<int,int>&mp){
    int h1 = x/2,h2 = (x+1)/2;
    if(h1==0 || h2==0)return false;

    bool mila = true;

    if(mp[h1]>0)mp[h1]--;
    else mila&=func(h1,mp);

    if(!mila)return false;
    
    if(mp[h2]>0){mp[h2]--;return true;}
    else return func(h2,mp);

}   

void solve(){
    int n,m;cin>>n>>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;
        if(mp[x])mp[x]--;
        else{
            if(!func(x,mp)){
                cout << "NO" << endl;return;
            }
        }
    }
    for(auto i:mp){
        if(i.second>0){
            cout << "NO" << endl;return;
        }
    }
    cout << "YES" << endl;
}   

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int tt;cin>>tt;
    while(tt--)
    solve();
    return 0;
}



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

#define endl '\n'
// #define int long long
// const int inf = 1e18;
// const int MOD = 1000000007;
// const int mod = 998244353;

bool func(int x,int y,map<int,int>&mp){
    bool mila = true;
    if(x==0 || y==0)return false;
    if(mp[x]>0)mp[x]--;
    else mila&=func(x/2,(x+1)/2,mp);

    if(!mila)return false;
    
    if(mp[y]>0){mp[y]--;return true;}
    else return func(y/2,(y+1)/2,mp);

}   

void solve(){
    int n,m;cin>>n>>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;
        if(mp[x])mp[x]--;
        else{
            if(!func(x/2,(x+1)/2,mp)){
                cout << "NO" << endl;return;
            }
        }
    }
    for(auto i:mp){
        if(i.second>0){
            cout << "NO" << endl;return;
        }
    }
    cout << "YES" << endl;
}   

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int tt;cin>>tt;
    while(tt--)
    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;

#define endl '\n'
// #define int long long
// const int inf = 1e18;
// const int MOD = 1000000007;
// const int mod = 998244353;

bool func(int x,map<int,int>&mp){
    int h1 = x/2,h2 = (x+1)/2;
    if(h1==0 || h2==0)return false;

    bool mila = true;

    if(mp[h1])mp[h1]--;
    else mila&=func(h1,mp);

    if(!mila)return false;
    
    if(mp[h2])mp[h2]--;
    else mila&=func(h2,mp);

    return mila;
}   

void solve(){
    int n,m;cin>>n>>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;
        if(mp[x])mp[x]--;
        else{
            if(!func(x,mp)){
                cout << "NO" << endl;return;
            }
        }
    }
    for(auto i:mp){
        if(i.second>0){
            cout << "NO" << endl;return;
        }
    }
    cout << "YES" << endl;
}   

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int tt;cin>>tt;
    while(tt--)
    solve();
    return 0;
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 4):
/* Vivek Dhir */
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long int li;
typedef long long int ll;
#define max(a, b) (a > b ? a : b)
#define min(a, b) (a > b ? b : a)
#define FA(i, start, end) for (int i = start; i < end; i++)
#define setbits(x) __builtin_popcountll(x)// counts no. of 1s
#define zrobits(x) __builtin_ctzll(x)// counts no. of zeros on left
#define mod 1000000007
#define INF 322337200489576
#define VI vector<int>
#define VL vector<ll>
#define AI(arr, t) VL arr(t); FA(i, 0, t) cin>>arr[i];
#define print(arr) for(auto x: arr) cout<< x <<' '; cout<<'\n';
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define ff first
#define ss second
#define MP make_pair
#define WINNING() ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
#ifndef ONLINE_JUDGE
#define debug(x) cerr << x<< endl;
#endif
ll expo(ll a, ll b, ll M) {ll res = 1; while (b > 0) {if (b & 1)res = (res * a) % M; a = (a * a) % M; b = b >> 1;} return res;}
void fil(){ 
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);freopen("out.txt", "w", stdout);freopen("error.txt", "w", stderr); 
#endif
}
/*-------------------------------------------------------------------------------------------------------------------------------------*/

int ans(vector<vector<int> > &dp,string &a, string &b, string &c, int i, int j, int k){
    if(c.length()==k){
        return 0;
    }
    int fans = INT_MAX;
    if(i==a.length()){
        if(b[j]==c[k]){
            fans = min(fans, ans(dp, a, b, c, i, j+1, k+1));
        }
        else{
            fans = min(fans, ans(dp, a, b, c, i, j+1, k+1)+1);
        }
    }if(j==b.length()){
        if(a[i]==c[k]){
            fans = min(fans, ans(dp, a, b, c, i+1, j, k+1));
        }
        else{
            fans = min(fans, ans(dp, a, b, c, i+1, j, k+1)+1);
        }
    }
    if(j!=b.length() && i!=a.length()){
        if(a[i]==c[k]){
            fans = min(fans, ans(dp, a, b, c, i+1, j, k+1));
        }
        if(b[j]==c[k]){
            fans = min(fans, ans(dp, a, b, c, i, j+1, k+1));
        }
        if(b[j]!=c[k] || a[i]==c[k]){
            fans = min(fans, min(ans(dp, a, b, c, i, j+1, k+1)+1,  ans(dp, a, b, c, i+1, j, k+1)+1));
        }
    }
    return dp[i][j] = fans;
}

void solve(){
    string a, b, c;
    cin>>a>>b>>c;
    // cout<< a<<" "<<b<<" "<<c<<" ";
    vector<vector<int> > dp(a.length()+1, vector<int>(b.length()+1, 0));
    cout<<ans(dp, a, b, c, 0, 0, 0)<<"\n";
}

int main(){
    WINNING(); fil(); 
    ll t = 1;
    cin>>t;
    FA(i, 1, t+1){
        // cout << "Case #"<< i <<": ";
        solve(); 
        //cout<<"\n";
    }
}
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)


Submission (verdict: Time limit exceeded on test 1):
#include<bits/stdc++.h>

using namespace std;

using ll =long long;

using pii=pair<int,int>;

#define yes cout<<"YES"<<endl;

#define no cout<<"NO"<<endl;

#define all(v) v.begin(),v.end()

using namespace std;





void solve(){

    ll n,m;

    cin>>n>>m;

    vector<ll>a(n),b(n);

    for(auto &it:a)cin>>it;

    for(auto &it:b)cin>>it;

    map<ll,ll>freq_a,freq_b;

    set<ll,greater<ll>>set_a,set_b;

    for(auto value:a){

        freq_a[value]++;

        set_a.insert(value);

    }

    for(auto value:b){

        freq_b[value]++;

        set_b.insert(value);

    }

    while(true){

        if(set_a.empty() and set_b.empty()){

            yes

            return;

        }

        if(set_a.empty() or set_b.empty()){

            no

            return;

        }

        ll max_b=*set_b.begin();

        ll max_a=*set_a.begin();

        if(max_a>max_b){

            no

            return;

        }

        if(freq_a[max_b]){

            ll min_count=min(freq_a[max_b],freq_b[max_b]);

            freq_a[max_b]=min_count;

            freq_b[max_b]=min_count;

            

            if (freq_a[max_b] == 0) set_a.erase(max_b);

            if (freq_b[max_b] == 0) set_b.erase(max_b);

        }

        else{

            ll part1=max_b/2;

            ll part2=(max_b+1)/2;

            ll count=freq_b[max_b];

            freq_b[max_b]=0;

            set_b.erase(max_b);



            freq_b[part1]+=count;

            freq_b[part2]+=count;

            set_b.insert(part1);

            set_b.insert(part2);

        }

    }

}

int main(){

    ios::sync_with_stdio(false); cin.tie(0);cout.tie(0);

    int t=1;

    cin>>t;

    while(t--){

        solve();

    }

    return 0; 

}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 4):
// ����ʡʵ����ѧ ���� 21�� ������

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define re register

const ll INF = 0x7FFFFFFFFFFFFFFF;
using namespace std;

inline ll read(){
	register ll x=0;bool flag=1;char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-')flag=0;ch=getchar();}
	while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	if(flag) return x;
	return ~(x-1);
}

ll n;
ll c[2000]; 
pair<ll, ll> ans[2000000];
ll tot = 0;

int main() {
	n = read();
	for (int i = 1; i <= n; i++) c[i] = read();
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (c[j] == i) break;
			if (c[j] < i) {
				tot++;
				ans[tot] = make_pair(i, c[j]);
				tot++;
				ans[tot] = make_pair(c[j], i);
			}
			else {
				tot++;
				ans[tot] = make_pair(c[j], i);
			}
		}
	}
	cout << tot << endl;
	for (int i = 1; i <= tot; i++) cout << ans[i].first << " " << ans[i].second << endl;
	return 0;
}





Submission (verdict: Wrong answer on test 4):
// ����ʡʵ����ѧ ���� 21�� ������

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define re register

const ll INF = 0x7FFFFFFFFFFFFFFF;
using namespace std;

inline ll read(){
	register ll x=0;bool flag=1;char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-')flag=0;ch=getchar();}
	while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	if(flag) return x;
	return ~(x-1);
}

ll n;
ll c[2000]; 
pair<ll, ll> ans[2000000];
ll tot = 0;



int main() {
	n = read();
	for (int i = 1; i <= n; i++) c[i] = read();
	for (int i = 1; i <= n; i++) {
		int x = c[n - i + 1];
		for (int j = 1; j <= n; j++) {
			if (c[j] == x) break;
			if (c[j] < x) {
				tot++;
				ans[tot] = make_pair(x, c[j]);
				tot++;
				ans[tot] = make_pair(c[j], x);
			}
			else {
				tot++;
				ans[tot] = make_pair(c[j], x);
			}
		}
	}
	cout << tot << endl;
//	sort(ans + 1, ans + tot + 1, cmp);
	for (int i = 1; i <= tot; i++) cout << ans[i].first << " " << ans[i].second << endl;
	return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 4):
// ����ʡʵ����ѧ ���� 21�� ������

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define re register

const ll INF = 0x7FFFFFFFFFFFFFFF;
using namespace std;

inline ll read(){
	register ll x=0;bool flag=1;char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-')flag=0;ch=getchar();}
	while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	if(flag) return x;
	return ~(x-1);
}

ll n;
ll c[2000]; 
pair<ll, ll> ans[2000000];
ll tot = 0;

int main() {
	n = read();
	for (int i = 1; i <= n; i++) c[i] = read();
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= n; j++) {
			if (c[j] == i) break;
			if (c[j] < i) {
				tot++;
				ans[tot] = make_pair(i, c[j]);
				tot++;
				ans[tot] = make_pair(c[j], i);
			}
			else {
				tot++;
				ans[tot] = make_pair(c[j], i);
			}
		}
	}
	cout << tot << endl;
	for (int i = 1; i <= tot; i++) cout << ans[i].first << " " << ans[i].second << endl;
	return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 4):
// ����ʡʵ����ѧ ���� 21�� ������

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define re register

const ll INF = 0x7FFFFFFFFFFFFFFF;
using namespace std;

inline ll read(){
	register ll x=0;bool flag=1;char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-')flag=0;ch=getchar();}
	while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	if(flag) return x;
	return ~(x-1);
}

ll n;
ll c[2000]; 
pair<ll, ll> ans[2000000];
ll tot = 0;



int main() {
	n = read();
	for (int i = 1; i <= n; i++) c[i] = read();
	for (int i = 1; i <= n; i++) {
		int x = c[n - i + 1];
		for (int j = 1; j <= n; j++) {
			if (c[j] == x) break;
			if (c[j] < x) {
				tot++;
				ans[tot] = make_pair(x, c[j]);
				tot++;
				ans[tot] = make_pair(c[j], x);
			}
			else {
				tot++;
				ans[tot] = make_pair(c[j], x);
			}
		}
	}
	cout << tot << endl;
//	sort(ans + 1, ans + tot + 1, cmp);
	for (int i = 1; i <= tot; i++) cout << ans[i].first << " " << ans[i].second << endl;
	return 0;
}





Submission (verdict: Accepted):
// ����ʡʵ����ѧ ���� 21�� ������

#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define re register

const ll INF = 0x7FFFFFFFFFFFFFFF;
using namespace std;

inline ll read(){
	register ll x=0;bool flag=1;char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-')flag=0;ch=getchar();}
	while(ch>='0'&&ch<='9') {x=(x<<3)+(x<<1)+ch-'0';ch=getchar();}
	if(flag) return x;
	return ~(x-1);
}

ll n;
ll c[2000]; 
ll weizhi[2000];
pair<ll, ll> ans[2000000];
ll tot = 0;
bool wancheng[2000];

int main() {
	n = read();
	for (int i = 1; i <= n; i++) {
		c[i] = read();
		weizhi[c[i]] = i;
		wancheng[i] = 0;
	}
	for (int i = 1; i <= n; i++) {
		int x = c[n - i + 1];
		wancheng[x] = 1;
		for (int j = x - 1; j > 0; j--) {
			if (wancheng[j] == 0) {
				tot++;
				ans[tot] = make_pair(x, j);
			}
		}
		for (int j = 1; j <= n; j++) {
			if (weizhi[j] < weizhi[x]) {
				tot++;
				ans[tot] = make_pair(j, x);
			}
		}
	}
	cout << tot << endl;
//	sort(ans + 1, ans + tot + 1, cmp);
	for (int i = 1; i <= tot; i++) cout << ans[i].first << " " << ans[i].second << endl;
	return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
using namespace std;

void solve() {
    int n, m;
    cin >> n >> m;
    vector<long long> a(n), b(m);
    long long sum_a = 0, sum_b = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum_a += a[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
        sum_b += b[i];
    }
    if (sum_a != sum_b) {
        cout << "No\n";
        return;
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    
    int i = 0, j = 0;
    while (i < n && j < m) {
        long long current_sum = 0;
        long long current_max = a[i];
        while (i < n) {
            current_sum += a[i];
            current_max = max(current_max, a[i]);
            i++;
            if (current_sum == b[j]) {
                if (current_max > b[j]) {
                    cout << "No\n";
                    return;
                }
                j++;
                break;
            } else if (current_sum > b[j]) {
                cout << "No\n";
                return;
            }
        }
    }
    if (j == m) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}

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

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

void solve() {
    int n, m;
    cin >> n >> m;
    vector<long long> a(n), b(m);
    long long sum_a = 0, sum_b = 0;
    for (auto &x : a) {
        cin >> x;
        sum_a += x;
    }
    for (auto &x : b) {
        cin >> x;
        sum_b += x;
    }
    if (sum_a != sum_b) {
        cout << "No\n";
        return;
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    
    int i = 0, j = 0;
    while (i < n && j < m) {
        long long current_sum = 0;
        long long current_max = 0;
        int start_i = i;
        while (i < n) {
            current_sum += a[i];
            current_max = max(current_max, a[i]);
            i++;
            if (current_sum == b[j]) {
                int group_size = i - start_i;
                if (current_max > b[j]) {
                    cout << "No\n";
                    return;
                }
                if (group_size == 2) {
                    if (a[i-1] - a[start_i] > 1) {
                        cout << "No\n";
                        return;
                    }
                }
                long long rem = current_sum - current_max;
                if (rem < group_size - 1) {
                    cout << "No\n";
                    return;
                }
                j++;
                break;
            } else if (current_sum > b[j]) {
                cout << "No\n";
                return;
            }
        }
    }
    cout << (j == m ? "Yes\n" : "No\n");
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--) solve();
    return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)


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

void solve() {
    int n, m;
    cin >> n >> m;
    vector<long long> a(n), b(m);
    long long sum_a = 0, sum_b = 0;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        sum_a += a[i];
    }
    for (int i = 0; i < m; ++i) {
        cin >> b[i];
        sum_b += b[i];
    }
    if (sum_a != sum_b) {
        cout << "No\n";
        return;
    }
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    
    int i = 0, j = 0;
    while (i < n && j < m) {
        long long current_sum = 0;
        long long current_max = a[i];
        while (i < n) {
            current_sum += a[i];
            current_max = max(current_max, a[i]);
            i++;
            if (current_sum == b[j]) {
                if (current_max > b[j]) {
                    cout << "No\n";
                    return;
                }
                j++;
                break;
            } else if (current_sum > b[j]) {
                cout << "No\n";
                return;
            }
        }
    }
    if (j == m) {
        cout << "Yes\n";
    } else {
        cout << "No\n";
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--) solve();
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>

using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    int sum = v[n - 1];
    bool ok = true;
    for (int i = n - 2; i >= 0; --i) {
        if (v[i] > sum) {
            ok = false;
            break;
        }
        sum += v[i];
    }
    if (ok) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}

Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>

using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<long long> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i];
    }
    long long sum = v[n - 1];
    bool ok = true;
    for (int i = n - 2; i >= 0; --i) {
        if (v[i] > sum) {
            ok = false;
            break;
        }
        sum += v[i];
    }
    if (ok) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }
}

signed main() {
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}