ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2049C - MEX Cycle
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include<set>

#include<map>

#include<ctime>

#include<queue>

#include<stack>

#include<cmath>

#include<vector>

#include<cstdio>

#include<cstdlib>

#include<cstring>

#include<iostream>

#include<algorithm>



#define int long long



using namespace std;



const int N = 1e6 + 100;

const int MOD = 998244353;

const int INF = 1e18 + 7;



int gi()

{

   int s=0,f=1;char ch=getchar();

   while(!(ch>='0'&&ch<='9')) f=(ch=='-'?-1:1),ch=getchar();

   while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();

   return s*f;

}



int PRINT[333];

void print(int x)

{

    if(!x) 

    {

        putchar('0');

        return;

    }

    if(x<0) putchar('-'),x=-x;

    int ppp=0;

    while(x) PRINT[++ppp]=x%10,x/=10;

    for(int i=ppp;i>=1;--i) putchar(PRINT[i]+'0');

}



int T;

int n,m;

int A[N],B[N];

char ch[N];



signed main()

{

    T=gi();

    while(T--)

    {

        n=gi();

        int x=gi(),y=gi();

        if(n&1)

        {

            for(int i=1;i<n;++i) A[i]=i&1;

            A[n]=2;

        }

        else

        {

            for(int i=1;i<=n;++i) A[i]=i&1;

        }

        if(A[x]!=A[y])

        {

            for(int i=1;i<=n;++i) printf("%d ",A[i]);

            putchar('\n');

            continue;

        }

        if(A[x]==0)

        {

            if((n&1)&&(x==1||x==n-1)) A[x]=3;

            else A[x]=2;

        }

        else

        {

            if((n&1)&&(x==1||x==n-1)) A[x]=3;

            else A[x]=2;

        }

        for(int i=1;i<=n;++i) printf("%d ",A[i]);

        putchar('\n');

    }

}
Problem: 2063B - Subsequence Update
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--) {
       long n, l, r;
        cin >> n >> l >> r;
        vector<long> v(n);
        
        
        // int x = 0;

        for (int i = 0; i < n; ++i) {
            cin >> v[i];
           
            
        }
        vector<long>v1;
        vector<long>v2;
        for (int i = 0; i <=r-1; ++i)
        {
            v1.push_back(v[i]);
            /* code */
        }
        sort(v1.begin(),v1.end());
        for (int i =0; i <n; ++i)
        { 
           v2.push_back(v[i]);
            /* code */
        }
        
        long x = r-l+1;
        long sum1 =0;
        long sum2 =0;

        for (int i = 0; i <x; ++i)
        {
            sum1+=v1[i];

            /* code */
        }
        sort(v2.begin(),v2.end());
        for (int i = 0; i <x; ++i)
        {
            // cout<<v2[i]<<" ";
            sum2+=v2[i];

            /* code */
        }
        cout<<min(sum1,sum2)<<endl;
           }
}
       

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

using namespace std;



int main() {

    int t;

    cin >> t;

    while (t--) {

       long n, l, r;

        cin >> n >> l >> r;

        vector<long> v(n);

        

        

        // int x = 0;



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

            cin >> v[i];

           

            

        }

        vector<long>v1;

        vector<long>v2;

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

        {

            v1.push_back(v[i]);

            /* code */

        }

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

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

        { 

           v2.push_back(v[i]);

            /* code */

        }

        

        long x = r-l+1;

        long sum1 =0;

        long sum2 =0;



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

        {

            sum1+=v1[i];



            /* code */

        }

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

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

        {

            // cout<<v2[i]<<" ";

            sum2+=v2[i];



            /* code */

        }

        cout<<min(sum1,sum2)<<endl;

           }

}
Problem: 2063B - Subsequence Update
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--) {
       long n, l, r;
        cin >> n >> l >> r;
        vector<long> v(n);
        
        
        // int x = 0;

        for (int i = 0; i < n; ++i) {
            cin >> v[i];
           
            
        }
        vector<long>v1;
        vector<long>v2;
        for (int i = 0; i <=r-1; ++i)
        {
            v1.push_back(v[i]);
            /* code */
        }
        sort(v1.begin(),v1.end());
        for (int i =0; i <n; ++i)
        { 
           v2.push_back(v[i]);
            /* code */
        }
        
        long x = r-l+1;
        long sum1 =0;
        long sum2 =0;

        for (int i = 0; i <x; ++i)
        {
            sum1+=v1[i];

            /* code */
        }
        sort(v2.begin(),v2.end());
        for (int i = 0; i <x; ++i)
        {
            // cout<<v2[i]<<" ";
            sum2+=v2[i];

            /* code */
        }
        cout<<min(sum1,sum2)<<endl;
           }
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

using namespace std;



int main() {

    int t;

    cin >> t;

    while (t--) {

       long n, l, r;

        cin >> n >> l >> r;

        vector<long> v(n);

        

        

        // int x = 0;



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

            cin >> v[i];

           

            

        }

        vector<long>v1;

        vector<long>v2;

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

        {

            v1.push_back(v[i]);

            /* code */

        }

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

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

        { 

           v2.push_back(v[i]);

            /* code */

        }

        

        long x = r-l+1;

        long sum1 =0;

        long sum2 =0;



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

        {

            sum1+=v1[i];



            /* code */

        }

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

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

        {

            // cout<<v2[i]<<" ";

            sum2+=v2[i];



            /* code */

        }

        cout<<min(sum1,sum2)<<endl;

           }

}

       

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

int main() {
    int t;
    cin >> t;
    while (t--) {
       long n, l, r;
        cin >> n >> l >> r;
        vector<long long> v(n);
        
        
        // int x = 0;

        for (int i = 0; i < n; ++i) {
            cin >> v[i];
           
            
        }
        vector<long long>v1;
        vector<long long>v2;
        for (int i = 0; i <=r-1; ++i)
        {
            v1.push_back(v[i]);
            /* code */
        }
        sort(v1.begin(),v1.end());
        for (int i =l-1; i <n; ++i)
        { 
           v2.push_back(v[i]);
            /* code */
        }
        
        long x = r-l+1;
        long long sum1 =0;
        long long sum2 =0;

        for (int i = 0; i <x; ++i)
        {
            sum1+=v1[i];

            /* code */
        }
        sort(v2.begin(),v2.end());
        for (int i = 0; i <x; ++i)
        {
            // cout<<v2[i]<<" ";
            sum2+=v2[i];

            /* code */
        }
        cout<<min(sum1,sum2)<<endl;
           }
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)


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>
#define  nn                     cout<<"NO"<<endl
#define  hh                     cout<<"YES"<<endl
#define all(x)                   x.begin(),x.end()
#define rall(x)                 x.rbegin(),x.rend()
#define ct(x)                   cout<<x<<endl
#define TT                      TALHA TASEEN
using namespace std;
using ll = long long;
bool isPrime(ll n)
{
    for(int i=2;i*i<=n;i++)   if(n%i==0) return false;
    return true;
}
ll gcd(ll a,ll b)                   {return (__gcd(a,b));}
ll lcm(ll a,ll b)                   {return (a/(gcd(a,b))*b);}
void talha();
int  main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--)talha();
    return 0;
}
void talha()
{
    int n;
    cin>>n;
    vector<ll>v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    int ans=0;
    for(int i=0;i<n-1;i++)
    {
        if(v[i]<=v[i+1])
        {
            i++;
            ans=i;
        }
    }
    cout<<ans<<endl;
    if(n%2==1)
    {
        if(v[n-1]>=v[n-2])hh;
        else nn;
    }
    else
    {
        if(ans==n-1)hh;
        else nn;
    }
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

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>
#define  nn                     cout<<"NO"<<endl
#define  hh                     cout<<"YES"<<endl
#define all(x)                   x.begin(),x.end()
#define rall(x)                 x.rbegin(),x.rend()
#define ct(x)                   cout<<x<<endl
#define TT                      TALHA TASEEN
using namespace std;
using ll = long long;
bool isPrime(ll n)
{
    for(int i=2;i*i<=n;i++)   if(n%i==0) return false;
    return true;
}
ll gcd(ll a,ll b)                   {return (__gcd(a,b));}
ll lcm(ll a,ll b)                   {return (a/(gcd(a,b))*b);}
void talha();
int  main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--)talha();
    return 0;
}
void talha()
{
    int n;
    cin>>n;
    vector<ll>v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    int ans=0;
    for(int i=0;i<n-1;i++)
    {
        if(v[i]<=v[i+1])
        {
            i++;
            ans=i;
        }
    }
    cout<<ans<<endl;
    if(n%2==1)
    {
        if(v[n-1]>=v[n-2])hh;
        else nn;
    }
    else
    {
        if(ans==n-1)hh;
        else nn;
    }
}


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>
#define  nn                     cout<<"NO"<<endl
#define  hh                     cout<<"YES"<<endl
#define all(x)                   x.begin(),x.end()
#define rall(x)                 x.rbegin(),x.rend()
#define ct(x)                   cout<<x<<endl
#define TT                      TALHA TASEEN
using namespace std;
using ll = long long;
bool isPrime(ll n)
{
    for(int i=2;i*i<=n;i++)   if(n%i==0) return false;
    return true;
}
ll gcd(ll a,ll b)                   {return (__gcd(a,b));}
ll lcm(ll a,ll b)                   {return (a/(gcd(a,b))*b);}
void talha();
int  main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--)talha();
    return 0;
}
void talha()
{
    int n;
    cin>>n;
    vector<ll>v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    int ans=0;
    for(int i=0;i<n-1;i++)
    {
        if(v[i]<=v[i+1])
        {
            i++;
            ans=i;
        }
    }
    if(n%2==1)
    {
        if(v[n-1]>=v[n-2])hh;
        else nn;
    }
    else
    {
        if(ans==n-1)hh;
        else nn;
    }
}
Problem: 2060D - Subtract Min Sort
Language: C++23 (GCC 14-64, msys2)

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>
#define  nn                     cout<<"NO"<<endl
#define  hh                     cout<<"YES"<<endl
#define all(x)                   x.begin(),x.end()
#define rall(x)                 x.rbegin(),x.rend()
#define ct(x)                   cout<<x<<endl
#define TT                      TALHA TASEEN
using namespace std;
using ll = long long;
bool isPrime(ll n)
{
    for(int i=2;i*i<=n;i++)   if(n%i==0) return false;
    return true;
}
ll gcd(ll a,ll b)                   {return (__gcd(a,b));}
ll lcm(ll a,ll b)                   {return (a/(gcd(a,b))*b);}
void talha();
int  main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--)talha();
    return 0;
}
void talha()
{
    int n;
    cin>>n;
    vector<ll>v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    int ans=0;
    for(int i=0;i<n-1;i++)
    {
        if(v[i]<=v[i+1])
        {
            i++;
            ans=i;
        }
    }
    if(n%2==1)
    {
        if(v[n-1]>=v[n-2])hh;
        else nn;
    }
    else
    {
        if(ans==n-1)hh;
        else nn;
    }
}


Submission (verdict: Accepted):
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define  nn                     cout<<"NO"<<endl
#define  hh                     cout<<"YES"<<endl
#define all(x)                   x.begin(),x.end()
#define rall(x)                 x.rbegin(),x.rend()
#define ct(x)                   cout<<x<<endl
#define TT                      TALHA TASEEN
using namespace std;
using ll = long long;
bool isPrime(ll n)
{
    for(int i=2;i*i<=n;i++)   if(n%i==0) return false;
    return true;
}
ll gcd(ll a,ll b)                   {return (__gcd(a,b));}
ll lcm(ll a,ll b)                   {return (a/(gcd(a,b))*b);}
void talha();
int  main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--)talha();
    return 0;
}
void talha()
{
    int n;
    cin>>n;
    vector<ll>v(n);
    for(int i=0;i<n;i++)cin>>v[i];
    int ans=0;
    for(int i=0;i<n-1;i++)
    {
        ll bal=min(v[i],v[i+1]);
        v[i]-=bal;
        v[i+1]-=bal;
    }
    if(is_sorted(all(v))) hh;
    else nn;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

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>
#define  nn                     cout<<"NO"<<endl
#define  hh                     cout<<"YES"<<endl
#define all(x)                   x.begin(),x.end()
#define rall(x)                 x.rbegin(),x.rend()
#define ct(x)                   cout<<x<<endl
#define TT                      TALHA TASEEN
using namespace std;
using ll = long long;
bool isPrime(ll n)
{
    for(int i=2; i*i<=n; i++)   if(n%i==0) return false;
    return true;
}
ll gcd(ll a,ll b)
{
    return (__gcd(a,b));
}
ll lcm(ll a,ll b)
{
    return (a/(gcd(a,b))*b);
}
void talha();
int  main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--)talha();
    return 0;
}
void talha()
{
    int n;
    cin>>n;
    vector<int>v(n),vv;
    ll sm=0,ans=0;
    for(int i=0; i<n; i++)
    {
        cin>>v[i];
        sm+=v[i];
    }
    while(n>1)
    {
        ans=0;
        for(int j=0; j<n-1; j++)vv.push_back(v[j+1]-v[j]);
//        for(auto x:vv)
//        {
//            cout<<x<<" ";
//        }
//        cout<<endl;
        for(int j=0; j<vv.size(); j++)ans+=vv[j];
        sm=max(sm,abs(ans));
        for(int i=0; i<n-1; i++)v[i]=vv[i];
        vv.clear(),n--;
    }
    ct(sm);
}



Submission (verdict: Accepted):
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define  nn                     cout<<"NO"<<endl
#define  hh                     cout<<"YES"<<endl
#define all(x)                   x.begin(),x.end()
#define rall(x)                 x.rbegin(),x.rend()
#define ct(x)                   cout<<x<<endl
#define TT                      TALHA TASEEN
using namespace std;
using ll = long long;
bool isPrime(ll n)
{
    for(int i=2; i*i<=n; i++)   if(n%i==0) return false;
    return true;
}
ll gcd(ll a,ll b)
{
    return (__gcd(a,b));
}
ll lcm(ll a,ll b)
{
    return (a/(gcd(a,b))*b);
}
void talha();
int  main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--)talha();
    return 0;
}
void talha()
{
    ll n;
    cin>>n;
    vector<ll>v(n),vv;
    ll sm=0,ans=0;
    for(int i=0; i<n; i++)
    {
        cin>>v[i];
        sm+=v[i];
    }
    while(n>1)
    {
        ans=0;
        for(int j=0; j<n-1; j++)vv.push_back(v[j+1]-v[j]);
        for(int j=0; j<vv.size(); j++)ans+=vv[j];
        sm=max(sm,abs(ans));
        for(int i=0; i<n-1; i++)v[i]=vv[i];
        vv.clear(),n--;
    }
    ct(sm);
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

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>
#define  nn                     cout<<"NO"<<endl
#define  hh                     cout<<"YES"<<endl
#define all(x)                   x.begin(),x.end()
#define rall(x)                 x.rbegin(),x.rend()
#define ct(x)                   cout<<x<<endl
#define TT                      TALHA TASEEN
using namespace std;
using ll = long long;
bool isPrime(ll n)
{
    for(int i=2; i*i<=n; i++)   if(n%i==0) return false;
    return true;
}
ll gcd(ll a,ll b)
{
    return (__gcd(a,b));
}
ll lcm(ll a,ll b)
{
    return (a/(gcd(a,b))*b);
}
void talha();
int  main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--)talha();
    return 0;
}
void talha()
{
    ll n;
    cin >> n;
    vector<ll> v(n);
    ll sm = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
        sm += v[i];
    }
    while (n > 1)
    {
        ll ans = 0;
        for (int j = 0; j < n - 1; j++)
        {
            v[j] = v[j + 1] - v[j];
            ans += abs(v[j]);
        }
        sm = max(sm, ans);
        n--;
    }
    ct(sm);
}


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>
#define  nn                     cout<<"NO"<<endl
#define  hh                     cout<<"YES"<<endl
#define all(x)                   x.begin(),x.end()
#define rall(x)                 x.rbegin(),x.rend()
#define ct(x)                   cout<<x<<endl
#define TT                      TALHA TASEEN
using namespace std;
using ll = long long;
bool isPrime(ll n)
{
    for(int i=2; i*i<=n; i++)   if(n%i==0) return false;
    return true;
}
ll gcd(ll a,ll b)
{
    return (__gcd(a,b));
}
ll lcm(ll a,ll b)
{
    return (a/(gcd(a,b))*b);
}
void talha();
int  main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--)talha();
    return 0;
}
void talha()
{
    int n;
    cin>>n;
    vector<int>v(n),vv;
    ll sm=0,ans=0;
    for(int i=0; i<n; i++)
    {
        cin>>v[i];
        sm+=v[i];
    }
    while(n>1)
    {
        ans=0;
        for(int j=0; j<n-1; j++)vv.push_back(v[j+1]-v[j]);
//        for(auto x:vv)
//        {
//            cout<<x<<" ";
//        }
//        cout<<endl;
        for(int j=0; j<vv.size(); j++)ans+=vv[j];
        sm=max(sm,abs(ans));
        for(int i=0; i<n-1; i++)v[i]=vv[i];
        vv.clear(),n--;
    }
    ct(sm);
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

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>
#define  nn                     cout<<"NO"<<endl
#define  hh                     cout<<"YES"<<endl
#define all(x)                   x.begin(),x.end()
#define rall(x)                 x.rbegin(),x.rend()
#define ct(x)                   cout<<x<<endl
#define TT                      TALHA TASEEN
using namespace std;
using ll = long long;
bool isPrime(ll n)
{
    for(int i=2; i*i<=n; i++)   if(n%i==0) return false;
    return true;
}
ll gcd(ll a,ll b)
{
    return (__gcd(a,b));
}
ll lcm(ll a,ll b)
{
    return (a/(gcd(a,b))*b);
}
void talha();
int  main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--)talha();
    return 0;
}
void talha()
{
    int n;
    cin >> n;
    vector<int> v(n);
    ll sm = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
        sm += v[i];
    }
    while (n > 1)
    {
        ll ans = 0;
        for (int j = 0; j < n - 1; j++)
        {
            v[j] = v[j + 1] - v[j];
            ans += abs(v[j]);
        }
        sm = max(sm, ans);
        n--;
    }
    ct(sm);
}


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>
#define  nn                     cout<<"NO"<<endl
#define  hh                     cout<<"YES"<<endl
#define all(x)                   x.begin(),x.end()
#define rall(x)                 x.rbegin(),x.rend()
#define ct(x)                   cout<<x<<endl
#define TT                      TALHA TASEEN
using namespace std;
using ll = long long;
bool isPrime(ll n)
{
    for(int i=2; i*i<=n; i++)   if(n%i==0) return false;
    return true;
}
ll gcd(ll a,ll b)
{
    return (__gcd(a,b));
}
ll lcm(ll a,ll b)
{
    return (a/(gcd(a,b))*b);
}
void talha();
int  main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--)talha();
    return 0;
}
void talha()
{
    ll n;
    cin >> n;
    vector<ll> v(n);
    ll sm = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
        sm += v[i];
    }
    while (n > 1)
    {
        ll ans = 0;
        for (int j = 0; j < n - 1; j++)
        {
            v[j] = v[j + 1] - v[j];
            ans += abs(v[j]);
        }
        sm = max(sm, ans);
        n--;
    }
    ct(sm);
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)


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>
#define  nn                     cout<<"NO"<<endl
#define  hh                     cout<<"YES"<<endl
#define all(x)                   x.begin(),x.end()
#define rall(x)                 x.rbegin(),x.rend()
#define ct(x)                   cout<<x<<endl
#define TT                      TALHA TASEEN
using namespace std;
using ll = long long;
bool isPrime(ll n)
{
    for(int i=2; i*i<=n; i++)   if(n%i==0) return false;
    return true;
}
ll gcd(ll a,ll b)
{
    return (__gcd(a,b));
}
ll lcm(ll a,ll b)
{
    return (a/(gcd(a,b))*b);
}
void talha();
int  main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    cin>>t;
    while(t--)talha();
    return 0;
}
void talha()
{
    int n;
    cin >> n;
    vector<int> v(n);
    ll sm = 0;
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
        sm += v[i];
    }
    while (n > 1)
    {
        ll ans = 0;
        for (int j = 0; j < n - 1; j++)
        {
            v[j] = v[j + 1] - v[j];
            ans += abs(v[j]);
        }
        sm = max(sm, ans);
        n--;
    }
    ct(sm);
}