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

Solution 1 (runtime: 46 ms):
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define int ll

const int sz = 2e5 + 5;

void solve(){
    int n, sum = 0, ans = -1e9; cin >> n;
    vector<int>a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i]; sum += a[i];
    }
    ans = max(ans, sum); sum = 0;
    while(a.size() > 1){
        reverse(a.begin(), a.end());
        vector<int>b(a.size() - 1);
        for(int i = 1; i < a.size(); i++){
            b[i - 1] = a[i] - a[i - 1];
            sum += b[i - 1];
        }
        ans  = max(ans, abs(sum)); sum = 0;
        swap(a, b);
    }
    cout << ans << '\n';
}
 
signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0); 
    int t; cin >> t;
    while(t--) solve();
}

Solution 2 (runtime: 61 ms):
/*// Ih Badhon Chowdhury //*/

#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;

// using namespace __gnu_pbds;
// template<typename T> using orderset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
// template<typename T> using ordermultiset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
//(*X).find_by_order(index) /// return value (0 index)
//(X).order_of_key(value) /// return lower_bound(value)

/*
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); /// mt19937_64 (long long)
auto my_rand(long long l,long long r)
{
  return uniform_int_distribution<long long>(l,r)(rng);
}
#ifndef ONLINE_JUDGE
#include "debug.h"
#else
#define dbg(...) 42
#endif
*/

#define ll long long int
#define ld long double
#define sp " "
#define lcm(a, b) (a * b) / __gcd(a, b)
#define cinv(v)     \
  for (auto &i : v) \
    cin >> i;
#define vi vector<int>
#define vii vector<ll>
#define coutv(v)       \
  for (auto it : v)    \
    cout << it << ' '; \
  cout << endl;
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define case "Case " << test++ << ": "
#define all(v) v.begin(), v.end()
#define Faster                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(NULL);                    \
  cout.tie(NULL);
#define nl '\n'
#define PI acos(-1)

const int N = 1000001;
const int mod = 1000000007;
const ll INF = LLONG_MAX;

///.........Bit_Manipulation...........///
#define MSB(mask) 63 - __builtin_clzll(mask) /// 0 -> -1
#define LSB(mask) __builtin_ctzll(mask)      /// 0 -> 64
#define ONE(mask) __builtin_popcountll(mask)
#define CHECK(mask, bit) (mask & (1LL << bit))
#define ON(mask, bit) (mask(1LL << bit))
#define OFF(mask, bit) (mask & ~(1LL << bit))
#define CHANGE(mask, bit) (mask ^ (1LL << bit))
#define LOG2(x) (__builtin_clz(x) ^ 31)
#define LSB1(mask) (__builtin_ffs(mask) - 1)
#define STRING_TO_INT(mask) (std::bitset<64>(mask).to_ullong())

///................Graph's Move.................
/// const int dx[] = {+1,-1,+0,+0}; ///Rock's Move
/// const int dy[] = {+0,+0,+1,-1}; ///Rock's Move
/// const int dx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's Move
/// const int dy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
/// const int dx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's Move
/// const int dy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's Move
///*.....................-_-........................*///

inline ll IPOW(ll n, ll k)
{
  ll ans = 1;
  while (k)
  {
    if (k & 1)
      ans = ans * n % mod;
    n = n * n % mod;
    k >>= 1;
  }
  return ans;
}
inline ll POW(ll n, ll k)
{
  ll ans = 1;
  while (k)
  {
    if (k & 1)
      ans = ans * n;
    n = n * n;
    k >>= 1;
  }
  return ans;
}
//////

// Driver Code
int main()
{
  Faster;
  ll tc = 1, test = 1;
  cin >> tc;
  while (tc--)
  {
    int n;
    cin >> n;
    vii v(n);
    cinv(v);

    ll ans = -1e18;

    int now = n;

    for (int i = 0; i < n; i++)
    {
      ll tot = 0;
      for (int j = 0; j < now; j++)
        tot += v[j];

      if (i == 0)
        ans = max(ans, tot);
      else
        ans = max(ans, max(tot, (-tot)));

      for (int j = 0; j < now; j++)
        v[j] = v[j + 1] - v[j];
      now--;
    }

    cout << ans << nl;
  }
}