Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#ifndef ONLINE_JUDGE
#include <iostream>
#else
#include<bits/stdc++.h>
#endif
using namespace std;
#define ll long long
#if defined(MYDEB)
int ____tt=1;
#include "../../../tools/local-test/debug.hpp"
#else
#define ___SHOW(...)
#define ___SHOWV(...)
#define ___SHOWA(...)
#define ___SHOWR(...)
#endif
#define FIO ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

#define FOR(i,n,m) for(int i=(n);i<=(m);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define YES printf("YES\n")
#define NO printf("NO\n")

namespace Fast_IO {
  #define SZ 1<<20
  static char inBuf[SZ], *iHeadP = inBuf, *iTailP = inBuf;
  #define getchar() iHeadP == iTailP && (iTailP = (iHeadP = inBuf) + fread(inBuf, 1, SZ, stdin), iHeadP == iTailP) ? EOF : *iHeadP++
  inline int ri() {
    int x(0), t(1);
    char fc(getchar());
    while (fc!=EOF && !('0'<=fc && fc<='9')) {
      if (fc == '-')
        t = -1;
      fc = getchar();
    }
    while ('0'<=fc && fc<='9')
      x = (x << 1) + (x << 3) + (fc & 15), fc = getchar();
    return x * t;
  }
}
using namespace Fast_IO;
#define pi(x) printf("%d", x)
#define pil(x) printf("%d\n", x)
#define pll(x) printf("%lld", x)
#define psp() putchar(' ')
#define pnl() putchar('\n')

bool multiCase = 1;


int n, nums[51];
void solve() {
  n=ri(); REP(i, n) {nums[i]=ri();}
  int ans=0;
  REP(i, n) {ans+=nums[i];}
  REP(i, n-1) {
    int sum=0;
    REP(j, n-i-1) {
      nums[j]=nums[j+1]-nums[j];
      sum+=nums[j];
    }
    ans=max(abs(sum), ans);
  }
  pi(ans); pnl();
}

int main() {
#ifdef MYTEST
  freopen("./tools/local-test/in.txt", "r", stdin);
  freopen("./tools/local-test/out.txt", "w", stdout);
  clock_t start_time = clock();
#endif
  int tt = 1;
  if (multiCase) tt=ri();
  while (tt--) {
    
    solve();
  }
#ifdef MYTEST
  fprintf(stderr, "\n>> Exec Time: %.3f ms\n", (double)(clock() - start_time) / CLOCKS_PER_SEC * 1000);
#endif
  return 0;
}


Submission (verdict: Wrong answer on test 2):
#ifndef ONLINE_JUDGE
#include <iostream>
#else
#include<bits/stdc++.h>
#endif
using namespace std;
#define ll long long
#if defined(MYDEB)
int ____tt=1;
#include "../../../tools/local-test/debug.hpp"
#else
#define ___SHOW(...)
#define ___SHOWV(...)
#define ___SHOWA(...)
#define ___SHOWR(...)
#endif
#define FIO ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);

#define FOR(i,n,m) for(int i=(n);i<=(m);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define YES printf("YES\n")
#define NO printf("NO\n")

namespace Fast_IO {
  #define SZ 1<<20
  static char inBuf[SZ], *iHeadP = inBuf, *iTailP = inBuf;
  #define getchar() iHeadP == iTailP && (iTailP = (iHeadP = inBuf) + fread(inBuf, 1, SZ, stdin), iHeadP == iTailP) ? EOF : *iHeadP++
  inline int ri() {
    int x(0), t(1);
    char fc(getchar());
    while (fc!=EOF && !('0'<=fc && fc<='9')) {
      if (fc == '-')
        t = -1;
      fc = getchar();
    }
    while ('0'<=fc && fc<='9')
      x = (x << 1) + (x << 3) + (fc & 15), fc = getchar();
    return x * t;
  }
}
using namespace Fast_IO;
#define pi(x) printf("%d", x)
#define pil(x) printf("%d\n", x)
#define pll(x) printf("%lld", x)
#define psp() putchar(' ')
#define pnl() putchar('\n')

bool multiCase = 1;


int n, nums[51];
void solve() {
  n=ri(); REP(i, n) {nums[i]=ri();}
  ll ans=0;
  REP(i, n) {ans+=nums[i];}
  REP(i, n-1) {
    ll sum=0;
    REP(j, n-i-1) {
      nums[j]=nums[j+1]-nums[j];
      sum+=nums[j];
    }
    ans=max(abs(sum), ans);
  }
  pi(ans); pnl();
}

int main() {
#ifdef MYTEST
  freopen("./tools/local-test/in.txt", "r", stdin);
  freopen("./tools/local-test/out.txt", "w", stdout);
  clock_t start_time = clock();
#endif
  int tt = 1;
  if (multiCase) tt=ri();
  while (tt--) {
    
    solve();
  }
#ifdef MYTEST
  fprintf(stderr, "\n>> Exec Time: %.3f ms\n", (double)(clock() - start_time) / CLOCKS_PER_SEC * 1000);
#endif
  return 0;
}