ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

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 &ai:a)cin>>ai;
	auto calc=[](vector<int> a)
	{
		int ans=0;
		for(auto ai:a)ans+=ai;
		while(a.size())
		{
			int sum=0;
			ans=max(ans,a.back()-a.front());
			ans=max(ans,a.front()-a.back());
			for(int j=0;j<a.size()-1;j++)
				a[j]=a[j+1]-a[j];
			a.resize(a.size()-1);
		}
		return ans;
	};
	int ans=calc(a);
	reverse(a.begin(),a.end());
	ans=max(ans,calc(a));
	cout<<ans<<endl;
}
int main()
{
	ios::sync_with_stdio(false);
	int T;
	cin>>T;
	for(int i=1;i<=T;i++)solve();
	return 0;
}


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
void solve()
{
	int n;
	cin>>n;
	vector<int> a(n);
	for(auto &ai:a)cin>>ai;
	auto calc=[](vector<int> a)
	{
		int ans=0;
		for(auto ai:a)ans+=ai;
		while(a.size()>1)
		{
			int sum=0;
			ans=max(ans,a.back()-a.front());
			ans=max(ans,a.front()-a.back());
			for(int j=0;j<a.size()-1;j++)
				a[j]=a[j+1]-a[j];
			a.resize(a.size()-1);
		}
		return ans;
	};
	int ans=calc(a);
	reverse(a.begin(),a.end());
	ans=max(ans,calc(a));
	cout<<ans<<endl;
}
int main()
{
	ios::sync_with_stdio(false);
	int T;
	cin>>T;
	for(int i=1;i<=T;i++)solve();
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


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 &ai:a)cin>>ai;
	auto calc=[](vector<int> a)
	{
		int ans=0;
		for(auto ai:a)ans+=ai;
		while(a.size())
		{
			int sum=0;
			ans=max(ans,a.back()-a.front());
			ans=max(ans,a.front()-a.back());
			for(int j=0;j<a.size()-1;j++)
				a[j]=a[j+1]-a[j];
			a.resize(a.size()-1);
		}
		return ans;
	};
	int ans=calc(a);
	reverse(a.begin(),a.end());
	ans=max(ans,calc(a));
	cout<<ans<<endl;
}
int main()
{
	ios::sync_with_stdio(false);
	int T;
	cin>>T;
	for(int i=1;i<=T;i++)solve();
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

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);
	for(auto &ai:a)cin>>ai;
	auto calc=[](vector<int> a)
	{
		int ans=0;
		for(auto ai:a)ans+=ai;
		while(a.size()>1)
		{
			int sum=0;
			ans=max(ans,a.back()-a.front());
			ans=max(ans,a.front()-a.back());
			for(int j=0;j<a.size()-1;j++)
				a[j]=a[j+1]-a[j];
			a.resize(a.size()-1);
		}
		return ans;
	};
	int ans=calc(a);
	reverse(a.begin(),a.end());
	ans=max(ans,calc(a));
	cout<<ans<<endl;
}
int main()
{
	ios::sync_with_stdio(false);
	int T;
	cin>>T;
	for(int i=1;i<=T;i++)solve();
	return 0;
}


Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
void solve()
{
	int n;
	cin>>n;
	vector<long long> a(n);
	for(auto &ai:a)cin>>ai;
	auto calc=[](vector<long long> a)
	{
		long long ans=0;
		for(auto ai:a)ans+=ai;
		while(a.size()>1)
		{
			int sum=0;
			ans=max(ans,a.back()-a.front());
			ans=max(ans,a.front()-a.back());
			for(int j=0;j<a.size()-1;j++)
				a[j]=a[j+1]-a[j];
			a.resize(a.size()-1);
		}
		return ans;
	};
	auto ans=calc(a);
	reverse(a.begin(),a.end());
	ans=max(ans,calc(a));
	cout<<ans<<endl;
}
int main()
{
	ios::sync_with_stdio(false);
	int T;
	cin>>T;
	for(int i=1;i<=T;i++)solve();
	return 0;
}
Problem: 2050B - Transfusion
Language: GNU C11

Previous submission (verdict: Wrong answer on test 3):
#include <stdio.h>
#include <string.h>
int main()
{
	int i,t,n,m,sum1,sum2,s1,s2;
	double f1,f2;
	while(scanf("%d",&t)!=EOF)
	{
		while(t--)
		{
			scanf("%d",&n);
			sum1=sum2=s1=s2=0;
			for(i=1;i<=n;i++)
			{
				scanf("%d",&m);
				if (i%2==1)
				{
					sum1=sum1+m;
					s1++;
				}
				else
				{
					sum2=sum2+m;
					s2++;
				}
			}
			f1=1.0*sum1/s1;
			f2=1.0*sum2/s2;
			if (f1==f2 && f1==sum1/s1)
				printf("YES\n");
			else
				printf("NO\n");
		}
	}
}

Submission (verdict: Accepted):
#include <stdio.h>
#include <string.h>
int main()
{
	int i,t,n,m;
	double sum1,sum2,s1,s2,f1,f2;
	while(scanf("%d",&t)!=EOF)
	{
		while(t--)
		{
			scanf("%d",&n);
			sum1=sum2=s1=s2=0;
			for(i=1;i<=n;i++)
			{
				scanf("%d",&m);
				if (i%2==1)
				{
					sum1=sum1+m;
					s1++;
				}
				else
				{
					sum2=sum2+m;
					s2++;
				}
			}
			f1=1.0*sum1/s1;
			f2=1.0*sum2/s2;
			if (f1==f2 && f1==(int)f1)
				printf("YES\n");
			else
				printf("NO\n");
		}
	}
}
Problem: 2050B - Transfusion
Language: GNU C11

Previous submission (verdict: Wrong answer on test 3):
#include <stdio.h>
#include <string.h>
int main()
{
	int i,t,n,m,sum1,sum2,s1,s2;
	double f1,f2;
	while(scanf("%d",&t)!=EOF)
	{
		while(t--)
		{
			scanf("%d",&n);
			sum1=sum2=s1=s2=0;
			for(i=1;i<=n;i++)
			{
				scanf("%d",&m);
				if (i%2==1)
				{
					sum1=sum1+m;
					s1++;
				}
				else
				{
					sum2=sum2+m;
					s2++;
				}
			}
			f1=1.0*sum1/s1;
			f2=1.0*sum2/s2;
			if (f1==f2 && f1==(int)f1)
				printf("YES\n");
			else
				printf("NO\n");
		}
	}
}

Submission (verdict: Wrong answer on test 3):
#include <stdio.h>
#include <string.h>
int main()
{
	int i,t,n,m,sum1,sum2,s1,s2;
	double f1,f2;
	while(scanf("%d",&t)!=EOF)
	{
		while(t--)
		{
			scanf("%d",&n);
			sum1=sum2=s1=s2=0;
			for(i=1;i<=n;i++)
			{
				scanf("%d",&m);
				if (i%2==1)
				{
					sum1=sum1+m;
					s1++;
				}
				else
				{
					sum2=sum2+m;
					s2++;
				}
			}
			f1=1.0*sum1/s1;
			f2=1.0*sum2/s2;
			if (f1==f2 && f1==sum1/s1)
				printf("YES\n");
			else
				printf("NO\n");
		}
	}
}
Problem: 2050B - Transfusion
Language: GNU C11


Submission (verdict: Wrong answer on test 3):
#include <stdio.h>
#include <string.h>
int main()
{
	int i,t,n,m,sum1,sum2,s1,s2;
	double f1,f2;
	while(scanf("%d",&t)!=EOF)
	{
		while(t--)
		{
			scanf("%d",&n);
			sum1=sum2=s1=s2=0;
			for(i=1;i<=n;i++)
			{
				scanf("%d",&m);
				if (i%2==1)
				{
					sum1=sum1+m;
					s1++;
				}
				else
				{
					sum2=sum2+m;
					s2++;
				}
			}
			f1=1.0*sum1/s1;
			f2=1.0*sum2/s2;
			if (f1==f2 && f1==(int)f1)
				printf("YES\n");
			else
				printf("NO\n");
		}
	}
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)


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

typedef long long ll;//1e18

#define fi first

#define se second

#define  pll pair<ll,ll>

#define MAXN 100005

#define pb push_back

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

#define ull unsigned long long//1e19

#define endl "\n"

#define ld long double

#define allc(x) x.begin(),x.end(),cmp

//cout<<fixed<<setprecision()<<ans<<endl;

using namespace std;

//struct

bool cmp(ll x,ll y){

return x>y;

}

const int N=2e6+10;

const int mod=1000000007;

//初始化

int s[MAXN];

int fa[MAXN];

int add(int n){

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

fa[i]=i;

s[i] = 1;

}

}

//查询 寻找祖先 进行路径压缩



int find (int i){

if(fa[i]==i){

return i;

}else{

fa[i]=find(fa[i]);

return fa[i];

}

}



//合并

void unionn(int i,int j){

int i_fa=find(i);

int j_fa=find(j);

if(i_fa!=j_fa){

if(s[i_fa] < s[j_fa]) {

fa[i_fa] = j_fa;

s[j_fa] += s[i_fa];

} else {

fa[j_fa] = i_fa;

s[i_fa] += s[j_fa];

}

}

}



// DFS



/*



ll p,q;

ll min=1e7;

ll m,n;

int dx[4]={0,1,0,-1};

int dy[4]={1,0,-1,0};

ll a[100][100]; // 1表示空地 2表示障碍物

ll v[100][100]; // 0表示未探索 1表示已经探索

void dfs(ll x,ll y,ll step){

if(x==p&&y==q){

if(step<min){

min=step;

return ;

}

}

//顺时针探索

for(int i=0;i<=3;i++){

ll tx,ty;

tx=x+dx[i];

ty=y+dy[i];

if(a[tx][ty]==1&&v[tx][ty]==0){

v[tx][ty]=1;

dfs(tx,ty,step+1);

v[tx][ty]=0;

}

}

}



*/



// 背包

// 快速幂

ll modpow(ll n,ll m,ll q){

ll result=1;

while(m>0){

if(m%2==1){

result=(result*n)%q;

}

n=(n*n)%q;

m/=2;

}

return result;

}

void solve(){

ll n;

cin>>n;

ll a[n+1];

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

cin>>a[i];

}

bool flag=0;

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

a[i+1]=a[i+1]-min(a[i],a[i+1]);

a[i]=a[i]-min(a[i],a[i+1]);

if(a[i+2]<a[i+1]||a[i]>a[i+1]){

flag=1;

}

}

if(flag){

cout<<"NO"<<endl;

}else{

cout<<"YES"<<endl;

}

}

int main(){

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

int t=1;

cin>>t;

while(t--){

solve();

}

return 0;

}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Memory limit exceeded on test 4):
#include <bits/stdc++.h> 
#include <string>
using namespace std;

#define endl '\n'
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); 
static bool solve(string s);
/*
for all digits 1,2,3 square them I guess. breadth first search I guess. there's nothing about the ones place number
that would suggest it's divisible by 9 so brute force would be the only way. oh sum of lengths doesn't exceed 10^5 lol.
you could substring a tiny portion. if a number has 9 trailing 0's I'm assuming it would be divisible by 9.
actually 1 less than that number would be divisible by 9. so 2222222000000000 -> 2222221999999999 + 1.
the way to think about it is the other way around, that number with the trailing 9s isn't even divisible by 9, 9 0's don't matter.

9 as binary will be 1001. 8 would be 1000, which may be a better candidate than 10 to go looking for prospects. & 8.

divisibility rule of 3 hahaha there's another one for 9, wasn't expecting that to ever come up again.
I just don't really know how to do the dp part, ok you don't immediately check whether the sum is divisible by 9. the dp truth
table comes first. if every single digit is a 3, you'd get every index and multiply the size of that by 6.
*/

int main() {
    fast; 
    int t; 
    cin >> t; 
    cin.ignore();
    string line;
    while(getline(cin, line)) {
        string s = line;
        // cout << s << endl;
        if (solve(s)) {
            cout << "YES" << endl;
        } else {
            cout << "NO" << endl;
        }
    }


    return 0;
}

static bool solve(string s) {
    int len = s.length();
    vector<int> indices;
    int sum = 0;
    for (size_t i = 0; i < s.length(); i++) {
        int val = s[i] - '0';
        sum += val;
        if (val == 2 || val == 3) {
            indices.push_back(i);
        }
    }
    if (sum % 9 == 0) return true;
    // cout << s << " " << sum << endl;
    vector<vector<bool>> dp(indices.size() + 1, vector<bool>(sum + 6 * indices.size() + 1, false));
    // set the base case that the sum can be reached.
    dp[0][sum] = true; // think this is how you do this.
    for (int i = 1; i <= indices.size(); i++) { // this is super easy to get wrong.
        // cout << "what is change?" << s[indices[i-1]] << endl;
        int change = (s[indices[i-1]] == '2') ? 2 : 6;
        // cout << "converted " << change << endl;
        for (int j = sum; j <= sum + 6 * indices.size(); j++) {
            dp[i][j] = dp[i-1][j];
            if (j >= change && dp[i-1][j-change]) { // bounds check and verifying that the previous number could be reached.
                dp[i][j] = true;
                if (j % 9 == 0) {
                    // cout << "i " << i << " j - change" << (j-change) << endl;
                    // cout << j << endl;
                    return true;
                }
            }
        }
    }

    return false;
}
Problem: 2049C - MEX Cycle
Language: C++20 (GCC 13-64)

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

#define int long long

#define all(x,y) x.begin()+y,x.end()

using namespace std;

typedef pair<int, int> pii;

typedef array<int,2> arr2;

const int inf = 1e18 + 30;

const int N=1e5+15;

const int mod=1e9+7;

void smin(int&x,int y){x=min(x,y);}

void smax(int&x,int y){x=max(x,y);}

void help(){

    int n,x,y;cin>>n>>x>>y;

    vector<int> vec(n+1);

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

        vec[i]=(i&1?0:1);

    if(n&1)

        for(int i=n;i>=1;i-=2){

            vec[i]=1;

            // if(i-1!=x&&i-1!=y){

                vec[i-1]=2;

                break;

            // }

        } 

    set<int> st;

    st.insert(vec[(x-1)<1?n:(x-1)]); 

    st.insert(vec[(x+1)>n?1:(x+1)]);

    st.insert(vec[y]);

    int mex=0;

    while(st.count(mex)) mex++;

    vec[x]=mex;

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

        cout<<vec[i]<<" \n"[i==n];

}

signed main() { 

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t=1;

    cin>>t;

    while(t--){

        help();

        // cout<<help()<<"\n";

    }

    return 0;

}

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

#define int long long

#define all(x,y) x.begin()+y,x.end()

using namespace std;

typedef pair<int, int> pii;

typedef array<int,2> arr2;

const int inf = 1e18 + 30;

const int N=1e5+15;

const int mod=1e9+7;

void smin(int&x,int y){x=min(x,y);}

void smax(int&x,int y){x=max(x,y);}

void help(){

    int n,x,y;cin>>n>>x>>y;

    vector<int> vec(n+1);

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

        vec[i]=(i&1?0:1);

    if(n&1) vec[n]=2;

    set<int> st;

    st.insert(vec[(x-1)<1?n:(x-1)]); 

    st.insert(vec[(x+1)>n?1:(x+1)]);

    st.insert(vec[y]);

    int mex=0;

    while(st.count(mex)) mex++;

    vec[x]=mex;

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

        cout<<vec[i]<<" \n"[i==n];

}

signed main() { 

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t=1;

    cin>>t;

    while(t--){

        help();

        // cout<<help()<<"\n";

    }

    return 0;

}
Problem: 2049C - MEX Cycle
Language: C++20 (GCC 13-64)

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

#define int long long

#define all(x,y) x.begin()+y,x.end()

using namespace std;

typedef pair<int, int> pii;

typedef array<int,2> arr2;

const int inf = 1e18 + 30;

const int N=1e5+15;

const int mod=1e9+7;

void smin(int&x,int y){x=min(x,y);}

void smax(int&x,int y){x=max(x,y);}

void help(){

    int n,x,y;cin>>n>>x>>y;

    vector<int> vec(n+1);

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

        vec[i]=(i&1?0:1);

    if(n&1) vec[n]=2;

    set<int> st;

    st.insert(vec[(x-1)<1?n:(x-1)]); 

    st.insert(vec[(x+1)>n?1:(x+1)]);

    st.insert(vec[y]);

    int mex=0;

    while(st.count(mex)) mex++;

    vec[x]=mex;

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

        cout<<vec[i]<<" \n"[i==n];

}

signed main() { 

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t=1;

    cin>>t;

    while(t--){

        help();

        // cout<<help()<<"\n";

    }

    return 0;

}

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

#define int long long

#define all(x,y) x.begin()+y,x.end()

using namespace std;

typedef pair<int, int> pii;

typedef array<int,2> arr2;

const int inf = 1e18 + 30;

const int N=1e5+15;

const int mod=1e9+7;

void smin(int&x,int y){x=min(x,y);}

void smax(int&x,int y){x=max(x,y);}

void help(){

    int n,x,y;cin>>n>>x>>y;

    vector<int> vec(n+1);

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

        vec[i]=(i&1?0:1);

    if(n&1) vec[n]=2;

    set<int> st;

    st.insert(vec[(x-1)<1?n:(x-1)]); 

    st.insert(vec[(x+1)>n?1:(x+1)]);

    st.insert(vec[y]);



    int mex=0;

    while(st.count(mex)) mex++;

    vec[x]=mex;

    st.clear(); mex=0;

    st.insert(vec[(y-1)<1?n:(y-1)]); 

    st.insert(vec[(y+1)>n?1:(y+1)]);

    st.insert(vec[x]);

    while(st.count(mex)) mex++;

    vec[y]=mex;

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

        cout<<vec[i]<<" \n"[i==n];

}

signed main() { 

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t=1;

    cin>>t;

    while(t--){

        help();

        // cout<<help()<<"\n";

    }

    return 0;

}
Problem: 2049C - MEX Cycle
Language: C++20 (GCC 13-64)

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

#define int long long

#define all(x,y) x.begin()+y,x.end()

using namespace std;

typedef pair<int, int> pii;

typedef array<int,2> arr2;

const int inf = 1e18 + 30;

const int N=1e5+15;

const int mod=1e9+7;

void smin(int&x,int y){x=min(x,y);}

void smax(int&x,int y){x=max(x,y);}

void help(){

    int n,x,y;cin>>n>>x>>y;

    vector<int> vec(n+1);

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

        vec[i]=(i&1?0:1);

    if(n&1)

        for(int i=n;i>=1;i-=2){

            vec[i]=1;

            if(i-1!=x&&i-1!=y){

                vec[i-1]=2;

                break;

            }

        } 

    set<int> st;

    st.insert(vec[(x-1)<1?n:(x-1)]); 

    st.insert(vec[(x+1)>n?1:(x+1)]);

    st.insert(vec[y]);

    int mex=0;

    while(st.count(mex)) mex++;

    vec[x]=mex;

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

        cout<<vec[i]<<" \n"[i==n];

}

signed main() { 

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t=1;

    cin>>t;

    while(t--){

        help();

        // cout<<help()<<"\n";

    }

    return 0;

}

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

#define int long long

#define all(x,y) x.begin()+y,x.end()

using namespace std;

typedef pair<int, int> pii;

typedef array<int,2> arr2;

const int inf = 1e18 + 30;

const int N=1e5+15;

const int mod=1e9+7;

void smin(int&x,int y){x=min(x,y);}

void smax(int&x,int y){x=max(x,y);}

void help(){

    int n,x,y;cin>>n>>x>>y;

    vector<int> vec(n+1);

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

        vec[i]=(i&1?0:1);

    if(n&1)

        for(int i=n;i>=1;i-=2){

            vec[i]=1;

            // if(i-1!=x&&i-1!=y){

                vec[i-1]=2;

                break;

            // }

        } 

    set<int> st;

    st.insert(vec[(x-1)<1?n:(x-1)]); 

    st.insert(vec[(x+1)>n?1:(x+1)]);

    st.insert(vec[y]);

    int mex=0;

    while(st.count(mex)) mex++;

    vec[x]=mex;

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

        cout<<vec[i]<<" \n"[i==n];

}

signed main() { 

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t=1;

    cin>>t;

    while(t--){

        help();

        // cout<<help()<<"\n";

    }

    return 0;

}
Problem: 2049C - MEX Cycle
Language: C++20 (GCC 13-64)

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

#define int long long

#define all(x,y) x.begin()+y,x.end()

using namespace std;

typedef pair<int, int> pii;

typedef array<int,2> arr2;

const int inf = 1e18 + 30;

const int N=1e5+15;

const int mod=1e9+7;

void smin(int&x,int y){x=min(x,y);}

void smax(int&x,int y){x=max(x,y);}

void help(){

    int n,x,y;cin>>n>>x>>y;

    vector<int> vec(n+1);

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

        vec[i]=(i&1?0:1);

    if(n&1) vec[n]=2;

    set<int> st;

    st.insert(vec[(x-1)<1?n:(x-1)]); 

    st.insert(vec[(x+1)>n?1:(x+1)]);

    st.insert(vec[y]);



    int mex=0;

    while(st.count(mex)) mex++;

    vec[x]=mex;

    st.clear(); mex=0;

    st.insert(vec[(y-1)<1?n:(y-1)]); 

    st.insert(vec[(y+1)>n?1:(y+1)]);

    st.insert(vec[x]);

    while(st.count(mex)) mex++;

    vec[y]=mex;

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

        cout<<vec[i]<<" \n"[i==n];

}

signed main() { 

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t=1;

    cin>>t;

    while(t--){

        help();

        // cout<<help()<<"\n";

    }

    return 0;

}

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

#define int long long

#define all(x,y) x.begin()+y,x.end()

using namespace std;

typedef pair<int, int> pii;

typedef array<int,2> arr2;

const int inf = 1e18 + 30;

const int N=1e5+15;

const int mod=1e9+7;

void smin(int&x,int y){x=min(x,y);}

void smax(int&x,int y){x=max(x,y);}

void help(){

    int n,x,y;cin>>n>>x>>y;

    vector<int> vec(n+1);

    if(n&1){

        vec[x]=2; vec[x-1]=1,vec[x+1]=0;

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

            vec[i]=vec[i-1]^1;

        for(int i=x-2;i>=1;i--)

            vec[i]=vec[i+1]^1;

    }

    else{

        if(abs(x-y)&1)

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

                vec[i]=vec[i-1]^1;

        else{

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

                vec[i]=vec[i-1]^1;

            for(int i=x-1;i>=1;i--)

                vec[i]=vec[i+1]^1;

            vec[y]=2;

        }

    }

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

        cout<<vec[i]<<" \n"[i==n];

}

signed main() { 

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t=1;

    cin>>t;

    while(t--){

        help();

        // cout<<help()<<"\n";

    }

    return 0;

}
Problem: 2049C - MEX Cycle
Language: C++20 (GCC 13-64)


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

#define int long long

#define all(x,y) x.begin()+y,x.end()

using namespace std;

typedef pair<int, int> pii;

typedef array<int,2> arr2;

const int inf = 1e18 + 30;

const int N=1e5+15;

const int mod=1e9+7;

void smin(int&x,int y){x=min(x,y);}

void smax(int&x,int y){x=max(x,y);}

void help(){

    int n,x,y;cin>>n>>x>>y;

    vector<int> vec(n+1);

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

        vec[i]=(i&1?0:1);

    if(n&1)

        for(int i=n;i>=1;i-=2){

            vec[i]=1;

            if(i-1!=x&&i-1!=y){

                vec[i-1]=2;

                break;

            }

        } 

    set<int> st;

    st.insert(vec[(x-1)<1?n:(x-1)]); 

    st.insert(vec[(x+1)>n?1:(x+1)]);

    st.insert(vec[y]);

    int mex=0;

    while(st.count(mex)) mex++;

    vec[x]=mex;

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

        cout<<vec[i]<<" \n"[i==n];

}

signed main() { 

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t=1;

    cin>>t;

    while(t--){

        help();

        // cout<<help()<<"\n";

    }

    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 8):
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        int n, l,r;
        cin >> n >> l >> r;
        l-=1;
        r-=1;
        int arr[n];
        vector <long long int> arr1, arr2;
        for(int i=0;i<n;i++)
        {
            cin >> arr[i];
            if(i<l)
            arr1.push_back(arr[i]);
            else if(i>r)
            arr2.push_back(arr[i]);
            else
            {
                arr1.push_back(arr[i]);
                arr2.push_back(arr[i]);
            }
        }
        sort(arr1.begin(), arr1.end());
        sort(arr2.begin(), arr2.end());
        long long int sum1=accumulate(arr1.begin(), arr1.begin()+r-l+1,0);
        long long int sum2=accumulate(arr2.begin(), arr2.begin()+r-l+1,0);
        cout << min(sum1, sum2) << endl;
    }
}

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

using namespace std;

int main()

{

    int t;

    cin >> t;

    while(t--)

    {

        int n, l,r;

        cin >> n >> l >> r;

        l-=1;

        r-=1;

        int arr[n];

        vector <long long int> arr1, arr2;

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

        {

            cin >> arr[i];

            if(i<l)

            arr1.push_back(arr[i]);

            else if(i>r)

            arr2.push_back(arr[i]);

            else

            {

                arr1.push_back(arr[i]);

                arr2.push_back(arr[i]);

            }

        }

        sort(arr1.begin(), arr1.end());

        sort(arr2.begin(), arr2.end());

        long long int sum1=0, sum2=0;

        for(int i=0;i<r-l;i++)

        {

            sum1+=arr1[i];

            sum2+=arr2[i];

        }

        cout << min(sum1, sum2) << endl;

    }

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 8):
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    cin >> t;
    while(t--)
    {
        int n, l,r;
        cin >> n >> l >> r;
        l-=1;
        r-=1;
        int arr[n], arr1[r+1], arr2[n-l];
        for(int i=0;i<n;i++)
        {
            cin >> arr[i];
            if(i<l)
            arr1[i]=arr[i];
            else if(i>r)
            arr2[i-l]=arr[i];
            else
            {
                arr1[i]=arr[i];
                arr2[i-l]=arr[i];
            }
        }
        sort(arr1, arr1+r+1);
        sort(arr2, arr2+n-l);
        long long int sum1=accumulate(arr1, arr1+r-l+1,0);
        long long int sum2=accumulate(arr2, arr2+r-l+1,0);
        cout << min(sum1, sum2) << endl;
    }
}