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

Solution 1 (runtime: 46 ms):
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define be begin()
#define en end()
#define pb push_back
#define rev(v) reverse(v.begin(), v.end())
#define srt(v) sort(v.begin(), v.end())
#define srtd(v) sort(v.rbegin(), v.rend())
#define all(v) (v.begin(), v.end())
#define mnv(v) *min_element(v.begin(), v.end())
#define mxv(v) *max_element(v.begin(), v.end())
#define vl vector<ll>
#define vi vector<int>
#define vp vector<pair<ll, ll>>
#define pqmx(type) priority_queue<type>
#define pqmi(type) priority_queue<type, vector<type>, greater<type>>
#define ppi pair<int, pair<int, int>>
#define trav(v) for (auto it = v.begin(); it != v.end(); it++)
#define rep(i, n) for (ll i = 0; i < n; i++)
#define fori(i, a, b) for (ll i = a; i < b; i++)
#define ford(i, s, e) for (ll i = s; i >= e; i--)
#define acc(a) accumulate(a.begin(), a.end(), 0)
#define seea(a, n)             \
    for (ll i = 0; i < n; i++) \
    {                          \
        cin >> a[i];           \
    }
#define seed(a, m, n)              \
    for (ll i = 0; i < m; i++)     \
    {                              \
        for (ll j = 0; j < n; j++) \
        {                          \
            cin >> a[i][j];        \
        }                          \
    }
#define e(x) \
    ll x;    \
    cin >> x;
#define p(x) cout << x;
#define py cout << "YES\n";
#define pn cout << "NO\n";
// calculate and stores all prime numbers from 1 to N
// const ll N = 10000000;
// ll prime[N];
// vector<ll> pr;
// #define SIEVE for (ll i = 2; i < N; i++) { if (prime[i] == 0) { pr.pb(i); for (ll j = i * i; j < N; j += i) { prime[j] = 1; } } prime[i] ^= 1; }
// find GCD inbuilt function in c++ use __gcd(a.b);
// int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a); }
// binary exponentiation or binary power a^b %m
// ll pw(ll a, ll b, ll m) { if (b == 0) return 1; else if (b % 2 == 0) { ll t = pw(a, b / 2, m); return ((t * t) % m); } else { ll t = pw(a, (b - 1) / 2, m); t = (t * t) % m; return ((a * t) % m); } }
// combinators
// const int MOD = 1e9 + 7;
// const int MAXN = 1e6 + 5;
// vector<long long> fact(MAXN), invFact(MAXN);
// long long binpow(long long a, long long b, long long m) { long long res = 1; while (b > 0) { if (b % 2 == 1) { res = res * a % m; } a = a * a % m; b /= 2; } return res; }
// void initFactorials(int n, int mod) { fact[0] = 1; for (int i = 1; i <= n; i++) { fact[i] = fact[i - 1] * i % mod; } invFact[n] = binpow(fact[n], mod - 2, mod); for (int i = n - 1; i >= 0; i--) { invFact[i] = invFact[i + 1] * (i + 1) % mod; } }
// long long binCo(int n, int r, int mod) { if (r < 0 || r > n) return 0; return fact[n] * invFact[r] % mod * invFact[n - r] % mod; }
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t;
    while (t--)
    {
        e(n);
        vl a(n);
        seea(a, n);
        ll s = acc(a);
        while (a.size() > 1)
        {
            vl v;
            ll sum = 0;
            for (int i = 1; i < a.size(); i++)
            {
                v.push_back(a[i] - a[i - 1]);
                sum += a[i] - a[i - 1];
            }
            s = max(s, abs(sum));
            a = v;
        }
        cout << s << endl;
    }
    return 0;
}

Solution 2 (runtime: 77 ms):
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e5 + 5;
typedef pair<int, int> pii;

int n, x, p, m;
int num[55];

void solve()
{
    cin >> n;
    int sum = 0;
    for(int i = 1; i <= n; i ++)
    {
        cin >> num[i];
        sum += num[i];
    }
    int len = n - 1;
    while(len)
    {
        sum = max(abs(num[1] - num[len + 1]), sum);
        for(int i = 1; i <= len; i ++)
        {
            num[i] = num[i + 1] - num[i];
        }
        len -- ;
    }
    cout << sum << endl;
}

signed main()
{
    int T;
    cin >> T;
    while (T--)
    {
        solve();
    }
    return 0;
}