ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2049B - pspspsps
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
// include

#include<bits/stdc++.h>



using namespace std;



// define

#define fi    first

#define se    second



#define pub   push_back

#define pob   pop_back

#define puf   push_front

#define pof   pop_front

#define eb    emplace_back

#define upb   upper_bound

#define lwb   lower_bound



#define left  VAN

#define right TAN



#define sz(a)               (int)a.size()

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

#define rall(a)             (a).begin(),(a).end()

#define sort_and_unique(a)  sort(all(a));(a).resize(unique(all(a))-a.begin())

#define max_                max_element

#define min_                min_element



// another define

using ll  = long long;

using ld  = long double;

using pii = pair<int, int>;

using pil = pair<int, ll>;

using pli = pair<ll, int>;

using pll = pair<ll, ll>;

using mii = map<int, int>;

using mil = map<int, ll>;

using mli = map<ll, int>;

using mll = map<ll, ll>;

using vi  = vector<int>;

using vl  = vector<ll>;

using vvi = vector<vi>;

using vvl = vector<vl>;



// random

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());



// templates

template<class X, class Y>

    bool maximize(X &x, const Y &y) {

        if (y > x) {

            x = y;

            return (true);

        } else return (false);

    }



template<class X, class Y>

    bool minimize(X &x, const Y &y) {

        if (y < x) {

            x = y;

            return (true);

        } else return (false);

    }



template<class T>

    void print(const T &a, const int &l, const int &r) {

        for (int i = l; i <= r; i++)

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

        cout << '\n';

    }



// limit

const int oo = 2e9;



// function

void yesno(bool x) {

    cout << (x ? "YES\n" : "NO\n");

}



void solve() {

    int n;

    string str;

    cin >> n >> str;

    int p = -1, s = -1;

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

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

            s = i;

        } else if (str[i] == 'p') {

            if (p == -1) {

                p = i;

            }

        }

    }

    if (s == -1 || p == -1) {

        yesno(1);

    } else {

        if (s > p) {

            yesno(0);

        } else {

            int a = 0;

            int b = 0;

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

                a |= (str[i] == '.');

            for (int i = n - 1; i > p; i--)

                b |= (str[i] == '.');

            yesno(!(a & b));

        }

    }

}



int main() {

    ios_base::sync_with_stdio(false);

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

    int t = 1;

    cin >> t;



    while (t--) solve();

    return 0;

}
Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 3):
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int n , m; 
    cin >> n >> m;
    vector<int> a(n + 1) , b( m + 1 );
    map<int,int> mp1 , mp2;
    for( int i = 1 ; i <= n ; i++ ) cin >> a[i] , mp1[a[i]]++;
    for( int i = 1 ; i <= m ; i++ ) cin >> b[i] , mp2[b[i]]++;
    for( int i = 1 ; i <= n ; i++ )
    {
        if( mp2[a[i]] )
        {
            mp2[a[i]]--;
            mp1[a[i]]--;
        }
    }
    priority_queue<int , vector<int> , greater<int>> heap;
    for(auto e : mp1 )
    {
        int cnt = e.second;
        for( int i = 0 ; i < cnt ; i++ ) heap.push(e.first);
    }
    while( heap.size() > 1 )
    {
        int temp1 = heap.top(); heap.pop();
        int temp2 = heap.top(); heap.pop();
        if( abs(temp1 - temp2 ) <= 1 && mp2[temp1 + temp2] ) 
        {
            mp2[ temp1 + temp2 ]--;
            continue;
        }
        else if( abs(temp1 - temp2 ) <= 1 ) heap.push( temp1 + temp2 );
        else 
        {
            puts("No"); return;
        }
    }
    if( heap.size() == 0 ) 
    {
        for( auto e : mp2 )
        {
            if( e.second )
            {
                puts("No"); return;
            }
        }
        puts("Yes");
    }
    else puts("No");
}
signed main()
{
    int tt; cin >> tt;
    while(tt--)solve();
    return 0;
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int n, m;
    cin >> n >> m;
    vector<int> a(n + 1), b(m + 1);
    priority_queue<int> heap1, heap2;
    for (int i = 0; i < n; i++)
    {
        int x; cin >> x;
        heap1.push(x);
    }
    for (int i = 0; i < m; i++)
    {
        int x; cin >> x;
        heap2.push(x);
    }
    while (heap1.size())
    {
        if (!heap2.size() || heap2.size() > heap1.size())
        {
            puts("No"); return;
        }
        int temp = heap2.top(); heap2.pop();
        if (heap1.top() == temp)
        {
            heap1.pop();
            continue;
        }
        else if (heap1.top() > temp)
        {
            puts("No"); return;
        }
        else
        {
            heap2.push(temp / 2);
            heap2.push((temp + 1) / 2);
        }
    }
    if (heap1.size() == 0 && heap2.size() == 0)puts("Yes");
    else puts("No");
}
signed main()
{
    int tt; cin >> tt;
    while (tt--)solve();
    return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int n , m; 
    cin >> n >> m;
    vector<int> a(n + 1) , b( m + 1 );
    map<int,int> mp1 , mp2;
    for( int i = 1 ; i <= n ; i++ ) cin >> a[i] , mp1[a[i]]++;
    for( int i = 1 ; i <= m ; i++ ) cin >> b[i] , mp2[b[i]]++;
    for( int i = 1 ; i <= n ; i++ )
    {
        if( mp2[a[i]] )
        {
            mp2[a[i]]--;
            mp1[a[i]]--;
        }
    }
    priority_queue<int , vector<int> , greater<int>> heap;
    for(auto e : mp1 )
    {
        int cnt = e.second;
        for( int i = 0 ; i < cnt ; i++ ) heap.push(e.first);
    }
    while( heap.size() > 1 )
    {
        int temp1 = heap.top(); heap.pop();
        int temp2 = heap.top(); heap.pop();
        if( abs(temp1 - temp2 ) <= 1 && mp2[temp1 + temp2] ) continue;
        else if( abs(temp1 - temp2 ) <= 1 ) heap.push( temp1 + temp2 );
        else 
        {
            puts("No"); return;
        }
    }
    if( heap.size() == 0 ) puts("Yes");
    else puts("No");
}
signed main()
{
    int tt; cin >> tt;
    while(tt--)solve();
    return 0;
}

Submission (verdict: Wrong answer on test 3):
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int n , m; 
    cin >> n >> m;
    vector<int> a(n + 1) , b( m + 1 );
    map<int,int> mp1 , mp2;
    for( int i = 1 ; i <= n ; i++ ) cin >> a[i] , mp1[a[i]]++;
    for( int i = 1 ; i <= m ; i++ ) cin >> b[i] , mp2[b[i]]++;
    for( int i = 1 ; i <= n ; i++ )
    {
        if( mp2[a[i]] )
        {
            mp2[a[i]]--;
            mp1[a[i]]--;
        }
    }
    priority_queue<int , vector<int> , greater<int>> heap;
    for(auto e : mp1 )
    {
        int cnt = e.second;
        for( int i = 0 ; i < cnt ; i++ ) heap.push(e.first);
    }
    while( heap.size() > 1 )
    {
        int temp1 = heap.top(); heap.pop();
        int temp2 = heap.top(); heap.pop();
        if( abs(temp1 - temp2 ) <= 1 && mp2[temp1 + temp2] ) 
        {
            mp2[ temp1 + temp2 ]--;
            continue;
        }
        else if( abs(temp1 - temp2 ) <= 1 ) heap.push( temp1 + temp2 );
        else 
        {
            puts("No"); return;
        }
    }
    if( heap.size() == 0 ) 
    {
        for( auto e : mp2 )
        {
            if( e.second )
            {
                puts("No"); return;
            }
        }
        puts("Yes");
    }
    else puts("No");
}
signed main()
{
    int tt; cin >> tt;
    while(tt--)solve();
    return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int n , m; 
    cin >> n >> m;
    vector<int> a(n + 1) , b( m + 1 );
    map<int,int> mp1 , mp2;
    for( int i = 1 ; i <= n ; i++ ) cin >> a[i] , mp1[a[i]]++;
    for( int i = 1 ; i <= m ; i++ ) cin >> b[i] , mp2[b[i]]++;
    for( int i = 1 ; i <= n ; i++ )
    {
        if( mp2[a[i]] )
        {
            mp2[a[i]]--;
            mp1[a[i]]--;
        }
    }
    priority_queue<int , vector<int> , greater<int>> heap;
    for(auto e : mp1 )
    {
        int cnt = e.second;
        for( int i = 0 ; i < cnt ; i++ ) heap.push(e.first);
    }
    while( heap.size() > 1 )
    {
        int temp1 = heap.top(); heap.pop();
        int temp2 = heap.top(); heap.pop();
        if( abs(temp1 - temp2 ) <= 1 && mp2[temp1 + temp2] ) continue;
        else if( abs(temp1 - temp2 ) <= 1 ) heap.push( temp1 + temp2 );
        else 
        {
            puts("No"); return;
        }
    }
    if( heap.size() == 0 ) puts("Yes");
    else puts("No");
}
signed main()
{
    int tt; cin >> tt;
    while(tt--)solve();
    return 0;
}
Problem: 2050E - Three Strings
Language: C++20 (GCC 13-64)

Previous submission (verdict: Memory limit exceeded on test 1):
#include<bits/stdc++.h>
using namespace std;
#define int long long
int dp[500][500][500];
int f(int i,int j,int k,string a,string b,string c){
    int n=c.length();
    if(k==n) return 0;
    //if(i==a.length()&&j==b.length()) return 0;
    if(dp[i][j][k]!=-1) return dp[i][j][k];
    int ta=2002,tb=2002;
    if(a[i]==c[k]) ta=f(i+1,j,k+1,a,b,c);
    else ta=1+f(i+1,j,k+1,a,b,c);
    if(b[j]==c[k]) tb=f(i,j+1,k+1,a,b,c);
    else tb=1+f(i,j+1,k+1,a,b,c);
    return dp[i][j][k]=min(ta,tb);
}
signed main(){
    int t; cin>>t;
    string a,b,c;
    while(t--&&cin>>a>>b>>c){
        int al=a.length(),bl=b.length(),cl=c.length();
        for(int i=0;i<=al;i++){
            for(int j=0;j<=bl;j++){
                for(int k=0;k<=cl;k++){
                    dp[i][j][k]=-1;
                }
            }
        }
        cout<<f(0,0,0,a,b,c)<<'\n';
    }
}






Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define int long long
int dp[100][100][100];
int f(int i,int j,int k,string a,string b,string c){
    int n=c.length();
    if(k==n) return 0;
    //if(i==a.length()&&j==b.length()) return 0;
    if(dp[i][j][k]!=-1) return dp[i][j][k];
    int ta=2002,tb=2002;
    if(a[i]==c[k]) ta=f(i+1,j,k+1,a,b,c);
    else ta=1+f(i+1,j,k+1,a,b,c);
    if(b[j]==c[k]) tb=f(i,j+1,k+1,a,b,c);
    else tb=1+f(i,j+1,k+1,a,b,c);
    return dp[i][j][k]=min(ta,tb);
}
signed main(){
    int t; cin>>t;
    string a,b,c;
    while(t--&&cin>>a>>b>>c){
        int al=a.length(),bl=b.length(),cl=c.length();
        for(int i=0;i<=al;i++){
            for(int j=0;j<=bl;j++){
                for(int k=0;k<=cl;k++){
                    dp[i][j][k]=-1;
                }
            }
        }
        cout<<f(0,0,0,a,b,c)<<'\n';
    }
}
Problem: 2050E - Three Strings
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define int long long
int dp[1000][1000];
int f(int i,int j,int k,string a,string b,string c){
    int n=c.length();
    if(k==n) return 0;
    //if(i==a.length()&&j==b.length()) return 0;
    if(dp[i][j]!=-1) return dp[i][j];
    int ta=2002,tb=2002;
    if(a[i]==c[k]) ta=f(i+1,j,k+1,a,b,c);
    else ta=1+f(i+1,j,k+1,a,b,c);
    if(b[j]==c[k]) tb=f(i,j+1,k+1,a,b,c);
    else tb=1+f(i,j+1,k+1,a,b,c);
    return dp[i][j]=min(ta,tb);
}
signed main(){
    int t; cin>>t;
    string a,b,c;
    while(t--&&cin>>a>>b>>c){
        int al=a.length(),bl=b.length(),cl=c.length();
        for(int i=0;i<=al;i++){
            for(int j=0;j<=bl;j++){
                dp[i][j]=-1;
            }
        }
        cout<<f(0,0,0,a,b,c)<<'\n';
    }
}



Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
#define int long long
int dp[1001][1001];
int n,m;
string a,b,c;
int f(int i,int j){
    if(i==n&&j==m) return 0;
    if(dp[i][j]!=-1) return dp[i][j];
    int k=i+j;
    dp[i][j]=INT_MAX;
    int ta=2002,tb=2002;
    if(i<n) ta=(a[i]!=c[k])+f(i+1,j);
    if(j<m) tb=(b[j]!=c[k])+f(i,j+1);
    return dp[i][j]=min(ta,tb);
}
signed main(){
    int t; cin>>t;
    while(t--&&cin>>a>>b>>c){
        n=a.length(),m=b.length();
        for(int i=0;i<=n;i++) for(int j=0;j<=m;j++) dp[i][j]=-1;
        cout<<f(0,0)<<'\n';
    }
}
Problem: 2050E - Three Strings
Language: C++20 (GCC 13-64)


Submission (verdict: Memory limit exceeded on test 1):
#include<bits/stdc++.h>
using namespace std;
#define int long long
int dp[500][500][500];
int f(int i,int j,int k,string a,string b,string c){
    int n=c.length();
    if(k==n) return 0;
    //if(i==a.length()&&j==b.length()) return 0;
    if(dp[i][j][k]!=-1) return dp[i][j][k];
    int ta=2002,tb=2002;
    if(a[i]==c[k]) ta=f(i+1,j,k+1,a,b,c);
    else ta=1+f(i+1,j,k+1,a,b,c);
    if(b[j]==c[k]) tb=f(i,j+1,k+1,a,b,c);
    else tb=1+f(i,j+1,k+1,a,b,c);
    return dp[i][j][k]=min(ta,tb);
}
signed main(){
    int t; cin>>t;
    string a,b,c;
    while(t--&&cin>>a>>b>>c){
        int al=a.length(),bl=b.length(),cl=c.length();
        for(int i=0;i<=al;i++){
            for(int j=0;j<=bl;j++){
                for(int k=0;k<=cl;k++){
                    dp[i][j][k]=-1;
                }
            }
        }
        cout<<f(0,0,0,a,b,c)<<'\n';
    }
}
Problem: 2050E - Three Strings
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define int long long
int dp[100][100][100];
int f(int i,int j,int k,string a,string b,string c){
    int n=c.length();
    if(k==n) return 0;
    //if(i==a.length()&&j==b.length()) return 0;
    if(dp[i][j][k]!=-1) return dp[i][j][k];
    int ta=2002,tb=2002;
    if(a[i]==c[k]) ta=f(i+1,j,k+1,a,b,c);
    else ta=1+f(i+1,j,k+1,a,b,c);
    if(b[j]==c[k]) tb=f(i,j+1,k+1,a,b,c);
    else tb=1+f(i,j+1,k+1,a,b,c);
    return dp[i][j][k]=min(ta,tb);
}
signed main(){
    int t; cin>>t;
    string a,b,c;
    while(t--&&cin>>a>>b>>c){
        int al=a.length(),bl=b.length(),cl=c.length();
        for(int i=0;i<=al;i++){
            for(int j=0;j<=bl;j++){
                for(int k=0;k<=cl;k++){
                    dp[i][j][k]=-1;
                }
            }
        }
        cout<<f(0,0,0,a,b,c)<<'\n';
    }
}






Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define int long long
int dp[1000][2000];
int f(int i,int j,int k,string a,string b,string c){
    int n=c.length();
    if(k==n) return 0;
    //if(i==a.length()&&j==b.length()) return 0;
    if(dp[i][k]!=-1) return dp[i][k];
    int ta=2002,tb=2002;
    if(a[i]==c[k]) ta=f(i+1,j,k+1,a,b,c);
    else ta=1+f(i+1,j,k+1,a,b,c);
    if(b[j]==c[k]) tb=f(i,j+1,k+1,a,b,c);
    else tb=1+f(i,j+1,k+1,a,b,c);
    return dp[i][k]=min(ta,tb);
}
signed main(){
    int t; cin>>t;
    string a,b,c;
    while(t--&&cin>>a>>b>>c){
        int al=a.length(),bl=b.length(),cl=c.length();
        for(int i=0;i<=al;i++){
            for(int k=0;k<=cl;k++){
                dp[i][k]=-1;
            }
        }
        cout<<f(0,0,0,a,b,c)<<'\n';
    }
}
Problem: 2050E - Three Strings
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define int long long
int dp[1000][2000];
int f(int i,int j,int k,string a,string b,string c){
    int n=c.length();
    if(k==n) return 0;
    //if(i==a.length()&&j==b.length()) return 0;
    if(dp[i][k]!=-1) return dp[i][k];
    int ta=2002,tb=2002;
    if(a[i]==c[k]) ta=f(i+1,j,k+1,a,b,c);
    else ta=1+f(i+1,j,k+1,a,b,c);
    if(b[j]==c[k]) tb=f(i,j+1,k+1,a,b,c);
    else tb=1+f(i,j+1,k+1,a,b,c);
    return dp[i][k]=min(ta,tb);
}
signed main(){
    int t; cin>>t;
    string a,b,c;
    while(t--&&cin>>a>>b>>c){
        int al=a.length(),bl=b.length(),cl=c.length();
        for(int i=0;i<=al;i++){
            for(int k=0;k<=cl;k++){
                dp[i][k]=-1;
            }
        }
        cout<<f(0,0,0,a,b,c)<<'\n';
    }
}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
#define int long long
int dp[1000][1000];
int f(int i,int j,int k,string a,string b,string c){
    int n=c.length();
    if(k==n) return 0;
    //if(i==a.length()&&j==b.length()) return 0;
    if(dp[i][j]!=-1) return dp[i][j];
    int ta=2002,tb=2002;
    if(a[i]==c[k]) ta=f(i+1,j,k+1,a,b,c);
    else ta=1+f(i+1,j,k+1,a,b,c);
    if(b[j]==c[k]) tb=f(i,j+1,k+1,a,b,c);
    else tb=1+f(i,j+1,k+1,a,b,c);
    return dp[i][j]=min(ta,tb);
}
signed main(){
    int t; cin>>t;
    string a,b,c;
    while(t--&&cin>>a>>b>>c){
        int al=a.length(),bl=b.length(),cl=c.length();
        for(int i=0;i<=al;i++){
            for(int j=0;j<=bl;j++){
                dp[i][j]=-1;
            }
        }
        cout<<f(0,0,0,a,b,c)<<'\n';
    }
}
Problem: 2049C - MEX Cycle
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 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;

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

#define int long long

#define fast                          \

	ios_base::sync_with_stdio(false); \

	cin.tie(NULL)

#define fr(i, a, b) for (int i = (a); i < (int)(b); ++i)

#define frr(i, a, b) for (int i = (a); i >= (int)(b); --i)

#define vi vector<int>

#define vvi vector<vi>

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

typedef pair<int, int> pi;

typedef vector<pi> vpi;

#define pb push_back

#define endl "\n"

void solve()

{

	int n, x, y;

	cin >> n >> x >> y;

	vi v;

	if (n % 2)

	{

		fr(i, 0, n - 1)

		{

			if (i % 2)

			{

				v.pb(1);

			}

			else

			{

				v.pb(0);

			}

		}

		v.pb(2);

	}

	else

	{

		fr(i, 0, n)

		{

			if (i % 2)

			{

				v.pb(1);

			}

			else

			{

				v.pb(0);

			}

		}

	}

	if (v[x - 1] == v[y - 1])

	{

		if (x != 1)

		{

			v[x - 1] = 2;

		}

		else

		{

			v[y - 1] = 2;

		}

	}

	fr(i, 0, n)

	{

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

	}

	cout << endl;

}

signed main()

{

	fast;

	int t;

	cin >> t;

	while (t--)

	{

		solve();

	}

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

Previous submission (verdict: Wrong answer on test 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;

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

#define int long long

#define fast                          \

	ios_base::sync_with_stdio(false); \

	cin.tie(NULL)

#define fr(i, a, b) for (int i = (a); i < (int)(b); ++i)

#define frr(i, a, b) for (int i = (a); i >= (int)(b); --i)

#define vi vector<int>

#define vvi vector<vi>

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

typedef pair<int, int> pi;

typedef vector<pi> vpi;

#define pb push_back

#define endl "\n"

void solve()

{

	int n, x, y;

	cin >> n >> x >> y;

	vi v;

	if (n % 2)

	{

		fr(i, 0, n - 1)

		{

			if (i % 2)

			{

				v.pb(1);

			}

			else

			{

				v.pb(0);

			}

		}

		v.pb(2);

	}

	else

	{

		fr(i, 0, n)

		{

			if (i % 2)

			{

				v.pb(1);

			}

			else

			{

				v.pb(0);

			}

		}

	}

	if (v[x - 1] == v[y - 1])

	{

		if (x != 1)

		{

			v[x - 1] = 2;

		}

		else

		{

			v[y - 1] = 2;

		}

	}

	fr(i, 0, n)

	{

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

	}

	cout << endl;

}

signed main()

{

	fast;

	int t;

	cin >> t;

	while (t--)

	{

		solve();

	}

}

Submission (verdict: Wrong answer on test 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;

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

#define int long long

#define fast                          \

	ios_base::sync_with_stdio(false); \

	cin.tie(NULL)

#define fr(i, a, b) for (int i = (a); i < (int)(b); ++i)

#define frr(i, a, b) for (int i = (a); i >= (int)(b); --i)

#define vi vector<int>

#define vvi vector<vi>

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

typedef pair<int, int> pi;

typedef vector<pi> vpi;

#define pb push_back

#define endl "\n"

void solve()

{

	int n, x, y;

	cin >> n >> x >> y;

	vi v;

	if (n % 2)

	{

		fr(i, 0, n - 1)

		{

			if(i == y-1)

			{

				v.pb(2);

				break;

			}

			if (i % 2)

			{

				v.pb(1);

			}

			else

			{

				v.pb(0);

			}

		}

		int c = 0;

		fr(i,y,n)

		{

			if(v[y-2] == 1)

			{

				if(c%2 == 0)

				{

					v.pb(0);

				}

				else

				{

					v.pb(1);

				}

			}

			else

			{

				if (c % 2 == 0)

				{

					v.pb(1);

				}

				else

				{

					v.pb(0);

				}

			}

			c++;

		}

	}

	else

	{

		fr(i, 0, n)

		{

			if (i % 2)

			{

				v.pb(1);

			}

			else

			{

				v.pb(0);

			}

		}

		if (v[x - 1] == v[y - 1])

		{

			v[x - 1] = 2;

		}

	}

	fr(i,0,n)

	{

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

	}

	cout << endl;

}

signed main()

{

	fast;

	int t;

	cin >> t;

	while (t--)

	{

		solve();

	}

}