ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int t;
    cin >> t;
    while (t--){
        string num;
        cin >> num;
        int l = num.size();
        int qs = 0;
        int cnt2 = 0, cnt3 = 0;
        for (int i = 0; i < l; i++){
            if (num[i]-'0' == 2){
                cnt2++;
            }
            else if (num[i]-'0' == 3){
                cnt3++;
            }
            qs += num[i]-'0';
        }
        bool ch = false;
        qs%=9;
        if (qs == 0) ch = true;
        if (qs == 7 && cnt2 >= 1) ch = true;
        if (qs == 6 && (cnt2 >= 6 || cnt3 >= 2 || (cnt3 >= 1 && cnt2 >= 3))) ch = true;
        if (qs == 5 && cnt2 >= 2) ch = true;
        if (qs == 3 && (cnt2 >= 3 || cnt3 >= 1)) ch = true;
        if (qs == 2 && cnt2 >= 8 || (cnt3 >= 1 && cnt2 >= 5) || (cnt3 >= 2 && cnt2 >= 2)) ch = true;
        if (qs == 1 && (cnt2 >= 4 || (cnt2 >= 1 && cnt3 >= 1))) ch = true;
        if (ch) cout << "YES\n";
        else cout << "NO\n";
    }

    return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int t;
    cin >> t;
    while (t--){
        string num;
        cin >> num;
        int l = num.size();
        int qs = 0;
        int cnt2 = 0, cnt3 = 0;
        for (int i = 0; i < l; i++){
            if (num[i]-'0' == 2){
                cnt2++;
            }
            else if (num[i]-'0' == 3){
                cnt3++;
            }
            qs += num[i]-'0';
        }
        bool ch = false;
        qs%=9;
        if (qs == 0) ch = true;
        if (qs == 8 && (cnt2 >= 5 || (cnt3 >= 1 && cnt2 >= 2))) ch = true;
        if (qs == 7 && (cnt2 >= 1)) ch = true;
        if (qs == 6 && (cnt2 >= 6 || cnt3 >= 2 || (cnt3 >= 1 && cnt2 >= 3))) ch = true;
        if (qs == 5 && (cnt2 >= 2)) ch = true;
        if (qs == 4 && (cnt2 >= 6 || cnt3 >= 2 || (cnt3 >= 1 && cnt2 >= 3))) ch = true;
        if (qs == 3 && (cnt2 >= 3 || cnt3 >= 1)) ch = true;
        if (qs == 2 && (cnt2 >= 8 || (cnt3 >= 1 && cnt2 >= 5) || (cnt3 >= 2 && cnt2 >= 2))) ch = true;
        if (qs == 1 && (cnt2 >= 4 || (cnt2 >= 1 && cnt3 >= 1))) ch = true;
        if (ch) cout << "YES\n";
        else cout << "NO\n";
    }

    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int t;
    cin >> t;
    while (t--){
        string num;
        cin >> num;
        int l = num.size();
        int qs = 0;
        int cnt2 = 0, cnt3 = 0;
        for (int i = 0; i < l; i++){
            if (num[i]-'0' == 2){
                cnt2++;
            }
            else if (num[i]-'0' == 3){
                cnt3++;
            }
            qs += num[i]-'0';
        }
        bool ch = false;
        qs%=9;
        if (qs == 0) ch = true;
        if (qs == 8 && (cnt2 >= 5 || (cnt3 >= 1 && cnt2 >= 2))) ch = true;
        if (qs == 7 && (cnt2 >= 1)) ch = true;
        if (qs == 6 && (cnt2 >= 6 || cnt3 >= 2 || (cnt3 >= 1 && cnt2 >= 3))) ch = true;
        if (qs == 5 && (cnt2 >= 2)) ch = true;
        if (qs == 4 && (cnt2 >= 6 || cnt3 >= 2 || (cnt3 >= 1 && cnt2 >= 3))) ch = true;
        if (qs == 3 && (cnt2 >= 3 || cnt3 >= 1)) ch = true;
        if (qs == 2 && (cnt2 >= 8 || (cnt3 >= 1 && cnt2 >= 5) || (cnt3 >= 2 && cnt2 >= 2))) ch = true;
        if (qs == 1 && (cnt2 >= 4 || (cnt2 >= 1 && cnt3 >= 1))) ch = true;
        if (ch) cout << "YES\n";
        else cout << "NO\n";
    }

    return 0;
}


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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int t;
    cin >> t;
    while (t--){
        string num;
        cin >> num;
        int l = num.size();
        int qs = 0;
        int cnt2 = 0, cnt3 = 0;
        for (int i = 0; i < l; i++){
            if (num[i]-'0' == 2){
                cnt2++;
            }
            else if (num[i]-'0' == 3){
                cnt3++;
            }
            qs += num[i]-'0';
        }
        bool ch = false;
        int temp;
        for (int i = 0; i <= cnt2; i++){
            for (int j = 0; j <= cnt3; j++){
                temp = qs;
                qs += (2*i)+(6*j);
                if (qs%9==0) ch = true;
                if (ch) break;
                qs = temp;
            }
            if (ch) break;
        }
        if (ch) cout << "YES\n";
        else cout << "NO\n";
    }

    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)


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

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int t;
    cin >> t;
    while (t--){
        string num;
        cin >> num;
        int l = num.size();
        int qs = 0;
        int cnt2 = 0, cnt3 = 0;
        for (int i = 0; i < l; i++){
            if (num[i]-'0' == 2){
                cnt2++;
            }
            else if (num[i]-'0' == 3){
                cnt3++;
            }
            qs += num[i]-'0';
        }
        bool ch = false;
        qs%=9;
        if (qs == 0) ch = true;
        if (qs == 7 && cnt2 >= 1) ch = true;
        if (qs == 6 && (cnt2 >= 6 || cnt3 >= 2 || (cnt3 >= 1 && cnt2 >= 3))) ch = true;
        if (qs == 5 && cnt2 >= 2) ch = true;
        if (qs == 3 && (cnt2 >= 3 || cnt3 >= 1)) ch = true;
        if (qs == 2 && cnt2 >= 8 || (cnt3 >= 1 && cnt2 >= 5) || (cnt3 >= 2 && cnt2 >= 2)) ch = true;
        if (qs == 1 && (cnt2 >= 4 || (cnt2 >= 1 && cnt3 >= 1))) ch = true;
        if (ch) cout << "YES\n";
        else cout << "NO\n";
    }

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


Submission (verdict: Wrong answer on test 1):
#include <iostream>
 
using i64 = long long;
 
void solve() {
    int l, r;
    std::cin >> l >> r;
    int k = 31 - __builtin_clz(l ^ r);
    int a = l | ((1 << k) - 1), b = a + 1, c = (a == l ? r : l);
    std::cout << a << " " << b << " " << c << "\n";
}
 
signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
 
    int t = 1;
    std::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 i64 = long long;

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

    i64 a = l, c = r, b = 0;
    int pos;
    for (int i = 32; i >= 0; i --) {
        int x = a >> i & 1;
        int y = c >> i & 1;
        if (x ^ y) {
            pos = i;
            break;
        }
    }

    for (int i = 32; i > pos; i --) {
        int x = a >> i & 1;
        b += x * 1ll << i;
    }

    for (int i = pos; i >= 0; i --) {
        int x = a >> i & 1;
        int y = c >> i & 1;
        if (x ^ y == 0) {
            b += (!x) * 1ll << i;
        }
    }

    for (int i = pos; i >= 0; i --) {
        int x = a >> i & 1;
        int y = c >> i & 1;
        if (x ^ y) {
            if (b + (1ll << i) < c) {
                b += 1ll << i;
            }
        } 
    }

    std::cout << a << " " << b << " " << c << "\n";
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(20);

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

    while (T --) {
        solve();
    }

    return 0;
}

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

using i64 = long long;

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

    int a = l, c = r, b = 0;
    int pos;
    for (int i = 31; i >= 0; i --) {
        int x = a >> i & 1;
        int y = c >> i & 1;
        if (x ^ y) {
            pos = i;
            break;
        }
    }

    for (int i = 31; i > pos; i --) {
        int x = a >> i & 1;
        b += x * 1 << i;
    }

    for (int i = pos; i >= 0; i --) {
        int x = a >> i & 1;
        int y = c >> i & 1;
        if (x ^ y == 0) {
            b += (!x) << i;
        }
    }

    for (int i = pos; i >= 0; i --) {
        int x = a >> i & 1;
        int y = c >> i & 1;
        if (x ^ y) {
            if (b + (1 << i) < c) {
                b += 1 << i;
            }
        } 
    }

    std::cout << a << " " << b << " " << c << "\n";
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(20);

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

    while (T --) {
        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;

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

    i64 a = l, c = r, b = 0;
    int pos;
    for (int i = 32; i >= 0; i --) {
        int x = a >> i & 1;
        int y = c >> i & 1;
        if (x ^ y) {
            pos = i;
            break;
        }
    }

    for (int i = 32; i > pos; i --) {
        int x = a >> i & 1;
        b += x << i;
    }

    for (int i = pos; i >= 0; i --) {
        int x = a >> i & 1;
        int y = c >> i & 1;
        if (x ^ y) {
            if (b + (1 << i) < c) {
                b += 1ll << i;
            }
        } else {
            b += (!x) * 1ll << i;
        }
    }

    std::cout << a << " " << b << " " << c << "\n";
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(20);

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

    while (T --) {
        solve();
    }

    return 0;
}

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

using i64 = long long;

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

    i64 a = l, c = r, b = 0;
    int pos;
    for (int i = 32; i >= 0; i --) {
        int x = a >> i & 1;
        int y = c >> i & 1;
        if (x ^ y) {
            pos = i;
            break;
        }
    }

    for (int i = 32; i > pos; i --) {
        int x = a >> i & 1;
        b += x * 1ll << i;
    }

    for (int i = pos; i >= 0; i --) {
        int x = a >> i & 1;
        int y = c >> i & 1;
        if (x ^ y == 0) {
            b += (!x) * 1ll << i;
        }
    }

    for (int i = pos; i >= 0; i --) {
        int x = a >> i & 1;
        int y = c >> i & 1;
        if (x ^ y) {
            if (b + (1ll << i) < c) {
                b += 1ll << i;
            }
        } 
    }

    std::cout << a << " " << b << " " << c << "\n";
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(20);

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

    while (T --) {
        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 <iostream>
 
using i64 = long long;
 
void solve() {
    int l, r;
    std::cin >> l >> r;
    int k = 31 - __builtin_clz(l ^ r);
    int a = l | ((1 << k) - 1), b = a + 1, c = (a == l ? r : l);
    std::cout << a << " " << b << " " << c << "\n";
}
 
signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
 
    int t = 1;
    std::cin >> t;
 
    while (t--) {
        solve();
    }
}

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

using i64 = long long;

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

    i64 a = l, c = r, b = 0;
    int pos;
    for (int i = 32; i >= 0; i --) {
        int x = a >> i & 1;
        int y = c >> i & 1;
        if (x ^ y) {
            pos = i;
            break;
        }
    }

    for (int i = 32; i > pos; i --) {
        int x = a >> i & 1;
        b += x << i;
    }

    for (int i = pos; i >= 0; i --) {
        int x = a >> i & 1;
        int y = c >> i & 1;
        if (x ^ y) {
            if (b + (1 << i) < c) {
                b += 1ll << i;
            }
        } else {
            b += (!x) * 1ll << i;
        }
    }

    std::cout << a << " " << b << " " << c << "\n";
}

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(20);

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

    while (T --) {
        solve();
    }

    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

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

using i64 = long long;

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

    std::vector<int> a(n);
    for (int i = 0; i < n; i ++) {
        std::cin >> a[i];
    }

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

    i64 ans = 0;
    for (int i = 0; i < r - l + 1; i ++) {
        ans += a[i];
    }
    std::cout << ans << "\n";
} 

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(20);

    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;



void solve() {

    int n, l, r;

    std::cin >> n >> l >> r;

    l --, r --;



    std::vector<int> a(n), b(n);

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

        std::cin >> a[i];

    }



    b = a;



    std::sort(a.begin(), a.begin() + r);

    std::sort(a.begin() + l, a.end());



    i64 ans = 0;

    i64 res1 = 0, res2 = 0;

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

        res1 += a[i];

    }



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

        res2 += a[i];

    }

    

    ans = std::min(res1, res2);

    

    std::cout << ans << "\n";

} 



int main() {

    std::ios::sync_with_stdio(false);

    std::cin.tie(nullptr);

    std::cout << std::fixed << std::setprecision(20);



    int T = 1;

    std::cin >> T;



    while (T --) {

        solve();

    }



    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

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



using i64 = long long;



void solve() {

    int n, l, r;

    std::cin >> n >> l >> r;

    l --, r --;



    std::vector<int> a(n), b(n);

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

        std::cin >> a[i];

    }



    b = a;



    std::sort(a.begin(), a.begin() + r);

    std::sort(a.begin() + l, a.end());



    i64 ans = 0;

    i64 res1 = 0, res2 = 0;

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

        res1 += a[i];

    }



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

        res2 += a[i];

    }

    

    ans = std::min(res1, res2);

    

    std::cout << ans << "\n";

} 



int main() {

    std::ios::sync_with_stdio(false);

    std::cin.tie(nullptr);

    std::cout << std::fixed << std::setprecision(20);



    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;

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

    std::vector<int> a(n), b(n);
    for (int i = 0; i < n; i ++) {
        std::cin >> a[i];
    }

    b = a;

    std::sort(a.begin(), a.begin() + r);
    std::sort(b.begin() + l, b.end());

    i64 ans = 0;
    i64 res1 = 0, res2 = 0;
    for (int i = 0; i < r - l + 1; i ++) {
        res1 += a[i];
    }

    for (int i = l; i <= r; i ++) {
        res2 += b[i];
    }

    ans = std::min(res1, res2);
    
    std::cout << ans << "\n";
} 

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(20);

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

    while (T --) {
        solve();
    }

    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

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

using i64 = long long;

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

    std::vector<int> a(n), b(n);
    for (int i = 0; i < n; i ++) {
        std::cin >> a[i];
    }

    b = a;

    std::sort(a.begin(), a.begin() + r);
    std::sort(b.begin() + l, b.end());

    i64 ans = 0;
    i64 res1 = 0, res2 = 0;
    for (int i = 0; i < r - l + 1; i ++) {
        res1 += a[i];
    }

    for (int i = l; i <= r; i ++) {
        res2 += b[i];
    }

    ans = std::min(res1, res2);
    
    std::cout << ans << "\n";
} 

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(20);

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

    while (T --) {
        solve();
    }

    return 0;
}

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

using i64 = long long;

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

    std::vector<int> a(n), b(n);
    for (int i = 0; i < n; i ++) {
        std::cin >> a[i];
    }

    b = a;

    std::sort(a.begin(), a.begin() + r + 1);
    std::sort(b.begin() + l, b.end());

    i64 ans = 0;
    i64 res1 = 0, res2 = 0;
    for (int i = 0; i < r - l + 1; i ++) {
        res1 += a[i];
    }

    for (int i = l; i <= r; i ++) {
        res2 += b[i];
    }

    ans = std::min(res1, res2);
    
    std::cout << ans << "\n";
} 

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(20);

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

    while (T --) {
        solve();
    }

    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)


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

using i64 = long long;

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

    std::vector<int> a(n);
    for (int i = 0; i < n; i ++) {
        std::cin >> a[i];
    }

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

    i64 ans = 0;
    for (int i = 0; i < r - l + 1; i ++) {
        ans += a[i];
    }
    std::cout << ans << "\n";
} 

int main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(20);

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

    while (T --) {
        solve();
    }

    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
﻿#include<iostream>
#include<vector>
#include<queue>
#include<set>
#include<bitset>
#include<stack>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>
#include<assert.h>
#include <random>
using namespace std;
typedef long long ll;
ll N = 2e5 + 1, mod = 998244353, MOD = 1e9 + 7;
ll solve() {
    ll l, r; std::cin >> l >> r;
    ll a = 0, b = 0, c = 0;
    for (int i = 29; i >= 0; i++) {
        ll t = 1 << i;
        if ((l ^ r) & t) {
            a = t;
            b = t - 1;
            break;
        }
        else {
            a += t;
            b += t;
        }
    }
    c = l;
    while (c == a || c == b) {
        c++;
    }
    cout << a << ' ' << b << ' ' << c << ' ' << endl;
    return 0;
}
int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(0); cout.tie(0);
    int t = 1; cin >> t;
    while (t--) {
        //int t1 = clock();
        ll ans = solve();
        //int t2 = clock();
        //cout << "t:" << t2 - t1 << endl;
        //cout << ans << endl;
    }
    return 0;
}

Submission (verdict: Wrong answer on test 1):
﻿#include<iostream>
#include<vector>
#include<queue>
#include<set>
#include<bitset>
#include<stack>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>
#include<assert.h>
#include <random>
using namespace std;
typedef long long ll;
ll N = 2e5 + 1, mod = 998244353, MOD = 1e9 + 7;
ll solve() {
    ll l, r; std::cin >> l >> r;
    ll a = 0, b = 0, c = 0;
    cin >> a >> b >> c;
    for (int i = 29; i >= 0; i--) {
        ll t = 1 << i;
        if ((l ^ r) & t) {
            a |= t;
            b |= (t - 1);
            break;
        }
        else {
            if (l & t) {
                a += t;
                b += t;
            }
        }
    }
    c = l;
    while (c == a || c == b) {
        c++;
    }
    cout << a << ' ' << b << ' ' << c << ' ' << endl;
    //cout << (a ^ b) + (a ^ c) + (b ^ c) << endl;
    return 0;
}
int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(0); cout.tie(0);
    int t = 1; cin >> t;
    while (t--) {
        //int t1 = clock();
        ll ans = solve();
        //int t2 = clock();
        //cout << "t:" << t2 - t1 << endl;
        //cout << ans << endl;
    }
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
﻿#include<iostream>
#include<vector>
#include<queue>
#include<set>
#include<bitset>
#include<stack>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>
#include<assert.h>
#include <random>
using namespace std;
typedef long long ll;
ll N = 2e5 + 1, mod = 998244353, MOD = 1e9 + 7;
ll solve() {
    ll l, r; std::cin >> l >> r;
    ll a = 0, b = 0, c = 0;
    cin >> a >> b >> c;
    for (int i = 29; i >= 0; i--) {
        ll t = 1 << i;
        if ((l ^ r) & t) {
            a |= t;
            b |= (t - 1);
            break;
        }
        else {
            if (l & t) {
                a += t;
                b += t;
            }
        }
    }
    c = l;
    while (c == a || c == b) {
        c++;
    }
    cout << a << ' ' << b << ' ' << c << ' ' << endl;
    //cout << (a ^ b) + (a ^ c) + (b ^ c) << endl;
    return 0;
}
int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(0); cout.tie(0);
    int t = 1; cin >> t;
    while (t--) {
        //int t1 = clock();
        ll ans = solve();
        //int t2 = clock();
        //cout << "t:" << t2 - t1 << endl;
        //cout << ans << endl;
    }
    return 0;
}

Submission (verdict: Accepted):
﻿#include<iostream>
#include<vector>
#include<queue>
#include<set>
#include<bitset>
#include<stack>
#include<algorithm>
#include<cmath>
#include<map>
#include<string>
#include<assert.h>
#include <random>
using namespace std;
typedef long long ll;
ll N = 2e5 + 1, mod = 998244353, MOD = 1e9 + 7;
ll solve() {
    ll l, r; std::cin >> l >> r;
    ll a = 0, b = 0, c = 0;
    for (int i = 29; i >= 0; i--) {
        ll t = 1 << i;
        if ((l ^ r) & t) {
            a |= t;
            b |= (t - 1);
            break;
        }
        else {
            if (l & t) {
                a += t;
                b += t;
            }
        }
    }
    c = l;
    while (c == a || c == b) {
        c++;
    }
    cout << a << ' ' << b << ' ' << c << ' ' << endl;
    //cout << (a ^ b) + (a ^ c) + (b ^ c) << endl;
    return 0;
}
int main()
{
    ios::sync_with_stdio(false);
    std::cin.tie(0); cout.tie(0);
    int t = 1; cin >> t;
    while (t--) {
        //int t1 = clock();
        ll ans = solve();
        //int t2 = clock();
        //cout << "t:" << t2 - t1 << endl;
        //cout << ans << endl;
    }
    return 0;
}