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

Previous submission (verdict: Wrong answer on test 2):
#include     <bits/stdc++.h>
using        namespace std;

#define     pb push_back
#define     endl "\n"
#define     take cin >> 
#define     ll long long
#define     pii pair<int, int>
#define     all(v) v.begin(),v.end()
#define     read(v) for(auto& temp : v) cin >> temp
#define     precision(n) fixed << setprecision(n)
#define     debug(x) cout << #x << " = " << x << endl
#define     print(v) for(auto tem : v) cout << tem << ' '; cout << endl
#define     miuu ios_base::sync_with_stdio(false);cin.tie(nullptr); cout.tie(nullptr)


const int   N = 2e5 + 5;
const int   mod = 1e9 + 7;
const int   inf = 1e9 + 9;
const int   dx[] = {0, 0, 1, -1, -1, 1, -1, 1};
const int   dy[] = {1, -1, 0, 0, -1, -1, 1, 1};

int vis[N];
int lev[N];
int rel[N];
int n, m, t;


void solution() { 

  int n;
  cin >> n;

  vector < ll > arr;

  ll ans = -1e18;

  ll sum = 0;

  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    arr.push_back(x);
    sum += x;
  }
  if(n > 1) ans = max (abs(sum), ans);
  else ans = max (sum, ans);

  while(arr.size() > 1){

    vector < ll > b;
    sum = 0;

  for(int i = 1; i < arr.size(); i++){

    b.push_back(arr[i] - arr[i - 1]);
    sum += arr[i] - arr[i - 1];

  }

  ans = max ( ans, abs(sum));
  if(sum < 0)for(int i = 0; i < b.size() ; i++)b[i] = -b[i];
  arr = b;
 } 
    
    cout << ans << endl;
}

int main()
{
    miuu;
    
    int case_number = 1;
    cin >> case_number;

    int c = 1;


    while (case_number--) {

        solution();

        // if(case_number != 0)cout << endl;
    }
    return 0;
}

Submission (verdict: Accepted):
#include     <bits/stdc++.h>
using        namespace std;

#define     pb push_back
#define     endl "\n"
#define     take cin >> 
#define     ll long long
#define     pii pair<int, int>
#define     all(v) v.begin(),v.end()
#define     read(v) for(auto& temp : v) cin >> temp
#define     precision(n) fixed << setprecision(n)
#define     debug(x) cout << #x << " = " << x << endl
#define     print(v) for(auto tem : v) cout << tem << ' '; cout << endl
#define     miuu ios_base::sync_with_stdio(false);cin.tie(nullptr); cout.tie(nullptr)


const int   N = 2e5 + 5;
const int   mod = 1e9 + 7;
const int   inf = 1e9 + 9;
const int   dx[] = {0, 0, 1, -1, -1, 1, -1, 1};
const int   dy[] = {1, -1, 0, 0, -1, -1, 1, 1};

int vis[N];
int lev[N];
int rel[N];
int n, m, t;


void solution() { 

  int n;
  cin >> n;

  vector < ll > arr;

  ll ans = 0;

  ll sum = 0;

  for(int i = 0; i < n; i++){
    int x;
    cin >> x;
    arr.push_back(x);
    sum += x;
  }
  
  ans = sum;

  while(arr.size() > 1){

    vector < ll > b;
    sum = 0;

  for(int i = 1; i < arr.size(); i++){

    b.push_back(arr[i] - arr[i - 1]);
    sum += arr[i] - arr[i - 1];

  }

  ans = max ( ans, abs(sum));
  if(sum < 0)for(int i = 0; i < b.size() ; i++)b[i] = -b[i];
  arr = b;
 } 
    
    cout << ans << endl;
}

int main()
{
    miuu;
    
    int case_number = 1;
    cin >> case_number;

    int c = 1;


    while (case_number--) {

        solution();

        // if(case_number != 0)cout << endl;
    }
    return 0;
}