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

Code 1:
/**

you can ^_^ (•‿•)

( إن الله وملائكته يصلون على النبي يا أيها الذين آمنوا صلوا عليه وسلموا تسليما )

**/

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/hash_policy.hpp>

// #pragma GCC optimize("Ofast")

// #pragma GCC target("avx,avx2,fma")

// #pragma GCC optimization ("unroint-loops")

// #include "robin_hood.h"

using namespace __gnu_pbds;

using namespace std;

typedef long long ll;

typedef unsigned long long ul;

typedef tree<pair <ll, ll>, null_type, greater<pair <ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define endl "\n"

const int mod = 998244353;

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

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

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 2e5 + 5;



void Solve() {

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

    vector <int> ans(n + 1);

    ans[x] = 2;

    ans[y] = 1;

    for (int i = 1; i < x; i++) ans[i] = ans[i > 1 ? i - 1 : n] == 0 ? 1 : 0;

    for (int i = x + 1; i < y; i++) ans[i] = ans[i > 1 ? i - 1 : n] == 0 ? 1 : 0;

    for (int i = y + 1; i < n + 1; i++) ans[i] = ans[i > 1 ? i - 1 : n] == 0 ? 1 : 0;

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

    cout << endl;

}



signed main() {

    fast();

    int t = 1; cin >> t;

    while (t--) Solve();

}

/**

you can ^_^ (•‿•)

( إن الله وملائكته يصلون على النبي يا أيها الذين آمنوا صلوا عليه وسلموا تسليما )

**/

Code 2:
/**

you can ^_^ (•‿•)

( إن الله وملائكته يصلون على النبي يا أيها الذين آمنوا صلوا عليه وسلموا تسليما )

**/

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/hash_policy.hpp>

// #pragma GCC optimize("Ofast")

// #pragma GCC target("avx,avx2,fma")

// #pragma GCC optimization ("unroint-loops")

// #include "robin_hood.h"

using namespace __gnu_pbds;

using namespace std;

typedef long long ll;

typedef unsigned long long ul;

typedef tree<pair <ll, ll>, null_type, greater<pair <ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

#define endl "\n"

const int mod = 998244353;

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

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

void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 2e5 + 5;



void Solve() {

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

    vector <int> ans(n + 1);

    ans[x] = (n - y + x - 1) % 2 || (y - x - 1) % 2 ? 2 : 0;

    ans[y] = 1;

    for (int i = y + 1; i <= n; i++) ans[i] = ans[i - 1] == 0 ? 1 : 0;

    for (int i = 1; i < x; i++) ans[i] = ans[i > 1 ? i - 1 : n] == 0 ? 1 : 0;

    for (int i = y - 1; i > x; i--) ans[i] = ans[i + 1] == 0 ? 1 : 0;

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

    cout << endl;

}



signed main() {

    fast();

    int t = 1; cin >> t;

    while (t--) Solve();

}

/**

you can ^_^ (•‿•)

( إن الله وملائكته يصلون على النبي يا أيها الذين آمنوا صلوا عليه وسلموا تسليما )

**/

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 || (x+n-y) % 2) 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++17 

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

using namespace std;



int main() {

    int t;

    cin >> t;

    

    while (t--) {

        int n, x, y;

        cin >> n >> x >> y;

        

        vector<int> groups(n + 1);

        

        // Start with filling most positions with alternating 0s and 1s

        int curr_val = 0;

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

            if (i == y) {

                groups[i] = 2;

            } else {

                groups[i] = curr_val;

                curr_val = 1 - curr_val;

            }

        }

        

        // Then adjust values working backwards from y to ensure MEX property holds

        int curr = y;

        while (curr != x) {

            curr = (curr == 1) ? n : curr - 1;

            if (curr == x) break;

            

            // Get next value (considering circular array)

            int next = (curr == n) ? 1 : curr + 1;

            

            // If next is y, get the value after y

            if (next == y) {

                next = (next == n) ? 1 : next + 1;

            }

            

            // Adjust current position to maintain MEX property

            groups[curr] = (groups[next] + 1) % 2;

        }

        

        // Ensure x position has value 0

        groups[x] = 0;

        

        // Print result

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

            cout << groups[i] << " ";

        }

        cout << "\n";

    }

    return 0;

}

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

using namespace std;



int main() {

    int t;

    cin >> t;

    

    while (t--) {

        int n, x, y;

        cin >> n >> x >> y;

        --x;

        --y;



        vector<int> groups(n);



        groups[x] = 0;



        for (int i = (x + 1 + n) % n; i != y; i = (i + 1 + n) % n){

            groups[i] = (groups[(i-1) % n] + 1) % 2;



        }

    

        for (int i = (x - 1 + n) % n; i != y; i = (i - 1 + n) % n){

            groups[i] = (groups[(i+1) % n] + 1) % 2;



        }



        if (groups[(y - 1) % n] == 1 || groups[(y+1) % n] == 1) groups[y] = 2;

        else{

            groups[y] = 1;

        }

        for (auto g : groups){

            cout << g << " ";

        }

        cout << '\n';

    }

}

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

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

int main() {

  for (int _ = (std::cin.tie(0), not std::ios::sync_with_stdio(0)); _ or std::cin >> _, _; _--) {

    int n, x, y;

    std::cin >> n >> x >> y;

    x--, y--;

    std::vector<int> a(n);

    if (n % 2 == 1) {

      a[x] = 2;

      int digit = 0;

      for (int i = (x + 1) % n; i != x; (++i) %= n) a[i] = digit, digit = not digit;

    } else {

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

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

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

    }

    for (int val : a) std::cout << val << " ";

    std::cout << "\n";

  }

}



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

int main() {

  for (int _ = (std::cin.tie(0), not std::ios::sync_with_stdio(0)); _ or std::cin >> _, _; _--) {

    int n, x, y;

    std::cin >> n >> x >> y;

    x--, y--;

    std::vector<int> a(n);

    if (n % 2 == 1) {

      a[x] = 2;

      int digit = 0;

      for (int i = (x + 1) % n; i != x; (++i) %= n) a[i] = digit, digit = not digit;

    } else {

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

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

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

    }

    DEBUG(a);

  }

}



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

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

#define ll long long

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

#define rall(x) (x).rbegin(), (x).rend()

#define int long long

#define inf LONG_MAX

#define loop(i, n) for (int i = 0; i < n; i++)

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

#define vec vector<int>

#define no cout << "NO" << '\n';

#define yes cout << "YES" << '\n';

#define nl cout << '\n';

#define MOD 1000000007

#define fs fflush(stdout);

#define pb push_back

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

#define ump unordered_map<int, int>

#define vs vector<string>

#define vv vector<vector<int>>

#define vb vector<bool>

using namespace std;



void solve();



signed main() {

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t = 1;

    cin >> t;

    while (t--)

        solve();

    return 0;

}





void solve() {

   int n,m,k;

   cin>>n>>m>>k;

   vec a(n,-1);

   a[m-1]=0;

   a[k-1]=1;

   m--,k--;

   for(int i=m+1;i<k-1;i++)

    a[i]=!a[i-1];



   a[k-1]=(a[k-2]==1?0:2);

   for(int i=k+1;;i++)

   {

       if(i%n==(m-1+n)%n)break;

       else if(a[i%n]==-1) a[i%n]=!a[(i-1+n)%n];

   }

   if(a[(m-1+n)%n]==-1)

   a[(m-1+n)%n] =(a[(m-2+n)%n]==0?1:2);

   loop(i,n) cout<<a[i]<<" ";nl

}



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

#define ll long long

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

#define rall(x) (x).rbegin(), (x).rend()

#define int long long

#define inf LONG_MAX

#define loop(i, n) for (int i = 0; i < n; i++)

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

#define vec vector<int>

#define no cout << "NO" << '\n';

#define yes cout << "YES" << '\n';

#define nl cout << '\n';

#define MOD 1000000007

#define fs fflush(stdout);

#define pb push_back

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

#define ump unordered_map<int, int>

#define vs vector<string>

#define vv vector<vector<int>>

#define vb vector<bool>

using namespace std;



void solve();



signed main() {

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t = 1;

    cin >> t;

    while (t--)

        solve();

    return 0;

}





void solve() {

   int n,m,k;

   cin>>n>>m>>k;

   vec a(n,-1);

   a[m-1]=0;

   a[k-1]=1;

   m--,k--;

   for(int i=m+1;i<k-1;i++)

    a[i]=!a[i-1];



   if(a[k-1]==-1)

   a[k-1]=(a[k-2]==1?0:2);

   for(int i=k+1;;i++)

   {

       if(i%n==(m-1+n)%n)break;

       else if(a[i%n]==-1) a[i%n]=!a[(i-1+n)%n];

   }

   if(a[(m-1+n)%n]==-1)

   a[(m-1+n)%n] =(a[(m-2+n)%n]==0?1:2);

   loop(i,n) cout<<a[i]<<" ";nl

}



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

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

using namespace std;

const int MOD = 998244353;

#define int long long

#define loop(i, n, x) for (int i = 0; i < n; i += x)



void solve()

{

    int n, x, y;

    cin >> n >> x >> y;

    x--;

    y--;

    vector<int> ans(n);

    loop(i, n, 1)

    {

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

    }

    if (n & 1 || !((y - x) & 1))

    {

        ans[x] = 2;

    }

    loop(i, n, 1)

    {

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

    }

    cout << endl;

}



int32_t main()

{

    ios::sync_with_stdio(false);

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



    int t = 1;

    cin >> t;

    while (t--)

    {

        solve();

    }

    return 0;

}



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

using namespace std;

const int MOD = 998244353;

#define int long long

#define loop(i, n, x) for (int i = 0; i < n; i += x)



void solve()

{

    int n, x, y;

    cin >> n >> x >> y;

    x--;

    y--;

    vector<int> ans(n);

    loop(i, n, 1)

    {

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

    }

    if (n & 1 || !(y - x) & 1)

    {

        ans[x] = 2;

    }

    loop(i, n, 1)

    {

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

    }

    cout << endl;

}



int32_t main()

{

    ios::sync_with_stdio(false);

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



    int t = 1;

    cin >> t;

    while (t--)

    {

        solve();

    }

    return 0;

}



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

Code 1:
#include <iostream>

#include <vector>

#include <algorithm>

#include <climits>

#include <queue>

using namespace std;

using ll = long long int;

int main()

{

    ll i, j, n, k, t, d, m, l, v, x, y;

    cin >> t;

    while (t--)

    {

        cin>>n>>x>>y;

        int arr[n+1];

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

            if(i%2==0){

                arr[i]=1;

            }else{

                arr[i]=0;

            }

        }if(n%2==0){

            arr[n]=1;

        }else{

            arr[n]=2;

        }if(arr[x]==arr[y]){

            if(y==n-1){

                arr[x]=2;

            }else{

                arr[y]=2;

            }

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

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

        }cout<<endl;

    }

    return 0;

}



Code 2:
#include <iostream>

#include <vector>

#include <algorithm>

#include <climits>

#include <queue>

using namespace std;

using ll = long long int;

int main()

{

    ll i, j, n, k, t, d, m, l, v, x, y;

    cin >> t;

    while (t--)

    {

        cin >> n >> x >> y;

        int arr[n + 1];

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

        {

            if (i % 2 == 0)

            {

                arr[i] = 1;

            }

            else

            {

                arr[i] = 0;

            }

        }

        if (n % 2 == 0)

        {

            arr[n] = 1;

        }

        else

        {

            arr[n] = 2;

        }

        if (arr[x] == arr[y])

        {

            if (y == n - 1)

            {

                arr[x] = 2;

            }

            else

            {

                arr[y] = 2;

                if (y != n && arr[y + 2] == 2)

                {

                    arr[y + 1] = 0;

                    arr[n] = 1;

                }

            }

        }

        for (i = 1; 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;

int main(){

	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

	int t; cin>>t;

	while(t--){

		int n,x,y; cin>>n>>x>>y; x--; y--; vector<int> a(n);

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

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

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

		cout<<endl;

	}

	return 0;

}

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

using namespace std;

int main(){

	ios_base::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 a[n+1];

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

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

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

		cout<<endl;

	}

	return 0;

}

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

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

using namespace std;

using ll = long long;

const ll inf = 4e18;

const int N = 2e5 + 5;

int n, x, y;

int a[N];

void solve(){

	cin >> n >> x >> y;

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

		a[i] = (i - 1) % 2;

	}

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



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

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

		else{

			if(x == 2)swap(a[x], a[1]);

			else if(y == n)swap(a[y], a[1]);

			else a[x] = 2;

		}

	}

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

		cout << '\n';



}



int main(){

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

	int _ = 1;cin >> _;

	while(_ --){

		solve();

	}

	return 0;

}

/*



*/

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

using namespace std;

using ll = long long;

const ll inf = 4e18;

const int N = 2e5 + 5;

int n, x, y;

int a[N];

void solve(){

	cin >> n >> x >> y;

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

		a[i] = (i - 1) % 2;

	}

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



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

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

		else{

			if(x == 2)swap(a[x], a[1]);

			else if(y == n)swap(a[y], a[1]);

			else a[y] = 2;

		}

	}

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

		cout << '\n';



}



int main(){

	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: python

Code 1:
def solve():

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

    x-=1

    y-=1

    a = [0]*n

    #x, x+1, ..., y

    if (y-x+1)%2 == 0:

        #偶数だべ

        #x, yは0, 1にする

        for i in range(x, y+1):

            a[i] = (i-x)%2

    else:

        #奇数なり

        #x, yは0, 1にする

        for i in range(x, y+1):

            a[i] = (i-x)%2

        #0, 2, 1

        a[y-1] = 2

        a[y] = 1

    #y, y+1, ..., n-1, 0, ..., x

    x += n

    if (x-y+1)%2 == 0:

        #偶数だ～～～！！！！！

        #x, yは0, 1にする

        for i in range(y, x+1):

            if (i-y)%2 == 0:

                a[i%n] = 1

            else:

                a[i%n] = 0

    else:

        #奇数だよ

        #x, yは0, 1にする

        for i in range(y, x+1):

            a[i%n] = (x-i)%2

        a[y] = 1

        a[(y+1)%n] = 2

    print(*a, sep = " ")



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

    solve()

Code 2:
def solve():

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

    x-=1

    y-=1

    a = [0]*n

    #x, x+1, ..., y

    if (y-x+1)%2 == 0:

        #偶数だべ

        #x, yは0, 1にする

        for i in range(x, y+1):

            a[i] = (i-x)%2

    else:

        #奇数なり

        #x, yは0, 1にする

        for i in range(x, y+1):

            a[i] = (i-x)%2

        #0, 2, 1

        a[y-1] = 2

        a[y] = 1

    #y, y+1, ..., n-1, 0, ..., x

    x += n

    if (x-y+1)%2 == 0:

        #偶数だ～～～！！！！！

        #x, yは0, 1にする

        for i in range(y, x+1):

            if (i-y)%2 == 0:

                a[i%n] = 0

            else:

                a[i%n] = 1

    else:

        #奇数だよ

        #x, yは0, 1にする

        for i in range(y, x+1):

            a[i%n] = (x-i)%2

        a[y] = 1

        a[(y+1)%n] = 2

    print(*a, sep = " ")



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

    solve()

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

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



using namespace std;

#define lli long long int



void solve(){

	lli n, x, y;

	cin >> n >> x >> y;

	vector <lli> a1(n), a2(n);

	lli st = 1;

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

		a1[i] = st;

		st = 1-st;

	}

	st = 0;

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

		a2[i] = st;

		st = 1 -st;

	}

	if(n&1){

		a1[n-1] = 2;

		a2[n-1] = 2;

	}

	bool yes1 = false, yes2 = false;

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

		yes1 = true;

		goto label;

	}

	x--; y--;

	if(a1[x] == 1){

		a1[x] = 2;

		yes1 = true;

	}

	else if((a1[y] == 1)){

		a1[y] = 2;

		yes1 = true;

	}

	else if(a2[x] == 1){

		a2[x] = 2;

		yes2 = true;

	}

	else if(a2[y] == 1){

		a2[y] = 2;

		yes2 = true;

	}

	label:

	if(yes1){

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

			cout << a1[i] << " ";

		}

		cout << endl;

	}

	else{

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

			cout << a2[i] << " ";

		}

		cout << endl;

	}



}



#define lli long long int

int main(){

    ios_base::sync_with_stdio(false);

#ifndef ONLINE_JUDGE

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

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

#endif

	lli t;

	cin >> t;

	// t = 1;

	while(t--){

		solve();

	}

	

#ifndef ONLINE_JUDGE

    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";

#endif

	return 0;

}

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



using namespace std;

#define lli long long int



void solve(){

	lli n, x, y;

	cin >> n >> x >> y;

	vector <lli> a1(n), a2(n);

	lli st = 1;

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

		a1[i] = st;

		st = 1-st;

	}

	st = 0;

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

		a2[i] = st;

		st = 1 -st;

	}

	if(n&1){

		a1[n-1] = 2;

		a2[n-1] = 2;

	}

	bool yes1 = false, yes2 = false;

	if(((y-x) == 1) || ((y == n) && (n&1)) || ((y+x)&1)){

		yes1 = true;

		goto label;

	}

	x--; y--;

	if(a1[x] == 1 && !((n&1) && (x == 0))){

		a1[x] = 2;

		yes1 = true;

	}

	else if((a1[y] == 1) && !((n&1) && (y == (n-2)))){

		a1[y] = 2;

		yes1 = true;

	}

	else if(a2[x] == 1 && !((n&1) && (x == 0))){

		a2[x] = 2;

		yes2 = true;

	}

	else if((a2[y] == 1) && !((n&1) && (y == (n-2)))){

		a2[y] = 2;

		yes2 = true;

	}

	label:

	if(yes1){

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

			cout << a1[i] << " ";

		}

		cout << endl;

	}

	else{

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

			cout << a2[i] << " ";

		}

		cout << endl;

	}



}



#define lli long long int

int main(){

    ios_base::sync_with_stdio(false);

#ifndef ONLINE_JUDGE

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

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

#endif

	lli t;

	cin >> t;

	// t = 1;

	while(t--){

		solve();

	}

	

#ifndef ONLINE_JUDGE

    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";

#endif

	return 0;

}

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

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

using namespace std;

int arr[200005];



void solve(){

	int n,x,y;

	cin>>n>>x>>y;

	if(n&1){

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

			arr[i-1]=0;

			arr[i]=1;

		}

		arr[n]=2;

		if(arr[x]==0&&arr[y]==0){

				if(x==n-1||x==1)swap(arr[x],arr[n]);

				else arr[x]=2;

		}

		if(arr[x]==1&&arr[y]==1){

				if(x==n-1||x==1)swap(arr[x],arr[n]);

				else arr[x]=2;

		}

	}else{

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

			arr[i-1]=0;

			arr[i]=1;

		}

		if(arr[x]==0&&arr[y]==0){

				if(x==n-1||x==1)swap(arr[x],arr[n]);

				else arr[x]=2;

		}

		if(arr[x]==1&&arr[y]==1){

				if(x==n-1||x==1)swap(arr[x],arr[n]);

				else arr[x]=2;

		}

	}

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

    cout << "\n";

}



int main(){

	int t;

	cin>>t;

	while(t--)solve();

}

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

using namespace std;

int arr[200005];



void solve(){

	int n,x,y;

	cin>>n>>x>>y;

	if(n&1){

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

			arr[i-1]=0;

			arr[i]=1;

		}

		arr[n]=2;

		if(arr[x]==0&&arr[y]==0){

				if(x==n-1||x==1)swap(arr[x],arr[n]);

				else arr[x]=2;

		}

		if(arr[x]==1&&arr[y]==1){

				if(x==n-1||x==1)swap(arr[x],arr[n]);

				else arr[x]=2;

		}

	}else{

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

			arr[i-1]=0;

			arr[i]=1;

		}

		if(arr[x]==0&&arr[y]==0){

			arr[x]=2;

		}

		if(arr[x]==1&&arr[y]==1){

			arr[x]=2;

		}

	}

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

    cout << "\n";

}



int main(){

	int t;

	cin>>t;

	while(t--)solve();

}

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]);

			}

		else{

			a[y-1]=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){

		int a1=a[y%n];

		int b1=a[y-2];

		int c1=a[x-1];

		a[y-1]=findMex(a1,b1,c1);

		}

	for(auto t:a){

		cout<<t<<" ";

		}

	cout<<endl;

	}



int main(){

	int t;

	cin>>t;

	while(t--){

		solve();

		}

	}



Answer: 1