ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050D - Digital string maximization
Language: C++20 (GCC 13-64)

Previous submission (verdict: Time limit exceeded on test 6):
#include <bits/stdc++.h>

using namespace std;

using ll = long long;



void solve() {

// ll n;

// cin >> n;

// vector<ll> a(n);

// for (ll i = 0; i < n; i++) {

//     cin >> a[i];

// }



string s; cin >> s;

ll length = s.size();



while(length--) {

for (ll i = 0; i < s.size() - 1; i++) {

if (s[i] < s[i + 1] - 1) {

s[i + 1] -= 1;

swap(s[i], s[i + 1]);

}

}

}



cout << s << "\n";





}



int main() {

ios::sync_with_stdio(0);

cin.tie(0);

ll t;

cin >> t;

while (t--) {

solve();

}

return 0;

}



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

using namespace std;

using ll = long long;



void solve() {

// ll n;

// cin >> n;

// vector<ll> a(n);

// for (ll i = 0; i < n; i++) {

//     cin >> a[i];

// }



string s; cin >> s;

ll length = s.size();



while(length--) {

bool flag = false;

for (ll i = 0; i < s.size() - 1; i++) {

if (s[i] < s[i + 1] - 1) {

s[i + 1] -= 1;

swap(s[i], s[i + 1]);

flag = true;

}

}

if (!flag) {

break;

}

}



cout << s << "\n";





}



int main() {

ios::sync_with_stdio(0);

cin.tie(0);

ll t;

cin >> t;

while (t--) {

solve();

}

return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)

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

using namespace std;

using ll = long long;

using ull = unsigned long long;

using ld = long double;

using pii = pair<int, int>;

using pll = pair<ll, ll>;



const int MOD = 1e9 + 7;

const int INF = 1e9;

const ll LINF = 1e18;



#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

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

#define pb push_back

#define mp make_pair

#define fi first

#define se second

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

#define rep(i, a, b) for (int i = a; i < b; ++i)

#define repr(i, a, b) for (int i = a; i > b; --i)



#define debug(x) cerr << #x << " = " << (x) << endl



//<------------------------------------------------------------------------------------------------>



void solve() {

    ll n;

    cin >> n;

    vector<int> a(n);

    for(auto& x : a) {

        cin >> x;

    }

    vector<int> temp = a;

    sort(temp.begin(), temp.end());

    if(temp == a) {

        cout << "YES" << endl;

        return;

    }

    bool flag = false;

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

        if(a[i] >= a[i+1]) {

            flag = true;

            break;

        }else {

            a[i+1] -= a[i];

        }

    }

    if(flag) {

        cout << "NO" << endl;

    }else {

        cout << "YES" << endl;

    }



}



int main() {

    FAST_IO;

    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}

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

using namespace std;

using ll = long long;

using ull = unsigned long long;

using ld = long double;

using pii = pair<int, int>;

using pll = pair<ll, ll>;



const int MOD = 1e9 + 7;

const int INF = 1e9;

const ll LINF = 1e18;



#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

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

#define pb push_back

#define mp make_pair

#define fi first

#define se second

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

#define rep(i, a, b) for (int i = a; i < b; ++i)

#define repr(i, a, b) for (int i = a; i > b; --i)



#define debug(x) cerr << #x << " = " << (x) << endl



//<------------------------------------------------------------------------------------------------>



void solve() {

    ll n;

    cin >> n;

    vector<int> a(n);

    for(auto& x : a) {

        cin >> x;

    }

    vector<int> temp = a;

    sort(temp.begin(), temp.end());

    if(temp == a) {

        cout << "YES" << endl;

        return;

    }

    bool flag = false;

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

        if(a[i] > a[i+1]) {

            flag = true;

            break;

        }else {

            a[i+1] -= a[i];

        }

    }

    if(flag) {

        cout << "NO" << endl;

    }else {

        cout << "YES" << endl;

    }



}



int main() {

    FAST_IO;

    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)


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

using namespace std;

using ll = long long;

using ull = unsigned long long;

using ld = long double;

using pii = pair<int, int>;

using pll = pair<ll, ll>;



const int MOD = 1e9 + 7;

const int INF = 1e9;

const ll LINF = 1e18;



#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

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

#define pb push_back

#define mp make_pair

#define fi first

#define se second

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

#define rep(i, a, b) for (int i = a; i < b; ++i)

#define repr(i, a, b) for (int i = a; i > b; --i)



#define debug(x) cerr << #x << " = " << (x) << endl



//<------------------------------------------------------------------------------------------------>



void solve() {

    ll n;

    cin >> n;

    vector<int> a(n);

    for(auto& x : a) {

        cin >> x;

    }

    vector<int> temp = a;

    sort(temp.begin(), temp.end());

    if(temp == a) {

        cout << "YES" << endl;

        return;

    }

    int first = a[0];

    int second = a[1];

    if(first < second) {

        cout << "YES" << endl;

    }else {

        cout << "NO" << endl;

    }



}



int main() {

    FAST_IO;

    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)

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

using namespace std;

using ll = long long;

using ull = unsigned long long;

using ld = long double;

using pii = pair<int, int>;

using pll = pair<ll, ll>;



const int MOD = 1e9 + 7;

const int INF = 1e9;

const ll LINF = 1e18;



#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

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

#define pb push_back

#define mp make_pair

#define fi first

#define se second

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

#define rep(i, a, b) for (int i = a; i < b; ++i)

#define repr(i, a, b) for (int i = a; i > b; --i)



#define debug(x) cerr << #x << " = " << (x) << endl



//<------------------------------------------------------------------------------------------------>



void solve() {

    ll n;

    cin >> n;

    vector<int> a(n);

    for(auto& x : a) {

        cin >> x;

    }

    vector<int> temp = a;

    sort(temp.begin(), temp.end());

    if(temp == a) {

        cout << "YES" << endl;

        return;

    }

    int first = a[0];

    int second = a[1];

    if(first < second) {

        cout << "YES" << endl;

    }else {

        cout << "NO" << endl;

    }



}



int main() {

    FAST_IO;

    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}

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

using namespace std;

using ll = long long;

using ull = unsigned long long;

using ld = long double;

using pii = pair<int, int>;

using pll = pair<ll, ll>;



const int MOD = 1e9 + 7;

const int INF = 1e9;

const ll LINF = 1e18;



#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

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

#define pb push_back

#define mp make_pair

#define fi first

#define se second

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

#define rep(i, a, b) for (int i = a; i < b; ++i)

#define repr(i, a, b) for (int i = a; i > b; --i)



#define debug(x) cerr << #x << " = " << (x) << endl



//<------------------------------------------------------------------------------------------------>



void solve() {

    ll n;

    cin >> n;

    vector<int> a(n);

    for(auto& x : a) {

        cin >> x;

    }

    vector<int> temp = a;

    sort(temp.begin(), temp.end());

    if(temp == a) {

        cout << "YES" << endl;

        return;

    }

    bool flag = false;

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

        if(a[i] >= a[i+1]) {

            flag = true;

            break;

        }else {

            a[i+1] -= a[i];

        }

    }

    if(flag) {

        cout << "NO" << endl;

    }else {

        cout << "YES" << endl;

    }



}



int main() {

    FAST_IO;

    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

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

using namespace std;

using ll = long long;

using ull = unsigned long long;

using ld = long double;

using pii = pair<int, int>;

using pll = pair<ll, ll>;



const int MOD = 1e9 + 7;

const int INF = 1e9;

const ll LINF = 1e18;



#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

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

#define pb push_back

#define mp make_pair

#define fi first

#define se second

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

#define rep(i, a, b) for (int i = a; i < b; ++i)

#define repr(i, a, b) for (int i = a; i > b; --i)



#define debug(x) cerr << #x << " = " << (x) << endl



//<------------------------------------------------------------------------------------------------>



void solve() {

    ll n, l, r;

    cin >> n >> l >> r;

    vector<int> a(n);

    for(auto& x : a) cin >> x;

    sort(a.begin(), a.end());

    ll k = r-l+1;

    ll ans = 0;

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

        ans += a[i];

    }

    cout << ans << endl;

}



int main() {

    FAST_IO;

    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}

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

using namespace std;

using ll = long long;

using ull = unsigned long long;

using ld = long double;

using pii = pair<int, int>;

using pll = pair<ll, ll>;



const int MOD = 1e9 + 7;

const int INF = 1e9;

const ll LINF = 1e18;



#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

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

#define pb push_back

#define mp make_pair

#define fi first

#define se second

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

#define rep(i, a, b) for (int i = a; i < b; ++i)

#define repr(i, a, b) for (int i = a; i > b; --i)



#define debug(x) cerr << #x << " = " << (x) << endl



//<------------------------------------------------------------------------------------------------>



void solve() {

    ll n, l, r;

    cin >> n >> l >> r;

    vector<int> a(n);

    for(auto& x : a) cin >> x;

    sort(a.begin(), a.end());

    ll k = r-l+1;

    ll ans = 0;

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

        ans += a[i];

    }

    vector<int> a1, a2, a3;

    for(int i = 0; i < l-1; i++) {

        a1.push_back(a[i]);

    }

    for(int i = l-1; i <r; i++) {

        a2.push_back(a[i]);

    }

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

        a3.push_back(a[i]);

    }

    ans = accumulate(a2.begin(), a2.end(), 0LL);

    sort(a1.begin(), a1.end());

    sort(a2.begin(), a2.end(), greater<int>());

    sort(a3.begin(), a3.end());

    for(int i = 0; i < min(a1.size(), a2.size()); i++) {

        ans = min(ans, ans + a1[i] - a2[i]);

    }

    for(int i = 0; i < min(a3.size(), a2.size()); i++) {

        ans = min(ans, ans + a3[i] - a2[i]);

    }

    //cout << a1.size() << ' ' << a2.size() << ' ' << a3.size() << endl;

    cout << ans << endl;

}



int main() {

    FAST_IO;

    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)


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

using namespace std;

using ll = long long;

using ull = unsigned long long;

using ld = long double;

using pii = pair<int, int>;

using pll = pair<ll, ll>;



const int MOD = 1e9 + 7;

const int INF = 1e9;

const ll LINF = 1e18;



#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)

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

#define pb push_back

#define mp make_pair

#define fi first

#define se second

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

#define rep(i, a, b) for (int i = a; i < b; ++i)

#define repr(i, a, b) for (int i = a; i > b; --i)



#define debug(x) cerr << #x << " = " << (x) << endl



//<------------------------------------------------------------------------------------------------>



void solve() {

    ll n, l, r;

    cin >> n >> l >> r;

    vector<int> a(n);

    for(auto& x : a) cin >> x;

    sort(a.begin(), a.end());

    ll k = r-l+1;

    ll ans = 0;

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

        ans += a[i];

    }

    cout << ans << endl;

}



int main() {

    FAST_IO;

    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}
Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Runtime error on test 9):
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
#define int long long
#define fr(i,a,b) for(int i=a;i<b;i++)

int power(int a, int b) {
    int result = 1;
    while (b) {
        if (b & 1) 
            result = result * a;
        a = a * a;
        b >>= 1;
    }
    return result;
}
int log_a_base_b(int a , int b){
    int cnt=0;
    while(a!=0){
        a/=b;
        cnt++;
    }
    return cnt;
}
void solve(){
    int n,m;
    cin >> n>>m ;
    multiset<int> s1;
    multiset<int> s2;
    fr(i,0,n){
        int x;
        cin>>x;
        s1.insert(x);
    }
    fr(i,0,m){
        int x;
        cin>>x;
        s2.insert(x);
    }
    int f=1;
    while(!s1.empty() && !s2.empty()){
        auto it1=--s1.end(),it2=--s2.end();
        if(*it2>*it1){
            s2.erase(it2);
            int x=floor((*it2)*1.0/2);
            int y=ceil((*it2)*1.0/2);
            s2.insert(x);
            s2.insert(y);
            // cout<<x<<" "<<y;
        }
        else{
            if(*it2==*it1){
                s1.erase(it1);
                s2.erase(it2);
                // cout<<" = "  << *it1<<" = ";
            }
            else{
                f=0;
                break;
            }
        }
        if(s2.size()>s1.size()){
            f=0;
            break;
        }
    }
    if(!f) cout<<"No"<<endl;
    else{
        if(s1.empty() && s2.empty()){
            cout<<"Yes"<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
        
    }
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    #endif
    int t;
    cin >> t;
    while(t--)
    {
        solve();
    }
}
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)

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

#define ar array

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

using namespace std;

typedef long long ll;



void solve() {

    int n, m;

    cin >> n >> m;

    multiset <int> a;

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

        int x;

        cin >> x;

        a.insert(x);

    }

    int ok = 1;

    function <bool(int)> check = [&] (int x) -> bool {

        if (x == 0)

            return false;

        if (a.count(x)) {

            a.erase(a.find(x));

            return true;

        }

        int m = x >> 1;

        if (check(m))

            return check(x - m);

        return false;

    };

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

        int x; cin >> x;

        if (ok)

            ok &= check(x);

    }

    if (ok)

        cout << "Yes\n";

    else

        cout << "No\n";

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0); cout.tie(0);

    int t = 1;

    cin >> t;

    while (t--)

        solve();    

}

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

#define ar array

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

using namespace std;

typedef long long ll;



void solve() {

    int n, m;

    cin >> n >> m;

    multiset <int> a;

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

        int x;

        cin >> x;

        a.insert(x);

    }

    int ok = 1;

    function <bool(int)> check = [&] (int x) -> bool {

        if (x == 0)

            return false;

        if (a.count(x)) {

            a.erase(a.find(x));

            return true;

        }

        int m = x >> 1;

        if (check(m))

            return check(x - m);

        return false;

    };

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

        int x; cin >> x;

        if (ok)

            ok &= check(x);

    }

    if (ok && a.empty())

        cout << "Yes\n";

    else

        cout << "No\n";

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0); cout.tie(0);

    int t = 1;

    cin >> t;

    while (t--)

        solve();    

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

Previous submission (verdict: Runtime error on test 1):
#include <bits/stdc++.h>

#define ar array

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

using namespace std;

typedef long long ll;



void solve() {

    int n, m;

    cin >> n >> m;

    multiset <int> a;

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

        int x;

        cin >> x;

        a.insert(x);

    }

    int ok = 1;

    function <bool(int)> check = [&] (int x) -> bool {

        if (x < 0)

            return false;

        if (a.count(x)) {

            a.erase(a.find(x));

            return true;

        }

        int m = x >> 1;

        if (check(m))

            return check(x - m);

        return false;

    };

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

        int x; cin >> x;

        if (ok)

            ok &= check(x);

    }

    if (ok)

        cout << "Yes\n";

    else

        cout << "No\n";

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0); cout.tie(0);

    int t = 1;

    cin >> t;

    while (t--)

        solve();    

}

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

#define ar array

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

using namespace std;

typedef long long ll;



void solve() {

    int n, m;

    cin >> n >> m;

    multiset <int> a;

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

        int x;

        cin >> x;

        a.insert(x);

    }

    int ok = 1;

    function <bool(int)> check = [&] (int x) -> bool {

        if (x == 0)

            return false;

        if (a.count(x)) {

            a.erase(a.find(x));

            return true;

        }

        int m = x >> 1;

        if (check(m))

            return check(x - m);

        return false;

    };

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

        int x; cin >> x;

        if (ok)

            ok &= check(x);

    }

    if (ok)

        cout << "Yes\n";

    else

        cout << "No\n";

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0); cout.tie(0);

    int t = 1;

    cin >> t;

    while (t--)

        solve();    

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


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

#define ar array

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

using namespace std;

typedef long long ll;



void solve() {

    int n, m;

    cin >> n >> m;

    multiset <int> a;

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

        int x;

        cin >> x;

        a.insert(x);

    }

    int ok = 1;

    function <bool(int)> check = [&] (int x) -> bool {

        if (a.count(x)) {

            a.erase(a.find(x));

            return true;

        }

        int m = x >> 1;

        if (check(m))

            return check(x - m);

        return false;

    };

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

        int x; cin >> x;

        if (ok)

            ok &= check(x);

    }

    if (ok)

        cout << "Yes\n";

    else

        cout << "No\n";

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0); cout.tie(0);

    int t = 1;

    cin >> t;

    while (t--)

        solve();    

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

Previous submission (verdict: Runtime error on test 1):
#include <bits/stdc++.h>

#define ar array

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

using namespace std;

typedef long long ll;



void solve() {

    int n, m;

    cin >> n >> m;

    multiset <int> a;

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

        int x;

        cin >> x;

        a.insert(x);

    }

    int ok = 1;

    function <bool(int)> check = [&] (int x) -> bool {

        if (a.count(x)) {

            a.erase(a.find(x));

            return true;

        }

        int m = x >> 1;

        if (check(m))

            return check(x - m);

        return false;

    };

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

        int x; cin >> x;

        if (ok)

            ok &= check(x);

    }

    if (ok)

        cout << "Yes\n";

    else

        cout << "No\n";

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0); cout.tie(0);

    int t = 1;

    cin >> t;

    while (t--)

        solve();    

}

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

#define ar array

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

using namespace std;

typedef long long ll;



void solve() {

    int n, m;

    cin >> n >> m;

    multiset <int> a;

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

        int x;

        cin >> x;

        a.insert(x);

    }

    int ok = 1;

    function <bool(int)> check = [&] (int x) -> bool {

        if (x < 0)

            return false;

        if (a.count(x)) {

            a.erase(a.find(x));

            return true;

        }

        int m = x >> 1;

        if (check(m))

            return check(x - m);

        return false;

    };

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

        int x; cin >> x;

        if (ok)

            ok &= check(x);

    }

    if (ok)

        cout << "Yes\n";

    else

        cout << "No\n";

}



int main() {

    ios::sync_with_stdio(false);

    cin.tie(0); cout.tie(0);

    int t = 1;

    cin >> t;

    while (t--)

        solve();    

}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#include <bit>
#include <bitset>
using namespace std;
void go()
{
  unsigned l, r;
  cin >> l >> r;
  if (l + 2 == r)
  {
    cout << l << " " << l + 1 << " " << l + 2 << endl;
    return;
  }
  int add = 0;
  for (int i = bit_width(unsigned(r)) - 1; i >= 0; i--)
  {
    if ((r >> 1) == (l >> 1))
    {
      if (r >> i)
      {
        r -= 1 << i;
        l -= 1 << i;
        add += 1 << i;
      }
      else
        break;
    }
  }
  unsigned res = 0;
  if (has_single_bit(r))
    res += r + add;
  else
    res += bit_floor(r) + 1 + add;
  cout << res - 2 << " " << res - 1 << " " << res << endl;
}
int main()
{
  int t;
  cin >> t;
  while (t--)
    go();
  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>
#include <bit>
#include <bitset>
using namespace std;
void go()
{
  unsigned l, r;
  cin >> l >> r;
  if (l + 2 == r)
  {
    cout << l << " " << l + 1 << " " << l + 2 << endl;
    return;
  }
  int add = 0;
  for (int i = bit_width(unsigned(r)) - 1; i >= 0; i--)
  {
    if ((r >> 1) == (l >> 1))
    {
      if (r >> i)
      {
        r -= 1 << i;
        l -= 1 << i;
        add += 1 << i;
      }
      else
        break;
    }
  }
  unsigned res = 0;
  if (has_single_bit(r))
    res += r + add;
  else
    res += bit_floor(r) + 1 + add;
  cout << res - 2 << " " << res - 1 << " " << res << endl;
}
int main()
{
  int t;
  cin >> t;
  while (t--)
    go();
  return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#include <bit>
#include <bitset>
using namespace std;
void go()
{
  unsigned l, r;
  cin >> l >> r;
  if (l + 2 == r)
  {
    cout << l << " " << l + 1 << " " << l + 2 << endl;
    return;
  }
  int add = 0;
  for (int i = bit_width(unsigned(r)) - 1; i >= 0; i--)
  {
    if ((r >> i) == (l >> i))
    {
      if (r >> i)
      {
        r -= 1 << i;
        l -= 1 << i;
        add += 1 << i;
      }
      else
        break;
    }
  }
  unsigned res = 0;
  if (has_single_bit(r))
    res += r + add;
  else
    res += bit_floor(r) + 1 + add;
  cout << res - 2 << " " << res - 1 << " " << res << endl;
}
int main()
{
  int t;
  cin >> t;
  while (t--)
    go();
  return 0;
}