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

Previous submission (verdict: Compilation error):
#include <bits/stdc++.h>

using namespace std;



#ifndef ONLINE_JUDGE

#include <D:/deb.hpp>

#else

#define p(...);

#define Case(x);

#define bl ;

#endif

#define int long long



#define pb push_back

#define ff first

#define ss second

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

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

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



#ifdef ONLINE_JUDGE

#define STATER

#else

#define STATER freopen("E.txt", "w", stderr);

#endif



#define TCS(x) ios::sync_with_stdio(0);cin.tie(0); \

int t = 0; if (!x)cin >> t; else t = x; for (int i = 1; i <= t; i++){Case(i); solve(); bl}

template<class...T> void _i_(T &...s) {

	(void)initializer_list<int> {(cin >> s, 0)...};

}

#define in(...) int __VA_ARGS__;_i_(__VA_ARGS__)

#define chr(...) char __VA_ARGS__; _i_(__VA_ARGS__)

#define str(...) string __VA_ARGS__; _i_(__VA_ARGS__)

#define vec(T,v,n) vector<T> v(n); for (auto &x : v) cin >> x

#define vp(S,T,v,n) vector<pair<S,T>>v(n); for(auto & x : v) cin >> x.first >> x.second

#define vvec(T,v,n,m) vector<vector<T>>v(n, vector<T>(m)); for (auto &i : v)for (auto &j : i)cin >> j



auto solve() {

	in(n, x, y);

	map<int, vector<int>>mp;

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

		int left = (i - 1 + n) % n, right = (i + 1) % n;

		mp[i] = {left, right};

		if (x == i + 1)mp[i].pb(y - 1);

		if (y == i + 1)mp[i].pb(x - 1);

	}

	vector<int> ans(n, 0);

	for (auto &i : mp) {

		vector<bool> seen(n + 1, false);

		for (auto &j : i.ss)

			seen[ans[j]] = 1;

		int mex = 0;

		while (seen[mex])mex++;

		ans[i.ff] = mex;

	}

	for (auto &i : ans)

		cout << i << ' ';

	cout << endl;

}

signed main() {

	STATER;

	TCS(0);

}





	}

	for (auto &i : ans)

		cout << i << ' ';

	cout << endl;

}

signed main() {

	STATER;

	TCS(0);

}





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

using namespace std;



#ifndef ONLINE_JUDGE

#include <D:/deb.hpp>

#else

#define p(...);

#define Case(x);

#define bl ;

#endif

#define int long long



#define pb push_back

#define ff first

#define ss second

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

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

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



#ifdef ONLINE_JUDGE

#define STATER

#else

#define STATER freopen("E.txt", "w", stderr);

#endif



#define TCS(x) ios::sync_with_stdio(0);cin.tie(0); \

int t = 0; if (!x)cin >> t; else t = x; for (int i = 1; i <= t; i++){Case(i); solve(); bl}

template<class...T> void _i_(T &...s) {

	(void)initializer_list<int> {(cin >> s, 0)...};

}

#define in(...) int __VA_ARGS__;_i_(__VA_ARGS__)

#define chr(...) char __VA_ARGS__; _i_(__VA_ARGS__)

#define str(...) string __VA_ARGS__; _i_(__VA_ARGS__)

#define vec(T,v,n) vector<T> v(n); for (auto &x : v) cin >> x

#define vp(S,T,v,n) vector<pair<S,T>>v(n); for(auto & x : v) cin >> x.first >> x.second

#define vvec(T,v,n,m) vector<vector<T>>v(n, vector<T>(m)); for (auto &i : v)for (auto &j : i)cin >> j



auto solve() {

	in(n, x, y);

	map<int, vector<int>>mp;

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

		int left = (i - 1 + n) % n, right = (i + 1) % n;

		mp[i] = {left, right};

		if (x == i + 1)mp[i].pb(y - 1);

		if (y == i + 1)mp[i].pb(x - 1);

	}

	vector<int> ans(n, 0);

	for (auto &i : mp) {

		vector<bool> seen(n + 1, false);

		for (auto &j : i.ss)

			seen[ans[j]] = 1;

		int mex = 0;

		while (seen[mex])mex++;

		ans[i.ff] = mex;

	}

	for (auto &i : ans)

		cout << i << ' ';

	cout << endl;

}

signed main() {

	STATER;

	TCS(0);

}