ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050E - Three Strings
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll inf = 1e16;
int main()
{
    int t;
    ll dp[2005][2005];
    string a,b,c;
    cin>>t;
    for(int i = 0;i < t ;i++)
    {
        cin>>a>>b>>c;
        int lena = a.length();
        int lenb = b.length();
        for(int j = 0;j <= lena;j++)
            for(int k = 0;k <= lenb;k++)
                dp[j][k] = inf;
        dp[0][0] = 0;
        for(int j = 1;j <= lena;j++)
            dp[j][0] = dp[j - 1][0] + (a[j - 1] != c[j - 1]);
        for(int j = 1;j <= lenb;j++)
            dp[0][j] = dp[0][j - 1] + (b[j - 1] != c[j - 1]);
        for(int j = 1;j <= lena;j++)
            for(int k = 1;k <= lenb;k++)
                dp[j][k] = min(dp[j - 1][k] + (a[k - 1] != c[j + k - 1]),dp[j][k  - 1] + (b[k - 1] != c[k + j - 1]));
        cout<<dp[lena][lenb]<<endl;
    }
    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll inf = 1e16;
ll dp[2005][2005];
int main()
{
    ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
    int t;
    string a,b,c;
    cin>>t;
    for(int i = 0;i < t ;i++)
    {
        cin>>a>>b>>c;
        int lena = a.length();
        int lenb = b.length();
        for(int j = 0;j <= lena;j++)
            for(int k = 0;k <= lenb;k++)
                dp[j][k] = inf;
        dp[0][0] = 0;
        for(int j = 1;j <= lena;j++)
            dp[j][0] = dp[j - 1][0] + (a[j - 1] != c[j - 1]);
        for(int j = 1;j <= lenb;j++)
            dp[0][j] = dp[0][j - 1] + (b[j - 1] != c[j - 1]);
        for(int j = 1;j <= lena;j++)
            for(int k = 1;k <= lenb;k++)
                dp[j][k] = min(dp[j - 1][k] + (a[j - 1] != c[j + k - 1]),dp[j][k  - 1] + (b[k - 1] != c[k + j - 1]));
        cout<<dp[lena][lenb]<<endl;
    }
    return 0;
}
Problem: 2050E - Three Strings
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    int t;
    ll dp[1000][1000];
    string a,b,c;
    cin>>t;
    for(int i = 0;i < t ;i++)
    {
        dp[0][0] = 0;
        cin>>a>>b>>c;
        int lena = a.length();
        int lenb = b.length();
        for(int j = 1;j < lena;j++)
            dp[0][j] = dp[0][j - 1] + (a[j] != c[j]);
        for(int j = 1;j < lenb;j++)
            dp[0][j] = dp[0][j - 1] + (b[j] != c[j]);
    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

int T;
int a[55];

int main()
{
    scanf("%d", &T);
    while (T--)
    {
        int n;
        ll sum = 0;
        scanf("%d", &n);
        for (int i = 1; i <= n; i++)
            scanf("%d", &a[i]);
        for (int i = 1; i <= n; i++)
            sum += a[i];
        for (int i = 1; i < n; i++)
            a[i] = a[i + 1] - a[i];
        int m = n;
        while (m--)
        {
            ll sum2 = 0;
            for (int i = 1; i <= m; i++)
                sum2 += a[i];
            sum = max(sum, sum2);
            sum = max(sum, -sum2);
            for (int i = 1; i < m; i++)
                a[i] = a[i + 1] - a[i];
        }
        printf("%lld\n", sum);
    }
}

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

int T;
int a[55];

int main()
{
    scanf("%d", &T);
    while (T--)
    {
        int n;
        ll sum = 0;
        scanf("%d", &n);
        for (int i = 1; i <= n; i++)
            scanf("%d", &a[i]);
        for (int i = 1; i <= n; i++)
            sum += a[i];
        for (int i = 1; i < n; i++)
            a[i] = a[i + 1] - a[i];
        for (int m = n - 1; m >= 1; m--)
        {
            ll sum2 = 0;
            for (int i = 1; i <= m; i++)
                sum2 += a[i];
            sum = max(sum, sum2);
            sum = max(sum, -sum2);
            for (int i = 1; i < m; i++)
                a[i] = a[i + 1] - a[i];
        }
        printf("%lld\n", sum);
    }
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

int T;
int a[55];

int main()
{
    scanf("%d", &T);
    while (T--)
    {
        int n;
        ll sum = -1 << 30;
        scanf("%d", &n);
        for (int i = 1; i <= n; i++)
            scanf("%d", &a[i]);
        for (int m = n; m >= 1; m--)
        {
            ll sum2 = 0;
            for (int i = 1; i <= m; i++)
                sum2 += a[i];
            sum = max(sum, sum2);
            if (m < n)
                sum = max(sum, -sum2);
            for (int i = 1; i < m; i++)
                a[i] = a[i + 1] - a[i];
        }
        printf("%lld\n", sum);
    }
}

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

int T;
int a[55];

int main()
{
    scanf("%d", &T);
    while (T--)
    {
        int n;
        ll sum = -1 << 30;
        scanf("%d", &n);
        for (int i = 1; i <= n; i++)
            scanf("%d", &a[i]);
        int m = n;
        for (int j = 1; j <= n; j++)
        {
            ll sum2 = 0;
            for (int i = 1; i <= m; i++)
                sum2 += a[i];
            sum = max(sum, sum2);
            if (j > 1)
                sum = max(sum, -sum2);
            for (int i = 1; i < m; i++)
                a[i] = a[i + 1] - a[i];
            m--;
        }
        printf("%lld\n", sum);
    }
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


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

int T;
int a[55];

int main()
{
    scanf("%d", &T);
    while (T--)
    {
        int n;
        ll sum = 0;
        scanf("%d", &n);
        for (int i = 1; i <= n; i++)
            scanf("%d", &a[i]);
        for (int i = 1; i <= n; i++)
            sum += a[i];
        for (int i = 1; i < n; i++)
            a[i] = a[i + 1] - a[i];
        int m = n;
        while (m--)
        {
            ll sum2 = 0;
            for (int i = 1; i <= m; i++)
                sum2 += a[i];
            sum = max(sum, sum2);
            sum = max(sum, -sum2);
            for (int i = 1; i < m; i++)
                a[i] = a[i + 1] - a[i];
        }
        printf("%lld\n", sum);
    }
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

int T;
int a[55];

int main()
{
    scanf("%d", &T);
    while (T--)
    {
        int n;
        ll sum = -1 << 30;
        scanf("%d", &n);
        for (int i = 1; i <= n; i++)
            scanf("%d", &a[i]);
        int m = n;
        for (int j = 1; j <= n; j++)
        {
            ll sum2 = 0;
            for (int i = 1; i <= m; i++)
                sum2 += a[i];
            sum = max(sum, sum2);
            if (j > 1)
                sum = max(sum, -sum2);
            for (int i = 1; i < m; i++)
                a[i] = a[i + 1] - a[i];
            m--;
        }
        printf("%lld\n", sum);
    }
}

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

int T;
ll a[55];

int main()
{
    scanf("%d", &T);
    while (T--)
    {
        int n;
        ll sum = 0;
        scanf("%d", &n);
        for (int i = 1; i <= n; i++)
            scanf("%lld", &a[i]);
        for (int i = 1; i <= n; i++)
            sum += a[i];
        for (int i = 1; i < n; i++)
            a[i] = a[i + 1] - a[i];
        for (int m = n - 1; m >= 1; m--)
        {
            ll sum2 = 0;
            for (int i = 1; i <= m; i++)
                sum2 += a[i];
            sum = max(sum, sum2);
            sum = max(sum, -sum2);
            for (int i = 1; i < m; i++)
                a[i] = a[i + 1] - a[i];
        }
        printf("%lld\n", sum);
    }
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

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

int T;
int a[55];

int main()
{
    scanf("%d", &T);
    while (T--)
    {
        int n;
        ll sum = 0;
        scanf("%d", &n);
        for (int i = 1; i <= n; i++)
            scanf("%d", &a[i]);
        for (int i = 1; i <= n; i++)
            sum += a[i];
        for (int i = 1; i < n; i++)
            a[i] = a[i + 1] - a[i];
        for (int m = n - 1; m >= 1; m--)
        {
            ll sum2 = 0;
            for (int i = 1; i <= m; i++)
                sum2 += a[i];
            sum = max(sum, sum2);
            sum = max(sum, -sum2);
            for (int i = 1; i < m; i++)
                a[i] = a[i + 1] - a[i];
        }
        printf("%lld\n", sum);
    }
}

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

int T;
int a[55];

int main()
{
    scanf("%d", &T);
    while (T--)
    {
        int n;
        ll sum = -1 << 30;
        scanf("%d", &n);
        for (int i = 1; i <= n; i++)
            scanf("%d", &a[i]);
        for (int m = n; m >= 1; m--)
        {
            ll sum2 = 0;
            for (int i = 1; i <= m; i++)
                sum2 += a[i];
            sum = max(sum, sum2);
            if (m < n)
                sum = max(sum, -sum2);
            for (int i = 1; i < m; i++)
                a[i] = a[i + 1] - a[i];
        }
        printf("%lld\n", sum);
    }
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 1):
#include<algorithm>
#include<iostream>
#include<cstdlib>
#include<cstring>
#include<cassert>
#include<cstdio>
#include<cctype>
#include<vector>
#include<bitset>
#include<random>
#include<ctime>
#include<queue>
#include<cmath>
#include<list>
#include<map>
#include<set>
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pll pair<long long,long long>
#define FF fflush(stdout)
#define inf 0x3f3f3f3f
#define endl "\n"
#define fi first
#define se second
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
//char buf[1<<20],*p1,*p2;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
inline int read()
{
    int s=0,f=1;
    char x=getchar();
    while(!isdigit(x))f=(x=='-'?-1:1),x=getchar();
    while(isdigit(x))s=s*10+x-'0',x=getchar();
    return s*f;
}
const int p=1e9+7;
//ll ksm(int a,int b){ll ans=1,bs=a;while(b){if(b&1)ans=ans*bs%p;bs=bs*bs%p;b>>=1;}return ans;}
mt19937 rd(time(0));
#define reaD read
ll a[55];
ll C[55][55];
ll cal(int k)
{
    ll s=0;
    for(int i=0;i<=k;i++)
    s+=((i+k)%2?-1:1)*C[k][i]*a[i];
    return s;
}
int main()
{
    C[0][0]=1;
    for(int i=1;i<=50;i++)
    {
        C[i][0]=1;
        for(int j=1;j<=i;j++)
        C[i][j]=C[i-1][j-1]+C[i-1][j];
    }
    int T=read();
    while(T--)
    {
        ll ans=0;
        int n=read();
        for(int i=0;i<n;i++)
        a[i]=read(),ans+=a[i];
        for(int i=0;i<=n-2;i++)
        {
            ll a1=cal(i);
            reverse(a,a+n);
            ll an=cal(i);
            reverse(a,a+n);
            ans=max(ans,abs(a1-an));
        }
        ans=max(ans,abs(cal(n-1)));
        printf("%lld\n",ans);  
    }
    
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

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

typedef long long ll;
typedef pair<int , int> PII;

const int INF = 0x3f3f3f3f;
const int N = 2e5 + 9;

int n;
vector<int> node[N];
int in[N];
bool flag[N];

struct Node
{
    int no , val;
    bool operator < (const Node temp) const
    {
        return val > temp.val;
    }
}a[N];

void solve()
{
    cin >> n;
    for(int i = 1 ; i <= n ; i++)
    {
        node[i].clear();
        in[i] = 0;
        flag[i] = false;
    }
    for(int i = 1 ; i < n ; i++)
    {
        int x , y;
        cin >> x >> y;
        node[x].push_back(y);
        node[y].push_back(x);
        in[x]++ , in[y]++;
    }
    for(int i = 1 ; i <= n ; i++)
    {
        a[i] = {i , in[i]};
    }
    sort(a + 1 , a + 1 + n);    
    int flag = 0;
    for(auto to : node[a[1].no])
    {
        if(to == a[2].no)
        {
            flag = -1;
        }
    }
    cout << a[1].val + a[2].val + flag - 1 << "\n";
}

int main()
{
    cin.tie(0) -> sync_with_stdio(false);
    int t;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}

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

typedef long long ll;
typedef pair<int , int> PII;

const int INF = 0x3f3f3f3f;
const int N = 2e5 + 9;

int n;
vector<int> node[N];
int in[N];
bool flag[N];

struct Node
{
    int no , val;
    bool operator < (const Node temp) const
    {
        return val > temp.val;
    }
}a[N];

void solve()
{
    cin >> n;
    for(int i = 1 ; i <= n ; i++)
    {
        node[i].clear();
        in[i] = 0;
        flag[i] = false;
    }
    for(int i = 1 ; i < n ; i++)
    {
        int x , y;
        cin >> x >> y;
        node[x].push_back(y);
        node[y].push_back(x);
        in[x]++ , in[y]++;
    }
    for(int i = 1 ; i <= n ; i++)
    {
        a[i] = {i , in[i]};
    }
    sort(a + 1 , a + 1 + n);    
    int ans = 0 , cnt = 0;
    for(int i = 1 ; i <= n ; i ++)
    {
        if(a[i].val == a[1].val)
        {
            cnt++;
        }
        else
        {
            break;
        }
    }
    if(cnt == 1)
    {
        int flag = 0;
        for(auto to : node[a[1].no])
        {
            if(to == a[2].no)
            {
                flag = -1;
            }
        }
        cout << a[1].val + a[2].val + flag - 1 << "\n";
    }
    else
    {
        cout << a[1].val + a[2].val - 1 << "\n";
    }
}

int main()
{
    cin.tie(0) -> sync_with_stdio(false);
    int t;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
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 pair<int , int> PII;

const int INF = 0x3f3f3f3f;
const int N = 2e5 + 9;

int n;
vector<int> node[N];
int in[N];
bool flag[N];

struct Node
{
    int no , val;
    bool operator < (const Node temp) const
    {
        return val > temp.val;
    }
}a[N];

void solve()
{
    cin >> n;
    for(int i = 1 ; i <= n ; i++)
    {
        node[i].clear();
        in[i] = 0;
        flag[i] = false;
    }
    for(int i = 1 ; i < n ; i++)
    {
        int x , y;
        cin >> x >> y;
        node[x].push_back(y);
        node[y].push_back(x);
        in[x]++ , in[y]++;
    }
    for(int i = 1 ; i <= n ; i++)
    {
        a[i] = {i , in[i]};
    }
    sort(a + 1 , a + 1 + n);    
    int ans = 0;
    for(auto to : node[a[1].no])
    {
        flag[to] = true;
    }
    if(flag[a[2].no])
    {
        cout << max(a[1].val + a[2].val - 1 , a[2].val + a[3].val) - 1 << "\n";
    }
    else
    {
        cout << a[1].val + a[2].val - 1 << '\n';
    }
}

int main()
{
    cin.tie(0) -> sync_with_stdio(false);
    int t;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

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

typedef long long ll;
typedef pair<int , int> PII;

const int INF = 0x3f3f3f3f;
const int N = 2e5 + 9;

int n;
vector<int> node[N];
int in[N];
bool flag[N];

struct Node
{
    int no , val;
    bool operator < (const Node temp) const
    {
        return val > temp.val;
    }
}a[N];

void solve()
{
    cin >> n;
    for(int i = 1 ; i <= n ; i++)
    {
        node[i].clear();
        in[i] = 0;
        flag[i] = false;
    }
    for(int i = 1 ; i < n ; i++)
    {
        int x , y;
        cin >> x >> y;
        node[x].push_back(y);
        node[y].push_back(x);
        in[x]++ , in[y]++;
    }
    for(int i = 1 ; i <= n ; i++)
    {
        a[i] = {i , in[i]};
    }
    sort(a + 1 , a + 1 + n);    
    int ans = 0 , cnt = 0;
    for(int i = 1 ; i <= n ; i ++)
    {
        if(a[i].val == a[1].val)
        {
            cnt++;
        }
        else
        {
            break;
        }
    }
    if(cnt == 1)
    {
        int flag = 0;
        for(auto to : node[a[1].no])
        {
            if(to == a[2].no)
            {
                flag = -1;
            }
        }
        cout << a[1].val + a[2].val + flag - 1 << "\n";
    }
    else
    {
        cout << a[1].val + a[2].val - 1 << "\n";
    }
}

int main()
{
    cin.tie(0) -> sync_with_stdio(false);
    int t;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}

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

typedef long long ll;
typedef pair<int , int> PII;

const int INF = 0x3f3f3f3f;
const int N = 2e5 + 9;

int n;
vector<int> node[N];
int in[N];
bool flag[N];

struct Node
{
    int no , val;
    bool operator < (const Node temp) const
    {
        return val > temp.val;
    }
}a[N];

void solve()
{
    cin >> n;
    for(int i = 1 ; i <= n ; i++)
    {
        node[i].clear();
        in[i] = 0;
        flag[i] = false;
    }
    for(int i = 1 ; i < n ; i++)
    {
        int x , y;
        cin >> x >> y;
        node[x].push_back(y);
        node[y].push_back(x);
        in[x]++ , in[y]++;
    }
    for(int i = 1 ; i <= n ; i++)
    {
        a[i] = {i , in[i]};
    }
    sort(a + 1 , a + 1 + n);    
    int ans = 0 , cnt = 0;
    for(int i = 1 ; i <= n ; i ++)
    {
        if(a[i].val == a[1].val)
        {
            cnt++;
        }
        else
        {
            break;
        }
    }
    if(cnt <= 2)
    {
        int flag = 0;
        for(auto to : node[a[1].no])
        {
            if(to == a[2].no)
            {
                flag = -1;
            }
        }
        cout << a[1].val + a[2].val + flag - 1 << "\n";
    }
    else 
    {
        cout << a[1].val + a[2].val - 1 << "\n";
    }
}

int main()
{
    cin.tie(0) -> sync_with_stdio(false);
    int t;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

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

typedef long long ll;
typedef pair<int , int> PII;

const int INF = 0x3f3f3f3f;
const int N = 2e5 + 9;

int n;
vector<int> node[N];
int in[N];
bool flag[N];

struct Node
{
    int no , val;
    bool operator < (const Node temp) const
    {
        return val > temp.val;
    }
}a[N];

void solve()
{
    cin >> n;
    for(int i = 1 ; i <= n ; i++)
    {
        node[i].clear();
        in[i] = 0;
        flag[i] = false;
    }
    for(int i = 1 ; i < n ; i++)
    {
        int x , y;
        cin >> x >> y;
        node[x].push_back(y);
        node[y].push_back(x);
        in[x]++ , in[y]++;
    }
    for(int i = 1 ; i <= n ; i++)
    {
        a[i] = {i , in[i]};
    }
    sort(a + 1 , a + 1 + n);    
    int ans = 0;
    for(auto to : node[a[1].no])
    {
        flag[to] = true;
    }
    if(flag[a[2].no])
    {
        cout << max(a[1].val + a[2].val - 1 , a[2].val + a[3].val) - 1 << "\n";
    }
    else
    {
        cout << a[1].val + a[2].val - 1 << '\n';
    }
}

int main()
{
    cin.tie(0) -> sync_with_stdio(false);
    int t;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}

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

typedef long long ll;
typedef pair<int , int> PII;

const int INF = 0x3f3f3f3f;
const int N = 2e5 + 9;

int n;
vector<int> node[N];
int in[N];
bool flag[N];

struct Node
{
    int no , val;
    bool operator < (const Node temp) const
    {
        return val > temp.val;
    }
}a[N];

void solve()
{
    cin >> n;
    for(int i = 1 ; i <= n ; i++)
    {
        node[i].clear();
        in[i] = 0;
        flag[i] = false;
    }
    for(int i = 1 ; i < n ; i++)
    {
        int x , y;
        cin >> x >> y;
        node[x].push_back(y);
        node[y].push_back(x);
        in[x]++ , in[y]++;
    }
    for(int i = 1 ; i <= n ; i++)
    {
        a[i] = {i , in[i]};
    }
    sort(a + 1 , a + 1 + n);    
    int flag = 0;
    for(auto to : node[a[1].no])
    {
        if(to == a[2].no)
        {
            flag = -1;
        }
    }
    cout << a[1].val + a[2].val + flag - 1 << "\n";
}

int main()
{
    cin.tie(0) -> sync_with_stdio(false);
    int t;
    cin >> t;
    while(t--)
    {
        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;

#define int long long int
#define all(a) (a).begin(), (a).end()
#define lup(i,j,n) for(int i = j; i < n; ++i)
#define lupr(i,j,n) for(int i = j; i >= n; --i)
#define endl '\n'
#define vi vector<int>
#define vpi vector<pair<int,int> >
#define vvi vector<vector<int> >
#define pii pair<int, int>
#define MP make_pair
#define F first
#define S second
#define bitcount(x) __builtin_popcount(x)
#define INF 1e9
#define MOD 1000000007
#define MAXN ((int)2e5 + 4)

void solve() {
    int l, r;
    cin >> l >> r;
    
    int a = l, b = l, c = r;
    lupr(i, log2(l ^ r), 0) {
        int l_bit = (l >> i) & 1;
        int r_bit = (r >> i) & 1;

        if(l_bit == r_bit) {
            int temp = b ^ (1 << i);
            if(temp >= l && temp <= r) {
                b = temp;
            }
        }
    }

    if(b == a) ++b;
    cout << a << ' ' << b << ' ' << c << endl;
}   

signed main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(0); 
    cout.tie(0);
    
    int _t = 1;
    cin >> _t;
    while(_t--) {
        solve();
    }
}