ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

using namespace std;

void solve() {
    int n; cin >> n;
    vector<long long> a(n);
    long long mx = 0;
    for (auto& aa: a) {
        cin >> aa;
        mx += aa;
    }
    while (a.size() > 1) {
        vector<long long> change;
        for (int i = (int)a.size() - 2; i >= 0; --i) change.push_back(a[i] - a[i + 1]);
        long long cur = 0;
        for (auto cc : change) cur += cc;
        mx = max(cur, mx);
        a = change;
    }
    cout << mx << endl;
}

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


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

using namespace std;

void solve() {
    int n; cin >> n;
    vector<long long> a(n);
    long long mx = 0;
    for (auto& aa: a) {
        cin >> aa;
        mx += aa;
    }
    while (a.size() > 1) {
        vector<long long> change;
        for (int i = (int)a.size() - 2; i >= 0; --i) change.push_back(a[i] - a[i + 1]);
        long long cur = 0;
        for (auto cc : change) cur += cc;
        mx = max(cur, mx);
        mx = max(mx, -cur);
        a = change;
    }
    cout << mx << endl;
}

int main() {
    int t; cin >> t;
    while (t--) solve();
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

using namespace std;

void solve() {
    int n; cin >> n;
    vector<int> a(n);
    long long mx = 0;
    for (auto& aa: a) {
        cin >> aa;
        mx += aa;
    }
    while (a.size() > 1) {
        vector<int> change;
        for (int i = (int)a.size() - 2; i >= 0; --i) change.push_back(a[i] - a[i + 1]);
        long long cur = 0;
        for (auto cc : change) cur += cc;
        mx = max(cur, mx);
        a = change;
    }
    cout << mx << endl;
}

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


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

using namespace std;

void solve() {
    int n; cin >> n;
    vector<long long> a(n);
    long long mx = 0;
    for (auto& aa: a) {
        cin >> aa;
        mx += aa;
    }
    while (a.size() > 1) {
        vector<long long> change;
        for (int i = (int)a.size() - 2; i >= 0; --i) change.push_back(a[i] - a[i + 1]);
        long long cur = 0;
        for (auto cc : change) cur += cc;
        mx = max(cur, mx);
        a = change;
    }
    cout << mx << endl;
}

int main() {
    int t; cin >> t;
    while (t--) solve();
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>

using namespace std;

void solve() {
    int n; cin >> n;
    vector<int> a(n);
    for (auto& aa: a) cin >> aa;
    long long mx = a[0];
    while (a.size() > 1) {
        vector<int> change;
        for (int i = (int)a.size() - 2; i >= 0; --i) change.push_back(a[i] - a[i + 1]);
        long long cur = 0;
        for (auto cc : change) cur += cc;
        mx = max(cur, mx);
        a = change;
    }
    cout << mx << endl;
}

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


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

using namespace std;

void solve() {
    int n; cin >> n;
    vector<int> a(n);
    long long mx = 0;
    for (auto& aa: a) {
        cin >> aa;
        mx += aa;
    }
    while (a.size() > 1) {
        vector<int> change;
        for (int i = (int)a.size() - 2; i >= 0; --i) change.push_back(a[i] - a[i + 1]);
        long long cur = 0;
        for (auto cc : change) cur += cc;
        mx = max(cur, mx);
        a = change;
    }
    cout << mx << endl;
}

int main() {
    int t; cin >> t;
    while (t--) solve();
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


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

using namespace std;

void solve() {
    int n; cin >> n;
    vector<int> a(n);
    for (auto& aa: a) cin >> aa;
    long long mx = a[0];
    while (a.size() > 1) {
        vector<int> change;
        for (int i = (int)a.size() - 2; i >= 0; --i) change.push_back(a[i] - a[i + 1]);
        long long cur = 0;
        for (auto cc : change) cur += cc;
        mx = max(cur, mx);
        a = change;
    }
    cout << mx << endl;
}

int main() {
    int t; cin >> t;
    while (t--) solve();
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long a,b,c;
long long t;
long long l,r,x,y,ll,rr;
long long myl[1000010];
long long myr[1000010];
long long ans[1000010];
long long cntl;
long long cntr;
int main()
{
	scanf("%lld",&t);
	for(long long i=1;i<=t;i++)
	{
		scanf("%lld%lld",&l,&r);
		ll=l;
		rr=r;
		cntl=0;
		cntr=0;
		while(ll>0)
		{
			cntl++;
			myl[cntl]=ll%2;
			ll=ll/2;
		}
		while(rr>0)
		{
			cntr++;
			myr[cntr]=rr%2;
			rr=rr/2;
		}
		bool pd=true;
		for(long long j=max(cntl,cntr);j>=1;j--)
		{
			if(pd==true&&(myl[j]&&myr[j]))
			{ 
				ans[j]=1;
			}
			else if(pd==true&&(!myl[j]&&!myr[j]))
			{
				ans[j]=0;
			}
			else
			{
				pd=false;
				if(myl[j]&&myr[j]) ans[j]=0;	
				else if(!myl[j]&&!myr[j]) ans[j]=1;	
				else ans[j]=-1;
			}
		}
		long long myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			if(ans[j]!=-1) myans+=ans[j]*(1<<(j-1));
		for(int j=max(cntl,cntr);j>=1;j--)
		{
			if(ans[j]==-1)
			{
				if(myans+(1<<(j-1))>l&&myans+(1<<(j-1))<r) ans[j]=1,myans+=(1<<(j-1));
				else ans[j]=0;
			}
		}
		myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			myans+=ans[j]*(1<<(j-1)),ans[j]=0,myl[j]=0,myr[j]=0;
		printf("%lld %lld %lld\n",l,myans,r);
	}
	return 0;
}
/*
1 2 0
8 7 1
*/

Submission (verdict: Accepted):
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long a,b,c;
long long t;
long long l,r,x,y,ll,rr;
long long myl[1000010];
long long myr[1000010];
long long ans[1000010];
long long cntl;
long long cntr;
int main()
{
	scanf("%lld",&t);
	for(long long i=1;i<=t;i++)
	{
		scanf("%lld%lld",&l,&r);
		ll=l;
		rr=r;
		cntl=0;
		cntr=0;
		while(ll>0)
		{
			cntl++;
			myl[cntl]=ll%2;
			ll=ll/2;
		}
		while(rr>0)
		{
			cntr++;
			myr[cntr]=rr%2;
			rr=rr/2;
		}
		bool pd=true;
		for(long long j=max(cntl,cntr);j>=1;j--)
		{
			if(pd==true&&(myl[j]&&myr[j]))
			{ 
				ans[j]=1;
			}
			else if(pd==true&&(!myl[j]&&!myr[j]))
			{
				ans[j]=0;
			}
			else
			{
				pd=false;
				if(myl[j]&&myr[j]) ans[j]=0;	
				else if(!myl[j]&&!myr[j]) ans[j]=1;	
				else ans[j]=-1;
			}
		}
		long long myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			if(ans[j]!=-1) myans+=ans[j]*(1<<(j-1));
		//cout<<myans<<endl;
		for(int j=max(cntl,cntr);j>=1;j--)
		{
			if(ans[j]==-1)
			{
				if(myans+(1<<(j-1))<r) ans[j]=1,myans+=(1<<(j-1));
				else ans[j]=0;
			}
		}
		myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			myans+=ans[j]*(1<<(j-1)),ans[j]=0,myl[j]=0,myr[j]=0;
		printf("%lld %lld %lld\n",l,myans,r);
	}
	return 0;
}
/*
1 2 0
8 7 1
*/
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long a,b,c;
long long t;
long long l,r,x,y,ll,rr;
long long myl[1000010];
long long myr[1000010];
long long ans[1000010];
long long cntl;
long long cntr;
int main()
{
	scanf("%lld",&t);
	for(long long i=1;i<=t;i++)
	{
		scanf("%lld%lld",&l,&r);
		ll=l;
		rr=r;
		cntl=0;
		cntr=0;
		while(ll>0)
		{
			cntl++;
			myl[cntl]=ll%2;
			ll=ll/2;
		}
		while(rr>0)
		{
			cntr++;
			myr[cntr]=rr%2;
			rr=rr/2;
		}
		bool pd=true;
		for(long long j=max(cntl,cntr);j>=1;j--)
		{
			if(pd==true&&(myl[j]&&myr[j]))
			{ 
				ans[j]=1;
			}
			else if(pd==true&&(!myl[j]&&!myr[j]))
			{
				ans[j]=0;
			}
			else
			{
				pd=false;
				if(myl[j]&&myr[j]) ans[j]=0;	
				else if(!myl[j]&&!myr[j]) ans[j]=1;	
				else ans[j]=1;
			}
		}
		long long myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			myans+=ans[j]*(1<<(j-1));
		if(myans>=r)
		for(long long j=max(cntl,cntr);j>=1;j--)
		{
			if(myr[j]==1&&myl[j]==0)
			{
				ans[j]=0;
				break;
			}
		}
		myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			myans+=ans[j]*(1<<(j-1));
		printf("%lld %lld %lld\n",l,myans,r);
	}
	return 0;
}
/*
1 2 0
8 7 1
*/

Submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long a,b,c;
long long t;
long long l,r,x,y,ll,rr;
long long myl[1000010];
long long myr[1000010];
long long ans[1000010];
long long cntl;
long long cntr;
int main()
{
	scanf("%lld",&t);
	for(long long i=1;i<=t;i++)
	{
		scanf("%lld%lld",&l,&r);
		ll=l;
		rr=r;
		cntl=0;
		cntr=0;
		while(ll>0)
		{
			cntl++;
			myl[cntl]=ll%2;
			ll=ll/2;
		}
		while(rr>0)
		{
			cntr++;
			myr[cntr]=rr%2;
			rr=rr/2;
		}
		bool pd=true;
		for(long long j=max(cntl,cntr);j>=1;j--)
		{
			if(pd==true&&(myl[j]&&myr[j]))
			{ 
				ans[j]=1;
			}
			else if(pd==true&&(!myl[j]&&!myr[j]))
			{
				ans[j]=0;
			}
			else
			{
				pd=false;
				if(myl[j]&&myr[j]) ans[j]=0;	
				else if(!myl[j]&&!myr[j]) ans[j]=1;	
				else ans[j]=-1;
			}
		}
		long long myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			if(ans[j]!=-1) myans+=ans[j]*(1<<(j-1));
		for(int j=max(cntl,cntr);j>=1;j--)
		{
			if(ans[j]==-1)
			{
				if(myans+(1<<(j-1))>l&&myans+(1<<(j-1))<r) ans[j]=1,myans+=(1<<(j-1));
				else ans[j]=0;
			}
		}
		myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			myans+=ans[j]*(1<<(j-1)),ans[j]=0,myl[j]=0,myr[j]=0;
		printf("%lld %lld %lld\n",l,myans,r);
	}
	return 0;
}
/*
1 2 0
8 7 1
*/
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long a,b,c;
long long t;
long long l,r,x,y,ll,rr;
long long myl[1000010];
long long myr[1000010];
long long ans[1000010];
long long cntl;
long long cntr;
int main()
{
	scanf("%lld",&t);
	for(long long i=1;i<=t;i++)
	{
		scanf("%lld%lld",&l,&r);
		ll=l;
		rr=r;
		cntl=0;
		cntr=0;
		while(ll>0)
		{
			cntl++;
			myl[cntl]=ll%2;
			ll=ll/2;
		}
		while(rr>0)
		{
			cntr++;
			myr[cntr]=rr%2;
			rr=rr/2;
		}
		bool pd=true;
		for(long long j=max(cntl,cntr);j>=1;j--)
		{
			if(pd==true&&(myl[j]&&myr[j]))
			{ 
				ans[j]=1;
			}
			else
			{
				pd=false;
				if(myr[j]==1&&myl[j]==1) ans[j]=0;
				if(myr[j]==1&&myl[j]==0) ans[j]=0;
				if(myr[j]==0&&myl[j]==1) ans[j]=0;
				if(myr[j]==0&&myl[j]==0) ans[j]=1;
				if(j==1&&myr[j]==1&&myl[j]==0) ans[j]=1;
				if(j==1&&myr[j]==0&&myl[j]==1) ans[j]=1;
			}
		}
		long long myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			myans+=ans[j]*(1<<(j-1));
		printf("%lld %lld %lld\n",l,myans,r);
	}
	return 0;
}
/*
123 121 118
115 76 111
*/
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long a,b,c;
long long t;
long long l,r,x,y,ll,rr;
long long myl[1000010];
long long myr[1000010];
long long ans[1000010];
long long cntl;
long long cntr;
int main()
{
	scanf("%lld",&t);
	for(long long i=1;i<=t;i++)
	{
		scanf("%lld%lld",&l,&r);
		ll=l;
		rr=r;
		cntl=0;
		cntr=0;
		while(ll>0)
		{
			cntl++;
			myl[cntl]=ll%2;
			ll=ll/2;
		}
		while(rr>0)
		{
			cntr++;
			myr[cntr]=rr%2;
			rr=rr/2;
		}
		bool pd=true;
		for(long long j=max(cntl,cntr);j>=1;j--)
		{
			if(pd==true&&(myl[j]&&myr[j]))
			{ 
				ans[j]=1;
			}
			else
			{
				pd=false;
				if(myr[j]==1&&myl[j]==1) ans[j]=0;
				if(myr[j]==1&&myl[j]==0) ans[j]=0;
				if(myr[j]==0&&myl[j]==1) ans[j]=0;
				if(myr[j]==0&&myl[j]==0) ans[j]=1;
				if(j==1&&myr[j]==1&&myl[j]==0) ans[j]=1;
				if(j==1&&myr[j]==0&&myl[j]==1) ans[j]=1;
			}
		}
		long long myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			myans+=ans[j]*(1<<(j-1));
		printf("%lld %lld %lld\n",l,myans,r);
	}
	return 0;
}
/*
123 121 118
115 76 111
*/

Submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long a,b,c;
long long t;
long long l,r,x,y,ll,rr;
long long myl[1000010];
long long myr[1000010];
long long ans[1000010];
long long cntl;
long long cntr;
int main()
{
	scanf("%lld",&t);
	for(long long i=1;i<=t;i++)
	{
		scanf("%lld%lld",&l,&r);
		ll=l;
		rr=r;
		cntl=0;
		cntr=0;
		while(ll>0)
		{
			cntl++;
			myl[cntl]=ll%2;
			ll=ll/2;
		}
		while(rr>0)
		{
			cntr++;
			myr[cntr]=rr%2;
			rr=rr/2;
		}
		bool pd=true;
		for(long long j=max(cntl,cntr);j>=1;j--)
		{
			if(pd==true&&(myl[j]&&myr[j]))
			{ 
				ans[j]=1;
			}
			else if(pd==true&&(!myl[j]&&!myr[j]))
			{
				ans[j]=0;
			}
			else
			{
				pd=false;
				if(myl[j]&&myr[j]) ans[j]=0;	
				else if(!myl[j]&&!myr[j]) ans[j]=1;	
				else ans[j]=0;
			}
		}
		long long myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			myans+=ans[j]*(1<<(j-1));
		if(myans<=l)
		for(long long j=1;j<=max(cntl,cntr);j++)
		{
			if(myr[j]==1&&myl[j]==0)
			{
				ans[j]=1;
				break;
			}
		}
		myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			myans+=ans[j]*(1<<(j-1));
		printf("%lld %lld %lld\n",l,myans,r);
	}
	return 0;
}
/*
1 2 0
8 7 1
*/
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long a,b,c;
long long t;
long long l,r,x,y,ll,rr;
long long myl[1000010];
long long myr[1000010];
long long ans[1000010];
long long cntl;
long long cntr;
int main()
{
	scanf("%lld",&t);
	for(long long i=1;i<=t;i++)
	{
		scanf("%lld%lld",&l,&r);
		ll=l;
		rr=r;
		cntl=0;
		cntr=0;
		while(ll>0)
		{
			cntl++;
			myl[cntl]=ll%2;
			ll=ll/2;
		}
		while(rr>0)
		{
			cntr++;
			myr[cntr]=rr%2;
			rr=rr/2;
		}
		bool pd=true;
		for(long long j=max(cntl,cntr);j>=1;j--)
		{
			if(pd==true&&(myl[j]&&myr[j]))
			{ 
				ans[j]=1;
			}
			else if(pd==true&&(!myl[j]&&!myr[j]))
			{
				ans[j]=0;
			}
			else
			{
				pd=false;
				if(myl[j]&&myr[j]) ans[j]=0;	
				else if(!myl[j]&&!myr[j]) ans[j]=1;	
				else ans[j]=0;
			}
		}
		long long myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			myans+=ans[j]*(1<<(j-1));
		if(myans<=l)
		for(long long j=1;j<=max(cntl,cntr);j++)
		{
			if(myr[j]==1&&myl[j]==0)
			{
				ans[j]=1;
				break;
			}
		}
		myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			myans+=ans[j]*(1<<(j-1));
		printf("%lld %lld %lld\n",l,myans,r);
	}
	return 0;
}
/*
1 2 0
8 7 1
*/

Submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
long long a,b,c;
long long t;
long long l,r,x,y,ll,rr;
long long myl[1000010];
long long myr[1000010];
long long ans[1000010];
long long cntl;
long long cntr;
int main()
{
	scanf("%lld",&t);
	for(long long i=1;i<=t;i++)
	{
		scanf("%lld%lld",&l,&r);
		ll=l;
		rr=r;
		cntl=0;
		cntr=0;
		while(ll>0)
		{
			cntl++;
			myl[cntl]=ll%2;
			ll=ll/2;
		}
		while(rr>0)
		{
			cntr++;
			myr[cntr]=rr%2;
			rr=rr/2;
		}
		bool pd=true;
		for(long long j=max(cntl,cntr);j>=1;j--)
		{
			if(pd==true&&(myl[j]&&myr[j]))
			{ 
				ans[j]=1;
			}
			else if(pd==true&&(!myl[j]&&!myr[j]))
			{
				ans[j]=0;
			}
			else
			{
				pd=false;
				if(myl[j]&&myr[j]) ans[j]=0;	
				else if(!myl[j]&&!myr[j]) ans[j]=1;	
				else ans[j]=1;
			}
		}
		long long myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			myans+=ans[j]*(1<<(j-1));
		if(myans>=r)
		for(long long j=max(cntl,cntr);j>=1;j--)
		{
			if(myr[j]==1&&myl[j]==0)
			{
				ans[j]=0;
				break;
			}
		}
		myans=0;
		for(long long j=1;j<=max(cntl,cntr);j++)
			myans+=ans[j]*(1<<(j-1));
		printf("%lld %lld %lld\n",l,myans,r);
	}
	return 0;
}
/*
1 2 0
8 7 1
*/
Problem: 2050C - Uninteresting Number
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 1):
def solve(num):
    three = 0
    two = 0
    s = 0
    s2 = 0
    for i in num:
        if i == '2':
            two += 1

        if i == '3':
            s2 += 6
        else:
            s2 += int(i)
        s += int(i)

    if s%9 == 0 or s2%9==0:
        return "YES"

    if two == 0:
        return "NO"

    for i in range(1,two + 1):
        if (2*i + s ) % 9 == 0 or (2*i + s2 ) % 9 == 0 :
            return "YES"
    return "NO"

for _ in range(int(input())):
    print(solve(input()))


Submission (verdict: Accepted):
def solve(num):
    three = 0
    two = 0
    s = 0
    for i in num:
        if i == '2':
            two += 1
        elif i == '3':
            three += 1
        s += int(i)

    if s % 9 == 0:
        return "YES"

    for i in range(min(9,two+1)):
        for j in range(min(7,three+1)):
            if (s + 2*i + 6*j ) % 9 == 0:
                return "YES"
    return "NO"




for _ in range(int(input())):
    print(solve(input()))
Problem: 2050C - Uninteresting Number
Language: PyPy 3-64


Submission (verdict: Wrong answer on test 2):
def solve(num):
    three = 0
    two = 0
    s = 0
    s2 = 0
    for i in num:
        if i == '2':
            two += 1

        if i == '3':
            s2 += 9
        else:
            s2 += int(i)
        s += int(i)

    if s%9 == 0 or s2%9==0:
        return "YES"

    if two == 0:
        return "NO"

    for i in range(1,two + 1):
        if (2*i + s ) % 9 == 0 or (2*i + s2 ) % 9 == 0 :
            return "YES"
    return "NO"

for _ in range(int(input())):
    print(solve(input()))
Problem: 2050C - Uninteresting Number
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 2):
def solve(num):
    three = 0
    two = 0
    s = 0
    s2 = 0
    for i in num:
        if i == '2':
            two += 1

        if i == '3':
            s2 += 9
        else:
            s2 += int(i)
        s += int(i)

    if s%9 == 0 or s2%9==0:
        return "YES"

    if two == 0:
        return "NO"

    for i in range(1,two + 1):
        if (2*i + s ) % 9 == 0 or (2*i + s2 ) % 9 == 0 :
            return "YES"
    return "NO"

for _ in range(int(input())):
    print(solve(input()))


Submission (verdict: Wrong answer on test 1):
def solve(num):
    three = 0
    two = 0
    s = 0
    s2 = 0
    for i in num:
        if i == '2':
            two += 1

        if i == '3':
            s2 += 6
        else:
            s2 += int(i)
        s += int(i)

    if s%9 == 0 or s2%9==0:
        return "YES"

    if two == 0:
        return "NO"

    for i in range(1,two + 1):
        if (2*i + s ) % 9 == 0 or (2*i + s2 ) % 9 == 0 :
            return "YES"
    return "NO"

for _ in range(int(input())):
    print(solve(input()))
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define endl "\n"

int main() {
    optimize();
    ll t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n; 
        vector<ll> v(n);
        for (int i = 0; i < n; i++) cin >> v[i]; 
        bool ch = false;
        for (int i = 1; i < n; i+=2) { 
            if (v[i] > v[i - 1]) {
                ch = true;
                break;
            }
        }
        cout << (ch ? "Yes" : "No") << endl;
    }
    return 0;
}


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define endl "\n"
int main() {
    optimize();
    ll t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n; 
        vector<ll> v(n);
        for (int i = 0; i < n; i++) cin >> v[i]; 
        bool ch = false;
        for (int i = 1; i < n; i+=2) { 
            if (v[i] > v[i - 1]) {
                ch = true;
            }
        }
        cout << (ch ? "Yes" : "No") << endl;
    }
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define endl "\n"
int main() {
    optimize();
    ll t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n; 
        vector<ll> v(n);
        for (int i = 0; i < n; i++) cin >> v[i]; 
        bool ch = false;
        for (int i = 1; i < n; i+=2) { 
            if (v[i] > v[i - 1]) {
                ch = true;
            }
        }
        cout << (ch ? "Yes" : "No") << endl;
    }
    return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define endl "\n"
int main() {
    optimize();
    ll t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n;
        vector<ll> v(n);
        for (int i = 0; i < n; i++) cin >> v[i];
        bool ch = true;
        for (int i = 1; i < n; i+=2) {
            if (v[i] < v[i - 1]) {
                ch =false;
                break;
            }
        }
        cout << (ch ? "Yes" : "No") << endl;
    }
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define endl "\n"
int main() {
    optimize();
    ll t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n;
        vector<ll> v(n);
        for (int i = 0; i < n; i++) cin >> v[i];
        bool ch = true;
        for (int i = 1; i < n; i+=2) {
            if (v[i] < v[i - 1]) {
                ch =false;
                break;
            }
        }
        cout << (ch ? "Yes" : "No") << endl;
    }
    return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define endl "\n"
void tc() {
    ll n;
    cin >> n; 
    vector<ll> ve(n);
    for (ll &i : ve) cin >> i;  
    ll j = 0;  
    for (ll i = 1; i < n; i++) {
        if (ve[i - 1] > ve[i]) j = i;
    }
    if (j == 0) {
        cout << "YES\n";
        return;
    }
    auto fop = [&](ll i) {
        ll minN = min(ve[i], ve[i + 1]);
        ve[i] -= minN;   
        ve[i + 1] -= minN;
    };
    for (ll i = 0; i < j; i++) {
        fop(i);
    }
    cout << (is_sorted(ve.begin(), ve.end()) ? "YES" : "NO") << '\n';
}

int main() {
    optimize();
    ll T;
    cin >> T;  
    while (T--) { 
        tc();
    }
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define optimize() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define endl "\n"

int main() {
    optimize();
    ll t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n; 
        vector<ll> v(n);
        for (int i = 0; i < n; i++) cin >> v[i]; 
        bool ch = false;
        for (int i = 1; i < n; i+=2) { 
            if (v[i] > v[i - 1]) {
                ch = true;
                break;
            }
        }
        cout << (ch ? "Yes" : "No") << endl;
    }
    return 0;
}