ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2057B - Gorilla and the Exam
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
bool comp(pair<int,int>a,pair<int,int>b){
    if(a.second<b.second) return true;
    return false;
}
int main(){
    int t;
    cin>>t;
    while(t--){
        int n,k;
        cin>>n>>k;
        int l[n];
        vector<pair<int,int>>m;
        for(int i=0;i<n;i++){
            cin>>l[i];
        }
        sort(l,l+n);
        int say=1;
        for(int i=1;i<=n;i++){
            if(l[i]==l[i-1]){
                say++;
            }
            else{
                m.push_back({i,say});
                say=1;
            }

        }

        sort(m.begin(),m.end(),comp);
        for(auto& p:m){
            if(k==0){
                break;
            }
            if(k>=p.second){
                k-=p.second;
                p.second=0;

            }
            else{
                p.second-=k;
                k=0;
                break;
            }
        }
        int cvb=0;
        for(pair<int,int>p:m){
           // cout<<p.first<<" "<<p.second<<endl;
            if(p.second!=0){
                cvb++;
            }

        }
        if(cvb==0) cvb=1;
        cout<<cvb<<endl;


    }
}


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
bool comp(pair<int,int>a,pair<int,int>b){
    if(a.second<b.second) return true;
    return false;
}
int main(){
    int t;
    cin>>t;
    while(t--){
        int n,k;
        cin>>n>>k;
        int l[n];
        vector<pair<int,int>>m;
        for(int i=0;i<n;i++){
            cin>>l[i];
        }
        sort(l,l+n);
        int say=1;
        for(int i=1;i<=n;i++){
            if(l[i]==l[i-1]){
                say++;
            }
            else{
                m.push_back({l[i-1],say});
                say=1;
            }

        }

        sort(m.begin(),m.end(),comp);
        for(auto& p:m){
            if(k==0){
                break;
            }
            if(k>=p.second){
                k-=p.second;
                p.second=0;

            }
            else{
                p.second-=k;
                k=0;
                break;
            }
        }
        int cvb=0;
        for(pair<int,int>p:m){
           // cout<<p.first<<" "<<p.second<<endl;
            if(p.second!=0){
                cvb++;
            }

        }
        if(cvb==0) cvb=1;
        cout<<cvb<<endl;


    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

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

#define endl '\n'
using ll = long long;
using pii = pair<int, int>;
const double PI = acos(-1);
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
void solve() {
	ll l,r;cin>>l>>r;
	if(r-l==2) {
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
		return;
	}
	ll pre=0;
	int i=30;
	for(;i>=0;i--){
		if((l>>i)==(r>>i)){
			if((l>>i)&1){
				l-=(1<<i);
				r-=(1<<i);
				pre+=(1<<i);
			}
		}
		else break;
	}
	if((1<<i)==r){
		r=pre+r;
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
		cout<<"异或值："<<(((r-2)^(r-1))+((r-2)^r)+((r-1)^r))<<endl;
	}
	else{
		r=pre+(1<<i);
		cout<<r-1<<" "<<r<<" "<<r+1<<endl;
		cout<<"异或值："<<(((r-1)^r)+((r-1)^(r+1))+((r+1)^r))<<endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	
	int T = 1;
	cin>>T;
	while (T--) {
		solve();
	}
	
	return 0;
}
//异或值：6
//6 7 8
//异或值：30
//1 2 3
//异或值：6
//15 16 17
//异或值：62
//135 136 137
//异或值：30
//95 96 97
//异或值：126
//119 120 121
//异或值：30
//536870911 536870912 536870913
//异或值：2147483646




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

#define endl '\n'
using ll = long long;
using pii = pair<int, int>;
const double PI = acos(-1);
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
void solve() {
	ll l,r;cin>>l>>r;
	if(r-l==2) {
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
		return;
	}
	ll pre=0;
	int i=30;
	for(;i>=0;i--){
		if((l>>i)==(r>>i)){
			if((l>>i)&1){
				l-=(1<<i);
				r-=(1<<i);
				pre+=(1<<i);
			}
		}
		else break;
	}
	if((1<<i)==r){
		r=pre+r;
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
//		cout<<"异或值："<<(((r-2)^(r-1))+((r-2)^r)+((r-1)^r))<<endl;
	}
	else{
		r=pre+(1<<i);
		cout<<r-1<<" "<<r<<" "<<r+1<<endl;
//		cout<<"异或值："<<(((r-1)^r)+((r-1)^(r+1))+((r+1)^r))<<endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	
	int T = 1;
	cin>>T;
	while (T--) {
		solve();
	}
	
	return 0;
}
//异或值：6
//6 7 8
//异或值：30
//1 2 3
//异或值：6
//15 16 17
//异或值：62
//135 136 137
//异或值：30
//95 96 97
//异或值：126
//119 120 121
//异或值：30
//536870911 536870912 536870913
//异或值：2147483646
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

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

#define endl '\n'
using ll = long long;
using pii = pair<int, int>;
const double PI = acos(-1);
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
void solve() {
	ll l,r;cin>>l>>r;
	if(r-l>1) {
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
		return;
	}
	ll pre=0;
	int i=30;
	for(;i>=0;i--){
		if((l>>i)==(r>>i)){
			if((l>>i)&1){
				l-=(1<<i);
				r-=(1<<i);
				pre+=(1<<i);
			}
		}
		else break;
	}
	if((1<<i)==r){
		r=pre+r;
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
//		cout<<"异或值："<<(((r-2)^(r-1))+((r-2)^r)+((r-1)^r))<<endl;
	}
	else{
		r=pre+(1<<i);
		cout<<r-1<<" "<<r<<" "<<r+1<<endl;
//		cout<<"异或值："<<(((r-1)^r)+((r-1)^(r+1))+((r+1)^r))<<endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	
	int T = 1;
	cin>>T;
	while (T--) {
		solve();
	}
	
	return 0;
}
//异或值：6
//6 7 8
//异或值：30
//1 2 3
//异或值：6
//15 16 17
//异或值：62
//135 136 137
//异或值：30
//95 96 97
//异或值：126
//119 120 121
//异或值：30
//536870911 536870912 536870913
//异或值：2147483646




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

#define endl '\n'
using ll = long long;
using pii = pair<int, int>;
const double PI = acos(-1);
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
void solve() {
	ll l,r;cin>>l>>r;
	if(r-l==2) {
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
		return;
	}
	ll pre=0;
	int i=30;
	for(;i>=0;i--){
		if((l>>i)==(r>>i)){
			if((l>>i)&1){
				l-=(1<<i);
				r-=(1<<i);
				pre+=(1<<i);
			}
		}
		else break;
	}
	if((1<<i)==r){
		r=pre+r;
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
		cout<<"异或值："<<(((r-2)^(r-1))+((r-2)^r)+((r-1)^r))<<endl;
	}
	else{
		r=pre+(1<<i);
		cout<<r-1<<" "<<r<<" "<<r+1<<endl;
		cout<<"异或值："<<(((r-1)^r)+((r-1)^(r+1))+((r+1)^r))<<endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	
	int T = 1;
	cin>>T;
	while (T--) {
		solve();
	}
	
	return 0;
}
//异或值：6
//6 7 8
//异或值：30
//1 2 3
//异或值：6
//15 16 17
//异或值：62
//135 136 137
//异或值：30
//95 96 97
//异或值：126
//119 120 121
//异或值：30
//536870911 536870912 536870913
//异或值：2147483646
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

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

#define endl '\n'
using ll = long long;
using pii = pair<int, int>;
const double PI = acos(-1);
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
void solve() {
	ll l,r;cin>>l>>r;
	ll pre=0;
	int i=30;
	for(;i>=0;i--){
		if((l>>i)==(r>>i)){
			if((l>>i)&1){
				l-=(1<<i);
				r-=(1<<i);
				pre+=(1<<i);
			}
		}
		else break;
	}
	if(ceil(log10(r*1.)/log10(2*1.))==floor(log10(r*1.)/log10(2*1.))){
		r=pre+r;
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
//		cout<<"异或值："<<(((r-2)^(r-1))+((r-2)^r)+((r-1)^r))<<endl;
	}
	else{
		r=pre+(1<<i);
		cout<<r-1<<" "<<r<<" "<<r+1<<endl;
//		cout<<"异或值："<<(((r-1)^r)+((r-1)^(r+1))+((r+1)^r))<<endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	
	int T = 1;
	cin>>T;
	while (T--) {
		solve();
	}
	
	return 0;
}
//异或值：6
//6 7 8
//异或值：30
//1 2 3
//异或值：6
//15 16 17
//异或值：62
//135 136 137
//异或值：30
//95 96 97
//异或值：126
//119 120 121
//异或值：30
//536870911 536870912 536870913
//异或值：2147483646




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

#define endl '\n'
using ll = long long;
using pii = pair<int, int>;
const double PI = acos(-1);
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
void solve() {
	ll l,r;cin>>l>>r;
	if(r-l>1) {
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
		return;
	}
	ll pre=0;
	int i=30;
	for(;i>=0;i--){
		if((l>>i)==(r>>i)){
			if((l>>i)&1){
				l-=(1<<i);
				r-=(1<<i);
				pre+=(1<<i);
			}
		}
		else break;
	}
	if(ceil(log10(r*1.)/log10(2*1.))==floor(log10(r*1.)/log10(2*1.))){
		r=pre+r;
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
//		cout<<"异或值："<<(((r-2)^(r-1))+((r-2)^r)+((r-1)^r))<<endl;
	}
	else{
		r=pre+(1<<i);
		cout<<r-1<<" "<<r<<" "<<r+1<<endl;
//		cout<<"异或值："<<(((r-1)^r)+((r-1)^(r+1))+((r+1)^r))<<endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	
	int T = 1;
	cin>>T;
	while (T--) {
		solve();
	}
	
	return 0;
}
//异或值：6
//6 7 8
//异或值：30
//1 2 3
//异或值：6
//15 16 17
//异或值：62
//135 136 137
//异或值：30
//95 96 97
//异或值：126
//119 120 121
//异或值：30
//536870911 536870912 536870913
//异或值：2147483646
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

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

#define endl '\n'
using ll = long long;
using pii = pair<int, int>;
const double PI = acos(-1);
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
void solve() {
	ll l,r;cin>>l>>r;
	if(r-l>1) {
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
		return;
	}
	ll pre=0;
	int i=30;
	for(;i>=0;i--){
		if((l>>i)==(r>>i)){
			if((l>>i)&1){
				l-=(1<<i);
				r-=(1<<i);
				pre+=(1<<i);
			}
		}
		else break;
	}
	if(ceil(log10(r*1.)/log10(2*1.))==floor(log10(r*1.)/log10(2*1.))){
		r=pre+r;
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
//		cout<<"异或值："<<(((r-2)^(r-1))+((r-2)^r)+((r-1)^r))<<endl;
	}
	else{
		r=pre+(1<<i);
		cout<<r-1<<" "<<r<<" "<<r+1<<endl;
//		cout<<"异或值："<<(((r-1)^r)+((r-1)^(r+1))+((r+1)^r))<<endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	
	int T = 1;
	cin>>T;
	while (T--) {
		solve();
	}
	
	return 0;
}
//异或值：6
//6 7 8
//异或值：30
//1 2 3
//异或值：6
//15 16 17
//异或值：62
//135 136 137
//异或值：30
//95 96 97
//异或值：126
//119 120 121
//异或值：30
//536870911 536870912 536870913
//异或值：2147483646




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

#define endl '\n'
using ll = long long;
using pii = pair<int, int>;
const double PI = acos(-1);
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
void solve() {
	ll l,r;cin>>l>>r;
	if(r-l>1) {
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
		return;
	}
	ll pre=0;
	int i=30;
	for(;i>=0;i--){
		if((l>>i)==(r>>i)){
			if((l>>i)&1){
				l-=(1<<i);
				r-=(1<<i);
				pre+=(1<<i);
			}
		}
		else break;
	}
	if((1<<i)==r){
		r=pre+r;
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
//		cout<<"异或值："<<(((r-2)^(r-1))+((r-2)^r)+((r-1)^r))<<endl;
	}
	else{
		r=pre+(1<<i);
		cout<<r-1<<" "<<r<<" "<<r+1<<endl;
//		cout<<"异或值："<<(((r-1)^r)+((r-1)^(r+1))+((r+1)^r))<<endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	
	int T = 1;
	cin>>T;
	while (T--) {
		solve();
	}
	
	return 0;
}
//异或值：6
//6 7 8
//异或值：30
//1 2 3
//异或值：6
//15 16 17
//异或值：62
//135 136 137
//异或值：30
//95 96 97
//异或值：126
//119 120 121
//异或值：30
//536870911 536870912 536870913
//异或值：2147483646
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)


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

#define endl '\n'
using ll = long long;
using pii = pair<int, int>;
const double PI = acos(-1);
const int N = 1e5 + 10;
const int mod = 1e9 + 7;
void solve() {
	ll l,r;cin>>l>>r;
	ll pre=0;
	int i=30;
	for(;i>=0;i--){
		if((l>>i)==(r>>i)){
			if((l>>i)&1){
				l-=(1<<i);
				r-=(1<<i);
				pre+=(1<<i);
			}
		}
		else break;
	}
	if(ceil(log10(r*1.)/log10(2*1.))==floor(log10(r*1.)/log10(2*1.))){
		r=pre+r;
		cout<<r-2<<" "<<r-1<<" "<<r<<endl;
//		cout<<"异或值："<<(((r-2)^(r-1))+((r-2)^r)+((r-1)^r))<<endl;
	}
	else{
		r=pre+(1<<i);
		cout<<r-1<<" "<<r<<" "<<r+1<<endl;
//		cout<<"异或值："<<(((r-1)^r)+((r-1)^(r+1))+((r+1)^r))<<endl;
	}
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr), cout.tie(nullptr);
	
	int T = 1;
	cin>>T;
	while (T--) {
		solve();
	}
	
	return 0;
}
//异或值：6
//6 7 8
//异或值：30
//1 2 3
//异或值：6
//15 16 17
//异或值：62
//135 136 137
//异或值：30
//95 96 97
//异或值：126
//119 120 121
//异或值：30
//536870911 536870912 536870913
//异或值：2147483646
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
 
using namespace std;
#define debug(x) cout << #x << " " << x << endl;

void solve() {
    int l ,r ;
    cin >> l >> r ;
    int val = 0 ;
    for (int i = 30 ; i >= 0 ; i --) {
        if (r & (1 << i)) {
            val = (1 << i) ;
            break ;
        }
    }

    if (val > l) {
        cout << val << " " << val - 1 << " " << (val != r ? r : val - 2) << '\n' ;
        return ;
    }
    int diff = r - l + 1 ;
    val = 0 ;

    for (int i = 30 ; i >= 0 ; i --) {
        if (diff & (1 << i)) {
            val = (1 << i) ;
            break ;
        }
    }
    cout << l + val << " " << l + val - 1 << " " << l + val - 2 << '\n' ;
 }
int main(){
    
    #ifndef ONLINE_JUDGE
 
    // freopen("radio.in", "r", stdin);   // file input.txt is opened in reading mode i.e "r"
 
    // freopen("radio.out", "w", stdout); // file output.txt is opened in writing mode i.e "w"
 
    freopen("input.txt","r",stdin);
 
    freopen("output.txt","w",stdout);
 
     #endif
 
    ios_base::sync_with_stdio(0);
 
    cin.tie(0); 
 
    cout.tie(0);
 
    int t ;
 
    t = 1 ;
 
    cin >> t;
 
    while(t--) {
      
      solve();
    }
 
 
    return 0;
 
}




Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
 
using namespace std;
#define debug(x) cout << #x << " " << x << endl;

void solve() {
    int l ,r ;
    cin >> l >> r ;
    int val = l^r ;
    int bit = 0 ;
    for (int i = 30 ; i >= 0 ; i --) {
        if ((1 << i) & val) {
            bit = i ;
            break ;
        }
    }
    int a = l | ((1 << bit)-1) ;
    int b = a + 1 ;
    int c = (b != l ? l : r) ;
    cout << a << " " << b << " " << c << '\n' ;
 }
int main(){
    
    #ifndef ONLINE_JUDGE
 
    // freopen("radio.in", "r", stdin);   // file input.txt is opened in reading mode i.e "r"
 
    // freopen("radio.out", "w", stdout); // file output.txt is opened in writing mode i.e "w"
 
    freopen("input.txt","r",stdin);
 
    freopen("output.txt","w",stdout);
 
     #endif
 
    ios_base::sync_with_stdio(0);
 
    cin.tie(0); 
 
    cout.tie(0);
 
    int t ;
 
    t = 1 ;
 
    cin >> t;
 
    while(t--) {
      
      solve();
    }
 
 
    return 0;
 
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
 
using namespace std;
#define debug(x) cout << #x << " " << x << endl;

void solve() {
    int l ,r ;
    cin >> l >> r ;
    int val = 0 ;
    for (int i = 30 ; i >= 0 ; i --) {
        if (r & (1 << i)) {
            val = (1 << i) ;
            break ;
        }
    }

    if (val != l) {
        cout << val << " " << val - 1 << " " << (val != r ? r : val - 2) << '\n' ;
        return ;
    }
    int diff = r - l + 1 ;
    val = 0 ;

    for (int i = 30 ; i >= 0 ; i --) {
        if (diff & (1 << i)) {
            val = (1 << i) ;
            break ;
        }
    }
    cout << l + val << " " << l + val - 1 << " " << l + val - 2 << '\n' ;
 }
int main(){
    
    #ifndef ONLINE_JUDGE
 
    // freopen("radio.in", "r", stdin);   // file input.txt is opened in reading mode i.e "r"
 
    // freopen("radio.out", "w", stdout); // file output.txt is opened in writing mode i.e "w"
 
    freopen("input.txt","r",stdin);
 
    freopen("output.txt","w",stdout);
 
     #endif
 
    ios_base::sync_with_stdio(0);
 
    cin.tie(0); 
 
    cout.tie(0);
 
    int t ;
 
    t = 1 ;
 
    cin >> t;
 
    while(t--) {
      
      solve();
    }
 
 
    return 0;
 
}




Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
 
using namespace std;
#define debug(x) cout << #x << " " << x << endl;

void solve() {
    int l ,r ;
    cin >> l >> r ;
    int val = 0 ;
    for (int i = 30 ; i >= 0 ; i --) {
        if (r & (1 << i)) {
            val = (1 << i) ;
            break ;
        }
    }

    if (val > l) {
        cout << val << " " << val - 1 << " " << (val != r ? r : val - 2) << '\n' ;
        return ;
    }
    int diff = r - l + 1 ;
    val = 0 ;

    for (int i = 30 ; i >= 0 ; i --) {
        if (diff & (1 << i)) {
            val = (1 << i) ;
            break ;
        }
    }
    cout << l + val << " " << l + val - 1 << " " << l + val - 2 << '\n' ;
 }
int main(){
    
    #ifndef ONLINE_JUDGE
 
    // freopen("radio.in", "r", stdin);   // file input.txt is opened in reading mode i.e "r"
 
    // freopen("radio.out", "w", stdout); // file output.txt is opened in writing mode i.e "w"
 
    freopen("input.txt","r",stdin);
 
    freopen("output.txt","w",stdout);
 
     #endif
 
    ios_base::sync_with_stdio(0);
 
    cin.tie(0); 
 
    cout.tie(0);
 
    int t ;
 
    t = 1 ;
 
    cin >> t;
 
    while(t--) {
      
      solve();
    }
 
 
    return 0;
 
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
 
using namespace std;
#define debug(x) cout << #x << " " << x << endl;


int64_t mp[1001001] ;

void solve() {
    int l ,r ;
    cin >> l >> r ;
    int val = 0 ;
    for (int i = 30 ; i >= 0 ; i --) {
        if (r & (1 << i)) {
            val = (1 << i) ;
            break ;
        }
    }

    cout << val << " " << val - 1 << " " << (val-1 != l ? l : r) << '\n' ;
}
int main(){
    
    #ifndef ONLINE_JUDGE
 
    // freopen("radio.in", "r", stdin);   // file input.txt is opened in reading mode i.e "r"
 
    // freopen("radio.out", "w", stdout); // file output.txt is opened in writing mode i.e "w"
 
    freopen("input.txt","r",stdin);
 
    freopen("output.txt","w",stdout);
 
     #endif
 
    ios_base::sync_with_stdio(0);
 
    cin.tie(0); 
 
    cout.tie(0);
 
    int t ;
 
    t = 1 ;
 
    cin >> t;
 
    while(t--) {
      
      solve();
    }
 
 
    return 0;
 
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
 
using namespace std;
#define debug(x) cout << #x << " " << x << endl;

void solve() {
    int l ,r ;
    cin >> l >> r ;
    int val = l^r ;
    int bit = 0 ;
    for (int i = 30 ; i >= 0 ; i --) {
        if ((1 << i) & val) {
            bit = i ;
            break ;
        }
    }
    int a = l | ((1 << bit)-1) ;
    int b = a + 1 ;
    int c = (b != l ? l : r) ;
    cout << a << " " << b << " " << c << '\n' ;
 }
int main(){
    
    #ifndef ONLINE_JUDGE
 
    // freopen("radio.in", "r", stdin);   // file input.txt is opened in reading mode i.e "r"
 
    // freopen("radio.out", "w", stdout); // file output.txt is opened in writing mode i.e "w"
 
    freopen("input.txt","r",stdin);
 
    freopen("output.txt","w",stdout);
 
     #endif
 
    ios_base::sync_with_stdio(0);
 
    cin.tie(0); 
 
    cout.tie(0);
 
    int t ;
 
    t = 1 ;
 
    cin >> t;
 
    while(t--) {
      
      solve();
    }
 
 
    return 0;
 
}




Submission (verdict: Accepted):
#include <bits/stdc++.h>
 
using namespace std;
#define debug(x) cout << #x << " " << x << endl;

void solve() {
    int l ,r ;
    cin >> l >> r ;
    int val = l^r ;
    int bit = 0 ;
    for (int i = 30 ; i >= 0 ; i --) {
        if ((1 << i) & val) {
            bit = i ;
            break ;
        }
    }
    int a = l | ((1 << bit)-1) ;
    int b = a + 1 ;
    int c = (a != l ? l : r) ;
    cout << a << " " << b << " " << c << '\n' ;
 }
int main(){
    
    #ifndef ONLINE_JUDGE
 
    // freopen("radio.in", "r", stdin);   // file input.txt is opened in reading mode i.e "r"
 
    // freopen("radio.out", "w", stdout); // file output.txt is opened in writing mode i.e "w"
 
    freopen("input.txt","r",stdin);
 
    freopen("output.txt","w",stdout);
 
     #endif
 
    ios_base::sync_with_stdio(0);
 
    cin.tie(0); 
 
    cout.tie(0);
 
    int t ;
 
    t = 1 ;
 
    cin >> t;
 
    while(t--) {
      
      solve();
    }
 
 
    return 0;
 
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
 
using namespace std;
#define debug(x) cout << #x << " " << x << endl;


int64_t mp[1001001] ;

void solve() {
    int l ,r ;
    cin >> l >> r ;
    int val = 0 ;
    for (int i = 30 ; i >= 0 ; i --) {
        if (r & (1 << i)) {
            val = (1 << i) ;
            break ;
        }
    }

    cout << val << " " << val - 1 << " " << (val-1 != l ? l : r) << '\n' ;
}
int main(){
    
    #ifndef ONLINE_JUDGE
 
    // freopen("radio.in", "r", stdin);   // file input.txt is opened in reading mode i.e "r"
 
    // freopen("radio.out", "w", stdout); // file output.txt is opened in writing mode i.e "w"
 
    freopen("input.txt","r",stdin);
 
    freopen("output.txt","w",stdout);
 
     #endif
 
    ios_base::sync_with_stdio(0);
 
    cin.tie(0); 
 
    cout.tie(0);
 
    int t ;
 
    t = 1 ;
 
    cin >> t;
 
    while(t--) {
      
      solve();
    }
 
 
    return 0;
 
}




Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
 
using namespace std;
#define debug(x) cout << #x << " " << x << endl;

void solve() {
    int l ,r ;
    cin >> l >> r ;
    int val = 0 ;
    for (int i = 30 ; i >= 0 ; i --) {
        if (r & (1 << i)) {
            val = (1 << i) ;
            break ;
        }
    }

    if (val != l) {
        cout << val << " " << val - 1 << " " << (val != r ? r : val - 2) << '\n' ;
        return ;
    }
    int diff = r - l + 1 ;
    val = 0 ;

    for (int i = 30 ; i >= 0 ; i --) {
        if (diff & (1 << i)) {
            val = (1 << i) ;
            break ;
        }
    }
    cout << l + val << " " << l + val - 1 << " " << l + val - 2 << '\n' ;
 }
int main(){
    
    #ifndef ONLINE_JUDGE
 
    // freopen("radio.in", "r", stdin);   // file input.txt is opened in reading mode i.e "r"
 
    // freopen("radio.out", "w", stdout); // file output.txt is opened in writing mode i.e "w"
 
    freopen("input.txt","r",stdin);
 
    freopen("output.txt","w",stdout);
 
     #endif
 
    ios_base::sync_with_stdio(0);
 
    cin.tie(0); 
 
    cout.tie(0);
 
    int t ;
 
    t = 1 ;
 
    cin >> t;
 
    while(t--) {
      
      solve();
    }
 
 
    return 0;
 
}