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


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

int main() {
    int t, n, i, bef, aft, subs = 0;
    scanf("%d", &t);
    while (t--) {
        scanf("%d", &n);
        bool possible = true;

        scanf("%d", &bef);
        for (i = 1; i < n; i++) {
            scanf("%d", &aft);
            if (subs > aft) {
                possible = false;
            }
            subs = aft - bef;
            if (subs < 0)
                subs = 0;
            bef = subs;
        }
        printf("%s\n", possible ? "YES":"NO");
    }
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)


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

int main()
{
	int t;
	scanf("%d", &t);
	while(t--)
	{
		int dp[1005][1005];
		char a[1005], b[1005], c[1005];
		scanf("%s %s %s", &a, &b, &c);
		int lena=strlen(a), lenb=strlen(b);
		for(int i=0; i<=lena; i++)
		{
			for(int j=0; j<=lenb; j++)
			{
				dp[i][j]=1e9;
			}
		}
		dp[0][0]=0;
		for(int i=0; i<=lena; i++)
		{
			for(int j=0; j<=lenb; j++)
			{
				if(i==j && i==0)
				{
					continue;
				}
				if(c[i+j-1]==a[i-1] && i>0)
				{
					dp[i][j]=min(dp[i-1][j], dp[i][j]);
				}
				else if(i>0)
				{
					dp[i][j]=min(dp[i-1][j]+1, dp[i][j]);
				}
				if(c[i+j-1]==b[j-1] && j>0)
				{
					dp[i][j]=min(dp[i][j-1], dp[i][j]);
				}
				else if(j>0)
				{
					dp[i][j]=min(dp[i][j-1]+1, dp[i][j]);
				}
			}
		}
		printf("%d\n", dp[lena][lenb]);
	}
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

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

int main()
{
	int t;
	scanf("%d", &t);
	while(t--)
	{
		int dp[1005][1005];
		char a[1005], b[1005], c[1005];
		scanf("%s %s %s", &a, &b, &c);
		int lena=strlen(a), lenb=strlen(b);
		for(int i=0; i<=lena; i++)
		{
			for(int j=0; j<=lenb; j++)
			{
				dp[i][j]=1e9;
			}
		}
		dp[0][0]=0;
		for(int i=0; i<=lena; i++)
		{
			for(int j=0; j<=lenb; j++)
			{
				if(i==j && i==0)
				{
					continue;
				}
				if(c[i+j-1]==a[i-1] && i>0)
				{
					dp[i][j]=min(dp[i-1][j], dp[i][j]);
				}
				else if(i>0)
				{
					dp[i][j]=min(dp[i-1][j]+1, dp[i][j]);
				}
				if(c[i+j-1]==b[j-1] && j>0)
				{
					dp[i][j]=min(dp[i][j-1], dp[i][j]);
				}
				else if(j>0)
				{
					dp[i][j]=min(dp[i][j-1]+1, dp[i][j]);
				}
			}
		}
		printf("%d\n", dp[lena][lenb]);
	}
}

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

int main()
{
	int t;
	scanf("%d", &t);
	while(t--)
	{
		int dp[1005][1005];
		char a[1005], b[1005], c[1005];
		scanf("%s %s %s", &a, &b, &c);
		int lena=strlen(a), lenb=strlen(b);
		for(int i=0; i<=lena; i++)
		{
			for(int j=0; j<=lenb; j++)
			{
				dp[i][j]=1e9;
			}
		}
		dp[0][0]=0;
		for(int i=0; i<=lena; i++)
		{
			for(int j=0; j<=lenb; j++)
			{
				if(i==j && i==0)
				{
					continue;
				}
				if(i>0 && c[i+j-1]==a[i-1])
				{
					dp[i][j]=min(dp[i-1][j], dp[i][j]);
				}
				else if(i>0)
				{
					dp[i][j]=min(dp[i-1][j]+1, dp[i][j]);
				}
				if(j>0 && c[i+j-1]==b[j-1])
				{
					dp[i][j]=min(dp[i][j-1], dp[i][j]);
				}
				else if(j>0)
				{
					dp[i][j]=min(dp[i][j-1]+1, dp[i][j]);
				}
			}
		}
		printf("%d\n", dp[lena][lenb]);
	}
}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)

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

int main()
{
	int t;
	scanf("%d", &t);
	while(t--)
	{
		int dp[1005][1005];
		char a[1005], b[1005], c[1005];
		scanf("%s %s %s", &a, &b, &c);
		int lena=strlen(a), lenb=strlen(b);
		for(int i=0; i<=lena; i++)
		{
			for(int j=0; j<=lenb; j++)
			{
				dp[i][j]=1e9;
			}
		}
		dp[0][0]=0;
		for(int i=0; i<=lena; i++)
		{
			for(int j=0; j<=lenb; j++)
			{
				if(i==j && i==0)
				{
					continue;
				}
				if(i>0 && c[i+j-1]==a[i-1])
				{
					dp[i][j]=min(dp[i-1][j], dp[i][j]);
				}
				else if(i>0)
				{
					dp[i][j]=min(dp[i-1][j]+1, dp[i][j]);
				}
				if(j>0 && c[i+j-1]==b[j-1])
				{
					dp[i][j]=min(dp[i][j-1], dp[i][j]);
				}
				else if(j>0)
				{
					dp[i][j]=min(dp[i][j-1]+1, dp[i][j]);
				}
			}
		}
		printf("%d\n", dp[lena][lenb]);
	}
}

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

int main()
{
	int t;
	scanf("%d", &t);
	while(t--)
	{
		int dp[1005][1005];
		char a[1005], b[1005], c[2005];
		scanf("%s %s %s", &a, &b, &c);
		int lena=strlen(a), lenb=strlen(b);
		for(int i=0; i<=lena; i++)
		{
			for(int j=0; j<=lenb; j++)
			{
				dp[i][j]=1e9;
			}
		}
		dp[0][0]=0;
		for(int i=0; i<=lena; i++)
		{
			for(int j=0; j<=lenb; j++)
			{
				if(i==j && i==0)
				{
					continue;
				}
				if(i>0 && c[i+j-1]==a[i-1])
				{
					dp[i][j]=min(dp[i-1][j], dp[i][j]);
				}
				else if(i>0 && c[i+j-1]!=a[i-1])
				{
					dp[i][j]=min(dp[i-1][j]+1, dp[i][j]);
				}
				if(j>0 && c[i+j-1]==b[j-1])
				{
					dp[i][j]=min(dp[i][j-1], dp[i][j]);
				}
				else if(j>0 && c[i+j-1]!=b[j-1])
				{
					dp[i][j]=min(dp[i][j-1]+1, dp[i][j]);
				}
			}
		}
		printf("%d\n", dp[lena][lenb]);
	}
}
Problem: 2061D - Kevin and Numbers
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 3):
// Humare saath Shri Raghunath toh
// Kis baat ki chinta :)

#include<bits/stdc++.h>
using namespace std;
//-----------------------------------------------------------------------------------------------------------------------//
typedef long long int ll;
typedef vector<ll> vi;
typedef pair<ll, ll> pi;
typedef vector<pi> vp;
#define endl "\n"
#define all(_obj) _obj.begin(), _obj.end()
#define rev(i,a,b) for (ll i = b; i >= a; i--)
#define ff first
#define ss second
#define pb push_back
#define loop(i,a,b) for(ll i=a;i<b;i++)
#define YES cout << "YES"
#define NO cout << "NO"
#define Yes cout << "Yes"
#define No cout << "No"
const ll M = 1e9 + 7;
//-----------------------------------------------------------------------------------------------------------------------//
bool cmp(pi &a, pi &b) {
    if (a.ff == b.ff) return a.ss > b.ss;
    else return a.ff > b.ff;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    /*#ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif*/
    ll t;
    cin >> t;
    for (ll h = 1; h <= t; h++) {
        //cout<<"Case #"<<h<<": ";
        ll n, m;
        cin >> n >> m;
        multiset<ll> set1;
        loop(i, 0, n) {
            ll in;
            cin >> in;
            set1.insert(in);
        }
        multiset<ll> set2;
        loop(i, 0, m) {
            ll in;
            cin >> in;
            if (set1.find(in) == set1.end()) set2.insert(in);
            else {
                set1.erase(set1.find(in));
            }
        }
        while (!set1.empty() && !set2.empty()) {
            auto it = set1.begin(), it2 = set2.begin();
            if (*it2 < *it) break;
            else if (*it2 == *it) {
                set1.erase(set1.find(*it));
                set2.erase(set2.find(*it2));
            }
            else {
                ll x = *it2;
                set2.erase(set2.find(*it2));
                if (x % 2) {
                    set2.insert(x / 2);
                    set2.insert(x / 2 + 1);
                }
                else {
                    set2.insert(x / 2);
                    set2.insert(x / 2);
                }
            }
        }
        (set1.empty() && set2.empty()) ? Yes : No;
        cout << endl;
    }
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)


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

using namespace std;

#define ll long long

#define f(i,n) for(ll i=0;i<n;i++)



void solve(){

    ll n;

    cin>>n;

    ll sum=0;

    ll x=n;

    ll cnt2=0,cnt3=0;

    while(x>0){

        if(x%10==2) cnt2++;

        if(x%10==3) cnt3++;

        sum+=(x%10);

        x/=10;

    }

    if(sum%9==0){

        cout<<"YES\n";

        return;

    }

    else if(sum%9==1){

        // if(cnt2==0){

        //     cout<<"NO\n";

        //     return;

        // }else{

        //     // if(cnt3==0){

        //     //     if(cnt2>=4){

        //     //         cout<<"YES\n";

        //     //         return;

        //     //     }else{

        //     //         cout<<"NO\n";

        //     //         return;

        //     //     }

        //     // }else{

        //     //     cout<<"YES\n";

        //     //     return;

        //     // }

        //     if(cnt2>=4 || (cnt2>=1 && cnt3>=1)){

        //         cout<<"YES\n";

        //         return;

        //     }

        // }

        if(cnt2>=4 || (cnt2>=1 && cnt3>=1)) cout<<"YES\n";

        else cout<<"NO\n";

    }else if(sum%9==2){

        if((cnt2>=8) || (cnt2>=5 && cnt3>=1) || (cnt2>=2 && cnt3>=2)){

            cout<<"YES\n";

            return;

        }else{

            cout<<"No\n";

        }

    }else if(sum%9==3){

        if(cnt2>=3 || cnt3>=1) cout<<"YES\n";

        else cout<<"NO\n";

    }else if(sum%9==4){

        if(cnt2>=7 || (cnt2>=4 && cnt3>=1) || (cnt2>=1 && cnt3>=2)) cout<<"YES\n";

        else cout<<"NO\n";

    }else if(sum%9==5){

        if(cnt2>=2) cout<<"YES\n";

        else cout<<"NO\n";

    }else if(sum%9==6){

        if(cnt2>=6 || (cnt2>=3 && cnt3>=1) || (cnt3>=2)) cout<<"YES\n";

        else cout<<"NO\n";

    }else if(sum%9==7){

        if(cnt2>=1) cout<<"YES\n";

        else cout<<"NO\n";

    }else if(sum%9==8){

        if(cnt2>=5 || (cnt2>=2 && cnt3>=1)) cout<<"YES\n";

        else cout<<"NO\n";

    }

}

int main(){

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    cout.tie(NULL);

    int t;

    cin >> t;

    while (t--){

        solve();

    }

    return 0;

}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 3):
#include<iostream>
#include<vector>
using namespace std;
#define ll long long

int main(){
    ios_base::sync_with_stdio(false);
    ll t;
    cin >> t;
    while(t--){
        ll n;
        cin >> n;
        ll c2=0;
        ll c3=0;
        ll sum=0;
        bool a=false;
        while(n>0){
            sum+=(n%10);
            if(n%10==2){
                c2+=1;
            }
            else if(n%10==3){
                c3+=1;
            }
            n/=10;
        }
        if(sum%9==0){
            a=true;
        }
        else{
            for(int i=0;i<=c2;i++){
                for(int j=0;j<=c3;j++){
                    ll sum1=sum;
                    sum1+=(2*i)+(6*j);
                    if(sum1%9==0){
                        a=true;
                        break;
                    }
                }
                if(a==true){
                    break;
                }
            }
        }
        if(a==true){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 3):
#include<iostream>
#include<vector>
using namespace std;
#define ll long long

int main(){
    ios_base::sync_with_stdio(false);
    ll t;
    cin >> t;
    while(t--){
        ll n;
        cin >> n;
        ll c2=0;
        ll c3=0;
        ll sum=0;
        bool a=false;
        while(n>0){
            sum+=(n%10);
            if(n%10==2){
                c2+=1;
            }
            else if(n%10==3){
                c3+=1;
            }
            n/=10;
        }
        if(sum%9==0){
            a=true;
        }
        else{
            for(int i=0;i<=c2;i++){
                for(int j=0;j<=c3;j++){
                    ll sum1=sum;
                    sum1+=(2*i)+(6*j);
                    if(sum1%9==0){
                        a=true;
                        break;
                    }
                }
                if(a==true){
                    break;
                }
            }
        }
        if(a==true){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
}

Submission (verdict: Wrong answer on test 3):
#include<iostream>
#include<vector>
using namespace std;
#define ll long long

int main(){
    ios_base::sync_with_stdio(false);
    ll t;
    cin >> t;
    while(t--){
        ll n;
        cin >> n;
        ll c2=0;
        ll c3=0;
        ll sum=0;
        bool a=false;
        while(n>0){
            sum+=(n%10);
            if(n%10==2){
                c2+=1;
            }
            else if(n%10==3){
                c3+=1;
            }
            n/=10;
        }
        if(c2>8){
            c2=8;
        }
        if(c3>8){
            c3=8;
        }
        if(sum%9==0){
            a=true;
        }
        else{
            for(int i=0;i<=c2;i++){
                for(int j=0;j<=c3;j++){
                    ll sum1=sum;
                    sum1+=(2*i)+(6*j);
                    if(sum1%9==0){
                        a=true;
                        break;
                    }
                }
                if(a==true){
                    break;
                }
            }
        }
        if(a==true){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
}
Problem: 2050C - Uninteresting Number
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 3):
#include<iostream>
#include<vector>
using namespace std;
#define ll long long

int main(){
    ios_base::sync_with_stdio(false);
    ll t;
    cin >> t;
    while(t--){
        ll n;
        cin >> n;
        ll c2=0;
        ll c3=0;
        ll sum=0;
        bool a=false;
        while(n>0){
            sum+=(n%10);
            if(n%10==2){
                c2+=1;
            }
            else if(n%10==3){
                c3+=1;
            }
            n/=10;
        }
        if(c2>8){
            c2=8;
        }
        if(c3>8){
            c3=8;
        }
        if(sum%9==0){
            a=true;
        }
        else{
            for(int i=0;i<=c2;i++){
                for(int j=0;j<=c3;j++){
                    ll sum1=sum;
                    sum1+=(2*i)+(6*j);
                    if(sum1%9==0){
                        a=true;
                        break;
                    }
                }
                if(a==true){
                    break;
                }
            }
        }
        if(a==true){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
}

Submission (verdict: Accepted):
#include<iostream>
#include<vector>
#include<string>
using namespace std;
#define ll long long

int main(){
    ios_base::sync_with_stdio(false);
    ll t;
    cin >> t;
    while(t--){
        string n;
        cin >> n;
        ll c2=0;
        ll c3=0;
        ll sum=0;
        bool a=false;
        for(int i=0;i<n.size();i++){
            sum+=n[i]-'0';
            if(n[i]=='2'){
                c2+=1;
            }
            else if(n[i]=='3'){
                c3+=1;
            }
        }
        if(sum%9==0){
            a=true;
        }
        else{
            for(int i=0;i<=c2;i++){
                for(int j=0;j<=c3;j++){
                    ll sum1=sum;
                    sum1+=(2*i)+(6*j);
                    if(sum1%9==0){
                        a=true;
                        break;
                    }
                }
                if(a==true){
                    break;
                }
            }
        }
        if(a==true){
            cout << "YES" << endl;
        }
        else{
            cout << "NO" << endl;
        }
    }
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

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

using namespace std;

void solve(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int &x: a) cin >> x;
  for(int i = 0; i < n-1; i++){
    if(a[i] == a[i+1]){
      continue;
    }
    cout << ((a[i] > a[i+1])? "NO" : "YES")<< "\n";
    break;
  }
}

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


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

using namespace std;

void solve(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int &x: a) cin >> x;
  for(int i = 0; i < n-1; i++){
    if(a[i] == a[i+1]){
      continue;
    }
    if(a[i] < a[i+1]){
      a[i+1] -= a[i];
    }
    if(a[i] > a[i+1]){
      cout << "NO\n";
      break;
    }
    if(i==n-2){
      cout << "YES\n";
    }
  }
}

int main(){
  int t;
  cin >> t;
  while(t--) solve();
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

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

using namespace std;

void solve(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int &x: a) cin >> x;
  for(int i = 0; i < n-1; i++){
    if(a[i] < a[i+1]){
      a[i+1] -= a[i];
    }
    else if(a[i] > a[i+1]){
      cout << "NO\n";
      break;
    }
    if(i==n-2){
      cout << "YES\n";
      break;
    }
  }
}

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


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

using namespace std;

void solve(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int &x: a) cin >> x;
  for(int i = 0; i < n-1; i++){
    if(a[i] <= a[i+1]){
      a[i+1] -= a[i];
    }
    else if(a[i] > a[i+1]){
      cout << "NO\n";
      break;
    }
    if(i==n-2){
      cout << "YES\n";
      break;
    }
  }
}

int main(){
  int t;
  cin >> t;
  while(t--) solve();
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

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

using namespace std;

void solve(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int &x: a) cin >> x;
  for(int i = 0; i < n-1; i++){
    if(a[i] == a[i+1]){
      continue;
    }
    if(a[i] < a[i+1]){
      a[i+1] -= a[i];
    }
    if(a[i] > a[i+1]){
      cout << "NO\n";
      break;
    }
    if(i==n-2){
      cout << "YES\n";
    }
  }
}

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


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

using namespace std;

void solve(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int &x: a) cin >> x;
  for(int i = 0; i < n-1; i++){
    if(a[i] == a[i+1]){
      continue;
    }
    else if(a[i] < a[i+1]){
      a[i+1] -= a[i];
    }
    else if(a[i] > a[i+1]){
      cout << "NO\n";
      break;
    }
    if(i==n-2){
      cout << "YES\n";
      break;
    }
  }
}

int main(){
  int t;
  cin >> t;
  while(t--) solve();
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

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

using namespace std;

void solve(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int &x: a) cin >> x;
  for(int i = 0; i < n-1; i++){
    if(a[i] == a[i+1]){
      continue;
    }
    else if(a[i] < a[i+1]){
      a[i+1] -= a[i];
    }
    else if(a[i] > a[i+1]){
      cout << "NO\n";
      break;
    }
    if(i==n-2){
      cout << "YES\n";
      break;
    }
  }
}

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


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

using namespace std;

void solve(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int &x: a) cin >> x;
  for(int i = 0; i < n-1; i++){
    if(a[i] < a[i+1]){
      a[i+1] -= a[i];
    }
    else if(a[i] > a[i+1]){
      cout << "NO\n";
      break;
    }
    if(i==n-2){
      cout << "YES\n";
      break;
    }
  }
}

int main(){
  int t;
  cin >> t;
  while(t--) solve();
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)


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

using namespace std;

void solve(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int &x: a) cin >> x;
  for(int i = 0; i < n-1; i++){
    if(a[i] == a[i+1]){
      continue;
    }
    cout << ((a[i] > a[i+1])? "NO" : "YES")<< "\n";
    break;
  }
}

int main(){
  int t;
  cin >> t;
  while(t--) solve();
}
Problem: 2057C - Trip to the Olympiad
Language: PyPy 3-64

Previous submission (verdict: Wrong answer on test 1):
# cook your dish here
for _ in range(int(input())):
    min_val, max_val = map(int, input().split())
    
    def decimalToBinary(n): 
        return bin(n).replace("0b", "")
        
    def binaryToDecimal(n):
        return int(str(n),2)
    
    min_bin = [*decimalToBinary(min_val)]
    max_bin = [*decimalToBinary(max_val)]
    
    while len(min_bin) != len(max_bin):
        min_bin.insert(0, '0')
    
    a_bin = []
    b_bin = []
    
    for i,j in zip(min_bin, max_bin):
        if i != j:
            a_bin.append(str(i))
            b_bin.append(str(j))
            min_bin.pop(0)
            max_bin.pop(0)
            for i in range(len(min_bin)-1):
                if int("".join(a_bin)) > int("".join(b_bin)):
                    a_bin.append('1')
                    b_bin.append('0')
                else:
                    a_bin.append('0')
                    b_bin.append('1')
            break
        else:
            a_bin.append(str(i))
            b_bin.append(str(j))
            min_bin.pop(0)
            max_bin.pop(0)
            
    # print(min_bin, max_bin)
    # print(a_bin, b_bin)
            
    f_a = binaryToDecimal("".join(a_bin))
    f_b = binaryToDecimal("".join(b_bin))
    f_c = min(f_a, f_b) +1
    for i in range(min_val, max_val+1):
        if (i != f_a and i != f_b):
            f_c = i
            break
    
    print(f_a, f_b, f_c)

Submission (verdict: Wrong answer on test 1):
# cook your dish here
for _ in range(int(input())):
    min_val, max_val = map(int, input().split())
    
    def decimalToBinary(n): 
        return bin(n).replace("0b", "")
        
    def binaryToDecimal(n):
        return int(str(n),2)
    
    min_bin = [*decimalToBinary(min_val)]
    max_bin = [*decimalToBinary(max_val)]
    
    while len(min_bin) != len(max_bin):
        min_bin.insert(0, '0')
    
    a_bin = []
    b_bin = []
    
    # print(min_bin, max_bin)
    
    for k in range(len(max_bin)):
        i = min_bin[k]
        j = max_bin[k]
        if i != j:
            a_bin.append(str(i))
            b_bin.append(str(j))
            for i in range(len(max_bin) - len(a_bin)):
                if int("".join(a_bin)) < int("".join(b_bin)):
                    a_bin.append('1')
                    b_bin.append('0')
                else:
                    a_bin.append('0')
                    b_bin.append('1')
            break
        else:
            a_bin.append(str(i))
            b_bin.append(str(j))
    
    # print(a_bin, b_bin)
            
    f_a = binaryToDecimal("".join(a_bin))
    f_b = binaryToDecimal("".join(b_bin))
    f_c = min(f_a, f_b) +1
    for i in range(min_val, max_val+1):
        if (i != f_a and i != f_b):
            f_c = i
            break
    
    print(f_a, f_b, f_c)