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

Solution 1 (runtime: 62 ms):
// ---------------------------------
// READ { WHOLE } QUESTION PROPERLY. |
// ---------------------------------
// --------------------------------------------
// READ QUESTION CAREFULLY IN EDUCATIONAL ROUND
// --------------------------------------------
// understand question properly and have patience if not able to understand question in first time.
// -----------------------------------------------
// | VERY IMPORTANT : OBSERVE TESTCASES PROPERLY. |
// -----------------------------------------------
// understand question properly and fast.
// don't do faasam faas if you know its easy question or you have to face a lot of repurcussion.
// don't do stupidness in div 4 be calm and do it.
// if not able to do find out solution of any question jump to another question.
// Keep Precomputation in mind if it can be used.
// If questions are done early don't be happy try next question very seriously

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef double dd;
typedef float fl;

const ll N = 1e6 + 7;

vector<ll> binary(ll n)
{
    vector<ll> v;
    while (n != 0)
    {
        v.push_back(n % 2);
        n = n / 2;
    }
    // reverse(v.begin(),v.end());
    return v;
}
const int MOD = 1e9 + 7;
const int MAX_N = 2.1e5 + 1;
vector<long long> fact(MAX_N);
vector<long long> invFact(MAX_N);
void precomputeFactorials()
{
    fact[0] = 1;
    for (int i = 1; i < MAX_N; ++i)
    {
        fact[i] = (fact[i - 1] * i) % MOD;
    }
}
long long modInverse(long long x, long long mod)
{
    long long result = 1, power = mod - 2;
    while (power)
    {
        if (power & 1)
            result = (result * x) % mod;
        x = (x * x) % mod;
        power >>= 1;
    }
    return result;
}
void precomputeInvFactorials()
{
    for (int i = 0; i < MAX_N; ++i)
    {
        invFact[i] = modInverse(fact[i], MOD);
    }
}
long long comb(int n, int k)
{
    if (k > n || k < 0)
        return 0;
    return fact[n] * invFact[k] % MOD * invFact[n - k] % MOD;
}
ll power(ll a, ll b)
{
    ll ans = 1;
    while (b)
    {
        if (b & 1)
            ans = ans * a;
        a = a * a;
        b >>= 1;
    }
    return ans;
}

vector<bool> isPrime(N, 1);

bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
{
    return a.second < b.second;
}

int main()
{
    //   isPrime[0]=isPrime[1]=false;
    //   for(int i=2;i*i < N;i++){
    //       if(isPrime[i]==true){
    //           for(int j=2*i;j<N;j+=i){
    //               isPrime[j]=false;
    //           }
    //       }
    //   }

    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);

    int t = 1;
    cin >> t;
    while (t--)
    {
        ll n;
        cin >> n;
        vector<ll> v(n);
        for (ll i = 0; i < n; i++)
        {
            cin >> v[i];
        }
        ll ans=v[0];
        while (v.size()>1)
        {
            ll sum = 0;
            for (int i = 0; i < v.size(); i++)
            {
                sum += v[i];
            }
            vector<ll> w1;
            ll sum1 = 0;
            for (ll i = 0; i < v.size() - 1; i++)
            {
                w1.push_back(v[i + 1] - v[i]);
                sum1 += v[i + 1] - v[i];
            }
            v=w1;
            ans=max(ans,max(sum,max(sum1,(-1)*sum1)));
        }
        cout << ans << "\n";
    }
    return 0;
}

Solution 2 (runtime: 46 ms):
#include <algorithm>
#include <bits/stdc++.h>
#include <cstdint>
#include <vector>
#define sz(x) (int)x.size()
#define fi first
#define se second
#define DBG(x) cout << #x << " = " << x << '\n';
#define DBGS(x) cout << #x << " = " << x << ", ";
#define all(x) x.begin() , x.end()
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vpll;
     
const ll mod = 1e9+7;

const ll  cc = 998244353;


int nxt() {
    int x; cin >> x;
    return x;
}  
const int inf = INT_MAX;
template<typename T>
T minV(T a){
    return a;
}
template<typename T, typename ... Args>
T minV(T a , Args... arg){
    T b = minVariadic(arg...);
    return min(a,b);
}
int n,m;

const int mx = 2e5 + 5;

vector<pii> dir = { {0,1} , {0,-1} , {1,0} , {-1,0} };

bool isIn(int x,int y){
    return x >= 0 && x < n && y >= 0 && y < m;
}

void slv(){
    cin>>n;
    vl a(n);
    for(ll& i : a) cin>>i;

    ll ans = 0;
    for(ll& i : a) ans += i;

    for(int k = 1 ; k <= n-1 ; k++){
        vl b;
        ll s = 0;
        for(int i = 1 ; i < sz(a) ; i++) b.push_back(a[i] - a[i-1]);
        for(ll& i : b) s += i;
        ans = max(ans,s);
        ans = max(ans,-1*s);
        a = b;
    }

    cout<<ans<<"\n";
    
}   
     
int main(){
    int t = 1; cin>>t;
    while(t--) slv();
    return 0;
}