ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <map>
using namespace std;

typedef long long ll;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int& x : a) cin >> x;

    int next_min = a[n - 1];
    for (int i = n - 2; i >= 0; i--) {
        int curr_min = min(a[i], a[i + 1]);
        if (curr_min > next_min) {
            cout << "NO\n";
            return;
        }
        next_min = curr_min;
    }
    cout << "YES\n";
}


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


Submission (verdict: Accepted):
#include <iostream>
#include <vector>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <map>
using namespace std;

typedef long long ll;

void solve() {
    int n; cin >> n;
    bool chk = 1;
    deque<int> a(n);
    for(auto &x: a) cin >> x;
    
    while(a.size() > 1) {
        if(a[0] > a[1]) {
            chk = 0;
            break;
        }
        else if (a[0] < a[1]) {
            a[1] -= a[0];
            a.pop_front();
        }
        else {
            a.pop_front();
            a.pop_front();
        }
    }
    cout << (chk?"YES":"NO") << '\n';
}



int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int t;
    cin >> t;
    while (t--) solve();
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <map>
using namespace std;

typedef long long ll;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int& x : a) cin >> x;
    
    vector<bool> dp(n, false);
    dp[0] = true;
    int prev = a[0];

    for (int i = 1; i < n; i++) {
        if (prev > a[i]) {
            cout << "NO\n";
            return;
        }
        dp[i] = true;
        prev = min(prev, a[i]);
    }
    cout << "YES\n";
}


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


Submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <map>
using namespace std;

typedef long long ll;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int& x : a) cin >> x;

    int next_min = a[n - 1];
    for (int i = n - 2; i >= 0; i--) {
        int curr_min = min(a[i], a[i + 1]);
        if (curr_min > next_min) {
            cout << "NO\n";
            return;
        }
        next_min = curr_min;
    }
    cout << "YES\n";
}


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int t;
    cin >> t;
    while (t--) solve();
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <map>
using namespace std;

typedef long long ll;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = n - 2; i >= 0; --i) {
        if (a[i] > a[i + 1]) {
            int diff = a[i] - a[i + 1];
            a[i] -= diff;
            a[i + 1] -= diff;

            if (a[i] < 0 || a[i + 1] < 0) {
                cout << "NO\n";
                return;
            }
        }
    }

    cout << "YES\n";
}


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


Submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <vector>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <map>
using namespace std;

typedef long long ll;

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int& x : a) cin >> x;
    
    vector<bool> dp(n, false);
    dp[0] = true;
    int prev = a[0];

    for (int i = 1; i < n; i++) {
        if (prev > a[i]) {
            cout << "NO\n";
            return;
        }
        dp[i] = true;
        prev = min(prev, a[i]);
    }
    cout << "YES\n";
}


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    int t;
    cin >> t;
    while (t--) solve();
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

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

using namespace std;

#define int long long

void red() {
  int n;
  cin >> n;
  int sum = 0;
  int cnt2 = 0, cnt3 = 0;
  while (n > 0) {
    int digit = n % 10;
    if (digit == 2)
      cnt2++;
    if (digit == 3)
      cnt3++;
    sum += digit;
    n /= 10;
    sum %= 9;
  }
  sum = 9 - sum;

  if (sum == 1 && (cnt2 >= 5 || (cnt2 >= 2 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 2 && cnt2 >= 1) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 3 && (cnt2 >= 6 || cnt3 >= 2 || (cnt2 >= 3 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 4 && cnt2 >= 2) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 5 &&
      (cnt2 >= 7 || (cnt2 >= 4 && cnt3 >= 1) || (cnt2 >= 1 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 6 && (cnt3 >= 1 || cnt2 >= 3)) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 7 &&
      (cnt2 >= 8 || (cnt2 >= 5 && cnt3 >= 1) || (cnt2 >= 2 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 8 && (cnt2 >= 4 || (cnt2 >= 1 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 9) {
    cout << "YES" << endl;
    return;
  }
  cout << "NO" << endl;
  return;
}

int32_t main() {
  int t;
  cin >> t;
  while (t--)
    red();
  return 0;
}

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

using namespace std;

#define int long long

void red() {
  string n;
  cin >> n;
  int sum = 0;
  int cnt2 = 0, cnt3 = 0;
  for (char ch : n) {
    int digit = ch - '0';
    if (digit == 2)
      cnt2++;
    if (digit == 3)
      cnt3++;
    sum += digit;
    sum %= 9;
  }
  sum = 9 - sum;

  if (sum == 1 && (cnt2 >= 5 || (cnt2 >= 2 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 2 && cnt2 >= 1) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 3 && (cnt2 >= 6 || cnt3 >= 2 || (cnt2 >= 3 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 4 && cnt2 >= 2) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 5 &&
      (cnt2 >= 7 || (cnt2 >= 4 && cnt3 >= 1) || (cnt2 >= 1 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 6 && (cnt3 >= 1 || cnt2 >= 3)) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 7 &&
      (cnt2 >= 8 || (cnt2 >= 5 && cnt3 >= 1) || (cnt2 >= 2 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 8 && (cnt2 >= 4 || (cnt2 >= 1 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 9) {
    cout << "YES" << endl;
    return;
  }
  cout << "NO" << endl;
  return;
}

int32_t main() {
  int t;
  cin >> t;
  while (t--)
    red();
  return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

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

using namespace std;

#define int long long

void red() {
  int n;
  cin >> n;
  int sum = 0;
  int cnt2 = 0, cnt3 = 0;
  while (n > 0) {
    int digit = n % 10;
    if (digit == 2)
      cnt2++;
    if (digit == 3)
      cnt3++;
    sum += digit;
    n /= 10;
    sum %= 9;
  }
  sum = 9 - sum;

  if (sum == 1 && (cnt2 >= 5 || (cnt2 >= 2 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 2 && cnt2 >= 1) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 3 && (cnt2 >= 6 || cnt3 >= 2 || (cnt2 >= 3 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 4 && cnt2 >= 2) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 5 &&
      (cnt2 >= 7 || (cnt2 >= 4 && cnt3 >= 1) || (cnt2 >= 1 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 6 && (cnt3 >= 1 || cnt2 >= 3)) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 7 &&
      (cnt2 >= 8 || (cnt2 >= 5 && cnt3 >= 1) || (cnt2 >= 2 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 8 && (cnt2 >= 3 || (cnt2 >= 1 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 9) {
    cout << "YES" << endl;
    return;
  }
  cout << "NO" << endl;
  return;
}

int32_t main() {
  int t;
  cin >> t;
  while (t--)
    red();
  return 0;
}

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

using namespace std;

#define int long long

void red() {
  int n;
  cin >> n;
  int sum = 0;
  int cnt2 = 0, cnt3 = 0;
  while (n > 0) {
    int digit = n % 10;
    if (digit == 2)
      cnt2++;
    if (digit == 3)
      cnt3++;
    sum += digit;
    n /= 10;
    sum %= 9;
  }
  sum = 9 - sum;

  if (sum == 1 && (cnt2 >= 5 || (cnt2 >= 2 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 2 && cnt2 >= 1) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 3 && (cnt2 >= 6 || cnt3 >= 2 || (cnt2 >= 3 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 4 && cnt2 >= 2) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 5 &&
      (cnt2 >= 7 || (cnt2 >= 4 && cnt3 >= 1) || (cnt2 >= 1 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 6 && (cnt3 >= 1 || cnt2 >= 3)) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 7 &&
      (cnt2 >= 8 || (cnt2 >= 5 && cnt3 >= 1) || (cnt2 >= 2 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 8 && (cnt2 >= 3 || (cnt2 >= 1 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 9) {
    cout << "YES" << endl;
    return;
  }
  cout << "NO" << endl;
  return;
}

int32_t main() {
  int t;
  cin >> t;
  while (t--)
    red();
  return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)


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

using namespace std;

#define int long long

void red() {
  int n;
  cin >> n;
  int sum = 0;
  int cnt2 = 0, cnt3 = 0;
  while (n > 0) {
    int digit = n % 10;
    if (digit == 2)
      cnt2++;
    if (digit == 3)
      cnt3++;
    sum += digit;
    n /= 10;
    sum %= 9;
  }
  sum = 9 - sum;

  if (sum == 1 && (cnt2 >= 5 || (cnt2 >= 2 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 2 && cnt2 >= 1) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 3 && (cnt2 >= 6 || cnt3 >= 2 || (cnt2 >= 3 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 4 && cnt2 >= 2) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 5 &&
      (cnt2 >= 7 || (cnt2 >= 4 && cnt3 >= 1) || (cnt2 >= 1 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 6 && (cnt3 >= 1 || cnt2 >= 3)) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 7 &&
      (cnt2 >= 8 || (cnt2 >= 5 && cnt3 >= 1) || (cnt2 >= 2 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 8 && (cnt2 >= 3 || (cnt2 >= 1 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 9) {
    cout << "YES" << endl;
    return;
  }
  cout << "NO" << endl;
  return;
}

int32_t main() {
  int t;
  cin >> t;
  while (t--)
    red();
  return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

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

using namespace std;

#define int long long

void red() {
  int n;
  cin >> n;
  int sum = 0;
  int cnt2 = 0, cnt3 = 0;
  while (n > 0) {
    int digit = n % 10;
    if (digit == 2)
      cnt2++;
    if (digit == 3)
      cnt3++;
    sum += digit;
    n /= 10;
    sum %= 9;
  }
  sum = 9 - sum;

  if (sum == 1 && (cnt2 >= 5 || (cnt2 >= 2 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 2 && cnt2 >= 1) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 3 && (cnt2 >= 6 || cnt3 >= 2 || (cnt2 >= 3 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 4 && cnt2 >= 2) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 5 &&
      (cnt2 >= 7 || (cnt2 >= 4 && cnt3 >= 1) || (cnt2 >= 1 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 6 && (cnt3 >= 1 || cnt2 >= 3)) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 7 &&
      (cnt2 >= 8 || (cnt2 >= 5 && cnt3 >= 1) || (cnt2 >= 2 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 8 && (cnt2 >= 3 || (cnt2 >= 1 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 9) {
    cout << "YES" << endl;
    return;
  }
  cout << "NO" << endl;
  return;
}

int32_t main() {
  int t;
  cin >> t;
  while (t--)
    red();
  return 0;
}

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

using namespace std;

#define int long long

void red() {
  int n;
  cin >> n;
  int sum = 0;
  int cnt2 = 0, cnt3 = 0;
  while (n > 0) {
    int digit = n % 10;
    if (digit == 2)
      cnt2++;
    if (digit == 3)
      cnt3++;
    sum += digit;
    n /= 10;
    sum %= 9;
  }
  sum = 9 - sum;

  if (sum == 1 && (cnt2 >= 5 || (cnt2 >= 2 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 2 && cnt2 >= 1) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 3 && (cnt2 >= 6 || cnt3 >= 2 || (cnt2 >= 3 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 4 && cnt2 >= 2) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 5 &&
      (cnt2 >= 7 || (cnt2 >= 4 && cnt3 >= 1) || (cnt2 >= 1 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 6 && (cnt3 >= 1 || cnt2 >= 3)) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 7 &&
      (cnt2 >= 8 || (cnt2 >= 5 && cnt3 >= 1) || (cnt2 >= 2 && cnt3 >= 2))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 8 && (cnt2 >= 4 || (cnt2 >= 1 && cnt3 >= 1))) {
    cout << "YES" << endl;
    return;
  }
  if (sum == 9) {
    cout << "YES" << endl;
    return;
  }
  cout << "NO" << endl;
  return;
}

int32_t main() {
  int t;
  cin >> t;
  while (t--)
    red();
  return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

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

int t,l,r;
signed main()
{
    cin>>t;
    while(t--){
        cin>>l>>r;
        int tmp=r;
        int cnt=0;
        while(tmp){
            cnt++;
            tmp>>=1;
        }
        cnt--;
      bitset<35> b1(l),b2(r);
      bitset<35> ans(0);
        for(int i=cnt;i>=0;i--){
            if(b1[i]==b2[i]){
                ans[i]=true;
            }else{
                ans[i]=true;
                break;
            }
        }

        int a=0,b=0,c=0;
        for(int i=cnt;i>=0;i--){
            a=a*2+ans[i];
        }
        b=a-1;
        for(int i=l;i<=r;i++){
            if(i!=a&&i!=b){
                c=i;
                break;
            }
        }
        cout<<a<<" "<<b<<" "<<c<<endl;
    }
}







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

int t,l,r;
signed main()
{
    cin>>t;
    while(t--){
        cin>>l>>r;
        int tmp=r;
        int cnt=0;
        while(tmp){
            cnt++;
            tmp>>=1;
        }
        cnt--;
      bitset<35> b1(l),b2(r);
      bitset<35> ans(0);
        for(int i=cnt;i>=0;i--){
            if(b1[i]==b2[i]){
                ans[i]=b1[i];
            }else{
                ans[i]=true;
                break;
            }
        }

        int a=0,b=0,c=0;
        for(int i=cnt;i>=0;i--){
            a=a*2+ans[i];
        }
        b=a-1;
        for(int i=l;i<=r;i++){
            if(i!=a&&i!=b){
                c=i;
                break;
            }
        }
        cout<<a<<" "<<b<<" "<<c<<endl;
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

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

int t,l,r;
signed main()
{
    cin>>t;
    while(t--){
        cin>>l>>r;
      int cnt=0;
      int tmp=r;
      while(tmp!=0){
          cnt++;
          tmp>>=1;
      }
        int a=0,b=0,c=0;
        for(int i=cnt-1;i>0;i--){
            int k=(1<<i);
            if((l&k)!=(r&k)){
                a=k;
                b=k-1;
                break;
            }
        }
        for(int i=l;i<=r;i++){
            if(i!=a&&i!=b){
                c=i;
                break;
            }
        }
        cout<<a<<" "<<b<<" "<<c<<endl;
    }
}







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

int t,l,r;
signed main()
{
    cin>>t;
    while(t--){
        cin>>l>>r;
      int cnt=0;
      int tmp=r;
      while(tmp!=0){
          cnt++;
          tmp>>=1;
      }
        int a=0,b=0,c=0;
        for(int i=cnt-1;i>=0;i--){
            int k=(1<<i);
            if((l&k)!=(r&k)){
                a=k;
                b=k-1;
                break;
            }
        }
        for(int i=l;i<=r;i++){
            if(i!=a&&i!=b){
                c=i;
                break;
            }
        }
        cout<<a<<" "<<b<<" "<<c<<endl;
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)


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

int t,l,r;
signed main()
{
    cin>>t;
    while(t--){
        cin>>l>>r;
      int cnt=0;
      int tmp=r;
      while(tmp!=0){
          cnt++;
          tmp>>=1;
      }
        int a=0,b=0,c=0;
        for(int i=cnt-1;i>0;i--){
            int k=(1<<i);
            if((l&k)!=(r&k)){
                a=k;
                b=k-1;
                break;
            }
        }
        for(int i=l;i<=r;i++){
            if(i!=a&&i!=b){
                c=i;
                break;
            }
        }
        cout<<a<<" "<<b<<" "<<c<<endl;
    }
}
Problem: 2057C - Trip to the Olympiad
Language: C++23 (GCC 14-64, msys2)

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

int t,l,r;
signed main()
{
    cin>>t;
    while(t--){
        cin>>l>>r;
      int cnt=0;
      int tmp=r;
      while(tmp!=0){
          cnt++;
          tmp>>=1;
      }
        int a=0,b=0,c=0;
        for(int i=cnt-1;i>=0;i--){
            int k=(1<<i);
            if((l&k)!=(r&k)){
                a=k;
                b=k-1;
                break;
            }
        }
        for(int i=l;i<=r;i++){
            if(i!=a&&i!=b){
                c=i;
                break;
            }
        }
        cout<<a<<" "<<b<<" "<<c<<endl;
    }
}







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

int t,l,r;
signed main()
{
    cin>>t;
    while(t--){
        cin>>l>>r;
        int tmp=r;
        int cnt=0;
        while(tmp){
            cnt++;
            tmp>>=1;
        }
        cnt--;
      bitset<35> b1(l),b2(r);
      bitset<35> ans(0);
        for(int i=cnt;i>=0;i--){
            if(b1[i]==b2[i]){
                ans[i]=true;
            }else{
                ans[i]=true;
                break;
            }
        }

        int a=0,b=0,c=0;
        for(int i=cnt;i>=0;i--){
            a=a*2+ans[i];
        }
        b=a-1;
        for(int i=l;i<=r;i++){
            if(i!=a&&i!=b){
                c=i;
                break;
            }
        }
        cout<<a<<" "<<b<<" "<<c<<endl;
    }
}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)


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

#include <vector>

#include <algorithm>

using namespace std;



int main() {

    int t;

    cin >> t;

    while (t--) {

        int n, l, r;

        cin >> n >> l >> r;

        vector<int> a(n);

        for (int& it : a) cin >> it;

        l--;

        r--;

       



        vector<int> v(a.begin() + l, a.begin() + r + 1), v2;

        v2.insert(v2.end(), a.begin(), a.begin() + l);

        v2.insert(v2.end(), a.begin() + r + 1, a.end());



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

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



        int i = 0, j = 0;

        while (i < v.size() && j < v2.size()) {

            if (v[v.size() - 1 - i] > v2[j]) {

                v[v.size() - 1 - i] = v2[j];

                i++;

                j++;

            }

            else {

                break;

            }

        }



        long long sum = 0;

        for (int num : v) {

            sum += num;

        }

        cout << sum << endl;

    }



    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

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

#include <vector>

#include <algorithm>

using namespace std;



int main() {

    int t;

    cin >> t;

    while (t--) {

        int n, l, r;

        cin >> n >> l >> r;

        vector<int> a(n);

        for (int& it : a) cin >> it;

        l--;

        r--;

       



        vector<int> v(a.begin() + l, a.begin() + r + 1), v2;

        v2.insert(v2.end(), a.begin(), a.begin() + l);

        v2.insert(v2.end(), a.begin() + r + 1, a.end());



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

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



        int i = 0, j = 0;

        while (i < v.size() && j < v2.size()) {

            if (v[v.size() - 1 - i] > v2[j]) {

                v[v.size() - 1 - i] = v2[j];

                i++;

                j++;

            }

            else {

                break;

            }

        }



        long long sum = 0;

        for (int num : v) {

            sum += num;

        }

        cout << sum << endl;

    }



    return 0;

}

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

#include <vector>

#include <algorithm>



using namespace std;



int main() {

    int t;

    cin >> t;



    while (t--) {

        int n, l, r;

        cin >> n >> l >> r;



        vector<int> a(n);

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

            cin >> a[i];

        }

        l--;

        r--;



        vector<int> v(a.begin() + l, a.begin() + r + 1);



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



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

            a[l + i] = v[i];

        }



        int result = 0;

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

            result += a[i];

        }



        cout << result << endl;

    }



    return 0;

}