Problem: 2062C - Cirno and Operations
Language: c++17 

Code 1:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define ld long double
#define pll pair<ll,ll>
#define pllv pair<ll,vector<ll>>
#define all(a) a.begin(),a.end()
#define ump unordered_map
#define  deb1(a)        cout<<a<<endl;
#define  deb2(a,b)      cout<<a<<" "<<b<<"\n";
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());
#define DEATH_NOTE ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15);
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define rep(a,b) for(ll i=a;i<b;i++)
//const ll sz=1001;
const ll mod=1e9+7;
const ll INF=1e18+10;

void solve()
{
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll ans = -INF;
    for(ll i=0;i<n;i++) cin>>a[i];
    vector<ll> v = a;
    if(v.size()== 1) {
        cout<<v[0]<<endl;
        return;
    }
    while(v.size()>1) {
        ll stSum = 0;
        for(ll i=0;i<v.size();i++) stSum+=v[i];
        ans=max(ans,abs(stSum));
        ll reducedSum = 0;
        vector<ll> reducedV;
        for(ll i=1;i<v.size();i++) {
            reducedV.push_back(v[i]-v[i-1]);
            reducedSum+=(v[i]-v[i-1]);
        }
        ans=max(ans,abs(reducedSum));
        v=reducedV;
    }
    cout<<ans<<endl;
}
int main()
{
    DEATH_NOTE

    ll t;
    t=1;
    cin>>t;
    while(t--)
    {
        solve();
    }
}


Code 2:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define ll long long
#define endl "\n"
#define pb push_back
#define ff first
#define ss second
#define ld long double
#define pll pair<ll,ll>
#define pllv pair<ll,vector<ll>>
#define all(a) a.begin(),a.end()
#define ump unordered_map
#define  deb1(a)        cout<<a<<endl;
#define  deb2(a,b)      cout<<a<<" "<<b<<"\n";
#define  deb3(a,b,c)    cout<<a<<" "<<b<<" "<<c<<"\n";
#define  deb4(a,b,c,d)  cout<<a<<" "<<b<<" "<<c<<" "<<d<<"\n";
#define  uniq(a)        a.resize(unique(a.begin(), a.end()) - a.begin());
#define DEATH_NOTE ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(15);
#define vll vector<ll>
#define vvll vector<vector<ll>>
#define rep(a,b) for(ll i=a;i<b;i++)
//const ll sz=1001;
const ll mod=1e9+7;
const ll INF=1e18+10;

void solve()
{
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll ans = -INF;
    for(ll i=0;i<n;i++) cin>>a[i];
    vector<ll> v = a;
    if(v.size()== 1) {
        cout<<v[0]<<endl;
        return;
    }
    while(v.size()>1) {
        ll stSum = 0;
        for(ll i=0;i<v.size();i++) stSum+=v[i];
        ans=max(ans,stSum);
        ll reducedSum = 0;
        vector<ll> reducedV;
        for(ll i=1;i<v.size();i++) {
            reducedV.push_back(v[i]-v[i-1]);
            reducedSum+=(v[i]-v[i-1]);
        }
        ans=max(ans,abs(reducedSum));
        v=reducedV;
    }
    cout<<ans<<endl;
}
int main()
{
    DEATH_NOTE

    ll t;
    t=1;
    cin>>t;
    while(t--)
    {
        solve();
    }
}


Answer: 2