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

Solution 1 (runtime: 61 ms):
#define ll long long

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

signed main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    
    int t;
    cin>>t;
    while(t--){
        int n;
        cin>>n;
        vector<long long> v(n);
        for(auto &x: v) cin>>x;
        long long ans=accumulate(v.begin(), v.end(), 0);
        while(n>1){
            long long c1=0, c2=0;
            for(int i=0; i<n-1; i++){
                v[i]=v[i]-v[i+1];
                c1+=v[i];
                c2-=v[i];
            }
            n--;
            ans=max({ans, c1, c2});
        }
        cout<<max(ans, v[0])<<endl;
    }
    

    return 0;
}

Solution 2 (runtime: 46 ms):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_updat
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
template<class T> using oset = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
#define ll long long
void dbg_out() { cerr << endl; }
template <typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) {
  cerr << ' ' << H;
  dbg_out(T...);
}
#ifndef ONLINE_JUDGE
#define deb(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define deb(...)
#endif
#define pb push_back
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define sortall(x) sort(all(x))
#define forEach(arr) for (auto &x : arr)
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
template <typename A, typename B>
ostream &operator<<(ostream &cout, pair<A, B> const &p) { return cout << "(" << p.F << ", " << p.S << ")"; }
template <typename A>
ostream &operator<<(ostream &cout,vector<A> const &v){cout<<"[";for (int i = 0; i < v.size(); i++){if(i) cout<<", ";cout << v[i];} return cout << "]";}
template <typename A>
ostream &operator<<(ostream &cout,set<A> const &s){cout<<"[";for (auto &x: s){cout << x<<", ";} return cout << "]";}
template <typename A, typename B>
ostream &operator<<(ostream &cout,unordered_map<A, B> const &v){cout<<"{";for(auto &x: v){cout<<"{"<<x.first<<"="<<x.second<<"}";} return cout << "}";}
template <typename A>
istream &operator>>(istream &cin, vector<A> &v) {for (auto &i : v) cin >> i; return cin;}

const int mod = 1e9+7;
//=======================

void solve() {
  int n; cin>>n;
  vector<ll> arr(n); cin>>arr;
  ll ans = accumulate(all(arr), int64_t(0));
  while(arr.size() > 1) {
    for(int i=1; i<n; i++) arr[i-1] = arr[i] - arr[i-1];
    arr.pop_back();
    ans = max(ans, abs(accumulate(all(arr), int64_t(0)))); // reverse operation
  }
  cout<<ans;
}


int32_t main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("error.txt", "w", stderr);
  freopen("output.out", "w", stdout);
  freopen("input.in", "r", stdin);
#endif
  auto start1 = high_resolution_clock::now();
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
    cout << "\n";
    deb("tc_end\n");
  }
  auto stop1 = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop1 - start1);
#ifndef ONLINE_JUDGE
  cerr << "Time: " << duration.count()<<"ms"<< endl;
#endif
  return 0;
}