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

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



#define ll long long int

#define for1(x1) for(ll i = 0; i < x1; i++)

#define for2(x2) for(ll j = 0; j < x2; j++)

#define for3(vc_1) for(auto &it : vc_1) cin >> it;

#define so(x3) sort((x3).begin(), (x3).end())

#define rev(x3) reverse((x3).begin(), (x3).end())

#define nl endl

#define nb "\n"

#define fast_IO ios_base::sync_with_stdio(false); cin.tie(NULL);

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

using namespace std;



istream& operator>> (istream &input, vector <ll> &vc_1)

{

    for3(vc_1);

    return input;

}



const ll mod = 1e9 + 7;

const int N = 2e5 + 5;  



vector<int> adj[N];     

bool vis[N];      





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;

}







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





void Ahmed_log()

{

    ll siz; cin >> siz; vector <ll> vc_1 (siz); cin >> vc_1;

    if (*max_element(all(vc_1)) == vc_1.front() or vc_1[0] > vc_1[1] or vc_1[1] - vc_1[0] > *min_element(all(vc_1)))

    {

        cout << "NO" << nl;

    }

    else cout << "YES" << nl;

}



// Example: nums.erase(remove(nums.begin(), nums.end(), Player1), nums.end());



int main()

{

    fast_IO;

    ll test_case = 1;

    cin >> test_case;

    while(test_case--)

    {

        Ahmed_log();

    }

    return 0;

}

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



#define ll long long int

#define for1(x1) for(ll i = 0; i < x1; i++)

#define for2(x2) for(ll j = 0; j < x2; j++)

#define for3(vc_1) for(auto &it : vc_1) cin >> it;

#define so(x3) sort((x3).begin(), (x3).end())

#define rev(x3) reverse((x3).begin(), (x3).end())

#define nl endl

#define nb "\n"

#define fast_IO ios_base::sync_with_stdio(false); cin.tie(NULL);

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

using namespace std;



istream& operator>> (istream &input, vector <ll> &vc_1)

{

    for3(vc_1);

    return input;

}



const ll mod = 1e9 + 7;

const int N = 2e5 + 5;  



vector<int> adj[N];     

bool vis[N];      





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;

}







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





void Ahmed_log()

{

    ll siz; cin >> siz; vector <ll> vc_1 (siz); cin >> vc_1;

    if (*max_element(all(vc_1)) == vc_1.front() or vc_1[0] > vc_1[1])

    {

        cout << "NO" << nl;

        return;

    }

    ll a1 , a2;

    for1(siz - 1)

    {

        a1 = vc_1[i] , a2 = vc_1[i + 1];

        if (a1 <= a2)

        {

            vc_1[i] = 0;

            vc_1[i + 1] -= a1;

        }

        else

        {

            cout << "NO" << nl;

            return;

        }

    }

    cout << "YES" << nl;

}



// Example: nums.erase(remove(nums.begin(), nums.end(), Player1), nums.end());



int main()

{

    fast_IO;

    ll test_case = 1;

    cin >> test_case;

    while(test_case--)

    {

        Ahmed_log();

    }

    return 0;

}