ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<algorithm>
using namespace std;

const int N = 1e5 + 10;
int t;
int n, l, r;
int a[N];

int main()
{
	cin >> t;
	while (t--)
	{
		cin >> n >> l >> r;
		for (int i = 1; i <= n; i++)
			cin >> a[i];
		sort(a + 1, a + 1 + n);
		
		int sum = 0;
		for (int i = 1; i <= r - l + 1; i++)
			sum += a[i];
		cout << sum << endl;
	}

	return 0;
}

Submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<algorithm>
using namespace std;

typedef long long ll;

const ll N = 1e5 + 10;
ll t;
ll n, l, r;
ll a[N];

int main()
{
	cin >> t;
	while (t--)
	{
		cin >> n >> l >> r;
		for (int i = 1; i <= n; i++)
			cin >> a[i];
		sort(a + 1, a + 1 + n);
		
		ll sum = 0;
		for (int i = 1; i <= r - l + 1; i++)
			sum += a[i];
		cout << sum << endl;
	}

	return 0;
}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

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

#include<algorithm>

using namespace std;



const int N = 1e5 + 10;

int t, n, r, l;

int a[N], sum[N];



int main()

{

	cin >> t;

	while (t--)

	{

		cin >> n >> l >> r;

		for (int i = 1; i <= n; i++)

			cin >> a[i];



		if (l > 1 && r < n)

		{

			sort(a + 1, a + l);

			sort(a + l, a + r + 1);

			sort(a + r + 1, a + 1 + n);

		}

		else if (l == 1 && r < n)

		{

			sort(a + 1, a + r + 1);

			sort(a + r + 1, a + 1 + n);

		}

		else if (l > 1 && r == n)

		{

			sort(a + 1, a + l);

			sort(a + l, a + n + 1);

		}

		else

			sort(a + 1, a + 1 + n);



		cout << endl;



		if (l > 1)

		{

			sum[0] = 0;

			for (int i = 1; i <= l - 1; i++)

				sum[i] = sum[i - 1] + a[i];

		}

		sum[r] = a[r];

		for (int i = r-1; i >=l; i--)

			sum[i] = sum[i + 1] + a[i];

		if (r < n)

		{

			sum[r + 1] = a[r + 1];

			for (int i = r + 2; i <= n; i++)

				sum[i] = sum[i - 1] + a[i];

		}



		//左边

		int ans1 = sum[l];

		if (l > 1)

		{

			for (int i = 1; i <= min(l - 1, r - l + 1); i++)

			{

				if (sum[i] < sum[r - i + 1])

					ans1 = min(ans1, sum[l] - sum[r - i + 1] + sum[i]);

			}

		}



		//右边

		int ans2 = sum[l];

		if (r < n)

		{

			for (int i = r + 1; i <= min(n, r + 1 + r - l); i++)

			{

				if (sum[i] < sum[r - (i - r) + 1])

					ans2 = min(ans2, sum[l] - sum[r - (i - r) + 1] + sum[i]);

			}

		}



		int ans = min(ans1, ans2);

		cout << ans << endl;



	}



	return 0;

}

Submission (verdict: Accepted):
#include<iostream>

#include<algorithm>

using namespace std;



typedef long long ll;

const int N = 1e5 + 10;

int t, n, r, l;

ll a[N], sum[N];



int main()

{

	cin >> t;

	while (t--)

	{

		cin >> n >> l >> r;

		for (int i = 1; i <= n; i++)

			cin >> a[i];



		if (l > 1 && r < n)

		{

			sort(a + 1, a + l);

			sort(a + l, a + r + 1);

			sort(a + r + 1, a + 1 + n);

		}

		else if (l == 1 && r < n)

		{

			sort(a + 1, a + r + 1);

			sort(a + r + 1, a + 1 + n);

		}

		else if (l > 1 && r == n)

		{

			sort(a + 1, a + l);

			sort(a + l, a + n + 1);

		}

		else

			sort(a + 1, a + 1 + n);



		if (l > 1)

		{

			sum[0] = 0;

			for (int i = 1; i <= l - 1; i++)

				sum[i] = sum[i - 1] + a[i];

		}

		sum[r] = a[r];

		for (int i = r-1; i >=l; i--)

			sum[i] = sum[i + 1] + a[i];

		if (r < n)

		{

			sum[r + 1] = a[r + 1];

			for (int i = r + 2; i <= n; i++)

				sum[i] = sum[i - 1] + a[i];

		}



		//左边

		ll ans1 = sum[l];

		if (l > 1)

		{

			for (int i = 1; i <= min(l - 1, r - l + 1); i++)

			{

				if (sum[i] < sum[r - i + 1])

					ans1 = min(ans1, sum[l] - sum[r - i + 1] + sum[i]);

			}

		}



		//右边

		ll ans2 = sum[l];

		if (r < n)

		{

			for (int i = r + 1; i <= min(n, r + 1 + r - l); i++)

			{

				if (sum[i] < sum[r - (i - r) + 1])

					ans2 = min(ans2, sum[l] - sum[r - (i - r) + 1] + sum[i]);

			}

		}



		ll ans = min(ans1, ans2);

		cout << ans << endl;



	}



	return 0;

}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <stdio.h>

#include <string>

#include <iostream>

using namespace std;



int main(){

	int t;

	scanf("%d",&t);

	for(int uu=0;uu<t;uu++){

		string p;

		cin >> p;

		int c1=p.size();

		for(int i=1;i<c1;i++){

			char p1=p[i-1];

			if(p[i]>p[i-1]+1){

				p[i-1]=p[i]-1;

				p[i]=p1;

				i=i-1;

			}

			if(p[i+1]>p[i]+1){

				char p1=p[i];

				p[i]=p[i+1]-1;

				p[i+1]=p1;

				i=i-1;

			}

		}

		cout << p <<endl;

	}

	

	

	return 0;

}

Submission (verdict: Accepted):
#include <stdio.h>

#include <string>

#include <iostream>

using namespace std;



int main(){

	int t;

	scanf("%d",&t);

	for(int uu=0;uu<t;uu++){

		string p;

		cin >> p;

		int c1=p.size();

		for(int j=0;j<9;j++){

			for(int i=1;i<c1;i++){

				char p1=p[i-1];

				if(p[i]>p[i-1]+1){

					p[i-1]=p[i]-1;

					p[i]=p1;

				}

			}

		}

		cout << p <<endl;

	}

	

	

	return 0;

}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 6):
#include <stdio.h>

#include <string>

#include <iostream>

using namespace std;



int main(){

	int t;

	scanf("%d",&t);

	for(int uu=0;uu<t;uu++){

		string p;

		cin >> p;

		int c1=p.size();

		for(int i=1;i<c1;i++){

			char p1=p[i-1];

			if(p[i]>p[i-1]+1){

				p[i-1]=p[i]-1;

				p[i]=p1;

				i=0;

			}

		}

		cout << p <<endl;

	}

	

	

	return 0;

}

Submission (verdict: Wrong answer on test 2):
#include <stdio.h>

#include <string>

#include <iostream>

using namespace std;



int main(){

	int t;

	scanf("%d",&t);

	for(int uu=0;uu<t;uu++){

		string p;

		cin >> p;

		int c1=p.size();

		for(int i=1;i<c1;i++){

			char p1=p[i-1];

			if(p[i]>p[i-1]+1){

				p[i-1]=p[i]-1;

				p[i]=p1;

				i=i-1;

			}else if(p[i+1]>p[i]+1){

				char p1=p[i];

				p[i]=p[i+1]-1;

				p[i+1]=p1;

				i=i-1;

			}

		}

		cout << p <<endl;

	}

	

	

	return 0;

}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <stdio.h>

#include <string>

#include <iostream>

using namespace std;



int main(){

	int t;

	scanf("%d",&t);

	for(int uu=0;uu<t;uu++){

		string p;

		cin >> p;

		int c1=p.size();

		for(int i=1;i<c1;i++){

			char p1=p[i-1];

			if(p[i]>p[i-1]+1){

				p[i-1]=p[i]-1;

				p[i]=p1;

				i=i-1;

			}else if(p[i+1]>p[i]+1){

				char p1=p[i];

				p[i]=p[i+1]-1;

				p[i+1]=p1;

				i=i-1;

			}

		}

		cout << p <<endl;

	}

	

	

	return 0;

}

Submission (verdict: Wrong answer on test 2):
#include <stdio.h>

#include <string>

#include <iostream>

using namespace std;



int main(){

	int t;

	scanf("%d",&t);

	for(int uu=0;uu<t;uu++){

		string p;

		cin >> p;

		int c1=p.size();

		for(int i=1;i<c1;i++){

			char p1=p[i-1];

			if(p[i]>p[i-1]+1){

				p[i-1]=p[i]-1;

				p[i]=p1;

				i=i-1;

			}

			if(p[i+1]>p[i]+1){

				char p1=p[i];

				p[i]=p[i+1]-1;

				p[i+1]=p1;

				i=i-1;

			}

		}

		cout << p <<endl;

	}

	

	

	return 0;

}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)


Submission (verdict: Time limit exceeded on test 6):
#include <stdio.h>

#include <string>

#include <iostream>

using namespace std;



int main(){

	int t;

	scanf("%d",&t);

	for(int uu=0;uu<t;uu++){

		string p;

		cin >> p;

		int c1=p.size();

		for(int i=1;i<c1;i++){

			char p1=p[i-1];

			if(p[i]>p[i-1]+1){

				p[i-1]=p[i]-1;

				p[i]=p1;

				i=0;

			}

		}

		cout << p <<endl;

	}

	

	

	return 0;

}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
using namespace std;
using LL = long long;
typedef pair<int, int> PII;
typedef unsigned long long ULL;
const int N = 2e6 + 10, M = 5010, mod = 998244353;
const int inf = 1e18;
mt19937_64 rng(time(0));
void solve() {
	int n;
	cin >> n;
	vector <int> a(n + 1);
	int ans = 0;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		ans += a[i];
	}
	for(int i = 1; i <= n; i++){
		int s = 0;
		for(int j = 1; j <= n - i; j++){
			a[j] = a[j + 1] - a[j];
			s += a[j];
			//cout << a[j] << " \n"[ j == n - i ];
		}
		ans = max(ans, abs(s));
	}
	cout << ans << "\n";
}
signed main() {
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int T = 1;
    cin >> T;
    while(T--) {
        solve();
    }
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
using namespace std;
using LL = long long;
typedef pair<int, int> PII;
typedef unsigned long long ULL;
const int N = 2e6 + 10, M = 5010, mod = 998244353;
const int inf = 1e18;
mt19937_64 rng(time(0));
void solve() {
	int n;
	cin >> n;
	vector <int> a(n + 1);
	int ans = 0;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		ans += a[i];
	}
	for(int i = 1; i <= n; i++){
		int s = 0;
		for(int j = 1; j <= n - i; j++){
			a[j] = a[j + 1] - a[j];
			s += a[j];
			//cout << a[j] << " \n"[ j == n - i ];
			ans = max(ans, abs(s));
		}
	}
	cout << ans << "\n";
}
signed main() {
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int T = 1;
    cin >> T;
    while(T--) {
        solve();
    }
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
using namespace std;
using LL = long long;
typedef pair<int, int> PII;
typedef unsigned long long ULL;
const int N = 2e6 + 10, M = 5010, mod = 998244353;
const int inf = 1e18;
mt19937_64 rng(time(0));
void solve() {
	int n;
	cin >> n;
	vector <int> a(n + 1);
	int ans = 0;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		ans += abs(a[i]);
	}
	for(int i = 1; i <= n; i++){
		int s = 0;
		for(int j = 1; j <= n - i; j++){
			a[j] = a[j + 1] - a[j];
			s += a[j];
			//cout << a[j] << " \n"[ j == n - i ];
		}
		ans = max(ans, abs(s));
	}
	cout << ans << "\n";
}
signed main() {
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int T = 1;
    cin >> T;
    while(T--) {
        solve();
    }
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
using namespace std;
using LL = long long;
typedef pair<int, int> PII;
typedef unsigned long long ULL;
const int N = 2e6 + 10, M = 5010, mod = 998244353;
const int inf = 1e18;
mt19937_64 rng(time(0));
void solve() {
	int n;
	cin >> n;
	vector <int> a(n + 1);
	int ans = 0;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		ans += abs(a[i]);
	}
	for(int i = 1; i <= n; i++){
		int s = 0;
		for(int j = 1; j <= n - i; j++){
			a[j] = a[j + 1] - a[j];
			s += a[j];
			//cout << a[j] << " \n"[ j == n - i ];
		}
		ans = max(ans, abs(s));
	}
	cout << ans << "\n";
}
signed main() {
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int T = 1;
    cin >> T;
    while(T--) {
        solve();
    }
}

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
using namespace std;
using LL = long long;
typedef pair<int, int> PII;
typedef unsigned long long ULL;
const int N = 2e6 + 10, M = 5010, mod = 998244353;
const int inf = 1e18;
mt19937_64 rng(time(0));
void solve() {
	int n;
	cin >> n;
	vector <int> a(n + 1);
	int ans = 0;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		ans += a[i];
	}
	for(int i = 1; i <= n; i++){
		int s = 0;
		for(int j = 1; j <= n - i; j++){
			a[j] = a[j + 1] - a[j];
			s += a[j];
			//cout << a[j] << " \n"[ j == n - i ];
		}
		ans = max(ans, abs(s));
	}
	cout << ans << "\n";
}
signed main() {
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int T = 1;
    cin >> T;
    while(T--) {
        solve();
    }
}
Problem: 2050B - Transfusion
Language: C++20 (GCC 13-64)


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

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin>>n;
        vector<int> v;
        int a,sum=0;
        for(int i=0;i<n;i++){
            cin>>a;
            sum+=a;
            v.push_back(a);
        }
        if(sum%n) cout<<"No"<<endl;
        else{
            int req = sum/n;
            int store1=0,store2=0;
            for(int i=0;i<n;i++){
                if(i==0)  store1 = req - v[i];
                else if(i==1) store2 = req - v[i];
                else {
                    if(i%2==0){
                        v[i]-=store1;
                        store1 = req - v[i];
                    }
                    else{
                        v[i]-=store2;
                        store2 = req - v[i];
                    }
                }     
            }
            if(v[n-1]==req && v[n-2]==req) cout<<"Yes"<<endl;
                else cout<<"No"<<endl;
        }
    }
    
}
Problem: 2050B - Transfusion
Language: C++20 (GCC 13-64)

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

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin>>n;
        vector<int> v;
        int a,sum=0;
        for(int i=0;i<n;i++){
            cin>>a;
            sum+=a;
            v.push_back(a);
        }
        if(sum%n) cout<<"No"<<endl;
        else{
            int req = sum/n;
            int store1=0,store2=0;
            for(int i=0;i<n;i++){
                if(i==0)  store1 = req - v[i];
                else if(i==1) store2 = req - v[i];
                else {
                    if(i%2==0){
                        v[i]-=store1;
                        store1 = req - v[i];
                    }
                    else{
                        v[i]-=store2;
                        store2 = req - v[i];
                    }
                }     
            }
            if(v[n-1]==req && v[n-2]==req) cout<<"Yes"<<endl;
                else cout<<"No"<<endl;
        }
    }
    
}

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

int main() {
    int t;
    cin >> t;
    while (t--) {
        long long int n;
        cin>>n;
        vector<long long int> v;
        long long int a;
        for(long long int i=0;i<n;i++){
            cin>>a;
            sum+=a;
            v.push_back(a);
        }
        if(sum%n) cout<<"No"<<endl;
        else{
            long long int req = sum/n;
            long long int store1=0,store2=0;
            for(long long int i=0;i<n;i++){
                if(i==0)  store1 = req - v[i];
                else if(i==1) store2 = req - v[i];
                else {
                    if(i%2==0){
                        v[i]-=store1;
                        store1 = req - v[i];
                    }
                    else{
                        v[i]-=store2;
                        store2 = req - v[i];
                    }
                }     
            }
            if(v[n-1]==req && v[n-2]==req) cout<<"Yes"<<endl;
                else cout<<"No"<<endl;
        }
    }
    
}
Problem: 2050B - Transfusion
Language: C++20 (GCC 13-64)

Previous submission (verdict: Compilation error):
#include <bits/stdc++.h>
using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        long long int n;
        cin>>n;
        vector<long long int> v;
        long long int a;
        for(long long int i=0;i<n;i++){
            cin>>a;
            sum+=a;
            v.push_back(a);
        }
        if(sum%n) cout<<"No"<<endl;
        else{
            long long int req = sum/n;
            long long int store1=0,store2=0;
            for(long long int i=0;i<n;i++){
                if(i==0)  store1 = req - v[i];
                else if(i==1) store2 = req - v[i];
                else {
                    if(i%2==0){
                        v[i]-=store1;
                        store1 = req - v[i];
                    }
                    else{
                        v[i]-=store2;
                        store2 = req - v[i];
                    }
                }     
            }
            if(v[n-1]==req && v[n-2]==req) cout<<"Yes"<<endl;
                else cout<<"No"<<endl;
        }
    }
    
}

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

int main() {
    int t;
    cin >> t;
    while (t--) {
        long long int n;
        cin>>n;
        vector<long long int> v;
        long long int a,sum=0;
        for(long long int i=0;i<n;i++){
            cin>>a;
            sum+=a;
            v.push_back(a);
        }
        if(sum%n) cout<<"No"<<endl;
        else{
            long long int req = sum/n;
            long long int store1=0,store2=0;
            for(long long int i=0;i<n;i++){
                if(i==0)  store1 = req - v[i];
                else if(i==1) store2 = req - v[i];
                else {
                    if(i%2==0){
                        v[i]-=store1;
                        store1 = req - v[i];
                    }
                    else{
                        v[i]-=store2;
                        store2 = req - v[i];
                    }
                }     
            }
            if(v[n-1]==req && v[n-2]==req) cout<<"Yes"<<endl;
                else cout<<"No"<<endl;
        }
    }
    
}
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 ll long long

void solve(){

	int n,m,num;

	priority_queue<int, vector<int>, greater<int>>a,b;

	cin>>n>>m;

	for(int i=1;i<=n;i++){

		cin>>num;

		a.push(num);

	}

	for(int i=1;i<=m;i++){

		cin>>num;

		b.push(num);

	}

	while(n>0&&m>0){

		int x=a.top();

		int y=b.top();

		a.pop();

		b.pop();

		n--;

		m--;

		if(x==y){

			continue;

		}

		else{

			if(x<y&&n>0){

				int z=a.top();

				a.pop();

				n--;

				if(z-x<=1){

					a.push(x+z);

				}

				else{

					cout<<"NO"<<endl; 

					return;

				}

				b.push(y);

			}

			else{

				cout<<"NO"<<endl;

				return;

			}

		}

	}

	cout<<((n==0&&m==0)?"YES":"NO")<<endl;

	return;

}

int main(){

	ios::sync_with_stdio(false);

    cin.tie(nullptr);

    //cout.tie(nullptr);

	int t;

	cin>>t;

	while(t--){

		solve();

	}

} 

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

using namespace std;

#define ll long long

int n;

map<int,int> a;

bool dfs(int num){

	if(a[num]){

		a[num]--;

		n--;

		return 1;

	}

	if(num<=1){

		return 0;

	}

	return dfs(num/2)&&dfs(num-num/2);

}

void solve(){

	int m,num;

	a.clear();

	cin>>n>>m;

	for(int i=1;i<=n;i++){

		cin>>num;

		a[num]++;

	}

	for(int i=1;i<=m;i++){

		cin>>num;

		if(!dfs(num)){

			cout<<"NO"<<endl; 

			return ;

		}

	} 

	cout<<(!n?"YES":"NO")<<endl;

	return;

}

int main(){

	ios::sync_with_stdio(false);

    cin.tie(nullptr);

    //cout.tie(nullptr);

	int t;

	cin>>t;

	while(t--){

		solve();

	}

}
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 ll long long

int n;

map<ll,ll> a;

bool dfs(ll num){

	if(a[num]){

		a[num]--;

		n--;

		return 1;

	}

	if(num<=1){

		return 0;

	}

	return dfs(num/2)&&dfs(num-num/2);

}

void solve(){

	ll m,num;

	a.clear();

	cin>>n>>m;

	for(int i=1;i<=n;i++){

		cin>>num;

		a[num]++;

	}

	for(int i=1;i<=m;i++){

		cin>>num;

		if(!dfs(num)){

			cout<<"NO"<<endl; 

			return;

		}

	} 

	cout<<(!n?"YES":"NO")<<endl;

	return;

}

int main(){

	ios::sync_with_stdio(false);

    cin.tie(nullptr);

    //cout.tie(nullptr);

	int t;

	cin>>t;

	while(t--){

		solve();

	}

} 

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

using namespace std;

#define ll long long

int n;

map<ll,ll> a;

bool dfs(ll num){

	if(a[num]){

		a[num]--;

		n--;

		return 1;

	}

	if(num<=1){

		return 0;

	}

	return dfs(num/2)&&dfs(num-num/2);

}

void solve(){

	ll m,num;

	a.clear();

	cin>>n>>m;

	vector<ll> b(m+1);

	for(int i=1;i<=n;i++){

		cin>>num;

		a[num]++;

	}

	for(int i=1;i<=m;i++){

		cin>>b[i];

	} 

	sort(b.begin()+1,b.end());

	for(int i=m;i>=1;i--){

		if(!dfs(b[i])){

			cout<<"NO"<<endl;

			return;

		}

	}

	cout<<(!n?"YES":"NO")<<endl;

	return;

}

int main(){

	ios::sync_with_stdio(false);

    cin.tie(nullptr);

    //cout.tie(nullptr);

	int t;

	cin>>t;

	while(t--){

		solve();

	}

}
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 ll long long

int n;

map<int,int> a;

bool dfs(int num){

	if(a[num]){

		a[num]--;

		n--;

		return 1;

	}

	if(num<=1){

		return 0;

	}

	return dfs(num/2)&&dfs(num-num/2);

}

void solve(){

	int m,num;

	a.clear();

	cin>>n>>m;

	for(int i=1;i<=n;i++){

		cin>>num;

		a[num]++;

	}

	for(int i=1;i<=m;i++){

		cin>>num;

		if(!dfs(num)){

			cout<<"NO"<<endl; 

			return ;

		}

	} 

	cout<<(!n?"YES":"NO")<<endl;

	return;

}

int main(){

	ios::sync_with_stdio(false);

    cin.tie(nullptr);

    //cout.tie(nullptr);

	int t;

	cin>>t;

	while(t--){

		solve();

	}

} 

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

using namespace std;

#define ll long long

int n;

map<ll,ll> a;

bool dfs(ll num){

	if(a[num]){

		a[num]--;

		n--;

		return 1;

	}

	if(num<=1){

		return 0;

	}

	return dfs(num/2)&&dfs(num-num/2);

}

void solve(){

	ll m,num;

	a.clear();

	cin>>n>>m;

	for(int i=1;i<=n;i++){

		cin>>num;

		a[num]++;

	}

	for(int i=1;i<=m;i++){

		cin>>num;

		if(!dfs(num)){

			cout<<"NO"<<endl; 

			return;

		}

	} 

	cout<<(!n?"YES":"NO")<<endl;

	return;

}

int main(){

	ios::sync_with_stdio(false);

    cin.tie(nullptr);

    //cout.tie(nullptr);

	int t;

	cin>>t;

	while(t--){

		solve();

	}

}
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 ll long long

void solve(){

	int n,m,num;

	priority_queue<int, vector<int>, greater<int>>a,b;

	cin>>n>>m;

	for(int i=1;i<=n;i++){

		cin>>num;

		a.push(num);

	}

	for(int i=1;i<=m;i++){

		cin>>num;

		b.push(num);

	}

	while(n>0&&m>0){

		int x=a.top();

		int y=b.top();

		a.pop();

		b.pop();

		n--;

		m--;

		if(x==y){

			continue;

		}

		else{

			if(x<y&&n>0){

				int z=a.top();

				a.pop();

				n--;

				if(z-x<=1){

					a.push(x+z);

				}

				else{

					cout<<"NO"<<endl; 

					return;

				}

				b.push(y);

			}

			else{

				cout<<"NO"<<endl;

				return;

			}

		}

	}

	cout<<((n==0&&m==0)?"YES":"NO")<<endl;

	return;

}

int main(){

	ios::sync_with_stdio(false);

    cin.tie(nullptr);

    //cout.tie(nullptr);

	int t;

	cin>>t;

	while(t--){

		solve();

	}

}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int t;cin>>t;
    while(t--){
        int n;cin>>n;ll sum=0;
        vector<int>v(n);for(int i=0;i<n;i++) {cin>>v[i];sum+=v[i];}
        if(n>1) sum=max(sum,abs(sum));
        while(n>1){
            vector<int>a(n-1);ll sum1=0;
            for(int i=0;i<n-1;i++) {a[i]=v[i+1]-v[i];sum1+=a[i];}
            sum=max(sum,abs(sum1));
            v=a;n--;
        }
        cout<<sum<<endl;
    }
}