Problem: 2062C - Cirno and Operations
Language: c++23 

Code 1:
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;
#define nl cout << '\n';
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mod 1000000007
#define make(n) ll n; cin >> n;
#define makech(ch) char ch; cin >> ch;
#define makestr(s) string s; cin >> s;
#define show(n) cout << n << endl;
#define makearr(a, n) vector<ll> a(n); for (int i = 0; i < n; i++){ cin >> a[i]; }
#define make2d(a, n, m) vector<vector<ll>> a(n, vector<ll>(m)); for (int i = 0; i < n; i++){ for (int j = 0; j < m; j++){ cin >> a[i][j]; } }
#define all(v) v.begin(), v.end()
#define showarr(a, n) for (int i = 0; i < n; i++){ cout << a[i] << " "; } cout << '\n';
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>

vector<ll> generatePascalsTriangleLine(int n) {
    vector<ll> line(n + 1, 1);
    for (int i = 1; i < n; i++){
        line[i] = line[i - 1] * (n - i + 1) / i;
    }
    return line;
}

int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    make(t);
    while(t--){
        make(n);
        makearr(arr, n)
        ll sum = 0; for (int i = 0; i < n; i++) sum += arr[i];
        if(n == 1){ show(sum) continue; }

        vector<ll> gpt = generatePascalsTriangleLine(n - 1);
        
        ll F_sum = 0, G_sum = 0;
        for (int i = 0; i < n; i++){
            F_sum += ((n - 1 - i) % 2 ? -1LL : 1LL) * gpt[i] * arr[i];
            G_sum += (i % 2 ? -1LL : 1LL) * gpt[i] * arr[i];
        }
        ll ans = max({sum, (ll)abs(F_sum), (ll)abs(G_sum)});
        show(ans)
    }
    return 0;
}


Code 2:
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define yes cout << "YES" << endl;
#define no cout << "NO" << endl;
#define nl cout << '\n';
#define pb push_back
#define F first
#define S second
#define mp make_pair
#define mod 1000000007
#define make(n) ll n; cin >> n;
#define makech(ch) char ch; cin >> ch;
#define makestr(s) string s; cin >> s;
#define show(n) cout << n << endl;
#define makearr(a, n) vector<ll> a(n); for (int i = 0; i < n; i++) { cin >> a[i]; }
#define make2d(a, n, m) vvi a(n, vector<ll>(m)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> a[i][j]; } }
#define all(v) v.begin(), v.end()
#define showme(a) for(auto it:a){cout<<it<<" ";} cout<<'\n';
#define vvi vector<vector<int>>
#define vvl vector<vector<ll>>
#define forl(n) for(int i=0; i<n; i++)

vector<ll> generatePascalsTriangleLine(int n) {
    vector<ll> line(n + 1, 1);
    for (int i = 1; i < n; i++) {
        line[i] = line[i - 1] * (n - i + 1) / i;
    }
    return line;
}

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    
    make(t);
    while (t--) {
        make(n);
        makearr(arr, n)

        ll sum = 0, ans = 0;
        for(int i=0; i<arr.size(); i++){
            sum+=arr[i];
        }
        ans=sum;
        
        vector<ll>curr=arr;
        while(curr.size()>1){
            vector<ll>diff;
            for(int i=0; i<curr.size()-1; i++){
                diff.pb(curr[i+1]-curr[i]);
            }

            sum=accumulate(all(diff), 0LL);
            ans=max(ans, abs(sum));

            curr.clear();
            for(int i=0; i<diff.size(); i++){
                curr.pb(diff[i]);
            }
            diff.clear();
        }
        show(ans)
    }
    return 0;
}


Answer: 2