ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)


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

#define fi first

#define se second

using pii = std::pair<int, int>;

using ll = long long;

using ul = unsigned long long;

using ld = long double;

constexpr int INF = 0x7FFFFFFF;

inline void solve() {

    std::string s;

    std::cin >> s;

    int n = s.size();

    std::vector<int> a(n + 1);

    for(int i = 1; i <= n; i++) a[i] = s[i - 1] - '0';

    int sum = 0, cnt3 = 0, cnt2 = 0;

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

        if(a[i] == 3) cnt3++;

        if(a[i] == 2) cnt2++;

        sum += a[i];

    }

    cnt3 %= 8, cnt2 %= 8;

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

        for(int j = 0; j <= cnt2; j++) {

            if((sum + i * 6 + j * 2) % 9 == 0) {

                std::cout << "YES\n";

                return;

            }

        }

    }

    std::cout << "NO\n";

}

signed main() {

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

	int t;

	std::cin >> t;

	while(t--) solve();

	return 0;

}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

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

#define fi first

#define se second

using pii = std::pair<int, int>;

using ll = long long;

using ul = unsigned long long;

using ld = long double;

constexpr int INF = 0x7FFFFFFF;

inline void solve() {

    std::string s;

    std::cin >> s;

    int n = s.size();

    std::vector<int> a(n + 1);

    for(int i = 1; i <= n; i++) a[i] = s[i - 1] - '0';

    int sum = 0, cnt3 = 0, cnt2 = 0;

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

        if(a[i] == 3) cnt3++;

        if(a[i] == 2) cnt2++;

        sum += a[i];

    }

    cnt3 %= 8, cnt2 %= 8;

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

        for(int j = 0; j <= cnt2; j++) {

            if((sum + i * 6 + j * 2) % 9 == 0) {

                std::cout << "YES\n";

                return;

            }

        }

    }

    std::cout << "NO\n";

}

signed main() {

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

	int t;

	std::cin >> t;

	while(t--) solve();

	return 0;

}



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

#define fi first

#define se second

using pii = std::pair<int, int>;

using ll = long long;

using ul = unsigned long long;

using ld = long double;

constexpr int INF = 0x7FFFFFFF;

inline void solve() {

    std::string s;

    std::cin >> s;

    int n = s.size();

    std::vector<int> a(n + 1);

    for(int i = 1; i <= n; i++) a[i] = s[i - 1] - '0';

    int sum = 0, cnt3 = 0, cnt2 = 0;

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

        if(a[i] == 3) cnt3++;

        if(a[i] == 2) cnt2++;

        sum += a[i];

    }

    cnt3 %= 9, cnt2 %= 9;

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

        for(int j = 0; j <= cnt2; j++) {

            if((sum + i * 6 + j * 2) % 9 == 0) {

                std::cout << "YES\n";

                return;

            }

        }

    }

    std::cout << "NO\n";

}

signed main() {

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

	int t;

	std::cin >> t;

	while(t--) solve();

	return 0;

}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

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

#define fi first

#define se second

using pii = std::pair<int, int>;

using ll = long long;

using ul = unsigned long long;

using ld = long double;

constexpr int INF = 0x7FFFFFFF;

inline void solve() {

    std::string s;

    std::cin >> s;

    int n = s.size();

    std::vector<int> a(n + 1);

    for(int i = 1; i <= n; i++) a[i] = s[i - 1] - '0';

    int sum = 0, cnt3 = 0, cnt2 = 0;

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

        if(a[i] == 3) cnt3++;

        if(a[i] == 2) cnt2++;

        sum += a[i];

    }

    cnt3 %= 20, cnt2 %= 20;

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

        for(int j = 0; j <= cnt2; j++) {

            if((sum + i * 6 + j * 2) % 9 == 0) {

                std::cout << "YES\n";

                return;

            }

        }

    }

    std::cout << "NO\n";

}

signed main() {

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

	int t;

	std::cin >> t;

	while(t--) solve();

	return 0;

}



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

#define fi first

#define se second

using pii = std::pair<int, int>;

using ll = long long;

using ul = unsigned long long;

using ld = long double;

constexpr int INF = 0x7FFFFFFF;

inline void solve() {

    std::string s;

    std::cin >> s;

    int n = s.size();

    std::vector<int> a(n + 1);

    for(int i = 1; i <= n; i++) a[i] = s[i - 1] - '0';

    int sum = 0, cnt3 = 0, cnt2 = 0;

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

        if(a[i] == 3) cnt3++;

        if(a[i] == 2) cnt2++;

        sum += a[i];

    }

    int x = std::min(cnt3 / 9, cnt2 / 9);

    cnt3 -= 9 * x, cnt2 -= 9 * x;

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

        for(int j = 0; j <= cnt2; j++) {

            if((sum + i * 6 + j * 2) % 9 == 0) {

                std::cout << "YES\n";

                return;

            }

        }

    }

    std::cout << "NO\n";

}

signed main() {

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

	int t;

	std::cin >> t;

	while(t--) solve();

	return 0;

}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

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

#define fi first

#define se second

using pii = std::pair<int, int>;

using ll = long long;

using ul = unsigned long long;

using ld = long double;

constexpr int INF = 0x7FFFFFFF;

inline void solve() {

    std::string s;

    std::cin >> s;

    int n = s.size();

    std::vector<int> a(n + 1);

    for(int i = 1; i <= n; i++) a[i] = s[i - 1] - '0';

    int sum = 0, cnt3 = 0, cnt2 = 0;

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

        if(a[i] == 3) cnt3++;

        if(a[i] == 2) cnt2++;

        sum += a[i];

    }

    int x = std::min(cnt3 / 9, cnt2 / 9);

    cnt3 -= 9 * x, cnt2 -= 9 * x;

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

        for(int j = 0; j <= cnt2; j++) {

            if((sum + i * 6 + j * 2) % 9 == 0) {

                std::cout << "YES\n";

                return;

            }

        }

    }

    std::cout << "NO\n";

}

signed main() {

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

	int t;

	std::cin >> t;

	while(t--) solve();

	return 0;

}



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

#define fi first

#define se second

using pii = std::pair<int, int>;

using ll = long long;

using ul = unsigned long long;

using ld = long double;

constexpr int INF = 0x7FFFFFFF;

inline void solve() {

    std::string s;

    std::cin >> s;

    int n = s.size();

    std::vector<int> a(n + 1);

    for(int i = 1; i <= n; i++) a[i] = s[i - 1] - '0';

    int sum = 0, cnt3 = 0, cnt2 = 0;

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

        if(a[i] == 3) cnt3++;

        if(a[i] == 2) cnt2++;

        sum += a[i];

    }

    cnt3 = std::min(9, cnt3), cnt2 = std::min(9, cnt2);

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

        for(int j = 0; j <= cnt2; j++) {

            if((sum + i * 6 + j * 2) % 9 == 0) {

                std::cout << "YES\n";

                return;

            }

        }

    }

    std::cout << "NO\n";

}

signed main() {

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

	int t;

	std::cin >> t;

	while(t--) solve();

	return 0;

}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


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

using namespace std;
const int N=5e5+10;
int a[N];

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
    
    int t;
    cin>>t;
    while(t--){
    	int n,res=0;
    	cin>>n;
    	for(int i=0;i<n;i++){
    		cin>>a[i];
    		res+=a[i];
		} 
    	
    	if(n==1) cout<<a[0]<<endl;
    	else {	
    		for(int j=0;j<n;j++){
    			for(int i=0;i<n-1-j;i++){
		   			a[i]=-a[i];
		   			a[i]+=a[i+1];
				}
			}
    			
			if(a[0]>=0){
				if(a[0]>res) cout<<a[0]<<endl;
				else cout<<res<<endl;
			} 
			else{
				if((-a[0])>res) cout<<-a[0]<<endl;
				else cout<<res<<endl;
			} 
		}
	}
	
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

using namespace std;
const int N=5e5+10;
ll a[N];

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
    
    int t;
    cin>>t;
    while(t--){
    	ll n,res=0,cnt;
    	cin>>n;
    	for(int i=0;i<n;i++) cin>>a[i],res+=a[i];
    	
    	if(n==1) cout<<a[0]<<endl;
    	else {	
    		for(int j=0;j<n-1;j++){
    			cnt=0;
    			for(int i=0;i<n-j;i++){
    				cnt+=a[i];
		   			a[i]=-a[i];
		   			a[i]+=a[i+1];
				}
				if(cnt<0) cnt=-cnt;
				if(cnt>res) res=cnt;
			}
    			
			if(a[0]>=0){
				if(a[0]>res) cout<<a[0]<<endl;
				else cout<<res<<endl;
			} 
			else{
				if((-a[0])>res) cout<<-a[0]<<endl;
				else cout<<res<<endl;
			} 
		}
	}
	
	return 0;
}


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

using namespace std;
const int N=5e5+10;
ll a[N];

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
    
    int t;
    cin>>t;
    while(t--){
    	ll n,res=0,cnt;
    	cin>>n;
    	for(int i=0;i<n;i++) cin>>a[i],res+=a[i];
    	
    	for(int i=1;i<n;i++){
    		cnt=0;
    		int m=n-i;
    		for(int j=0;j<m;j++){
    			a[j]=a[j+1]-a[j];
    			cnt+=a[j];
			}
			
			res=max(res,max(cnt,-cnt));
		}
		
		cout<<res<<endl;
	}
	
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

using namespace std;
const int N=5e5+10;
int a[N];

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
    
    int t;
    cin>>t;
    while(t--){
    	int n,res=0;
    	cin>>n;
    	for(int i=0;i<n;i++){
    		cin>>a[i];
    		res+=a[i];
		} 
    	
    	if(n==1) cout<<a[0]<<endl;
    	else {	
    		for(int j=0;j<n;j++){
    			for(int i=0;i<n-1-j;i++){
		   			a[i]=-a[i];
		   			a[i]+=a[i+1];
				}
			}
    			
			if(a[0]>=0){
				if(a[0]>res) cout<<a[0]<<endl;
				else cout<<res<<endl;
			} 
			else{
				if((-a[0])>res) cout<<-a[0]<<endl;
				else cout<<res<<endl;
			} 
		}
	}
	
	return 0;
}


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

using namespace std;
const int N=5e5+10;
ll a[N];

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
    
    int t;
    cin>>t;
    while(t--){
    	ll n,res=0;
    	cin>>n;
    	for(int i=0;i<n;i++){
    		cin>>a[i];
    		res+=a[i];
		} 
    	
    	if(n==1) cout<<a[0]<<endl;
    	else {	
    		for(int j=0;j<n;j++){
    			for(int i=0;i<n-1-j;i++){
		   			a[i]=-a[i];
		   			a[i]+=a[i+1];
				}
			}
    			
			if(a[0]>=0){
				if(a[0]>res) cout<<a[0]<<endl;
				else cout<<res<<endl;
			} 
			else{
				if((-a[0])>res) cout<<-a[0]<<endl;
				else cout<<res<<endl;
			} 
		}
	}
	
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

using namespace std;
const int N=5e5+10;
ll a[N];

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
    
    int t;
    cin>>t;
    while(t--){
    	ll n,res=0;
    	cin>>n;
    	for(int i=0;i<n;i++){
    		cin>>a[i];
    		res+=a[i];
		} 
    	
    	if(n==1) cout<<a[0]<<endl;
    	else {	
    		for(int j=0;j<n;j++){
    			for(int i=0;i<n-1-j;i++){
		   			a[i]=-a[i];
		   			a[i]+=a[i+1];
				}
			}
    			
			if(a[0]>=0){
				if(a[0]>res) cout<<a[0]<<endl;
				else cout<<res<<endl;
			} 
			else{
				if((-a[0])>res) cout<<-a[0]<<endl;
				else cout<<res<<endl;
			} 
		}
	}
	
	return 0;
}


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

using namespace std;
const int N=5e5+10;
ll a[N];

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
    
    int t;
    cin>>t;
    while(t--){
    	ll n,res=0,cnt;
    	cin>>n;
    	for(int i=0;i<n;i++) cin>>a[i],res+=a[i];
    	
    	if(n==1) cout<<a[0]<<endl;
    	else {	
    		for(int j=0;j<n-1;j++){
    			cnt=0;
    			for(int i=0;i<n-j;i++){
    				cnt+=a[i];
		   			a[i]=-a[i];
		   			a[i]+=a[i+1];
				}
				if(cnt>res) res=cnt;
			}
    			
			if(a[0]>=0){
				if(a[0]>res) cout<<a[0]<<endl;
				else cout<<res<<endl;
			} 
			else{
				if((-a[0])>res) cout<<-a[0]<<endl;
				else cout<<res<<endl;
			} 
		}
	}
	
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

using namespace std;
const int N=5e5+10;
ll a[N];

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
    
    int t;
    cin>>t;
    while(t--){
    	ll n,res=0,cnt;
    	cin>>n;
    	for(int i=0;i<n;i++) cin>>a[i],res+=a[i];
    	
    	if(n==1) cout<<a[0]<<endl;
    	else {	
    		for(int j=0;j<n-1;j++){
    			cnt=0;
    			for(int i=0;i<n-j;i++){
    				cnt+=a[i];
		   			a[i]=-a[i];
		   			a[i]+=a[i+1];
				}
				if(cnt>res) res=cnt;
			}
    			
			if(a[0]>=0){
				if(a[0]>res) cout<<a[0]<<endl;
				else cout<<res<<endl;
			} 
			else{
				if((-a[0])>res) cout<<-a[0]<<endl;
				else cout<<res<<endl;
			} 
		}
	}
	
	return 0;
}


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

using namespace std;
const int N=5e5+10;
ll a[N];

int main(){
    ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
    
    int t;
    cin>>t;
    while(t--){
    	ll n,res=0,cnt;
    	cin>>n;
    	for(int i=0;i<n;i++) cin>>a[i],res+=a[i];
    	
    	if(n==1) cout<<a[0]<<endl;
    	else {	
    		for(int j=0;j<n-1;j++){
    			cnt=0;
    			for(int i=0;i<n-j;i++){
    				cnt+=a[i];
		   			a[i]=-a[i];
		   			a[i]+=a[i+1];
				}
				if(cnt<0) cnt=-cnt;
				if(cnt>res) res=cnt;
			}
    			
			if(a[0]>=0){
				if(a[0]>res) cout<<a[0]<<endl;
				else cout<<res<<endl;
			} 
			else{
				if((-a[0])>res) cout<<-a[0]<<endl;
				else cout<<res<<endl;
			} 
		}
	}
	
	return 0;
}
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;



#define endl '\n'

#define int long long

#define PII std::pair<int,int>

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



using i64 = long long;

using i128 = __int128;

using u64 = unsigned long long;



constexpr int N = 2e6 + 5;

constexpr i64 INF = LLONG_MAX;

constexpr double eps = 1e-10;

constexpr int mod = 998244353;

constexpr int MOD = 1e9 + 7;



void Main()

{

    int n, x, y;

    cin >> n >> x >> y;

    if (abs(x - y) == 1) {

        int flag = 0, be = 1 + n % 2;

        cout << be << " \n"[n == 1];

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

            cout << flag << " \n"[i == n];

            flag ^= 1;

        }

        return;

    }

    vector<int> ans(n + 1);

    int flag = 0;

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

        ans[i] = flag;

        flag ^= 1;

    }

    if (n % 2 == 1) {

        ans[n] = 2;

    }

    if (ans[x] == ans[y]) {

        ans[y] = 2;

    }

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

        cout << ans[i] << " \n"[i == n];

    }

}



signed main()

{

    std::ios::sync_with_stdio(false);

    std::cin.tie(0), std::cout.tie(0);

    int T = 1;

    std::cin >> T;

    while (T--) {

        Main();

    }

    return 0;

}

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

using namespace std;



#define endl '\n'

#define int long long

#define PII std::pair<int,int>

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



using i64 = long long;

using i128 = __int128;

using u64 = unsigned long long;



constexpr int N = 2e6 + 5;

constexpr i64 INF = LLONG_MAX;

constexpr double eps = 1e-10;

constexpr int mod = 998244353;

constexpr int MOD = 1e9 + 7;



void Main()

{

    int n, x, y;

    cin >> n >> x >> y;

    x--, y--;

    vector<int> ans(n);

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

        ans[(x = i) % n] = i % 2;

    }

    if (n % 2 || !(x - y) & 1) {

        ans[x] = 2;

    }

    

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

        cout << ans[i] << " \n"[i == n - 1];

    }

}



signed main()

{

    std::ios::sync_with_stdio(false);

    std::cin.tie(0), std::cout.tie(0);

    int T = 1;

    std::cin >> T;

    while (T--) {

        Main();

    }

    return 0;

}
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;



#define endl '\n'

#define int long long

#define PII std::pair<int,int>

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



using i64 = long long;

using i128 = __int128;

using u64 = unsigned long long;



constexpr int N = 2e6 + 5;

constexpr i64 INF = LLONG_MAX;

constexpr double eps = 1e-10;

constexpr int mod = 998244353;

constexpr int MOD = 1e9 + 7;



void Main()

{

    int n, x, y;

    cin >> n >> x >> y;

    if (abs(x - y) == 1) {

        int flag = 0, be = 1 + n % 2;

        cout << be << " \n"[n == 1];

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

            cout << flag << " \n"[i == n];

            flag ^= 1;

        }

        return;

    }

    vector<int> ans(n + 1);

    int flag = 0;

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

        ans[i] = flag++;

        flag %= 3;

    }

    if (n % 3 == 1) {

        swap(ans[n], ans[n - 1]);

    }

    if (ans[x] == ans[y]) {

        ans[y] = 3;

    }

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

        cout << ans[i] << " \n"[i == n];

    }

}



signed main()

{

    std::ios::sync_with_stdio(false);

    std::cin.tie(0), std::cout.tie(0);

    int T = 1;

    std::cin >> T;

    while (T--) {

        Main();

    }

    return 0;

}

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

using namespace std;



#define endl '\n'

#define int long long

#define PII std::pair<int,int>

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



using i64 = long long;

using i128 = __int128;

using u64 = unsigned long long;



constexpr int N = 2e6 + 5;

constexpr i64 INF = LLONG_MAX;

constexpr double eps = 1e-10;

constexpr int mod = 998244353;

constexpr int MOD = 1e9 + 7;



void Main()

{

    int n, x, y;

    cin >> n >> x >> y;

    if (abs(x - y) == 1) {

        int flag = 0, be = 1 + n % 2;

        cout << be << " \n"[n == 1];

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

            cout << flag << " \n"[i == n];

            flag ^= 1;

        }

        return;

    }

    vector<int> ans(n + 1);

    int flag = 0;

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

        ans[i] = flag;

        flag ^= 1;

    }

    if (n % 2 == 1) {

        ans[n] = 2;

    }

    if (ans[x] == ans[y]) {

        ans[y] = 2;

    }

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

        cout << ans[i] << " \n"[i == n];

    }

}



signed main()

{

    std::ios::sync_with_stdio(false);

    std::cin.tie(0), std::cout.tie(0);

    int T = 1;

    std::cin >> T;

    while (T--) {

        Main();

    }

    return 0;

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


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

using namespace std;



#define endl '\n'

#define int long long

#define PII std::pair<int,int>

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



using i64 = long long;

using i128 = __int128;

using u64 = unsigned long long;



constexpr int N = 2e6 + 5;

constexpr i64 INF = LLONG_MAX;

constexpr double eps = 1e-10;

constexpr int mod = 998244353;

constexpr int MOD = 1e9 + 7;



void Main()

{

    int n, x, y;

    cin >> n >> x >> y;

    if (abs(x - y) == 1) {

        int flag = 0, be = 1 + n % 2;

        cout << be << " \n"[n == 1];

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

            cout << flag << " \n"[i == n];

            flag ^= 1;

        }

        return;

    }

    vector<int> ans(n + 1);

    int flag = 0;

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

        ans[i] = flag++;

        flag %= 3;

    }

    if (n % 3 == 1) {

        swap(ans[n], ans[n - 1]);

    }

    if (ans[x] == ans[y]) {

        ans[y] = 3;

    }

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

        cout << ans[i] << " \n"[i == n];

    }

}



signed main()

{

    std::ios::sync_with_stdio(false);

    std::cin.tie(0), std::cout.tie(0);

    int T = 1;

    std::cin >> T;

    while (T--) {

        Main();

    }

    return 0;

}
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;



#define endl '\n'

#define int long long

#define PII std::pair<int,int>

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



using i64 = long long;

using i128 = __int128;

using u64 = unsigned long long;



constexpr int N = 2e6 + 5;

constexpr i64 INF = LLONG_MAX;

constexpr double eps = 1e-10;

constexpr int mod = 998244353;

constexpr int MOD = 1e9 + 7;



void Main()

{

    int n, x, y;

    cin >> n >> x >> y;

    x--, y--;

    vector<int> ans(n);

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

        ans[(x = i) % n] = i % 2;

    }

    if (n % 2 || !(x - y) & 1) {

        ans[x] = 2;

    }

    

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

        cout << ans[i] << " \n"[i == n - 1];

    }

}



signed main()

{

    std::ios::sync_with_stdio(false);

    std::cin.tie(0), std::cout.tie(0);

    int T = 1;

    std::cin >> T;

    while (T--) {

        Main();

    }

    return 0;

}

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

using namespace std;



#define endl '\n'

#define int long long

#define PII std::pair<int,int>

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



using i64 = long long;

using i128 = __int128;

using u64 = unsigned long long;



constexpr int N = 2e6 + 5;

constexpr i64 INF = LLONG_MAX;

constexpr double eps = 1e-10;

constexpr int mod = 998244353;

constexpr int MOD = 1e9 + 7;



void Main()

{

    int n, x, y;

    cin >> n >> x >> y;

    x--, y--;

    vector<int> ans(n);

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

        ans[(x + i) % n] = i % 2;

    }

    if (n % 2 || !((x - y) & 1)) {

        ans[x] = 2;

    }

    

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

        cout << ans[i] << " \n"[i == n - 1];

    }

}



signed main()

{

    std::ios::sync_with_stdio(false);

    std::cin.tie(0), std::cout.tie(0);

    int T = 1;

    std::cin >> T;

    while (T--) {

        Main();

    }

    return 0;

}