ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef vector<long long> vc;
#define fol(i,a,b) for(ll i = a; i < b; i++)
const ll mod = 1e9+7;
int main(){
    int t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        vector<ll> a(n);
        ll sum = 0;
        fol(i,0,n) {cin>>a[i];sum += a[i];}
        vector<ll> prev;
        if (a.size() == 1) cout<<a[0]<<endl;
        else{
        if (a[n-1] - a[0] < a[0] - a[n-1]){
            for(ll i = n-1;i>=0;i--){
                prev.push_back(a[i]);
            }} else{
                for(ll i = 0;i<n;i++) prev.push_back(a[i]);
            }
        ll ans = 0;
        for(ll i = 0;i<n;i++){
            vector<ll> curr;
            if (prev[prev.size()-1] - prev[0] < prev[0] - prev[prev.size()-1]){
                reverse(prev.begin(),prev.end());
            }
            for(ll j = 0;j<prev.size()-1;j++){
                curr.push_back(prev[j+1] - prev[j]);
            }
            if (curr.size() == 1){
                ans = curr[0];break;
            }
            prev.clear();
            prev.insert(prev.end(), curr.begin(), curr.end());
        }
        cout<<max(ans,sum)<<endl;
    }
    }
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef vector<long long> vc;
#define fol(i,a,b) for(ll i = a; i < b; i++)
const ll mod = 1e9+7;
int main(){
    int t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        vector<ll> a(n);
        ll sum = 0;
        fol(i,0,n) {cin>>a[i];sum += a[i];}
        vector<ll> prev;
        if (a.size() == 1) cout<<a[0]<<endl;
        else{
        if (a[n-1] - a[0] < a[0] - a[n-1]){
            for(ll i = n-1;i>=0;i--){
                prev.push_back(a[i]);
            }} else{
                for(ll i = 0;i<n;i++) prev.push_back(a[i]);
            }
        ll ans = 0;
        for(ll i = 0;i<n;i++){
            vector<ll> curr;
            if (prev[prev.size()-1] - prev[0] < prev[0] - prev[prev.size()-1]){
                reverse(prev.begin(),prev.end());
            }
            for(ll j = 0;j<prev.size()-1;j++){
                curr.push_back(prev[j+1] - prev[j]);
            }
            if (curr.size() == 1){
                ans = curr[0];break;
            }
            prev.clear();
            prev.insert(prev.end(), curr.begin(), curr.end());
        }
        cout<<max(ans,sum)<<endl;
    }
    }
}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef vector<long long> vc;
#define fol(i,a,b) for(ll i = a; i < b; i++)
const ll mod = 1e9+7;
int main(){
    int t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        vector<ll> a(n);
        ll sum = 0;
        fol(i,0,n) {cin>>a[i];sum += a[i];}
        vector<ll> prev;
        if (n == 1) cout<<a[0]<<endl;
        else{
        if (a[n-1] - a[0] < a[0] - a[n-1]){
            for(ll i = n-1;i>=0;i--){
                prev.push_back(a[i]);
            }} else{
                for(ll i = 0;i<n;i++) prev.push_back(a[i]);
            }
        ll ans = 0;
        for(ll i = 0;i<n;i++){
            vector<ll> curr;
            //if (prev[prev.size()-1] - prev[0] < prev[0] - prev[prev.size()-1]){
            //    reverse(prev.begin(),prev.end());
            //}
            for(ll j = 0;j<prev.size()-1;j++){
                curr.push_back(prev[j+1] - prev[j]);
            }
            if (curr.size() == 1){
                ans = curr[0];break;
            }
            prev.clear();
            prev.insert(prev.end(), curr.begin(), curr.end());
        }
        if (ans < 0) ans = abs(ans);
        cout<<max(ans,sum)<<endl;
    }
}
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef vector<long long> vc;
#define fol(i,a,b) for(ll i = a; i < b; i++)
const ll mod = 1e9+7;
int main(){
    int t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        vector<ll> a(n);
        ll sum = 0;
        fol(i,0,n) {cin>>a[i];sum += a[i];}
        //vector<ll> prev;
        if (n == 1) cout<<a[0]<<endl;
        else{
        ll ans = -1e18;
        ll lim = n;
        for(ll i = 0;i<n;i++){
            ll sum2 = 0;
            for(ll j = 0;j<lim;j++) sum2 += a[i];
            if (i == 0) ans=max(ans,sum2);
            else ans=max(ans,max(sum2,-(sum2)));
            for(ll j = 0;j<lim-1;j++){
                a[j] = a[j+1] - a[j];
            }
            lim--;
        }
        cout<<ans<<endl;
    }
}
}

Submission (verdict: Accepted):
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef vector<long long> vc;
#define fol(i,a,b) for(ll i = a; i < b; i++)
const ll mod = 1e9+7;
int main(){
    int t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        vector<ll> a(n);
        ll sum = 0;
        fol(i,0,n) {cin>>a[i];}
        //vector<ll> prev;
        if (n == 1) cout<<a[0]<<endl;
        else{
        ll ans = -1e18;
        ll lim = n;
        for(ll i = 0;i<n;i++){
            ll sum2 = 0;
            for(ll j = 0;j<lim;j++) sum2 += a[j];
            if (i == 0) ans=max(ans,sum2);
            else ans=max(ans,max(sum2,-(sum2)));
            //cout<<sum2<<endl;
            for(ll j = 0;j<lim-1;j++){
                a[j] = a[j+1] - a[j];
            }
            lim--;
        }
        //ll si = 0;
        cout<<ans<<endl;
    }
}
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef vector<long long> vc;
#define fol(i,a,b) for(ll i = a; i < b; i++)
const ll mod = 1e9+7;
int main(){
    int t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        vector<ll> a(n);
        ll sum = 0;
        fol(i,0,n) {cin>>a[i];sum += a[i];}
        vector<ll> prev;
        if (n == 1) cout<<a[0]<<endl;
        else{
        if (a[n-1] - a[0] < a[0] - a[n-1]){
            for(ll i = n-1;i>=0;i--){
                prev.push_back(a[i]);
            }} else{
                for(ll i = 0;i<n;i++) prev.push_back(a[i]);
            }
        ll ans = 0;
        for(ll i = 0;i<n;i++){
            vector<ll> curr;
            //if (prev[prev.size()-1] - prev[0] < prev[0] - prev[prev.size()-1]){
            //    reverse(prev.begin(),prev.end());
            //}
            ll sum2 = 0;
            for(ll j = 0;j<prev.size();j++) sum2 += prev[j];
            if (i == 0) ans = max(ans,sum2);
            else ans = max(ans,max(sum2,(-sum2)));
            for(ll j = 0;j<prev.size()-1;j++){
                curr.push_back(prev[j+1] - prev[j]);
            }
            if (curr.size() == 1){
                ans = curr[0];break;
            }
            prev.clear();
            prev.insert(prev.end(), curr.begin(), curr.end());
        }
        if (ans < 0) ans = abs(ans);
        cout<<max(ans,sum)<<endl;
    }
}
}

Submission (verdict: Wrong answer on test 1):
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef vector<long long> vc;
#define fol(i,a,b) for(ll i = a; i < b; i++)
const ll mod = 1e9+7;
int main(){
    int t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        vector<ll> a(n);
        ll sum = 0;
        fol(i,0,n) {cin>>a[i];sum += a[i];}
        //vector<ll> prev;
        if (n == 1) cout<<a[0]<<endl;
        else{
        ll ans = -1e18;
        ll lim = n;
        for(ll i = 0;i<n;i++){
            ll sum2 = 0;
            for(ll j = 0;j<lim;j++) sum2 += a[i];
            if (i == 0) ans=max(ans,sum2);
            else ans=max(ans,max(sum2,-(sum2)));
            for(ll j = 0;j<lim-1;j++){
                a[j] = a[j+1] - a[j];
            }
            lim--;
        }
        cout<<ans<<endl;
    }
}
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef vector<long long> vc;
#define fol(i,a,b) for(ll i = a; i < b; i++)
const ll mod = 1e9+7;
int main(){
    int t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        vector<ll> a(n);
        ll sum = 0;
        fol(i,0,n) {cin>>a[i];sum += a[i];}
        vector<ll> prev;
        if (n == 1) cout<<a[0]<<endl;
        else{
        if (a[n-1] - a[0] < a[0] - a[n-1]){
            for(ll i = n-1;i>=0;i--){
                prev.push_back(a[i]);
            }} else{
                for(ll i = 0;i<n;i++) prev.push_back(a[i]);
            }
        ll ans = 0;
        for(ll i = 0;i<n;i++){
            vector<ll> curr;
            //if (prev[prev.size()-1] - prev[0] < prev[0] - prev[prev.size()-1]){
            //    reverse(prev.begin(),prev.end());
            //}
            for(ll j = 0;j<prev.size()-1;j++){
                curr.push_back(prev[j+1] - prev[j]);
            }
            if (curr.size() == 1){
                ans = curr[0];break;
            }
            prev.clear();
            prev.insert(prev.end(), curr.begin(), curr.end());
        }
        if (ans < 0) ans = abs(ans);
        cout<<max(ans,sum)<<endl;
    }
}
}

Submission (verdict: Wrong answer on test 2):
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
//typedef vector<long long> vc;
#define fol(i,a,b) for(ll i = a; i < b; i++)
const ll mod = 1e9+7;
int main(){
    int t;
    cin>>t;
    while(t--){
        ll n;
        cin>>n;
        vector<ll> a(n);
        ll sum = 0;
        fol(i,0,n) {cin>>a[i];sum += a[i];}
        vector<ll> prev;
        if (n == 1) cout<<a[0]<<endl;
        else{
        if (a[n-1] - a[0] < a[0] - a[n-1]){
            for(ll i = n-1;i>=0;i--){
                prev.push_back(a[i]);
            }} else{
                for(ll i = 0;i<n;i++) prev.push_back(a[i]);
            }
        ll ans = 0;
        for(ll i = 0;i<n;i++){
            vector<ll> curr;
            //if (prev[prev.size()-1] - prev[0] < prev[0] - prev[prev.size()-1]){
            //    reverse(prev.begin(),prev.end());
            //}
            ll sum2 = 0;
            for(ll j = 0;j<prev.size();j++) sum2 += prev[j];
            if (i == 0) ans = max(ans,sum2);
            else ans = max(ans,max(sum2,(-sum2)));
            for(ll j = 0;j<prev.size()-1;j++){
                curr.push_back(prev[j+1] - prev[j]);
            }
            if (curr.size() == 1){
                ans = curr[0];break;
            }
            prev.clear();
            prev.insert(prev.end(), curr.begin(), curr.end());
        }
        if (ans < 0) ans = abs(ans);
        cout<<max(ans,sum)<<endl;
    }
}
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void solve()
{
    int n,ans=0;
    cin>>n;
    vector<int> a(n,0),b;
    for(int i=0;i<n;i++)
        cin>>a[i],ans+=a[i];
    for(int i=1;i<n;i++)
    {
        ans=max(ans,max(a[n-i]-a[0],a[0]-a[n-i]));
        for(int j=0;j<=n-i-1;j++)
            a[j]=a[j+1]-a[j];
    }
    cout<<ans<<'\n';
}
int main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int t;
    cin>>t;
    while(t--)solve();
    return 0;
}

Submission (verdict: Accepted):
#include<iostream>
#include<vector>
#include<algorithm>
#define int long long
using namespace std;
void solve()
{
    int n,ans=0;
    cin>>n;
    vector<int> a(n,0),b;
    for(int i=0;i<n;i++)
        cin>>a[i],ans+=a[i];
    for(int i=1;i<n;i++)
    {
        ans=max(ans,max(a[n-i]-a[0],a[0]-a[n-i]));
        for(int j=0;j<=n-i-1;j++)
            a[j]=a[j+1]-a[j];
    }
    cout<<ans<<'\n';
}
signed main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int t;
    cin>>t;
    while(t--)solve();
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


Submission (verdict: Time limit exceeded on test 2):
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void solve()
{
    int n,ans=0;
    cin>>n;
    vector<int> a(n,0),b;
    for(int i=0;i<n;i++)
        cin>>a[i],ans+=a[i];
    auto dfs=[&](auto dfs,vector<int>& a)->void{
        if(a.size()==1)
        {
            ans=max(ans,a[0]);
            return;
        }
        ans=max(ans,max(a.back()-a[0],a[0]-a.back()));
        vector<int> b;
        for(int i=0;i<a.size()-1;i++)
            b.push_back(a[i+1]-a[i]);
        dfs(dfs,b);
        reverse(b.begin(),b.end());
        for(auto &i:b)i=-i;
        dfs(dfs,b);
    };
    dfs(dfs,a);
    cout<<ans<<'\n';
}
int main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int t;
    cin>>t;
    while(t--)solve();
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 2):
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void solve()
{
    int n,ans=0;
    cin>>n;
    vector<int> a(n,0),b;
    for(int i=0;i<n;i++)
        cin>>a[i],ans+=a[i];
    auto dfs=[&](auto dfs,vector<int>& a)->void{
        if(a.size()==1)
        {
            ans=max(ans,a[0]);
            return;
        }
        ans=max(ans,max(a.back()-a[0],a[0]-a.back()));
        vector<int> b;
        for(int i=0;i<a.size()-1;i++)
            b.push_back(a[i+1]-a[i]);
        dfs(dfs,b);
        reverse(b.begin(),b.end());
        for(auto &i:b)i=-i;
        dfs(dfs,b);
    };
    dfs(dfs,a);
    cout<<ans<<'\n';
}
int main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int t;
    cin>>t;
    while(t--)solve();
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
void solve()
{
    int n,ans=0;
    cin>>n;
    vector<int> a(n,0),b;
    for(int i=0;i<n;i++)
        cin>>a[i],ans+=a[i];
    for(int i=1;i<n;i++)
    {
        ans=max(ans,max(a[n-i]-a[0],a[0]-a[n-i]));
        for(int j=0;j<=n-i-1;j++)
            a[j]=a[j+1]-a[j];
    }
    cout<<ans<<'\n';
}
int main()
{
    ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int t;
    cin>>t;
    while(t--)solve();
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ll t;
    cin >> t;
    // t = 1;
    while (t--)
    {
        ll n, k = 1;
        ll i = 0, j = 0;
        ll cnt = 0, sum = 0;
        ll mx = 0;
        cin >> n;

        vector<ll> v(n);
        vector<ll> r(n);
        for (auto &u : v)
        {
            cin >> u;mx+=u;
        }
        for (i = 0; i <= (n - 1) / 2; i++)
        {
            if(i!=n-1-i)sum += (v[i] - v[n - 1 - i]);else sum-=v[i];
            mx = max(mx, abs(sum));
        }
        // for(auto u : r) cout<<u<< " ";cout<<endl;

        cout << mx << endl;
    }
}
/*

ll ar[n], br[n];

map<ll,ll>mp;

vector<ll>v;

i = 0;

while (i < n) {
    cin >> ar[i]; i++;
}

i = 0;
while (i < n) {
    cin >> br[i]; // mp[br[i]];
    i++;
}

if (p == 1) cout << "YES" << endl;
else cout << "NO" << endl;

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

// ll mn = 1000000000000000000, mx = 0;

*/
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ll t;
    cin >> t;
    // t = 1;
    while (t--)
    {
        ll n, k = 1;
        ll i = 0, j = 0;
        ll cnt = 0, sum = 0;
        ll mx = 0;
        cin >> n;

        vector<ll> v(n);
        vector<ll> r(n);
        for (auto &u : v)
        {
            cin >> u;mx+=u;
        }
        for (i = 0; i <= (n - 1) / 2; i++)
        {
            if(i!=n-1-i)sum += (v[i] - v[n - 1 - i]);else sum-=v[i];
            mx = max(mx, abs(sum));
        }
        // for(auto u : r) cout<<u<< " ";cout<<endl;

        cout << mx << endl;
    }
}
/*

ll ar[n], br[n];

map<ll,ll>mp;

vector<ll>v;

i = 0;

while (i < n) {
    cin >> ar[i]; i++;
}

i = 0;
while (i < n) {
    cin >> br[i]; // mp[br[i]];
    i++;
}

if (p == 1) cout << "YES" << endl;
else cout << "NO" << endl;

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

// ll mn = 1000000000000000000, mx = 0;

*/

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ll t;
    cin >> t;
    // t = 1;
    while (t--)
    {
        ll n, k = 1;
        ll i = 0, j = 0;
        ll cnt = 0, sum = 0;
        ll mx = 0;
        cin >> n;

        ll v[n];
        for (auto &u : v)
        {
            cin >> u;
            sum += u;
        }
        mx = max(sum, mx);
        sum = 0;
        for (i = 1; i < n; i++)
        {

            for (j = n-1 ; j >=i; j--)
            {
                v[j] = v[j] - v[j - 1];
            }
            sum = 0;
            for (j = i; j < n; j++)
            {
                sum += v[j];
            }
           // cout<<sum<<endl;
            mx = max(mx, abs(sum));
            if (sum < 0)
            {
                reverse(v + i, v + n);
                for (j = i; j < n; j++)
                {
                    v[j] = -v[j];
                }
            }
           // for(auto u : v) cout<<u<< " ";cout<<endl;
        }
        // for(auto u : r) cout<<u<< " ";cout<<endl;

        cout << mx << endl;
    }
}
/*

ll ar[n], br[n];

map<ll,ll>mp;

vector<ll>v;

i = 0;

while (i < n) {
    cin >> ar[i]; i++;
}

i = 0;
while (i < n) {
    cin >> br[i]; // mp[br[i]];
    i++;
}

if (p == 1) cout << "YES" << endl;
else cout << "NO" << endl;

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

// ll mn = 1000000000000000000, mx = 0;

*/
Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ll t;
    cin >> t;
    // t = 1;
    while (t--)
    {
        ll n, k = 1;
        ll i = 0, j = 0;
        ll cnt = 0, sum = 0;
        ll mx = 0;
        cin >> n;

        ll v[n];
        for (auto &u : v)
        {
            cin >> u;
            sum += u;
        }
        mx = max(sum, mx);
        sum = 0;
        for (i = 1; i < n; i++)
        {

            for (j = n-1 ; j >=i; j--)
            {
                v[j] = v[j] - v[j - 1];
            }
            sum = 0;
            for (j = i; j < n; j++)
            {
                sum += v[j];
            }
           // cout<<sum<<endl;
            mx = max(mx, abs(sum));
            if (sum < 0)
            {
                reverse(v + i, v + n);
                for (j = i; j < n; j++)
                {
                    v[j] = -v[j];
                }
            }
           // for(auto u : v) cout<<u<< " ";cout<<endl;
        }
        // for(auto u : r) cout<<u<< " ";cout<<endl;

        cout << mx << endl;
    }
}
/*

ll ar[n], br[n];

map<ll,ll>mp;

vector<ll>v;

i = 0;

while (i < n) {
    cin >> ar[i]; i++;
}

i = 0;
while (i < n) {
    cin >> br[i]; // mp[br[i]];
    i++;
}

if (p == 1) cout << "YES" << endl;
else cout << "NO" << endl;

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

// ll mn = 1000000000000000000, mx = 0;

*/

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ll t;
    cin >> t;
    // t = 1;
    while (t--)
    {
        ll n, k = 1;
        ll i = 0, j = 0;
        ll cnt = 0, sum = 0;
        ll mx = 0;
        cin >> n;

        ll v[n];
        for (auto &u : v)
        {
            cin >> u;
            sum += u;
        }
        if(n==1)mx=v[0];
        mx = max(sum, mx);
        sum = 0;
        for (i = 1; i < n; i++)
        {

            for (j = n-1 ; j >=i; j--)
            {
                v[j] = v[j] - v[j - 1];
            }
            sum = 0;
            for (j = i; j < n; j++)
            {
                sum += v[j];
            }
           // cout<<sum<<endl;
            mx = max(mx, abs(sum));
            if (sum < 0)
            {
                reverse(v + i, v + n);
                for (j = i; j < n; j++)
                {
                    v[j] = -v[j];
                }
            }
           // for(auto u : v) cout<<u<< " ";cout<<endl;
        }
        // for(auto u : r) cout<<u<< " ";cout<<endl;

        cout << mx << endl;

    }
}
/*

ll ar[n], br[n];

map<ll,ll>mp;

vector<ll>v;

i = 0;

while (i < n) {
    cin >> ar[i]; i++;
}

i = 0;
while (i < n) {
    cin >> br[i]; // mp[br[i]];
    i++;
}

if (p == 1) cout << "YES" << endl;
else cout << "NO" << endl;

ll gcd(ll a, ll b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

// ll mn = 1000000000000000000, mx = 0;

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


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

using namespace std;

void solve(vector<int>& v){

    

    

    if(v.size()==1){

        cout<<"YES"<<endl;

        return;

    }

    if(v[1]<v[0]){

        cout<<"NO"<<endl;

        return;

    }

    else if(v[0]==v[1]){

        if(v.size()==2){

            cout<<"YES"<<endl;

            return;

        }

        vector<int> t11(v.begin()+2,v.end());

        solve(t11);

    }

    else{

        cout<<"YES"<<endl;

    }







}

signed main(){

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    int t;

    cin>>t;

    while(t--){

        int n;

        cin>>n;

        vector<int> v(n);

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

            cin>>v[i];

        }

        solve(v);

    }

    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>

using namespace std;

void solve(vector<int>& v){

    

    

    if(v.size()==1){

        cout<<"YES"<<endl;

        return;

    }

    if(v[1]<v[0]){

        cout<<"NO"<<endl;

        return;

    }

    else if(v[0]==v[1]){

        if(v.size()==2){

            cout<<"YES"<<endl;

            return;

        }

        vector<int> t11(v.begin()+2,v.end());

        solve(t11);

    }

    else{

        cout<<"YES"<<endl;

    }







}

signed main(){

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    int t;

    cin>>t;

    while(t--){

        int n;

        cin>>n;

        vector<int> v(n);

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

            cin>>v[i];

        }

        solve(v);

    }

    return 0;

}

Submission (verdict: Memory limit exceeded on test 6):
#include<bits/stdc++.h>

using namespace std;

void solve(vector<int>& v){

    

    

    if(v.size()==1){

        cout<<"YES"<<endl;

        return;

    }

    if(v[1]<v[0]){

        cout<<"NO"<<endl;

        return;

    }

    v[1]=v[1]-v[0];

    vector<int> tt1(v.begin()+1,v.end());

    solve(tt1);



}

signed main(){

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    int t;

    cin>>t;

    while(t--){

        int n;

        cin>>n;

        vector<int> v(n);

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

            cin>>v[i];

        }

        solve(v);

    }

    return 0;

}