ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
//
// Created by EDY on 25-2-6.
//
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
using i32 = int32_t;

void solve() {
    i64 maxs = numeric_limits<i64>::min();
    int n;
    cin >> n;
    if (n == 1) {
        int x;
        cin >> x;
        cout << x << endl;
    } else {
        vector<i64> v(n);
        int now = n;
        for (int i = 0; i <= n - 1; i++) {
            cin >> v[i];
        }
        while (now > 1) {
            i64 sum = 0;
            for (int i = 0; i <= now - 1; i++) {
                sum += v[i];
            }
            maxs = max(maxs, abs(sum));
            now = now - 1;
            for (int i = 0; i <= now - 1; i++) {
                v[i] = v[i + 1] - v[i];
            }
        }
        maxs = max(maxs, abs(v[0]));
        cout << maxs << endl;
    }
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    freopen("input.txt", "r", stdin);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
//
// Created by EDY on 25-2-6.
//
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
using i32 = int32_t;

void solve() {
    i64 maxs = numeric_limits<i64>::min();
    int n;
    cin >> n;
    if (n == 1) {
        int x;
        cin >> x;
        cout << x << endl;
    } else {
        vector<i64> v(n);
        int now = n;
        for (int i = 0; i <= n - 1; i++) {
            cin >> v[i];
        }
        while (now > 1) {
            i64 sum = 0;
            for (int i = 0; i <= now - 1; i++) {
                sum += v[i];
            }
            maxs = max(maxs, abs(sum));
            now = now - 1;
            for (int i = 0; i <= now - 1; i++) {
                v[i] = v[i + 1] - v[i];
            }
        }
        maxs = max(maxs, abs(v[0]));
        cout << maxs << endl;
    }
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    freopen("input.txt", "r", stdin);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}


Submission (verdict: Wrong answer on test 2):
//
// Created by EDY on 25-2-6.
//
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
using i32 = int32_t;

void solve() {
    i64 maxs = numeric_limits<i64>::min();
    int n;
    cin >> n;
    if (n == 1) {
        int x;
        cin >> x;
        cout << x << endl;
    } else {
        vector<i64> v(n);
        int now = n;
        for (int i = 0; i <= n - 1; i++) {
            cin >> v[i];
        }
        while (now > 1) {
            i64 sum = 0;
            for (int i = 0; i <= now - 1; i++) {
                sum += v[i];
            }
            maxs = max(maxs, abs(sum));
            now = now - 1;
            for (int i = 0; i <= now - 1; i++) {
                v[i] = v[i + 1] - v[i];
            }
        }
        maxs = max(maxs, abs(v[0]));
        cout << maxs << endl;
    }
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
//
// Created by EDY on 25-2-6.
//
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
using i32 = int32_t;

void solve() {

    int n;
    cin >> n;
    if (n == 1) {
        int x;
        cin >> x;
        cout << x << endl;
    } else {
        vector<i64> v(n);
        i64 maxs = numeric_limits<i64>::min();
        int now = n;
        for (int i = 0; i <= n - 1; i++) {
            cin >> v[i];
        }
        i64 sums = 0;
        for (int i = n - 1; i >= 0; i--) {
            sums += v[i];
        }
        // cout << sums << endl;
        maxs = max(maxs, sums);
        while (now > 1) {
            now = now - 1;
            for (int i = 0; i <= now - 1; i++) {
                v[i] = v[i + 1] - v[i];
            }
            i64 sum = 0;
            for (int i = 0; i <= now - 1; i++) {
                sum += v[i];
            }
            maxs = max(maxs, abs(sum));
        }
        cout << maxs << endl;
    }
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    freopen("input.txt", "r", stdin);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}


Submission (verdict: Accepted):
//
// Created by EDY on 25-2-6.
//
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
using i32 = int32_t;

void solve() {

    int n;
    cin >> n;
    if (n == 1) {
        int x;
        cin >> x;
        cout << x << endl;
    } else {
        vector<i64> v(n);
        i64 maxs = numeric_limits<i64>::min();
        int now = n;
        for (int i = 0; i <= n - 1; i++) {
            cin >> v[i];
        }
        i64 sums = 0;
        for (int i = n - 1; i >= 0; i--) {
            sums += v[i];
        }
        // cout << sums << endl;
        maxs = max(maxs, sums);
        while (now > 1) {
            now = now - 1;
            for (int i = 0; i <= now - 1; i++) {
                v[i] = v[i + 1] - v[i];
            }
            i64 sum = 0;
            for (int i = 0; i <= now - 1; i++) {
                sum += v[i];
            }
            maxs = max(maxs, abs(sum));
        }
        cout << maxs << endl;
    }
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}
Problem: 2063C - Remove Exactly Two
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define _11037_ ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define endl '\n'
#define MAX 200005
const int MOD = 998244353;
int N, u, v, T, ans, connect, num[MAX], infile[MAX];
set<int> node[MAX];
bool MyCompare(int x1, int x2)
{
    return infile[x2] < infile[x1];
}
signed main()
{
    _11037_
    cin >> T;
    while (T--)
    {
        cin >> N;
        ans = 0, connect = 1;
        for (int i = 1; i <= N; i++)
            node[i].clear(), num[i] = i, infile[i] = 0;
        for (int i = 1; i <= N - 1; i++)
        {
            cin >> u >> v, node[u].insert(v), node[v].insert(u);
            infile[u]++, infile[v]++;
        }
        sort(num + 1, num + 1 + N, MyCompare);
        for (int i = 2; connect && infile[num[i]] == infile[num[2]] && i <= N; i++)
            if (!node[num[1]].count(num[i]))
                connect = 0;
        cout << infile[num[1]] + infile[num[2]] - 1 - connect << endl;
    }
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define _11037_ ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define endl '\n'
#define MAX 200005
const int MOD = 998244353;
int N, u, v, T, ans, connect, num[MAX], infile[MAX];
set<int> node[MAX];
bool MyCompare(int x1, int x2)
{
    return infile[x2] < infile[x1];
}
signed main()
{
    _11037_
    cin >> T;
    while (T--)
    {
        cin >> N;
        ans = 0, connect = 1;
        for (int i = 1; i <= N; i++)
            node[i].clear(), num[i] = i, infile[i] = 0;
        for (int i = 1; i <= N - 1; i++)
        {
            cin >> u >> v, node[u].insert(v), node[v].insert(u);
            infile[u]++, infile[v]++;
        }
        sort(num + 1, num + 1 + N, MyCompare);
        for (int i = 1; connect && infile[num[i]] == infile[num[1]] && i <= N; i++)
            if (i == 3)
                connect = 0;
        for (int i = 2; connect && infile[num[i]] == infile[num[2]] && i <= N; i++)
            if (!node[num[1]].count(num[i]))
                connect = 0;
        cout << infile[num[1]] + infile[num[2]] - 1 - connect << endl;
    }
}
Problem: 2063C - Remove Exactly Two
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define _11037_ ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define endl '\n'
#define MAX 200005
const int MOD = 998244353;
int N, u, v, T, Ans;
vector<int> node[MAX];
signed main()
{
    _11037_
    cin >> T;
    while (T--)
    {
        cin >> N;
        Ans = 0;
        for (int i = 1; i <= N; i++)
            node[i].clear();
        for (int i = 1; i <= N - 1; i++)
            cin >> u >> v, node[u].push_back(v), node[v].push_back(u);
        if (N == 2)
        {
            cout << 0 << endl;
            continue;
        }
        for (int i = 1; i <= N; i++)
        {
            for (int j = i + 1; j <= N; j++)
            {
                int cnt1 = 0, cnt2 = 0, ans = 0;
                for (auto nxt : node[i])
                    if (nxt != j)
                        cnt1++;
                cnt1 -= cnt1 > 0;
                for (auto nxt : node[j])
                    if (nxt != i)
                        cnt2++;
                cnt2 -= cnt2 > 0;
                ans = cnt1 + cnt2 + 1;
                Ans = max(Ans, ans);
            }
        }
        cout << Ans << endl;
    }
}
Problem: 2063C - Remove Exactly Two
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define _11037_ ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define endl '\n'
#define MAX 200005
const int MOD = 998244353;
int N, u, v, T, Ans;
vector<int> node[MAX];
signed main()
{
    _11037_
    cin >> T;
    while (T--)
    {
        cin >> N;
        Ans = 0;
        for (int i = 1; i <= N; i++)
            node[i].clear();
        for (int i = 1; i <= N - 1; i++)
            cin >> u >> v, node[u].push_back(v), node[v].push_back(u);
        if (N == 2)
        {
            cout << 0 << endl;
            continue;
        }
        for (int i = 1; i <= N; i++)
        {
            for (int j = i + 1; j <= N; j++)
            {
                int cnt1 = 0, cnt2 = 0, ans = 0;
                for (auto nxt : node[i])
                    if (nxt != j)
                        cnt1++;
                cnt1 -= cnt1 > 0;
                for (auto nxt : node[j])
                    if (nxt != i)
                        cnt2++;
                cnt2 -= cnt2 > 0;
                ans = cnt1 + cnt2 + 1;
                Ans = max(Ans, ans);
            }
        }
        cout << Ans << endl;
    }
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define _11037_ ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define endl '\n'
#define MAX 200005
const int MOD = 998244353;
int N, u, v, T, ans, connect, num[MAX], infile[MAX];
set<int> node[MAX];
bool MyCompare(int x1, int x2)
{
    return infile[x2] < infile[x1];
}
signed main()
{
    _11037_
    cin >> T;
    while (T--)
    {
        cin >> N;
        ans = 0, connect = 1;
        for (int i = 1; i <= N; i++)
            node[i].clear(), num[i] = i, infile[i] = 0;
        for (int i = 1; i <= N - 1; i++)
        {
            cin >> u >> v, node[u].insert(v), node[v].insert(u);
            infile[u]++, infile[v]++;
        }
        sort(num + 1, num + 1 + N, MyCompare);
        for (int i = 2; connect && infile[num[i]] == infile[num[2]] && i <= N; i++)
            if (!node[num[1]].count(num[i]))
                connect = 0;
        cout << infile[num[1]] + infile[num[2]] - 1 - connect << endl;
    }
}
Problem: 2050E - Three Strings
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#define int long long
#define endl "\n"
#define pii pair <int, int>
#define fi first
#define se second

using namespace std;
const int N = 1e3 + 5;
const int inf = 1e18;
const int mod = 1e9 + 7;

int t;
int dp[N][N];
string a, b, c;

void solve()
{
    memset(dp, 0, sizeof(dp));

    cin >> a >> b >> c;

    a = ' ' + a;
    b = ' ' + b;
    c = ' ' + c;

    for(int i = 0; i < a.size(); i++){
        for(int j = 0; j < b.size(); j++){
            if(i == 0 && j == 0)
                continue;
            if(i == 0){
                if(b[j] == c[i + j])
                    dp[i][j] = dp[i][j - 1] + 1;
//                cout << i << " " << j << endl;
//                cout << a[i] << " " << b[j] << " " << c[i + j] << " " << dp[i][j] << endl;
                continue;
            }
            if(j == 0){
                if(a[i] == c[i + j])
                    dp[i][j] = dp[i - 1][j] + 1;
//                cout << i << " " << j << endl;
//                cout << a[i] << " " << b[j] << " " << c[i + j] << " " << dp[i][j] << endl;
                continue;
            }
            if(a[i] == c[i + j])
                dp[i][j] = max(dp[i][j], dp[i - 1][j] + 1);
            if(b[j] == c[i + j])
                dp[i][j] = max(dp[i][j], dp[i][j - 1] + 1);
            dp[i][j] = max({dp[i][j], dp[i - 1][j], dp[i][j - 1]});
//            cout << i << " " << j << endl;
//            cout << a[i] << " " << b[j] << " " << c[i + j] << " " << dp[i][j] << endl;
        }
    }

    cout << a.size() + b.size() - 2 - dp[a.size() - 1][b.size() - 1] << endl;
}

signed main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
//	freopen("E.inp", "r", stdin);
//	freopen("E.out", "w", stdout);

	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 2):
#include <bits/stdc++.h>
#define int long long
using namespace std;

int32_t main()
{
    int t;
    cin >> t;
    while(t--)
    {
        int l,r;
        cin >> l >> r;
        int atual = 1;
        int rep = 0;
        while(atual*2 <= r)
        {
            atual *= 2;
            rep++;
        }
        if(atual == r)
        {
            cout << atual << " " << atual -1 << " "  << atual -2 << "\n";
            continue;
        }
        rep--;
        while(atual <= l)
        {
            if(atual + pow(2,rep) < r)
            atual += pow(2,rep);
            rep--;
        }
          cout << atual - 1 << " " << atual  << " "  << atual +1 << "\n";
          #
    }
}


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

int32_t main()
{
    int t;
    cin >> t;
    while(t--)
    {
        int l,r;
        cin >> l >> r;
        int atual = 1;
        int rep = 0;
        while(atual*2 <= r)
        {
            atual *= 2;
            rep++;
        }
        if(atual == r)
        {
            cout << atual << " " << atual -1 << " "  << atual -2 << "\n";
            continue;
        }
        rep--;
        while(atual <= l)
        {
            if(atual + pow(2,rep) <= r)
            atual += pow(2,rep);
            rep--;
        }
        if(atual == r)
        {
            cout << atual << " " << atual -1 << " "  << atual -2 << "\n";
            continue;
        }
          cout << atual - 1 << " " << atual  << " "  << atual +1 << "\n";
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

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

int32_t main()
{
    int t;
    cin >> t;
    while(t--)
    {
        int l,r;
        cin >> l >> r;
        int atual = 1;
        int rep = 0;
        while(atual*2 <= r)
        {
            atual *= 2;
            rep++;
        }
        if(atual == r)
        {
            cout << atual << " " << atual -1 << " "  << atual -2 << "\n";
            continue;
        }
        rep--;
        while(atual <= l)
        {
            if(atual + pow(2,rep) < r)
            atual += pow(2,rep);
            rep--;
        }
          cout << atual - 1 << " " << atual  << " "  << atual +1 << "\n";
    }
}


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

int32_t main()
{
    int t;
    cin >> t;
    while(t--)
    {
        int l,r;
        cin >> l >> r;
        int atual = 1;
        int rep = 0;
        while(atual*2 <= r)
        {
            atual *= 2;
            rep++;
        }
        if(atual == r)
        {
            cout << atual << " " << atual -1 << " "  << atual -2 << "\n";
            continue;
        }
        rep--;
        while(atual <= l)
        {
            if(atual + pow(2,rep) < r)
            atual += pow(2,rep);
            rep--;
        }
          cout << atual - 1 << " " << atual  << " "  << atual +1 << "\n";
          #
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)


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

int32_t main()
{
    int t;
    cin >> t;
    while(t--)
    {
        int l,r;
        cin >> l >> r;
        int atual = 1;
        int rep = 0;
        while(atual*2 <= r)
        {
            atual *= 2;
            rep++;
        }
        if(atual == r)
        {
            cout << atual << " " << atual -1 << " "  << atual -2 << "\n";
            continue;
        }
        rep--;
        while(atual <= l)
        {
            if(atual + pow(2,rep) < r)
            atual += pow(2,rep);
            rep--;
        }
          cout << atual - 1 << " " << atual  << " "  << atual +1 << "\n";
    }
}
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 int long long

#define pii pair<int,int>

#define tt tuple<int,int,int>

#define NMAX 15

#define MOD 1000000007

#define INF 1000000000000000000

#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);





int32_t main() { faster

    int t;

    cin>>t;



    while(t--) {

        int n, a, b;

        cin>>n>>a>>b;



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

            if(i == a && a % 2 == b % 2) cout<<"2 ";

            else cout<<i%2<<" ";

        }

        cout<<"\n";

    }

}



/*



*/

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

using namespace std;

#define int long long

#define pii pair<int,int>

#define tt tuple<int,int,int>

#define NMAX 105

#define MOD 1000000007

#define INF 1000000000000000000

#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);





int32_t main() { faster

    int t;

    cin>>t;



    while(t--) {

        int n, a, b;

        cin>>n>>a>>b;



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

            if(i == a && a % 2 == b % 2) cout<<"2 ";

            else cout<<i%2<<" ";

        }

        cout<<"\n";

    }

}



/*



*/
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 int long long

#define pii pair<int,int>

#define tt tuple<int,int,int>

#define NMAX 105

#define MOD 1000000007

#define INF 1000000000000000000

#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);





int32_t main() { faster

    int t;

    cin>>t;



    while(t--) {

        int n, a, b;

        cin>>n>>a>>b;



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

            if(i == a && a % 2 == b % 2) cout<<"2 ";

            else cout<<i%2<<" ";

        }

        cout<<"\n";

    }

}



/*



*/

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

using namespace std;

#define int long long

#define pii pair<int,int>

#define tt tuple<int,int,int>

#define NMAX 200005

#define MOD 1000000007

#define INF 1000000000000000000

#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);



int arr[NMAX];



int32_t main() { faster

    int t;

    cin>>t;



    while(t--) {

        int n, a, b;

        cin>>n>>a>>b;



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

            arr[i] = i % 2;

            if(n % 2 && i == n) arr[i] = 2;

        }

        if(arr[a] == arr[b]) {

            arr[a] = 2;

            if(a == 1 && n % 2) {

                arr[n]--;

            }

            if(a == 2 && n % 2) {

                arr[1]--; arr[n]--;

            }

        }

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

            cout<<arr[i]<<" ";

        }

        cout<<"\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 int long long

#define pii pair<int,int>

#define tt tuple<int,int,int>

#define NMAX 15

#define MOD 1000000007

#define INF 1000000000000000000

#define faster ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);





int32_t main() { faster

    int t;

    cin>>t;



    while(t--) {

        int n, a, b;

        cin>>n>>a>>b;



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

            if(i == a && a % 2 == b % 2) cout<<"2 ";

            else cout<<i%2<<" ";

        }

        cout<<"\n";

    }

}



/*



*/
Problem: 2049C - MEX Cycle
Language: C++23 (GCC 14-64, msys2)

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

using namespace std;

const int N = 2e5+7;

int a[N];

int main(){

	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	int T;

	cin>>T;

	while(T--){

		int n,x,y;

		cin>>n>>x>>y;

		int m=y-x;

		if (n%2==0){

			if (m%2){

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

					if (i%2) a[i]=0;

					else a[i]=1;

				}

			} 

			else{

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

					if (i%2) a[i]=0;

					else a[i]=1;

				}

				a[x]=2;

			}

		}

		else{

			if (m%2){

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

					if (i%2) a[i]=0;

					else a[i]=1;

				}

				a[n]=2;

			}

			else{

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

					if (i%2) a[i]=0;

					else a[i]=1;

				}

				a[n]=2;

				a[x]=2;

			}

		}

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

			cout<<a[i]<<" ";

		cout<<"\n";

	}

	return 0;

} 

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

using namespace std;

const int N = 2e5+7;

int a[N];

int main(){

	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);

	int T;

	cin>>T;

	while(T--){

		int n,x,y;

		cin>>n>>x>>y;

		int m=y-x,flag=0;

		if (n%2==0){

			if (m%2){

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

			} 

			else{

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

				a[y]=2;

			}

		}

		else{

			if (m%2){

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

				a[x-1]=2;

			}

			else{

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

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

					a[i]=flag;

					if (flag==0) flag=1;

					else flag=0;

				}

				a[x-1]=2;

				a[y]=2;

			}

		}

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

			cout<<a[i]<<" ";

		cout<<"\n";

	}

	return 0;

}