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

Solution 1 (runtime: 46 ms):
//SHANKY CAN'T CODE
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long int 
#define loop(i,n) for(int i = 0; i < n; ++i)
#define loop1(i,n) for(int i = 1; i <= n; ++i)
#define endl "\n"
#define rep(i, s, e) for(int i = s; i < e; i++)
#define repd(i, s, e) for(int i = s; i>e; i--)
#define scan(arr) for(auto &x : arr) cin>>x;
#define print(arr) for(auto &x : arr) cout<<x<<" "; cout<<endl;
#define pb        push_back
#define ppb       pop_back
#define vi        vector<ll>
#define vpi        vector<pair<ll,ll>>
#define vvi       vector<vector<ll>>
#define all(x)    (x.begin(),x.end())
#define ppf       pop_front
#define pf        push_front
#define mod       1e9+7
#define YES       cout<<"YES"<<"\n";
#define NO        cout<<"NO"<<"\n";
#define Yes       cout<<"Yes"<<"\n";
#define No        cout<<"No"<<"\n";
#define yes       cout<<"yes"<<"\n";
#define no        cout<<"no"<<"\n";
#define mod 1e9+7
int reversal(int n);                            //reverse intezers
int digit_sum(int n);                           //sum of int digits
int ati(int arr[],int n);                       //array to intezer
int lenint(int n);                              //length of any intezer
string binary(int n);                           //int to binary(string)
int max_sub(string s,char a);                   //return max conse freq of a
void fast()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
/****************************************************************************************************************/
void solve(){
       int n; cin>>n; vi v;
       int sum=0;
       rep(i,0,n){
        int x; cin>>x;
        v.pb(x);
        sum+=x;
       }
    //    print(v);
       int k=v.size();
       while(k>1){
        int sm=0;
        int x=0;
        // reverse(v.begin(),v.end());
        for(int i=0; i<k-1; i++){
            v[i] = v[i+1]-v[i];
            sm+=v[i];
            x=1;
        }
        // print(v);
        // v.pop_back();
        k--;
        sum=max(abs(sm),sum);
        // if(sm==0 && x==0){
        //     continue;
        // }
        // else{
        //     sum=max(sum,sm);
        // }
        
       }
       cout<<sum<<endl;
}
/*****************************************************************************************************************/
signed main(){
fast();
int t;
cin>>t;
while(t--){
solve();
}
return 0;
}
int lenint(ll n){
    return floor(log10(n) + 1);
}
int ati(int a[],int n){
    int x=0;
    for(int i=0; i<n; i++){
        x+=a[i];
        x*=10;
    }
    return(x/10);
}
int reversal(int n){
    int x=0,j=(int)pow(10,(int)log10(n));
    while(n){
        x+=(n%10)*j;
        n/=10;
        j/=10;
    }
    return x;
}
// string binary(int n){
//     string str="";
//     int binaryNum[32];
//     int i = 0;
//     while (n > 0) {
//         int x=n%2;
//         str.push_back(x+'0');
//         n = n / 2;
//     }
//     reverse(all(str));
//     return str;
// }
int digit_sum(int n){
    int x=0;
    while(n){
        x+=n%10;
        n/=10;
    }
    return x;
}
int max_sub(string s, char a){
    int temp=0,flag=0,ans=0;
    for(int i=0; i<s.size(); i++){
        if(s[i]==a){
            temp++; flag=1;
        }
        else{
            temp=0; flag=0;
        }
        if(flag==1 && temp>ans)
            ans=temp;
    }
    return ans;
}

Solution 2 (runtime: 46 ms):
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF (int)1e18
#define f first
#define s second
#define eb emplace
#define pb push_back
#define endl '\n'
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define mod (int)998244353
#define p(v) for(auto x: v) cout << x << " "; cout << endl;
#define debug(x) cout << #x << ": " << x << endl;
#define input(a,n); for(int i = 0;i<n;i++) cin>>a[i];


int gcd(int a, int b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

bool isPrime(int n) {
    if (n <= 1) return false;
    if (n <= 3) return true;
    if (n % 2 == 0 || n % 3 == 0) return false;
    for (int i = 5; i <= sqrt(n); i += 6) {
        if (n % i == 0 || n % (i + 2) == 0)
            return false;
    }
    return true;
}

vector<int> findDivisors(int n) {
    vector<int> divisors;
    for (int i = 1; i <= sqrt(n); ++i) {
        if (n % i == 0) {
            divisors.push_back(i);
            if (i != n / i) divisors.push_back(n / i);
        }
    }
    return divisors;
}

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1) {
            res = (res * a );
        }
        a = (a * a);
        b >>= 1;
    }
    return res;
}


void Solve() {
   int n;
   cin >> n;
   int a[n];
   int sum=0;
   for(int i=0;i<n;i++){
      cin>>a[i];
      sum+=a[i];
   }
   vector<int>v;
   while(n > 1) {
      int ps=0;
      for(int i=0;i<n-1;i++){
         v.pb(a[i+1]-a[i]);
         ps+=a[i+1]-a[i];
      }
      sum=max(sum,abs(ps));
      for(int i=0;i<n-1;i++){
         a[i]=v[i];
      }
      v.clear();
      n--;
   }
   cout<<sum<<endl;
}

int32_t main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin>>t;
    while(t--)
         Solve();
    return 0;
}