Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;

mt19937 lol(chrono::steady_clock::now().time_since_epoch().count());   
void err(istream_iterator<string> it) {cout << '\n';} template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {string s = typeid(a).name();cout << "[" << *it << " = ";cout << a;cout << "] ";err(++it, args...);} void catchAlarm(int sig) {cout << "TL!!!!!";exit(0);}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

using ll = long long;
using Graph = vector<vector<int>>;

template<typename T> T gcd(T a, T b) {if (a < b) swap(a, b); return b ? gcd(b, a % b) : a;}
template<typename T> void Max(T &a, T b){if(a < b) a = b;}
template<typename T> void Min(T &a, T b){if(a > b) a = b;}
template<typename Container>
void print(const Container& container) {
    std::cout << "[ ";
    for (const auto& element : container) {
        std::cout << element << " ";
    }
    std::cout << "]" << std::endl;
}

[[maybe_unused]] int mod = 1e9 + 7;
[[maybe_unused]] constexpr int inf = 1e9 + 7;
[[maybe_unused]] constexpr long long INF = 1e18 + 7;
[[maybe_unused]] constexpr array<pair<int, int>, 4> directions = {{{0, -1}, {-1, 0}, {0, 1}, {1, 0}}};

int bp(int a, int n, int mOd = mod) {
    if (n == 0) return 1;
    int res = bp(a, n / 2, mOd);
    res = res * 1ll * res % mOd;
    if (n & 1) res = res * 1ll * a % mOd;
    return res;
}

void Add(int &a, int b) {a += b;if (a >= mod) a -= mod;}
void Sub(int &a, int b) {a -= b;if (a < 0) a += mod;}
void Mul(int &a, int b) {a = a * 1ll * b % mod;}
int add(int a, int b) {a += b;if (a >= mod) a -= mod;return a;}
int sub(int a, int b) {a -= b;if (a < 0) a += mod;return a;}
int mul(int a, int b) {return a * 1ll * b % mod;}
int divide(int a, int b) {return mul(a, bp(b, mod - 2));}

// #define int long long


void solve() {
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    int ans = accumulate(a.begin(), a.end(), 0);

    while (a.size() > 1) {
        vector<int> b, c;
        for (int i = 1; i < a.size(); i++) {
            b.push_back(a[i] - a[i - 1]);
            c.push_back(a[i - 1] - a[i]);
        }

        reverse(c.begin(), c.end());

        int bSum = accumulate(b.begin(), b.end(), 0);
        int cSum = accumulate(c.begin(), c.end(), 0);

        a = (bSum > cSum ? b : c);
        ans = max(ans, max(bSum, cSum));
    }

    cout << max(ans, a[0]);
}





signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
        signal(SIGALRM, catchAlarm);
        alarm(2);
        freopen("test.in", "r", stdin);
        freopen("test.out", "w", stdout);
    #endif
    int TT = 1;
    cin >> TT;


    for (int testcase = 1; testcase <= TT; testcase++) {
        // cout << "Case #" << testcase << ": ";
        solve();
        cout << '\n';
    }
        
//    #ifndef ONLINE_JUDGE
//      cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
//    #endif
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;

mt19937 lol(chrono::steady_clock::now().time_since_epoch().count());   
void err(istream_iterator<string> it) {cout << '\n';} template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {string s = typeid(a).name();cout << "[" << *it << " = ";cout << a;cout << "] ";err(++it, args...);} void catchAlarm(int sig) {cout << "TL!!!!!";exit(0);}
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

using ll = long long;
using Graph = vector<vector<int>>;

template<typename T> T gcd(T a, T b) {if (a < b) swap(a, b); return b ? gcd(b, a % b) : a;}
template<typename T> void Max(T &a, T b){if(a < b) a = b;}
template<typename T> void Min(T &a, T b){if(a > b) a = b;}
template<typename Container>
void print(const Container& container) {
    std::cout << "[ ";
    for (const auto& element : container) {
        std::cout << element << " ";
    }
    std::cout << "]" << std::endl;
}

[[maybe_unused]] int mod = 1e9 + 7;
[[maybe_unused]] constexpr int inf = 1e9 + 7;
[[maybe_unused]] constexpr long long INF = 1e18 + 7;
[[maybe_unused]] constexpr array<pair<int, int>, 4> directions = {{{0, -1}, {-1, 0}, {0, 1}, {1, 0}}};

int bp(int a, int n, int mOd = mod) {
    if (n == 0) return 1;
    int res = bp(a, n / 2, mOd);
    res = res * 1ll * res % mOd;
    if (n & 1) res = res * 1ll * a % mOd;
    return res;
}

void Add(int &a, int b) {a += b;if (a >= mod) a -= mod;}
void Sub(int &a, int b) {a -= b;if (a < 0) a += mod;}
void Mul(int &a, int b) {a = a * 1ll * b % mod;}
int add(int a, int b) {a += b;if (a >= mod) a -= mod;return a;}
int sub(int a, int b) {a -= b;if (a < 0) a += mod;return a;}
int mul(int a, int b) {return a * 1ll * b % mod;}
int divide(int a, int b) {return mul(a, bp(b, mod - 2));}

#define int long long


void solve() {
    int n;
    cin >> n;

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }

    vector<int> cpA(a);

    int ans = accumulate(a.begin(), a.end(), 0);

    for (int it = 0; it < 2; it++) {
        while (a.size() > 1) {
            vector<int> b, c;
            for (int i = 1; i < a.size(); i++) {
                b.push_back(a[i] - a[i - 1]);
                c.push_back(a[i - 1] - a[i]);
            }

            reverse(c.begin(), c.end());

            if (it == 0) {
                b = c;
            }
            else {
                c = b;
            }

            int bSum = accumulate(b.begin(), b.end(), 0);
            int cSum = accumulate(c.begin(), c.end(), 0);

            a = (bSum > cSum ? b : c);
            ans = max(ans, max(bSum, cSum));
        }
        ans = max(ans, a[0]);
        a = cpA;
    }
    cout << ans;
}





signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #ifndef ONLINE_JUDGE
        signal(SIGALRM, catchAlarm);
        alarm(2);
        freopen("test.in", "r", stdin);
        freopen("test.out", "w", stdout);
    #endif
    int TT = 1;
    cin >> TT;


    for (int testcase = 1; testcase <= TT; testcase++) {
        // cout << "Case #" << testcase << ": ";
        solve();
        cout << '\n';
    }
        
//    #ifndef ONLINE_JUDGE
//      cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
//    #endif
    return 0;
}