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] = (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 ^_^ (•‿•)

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

**/

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] = 2;

    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: 1
Problem: 2049C - MEX Cycle
Language: c++20 

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



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;

        int a[n];

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

        {

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

        }

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

        {

            a[x-1]=2;

        }

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

        {

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

        }

        cout<<'\n';

    }



    return 0;

}

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



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;

        int a[n];

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

        {

            a[i%n]=i%2;

        }

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

        {

            a[x-1]=2;

        }

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

        {

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

        }

        cout<<'\n';

    }



    return 0;

}

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

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

using namespace std;

#define ll long long

#define pair pair<ll,ll>

ll n,m,x,y,say1,say2,cem=0;

int main()

{

    cin>>n;

    string s;

    while(n--)

    {

      cin>>m>>x>>y;

      x--; y--;

      vector<ll>v(m);

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

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

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

      v[x]=2;

      for(auto k : v)

      cout<<k<<' ';

      cout<<endl;

    }

}

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

using namespace std;

#define ll long long

#define pair pair<ll,ll>

ll n,m,x,ysay1,say2,cem=0;

int main()

{

    cin>>n;

    string s;

    while(n--)

    {

      cin>>m>>x>>y;

      x--; y--;

      vector<ll>v(m);

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

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

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

      ans[x]=2;

      for(auto k : ans)

      cout<<k<<' ';

      cout<<endl;

    }

}

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

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

using namespace std;

typedef long long ll;

const int N = 2e6 + 7;

ll r[N];

int h[N], e[N], ne[N], idx;

void add(int a, int b)

{

    e[idx] = b, ne[idx] = h[a], h[a] = idx++;

}

void dfs(int x)

{

    if (r[x] >= 0)

    {

        return;

    }

    set<ll> s;

    for (int i = h[x]; i != -1; i = ne[i])

    {

        int to = e[i];

        if (r[to] >= 0)

        {

            s.insert(r[to]);

        }

    }

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

    {

        if (s.count(i) == 0)

        {

            r[x] = i;

            break;

        }

    }

    for (int i = h[x]; i != -1; i = ne[i])

    {

        int to = e[i];

        dfs(to);

    }

}

void solve()

{

    ll n, x, y;

    cin >> n >> x >> y;

    idx = 0;

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

    {

        r[i] = -1;

        h[i] = -1;

    }

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

    {

        add(i - 1, i);

        add(i, i - 1);

    }

    add(1, n);

    add(n, 1);

    add(x, y);

    add(y, x);

    r[y] = 1;

    dfs(x);

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

    {

        cout << r[i] << ' ';

    }

    cout << '\n';

}

int main()

{

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

    int T;

    cin >> T;

    while (T--)

    {

        solve();

    }

}

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

using namespace std;

typedef long long ll;

const int N = 2e5 + 7;

ll r[N];

int h[N], e[N], ne[N], idx;

void add(int a, int b)

{

    e[idx] = b, ne[idx] = h[a], h[a] = idx++;

}

void dfs(int x)

{

    if (r[x] >= 0)

    {

        return;

    }

    set<ll> s;

    for (int i = h[x]; i != -1; i = ne[i])

    {

        int to = e[i];

        if (r[to] >= 0)

        {

            s.insert(r[to]);

        }

    }

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

    {

        if (s.count(i) == 0)

        {

            r[x] = i;

            break;

        }

    }

    for (int i = h[x]; i != -1; i = ne[i])

    {

        int to = e[i];

        dfs(to);

    }

}

void solve()

{

    ll n, x, y;

    cin >> n >> x >> y;

    idx = 0;

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

    {

        r[i] = -1;

        h[i] = -1;

    }

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

    {

        add(i - 1, i);

        add(i, i - 1);

    }

    add(1, n);

    add(n, 1);

    add(x, y);

    add(y, x);

    r[y] = 1;

    dfs(x);

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

    {

        cout << r[i] << ' ';

    }

    cout << '\n';

}

int main()

{

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

    int T;

    cin >> T;

    while (T--)

    {

        solve();

    }

}

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

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>ans(n);

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

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

		}

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

			ans[x]=2;

		}

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

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

		}

	cout<<endl;

	}

	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>ans(n);

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

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

		}

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

			ans[x]=2;

		}

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

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

		}

	cout<<endl;

	}

	return 0;

}



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

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

#define pii pair<int,int>

#define fi first

#define se second

#define ll long long

#define int long long

#define endl '\n'

#define ull unsigned long long

using namespace std;

const int N=2e5+5;

int a[N],n,x,y;

void work(){

    cin>>n>>x>>y;

    if(n&1){

        a[x]=2;

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

            x++;if(x==n+1)x=1;

            a[x]=(i&1);

        }

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

        cout<<endl;

        return;

    }

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

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

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

        cout<<endl;

        return;

    }

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

        a[x]=2;

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

        cout<<endl;

        return;

    }

    a[x]=2;int xx=x;

    int fl=0;

    while(1){

        x++;if(x==n+1)x=1;

        if(x==y)break;

        if(fl==0)a[x]=0;

        if(fl==1)a[x]=2;

        if(fl>=2)a[x]=(fl-1)&1;

        fl++;

    }

    fl=0;x=xx;

    while(1){

        x--;if(x==0)x=n;

        if(x==y)break;

        a[x]=(fl-1)&1;

        fl++;

    }

    a[y]=1;

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

    cout<<endl;

    return;

}

signed main(){

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int T=1;

    cin>>T;

    while(T--)work();

    return 0;

}

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

#define pii pair<int,int>

#define fi first

#define se second

#define ll long long

#define int long long

#define endl '\n'

#define ull unsigned long long

using namespace std;

const int N=2e5+5;

int a[N],n,x,y;

void work(){

    cin>>n>>x>>y;

    if(n&1){

        a[x]=2;

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

            x++;if(x==n+1)x=1;

            a[x]=(i&1);

        }

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

        cout<<endl;

        return;

    }

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

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

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

        cout<<endl;

        return;

    }

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

        a[x]=2;

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

        cout<<endl;

        return;

    }

    a[x]=2;int xx=x;

    int fl=0;

    while(1){

        x++;if(x==n+1)x=1;

        if(x==y)break;

        if(fl==0)a[x]=0;

        if(fl==1)a[x]=2;

        if(fl>=2)a[x]=(fl-1)&1;

        fl++;

    }

    fl=0;x=xx;

    while(1){

        x--;if(x==0)x=n;

        if(x==y)break;

        a[x]=(fl-1)&1;

        fl++;

    }

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

    cout<<endl;

    return;

}

signed main(){

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int T=1;

    cin>>T;

    while(T--)work();

    return 0;

}

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

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

#define int long long

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

using namespace std;

typedef pair<int, int> pii;

typedef array<int,2> arr2;

const int inf = 1e18 + 30;

const int N=1e5+15;

const int mod=1e9+7;

void smin(int&x,int y){x=min(x,y);}

void smax(int&x,int y){x=max(x,y);}

void help(){

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

    vector<int> vec(n+1);

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

        vec[i]=(i&1?0:1);

    if(n&1)

        for(int i=n;i>=1;i-=2){

            vec[i]=1;

            // if(i-1!=x&&i-1!=y){

                vec[i-1]=2;

                break;

            // }

        } 

    set<int> st;

    st.insert(vec[(x-1)<1?n:(x-1)]); 

    st.insert(vec[(x+1)>n?1:(x+1)]);

    st.insert(vec[y]);

    int mex=0;

    while(st.count(mex)) mex++;

    vec[x]=mex;

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

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

}

signed main() { 

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t=1;

    cin>>t;

    while(t--){

        help();

        // cout<<help()<<"\n";

    }

    return 0;

}

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

#define int long long

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

using namespace std;

typedef pair<int, int> pii;

typedef array<int,2> arr2;

const int inf = 1e18 + 30;

const int N=1e5+15;

const int mod=1e9+7;

void smin(int&x,int y){x=min(x,y);}

void smax(int&x,int y){x=max(x,y);}

void help(){

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

    vector<int> vec(n+1);

    if(n&1){

        vec[x]=2; vec[x-1]=1,vec[x+1]=0;

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

            vec[i]=vec[i-1]^1;

        for(int i=x-2;i>=1;i--)

            vec[i]=vec[i+1]^1;

    }

    else{

        if(abs(x-y)&1)

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

                vec[i]=vec[i-1]^1;

        else{

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

                vec[i]=vec[i-1]^1;

            for(int i=x-1;i>=1;i--)

                vec[i]=vec[i+1]^1;

            vec[y]=2;

        }

    }

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

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

}

signed main() { 

    ios::sync_with_stdio(false);

    cin.tie(0);

    cout.tie(0);

    int t=1;

    cin>>t;

    while(t--){

        help();

        // cout<<help()<<"\n";

    }

    return 0;

}

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

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

#define x first

#define y second

using namespace std;

#define int long long

typedef pair<int, int> PII;

typedef long long LL;

const int N = 2e5+10;

const int mod = 998244353;

const int p = 1e9 + 7;

int a[N];

void solve(){

   int n, x, y;

	cin >> n >> x >> y;

	a[x] = 1, a[y] = 0;

	int t1 = abs(x-y)-1, t2 = n - 2 - t1;

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

	int st = x+1;

	

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

			a[st] = 0;

			a[st+1] = 1;

			st+=2;

		}

	if(t1%2)a[st] = 2;

		st = y+1;

		if(st > n)st-=n;

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

		a[st] = 1;

			a[st+1] = 0;

			st+=2;

			if(st > n)st-=n;

	}

	if(t2%2)a[st] = 2;

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

	cout <<endl;

}

signed main() {

    int t;

    cin >> t;

    while(t--){

        solve();

    }

    return 0;

}

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

#define x first

#define y second

using namespace std;

#define int long long

typedef pair<int, int> PII;

typedef long long LL;

const int N = 2e5+10;

const int mod = 998244353;

const int p = 1e9 + 7;

int a[N];

void solve(){

   int n, x, y;

	cin >> n >> x >> y;

	a[x] = 1, a[y] = 0;

	int t1 = abs(x-y)-1, t2 = n - 2 - t1;

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

	int st = x+1;

	

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

			a[st] = 0;

			a[st+1] = 1;

			st+=2;

		}

	if(t1%2)a[st] = 2;

		st = y+1;

		if(st > n)st-=n;

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

		if(st > n)st-=n;

		a[st] = 1;

		if(st+1 > n)st-=n;

			a[st+1] = 0;

			st+=2;	

	}

	if(st > n)st-=n;

	if(t2%2)a[st] = 2;

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

	cout <<endl;

}

signed main() {

    int t;

    cin >> t;

    while(t--){

        solve();

    }

    return 0;

}

Answer: 2
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);

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

    }

}

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

   

    if(x&1 && y&1){

        v[x-1]=0;

        v[y-1]=2;

    }else{

        v[x-1]=1;

        v[y-1]=2;

    }

    int i=x-2;

    while(i>=0){

        if(v[i+1]==0){

            v[i]=1;

        }else{

            v[i]=0;

        }

        i--;

    }

    i=x;

    while(i<y-1){

        if(v[i-1]==0){

            v[i]=1;

        }else{

            v[i]=0;

        }

        i++;

    }

    i=y;

    while(i<n){

        if(v[i-1]==0){

            v[i]=1;

        }else{

            v[i]=0;

        }

        i++;

    }

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

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

    }

    cout<<endl;

    

    

}

signed main()

{

    int tcs;

    cin >> tcs;

    while (tcs--)

    {

        solve();

    }

}

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

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

#define ll long long

#define hachimi cat

#define oukinkin milktea

#define bacon maozedong

#define my_son dengxiaoping

#define winnie xijinping

#define N 200005

using namespace std;



int n,x,y;

int a[N];

int main(){

	std::ios::sync_with_stdio(0);

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

	int T;cin>>T;

	while(T--){

		cin>>n>>x>>y;

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

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

		}

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

			a[x]=2;

		}

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

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

		}cout<<endl;

	}

	return 0;

}

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

#define ll long long

#define hachimi cat

#define oukinkin milktea

#define bacon maozedong

#define my_son dengxiaoping

#define winnie xijinping

#define N 200005

using namespace std;



int n;

ll a[305][305],b[305];

int main(){

	std::ios::sync_with_stdio(0);

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

	int T;cin>>T;

	while(T--){

		cin>>n;

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

			a[i][n+1]=1;b[i]=0;

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

				cin>>a[i][j];

			}

		}

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

			for(int j=n-1;j>=1;j--){

				a[i][j]+=a[i][j+1];

			}

		}

		priority_queue<int,vector<int>,greater<int> > q;

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

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

				if(a[i][j]==n-j+1){

					q.push(n-j+1);break;

				}

			}

		}

		//cout<<"ans=";

		int ans=0;

		while(!q.empty()){

			int x=q.top();q.pop();

			if(x>=ans){

				ans++;

			}

			cout<<x<<' ';

		}

		ans++;

		cout<<ans<<endl;

	}

	return 0;

}

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

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

using namespace std;

const int N=505;

int t,n,x,y;

int cha(int a,int b){

	if (a>b) swap(a,b);

	return min(b-a,a+n-b);

}

void solve(){

	cin>>n>>x>>y;

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

	int a=y-x,b=x+n-y;

	if (a>b) swap(a,b);

	if (a==1){

		if (n%2==1){

			for (int i=1;i<=n-1;i++) cout<<i%2<<" ";

			cout<<2<<" ";

		}

		else for (int i=1;i<=n-1;i++) cout<<i%2<<" ";

		cout<<'\n';

		return;

	}

	if (a%2!=b%2){

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

			if (i==x){

				cout<<2<<" ";

				continue;

			}

			t^=1;

			cout<<t<<" ";

		}

		cout<<'\n';

		return;

	}

	if (a%2==b%2){

		if (a%2==0){

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

				t^=1;

				if (i==x){

					cout<<2<<" ";

					continue;

				}

				cout<<t<<" ";

			}	

		}

		else for (int i=1;i<=n;i++) cout<<i%2<<" ";

		cout<<'\n';

		return;

	}

}

int main(){

	cin>>t;

	while (t--) solve();

	return 0;

}

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

using namespace std;

const int N=505;

int t,n,x,y;

void solve(){

	cin>>n>>x>>y;

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

	int a=y-x,b=x+n-y;

	if (a>b) swap(a,b);

	if (a==1){

		if (n%2==1){

			for (int i=1;i<=n-1;i++) cout<<i%2<<" ";

			cout<<2<<" ";

		}

		else for (int i=1;i<=n;i++) cout<<i%2<<" ";

		cout<<'\n';

		return;

	}

	if (a%2!=b%2){

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

			if (i==x){

				cout<<2<<" ";

				continue;

			}

			t^=1;

			cout<<t<<" ";

		}

		cout<<'\n';

		return;

	}

	if (a%2==b%2){

		if (a%2==0){

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

				if (i==x){

					cout<<2<<" ";

					continue;

				}

				cout<<i%2<<" ";

			}	

		}

		else for (int i=1;i<=n;i++) cout<<i%2<<" ";

		cout<<'\n';

		return;

	}

}

int main(){

	cin>>t;

	while (t--) solve();

	return 0;

}

Answer: 2
Problem: 2050B - Transfusion
Language: c++20 

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

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>



using namespace std;

using namespace __gnu_pbds;



template <class type1>

#define ll long long int

#define endl "\n"

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

using ordered_multiset = tree <type1, null_type, less_equal <type1>, rb_tree_tag, tree_order_statistics_node_update>;

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

#define yes cout << "Yes\n"

#define no cout << "No\n"



ll lcm(ll x, ll y)

{

    return (x * y) / __gcd(x, y);

}



int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    int t;

    cin>>t;

   while(t--)

    {



        ll n;

        cin>>n;

        ll odd=0,even=0,sum=0;

        ll oo,ee;

        vector<ll>v;

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

        {



            ll x;

            cin>>x;

            if((i+1)%2!=0)odd+=x;

            else even+=x;

            sum+=x;

            v.push_back(x);

        }

        oo=(n+1)/2;

        ee=n/2;

        ll k=sum/n;

        //cout<<even<<" "<<odd<<" "<<k*ee<<" "<<k*oo<<endl;

        if(sum%n!=0)no;

        else if((odd==k*oo) && (even==ee*k))yes;

        else no;





    }

    return 0;

}



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

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>



using namespace std;

using namespace __gnu_pbds;



template <class type1>

#define ll long long int

#define endl "\n"

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

using ordered_multiset = tree <type1, null_type, less_equal <type1>, rb_tree_tag, tree_order_statistics_node_update>;

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

#define yes cout << "Yes\n"

#define no cout << "No\n"



ll lcm(ll x, ll y)

{

    return (x * y) / __gcd(x, y);

}



int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    int t;

    cin>>t;

   while(t--)

    {

        int n;

        cin>>n;

        int odd=0,even=0,sum=0;

        int oo,ee;

        vector<int>v;

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

        {



            int x;

            cin>>x;

            if((i+1)%2!=0)odd+=x;

            else even+=x;

            sum+=x;

            v.push_back(x);

        }

        oo=(n+1)/2;

        ee=n/2;

        int k=sum/n;

        //cout<<even<<" "<<odd<<" "<<k*ee<<" "<<k*oo<<endl;

        if(sum%n!=0)no;

        else if((odd==k*oo) && (even==ee*k))yes;

        else no;





    }

    return 0;

}



Answer: 1