Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 1):
//fly!
#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<numeric>
#define ll long  long
#define ull unsigned long long
#define itn int 
#define mian main
#define N 1000010
#define end <<"\n"
#define endd <<" "
#define yes true
#define no false
#define fi first
#define se second
#define be begin()
#define en end()
#define double long double
using namespace std;
//atuo lfy 琴弦断了，缘也尽了，你也走了
//ll x[500010] = { 0 };
ll sumy = 0;ll x[1000010]={0};ll x1[1000010]={0};

int Rank[1000010]={0};int pre[1000010]={0};
inline ll gcd(ll a, ll b) { return b > 0 ? gcd(b, a % b) : a; }// from kdb学长
inline ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
inline int jihefind(int root){if(pre[root]==root){return root;}pre[root]=jihefind(pre[root]);return pre[root];}
inline int jihejoin(int x,int y){ x=jihefind(x); y=jihefind(y);if(x==y){return 0;}if(Rank[x]>Rank[y]){pre[y]=x;}else{if(Rank[x]==Rank[y]){Rank[y]++;}pre[x]=y;}return 1;}
inline bool issame(itn x,int y){return jihefind(x)==jihefind(y);}
// priority_queue<int> q;//优先队列 大
//priority_queue<int,vector<int>,greater<int> > q;//优先队列 小
// struct q{

// }x;
//bool cmp(jian q, jian w) {
//    return q.b > w.b;
//}
int dx[8]={-1,1,0,0,-1,-1,1,1};
int dy[8]={0,0,-1,1,-1,1,-1,1};//上下左右，左上右上左下右上
void bfs(int i,int j){
  
}
void solve() {      
int n;
cin>>n;sumy=0;

for(int i=1;i<=n;i++){
  cin>>x[i];sumy+=x[i];
}
if(n==1){
  cout<<x[1] end;return ;
}
ll maxx=-1;
while(n){
  n--;ll sum=0;
  for(itn i=1;i<=n;i++){
    x[i]=x[i+1]-x[i];
    sum+=x[i];
  }
   maxx=max(sumy,max(sum,-sum));
}
cout<<maxx end;
}
int main() {
    std::ios::sync_with_stdio(false);
    int T = 1;
    // scanf("%d", &T);
      cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}

Submission (verdict: Accepted):
//fly!
#include<bits/stdc++.h>
#include<algorithm>
#include<string>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<numeric>
#define ll long  long
#define ull unsigned long long
#define itn int 
#define mian main
#define N 1000010
#define end <<"\n"
#define endd <<" "
#define yes true
#define no false
#define fi first
#define se second
#define be begin()
#define en end()
#define double long double
using namespace std;
//atuo lfy 琴弦断了，缘也尽了，你也走了
//ll x[500010] = { 0 };
ll sumy = 0;ll x[1000010]={0};ll x1[1000010]={0};

int Rank[1000010]={0};int pre[1000010]={0};
inline ll gcd(ll a, ll b) { return b > 0 ? gcd(b, a % b) : a; }// from kdb学长
inline ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
inline int jihefind(int root){if(pre[root]==root){return root;}pre[root]=jihefind(pre[root]);return pre[root];}
inline int jihejoin(int x,int y){ x=jihefind(x); y=jihefind(y);if(x==y){return 0;}if(Rank[x]>Rank[y]){pre[y]=x;}else{if(Rank[x]==Rank[y]){Rank[y]++;}pre[x]=y;}return 1;}
inline bool issame(itn x,int y){return jihefind(x)==jihefind(y);}
// priority_queue<int> q;//优先队列 大
//priority_queue<int,vector<int>,greater<int> > q;//优先队列 小
// struct q{

// }x;
//bool cmp(jian q, jian w) {
//    return q.b > w.b;
//}
int dx[8]={-1,1,0,0,-1,-1,1,1};
int dy[8]={0,0,-1,1,-1,1,-1,1};//上下左右，左上右上左下右上
void bfs(int i,int j){
  
}
void solve() {      
int n;
cin>>n;sumy=0;
for(int i=1;i<=n;i++){
  cin>>x[i];sumy+=x[i];
}
if(n==1){
  cout<<x[1] end;return ;
}
while(n){
  n--;ll sum=0;
  for(itn i=1;i<=n;i++){
    x[i]=x[i+1]-x[i];
    sum+=x[i];
  }
   sumy=max(sumy,max(sum,-sum));
}
cout<<sumy end;
}
int main() {
    std::ios::sync_with_stdio(false);
    int T = 1;
    // scanf("%d", &T);
      cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}