ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2049B - pspspsps
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
// Author : Hardik Ahuja



#include <bits/stdc++.h>

using namespace std;



#define int long long

#define loop(i,m,n) for(int i = (m);i < (n);i++)

#define rloop(i,m,n) for(int i = (m);i >= (n);i--)

#define ivec(vec) for(int i = 0;i < vec.size();i++)cin>>vec[i]

#define ovec(vec) for(int i = 0;i < vec.size();i++)cout<<vec[i]<<' '

#define endl '\n'

#define YES cout<<"YES"<<endl

#define NO cout<<"NO"<<endl





void solve(){

    int n;cin>>n;

    string s;cin>>s;



    int p = 0;

    int c = 0;

    int dot = 0;

    for(auto i: s){

        if(i == 's')c++;

        else if(i == 'p')p++;

        else dot++;

    }



    if(p + dot == n){

        YES;

    }

    else if(c + dot == n){

        YES;

    }

    else if(c + dot + p == n && p == 1 && s[n - 1] == 'p'){

        YES;

    }

    else NO;





}



int32_t main(){



    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}

Submission (verdict: Wrong answer on test 2):
// Author : Hardik Ahuja



#include <bits/stdc++.h>

using namespace std;



#define int long long

#define loop(i,m,n) for(int i = (m);i < (n);i++)

#define rloop(i,m,n) for(int i = (m);i >= (n);i--)

#define ivec(vec) for(int i = 0;i < vec.size();i++)cin>>vec[i]

#define ovec(vec) for(int i = 0;i < vec.size();i++)cout<<vec[i]<<' '

#define endl '\n'

#define YES cout<<"YES"<<endl

#define NO cout<<"NO"<<endl





void solve(){

    int n;cin>>n;

    string s;cin>>s;



    int p = 0;

    int c = 0;

    int dot = 0;

    for(auto i: s){

        if(i == 's')c++;

        else if(i == 'p')p++;

        else dot++;

    }



    if(p + dot == n){

        YES;

    }

    else if(c + dot == n){

        YES;

    }

    else if(c + dot + p == n && p == 1 && s[n - 1] == 'p'){

        YES;

    }

    else if(c + dot + p == n && c == 1 && s[n - 1] == 's')YES;

    else NO;





}



int32_t main(){



    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}
Problem: 2049B - pspspsps
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
// Author : Hardik Ahuja



#include <bits/stdc++.h>

using namespace std;



#define int long long

#define loop(i,m,n) for(int i = (m);i < (n);i++)

#define rloop(i,m,n) for(int i = (m);i >= (n);i--)

#define ivec(vec) for(int i = 0;i < vec.size();i++)cin>>vec[i]

#define ovec(vec) for(int i = 0;i < vec.size();i++)cout<<vec[i]<<' '

#define endl '\n'

#define YES cout<<"YES"<<endl

#define NO cout<<"NO"<<endl





void solve(){

    int n;cin>>n;

    string s;cin>>s;



    int p = 0;

    int c = 0;

    int dot = 0;

    for(auto i: s){

        if(i == 's')c++;

        else if(i == 'p')p++;

        else dot++;

    }



    if(p + dot == n){

        YES;

    }

    else if(c + dot == n){

        YES;

    }

    else if(c + dot + p == n && p == 1 && s[n - 1] == 'p'){

        YES;

    }

    else if(c + dot + p == n && c == 1 && s[n - 1] == 's')YES;

    else NO;





}



int32_t main(){



    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}

Submission (verdict: Accepted):
// Author : Hardik Ahuja



#include <bits/stdc++.h>

using namespace std;



#define int long long

#define loop(i,m,n) for(int i = (m);i < (n);i++)

#define rloop(i,m,n) for(int i = (m);i >= (n);i--)

#define ivec(vec) for(int i = 0;i < vec.size();i++)cin>>vec[i]

#define ovec(vec) for(int i = 0;i < vec.size();i++)cout<<vec[i]<<' '

#define endl '\n'

#define YES cout<<"YES"<<endl

#define NO cout<<"NO"<<endl





void solve(){

    int n;cin>>n;

    string s;cin>>s;



    int p = 0;

    int c = 0;

    int dot = 0;

    for(auto i: s){

        if(i == 's')c++;

        else if(i == 'p')p++;

        else dot++;

    }



    if(p + dot == n){

        YES;

    }

    else if(c + dot == n){

        YES;

    }

    else if(c == 1 && s[0] == 's' && p + dot == n - 1)YES;

    else if(p == 1 && s[n - 1] == 'p' && c + dot == n - 1)YES;

    else NO;





}



int32_t main(){



    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: Java 21

Previous submission (verdict: Wrong answer on test 1):
import java.util.*;
 
public class bit {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt();
            int arr[] = new int[n];
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
            }
            String ans = "YES";
            if(arr[0]>arr[1]){
                System.out.println("NO");
                continue;
            }
            for(int i=0;i<n-1;i++){
                if(arr[i]>arr[i+1]){
                    System.out.println(i);
                    ans = "NO";
                    break;
                }else{
                    arr[i+1]-=arr[i];
                    arr[i]-=arr[i];
                }
            }
            System.out.println(ans);
            
        } 
    }
}




Submission (verdict: Accepted):
import java.util.*;
 
public class bit {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt();
            int arr[] = new int[n];
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
            }
            String ans = "YES";
            if(arr[0]>arr[1]){
                System.out.println("NO");
                continue;
            }
            for(int i=0;i<n-1;i++){
                if(arr[i]>arr[i+1]){
                    ans = "NO";
                    break;
                }else{
                    arr[i+1]-=arr[i];
                    arr[i]-=arr[i];
                }
            }
            System.out.println(ans);
            
        } 
    }
}
Problem: 2060D - Subtract Min Sort
Language: Java 21

Previous submission (verdict: Wrong answer on test 2):
import java.util.*;
 
public class bit {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt();
            int arr[] = new int[n];
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
            }
            String ans = "YES";
            if(arr[0]>arr[1]){
                System.out.println("NO");
                continue;
            }
            for(int i=1;i<n-1;i++){
                if(arr[i]>=arr[i-1] || arr[i]<=arr[i+1]){
                    continue;
                }else{
                    ans ="NO";
                }
            }
            System.out.println(ans);
            
        } 
    }
}




Submission (verdict: Wrong answer on test 1):
import java.util.*;
 
public class bit {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt();
            int arr[] = new int[n];
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
            }
            String ans = "YES";
            if(arr[0]>arr[1]){
                System.out.println("NO");
                continue;
            }
            for(int i=0;i<n-1;i++){
                if(arr[i]>arr[i+1]){
                    System.out.println(i);
                    ans = "NO";
                    break;
                }else{
                    arr[i+1]-=arr[i];
                    arr[i]-=arr[i];
                }
            }
            System.out.println(ans);
            
        } 
    }
}
Problem: 2060D - Subtract Min Sort
Language: Java 21


Submission (verdict: Wrong answer on test 2):
import java.util.*;
 
public class bit {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt();
            int arr[] = new int[n];
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
            }
            String ans = "YES";
            for(int i=1;i<n-1;i++){
                if(arr[i]>=arr[i-1] || arr[i]<=arr[i+1]){
                    continue;
                }else{
                    ans ="NO";
                }
            }
            System.out.println(ans);
            
        } 
    }
}
Problem: 2060D - Subtract Min Sort
Language: Java 21

Previous submission (verdict: Wrong answer on test 2):
import java.util.*;
 
public class bit {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt();
            int arr[] = new int[n];
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
            }
            String ans = "YES";
            for(int i=1;i<n-1;i++){
                if(arr[i]>=arr[i-1] || arr[i]<=arr[i+1]){
                    continue;
                }else{
                    ans ="NO";
                }
            }
            System.out.println(ans);
            
        } 
    }
}




Submission (verdict: Wrong answer on test 2):
import java.util.*;
 
public class bit {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int t = sc.nextInt();
        while (t-- > 0) {
            int n = sc.nextInt();
            int arr[] = new int[n];
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
            }
            String ans = "YES";
            if(arr[0]>arr[1]){
                System.out.println("NO");
                continue;
            }
            for(int i=1;i<n-1;i++){
                if(arr[i]>=arr[i-1] || arr[i]<=arr[i+1]){
                    continue;
                }else{
                    ans ="NO";
                }
            }
            System.out.println(ans);
            
        } 
    }
}
Problem: 2061D - Kevin and Numbers
Language: C++20 (GCC 13-64)


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

ll modPow(ll base,ll exponent,ll mod)
{
    ll result=1;
    while(exponent>0)
    {
        if(exponent%2==1) 
        {
            result=(result*base)%mod;
        }
        base=(base*base)%mod;
        exponent/=2;
    }
    result=result%mod;
    return result;
}

bool fun(ll n,map<ll,ll> &mc)
{
	if(mc[n]>0)
	{
		mc[n]--;
		return true;
	}
	if(n==1)
	{
		return false;
	}
	ll a=n/2;
	ll b=n/2;
	if(n&1)
	b++;
	if(mc[a]>0 && mc[b]>0)
	{
		mc[a]--;
		mc[b]--;
		return true;
	}
	else
	{
		if(mc[a]==0)
		{
			if(!fun(a,mc))
			{
				// cout<<a<<" ";
				return false;
			}
		}
		else
		mc[a]--;
		if(mc[b]==0)
		{
			if(!fun(b,mc))
			{
				// cout<<b<<" ";
				return false;
			}
		}
		else
		mc[b]--;
		return true;
	}
}

void solve()
{
	ll n,m;
	cin>>n>>m;
	vector<ll> a(n,0),b(m,0),c;
	map<ll,ll> ma,mb,mc;
	for(ll i=0;i<n;i++)
	{
		cin>>a[i];
		ma[a[i]]++;
	}
	for(ll i=0;i<m;i++)
	{
		cin>>b[i];
		mb[b[i]]++;
	}
	for(ll i=0;i<n;i++)
	{
		if(mb[a[i]]==0)
		{
			c.push_back(a[i]);
			mc[a[i]]++;
		}
		else
		{
			mb[a[i]]--;
		}
	}
	sort(c.begin(),c.end());
	if(c.size()==0)
	{
		cout<<"YES"<<endl;
		return;
	}
	if(c.size()==1)
	{
		cout<<"NO"<<endl;
		return;
	}
	sort(b.rbegin(),b.rend());
	for(ll i=0;i<c.size();i++)
	{
		if(mc[c[i]]>0)
		{
			if(mb[2*c[i]]>0 && mc[c[i]]>1)
			{
				mc[c[i]]-=2;
				mb[2*c[i]]--;
			}
			else if(mb[(2*c[i])+1]>0 && mc[c[i]+1]>0)
			{
				mc[c[i]]--;
				mc[c[i]+1]--;
				mb[(2*c[i])+1]--;
			}
			else if(mb[(2*c[i])+1]>0 || mb[2*c[i]]>0)
			{
				cout<<"NO"<<endl;
				return;
			}
		}
	}
	for(ll i=0;i<m;i++)
	{
		if(mb[b[i]]>0)
		{
			bool p=fun(b[i],mc);
			if(p)
			mb[b[i]]--;
			else
			{
				cout<<"NO"<<endl;
				return;
			}
		}
	}
	for(auto x:mb)
	{
		if(x.second>0)
		{
			cout<<"NO"<<endl;
			return;
		}
	}
	for(auto x:mc)
	{
		if(x.second>0)
		{
			cout<<"NO"<<endl;
			return;
		}
	}
	cout<<"YES"<<endl;
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll t1;
	cin >> t1;
	while (t1--)
	{
		solve();
	}
}
Problem: 2057B - Gorilla and the Exam
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Time limit exceeded on test 9):
#include <iostream>
#include <vector>

using namespace std;

int f(vector<int>& arr) { // No of distinct elements
    vector<int> distinct_ele;

    for (int num : arr) {
        bool ele_present = false;

        for (int ele : distinct_ele) {
            if (ele == num) {
                ele_present = true;
                break;
            }
        }

        if (!ele_present) {
            distinct_ele.push_back(num);
        }
    }

    return distinct_ele.size();
}

int main() {

    int t;
    cin >> t;

    for (int i = 0; i < t; i++) {
        int n, k;
        cin >> n >> k;

        if (!n) {
            cout << 0 << endl;
            continue;
        }

        vector<int> nums;
        vector<int> freq;
        for (int i = 0; i < n; i++) {
            int x;
            cin >> x;

            bool x_found = false;

            for (int j = 0; j < nums.size(); j++) {
                if (nums[j] == x) {
                    freq[j]++;
                    x_found = true;
                    break;
                }
            }

            if (!x_found) {
                nums.push_back(x);
                freq.push_back(1);
            }
        }

        for (int i = 0; i < freq.size(); i++) {
            for (int j = 0; j < freq.size() - i - 1; j++) {
                if (freq[j] < freq[j+1]) {
                    freq[j] = freq[j+1] + freq[j] - (freq[j+1] = freq[j]);
                }
            }
        }

        int index = freq.size() - 1;
        while (k) {
            if (freq[index]) {
                freq[index]--;
                freq[0]++;
            } else {
                freq.pop_back();
                index--;
                freq[index]--;
                freq[0]++;
            }

            k--;
        }

        if (!freq[index]) {
            freq.pop_back();
            index--;
        }


        cout << freq.size() << endl;
    }

    return 0;
}
Problem: 2057B - Gorilla and the Exam
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>

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

    int t;
    std::cin >> t;

    while (t--) {
        int n, k;
        std::cin >> n >> k;

        std::vector<int> arr(n);
        for (int i = 0; i < n; i++) {
            std::cin >> arr[i];
        }

        std::sort(arr.begin(), arr.end());
        std::vector<int> frequencies = {0};

        for (int i = 0; i < n - 1; i++) {
            if (arr[i] != arr[i+1]) {
                frequencies.emplace_back(1);
            } else {
                frequencies.back()++;
            }
        }

        std::sort(frequencies.begin(), frequencies.end()); // Ascending
        int distinctCount = frequencies.size();

        for (int f : frequencies) {
            if (f <= k) {
                k -= f;
                distinctCount--;
            } else {
                break;
            }
        }

        std::cout << (distinctCount ? distinctCount : 1) << "\n";
    }

}

Submission (verdict: Accepted):
#include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>

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

    int t;
    std::cin >> t;

    while (t--) {
        int n, k;
        std::cin >> n >> k;

        std::vector<int> arr(n);
        for (int i = 0; i < n; i++) {
            std::cin >> arr[i];
        }

        std::sort(arr.begin(), arr.end());
        std::vector<int> frequencies = {1};

        for (int i = 0; i < n - 1; i++) {
            if (arr[i] != arr[i+1]) {
                frequencies.emplace_back(1);
            } else {
                frequencies.back()++;
            }
        }

        std::sort(frequencies.begin(), frequencies.end()); // Ascending
        int distinctCount = frequencies.size();

        for (int f : frequencies) {
            if (f <= k) {
                k -= f;
                distinctCount--;
            } else {
                break;
            }
        }

        std::cout << (distinctCount ? distinctCount : 1) << "\n";
    }

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


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



using namespace std;

#define lli long long int



void solve(){

	lli n, x, y;

	cin >> n >> x >> y;

	vector <lli> a1(n), a2(n);

	lli st = 1;

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

		a1[i] = st;

		st = 1-st;

	}

	st = 0;

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

		a2[i] = st;

		st = 1 -st;

	}

	if(n&1){

		a1[n-1] = 2;

		a2[n-1] = 2;

	}

	bool yes1 = false, yes2 = false;

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

		yes1 = true;

		goto label;

	}

	x--; y--;

	if(a1[x] == 1){

		a1[x] = 2;

		yes1 = true;

	}

	else if((a1[y] == 1)){

		a1[y] = 2;

		yes1 = true;

	}

	else if(a2[x] == 1){

		a2[x] = 2;

		yes2 = true;

	}

	else if(a2[y] == 1){

		a2[y] = 2;

		yes2 = true;

	}

	label:

	if(yes1){

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

			cout << a1[i] << " ";

		}

		cout << endl;

	}

	else{

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

			cout << a2[i] << " ";

		}

		cout << endl;

	}



}



#define lli long long int

int main(){

    ios_base::sync_with_stdio(false);

#ifndef ONLINE_JUDGE

	freopen("input.txt", "r", stdin);

	freopen("output.txt", "w", stdout);

#endif

	lli t;

	cin >> t;

	// t = 1;

	while(t--){

		solve();

	}

	

#ifndef ONLINE_JUDGE

    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";

#endif

	return 0;

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

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



using namespace std;

#define lli long long int



void solve(){

	lli n, x, y;

	cin >> n >> x >> y;

	vector <lli> a1(n), a2(n);

	lli st = 1;

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

		a1[i] = st;

		st = 1-st;

	}

	st = 0;

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

		a2[i] = st;

		st = 1 -st;

	}

	if(n&1){

		a1[n-1] = 2;

		a2[n-1] = 2;

	}

	bool yes1 = false, yes2 = false;

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

		yes1 = true;

		goto label;

	}

	x--; y--;

	if(a1[x] == 1 && !((n&1) && (x == 0))){

		a1[x] = 2;

		yes1 = true;

	}

	else if((a1[y] == 1) && !((n&1) && (y == (n-2)))){

		a1[y] = 2;

		yes1 = true;

	}

	else if(a2[x] == 1 && !((n&1) && (x == 0))){

		a2[x] = 2;

		yes2 = true;

	}

	else if((a2[y] == 1) && !((n&1) && (y == (n-2)))){

		a2[y] = 2;

		yes2 = true;

	}

	label:

	if(yes1){

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

			cout << a1[i] << " ";

		}

		cout << endl;

	}

	else{

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

			cout << a2[i] << " ";

		}

		cout << endl;

	}



}



#define lli long long int

int main(){

    ios_base::sync_with_stdio(false);

#ifndef ONLINE_JUDGE

	freopen("input.txt", "r", stdin);

	freopen("output.txt", "w", stdout);

#endif

	lli t;

	cin >> t;

	// t = 1;

	while(t--){

		solve();

	}

	

#ifndef ONLINE_JUDGE

    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";

#endif

	return 0;

}

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



using namespace std;

#define lli long long int



void solve(){

	lli n, x, y;

	cin >> n >> x >> y;

	vector <lli> a1(n), a2(n);

	lli st = 1;

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

		a1[i] = st;

		st = 1-st;

	}

	st = 0;

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

		a2[i] = st;

		st = 1 -st;

	}

	if(n&1){

		a1[n-1] = 2;

		a2[n-1] = 2;

	}

	bool yes1 = false, yes2 = false;

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

		yes1 = true;

		goto label;

	}

	x--; y--;

	if(a1[x] == 1 && !((n&1) && (x == 0))){

		a1[x] = 2;

		yes1 = true;

	}

	else if((a1[y] == 1) && !((n&1) && (y == (n-2)))){

		a1[y] = 2;

		yes1 = true;

	}

	else if(a2[x] == 1 && !((n&1) && (x == 0))){

		a2[x] = 2;

		yes2 = true;

	}

	else if((a2[y] == 1) && !((n&1) && (y == (n-2)))){

		a2[y] = 2;

		yes2 = true;

	}

	label:

	if(yes1){

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

			cout << a1[i] << " ";

		}

		cout << endl;

	}

	else{

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

			cout << a2[i] << " ";

		}

		cout << endl;

	}



}



#define lli long long int

int main(){

    ios_base::sync_with_stdio(false);

#ifndef ONLINE_JUDGE

	freopen("input.txt", "r", stdin);

	freopen("output.txt", "w", stdout);

#endif

	lli t;

	cin >> t;

	// t = 1;

	while(t--){

		solve();

	}

	

#ifndef ONLINE_JUDGE

    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";

#endif

	return 0;

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

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



using namespace std;

#define lli long long int



void solve(){

	lli n, x, y;

	cin >> n >> x >> y;

	vector <lli> a1(n), a2(n);

	lli st = 1;

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

		a1[i] = st;

		st = 1-st;

	}

	st = 0;

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

		a2[i] = st;

		st = 1 -st;

	}

	if(n&1){

		a1[n-1] = 2;

		a2[n-1] = 2;

	}

	bool yes1 = false, yes2 = false;

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

		yes1 = true;

		goto label;

	}

	x--; y--;

	if(a1[x] == 1){

		a1[x] = 2;

		yes1 = true;

	}

	else if((a1[y] == 1)){

		a1[y] = 2;

		yes1 = true;

	}

	else if(a2[x] == 1){

		a2[x] = 2;

		yes2 = true;

	}

	else if(a2[y] == 1){

		a2[y] = 2;

		yes2 = true;

	}

	label:

	if(yes1){

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

			cout << a1[i] << " ";

		}

		cout << endl;

	}

	else{

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

			cout << a2[i] << " ";

		}

		cout << endl;

	}



}



#define lli long long int

int main(){

    ios_base::sync_with_stdio(false);

#ifndef ONLINE_JUDGE

	freopen("input.txt", "r", stdin);

	freopen("output.txt", "w", stdout);

#endif

	lli t;

	cin >> t;

	// t = 1;

	while(t--){

		solve();

	}

	

#ifndef ONLINE_JUDGE

    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";

#endif

	return 0;

}

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



using namespace std;

#define lli long long int



void solve(){

	lli n, x, y;

	cin >> n >> x >> y;

	vector <lli> a1(n), a2(n);

	lli st = 1;

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

		a1[i] = st;

		st = 1-st;

	}

	st = 0;

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

		a2[i] = st;

		st = 1 -st;

	}

	if(n&1){

		a1[n-1] = 2;

		a2[n-1] = 2;

	}

	bool yes1 = false, yes2 = false;

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

		yes1 = true;

		goto label;

	}

	x--; y--;

	if(a1[x] == 1 && !((n&1) && (x == 0))){

		a1[x] = 2;

		yes1 = true;

	}

	else if((a1[y] == 1) && !((n&1) && (y == (n-2)))){

		a1[y] = 2;

		yes1 = true;

	}

	else if(a2[x] == 1 && !((n&1) && (x == 0))){

		a2[x] = 2;

		yes2 = true;

	}

	else if((a2[y] == 1) && !((n&1) && (y == (n-2)))){

		a2[y] = 2;

		yes2 = true;

	}

	label:

	if(yes1){

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

			cout << a1[i] << " ";

		}

		cout << endl;

	}

	else{

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

			cout << a2[i] << " ";

		}

		cout << endl;

	}



}



#define lli long long int

int main(){

    ios_base::sync_with_stdio(false);

#ifndef ONLINE_JUDGE

	freopen("input.txt", "r", stdin);

	freopen("output.txt", "w", stdout);

#endif

	lli t;

	cin >> t;

	// t = 1;

	while(t--){

		solve();

	}

	

#ifndef ONLINE_JUDGE

    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";

#endif

	return 0;

}