Problem: 2049C - MEX Cycle
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>

using namespace std;



typedef long long ll;

typedef long long ll;

typedef vector<ll> vi;

typedef vector<char> vc;

typedef vector<long long> vll;

typedef unsigned long long ull;

typedef vector<pair<ll, ll>> vpii;

typedef vector<pair<ll, char>> vpic;



#define for1(i, n1, n2) for(ll i = n1; i < n2; i++)  

#define for2(i, n2, n1) for(ll i = n2; i > n1; i--)  

#define vecMAX(v) *max_element(v.begin(), v.end())     

#define vecMIN(v) *min_element(v.begin(), v.end())      

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

#define rev(v) reverse(v.begin(), v.end())             

#define pb push_back                                  

#define inx ll p[0]; cin >> p[0];                           

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

#define mp make_pair                                  

#define ff first                                       

#define ss second                                       

#define v_erase(i) v.erase(v.begin() + i);          

#define sum(v) accumulate(v.begin(), v.end(), 0)        

#define INF 1e9                                         

#define MOD 1000000007                                 

#define sz(v) ((ll)(v).size())  

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

#ifndef ONLINE_JUDGE



    #include "Jatt_don't_Care.h"

#else

    #define see(...) 42 

#endif

void solve() {

ll n,x,y;

cin>>n>>x>>y;

x--,y--;

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

    for1(i,0,n)cout<<i%2<<" ";

    return;

}

ll c=0;

for1(i,0,n){

    if(x==i){

        cout<<2<<" ";

        if(n%2==0){

            c+=1;

        }

    }else{

    cout<<(i+c)%2<<" ";

    }

}

cout<<"\n";

}

signed main() {

   Code_by_Millenialkiid

   ll t;

    cin >> t;                 



    for (ll i = 0; i < t; i++) {

        #ifndef ONLINE_JUDGE



            cout << "-----------------" << i + 1 << endl;

        #endif



       solve(); 

    }



    return 0;

}

Submission (verdict: Accepted):
#include <bits/stdc++.h>

using namespace std;



typedef long long ll;

typedef long long ll;

typedef vector<ll> vi;

typedef vector<char> vc;

typedef vector<long long> vll;

typedef unsigned long long ull;

typedef vector<pair<ll, ll>> vpii;

typedef vector<pair<ll, char>> vpic;



#define for1(i, n1, n2) for(ll i = n1; i < n2; i++)  

#define for2(i, n2, n1) for(ll i = n2; i > n1; i--)  

#define vecMAX(v) *max_element(v.begin(), v.end())     

#define vecMIN(v) *min_element(v.begin(), v.end())      

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

#define rev(v) reverse(v.begin(), v.end())             

#define pb push_back                                  

#define inx ll p[0]; cin >> p[0];                           

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

#define mp make_pair                                  

#define ff first                                       

#define ss second                                       

#define v_erase(i) v.erase(v.begin() + i);          

#define sum(v) accumulate(v.begin(), v.end(), 0)        

#define INF 1e9                                         

#define MOD 1000000007                                 

#define sz(v) ((ll)(v).size())  

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

#ifndef ONLINE_JUDGE



    #include "Jatt_don't_Care.h"

#else

    #define see(...) 42 

#endif

void solve() {

ll n,x,y;

cin>>n>>x>>y;

x--,y--;

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

    for1(i,0,n)cout<<i%2<<" ";

    return;

}

ll c=0;

for1(i,0,n){

    if(x==i){

        cout<<2<<" "; 

        if(n%2==0){     

        c+=1;

        c%=2;

        }        

        continue;

    }

    cout<<c<<" ";

    c++;

    c%=2;   

}

cout<<"\n";

}

signed main() {

   Code_by_Millenialkiid

   ll t;

    cin >> t;                 



    for (ll i = 0; i < t; i++) {

        #ifndef ONLINE_JUDGE



            cout << "-----------------" << i + 1 << endl;

        #endif



       solve(); 

    }



    return 0;

}