Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
/*
*   author: bobbyCodes
*/

#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/treepolicy.hpp>
//#define pbds tree<ll , null_type, less , rb_tree_tag, tree_order_static_node_update> 
#define ll long long
#define pb push_back
#define IM INT_MAX
#define IN INT_MIN
#define fo for(int i=0;i<n;i++){}
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
/* -------------------------------------------------------------------------------------------------------------
//ll gcd(ll a,ll b){for(ll i = min(a,b);i >=1;i--){if(!(a%i) && !(b%i)){return i;}}return 1;}
ll seiveOfErytosthesis(ll k,ll n = 1e6){vector<bool> v(n+1,true);v[0]=v[1]=false;for(ll i =2; i*i<= n; i++){for(ll j =2*i; j <=n ; j+=i){if(v[j]){v[j]=false;}}}ll num=0;for(ll i=k; i<=1e6;i++){if(v[i]){num= i;break;}}return num;}
-------------------------------------------------------------------------------------------------------------
*/
//using namespace __gnu_pbds

void init_code(){
    fast_io;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif 
}
void solve(){
   int n;
   cin>>n;

   vector<int>v(n);

   for(int i=0; i<n; i++){
      cin>>v[i];
   }

   int now=n;

   long long ans= -1e18;

   for(int i=0; i<n ;i ++){
      long long sum=0;
      for(int i=0; i< now; i++ ){
         sum+=v[i];
      }
      if(i==0){
         ans=max(ans,sum);
      }else{
         ans=max(ans, max(sum,(-sum)));
      }
      for(int i=0; i<now-1; i++){
         v[i]=v[i+1] - v[i];
      }
      now--;
   }
   cout<<ans<<endl;
}
int main() {
   init_code();
   int t = 1; cin >> t;
   while(t--){
         solve();
   }
   return 0;
}

Submission (verdict: Wrong answer on test 2):
/*
*   author: bobbyCodes
*/

#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/treepolicy.hpp>
//#define pbds tree<ll , null_type, less , rb_tree_tag, tree_order_static_node_update> 
#define ll long long
#define pb push_back
#define IM INT_MAX
#define IN INT_MIN
#define fo for(int i=0;i<n;i++){}
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
/* -------------------------------------------------------------------------------------------------------------
//ll gcd(ll a,ll b){for(ll i = min(a,b);i >=1;i--){if(!(a%i) && !(b%i)){return i;}}return 1;}
ll seiveOfErytosthesis(ll k,ll n = 1e6){vector<bool> v(n+1,true);v[0]=v[1]=false;for(ll i =2; i*i<= n; i++){for(ll j =2*i; j <=n ; j+=i){if(v[j]){v[j]=false;}}}ll num=0;for(ll i=k; i<=1e6;i++){if(v[i]){num= i;break;}}return num;}
-------------------------------------------------------------------------------------------------------------
*/
//using namespace __gnu_pbds

void init_code(){
    fast_io;
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif 
}
void solve(){
   int n;
   cin>>n;

   vector<int>v(n);

   for(int i=0; i<n; i++){
      cin>>v[i];
   }

   int now=n;

   long long ans= -1e18;

   for(int i=0; i<n ;i ++){
      long long sum=0;
      for(int j=0; j< now; j++ ){
         sum+=v[j];
      }
      if(i==0){
         ans=max(ans,sum);
      }else{
         ans=max(ans, max(sum,(-sum)));
      }
      for(int j=0; j<now-1; j++){
         v[j]=v[j+1] - v[j];
      }
      now--;
   }
   cout<<ans<<endl;
}
int main() {
   init_code();
   int t = 1; cin >> t;
   while(t--){
         solve();
   }
   return 0;
}