ShaysXIA/CodeInsightBench huggingface dataset:
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: 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: 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: 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: 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;
}

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: 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;
}

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: 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;
}

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: 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;
}

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):
#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;
}


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):
#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;
}


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):
#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;
}


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: 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)

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: 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)

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: 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?”

                         
                                                                                                              
*/
 
 

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: 2060D - Subtract Min Sort
Language: python

Solution 1 (runtime: 186 ms):
x=int(input())
for _ in range(x):
    y=int(input())
    l=list(map(int,input().split()))
    res=0
    n=l.copy()
    n.sort()
    if l==n:
        print("YES")
    else:
        if l[0]>l[1]:
            print("NO")
        else:
            z=0
            b=l[1]-l[0]
            for i in range(2,len(l)):
                if (b>l[i]):
                    z=1
                    print("NO")
                    break
                b=l[i]-b
                
            if z==0:
                print("YES")
                
                

Solution 2 (runtime: 234 ms):
# Jai Shree Ram

def main() -> None:
    n=int(input())
    v=list(map(int,input().strip().split()))
    
    i,j=0,1
    while j<n:
        m=min(v[i],v[j])
        v[i]-=m
        v[j]-=m
        i+=1
        j+=1
    
    for i in range(n-1):
        if v[i]!=0:
            print("NO")
            return
    
    print("YES")

t=int(input())

while t>0:
    t-=1
    main()
Problem: 2060D - Subtract Min Sort
Language: python

Solution 1 (runtime: 186 ms):
x=int(input())
for _ in range(x):
    y=int(input())
    l=list(map(int,input().split()))
    res=0
    n=l.copy()
    n.sort()
    if l==n:
        print("YES")
    else:
        if l[0]>l[1]:
            print("NO")
        else:
            z=0
            b=l[1]-l[0]
            for i in range(2,len(l)):
                if (b>l[i]):
                    z=1
                    print("NO")
                    break
                b=l[i]-b
                
            if z==0:
                print("YES")
                
                

Solution 2 (runtime: 265 ms):
def ls(): return input().split()
def ints(): return map(int, input().split())
def strs(): return map(str, input().split())
def it(): return int(input())
def s(): return input()
def li(): return list(map(int, input().split()))

for _ in range(it()):
    n = it()
    arr = li()
    idx = 0
    for i in range(1, n):
        if arr[i - 1] > arr[i]:
            idx = i
    if idx == 0:  
        print("YES")
        continue

    for i in range(idx):
        mn = min(arr[i], arr[i + 1])
        arr[i] -= mn
        arr[i + 1] -= mn

    print("YES" if arr == sorted(arr) else "NO")