ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2049C - MEX Cycle
Language: c++23 

Code 1:
#include<bits/stdc++.h>

using namespace std;

const int N = 2e5+7;

int a[N];

int main(){

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

	int T;

	cin>>T;

	while(T--){

		int n,x,y;

		cin>>n>>x>>y;

		int m=y-x,flag=0;

		if (n%2==0){

			if (m%2){

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

			} 

			else{

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

				a[y]=2;

			}

		}

		else{

			if (m%2){

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

				a[x]=2;

			}

			else{

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

				a[x]=2;

			}

		}

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

			cout<<a[i]<<" ";

		cout<<"\n";

	}

	return 0;

} 

Code 2:
#include<bits/stdc++.h>

using namespace std;

const int N = 2e5+7;

int a[N];

int main(){

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

	int T;

	cin>>T;

	while(T--){

		int n,x,y;

		cin>>n>>x>>y;

		int m=y-x,flag=0;

		if (n%2==0){

			if (m%2){

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

			} 

			else{

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

				a[y]=2;

			}

		}

		else{

			if (m%2){

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

				if (x-1==0) a[n]=2;

				else a[x-1]=2;

			}

			else{

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

				if (x-1==0) a[n]=2;

				else a[x-1]=2;

				a[y]=2;

			}

		}

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

			cout<<a[i]<<" ";

		cout<<"\n";

	}

	return 0;

} 

Answer: 1
Problem: 2049C - MEX Cycle
Language: c++23 

Code 1:
#include <bits/stdc++.h>

using namespace std;

#define ll long long

#define N 100000000+1;

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

#define fin(v) for(auto &it:v) cin>>it

#define mll map<ll,ll>

#define vl vector<ll>

#define srt(v) sort(v.begin(),v.end())  

#define cnt(a,v) count(a.begin(),a.end(),v)

#define sm(v) accumulate(all(v), 0LL)

#define ln "\n"

#define Griffith ios_base::sync_with_stdio(0);

#define The cin.tie(0);

#define Hawk cout.tie(0);

#define Solve ll tt; cin>>tt; while (tt--){solve();	}





void solve() {

	ll n; cin>>n;

	ll x,y; cin>>x>>y; x--; y--;

	vl ans(n);

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

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

		{

			ans[i] = 1&i;

		}

	}

	else{

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

		{

			if(i == x) ans[i] = 2;

			else ans[i] = ((i-x+n)%n)&1;

		}

		

	}

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

	{

		cout<<ans[i]<<" ";

	}

	cout<<ln;

 

 

}

int main(){

	Griffith The Hawk

	Solve

	//solve();

	return 0;

}

Code 2:
#include <bits/stdc++.h>

using namespace std;

#define ll long long

#define N 100000000+1;

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

#define fin(v) for(auto &it:v) cin>>it

#define mll map<ll,ll>

#define vl vector<ll>

#define srt(v) sort(v.begin(),v.end())  

#define cnt(a,v) count(a.begin(),a.end(),v)

#define sm(v) accumulate(all(v), 0LL)

#define ln "\n"

#define Griffith ios_base::sync_with_stdio(0);

#define The cin.tie(0);

#define Hawk cout.tie(0);

#define Solve ll tt; cin>>tt; while (tt--){solve();	}





void solve() {

	ll n; cin>>n;

	ll x,y; cin>>x>>y;

	vl ans(n);

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

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

		{

			ans[i] = 1&i;

		}

	}

	else{

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

		{

			if(i == x) ans[i] = 2;

			else ans[i] = ((i-x+n)%n)&1;

		}

		

	}

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

	{

		cout<<ans[i]<<" ";

	}

	cout<<ln;

 

 

}

int main(){

	Griffith The Hawk

	Solve

	//solve();

	return 0;

}

Answer: 1
Problem: 2049C - MEX Cycle
Language: c++23 

Code 1:
#include <iostream>

#include <bits/stdc++.h>

#define max(a, b) (a < b ? b : a)

#define min(a, b) ((a > b) ? b : a)

#define SZ(X) ((int)(X).size())

#define ALL(X) (X).begin(), (X).end()

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

typedef long long int ll;

typedef std::vector<int> vi;

typedef std::pair<int, int> pi;

#define clr(arr,value) memset(arr,value,sizeof(arr))

#define F first

#define S second

//#define int long long

#define el '\n'

#define OO 100000000000000

const ll MOD = 1e9 +7;

const int N = 2e5+5;

using namespace std;

typedef unordered_map<int,unordered_set<int>> HASHSET ;









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

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







void PLAY(){

    int n , x, y;

    cin >> n >> x>> y;

    --x;--y;

    vi ans(n);

    bool f = x&1?1:0;

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

        ans[i] = (i&1?f:!f);

    }

    if (n&1)ans[n-1]=2;

    if (!(abs(x-y)==1 || ans[x] != ans[y] || y-x == n-1)){

        x =  (x == 0)?y:x;

        ans[x] = 2;

    }

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

        cout << ans[i] << ' ';

    }

    cout << el;

}





int main() {



    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

//    freopen("input.txt","r",stdin);

//    freopen("output.txt", "w", stdout);

    int T = 1 ;

    cin >> T;



    while (T--){

        PLAY();

    }



    return 0;



}

Code 2:
#include <iostream>

#include <bits/stdc++.h>

#define max(a, b) (a < b ? b : a)

#define min(a, b) ((a > b) ? b : a)

#define SZ(X) ((int)(X).size())

#define ALL(X) (X).begin(), (X).end()

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

typedef long long int ll;

typedef std::vector<int> vi;

typedef std::pair<int, int> pi;

#define clr(arr,value) memset(arr,value,sizeof(arr))

#define F first

#define S second

//#define int long long

#define el '\n'

#define OO 100000000000000

const ll MOD = 1e9 +7;

const int N = 2e5+5;

using namespace std;

typedef unordered_map<int,unordered_set<int>> HASHSET ;









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

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







void PLAY(){

    int n , x, y;

    cin >> n >> x>> y;

    --x;--y;

    vi ans(n);

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

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

    }

    if (n&1)ans[n-1]=2;

    if (!(abs(x-y)==1 || ans[x] != ans[y] || y-x == n-1)){

        x =  (x == 0)?y:x;

        ans[x] = 2;

    }

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

        cout << ans[i] << ' ';

    }

    cout << el;

}





int main() {



    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

//    freopen("input.txt","r",stdin);

//    freopen("output.txt", "w", stdout);

    int T = 1 ;

    cin >> T;



    while (T--){

        PLAY();

    }



    return 0;



}

Answer: 1
Problem: 2049C - MEX Cycle
Language: c++17 

Code 1:
#include <bits/stdc++.h>

using namespace std;



void solve(){

    int n, x, y;

    cin >> n >> x >> y;

    vector<int> res(n + 1);

    if (n % 2) {

        bool ok = false;

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

            if (i == y && (y - x) % 2 == 0) ok = true;

            res[i] = (i + ok) % 2;

        }

        res[y] = 2;

    }

    else {

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

            res[i] = i % 2;

        }

        if (res[x] == res[y]) res[y] = 2;

    }

    for (int i = 1; i <= n; i++) cout << res[i] << " \n"[i == n];

}

int main(){

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    

    int T;

    cin >> T;

    while (T--) {

        solve();

    }

    return 0;

}

Code 2:
#include <bits/stdc++.h>

using namespace std;



void solve(){

    int n, x, y;

    cin >> n >> x >> y;

    vector<int> res(n + 1);

    if (n % 2) {

        bool ok = false;

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

            if (i == y) ok = true;

            res[i] = (i + ok) % 2;

        }

        res[y] = 2;

    }

    else {

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

            res[i] = i % 2;

        }

        if (res[x] == res[y]) res[y] = 2;

    }

    for (int i = 1; i <= n; i++) cout << res[i] << " \n"[i == n];

}

int main(){

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    

    int T;

    cin >> T;

    while (T--) {

        solve();

    }

    return 0;

}

Answer: 2
Problem: 2049C - MEX Cycle
Language: c++20 

Code 1:
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>

#define int long long

#define ok cout<<"ok\n"

using namespace std;

typedef pair<int,int> PII;

#define ft first

#define sd second

const int N=1e6+10;

const int mod=998244353;

//const int inf=0x3f3f3f3f;

const int inf=0x3f3f3f3f3f3f3f3f;

int n,m;

int a[N];

void solve(){

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

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

		a[i]=0;

		a[i+1]=1;

	}

	if(n%2)a[n]=2;

	if(a[x]==a[y]&&a[x]==0)a[y]=2;

	else if(a[x]==a[y]&&a[x]==1)a[x]=2;

	for(int i=1;i<=n;i++)cout<<a[i]<<' ';

	cout<<'\n';

}

signed main(){

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

	int Case=1;

	cin>>Case;

	while(Case--)solve();

}

Code 2:
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>

#define int long long

#define ok cout<<"ok\n"

using namespace std;

typedef pair<int,int> PII;

#define ft first

#define sd second

const int N=1e6+10;

const int mod=998244353;

//const int inf=0x3f3f3f3f;

const int inf=0x3f3f3f3f3f3f3f3f;

int n,m;

int a[N];

void solve(){

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

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

		a[i]=0;

		a[i+1]=1;

	}

	if(n%2==0){

		for(int i=1;i<n;i+=2)a[i]=0,a[i+1]=1;

		if(a[x]==a[y])a[x]=2;

	}

	else{

		a[x]=2;

		for(int i=x+1;i<=n;i+=2)a[i]=0,a[i+1]=1;

		for(int i=x-1;i>=1;i-=2)a[i]=1,a[i-1]=0;

	}

	for(int i=1;i<=n;i++)cout<<a[i]<<' ';

	cout<<'\n';

}

signed main(){

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

	int Case=1;

	cin>>Case;

	while(Case--)solve();

}

Answer: 2
Problem: 2049C - MEX Cycle
Language: c++23 

Code 1:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N=100000;

vector<int> v;

int CALMEX(vector<int> sex){

	int m[10]={};

	for(auto k:sex){

		m[k]++;

	}

	if(m[0]==0){

		return 0;

	}

	if(m[1]==0){

		return 1;

	}

	if(m[2]==0){

		return 2;

	}

	if(m[3]==0){

		return 3;

	}

	return 4;

}

void solve(){

	int n,x,y;

	cin>>n>>x>>y;

	int a[n+2]={},b[n+2]={};

	vector<vector<int>> g(n+2);

	g[x].push_back(y);

	g[y].push_back(x);

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

		g[i].push_back(i-1);

		g[i].push_back(i+1);

	}

	g[1].push_back(n);

	g[1].push_back(2);

	g[n].push_back(1);

	g[n].push_back(n-1);

	int thu=10;

	while(thu--){

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

		for(auto x:g[i]){

		//	cout<<a[x]<<" ";

			v.push_back(a[x]);

		}

		a[i]=CALMEX(v);

		v.clear();

	}

}

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

		cout<<a[i]<<" ";

	}

	cout<<'\n';

}

int main(){

	#define task ""

	if(fopen(task".inp", "r")){

		freopen(task".inp", "r", stdin);

		freopen(task".out", "w", stdout);

	}

	ios_base::sync_with_stdio(0);

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

	int t;

	cin>>t;

	while(t--){

		solve();

	}

}



Code 2:
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N=100000;

vector<int> v;

int CALMEX(vector<int> sex){

	int m[10]={};

	for(auto k:sex){

		m[k]++;

	}

	if(m[0]==0){

		return 0;

	}

	if(m[1]==0){

		return 1;

	}

	if(m[2]==0){

		return 2;

	}

	if(m[3]==0){

		return 3;

	}

	return 4;

}

void solve(){

	int n,x,y;

	cin>>n>>x>>y;

	int a[n+2]={};

	vector<vector<int>> g(n+2);

	g[x].push_back(y);

	g[y].push_back(x);

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

		g[i].push_back(i-1);

		g[i].push_back(i+1);

	}

	g[1].push_back(n);

	g[1].push_back(2);

	g[n].push_back(1);

	g[n].push_back(n-1);

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

		for(auto x:g[i]){

		//	cout<<a[x]<<" ";

			v.push_back(a[x]);

		}

		a[i]=CALMEX(v);

		v.clear();

	}

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

		for(auto x:g[i]){

		//	cout<<a[x]<<" ";

			v.push_back(a[x]);

		}

		a[i]=CALMEX(v);

		v.clear();

	}

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

		cout<<a[i]<<" ";

	}

	cout<<'\n';

}

int main(){

	#define task ""

	if(fopen(task".inp", "r")){

		freopen(task".inp", "r", stdin);

		freopen(task".out", "w", stdout);

	}

	ios_base::sync_with_stdio(0);

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

	int t;

	cin>>t;

	while(t--){

		solve();

	}

}



Answer: 1
Problem: 2049C - MEX Cycle
Language: c++20 

Code 1:
#include<bits/stdc++.h>

using namespace std;

const int N = 2e5+5;

int n,x,y;

int ans[N];



void solve()

{

	cin>>n>>x>>y;

	if((y-x)%2==1){

		if(n&1){

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

				if(i&1) cout <<1<<" ";

				else cout <<0<<" ";

			}

			cout <<2<<'\n';

		}else{

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

				if(i&1) cout <<1<<" ";

				else cout <<0<<" ";

			}

			cout <<'\n';

		}

	}else{

		if(n&1){

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

				if(i == x){

					cout <<2<<" ";

				}else{

					if(cnt&1) cout <<0<<" ";

					else cout <<1<<" ";

					cnt++;

				}

			}

			cout <<'\n';

		}else{

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

				if(i&1) ans[i] = 1;

				else ans[i] = 0;

			}

			ans[x] = 2;

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

				cout <<ans[i]<<" ";

			}

			cout <<'\n';

		}

	}

}



int main()

{

	ios::sync_with_stdio(false);

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

	

	int t;

	cin>>t;

	while(t--)

	{

		solve();

	}

	return 0;

}

Code 2:
#include<bits/stdc++.h>

using namespace std;

const int N = 2e5+5;

int n,x,y;

int ans[N];



void solve()

{

	cin>>n>>x>>y;

	if(x == 1 || (y-x)%2==1){

		cout <<2<<" ";

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

			if(i&1) cout <<0<<" ";

			else cout <<1<<" ";

		}

		cout <<'\n';

	}else if((y-x)%2==0){

		ans[x] = 2;

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

			if(cnt&1) ans[i] = 0;

			else ans[i] = 1;

		}

		for(int i = x-1,cnt = 0;i>=1;i--,cnt++){

			if(cnt&1) ans[i] = 1;

			else ans[i] = 0;

		}

		for(int i = 1;i <= n  ;i++) cout <<ans[i]<<" ";

		cout <<'\n';

	}

}



int main()

{

	ios::sync_with_stdio(false);

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

	

	int t;

	cin>>t;

	while(t--)

	{

		solve();

	}

	return 0;

}

Answer: 1
Problem: 2049C - MEX Cycle
Language: c++23 

Code 1:
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'

#define int long long

const int inf = 0x7f7f7f7f;

const int mod = 1e9+7;



long long ksm(long long a,long long b){

	if(b==0) return 1;

	long long ans = 1;

	while(b>0){

		if(b & 1){

			ans= ans * a % mod;

		}

		a = a * a % mod;

		b>>=1;

	}

	return ans;

}



void solve(){

	int n,x,y;

	cin>>n>>x>>y;

	y--;x--;

	vector<int> ans(n);

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

	{

       ans[(i+x)%n] = i%2;

	}

	if(n%2 || (y-x)%2==0)

	{

		ans[x] = 2;

	}

	for(auto t : ans)

		cout<<t<<" ";

	cout<<endl;



}



signed main(){

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	int t;

	cin>>t;

	while(t--){

		solve();

	}



	return 0;

}

Code 2:
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'

#define int long long

const int inf = 0x7f7f7f7f;

const int mod = 1e9+7;



long long ksm(long long a,long long b){

	if(b==0) return 1;

	long long ans = 1;

	while(b>0){

		if(b & 1){

			ans= ans * a % mod;

		}

		a = a * a % mod;

		b>>=1;

	}

	return ans;

}



void solve(){

	int n,x,y;

	cin>>n>>x>>y;

	vector<int> ans(n);

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

	{

       ans[(i+x)%n] = i%2;

	}

	if(n%2 || (y-x)%2==0)

	{

		ans[x] = 2;

	}

	for(auto t : ans)

		cout<<t<<" ";

	cout<<endl;



}



signed main(){

	std::ios::sync_with_stdio(false);

	std::cin.tie(0);

	int t;

	cin>>t;

	while(t--){

		solve();

	}



	return 0;

}

Answer: 1
Problem: 2049C - MEX Cycle
Language: c++23 

Code 1:
#include<bits/stdc++.h>

using namespace std;



#define endl '\n'

#define int long long

#define PII std::pair<int,int>

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



using i64 = long long;

using i128 = __int128;

using u64 = unsigned long long;



constexpr int N = 2e6 + 5;

constexpr i64 INF = LLONG_MAX;

constexpr double eps = 1e-10;

constexpr int mod = 998244353;

constexpr int MOD = 1e9 + 7;



void Main()

{

    int n, x, y;

    cin >> n >> x >> y;

    if (abs(x - y) == 1) {

        int flag = 0, be = 1 + n % 2;

        cout << be << " \n"[n == 1];

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

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

            flag ^= 1;

        }

        return;

    }

    vector<int> ans(n + 1);

    int flag = 0;

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

        ans[i] = flag++;

        flag %= 3;

    }

    if (n % 3 == 1) {

        swap(ans[n], ans[n - 1]);

    }

    if (ans[x] == ans[y]) {

        ans[y] = 3;

    }

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

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

    }

}



signed main()

{

    std::ios::sync_with_stdio(false);

    std::cin.tie(0), std::cout.tie(0);

    int T = 1;

    std::cin >> T;

    while (T--) {

        Main();

    }

    return 0;

}

Code 2:
#include<bits/stdc++.h>

using namespace std;



#define endl '\n'

#define int long long

#define PII std::pair<int,int>

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



using i64 = long long;

using i128 = __int128;

using u64 = unsigned long long;



constexpr int N = 2e6 + 5;

constexpr i64 INF = LLONG_MAX;

constexpr double eps = 1e-10;

constexpr int mod = 998244353;

constexpr int MOD = 1e9 + 7;



void Main()

{

    int n, x, y;

    cin >> n >> x >> y;

    x--, y--;

    vector<int> ans(n);

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

        ans[(x + i) % n] = i % 2;

    }

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

        ans[x] = 2;

    }

    

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

        cout << ans[i] << " \n"[i == n - 1];

    }

}



signed main()

{

    std::ios::sync_with_stdio(false);

    std::cin.tie(0), std::cout.tie(0);

    int T = 1;

    std::cin >> T;

    while (T--) {

        Main();

    }

    return 0;

}

Answer: 2
Problem: 2049C - MEX Cycle
Language: c++17 

Code 1:
#include<bits/stdc++.h>

using namespace std;



void solve(){

   int n,x,y;

cin>>n>>x>>y;



int a[n];

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

    a[(x+i)%n]=i%2;

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

        a[x]=2;

    }

}

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

        cout<<a[i]<<" ";

    }

    cout<<endl;

    }

    







    

int main(){

    long long t;

	cin>>t;

	while(t--)

    {

       solve();

}

}

		

		

	



Code 2:
#include<bits/stdc++.h>

using namespace std;

 

void solve(){

   int n,x,y;

cin>>n>>x>>y;

 --x;--y;

int a[n];

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

    a[(x+i)%n]=i%2;

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

        a[x]=2;

    }

}

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

        cout<<a[i]<<" ";

    }

    cout<<endl;

    }

    

 

 

 

    

int main(){

    long long t;

	cin>>t;

	while(t--)

    {

       solve();

}

}

Answer: 2
Problem: 2049C - MEX Cycle
Language: python

Code 1:
def main():



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



        n,x,y = map(int,input().split())



        x -= 1

        y -=1 



        ans = [0] * n





        for i in range(n):



            ans[(x + i) %n] = i % 2



        

        if n % 2 != 0  or (x - y) % 2 == 0:

            ans[x] = 2

        



        print(*ans)







if __name__ == "__main__":

    main()

Code 2:
def main():



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



        n,x,y = map(int,input().split())







        ans = [0] * n





        for i in range(n):



            ans[(x + i) %n] = i % 2



        

        if n % 2 != 0  or (x - y) % 2 == 0:

            ans[x] = 2

        



        print(*ans)







if __name__ == "__main__":

    main()

Answer: 1
Problem: 2049C - MEX Cycle
Language: c++23 

Code 1:
#include<bits/stdc++.h>

using namespace std;



#define endl '\n'

#define int long long

#define PII std::pair<int,int>

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



using i64 = long long;

using i128 = __int128;

using u64 = unsigned long long;



constexpr int N = 2e6 + 5;

constexpr i64 INF = LLONG_MAX;

constexpr double eps = 1e-10;

constexpr int mod = 998244353;

constexpr int MOD = 1e9 + 7;



void Main()

{

    int n, x, y;

    cin >> n >> x >> y;

    if (abs(x - y) == 1) {

        int flag = 0, be = 1 + n % 2;

        cout << be << " \n"[n == 1];

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

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

            flag ^= 1;

        }

        return;

    }

    vector<int> ans(n + 1);

    int flag = 0;

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

        ans[i] = flag;

        flag ^= 1;

    }

    if (n % 2 == 1) {

        ans[n] = 2;

    }

    if (ans[x] == ans[y]) {

        ans[y] = 2;

    }

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

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

    }

}



signed main()

{

    std::ios::sync_with_stdio(false);

    std::cin.tie(0), std::cout.tie(0);

    int T = 1;

    std::cin >> T;

    while (T--) {

        Main();

    }

    return 0;

}

Code 2:
#include<bits/stdc++.h>

using namespace std;



#define endl '\n'

#define int long long

#define PII std::pair<int,int>

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



using i64 = long long;

using i128 = __int128;

using u64 = unsigned long long;



constexpr int N = 2e6 + 5;

constexpr i64 INF = LLONG_MAX;

constexpr double eps = 1e-10;

constexpr int mod = 998244353;

constexpr int MOD = 1e9 + 7;



void Main()

{

    int n, x, y;

    cin >> n >> x >> y;

    x--, y--;

    vector<int> ans(n);

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

        ans[(x + i) % n] = i % 2;

    }

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

        ans[x] = 2;

    }

    

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

        cout << ans[i] << " \n"[i == n - 1];

    }

}



signed main()

{

    std::ios::sync_with_stdio(false);

    std::cin.tie(0), std::cout.tie(0);

    int T = 1;

    std::cin >> T;

    while (T--) {

        Main();

    }

    return 0;

}

Answer: 2