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

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
/*
#define isOn(S, j) (S & (1<<j))
#define setBit(S, j) (S |= (1<<j))
#define clearBit(S, j) (S &= ~(1<<j))
#define toggleBit(S, j) (S ^= (1<<j))
#define lowBit(S) (S & (-S))
#define setAll(S, n) (S = (1<<n)-1)
#define modulo(S, N) ((S) & (N-1))   
#define isPowerOfTwo(S) (!(S & (S-1)))
#define nearestPowerOfTwo(S) (1<<lround(log2(S)))
#define turnOffLastBit(S) ((S) & (S-1))
#define turnOnLastZero(S) ((S) | (S+1))
#define turnOffLastConsecutiveBits(S) ((S) & (S+1))
#define turnOnLastConsecutiveZeroes(S) ((S) | (S-1))
*/
#define pb push_back
#define sqr(x) ((x) * (x))
#define gcd(a,b) __gcd(a,b)
#define FAST_IO ios::sync_with_stdio(0);cin.tie(0);
#define MOD 1000000007
#define rep(i,a,b) for(int i = a; i < b; i++)
#define rep0(i,n) for(int i = 0; i < n; i++)
#define all(v) (v).begin(), (v).end()
#define mp make_pair
#define fi first
#define se second
#define INF 1e18
#define int_max INT_MAX
#define int_min INT_MIN
#define endl "\n"
#define LSOne(S) ((S) & (-S))
#define ceros(v) __builtin_ctzll(v)
#define debug(x) cout << #x << " = " << x << "\n";
#define vdebug(a) cout << #a << " = "; for(auto x: a) cout << x << " "; cout << "\n";
typedef  long long ll;
typedef pair<int,int> ii;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef tuple <int,string,string> iss;
typedef tuple <int,int,int> iii;
#pragma GCC optimize("Ofast,unroll-loops,fast-math,prefetch-loop-arrays,tree-vectorize,omit-frame-pointer,no-peephole")
//mt19937_64 qrand(chrono::steady_clock::now().time_since_epoch().count());



main() {
    FAST_IO;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int tt;
    cin >> tt;
    while(tt -- ){
        int n;
        cin >> n;
        vector<ll> datos(n);
        for(ll &i:datos) cin >> i;
        int newN=n;
        ll ans=-1e18;
        for(int i=0;i<n;i++){
            ll sum=0;
            for(int i=0;i<newN;i++)sum += datos[i];
            if(i==0){
                ans = max(ans, sum); 
                cout << 'a';
            }else{
                ans = max(ans, max(sum, - sum));
            }
            newN--;
            for(int i=0;i<newN;i++){
                datos[i]=datos[i+1]-datos[i];
            }
        }
        cout << ans << endl;
    }
    return 0;
}






Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
/*
#define isOn(S, j) (S & (1<<j))
#define setBit(S, j) (S |= (1<<j))
#define clearBit(S, j) (S &= ~(1<<j))
#define toggleBit(S, j) (S ^= (1<<j))
#define lowBit(S) (S & (-S))
#define setAll(S, n) (S = (1<<n)-1)
#define modulo(S, N) ((S) & (N-1))   
#define isPowerOfTwo(S) (!(S & (S-1)))
#define nearestPowerOfTwo(S) (1<<lround(log2(S)))
#define turnOffLastBit(S) ((S) & (S-1))
#define turnOnLastZero(S) ((S) | (S+1))
#define turnOffLastConsecutiveBits(S) ((S) & (S+1))
#define turnOnLastConsecutiveZeroes(S) ((S) | (S-1))
*/
#define pb push_back
#define sqr(x) ((x) * (x))
#define gcd(a,b) __gcd(a,b)
#define FAST_IO ios::sync_with_stdio(0);cin.tie(0);
#define MOD 1000000007
#define rep(i,a,b) for(int i = a; i < b; i++)
#define rep0(i,n) for(int i = 0; i < n; i++)
#define all(v) (v).begin(), (v).end()
#define mp make_pair
#define fi first
#define se second
#define INF 1e18
#define int_max INT_MAX
#define int_min INT_MIN
#define endl "\n"
#define LSOne(S) ((S) & (-S))
#define ceros(v) __builtin_ctzll(v)
#define debug(x) cout << #x << " = " << x << "\n";
#define vdebug(a) cout << #a << " = "; for(auto x: a) cout << x << " "; cout << "\n";
typedef  long long ll;
typedef pair<int,int> ii;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef tuple <int,string,string> iss;
typedef tuple <int,int,int> iii;
#pragma GCC optimize("Ofast,unroll-loops,fast-math,prefetch-loop-arrays,tree-vectorize,omit-frame-pointer,no-peephole")
//mt19937_64 qrand(chrono::steady_clock::now().time_since_epoch().count());



main() {
    FAST_IO;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int tt;
    cin >> tt;
    while(tt -- ){
        int n;
        cin >> n;
        vector<ll> datos(n);
        for(ll &i:datos) cin >> i;
        int newN=n;
        ll ans=-1e18;
        for(int i=0;i<n;i++){
            ll sum=0;
            for(int i=0;i<newN;i++)sum += datos[i];
            if(i==0){
                ans = max(ans, sum); 
            }else{
                ans = max(ans, max(sum, - sum));
            }
            newN--;
            for(int i=0;i<newN;i++){
                datos[i]=datos[i+1]-datos[i];
            }
        }
        cout << ans << endl;
    }
    return 0;
}