ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#define inpv(v,n) for(int i=0;i<n;i++)cin>>v[i]
#define disp(v) for(auto x:v) cout<<x<<" "; cout<<"\n"
#define srt(x) sort(x.begin(),x.end())
#define N "\n"
using namespace std;
typedef long long ll;
typedef vector <ll> vll;

void solve() {
    // Your code here
    string s;
    cin>>s;
    int sum=0;
    ll three=0;
    ll two=0;
    for(ll i=0;i<s.length();i++)
    {
        sum+=s[i]-'0';
        switch(s[i])
        {
            case '2':two++;
            break;
            case '3':three++;
            break;
        }
    }
    sum=sum%9;
    bool yes=false;
    two=two%9;
    three=three%9;
    for(ll i=0;i<=two;i++)
    {
        for(ll j=0;j<=three;j++)
        {
            if((i*2+j*6+sum)%9==0)
            {
                yes=true;
                break;
            }
        }
    }
    if(sum==0)yes=true;
    //cout<<two<<" "<<three<<N;
    cout<<(yes?"YES\n":"NO\n");
}


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

    ll t;
    cin >> t;
    while (t--) solve();
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define inpv(v,n) for(int i=0;i<n;i++)cin>>v[i]
#define disp(v) for(auto x:v) cout<<x<<" "; cout<<"\n"
#define srt(x) sort(x.begin(),x.end())
#define N "\n"
using namespace std;
typedef long long ll;
typedef vector <ll> vll;

void solve() {
    // Your code here
    string s;
    cin>>s;
    int sum=0;
    ll three=0;
    ll two=0;
    for(ll i=0;i<s.length();i++)
    {
        sum+=s[i]-'0';
        switch(s[i])
        {
            case '2':two++;
            break;
            case '3':three++;
            break;
        }
    }
    sum=sum%9;
    bool yes=false;
    two=min(9LL,two);
    three=min(three,9LL);
    for(ll i=0;i<=two;i++)
    {
        for(ll j=0;j<=three;j++)
        {
            if((i*2+j*6+sum)%9==0)
            {
                yes=true;
                break;
            }
        }
    }
    if(sum==0)yes=true;
    //cout<<two<<" "<<three<<N;
    cout<<(yes?"YES\n":"NO\n");
}


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

    ll t;
    cin >> t;
    while (t--) solve();
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Compilation error):
#include <bits/stdc++.h>
#define inpv(v,n) for(int i=0;i<n;i++)cin>>v[i]
#define disp(v) for(auto x:v) cout<<x<<" "; cout<<"\n"
#define srt(x) sort(x.begin(),x.end())
#define N "\n"
using namespace std;
typedef long long ll;
typedef vector <ll> vll;

void solve() {
    // Your code here
    string s;
    cin>>s;
    int sum=0;
    ll three=0;
    ll two=0;
    for(ll i=0;i<s.length();i++)
    {
        sum+=s[i]-'0';
        switch(s[i])
        {
            case '2':two++;
            break;
            case '3':three++;
            break;
        }
    }
    sum=sum%9;
    bool yes=false;
    two=two%9;
    three=three%9;
    for(ll i=0;i<=two;i++)
    {
        for(ll j=0;j<=three;j++)
        {
            if((i*2+j*6+sum)%9==0)
            {
                yes=true;
                break;
            }
        }
    }
    if(sum==0)yes=true;
    //cout<<two<<" "<<three<<N;
    cout<<(yes?"YES\n":"NO\n");
}


void main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    ll t;
    cin >> t;
    while (t--) solve();
}

Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#define inpv(v,n) for(int i=0;i<n;i++)cin>>v[i]
#define disp(v) for(auto x:v) cout<<x<<" "; cout<<"\n"
#define srt(x) sort(x.begin(),x.end())
#define N "\n"
using namespace std;
typedef long long ll;
typedef vector <ll> vll;

void solve() {
    // Your code here
    string s;
    cin>>s;
    int sum=0;
    ll three=0;
    ll two=0;
    for(ll i=0;i<s.length();i++)
    {
        sum+=s[i]-'0';
        switch(s[i])
        {
            case '2':two++;
            break;
            case '3':three++;
            break;
        }
    }
    sum=sum%9;
    bool yes=false;
    two=two%9;
    three=three%9;
    for(ll i=0;i<=two;i++)
    {
        for(ll j=0;j<=three;j++)
        {
            if((i*2+j*6+sum)%9==0)
            {
                yes=true;
                break;
            }
        }
    }
    if(sum==0)yes=true;
    //cout<<two<<" "<<three<<N;
    cout<<(yes?"YES\n":"NO\n");
}


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

    ll t;
    cin >> t;
    while (t--) solve();
}
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;
void solve()
{
long long l,r;
cin>>l>>r;
long long ans=0;
long long a,b,c;
for(int i=30;i>=0;i--){
  long long b1 = (l&(1LL<<i));
  long long b2 = (r&(1LL<<i));
  if(b1==b2){
    ans += b1*(1LL<<i);
  }else {
    a = ans + (1LL<<i);
    b = a-1;
    break;
  }
}
for(long long i = l ;i<=r;i++){
  if(i!=a && i!=b) {
    c= i;
    break;
    }

}
cout<<a<<" "<<b<<" "<<c<<"\n";


}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    int t = 1;
    cin >> t;
    // cout<<t<<endl;
    while (t--)
    {
        solve();
    }
    return 0;
}





Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
void solve()
{
long long l,r;
cin>>l>>r;
long long ans=0;
long long a,b,c;
for(int i=30;i>=0;i--){
  long long b1=0,b2=0;
  if(l&(1LL<<i)) b1 =1 ;
  if(r&(1LL<<i)) b2 =1 ;  
  if(b1==b2){
    ans += b1*(1LL<<i);
  }else {
    a = ans + (1LL<<i);
    b = a-1;
    break;
  }
}
for(long long i = r ;i>=l;i--){
  if(i!=a && i!=b) {
    c= i;
    break;
    }

}
cout<<a<<" "<<b<<" "<<c<<"\n";


}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    int t = 1;
    cin >> t;
    // cout<<t<<endl;
    while (t--)
    {
        solve();
    }
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
void solve()
{
long long l,r;
cin>>l>>r;
long long ans=0;
long long a,b,c;
for(int i=30;i>=0;i--){
  long long b1 = (l&(1<<i));
  long long b2 = (r&(1<<i));
  if(b1==b2){
    ans += b1*(1<<i);
  }else {
    a = ans + (1<<i);
    b = a-1;
  }
}
for(long long i = l ;i<=r;i++){
  if(i!=a && i!=b) {
    c= i;
    break;
    }

}
cout<<a<<" "<<b<<" "<<c<<"\n";


}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    int t = 1;
    cin >> t;
    // cout<<t<<endl;
    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;
void solve()
{
long long l,r;
cin>>l>>r;
long long ans=0;
long long a,b,c;
for(int i=30;i>=0;i--){
  long long b1 = (l&(1<<i));
  long long b2 = (r&(1<<i));
  if(b1==b2){
    ans += b1*(1<<i);
  }else {
    a = ans + (1<<i);
    b = a-1;
  }
}
for(long long i = l ;i<=r;i++){
  if(i!=a && i!=b) {
    c= i;
    break;
    }

}
cout<<a<<" "<<b<<" "<<c<<"\n";


}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    int t = 1;
    cin >> t;
    // cout<<t<<endl;
    while (t--)
    {
        solve();
    }
    return 0;
}





Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
void solve()
{
long long l,r;
cin>>l>>r;
long long ans=0;
long long a,b,c;
for(int i=30;i>=0;i--){
  long long b1 = (l&(1LL<<i));
  long long b2 = (r&(1LL<<i));
  if(b1==b2){
    ans += b1*(1LL<<i);
  }else {
    a = ans + (1LL<<i);
    b = a-1;
    break;
  }
}
for(long long i = l ;i<=r;i++){
  if(i!=a && i!=b) {
    c= i;
    break;
    }

}
cout<<a<<" "<<b<<" "<<c<<"\n";


}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    int t = 1;
    cin >> t;
    // cout<<t<<endl;
    while (t--)
    {
        solve();
    }
    return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

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

#include <vector>

#include <algorithm>

using namespace std;



int getMin(int a, int b) {

return min(a, b);

}



int main() {

int t;

cin >> t;



while (t--) {

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++) {

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

int minVal = getMin(v[i], v[j]);

v[i] -= minVal;

v[j] -= minVal;

}

}



bool isNonDecreasing = true;

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

if (v[i] > v[i + 1]) {

isNonDecreasing = false;

break;

}

}



if (isNonDecreasing) {

cout << "YES" << endl;

} else {

cout << "NO" << 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;

cin >> n;



vector<int> v(n);

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

cin >> v[i];

}



int i=0;

bool c=false;

while(i<n-1){

if(v[i]>v[i+1]){

c=true;

break;

}

else{

v[i+1]-=v[i];

v[i]=0;



}

i++;

}



if (c) {

cout << "YES" << endl;

} else {

cout << "NO" << endl;

}

}



return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)


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

#include <vector>

#include <algorithm>

using namespace std;





int getMin(int i, int j) {

return min(i, j);

}



int main() {

int t;

cin >> t;



while (t--) {

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++) {

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

int minVal = getMin(v[i], v[j]);

v[i] -= minVal;  // Subtract min value from both elements

v[j] -= minVal;  // Subtract min value from both elements

}

}



// Check if the sequence is non-decreasing

bool isNonDecreasing = true;

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

if (v[i] > v[i + 1]) {

isNonDecreasing = false;  // If any pair is not non-decreasing

break;

}

}



// Output the result

if (isNonDecreasing) {

cout << "YES" << endl;  // Sequence is non-decreasing

} else {

cout << "NO" << endl;  // Sequence is not non-decreasing

}

}



return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

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

#include <vector>

#include <algorithm>

using namespace std;





int getMin(int i, int j) {

return min(i, j);

}



int main() {

int t;

cin >> t;



while (t--) {

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++) {

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

int minVal = getMin(v[i], v[j]);

v[i] -= minVal;  // Subtract min value from both elements

v[j] -= minVal;  // Subtract min value from both elements

}

}



// Check if the sequence is non-decreasing

bool isNonDecreasing = true;

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

if (v[i] > v[i + 1]) {

isNonDecreasing = false;  // If any pair is not non-decreasing

break;

}

}



// Output the result

if (isNonDecreasing) {

cout << "YES" << endl;  // Sequence is non-decreasing

} else {

cout << "NO" << endl;  // Sequence is not non-decreasing

}

}



return 0;

}



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

#include <vector>

#include <algorithm>

using namespace std;



int getMin(int a, int b) {

return min(a, b);

}



int main() {

int t;

cin >> t;



while (t--) {

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++) {

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

int minVal = getMin(v[i], v[j]);

v[i] -= minVal;

v[j] -= minVal;

}

}



bool isNonDecreasing = true;

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

if (v[i] > v[i + 1]) {

isNonDecreasing = false;

break;

}

}



if (isNonDecreasing) {

cout << "YES" << endl;

} else {

cout << "NO" << endl;

}

}



return 0;

}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

Previous 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;

cin >> n;



vector<int> v(n);

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

cin >> v[i];

}



int i=0;

bool c=false;

while(i<n-1){

if(v[i]>v[i+1]){

c=true;

break;

}

else{

v[i+1]-=v[i];

v[i]=0;



}

i++;

}



if (c) {

cout << "YES" << endl;

} else {

cout << "NO" << endl;

}

}



return 0;

}



Submission (verdict: Accepted):
#include <iostream>

#include <vector>

#include <algorithm>

using namespace std;







int main() {

int t;

cin >> t;



while (t--) {

int n;

cin >> n;



vector<int> v(n);

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

cin >> v[i];

}



int i=0;

bool c=false;

while(i<n-1){

if(v[i]>v[i+1]){

c=true;

break;

}

else{

v[i+1]-=v[i];

v[i]=0;



}

i++;

}



if (c) {

cout << "no" << endl;

} else {

cout << "yes" << endl;

}

}



return 0;

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


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

using namespace std;

void rudrakumarsharma(){

    int n , l, r;
    cin >> n >> l >> r;

    vector <int> arr(n);


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

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

    int win_size = r - l + 1;

    int sum = 0;

    for(int i = 0; i < win_size; i++)
    {
        sum += arr[i];
    }

    cout << sum << endl;

}

int main(){

    int t;
    cin >> t;

    while(t--){

        rudrakumarsharma();
    }
    return 0;

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

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

using namespace std;

void rudrakumarsharma(){

    int n , l, r;
    cin >> n >> l >> r;

    vector <int> arr(n);


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

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

    int win_size = r - l + 1;

    int sum = 0;

    for(int i = 0; i < win_size; i++)
    {
        sum += arr[i];
    }

    cout << sum << endl;

}

int main(){

    int t;
    cin >> t;

    while(t--){

        rudrakumarsharma();
    }
    return 0;

}


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

using namespace std;

void rudrakumarsharma(){

    int n , l, r;
    cin >> n >> l >> r;

    vector <int> arr(n);


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

    // sort(arr.begin(), arr.end());

    // int win_size = r - l + 1;

    // int sum = 0;

    // for(int i = 0; i < win_size; i++)
    // {
    //     sum += arr[i];
    // }

    // cout << sum << endl;

    if ( l == r)
    {
        int mini = *min_element(arr.begin(), arr.end());
        cout << mini << endl;
        return;
    }

    sort(arr.begin(), arr.begin() + l - 1);
    
    sort(arr.begin() + l - 1 , arr.begin() + r );

    sort(arr.begin() + r, arr.end());

    // for(auto & c: arr)
    // {
    //     cout << c;
    // }
    // cout << endl;

    vector <int> pre;
    vector <int> mid;
    vector <int> suff;

    int sum1 = 0;
    int sum2 = 0;
    int sum3 = 0;

    for (int i = 0 ; i < l-1; i++)
    {
        sum1 += arr[i];

        pre.push_back(sum1); 
    }
    // for(auto & c: pre)
    // {
    //     cout << c << " ";
    // }
    // cout << endl;

    for (int i = r - 1; i >= l-1; i--)
    {
        sum2 += arr[i];

        mid.push_back(sum2); 
    }
    // for(auto & c: mid)
    // {
    //     cout << c << " ";
    // }
    // cout << endl;

    for (int i = r ; i < arr.size(); i++)
    {
        sum3 += arr[i];

        suff.push_back(sum3); 
    }
    // for(auto & c: suff)
    // {
    //     cout << c << " ";
    // }
    // cout << endl;

    int arr_sum = mid[mid.size() - 1];
    // cout << arr_sum << endl;

    int idx1 = min(pre.size(), mid.size());

    int ans = arr_sum;
    // cout << arr_sum << endl;


    for( int i = 0; i < idx1; i++)
    {
        int temp = arr_sum;

        temp -= mid[i];
        temp += pre[i];

        ans = min(ans , temp);
    }

    // cout << ans << endl;

    int idx2 = min(suff.size(), mid.size());

    for( int i = 0; i < idx2; i++)
    {
        int temp = arr_sum;

        temp -= mid[i];
        temp += suff[i];

        ans = min(ans , temp);
    }

    cout << ans << endl;


}

int main(){

    int t;
    cin >> t;

    while(t--){

        rudrakumarsharma();
    }
    return 0;

}
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)


Submission (verdict: Time limit exceeded on test 16):
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int f(int i,int j,int k,vector<vector<int>>&dp,string a,string b,string c){
  if(i==a.length()&&j==b.length()){
    return 0;
  }
  if(dp[i][j]!=-1)return dp[i][j];
  if(i<a.length()&&j<b.length()){
    if(a[i]==b[j]){
      if(a[i]==c[k]){
        return dp[i][j]=min(f(i+1,j,k+1,dp,a,b,c),f(i,j+1,k+1,dp,a,b,c));
      }
      return dp[i][j]=1+min(f(i+1,j,k+1,dp,a,b,c),f(i,j+1,k+1,dp,a,b,c));
    }
    if(a[i]==c[k]){
      return dp[i][j]=min(f(i+1,j,k+1,dp,a,b,c),1+f(i,j+1,k+1,dp,a,b,c));
    }
    if(b[j]==c[k]){
        return dp[i][j]=min(1+f(i+1,j,k+1,dp,a,b,c),f(i,j+1,k+1,dp,a,b,c));
    }
    return dp[i][j]= 1+min(f(i+1,j,k+1,dp,a,b,c),f(i,j+1,k+1,dp,a,b,c));
  }
  if(i<a.length()){
 if(a[i]==c[k]){
      return dp[i][j]=f(i+1,j,k+1,dp,a,b,c);
    }
    return dp[i][j]=1+f(i+1,j,k+1,dp,a,b,c);
  }
    if(b[j]==c[k]){
        return dp[i][j]=f(i,j+1,k+1,dp,a,b,c);
    }
    return dp[i][j]= 1+f(i,j+1,k+1,dp,a,b,c);

}
int main(){
    int t;
    cin>>t;
    while(t--){
      
       string a,b,c;
       cin>>a>>b>>c;
vector<vector<int>>dp(a.length()+1,vector<int>(b.length()+1,-1));

     cout<<  f(0,0,0,dp,a,b,c);

   cout<<endl;


     
    }
    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;
using LL = long long;
using uLL = unsigned long long;
#define PII pair<int,int>
const int N = 1e+9;

void solve(){
    int l, r; cin >> l >> r;
    int a = 0, b = 0, c = 0;
    for(int i = 29; i >= 0; i--){
        if((l ^ r) >> i & 1){
            a |= (1 << i);
            b |= (1 << i) - 1;
        }
        else{
            a |= l & (1 << i);
            b |= l & (1 << i);
        }
    }
    c = l;
    while(c == a || c == b) c++;
    cout << a << ' ' << b << ' ' << c << '\n';
}
int main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int _ =1;
    cin >> _;
    while(_--)solve();
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using uLL = unsigned long long;
#define PII pair<int,int>
const int N = 1e+9;

void solve(){
    int l, r; cin >> l >> r;
    int a = 0, b = 0, c = 0;
    for(int i = 29; i >= 0; i--){
        if((l ^ r) >> i & 1){
            a |= (1 << i);
            b |= (1 << i) - 1;
            break;
        }
        else{
            a |= l & (1 << i);
            b |= l & (1 << i);
        }
    }
    c = l;
    while(c == a || c == b) c++;
    cout << a << ' ' << b << ' ' << c << '\n';
}
int main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int _ =1;
    cin >> _;
    while(_--)solve();
}
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;
using LL = long long;
using uLL = unsigned long long;
#define PII pair<int,int>
const int N = 1e+9;

void solve(){
    int l, r; cin >> l >> r;
    int a = 0, b = 0, c = 0;
    for(int i = 29; i >= 0; i--){
        if((l ^ r) >> i & 1){
            a |= (1 << i);
            b |= (1 << i) - 1;
            break;
        }
    }
    c = l;
    while(c == a || c == b) c++;
    cout << a << ' ' << b << ' ' << c << '\n';
}
int main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int _ =1;
    cin >> _;
    while(_--)solve();
}

Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
using LL = long long;
using uLL = unsigned long long;
#define PII pair<int,int>
const int N = 1e+9;

void solve(){
    int l, r; cin >> l >> r;
    int a = 0, b = 0, c = 0;
    for(int i = 29; i >= 0; i--){
        if((l ^ r) >> i & 1){
            a |= (1 << i);
            b |= (1 << i) - 1;
        }
        else{
            a |= l & (1 << i);
            b |= l & (1 << i);
        }
    }
    c = l;
    while(c == a || c == b) c++;
    cout << a << ' ' << b << ' ' << c << '\n';
}
int main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int _ =1;
    cin >> _;
    while(_--)solve();
}
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;
using LL = long long;
using uLL = unsigned long long;
#define PII pair<int,int>
const int N = 1e+9;

void solve(){
    int l, r; cin >> l >> r;
    int a = 0, b = 0, c = 0;
    for(int i = 29; i >= 0; i--){
        if((l ^ r) >> i & 1){
            a |= (1 << i);
            b |= (1 << i) - 1;
            break;
        }
    }
    c = l;
    while(c == a || c == b) c++;
    cout << a << ' ' << b << ' ' << c << '\n';
}
int main(){
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int _ =1;
    cin >> _;
    while(_--)solve();
}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)


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



using namespace std;

using ll = long long;

typedef vector<int> vi;

typedef vector<ll> vll;



#define srt(a) sort(a.begin(), a.end());

#define vin(a,n) for(int i = 0; i < n; i++){cin >> a[i];};

#define all(a) a.begin(), a.end()

#define pb push_back

#define mp make_pair

#define wut 1000000007

#define out(x) cout << x << "\n";

#define each(it, v) for(auto &it: v)



template<typename T>

void vout(const vector<T>& vec) {

for(const auto& it : vec) {

cout << it << " ";

}

cout << endl;

}



template <typename T>

istream& operator>>(istream& in, vector<T>& vec) {

for (auto& element : vec) {

in >> element;

}

return in;

}





ll gcd(ll a, ll b) {

while (b != 0) {

ll temp = b;

b = a % b;

a = temp;

}

return a;

}

ll lcm(ll a, ll b) {

return (a / gcd(a, b)) * b;

}





// const ll MAXN = 1e6;

// vector<ll> adj[MAXN];    // Adjacency list

// vector<bool> visited(MAXN, false);



// void dfs(ll node, vector<ll> &component) {

//     // to add nodes

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

//     // adj[v].push_back(u); // for undirected graph

//     visited[node] = true;

//     component.pb(node);



//     for (ll neighbor : adj[node]) {

//         if (!visited[neighbor]) {

//             dfs(neighbor, component);

//         }

//     }

// }



/*

DO NOT TOUCH ABOVE THIS

*/



void solve(){

ll n; cin >> n;

vll a(n);

ll mx = 0;

ll mn = INT_MAX;

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

{

cin >> a[i];

mx = max(mx, a[i]);

mn = min(mn, a[i]);

}



((a[0] == mx || a[n-1] == mn) ? cout << "NO\n" : cout << "YES\n");





}



int main(){

std::ios_base::sync_with_stdio(false);

std::cin.tie(nullptr);

int t = 1;

cin >> t;

while (t--)

{

solve();

}



}