ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)


Submission (verdict: Runtime error on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int               long long int
#define endl              "\n"
#define vi                vector<int>
#define vvi               vector<vector<int>>
#define fast              ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);



int32_t main(){
fast;

int t=0;
cin >> t;
while(t--){
    string s;
    cin >> s;
    int n = s.size();
    vi vec;
    for(int i=0;i<n;i++){
        vec.push_back(s[i] - '0');
    }

    for(int i=0;i<n;i++){
        // cout << "began at " << i << " num = " << vec[i] << endl;
        int num = vec[i];
        int x = i+1;
        if((vec[x]-num<2)){
            // cout << "continuing at " << i << " num= " << vec[i] << endl;
            continue;
        }
        while((vec[x] - num)>1){
            vec[x-1] = vec[x]-1;
            vec[x] = num;
            x++;
            if(x>=n){
                break;
            }
        }
        i--;
        i--;
    }

    for(int i=0;i<n;i++){
        cout << vec[i];
    }
    cout << endl;

}

return 0;
}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)

Previous submission (verdict: Runtime error on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int               long long int
#define endl              "\n"
#define vi                vector<int>
#define vvi               vector<vector<int>>
#define fast              ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);



int32_t main(){
fast;

int t=0;
cin >> t;
while(t--){
    string s;
    cin >> s;
    int n = s.size();
    vi vec;
    for(int i=0;i<n;i++){
        vec.push_back(s[i] - '0');
    }

    for(int i=0;i<n;i++){
        // cout << "began at " << i << " num = " << vec[i] << endl;
        int num = vec[i];
        int x = i+1;
        if((vec[x]-num<2)){
            // cout << "continuing at " << i << " num= " << vec[i] << endl;
            continue;
        }
        while((vec[x] - num)>1){
            vec[x-1] = vec[x]-1;
            vec[x] = num;
            x++;
            if(x>=n){
                break;
            }
        }
        i--;
        i--;
    }

    for(int i=0;i<n;i++){
        cout << vec[i];
    }
    cout << endl;

}

return 0;
}

















Submission (verdict: Runtime error on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int               long long int
#define endl              "\n"
#define vi                vector<int>
#define vvi               vector<vector<int>>
#define fast              ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);



int32_t main(){
fast;

int t=0;
cin >> t;
while(t--){
    string s;
    cin >> s;
    int n = s.size();
    vi vec;
    for(int i=0;i<n;i++){
        vec.push_back(s[i] - '0');
    }

    for(int i=0;i<n;i++){
        // cout << "began at " << i << " num = " << vec[i] << endl;
        int num = vec[i];
        int x = i+1;
        if((vec[x]-num<2)){
            // cout << "continuing at " << i << " num= " << vec[i] << endl;
            continue;
        }
        while((vec[x] - num)>1){
            vec[x-1] = vec[x]-1;
            vec[x] = num;
            x++;
            if(x>=n){
                break;
            }
        }
        i--;
        if(i>0){
            i--;
        }
    }

    for(int i=0;i<n;i++){
        cout << vec[i];
    }
    cout << endl;

}

return 0;
}
Problem: 2050B - Transfusion
Language: Python 3

Previous submission (verdict: Time limit exceeded on test 2):
t=int(input())
for i in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    b=[]
    c=[0*t for m in range(t)]
    count=0
    count2=0
    mean=2*sum(a)//n
    if sum(a)%n!=0:
        print("NO")
    else:
        for j in range(n-2):
            b.append(abs(a[j]+a[j+2]))
        for k in range(n-2):
            if b[k]%2==0:
                count+=2
            else:
                c[i]+=1
        if mean in b:
                if (count+c[i])%2==0:
                    print("YES")
                else:
                    print("NO")
        else:
            print("NO")

Submission (verdict: Wrong answer on test 2):
t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    b = []
    count = 0
    mean = 2 * sum(a) // n

    if sum(a) % n != 0:
        print("NO")
    else:
        for j in range(n - 2):
            b.append(a[j] + a[j + 2])

        for value in b:
            if value % 2 == 0:
                count += 2

        if mean in b and count % 2 == 0:
            print("YES")
        else:
            print("NO")
Problem: 2050B - Transfusion
Language: Python 3


Submission (verdict: Time limit exceeded on test 2):
t=int(input())
for i in range(t):
    n=int(input())
    a=list(map(int,input().split()))
    b=[]
    c=[0*t for m in range(t)]
    count=0
    count2=0
    mean=2*sum(a)//n
    if sum(a)%n!=0:
        print("NO")
    else:
        for j in range(n-2):
            b.append(abs(a[j]+a[j+2]))
        for k in range(n-2):
            if b[k]%2==0:
                count+=2
            else:
                c[i]+=1
        if mean in b:
                if (count+c[i])%2==0:
                    print("YES")
                else:
                    print("NO")
        else:
            print("NO")
Problem: 2050B - Transfusion
Language: Python 3

Previous submission (verdict: Wrong answer on test 2):
t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    b = []
    count = 0
    mean = 2 * sum(a) // n

    if sum(a) % n != 0:
        print("NO")
    else:
        for j in range(n - 2):
            b.append(a[j] + a[j + 2])

        for value in b:
            if value % 2 == 0:
                count += 2

        if mean in b and count % 2 == 0:
            print("YES")
        else:
            print("NO")


Submission (verdict: Wrong answer on test 2):
t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    b = []
    count = 0
    d=0
    mean = 2 * sum(a) // n

    if sum(a) % n != 0:
        print("NO")
    else:
        for j in range(n - 2):
            b.append(a[j] + a[j + 2])

        for value in b:
            if value % 2 != 0:
                count += 1
            else:
                d+=2
        if mean in b and (count+d) % 2 == 0:
            print("YES")
        else:
            print("NO")
Problem: 2050B - Transfusion
Language: Python 3

Previous submission (verdict: Wrong answer on test 2):
t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    b = []
    count = 0
    d=0
    mean = 2 * sum(a) // n

    if sum(a) % n != 0:
        print("NO")
    else:
        for j in range(n - 2):
            b.append(a[j] + a[j + 2])

        for value in b:
            if value % 2 != 0:
                count += 1
            else:
                d+=2
        if mean in b and (count+d) % 2 == 0:
            print("YES")
        else:
            print("NO")


Submission (verdict: Accepted):
t = int(input())
for _ in range(t):
    n = int(input())
    a = list(map(int, input().split()))
    b = [a[i] for i in range(n) if i % 2 == 0]
    c=[a[i] for i in range(n) if i % 2 != 0]

    if sum(b)%len(b)==0:
        if sum(c)%len(c)==0 and sum(b)//len(b)==sum(c)//len(c):
            print("YES")
        else:
            print("NO")
    else:
        print("NO")
Problem: 2049B - pspspsps
Language: Java 21

Previous submission (verdict: Wrong answer on test 2):
import java.util.HashSet;

import java.util.Scanner;



public class PSPS {

    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);

        int testCase=sc.nextInt();

        while (testCase-- >0){

            int n=sc.nextInt();

            String s=sc.next();

            int pidx=s.indexOf('p');

            int sidx=s.lastIndexOf('s');

            HashSet<Character> hs=new HashSet<>();

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

                if(s.charAt(i)!='.') hs.add(s.charAt(i));

            }

            if(hs.size()>1 || pidx<sidx) System.out.println("NO");

            else System.out.println("YES");

        }

    }

}



Submission (verdict: Accepted):
import java.util.HashSet;

import java.util.Scanner;



public class PSPS {

    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);

        int testCase=sc.nextInt();

        while (testCase-- >0){

            int n=sc.nextInt();

            String s=sc.next();

            int pidx=s.indexOf('p');

            int sidx=s.lastIndexOf('s');

            HashSet<Character> hs=new HashSet<>();

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

                if(s.charAt(i)!='.') hs.add(s.charAt(i));

            }

            if(hs.size()>1 || (pidx<sidx && pidx!=-1)) System.out.println("NO");

            else System.out.println("YES");

        }

    }

}
Problem: 2049B - pspspsps
Language: Java 21


Submission (verdict: Wrong answer on test 2):
import java.util.HashSet;

import java.util.Scanner;



public class PSPS {

    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);

        int testCase=sc.nextInt();

        while (testCase-- >0){

            int n=sc.nextInt();

            String s=sc.next();

            String t=s.substring(1);

            t=t.substring(0,Math.max(0,t.length()-1));

            HashSet<Character> hs=new HashSet<>();

            for (int i = 0; i < t.length(); i++) {

                if(t.charAt(i)!='.'){

                    hs.add(s.charAt(i));

                }

            }

            if(hs.size()<=1) System.out.println("YES");

            else System.out.println("NO");

        }

    }

}
Problem: 2049B - pspspsps
Language: Java 21

Previous submission (verdict: Wrong answer on test 2):
import java.util.HashSet;

import java.util.Scanner;



public class PSPS {

    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);

        int testCase=sc.nextInt();

        while (testCase-- >0){

            int n=sc.nextInt();

            String s=sc.next();

            String t=s.substring(1);

            t=t.substring(0,Math.max(0,t.length()-1));

            HashSet<Character> hs=new HashSet<>();

            for (int i = 0; i < t.length(); i++) {

                if(t.charAt(i)!='.'){

                    hs.add(s.charAt(i));

                }

            }

            if(hs.size()<=1) System.out.println("YES");

            else System.out.println("NO");

        }

    }

}

Submission (verdict: Wrong answer on test 2):
import java.util.HashSet;

import java.util.Scanner;



public class PSPS {

    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);

        int testCase=sc.nextInt();

        while (testCase-- >0){

            int n=sc.nextInt();

            String s=sc.next();

            if(s.charAt(0)=='p' && s.charAt(s.length()-1)=='s') System.out.println("NO");

            else{

                String t=s.substring(1);

                t=t.substring(0,Math.max(0,t.length()-1));

                HashSet<Character> hs=new HashSet<>();

                for (int i = 0; i < t.length(); i++) {

                    if(t.charAt(i)!='.'){

                        hs.add(s.charAt(i));

                    }

                }

                if(hs.size()<=1) System.out.println("YES");

                else System.out.println("NO");

            }



        }

    }

}
Problem: 2049B - pspspsps
Language: Java 21

Previous submission (verdict: Wrong answer on test 2):
import java.util.HashSet;

import java.util.Scanner;



public class PSPS {

    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);

        int testCase=sc.nextInt();

        while (testCase-- >0){

            int n=sc.nextInt();

            String s=sc.next();

            if(s.charAt(0)=='p' && s.charAt(s.length()-1)=='s') System.out.println("NO");

            else{

                String t=s.substring(1);

                t=t.substring(0,Math.max(0,t.length()-1));

                HashSet<Character> hs=new HashSet<>();

                for (int i = 0; i < t.length(); i++) {

                    if(t.charAt(i)!='.'){

                        hs.add(s.charAt(i));

                    }

                }

                if(hs.size()<=1) System.out.println("YES");

                else System.out.println("NO");

            }



        }

    }

}



Submission (verdict: Wrong answer on test 2):
import java.util.HashSet;

import java.util.Scanner;



public class PSPS {

    public static void main(String[] args) {

        Scanner sc=new Scanner(System.in);

        int testCase=sc.nextInt();

        while (testCase-- >0){

            int n=sc.nextInt();

            String s=sc.next();

            int pidx=s.indexOf('p');

            int sidx=s.lastIndexOf('s');

            HashSet<Character> hs=new HashSet<>();

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

                if(s.charAt(i)!='.') hs.add(s.charAt(i));

            }

            if(hs.size()>1 || pidx<sidx) System.out.println("NO");

            else System.out.println("YES");

        }

    }

}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 4):
# include<bits/stdc++.h>
using namespace  std;
# define ll long long 
int main(){
  ll n;
  cin>>n;
  ll arr[n];
  set<int> st;
  vector<vector<ll>> ans;
  for(ll i=0;i<n;i++){
      cin>>arr[i];
      for(ll j=arr[i]-1;j>=1;j--){
        if(!st.count(j)){
          ans.push_back({arr[i],j});
        }
      }
      st.insert(arr[i]);
  }
  for(ll i=1;i<n;i++){
    if(arr[i]>arr[i-1]){
      ans.push_back({arr[i],arr[i-1]});
      ans.push_back({arr[i-1],arr[i]});
    }
  }
  cout<<ans.size()<<endl;
  for(auto it:ans){
    cout<<it[0]<<" "<<it[1]<<endl;
  }
  return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 4):
# include<bits/stdc++.h>
using namespace  std;
# define ll long long 
int main(){
  ll n;
  cin>>n;
  ll arr[n];
  set<int> st;
  vector<vector<ll>> ans;
  for(ll i=0;i<n;i++){
      cin>>arr[i];
      for(ll j=arr[i]-1;j>=1;j--){
        if(!st.count(j)){
          ans.push_back({arr[i],j});
        }
      }
      st.insert(arr[i]);
  }
  for(ll i=1;i<n;i++){
    if(arr[i]>arr[i-1]){
      ans.push_back({arr[i],arr[i-1]});
      ans.push_back({arr[i-1],arr[i]});
    }
  }
  cout<<ans.size()<<endl;
  for(auto it:ans){
    cout<<it[0]<<" "<<it[1]<<endl;
  }
  return 0;
}

Submission (verdict: Wrong answer on test 4):
# include<bits/stdc++.h>
using namespace  std;
# define ll long long 
int main(){
  ll n;
  cin>>n;
  ll arr[n];
  set<int> st;
  vector<vector<ll>> ans;
  for(ll i=0;i<n;i++){
      cin>>arr[i];
      for(ll j=arr[i]-1;j>=1;j--){
        if(!st.count(j)){
          ans.push_back({arr[i],j});
        }
      }
      st.insert(arr[i]);
  }
  for(ll i=1;i<n;i++){
    for(ll j=i-1;j>=0;j--)
    if(arr[i]>arr[j]){
      ans.push_back({arr[i],arr[j]});
      ans.push_back({arr[j],arr[i]});
    }
    
    }
  cout<<ans.size()<<endl;
  for(auto it:ans){
    cout<<it[0]<<" "<<it[1]<<endl;
  }
  return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 4):
# include<bits/stdc++.h>
using namespace  std;
# define ll long long 
int main(){
  ll n;
  cin>>n;
  ll arr[n];
  set<int> st;
  vector<vector<ll>> ans;
  for(ll i=0;i<n;i++){
      cin>>arr[i];
      for(ll j=arr[i]-1;j>=1;j--){
        if(!st.count(j)){
          ans.push_back({arr[i],j});
        }
      }
      st.insert(arr[i]);
  }
  for(ll i=1;i<n;i++){
    for(ll j=i-1;j>=0;j--)
    if(arr[i]>arr[j]){
      ans.push_back({arr[i],arr[j]});
      ans.push_back({arr[j],arr[i]});
    }
    
    }
  cout<<ans.size()<<endl;
  for(auto it:ans){
    cout<<it[0]<<" "<<it[1]<<endl;
  }
  return 0;
}

Submission (verdict: Accepted):
# include<bits/stdc++.h>
using namespace  std;
# define ll long long 
int main(){
  ll n;
  cin>>n;
  ll arr[n];
  set<int> st;
  vector<vector<ll>> ans;
  for(ll i=0;i<n;i++){
      cin>>arr[i];
      
      for(ll j=arr[i]+1;j<=n;j++){
          if(!st.count(j)){
            ans.push_back({j,arr[i]});
          }
      }
      
      for(ll j=n;j>=1;j--){
        if(!st.count(j)&&  arr[i]!=j) {
          ans.push_back({arr[i],j});
        }
      }
      st.insert(arr[i]);
  }
 
  cout<<ans.size()<<endl;
  for(auto it:ans){
    cout<<it[0]<<" "<<it[1]<<endl;
  }
  return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#define ll long long
#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> 

ll flipBitsAfterMSB(ll num) {
    if (num == 0) return 0;
    ll msb = 63 - __builtin_clzll(num);
    return num ^ ((1LL << msb) - 1);
}

int main() {
    long long t;
    cin >> t;
    while (t--) {
        ll l, r;
        cin >> l >> r;
        
        ll ans1 = r;
        ll ans2 = flipBitsAfterMSB(ans1);
        if (ans2 < l || ans2 > r) ans2 = l;
        
        ll ans3 = (l == ans1) ? l + 1 : l;
        if (ans3 == ans2) ans3++;
        if (ans3 > r) {
            cout << "-1 -1 -1" << endl;
            continue;
        }
        
        cout << ans1 << ' ' << ans2 << ' ' << ans3 << endl;
    }
}


Submission (verdict: Accepted):
#define ll long long
#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> 

int main() {
    long long t;
    cin >> t;
    while (t--) {
        ll l, r;
        cin >> l >> r;
        
        ll msb = 63 - __builtin_clzll(l ^ r);
        ll x = (l + (1LL << msb)) & ~((1LL << msb) - 1);
        if (x > r) x -= (1LL << msb);
        
        ll y = x - 1;
        ll z = (l == x || l == y) ? l + 1 : l;
        if (z == y || z == x) z++;
        if (z > r) {
            cout << "-1 -1 -1" << endl;
            continue;
        }
        
        cout << x << " " << y << " " << z << endl;
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
#define ll long long
#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> 
std::string toBinaryString(long long num) {
std::bitset<64> binary(num);
return binary.to_string();
}
long long binaryToLongLong(const std::string& binary) {
std::bitset<64> binarySet(binary);
return static_cast<long long>(binarySet.to_ullong());
}
bool compareByFirst(const std::pair<ll, ll>& a, const std::pair<ll, ll>& b) {
return a.first < b.first; // Ascending order by the first element
}
int main(){
    long long t;
    cin>>t;
    while(t--){
        ll l;
        ll r;
        cin>>l;
        cin>>r;
        ll ans1;
        ll ans2;
        for(ll i=r;i>=l;i++)
        {
            string s=toBinaryString(i);
            string g="";
            ll index=0;
            for(ll j=0;j<s.size();j++)
            {
                if(s[j]=='0')
                g+='0';
                else 
                {
                    index=j;
                    break;
                }


            }
            for(ll j=index;j<s.size();j++)
            {
                if(s[j]=='1')
                g+='0';
                else 
                g+='1';
            }
            ll number=binaryToLongLong(g);
            if(number>=l&&number<=r)
            {
                ans1=i;
                ans2=number;
                break;

            }
        }
        ll ans3;
        for(ll i=l;i<=r;i++)
        {
            if(i!=ans1&&i!=ans2)
            {
                ans3=i;
                break;
            }
        }
        cout<<ans1<<' '<<ans2<<' '<<ans3<<endl;
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#define ll long long
#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> 
std::string toBinaryString(long long num) {
std::bitset<64> binary(num);
return binary.to_string();
}
long long binaryToLongLong(const std::string& binary) {
std::bitset<64> binarySet(binary);
return static_cast<long long>(binarySet.to_ullong());
}
bool compareByFirst(const std::pair<ll, ll>& a, const std::pair<ll, ll>& b) {
return a.first < b.first; // Ascending order by the first element
}
int main(){
    long long t;
    cin>>t;
    while(t--){
        ll l;
        ll r;
        cin>>l;
        cin>>r;
        ll ans1;
        ll ans2;
        for(ll i=r;i>=l;i--)
        {
            string s=toBinaryString(i);
            string g="";
            ll index=0;
            for(ll j=0;j<s.size();j++)
            {
                if(s[j]=='0')
                g+='0';
                else 
                {
                    index=j;
                    break;
                }


            }
            for(ll j=index;j<s.size();j++)
            {
                if(s[j]=='1')
                g+='0';
                else 
                g+='1';
            }
            ll number=binaryToLongLong(g);
            if(number>=l&&number<=r)
            {
                ans1=i;
                ans2=number;
                break;

            }
        }
        ll ans3;
        for(ll i=l;i<=r;i++)
        {
            if(i!=ans1&&i!=ans2)
            {
                ans3=i;
                break;
            }
        }
        cout<<ans1<<' '<<ans2<<' '<<ans3<<endl;
    }
}


Submission (verdict: Wrong answer on test 1):
#define ll long long
#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> 

ll flipBitsAfterMSB(ll num) {
    if (num == 0) return 0;
    ll msb = 63 - __builtin_clzll(num);
    return num ^ ((1LL << msb) - 1);
}

int main() {
    long long t;
    cin >> t;
    while (t--) {
        ll l, r;
        cin >> l >> r;
        
        ll ans1 = r;
        ll ans2 = flipBitsAfterMSB(ans1);
        if (ans2 < l || ans2 > r) ans2 = l;
        
        ll ans3 = (l == ans1) ? l + 1 : l;
        if (ans3 == ans2) ans3++;
        if (ans3 > r) {
            cout << "-1 -1 -1" << endl;
            continue;
        }
        
        cout << ans1 << ' ' << ans2 << ' ' << ans3 << endl;
    }
}
Problem: 2049C - MEX Cycle
Language: C++20 (GCC 13-64)


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

#include<algorithm>

using namespace std;

#define int long long

#define pub push_back  

#define pob pop_back  

#define cin(v) for(auto &val:v) cin >> val  

#define cout(v) for(auto &val:v) cout <<val <<" ";cout << endl;

#define vi vector<int>

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

#define endl "\n"

// Dont't get stuck on one approach ::

const int M=1e9+7;

int binexp(int a,int b){

  int ans=1;

  while(b){

    if(b&1){

      ans=(ans*a)%M;

    }

    a=(a*a)%M;

    b>>=1;

  }

  return ans;

}

signed main()

{

  ios_base::sync_with_stdio(false);

  cin.tie(NULL);

  int t;

  cin >> t;

  while(t--){

    int n,x,y;

    cin >> n;

    cin>> x >> y;

    vi ans(n+1,0);

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

        if(!(i&1)) ans[i]=1;

    }

    ans[n]=2;

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

        ans[y]=2;

    }

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

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

    }

    cout << endl;

    }

}