ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050D - Digital string maximization
Language: Java 21

Previous submission (verdict: Wrong answer on test 1):
import java.math.*;

import java.util.*;



public class Main {

static int N = (int)2e5 + 5;

static int[] a = new int[N];

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int T = sc.nextInt();

while(T-- > 0){

String s = sc.next();

int len = s.length();

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

a[i] = (int)s.charAt(i - 1) - (int)'0';

}

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

int x = a[i], idx = i;

int mx = -1, id = -1;

for(int j = i + 1;j <= i + 8;j++){

if(a[j] - (j - i) > mx){

mx = a[j] - (j - i);

idx = j;

}

}

for(int j = idx - 1;j >= i;j--){

int t = a[j];

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

a[j + 1] = t;

}

}

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

System.out.print(a[i]);

}

System.out.println();

}

sc.close();

}

}

Submission (verdict: Wrong answer on test 1):
import java.math.*;

import java.util.*;



public class Main {

static int N = (int)2e5 + 5;

static int[] a = new int[N];

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int T = sc.nextInt();

while(T-- > 0){

String s = sc.next();

int len = s.length();

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

a[i] = (int)s.charAt(i - 1) - (int)'0';

}

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

int x = a[i], idx = i;

int mx = 0, id = -1;

for(int j = i + 1;j <= len && j <= i + 8;j++){

if(a[j] - (j - i) > mx){

mx = a[j] - (j - i);

idx = j;

}

}

for(int j = idx - 1;j >= i;j--){

int t = a[j];

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

a[j + 1] = t;

}

}

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

System.out.print(a[i]);

}

System.out.println();

}

sc.close();

}

}
Problem: 2050D - Digital string maximization
Language: Java 21

Previous submission (verdict: Wrong answer on test 1):
import java.math.*;

import java.util.*;



public class Main {

static int N = (int)2e5 + 5;

static int[] a = new int[N];

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int T = sc.nextInt();

while(T-- > 0){

String s = sc.next();

int len = s.length();

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

a[i] = (int)s.charAt(i - 1) - (int)'0';

}

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

int x = a[i], idx = i;

int mx = 0, id = -1;

for(int j = i + 1;j <= len && j <= i + 8;j++){

if(a[j] - (j - i) > mx){

mx = a[j] - (j - i);

idx = j;

}

}

for(int j = idx - 1;j >= i;j--){

int t = a[j];

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

a[j + 1] = t;

}

}

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

System.out.print(a[i]);

}

System.out.println();

}

sc.close();

}

}

Submission (verdict: Accepted):
import java.math.*;

import java.util.*;



public class Main {

static int N = (int)2e5 + 5;

static int[] a = new int[N];

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int T = sc.nextInt();

while(T-- > 0){

String s = sc.next();

int len = s.length();

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

a[i] = (int)s.charAt(i - 1) - (int)'0';

}

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

int x = a[i], idx = i;

int mx = x, id = -1;

for(int j = i + 1;j <= len && j <= i + 8;j++){

if(a[j] - (j - i) > mx){

mx = a[j] - (j - i);

idx = j;

}

}

for(int j = idx - 1;j >= i;j--){

int t = a[j];

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

a[j + 1] = t;

}

}

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

System.out.print(a[i]);

}

System.out.println();

}

sc.close();

}

}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
// Author : Hardik Ahuja



#include <bits/stdc++.h>

using namespace std;



#define int long long

#define loop(i,m,n) for(int i = (m);i < (n);i++)

#define rloop(i,m,n) for(int i = (m);i >= (n);i--)

#define ivec(vec) for(int i = 0;i < vec.size();i++)cin>>vec[i]

#define ovec(vec) for(int i = 0;i < vec.size();i++)cout<<vec[i]<<' '

#define endl '\n'

#define YES cout<<"YES"<<endl

#define NO cout<<"NO"<<endl





void solve(){

    int n;cin>>n;

    string s;cin>>s;



    int p = 0;

    int c = 0;

    int dot = 0;

    for(auto i: s){

        if(i == 's')c++;

        else if(i == 'p')p++;

        else dot++;

    }



    if(p + dot == n){

        YES;

    }

    else if(c + dot == n){

        YES;

    }

    else{



        p = 0;

        c = 0;

        if(s[0] == 'p' || s[0] == '.'){

            NO;

            return;

        }

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

            if(s[i] == 'p')p++;

            else if(s[i] == 's')c++;



            if(s[i] == 's' && p != 0){

                NO;

                return;

            }

        }

        YES;

    }





}



int32_t main(){



    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
// Author : Hardik Ahuja



#include <bits/stdc++.h>

using namespace std;



#define int long long

#define loop(i,m,n) for(int i = (m);i < (n);i++)

#define rloop(i,m,n) for(int i = (m);i >= (n);i--)

#define ivec(vec) for(int i = 0;i < vec.size();i++)cin>>vec[i]

#define ovec(vec) for(int i = 0;i < vec.size();i++)cout<<vec[i]<<' '

#define endl '\n'

#define YES cout<<"YES"<<endl

#define NO cout<<"NO"<<endl





void solve(){

    int n;cin>>n;

    string s;cin>>s;



    int p = 0;

    int c = 0;

    int dot = 0;

    for(auto i: s){

        if(i == 's')c++;

        else if(i == 'p')p++;

        else dot++;

    }



    if(p + dot == n){

        YES;

    }

    else if(c + dot == n){

        YES;

    }

    else{



        p = 0;

        c = 0;

        if(s[0] == 'p' || s[0] == '.'){

            NO;

            return;

        }

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

            if(s[i] == 'p')p++;

            else if(s[i] == 's')c++;



            if(s[i] == 's' && p != 0){

                NO;

                return;

            }

        }

        YES;

    }





}



int32_t main(){



    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}

Submission (verdict: Wrong answer on test 2):
// Author : Hardik Ahuja



#include <bits/stdc++.h>

using namespace std;



#define int long long

#define loop(i,m,n) for(int i = (m);i < (n);i++)

#define rloop(i,m,n) for(int i = (m);i >= (n);i--)

#define ivec(vec) for(int i = 0;i < vec.size();i++)cin>>vec[i]

#define ovec(vec) for(int i = 0;i < vec.size();i++)cout<<vec[i]<<' '

#define endl '\n'

#define YES cout<<"YES"<<endl

#define NO cout<<"NO"<<endl





void solve(){

    int n;cin>>n;

    string s;cin>>s;



    int p = 0;

    int c = 0;

    int dot = 0;

    for(auto i: s){

        if(i == 's')c++;

        else if(i == 'p')p++;

        else dot++;

    }



    if(p + dot == n){

        YES;

    }

    else if(c + dot == n){

        YES;

    }

    else{



        p = 0;

        c = 0;

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

            p += (s[i] == 'p');

            if(p == 0 && s[i] == '.')s[i] = 's';

            else if(p != 0 && s[i] == '.')s[i] = 'p';

        }



        int cnt1 = 0;

        int cnt2 = 0;



        for(auto i:s){

            if(i == 's')cnt1++;

            else cnt2++;

        }



        if(cnt1 == 1 && s[0] == 's')YES;

        else if(cnt2 == 1 && s[n - 1] == 'p')YES;

        else NO;

    }





}



int32_t main(){



    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
// Author : Hardik Ahuja



#include <bits/stdc++.h>

using namespace std;



#define int long long

#define loop(i,m,n) for(int i = (m);i < (n);i++)

#define rloop(i,m,n) for(int i = (m);i >= (n);i--)

#define ivec(vec) for(int i = 0;i < vec.size();i++)cin>>vec[i]

#define ovec(vec) for(int i = 0;i < vec.size();i++)cout<<vec[i]<<' '

#define endl '\n'

#define YES cout<<"YES"<<endl

#define NO cout<<"NO"<<endl





void solve(){

    int n;cin>>n;

    string s;cin>>s;



    int p = 0;

    int c = 0;

    int dot = 0;

    for(auto i: s){

        if(i == 's')c++;

        else if(i == 'p')p++;

        else dot++;

    }



    if(p + dot == n){

        YES;

    }

    else if(c + dot == n){

        YES;

    }

    else{



        p = 0;

        c = 0;

        if(s[0] == 'p' || s[0] == '.'){

            NO;

            return;

        }

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

            if(s[i] == 'p')p++;

            else if(s[i] == 's')c++;



            if(s[i] == 's' && p != 0){

                NO;

                return;

            }

        }

        YES;

    }





}



int32_t main(){



    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}

Submission (verdict: Wrong answer on test 2):
// Author : Hardik Ahuja



#include <bits/stdc++.h>

using namespace std;



#define int long long

#define loop(i,m,n) for(int i = (m);i < (n);i++)

#define rloop(i,m,n) for(int i = (m);i >= (n);i--)

#define ivec(vec) for(int i = 0;i < vec.size();i++)cin>>vec[i]

#define ovec(vec) for(int i = 0;i < vec.size();i++)cout<<vec[i]<<' '

#define endl '\n'

#define YES cout<<"YES"<<endl

#define NO cout<<"NO"<<endl





void solve(){

    int n;cin>>n;

    string s;cin>>s;



    int p = 0;

    int c = 0;

    int dot = 0;

    for(auto i: s){

        if(i == 's')c++;

        else if(i == 'p')p++;

        else dot++;

    }



    if(p + dot == n){

        YES;

    }

    else if(c + dot == n){

        YES;

    }

    else{



        p = 0;

        c = 0;

        if(s[0] == 'p' || s[0] == '.'){

            NO;

            return;

        }

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

            if(s[i] == 'p')p++;

            else if(s[i] == 's')c++;



            if(s[i] == 's' && p != 0){

                NO;

                return;

            }

        }

        YES;

    }





}



int32_t main(){



    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}
Problem: 2049B - pspspsps
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
// Author : Hardik Ahuja



#include <bits/stdc++.h>

using namespace std;



#define int long long

#define loop(i,m,n) for(int i = (m);i < (n);i++)

#define rloop(i,m,n) for(int i = (m);i >= (n);i--)

#define ivec(vec) for(int i = 0;i < vec.size();i++)cin>>vec[i]

#define ovec(vec) for(int i = 0;i < vec.size();i++)cout<<vec[i]<<' '

#define endl '\n'

#define YES cout<<"YES"<<endl

#define NO cout<<"NO"<<endl





void solve(){

    int n;cin>>n;

    string s;cin>>s;



    int p = 0;

    int c = 0;

    int dot = 0;

    for(auto i: s){

        if(i == 's')c++;

        else if(i == 'p')p++;

        else dot++;

    }



    if(p + dot == n){

        YES;

    }

    else if(c + dot == n){

        YES;

    }

    else{



        p = 0;

        c = 0;

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

            p += (s[i] == 'p');

            if(p == 0 && s[i] == '.')s[i] = 's';

            else if(p != 0 && s[i] == '.')s[i] = 'p';

        }



        int cnt1 = 0;

        int cnt2 = 0;



        for(auto i:s){

            if(i == 's')cnt1++;

            else cnt2++;

        }



        if(cnt1 == 1 && s[0] == 's')YES;

        else if(cnt2 == 1 && s[n - 1] == 'p')YES;

        else NO;

    }





}



int32_t main(){



    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}

Submission (verdict: Accepted):
// Author : Hardik Ahuja



#include <bits/stdc++.h>

using namespace std;



#define int long long

#define loop(i,m,n) for(int i = (m);i < (n);i++)

#define rloop(i,m,n) for(int i = (m);i >= (n);i--)

#define ivec(vec) for(int i = 0;i < vec.size();i++)cin>>vec[i]

#define ovec(vec) for(int i = 0;i < vec.size();i++)cout<<vec[i]<<' '

#define endl '\n'

#define YES cout<<"YES"<<endl

#define NO cout<<"NO"<<endl





void solve(){

    int n;cin>>n;

    string s;cin>>s;



    int p = 0;

    int c = 0;

    int dot = 0;

    for(auto i: s){

        if(i == 's')c++;

        else if(i == 'p')p++;

        else dot++;

    }



    if(p + dot == n){

        YES;

    }

    else if(c + dot == n){

        YES;

    }

    else if(c == 1 && s[0] == 's' && p + dot == n - 1)YES;

    else if(p == 1 && s[n - 1] == 'p' && c + dot == n - 1)YES;

    else NO;





}



int32_t main(){



    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}
Problem: 2050E - Three Strings
Language: C++23 (GCC 14-64, msys2)


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

#define dbg(x) cout << #x << ' = ' << x << endl
#define all(x) (x).begin(), (x).end()
#define cin_vector(vec, n, T)  \
    vector<T> vec(n);          \
    for (ll i = 0; i < n; i++) \
        cin >> vec[i];

template <typename T>
void print(vector<T> &v)
{
    for (auto &a : v)
        cout << a << ' ';
    cout << endl;
}

string a, b, c;

int rec(int i, int j, int k)
{
    int changes = 0;
    if (k == -1)
    {
        return 0;
    }
    if (a[i] == c[k] && b[j] != c[k])
    {
        return min(rec(i - 1, j, k - 1), 1 + rec(i, j - 1, k - 1));
    }
    if (b[j] == c[k] && a[i] != c[k])
    {
        return min(rec(i, j - 1, k - 1), 1 + rec(i - 1, j, k - 1));
    }
    if (a[i] == c[k] && b[j] == c[k])
    {
        return min(rec(i - 1, j, k - 1), rec(i, j - 1, k - 1));
    }
    else
    {
        changes++;
        return changes + min(rec(i - 1, j, k - 1), rec(i, j - 1, k - 1));
    }
}

void solve()
{

    cin >> a >> b >> c;
    reverse(all(a));
    reverse(all(b));
    reverse(all(c));
    cout << rec(a.size() - 1, b.size() - 1, c.size() - 1) << endl;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin >> t;
    while (t--)
    {
        solve();
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 4):
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin>>n;
    int c[n],tmp[n];
    for(int i=0;i<n;i++){
        cin>>c[i];
        tmp[i]=c[i];
    }
    vector<pair<int,int>> ans;
    for(int i=0;i<n-1;i++)if(tmp[i]==tmp[i+1]-1){
        ans.push_back(make_pair(tmp[i],tmp[i+1]));
        ans.push_back(make_pair(tmp[i+1],tmp[i]));
    }
    for(int i=n-1;i>=0;i--){
        for(int j=0;j<i;j++){
            if(tmp[j]>tmp[j+1]){
                ans.push_back(make_pair(tmp[j],tmp[j+1]));
                swap(tmp[j],tmp[j+1]);
            }
        }
    }
    cout<<ans.size()<<endl;
    for(int i=ans.size()-1;i>=0;i--)cout<<ans[i].first<<' '<<ans[i].second<<endl;
    return 0;
}

Submission (verdict: Wrong answer on test 4):
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin>>n;
    int c[n],tmp[n];
    for(int i=0;i<n;i++){
        cin>>c[i];
        tmp[i]=c[i];
    }
    vector<pair<int,int>> ans;
    for(int i=0;i<n-1;i++)if(tmp[i]<tmp[i+1]){
        ans.push_back(make_pair(tmp[i],tmp[i+1]));
        ans.push_back(make_pair(tmp[i+1],tmp[i]));
    }
    for(int i=n-1;i>=0;i--){
        for(int j=0;j<i;j++){
            if(tmp[j]>tmp[j+1]){
                ans.push_back(make_pair(tmp[j],tmp[j+1]));
                swap(tmp[j],tmp[j+1]);
            }
        }
    }
    cout<<ans.size()<<endl;
    for(int i=ans.size()-1;i>=0;i--)cout<<ans[i].first<<' '<<ans[i].second<<endl;
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 4):
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin>>n;
    int c[n],tmp[n];
    for(int i=0;i<n;i++){
        cin>>c[i];
        tmp[i]=c[i];
    }
    vector<pair<int,int>> ans;
    for(int i=0;i<n-1;i++)if(tmp[i]==tmp[i+1]-1){
        ans.push_back(make_pair(tmp[i],tmp[i+1]));
        ans.push_back(make_pair(tmp[i+1],tmp[i]));
    }
    for(int i=n-1;i>=0;i--){
        for(int j=0;j<i;j++){
            if(tmp[j]>tmp[j+1]){
                ans.push_back(make_pair(tmp[j],tmp[j+1]));
                swap(tmp[j],tmp[j+1]);
            }
        }
    }
    cout<<ans.size()<<endl;
    for(int i=ans.size()-1;i>=0;i--)cout<<ans[i].first<<' '<<ans[i].second<<endl;
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 4):
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin>>n;
    int c[n],tmp[n];
    for(int i=0;i<n;i++){
        cin>>c[i];
        tmp[i]=c[i];
    }
    vector<pair<int,int>> ans;
    for(int i=0;i<n-1;i++)if(tmp[i]<tmp[i+1]){
        ans.push_back(make_pair(tmp[i],tmp[i+1]));
        ans.push_back(make_pair(tmp[i+1],tmp[i]));
    }
    for(int i=n-1;i>=0;i--){
        for(int j=0;j<i;j++){
            if(tmp[j]>tmp[j+1]){
                ans.push_back(make_pair(tmp[j],tmp[j+1]));
                swap(tmp[j],tmp[j+1]);
            }
        }
    }
    cout<<ans.size()<<endl;
    for(int i=ans.size()-1;i>=0;i--)cout<<ans[i].first<<' '<<ans[i].second<<endl;
    return 0;
}

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

signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n;
    cin>>n;
    int c,tmp[n+1];
    for(int i=0;i<=n;i++)tmp[i]=i;
    vector<pair<int,int>> ans;
    for(int i=1;i<=n;i++){
        cin>>c;
        int l=i,r=n,m=(l+r)/2;
        while(l<r){
            if(tmp[m]<c)l=m+1;
            else r=m;
            m=(l+r)/2;
        }
        for(int j=m;j<n;j++){
            ans.push_back(make_pair(tmp[j+1],tmp[j]));
            swap(tmp[j],tmp[j+1]);
        }
        for(int j=n-1;j>=i;j--){
            ans.push_back(make_pair(tmp[j+1],tmp[j]));
            swap(tmp[j],tmp[j+1]);
        }
    }
    cout<<ans.size()<<endl;
    for(auto i:ans)cout<<i.first<<' '<<i.second<<endl;
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++17 (GCC 7-32)


Submission (verdict: Runtime error on test 1):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fr(i, a, b) for (int i = a; i < b; i++)
#define vi vector<int>
#define vc vector<char>
#define pb push_back
#define ub(x, v) upper_bound(v.begin(), v.end(), x)
#define lb(x, v) lower_bound(v.begin(), v.end(), x)
#define lbi(x, v) lower_bound(v.begin(), v.end(), x) - v.begin()
#define ubi(x, v) upper_bound(v.begin(), v.end(), x) - v.begin()
#define all(a) (a).begin(), (a).end()
int power(int a, int b)
{
    int result = 1;
    while (b)
    {
        if (b & 1)
            result = result * a;
        a = a * a;
        b >>= 1;
    }
    return result;
}
#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
signed main()
{
    fast;
    {
        int n;
        cin >> n;
        vi v(n);
        fr(i, 0, n) { cin >> v[i]; }
        vector<pair<int, int>> p;
        map<int, vi> m;
        fr(i, 0, n - 1)
        {
            fr(j, 1 + i, n)
            {
                if (v[i] > v[j])
                {
                    m[v[i]].pb(v[j]);
                }
                else
                {
                    m[v[i]].pb(v[j]);
                    m[v[j]].pb(v[i]);
                }
            }
        }
        for (int i = n; i > 0; i--)
        {
            sort(all(m[i]));
            vi temp;
            for (int j = m[i].size() - 1; j >= 0; j--)
            {
                if(m[i][j]>i){
                    temp.pb(m[i][j]);
                }
                else{
                    p.pb({i,m[i][j]});
                }
            }
            sort(all(temp));
            fr(j,0,temp.size()){
                p.pb({i,temp[j]});
            }
        }
        cout<<p.size()<<endl;
        fr(i,0,p.size()){
            cout<<p[i].first<<" "<<p[i].second<<endl;
        }

    }
}
/*
1 2 3 4 5
5 3 2 1 4
tot = 13
unordered
5 3
5 2
5 1
5 4
3 2
3 1
4 3
3 4
2 1
4 2
2 4
4 1
1 4

if we sort
5 4
5 3
5 2
5 1
5 1 2 3 4
4 3
4 2
4 1
5 4 1 2 3
3 2
3 1
3 4
5 3 4 1 2
2 1
2 4
5 3 2 4 1
1 4
5 3 2 1 4



2 1
3 1
4 1
5 1
2 3 4 5 1
4 3
4 2

1 4
*/
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
 
int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int t;
    cin >> t;
    while(t--){
        unsigned int l, r;
        cin >> l >> r;
        // We are guaranteed that r - l > 1 so there are at least 3 numbers.
 
        // Collect candidate numbers from near the ends.
        // (Using a total of up to 32 candidates is plenty.)
        vector<unsigned int> cand;
        // Take the first 16 numbers from l (or all if fewer than 16 available)
        unsigned int cntLow = min((unsigned int)16, r - l + 1);
        for (unsigned int x = l; x < l + cntLow; x++){
            cand.push_back(x);
        }
        // Take the last 16 numbers (again, adjust if the interval is small)
        unsigned int cntHigh = min((unsigned int)16, r - l + 1);
        unsigned int startHigh = (r >= cntHigh - 1 ? r - (cntHigh - 1) : l);
        for (unsigned int x = startHigh; x <= r; x++){
            cand.push_back(x);
        }
        // Remove duplicates (if the interval is very small, the two groups might overlap)
        sort(cand.begin(), cand.end());
        cand.erase(unique(cand.begin(), cand.end()), cand.end());
 
        // Try all triples among the candidate numbers.
        // (Since the candidate set is small, a triple–loop is fast.)
        unsigned long long bestVal = 0;
        unsigned int ansA = l, ansB = l, ansC = l;
        int n = cand.size();
        for (int i = 0; i < n; i++){
            for (int j = i+1; j < n; j++){
                for (int k = j+1; k < n; k++){
                    unsigned int a = cand[i], b = cand[j], c = cand[k];
                    // Compute the team independence
                    unsigned int xor_ab = a ^ b;
                    unsigned int xor_bc = b ^ c;
                    unsigned int xor_ac = a ^ c;
                    unsigned long long sum = (unsigned long long)xor_ab + xor_bc + xor_ac;
                    if(sum > bestVal){
                        bestVal = sum;
                        ansA = a; ansB = b; ansC = c;
                    }
                }
            }
        }
 
        cout << ansA << " " << ansB << " " << ansC << "\n";
    }
    return 0;
}