ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

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

#define ll long long
#define ull unsigned long long
#define dbl double
#define yes cout << "YES\n"
#define no cout << "NO\n"
constexpr dbl PI = 3.14159265359;
constexpr ll mod = 1e9 + 7;

using namespace std;

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

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

    if (vec[0] > vec[1]) {
        cout << "NO\n";
        return;
    }
    if (vec[n - 2] > vec[n - 1]) {
        cout << "NO\n";
        return;
    }
    cout << "YES\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

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

    return 0;
}

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

#define ll long long
#define ull unsigned long long
#define dbl double
#define yes cout << "YES\n"
#define no cout << "NO\n"
constexpr dbl PI = 3.14159265359;
constexpr ll mod = 1e9 + 7;

using namespace std;

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

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

    if (vec[0] >= vec[1]) {
        cout << "NO\n";
        return;
    }
    if (vec[n - 2] > vec[n - 1]) {
        cout << "NO\n";
        return;
    }
    cout << "YES\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

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

    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

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

#define ll long long
#define ull unsigned long long
#define dbl double
#define yes cout << "YES\n"
#define no cout << "NO\n"
constexpr dbl PI = 3.14159265359;
constexpr ll mod = 1e9 + 7;

using namespace std;

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

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

    if (vec[0] >= vec[1]) {
        cout << "NO\n";
        return;
    }
    if (vec[n - 2] > vec[n - 1]) {
        cout << "NO\n";
        return;
    }
    cout << "YES\n";
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

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

    return 0;
}

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

#define ll long long
#define ull unsigned long long
#define dbl double
#define yes cout << "YES\n"
#define no cout << "NO\n"
constexpr dbl PI = 3.14159265359;
constexpr ll mod = 1e9 + 7;

using namespace std;

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

    int j = 0;
    vector<int> vec(n);
    for (int i = 0; i < n; ++i) {
        cin >> vec[i];
        if (i > 0 && vec[i] < vec[i - 1]) j = i;
    }
    if (j == 0) {
        cout << "YES\n";
        return;
    }

    for (int i = 0; i < j; ++i) {
        ll minN = min(vec[i], vec[i+1]);
        vec[i] -= minN;
        vec[i+1] -= minN;
    }

    cout << (is_sorted(vec.begin(), vec.end()) ? "YES" : "NO") << '\n';
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

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

    return 0;
}
Problem: 2050D - Digital string maximization
Language: GNU C11

Previous submission (verdict: Runtime error on test 7):
#include<stdio.h>
 void swap(int x, char arr[]){
     int end=x-1;
     for(int i=0; i<x-1; i++){
        if((arr[i]<arr[i+1]) && (arr[i]<(arr[i+1]-1))){
          int temp=arr[i];
          arr[i]=arr[i+1]-1;
          arr[i+1]=temp; end++;
          }
        else end--;
        }
        if(end==0) return;
        else swap(x, arr);
     return;
 }
 int main(){
    int n;
    scanf("%d", &n);
    for(int k=0; k<n; k++){
       char arr[100000];
       scanf("%s",arr); int x=strlen(arr);
       swap(x, arr);
       printf("%s\n", arr);
    }
    return 0;

 }

Submission (verdict: Accepted):
#include<stdio.h>
#include<string.h>

void swap(int x, char arr[]) {
    int swapped = 0;
    for (int i = 0; i < x - 1; i++) {
        if ((arr[i] < arr[i + 1]) && (arr[i] < (arr[i + 1] - 1))) {
            char temp = arr[i];
            arr[i] = arr[i + 1] - 1;
            arr[i + 1] = temp;
            swapped = 1;
        }
    }
    if (swapped) {
        swap(x, arr);
    }
}

int main() {
    int n;
    scanf("%d", &n);
    for (int k = 0; k < n; k++) {
        char arr[1000000];
        scanf("%s", arr);
        int x = strlen(arr);
        swap(x, arr);
        printf("%s\n", arr);
    }
    return 0;
}
Problem: 2050D - Digital string maximization
Language: GNU C11


Submission (verdict: Runtime error on test 4):
#include<stdio.h>
 void swap(int x, char arr[]){
     int end=x-1;
     for(int i=0; i<x-1; i++){
        if((arr[i]<arr[i+1]) && (arr[i]<(arr[i+1]-1))){
          int temp=arr[i];
          arr[i]=arr[i+1]-1;
          arr[i+1]=temp; end++;
          }
        else end--;
        }
        if(end==0) return;
        else swap(x, arr);
     return;
 }
 int main(){
    int n;
    scanf("%d", &n);
    for(int k=0; k<n; k++){
       char arr[1000];
       scanf("%s",arr); int x=strlen(arr);
       swap(x, arr);
       printf("%s\n", arr);
    }
    return 0;

 }
Problem: 2050D - Digital string maximization
Language: GNU C11

Previous submission (verdict: Runtime error on test 6):
#include<stdio.h>
 void swap(int x, char arr[]){
     int end=x-1;
     for(int i=0; i<x-1; i++){
        if((arr[i]<arr[i+1]) && (arr[i]<(arr[i+1]-1))){
          int temp=arr[i];
          arr[i]=arr[i+1]-1;
          arr[i+1]=temp; end++;
          }
        else end--;
        }
        if(end==0) return;
        else swap(x, arr);
     return;
 }
 int main(){
    int n;
    scanf("%d", &n);
    for(int k=0; k<n; k++){
       char arr[10000];
       scanf("%s",arr); int x=strlen(arr);
       swap(x, arr);
       printf("%s\n", arr);
    }
    return 0;

 }

Submission (verdict: Runtime error on test 7):
#include<stdio.h>
 void swap(int x, char arr[]){
     int end=x-1;
     for(int i=0; i<x-1; i++){
        if((arr[i]<arr[i+1]) && (arr[i]<(arr[i+1]-1))){
          int temp=arr[i];
          arr[i]=arr[i+1]-1;
          arr[i+1]=temp; end++;
          }
        else end--;
        }
        if(end==0) return;
        else swap(x, arr);
     return;
 }
 int main(){
    int n;
    scanf("%d", &n);
    for(int k=0; k<n; k++){
       char arr[100000];
       scanf("%s",arr); int x=strlen(arr);
       swap(x, arr);
       printf("%s\n", arr);
    }
    return 0;

 }
Problem: 2050D - Digital string maximization
Language: GNU C11

Previous submission (verdict: Runtime error on test 4):
#include<stdio.h>
 void swap(int x, char arr[]){
     int end=x-1;
     for(int i=0; i<x-1; i++){
        if((arr[i]<arr[i+1]) && (arr[i]<(arr[i+1]-1))){
          int temp=arr[i];
          arr[i]=arr[i+1]-1;
          arr[i+1]=temp; end++;
          }
        else end--;
        }
        if(end==0) return;
        else swap(x, arr);
     return;
 }
 int main(){
    int n;
    scanf("%d", &n);
    for(int k=0; k<n; k++){
       char arr[1000];
       scanf("%s",arr); int x=strlen(arr);
       swap(x, arr);
       printf("%s\n", arr);
    }
    return 0;

 }

Submission (verdict: Runtime error on test 6):
#include<stdio.h>
 void swap(int x, char arr[]){
     int end=x-1;
     for(int i=0; i<x-1; i++){
        if((arr[i]<arr[i+1]) && (arr[i]<(arr[i+1]-1))){
          int temp=arr[i];
          arr[i]=arr[i+1]-1;
          arr[i+1]=temp; end++;
          }
        else end--;
        }
        if(end==0) return;
        else swap(x, arr);
     return;
 }
 int main(){
    int n;
    scanf("%d", &n);
    for(int k=0; k<n; k++){
       char arr[10000];
       scanf("%s",arr); int x=strlen(arr);
       swap(x, arr);
       printf("%s\n", arr);
    }
    return 0;

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

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

void solve() {
    long long l, r;
    cin >> l >> r;
    long long a = r; 
    long long curr = a;
    int cng=-1;
    int f=-1;

    if(r-l==2){
        cout<<r<<" "<<r-1<<" "<<r-2;
        return;
    }
    for (int i = 32; i >= 0; i--) {
        if (curr & (1LL << i)) { 
            if ((curr & ~(1LL << i)) >= l) { 
                curr &= ~(1LL << i); 
                f=1;
                cng=(1LL << i);


            }
        } else { 
            if ((curr | (1LL << i)) <= r) { 
                curr |= (1LL << i);
                cng = ~(1LL << i);
                f=0;


            }
        }
    }
    long long curr2=curr;
    if(f==1){
        curr2|=cng;

    }
    else{
        curr2&=cng;
    }
    cout << a << " " << curr << " " <<curr2  ; 
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--) {
        solve();
        cout<<endl;
    }
}


Submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <cmath>
using namespace std;

int t;
long long l, r;

int main()
{
    cin >> t;
    while (t--)
    {
        cin >> l >> r;
        int k = log2(r) + 1;
        while ((l >> (k - 1)) == (r >> (k - 1)))
            k--;
        long long x = 1 << (k - 1);
        long long y = x - 1;
        long long z;
        for (z = l; z <= r; z++)
            if (z != x && z != y)
                break;
        cout << x << " " << y << " " << z << endl;
    }

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


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

using i64 = long long;
using i128 = __int128;
using ui64 = unsigned long long;

void solve(){
    int l, r;
    cin >> l >> r;
    int a=0, b=0, c=0;
    for(int i=29; i>=0; i--) {
        if(((l^r) >> i) & 1 ) {
            a |= (1<<i);
            b |= (1<<i);
            b--;
            break;
        }else{
            a |= l & (1<<i);
            b |= l & (1<<i);
        }
    }
    
    for(int  i=l; i<=r; i++) {
        if(i != a && i!=b) {
            c = i;
            break;
        }
    }
    cout << a << " " << b << " " << c << "\n";
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int t = 1;
    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 <bits/stdc++.h>
using namespace std;

using i64 = long long;
using i128 = __int128;
using ui64 = unsigned long long;

void solve(){
    int l, r;
    cin >> l >> r;
    int a=0, b=0, c=0;
    for(int i=29; i>=0; i--) {
        if(((l^r) >> i) & 1 ) {
            a |= (1<<i);
            b |= (1<<i);
            b--;
            break;
        }else{
            a |= l & (1<<i);
            b |= l & (1<<i);
        }
    }
    
    for(int  i=l; i<=r; i++) {
        if(i != a && i!=b) {
            c = i;
            break;
        }
    }
    cout << a << " " << b << " " << c << "\n";
}
int main(){
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int t = 1;
    cin >> t;
    while(t--) {
        solve();
    }
    return 0;
}

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

void solve() {
    long long l, r;
    cin >> l >> r;
    long long a = r; 
    long long curr = a;
    int cng=-1;
    int f=-1;

    if(r-l==2){
        cout<<r<<" "<<r-1<<" "<<r-2;
        return;
    }
    for (int i = 32; i >= 0; i--) {
        if (curr & (1LL << i)) { 
            if ((curr & ~(1LL << i)) >= l) { 
                curr &= ~(1LL << i); 
                f=1;
                cng=(1LL << i);


            }
        } else { 
            if ((curr | (1LL << i)) <= r) { 
                curr |= (1LL << i);
                cng = ~(1LL << i);
                f=0;


            }
        }
    }
    long long curr2=curr;
    if(f==1){
        curr2|=cng;

    }
    else{
        curr2&=cng;
    }
    cout << a << " " << curr << " " <<curr2  ; 
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int t;
    cin >> t;
    while (t--) {
        solve();
        cout<<endl;
    }
}
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)


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


void solve() {
   int n , m;
   cin >> n >> m;
   
   map<int , int> freq;
   vector<int> v(m);
   
   for(int i = 0; i < n ; i++) {
      int a; cin >> a;
      freq[a]++;
   }
   for(int i = 0; i < m; i++) cin >> v[i];
   sort(v.rbegin() , v.rend());
   
   vector<int> test;
   for(int i = 0; i < m; i++) {
      if(freq[v[i]] > 0) {
         test.push_back(v[i]);
         freq[v[i]]--;
      }
      else {
         int one = v[i] / 2 , two = (v[i] + 1) / 2;
         if(freq[one] && freq[two]) {
            test.push_back(v[i]);
            freq[one]--;
            freq[two]--;
            n--;
         }
      }
   }
   sort(test.rbegin() , test.rend());
   
   if(v == test && n == m) cout << "YES" << endl;
   else cout << "NO" << endl;
}


int main() {

    int t;
    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;
//abeke

typedef long long ll;
typedef unsigned long long ull;

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pb push_back
#define speed ios::sync_with_stdio( false); cin.tie(nullptr); cout.tie(0);
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define eb emplace_back
#define nl '\n'
#define f first
#define s second
#define gcd __gcd
#define ins insert
#define clz(x) __builtin_clz(x)
const int inf = INT_MAX;
const int mod = 998244353;
const int N = 2e5;

bool cmp (ll x, ll y) {
    return x > y;
}
ll minv(ll x, ll m) {
    ll res = 1, p = m - 2;
    while (p > 0) {
        if (p & 1) res = res * x % m;
        x = x * x % m;
        p >>= 1;
    }
    return res;
}
struct node {
    int lmn, lmx, rmx, rmn, x;
};
void solve() {
    int l, r;
    cin >> l >> r;
    ll a = 0, b = 0, c = 0;
    for (int i = 10; i >= 0; i--) {
        int x = (1<<i)&l;
        int y = (1<<i)&r;
        //cout << x << ' ' << y << nl;
        if (x != y) {
            a += (1<<i);
            break;
        } else if (x == y) {
            a += x;
            b += x;
        }
    }
    if (r-l == 2) {
        cout << r << ' ' << r-1 << ' ' << r-2 << nl;
        return;
    }
    cout << a << ' ' << a-1 << ' ' << a+1 << nl;
}
int main()
{
    speed;
    int t = 1;
    cin >> t;
    while (t --> 0)
        solve();
    return 0;
}

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

using namespace std;
//abeke

typedef long long ll;
typedef unsigned long long ull;

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pb push_back
#define speed ios::sync_with_stdio( false); cin.tie(nullptr); cout.tie(0);
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define eb emplace_back
#define nl '\n'
#define f first
#define s second
#define gcd __gcd
#define ins insert
#define clz(x) __builtin_clz(x)
const int inf = INT_MAX;
const int mod = 998244353;
const int N = 2e5;

bool cmp (ll x, ll y) {
    return x > y;
}
ll minv(ll x, ll m) {
    ll res = 1, p = m - 2;
    while (p > 0) {
        if (p & 1) res = res * x % m;
        x = x * x % m;
        p >>= 1;
    }
    return res;
}
struct node {
    int lmn, lmx, rmx, rmn, x;
};
void solve() {
    int l, r;
    cin >> l >> r;
    ll a = 0, b = 0, c = 0;
    for (int i = 10; i >= 0; i--) {
        int x = (1<<i)&l;
        int y = (1<<i)&r;
        //cout << x << ' ' << y << nl;
        if (x != y) {
            a += (1<<i);
            break;
        } else if (x == y) {
            a += x;
            b += x;
        }
    }
    if (a == r || a == 1) {
        cout << a << " " << a - 1 << " " << a - 2 << nl;
    } else {
        cout << a << " " << a - 1 << " " << a + 1 << nl;
    }
}
int main()
{
    speed;
    int t = 1;
    cin >> t;
    while (t --> 0)
        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;
//abeke

typedef long long ll;
typedef unsigned long long ull;

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pb push_back
#define speed ios::sync_with_stdio( false); cin.tie(nullptr); cout.tie(0);
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define eb emplace_back
#define nl '\n'
#define f first
#define s second
#define gcd __gcd
#define ins insert
#define clz(x) __builtin_clz(x)
const int inf = INT_MAX;
const int mod = 998244353;
const int N = 2e5;

bool cmp (ll x, ll y) {
    return x > y;
}
ll minv(ll x, ll m) {
    ll res = 1, p = m - 2;
    while (p > 0) {
        if (p & 1) res = res * x % m;
        x = x * x % m;
        p >>= 1;
    }
    return res;
}
struct node {
    int lmn, lmx, rmx, rmn, x;
};
void solve() {
    int l, r;
    cin >> l >> r;
    ll a = 0, b = 0, c = 0;
    for (int i = 10; i >= 0; i--) {
        int x = (1<<i)&l;
        int y = (1<<i)&r;
        //cout << x << ' ' << y << nl;
        if (x != y) {
            a += (1<<i);
        } else if (x == y) {
            a += x;
        }
    }
    b = a-1;
    c = l;
    while (c == a && c == b) c++;
    cout << a << ' ' << b << ' ' << c << nl;
}
int main()
{
    speed;
    int t = 1;
    cin >> t;
    while (t --> 0)
        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;
//abeke

typedef long long ll;
typedef unsigned long long ull;

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pb push_back
#define speed ios::sync_with_stdio( false); cin.tie(nullptr); cout.tie(0);
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define eb emplace_back
#define nl '\n'
#define f first
#define s second
#define gcd __gcd
#define ins insert
#define clz(x) __builtin_clz(x)
const int inf = INT_MAX;
const int mod = 998244353;
const int N = 2e5;

bool cmp (ll x, ll y) {
    return x > y;
}
ll minv(ll x, ll m) {
    ll res = 1, p = m - 2;
    while (p > 0) {
        if (p & 1) res = res * x % m;
        x = x * x % m;
        p >>= 1;
    }
    return res;
}
struct node {
    int lmn, lmx, rmx, rmn, x;
};
void solve() {
    int l, r;
    cin >> l >> r;
    ll a = 0, b = 0, c = 0;
    for (int i = 10; i >= 0; i--) {
        int x = (1<<i)&l;
        int y = (1<<i)&r;
        //cout << x << ' ' << y << nl;
        if (x != y) {
            a += (1<<i);
        } else if (x == y) {
            a += x;
        }
    }
    b = a-1;
    c = l;
    while (c == a && c == b) c++;
    cout << a << ' ' << b << ' ' << c << nl;
}
int main()
{
    speed;
    int t = 1;
    cin >> t;
    while (t --> 0)
        solve();
    return 0;
}

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

using namespace std;
//abeke

typedef long long ll;
typedef unsigned long long ull;

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pb push_back
#define speed ios::sync_with_stdio( false); cin.tie(nullptr); cout.tie(0);
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define eb emplace_back
#define nl '\n'
#define f first
#define s second
#define gcd __gcd
#define ins insert
#define clz(x) __builtin_clz(x)
const int inf = INT_MAX;
const int mod = 998244353;
const int N = 2e5;

bool cmp (ll x, ll y) {
    return x > y;
}
ll minv(ll x, ll m) {
    ll res = 1, p = m - 2;
    while (p > 0) {
        if (p & 1) res = res * x % m;
        x = x * x % m;
        p >>= 1;
    }
    return res;
}
struct node {
    int lmn, lmx, rmx, rmn, x;
};
void solve() {
    int l, r;
    cin >> l >> r;
    ll a = 0, b = 0, c = 0;
    for (int i = 10; i >= 0; i--) {
        int x = (1<<i)&l;
        int y = (1<<i)&r;
        //cout << x << ' ' << y << nl;
        if (x != y) {
            a += (1<<i);
            break;
        } else if (x == y) {
            a += x;
            b += x;
        }
    }
    if (r-l == 2) {
        cout << r << ' ' << r-1 << ' ' << r-2 << nl;
        return;
    }
    cout << a << ' ' << a-1 << ' ' << a+1 << nl;
}
int main()
{
    speed;
    int t = 1;
    cin >> t;
    while (t --> 0)
        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;
//abeke

typedef long long ll;
typedef unsigned long long ull;

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pb push_back
#define speed ios::sync_with_stdio( false); cin.tie(nullptr); cout.tie(0);
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define eb emplace_back
#define nl '\n'
#define f first
#define s second
#define gcd __gcd
#define ins insert
#define clz(x) __builtin_clz(x)
const int inf = INT_MAX;
const int mod = 998244353;
const int N = 2e5;

bool cmp (ll x, ll y) {
    return x > y;
}
ll minv(ll x, ll m) {
    ll res = 1, p = m - 2;
    while (p > 0) {
        if (p & 1) res = res * x % m;
        x = x * x % m;
        p >>= 1;
    }
    return res;
}
struct node {
    int lmn, lmx, rmx, rmn, x;
};
void solve() {
    int l, r;
    cin >> l >> r;
    ll a = 0, b = 0, c = 0;
    for (int i = 10; i >= 0; i--) {
        int x = (1<<i)&l;
        int y = (1<<i)&r;
        //cout << x << ' ' << y << nl;
        if (x != y) {
            a += (1<<i);
            break;
        } else if (x == y) {
            a += x;
            b += x;
        }
    }
    if (a == r || a == 1) {
        cout << a << " " << a - 1 << " " << a - 2 << nl;
    } else {
        cout << a << " " << a - 1 << " " << a + 1 << nl;
    }
}
int main()
{
    speed;
    int t = 1;
    cin >> t;
    while (t --> 0)
        solve();
    return 0;
}

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

using namespace std;
//abeke

typedef long long ll;
typedef unsigned long long ull;

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pb push_back
#define speed ios::sync_with_stdio( false); cin.tie(nullptr); cout.tie(0);
#define forn(i, n) for(int i = 0; i < int(n); i++)
#define eb emplace_back
#define nl '\n'
#define f first
#define s second
#define gcd __gcd
#define ins insert
#define clz(x) __builtin_clz(x)
const int inf = INT_MAX;
const int mod = 998244353;
const int N = 2e5;

bool cmp (ll x, ll y) {
    return x > y;
}
ll minv(ll x, ll m) {
    ll res = 1, p = m - 2;
    while (p > 0) {
        if (p & 1) res = res * x % m;
        x = x * x % m;
        p >>= 1;
    }
    return res;
}
struct node {
    int lmn, lmx, rmx, rmn, x;
};
void solve() {
    int l, r;
    cin >> l >> r;
    ll a = 0, b = 0, c = 0;
    for (int i = 30; i >= 0; i--) {
        int x = (1<<i)&l;
        int y = (1<<i)&r;
        //cout << x << ' ' << y << nl;
        if (x != y) {
            a += (1<<i);
            break;
        } else if (x == y) {
            a += x;
            b += x;
        }
    }
    if (a == r || a == 1) {
        cout << a << " " << a - 1 << " " << a - 2 << nl;
    } else {
        cout << a << " " << a - 1 << " " << a + 1 << nl;
    }
}
int main()
{
    speed;
    int t = 1;
    cin >> t;
    while (t --> 0)
        solve();
    return 0;
}