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>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define op()                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define srt(a) sort(a.begin(), a.end())
#define rsrt(a) sort(a.begin(), a.end(), greater<>())
#define fo(n) for (int i = 0; i < n; i++)
#define fo1(n) for (int i = 1; i <= n; i++)
#define all(a) a.begin(), a.end()
#define pb push_back
#define ll long long
#define Inf (ll)1e17 + 7
#define pi 3.1415926536
#define gcd __gcd
#define vi vector<int>
#define vl vector<ll>
#define nl '\n'
#define min_priority priority_queue<ll, vector<ll>, greater<ll>>
#define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update>
#define show(a)           \
    for (auto e : a)      \
        cout << e << " "; \
    cout << nl;
#define rY               \
    cout << "YES" << nl; \
    return;
#define rN              \
    cout << "NO" << nl; \
    return;
#define rr return
const ll mod = 1e9 + 7;
void Solve()
{
    ll n, m, x, y, z, i, j, k, l, r, q, W;
    cin >> n;
    vl v(n);
    for (i = 0; i < n; i++)
        cin >> v[i];
    ll ans = -1 * Inf;
    while (v.size() > 1)
    {
        x = 0;
        for (auto e : v)
        {
            x += e;
        }
        reverse(all(v));
        ans = max(ans, x);
        for (i = 1; i < v.size(); i++)
        {
            v[i - 1] = v[i] - v[i - 1];
        }
        v.pop_back();
    }
    ans = max(ans, v[0]);
    cout << ans << nl;
}
int main()
{
    op();
    int test = 1, c = 1;
    cin >> test;
    while (test--)
    {
        // cin.ignore();
        // cout << "Case " << c++ << ": ";
        Solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 5):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define op()                      \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0);
#define srt(a) sort(a.begin(), a.end())
#define rsrt(a) sort(a.begin(), a.end(), greater<>())
#define fo(n) for (int i = 0; i < n; i++)
#define fo1(n) for (int i = 1; i <= n; i++)
#define all(a) a.begin(), a.end()
#define pb push_back
#define ll long long
#define Inf (ll)1e17 + 7
#define pi 3.1415926536
#define gcd __gcd
#define vi vector<int>
#define vl vector<ll>
#define nl '\n'
#define min_priority priority_queue<ll, vector<ll>, greater<ll>>
#define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update>
#define show(a)           \
    for (auto e : a)      \
        cout << e << " "; \
    cout << nl;
#define rY               \
    cout << "YES" << nl; \
    return;
#define rN              \
    cout << "NO" << nl; \
    return;
#define rr return
const ll mod = 1e9 + 7;
void Solve()
{
    ll n, m, x, y, z, i, j, k, l, r, q, W;
    cin >> n;
    vl v(n);
    for (i = 0; i < n; i++)
        cin >> v[i];
    ll ans = -1 * Inf;
    while (v.size() > 1)
    {
        x = 0;
        for (auto e : v)
        {
            x += e;
        }
        ans = max(ans, x);
        vector<ll> v1 = v;
        for (i = 1; i < v.size(); i++)
        {
            v[i - 1] = v[i] - v[i - 1];
        }
        v.pop_back();
        reverse(all(v1));
        for (i = 1; i < v1.size(); i++)
        {
            v1[i - 1] = v1[i] - v1[i - 1];
        }
        v1.pop_back();
        y = 0;
        for (auto e : v1)
        {
            y += e;
        }
        ans = max(ans, y);
        if (x < y)
            v = v1;
    }
    ans = max(ans, v[0]);
    cout << ans << nl;
}
int main()
{
    op();
    int test = 1, c = 1;
    cin >> test;
    while (test--)
    {
        // cin.ignore();
        // cout << "Case " << c++ << ": ";
        Solve();
    }
    return 0;
}