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

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <math.h>
#include <array>
#include <random>
#include <bitset>
#include <climits>
#include <cstring>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define endl '\n'
#define mod 1000000007
#define INF 0x3f3f3f3f

#pragma GCC optimize("O3,Ofast,unroll-loops")
#pragma GCC target("avx2,sse3,sse4,avx")
#pragma GCC target("popcnt")

template <class x>
using ordered_set = tree<x, null_type, less<x>, rb_tree_tag, tree_order_statistics_node_update>;

typedef pair<int, int> ipair;

static inline int read()
{
    int x = 0;char ch = getchar();
    while (ch < '0' || ch>'9') ch = getchar();
    while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
    return x;
}

static inline void print(const int &x) {
    if (x > 9)print(x / 10);
    putchar('0' + x % 10);
}

int main()
{
    cin.tie(0) -> sync_with_stdio(0);

    int t;

    cin >> t;

    while(t--)
    {
        int n;

        cin >> n;

        int list[n];
        for(int i = 0;i < n;cin >> list[i++]);

        for(int i = 1;i < n;i++)
        {
            int x = min(list[i], list[i-1]);

            list[i] -= x;
            list[i - 1] -= x;
        }

        bool f = 1;
        for(int i = 0;i < n;i++)
        {
            if(list[i] > list[i + 1]) f = 0;
        }

        cout << (f ? "YES\n" : "NO\n");
    }
}


Submission (verdict: Accepted):
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <math.h>
#include <array>
#include <random>
#include <bitset>
#include <climits>
#include <cstring>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define endl '\n'
#define mod 1000000007
#define INF 0x3f3f3f3f

#pragma GCC optimize("O3,Ofast,unroll-loops")
#pragma GCC target("avx2,sse3,sse4,avx")
#pragma GCC target("popcnt")

template <class x>
using ordered_set = tree<x, null_type, less<x>, rb_tree_tag, tree_order_statistics_node_update>;

typedef pair<int, int> ipair;

static inline int read()
{
    int x = 0;char ch = getchar();
    while (ch < '0' || ch>'9') ch = getchar();
    while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
    return x;
}

static inline void print(const int &x) {
    if (x > 9)print(x / 10);
    putchar('0' + x % 10);
}

int main()
{
    cin.tie(0) -> sync_with_stdio(0);

    int t;

    cin >> t;

    while(t--)
    {
        int n;

        cin >> n;

        int list[n];
        for(int i = 0;i < n;cin >> list[i++]);

        for(int i = 1;i < n;i++)
        {
            int x = min(list[i], list[i-1]);

            list[i] -= x;
            list[i - 1] -= x;
        }

        bool f = 1;
        for(int i = 0;i < n-1;i++)
        {
            if(list[i] > list[i + 1]) f = 0;
        }

        cout << (f ? "YES\n" : "NO\n");
    }
}