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

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



using namespace std;

using ll = long long;

using ull = unsigned long long;

using ld = long double;



#define double ld

#define int ll

#define MOD 1000000007

#define MOD1 998244353

#define INF 1e18

#define pb push_back

#define ppb pop_back

#define mp make_pair

#define fi first

#define se second

#define vl vector<ll>

#define vvl vector<vl>

#define vb vector<bool>

#define vvb vector<vb>

#define vc vector<char>

#define vvc vector<vc>

#define vs vector<string>

#define pll pair<ll, ll>

#define vpll vector<pair<ll, ll>>

#define vvpll vector<vector<pair<ll, ll>>>

#define umll unordered_map<ll, ll>

#define umcl unordered_map<char, ll>

#define umlc unordered_map<ll, char>

#define fr(i, a, n) for (ll i = (a); i < (n); i++)

#define rfr(i, n, a) for (ll i = n; i >= a; i--)

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

#define allr(v) v.rbegin(), v.rend()

#define srt(v) sort(all(v))         // sort

#define mxe(v) *max_element(all(v)) // find max element in vector

#define mne(v) *min_element(all(v)) // find min element in vector

#define rev(v) reverse(all(v))

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

#define pq_max priority_queue<int>

#define pq_min priority_queue<int, vector<int>, greater<int>>

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

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



// function



ll gcd(ll a, ll b)

{

    if (a == 0)

        return b;

    return gcd(b % a, a);

}



ll ncr(ll n, ll r)

{

    ll res = 1;

    fr(i, 0, r)

    {

        res = res * (n - i);

        res = res / (i + 1);

    }

    return res;

}



int lcm(int a, int b)

{

    return (a * b) / gcd(a, b);

}



vector<int> simpleSieve(int limit)

{

    vector<bool> is_prime(limit + 1, true);

    vector<int> primes;

    for (int p = 2; p <= limit; ++p)

    {

        if (is_prime[p])

        {

            primes.push_back(p);

            for (int multiple = p * p; multiple <= limit; multiple += p)

            {

                is_prime[multiple] = false;

            }

        }

    }

    return primes;

}



int primeinrange(int L, int R)

{

    int limit = sqrt(R);

    vector<int> primes = simpleSieve(limit);

    vector<bool> is_prime(R - L + 1, true);

    for (int prime : primes)

    {

        int start = max(prime * prime, (L + prime - 1) / prime * prime);

        for (int j = start; j <= R; j += prime)

        {

            is_prime[j - L] = false;

        }

    }

    if (L == 1)

        is_prime[0] = false;

    int c = 0;

    for (int i = 0; i <= R - L; ++i)

    {

        if (is_prime[i])

        {

            c++;

        }

    }

    return c;

}



int mod_exp(int base, int exp, int mod)

{

    int result = 1;

    while (exp > 0)

    {

        if (exp % 2 == 1)

        {

            result = (result * base) % mod;

        }

        base = (base * base) % mod;

        exp /= 2;

    }

    return result;

}



// Code by harshsingh9222



int exp(int k,int c)

{

    return pow(k,c);

}



void solve() {

    int n,x,y;

    cin>>n>>x>>y;

    x--,y--;

    vl a(n);

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

    {

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

    }

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

    {

        a[x]=2;

    }

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

    {

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

    }

    cout<<'\n';

}



signed main()

{

    ios_base ::sync_with_stdio(false);

    cin.tie(0);

    cout << setprecision(12) << fixed;



    int t;

    cin >> t;



    while (t--)

    {

        solve();

    }

    return 0;

}

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



using namespace std;

using ll = long long;

using ull = unsigned long long;

using ld = long double;



#define double ld

#define int ll

#define MOD 1000000007

#define MOD1 998244353

#define INF 1e18

#define pb push_back

#define ppb pop_back

#define mp make_pair

#define fi first

#define se second

#define vl vector<ll>

#define vvl vector<vl>

#define vb vector<bool>

#define vvb vector<vb>

#define vc vector<char>

#define vvc vector<vc>

#define vs vector<string>

#define pll pair<ll, ll>

#define vpll vector<pair<ll, ll>>

#define vvpll vector<vector<pair<ll, ll>>>

#define umll unordered_map<ll, ll>

#define umcl unordered_map<char, ll>

#define umlc unordered_map<ll, char>

#define fr(i, a, n) for (ll i = (a); i < (n); i++)

#define rfr(i, n, a) for (ll i = n; i >= a; i--)

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

#define allr(v) v.rbegin(), v.rend()

#define srt(v) sort(all(v))         // sort

#define mxe(v) *max_element(all(v)) // find max element in vector

#define mne(v) *min_element(all(v)) // find min element in vector

#define rev(v) reverse(all(v))

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

#define pq_max priority_queue<int>

#define pq_min priority_queue<int, vector<int>, greater<int>>

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

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



// function



ll gcd(ll a, ll b)

{

    if (a == 0)

        return b;

    return gcd(b % a, a);

}



ll ncr(ll n, ll r)

{

    ll res = 1;

    fr(i, 0, r)

    {

        res = res * (n - i);

        res = res / (i + 1);

    }

    return res;

}



int lcm(int a, int b)

{

    return (a * b) / gcd(a, b);

}



vector<int> simpleSieve(int limit)

{

    vector<bool> is_prime(limit + 1, true);

    vector<int> primes;

    for (int p = 2; p <= limit; ++p)

    {

        if (is_prime[p])

        {

            primes.push_back(p);

            for (int multiple = p * p; multiple <= limit; multiple += p)

            {

                is_prime[multiple] = false;

            }

        }

    }

    return primes;

}



int primeinrange(int L, int R)

{

    int limit = sqrt(R);

    vector<int> primes = simpleSieve(limit);

    vector<bool> is_prime(R - L + 1, true);

    for (int prime : primes)

    {

        int start = max(prime * prime, (L + prime - 1) / prime * prime);

        for (int j = start; j <= R; j += prime)

        {

            is_prime[j - L] = false;

        }

    }

    if (L == 1)

        is_prime[0] = false;

    int c = 0;

    for (int i = 0; i <= R - L; ++i)

    {

        if (is_prime[i])

        {

            c++;

        }

    }

    return c;

}



int mod_exp(int base, int exp, int mod)

{

    int result = 1;

    while (exp > 0)

    {

        if (exp % 2 == 1)

        {

            result = (result * base) % mod;

        }

        base = (base * base) % mod;

        exp /= 2;

    }

    return result;

}



// Code by harshsingh9222



int exp(int k,int c)

{

    return pow(k,c);

}



void solve() {

    int n,x,y;

    cin>>n>>x>>y;

    vl a(n);

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

    {

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

    }

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

    {

        a[x]=2;

    }

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

    {

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

    }

    cout<<'\n';

}



signed main()

{

    ios_base ::sync_with_stdio(false);

    cin.tie(0);

    cout << setprecision(12) << fixed;



    int t;

    cin >> t;



    while (t--)

    {

        solve();

    }

    return 0;

}

Answer: 1