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

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std; 
 
//KEVAL MORI//
 
#define Jay ios_base::sync_with_stdio(false);
#define Shree cin.tie(NULL);
#define Ram cout.tie(NULL);
#define read(n) long long int n;cin>>n;
#define tread(a,b) long long int a,b;cin>>a>>b;
#define thread(a,b,c) long long int a,b,c;cin>>a>>b>>c;
#define fread(a,b,c,d) long long int a,b,c,d; cin>>a>>b>>c>>d;
#define vread(v) for(int i=0;i<v.size();i++) cin>>v[i];
#define vvread(v) for(int i=0;i<v.size();i++) {for(int j=0;j<v[i].size();j++) cin>>v[i][j];}
#define lli long long int
#define ll long long
#define MOD 1000000007
#define ld long double
#define f(i,x,n) for(ll i = x; i < n; i++)
#define rf(i,x,n) for(ll i = x; i >= n; i--)
#define fr(i,m) for(auto &i:m)
#define vl vector<long long int>
#define vvl vector<vector<long long int>>
#define vs vector<string>
#define vpl vector<pair<long long int,long long int>>
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(a) (a).rbegin(), (a).rend()
#define rll(v) (v).begin(), (v).end(),greater<ll>()
#define sl set<long long int>
#define ss set<string>
#define mll map<long long int,long long int>
#define mss map<string,string>
#define msl map<string,long long int>
#define mls map<long long int,string>
#define pl pair<long long int,long long int>
#define fi first
#define se second
#define PI (3.141592653589)
#define maxar *max_element
#define minar *min_element
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) (all(x)), x.erase(unique(all(x)), x.end())
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define nope cout<<-1<<endl
#define pv(v) for (int i = 0; i < v.size(); i++) cout<<v[i]<<" "; 
#define pvv(v) for(int i=0;i<v.size();i++){ for(int j=0;j<v[i].size();j++) {cout<<v[i][j]<<" ";}cout<<endl;}
bool isPrime(ll n){if(n<=1) return false; if(n<=3) return true; if(n%2==0 || n%3==0) return false; for(ll i=5; i*i<=n; i+=6) {if(n%i==0 || n%(i+2)==0) return false;} return true;}
bool isPerfectSquare(ll x){if(x>=0){ll sr=sqrt(x);return (sr*sr==x);}}
bool isInteger(double n){return floor(n)==n;}

void solve()
{
    read(n);
    vl a(n);
    vread(a);

    lli ans=accumulate(all(a),0LL),sum=0;

    lli limit=n-1;
    while(limit>0)
    {
        for (int i= 0; i < limit; i++) {
            a[i]=(a[i]-a[i+1]);
            sum+=abs(a[i]);
        }
        limit--;
        ans=max(sum,ans);
        sum=0;
    }
    cout<<ans<<endl;

}
int main()
{
    Jay Shree Ram

    int t;
    cin >> t;

    while (t--)
    {
        solve();
    }

    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std; 
 
//KEVAL MORI//
 
#define Jay ios_base::sync_with_stdio(false);
#define Shree cin.tie(NULL);
#define Ram cout.tie(NULL);
#define read(n) long long int n;cin>>n;
#define tread(a,b) long long int a,b;cin>>a>>b;
#define thread(a,b,c) long long int a,b,c;cin>>a>>b>>c;
#define fread(a,b,c,d) long long int a,b,c,d; cin>>a>>b>>c>>d;
#define vread(v) for(int i=0;i<v.size();i++) cin>>v[i];
#define vvread(v) for(int i=0;i<v.size();i++) {for(int j=0;j<v[i].size();j++) cin>>v[i][j];}
#define lli long long int
#define ll long long
#define MOD 1000000007
#define ld long double
#define f(i,x,n) for(ll i = x; i < n; i++)
#define rf(i,x,n) for(ll i = x; i >= n; i--)
#define fr(i,m) for(auto &i:m)
#define vl vector<long long int>
#define vvl vector<vector<long long int>>
#define vs vector<string>
#define vpl vector<pair<long long int,long long int>>
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(a) (a).rbegin(), (a).rend()
#define rll(v) (v).begin(), (v).end(),greater<ll>()
#define sl set<long long int>
#define ss set<string>
#define mll map<long long int,long long int>
#define mss map<string,string>
#define msl map<string,long long int>
#define mls map<long long int,string>
#define pl pair<long long int,long long int>
#define fi first
#define se second
#define PI (3.141592653589)
#define maxar *max_element
#define minar *min_element
#define LB(c, x) distance((c).begin(), lower_bound(all(c), (x)))
#define UB(c, x) distance((c).begin(), upper_bound(all(c), (x)))
#define UNIQUE(x) (all(x)), x.erase(unique(all(x)), x.end())
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define nope cout<<-1<<endl
#define pv(v) for (int i = 0; i < v.size(); i++) cout<<v[i]<<" "; 
#define pvv(v) for(int i=0;i<v.size();i++){ for(int j=0;j<v[i].size();j++) {cout<<v[i][j]<<" ";}cout<<endl;}
bool isPrime(ll n){if(n<=1) return false; if(n<=3) return true; if(n%2==0 || n%3==0) return false; for(ll i=5; i*i<=n; i+=6) {if(n%i==0 || n%(i+2)==0) return false;} return true;}
bool isPerfectSquare(ll x){if(x>=0){ll sr=sqrt(x);return (sr*sr==x);}}
bool isInteger(double n){return floor(n)==n;}

void solve()
{
    read(n);
    vl a(n);
    vread(a);

    lli ans=accumulate(all(a),0LL),sum=0;

    lli limit=n-1;
    while(limit>0)
    {
        for (int i= 0; i < limit; i++) {
            a[i]=(a[i]-a[i+1]);
           if(limit!=1) sum+=abs(a[i]);
           else sum+=a[i];
        }
        limit--;
        ans=max(sum,ans);
        sum=0;
    }
    cout<<ans<<endl;

}
int main()
{
    Jay Shree Ram

    int t;
    cin >> t;

    while (t--)
    {
        solve();
    }

    return 0;
}