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

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define ll  long long
#define pp push_back
#define ones(x) __builtin_popcountll(x)
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
// 32bit(1)=2147483647
// 2d vector:vector<vector<ll>> vec1( parentsz , vector<ll> (sz));
using namespace std;
char di[]={'D','L','U','R'};
int  dx[]={1,0,-1,0,-1,1,-1,1};
int  dy[]={0,-1,0,1,-1,-1,1,1};
const int N = 2e3 + 5, M = 1e5+5, LOG = 20, inf = 0x3f3f3f3f;
ll MOD = 1e9 + 7;
ll infLL = 0x3f3f3f3f3f3f3f3f;

bool const sorted (const pair<ll,ll> &p1,const pair <ll,ll> &p2){
    if(p1.first==p2.first) return p1.second<p2.second;
    return p1.first<p2.first;
}

int fastpower(ll x, ll y,ll p)
{
    ll res = 1;
    while (y > 0) {
        if (y % 2 == 1)
            res = (res * x)%MOD;
        y = y >> 1LL;
        x = (x * x) % MOD;
    }
    return res;
}

vector<ll>divisors(ll n){
    vector<ll>arr;
    arr.pp(0);
    for (long long i = 1; i*i <=n ; ++i) {
        if(n%i==0){
            arr.pp(i);
            if(i*i!=n){
                arr.pp(n/i);
            }
        }
    }
    return arr;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a%b);
}

ll mult(ll a, ll b){
    return (a%MOD * b%MOD)%MOD;
}

ll add(ll a, ll b){
    return (a%MOD + b%MOD)%MOD;
}
ll subtract(ll a, ll b){
    return (a%MOD - b%MOD + 2*MOD)%MOD;
}
int lcm(int a, int b) {
    return (a / gcd(a, b)) * b;
}

void solve(){
   ll n;cin>>n;
   vector<ll>v(n);
    for (long long i = 0; i < n; ++i) {
        cin>>v[i];
    }
    bool f=1;
    ll tmp;

    for (long long i = 0; i < n-1; ++i) {
        tmp= min(v[i],v[i+1]);
        v[i]-=tmp;v[i+1]-=tmp;
        if(v[i+1]>v[i])
            f=0;
            break;

    }
    if(!f) yes
    else no



}


int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    ll t;
    t = 1;
    cin>>t;
    while(t--){
        solve();
    }

}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
#define ll  long long
#define pp push_back
#define ones(x) __builtin_popcountll(x)
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
// 32bit(1)=2147483647
// 2d vector:vector<vector<ll>> vec1( parentsz , vector<ll> (sz));
using namespace std;
char di[]={'D','L','U','R'};
int  dx[]={1,0,-1,0,-1,1,-1,1};
int  dy[]={0,-1,0,1,-1,-1,1,1};
const int N = 2e3 + 5, M = 1e5+5, LOG = 20, inf = 0x3f3f3f3f;
ll MOD = 1e9 + 7;
ll infLL = 0x3f3f3f3f3f3f3f3f;

bool const sorted (const pair<ll,ll> &p1,const pair <ll,ll> &p2){
    if(p1.first==p2.first) return p1.second<p2.second;
    return p1.first<p2.first;
}

int fastpower(ll x, ll y,ll p)
{
    ll res = 1;
    while (y > 0) {
        if (y % 2 == 1)
            res = (res * x)%MOD;
        y = y >> 1LL;
        x = (x * x) % MOD;
    }
    return res;
}

vector<ll>divisors(ll n){
    vector<ll>arr;
    arr.pp(0);
    for (long long i = 1; i*i <=n ; ++i) {
        if(n%i==0){
            arr.pp(i);
            if(i*i!=n){
                arr.pp(n/i);
            }
        }
    }
    return arr;
}
ll gcd(ll a, ll b){
    if(b == 0) return a;
    return gcd(b, a%b);
}

ll mult(ll a, ll b){
    return (a%MOD * b%MOD)%MOD;
}

ll add(ll a, ll b){
    return (a%MOD + b%MOD)%MOD;
}
ll subtract(ll a, ll b){
    return (a%MOD - b%MOD + 2*MOD)%MOD;
}
int lcm(int a, int b) {
    return (a / gcd(a, b)) * b;
}

void solve(){
   ll n;cin>>n;
   vector<ll>v(n);
    for (long long i = 0; i < n; ++i) {
        cin>>v[i];
    }
    bool f=1;
    ll tmp;

    for (long long i = 0; i < n-1; ++i) {
        tmp= min(v[i],v[i+1]);
        v[i]-=tmp;v[i+1]-=tmp;
        if(v[i]>v[i+1]){
            f=0;
            break;
        }
    }
    if(f) yes
    else no



}


int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    ll t;
    t = 1;
    cin>>t;
    while(t--){
        solve();
    }

}