ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2057C - Trip to the Olympiad
Language: python

Solution 1 (runtime: 187 ms):
if __name__ == "__main__":
    t = int(input())
    while t > 0:
        l, r = list(map(int, input().split()))
        ans = 0
        for i in range(30, -1, -1):
            if (r & (1 << i)) != 0 and (l & (1 << i)) != 0:
                ans |= (1 << i)  # Set the i-th bit in `ans`
            elif (r & (1 << i)) != 0:
                for j in range(i-1, -1, -1):
                    if (r & (1 << j)) == 0 and (l & (1 << j)) != 0:
                        continue
                    else:
                        if (r & (1 << j)) != 0:
                            ans |= (1 << i)
                        else:
                            for k in range(i - 1, j - 1, -1):
                                ans |= (1 << k)

                        for k in range(j - 1, -1, -1):
                            if (r & (1 << k)) == 0 and (l & (1 << k)) == 0:
                                ans |= (1 << k)
                            elif (r & (1 << k)) != 0 and (l & (1 << k)) != 0:
                                 continue
                            else:
                                ans |= (1 << k)
                        break
                    # print(i, j)
                break
        print(f"{l} {ans} {r}")
        t -= 1


Solution 2 (runtime: 202 ms):
#include <bits/stdc++.h>
using namespace std;

pair<long long, long long> findMaxXORPairEfficient(long long l, long long r) {
    long long x = l ^ r;
    int k = 0;
    while (x) {
        k++;
        x >>= 1;
    }
    long long maxXor = ((long long)1 << k) - 1;
    long long partner = r ^ maxXor;
    if (partner >= l && partner <= r)
        return {partner, r};
    partner = l ^ maxXor;
    if (partner >= l && partner <= r)
        return {l, partner};
    return {l, r};
}

int main() {
    int t;
    cin >> t;
    while (t--) {
        long long l, r,third;
        cin >> l >> r;
        pair<long long, long long> result = findMaxXORPairEfficient(l, r);
        if(result.first!=l){third=l;} else{if(result.second!=r){third=r;}else{third=(l+r)/2;}}
        cout << result.first <<" "<< third<<" "<< result.second <<endl;
    }
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: python

Solution 1 (runtime: 187 ms):
if __name__ == "__main__":
    t = int(input())
    while t > 0:
        l, r = list(map(int, input().split()))
        ans = 0
        for i in range(30, -1, -1):
            if (r & (1 << i)) != 0 and (l & (1 << i)) != 0:
                ans |= (1 << i)  # Set the i-th bit in `ans`
            elif (r & (1 << i)) != 0:
                for j in range(i-1, -1, -1):
                    if (r & (1 << j)) == 0 and (l & (1 << j)) != 0:
                        continue
                    else:
                        if (r & (1 << j)) != 0:
                            ans |= (1 << i)
                        else:
                            for k in range(i - 1, j - 1, -1):
                                ans |= (1 << k)

                        for k in range(j - 1, -1, -1):
                            if (r & (1 << k)) == 0 and (l & (1 << k)) == 0:
                                ans |= (1 << k)
                            elif (r & (1 << k)) != 0 and (l & (1 << k)) != 0:
                                 continue
                            else:
                                ans |= (1 << k)
                        break
                    # print(i, j)
                break
        print(f"{l} {ans} {r}")
        t -= 1


Solution 2 (runtime: 124 ms):
import sys
input = sys.stdin.readline

S = lambda: input()
I = lambda: int(input())
M = lambda: map(int, input().split())

for _ in range(I()):
    l, r = M()
    n = l ^ r
    k = n.bit_length() - 1
    a = l | ((1 << k) - 1)
    b = a + 1
    c = l if a == r or b == r else r
    print(a, b, c)
Problem: 2057C - Trip to the Olympiad
Language: python

Solution 1 (runtime: 187 ms):
if __name__ == "__main__":
    t = int(input())
    while t > 0:
        l, r = list(map(int, input().split()))
        ans = 0
        for i in range(30, -1, -1):
            if (r & (1 << i)) != 0 and (l & (1 << i)) != 0:
                ans |= (1 << i)  # Set the i-th bit in `ans`
            elif (r & (1 << i)) != 0:
                for j in range(i-1, -1, -1):
                    if (r & (1 << j)) == 0 and (l & (1 << j)) != 0:
                        continue
                    else:
                        if (r & (1 << j)) != 0:
                            ans |= (1 << i)
                        else:
                            for k in range(i - 1, j - 1, -1):
                                ans |= (1 << k)

                        for k in range(j - 1, -1, -1):
                            if (r & (1 << k)) == 0 and (l & (1 << k)) == 0:
                                ans |= (1 << k)
                            elif (r & (1 << k)) != 0 and (l & (1 << k)) != 0:
                                 continue
                            else:
                                ans |= (1 << k)
                        break
                    # print(i, j)
                break
        print(f"{l} {ans} {r}")
        t -= 1


Solution 2 (runtime: 436 ms):

// "Oyyyy...she has a gold which is black"


#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

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


#define endl "\n"
#define int long long




void solve() { 
    int l,r; cin>>l>>r; 
    int k; 
    for (int i=30;i>=0;i--) {
        if ((r&(1LL<<i))!=(l&(1LL<<i))) {
            k=i; 
            break;
        }
    }
    //cout<<k<<endl;
    int x=0; 
    for (int i=30;i>=k;i--) {
        if (r&(1LL<<i)) {
            x+=(1LL<<i);
        }
    }
    int y=x-1; 
    cout<<x<<" "<<y<<" "; 
    if (y==l) {
        cout<<r<<endl;
    }
    else {
        cout<<l<<endl;
    }
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
        
    
    int tc=1; 
    cin>>tc; 
    while (tc--) {
        solve();
    }
    
 
    return 0;

}   
 


/* 

        “What is happening is actually terrifying. I mean what happened to me all on a sudden?”

                         
                                                                                                              
*/
Problem: 2057C - Trip to the Olympiad
Language: python

Solution 1 (runtime: 187 ms):
if __name__ == "__main__":
    t = int(input())
    while t > 0:
        l, r = list(map(int, input().split()))
        ans = 0
        for i in range(30, -1, -1):
            if (r & (1 << i)) != 0 and (l & (1 << i)) != 0:
                ans |= (1 << i)  # Set the i-th bit in `ans`
            elif (r & (1 << i)) != 0:
                for j in range(i-1, -1, -1):
                    if (r & (1 << j)) == 0 and (l & (1 << j)) != 0:
                        continue
                    else:
                        if (r & (1 << j)) != 0:
                            ans |= (1 << i)
                        else:
                            for k in range(i - 1, j - 1, -1):
                                ans |= (1 << k)

                        for k in range(j - 1, -1, -1):
                            if (r & (1 << k)) == 0 and (l & (1 << k)) == 0:
                                ans |= (1 << k)
                            elif (r & (1 << k)) != 0 and (l & (1 << k)) != 0:
                                 continue
                            else:
                                ans |= (1 << k)
                        break
                    # print(i, j)
                break
        print(f"{l} {ans} {r}")
        t -= 1


Solution 2 (runtime: 327 ms):
for _ in range(int(input())):
    b, a = map(int, input().split())
    k = (1 << ((a^b).bit_length()-1)) - 1
    if (b|k == b):
        m = (b|k)+2
    else:
        m = (b | k) -1
    print(b | k, m, (b | k) +1)
Problem: 2057C - Trip to the Olympiad
Language: python

Solution 1 (runtime: 202 ms):
def read_list():
    return list(map(int, input().split()))


def f(a, b, c):
    return (a ^ b) + (b ^ c) + (c ^ a)


class Solution:
    def solve(self):
        l, r = tuple(read_list())
        L = l
        R = r
        lb = []
        rb = []
        for _ in range(32):
            lb.append(l % 2)
            l //= 2
            rb.append(r % 2)
            r //= 2
        for i in range(31, -1, -1):
            if lb[i] != rb[i]:
                assert lb[i] == 0 and rb[i] == 1
                X = L | ((1 << i) - 1)
                if L < X:
                    print(L, X, X + 1)
                else:
                    print(X, X + 1, X + 2)
                break


if __name__ == "__main__":
    tests = int(input())
    for _ in range(tests):
        Solution().solve()


Solution 2 (runtime: 155 ms):
a = int(input()) 
for i in range(a):
    l, r = map(int, input().split()) 
    x = r - l + 1
    y = 1 
    while y<x:
        y *= 2 
    f1 = l - (l%y) 
    if l & y == r & y:
        l1 = l %y
        r1 = r %y 
        x1 = y - l1 - 1
        y1 = l1
        if x1 > r1:
            x1 = y - r1 - 1 
            y1 = r1 
        z1 = r1 
        while z1 == x1 or z1 == y1:
            z1 -= 1 
        print(x1+f1, y1+f1, z1+f1,sep = " ")
    else:
        x1 = f1 + y - 1 
        x2 = r - (r%y)
        x3 = r 
        while x3 == x1 or x3 == x2:
            x3 -= 1 
        print(x1,x2,x3, sep = " ")
Problem: 2057C - Trip to the Olympiad
Language: python

Solution 1 (runtime: 202 ms):
def read_list():
    return list(map(int, input().split()))


def f(a, b, c):
    return (a ^ b) + (b ^ c) + (c ^ a)


class Solution:
    def solve(self):
        l, r = tuple(read_list())
        L = l
        R = r
        lb = []
        rb = []
        for _ in range(32):
            lb.append(l % 2)
            l //= 2
            rb.append(r % 2)
            r //= 2
        for i in range(31, -1, -1):
            if lb[i] != rb[i]:
                assert lb[i] == 0 and rb[i] == 1
                X = L | ((1 << i) - 1)
                if L < X:
                    print(L, X, X + 1)
                else:
                    print(X, X + 1, X + 2)
                break


if __name__ == "__main__":
    tests = int(input())
    for _ in range(tests):
        Solution().solve()


Solution 2 (runtime: 171 ms):
//[amzad]: {{amjadimran004}}
#include <bits/stdc++.h>
using namespace std;
 
#define cY    cout << "YES"  << '\n'
#define cN    cout<<"NO"<<'\n'
#define ll    long long
#define ull   unsigned ll
#define ld    long double
#define pii   pair<int,int>
#define pll   pair<ll,ll>
#define vi    vector<int>
#define vll   vector<ll>
#define vvi   vector<vi>
#define vvll  vector<vll>
#define endl  '\n'
 
#define loop(a,b)    for(int i=(a);i<(b);i++)
#define rloop(a,b)   for(int i=(a);i>=(b);i--)
#define each(a,x)    for(auto &a:(x))
 
#define min3(a,b,c)  min( (a), min( (b), (c) ) )
#define max3(a,b,c)  max( (a), max( (b),(c) ) )
 
constexpr ll MOD = 1e9+7;
constexpr ld EPS = 1e-9;
 
struct HASH {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED = chrono::steady_clock::now()
                                   .time_since_epoch().count();
    return splitmix64(x + FIXED);
  }
};
 
void fastIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);
  cout.precision(20); cout.setf(ios::fixed);
}
 
#ifdef DEBUG
#define d_print(...) { cout << "[" << #__VA_ARGS__ << "]: "; \
                     dbg_out(__VA_ARGS__); }
template <typename... Args>
void dbg_out(Args... args) {
  ((cout << args << " "), ...); cout << endl;
}
#else
#define d_print(...)
#endif
 
void solve() {
  int l, r;
  cin >> l >> r;
  int k = 31 - __builtin_clz(l ^ r);
  int a = l | ((1 << k) - 1);
  int b = a + 1;
  int c = (a == l ? r : l);
  cout << a << ' ' << b << ' ' << c << endl;
}
 
int main(){
  fastIO();
  int t = 1;
  cin >> t;
  while(t--) {
    solve();
  }
  return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: python

Solution 1 (runtime: 202 ms):
def read_list():
    return list(map(int, input().split()))


def f(a, b, c):
    return (a ^ b) + (b ^ c) + (c ^ a)


class Solution:
    def solve(self):
        l, r = tuple(read_list())
        L = l
        R = r
        lb = []
        rb = []
        for _ in range(32):
            lb.append(l % 2)
            l //= 2
            rb.append(r % 2)
            r //= 2
        for i in range(31, -1, -1):
            if lb[i] != rb[i]:
                assert lb[i] == 0 and rb[i] == 1
                X = L | ((1 << i) - 1)
                if L < X:
                    print(L, X, X + 1)
                else:
                    print(X, X + 1, X + 2)
                break


if __name__ == "__main__":
    tests = int(input())
    for _ in range(tests):
        Solution().solve()


Solution 2 (runtime: 202 ms):
#include <bits/stdc++.h>
using namespace std;

pair<long long, long long> findMaxXORPairEfficient(long long l, long long r) {
    long long x = l ^ r;
    int k = 0;
    while (x) {
        k++;
        x >>= 1;
    }
    long long maxXor = ((long long)1 << k) - 1;
    long long partner = r ^ maxXor;
    if (partner >= l && partner <= r)
        return {partner, r};
    partner = l ^ maxXor;
    if (partner >= l && partner <= r)
        return {l, partner};
    return {l, r};
}

int main() {
    int t;
    cin >> t;
    while (t--) {
        long long l, r,third;
        cin >> l >> r;
        pair<long long, long long> result = findMaxXORPairEfficient(l, r);
        if(result.first!=l){third=l;} else{if(result.second!=r){third=r;}else{third=(l+r)/2;}}
        cout << result.first <<" "<< third<<" "<< result.second <<endl;
    }
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: python

Solution 1 (runtime: 202 ms):
def read_list():
    return list(map(int, input().split()))


def f(a, b, c):
    return (a ^ b) + (b ^ c) + (c ^ a)


class Solution:
    def solve(self):
        l, r = tuple(read_list())
        L = l
        R = r
        lb = []
        rb = []
        for _ in range(32):
            lb.append(l % 2)
            l //= 2
            rb.append(r % 2)
            r //= 2
        for i in range(31, -1, -1):
            if lb[i] != rb[i]:
                assert lb[i] == 0 and rb[i] == 1
                X = L | ((1 << i) - 1)
                if L < X:
                    print(L, X, X + 1)
                else:
                    print(X, X + 1, X + 2)
                break


if __name__ == "__main__":
    tests = int(input())
    for _ in range(tests):
        Solution().solve()


Solution 2 (runtime: 124 ms):
import sys
input = sys.stdin.readline

S = lambda: input()
I = lambda: int(input())
M = lambda: map(int, input().split())

for _ in range(I()):
    l, r = M()
    n = l ^ r
    k = n.bit_length() - 1
    a = l | ((1 << k) - 1)
    b = a + 1
    c = l if a == r or b == r else r
    print(a, b, c)
Problem: 2057C - Trip to the Olympiad
Language: python

Solution 1 (runtime: 202 ms):
def read_list():
    return list(map(int, input().split()))


def f(a, b, c):
    return (a ^ b) + (b ^ c) + (c ^ a)


class Solution:
    def solve(self):
        l, r = tuple(read_list())
        L = l
        R = r
        lb = []
        rb = []
        for _ in range(32):
            lb.append(l % 2)
            l //= 2
            rb.append(r % 2)
            r //= 2
        for i in range(31, -1, -1):
            if lb[i] != rb[i]:
                assert lb[i] == 0 and rb[i] == 1
                X = L | ((1 << i) - 1)
                if L < X:
                    print(L, X, X + 1)
                else:
                    print(X, X + 1, X + 2)
                break


if __name__ == "__main__":
    tests = int(input())
    for _ in range(tests):
        Solution().solve()


Solution 2 (runtime: 436 ms):

// "Oyyyy...she has a gold which is black"


#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

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


#define endl "\n"
#define int long long




void solve() { 
    int l,r; cin>>l>>r; 
    int k; 
    for (int i=30;i>=0;i--) {
        if ((r&(1LL<<i))!=(l&(1LL<<i))) {
            k=i; 
            break;
        }
    }
    //cout<<k<<endl;
    int x=0; 
    for (int i=30;i>=k;i--) {
        if (r&(1LL<<i)) {
            x+=(1LL<<i);
        }
    }
    int y=x-1; 
    cout<<x<<" "<<y<<" "; 
    if (y==l) {
        cout<<r<<endl;
    }
    else {
        cout<<l<<endl;
    }
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
        
    
    int tc=1; 
    cin>>tc; 
    while (tc--) {
        solve();
    }
    
 
    return 0;

}   
 


/* 

        “What is happening is actually terrifying. I mean what happened to me all on a sudden?”

                         
                                                                                                              
*/
Problem: 2057C - Trip to the Olympiad
Language: python

Solution 1 (runtime: 202 ms):
def read_list():
    return list(map(int, input().split()))


def f(a, b, c):
    return (a ^ b) + (b ^ c) + (c ^ a)


class Solution:
    def solve(self):
        l, r = tuple(read_list())
        L = l
        R = r
        lb = []
        rb = []
        for _ in range(32):
            lb.append(l % 2)
            l //= 2
            rb.append(r % 2)
            r //= 2
        for i in range(31, -1, -1):
            if lb[i] != rb[i]:
                assert lb[i] == 0 and rb[i] == 1
                X = L | ((1 << i) - 1)
                if L < X:
                    print(L, X, X + 1)
                else:
                    print(X, X + 1, X + 2)
                break


if __name__ == "__main__":
    tests = int(input())
    for _ in range(tests):
        Solution().solve()


Solution 2 (runtime: 327 ms):
for _ in range(int(input())):
    b, a = map(int, input().split())
    k = (1 << ((a^b).bit_length()-1)) - 1
    if (b|k == b):
        m = (b|k)+2
    else:
        m = (b | k) -1
    print(b | k, m, (b | k) +1)
Problem: 2057C - Trip to the Olympiad
Language: python

Solution 1 (runtime: 155 ms):
a = int(input()) 
for i in range(a):
    l, r = map(int, input().split()) 
    x = r - l + 1
    y = 1 
    while y<x:
        y *= 2 
    f1 = l - (l%y) 
    if l & y == r & y:
        l1 = l %y
        r1 = r %y 
        x1 = y - l1 - 1
        y1 = l1
        if x1 > r1:
            x1 = y - r1 - 1 
            y1 = r1 
        z1 = r1 
        while z1 == x1 or z1 == y1:
            z1 -= 1 
        print(x1+f1, y1+f1, z1+f1,sep = " ")
    else:
        x1 = f1 + y - 1 
        x2 = r - (r%y)
        x3 = r 
        while x3 == x1 or x3 == x2:
            x3 -= 1 
        print(x1,x2,x3, sep = " ")

Solution 2 (runtime: 171 ms):
//[amzad]: {{amjadimran004}}
#include <bits/stdc++.h>
using namespace std;
 
#define cY    cout << "YES"  << '\n'
#define cN    cout<<"NO"<<'\n'
#define ll    long long
#define ull   unsigned ll
#define ld    long double
#define pii   pair<int,int>
#define pll   pair<ll,ll>
#define vi    vector<int>
#define vll   vector<ll>
#define vvi   vector<vi>
#define vvll  vector<vll>
#define endl  '\n'
 
#define loop(a,b)    for(int i=(a);i<(b);i++)
#define rloop(a,b)   for(int i=(a);i>=(b);i--)
#define each(a,x)    for(auto &a:(x))
 
#define min3(a,b,c)  min( (a), min( (b), (c) ) )
#define max3(a,b,c)  max( (a), max( (b),(c) ) )
 
constexpr ll MOD = 1e9+7;
constexpr ld EPS = 1e-9;
 
struct HASH {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED = chrono::steady_clock::now()
                                   .time_since_epoch().count();
    return splitmix64(x + FIXED);
  }
};
 
void fastIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr); cout.tie(nullptr);
  cout.precision(20); cout.setf(ios::fixed);
}
 
#ifdef DEBUG
#define d_print(...) { cout << "[" << #__VA_ARGS__ << "]: "; \
                     dbg_out(__VA_ARGS__); }
template <typename... Args>
void dbg_out(Args... args) {
  ((cout << args << " "), ...); cout << endl;
}
#else
#define d_print(...)
#endif
 
void solve() {
  int l, r;
  cin >> l >> r;
  int k = 31 - __builtin_clz(l ^ r);
  int a = l | ((1 << k) - 1);
  int b = a + 1;
  int c = (a == l ? r : l);
  cout << a << ' ' << b << ' ' << c << endl;
}
 
int main(){
  fastIO();
  int t = 1;
  cin >> t;
  while(t--) {
    solve();
  }
  return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: python

Solution 1 (runtime: 155 ms):
a = int(input()) 
for i in range(a):
    l, r = map(int, input().split()) 
    x = r - l + 1
    y = 1 
    while y<x:
        y *= 2 
    f1 = l - (l%y) 
    if l & y == r & y:
        l1 = l %y
        r1 = r %y 
        x1 = y - l1 - 1
        y1 = l1
        if x1 > r1:
            x1 = y - r1 - 1 
            y1 = r1 
        z1 = r1 
        while z1 == x1 or z1 == y1:
            z1 -= 1 
        print(x1+f1, y1+f1, z1+f1,sep = " ")
    else:
        x1 = f1 + y - 1 
        x2 = r - (r%y)
        x3 = r 
        while x3 == x1 or x3 == x2:
            x3 -= 1 
        print(x1,x2,x3, sep = " ")

Solution 2 (runtime: 202 ms):
#include <bits/stdc++.h>
using namespace std;

pair<long long, long long> findMaxXORPairEfficient(long long l, long long r) {
    long long x = l ^ r;
    int k = 0;
    while (x) {
        k++;
        x >>= 1;
    }
    long long maxXor = ((long long)1 << k) - 1;
    long long partner = r ^ maxXor;
    if (partner >= l && partner <= r)
        return {partner, r};
    partner = l ^ maxXor;
    if (partner >= l && partner <= r)
        return {l, partner};
    return {l, r};
}

int main() {
    int t;
    cin >> t;
    while (t--) {
        long long l, r,third;
        cin >> l >> r;
        pair<long long, long long> result = findMaxXORPairEfficient(l, r);
        if(result.first!=l){third=l;} else{if(result.second!=r){third=r;}else{third=(l+r)/2;}}
        cout << result.first <<" "<< third<<" "<< result.second <<endl;
    }
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: python

Solution 1 (runtime: 155 ms):
a = int(input()) 
for i in range(a):
    l, r = map(int, input().split()) 
    x = r - l + 1
    y = 1 
    while y<x:
        y *= 2 
    f1 = l - (l%y) 
    if l & y == r & y:
        l1 = l %y
        r1 = r %y 
        x1 = y - l1 - 1
        y1 = l1
        if x1 > r1:
            x1 = y - r1 - 1 
            y1 = r1 
        z1 = r1 
        while z1 == x1 or z1 == y1:
            z1 -= 1 
        print(x1+f1, y1+f1, z1+f1,sep = " ")
    else:
        x1 = f1 + y - 1 
        x2 = r - (r%y)
        x3 = r 
        while x3 == x1 or x3 == x2:
            x3 -= 1 
        print(x1,x2,x3, sep = " ")

Solution 2 (runtime: 124 ms):
import sys
input = sys.stdin.readline

S = lambda: input()
I = lambda: int(input())
M = lambda: map(int, input().split())

for _ in range(I()):
    l, r = M()
    n = l ^ r
    k = n.bit_length() - 1
    a = l | ((1 << k) - 1)
    b = a + 1
    c = l if a == r or b == r else r
    print(a, b, c)