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

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

// g++-14 -o main [file].cpp;

//./main < input.txt > output.txt

using namespace std;



#pragma region

#define ll long long

template<typename T>

void print(T v[], int n, int i = 0){

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

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

    }

    cout << endl;

}

template<typename T>

void print(vector<T> v){

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

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

    }

    cout << endl;

}

ll inv_mod_prime(ll a, ll MOD) {

  return a <= 1 ? a : MOD - (MOD/a) * inv_mod_prime(MOD % a, MOD) % MOD;

}

// count number of bits 

// only for int64 and int32

//__builtin_popcount 



// bool is_prime[4'00'001];

// void sieve(int n){ 

//     memset(is_prime, true, sizeof(is_prime));

//     is_prime[0] = is_prime[1] = false;

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

//         is_prime[i] = false;

//     }

//     for(int i = 9; i <= n; i += 6){ 

//         is_prime[i] = false;

//     }

//     for(int i = 15; i <= n; i += 10){ 

//         is_prime[i] = false;

//     }

//     int num = 7; 

//     while(num  <= n){

//         if(is_prime[num]){

//             for(int i = num+num; i <= n; i += num){

//                 is_prime[i] = false;

//             }

//         }

//         num += 2;

//     }

// }

#pragma endregion





int a[2'00'001];

int n, x, y;



int convert_ind(int i){ 

    if(i == 0) return n;

    if(i == n+1) return 1;

    return i;



}



void solve(){

    cin >> n >> x >> y;

    int start = x; 

    int diff = y-x;

    int rev_diff = n-diff; 



    int val = 0;

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

        a[i] = val; 

        val ^= 1;

    }

    if(diff%2 == 0){ 

        a[convert_ind(y-1)] = 2; 

        a[y] = 1;

    }

    int ind = x;

    val = 0;

    while(ind != y){ 

        a[ind] = val;

        val ^= 1;

        ind--;

        ind = convert_ind(ind);

    }

    if(rev_diff%2 == 0){ 

        a[convert_ind(y+1)] = 2;

        a[y] = 1;

    }



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

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

    }

    cout << endl;

















    







}



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>

// g++-14 -o main [file].cpp;

//./main < input.txt > output.txt

using namespace std;



#pragma region

#define ll long long

template<typename T>

void print(T v[], int n, int i = 0){

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

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

    }

    cout << endl;

}

template<typename T>

void print(vector<T> v){

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

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

    }

    cout << endl;

}

ll inv_mod_prime(ll a, ll MOD) {

  return a <= 1 ? a : MOD - (MOD/a) * inv_mod_prime(MOD % a, MOD) % MOD;

}

// count number of bits 

// only for int64 and int32

//__builtin_popcount 



// bool is_prime[4'00'001];

// void sieve(int n){ 

//     memset(is_prime, true, sizeof(is_prime));

//     is_prime[0] = is_prime[1] = false;

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

//         is_prime[i] = false;

//     }

//     for(int i = 9; i <= n; i += 6){ 

//         is_prime[i] = false;

//     }

//     for(int i = 15; i <= n; i += 10){ 

//         is_prime[i] = false;

//     }

//     int num = 7; 

//     while(num  <= n){

//         if(is_prime[num]){

//             for(int i = num+num; i <= n; i += num){

//                 is_prime[i] = false;

//             }

//         }

//         num += 2;

//     }

// }

#pragma endregion





int a[2'00'001];

int n, x, y;



int convert_ind(int i){ 

    if(i == 0) return n;

    if(i == n+1) return 1;

    return i;



}



void solve(){

    cin >> n >> x >> y;

    int start = x; 

    int diff = y-x;

    int rev_diff = n-diff; 



    int val = 0;

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

        a[i] = val; 

        val ^= 1;

    }

    if(diff%2 == 0){ 

        a[convert_ind(y-1)] = 2; 

        a[y] = 1;

    }

    int ind = x;

    val = 0;

    while(ind != y){ 

        a[ind] = val;

        val ^= 1;

        ind--;

        ind = convert_ind(ind);

    }

    if(rev_diff%2 == 0){ 

        a[convert_ind(y+1)] = 2;

        a[y] = 1;

    }



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

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

    }

    cout << endl;

















    







}



int main(){

    ios::sync_with_stdio(false); 

    cin.tie(nullptr);

    int t; 

    cin >> t; 

    while(t--){

        

        solve();

    }

    return 0;

}

Answer: 1