ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2049B - pspspsps
Language: c++23 

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

#define ll long long

#define MAXN 100001

using namespace std;

vector<int> spf(MAXN + 1, 1);



void sieve()

{

    spf[0] = 0;

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

        if (spf[i] == 1) { 

            for (int j = i; j <= MAXN; j += i) {

                if (spf[j]== 1)

                    spf[j] = i;

            }

        }

    }

}



map<int,int> getFactorization(int x)

{

    map<int,int> ret;

    while (x != 1) {

        ret[spf[x]]++;

        x = x / spf[x];

    }

    return ret;

}

void solve(){

    int n;

    cin>>n;

    string s;

    cin>>s;

    int f=0;

    int x=0;

    int z=0;

    int y=0;

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

        if(s[i]=='p'){

            f=1;

        }

        if(s[i]=='s'){

            x=1;

        }

        if(s[i]=='s'&&f==1){

            cout<<"NO"<<endl;

            return;

        }

    }

    if(x&&f){

        int a=1;

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

        if(s[i]=='p'&&i!=n-1){

            a=0;

            break;

        }

       }

       int b=1;

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

        if(s[i]=='s'&&i!=0){

            b=0;

            break;

        }

       }

       if(!(a||b)){

        cout<<"NO"<<endl;

        return;

       }

    }

    cout<<"YES"<<endl;



}

int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    int t;

    cin>>t;

   while(t--){

      solve();

   }

    return 0;

}

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

#define ll long long

#define MAXN 100001

using namespace std;

vector<int> spf(MAXN + 1, 1);



void sieve()

{

    spf[0] = 0;

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

        if (spf[i] == 1) { 

            for (int j = i; j <= MAXN; j += i) {

                if (spf[j]== 1)

                    spf[j] = i;

            }

        }

    }

}



map<int,int> getFactorization(int x)

{

    map<int,int> ret;

    while (x != 1) {

        ret[spf[x]]++;

        x = x / spf[x];

    }

    return ret;

}

void solve(){

    int n;

    cin>>n;

    string s;

    cin>>s;

    int f=0;

    int x=0;

    int z=0;

    int y=0;

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

        if(s[i]=='p'){

            f=1;

        }

        if(s[i]=='.'&&f==1){

            x=1;

        }

        if(s[i]=='.'){

            y=1;

        }

        if(s[i]=='s'&&y==1){

            z=1;

        }

        if(s[i]=='s'&&f==1){

            cout<<"NO"<<endl;

            return;

        }

    }

    if(x&&z){

        cout<<"NO"<<endl;

        return;

    }

    cout<<"YES"<<endl;



}

int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    int t;

    cin>>t;

   while(t--){

      solve();

   }

    return 0;

}

Answer: 1
Problem: 2049B - pspspsps
Language: c++17 

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

using namespace std;





   void solve(){

      int n;

      cin>>n;

      string s;

      cin>>s;

      int pp=0;

      int ss=0;

      

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

         if(s[i]=='p'){

            pp++;

         }else if(s[i]=='s'){

            ss++;



        

        

      }

   }

     

      if(ss==0||pp==0){

         cout<<"YES"<<endl;

         return ;

      }

      int s1=0;

      int p1=-1;

      int idx=0;

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

         if(s[i]=='s'){

            s1=idx;

         }

         if(s[i]=='p'){

            if(p1==-1){

               p1=idx;

            }

         }

         idx++;

      }

      if(s1==0||p1==n-1){

         cout<<"YES"<<endl;

         return;

      }





        

      cout<<"NO"<<endl;

   }





   int main(){

   int t;

   cin>>t;



   while(t--){

      solve();



   }



return 0;

}

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

using namespace std;





   void solve(){

      int n;

      cin>>n;

      string s;

      cin>>s;

      int pp=0;

      int ss=0;

      int dot=0;

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

         if(s[i]=='p'){

            pp++;

         }else if(s[i]=='s'){

            ss++;



         }else{

            dot++;

         }

        

      }

      // cout<<pp<<endl;

      if(ss+dot==n||pp+dot==n||dot==n){

         cout<<"YES"<<endl;

         return ;

      }

        bool flag=false;

        int cnt=0;

        int cnt2=0;

        bool s1=false;

        bool s2=false;

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

         if(s[i]=='s' &&cnt==0){

            cnt++;

            flag=true;

            s1=true;

         }

         if(flag==true&&s[i]=='p'){

            cnt++;

            s2=true;

         }

         if(s[i]=='.'&&s1){

            cnt++;

         }





      }

      bool found=true;

           bool p1=false;

           bool p2=false;

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

         if(s[i]=='s' ){

            cnt2++;

            p1=true;

         }

         if(s[i]=='p'&&found==true){

            cnt2++;

            found=false;

            p2=true;

         }

         if(p1==true&&p2==false&&s[i]=='.'){

            cnt2++;

         }

      }

      if(cnt==n||cnt2==n){

         cout<<"YES"<<endl;

         return ;

      }

      cout<<"NO"<<endl;

   }



   int main(){

   int t;

   cin>>t;



   while(t--){

      solve();



   }



return 0;

}

Answer: 1
Problem: 2049B - pspspsps
Language: c++20 

Code 1:
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
string s;
cin>>s;
map<char,int>be,af;
int i=0;
while(i<n && s[i]!='p'){
    be[s[i]]++;
    i++;
}
if(i==n){
    cout<<"YES"<<endl;
}
else if(be['s']>0 && i==n-1){
    cout<<"YES"<<endl;
}
else if(be['s']>0 && i>1 && i<n-1){
    cout<<"NO"<<endl;
}
else{
    int p=i;
    while(i<n){
        af[s[i]]++;
        i++;
    }
    if(be['s']==0 && af['s']==0){
        cout<<"YES"<<endl;
    }
    else if(af['s']>0){
        cout<<"NO"<<endl;
    }
    else{
        cout<<"YES"<<endl;
    }
}
}
return 0;
}

Code 2:
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
string s;
cin>>s;
if(s[0]=='s')s[0]='.';
if(s[n-1]=='p')s[n-1]='.';
bool x=false,y=false;
int i=0;
while(i<n){
    if(s[i]=='s') x=true;
    else if(s[i]=='p') y=true;
    i++;
}
if(x==true && y==true){
    cout<<"NO"<<endl;
}
else{
    cout<<"YES"<<endl;
}
}
}

Answer: 2
Problem: 2049B - pspspsps
Language: c++23 

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



#define endl "\n"



// #define int long long



using namespace std;



using i64 = long long;

using u64 = unsigned long long;



constexpr int N = 2e5 + 1;

constexpr int P = 131;

constexpr int INF = 1e9;



void solve() {

    int n;

    cin >> n;

    string s;

    cin >> s;

    s = " " + s;

    int r = INF;

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

        if (s[i] == 'p') {

            r = i;

            break;

        }

    }

    bool ok = true;

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

        if (s[i] == 's') {

            if (n > r) {

                ok = false;

                break;

            }

        }

    }

    if (ok) {

        cout << "YES\n";

    } else {

        cout << "NO\n";

    }

}



signed main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    cout.tie(nullptr);

    int T;

    cin >> T;

    while (T--) {

        solve();

    }

}





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



#define endl "\n"



// #define int long long



using namespace std;



using i64 = long long;

using u64 = unsigned long long;



constexpr int N = 2e5 + 1;

constexpr int P = 131;

constexpr int INF = 1e9;



void solve() {

    int n;

    cin >> n;

    string s;

    cin >> s;

    s = " " + s;

    int mnp = INF, mxs = 0;

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

        if (s[i] == 'p') {

            mnp = min(mnp, i);

        } else {

            mxs = max(mxs, i);

        }

    }

    if (mnp < mxs) {

        cout << "NO\n";

    } else {

        cout << "YES\n";

    }

}



signed main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    cout.tie(nullptr);

    int T;

    cin >> T;

    while (T--) {

        solve();

    }

}





Answer: 1
Problem: 2049B - pspspsps
Language: c++20 

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

#define int long long //二维数组可能会爆

#define pll pair<int,int>

#define INF 0x3f3f3f3f3f3f3f3f

using namespace std;  

#define IOS ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);

const int N=1e6+7;

const int mod=1e9+7;

void solve(){

    int n;

    cin>>n;

    string s;

    cin>>s;

    bool ok=1;

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

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

    	{

    		if(s[i]=='p' && s[j]=='s' )

    		{

    			if(!(i==n-1 || j==0))ok=0;

    		}

    	}

    if(ok)

    {

    	cout<<"YES"<<endl;

    }

    else cout<<"NO"<<endl;

    return ;

}

signed main (){

    IOS;

    int _;

    cin>>_;

    while(_--){

        solve();

    }

    return 0;

}

/*



*/

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

#define int long long //二维数组可能会爆

#define pll pair<int,int>

#define INF 0x3f3f3f3f3f3f3f3f

using namespace std;  

#define IOS ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);

const int N=1e6+7;

const int mod=1e9+7;

void solve(){

    int n;

    cin>>n;

    string s;

    cin>>s;

    bool ok=0;

    int cnts=0,cntp=0,cntd=0;

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

    {

        if(s[i]=='s')cnts++;

        else if(s[i]=='p')cntp++;

        else cntd++;

    }

    if(s[0]=='s')

    {

    	int idxp=0,idxs=0;

    	for(int i=1;i<s.size();i++)

    	{

            if(s[i]=='s')idxs=i;

            if(s[i]=='p' && idxp==0)idxp=i;

    	}

    	if(idxs<idxp)ok=1;

    }

    if(cnts*cntp==0 || ok)

    {

    	cout<<"YES"<<endl;

    }

    else cout<<"NO"<<endl;

    return ;

}

signed main (){

    IOS;

    int _;

    cin>>_;

    while(_--){

        solve();

    }

    return 0;

}

/*



*/

Answer: 1
Problem: 2049B - pspspsps
Language: c++23 

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

using namespace std;



#define fastIO()                              \

    do {                                      \

        ios::sync_with_stdio(false);         \

        cin.tie(NULL);                        \

        cout.tie(NULL);                       \

    } while (0)



void solve() {

    int n;

    cin >> n;

    string s;

    cin >> s;

    map<char,int> m;

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

        m[s[i]]++;

    }

    if(s[0]=='s'){

        m['s']--;

        m['.']++;

    }



    if(s[n-1]=='p'){

        m['p']--;

        m['.']++;

    }



    if(m['s']+m['.']==n || m['p']+m['.']==n ) cout << "YES" << endl;

    else cout << "NO" << endl;



}



int main() {

    fastIO();

    int tc;

    cin >> tc;

    while (tc--) {

        solve();

    }

    return 0;

}



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

using namespace std;



#define fastIO()                              \

    do {                                      \

        ios::sync_with_stdio(false);         \

        cin.tie(NULL);                        \

        cout.tie(NULL);                       \

    } while (0)



void solve() {

    int n;

    cin >> n;

    string s;

    cin >> s;

    if(s[0]=='s' || s[n-1]=='p'){

        cout << "YES" << endl;

        return;

    }

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

        if(s[i]!='.'){

            cout << "NO" << endl;

            return;

        }

    }

    cout << "YES" << endl;

}



int main() {

    fastIO();

    int tc;

    cin >> tc;

    while (tc--) {

        solve();

    }

    return 0;

}



Answer: 1
Problem: 2049B - pspspsps
Language: c++23 

Code 1:
#include <iostream>

#include <vector>

#include <string>

#include <set>

#include <math.h>

#include <cmath>

#include <map>

#include <algorithm>

#include <iterator>

#include <queue>

#include <queue>

#include <stack>

#include <deque>

#include <unordered_map>

#include <unordered_set>

#include <iomanip>



using namespace std;



#pragma GCC target("avx2")



using ll = long long;

using ii = pair<int, int>;

using vi = int;

using vl = vector<ll>;

using pll = pair<ll, ll>;

using dd = pair<double, double>;

using db = double;



#define int long long

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

#define X first

#define Y second

#define endl "\n"

#define mod 998244353



void solve() {

    int n;

    cin>>n;

    string s;

    cin>>s;

    vector<int> a,b;

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

        if (s[i]=='s')

            a.push_back(i);

        else if (s[i]=='p')

            b.push_back(i);

    }

    if (min(a.size(),b.size())==0){

        cout<<"YES"<<endl;

        return;

    }else{

        if (min(a.size(),b.size())>1){

            cout<<"NO"<<endl;

        }else{

            if (a.size()==1 and a[0]==0 or b.size()==1 and b.back()==n-1)

                cout<<"YES"<<endl;

            else{

                cout<<"NO"<<endl;

            }

        }

    }

}



signed main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    ll tt = 1;

    cin >> tt;

    while (tt--)

        solve();

}

Code 2:
#include <iostream>

#include <vector>

#include <string>

#include <set>

#include <math.h>

#include <cmath>

#include <map>

#include <algorithm>

#include <iterator>

#include <queue>

#include <queue>

#include <stack>

#include <deque>

#include <unordered_map>

#include <unordered_set>

#include <iomanip>



using namespace std;



#pragma GCC target("avx2")



using ll = long long;

using ii = pair<int, int>;

using vi = int;

using vl = vector<ll>;

using pll = pair<ll, ll>;

using dd = pair<double, double>;

using db = double;



#define int long long

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

#define X first

#define Y second

#define endl "\n"

#define mod 998244353



void solve() {

    int n;

    cin>>n;

    string s;

    cin>>s;

    vector<int> a={-1},b;

    cin>>s;

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

        if (s[i]=='s')

            a.push_back(i);

        else if (s[i]=='b')

            b.push_back(i);

    }

    b.push_back(n+1);

    if (a.back()<b[0]){

        cout<<"YES"<<endl;

    }else{

        cout<<"NO"<<endl;

    }

}



signed main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    ll tt = 1;

    cin >> tt;

    while (tt--)

        solve();

}

Answer: 1
Problem: 2049B - pspspsps
Language: c++17 

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

using namespace std;

#define ll long long

#define pb push_back

#define int long long

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

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

#define mp make_pair

const int N=1e7+10;

const int M=1e5+10;

//int pf[N];

long long binpow(long long a, long long b) {

    if(b==0)

        return 1;

    long long res = binpow(a,b/2);

    if(b%2)

        return res*res*a;

    else

        return res*res;

}

int mex(vector<int> &arr, int N){

    sort(arr.begin(), arr.end());

    int mex = 0;

    for (int idx = 0; idx < N; idx++){

        if (arr[idx] == mex){

            mex += 1;

        }

    }

    return mex;

}

signed main()

{

    ios::sync_with_stdio(false);

    cin.tie(0);

    int t;

    cin>>t;

    while(t--)

    {

        int n;cin>>n;

        string s;cin>>s;

        if(s[0]=='s') s[0]='.';

        if(s[n-1]=='p') s[n-1]='.';

        int flagp=0,flags=0;

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

            if(s[i]=='p') flagp=1;

            if(s[i]=='s') flags=1;

        }

        if(flagp && flags) cout<<"NO"<<endl;

        else cout<<"YES"<<endl;

    }

    return 0;

}



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

using namespace std;

#define ll long long

#define pb push_back

#define int long long

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

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

#define mp make_pair

const int N=1e7+10;

const int M=1e5+10;

//int pf[N];

long long binpow(long long a, long long b) {

    if(b==0)

        return 1;

    long long res = binpow(a,b/2);

    if(b%2)

        return res*res*a;

    else

        return res*res;

}

int mex(vector<int> &arr, int N){

    sort(arr.begin(), arr.end());

    int mex = 0;

    for (int idx = 0; idx < N; idx++){

        if (arr[idx] == mex){

            mex += 1;

        }

    }

    return mex;

}

signed main()

{

    ios::sync_with_stdio(false);

    cin.tie(0);

    int t;

    cin>>t;

    while(t--)

    {

        int n;cin>>n;

        string s;cin>>s;

        int flag=0,fllag=0;

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

            if(s[i]=='p') flag=1;

            if(flag){

                if(s[i]=='s'){

                    fllag=1;break;

                }

            }

        }

        int presp=0,press=0;

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

            if(s[i]=='p') presp=1;

            else if(s[i]=='s') press=1;

        }

        if(fllag) cout<<"NO"<<endl;

        else if((press==1 && presp==1) && (s[0]=='.' && s[n-1]=='.')) cout<<"NO"<<endl;

        else cout<<"YES"<<endl;

    }

    return 0;

}



Answer: 1
Problem: 2049B - pspspsps
Language: c++23 

Code 1:
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pll pair<ll, ll>
#define vll vector<ll>
#define vii vector<int>
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define isON(n, k) (((n) >> (k)) & 1)
#define f(i, a, b) for (ll i = a; i < b; i++)
#define fb(i, a, b) for (ll i = a; i > b; i--)
#define ff first
#define ss second
#define PI 3.141592653589793238
// int dx[8] = { 1, 0, -1, 0, -1, 1, -1, 1 };
// int dy[8] = { 0, 1, 0, -1, -1, 1, 1, -1 };
using namespace std;
const int N = 2e5 + 5;
const ll MOD = 1e9 + 7;
ll t = 1;

void solve()
{
    ll n;
    cin >> n;
    string s;
    cin >> s;
    // Check if the string contains 's' or 'p'
    if (s.find('s') == string::npos && s.find('p') == string::npos)
    {
        cout << "YES\n";
        return;
    }
    if (s[0] == 's') s[0] = '.';
    if (s.back() == 'p') s.back() = '.';
    bool fp = false, fs = false;
    f(i, 0, n)
    {
        switch (s[i])
        {
        case 's':
            fs = true;
            break;
        case 'p':
            fp = true;
            break;
        }
    }
    cout << (fs && fp ? "NO\n" : "YES\n");

    return;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> t;
    while (t--)
    {
        solve();
    }

    return 0;
}

Code 2:
#include <bits/stdc++.h>
#define ll long long int
#define ld long double
#define mk make_pair
#define pb push_back
#define INF (ll)1e18
#define pll pair<ll, ll>
#define vll vector<ll>
#define vii vector<int>
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define isON(n, k) (((n) >> (k)) & 1)
#define f(i, a, b) for (ll i = a; i < b; i++)
#define fb(i, a, b) for (ll i = a; i > b; i--)
#define ff first
#define ss second
#define PI 3.141592653589793238
// int dx[8] = { 1, 0, -1, 0, -1, 1, -1, 1 };
// int dy[8] = { 0, 1, 0, -1, -1, 1, 1, -1 };
using namespace std;
const int N = 2e5 + 5;
const ll MOD = 1e9 + 7;
ll t = 1;

void solve()
{
    ll n;
    cin >> n;
    string s;
    cin >> s;
    ll count_p = count(s.begin(), s.end(), 'p');
    ll count_s = count(s.begin(), s.end(), 's');
    if (count_p == 0 || count_s == 0){
        cout << "YES\n";
    }
    else {
        if (s[0] == 's' || s[n - 1] == 'p'){
            cout << "YES\n";
        }
        else {
            cout << "NO\n";
        }
    }
    return;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin >> t;
    while (t--)
    {
        solve();
    }

    return 0;
}

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

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

//#include <atcoder/all>

using namespace std;

//using namespace atcoder;

//using mint = modint998244353;

//long long型=int64_tという認識で大丈夫です。

#define ll long long

#define ull unsigned long long

#define vec vector

#define vi vector<int>

#define vll vector<ll>

#define pq priority_queue

#define pb push_back

#define rep(i, l, r) for(int i=(int)(l); i<(int)(r); i++)

#define ld long double



const ll INF = 1e9;

const ll inf = 9e18;



struct Edge {

    int to;

    ll cost;

};



struct SEdge {

    int to;

    pair<ll, ll> cost;

};



template<class T>

using spq = priority_queue<T, vec<T>, greater<T>>; 



const vector<int> di = {-1, 0, 1, 1, 0, -1}, dj = {0, 1, 1, 0, -1, -1};



template<class T>

bool chmin(T& a, T b) {

    if (a > b) {

        a = b;

        return true;

    }

    return false;

}



template<class T>

bool chmax(T& a, T b) {

    if(a < b) {

        a = b;

        return true;

    }

    return false;

}



using S = ll;



S op(S a, S b) {return a + b;}

S e() {return 0;}



int main() {

    int t; cin >> t;

    rep(i, 0, t) {

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

        vi ans(n, 0);

        rep(j, 0, n) {

            ans[j] = j % 2;

        }

        if(n % 2 == 1) ans[n - 1] = 2;

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

            ans[max(x, y)] = 2;

            if(y == n - 3 && ans[n - 1] == 2) {ans[n - 2] = 0; ans[n - 1] = 1;}

        }

        rep(j, 0, n) cout << ans[j] << " ";

        cout << endl;

    }

}



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

//#include <atcoder/all>

using namespace std;

//using namespace atcoder;

//using mint = modint998244353;

//long long型=int64_tという認識で大丈夫です。

#define ll long long

#define ull unsigned long long

#define vec vector

#define vi vector<int>

#define vll vector<ll>

#define pq priority_queue

#define pb push_back

#define rep(i, l, r) for(int i=(int)(l); i<(int)(r); i++)

#define ld long double



const ll INF = 1e9;

const ll inf = 9e18;



struct Edge {

    int to;

    ll cost;

};



struct SEdge {

    int to;

    pair<ll, ll> cost;

};



template<class T>

using spq = priority_queue<T, vec<T>, greater<T>>; 



const vector<int> di = {-1, 0, 1, 1, 0, -1}, dj = {0, 1, 1, 0, -1, -1};



template<class T>

bool chmin(T& a, T b) {

    if (a > b) {

        a = b;

        return true;

    }

    return false;

}



template<class T>

bool chmax(T& a, T b) {

    if(a < b) {

        a = b;

        return true;

    }

    return false;

}



using S = ll;



S op(S a, S b) {return a + b;}

S e() {return 0;}



int main() {

    int t; cin >> t;

    rep(i, 0, t) {

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

        vi ans(n, 0);

        rep(j, 0, n) {

            ans[j] = j % 2;

        }

        if(n % 2 == 1) ans[n - 1] = 2;

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

            ans[max(x, y)] = 2;

            if(y == n - 2 && ans[n - 1] == 2) {ans[n - 1] = 1;}

            if(y == n - 3 && ans[n - 1] == 2) {ans[n - 2] = 0; ans[n - 1] = 1;}

        }

        rep(j, 0, n) cout << ans[j] << " ";

        cout << endl;

    }

}



Answer: 2