ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)


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

int binpow(int a, int b, int m) {
    int res = 1;
    a = a % m;
    while (b != 0) {
        if (b & 1) {
            res = (res * a) % m;
        }
        a = (a * a) % m;
        b = b >> 1;
    }
    return res;
}

int modinverse(int a, int m1) {
    int m = m1, y = 0, x = 1;
    while (a > 1) {
        int q = a / m;
        int t = m;
        m = a % m;
        a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0) x += m1;
    return x;
}

pair<int, pair<int, int>> fun(int l, int r) {
    int num;
    int i = 0;
    int num1 = -1, num2 = -1;
    
    while (i < 31) {
        num = (1LL << i);
        if (num <= r && num >= l && (num - 1) >= l && (num - 1) <= r) {
            num1 = num;
            num2 = num - 1;
        }
        i++;
    }

    if (num1 != -1 && num2 != -1) {
        if (num1 == r) {
            return {num1, {num2, num2 - 1}};
        }
        else{
            return {num1,{num1-1,num1+1}};
        }
    }
    
    return {0, {0, 0}};
}

void solve() {
    int l, r;
    cin >> l >> r;
    
    int num1 = -1, num2 = -1;
    int i = 0;
    
    while (i < 31) {
        int num = (1LL << i);
        if (num <= r && (num - 1) >= l ) {
            num1 = num;
            num2 = num - 1;
        }
        i++;
    }
    
    if (num1 != -1 && num2 != -1) {
        pair<int, pair<int, int>> p = fun(l, r);
        cout << p.first << " " << p.second.first << " " << p.second.second << "\n";
        return;
    }
    i = 31;
    while(i>=0){
        if(l&(1<<i)){
            break;
        }
        i--;
    }
    int sum = 0;
    
    while (i >= 0 && ((1LL << i) & l) && ((1LL << i) & r)) {
        sum += (1LL << i);
        l -= (1LL << i);
        r -= (1LL << i);
        i--;
    }
    //cout<<l<<" "<<r<<"hello\n";
    pair<int, pair<int, int>> p = fun(l, r);
    
    if (p.first == 0 && p.second.first == 0 && p.second.second == 0) {
        cout << "-1\n"; // Handle edge case properly
        return;
    }
    
    cout << sum + p.first << " " << sum + p.second.first << " " << sum + p.second.second << "\n";
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int t;
    cin >> t;
    
    while (t--) {
        solve();
    }
    
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
 
using i64 = long long;
 
void solve() {
    int l, r;
    std::cin >> l >> r;
    int k = 31 - __builtin_clz(l ^ r);
    int a = l | ((1 << k) - 1), b = a + 1, c = (a == l ? r : l);
    std::cout << a << " " << b << " " << c << "\n";
}
 
signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
 
    int t = 1;
    std::cin >> t;
 
    while (t--) {
        solve();
    }
}

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

typedef long long ll;
#define int ll
using namespace std;

bitset<10> p(int a) {
	return bitset<10>(a);
}

int32_t main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);
	int T; cin >> T;
	while(T--) {
		int l, r; cin >> l >> r;
		int k = 31 - __builtin_clz(l ^ r);
		int b = l | ((1 << k) - 1);
		int a = b + 1;
		int c;
		for(int i = l; i <= r; i++) {
			if(i != a && i != b) {
				c = i;
			}
		}
		cout << a << " " << b << " " << c << "\n";
	}
}
Problem: 2057C - Trip to the Olympiad
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
#define mod 1000000007

int binpow(int a, int b, int m) {
    int res = 1;
    a = a % m;
    while (b != 0) {
        if (b & 1) {
            res = (res * a) % m;
        }
        a = (a * a) % m;
        b = b >> 1;
    }
    return res;
}

int modinverse(int a, int m1) {
    int m = m1, y = 0, x = 1;
    while (a > 1) {
        int q = a / m;
        int t = m;
        m = a % m;
        a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0) x += m1;
    return x;
}

pair<int, pair<int, int>> fun(int l, int r) {
    int num;
    int i = 0;
    int num1 = -1, num2 = -1;
    
    while (i < 31) {
        num = (1LL << i);
        if (num <= r && num >= l && (num - 1) >= l && (num - 1) <= r) {
            num1 = num;
            num2 = num - 1;
        }
        i++;
    }

    if (num1 != -1 && num2 != -1) {
        if (num1 == r) {
            return {num1, {num2, num2 - 1}};
        }
        else{
            return {num1,{num1-1,num1+1}};
        }
    }
    
    return {0, {0, 0}};
}

void solve() {
    int l, r;
    cin >> l >> r;
    
    int num1 = -1, num2 = -1;
    int i = 0;
    
    while (i < 31) {
        int num = (1LL << i);
        if (num <= r && (num - 1) >= l ) {
            num1 = num;
            num2 = num - 1;
        }
        i++;
    }
    
    if (num1 != -1 && num2 != -1) {
        pair<int, pair<int, int>> p = fun(l, r);
        cout << p.first << " " << p.second.first << " " << p.second.second << "\n";
        return;
    }
    i = 31;
    while(i>=0){
        if(l&(1<<i)){
            break;
        }
        i--;
    }
    int sum = 0;
    
    while (i >= 0 && ((1LL << i) & l) && ((1LL << i) & r)) {
        sum += (1LL << i);
        l -= (1LL << i);
        r -= (1LL << i);
        i--;
    }
    //cout<<l<<" "<<r<<"hello\n";
    pair<int, pair<int, int>> p = fun(l, r);
    
    if (p.first == 0 && p.second.first == 0 && p.second.second == 0) {
        cout << "-1\n"; // Handle edge case properly
        return;
    }
    
    cout << sum + p.first << " " << sum + p.second.first << " " << sum + p.second.second << "\n";
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int t;
    cin >> t;
    
    while (t--) {
        solve();
    }
    
    return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
 
using i64 = long long;
 
void solve() {
    int l, r;
    std::cin >> l >> r;
    int k = 31 - __builtin_clz(l ^ r);
    int a = l | ((1 << k) - 1), b = a + 1, c = (a == l ? r : l);
    std::cout << a << " " << b << " " << c << "\n";
}
 
signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
 
    int t = 1;
    std::cin >> t;
 
    while (t--) {
        solve();
    }
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
#define startt ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
#define loop(i,n) for(int i=0;i<n;i++)
#define vi vector<ll> 
#define pb(a) push_back(a);
#define pp  pop_back()
#define all(a)  a.begin(),a.end()
#define sc second
#define fr first
#define dbg  cout<<1234567890;
const int M=1e9+7;
typedef long long ll;
typedef long long intl;
typedef pair<int, int> pi;
void solve(int durgesh){
    int n;cin>>n;
    ll arr[n];
    loop(i,n)cin>>arr[i];
    ll mini=INT_MIN;
    int f=0;
    for(int i=1;i<n;i++){
        if(arr[i-1]<arr[i]){
            arr[i]=arr[i]-arr[i-1];
            arr[i-1]=0;
            mini=max(mini,arr[i]);
        }else{
            f=1;
        }
    }
    if(f)cout<<"NO\n";
    else cout<<"YES\n";
}
int main() {
int TT=1;
cin>>TT;
for(int i=1;i<=TT;++i)
solve(i);
return 0;
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
#define startt ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
#define loop(i,n) for(int i=0;i<n;i++)
#define vi vector<ll> 
#define pb(a) push_back(a);
#define pp  pop_back()
#define all(a)  a.begin(),a.end()
#define sc second
#define fr first
#define dbg  cout<<1234567890;
const int M=1e9+7;
typedef long long ll;
typedef long long intl;
typedef pair<int, int> pi;
void solve(int durgesh){
    int n;cin>>n;
    ll arr[n];
    loop(i,n)cin>>arr[i];
    ll mini=INT_MIN;
    int f=0;
    for(int i=1;i<n;i++){
        if(arr[i-1]<=arr[i]){
            arr[i]=arr[i]-arr[i-1];
            arr[i-1]=0;
            mini=max(mini,arr[i]);
        }else{
            f=1;
        }
    }
    if(f)cout<<"NO\n";
    else cout<<"YES\n";
}
int main() {
int TT=1;
cin>>TT;
for(int i=1;i<=TT;++i)
solve(i);
return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
#define startt ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
#define loop(i,n) for(int i=0;i<n;i++)
#define vi vector<ll> 
#define pb(a) push_back(a);
#define pp  pop_back()
#define all(a)  a.begin(),a.end()
#define sc second
#define fr first
#define dbg  cout<<1234567890;
const int M=1e9+7;
typedef long long ll;
typedef long long intl;
typedef pair<int, int> pi;
void solve(int durgesh){
    int n;cin>>n;
    ll arr[n];
    loop(i,n)cin>>arr[i];
    ll mini=INT_MIN;
    int f=0;
    for(int i=1;i<n-1;i++){
        if(arr[i-1]<arr[i]){
            arr[i]=arr[i]-arr[i-1];
            arr[i-1]=0;
            mini=max(mini,arr[i]);
        }else{
            f=1;
        }
    }
    if(f)cout<<"NO\n";
    else cout<<"YES\n";
}
int main() {
int TT=1;
cin>>TT;
for(int i=1;i<=TT;++i)
solve(i);
return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
#define startt ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
#define loop(i,n) for(int i=0;i<n;i++)
#define vi vector<ll> 
#define pb(a) push_back(a);
#define pp  pop_back()
#define all(a)  a.begin(),a.end()
#define sc second
#define fr first
#define dbg  cout<<1234567890;
const int M=1e9+7;
typedef long long ll;
typedef long long intl;
typedef pair<int, int> pi;
void solve(int durgesh){
    int n;cin>>n;
    ll arr[n];
    loop(i,n)cin>>arr[i];
    ll mini=INT_MIN;
    int f=0;
    for(int i=1;i<n-1;i++){
        if(arr[i-1]<arr[i]){
            arr[i]=arr[i]-arr[i-1];
            arr[i-1]=0;
            mini=max(mini,arr[i]);
        }else{
            f=1;
        }
    }
    if(f)cout<<"NO\n";
    else cout<<"YES\n";
}
int main() {
int TT=1;
cin>>TT;
for(int i=1;i<=TT;++i)
solve(i);
return 0;
}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
#define startt ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
#define loop(i,n) for(int i=0;i<n;i++)
#define vi vector<ll> 
#define pb(a) push_back(a);
#define pp  pop_back()
#define all(a)  a.begin(),a.end()
#define sc second
#define fr first
#define dbg  cout<<1234567890;
const int M=1e9+7;
typedef long long ll;
typedef long long intl;
typedef pair<int, int> pi;
void solve(int durgesh){
    int n;cin>>n;
    ll arr[n];
    loop(i,n)cin>>arr[i];
    ll mini=INT_MIN;
    int f=0;
    for(int i=1;i<n;i++){
        if(arr[i-1]<arr[i]){
            arr[i]=arr[i]-arr[i-1];
            arr[i-1]=0;
            mini=max(mini,arr[i]);
        }else{
            f=1;
        }
    }
    if(f)cout<<"NO\n";
    else cout<<"YES\n";
}
int main() {
int TT=1;
cin>>TT;
for(int i=1;i<=TT;++i)
solve(i);
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;

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define int long long
#define pi pair<int,int>


void solve(){
	int l,r;	cin >> l >> r;
	int bit = log2(r);
	int a = 0, b = 0, c = l;
	while(bit >= 0){
		int pw = 1 << bit;

		if( (l&pw) == 0 and (r&pw) ){
			a += pw;
			for( int i = bit-1; i >= 0; --i){
				b += 1 << i;
			}
			break;
		}
		else{
			a += pw;
			b += pw;
		}
		l /= 2;	r /= 2;
		bit -= 1;
	}
	cout << a << " " << b << " " << c ;
 	   
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int test = 1;   
    cin >> test;
    while( test--){
        solve();
	    cout << "\n";
    }

    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;
int main()
{
 ios::sync_with_stdio(false);
cin.tie(NULL);
long long int t;
cin>>t;
while(t--){
 long long l,r;
 cin>>l>>r;
 vector<int>a;
 vector<int>b;
 int n1=1,n2=1;
 int i=l;
 while(i>1){
  a.push_back(i%2);
  i=i/2;
  n1++;
 }
 a.push_back(i%2);
  i=r;
 while(i>1){
  b.push_back(i%2);
  i=i/2;
  n2++;
 }
 b.push_back(i%2);
 if(r-l==2)  cout<<l<<" "<<l+1<<" "<<r<<endl;
 else if(n1!=n2) {
  n2--;
    int a=pow(2,n2);
    int b=0;
    n2--;
    while(n2>=0){
       b+=pow(2,n2);
       n2--;
    }
    if(a!=l) cout<<l<<" "<<a<<" "<<b<<endl;
    else cout<<a<<" "<<b<<" "<<b+1<<endl;

 }
 else {
  int cnt=0;
  for(int i=n1-1;i>=0;i--){
    if(a[i]==b[i]) cnt++;
    else break;
  }
  int bit= n1-cnt-1;
  //cout<<bit<<endl;
  //cout<<cnt<<endl;
  int a;
  for(int i=1;i<=3;i++){
    a+=pow(2,n2-i);
  }
     int b=a;
   a+=pow(2,bit);

   if(a>r) {
     a=pow(2,n1-1)+pow(2,bit);
     b=pow(2,n1-1);
   }
   //cout<<b<<endl;
   for(int i=bit-1;i>=0;i--) b+=pow(2,i);
  // cout<<b<<endl;
   cout<<l<<" "<<b<<" "<<a<<endl;
 }
 
}
 return 0;
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
int main()
{
 ios::sync_with_stdio(false);
cin.tie(NULL);
long long int t;
cin>>t;
while(t--){
 long long l,r;
 cin>>l>>r;
 vector<int>a;
 vector<int>b;
 int n1=1,n2=1;
 int i=l;
 while(i>1){
  a.push_back(i%2);
  i=i/2;
  n1++;
 }
 a.push_back(i%2);
  i=r;
 while(i>1){
  b.push_back(i%2);
  i=i/2;
  n2++;
 }
 b.push_back(i%2);
 if(r-l==2)  cout<<l<<" "<<l+1<<" "<<r<<endl;
 else if(n1!=n2) {
  n2--;
    int a=pow(2,n2);
    int b=0;
    n2--;
    while(n2>=0){
       b+=pow(2,n2);
       n2--;
    }
    if(a!=l) cout<<l<<" "<<a<<" "<<b<<endl;
    else cout<<a<<" "<<b<<" "<<b+1<<endl;

 }
 else {
  int cnt=0;
  for(int i=n1-1;i>=0;i--){
    if(a[i]==b[i]) cnt++;
    else break;
  }
  int bit= n1-cnt-1;
  //cout<<bit<<endl;
  //cout<<cnt<<endl;
  int a=0;
  for(int i=1;i<=cnt;i++){
    a+=pow(2,n2-i);
  }
     int b=a;
   a+=pow(2,bit);

   if(a>r) {
     a=pow(2,n1-1)+pow(2,bit);
     b=pow(2,n1-1);
     //cout<<"puk"<<endl;
   }
   //cout<<b<<endl;
   for(int i=bit-1;i>=0;i--) b+=pow(2,i);
  // cout<<b<<endl;
   cout<<l<<" "<<b<<" "<<a<<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;

#define pb push_back
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define int long long
#define pi pair<int,int>


void solve(){
	int l,r;	cin >> l >> r;
	int bit = log2(r);
	int a = 0, b = 0, c = l;
	while(bit >= 0){
		int pw = 1 << bit;

		if( (l&pw) == 0 and (r&pw) ){
			a += pw;
			for( int i = bit-1; i >= 0; --i){
				b += 1 << i;
			}
			break;
		}
		else{
			a += pw;
			b += pw;
		}
		l /= 2;	r /= 2;
		bit -= 1;
	}
	cout << a << " " << b << " " << c ;
 	   
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    int test = 1;   
    cin >> test;
    while( test--){
        solve();
	    cout << "\n";
    }

    return 0;
}


Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
int main()
{
 ios::sync_with_stdio(false);
cin.tie(NULL);
long long int t;
cin>>t;
while(t--){
 long long l,r;
 cin>>l>>r;
 vector<int>a;
 vector<int>b;
 int n1=1,n2=1;
 int i=l;
 while(i>1){
  a.push_back(i%2);
  i=i/2;
  n1++;
 }
 a.push_back(i%2);
  i=r;
 while(i>1){
  b.push_back(i%2);
  i=i/2;
  n2++;
 }
 b.push_back(i%2);
 if(r-l==2)  cout<<l<<" "<<l+1<<" "<<r<<endl;
 else if(n1!=n2) {
  n2--;
    int a=pow(2,n2);
    int b=0;
    n2--;
    while(n2>=0){
       b+=pow(2,n2);
       n2--;
    }
    if(a!=l) cout<<l<<" "<<a<<" "<<b<<endl;
    else cout<<a<<" "<<b<<" "<<b+1<<endl;

 }
 else {
  int cnt=0;
  for(int i=n1-1;i>=0;i--){
    if(a[i]==b[i]) cnt++;
    else break;
  }
  int bit= n1-cnt-1;
  //cout<<bit<<endl;
  //cout<<cnt<<endl;
  int a;
  for(int i=1;i<=3;i++){
    a+=pow(2,n2-i);
  }
     int b=a;
   a+=pow(2,bit);

   if(a>r) {
     a=pow(2,n1-1)+pow(2,bit);
     b=pow(2,n1-1);
   }
   //cout<<b<<endl;
   for(int i=bit-1;i>=0;i--) b+=pow(2,i);
  // cout<<b<<endl;
   cout<<l<<" "<<b<<" "<<a<<endl;
 }
 
}
 return 0;
}
Problem: 2060D - Subtract Min Sort
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 slove(){
    int n = 1; cin >> n;
    vector<int> v;
    for(int i = 0; i < n ;i++){
        int t; cin >> t;
        v.push_back(t);
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(i + 1 == n) break;
        if(v[i+1] < v[i] && i % 2 == 0){
            ans = 1;
            break;
        }
    }
    if(ans == 1){
        cout <<"NO" << endl; 
    }
    else{
        cout << "YES" << endl;
    }
}
signed main(){
    int n = 1; cin >> n;
    while(n--){
        slove();
    }
}
Problem: 2060D - Subtract Min Sort
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 slove(){
    int n = 1; cin >> n;
    vector<int> v;
    for(int i = 0; i < n ;i++){
        int t; cin >> t;
        v.push_back(t);
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(i + 1 == n) break;
        if(v[i+1] < v[i] && i % 2 == 0){
            ans = 1;
            break;
        }
    }
    if(ans == 1){
        cout <<"NO" << endl; 
    }
    else{
        cout << "YES" << endl;
    }
}
signed main(){
    int n = 1; cin >> n;
    while(n--){
        slove();
    }
}

Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
#define int long long
void slove(){
    int n = 1; cin >> n;
    vector<int> v;
    for(int i = 0; i < n;i++){
        int t; cin >> t;
        v.push_back(t);
    }
    int ans = 0;
    for(int i = 0; i < n - 1; i++){
        int t = min(v[i],v[i+1]);
        v[i] -= t;
        v[i+1] -= t;
    }
    for(int i = 0; i < n; i++){
        if(v[i+1] < v[i]){
            ans = 1;
            break;
        }
    }
    if(ans == 1){
        cout <<"NO" << endl; 
    }
    else{
        cout << "YES" << endl;
    }
}
signed main(){
    int n = 1; cin >> n;
    while(n--){
        slove();
    }
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
#define int long long
void slove(){
    int n = 1; cin >> n;
    vector<int> v;
    for(int i = 0; i < n;i++){
        int t; cin >> t;
        v.push_back(t);
    }
    int ans = 0;
    for(int i = 0; i < n - 1; i++){
        int t = min(v[i],v[i+1]);
        v[i] -= t;
        v[i+1] -= t;
    }
    for(int i = 0; i < n; i++){
        if(v[i+1] < v[i]){
            ans = 1;
            break;
        }
    }
    if(ans == 1){
        cout <<"NO" << endl; 
    }
    else{
        cout << "YES" << endl;
    }
}
signed main(){
    int n = 1; cin >> n;
    while(n--){
        slove();
    }
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
#define int long long
void slove(){
    int n = 1; cin >> n;
    vector<int> v;
    for(int i = 0; i < n;i++){
        int t; cin >> t;
        v.push_back(t);
    }
    int ans = 1;
    for(int i = 0; i < n - 1; i++){
        int t = min(v[i],v[i+1]);
        v[i] -= t;
        v[i+1] -= t;
    }
    for(int i = 0; i < n - 1; i++){
        if(v[i] > v[i+1]){
            ans = 0;
            break;
        }
    }
    if(ans == 0){
        cout <<"NO" << endl; 
    }
    else{
        cout << "YES" << endl;
    }
}
signed main(){
    int n = 1; cin >> n;
    while(n--){
        slove();
    }
}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)

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

int
main(void)
{
        ios::sync_with_stdio(0);
        cin.tie(0);
        
        ll t; cin >> t;
        for (ll i = 0; i < t; i++) {
                ll n; cin >> n;
                ll arr[n];
                for (int j = 0; j < n; j++)
                        cin >> arr[j];

                ll count = 0;
                for (int j = 0; j < n - 1; j++) {
                        if (arr[j] > arr[j + 1])
                                count++;
                }

                if (count >= n/2)
                        cout << "NO" << endl;
                else
                        cout << "YES" << endl;
        }

        return 0;
}



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

int
main(void)
{
        ios::sync_with_stdio(0);
        cin.tie(0);
        
        ll t; cin >> t;
        for (ll i = 0; i < t; i++) {
                ll n; cin >> n;
                ll arr[n];
                for (int j = 0; j < n; j++)
                        cin >> arr[j];

                ll count = 0, eq = 0;
                for (int j = 0; j < n - 1; j++) {
                        if (arr[j] >= arr[j + 1])
                                count++;
                        if (arr[j] == arr[j + 1])
                                eq++;
                }

                if (count > (n-1)/2 && count != eq)
                        cout << "NO" << endl;
                else
                        cout << "YES" << endl;
        }

        return 0;
}
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)

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

int
main(void)
{
        ios::sync_with_stdio(0);
        cin.tie(0);
        
        ll t; cin >> t;
        for (ll i = 0; i < t; i++) {
                ll n; cin >> n;
                ll arr[n];
                for (int j = 0; j < n; j++)
                        cin >> arr[j];

                ll count = 0, eq = 0;
                for (int j = 0; j < n - 1; j++) {
                        if (arr[j] >= arr[j + 1])
                                count++;
                        if (arr[j] == arr[j + 1])
                                eq++;
                }

                if (count > (n-1)/2 && count != eq)
                        cout << "NO" << endl;
                else
                        cout << "YES" << endl;
        }

        return 0;
}



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

int
main(void)
{
        ios::sync_with_stdio(0);
        cin.tie(0);
        
        ll t; cin >> t;
        for (ll i = 0; i < t; i++) {
                ll n; cin >> n;
                ll arr[n], diff[n - 1];
                ll flag = 0;
                for (int j = 0; j < n; j++)
                        cin >> arr[j];

                int global_min = -1;
                for (int j = 0; j < n - 1; j++) {
                        int min = arr[j] < arr[j + 1] ? arr[j] : arr[j + 1];
                        arr[j] -= min;
                        arr[j + 1] -= min;
                        if (arr[j] > arr[j + 1]) {
                                flag = 1;
                                break;
                        }
                }
                if (flag)
                        cout << "NO" << endl;
                else
                        cout << "YES" << endl;
        }

        return 0;
}
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;
typedef long long ll;

int
main(void)
{
        ios::sync_with_stdio(0);
        cin.tie(0);
        
        ll t; cin >> t;
        for (ll i = 0; i < t; i++) {
                ll n; cin >> n;
                ll arr[n];
                for (int j = 0; j < n; j++)
                        cin >> arr[j];

                ll count = 0;
                for (int j = 0; j < n - 1; j++) {
                        if (arr[j] > arr[j + 1])
                                count++;
                }

                if (count >= n/2)
                        cout << "NO" << endl;
                else
                        cout << "YES" << endl;
        }

        return 0;
}