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

Solution 1 (runtime: 62 ms):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
using namespace __gnu_pbds;
using namespace std;
using namespace chrono;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
// A.find_by_order(x), A.order_of_key(x)
#define int long long
#define pb push_back
#define pbb pop_back
#define float long double
#define mp make_pair
#define MOD 1000000007 // 998244353
#define INF 1e18
#define set_bits(x) __builtin_popcountll(x)
#define sp " "
#define endl "\n"
#define all(v) (v).begin(), (v).end()
#define PIE acos(-1)
#define F first
#define S second
#define rez(v, n) v.resize(n);
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = b; i >= a; i--)
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef vector<vector<int>> vvi;

int ansg = INF;

int rec(vector<int> &a, int revallowed)
{
    if (a.size() == 1)
        return a[0];

    ansg = max(ansg, accumulate(all(a), 0LL));
    int n = a.size();
    int ans = -INF;
    if (revallowed)
    {
        reverse(all(a));
        ans = max(ans, rec(a, 0));
    }
    for (int i = 0; i <= n - 2; i++)
    {
        a[i] = a[i + 1] - a[i];
    }
    a.pop_back();
    ans = max(ans, rec(a, 1));
    return ans;
}

void solve()
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, 0, n) cin >> a[i];
    ansg = -INF;
    while (a.size() >= 1)
    {
        int sum = accumulate(all(a), 0LL);
        if (a.size() == n)
            ansg = max(ansg, sum);
        else
            ansg = max(ansg, max(sum, -1 * sum));
        for (int i = 0; i < n - 1; i++)
        {
            a[i] = a[i + 1] - a[i];
        }
        a.pop_back();
    }
    cout<<ansg<<endl;
}
signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    auto start1 = high_resolution_clock::now();
    int t;
    t = 1;
    cin >> t;
    rep(testcase, 0, t) solve();
    auto stop1 = high_resolution_clock::now();
    auto duration = duration_cast<microseconds>(stop1 - start1);
#ifndef ONLINE_JUDGE
    cerr << "Time: " << duration.count() / 1000 << " ms" << endl;
#endif
}

Solution 2 (runtime: 61 ms):
// source problem : 
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
#define int long long
#define lb lower_bound
#define ub upper_bound
#define MASK(i) (1LL << (i))
const int inf = 1e18;
void ckmax(int& f, int s)
{
    f = (f > s ? f : s);
}
void ckmin(int& f, int s)
{
    f = (f < s ? f : s);
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vector<int> a(n);
        for (int &i : a) cin >> i;
        n--;
        int ans = accumulate(all(a), 0);
        while (n--)
        {
            for (int i = 1; i < a.size(); i++)
            {
                a[i - 1] = a[i] - a[i - 1];
            }
            a.pop_back();
            ckmax(ans, abs(accumulate(all(a), 0LL)));
        }
        cout << ans << '\n';
    }   
    return 0;
}