ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using i64 = long long;
#ifndef ATCODER
consteval auto operator"" _f(const char* str, std::size_t len) {
    return [fmt = std::string_view(str, len)](auto&&... args) {
        return std::vformat(fmt, std::make_format_args(args...));
    };
}
#endif

void solve() {
    int n;
    std::cin >> n;

    std::vector<std::vector<int>> adj(n);
    std::vector<int> d(n);
    for (int i = 1, u, v;i < n;i ++) {
        std::cin >> u >> v;
        u --, v --;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    auto update = [&]() {
        for (int i = 0;i < n;i ++) {
            d[i] = adj[i].size();
        }
    };

    update();
    int ans = 0;
    auto ind = std::max_element(d.begin(), d.end()) - d.begin();
    ans += d[ind];
    for (int i = 0;i < n;i ++) {
        if (i == ind) adj[i].clear();
        if (auto it = std::find(adj[i].begin(), adj[i].end(), ind); it != adj[i].end()) {
            adj[i].erase(it);
        }
    }

    update();
    ind = std::max_element(d.begin(), d.end()) - d.begin();
    std::cout << d[ind] + ans - 1 << "\n";
}
int32_t main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int t = 1;
    std::cin >> t;

    while (t --) {
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 4):
#include <bits/stdc++.h>
using i64 = long long;
#ifndef ATCODER
consteval auto operator"" _f(const char* str, std::size_t len) {
    return [fmt = std::string_view(str, len)](auto&&... args) {
        return std::vformat(fmt, std::make_format_args(args...));
    };
}
#endif

void solve() {
    int n;
    std::cin >> n;

    std::vector<std::vector<int>> adj(n);
    std::vector<std::array<int, 2>> a(n);
    for (int i = 1, u, v;i < n;i ++) {
        std::cin >> u >> v;
        u --, v --;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    for (int i = 0;i < n;i ++) {
        a[i] = {int(adj[i].size()), i};
    }

    std::sort(a.begin(), a.end());
    auto [d, id] = a.back();
    a.pop_back();
    std::sort(adj[id].begin(), adj[id].end());

    int ans = 0;
    while (a.size()) {
        int to = a.back()[1];
        if (auto it = std::lower_bound(adj[id].begin(), adj[id].end(), a.back()[1]); it != adj[id].end() and *it == a.back()[1]) {
            ans = std::max(ans, d + int(adj[to].size()) - 2);
        } else {
            ans = std::max(ans, d + int(adj[to].size()) - 1);
        }
        a.pop_back();
    }
    std::cout << ans << "\n";
}
int32_t main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int t = 1;
    std::cin >> t;

    while (t --) {
        solve();
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using i64 = long long;
#ifndef ATCODER
consteval auto operator"" _f(const char* str, std::size_t len) {
    return [fmt = std::string_view(str, len)](auto&&... args) {
        return std::vformat(fmt, std::make_format_args(args...));
    };
}
#endif

void solve() {
    int n;
    std::cin >> n;

    std::vector<std::vector<int>> adj(n);
    std::vector<int> max(n);
    for (int i = 1, u, v;i < n;i ++) {
        std::cin >> u >> v;
        u --, v --;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    int ans = 0;
    auto dfs = [&](this auto &&self, int ind, int p) -> void{
        for (auto &to : adj[ind]) {
            if (to == p) continue;
            self(to, ind);
            max[ind] = std::max(max[ind], std::max(max[to], int(adj[to].size())));
            ans = std::max(ans, int(adj[ind].size() + adj[to].size()) - 2);
            ans = std::max(ans, int(adj[ind].size()) + max[to] - 1);
        }
    };
    dfs(0, -1);

    std::cout << ans << "\n";
}
int32_t main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int t = 1;
    std::cin >> t;

    while (t --) {
        solve();
    }
    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using i64 = long long;
#ifndef ATCODER
consteval auto operator"" _f(const char* str, std::size_t len) {
    return [fmt = std::string_view(str, len)](auto&&... args) {
        return std::vformat(fmt, std::make_format_args(args...));
    };
}
#endif

void solve() {
    int n;
    std::cin >> n;

    std::vector<std::vector<int>> adj(n);
    std::vector<int> max(n);
    for (int i = 1, u, v;i < n;i ++) {
        std::cin >> u >> v;
        u --, v --;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    int ans = 0;
    auto dfs = [&](this auto &&self, int ind, int p) -> void{
        int mx1 = 0, mx2 = 0;
        for (auto &to : adj[ind]) {
            if (to == p) continue;
            self(to, ind);
            max[ind] = std::max(max[ind], std::max(max[to], int(adj[to].size())));
            ans = std::max(ans, int(adj[ind].size() + adj[to].size()) - 2);
            ans = std::max(ans, int(adj[ind].size()) + max[to] - 1);
            int smx = std::max(max[to], int(adj[to].size()));
            if (mx1 <= smx) {
                mx2 = mx1;
                mx1 = smx;
            } else if (mx2 < smx) {
                mx2 = smx;
            }
        }
        ans = std::max(ans, mx1 + mx2 - 1);
    };
    dfs(0, -1);

    std::cout << ans << "\n";
}
int32_t main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int t = 1;
    std::cin >> t;

    while (t --) {
        solve();
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 4):
#include <bits/stdc++.h>
using i64 = long long;
#ifndef ATCODER
consteval auto operator"" _f(const char* str, std::size_t len) {
    return [fmt = std::string_view(str, len)](auto&&... args) {
        return std::vformat(fmt, std::make_format_args(args...));
    };
}
#endif

void solve() {
    int n;
    std::cin >> n;

    std::vector<std::vector<int>> adj(n);
    std::vector<std::array<int, 2>> a(n);
    for (int i = 1, u, v;i < n;i ++) {
        std::cin >> u >> v;
        u --, v --;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    for (int i = 0;i < n;i ++) {
        a[i] = {int(adj[i].size()), i};
    }

    std::sort(a.begin(), a.end());
    auto [d, id] = a.back();
    a.pop_back();
    std::sort(adj[id].begin(), adj[id].end());

    int ans = 0;
    while (a.size()) {
        int to = a.back()[1];
        if (auto it = std::lower_bound(adj[id].begin(), adj[id].end(), a.back()[1]); it != adj[id].end() and *it == a.back()[1]) {
            ans = std::max(ans, d + int(adj[to].size()) - 2);
        } else {
            ans = std::max(ans, d + int(adj[to].size()) - 1);
        }
        a.pop_back();
    }
    std::cout << ans << "\n";
}
int32_t main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int t = 1;
    std::cin >> t;

    while (t --) {
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 4):
#include <bits/stdc++.h>
using i64 = long long;
#ifndef ATCODER
consteval auto operator"" _f(const char* str, std::size_t len) {
    return [fmt = std::string_view(str, len)](auto&&... args) {
        return std::vformat(fmt, std::make_format_args(args...));
    };
}
#endif

void solve() {
    int n;
    std::cin >> n;

    std::vector<std::vector<int>> adj(n);
    std::vector<std::array<int, 2>> a(n);
    for (int i = 1, u, v;i < n;i ++) {
        std::cin >> u >> v;
        u --, v --;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    for (int i = 0;i < n;i ++) {
        a[i] = {int(adj[i].size()), i};
    }

    std::sort(a.begin(), a.end());
    auto [d, id] = a.back();
    a.pop_back();
    std::sort(adj[id].begin(), adj[id].end());

    int ans = 0;
    for (int i = 0;i < n;i ++) {
        if (i == id) continue;
        auto it = std::lower_bound(adj[id].begin(), adj[id].end(), i);
        if (it != adj[id].end() and *it == i) {
            ans = std::max(ans, d + int(adj[i].size()) - 2);
        } else {
            ans = std::max(ans, d + int(adj[i].size()) - 1);
        }
    }
    std::cout << ans << "\n";
}
int32_t main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int t = 1;
    std::cin >> t;

    while (t --) {
        solve();
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using i64 = long long;
#ifndef ATCODER
consteval auto operator"" _f(const char* str, std::size_t len) {
    return [fmt = std::string_view(str, len)](auto&&... args) {
        return std::vformat(fmt, std::make_format_args(args...));
    };
}
#endif

void solve() {
    int n;
    std::cin >> n;

    std::vector<std::vector<int>> adj(n);
    std::vector<int> d(n);
    for (int i = 1, u, v;i < n;i ++) {
        std::cin >> u >> v;
        u --, v --;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    auto update = [&]() {
        for (int i = 0;i < n;i ++) {
            d[i] = adj[i].size();
        }
    };

    update();
    int ans = 0;
    auto ind = std::max_element(d.begin(), d.end()) - d.begin();
    ans += d[ind];
    for (int i = 0;i < n;i ++) {
        if (i == ind) adj[i].clear();
        if (auto it = std::find(adj[i].begin(), adj[i].end(), ind); it != adj[i].end()) {
            adj[i].erase(it);
        }
    }

    update();
    ind = std::max_element(d.begin(), d.end()) - d.begin();
    std::cout << d[ind] + ans - 1 << "\n";
}
int32_t main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int t = 1;
    std::cin >> t;

    while (t --) {
        solve();
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 4):
#include <bits/stdc++.h>
using i64 = long long;
#ifndef ATCODER
consteval auto operator"" _f(const char* str, std::size_t len) {
    return [fmt = std::string_view(str, len)](auto&&... args) {
        return std::vformat(fmt, std::make_format_args(args...));
    };
}
#endif

void solve() {
    int n;
    std::cin >> n;

    std::vector<std::vector<int>> adj(n);
    std::vector<std::array<int, 2>> a(n);
    for (int i = 1, u, v;i < n;i ++) {
        std::cin >> u >> v;
        u --, v --;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }
    for (int i = 0;i < n;i ++) {
        a[i] = {int(adj[i].size()), i};
    }

    std::sort(a.begin(), a.end());
    auto [d, id] = a.back();
    a.pop_back();
    std::sort(adj[id].begin(), adj[id].end());

    int ans = 0;
    for (int i = 0;i < n;i ++) {
        if (i == id) continue;
        auto it = std::lower_bound(adj[id].begin(), adj[id].end(), i);
        if (it != adj[id].end() and *it == i) {
            ans = std::max(ans, d + int(adj[i].size()) - 2);
        } else {
            ans = std::max(ans, d + int(adj[i].size()) - 1);
        }
    }
    std::cout << ans << "\n";
}
int32_t main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int t = 1;
    std::cin >> t;

    while (t --) {
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using i64 = long long;
#ifndef ATCODER
consteval auto operator"" _f(const char* str, std::size_t len) {
    return [fmt = std::string_view(str, len)](auto&&... args) {
        return std::vformat(fmt, std::make_format_args(args...));
    };
}
#endif

void solve() {
    int n;
    std::cin >> n;

    std::vector<std::vector<int>> adj(n);
    std::vector<int> max(n);
    for (int i = 1, u, v;i < n;i ++) {
        std::cin >> u >> v;
        u --, v --;
        adj[u].push_back(v);
        adj[v].push_back(u);
    }

    int ans = 0;
    auto dfs = [&](this auto &&self, int ind, int p) -> void{
        for (auto &to : adj[ind]) {
            if (to == p) continue;
            self(to, ind);
            max[ind] = std::max(max[ind], std::max(max[to], int(adj[to].size())));
            ans = std::max(ans, int(adj[ind].size() + adj[to].size()) - 2);
            ans = std::max(ans, int(adj[ind].size()) + max[to] - 1);
        }
    };
    dfs(0, -1);

    std::cout << ans << "\n";
}
int32_t main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int t = 1;
    std::cin >> t;

    while (t --) {
        solve();
    }
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
int main()
{
	int t;
	cin >> t;
	while(t--)
	{
		int n;
		cin >> n;
		vector<int> a(n + 1);
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		for(int i = 0; i < n - 1; i++)
		{
			if(a[i] <= a[i + 1])
			{
				a[i] -= min(a[i], a[i + 1]);
				a[i + 1] -= min(a[i], a[i + 1]);
			}
		}
		cout << (is_sorted(a.begin(), a.end())) ? "YES" : "NO";
		cout << endl;
	}
	return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
int main()
{
	int t;
	cin >> t;
	while(t--)
	{
		int n;
		cin >> n;
		vector<int> a(n + 1);
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		for(int i = 0; i < n - 1; i++)
		{
			if(a[i] <= a[i + 1])
			{
				a[i] -= min(a[i], a[i + 1]);
				a[i + 1] -= min(a[i], a[i + 1]);
			}
		}
		cout << (is_sorted(a.begin(), a.end()) ? "YES" : "NO");
		cout << endl;
	}
	return 0;
}



Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
int main()
{
	int t;
	cin >> t;
	while(t--)
	{
		int n;
		cin >> n;
		vector<int> a(n + 1);
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		for(int i = 0; i < n - 1; i++)
		{
			if(a[i] <= a[i + 1])
			{
				int t = min(a[i], a[i + 1]);
				a[i] -= t;
				a[i + 1] -= t;
			}
		}
		cout << (is_sorted(a.begin(), a.end()) ? "YES" : "NO");
		cout << endl;
	}
	return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
int main()
{
	int t;
	cin >> t;
	while(t--)
	{
		int n;
		cin >> n;
		vector<int> a(n + 1);
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		for(int i = 0; i < n - 1; i++)
		{
			if(a[i] <= a[i + 1])
			{
				a[i] -= min(a[i], a[i + 1]);
				a[i + 1] -= min(a[i], a[i + 1]);
			}
		}
		cout << (is_sorted(a.begin(), a.end())) ? "YES" : "NO";
		cout << endl;
	}
	return 0;
}



Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
int main()
{
	int t;
	cin >> t;
	while(t--)
	{
		int n;
		cin >> n;
		vector<int> a(n + 1);
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		for(int i = 0; i < n - 1; i++)
		{
			if(a[i] <= a[i + 1])
			{
				a[i] -= min(a[i], a[i + 1]);
				a[i + 1] -= min(a[i], a[i + 1]);
			}
		}
		cout << (is_sorted(a.begin(), a.end()) ? "YES" : "NO");
		cout << endl;
	}
	return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
int main()
{
	int t;
	cin >> t;
	while(t--)
	{
		int n;
		cin >> n;
		vector<int> a(n + 1);
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		for(int i = 0; i < n - 1; i++)
		{
			if(a[i] <= a[i + 1])
			{
				int t = min(a[i], a[i + 1]);
				a[i] -= t;
				a[i + 1] -= t;
			}
		}
		cout << (is_sorted(a.begin(), a.end()) ? "YES" : "NO");
		cout << endl;
	}
	return 0;
}



Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std; 
typedef long long ll;
int main()
{
	int t;
	cin >> t;
	while(t--)
	{
		int n;
		cin >> n;
		vector<int> a(n + 1);
		for(int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		for(int i = 0; i < n - 1; i++)
		{
			if(a[i] <= a[i + 1])
			{
				int t = min(a[i], a[i + 1]);
				a[i] -= t;
				a[i + 1] -= t;
			}
		}
		bool f = 1;
		for(int i = 0; i < n - 1; i++)
		{
			if(a[i + 1] < a[i])
			f = 0;
		}
		if(f) cout << "YES";
		else cout << "NO";
		cout << endl;
	}
	return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

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

using namespace std;
void solve()
{
	int l,r;
	cin >> l >> r;
	int m = l ^ r;
	int k;
	for (int i = 31; i >= 0; i--)
	{
		if ((m >> i) & 1)
		{
			k = i;
			break;
		}
	}
	int a = l | ((1 << k) - 1), b = a + 1, c = (a == l ? r : l);
	cout << a << " " << b << " " << c << endl;
}

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

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 1e6 + 50;
const ll mod = 1e9 + 7;
#define PI 3.14159265358979324
#define lowbit(x) (x & (-x))
typedef pair<int, int> PII;
#define all(x) x.begin(), x.end()
//#define x first
//#define y second
map<ll, ll> mp, mp1;
ll a[N];
void solve() {
    int l, r;
    cin >> l >> r;
    int op = 0;
    for(int i = 32; i >= 0; i--){
        if((l & (1 << i)) != (r & (1 << i))){
            op = i;
            break;
        }
    }
    int p = (l << op) >> op;
    int res1 = p + (1 << op), res2 = p + (1 << op) - 1;
    if(res2 == l) cout << res1 << " " << res2 << " " << r << endl;
    else cout << l << " " << res1 << " " << res2 << endl;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    int t = 1;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

/*1 2 3 4
1 2 4 3*/
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)


Submission (verdict: Compilation error):
#include<iostream>
#include<algorithm>

using namespace std;
void solve()
{
	int l,r;
	cin >> l >> r;
	int m = l ^ r;
	int k=0;
	for (int i = 31; i >= 0; i--)
	{
		if ((i >> i) & 1)
		{
			k = i;
			break;
		}
	}
	int a = l | ((1 << k) - 1), b = a + 1, c = (a == l ? r : l);
	cout << a << " " << b << " " << c << endl;
}

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		solve();
	}
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Compilation error):
#include<iostream>
#include<algorithm>

using namespace std;
void solve()
{
	int l,r;
	cin >> l >> r;
	int m = l ^ r;
	int k=0;
	for (int i = 31; i >= 0; i--)
	{
		if ((i >> i) & 1)
		{
			k = i;
			break;
		}
	}
	int a = l | ((1 << k) - 1), b = a + 1, c = (a == l ? r : l);
	cout << a << " " << b << " " << c << endl;
}

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

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

using namespace std;
void solve()
{
	int l,r;
	cin >> l >> r;
	int m = l ^ r;
	int k;
	for (int i = 31; i >= 0; i--)
	{
		if ((m >> i) & 1)
		{
			k = i;
			break;
		}
	}
	int a = l | ((1 << k) - 1), b = a + 1, c = (a == l ? r : l);
	cout << a << " " << b << " " << c << endl;
}

int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		solve();
	}
}
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>
using namespace std;
#define fast {ios_base::sync_with_stdio(false); cin.tie(0);}
typedef long long ll;
#define int long long
#define float long double
int cs;
void solve()
{
    int l,r;
    cin >> l >> r;
    int ll=l,rr=r;
    int k=0;
    for(int i=30;i>=0;i--)
    {
        int x=(1ll<<i);
        if((x&l)==(r&x)) l^=(x&l), k|=(x&r), r^=(x&r);
        else 
        {
            cout << (x|k) << ' ' << ((x-1)|k) << ' ' << ((x-2)|k) << '\n';
            break;
        }
    }
}
signed main()
{
    fast
    int t=1;
    cin >> t;
    for(cs=1;cs<=t;cs++)
    {
        //cout << "Case " << cs << ": "; 
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define fast {ios_base::sync_with_stdio(false); cin.tie(0);}
typedef long long ll;
#define int long long
#define float long double
int cs;
void solve()
{
    int l,r;
    cin >> l >> r;
    int ll=l,rr=r;
    if(r-l<=10)
    {
        for(int i=l;i<r;i++)
        {

        }
    }
    int k=0;
    for(int i=30;i>=0;i--)
    {
        int x=(1ll<<i);
        if((x&l)==(r&x)) l^=(x&l), k|=(x&r), r^=(x&r);
        else 
        {
            cout << (r|k) << ' ' << ((r-1)|k) << ' ' << ((r-2)|k) << '\n';
            break;
        }
    }
}
signed main()
{
    fast
    int t=1;
    cin >> t;
    for(cs=1;cs<=t;cs++)
    {
        //cout << "Case " << cs << ": "; 
        solve();
    }
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define fast {ios_base::sync_with_stdio(false); cin.tie(0);}
typedef long long ll;
#define int long long
#define float long double
int cs;
void solve()
{
    int l,r;
    cin >> l >> r;
    int ll=l,rr=r;
    int k=0;
    for(int i=30;i>=0;i--)
    {
        int x=(1ll<<i);
        if((x&l)==(r&x)) l^=(x&l), k|=(x&r), r^=(x&r);
        else 
        {
            cout << (x|k) << ' ' << ((x-1)|k) << ' ' << ((x-2)|k) << '\n';
            break;
        }
    }
}
signed main()
{
    fast
    int t=1;
    cin >> t;
    for(cs=1;cs<=t;cs++)
    {
        //cout << "Case " << cs << ": "; 
        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>
using namespace std;
#define fast {ios_base::sync_with_stdio(false); cin.tie(0);}
typedef long long ll;
#define int long long
#define float long double
int cs;
void solve()
{
    int l,r;
    cin >> l >> r;
    int ll=l,rr=r;
    int k=0;
    for(int i=30;i>=0;i--)
    {
        int x=(1ll<<i);
        if((x&l)==(r&x)) l^=(x&l), k|=(x&r), r^=(x&r);
        else 
        {
            cout << (x|k) << ' ' << ((x-1)|k) << ' ';
            if(((x-2)|k)<l) cout << ((x+1)|k) << '\n';
            else cout << ((x-2)|k) << '\n';
            break;
        }
    }
}
signed main()
{
    fast
    int t=1;
    cin >> t;
    for(cs=1;cs<=t;cs++)
    {
        //cout << "Case " << cs << ": "; 
        solve();
    }
    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define fast {ios_base::sync_with_stdio(false); cin.tie(0);}
typedef long long ll;
#define int long long
#define float long double
int cs;
void solve()
{
    int l,r;
    cin >> l >> r;
    int ll=l,rr=r;
    int k=0;
    for(int i=30;i>=0;i--)
    {
        int x=(1ll<<i);
        if((x&l)==(r&x)) l^=(x&l), k|=(x&r), r^=(x&r);
        else 
        {
            cout << (x|k) << ' ' << ((x-1)|k) << ' ';
            if(((x-2))<l) cout << ((x+1)|k) << '\n';
            else cout << ((x-2)|k) << '\n';
            break;
        }
    }
}
signed main()
{
    fast
    int t=1;
    cin >> t;
    for(cs=1;cs<=t;cs++)
    {
        //cout << "Case " << cs << ": "; 
        solve();
    }
    return 0;
}