Problem: 2049C - MEX Cycle
Language: C++23 (GCC 14-64, msys2)

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



using namespace std;



template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }

void dbg_out() { cerr << endl; }

template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#ifdef LOCAL

#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)

#else

#define dbg(...)

#endif



#define ar array

#define ll long long

#define ld long double

#define sza(x) ((int)x.size())

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



const int MAX_N = 1e5 + 5;

const ll MOD = 1e9 + 7;

const ll INF = 1e9;

const ld EPS = 1e-9;







void solve() {

    ll n,x,y;

    cin>>n>>x>>y;

    if(x==1 && y==n || y-x==1 || (y-x)%2!=0){

    	if(n%2==0){

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

    			if(i%2==0)cout<<1<<" ";

    			else cout<<0<<" ";





    		}

    		cout<<'\n';

    	}

    	else{

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

    			if(i%2==0)cout<<1<<" ";

    			else cout<<0<<" ";





    		}

    		cout<<2<<'\n';

    	}

    }

    else{

    	if(n%2==0){

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

    			if(i+1==x)cout<<2<<" ";

    			else if(i%2==0)cout<<1<<" ";

    			else cout<<0<<" ";

    		}

    		cout<<'\n';

    	}

    	else{

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

    			if(i%2==0)cout<<0<<" ";

    			else cout<<1<<" ";

    		}

    		cout<<2<<" ";

    		if(x%2==0){

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

    				if(i%2!=0)cout<<0<<" ";

    				else cout<<1<<" ";

    			}

    		}

    		else{

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

    				if(i%2!=0)cout<<1<<" ";

    				else cout<<0<<" ";

    			}



    		}

    		cout<<'\n';

    	}





    }

    

}



int main() {

    ios_base::sync_with_stdio(0);

    cin.tie(0); cout.tie(0);

    int tc = 1;

     cin >> tc;

    for (int t = 1; t <= tc; t++) {

        // cout << "Case #" << t << ": ";

        solve();

    }

    

}

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



using namespace std;



template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

template<typename T_container, typename T = typename enable_if<!is_same<T_container, string>::value, typename T_container::value_type>::type> ostream& operator<<(ostream &os, const T_container &v) { os << '{'; string sep; for (const T &x : v) os << sep << x, sep = ", "; return os << '}'; }

void dbg_out() { cerr << endl; }

template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#ifdef LOCAL

#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)

#else

#define dbg(...)

#endif



#define ar array

#define ll long long

#define ld long double

#define sza(x) ((int)x.size())

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



const int MAX_N = 1e5 + 5;

const ll MOD = 1e9 + 7;

const ll INF = 1e9;

const ld EPS = 1e-9;







void solve() { 

	ll n,x,y;

	cin>>n>>x>>y;

	if(n%2==0){

		

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

				if(i==x && (y-x)%2==0)cout<<2<<" ";

				else if(i%2==0)cout<<1<<" ";

				else cout<<0<<" ";

			}

			cout<<'\n';







	}

	else{

		

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

				if(i%2==0)cout<<0<<" ";

				else cout<<1<<" ";

			}

			cout<<2<<" ";

			if(x%2==0){

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

					if(i%2==0)cout<<1<<" ";

					else cout<<0<<" ";

				}



			}

			else{

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

					if(i%2==0)cout<<0<<" ";

					else cout<<1<<" ";

				}



			}

			cout<<'\n';



		

		

	}

    

}



int main() {

    ios_base::sync_with_stdio(0);

    cin.tie(0); cout.tie(0);

    int tc = 1;

     cin >> tc;

    for (int t = 1; t <= tc; t++) {

        // cout << "Case #" << t << ": ";

        solve();

    }

    

}