Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define debug(x) cout << #x << " = " << x << "\n";
#define vdebug(a) cout << #a << " = "; for(auto x: a) cout << x << " "; cout << "\n";

#define line "\n"
#define NO cout << "NO" << line
#define YES cout << "YES" << line
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define F0R(i, s, n) for(int i = (s); i < (n); i++)
#define ROF(i, n) for(int i = (n) - 1; i >= 0; --i)
#define R0F(i, e, n) for(int i = (n) - 1; i >= (e); --i)
#define pb push_back
#define eb emplace_back
#define mp make_pair

using ll = long long;
using ull = unsigned long long;
using ld = long double;

template<typename T1, typename T2>
using gpht = gp_hash_table<T1, T2>;

template<typename T> using V = vector<T>;
using vi = V<int>;
using vll = V<ll>;
using vld = V<ld>;
using vvi = V<vi>;
using vvll = V<vll>;
using vvld = V<vld>;
using vb = V<bool>;
using vpi = V<pair<int, int>>;
using vpll = V<pair<ll, ll>>;
using vvpi = V<vpi>;
using vvpll = V<vpll>;
using vs = V<string>;
using vc = V<char>;
using vvc = V<vc>;

template<typename T>
istream &operator>>(istream &is, V<T> &v) {
    for(auto &x: v)
        is >> x;
    return is;
}

template<typename T>
ostream &operator<<(ostream &os, const V<T> &v) {
    for(auto &x: v)
        os << x << " ";
    return os;
}

template<typename T>
istream &operator>>(istream &is, V<V<T>> &v) {
    for(auto &x: v)
        cin >> x;
    return is;
}
 
template<typename T>
ostream &operator<<(ostream &os, const V<V<T>> &v) {
    for(auto &x: v)
        cout << x << "\n";
    return os;
}

int mod = 998244353;

void solve() {
    int n; cin >> n;
    vll a(n); cin >> a;
    ll ans = accumulate(a.begin(), a.end(), 0LL);
    for(int i = 0; i < n; i++) {
        ll sum = 0;
        for(int j = 0; j < n - i; j++) {
            sum += a[j];
        }
        if(n == 1) ans = max(ans, sum);
        else ans = max(ans, max(sum, -sum));
        for(int j = 0; j < n - i - 1; j++) {
            a[j] = a[j + 1] - a[j];
        }
    }
    cout << ans << line;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int tt = 1;
    cin >> tt;
    while(tt--) {
        solve();
    }
    return 0;
}

/* 
 * stuff you should look for
 * int overflow, array bounds
 * special cases (n=1?)
 * do smth instead of nothing and stay organized
 * WRITE STUFF DOWN 
 * DON'T GET STUCK ON ONE APPROACH
 * if you think that solution is very very complicated, but 
   the problem is low rated, you're probably overcomplicating 
   it, should be simplier
 * if you think that solution is very very simple, prove 
   this, make sure that you're not wrong 
 */


/* 

5
1 2 3 4 5 

1 2 3 4 5 = 15

1) 5 4 3 2 1
   -1 -1 -1 -1

5
1 -3 2 5 -4 = 1




*/

Submission (verdict: Accepted):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
using namespace __gnu_pbds;

#define debug(x) cout << #x << " = " << x << "\n";
#define vdebug(a) cout << #a << " = "; for(auto x: a) cout << x << " "; cout << "\n";

#define line "\n"
#define NO cout << "NO" << line
#define YES cout << "YES" << line
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define F0R(i, s, n) for(int i = (s); i < (n); i++)
#define ROF(i, n) for(int i = (n) - 1; i >= 0; --i)
#define R0F(i, e, n) for(int i = (n) - 1; i >= (e); --i)
#define pb push_back
#define eb emplace_back
#define mp make_pair

using ll = long long;
using ull = unsigned long long;
using ld = long double;

template<typename T1, typename T2>
using gpht = gp_hash_table<T1, T2>;

template<typename T> using V = vector<T>;
using vi = V<int>;
using vll = V<ll>;
using vld = V<ld>;
using vvi = V<vi>;
using vvll = V<vll>;
using vvld = V<vld>;
using vb = V<bool>;
using vpi = V<pair<int, int>>;
using vpll = V<pair<ll, ll>>;
using vvpi = V<vpi>;
using vvpll = V<vpll>;
using vs = V<string>;
using vc = V<char>;
using vvc = V<vc>;

template<typename T>
istream &operator>>(istream &is, V<T> &v) {
    for(auto &x: v)
        is >> x;
    return is;
}

template<typename T>
ostream &operator<<(ostream &os, const V<T> &v) {
    for(auto &x: v)
        os << x << " ";
    return os;
}

template<typename T>
istream &operator>>(istream &is, V<V<T>> &v) {
    for(auto &x: v)
        cin >> x;
    return is;
}
 
template<typename T>
ostream &operator<<(ostream &os, const V<V<T>> &v) {
    for(auto &x: v)
        cout << x << "\n";
    return os;
}

int mod = 998244353;

void solve() {
    int n; cin >> n;
    vll a(n); cin >> a;
    ll ans = accumulate(a.begin(), a.end(), 0LL);
    while(n > 1) {
        n--;
        ll sum = 0;
        for(int i = 0; i < n; i++) {
            a[i] = a[i + 1] - a[i];
            sum += a[i];
        }
        ans = max({ans, sum, -sum});
    }
    cout << ans << line;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int tt = 1;
    cin >> tt;
    while(tt--) {
        solve();
    }
    return 0;
}

/* 
 * stuff you should look for
 * int overflow, array bounds
 * special cases (n=1?)
 * do smth instead of nothing and stay organized
 * WRITE STUFF DOWN 
 * DON'T GET STUCK ON ONE APPROACH
 * if you think that solution is very very complicated, but 
   the problem is low rated, you're probably overcomplicating 
   it, should be simplier
 * if you think that solution is very very simple, prove 
   this, make sure that you're not wrong 
 */


/* 

5
1 2 3 4 5 

1 2 3 4 5 = 15

1) 5 4 3 2 1
   -1 -1 -1 -1

5
1 -3 2 5 -4 = 1




*/