ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2049B - pspspsps
Language: C++23 (GCC 14-64, msys2)

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

using namespace std;

#define int long long

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



void solve() {

    int n;

    cin >> n;

    string st;

    cin >> st;

    bool s_after_p = false;

    map<char, int> mp;

    string ans;

    

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

        if (mp[st[i]] == 0) {

            ans.push_back(st[i]);  

            mp[st[i]]++; 

        }

    }

    

    if (ans == "ps." || ans == "p.s" || ans == ".ps" || ans == ".sp"||ans=="ps") {

        cout << "NO" << endl;

    } else {

        cout << "YES" << endl;

    }

}



int32_t main() {

    fastio;

    int t;

    cin >> t;

    while (t--) solve();

    return 0;

}

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

using namespace std;

#define int long long

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



void solve() {

    int n; cin >> n;

    string s; cin >> s;



    int count_s = 0, count_p = 0;

    for(auto &ch: s) {

        count_s += (ch == 's');

        count_p += (ch == 'p');

    }



    if(count_s == 0 || count_p == 0) {

        cout << "YES\n";

        return;

    }



    if(count_s > 1 && count_p > 1) {

        cout << "NO\n";

        return;

    }



    if(count_s == 1 && s.front() == 's') {

        cout << "YES\n";

        return;

    }



    if(count_p == 1 && s.back() == 'p') {

        cout << "YES\n";

        return;

    }



    cout << "NO\n";

}



int32_t main() {

    fastio;

    int t;

    cin >> t;

    while (t--) solve();

    return 0;

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

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

using namespace std;

#define int long long

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



void solve() {

    int n;

    cin >> n;

    string st;

    cin >> st;

    bool s_after_p = false;

    map<char, int> mp;

    string ans;

    

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

        if (mp[st[i]] == 0) {

            ans.push_back(st[i]);  

            mp[st[i]]++; 

        }

    }

    

    if (ans == "ps." || ans == "p.s" || ans == "ps." || ans == ".sp"||ans=="ps") {

        cout << "NO" << endl;

    } else {

        cout << "YES" << endl;

    }

}



int32_t main() {

    fastio;

    int t;

    cin >> t;

    while (t--) solve();

    return 0;

}



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

using namespace std;

#define int long long

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



void solve() {

    int n;

    cin >> n;

    string st;

    cin >> st;

    bool s_after_p = false;

    map<char, int> mp;

    string ans;

    

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

        if (mp[st[i]] == 0) {

            ans.push_back(st[i]);  

            mp[st[i]]++; 

        }

    }

    

    if (ans == "ps." || ans == "p.s" || ans == ".ps" || ans == ".sp"||ans=="ps") {

        cout << "NO" << endl;

    } else {

        cout << "YES" << endl;

    }

}



int32_t main() {

    fastio;

    int t;

    cin >> t;

    while (t--) solve();

    return 0;

}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)

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

using namespace std;

int main()
{
    int t;
    cin >> t;
    while (t--){
        int n;
        cin >> n;
        vector<pair<int,int>> edges;
        int counting[200015]; // counting[i] denotes the number of edges that connects to edge i
        memset(counting, 0, n + 5);
        vector<pair<int,int>> cnt; // counting, index
        int dem = 1; // number of connected components

        for (int i=1; i<n; i++){
            int x, y;
            cin >> x >> y;
            edges.push_back({x,y});
            counting[x]++;
            counting[y]++;
        }

        // first deletion
        for (int i=1; i<=n; i++) cnt.push_back({counting[i], i});
        sort(cnt.begin(),cnt.end());

        int node = cnt.back().second;
        for (auto edge : edges){
            int x = edge.first, y = edge.second;

            if (x == node || y == node) counting[x + y - node]--;
        }

        dem += cnt.back().first - 1;
        counting[node] = 0;
        cnt.clear();

        // second deletion
        for (int i=1; i<=n; i++) cnt.push_back({counting[i], i});
        sort(cnt.begin(),cnt.end());

        dem += cnt.back().first - 1;

        // clearing for next test case
        cnt.clear();
        edges.clear();

        cout << dem << endl;
    }

    return 0;
}


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

using namespace std;

int main()
{
    int t;
    cin >> t;
    while (t--){
        int n;
        cin >> n;
        vector<pair<int,int>> edges;
        int counting[200015]; // counting[i] denotes the number of edges that connects to edge i
        for (int i=1; i<=n; i++) counting[i] = 0; // reset counting
        vector<pair<int,int>> cnt; // counting, index
        int dem = 1; // number of connected components

        for (int i=1; i<n; i++){
            int x, y;
            cin >> x >> y;
            edges.push_back({x,y});
            counting[x]++;
            counting[y]++;
        }

        // first deletion
        for (int i=1; i<=n; i++) cnt.push_back({counting[i], i});
        sort(cnt.begin(),cnt.end());

        int node = cnt.back().second;
        for (auto edge : edges){
            int x = edge.first, y = edge.second;

            if (x == node || y == node) counting[x + y - node]--;
        }

        dem += cnt.back().first - 1;
        counting[node] = 0;
        cnt.clear();

        // second deletion
        for (int i=1; i<=n; i++) cnt.push_back({counting[i], i});
        sort(cnt.begin(),cnt.end());

        dem += cnt.back().first - 1;

        // clearing for next test case
        cnt.clear();
        edges.clear();

        cout << dem << endl;
    }

    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)


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

using namespace std;

int main()
{
    int t;
    cin >> t;
    while (t--){
        int n;
        cin >> n;
        vector<pair<int,int>> edges;
        int counting[200015]; // counting[i] denotes the number of edges that connects to edge i
        memset(counting, 0, n + 5);
        vector<pair<int,int>> cnt; // counting, index
        int dem = 1; // number of connected components

        for (int i=1; i<n; i++){
            int x, y;
            cin >> x >> y;
            edges.push_back({x,y});
            counting[x]++;
            counting[y]++;
        }

        // first deletion
        for (int i=1; i<=n; i++) cnt.push_back({counting[i], i});
        sort(cnt.begin(),cnt.end());

        int node = cnt.back().second;
        for (auto edge : edges){
            int x = edge.first, y = edge.second;

            if (x == node || y == node) counting[x + y - node]--;
        }

        dem += cnt.back().first - 1;
        counting[node] = 0;
        cnt.clear();

        // second deletion
        for (int i=1; i<=n; i++) cnt.push_back({counting[i], i});
        sort(cnt.begin(),cnt.end());

        dem += cnt.back().first - 1;

        // clearing for next test case
        cnt.clear();
        edges.clear();

        cout << dem << endl;
    }

    return 0;
}
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)


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



using namespace std;



#define endl "\n"

#define ll long long int

#define pb push_back

#define rvec_sort(v) sort(v.begin(), v.end(), greater<int>());

#define vec_sort(v) sort(v.begin(),v.end());

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)

#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)

#define vec_sum(v) accumulate(v.begin(),v.end(),0ll)

#define PI 3.1415926535897932384626433832795

const ll M=1e9+7;



// ordered_set(pbds) : 1)finding kth element :*A.find_by_order(k)  , 2)finding number of elements smaller than X: A.order_of_key(X)

//#include<ext/pb_ds/assoc_container.hpp>

//#include<ext/pb_ds/tree_policy.hpp>

//using namespace __gnu_pbds;

//typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;



// Binary exponentiation : (a^b)%m

long long binpow(long long a, long long b,long long m) {

    long long result = 1;

    while(b) {

         if (b & 1)

         result = (result * a)%m;

         a = (a * a)%m;

         b >>= 1;

    }

    return result;

}



// Modulo Multiplicative inverse (MMI) : A^-1 = A^(m-2)%m, where gcd(a,m)=1

long long modinverse(long long a,long long m){

    return binpow(a,m-2,m);

}



void solve(){

    int n,m;

    cin>>n>>m;

    multiset<int> b;

    vector<int> a(n);

    vec_sort(a);

    rep(i,n) cin>>a[i];

    rep(i,m){

        int x;

        cin>>x;

        b.insert(x);

    }

    ll sum = 0;

    rep(i,n){

        if(sum == 0 || abs(sum-a[i]) <= 1){

            sum += a[i];

        }

        else{

            cout << "No" << endl; return;

        }

        if(b.find(sum) != b.end()){

            b.erase(sum);

            sum = 0;

        }

    }

    if(b.empty() && sum == 0){

    cout << "Yes" << endl; }

    else{

        cout << "No" << endl;

    }

}



int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL); cout.tie(NULL);

    int t;

    cin>>t;

    while(t--){

    solve();

    }

    return 0;

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


Submission (verdict: Memory limit exceeded on test 14):
#include <bits/stdc++.h>
using namespace std;

int minChanges(const string& a, const string& b, const string& c, int i, int j, int k, vector<vector<vector<int>>>& dp) {
   
    if (k == c.size()) return 0;

    
    if (i == a.size() && j == b.size()) return INT_MAX;

    
    if (dp[i][j][k] != -1) return dp[i][j][k];

    int changes = INT_MAX;

    
    if (i < a.size() && a[i] == c[k]) {
        changes = min(changes, minChanges(a, b, c, i + 1, j, k + 1, dp));
    } else if (i < a.size()) {
        changes = min(changes, 1 + minChanges(a, b, c, i + 1, j, k + 1, dp));
    }

    
    if (j < b.size() && b[j] == c[k]) {
        changes = min(changes, minChanges(a, b, c, i, j + 1, k + 1, dp));
    } else if (j < b.size()) {
        changes = min(changes, 1 + minChanges(a, b, c, i, j + 1, k + 1, dp));
    }

    
    return dp[i][j][k] = changes;
}

int main() {
    int t;
    cin >> t;

    while (t--) {
        string a, b, c;
        cin >> a >> b >> c;

       
        vector<vector<vector<int>>> dp(a.size() + 1, vector<vector<int>>(b.size() + 1, vector<int>(c.size() + 1, -1)));

        int result = minChanges(a, b, c, 0, 0, 0, dp);
        cout << result << endl;
    }

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

Previous submission (verdict: Memory limit exceeded on test 14):
#include <bits/stdc++.h>
using namespace std;

int minChanges(const string& a, const string& b, const string& c, int i, int j, int k, vector<vector<vector<int>>>& dp) {
   
    if (k == c.size()) return 0;

    
    if (i == a.size() && j == b.size()) return INT_MAX;

    
    if (dp[i][j][k] != -1) return dp[i][j][k];

    int changes = INT_MAX;

    
    if (i < a.size() && a[i] == c[k]) {
        changes = min(changes, minChanges(a, b, c, i + 1, j, k + 1, dp));
    } else if (i < a.size()) {
        changes = min(changes, 1 + minChanges(a, b, c, i + 1, j, k + 1, dp));
    }

    
    if (j < b.size() && b[j] == c[k]) {
        changes = min(changes, minChanges(a, b, c, i, j + 1, k + 1, dp));
    } else if (j < b.size()) {
        changes = min(changes, 1 + minChanges(a, b, c, i, j + 1, k + 1, dp));
    }

    
    return dp[i][j][k] = changes;
}

int main() {
    int t;
    cin >> t;

    while (t--) {
        string a, b, c;
        cin >> a >> b >> c;

       
        vector<vector<vector<int>>> dp(a.size() + 1, vector<vector<int>>(b.size() + 1, vector<int>(c.size() + 1, -1)));

        int result = minChanges(a, b, c, 0, 0, 0, dp);
        cout << result << endl;
    }

    return 0;
}


Submission (verdict: Runtime error on test 1):
#include <bits/stdc++.h>
using namespace std;

int minChanges(const string& a, const string& b, const string& c, int i, int j, int k, vector<vector<vector<int>>>& dp) {
   
    if (k == c.size()) return 0;

    
    if (i == a.size() && j == b.size()) return INT_MAX;

    
    if (dp[i][j][k] != -1) return dp[i][j][k];

    int changes = INT_MAX;

    
    if (i < a.size() && a[i] == c[k]) {
        changes = min(changes, minChanges(a, b, c, i + 1, j, k + 1, dp));
    } else if (i < a.size()) {
        changes = min(changes, 1 + minChanges(a, b, c, i + 1, j, k + 1, dp));
    }

    
    if (j < b.size() && b[j] == c[k]) {
        changes = min(changes, minChanges(a, b, c, i, j + 1, k + 1, dp));
    } else if (j < b.size()) {
        changes = min(changes, 1 + minChanges(a, b, c, i, j + 1, k + 1, dp));
    }

    
    return dp[i][j][k] = changes;
}

int main() {
    int t;
    cin >> t;

    while (t--) {
        string a, b, c;
        cin >> a >> b >> c;

       
        vector<vector<vector<int>>> dp(a.size() , vector<vector<int>>(b.size() , vector<int>(c.size() , -1)));

        int result = minChanges(a, b, c, 0, 0, 0, dp);
        cout << result << endl;
    }

    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 2):
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define unmap unordered_map
#define unset unordered_set
#define MAXQ priority_queue
using namespace std;
template<typename T> using MINQ=priority_queue<T,vector<T>,greater<T> >;
using pii=pair<int,int>;
using vi=vector<int>;
using vii=vector<vi>;

#define maxn 1000010

int n;
int cnt,from[maxn],to[maxn],Next[maxn],head[maxn];
int f[maxn][2][2];

void add(int u,int v){
	cnt++;
	from[cnt]=u; to[cnt]=v;
	Next[cnt]=head[u]; head[u]=cnt;
}

void dfs(int u,int fa){
	int son=0;
	for(int i=head[u];i!=-1;i=Next[i]){
		int v=to[i]; if(v==fa)continue;
		dfs(v,u);son++;
	}
	f[u][0][0]=1;
	f[u][1][1]=son;f[u][1][0]=-1e9;
	f[u][2][0]=f[u][2][1]=-1e9;
	for(int i=head[u];i!=-1;i=Next[i]){
		int v=to[i]; if(v==fa)continue;
		f[u][2][0]=max(f[u][2][0],max(f[v][2][1]+1,f[v][2][0]));
		f[u][2][1]=max(f[u][2][1],max(f[v][1][0]+son-1,f[v][1][1]+son-1));
		f[u][1][0]=max(f[u][1][0],max(f[v][1][1]+1,f[v][1][0]));
	}
}

void solve(){cnt=0;
	memset(head,-1,sizeof(head));
	cin>>n;
	for(int i=1;i<=n-1;i++){
		int u,v;
		cin>>u>>v;
		add(u,v);
	}
	dfs(1,0);
	// for(int i=1;i<=n;i++)cout<<f[i][1][0]<<' '<<f[i][1][1]<<endl;
	cout<<max(f[1][2][0],f[1][2][1])<<endl;

	return ;
}

signed main(){
	ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
	int _t=1;
	cin>>_t;
	//cout<<fixed<<setprecision(20);
	for(int i=1;i<=_t;i++){
		//cout<<"Case "<<i<<": ";
		solve();
	}
	return 0;
}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define unmap unordered_map
#define unset unordered_set
#define MAXQ priority_queue
using namespace std;
template<typename T> using MINQ=priority_queue<T,vector<T>,greater<T> >;
using pii=pair<int,int>;
using vi=vector<int>;
using vii=vector<vi>;

#define maxn 1000010

int n;
int cnt,from[maxn],to[maxn],Next[maxn],head[maxn];
int f[maxn][2][2];

void add(int u,int v){
	cnt++;
	from[cnt]=u; to[cnt]=v;
	Next[cnt]=head[u]; head[u]=cnt;
}

void dfs(int u,int fa){
	int son=0;
	for(int i=head[u];i!=-1;i=Next[i]){
		int v=to[i]; if(v==fa)continue;
		dfs(v,u);son++;
	}
	f[u][0][0]=1;
	f[u][1][1]=son;f[u][1][0]=-1e9;
	f[u][2][0]=f[u][2][1]=-1e9;
	for(int i=head[u];i!=-1;i=Next[i]){
		int v=to[i]; if(v==fa)continue;
		f[u][2][0]=max(f[u][2][0],max(f[v][2][1]+1,f[v][2][0]));
		f[u][2][1]=max(f[u][2][1],max(f[v][1][0]+son-1,f[v][1][1]+son-1));
		f[u][1][0]=max(f[u][1][0],max(f[v][1][1]+1,f[v][1][0]));
	}
}

void solve(){cnt=0;
	cin>>n;
	for(int i=1;i<=n;i++)head[i]=-1;
	for(int i=1;i<=n-1;i++){
		int u,v;
		cin>>u>>v;
		add(u,v);
	}
	dfs(1,0);
	// for(int i=1;i<=n;i++)cout<<f[i][1][0]<<' '<<f[i][1][1]<<endl;
	cout<<max(f[1][2][0],f[1][2][1])<<endl;

	return ;
}

signed main(){
	ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
	int _t=1;
	cin>>_t;
	//cout<<fixed<<setprecision(20);
	for(int i=1;i<=_t;i++){
		//cout<<"Case "<<i<<": ";
		solve();
	}
	return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)


Submission (verdict: Time limit exceeded on test 2):
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define unmap unordered_map
#define unset unordered_set
#define MAXQ priority_queue
using namespace std;
template<typename T> using MINQ=priority_queue<T,vector<T>,greater<T> >;
using pii=pair<int,int>;
using vi=vector<int>;
using vii=vector<vi>;

#define maxn 1000010

int n;
int cnt,from[maxn],to[maxn],Next[maxn],head[maxn];
int f[maxn][2][2];

void add(int u,int v){
	cnt++;
	from[cnt]=u; to[cnt]=v;
	Next[cnt]=head[u]; head[u]=cnt;
}

void dfs(int u,int fa){
	int son=0;
	for(int i=head[u];i!=-1;i=Next[i]){
		int v=to[i]; if(v==fa)continue;
		dfs(v,u);son++;
	}
	f[u][0][0]=1;
	f[u][1][1]=son;f[u][1][0]=-1e9;
	f[u][2][0]=f[u][2][1]=-1e9;
	for(int i=head[u];i!=-1;i=Next[i]){
		int v=to[i]; if(v==fa)continue;
		f[u][2][0]=max(f[u][2][0],max(f[v][2][1]+1,f[v][2][0]));
		f[u][2][1]=max(f[u][2][1],max(f[v][1][0]+son-1,f[v][1][1]+son-1));
		f[u][1][0]=max(f[u][1][0],max(f[v][1][1]+1,f[v][1][0]));
	}
}

void solve(){cnt=0;
	memset(head,-1,sizeof(head));
	cin>>n;
	for(int i=1;i<=n-1;i++){
		int u,v;
		cin>>u>>v;
		add(u,v);
	}
	dfs(1,0);
	// for(int i=1;i<=n;i++)cout<<f[i][1][0]<<' '<<f[i][1][1]<<endl;
	cout<<max(f[1][2][0],f[1][2][1])<<endl;

	return ;
}

signed main(){
	ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
	int _t=1;
	cin>>_t;
	//cout<<fixed<<setprecision(20);
	for(int i=1;i<=_t;i++){
		//cout<<"Case "<<i<<": ";
		solve();
	}
	return 0;
}
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 i64 = long long;
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...));
    };
}

void solve() {
    int l, r;
    std::cin >> l >> r;

    int a = 0, b = 0, c = 0;
    for (int i = 30;i >= 0;i --) {
        if ((l ^ r) >> i & 1) {
            b |= 1 << i;
            a |= (1 << i) - 1;
        } else {
            a |= l & 1 << i;
            b |= l & 1 << i;
        }
    }
    c = l;
    while (c == a || c == b) c ++;

    std::cout << "{} {} {}\n"_f(a, b, c);
}

signed main() {
    std::cin.tie(nullptr)->sync_with_stdio(false);
    int _ = 1;
    std::cin >> _;
    while (_ --) {
        solve();
    }
    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using i64 = long long;
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...));
    };
}

void solve() {
    int l, r;
    std::cin >> l >> r;

    int a = 0, b = 0, c = 0;
    for (int i = 30;i >= 0;i --) {
        if ((l ^ r) >> i & 1) {
            b |= 1 << i;
            a |= (1 << i) - 1;
            break;
        } else {
            a |= l & 1 << i;
            b |= l & 1 << i;
        }
    }
    c = l;
    while (c == a || c == b) c ++;

    std::cout << "{} {} {}\n"_f(a, b, c);
}

signed main() {
    std::cin.tie(nullptr)->sync_with_stdio(false);
    int _ = 1;
    std::cin >> _;
    while (_ --) {
        solve();
    }
    return 0;
}
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 i64 = long long;
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...));
    };
}

void solve() {
    int l, r;
    std::cin >> l >> r;

    int a = 0, b = 0, c = 0;
    for (int i = 31;i >= 0;i --) {
        if ((l xor r) >> i & 1) {
            b |= 1 << i;
            a |= (1 << i) - 1;
        } else {
            a |= l & 1 << i;
            b |= l & 1 << i;
        }
    }
    c = l;
    while (c == a || c == b) c ++;

    std::cout << "{} {} {}\n"_f(a, b, c);
}

signed main() {
    std::cin.tie(nullptr)->sync_with_stdio(false);
    int _ = 1;
    std::cin >> _;
    while (_ --) {
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using i64 = long long;
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...));
    };
}

void solve() {
    int l, r;
    std::cin >> l >> r;

    int a = 0, b = 0, c = 0;
    for (int i = 30;i >= 0;i --) {
        if ((l ^ r) >> i & 1) {
            b |= 1 << i;
            a |= (1 << i) - 1;
        } else {
            a |= l & 1 << i;
            b |= l & 1 << i;
        }
    }
    c = l;
    while (c == a || c == b) c ++;

    std::cout << "{} {} {}\n"_f(a, b, c);
}

signed main() {
    std::cin.tie(nullptr)->sync_with_stdio(false);
    int _ = 1;
    std::cin >> _;
    while (_ --) {
        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 i64 = long long;
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...));
    };
}

void solve() {
    int l, r;
    std::cin >> l >> r;

    int a = 0, b = 0, c = 0;
    for (int i = 31;i >= 0;i --) {
        if ((l xor r) >> i & 1) {
            b |= 1 << i;
            a |= (1 << i) - 1;
        } else {
            a |= l & 1 << i;
            b |= l & 1 << i;
        }
    }
    c = l;
    while (c == a || c == b) c ++;

    std::cout << "{} {} {}\n"_f(a, b, c);
}

signed main() {
    std::cin.tie(nullptr)->sync_with_stdio(false);
    int _ = 1;
    std::cin >> _;
    while (_ --) {
        solve();
    }
    return 0;
}