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

Solution 1 (runtime: 62 ms):
/*                  +-- -- --++-- +- In the name of ALLAH, the lord of mercy, the giver of mercy. -+ --++-- -- --+                           */
/*                                                   "'Let's Mine Some Dopamine!'"                                                         */
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//                                                                                                                            //
//                                                      author: TheAnonymousAMGR                                              //
//                                                                                                                            //
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MOD 1000000007
#define pb push_back
#define vi vector<int>
#define vl vector<ll>
#define ook order_of_key
#define fbk find_by_order
#define F first
#define S second
#define bit(a)   __builtin_popcount(a)
#define w(x) while(x--)
#define ni int n;cin>>n;
#define nl ll n; cin>>n;
#define loop for(ll i=0;i<n;i++)
#define loop1 for(int i=1;i<=n;i++)
#define str string s;cin>>s;
#define test(fn) int t;cin>>t;while(t--) fn();
#define array(arr) int arr[n];for(int i=0;i<n;i++)cin>>arr[i];
#define vec(v) vector<int>v(n);for(int i=0;i<n;i++)cin>>v[i];
#define srt(v) sort(v.begin(),v.end());
#define rsrt(v) sort(v.rbegin(),v.rend());
#define all(v) v.begin(),v.end()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*b)/gcd(a,b)
#define PI 2*acos(0.0)
#define lb lower_bound
#define ub upper_bound
#define pr pair<int,int>
#define yes cout<<"YES"<<endl;
#define no cout<<"NO"<<endl;
#define dekha cout<<res<<endl;
#define en "\n"
#define AMGR()	(ios_base::sync_with_stdio(false),cin.tie(NULL))
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;
/* Ordered Set Template*/
//template <typename T>
//order_of_key (k) : Number of items strictly smaller than k
//find_by_order(k) : K-th element in a set (counting from zero)
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
/*_________________________________________________________________________________________________________________________________________*/
void answer()
{
    int n; cin>>n;
    ll sum=0;
    vl v(n);
    loop
    {
        cin>>v[i]; sum+=v[i];
    }
    ll res=sum;
    while(n>1)
    {
        loop v[i]=v[i+1]-v[i];
        n--;
        sum=0;
        loop sum+=v[i];
        res=max(res,abs(sum));
    }
    cout << res <<en;
}
int main()
{
    AMGR();
    test(answer);
}
/*__________________________________________________________________________________________________________________________________________*/
/*                               ++  --  ++  --  ++  cout<<"That's it. Keep coding:)"<<endl;  ++  --  ++  --  ++                          */
/*                                   "Don't quit. Suffer now and live the rest of your life as a champion."                               */
/*                                                        "Speak good or be silent."                                                      */
/*                                         "You may see me struggle, but you will never see me quit."                                     */

Solution 2 (runtime: 62 ms):
#include<bits/stdc++.h>

using namespace std;

long long max_sum(int n, vector<long long>&nums){
	long long res = -1e18;
	int cur = n;
	
	for(int i=0; i<n; i++){
		long long sum = 0;
		for(int j=0; j<cur; j++){
			sum += nums[j];
		}
		if(i==0){
			res = max(res, sum);
		}
		else{
			res = max(res, max(sum, -sum));
		}
		for(int j=0; j<cur-1; j++){
			nums[j] = nums[j+1]-nums[j];
		}
		cur--;
	}
	return res;
}

int main(){
	int T; cin>>T;
	
	for(int t=0; t<T; t++){
		int n; cin>>n;
		vector<long long>nums;
		
		for(int i=0; i<n; i++){
			long long num; cin>>num;
			nums.push_back(num);
		}
		cout<<max_sum(n,nums)<<endl;
	}
	return 0;
}