Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Compilation error):
#include "stdc++.h"

#define ll long long 

#define fastCode ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;



void code()

{

    ll n;

    cin >> n;

    unordered_set<int>v;

    int x;

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

    {

        cin >> x;

        v.insert(x);

    }



    if (v.size() < 2)

    {

        cout << "NO" << endl;

        return;

    }



    auto temp = v.begin();

    int first = *temp;

    temp++;

    int second = *temp;

    int mini = min(first, second);



    vector<int>res;

    int count = 0;

    for (auto i : v)

    {

        count++;

        int def = abs(i - mini);

        res.push_back(def);

        if (count == 2)

            break;

    }

    count = 0;

    for (auto i : v)

    {

        count++;

        int def = abs(i - mini);

        if (count == 2)

        {

            res.push_back(def);

        }

    }

    vector<int> ressort = res;

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

    if (res != ressort)

    {

        cout << "NO" << endl;

    }

    else

        cout << "YES" << endl;



}



int main()

{

    fastCode

        ll t = 1;

    cin >> t;

    while (t--)

    {

        code();

    }

}

Submission (verdict: Compilation error):
#include "stdc++.h"

#define ll long long 

#define fastCode ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;



void code()

{

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

    {

        int mini = min(v[i], v[i + 1]);

        v[i] -= mini;

        v[i+1] -= mini;

    }



    vector<int>sorted = v;

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

    if (sorted != v)

    {

        cout << "NO" << endl;

    }

    else cout << "YES" << endl;

}



int main()

{

    fastCode

        ll t = 1;

    cin >> t;

    while (t--)

    {

        code();

    }

}



















/*#include "stdc++.h"

#define ll long long 

#define fastCode ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;



void code()

{

    ll n;

    cin >> n;

    unordered_set<int>v;

    int x;

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

    {

        cin >> x;

        v.insert(x);

    }



    if (v.size() < 2)

    {

        cout << "NO" << endl;

        return;

    }



    auto temp = v.begin();

    int first = *temp;

    temp++;

    int second = *temp;

    int mini = min(first, second);



    vector<int>res;

    int count = 0;

    for (auto i : v)

    {

        count++;

        int def = abs(i - mini);

        res.push_back(def);

        if (count == 2)

            break;

    }

    count = 0;

    for (auto i : v)

    {

        count++;

        int def = abs(i - mini);

        if (count == 2)

        {

            res.push_back(def);

        }

    }

    vector<int> ressort = res;

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

    if (res != ressort)

    {

        cout << "NO" << endl;

    }

    else

        cout << "YES" << endl;



}



int main()

{

    fastCode

    ll t = 1;

    cin >> t;

    while (t--)

    {

        code();

    }

}*/