ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Runtime error on test 3):
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    ll t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        vector<ll>v;
        for(ll i=0 ; i<n ; i++){
            ll x;
            cin>>x;
            v.push_back(x);
        }
        vector<ll>summ;
        for(ll i=0 ; i<v.size() ; i++){
            ll sum=0;
            for(ll j=0 ; j<n ; j++){
                sum+=v[j];
            }
            if(i==0){
                summ.push_back(sum);
            }
            else{
                summ.push_back(abs(sum));
                
            }
            for(ll j=n-1 ; j>0 ; j--){
                v[j]=v[j]-v[j-1];
            }
            v[i]=0;
        }
        ll maxx=(ll)*max_element(summ.begin() , summ.end());
        cout<<maxx<<endl;
    }
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

void op1(vector<int>& v,int size){
    
    for(int i=1;i<size;i++){
        v[i-1]=v[i]-v[i-1];
    }
}

ll calc_sum(vector<int>& v,int size){
    ll sum=0;
    for(int i=0;i<size;i++){
        sum+=v[i];
    }
    return abs(sum);
}


void solve(){
    ll n;
    cin>>n;
    vector<int> v(n);
    ll ans=0;
    ll sum=0;
    for(int i=0;i<n;i++){
        cin>>v[i];
        sum+=v[i];
        
    }
    ans=sum;
    
    for(int i=0;i<n-1;i++){
        op1(v,n-i);
        ans=max(ans,calc_sum(v,n-i-1));
        
    }
    
    cout<<ans<<"\n";
    
}


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

}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    ll t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        vector<ll>v;
        for(ll i=0 ; i<n ; i++){
            ll x;
            cin>>x;
            v.push_back(x);
        }
        vector<ll>summ;
        for(ll i=0 ; i<n ; i++){
            ll sum=0;
            for(ll j=0 ; j<n ; j++){
                sum+=v[j];
            }
            if(i==0){
                summ.push_back(sum);
            }
            else{
                summ.push_back(abs(sum));
                
            }
            for(ll j=n ; j>0 ; j--){
                v[j]=v[j]-v[j-1];
            }
            v[i]=0;
        }
        ll maxx=(ll)*max_element(summ.begin() , summ.end());
        cout<<maxx<<endl;
    }
}

Submission (verdict: Runtime error on test 3):
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    ll t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        vector<ll>v;
        for(ll i=0 ; i<n ; i++){
            ll x;
            cin>>x;
            v.push_back(x);
        }
        vector<ll>summ;
        for(ll i=0 ; i<v.size() ; i++){
            ll sum=0;
            for(ll j=0 ; j<n ; j++){
                sum+=v[j];
            }
            if(i==0){
                summ.push_back(sum);
            }
            else{
                summ.push_back(abs(sum));
                
            }
            for(ll j=n-1 ; j>0 ; j--){
                v[j]=v[j]-v[j-1];
            }
            v[i]=0;
        }
        ll maxx=(ll)*max_element(summ.begin() , summ.end());
        cout<<maxx<<endl;
    }
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
    ll t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        vector<ll>v;
        for(ll i=0 ; i<n ; i++){
            ll x;
            cin>>x;
            v.push_back(x);
        }
        vector<ll>summ;
        for(ll i=0 ; i<n ; i++){
            ll sum=0;
            for(ll j=0 ; j<n ; j++){
                sum+=v[j];
            }
            if(i==0){
                summ.push_back(sum);
            }
            else{
                summ.push_back(abs(sum));
                
            }
            for(ll j=n ; j>0 ; j--){
                v[j]=v[j]-v[j-1];
            }
            v[i]=0;
        }
        ll maxx=(ll)*max_element(summ.begin() , summ.end());
        cout<<maxx<<endl;
    }
}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)

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



using namespace std;



int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    int t;

    cin>>t;

    for(int gt=0;gt<t;gt++){

        int n,k1=0,k2=0,s1=0,s2=0;

        cin>>n;

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

            int a;

            cin>>a;

            if(i%2==1){k1++;s1+=a;}

            else{k2++;s2+=a;}

        }

        if(s1%k1!=0 || s2%k2!=0){cout<<"NO"<<'\n';}

        else{cout<<"YES"<<'\n';}

    }

    return 0;

}



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



using namespace std;



int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    int t;

    cin>>t;

    for(int gt=0;gt<t;gt++){

        long long n,k1=0,k2=0,s1=0,s2=0;

        cin>>n;

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

            int a;

            cin>>a;

            if(i%2==1){k1++;s1+=a;}

            else{k2++;s2+=a;}

        }

        if(s1%k1!=0 || s2%k2!=0){cout<<"NO"<<'\n';}

        else if(s1/k1==s2/k2){cout<<"YES"<<'\n';}

        else{cout<<"NO"<<'\n';}

    }

    return 0;

}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)


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



using namespace std;



int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    int t;

    cin>>t;

    for(int gt=0;gt<t;gt++){

        int n,s=0;

        cin>>n;

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

            int a;

            cin>>a;

            s+=a;

        }

        if(s%2){cout<<"NO"<<'\n';}

        else{cout<<"YES"<<'\n';}

    }

    return 0;

}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)

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



using namespace std;



int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    int t;

    cin>>t;

    for(int gt=0;gt<t;gt++){

        int n,k1=0,k2=0,s1=0,s2=0;

        cin>>n;

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

            int a;

            cin>>a;

            if(i%2==1){k1++;s1+=a;}

            else{k2++;s2+=a;}

        }

        if(s1%k1!=0 || s2%k2!=0){cout<<"NO"<<'\n';}

        else if(s1/k1==s2/k2){cout<<"YES"<<'\n';}

        else{cout<<"NO"<<'\n';}

    }

    return 0;

}



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



using namespace std;



int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    int t;

    cin>>t;

    for(int gt=0;gt<t;gt++){

        int n,k1=0,k2=0,s1=0,s2=0;

        cin>>n;

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

            int a;

            cin>>a;

            if(i%2==1){k1++;s1+=a;}

            else{k2++;s2+=a;}

        }

        if(s1%k1!=0 || s2%k2!=0){cout<<"NO"<<'\n';}

        else{cout<<"YES"<<'\n';}

    }

    return 0;

}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)

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



using namespace std;



int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    int t;

    cin>>t;

    for(int gt=0;gt<t;gt++){

        int n,s=0;

        cin>>n;

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

            int a;

            cin>>a;

            s+=a;

        }

        if(s%2){cout<<"NO"<<'\n';}

        else{cout<<"YES"<<'\n';}

    }

    return 0;

}



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



using namespace std;



int main()

{

    ios_base::sync_with_stdio(0);

    cin.tie(0);

    cout.tie(0);

    int t;

    cin>>t;

    for(int gt=0;gt<t;gt++){

        int n,k1=0,k2=0,s1=0,s2=0;

        cin>>n;

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

            int a;

            cin>>a;

            if(i%2==1){k1++;s1+=a;}

            else{k2++;s2+=a;}

        }

        if(s1%k1!=0 || s2%k2!=0){cout<<"NO"<<'\n';}

        else if(s1/k1==s2/k2){cout<<"YES"<<'\n';}

        else{cout<<"NO"<<'\n';}

    }

    return 0;

}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

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

#define ll long long
#define all(x) x.begin(), x.end()
#define range(v, x) upper_bound(all(v), x) - lower_bound(all(v), x)
#define forn(i, n) for(int i = 0; i < n; i++)
#define int long long
#define pub push_back
#define pq priority_queue

#define X first
#define Y second 

using namespace std;

void solve() {
    int l, r; cin >> l >> r;
    int a = r, b = 0;
    for(int i = 63 - __builtin_clzll(a); i >= 0; i--) {
        if(!(a & (1LL << i)) and (b + (1LL << i)) >= l) {
            b += (1LL << i);
        }
    }
    for(int i = 0; i <= 63 - __builtin_clzll(a); i++) {
        if((b + (1LL << i)) < l) {
            b += (1LL << i);
        }
    }
    cout << a << " " << b  << " " << b << '\n';
}
 
signed main(){
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}


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

#define ll long long
#define all(x) x.begin(), x.end()
#define range(v, x) upper_bound(all(v), x) - lower_bound(all(v), x)
#define forn(i, n) for(int i = 0; i < n; i++)
#define int long long
#define pub push_back
#define pq priority_queue

#define X first
#define Y second 

using namespace std;

void solve() {
    int l, r; cin >> l >> r;
    int a, b, c;
    a = l | ((1LL << (31 - __builtin_clz(l ^ r))) - 1);
    b = l | (a + 1);
    cout << a << " " << b << " " << (b == r ? l : r) << '\n'; 
}
 
signed main(){
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

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

#define ll long long
#define all(x) x.begin(), x.end()
#define range(v, x) upper_bound(all(v), x) - lower_bound(all(v), x)
#define forn(i, n) for(int i = 0; i < n; i++)
#define int long long
#define pub push_back
#define pq priority_queue

#define X first
#define Y second 

using namespace std;

void solve() {
    int l, r; cin >> l >> r;
    int a, b, c;
    a = l | ((1LL << (31 - __builtin_clz(l ^ r))) - 1);
    b = l | (a + 1);
    cout << a << " " << b << " " << (b == r ? l : r) << '\n'; 
}
 
signed main(){
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}


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

#define ll long long
#define all(x) x.begin(), x.end()
#define range(v, x) upper_bound(all(v), x) - lower_bound(all(v), x)
#define forn(i, n) for(int i = 0; i < n; i++)
#define int long long
#define pub push_back
#define pq priority_queue

#define X first
#define Y second 

using namespace std;

void solve() {
    int l, r; cin >> l >> r;
    int a, b, c;
    a = l | ((1LL << (31 - __builtin_clz(l ^ r))) - 1);
    b = (a + 1);
    cout << a << " " << b << " " << (b == r ? l : r) << '\n'; 
}
 
signed main(){
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: Java 8


Submission (verdict: Wrong answer on test 1):
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {
        int t=1;
        Scanner sc = new Scanner(System.in);
        t=sc.nextInt();
        while(t-->0){
            int n=sc.nextInt();
            int[] arr=new int[n];
            int ans=0;
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
                ans+=arr[i];
            }

            while(n>0){
                ans=Math.max(ans,Math.abs(arr[n-1]-arr[0]));
                for (int i = 0; i < n-1; i++) {
                    arr[i]=arr[i+1]-arr[i];
                }
                n--;
            }
            System.out.println(ans);
        }
    }
}
Problem: 2062C - Cirno and Operations
Language: Java 8

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

public class Main {


    public static void main(String[] args) {
        int t=1;
        Scanner sc = new Scanner(System.in);
        t=sc.nextInt();
        while(t-->0){
            int n=sc.nextInt();
            int[] arr=new int[n];
            long ans=0;
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
                ans+=arr[i];
            }

            while(n>1){
                ans=Math.max(ans,Math.abs(arr[n-1]-arr[0]));
                for (int i = 0; i < n-1; i++) {
                    arr[i]=arr[i+1]-arr[i];
                }
                n--;
            }
            System.out.println(ans);
        }
    }
}


Submission (verdict: Accepted):
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {
        int t=1;
        Scanner sc = new Scanner(System.in);
        t=sc.nextInt();
        while(t-->0){
            int n=sc.nextInt();
            long[] arr=new long[n];
            long ans=0;
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
                ans+=arr[i];
            }

            while(n>1){
                ans=Math.max(ans,Math.abs(arr[n-1]-arr[0]));
                for (int i = 0; i < n-1; i++) {
                    arr[i]=arr[i+1]-arr[i];
                }
                n--;
            }
            System.out.println(ans);
        }
    }
}
Problem: 2062C - Cirno and Operations
Language: Java 8

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

public class Main {


    public static void main(String[] args) {
        int t=1;
        Scanner sc = new Scanner(System.in);
        t=sc.nextInt();
        while(t-->0){
            int n=sc.nextInt();
            int[] arr=new int[n];
            int ans=0;
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
                ans+=arr[i];
            }

            while(n>1){
                ans=Math.max(ans,Math.abs(arr[n-1]-arr[0]));
                for (int i = 0; i < n-1; i++) {
                    arr[i]=arr[i+1]-arr[i];
                }
                n--;
            }
            System.out.println(ans);
        }
    }
}


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

public class Main {


    public static void main(String[] args) {
        int t=1;
        Scanner sc = new Scanner(System.in);
        t=sc.nextInt();
        while(t-->0){
            int n=sc.nextInt();
            int[] arr=new int[n];
            long ans=0;
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
                ans+=arr[i];
            }

            while(n>1){
                ans=Math.max(ans,Math.abs(arr[n-1]-arr[0]));
                for (int i = 0; i < n-1; i++) {
                    arr[i]=arr[i+1]-arr[i];
                }
                n--;
            }
            System.out.println(ans);
        }
    }
}
Problem: 2062C - Cirno and Operations
Language: Java 8

Previous submission (verdict: Wrong answer on test 1):
import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {


    public static void main(String[] args) {
        int t=1;
        Scanner sc = new Scanner(System.in);
        t=sc.nextInt();
        while(t-->0){
            int n=sc.nextInt();
            int[] arr=new int[n];
            int ans=0;
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
                ans+=arr[i];
            }

            while(n>0){
                ans=Math.max(ans,Math.abs(arr[n-1]-arr[0]));
                for (int i = 0; i < n-1; i++) {
                    arr[i]=arr[i+1]-arr[i];
                }
                n--;
            }
            System.out.println(ans);
        }
    }
}


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

public class Main {


    public static void main(String[] args) {
        int t=1;
        Scanner sc = new Scanner(System.in);
        t=sc.nextInt();
        while(t-->0){
            int n=sc.nextInt();
            int[] arr=new int[n];
            int ans=0;
            for(int i=0;i<n;i++){
                arr[i]=sc.nextInt();
                ans+=arr[i];
            }

            while(n>1){
                ans=Math.max(ans,Math.abs(arr[n-1]-arr[0]));
                for (int i = 0; i < n-1; i++) {
                    arr[i]=arr[i+1]-arr[i];
                }
                n--;
            }
            System.out.println(ans);
        }
    }
}
Problem: 2049C - MEX Cycle
Language: C++17 (GCC 7-32)

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

#include <ctime>

#include <cstdlib>

#include <vector>

#include <algorithm>

#include <map>

#include <bitset>

#include <set>

using namespace std;



using ll = long long;

using ld = long double; 



int main() {

	ll t; 

	cin >> t; 

	for (ll o = 0; o < t; o++) {

		ll n, x, y;

		cin >> n >> x >> y; 

		vector<ll> ans; 

		ll otn; 

		y -= (x - 1); 

		if ((y - x) % 2 == 1) {

			for (ll i = 0; i < (n / 2) * 2; i++) {

				cout << i % 2 << " ";

			}

			if (n % 2 == 1) {

				cout << 2; 

			}

			cout << '\n'; 

			continue; 

		}

		for (ll i = 0; i < (y / 2) * 2; i++) {

			ans.push_back(i % 2);

		}

		if (y % 2 == 1) {

			ans.push_back(2); 

		}

		if ((n - y) % 2 == 0) {

			for (ll i = 0; i < n - y; i++) {

				ans.push_back(i % 2);

			}

		}

		else {

			for (ll i = 0; i < n - y; i++) {

				ans.push_back((i + 1) % 2); 

			}

		}

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

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

		}

		for (ll i = 0; i < n - x + 1; i++) {

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

		}

		cout << '\n'; 

	}

}

Submission (verdict: Wrong answer on test 1):
﻿#include <iostream>

#include <ctime>

#include <cstdlib>

#include <vector>

#include <algorithm>

#include <map>

#include <bitset>

#include <set>

using namespace std;



using ll = long long;

using ld = long double; 



int main() {

	ll t; 

	cin >> t; 

	for (ll o = 0; o < t; o++) {

		ll n, x, y;

		cin >> n >> x >> y; 

		vector<ll> ans; 

		ll otn; 

		y -= (x - 1); 

		if ((y - x) % 2 == 1) {

			for (ll i = 0; i < (n / 2) * 2; i++) {

				cout << i % 2 << " ";

			}

			if (n % 2 == 1) {

				cout << 2; 

			}

			cout << '\n'; 

			continue; 

		}

		for (ll i = 0; i < (y / 2) * 2; i++) {

			ans.push_back(i % 2);

		}

		if (y % 2 == 0) {

			ans.push_back(2); 

		}

		if ((n - y) % 2 == 0) {

			for (ll i = 0; i < n - y; i++) {

				ans.push_back(i % 2);

			}

		}

		else {

			for (ll i = 0; i < n - y; i++) {

				ans.push_back((i + 1) % 2); 

			}

		}

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

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

		}

		for (ll i = 0; i < n - x + 1; i++) {

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

		}

		cout << '\n'; 

	}

}
Problem: 2049C - MEX Cycle
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
﻿#include <iostream>

#include <ctime>

#include <cstdlib>

#include <vector>

#include <algorithm>

#include <map>

#include <bitset>

#include <set>

using namespace std;



using ll = long long;

using ld = long double; 



int main() {

	ll t; 

	cin >> t; 

	for (ll o = 0; o < t; o++) {

		ll n, x, y;

		cin >> n >> x >> y; 

		vector<ll> ans; 

		ll otn; 

		y -= (x - 1); 

		if ((y - x) % 2 == 1) {

			for (ll i = 0; i < (n / 2) * 2; i++) {

				cout << i % 2 << " ";

			}

			if (n % 2 == 1) {

				cout << 2; 

			}

			cout << '\n'; 

			continue; 

		}

		for (ll i = 0; i < (y / 2) * 2; i++) {

			ans.push_back(i % 2);

		}

		if (y % 2 == 1) {

			ans.push_back(2); 

		}

		if ((n - y) % 2 == 0) {

			for (ll i = 0; i < n - y; i++) {

				ans.push_back(i % 2);

			}

		}

		else {

			for (ll i = 0; i < n - y; i++) {

				ans.push_back((i + 1) % 2); 

			}

		}

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

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

		}

		for (ll i = 0; i < n - x + 1; i++) {

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

		}

		cout << '\n'; 

	}

}
Problem: 2049C - MEX Cycle
Language: C++17 (GCC 7-32)

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

#include <ctime>

#include <cstdlib>

#include <vector>

#include <algorithm>

#include <map>

#include <bitset>

#include <set>

using namespace std;



using ll = long long;

using ld = long double; 



int main() {

	ll t; 

	cin >> t; 

	for (ll o = 0; o < t; o++) {

		ll n, x, y;

		cin >> n >> x >> y; 

		vector<ll> ans; 

		ll otn; 

		y -= (x - 1); 

		if ((y - x) % 2 == 1) {

			for (ll i = 0; i < (n / 2) * 2; i++) {

				cout << i % 2 << " ";

			}

			if (n % 2 == 1) {

				cout << 2; 

			}

			cout << '\n'; 

			continue; 

		}

		for (ll i = 0; i < (y / 2) * 2; i++) {

			ans.push_back(i % 2);

		}

		if (y % 2 == 0) {

			ans.push_back(2); 

		}

		if ((n - y) % 2 == 0) {

			for (ll i = 0; i < n - y; i++) {

				ans.push_back(i % 2);

			}

		}

		else {

			for (ll i = 0; i < n - y; i++) {

				ans.push_back((i + 1) % 2); 

			}

		}

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

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

		}

		for (ll i = 0; i < n - x + 1; i++) {

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

		}

		cout << '\n'; 

	}

}

Submission (verdict: Accepted):
﻿#include <iostream>

#include <ctime>

#include <cstdlib>

#include <vector>

#include <algorithm>

#include <map>

#include <bitset>

#include <set>

using namespace std;



using ll = long long;

using ld = long double;



int main() {

	ll t;

	cin >> t;

	for (ll o = 0; o < t; o++) {

		ll n, x, y;

		cin >> n >> x >> y;

		vector<ll> ans;

		ll otn;

		if ((y - x) % 2 == 1) {

			for (ll i = 0; i < (n / 2) * 2; i++) {

				cout << i % 2 << " ";

			}

			if (n % 2 == 1) {

				cout << 2;

			}

			cout << '\n';

			continue;

		}

		y -= (x - 1);

		for (ll i = 0; i < (y / 2) * 2; i++) {

			ans.push_back(i % 2);

		}

		if (y % 2 == 1) {

			ans.push_back(2);

		}

		if ((n - y) % 2 == 0) {

			for (ll i = 0; i < n - y; i++) {

				ans.push_back(i % 2);

			}

		}

		else {

			for (ll i = 0; i < n - y; i++) {

				ans.push_back((i + 1) % 2);

			}

		}

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

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

		}

		for (ll i = 0; i < n - x + 1; i++) {

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

		}

		cout << '\n';

	}

}