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

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

using namespace std;





void solve() {

    int n, l, r;

    cin >> n >> l >> r;



    l--;

    r--;

    vector<long long> a(n);

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

    int size = r - l + 1;

    vector first(a.begin(), a.begin() + r + 1);

    vector second(a.begin() + l, a.end());



    sort(first.begin(), first.end());



    long long res =  INT_MAX;

    long long sum = 0;

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

        sum += first[i];

    }



    res = min(sum, res);



    sort(second.begin(), second.end());

    sum = 0;



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

        sum += second[i];

    }



    res = min(sum, res);



    cout << res << endl;

}



int main() {

    // freopen("../input.txt", "r", stdin);



    int t;

    cin >> t;

    while (t--) {

        solve();

    }

}



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

using namespace std;





void solve() {

    int n, l, r;

    cin >> n >> l >> r;



    l--;

    r--;

    vector<long long> a(n);

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

    int size = r - l + 1;

    vector<long long> first(a.begin(), a.begin() + r + 1);

    vector<long long> second(a.begin() + l, a.end());



    sort(first.begin(), first.end());



    long long res =  LONG_LONG_MAX;

    long long sum = 0;

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

        sum += first[i];

    }



    res = min(sum, res);



    sort(second.begin(), second.end());

    sum = 0;



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

        sum += second[i];

    }



    res = min(sum, res);



    cout << res << endl;

}



int main() {

    // freopen("../input.txt", "r", stdin);



    int t;

    cin >> t;

    while (t--) {

        solve();

    }

}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

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

void solve() {	
	std::string s;
	std::cin >> s;
	for(int i = 1; i < s.size(); i++) {
		for(int j = i - 1; j >= std::max(0, i - s[j + 1] + '0'); j--) {
			if(s[j] + 1 < s[j + 1])
				s[j + 1]--, std::swap(s[j], s[j + 1]);
		}
	}
	std::cout << s << "\n";
}

int main() {
	std::ios_base::sync_with_stdio(0), std::cin.tie(0);
	int tt_ = 1;
	std::cin >> tt_;
	while(tt_--) {
		solve();
	}
	return 0;
}

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

void solve() {	
	std::string s;
	std::cin >> s;
	for(int i = 1; i < s.size(); i++) {
		for(int j = i - 1; j >= std::max(0, i - 10); j--) {
			if(s[j] + 1 < s[j + 1])
				s[j + 1]--, std::swap(s[j], s[j + 1]);
		}
	}
	std::cout << s << "\n";
}

int main() {
	std::ios_base::sync_with_stdio(0), std::cin.tie(0);
	int tt_ = 1;
	std::cin >> tt_;
	while(tt_--) {
		solve();
	}
	return 0;
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Time limit exceeded on test 3):
#include <bits/stdc++.h>

void solve() {	
	std::string s;
	std::cin >> s;
	std::string mx = "0";
	for(int k = 0; k < 10000; k++) {
		for(int i = s.size() - 1; i >= 1; --i) {
			int p = i - 1;
			while(s[p + 1] > s[p] + 1) {
				s[p + 1]--;
				std::swap(s[p + 1], s[p]);
				p--;
				if(p < 0) break;
			}
		}
	}
	std::cout << s << "\n";
}

int main() {
	std::ios_base::sync_with_stdio(0), std::cin.tie(0);
	int tt_ = 1;
	std::cin >> tt_;
	while(tt_--) {
		solve();
	}
	return 0;
}

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

void solve() {	
	std::string s;
	std::cin >> s;
	for(int i = 1; i < s.size(); i++) {
		for(int j = i - 1; j >= std::max(0, i - s[j + 1] + '0'); j--) {
			if(s[j] + 1 < s[j + 1])
				s[j + 1]--, std::swap(s[j], s[j + 1]);
		}
	}
	std::cout << s << "\n";
}

int main() {
	std::ios_base::sync_with_stdio(0), std::cin.tie(0);
	int tt_ = 1;
	std::cin >> tt_;
	while(tt_--) {
		solve();
	}
	return 0;
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)

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

void solve() {	
   // 99% TLE
	std::string s;
	std::cin >> s;
	std::string mx = "0";
	for(int k = 0; k < 100; k++) {
		for(int i = s.size() - 1; i >= 1; --i) {
			int p = i - 1;
			while(s[p + 1] > s[p] + 1) {
				s[p + 1]--;
				std::swap(s[p + 1], s[p]);
				p--;
				if(p < 0) break;
			}
		}
	}
	std::cout << s << "\n";
}

int main() {
	std::ios_base::sync_with_stdio(0), std::cin.tie(0);
	int tt_ = 1;
	std::cin >> tt_;
	while(tt_--) {
		solve();
	}
	return 0;
}

Submission (verdict: Time limit exceeded on test 3):
#include <bits/stdc++.h>

void solve() {	
	std::string s;
	std::cin >> s;
	std::string mx = "0";
	for(int k = 0; k < 10000; k++) {
		for(int i = s.size() - 1; i >= 1; --i) {
			int p = i - 1;
			while(s[p + 1] > s[p] + 1) {
				s[p + 1]--;
				std::swap(s[p + 1], s[p]);
				p--;
				if(p < 0) break;
			}
		}
	}
	std::cout << s << "\n";
}

int main() {
	std::ios_base::sync_with_stdio(0), std::cin.tie(0);
	int tt_ = 1;
	std::cin >> tt_;
	while(tt_--) {
		solve();
	}
	return 0;
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)


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

void solve() {	
   // 99% TLE
	std::string s;
	std::cin >> s;
	std::string mx = "0";
	for(int k = 0; k < 100; k++) {
		for(int i = s.size() - 1; i >= 1; --i) {
			int p = i - 1;
			while(s[p + 1] > s[p] + 1) {
				s[p + 1]--;
				std::swap(s[p + 1], s[p]);
				p--;
				if(p < 0) break;
			}
		}
	}
	std::cout << s << "\n";
}

int main() {
	std::ios_base::sync_with_stdio(0), std::cin.tie(0);
	int tt_ = 1;
	std::cin >> tt_;
	while(tt_--) {
		solve();
	}
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)


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

using namespace std;
using namespace __gnu_pbds;

#define debug(x) cout << #x << " = " << x << "\n";
#define vdebug(a) cout << #a << " = "; for(auto x: a) cout << x << " "; cout << "\n";

#define line "\n"
#define NO cout << "NO" << line
#define YES cout << "YES" << line
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define F0R(i, s, n) for(int i = (s); i < (n); i++)
#define ROF(i, n) for(int i = (n) - 1; i >= 0; --i)
#define R0F(i, e, n) for(int i = (n) - 1; i >= (e); --i)
#define pb push_back
#define eb emplace_back
#define mp make_pair

using ll = long long;
using ull = unsigned long long;
using ld = long double;

template<typename T1, typename T2>
using gpht = gp_hash_table<T1, T2>;

template<typename T> using V = vector<T>;
using vi = V<int>;
using vll = V<ll>;
using vld = V<ld>;
using vvi = V<vi>;
using vvll = V<vll>;
using vvld = V<vld>;
using vb = V<bool>;
using vpi = V<pair<int, int>>;
using vpll = V<pair<ll, ll>>;
using vvpi = V<vpi>;
using vvpll = V<vpll>;
using vs = V<string>;
using vc = V<char>;
using vvc = V<vc>;

template<typename T>
istream &operator>>(istream &is, V<T> &v) {
    for(auto &x: v)
        is >> x;
    return is;
}

template<typename T>
ostream &operator<<(ostream &os, const V<T> &v) {
    for(auto &x: v)
        os << x << " ";
    return os;
}

template<typename T>
istream &operator>>(istream &is, V<V<T>> &v) {
    for(auto &x: v)
        cin >> x;
    return is;
}
 
template<typename T>
ostream &operator<<(ostream &os, const V<V<T>> &v) {
    for(auto &x: v)
        cout << x << "\n";
    return os;
}

int mod = 998244353;

void solve() {
    int n; cin >> n;
    vll a(n); cin >> a;
    if(n == 1) {
        cout << a[0] << line;
        return;
    }
    vll steps;
    for(int i = 0; i < n; i++) {
        ll sum = 0;
        for(int j = 0; j < n - i; j++) {
            sum += a[j];
        }
        steps.push_back(max(sum, -sum));
        for(int j = 0; j < n - i - 1; j++) {
            a[j] = a[j + 1] - a[j];
        }
    }
    ll ans = steps[0];
    for(auto &x: steps) ans = max(ans, x);
    cout << ans << line;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int tt = 1;
    cin >> tt;
    while(tt--) {
        solve();
    }
    return 0;
}

/* 
 * stuff you should look for
 * int overflow, array bounds
 * special cases (n=1?)
 * do smth instead of nothing and stay organized
 * WRITE STUFF DOWN 
 * DON'T GET STUCK ON ONE APPROACH
 * if you think that solution is very very complicated, but 
   the problem is low rated, you're probably overcomplicating 
   it, should be simplier
 * if you think that solution is very very simple, prove 
   this, make sure that you're not wrong 
 */


/* 

5
1 2 3 4 5 

1 2 3 4 5 = 15

1) 5 4 3 2 1
   -1 -1 -1 -1

5
1 -3 2 5 -4 = 1




*/
Problem: 2049C - MEX Cycle
Language: C++23 (GCC 14-64, msys2)


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

#include <algorithm>

#include <string>

#include <cstring>

#include <cmath>

#include <iomanip>

#include <queue>

#include <vector>

#include <stack>

#include <functional>

#include <array>

#include <set>

#include <map>

#include <unordered_map>

#include <unordered_set>



using namespace std;



#define ll long long

#define mod 998244353

const int N = 1e6 + 5;

ll oo = 0x3f3f3f3f3f3f3f3f;

int dx[] = {0, 0, -1, 1, -1, -1, 1, 1};

int dy[] = {1, -1, 0, 0, -1, 1, -1, 1};

char ch[] = {'R', 'L', 'U', 'D'};



int main()

{

  ios_base::sync_with_stdio(false);

  cin.tie(nullptr);

  cout.tie(nullptr);



  if (fopen("input.txt", "r"))

  {

    freopen("input.txt", "r", stdin);

    freopen("output.txt", "w", stdout);

  }



  int t = 1;

  cin >> t;



  while (t--)

  {

    int n, m, k;

    cin >> n >> m >> k;

    vector<int> v(n + 1);

    v[k] = 1;

    if (m == 1)

      v[n] = 1;

    else

      v[m - 1] = 1;

    if (m == n)

      v[1] = 1;

    else

      v[m + 1] = 1;



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

    {

      if (i == m)

        continue;

      if (i == k)

      {

        int j = 0;

        vector<int> a;

        if (i == 1)

        {

          a.push_back(v[n]);

        }

        else

          a.push_back(v[i - 1]);



        if (i == n)

          a.push_back(v[1]);



        else

          a.push_back(v[i + 1]);

        if ((i + 1) % n != m % n && (i - 1 != m || (i == 1 && m != n)))

          a.push_back(v[m]);

        sort(a.begin(), a.end());

        for (auto it : a)

        {

          if (it == j)

            j++;

        }

        v[i] = j;

      }

      else

      {

        int j = 0;

        vector<int> a;

        if (i == 1)

        {

          a.push_back(v[n]);

        }

        else

          a.push_back(v[i - 1]);



        if (i == n)

          a.push_back(v[1]);

        else

          a.push_back(v[i + 1]);

        sort(a.begin(), a.end());

        for (auto it : a)

        {

          if (it == j)

            j++;

        }

        v[i] = j;

      }

    }

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

      cout << v[i] << " ";

    cout << '\n';

  }

  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>
#define rep(i, s, e) for (ll i = (ll)(s); i < (ll)(e); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 61;
const ll MOD = 998244353;
//const ll MOD = 1000000007;

int main(){
    cin.tie(0);cout.tie(0);
    ios_base::sync_with_stdio(false);

    ll t;cin >> t;
    while(t){
        ll n;cin >> n;
        vector<vector<ll>> v(n);
        vector<ll> e(n);
        rep(i,0,n-1){
            ll a,b;cin >> a >> b;
            a--;b--;
            v[a].push_back(b);
            v[b].push_back(a);
            e[a]++;e[b]++;
        }
        ll ans = 1;
        ll k = 0;
        rep(i,0,n)k = max(k,e[i]);
        rep(i,0,n){
            if(k == v[i].size()){
                ans += k-1;
                for(auto x:v[i])e[x]--;
                e[i] = -1;
            }
        }
        k = 0;
        rep(i,0,n)k = max(k,e[i]);
        ans += k-1;
        cout << ans << endl;
        t--;
    }
	
    
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define rep(i, s, e) for (ll i = (ll)(s); i < (ll)(e); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 61;
const ll MOD = 998244353;
//const ll MOD = 1000000007;

int main(){
    cin.tie(0);cout.tie(0);
    ios_base::sync_with_stdio(false);

    ll t;cin >> t;
    while(t){
        ll n;cin >> n;
        vector<vector<ll>> v(n);
        vector<ll> e(n);
        rep(i,0,n-1){
            ll a,b;cin >> a >> b;
            a--;b--;
            v[a].push_back(b);
            v[b].push_back(a);
            e[a]++;e[b]++;
        }
        ll ans = 1;
        ll k = 0;
        rep(i,0,n)k = max(k,e[i]);
        rep(i,0,n){
            if(k == v[i].size()){
                ans += k-1;
                for(auto x:v[i])e[x]--;
                e[i] = -1;
            }
        }
        k = 0;
        rep(i,0,n)k = max(k,e[i]);
        ans += k-1;
        cout << ans << endl;
        t--;
    }
	
    
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define rep(i, s, e) for (ll i = (ll)(s); i < (ll)(e); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 61;
const ll MOD = 998244353;
//const ll MOD = 1000000007;

int main(){
    cin.tie(0);cout.tie(0);
    ios_base::sync_with_stdio(false);

    ll t;cin >> t;
    while(t){
        ll n;cin >> n;
        vector<vector<ll>> v(n);
        vector<ll> e(n);
        rep(i,0,n-1){
            ll a,b;cin >> a >> b;
            a--;b--;
            v[a].push_back(b);
            v[b].push_back(a);
            e[a]++;e[b]++;
        }
        ll ans = 1;
        ll k = 0;
        rep(i,0,n)k = max(k,e[i]);
        rep(i,0,n){
            if(k == v[i].size()){
                ans += k-1;
                for(auto x:v[i])e[x]--;
                e[i] = -1;
                break;
            }
        }
        k = 0;
        rep(i,0,n)k = max(k,e[i]);
        ans += k-1;
        cout << ans << endl;
        t--;
    }
	
    
}
Problem: 2063C - Remove Exactly Two
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define rep(i, s, e) for (ll i = (ll)(s); i < (ll)(e); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 61;
const ll MOD = 998244353;
//const ll MOD = 1000000007;

int main(){
    cin.tie(0);cout.tie(0);
    ios_base::sync_with_stdio(false);

    ll t;cin >> t;
    while(t){
        ll n;cin >> n;
        vector<vector<ll>> v(n);
        vector<ll> e(n);
        rep(i,0,n-1){
            ll a,b;cin >> a >> b;
            a--;b--;
            v[a].push_back(b);
            v[b].push_back(a);
            e[a]++;e[b]++;
        }
        ll ans = 1;
        ll k = 0;
        rep(i,0,n)k = max(k,e[i]);
        rep(i,0,n){
            if(k == v[i].size()){
                ans += k-1;
                for(auto x:v[i])e[x]--;
                e[i] = -1;
                break;
            }
        }
        k = 0;
        rep(i,0,n)k = max(k,e[i]);
        ans += k-1;
        cout << ans << endl;
        t--;
    }
	
    
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define rep(i, s, e) for (ll i = (ll)(s); i < (ll)(e); ++i)
using namespace std;
typedef long long ll;
const ll INF = 1LL << 61;
const ll MOD = 998244353;
//const ll MOD = 1000000007;

int main(){
    cin.tie(0);cout.tie(0);
    ios_base::sync_with_stdio(false);

    ll t;cin >> t;
    while(t){
        ll n;cin >> n;
        vector<vector<ll>> v(n);
        vector<ll> e(n);
        rep(i,0,n-1){
            ll a,b;cin >> a >> b;
            a--;b--;
            v[a].push_back(b);
            v[b].push_back(a);
            e[a]++;e[b]++;
        }
        ll ans = 1;
        ll k = 0;
        vector<ll> m;
        rep(i,0,n)k = max(k,e[i]);
        rep(i,0,n){
            if(k == v[i].size())m.push_back(i);
        }
        if(m.size() >= 3)cout << 2*k-1 << endl;
        else if(m.size() == 2){
            bool b = 1;
            for(auto x:v[m[0]])if(x == m[1])b = 0;
            if(b)cout << 2*k-1 << endl;
            else cout << 2*k-2 << endl;
        }
        else{
            for(auto x:v[m[0]])e[x]--;
            e[m[0]] = -1;
            ans += k-1;
            k = 0;
            rep(i,0,n)k = max(k,e[i]);
            cout << ans+k-1 << endl;
        }
        t--;
    }
	
    
}
Problem: 2050E - Three Strings
Language: Python 3

Previous submission (verdict: Compilation error):
for k in range(int(input()):
    a=intput()
    b=input()
    c=input()
    n=len(a)
    m=len(b)
    dp=[[float('inf')] * (m + 1) for i in range(n + 1)]
    for i in range(n+1):
        for j in range(m+1):
            if i>0:
                dp[i][j]=min(dp[i][j], dp[i - 1][j] + (c[i + j - 1] != a[i - 1]))
            if j>0:
                dp[i][j]= min(dp[i][j], dp[i][j - 1] + (c[i + j - 1] != b[j - 1]))
    print(dp[n][m])

Submission (verdict: Accepted):
for k in range(int(input())):
    a = input().strip()
    b = input().strip()
    c = input().strip()
    n = len(a)
    m = len(b)
    dp = [[float('inf')] * (m + 1) for i in range(n + 1)]
    dp[0][0] = 0
    for i in range(n + 1):
        for j in range(m + 1):
            if i > 0:
                dp[i][j] = min(dp[i][j], dp[i - 1][j] + (c[i + j - 1] != a[i - 1]))
            if j > 0:
                dp[i][j] = min(dp[i][j], dp[i][j - 1] + (c[i + j - 1] != b[j - 1]))
    print(dp[n][m])
Problem: 2050E - Three Strings
Language: Python 3


Submission (verdict: Compilation error):
for k in range(int(input())):
	a = input().strip()
	b = input().strip()
	c = input().strip()
	n = len(a)
	m = len(b)
	dp = [[1e9 for i in range(n+1)]for j in range(m+1)]
	dp[0][0] = 0
	for i in range(n+1):
		for j in range(m+1):
			if i > 0:
				dp[i][j]=min(dp[i][j],dp[i-1][j]+(c[i+j-1]!=a[i-1]))
			if j > 0:
            	dp[i][j] = min(dp[i][j], dp[i][j - 1] + (c[i + j - 1] != b[j - 1]))
	print(dp[n][m])
Problem: 2050E - Three Strings
Language: Python 3

Previous submission (verdict: Compilation error):
for k in range(int(input())):
	a = input().strip()
	b = input().strip()
	c = input().strip()
	n = len(a)
	m = len(b)
	dp = [[1e9 for i in range(n+1)]for j in range(m+1)]
	dp[0][0] = 0
	for i in range(n+1):
		for j in range(m+1):
			if i > 0:
				dp[i][j]=min(dp[i][j],dp[i-1][j]+(c[i+j-1]!=a[i-1]))
			if j > 0:
            	dp[i][j] = min(dp[i][j], dp[i][j - 1] + (c[i + j - 1] != b[j - 1]))
	print(dp[n][m])

Submission (verdict: Compilation error):
for k in range(int(input()):
    a=intput()
    b=input()
    c=input()
    n=len(a)
    m=len(b)
    dp=[[float('inf')] * (m + 1) for i in range(n + 1)]
    for i in range(n+1):
        for j in range(m+1):
            if i>0:
                dp[i][j]=min(dp[i][j], dp[i - 1][j] + (c[i + j - 1] != a[i - 1]))
            if j>0:
                dp[i][j]= min(dp[i][j], dp[i][j - 1] + (c[i + j - 1] != b[j - 1]))
    print(dp[n][m])
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define MULTI 1
#define int long long
#define inf (LLONG_MAX >> 2)
#define ninf (LLONG_MIN >> 2)
#define binrep(x) (bitset<32>(x))


void solve() {
    // tip of the iceberg
    int l,r; cin >> l >> r;

    // cout << "inputs are " << endl << binrep(l) << endl;
    // cout << binrep(r) << endl;

    int temp = log2(l^r);
    int MASK = ( 1ll << (1 + temp)) - 1;
    int res = l - (l & MASK);

    l &= MASK;
    r &= MASK;

    int rval = log2(r);

    int x = ( 1ll << rval );
    int third = l;
    
    if ( x - 1 == l ){
        third = x + 1;
    }

    // cout << "res is " << endl << binrep(res) << endl;

    cout << res + x << " " << res + x - 1 << " " << res + l << endl;
    
}

signed main() {
    ios::sync_with_stdio(false);
    cout.tie(nullptr);
    cin.tie(nullptr);
    int t {1};
    if (MULTI)
        cin >> t;

    for (int i = 1; i <= t ; i++ ) {
        solve();
    }

    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define MULTI 1
#define int long long
#define inf (LLONG_MAX >> 2)
#define ninf (LLONG_MIN >> 2)
#define binrep(x) (bitset<32>(x))


void solve() {
    // tip of the iceberg
    int l,r; cin >> l >> r;

    // cout << "inputs are " << endl << binrep(l) << endl;
    // cout << binrep(r) << endl;

    int temp = log2(l^r);
    int MASK = ( 1ll << (1 + temp)) - 1;
    int res = l - (l & MASK);

    l &= MASK;
    r &= MASK;

    int rval = log2(r);

    int x = ( 1ll << rval );
    int third = l;
    
    if ( x - 1 == l ){
        third = x + 1;
    }

    // cout << "res is " << endl << binrep(res) << endl;

    cout << res + x << " " << res + x - 1 << " " << res + third << endl;
    // cout << "binary : " << endl;
    // cout << binrep(res + x) << endl;
    // cout << binrep(res + x - 1) << endl;
    // cout << binrep(res + l) << endl;
    
}

signed main() {
    ios::sync_with_stdio(false);
    cout.tie(nullptr);
    cin.tie(nullptr);
    int t {1};
    if (MULTI)
        cin >> t;

    for (int i = 1; i <= t ; i++ ) {
        solve();
    }

    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
#define MULTI 1
#define int long long
#define inf (LLONG_MAX >> 2)
#define ninf (LLONG_MIN >> 2)
#define binrep(x) (bitset<32>(x))


void solve() {
    // tip of the iceberg
    int l,r; cin >> l >> r;

    // cout << "inputs are " << endl << binrep(l) << endl;
    // cout << binrep(r) << endl;

    int temp = log2(l^r);
    int MASK = ( 1ll << (1 + temp)) - 1;
    int res = l - (l & MASK);

    l &= MASK;
    r &= MASK;

    int rval = log2(r);
    int lval = log2(l);

    int x = ( 1ll << rval );
    int third = l;
    
    if ( x - 1 == l ){
        third = x + 1;
    }

    // cout << "res is " << endl << binrep(res) << endl;

    cout << res + x << " " << res + x - 1 << " " << res + l << endl;
    
}

signed main() {
    ios::sync_with_stdio(false);
    cout.tie(nullptr);
    cin.tie(nullptr);
    int t {1};
    if (MULTI)
        cin >> t;

    for (int i = 1; i <= t ; i++ ) {
        solve();
    }

    return 0;
}