ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2060D - Subtract Min Sort
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <class type1>
#define ll long long int
#define endl "\n"
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
using ordered_multiset = tree <type1, null_type, less_equal <type1>, rb_tree_tag, tree_order_statistics_node_update>;
#define yes cout << "YES\n"
#define no cout << "NO\n"
ll lcm(ll x,ll y)
{
    return (x*y)/__gcd(x,y);
}


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tt;
    cin >> tt;
    while (tt--)
    {
        int n;
        cin >> n;

        vector<ll> a(n);
        for (int i = 0; i < n; i++)
        {
            cin >> a[i];
        }
         int mn;
         vector<int>v,vv;
        for(int i=0;i<n-1;i++)
        {
            mn=min(a[i],a[i+1]);
            v.push_back(a[i]-mn);
            a[i+1]=a[i+1]-mn;
        }
        v.push_back(a[n-1]-mn);
        int bb=0;
        for(int i=0;i<n-1;i++)
        {
            if(v[i]<=v[i+1])continue;
            else
            {
                bb=1;
                no;
                break;
            }
        }
        if(bb==0)yes;



    }
    return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <class type1>
#define ll long long int
#define endl "\n"
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
using ordered_multiset = tree <type1, null_type, less_equal <type1>, rb_tree_tag, tree_order_statistics_node_update>;
#define yes cout << "YES\n"
#define no cout << "NO\n"
ll lcm(ll x,ll y)
{
    return (x*y)/__gcd(x,y);
}


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tt;
    cin >> tt;
    while (tt--)
    {
        int n;
        cin >> n;

        vector<ll> a(n);
        for (int i = 0; i < n; i++)
        {
            cin >> a[i];
        }
         int mn;
         vector<int>v,vv;
        for(int i=0;i<n-1;i++)
        {
            mn=min(a[i],a[i+1]);
            v.push_back(a[i]-=mn);
            a[i+1]-=mn;
        }
        v.push_back(a[n-1]-=mn);

       vv=v;
       sort(v.begin(),v.end());
       if(vv==v)yes;
       else no;



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

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <class type1>
#define ll long long int
#define endl "\n"
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
using ordered_multiset = tree <type1, null_type, less_equal <type1>, rb_tree_tag, tree_order_statistics_node_update>;
#define yes cout << "YES\n"
#define no cout << "NO\n"
ll lcm(ll x,ll y)
{
    return (x*y)/__gcd(x,y);
}


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tt;
    cin >> tt;
    while (tt--)
    {
        int n;
        cin >> n;

        vector<ll> a(n);
        for (int i = 0; i < n; i++)
        {
            cin >> a[i];
        }
         int mn;
         vector<int>v,vv;
        for(int i=0;i<n-1;i++)
        {
            mn=min(a[i],a[i+1]);
            v.push_back(a[i]-=mn);
            a[i+1]-=mn;
        }
        v.push_back(a[n-1]);
        for(auto u:v)cout<<u<<" ";
        cout<<endl;

       vv=v;
       sort(v.begin(),v.end());
       if(vv==v)yes;
       else no;



    }
    return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <class type1>
#define ll long long int
#define endl "\n"
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
using ordered_multiset = tree <type1, null_type, less_equal <type1>, rb_tree_tag, tree_order_statistics_node_update>;
#define yes cout << "YES\n"
#define no cout << "NO\n"
ll lcm(ll x,ll y)
{
    return (x*y)/__gcd(x,y);
}


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tt;
    cin >> tt;
    while (tt--)
    {
        int n;
        cin >> n;

        vector<ll> a(n);
        for (int i = 0; i < n; i++)
        {
            cin >> a[i];
        }
         int mn;
         vector<int>v,vv;
        for(int i=0;i<n-1;i++)
        {
            mn=min(a[i],a[i+1]);
            v.push_back(a[i]-=mn);
            a[i+1]-=mn;
        }
        v.push_back(a[n-1]);
        //for(auto u:v)cout<<u<<" ";
        //cout<<endl;

       vv=v;
       sort(v.begin(),v.end());
       if(vv==v)yes;
       else no;



    }
    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>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <class type1>
#define ll long long int
#define endl "\n"
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
using ordered_multiset = tree <type1, null_type, less_equal <type1>, rb_tree_tag, tree_order_statistics_node_update>;
#define yes cout << "YES\n"
#define no cout << "NO\n"
ll lcm(ll x,ll y)
{
    return (x*y)/__gcd(x,y);
}


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tt;
    cin >> tt;
    while (tt--)
    {
        int n;
        cin >> n;

        vector<ll> a(n);
        for (int i = 0; i < n; i++)
        {
            cin >> a[i];
        }
         int mn;
         vector<int>v,vv;
        for(int i=0;i<n-1;i++)
        {
            mn=min(a[i],a[i+1]);
            v.push_back(a[i]-=mn);
            a[i+1]-=mn;
        }
        v.push_back(a[n-1]-=mn);

       vv=v;
       sort(v.begin(),v.end());
       if(vv==v)yes;
       else no;



    }
    return 0;
}


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <class type1>
#define ll long long int
#define endl "\n"
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
using ordered_multiset = tree <type1, null_type, less_equal <type1>, rb_tree_tag, tree_order_statistics_node_update>;
#define yes cout << "YES\n"
#define no cout << "NO\n"
ll lcm(ll x,ll y)
{
    return (x*y)/__gcd(x,y);
}


int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int tt;
    cin >> tt;
    while (tt--)
    {
        int n;
        cin >> n;

        vector<ll> a(n);
        for (int i = 0; i < n; i++)
        {
            cin >> a[i];
        }
         int mn;
         vector<int>v,vv;
        for(int i=0;i<n-1;i++)
        {
            mn=min(a[i],a[i+1]);
            v.push_back(a[i]-=mn);
            a[i+1]-=mn;
        }
        v.push_back(a[n-1]);
        for(auto u:v)cout<<u<<" ";
        cout<<endl;

       vv=v;
       sort(v.begin(),v.end());
       if(vv==v)yes;
       else no;



    }
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
// [Irelia]
#include<bits/stdc++.h>

namespace Irelia // [Irelia Library] Irelia
{
    #define Irelia__ 201307
    #define fcc(i, j, k) for(int (i)=(j); (i)<=(k); ++(i))
    #define ccf(i, j, k) for(int (i)=(j); (i)>=(k); --(i))
    #define I (*this)

    using Int = long long;
    using uint = unsigned int;
    using uInt = unsigned long long;

    const char newl = '\n', *snewl = " \n";

    inline Int read()
    {
        Int ret = 0, s = 1, c = getchar();
        for(; !isdigit(c); c = getchar()) if(c == '-') s = -1;
        for(; isdigit(c); c = getchar()) ret = (ret << 1) + (ret << 3) + (c ^ 48);
        return s * ret;
    }
    inline std::string readstr()
    {
        std::string ret; char c = getchar();
        for(; c <= ' '; c = getchar());
        for(; c > ' '; c = getchar()) ret += c;
        return ret;
    }
    template<typename T>
    constexpr void min_(T &t, const T &u) { if(u < t) t = u; }
    template<typename T>
    constexpr void max_(T &t, const T &u) { if(t < u) t = u; }
    template<typename T>
    constexpr inf() { return (std::numeric_limits<T>::max() - Irelia__) / 2; }

    template<typename T>
    class vector : public std::vector<T>
    {
        public:
        int size() { return std::vector<T>::size(); }
        T &operator [] (int i)
        {
            #ifdef DEBUG__
            assert(0 <= i && i < size());
            #endif
            return std::vector<T>::operator[](i);
        }
        operator bool () { return !I.empty(); }
        void set(int siz) { I.resize(siz); }
        void push(auto &&...t) { I.emplace_back(t...); }
        void pop() { I.pop_back(); }
        void reverse() { std::reverse(I.begin(), I.end()); }
        template<typename Tl = std::less<T>>
        void sort() { std::sort(I.begin(), I.end(), Tl()); }
        template<typename Tl = std::less<T>>
        int lower(const T &t) { return std::lower_bound(I.begin(), I.end(), t, Tl()) - I.begin(); }
        template<typename Tl = std::less<T>>
        int upper(const T &t) { return std::upper_bound(I.begin(), I.end(), t, Tl()) - I.begin(); }
        template<typename Tl = std::less<T>>
        void discretize()
        {
            sort<Tl>(), set(std::unique(I.begin(), I.end(),
                [&](T &a, T &b) { return !Tl()(a, b) && !Tl()(b, a); }) - I.begin());
        }
    };
}

using namespace Irelia;

void solve()
{
    int N = read(), ans = 0;
    std::vector<int> A(N + 1);
    fcc(i, 1, N) A[i] = read(), ans += A[i];
    ans = std::abs(ans);
    fcc(i, 1, N - 1)
    {
        int sum = 0;
        fcc(j, 1, N - i) A[j] = A[j + 1] - A[j], sum += A[j];
        max_(ans, std::abs(sum));
    }
    std::cout << ans << newl;
}
int main()
{
    #ifndef ONLINE_JUDGE
    freopen(".in", "r", stdin);
    freopen(".out", "w", stdout);
    #endif
    std::cin.tie(0)->sync_with_stdio(0);

    for(int T = read(); T --> 0;) solve();
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 5):
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> p;
const int N = 1008;
int a[N];
vector<p> v;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n; cin >> n;
    int wynik = n*(n-1);
    for(int i=0; i<n; i++){
        cin >> a[i];
        if(i+1 > a[i]) wynik -= 1+i-a[i];
    }
    cout << wynik<<"\n";
    for(int i=1; i<=n; i++){
        for(int j=i+1; j<=n; j++){
            cout << j << " "<< i<<"\n";
        }
    }
    for(int i=0; i<n; i++){
        for(int j=0; j<n-1; j++){
            if(a[j]<a[j+1]){
                v.emplace_back(a[j], a[j+1]);
                swap(a[j], a[j+1]);
            }
        }
    }
    for(int i=v.size()-1; i>=0; --i){
        cout << v[i].first<<" "<<v[i].second<<"\n";
    }
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> p;
const int N = 1008;
int a[N];
vector<p> v;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n; cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    for(int i=0; i<n; i++){
        for(int j=0; j<n-1; j++){
            if(a[j]<a[j+1]){
                v.emplace_back(a[j], a[j+1]);
                swap(a[j], a[j+1]);
            }
        }
    }
    for(int i=n; i>0; i--){
        for(int j=i-1; j>0; j--){
            v.emplace_back(i, j);
        }
    }
    cout << v.size()<<"\n";
    for(int i=v.size()-1; i>=0; --i){
        cout << v[i].first<<" "<<v[i].second<<"\n";
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 5):
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> p;
const int N = 1008;
int a[N];
vector<p> v;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n; cin >> n;
    int wynik = n*(n-1);
    for(int i=0; i<n; i++){
        cin >> a[i];
        if(i > a[i]) wynik -= 1+i-a[i];
    }
    cout << wynik<<"\n";
    for(int i=1; i<=n; i++){
        for(int j=i+1; j<=n; j++){
            cout << j << " "<< i<<"\n";
        }
    }
    for(int i=0; i<n; i++){
        for(int j=0; j<n-1; j++){
            if(a[j]<a[j+1]){
                v.emplace_back(a[j], a[j+1]);
                swap(a[j], a[j+1]);
            }
        }
    }
    for(int i=v.size()-1; i>=0; --i){
        cout << v[i].first<<" "<<v[i].second<<"\n";
    }
}

Submission (verdict: Wrong answer on test 5):
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> p;
const int N = 1008;
int a[N];
vector<p> v;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n; cin >> n;
    int wynik = n*(n-1);
    for(int i=0; i<n; i++){
        cin >> a[i];
        if(i+1 > a[i]) wynik -= 1+i-a[i];
    }
    cout << wynik<<"\n";
    for(int i=1; i<=n; i++){
        for(int j=i+1; j<=n; j++){
            cout << j << " "<< i<<"\n";
        }
    }
    for(int i=0; i<n; i++){
        for(int j=0; j<n-1; j++){
            if(a[j]<a[j+1]){
                v.emplace_back(a[j], a[j+1]);
                swap(a[j], a[j+1]);
            }
        }
    }
    for(int i=v.size()-1; i>=0; --i){
        cout << v[i].first<<" "<<v[i].second<<"\n";
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 5):
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> p;
const int N = 1008;
int a[N];
vector<p> v;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n; cin >> n;
    int wynik = n*(n-1);
    for(int i=0; i<n; i++){
        cin >> a[i];
        if(i > a[i]) wynik -= 1+i-a[i];
    }
    cout << wynik<<"\n";
    for(int i=1; i<=n; i++){
        for(int j=i+1; j<=n; j++){
            cout << j << " "<< i<<"\n";
        }
    }
    for(int i=0; i<n; i++){
        for(int j=0; j<n-1; j++){
            if(a[j]<a[j+1]){
                v.emplace_back(a[j], a[j+1]);
                swap(a[j], a[j+1]);
            }
        }
    }
    for(int i=v.size()-1; i>=0; --i){
        cout << v[i].first<<" "<<v[i].second<<"\n";
    }
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

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

using namespace std;

const int64_t inf = 1e18;

void solve() {
    int64_t n;
    cin >> n;
    vector<int64_t> a(n), b(n);
    vector<pair<int64_t, int64_t>> r;
    for (int64_t i = 0; i < n; ++i) {
        cin >> a[i];
        b[i] = n - i;
    }
    for (int64_t i = 0; i < n; ++i) {
        int64_t j = i + 1;
        if (a[i] != b[i]) {
            while (a[i] != b[j]) ++j;
            while (a[i] != b[i]) {
                r.push_back({b[j], b[j - 1]});
                swap(b[j - 1], b[j]);
                --j;
            }
        }
        for (int64_t k = i + 1; k <= n; ++k) {
            if (i + 1 == k) continue;
            else r.push_back({k, i + 1});
        }
    }
    cout << r.size() << '\n';
    for (auto i : r) cout << i.first << ' ' << i.second << '\n';
    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int t = 1;
    // cin >> t;
    for (int i = 0; i < t; ++i)
        solve();
    return 0;
}

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

using namespace std;

const int64_t inf = 1e18;

void solve() {
    int64_t n;
    cin >> n;
    vector<int64_t> a(n), b(n);
    vector<pair<int64_t, int64_t>> r;
    for (int64_t i = 0; i < n; ++i) {
        cin >> a[i];
        b[i] = n - i;
    }
    for (int64_t i = 0; i < n; ++i) {
        for (int64_t k = i + 1; k <= n; ++k) {
            if (i + 1 == k) continue;
            else r.push_back({k, i + 1});
        }
        int64_t j = i + 1;
        if (a[i] != b[i]) {
            while (a[i] != b[j]) ++j;
            while (a[i] != b[i]) {
                r.push_back({b[j], b[j - 1]});
                swap(b[j - 1], b[j]);
                --j;
            }
        }
    }
    cout << r.size() << '\n';
    for (auto i : r) cout << i.first << ' ' << i.second << '\n';
    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int t = 1;
    // cin >> t;
    for (int i = 0; i < t; ++i)
        solve();
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)

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

using namespace std;

const int64_t inf = 1e18;

void solve() {
    int64_t n;
    cin >> n;
    vector<int64_t> a(n), b(n);
    vector<pair<int64_t, int64_t>> r;
    for (int64_t i = 0; i < n; ++i) {
        cin >> a[i];
        b[i] = n - i;
    }
    for (int64_t i = 0; i < n; ++i) {
        for (int64_t k = i + 1; k <= n; ++k) {
            if (i + 1 == k) continue;
            else r.push_back({k, i + 1});
        }
        int64_t j = i + 1;
        if (a[i] != b[i]) {
            while (a[i] != b[j]) ++j;
            while (a[i] != b[i]) {
                r.push_back({b[j], b[j - 1]});
                swap(b[j - 1], b[j]);
                --j;
            }
        }
    }
    cout << r.size() << '\n';
    for (auto i : r) cout << i.first << ' ' << i.second << '\n';
    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int t = 1;
    // cin >> t;
    for (int i = 0; i < t; ++i)
        solve();
    return 0;
}


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

using namespace std;

const int64_t inf = 1e18;

void solve() {
    int64_t n;
    cin >> n;
    vector<int64_t> a(n), b(n);
    for(int64_t i = 0; i < n; ++i) cin >> a[i];
    vector<pair<int64_t, int64_t>> r;
    for (int64_t i = 1; i <= n; ++i) {
        for (int64_t j = i + 1; j <= n; ++j) r.push_back({j, i});
        b[i - 1] = n - i + 1;
    }
    for (int64_t i = 0; i < n; ++i) {
        int64_t j = i + 1;
        if (a[i] != b[i]) {
            while (a[i] != b[j]) ++j;
            while (a[i] != b[i]) {
                r.push_back({b[j], b[j - 1]});
                swap(b[j - 1], b[j]);
                --j;
            }
        }
    }
    cout<< r.size() << endl;
    for(auto p : r) cout<< p.first << ' ' << p.second << endl;
    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int t = 1;
    // cin >> t;
    for (int i = 0; i < t; ++i)
        solve();
    return 0;
}
Problem: 2052A - Adrenaline Rush
Language: C++20 (GCC 13-64)


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

using namespace std;

const int64_t inf = 1e18;

void solve() {
    int64_t n;
    cin >> n;
    vector<int64_t> a(n), b(n);
    vector<pair<int64_t, int64_t>> r;
    for (int64_t i = 0; i < n; ++i) {
        cin >> a[i];
        b[i] = n - i;
    }
    for (int64_t i = 0; i < n; ++i) {
        int64_t j = i + 1;
        if (a[i] != b[i]) {
            while (a[i] != b[j]) ++j;
            while (a[i] != b[i]) {
                r.push_back({b[j], b[j - 1]});
                swap(b[j - 1], b[j]);
                --j;
            }
        }
        for (int64_t k = i + 1; k <= n; ++k) {
            if (i + 1 == k) continue;
            else r.push_back({k, i + 1});
        }
    }
    cout << r.size() << '\n';
    for (auto i : r) cout << i.first << ' ' << i.second << '\n';
    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int t = 1;
    // cin >> t;
    for (int i = 0; i < t; ++i)
        solve();
    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>

using namespace std;

int main()

{

    int t;

    cin >> t;

    while (t--)

    {

        int n;

        cin >> n;

        int a[n];

        string ans = "YES";

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

            cin >> a[i];

        for(int i=0;i<n-1;i+=2){

            if(a[i] > a[i+1]){

                ans = "NO";

                break;

            }

        }

        if(a[n-1] < a[n-2])

        ans = "NO";

        cout<<ans<<endl;

    }

}

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

using namespace std;

int main()

{

    int t;

    cin >> t;

    while (t--)

    {

        int n;

        cin >> n;

        int a[n];

        string ans = "YES";

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

            cin >> a[i];

        for (int i = 0; i < n - 1; i+=2)

        {

            if (a[i + 1] < a[i])

            {

                ans = "NO";

                break;

            }

            else

            {

                a[i] = 0;

                a[i + 1] = a[i + 1] - a[i];

            }

        }

        cout << ans << endl;

    }

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

int main()

{

    int t;

    cin >> t;

    while (t--)

    {

        int n;

        cin >> n;

        int a[n];

        string ans = "YES";

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

            cin >> a[i];

        for(int i=0;i<n-1;i+=2){

            if(a[i] > a[i+1]){

                ans = "NO";

                break;

            }

        }

        if(a[n-1] < a[n-2])

        ans = "NO";

        cout<<ans<<endl;

    }

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

int main()

{

    int t;

    cin >> t;

    while (t--)

    {

        int n;

        cin >> n;

        int a[n];

        string ans = "YES";

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

            cin >> a[i];

        for (int i = 0; i < n - 1; i+=2)

        {

            if (a[i + 1] < a[i])

            {

                ans = "NO";

                break;

            }

            else

            {

                a[i] = 0;

                a[i + 1] = a[i + 1] - a[i];

            }

        }

        cout << ans << endl;

    }

}

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

using namespace std;

int main()

{

    int t;

    cin >> t;

    while (t--)

    {

        int n;

        cin >> n;

        int a[n];

        string ans = "YES";

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

            cin >> a[i];

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

        {

            if (a[i + 1] < a[i])

            {

                ans = "NO";

                break;

            }

            else

            {

                a[i + 1] = a[i + 1] - a[i];

                a[i] = 0;

            }

        }

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

        {

            if (a[i] > a[i + 1])

            {

                ans = "NO";

                break;

            }

        }

        cout << ans << endl;

    }

}