Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define len(x) (int)x.length()
#define nl "\n"
#define sp " "
#define pb push_back
#define fr(a,b,i) for(int i=a; i<b; i++)
#define v(type) vector<type>
#define vv(type) vector<vector<type>>
#define vpii vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define rf(b,a,i) for(int i=b; i>=a; i--)
#define w(t) while(t--)
#define mset multiset
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define ms multiset
#define umap unordered_map
#define uset unordered_set
#define pq priority_queue
#define pqi priority_queue<int>
#define pqll priority_queue<ll>
#define si set<int>
#define sll set<ll>
#define mii map<int, int>
#define mll map<ll, ll>
#define msi multiset<int>
#define msl multiset<ll>
using namespace std;

void fastIO() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
template<typename T>
void print(v(T) v) {
    fr(0, v.size(), i) { cout << v[i] << " "; }
    cout << endl;
}

const ll mod = 1e9 + 7;
const ll inf = 1e18;
 
 
ll power(ll x, ll y) {
    ll res = 1;
    x = x % mod;
    if (x == 0) return 0;
    while (y > 0) {
        if (y & 1) res = (res * x) % mod;
        y = y >> 1;
        x = (x * x) % mod;
    }
    return res;
}
 
 
void run() {
    ll n;
    cin>>n;
    if (n == 1) { 
        ll num;
        cin >> num;
        cout << num << nl;  
        return;
    }
    vll a_old(n);
    ll sum = 0;
    fr(0, n, i) {
        cin>>a_old[i];
        sum += a_old[i];
    }
    ll k = n;
    while(k>1){
    vll a_new(k - 1);
    fr(0,k-1,i){
        a_new[i] = a_old[i+1]-a_old[i];
    }
    a_old = a_new;
    k--;
    }
    cout<<max(sum,abs(a_old[0]))<<nl;
    
;}

int main() {
    fastIO();
 
 
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //freopen("error.txt", "w", stderr);
 
 
    int t;
    cin >> t;
    w(t) {
        run();
    }
    return 0;
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define len(x) (int)x.length()
#define nl "\n"
#define sp " "
#define pb push_back
#define fr(a,b,i) for(int i=a; i<b; i++)
#define v(type) vector<type>
#define vv(type) vector<vector<type>>
#define vpii vector<pair<int, int>>
#define vpll vector<pair<ll, ll>>
#define rf(b,a,i) for(int i=b; i>=a; i--)
#define w(t) while(t--)
#define mset multiset
#define lb lower_bound
#define ub upper_bound
#define bs binary_search
#define ms multiset
#define umap unordered_map
#define uset unordered_set
#define pq priority_queue
#define pqi priority_queue<int>
#define pqll priority_queue<ll>
#define si set<int>
#define sll set<ll>
#define mii map<int, int>
#define mll map<ll, ll>
#define msi multiset<int>
#define msl multiset<ll>
using namespace std;

void fastIO() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
template<typename T>
void print(v(T) v) {
    fr(0, v.size(), i) { cout << v[i] << " "; }
    cout << endl;
}

const ll mod = 1e9 + 7;
const ll inf = 1e18;
 
 
ll power(ll x, ll y) {
    ll res = 1;
    x = x % mod;
    if (x == 0) return 0;
    while (y > 0) {
        if (y & 1) res = (res * x) % mod;
        y = y >> 1;
        x = (x * x) % mod;
    }
    return res;
}
 
 
void run() {
    ll n;
    cin>>n;
    if (n == 1) { 
        ll num;
        cin >> num;
        cout << num << nl;  
        return;
    }
    vll a_old(n);
    ll sum = 0;
    fr(0, n, i) {
        cin>>a_old[i];
        sum += a_old[i];
    }
    ll k = n;ll new_sum = 0;ll ans = 0;
    while(k>1){
    vll a_new(k - 1);
    new_sum = 0;
    fr(0,k-1,i){
        a_new[i] = a_old[i+1]-a_old[i];
        new_sum += a_new[i];
    }
    a_old = a_new;
    ans = max(ans,abs(new_sum));
    k--;
    }
    cout<<max(sum,ans)<<nl;
    
;}

int main() {
    fastIO();
 
 
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    //freopen("error.txt", "w", stderr);
 
 
    int t;
    cin >> t;
    w(t) {
        run();
    }
    return 0;
}