ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int N = 100010;
int t;
void solve()
{
    int n,l,r;
    cin>>n>>l>>r;
    int a[N]={0},al[N]={0},ar[N]={0};
    for(int i=1;i<=n;i++) cin>>a[i];
    sort(a+1,a+l);sort(a+l,a+r+1);sort(a+r+1,a+n+1);
    for(int i=1;i<=n;i++) al[i]=ar[i]=a[i];
    int tl=0,tr=0,il=r,ir=r;
    for(int i=r,j=1;i>=l;i--)
        if(j<l&&a[i]>a[j])
        {
            swap(a[i],a[j]);
            j++;
        }
    for(int i=r,j=r+1;i>=l;i--)
        if(j<=n&&a[i]>a[j])
        {
            swap(a[i],a[j]);
            j++;
        }
    for(int q=l;q<=r;q++) tl+=a[q];
    for(int q=l;q<=r;q++) tr+=a[q];
    if(tl<tr) cout<<tl<<endl;
    else cout<<tr<<endl;
}
int main()
{
    ios::sync_with_stdio(0),
    cin.tie(0),cout.tie(0);
    cin>>t;
    while(t--) solve();
    return 0;
}

Submission (verdict: Wrong answer on test 8):
#include <iostream>

#include <vector>

#include <algorithm>

using namespace std;

const int N = 100010;

int t;

void solve()

{

    int n, l, r;

    cin >> n >> l >> r;

    int a[N] = {0}, al[N] = {0}, ar[N] = {0};

    for (int i = 1; i <= n; i++)

        cin >> a[i];

    sort(a + 1, a + l);

    sort(a + l, a + r + 1);

    sort(a + r + 1, a + n + 1);

    for (int i = 1; i <= n; i++)

        al[i] = ar[i] = a[i];



    int tl = 0, tr = 0;

    for (int i = r, j = 1; i >= l; i--)

        if (j < l && al[i] > al[j])

        {

            swap(al[i], al[j]);

            j++;

        }

    for (int i = r, j = r + 1; i >= l; i--)

        if (j <= n && ar[i] > ar[j])

        {

            swap(ar[i], ar[j]);

            j++;

        }

    for (int q = l; q <= r; q++)

        tl += al[q];

    for (int q = l; q <= r; q++)

        tr += ar[q];

    if (tl < tr)

        cout << tl << endl;

    else

        cout << tr << endl;

}

int main()

{

    ios::sync_with_stdio(0),

        cin.tie(0), cout.tie(0);

    cin >> t;

    while (t--)

        solve();

    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int N = 100010;
int t;
void solve()
{
    int n,l,r;
    cin>>n>>l>>r;
    int a[N]={0},al[N]={0},ar[N]={0};
    for(int i=1;i<=n;i++) cin>>a[i];
    sort(a+1,a+l);sort(a+l,a+r+1);sort(a+r+1,a+n+1);
    for(int i=1;i<=n;i++) al[i]=ar[i]=a[i];
    int tl=0,tr=0,il=r,ir=r;
    for(int i=r,j=1;i>=l;i--)
        if(j<l&&a[i]>a[j])
        {
            swap(a[i],a[j]);
            j++;
        }
    for(int i=r,j=r+1;i>=l;i--)
        if(j<=n&&a[i]>a[j])
        {
            swap(a[i],a[j]);
            j++;
        }
    for(int q=l;q<=r;q++) tl+=a[q];
    for(int q=l;q<=r;q++) tr+=a[q];
    if(tl<tr) cout<<tl<<endl;
    else cout<<tr<<endl;
}
int main()
{
    ios::sync_with_stdio(0),
    cin.tie(0),cout.tie(0);
    cin>>t;
    while(t--) solve();
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

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

#define ll long long
#define MOD 1000000007
#define PI 3.1415926535897932384626433832795
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second

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

    vector<int> v(n);

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

    if(v[0] > v[1]){
        cout<<"NO\n";
        return ;
    }

    for(int i = 1;i < n-1;i++){
        if(v[i] > v[i+1]){
            v[i] -= min(v[i], v[i-1]);
            v[i-1] -= min(v[i], v[i-1]);
        }

        if(v[i] > v[i+1]){
            cout<<"NO\n";
            return ;
        }
    }

    cout<<"YES\n";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int t;
    cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}

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

#define ll long long
#define MOD 1000000007
#define PI 3.1415926535897932384626433832795
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second

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

    vector<int> v(n);

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

    if(v[0] > v[1]){
        cout<<"NO\n";
        return ;
    }

    for(int i = 1;i < n-1;i++){
        if(v[i] > v[i+1]){
            v[i] -= min(v[i], v[i-1]);
            v[i-1] -= min(v[i], v[i-1]);
        }

        if(v[i] >= v[i+1]){
            cout<<"NO\n";
            return ;
        }
    }

    cout<<"YES\n";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int t;
    cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

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

#define ll long long
#define MOD 1000000007
#define PI 3.1415926535897932384626433832795
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second

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

    vector<int> v(n);

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

    if(v[0] > v[1]){
        cout<<"NO\n";
        return ;
    }

    for(int i = 1;i < n-1;i++){
        if(v[i] > v[i+1]){
            v[i] -= min(v[i], v[i-1]);
            v[i-1] -= min(v[i], v[i-1]);
        }

        if(v[i] >= v[i+1]){
            cout<<"NO\n";
            return ;
        }
    }

    cout<<"YES\n";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int t;
    cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}

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

#define ll long long
#define MOD 1000000007
#define PI 3.1415926535897932384626433832795
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second

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

    vector<int> v(n);

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

    for(int i = 0;i < n-1;i++){
        if(v[i] > v[i+1]){
            cout<<"NO\n";
            return;
        }
        else{
            v[i+1] -= v[i];
            v[i] = 0;
        }
    }

    cout<<"YES\n";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int t;
    cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)


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

#define ll long long
#define MOD 1000000007
#define PI 3.1415926535897932384626433832795
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define fi first
#define se second

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

    vector<int> v(n);

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

    if(v[0] > v[1]){
        cout<<"NO\n";
        return ;
    }

    for(int i = 1;i < n-1;i++){
        if(v[i] > v[i+1]){
            v[i] -= min(v[i], v[i-1]);
            v[i-1] -= min(v[i], v[i-1]);
        }

        if(v[i] > v[i+1]){
            cout<<"NO\n";
            return ;
        }
    }

    cout<<"YES\n";
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int t;
    cin >> t;

    while (t--) {
        solve();
    }

    return 0;
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
int main(){
    int k;
    cin >> k;
    while(k--){
    int n,l,r;
    cin >> n >> l >> r;
    vector<int>arr1(n,0);
    for(int i=0;i<n;i++)cin >> arr1[i];
    int sum = 0;
    for(int i=0;i<=r-l;i++){
        sum+=arr1[i];
    }
    // cout << sum;
    int strt = 0;
    int end = r-l+1;
    int min = INT_MAX;
    int strt1 = 0;
    int end1 = 0;
    for(int i=0;i<n;i++){
        if(sum<min){
            min = sum;
            strt1 = strt;
            end1 = end;
        }
        // cout << strt%n << " " << end%n << "\n";
        sum-=arr1[strt%n];
        sum+=arr1[end%n];
        strt++;
        end++;
    }
    if(sum<min)min = sum;
    cout << min << "\n";
    }
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Compilation error):
#include <bits/stdc++.h>
using namespace std;
int main(){
    int k;
    cin >> k;
    while(k--){
    int n,l,r;
    cin >> n >> l >> r;
    vector<long long int>arr1(n,0);
    for(int i=0;i<n;i++)cin >> arr1[i];
    long long int sum = 0;
    for(int i=0;i<=r-l;i++){
        sum+=arr1[i];
    }
    // cout << sum;
    priority_queue<long long int,vector<long long int>,greater<long long int>>q;
    for(int i=0;i<r;i++){
        q.push(arr1[i]);
    }
    long long int sum = 0;
    long long int sum1 = 0;
    for(int i=0;i<r-l+1;i++){
        sum+=q.top();
        q.pop(); 
    }
    for(int i=l-1;i<n;i++){
        q.push(arr1[i]);
    }
    for(int i=0;i<r-l+1;i++){
        sum1+=q.top();
        q.pop(); 
    }
    cout << min(sum,sum1) << endl;
    }
}

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

using namespace std;

int main(){

    int k;

    cin >> k;

    while(k--){

    int n,l,r;

    cin >> n >> l >> r;

    vector<long long int>arr1(n,0);

    for(int i=0;i<n;i++)cin >> arr1[i];

    priority_queue<long long int,vector<long long int>,greater<long long int>>q;

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

        q.push(arr1[i]);

    }

    long long int sum = 0;

    long long int sum1 = 0;

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

        sum+=q.top();

        q.pop(); 

    }

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

        q.push(arr1[i]);

    }

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

        sum1+=q.top();

        q.pop(); 

    }

    cout << min(sum,sum1) << endl;

    }

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

using namespace std;

int main(){

    int k;

    cin >> k;

    while(k--){

    int n,l,r;

    cin >> n >> l >> r;

    vector<long long int>arr1(n,0);

    for(int i=0;i<n;i++)cin >> arr1[i];

    priority_queue<long long int,vector<long long int>,greater<long long int>>q;

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

        q.push(arr1[i]);

    }

    long long int sum = 0;

    long long int sum1 = 0;

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

        sum+=q.top();

        q.pop(); 

    }

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

        q.push(arr1[i]);

    }

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

        sum1+=q.top();

        q.pop(); 

    }

    cout << min(sum,sum1) << endl;

    }

}

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

using namespace std;

int main(){

    int k;

    cin >> k;

    while(k--){

    int n,l,r;

    cin >> n >> l >> r;

    vector<long long int>arr1(n,0);

    for(int i=0;i<n;i++)cin >> arr1[i];

    priority_queue<long long int,vector<long long int>,greater<long long int>>q;

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

        q.push(arr1[i]);

    }

    long long int sum = 0;

    long long int sum1 = 0;

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

        sum+=q.top();

        q.pop(); 

    }

    while(!q.empty())q.pop();

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

        q.push(arr1[i]);

    }

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

        sum1+=q.top();

        q.pop(); 

    }

    cout << min(sum,sum1) << endl;

    }

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

using namespace std;

int main(){

    int k;

    cin >> k;

    while(k--){

    int n,l,r;

    cin >> n >> l >> r;

    vector<long long int>arr1(n,0);

    for(int i=0;i<n;i++)cin >> arr1[i];

    long long int sum = 0;

    for(int i=0;i<=r-l;i++){

        sum+=arr1[i];

    }

    // cout << sum;

    int strt = 0;

    int end = r-l+1;

    long long int min = INT_MAX;

    int strt1 = 0;

    int end1 = 0;

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

        if(sum<min){

            min = sum;

            strt1 = strt;

            end1 = end;

        }

        // cout << strt%n << " " << end%n << "\n";

        sum-=arr1[strt%n];

        sum+=arr1[end%n];

        strt++;

        end++;

    }

    if(sum<min)min = sum;

    cout << min << "\n";

    }

}

Submission (verdict: Compilation error):
#include <bits/stdc++.h>
using namespace std;
int main(){
    int k;
    cin >> k;
    while(k--){
    int n,l,r;
    cin >> n >> l >> r;
    vector<long long int>arr1(n,0);
    for(int i=0;i<n;i++)cin >> arr1[i];
    long long int sum = 0;
    for(int i=0;i<=r-l;i++){
        sum+=arr1[i];
    }
    // cout << sum;
    priority_queue<long long int,vector<long long int>,greater<long long int>>q;
    for(int i=0;i<r;i++){
        q.push(arr1[i]);
    }
    long long int sum = 0;
    long long int sum1 = 0;
    for(int i=0;i<r-l+1;i++){
        sum+=q.top();
        q.pop(); 
    }
    for(int i=l-1;i<n;i++){
        q.push(arr1[i]);
    }
    for(int i=0;i<r-l+1;i++){
        sum1+=q.top();
        q.pop(); 
    }
    cout << min(sum,sum1) << endl;
    }
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
int main(){
    int k;
    cin >> k;
    while(k--){
    int n,l,r;
    cin >> n >> l >> r;
    vector<int>arr1(n,0);
    for(int i=0;i<n;i++)cin >> arr1[i];
    int sum = 0;
    for(int i=0;i<=r-l;i++){
        sum+=arr1[i];
    }
    // cout << sum;
    int strt = 0;
    int end = r-l+1;
    int min = INT_MAX;
    int strt1 = 0;
    int end1 = 0;
    for(int i=0;i<n;i++){
        if(sum<min){
            min = sum;
            strt1 = strt;
            end1 = end;
        }
        // cout << strt%n << " " << end%n << "\n";
        sum-=arr1[strt%n];
        sum+=arr1[end%n];
        strt++;
        end++;
    }
    if(sum<min)min = sum;
    cout << min << "\n";
    }
}

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

using namespace std;

int main(){

    int k;

    cin >> k;

    while(k--){

    int n,l,r;

    cin >> n >> l >> r;

    vector<long long int>arr1(n,0);

    for(int i=0;i<n;i++)cin >> arr1[i];

    long long int sum = 0;

    for(int i=0;i<=r-l;i++){

        sum+=arr1[i];

    }

    // cout << sum;

    int strt = 0;

    int end = r-l+1;

    long long int min = INT_MAX;

    int strt1 = 0;

    int end1 = 0;

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

        if(sum<min){

            min = sum;

            strt1 = strt;

            end1 = end;

        }

        // cout << strt%n << " " << end%n << "\n";

        sum-=arr1[strt%n];

        sum+=arr1[end%n];

        strt++;

        end++;

    }

    if(sum<min)min = sum;

    cout << min << "\n";

    }

}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)


Submission (verdict: Compilation error):
#include <iostream>
#include <bits/stdc++.h>

using namespace std;
using ll = long long int ;
using pii = pair<int,int> ;

void dfs(const vector<vector<int> > &adj , vector<int> &dp , int v , int p = -1)
{
    for(int to : adj[v])
    {
        if(to != p)
        {
            dfs(adj , dp , to , v) ;
            dp[v] = max(dp[v] ,
                        dp[to] ) ;
        }
    }

    dp[v] = max(dp[v] ,
                adj[v].size() ) ;
}

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

    vector<vector<int> > adj(n + 1) ;
    vector<int> dp(n + 1 , 0) ;
    for(int i = 1 ; i < n ; ++i)
    {
        int u , v ;
        cin >> u >> v ;

        adj[u].push_back(v) ;
        adj[v].push_back(u) ;
    }

    dfs(adj , dp , 1 , -1) ;
}

int main()
{
    int t ;
    cin >> t ;

    while(t--)
        solve() ;

    return 0;
}
Problem: 2063C - Remove Exactly Two
Language: C++17 (GCC 7-32)

Previous submission (verdict: Compilation error):
#include <iostream>
#include <bits/stdc++.h>

using namespace std;
using ll = long long int ;
using pii = pair<int,int> ;

void dfs(const vector<vector<int> > &adj , vector<int> &dp , int v , int p = -1)
{
    for(int to : adj[v])
    {
        if(to != p)
        {
            dfs(adj , dp , to , v) ;
            dp[v] = max(dp[v] ,
                        dp[to] ) ;
        }
    }

    dp[v] = max(dp[v] ,
                adj[v].size() ) ;
}

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

    vector<vector<int> > adj(n + 1) ;
    vector<int> dp(n + 1 , 0) ;
    for(int i = 1 ; i < n ; ++i)
    {
        int u , v ;
        cin >> u >> v ;

        adj[u].push_back(v) ;
        adj[v].push_back(u) ;
    }

    dfs(adj , dp , 1 , -1) ;
}

int main()
{
    int t ;
    cin >> t ;

    while(t--)
        solve() ;

    return 0;
}


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

using namespace std;
using ll = long long int ;
using pii = pair<int,int> ;

void dfs(const vector<vector<int> > &adj , vector<int> &dp , vector<int> &prev , int v , int p = -1)
{
    prev[v] = p ;

    for(int to : adj[v])
    {
        if(to != p)
        {
            dfs(adj , dp , prev , to , v) ;
            dp[v] = max(dp[v] ,
                        dp[to] ) ;
        }
    }

    dp[v] = max(dp[v] ,
                int(adj[v].size()) ) ;
}

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

    vector<vector<int> > adj(n + 1) ;
    vector<int> dp(n + 1 , 0) ;
    vector<int> prev(n + 1) ;
    for(int i = 1 ; i < n ; ++i)
    {
        int u , v ;
        cin >> u >> v ;

        adj[u].push_back(v) ;
        adj[v].push_back(u) ;
    }

    dfs(adj , dp , prev , 1 , -1) ;

    int ans = 0 ;

    for(int i = 1 ; i <= n ; ++i)
    {
        for(int to : adj[i])
        {
            if(to == prev[i])
                continue ;

            ans = max(ans ,
                      int(adj[i].size()) + int(adj[to].size()) - 2) ;

            for(int to2 : adj[to])
            {
                if(to2 == i)
                    continue ;

                ans = max(int(adj[i].size()) + dp[to2] - 1 ,
                          ans ) ;


            }
        }
    }

    cout << ans << "\n" ;

}

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;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
#define int long long int
#define ul unsigned long long
#define dec greater<int>()
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper);
#define all(x) (x).begin(), (x).end()
#define mod 1000000007
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }

void solve()
{
    int l, r;
    cin >> l >> r;
    int a=-1,b=-1,mx=0,mn=99;
    for(int i=l; i<min(100000000LL,r); i++)
    {
        int xx = __builtin_popcount(i);
        if(xx<mn)
        {
            mn=xx;
            a=i;
        }
        if(xx>=mx)
        {
            mx=xx;
            b=xx;
        }
    }
    cout<<a<<" "<<b<<" "<<r<<'\n';
}

signed main()
{
    fast;
    int t = 1;
    cin >> t;
    while (t--)
        solve();
}

/*You need to learn from the problem you solved.*/
/*If you got it slow, why? If you got WA, why?*/
/*What can you do to prevent it in the future?*/
/*Did you miss a critical observation?*/
/*What path of thinking would've led you there? */

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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
#define int long long int
#define ul unsigned long long
#define dec greater<int>()
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper);
#define all(x) (x).begin(), (x).end()
#define mod 1000000007
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }

void solve()
{
    int l, r;
    cin >> l >> r;
    int a=-1,b=-1,mx=0,mn=99;
    for(int i=l; i<min(100000000LL,r); i++)
    {
        int xx = __builtin_popcount(i);
        if(xx<mn)
        {
            mn=xx;
            a=i;
        }
        if(xx>=mx)
        {
            mx=xx;
            b=i;
        }
        //cout<<xx<<'\n';
    }
    cout<<a<<" "<<b<<" "<<r<<'\n';
}

signed main()
{
    fast;
    int t = 1;
    cin >> t;
    while (t--)
        solve();
}

/*You need to learn from the problem you solved.*/
/*If you got it slow, why? If you got WA, why?*/
/*What can you do to prevent it in the future?*/
/*Did you miss a critical observation?*/
/*What path of thinking would've led you there? */
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;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

#define fast                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL)
#define int long long int
#define ul unsigned long long
#define dec greater<int>()
#define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower);
#define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper);
#define all(x) (x).begin(), (x).end()
#define mod 1000000007
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); }

void solve()
{
    int l, r;
    cin >> l >> r;
    int a=-1,b=-1,mx=0,mn=99;
    for(int i=l; i<min(100000000LL,r); i++)
    {
        int xx = __builtin_popcount(i);
        if(xx<mn)
        {
            mn=xx;
            a=i;
        }
        if(xx>=mx)
        {
            mx=xx;
            b=xx;
        }
    }
    cout<<a<<" "<<b<<" "<<r<<'\n';
}

signed main()
{
    fast;
    int t = 1;
    cin >> t;
    while (t--)
        solve();
}

/*You need to learn from the problem you solved.*/
/*If you got it slow, why? If you got WA, why?*/
/*What can you do to prevent it in the future?*/
/*Did you miss a critical observation?*/
/*What path of thinking would've led you there? */