ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define endl '\n';
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define char unsigned char

typedef long long ll;
typedef long double ld;

void solve() {
  int l, r;
  cin >> l >> r;
  ll x = l ^ r;
  ll xx = __builtin_clz(x);
  ll idx = 32 - xx - 1;
  ll y = 1 << (idx + 1);
  ll a, b, c;
  a = l & (~y);
  a = a | ((1 << idx) - 1);
  a = a & (~(1 << idx));
  b = l & (~y);
  b += 1 << idx;
  for (int i = l; i <= r; i++) {
    if (i != a && i != c) {
      c = i;
      break;
    }
  }
  cout << a << ' ' << b << ' ' << c << endl;
  return;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);

  int TET = 1;
  cin >> TET;

  while (TET--) {
    solve();
  }
}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define endl '\n';
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define char unsigned char

typedef long long ll;
typedef long double ld;

void solve() {
  int l, r;
  cin >> l >> r;
  int x = l ^ r;
  int idx = 31 - __builtin_clz(x);
  int a, b, c;
  a = l | ((1 << idx) - 1);
  b = a + 1;
  for (int i = l; i <= r; i++) {
    if (i != a && i != c) {
      c = i;
      break;
    }
  }

  cout << a << ' ' << b << ' ' << c << endl;
  return;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);

  int TET = 1;
  cin >> TET;

  while (TET--) {
    solve();
  }
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define endl '\n';
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define char unsigned char

typedef long long ll;
typedef long double ld;

void solve() {
  int l, r;
  cin >> l >> r;
  int x = l ^ r;
  int idx = 31 - __builtin_clz(x);
  int a, b, c;
  a = l | ((1 << idx) - 1);
  b = a + 1;
  for (int i = l; i <= r; i++) {
    if (i != a && i != b) {
      c = i;
      break;
    }
  }

  cout << a << ' ' << b << ' ' << c << endl;
  return;
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);

  int TET = 1;
  cin >> TET;

  while (TET--) {
    solve();
  }
}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

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

#include <functional>

#include <vector>

using namespace std;

#define pb push_back

#define fi first

#define se second

#define mp make_pair

#define endl '\n';

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

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

#define rall(x) (x).rbegin(), (x).rend()

#define char unsigned char



typedef long long ll;

typedef long double ld;



void solve() {

  ll n, l, r;

  cin >> n >> l >> r;

  l--, r--;

  vector<int> a(n);

  for (auto &i : a)

    cin >> i;

  multiset<int, greater<int>> mid;

  multiset<int> right, left;

  ll ans = 0;

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

    mid.insert(a[i]);

    ans += a[i];

  }

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

    left.insert(a[i]);

  }

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

    right.insert(a[i]);

  }

  ll val = ans;

  while (!mid.empty() && !left.empty()) {

    auto m = mid.begin();

    auto r = left.begin();

    if (*m > *r) {

      val -= (*m - *r);

      mid.erase(m);

      left.erase(r);

    } else {

      break;

    }

  }

  ans = min(ans, val);

  val = ans;

  while (!mid.empty() && !right.empty()) {

    auto m = mid.begin();

    auto l = right.begin();

    if (*m > *l) {

      val -= (*m - *l);

      mid.erase(m);

      right.erase(l);

    } else {

      break;

    }

  }

  ans = min(ans, val);

  cout << ans << endl;



  return;

}



int main() {

  ios::sync_with_stdio(0);

  cin.tie(0);



  int TET = 1;

  cin >> TET;



  while (TET--) {

    solve();

  }

}



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

#include <functional>

#include <vector>

using namespace std;

#define pb push_back

#define fi first

#define se second

#define mp make_pair

#define endl '\n';

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

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

#define rall(x) (x).rbegin(), (x).rend()

#define char unsigned char



typedef long long ll;

typedef long double ld;



void solve() {

  ll n, l, r;

  cin >> n >> l >> r;

  l--, r--;

  vector<int> a(n);

  for (auto &i : a)

    cin >> i;

  multiset<int, greater<int>> mid;

  multiset<int> right, left;

  ll ans = 0;

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

    mid.insert(a[i]);

    ans += a[i];

  }

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

    left.insert(a[i]);

  }

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

    right.insert(a[i]);

  }

  ll val = 0;

  while (!mid.empty() && !left.empty()) {

    auto m = mid.begin();

    auto l = left.begin();

    if (*m >= *l) {

      val = val - *m + *l;

      mid.erase(m);

      left.erase(l);

    } else {

      break;

    }

  }

  ans = min(ans, ans + val);

  val = 0;

  while (!mid.empty() && !right.empty()) {

    auto m = mid.begin();

    auto r = right.begin();

    if (*m >= *r) {

      val = val - *m + *r;

      mid.erase(m);

      right.erase(r);

    } else {

      break;

    }

  }

  ans = min(ans, ans + val);

  cout << ans << endl;



  return;

}



int main() {

  ios::sync_with_stdio(0);

  cin.tie(0);



  int TET = 1;

  cin >> TET;



  while (TET--) {

    solve();

  }

}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)


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

#include <functional>

#include <vector>

using namespace std;

#define pb push_back

#define fi first

#define se second

#define mp make_pair

#define endl '\n';

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

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

#define rall(x) (x).rbegin(), (x).rend()

#define char unsigned char



typedef long long ll;

typedef long double ld;



void solve() {

  ll n, l, r;

  cin >> n >> l >> r;

  l--, r--;

  vector<int> a(n);

  for (auto &i : a)

    cin >> i;

  multiset<int, greater<int>> mid;

  multiset<int> right, left;

  ll ans = 0;

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

    mid.insert(a[i]);

    ans += a[i];

  }

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

    left.insert(a[i]);

  }

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

    right.insert(a[i]);

  }

  ll val = ans;

  while (!mid.empty() && !left.empty()) {

    auto m = mid.begin();

    auto r = left.begin();

    if (*m > *r) {

      val -= (*m - *r);

      mid.erase(m);

      left.erase(r);

    } else {

      break;

    }

  }

  ans = min(ans, val);

  val = ans;

  while (!mid.empty() && !right.empty()) {

    auto m = mid.begin();

    auto l = right.begin();

    if (*m > *l) {

      val -= (*m - *l);

      mid.erase(m);

      right.erase(l);

    } else {

      break;

    }

  }

  ans = min(ans, val);

  cout << ans << endl;



  return;

}



int main() {

  ios::sync_with_stdio(0);

  cin.tie(0);



  int TET = 1;

  cin >> TET;



  while (TET--) {

    solve();

  }

}
Problem: 2050E - Three Strings
Language: C++23 (GCC 14-64, msys2)


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

//#include <vector>

//#include <algorithm>

#include <string>

//#include<queue>

//#include<map>



using namespace std;



bool is_good(string& a, string& b, string& c, int num_of_wild, int pos_a, int pos_b)

{

    if (pos_a + pos_b == c.length())

        return true;



    // можно ли добавить а

    if (pos_a < a.length() and c[pos_a + pos_b] == a[pos_a])

    {

        if (is_good(a, b, c, num_of_wild, pos_a + 1, pos_b))

            return true;

    }



    // можно ли добавить b

    if (pos_b < b.length() and c[pos_a + pos_b] == b[pos_b])

    {

        if (is_good(a, b, c, num_of_wild, pos_a, pos_b + 1))

            return true;

    }



    // можно ли добавить wild card

    if (num_of_wild > 0)

    {

        if (is_good(a, b, c, num_of_wild - 1, pos_a + 1, pos_b))

            return true;



        if (is_good(a, b, c, num_of_wild - 1, pos_a, pos_b + 1))

            return true;

    }



    return false;

}



void alg()

{

    string a, b, c;



    cin >> a >> b >> c;



    int start = 0;

    int end = c.length();



    if (is_good(a, b, c, start, 0, 0))

    {

        cout << 0 << endl;

        return;

    }



    while (end - start != 1)

    {

        int middle = (start + end) / 2;



        if (is_good(a, b, c, middle, 0, 0))

        {

            end = middle;

        }

        else

        {

            start = middle;

        }

    }



    cout << end << endl;

}



int main()

{

    int t;



    cin >> t;



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

        alg();



}
Problem: 2050E - Three Strings
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
#include<bits\stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;

#define endl '\n'
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define fo(i,a,b) for(i=a;i<=b;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define inp(a,n) vector <int> a(n); for(int i=0;i<n;i++) cin >> a[i];

typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;

const long long int mod=1e9 + 7;

string base_rep(ll n, ll b){  
    if(n==0) return "0";
    string res="";
    while(n>0){
        res+=char('0'+n%b);
        n=n/b;
    }
    reverse(all(res));
    return res;
}

void solve(){
    string a,b,c;
    cin>>a;
    cin>>b;
    cin>>c;

    int m=a.size();
    int n=b.size();
    int dp[n+1][m+1];
    fill(&dp[0][0], &dp[0][0] + (n + 1) * (m + 1), 1e9);
    dp[0][0]=0;
    for (int i = 0; i < n; i++) {
        dp[i + 1][0] = dp[i][0] + (a[i] != c[i]);
    }
    for (int j = 0; j < m; j++) {
        dp[0][j + 1] = dp[0][j] + (b[j] != c[j]);
    }
    for(int i=1; i<=n;++i){
        for(int j=1;j<=m;++j){
            dp[i][j]=min(dp[i-1][j]+(a[i-1]!=c[i+j-1]) , dp[i][j-1]+(b[j-1]!=c[i+j-1])) ;
        }
    }

    cout<<dp[m][n]<<endl;
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int test;
    cin>>test;
    for(int i=0;i<test;i++){
    solve();
    
}
}
Problem: 2050E - Three Strings
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include<bits\stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;

#define endl '\n'
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define fo(i,a,b) for(i=a;i<=b;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define inp(a,n) vector <int> a(n); for(int i=0;i<n;i++) cin >> a[i];

typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;

const long long int mod=1e9 + 7;

string base_rep(ll n, ll b){  
    if(n==0) return "0";
    string res="";
    while(n>0){
        res+=char('0'+n%b);
        n=n/b;
    }
    reverse(all(res));
    return res;
}

void solve(){
    string a,b,c;
    cin>>a;
    cin>>b;
    cin>>c;

    int m=a.size();
    int n=b.size();
    int dp[n+1][m+1];
    fill(&dp[0][0], &dp[0][0] + (n + 1) * (m + 1), 1e9);
    dp[0][0]=0;
    for (int i = 0; i < n; i++) {
        dp[i + 1][0] = dp[i][0] + (a[i] != c[i]);
    }
    for (int j = 0; j < m; j++) {
        dp[0][j + 1] = dp[0][j] + (b[j] != c[j]);
    }
    for(int i=1; i<=n;++i){
        for(int j=1;j<=m;++j){
            dp[i][j]=min(dp[i-1][j]+(a[i-1]!=c[i+j-1]) , dp[i][j-1]+(b[j-1]!=c[i+j-1])) ;
        }
    }

    cout<<dp[n][m]<<endl;
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int test;
    cin>>test;
    for(int i=0;i<test;i++){
    solve();
    
}
}

Submission (verdict: Accepted):
#include<bits\stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;

#define endl '\n'
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define fo(i,a,b) for(i=a;i<=b;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define inp(a,n) vector <int> a(n); for(int i=0;i<n;i++) cin >> a[i];

typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;

const long long int mod=1e9 + 7;

string base_rep(ll n, ll b){  
    if(n==0) return "0";
    string res="";
    while(n>0){
        res+=char('0'+n%b);
        n=n/b;
    }
    reverse(all(res));
    return res;
}

void solve(){
    string a,b,c;
    cin>>a;
    cin>>b;
    cin>>c;

    int n=a.size();
    int m=b.size();
    int dp[n+1][m+1];
    fill(&dp[0][0], &dp[0][0] + (n + 1) * (m + 1), 1e9);
    dp[0][0]=0;
    for (int i = 0; i < n; i++) {
        dp[i + 1][0] = dp[i][0] + (a[i] != c[i]);
    }
    for (int j = 0; j < m; j++) {
        dp[0][j + 1] = dp[0][j] + (b[j] != c[j]);
    }
    for(int i=1; i<=n;++i){
        for(int j=1;j<=m;++j){
            dp[i][j]=min(dp[i-1][j]+(a[i-1]!=c[i+j-1]) , dp[i][j-1]+(b[j-1]!=c[i+j-1])) ;
        }
    }

    cout<<dp[n][m]<<endl;
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int test;
    cin>>test;
    for(int i=0;i<test;i++){
    solve();
    
}
}
Problem: 2050E - Three Strings
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include<bits\stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;

#define endl '\n'
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define fo(i,a,b) for(i=a;i<=b;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define inp(a,n) vector <int> a(n); for(int i=0;i<n;i++) cin >> a[i];

typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;

const long long int mod=1e9 + 7;

string base_rep(ll n, ll b){  
    if(n==0) return "0";
    string res="";
    while(n>0){
        res+=char('0'+n%b);
        n=n/b;
    }
    reverse(all(res));
    return res;
}

void solve(){
    string a,b,c;
    cin>>a;
    cin>>b;
    cin>>c;

    int m=a.size();
    int n=b.size();
    int dp[n+1][m+1];
    fill(&dp[0][0], &dp[0][0] + (n + 1) * (m + 1), 1e9);
    dp[0][0]=0;
    for (int i = 0; i < n; i++) {
        dp[i + 1][0] = dp[i][0] + (a[i] != c[i]);
    }
    for (int j = 0; j < m; j++) {
        dp[0][j + 1] = dp[0][j] + (b[j] != c[j]);
    }
    for(int i=1; i<=n;++i){
        for(int j=1;j<=m;++j){
            dp[i][j]=min(dp[i-1][j]+(a[i-1]!=c[i+j-1]) , dp[i][j-1]+(b[j-1]!=c[i+j-1])) ;
        }
    }

    cout<<dp[m][n]<<endl;
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int test;
    cin>>test;
    for(int i=0;i<test;i++){
    solve();
    
}
}

Submission (verdict: Wrong answer on test 1):
#include<bits\stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
using namespace std;

#define endl '\n'
#define ll long long
#define lb lower_bound
#define ub upper_bound
#define fo(i,a,b) for(i=a;i<=b;i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define inp(a,n) vector <int> a(n); for(int i=0;i<n;i++) cin >> a[i];

typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;

const long long int mod=1e9 + 7;

string base_rep(ll n, ll b){  
    if(n==0) return "0";
    string res="";
    while(n>0){
        res+=char('0'+n%b);
        n=n/b;
    }
    reverse(all(res));
    return res;
}

void solve(){
    string a,b,c;
    cin>>a;
    cin>>b;
    cin>>c;

    int m=a.size();
    int n=b.size();
    int dp[n+1][m+1];
    fill(&dp[0][0], &dp[0][0] + (n + 1) * (m + 1), 1e9);
    dp[0][0]=0;
    for (int i = 0; i < n; i++) {
        dp[i + 1][0] = dp[i][0] + (a[i] != c[i]);
    }
    for (int j = 0; j < m; j++) {
        dp[0][j + 1] = dp[0][j] + (b[j] != c[j]);
    }
    for(int i=1; i<=n;++i){
        for(int j=1;j<=m;++j){
            dp[i][j]=min(dp[i-1][j]+(a[i-1]!=c[i+j-1]) , dp[i][j-1]+(b[j-1]!=c[i+j-1])) ;
        }
    }

    cout<<dp[n][m]<<endl;
}

int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int test;
    cin>>test;
    for(int i=0;i<test;i++){
    solve();
    
}
}
Problem: 2049C - MEX Cycle
Language: C++17 (GCC 7-32)


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

#define int long long

#define endl '\n'

using namespace std;



void solve() { 



    int n, x, y; cin >> n >> x >> y;



    if(n&1){

        if((x-y)&1){

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

                if(i == y+1) {

                    cout << 2 << " ";

                    i++;

                }

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

        else{

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

                if(i == y-1) {

                    cout << 2 << " ";

                    i++;

                }

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

    }

    else{

        if((x-y)&1){

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

                cout << (i&1 ? 0 : 1) << " ";

            }

        }

        else{

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

                if(i == y) cout << 2 << " ";

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

    }

    cout << endl;

}



signed main() {

    

    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);/**/

    #ifndef ONLINE_JUDGE 

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

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

    #endif

    

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

    //solve();



    return 0;

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

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

#define int long long

#define endl '\n'

using namespace std;



void solve() { 



    int n, x, y; cin >> n >> x >> y;



    if(n&1){

        if((x-y)&1){

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

                if(i == y+1) {

                    cout << 2 << " ";

                    i++;

                }

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

        else{

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

                if(i == y-1) {

                    cout << 2 << " ";

                    i++;

                }

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

    }

    else{

        if((x-y)&1){

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

                cout << (i&1 ? 0 : 1) << " ";

            }

        }

        else{

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

                if(i == y) cout << 2 << " ";

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

    }

    cout << endl;

}



signed main() {

    

    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);/**/

    #ifndef ONLINE_JUDGE 

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

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

    #endif

    

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

    //solve();



    return 0;

}

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

#define int long long

#define endl '\n'

using namespace std;



void solve() { 



    int n, x, y; cin >> n >> x >> y;



    if(n==3){

        cout << "0 1 2" << endl;

        return;

    }



    if(n&1){

        if((y-x)&1){

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

                if(i == y+1) {

                    cout << 2 << " ";

                    i++;

                }

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

        else{

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

                if(i == y-1) {

                    cout << 2 << " ";

                    i++;

                }

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

    }

    else{

        if((y-x)&1){

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

                cout << (i&1 ? 0 : 1) << " ";

            }

        }

        else{

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

                if(i == y) cout << 2 << " ";

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

    }

    cout << endl;

}



signed main() {

    

    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);/**/

    #ifndef ONLINE_JUDGE 

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

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

    #endif

    

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

    //solve();



    return 0;

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

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

#define int long long

#define endl '\n'

using namespace std;



void solve() { 



    int n, x, y; cin >> n >> x >> y;



    if(n==3){

        cout << "0 1 2" << endl;

        return;

    }



    if(n&1){

        if((y-x)&1){

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

                if(i == y+1) {

                    cout << 2 << " ";

                    i++;

                }

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

        else{

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

                if(i == y-1) {

                    cout << 2 << " ";

                    i++;

                }

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

    }

    else{

        if((y-x)&1){

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

                cout << (i&1 ? 0 : 1) << " ";

            }

        }

        else{

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

                if(i == y) cout << 2 << " ";

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

    }

    cout << endl;

}



signed main() {

    

    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);/**/

    #ifndef ONLINE_JUDGE 

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

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

    #endif

    

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

    //solve();



    return 0;

}

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

#define int long long

#define endl '\n'

using namespace std;



void solve() { 



    int n, x, y; cin >> n >> x >> y;



    if(n&1){

        if((y-x)&1){

            if(y+1 == n+1){

                cout << 2 << " ";

                for(int i=1; i<n; i++) cout << (i&1 ? 1 : 0) << " ";

            }

            else{

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

                    if(i == y+1) {

                        cout << 2 << " ";

                        i++;

                    }

                    else cout << (i&1 ? 0 : 1) << " ";

                }

            }

        }

        else{

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

                if(i == y-1) {

                    cout << 2 << " ";

                    i++;

                }

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

    }

    else{

        if((y-x)&1){

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

                cout << (i&1 ? 0 : 1) << " ";

            }

        }

        else{

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

                if(i == y) cout << 2 << " ";

                else cout << (i&1 ? 0 : 1) << " ";

            }

        }

    }

    cout << endl;

}



signed main() {

    

    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);/**/

    #ifndef ONLINE_JUDGE 

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

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

    #endif

    

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

    //solve();



    return 0;

}