ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063C - Remove Exactly Two
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 4):
// Problem: C. Remove Exactly Two
// Contest: Codeforces - Codeforces Round 1000 (Div. 2)
// URL: https://codeforces.com/contest/2063/problem/C
// Memory Limit: 256 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
using namespace std;

#define ll long long int
#define endl '\n'
#define pb push_back
#define mod 1000000007
#define fin for(int i=0;i<n;i++) 

ll power(ll x, ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % mod; 
    p = (p * p) % mod; 
  
    return (y%2 == 0)? p : (x * p) % mod; 
} 
ll factorial[1000007];
void fact(ll n)
{
    memset(factorial,0,sizeof(factorial));
    factorial[0]=1;
	factorial[1]=1;

    for(int i=1;i<n;i++)
    {
        factorial[i]=(factorial[i-1]*i)%mod;
    } 
}
ll ncr(ll n,ll r)
{
    ll ans=1;
    ans=factorial[n];
    ll ans1=power(factorial[n-r],mod-2);
    ll ans2=power(factorial[r],mod-2);
    ans=((ans*ans1)%mod*ans2)%mod;
    return ans;
}
ll gcd(ll a, ll b) 
{ 
    if (b == 0) 
        return a; 
    return gcd(b, a % b);  
      
} 

bool prime[100000006];
void sieve(ll n){
    memset(prime,true,sizeof(prime));
	prime[1]=false; 
    for (ll p=2;p*p<=n;p++){
        if (prime[p]){  
            for (ll i=p*p;i<=n;i+=p)
                prime[i]=false;
        }
    }
}

// string s=bitset<64>(n).to_string();

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
	ll t;
	cin>>t;
	while(t--)
	{
		ll n;
		cin>>n;
		map<ll,set<ll> > mp;
		vector<ll> degree(n+1,0);
		for(int i=0;i<n-1;i++)
		{
			ll u,v;
			cin>>u>>v;
			mp[u].insert(v);
			mp[v].insert(u);
			degree[u]++;
			degree[v]++;
		}
		// for(int i=0;i<=n;i++)
		// {
			// cout<<degree[i]<<" ";
		// }
		// cout<<endl;
		ll node1 = 1,node2 =-1;
		ll ans = 0;
		for(int i=2;i<=n;i++)
		{
			// cout<<node1<<" "<<node2<<endl;
			ll res = degree[i];
			// cout<<res<<endl;
			//node1
			if(mp[i].find(node1)==mp[i].end())
			{
				// cout<<"THIS"<<endl;
				ans = max(ans,res+degree[node1]-1);
			}
			else
			{
				// cout<<degree[node1]<<endl;
				ans = max(ans,res+degree[node1]-2);
			}
			//node2
			if(node2!=-1)
			{
				// cout<<"THIS"<<endl;
				if(mp[i].find(node2)==mp[i].end())
				{
					ans = max(ans,res+degree[node2]-1);
				}
				else
				{
					ans = max(ans,res+degree[node2]-2);
				}
			}
			if(degree[i]>=degree[node1])
			{
				node2 = node1;
				node1 = i;
			}
			else
			{
				if(node2==-1||degree[node2]<degree[i])
				{
					node2 = i;
				}
			}
			//
		}
		// cout<<ans<<endl;
		// cout<<node1<<" "<<node2<<endl;
		if(mp[node1].find(node2)==mp[node1].end())
		{
			ans = max(ans,degree[node1]+degree[node2]-1);
		}
		else
		{
			ans = max(ans,degree[node1]+degree[node2]-2);
		}
		cout<<ans<<endl;
	}
	return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 7):
#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 ll long long int
#define ull unsigned long long
#define lld long double
#define input(v,n) for(ll i=0;i<n;i++){cin>>v[i];}
#define print(v) for(ll i=0;i<v.size();i++){cout<<v[i]<<" ";}cout<<endl;
const int N = 1e9 + 7;
#define pb push_back
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL);
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int qpow(int base, int exp, int mod) {
  int result = 1;
  base = base % mod;
  while (exp > 0) {
    if (exp % 2 == 1) {
      result = (result * base) % mod;
    }
    exp = exp >> 1;
    base = (base * base) % mod;
  }
  return result;
}
int invmod(int a, int m) {
  return qpow(a, m - 2LL, m);
}
int gcd(int a, int b) {
  if (b == 0) {
    return a;
  } else {
    return gcd(b, a % b);
  }
}
int lcm(int a, int b) {
  return (a * b) / gcd(a, b);
}
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << " "; _print(x); cerr << endl;
#else
#define debug(x)
#endif
void _print(ll t) { cerr << t; }
void _print(int t) { cerr << t; }
void _print(string t) { cerr << t; }
void _print(char t) { cerr << t; }
void _print(lld t) { cerr << t; }
void _print(double t) { cerr << t; }
void _print(ull t) { cerr << t; }
template <class T, class V> void _print(pair<T, V> p) {
  cerr << "{"; _print(p.first); cerr << ","; _print(p.second); cerr << "}";
}
template <class T> void _print(vector<T> v) {
  cerr << "[ "; for (T i : v) { _print(i); cerr << " "; } cerr << "]";
}
template <class T> void _print(set<T> v) {
  cerr << "[ "; for (T i : v) { _print(i); cerr << " "; } cerr << "]";
}
template <class T> void _print(multiset<T> v) {
  cerr << "[ "; for (T i : v) { _print(i); cerr << " "; } cerr << "]";
}
template <class T, class V> void _print(map<T, V> v) {
  cerr << "[ "; for (auto i : v) { _print(i); cerr << " "; } cerr << "]";
}
//--------------------------------------------------------------------------------------------------------------------------------
int main() {
  fastio();
  #ifndef ONLINE_JUDGE
  freopen("error.txt", "w", stderr);
  freopen("inputf.in","r",stdin);
  freopen("outputf.out","w",stdout);
  #endif
  ll t;
  // cin >> t;
  t=1;

  while (t--) {
     
  int n;
  cin>>n;
  vector<int>c(n+1);
  for(int i=1;i<=n;i++){
    cin>>c[i]; 
  }
  
  vector<pair<int,int>>v;
  for(int i=n-1;i>=1;i--){
    for(int j=n;j>i;j--){
      v.pb({j,i});
    }
  }
  for(int i=1;i<=n;i++){
    for(int j=i+1;j<=n;j++){
      if(c[j] > c[i]){
        v.pb({c[i],c[j]});
      }
    }
  }
  cout<<v.size()<<endl;
  for(auto x:v){
    cout<<x.first <<" "<<x.second<<endl;
  }
  

  return 0;
  }
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 4):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
 
    ll t;
    cin >> t;
 
    while (t--) {
        ll n;
        cin >> n ;
        vector<ll> a(n);
        vector<vector<ll>> adj(n);
        map<pair<ll,ll>, ll>st;
        vector<pair<ll,ll>>sz;
        for (ll i = 0; i < n - 1; i++) {
            ll x, y;
            cin >> x >> y;
            x--; y--;
            adj[y].push_back(x);
            adj[x].push_back(y);
            st[{x,y}]++;
            st[{y,x}]++;
        }
        for (ll i = 0; i < n ; i++) {
            sort(adj[i].begin(), adj[i].end());
            sz.push_back({adj[i].size(), i});
        }
        sort(sz.rbegin(),sz.rend());
        
        ll ans=0;
        for(ll i=0; i<n; i++){
            ll node=sz[i].second;
            ll ans2=sz[i].first;
            ll mx=0;
            ll f=0;
            for(ll j=0; j<n; j++){
                ll nd=sz[j].second;
                ll len=sz[j].first;
                if(node==nd){
                    continue;
                }
                if(st[{node,nd}]==0 || st[{nd,node}]==0){
                    mx=max(len,mx);
                    f=1;
                    break;
                }
                else{
                    mx=max(len-1,mx);
                }
            }
            ans=max(ans,mx+ans2-1);
            if(f==1){
                break;
            }
        }
        cout<<ans<<endl;
    }
 
 
    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
 
    ll t;
    cin >> t;
 
    while (t--) {
        ll n;
        cin >> n ;
        vector<ll> a(n);
        vector<vector<ll>> adj(n);
        map<pair<ll,ll>, ll>st;
        vector<pair<ll,ll>>sz;
        for (ll i = 0; i < n - 1; i++) {
            ll x, y;
            cin >> x >> y;
            x--; y--;
            adj[y].push_back(x);
            adj[x].push_back(y);
            st[{x,y}]++;
            st[{y,x}]++;
        }
        for (ll i = 0; i < n ; i++) {
            sort(adj[i].begin(), adj[i].end());
            sz.push_back({adj[i].size(), i});
        }
        sort(sz.rbegin(),sz.rend());
        
        ll ans=0;
        for(ll i=0; i<n; i++){
            ll node=sz[i].second;
            ll ans2=sz[i].first;
            ll mx=0;
            ll f=0;
            for(ll j=0; j<n; j++){
                ll nd=sz[j].second;
                ll len=sz[j].first;
                if(node==nd){
                    continue;
                }
                if(st[{node,nd}]==0 || st[{nd,node}]==0){
                    mx=max(len,mx);
                    f=1;
                    break;
                }
                else{
                    mx=max(len-1,mx);
                }
            }
            ans=max(ans,mx+ans2-1);
            
        }
        cout<<ans<<endl;
    }
 
 
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 3):
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    ll t;
    cin >> t;

    while (t--) {
        ll n;
        cin >> n ;
        vector<ll> a(n);
        vector<vector<ll>> adj(n);
        map<pair<ll,ll>, ll>st;
        for (ll i = 0; i < n - 1; i++) {
            ll x, y;
            cin >> x >> y;
            x--; y--;
            adj[y].push_back(x);
            adj[x].push_back(y);
            st[{x,y}]++;
            st[{y,x}]++;
        }

        
        ll ans=0;
        for(ll i=0; i<n; i++){
            ll node=i;
            ll mx=0;
            for(ll j=0; j<n; j++){
                if(i==j){
                    continue;
                }
                if(st[{node,j}]==0 || st[{j,node}]==0){
                    mx=max((ll)adj[j].size(),mx);
                }
                else{
                    mx=max((ll)adj[j].size()-1,mx);
                }
            }
            ans=max(ans,mx+adj[i].size()-1);
        }
        cout<<ans<<endl;
    }


    return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    ll t;
    cin >> t;

    while (t--) {
        ll n;
        cin >> n ;
        vector<ll> a(n);
        vector<vector<ll>> adj(n);
        map<pair<ll,ll>, ll>st;
        vector<pair<ll,ll>>sz;
        for (ll i = 0; i < n - 1; i++) {
            ll x, y;
            cin >> x >> y;
            x--; y--;
            adj[y].push_back(x);
            adj[x].push_back(y);
            st[{x,y}]++;
            st[{y,x}]++;
        
        }
        for (ll i = 0; i < n ; i++) {
            sort(adj[i].begin(), adj[i].end());
            sz.push_back({adj[i].size(), i});
        }
        sort(sz.rbegin(),sz.rend());
        
        ll ans=0;
        for(ll i=0; i<n; i++){
            ll node=sz[i].second;
            ll conn=sz[i].first;
            ll mx=0;
            for(ll j=0; j<n; j++){
                if(sz[j].second==node){
                    continue;
                }
                if (st.find({node, sz[j].second}) == st.end()) {
                    mx = sz[j].first;
                    break;
                } 
                else {
                    mx = max(mx, sz[j].first - 1);
                }
            }
            ans=max(ans,mx+adj[node].size()-1);
        }
        cout<<ans<<endl;
    }


    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    ll t;
    cin >> t;

    while (t--) {
        ll n;
        cin >> n ;
        vector<ll> a(n);
        vector<vector<ll>> adj(n);
        map<pair<ll,ll>, ll>st;
        vector<pair<ll,ll>>sz;
        for (ll i = 0; i < n - 1; i++) {
            ll x, y;
            cin >> x >> y;
            x--; y--;
            adj[y].push_back(x);
            adj[x].push_back(y);
            st[{x,y}]++;
            st[{y,x}]++;
        
        }
        for (ll i = 0; i < n ; i++) {
            sort(adj[i].begin(), adj[i].end());
            sz.push_back({adj[i].size(), i});
        }
        sort(sz.rbegin(),sz.rend());
        
        ll ans=0;
        for(ll i=0; i<n; i++){
            ll node=sz[i].second;
            ll conn=sz[i].first;
            ll mx=0;
            for(ll j=0; j<n; j++){
                if(sz[j].second==node){
                    continue;
                }
                if (st.find({node, sz[j].second}) == st.end()) {
                    mx = sz[j].first;
                    break;
                } 
                else {
                    mx = max(mx, sz[j].first - 1);
                }
            }
            ans=max(ans,mx+adj[node].size()-1);
        }
        cout<<ans<<endl;
    }


    return 0;
}

Submission (verdict: Wrong answer on test 4):
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
 
    ll t;
    cin >> t;
 
    while (t--) {
        ll n;
        cin >> n ;
        vector<ll> a(n);
        vector<vector<ll>> adj(n);
        map<pair<ll,ll>, ll>st;
        vector<pair<ll,ll>>sz;
        for (ll i = 0; i < n - 1; i++) {
            ll x, y;
            cin >> x >> y;
            x--; y--;
            adj[y].push_back(x);
            adj[x].push_back(y);
            st[{x,y}]++;
            st[{y,x}]++;
        }
        for (ll i = 0; i < n ; i++) {
            sort(adj[i].begin(), adj[i].end());
            sz.push_back({adj[i].size(), i});
        }
        sort(sz.rbegin(),sz.rend());
        
        ll ans=0;
        for(ll i=0; i<n; i++){
            ll node=sz[i].second;
            ll ans2=sz[i].first;
            ll mx=0;
            ll f=0;
            for(ll j=0; j<n; j++){
                ll nd=sz[j].second;
                ll len=sz[j].first;
                if(node==nd){
                    continue;
                }
                if(st[{node,nd}]==0 || st[{nd,node}]==0){
                    mx=max(len,mx);
                    f=1;
                    break;
                }
                else{
                    mx=max(len-1,mx);
                }
            }
            ans=max(ans,mx+ans2-1);
            if(f==1){
                break;
            }
        }
        cout<<ans<<endl;
    }
 
 
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)


Submission (verdict: Time limit exceeded on test 3):
#include <bits/stdc++.h>
#define ll long long
using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    ll t;
    cin >> t;

    while (t--) {
        ll n;
        cin >> n ;
        vector<ll> a(n);
        vector<vector<ll>> adj(n);
        map<pair<ll,ll>, ll>st;
        for (ll i = 0; i < n - 1; i++) {
            ll x, y;
            cin >> x >> y;
            x--; y--;
            adj[y].push_back(x);
            adj[x].push_back(y);
            st[{x,y}]++;
            st[{y,x}]++;
        }

        
        ll ans=0;
        for(ll i=0; i<n; i++){
            ll node=i;
            ll mx=0;
            for(ll j=0; j<n; j++){
                if(i==j){
                    continue;
                }
                if(st[{node,j}]==0 || st[{j,node}]==0){
                    mx=max((ll)adj[j].size(),mx);
                }
                else{
                    mx=max((ll)adj[j].size()-1,mx);
                }
            }
            ans=max(ans,mx+adj[i].size()-1);
        }
        cout<<ans<<endl;
    }


    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

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

using namespace std;

void solve() {
    int l, r;
    cin >> l >> r;
    int k = 31 - __builtin_clz(l ^ r);
    int a = l | ((1 << k) - 1), b = a - 1;
    int c = l;
    // 确保 c 不等于 a 和 b，否则递增
    while (c == a || c == b) {
        c++;
    }
    cout << a << " " << b << " " << c << "\n";
}

// void test() {
//     int l=6, r=22;
//     int c=l^r;
//     cout << c << "\n"; 
//     bitset<32> bin(c);
//     cout << bin << "\n"; 
// }
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    // test();

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

    return 0;
}

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

using namespace std;

void solve() {
    int l, r;
    cin >> l >> r;
    int k = 31 - __builtin_clz(l ^ r);
    int a = l | ((1 << k) - 1), b = a + 1;
    int c = l;
    // 确保 c 不等于 a 和 b，否则递增
    while (c == a || c == b) {
        c++;
    }
    cout << a << " " << b << " " << c << "\n";
}

// void test() {
//     int l=6, r=22;
//     int c=l^r;
//     cout << c << "\n"; 
//     bitset<32> bin(c);
//     cout << bin << "\n"; 
// }
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    // test();

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

    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

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

using namespace std;

void solve() {
    int l, r;
    cin >> l >> r;
    int k = 31 - __builtin_clz(l ^ r);
    int a = l | ((1 << k) - 1), b = a - 1, c = (a == l ? r : l);
    cout << a << " " << b << " " << c << "\n";
}

// void test() {
//     int l=6, r=22;
//     int c=l^r;
//     cout << c << "\n"; 
//     bitset<32> bin(c);
//     cout << bin << "\n"; 
// }
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    // test();

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

    return 0;
}

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

using namespace std;

void solve() {
    int l, r;
    cin >> l >> r;
    int k = 31 - __builtin_clz(l ^ r);
    int a = l | ((1 << k) - 1), b = a - 1;
    int c = l;
    // 确保 c 不等于 a 和 b，否则递增
    while (c == a || c == b) {
        c++;
    }
    cout << a << " " << b << " " << c << "\n";
}

// void test() {
//     int l=6, r=22;
//     int c=l^r;
//     cout << c << "\n"; 
//     bitset<32> bin(c);
//     cout << bin << "\n"; 
// }
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    // test();

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

    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)


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

using namespace std;

void solve() {
    int l, r;
    cin >> l >> r;
    int k = 31 - __builtin_clz(l ^ r);
    int a = l | ((1 << k) - 1), b = a - 1, c = (a == l ? r : l);
    cout << a << " " << b << " " << c << "\n";
}

// void test() {
//     int l=6, r=22;
//     int c=l^r;
//     cout << c << "\n"; 
//     bitset<32> bin(c);
//     cout << bin << "\n"; 
// }
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);

    // test();

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

    return 0;
}
Problem: 2049C - MEX Cycle
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
//Patta Anaro Ka

//Patta Chanaro Ka

//Jaise Hawaon Me

//Aise Bhatakta Hu

//Din Raat Dikhta Hu

//Mai Teri Rahon Me









#include<bits/stdc++.h>

using namespace std;

#include <cctype>

#define M 1000000007

#define ll long long

#define rep(i,s,n) for(ll i=s; i<n; i++)

#define pb push_back

#define F first

#define S second

#define mp make_pair

#define endl "\n"

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

#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower)

#define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper)

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

#define rsrt(v) sort(v.rbegin(),v.rend())

#define vi vector<ll>

#define pll pair<ll,ll>

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

#define seea(a,n) for(ll i=0;i<n;i++){cin>>a[i];}

#define seed(a,n,m) for(ll i = 0;i<n;i++){for(ll j = 0;j<m;j++){cin>>a[i][j];}}

#define show(a,n) for(ll i=0;i<n;i++){cout<<a[i]<<" ";}cout<<endl;

#define yy cout<<"YES"<<"\n";

#define nn cout<<"NO"<<"\n";



bool isArraySorted(vector<ll>& arr) {

    for (size_t i = 0; i < arr.size() - 1; i++) {

        if (arr[i] > arr[i + 1]) {

            return false; // Array is not sorted

        }

    }

    return true; // Array is sorted

}



int fMSB(int num) {

    return 63 - __builtin_clzll(num);

}



bool comp(pair<ll,ll> a,pair<ll,ll> b){

    return a.first>b.first;

}



bool comp2(pair<ll,ll>a,pair<ll,ll>b){

    return a.first<b.first;

}



ll gcd(ll a,ll b){

    if(b==0)return a;

    return gcd(b,a%b);

}



bool check(vector<ll>&arr,ll x){

    ll l=0;

    ll r=arr.size()-1;

    bool f=true;

    while(l<=r){

        while(arr[l]==x)l++;

        while(arr[r]==x)r--;

        if(l>r)break;

        if(arr[l]!=arr[r]){

            f=false;

            break;

        }l++;

        r--;

    }

    return f;

}



int func(vector<ll>&arr, int x) {

    int lo = 0;

    int hi = x;

    int ans = 0;

    while (lo <= hi) {

        int mid = lo + (hi - lo) / 2;

        if (arr[mid] >= x - mid + 1) {

            ans = x - mid + 1;

            hi = mid - 1; 

        } else {

            lo = mid + 1;

        }

    }

    return ans;

}



void solve() {

   ll n,x,y;

   cin>>n>>x>>y;

   vector<ll>ans;

    rep(i,0,n/2){

        ans.push_back(0);

        ans.push_back(1);

    }

    if(n%2==1){

        ans.push_back(2);

    }

    ll r1=x%2;

    ll r2=y%2;

    if(n%2==0 && (r1+r2==0 || r1+r2==2)){

        ans[x-1]=2;

    }else if((r1+r2==0 || r1+r2==2) && (x!=n || y!=n)){

        if(abs(n-x)>abs(n-y)){

            ans[x-1]=2;

        }else if(abs(n-x)<abs(n-y)){

            ans[y-1]=2;

        }

    }

   show(ans,ans.size());

}



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    ll t;

    cin >> t;

    while (t--) {   

        solve();

    }

}



// _______________________________________________BY SOUMYADEEP__________________________________________________________________________________