ShaysXIA/CodeInsightBench huggingface dataset:
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?1:0);

    }

    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++20 

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

using namespace std;

long long n,m,t,k1,k2;

long long zs,zp,ys,yp;

string s1;



int main()

{

    cin>>t;

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

        cin>>n>>k1>>k2;

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

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

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

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

        }

        cout<<endl;

    }

    return 0;

}

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

using namespace std;

long long n,m,t,k1,k2;

long long zs,zp,ys,yp;

vector<int> a;

string s1;



int main()

{

    cin>>t;

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

        cin>>n>>k1>>k2;

        a.clear();

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

            if(i%2==1)a.push_back(0);

            else a.push_back(1);

        }

        if(n%2==0){

            a.push_back(1);

            if(a[k1-1]==a[k2-1]){

                a[k1-1]=2;

            }

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

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

            }

        }

        else{

            a.push_back(2);

            if(a[k1-1]==a[k2-1]){

                if(k1!=1)a[k1-1]=2;

                else{

                    a[k1-1]=2;

                    a[n-1]=0;

                }

            }

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

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

            }

        }

        cout<<endl;

    }

    return 0;

}

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

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

using namespace std;

#define int long long 

void solve() {

    int n,x,y;

    cin>>n>>x>>y;

    vector<int>a(n+1,0);

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

           if(i%2){

               a[i]=0;

           }else{

               a[i]=1;

           }

    }

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

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

        if(y==n&&a[1]==2) a[y]=2,a[1]=0;

        else  a[y]=2;

    }

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

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

    }

}

signed main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    cout.tie(nullptr);

    

    int t = 1;

    cin >> t;



    while (t--) {

        solve();

    }

}

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

using namespace std;

#define int long long 

void solve() {

    int n,x,y;

    cin>>n>>x>>y;

    vector<int>a(n+1,0);

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

           if(i%2){

               a[i]=0;

           }else{

               a[i]=1;

           }

    }

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

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

         a[y]=2;

    }

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

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

    }

}

signed main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    cout.tie(nullptr);

    

    int t = 1;

    cin >> t;



    while (t--) {

        solve();

    }

}

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

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

using namespace std;

#define int long long

#define pb push_back

#define ff first

#define ss second

#define pii pair<int,int>

#define vi vector<int>

#define vii vector<pair<int,int>>



void solve()

{

    int n,x,y;

    cin >> n>>x>>y;

    vi v(n);

    if(x>y)swap(x,y);

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

        if(i&1)v[i]=0;

        else v[i]=1;

    }

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

    if(v[x-1]==v[y-1] ){

        v[y-1]=2;

    }

    for(int i=0; i<v.size(); i++){

        cout<<v[i]<<" ";

    }

    cout<<endl;

    

    

    

    

    

}

signed main()

{

    int tcs;

    cin >> tcs;

    while (tcs--)

    {

        solve();

    }

}

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

using namespace std;

#define int long long

#define pb push_back

#define ff first

#define ss second

#define pii pair<int,int>

#define vi vector<int>

#define vii vector<pair<int,int>>



void solve()

{

    int n,x,y;

    cin >> n>>x>>y;

    vi v(n);

    x--,y--;

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

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

    }

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

        v[x] = 2;

    for(int i=0; i<v.size(); i++){

        cout<<v[i]<<" ";

    }

    cout<<endl;

    

    

    

    

    

}

signed main()

{

    int tcs;

    cin >> tcs;

    while (tcs--)

    {

        solve();

    }

}

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

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

//#include <atcoder/all>

using namespace std;

//using namespace atcoder;

//using mint = modint998244353;

//long long型=int64_tという認識で大丈夫です。

#define ll long long

#define ull unsigned long long

#define vec vector

#define vi vector<int>

#define vll vector<ll>

#define pq priority_queue

#define pb push_back

#define rep(i, l, r) for(int i=(int)(l); i<(int)(r); i++)

#define ld long double



const ll INF = 1e9;

const ll inf = 9e18;



struct Edge {

    int to;

    ll cost;

};



struct SEdge {

    int to;

    pair<ll, ll> cost;

};



template<class T>

using spq = priority_queue<T, vec<T>, greater<T>>; 



const vector<int> di = {-1, 0, 1, 1, 0, -1}, dj = {0, 1, 1, 0, -1, -1};



template<class T>

bool chmin(T& a, T b) {

    if (a > b) {

        a = b;

        return true;

    }

    return false;

}



template<class T>

bool chmax(T& a, T b) {

    if(a < b) {

        a = b;

        return true;

    }

    return false;

}



using S = ll;



S op(S a, S b) {return a + b;}

S e() {return 0;}



int main() {

    int t; cin >> t;

    rep(i, 0, t) {

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

        vi ans(n, 0);

        rep(j, 0, n) {

            ans[j] = j % 2;

        }

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

        if(ans[x] == ans[y]) ans[max(x, y)] = 2;

        if(y == n - 3 && ans[n - 1] == 2) {ans[n - 2] = 0; ans[n - 1] = 1;}

        rep(j, 0, n) cout << ans[j] << " ";

        cout << endl;

    }

}



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

//#include <atcoder/all>

using namespace std;

//using namespace atcoder;

//using mint = modint998244353;

//long long型=int64_tという認識で大丈夫です。

#define ll long long

#define ull unsigned long long

#define vec vector

#define vi vector<int>

#define vll vector<ll>

#define pq priority_queue

#define pb push_back

#define rep(i, l, r) for(int i=(int)(l); i<(int)(r); i++)

#define ld long double



const ll INF = 1e9;

const ll inf = 9e18;



struct Edge {

    int to;

    ll cost;

};



struct SEdge {

    int to;

    pair<ll, ll> cost;

};



template<class T>

using spq = priority_queue<T, vec<T>, greater<T>>; 



const vector<int> di = {-1, 0, 1, 1, 0, -1}, dj = {0, 1, 1, 0, -1, -1};



template<class T>

bool chmin(T& a, T b) {

    if (a > b) {

        a = b;

        return true;

    }

    return false;

}



template<class T>

bool chmax(T& a, T b) {

    if(a < b) {

        a = b;

        return true;

    }

    return false;

}



using S = ll;



S op(S a, S b) {return a + b;}

S e() {return 0;}



int main() {

    int t; cin >> t;

    rep(i, 0, t) {

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

        vi ans(n, 0);

        rep(j, 0, n) {

            ans[j] = j % 2;

        }

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

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

            ans[max(x, y)] = 2;

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

            if(y == n - 3 && ans[n - 1] == 2) {ans[n - 2] = 0; ans[n - 1] = 1;}

        }

        rep(j, 0, n) cout << ans[j] << " ";

        cout << endl;

    }

}



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

Code 1:
#pragma GCC optimize(2)

#include<bits/stdc++.h>

using namespace std;

#define ll long long

const int INF=0x3f3f3f3f;

const int mod=1e9+7;

const int N=200005;



int a[N];

void solve(){

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

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

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

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

        if(a[n]==2){

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

                if(i==x)cout<<a[i]<<" 2 ";

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

            }

            cout<<endl;

            return;

        }

        else{

            if(y!=n){

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

                    if(i==x)cout<<a[i]<<" 2 ";

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

                }

                cout<<2<<endl;

                return;

            }

            else{

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

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

                }

                cout<<2<<endl;

                return;

            }

        }

    }

    for(int i=1;i<=n;i++)cout<<a[i]<<(i==n?endl:" ");

}



int main(){

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

    int _=1;cin>>_;

    while(_--){

        solve();

    }

    return 0;

}

Code 2:
#pragma GCC optimize(2)

#include<bits/stdc++.h>

using namespace std;

#define ll long long

const int INF=0x3f3f3f3f;

const int mod=1e9+7;

const int N=200005;



int a[N];

void solve(){

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

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

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

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

        if(a[n]==2){

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

                if(i==x)cout<<a[i]<<" 2 ";

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

            }

            cout<<endl;

            return;

        }

        else{

            if(y!=n){

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

                    if(i==x)cout<<a[i]<<" 2 ";

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

                }

                cout<<2<<endl;

                return;

            }

            else{

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

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

                }

                cout<<2<<endl;

                return;

            }

        }

    }

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

}



int main(){

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

    int _=1;cin>>_;

    while(_--){

        solve();

    }

    return 0;

}

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

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

using namespace std;

typedef long long ll;

bool compareByFirst(const pair<int, int>& a, const pair<int, int>& b) {

    return a.first < b.first;

}

int findMex(int a, int b, int c) {

    set<int> s = {a, b, c}; // Store unique numbers

    

    for (int i = 0; ; i++) { // Check from 0 upwards

        if (s.find(i) == s.end()) return i;

    }

}

void solve(){

	int n,x,y;

	cin>>n>>x>>y;

	

	vector<int>a(n);

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

		a[i]=1;

		}

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

		a[i]=0;

		}

	if(n%2==1){

		a[n-1]=2;

		}

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

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

			swap(a[n-1],a[n-2]);

			}

		}

	for(auto t:a){

		cout<<t<<" ";

		}

	cout<<endl;

	}



int main(){

	int t;

	cin>>t;

	while(t--){

		solve();

		}

	}



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

using namespace std;

typedef long long ll;

bool compareByFirst(const pair<int, int>& a, const pair<int, int>& b) {

    return a.first < b.first;

}

int findMex(int a, int b, int c) {

    set<int> s = {a, b, c}; // Store unique numbers

    

    for (int i = 0; ; i++) { // Check from 0 upwards

        if (s.find(i) == s.end()) return i;

    }

}

void solve(){

	int n,x,y;

	cin>>n>>x>>y;

	

	vector<int>a(n);

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

		a[i]=1;

		}

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

		a[i]=0;

		}

	if(n%2==1){

		a[n-1]=2;

		}

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

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

			swap(a[n-1],a[n-2]);

			}

		else{

			a[y-1]=2;

			}

		}

	for(auto t:a){

		cout<<t<<" ";

		}

	cout<<endl;

	}



int main(){

	int t;

	cin>>t;

	while(t--){

		solve();

		}

	}



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

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

using namespace std;

#define int long long

#define pi 3.1415926

#define pb(e) push_back(e)

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

#define cin(v) for(auto &i:v){cin>>i;}

#define sv(a) sort(a.begin(),a.end())

#define fastread() (ios_base::sync_with_stdio(false), cin.tie(NULL));

#define forn(a, c) for (int (a) = 0; (a) < (c); (a)++)

#define vi vector<int> 

#define vii vector<vector<int>>

#define vc vector<char> 

#define vcc vector<vector<char>> 

void print(vector<int> v) {

for (auto i : v) cout << i << ' ';

cout << endl;}

 

 

int binpow(int a,int b){

int res=1;

while(b>0){

if(b&1)

res*=a; 

a*=a;

b>>=1;}

return res;}



void solve(){

    int n,x,y;

    cin>>n>>x>>y;

    x--;y--;

    vi ans(n);

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

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

        ans[x]=2;

    print(ans);

}

 

 

signed main(){

int t; cin>>t; while(t--) solve();

}

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

using namespace std;

#define int long long

#define pi 3.1415926

#define pb(e) push_back(e)

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

#define cin(v) for(auto &i:v){cin>>i;}

#define sv(a) sort(a.begin(),a.end())

#define fastread() (ios_base::sync_with_stdio(false), cin.tie(NULL));

#define forn(a, c) for (int (a) = 0; (a) < (c); (a)++)

#define vi vector<int> 

#define vii vector<vector<int>>

#define vc vector<char> 

#define vcc vector<vector<char>> 

void print(vector<int> v) {

for (auto i : v) cout << i << ' ';

cout << endl;}

 

 

int binpow(int a,int b){

int res=1;

while(b>0){

if(b&1)

res*=a; 

a*=a;

b>>=1;}

return res;}



int mex(vi f,vi ans) {

    set<int> v;

    forn(i,f.size()) {

        v.insert(ans[f[i]]);

    }

    int mex=0;

    for(auto i:v) if(i==mex) mex++;

    return mex;

}



void solve(){

    int n,x,y;

    cin>>n>>x>>y;

    vi ans(n,1e9);

    vii f(n);

    forn(i,n) {

        f[i].pb((i==0)?n-1:i-1);

        f[i].pb((i==n-1)?0:i+1);

    }

    x--;y--;

    f[x].pb(y);

    f[y].pb(x);

    forn(i,n) {

        ans[i]=mex(f[i],ans);

    }

    print(ans);

}

 

 

signed main(){

int t; cin>>t; while(t--) solve();

}

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

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

using namespace std;

#define rep(i, l, n) for(int i = (int)(l); i < (int)(n); i++)

#define ll long long



vector<int> solve() {

    int n; cin >> n;

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

    x--; y--;

    vector<int> ans(n, 0);

    rep(i, 0, n) ans[i] = i % 2;

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

    int start = -1;

    rep(i, 0, n) {

        if(ans[i] != ans[(i + y - x) % n]) start = i;

    }

    if(start == -1) {

        ans[0] = 2;

    }

    start = (start - x + n) % n;

    vector<int> real_ans(n);

    rep(i, 0, n) real_ans[i] = ans[(i + start) % n];

    return real_ans;

}



int main() {

    int t; cin >> t;

    while(t--) {

        auto v = solve();

        for(int u : v) cout << u << " ";

        cout << endl;

    }

}

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

using namespace std;

#define rep(i, l, n) for(int i = (int)(l); i < (int)(n); i++)

#define ll long long



vector<int> solve() {

    int n; cin >> n;

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

    x--; y--;

    vector<int> ans(n, 0);

    rep(i, 0, n) ans[i] = i % 2;

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

    int start = -1;

    rep(i, 0, n) {

        if(ans[i] != ans[(i + y - x) % n]) start = i;

    }

    if(start == -1) {

        ans[0] = 2;

        start = 0;

    }

    start = (start - x + n) % n;

    vector<int> real_ans(n);

    rep(i, 0, n) real_ans[i] = ans[(i + start) % n];

    return real_ans;

}



int main() {

    int t; cin >> t;

    while(t--) {

        auto v = solve();

        for(int u : v) cout << u << " ";

        cout << endl;

    }

}

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

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

typedef long long ll;

#define MII map<int, int>

#define UMII unordered_map<int, int>

#define F first

#define S second

#define PB push_back

#define MP make_pair

#define vi vector<int>

#define vvi vector<vi>

#define qi queue<int>

#define si stack<int>

#define rep(i, a, b) for(int i = a; i < b; i++)

using namespace std;



int main(){

    ios::sync_with_stdio(0);

    cin.tie(0);



    int t;

    cin >> t;

    while(t--){

        int n, x, y;

        cin >> n >> x >> y;

        if(x > y) swap(x, y);

        x--;

        y--;

        vector<int> arr(n);

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

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

        }

        if((y - x) % 2 == 0) arr[x] = 2;



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

            cout << arr[i] << " ";

        }

        cout << endl;

    }

    return 0;

}

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

typedef long long ll;

#define MII map<int, int>

#define UMII unordered_map<int, int>

#define F first

#define S second

#define PB push_back

#define MP make_pair

#define vi vector<int>

#define vvi vector<vi>

#define qi queue<int>

#define si stack<int>

#define rep(i, a, b) for(int i = a; i < b; i++)

using namespace std;



int main(){

    ios::sync_with_stdio(0);

    cin.tie(0);



    int t;

    cin >> t;

    while(t--){

        int n, x, y;

        cin >> n >> x >> y;

        if(x > y) swap(x, y);

        x--;

        y--;

        vector<int> arr(n);

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

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

        }

        if((y - x) % 2 == 0 || (x+n-y) % 2 == 0) arr[x] = 2;



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

            cout << arr[i] << " ";

        }

        cout << endl;

    }

    return 0;

}

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

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

using namespace std;

typedef long long ll;

#define endl "\n";

const int N = 2e5 + 5;



int main() {

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

	ll _; cin >> _;

	while (_--) {

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

		--x, --y;

		vector<ll> a(n);

		if (n & 1) {

			a[x] = 2;

			for (int i = 1; i < n; ++i) a[(x + i) % n] = i & 1;

		}

		else {

			if ((x ^ y) & 1) for (int i = 0; i < n; ++i) a[i] = i & 1;

			else {

				a[x] = 2;

				for (int i = 1; i < n; ++i) a[(x + i) % n] = i & 1;

			}

		}

		for (int i = 0; i < n; ++i) cout << a[i] << " ";

		cout << endl;

	}

	return 0;

}





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

using namespace std;

typedef long long ll;

#define endl "\n";

const int N = 2e5 + 5;



int main() {

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

	ll _; cin >> _;

	while (_--) {

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

		--x, --y;

		vector<ll> a(n);

		if (n & 1) {

			a[x] = 2;

			for (int i = 1; i < n; ++i) a[(x + i) % n] = i & 1;

		}

		else {

			if (x != y) for (int i = 0; i < n; ++i) a[i] = i & 1;

			else {

				a[x] = 2;

				for (int i = 1; i < n; ++i) a[(x + i) % n] = i & 1;

			}

		}

		for (int i = 0; i < n; ++i) cout << a[i] << " ";

		cout << endl;

	}

	return 0;

}





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

Code 1:
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;

#define int long long 

#define endl '\n'

#define IOS ios::sync_with_stdio(0),cin.tie(0);

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

#define all2(x) x.begin()+1,x.end()

#define pi pair<int,int> 

#define vi vector<int>

#define vc vector<char> 

#define si set<int> 

#define mi map<int,int>

#define mc map<char,int>

#define YES cout<<"Yes"<<endl;

#define NO  cout<<"No"<<endl;

#define fi first

#define sc second

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }



void solve()

{

	int n,x,y;

	cin>>n>>x>>y;

	x--,y--;

	vi a(n);

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

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

		j=1-j;

	}

	

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

		a[x]=2;

	}

	for (auto i : a){

		cout<<i<<" ";

	}

	cout<<endl;

}



signed main()

{

	IOS

	int t;

	cin>>t;

//	t=1;

	while(t--){

		solve();

	}

}





Code 2:
#include "bits/stdc++.h"

using namespace std;

typedef long long ll;

#define int long long 

#define endl '\n'

#define IOS ios::sync_with_stdio(0),cin.tie(0);

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

#define all2(x) x.begin()+1,x.end()

#define pi pair<int,int> 

#define vi vector<int>

#define vc vector<char> 

#define si set<int> 

#define mi map<int,int>

#define mc map<char,int>

#define YES cout<<"Yes"<<endl;

#define NO  cout<<"No"<<endl;

#define fi first

#define sc second

template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }







void solve()

{

	int n,x,y;

	cin>>n>>x>>y;

	vi a(n+1);

	if(n%2==0){

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

			a[i]=j;

			j=1-j;

		}

	}

	else {

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

			a[i]=j;

			j=1-j;

		}

		a[n]=2;

	}

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

		if(x!=1){

			a[x]=2;

		}

		else {

			a[y]=2;

		}

	}

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

		cout<<a[i]<<' ';

	}

	cout<<endl;

	

}



signed main()

{

	IOS

	int t;

	cin>>t;

//	t=1;

	while(t--){

		solve();

	}

}





Answer: 1