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;

#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef unordered_map<ll, ll> umpl;
typedef unordered_map<int, int> umpi;
typedef map<ll, ll> mpl;
typedef map<int, int> mpi;
typedef priority_queue<ll> pql;
typedef priority_queue<int> pqi;
typedef priority_queue<ll, vector<ll>, greater<ll>> minpql;
typedef priority_queue<int, vector<int>, greater<int>> minpqi;
typedef stack<ll> stl;
typedef stack<int> sti;
const ll mod = 1'000'000'007;
const ll N = 3e5, M = N;
vpii dir = {{1,0},{-1,0},{0,1},{0,-1}};
vpii dir1 = {{1,0},{-1,0},{0,1},{0,-1},{1,1},{-1,-1},{1,-1},{-1,1}};
//=======================

vi g[N];

void solve()
{
    ll n, i, j, k, q;
    cin>>n;
    vl a(n);
    ll sum1=0;
    fo(i,n)
    {
        cin>>a[i];
        sum1+=a[i];
    }
    if(a.size()==1)
    {
        cout<<a[0]<<endl;
        return;
    }
    ll ans=sum1;
    while (a.size()>1)
    {
        // cout<<1<<endl;
        ll sum=0;
        for(auto it : a)
        {
            sum+=it;
        }
        sum=abs(sum);
        max(ans, sum);
        vl b;
        fo(j, a.size()-1)
        {
            b.push_back(a[j+1]-a[j]);
        }
        a=b;
    }   
    ans=max(ans, abs(a[0]));
    cout<<ans<<endl;
    
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    ll t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    // solve();
    return 0;
}


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

#define fo(i, n) for (i = 0; i < n; i++)
#define Fo(i, k, n) for (i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef unordered_map<ll, ll> umpl;
typedef unordered_map<int, int> umpi;
typedef map<ll, ll> mpl;
typedef map<int, int> mpi;
typedef priority_queue<ll> pql;
typedef priority_queue<int> pqi;
typedef priority_queue<ll, vector<ll>, greater<ll>> minpql;
typedef priority_queue<int, vector<int>, greater<int>> minpqi;
typedef stack<ll> stl;
typedef stack<int> sti;
const ll mod = 1'000'000'007;
const ll N = 3e5, M = N;
vpii dir = {{1,0},{-1,0},{0,1},{0,-1}};
vpii dir1 = {{1,0},{-1,0},{0,1},{0,-1},{1,1},{-1,-1},{1,-1},{-1,1}};
//=======================

vi g[N];

void solve()
{
    ll n, i, j, k, q;
    cin>>n;
    vl a(n);
    ll sum1=0;
    fo(i,n)
    {
        cin>>a[i];
        sum1+=a[i];
    }
    if(a.size()==1)
    {
        cout<<a[0]<<endl;
        return;
    }
    ll ans=LLONG_MIN;
    while (a.size()>1)
    {
        ll sum=0;
        for(auto it : a)
        {
            sum+=it;
        }
        // cout<<sum<<endl;
        sum=abs(sum);
        ans=max(ans, sum);
        vl b;
        fo(j, a.size()-1)
        {
            b.push_back(a[j+1]-a[j]);
        }
        a=b;
    }   
    ans=max(ans, abs(a[0]));
    cout<<ans<<endl;
    
}

int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());

    ll t = 1;
    cin >> t;
    while (t--)
    {
        solve();
    }
    // solve();
    return 0;
}