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

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <cassert>
using namespace std;
using namespace __gnu_pbds;
#define num1bit(x) __builtin_popcountll(x)
#define ISOK(x,y,z) cout<<(x?(y):(z));
#define OK(x) ISOK(x,"YES\n","NO\n")
#define C continue
#define B break
#define R return
#define nd second
#define st first
#define bn begin()
#define ed end()
#define wte long Tests ; cin >> Tests ; while(Tests--)
#define wtede long Tests ; cin >> Tests ; for(int testcase = 1; testcase <=Tests;testcase++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// #define b(myint,z,size) bitset<size>z(myint) ; cout<<z<<endl ;
template<typename T>ostream& operator<<(ostream& stream, pair<T, T>& pair){ stream << pair.first << ' ' << pair.second; return stream; };
template<typename T>istream& operator>>(istream& stream, pair<T, T>& pair){ stream >> pair.first >> pair.second; return stream; };
// #define endl '\n'
#define pb push_back
#define SPR(a) cout<<fixed<<setprecision(a) ;
#define sleep(a) this_thread::sleep_for(chrono::milliseconds(a));
#define all(x) (x).begin(), (x).end()	
void dbg_out(){ cerr << endl; }
template<typename Head, typename... Tail>
void dbg_out(Head H, Tail... T){ cerr << ' ' << H; dbg_out(T...); }
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef priority_queue<ll> pqll;
typedef priority_queue<int> pqi;
const ll oo = (int)1e9 + 7, mod = oo, moD = 998244353, lloo = 1e18;
const ld eps = 1e-8, PI = 3.14159265359;
inline ll mid(ll l, ll r){ R(r - l) / 2 + l; }
inline ll MSB(int n){ R 63 - __builtin_clzll(n); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename y, typename T> y smax(y& a, const T& b){ if(a < b) a = b; R a; }
template<typename y, typename T> y smin(y& a, const T& b){ if(a > b) a = b; R a; }

ll n, x, y, z, k, m;
ll a[2000];
#define TCASES
// #define DEBUG
void maininit(){}
void solve(){
	cin >> n;
	ll ans = 0;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		ans += a[i];
	}
	for(int i = 1; i < n; i++){
		for(int j = 1; j <= n - i; j++) a[j] = a[j + 1] - a[j];
		smax(ans, (a[n - i] - a[1]));
		smax(ans, -(a[n - i] - a[1]));
	}
	cout << ans << endl;

}

int main(){
#ifndef DEBUG
	IOS;
#endif
	auto start = chrono::high_resolution_clock::now();
	maininit();
#ifdef TCASES
	wte
#endif
		solve();
#ifdef DEBUG
	auto end = chrono::high_resolution_clock::now();
	cerr << "\nExecution time: "
		<< chrono::duration_cast<chrono::milliseconds>(end - start).count()
		<< " ms" << endl;
#endif
	return 0;
}

Submission (verdict: Wrong answer on test 6):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <cassert>
using namespace std;
using namespace __gnu_pbds;
#define num1bit(x) __builtin_popcountll(x)
#define ISOK(x,y,z) cout<<(x?(y):(z));
#define OK(x) ISOK(x,"YES\n","NO\n")
#define C continue
#define B break
#define R return
#define nd second
#define st first
#define bn begin()
#define ed end()
#define wte long Tests ; cin >> Tests ; while(Tests--)
#define wtede long Tests ; cin >> Tests ; for(int testcase = 1; testcase <=Tests;testcase++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// #define b(myint,z,size) bitset<size>z(myint) ; cout<<z<<endl ;
template<typename T>ostream& operator<<(ostream& stream, pair<T, T>& pair){ stream << pair.first << ' ' << pair.second; return stream; };
template<typename T>istream& operator>>(istream& stream, pair<T, T>& pair){ stream >> pair.first >> pair.second; return stream; };
// #define endl '\n'
#define pb push_back
#define SPR(a) cout<<fixed<<setprecision(a) ;
#define sleep(a) this_thread::sleep_for(chrono::milliseconds(a));
#define all(x) (x).begin(), (x).end()	
void dbg_out(){ cerr << endl; }
template<typename Head, typename... Tail>
void dbg_out(Head H, Tail... T){ cerr << ' ' << H; dbg_out(T...); }
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_multiset;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpi;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef priority_queue<ll> pqll;
typedef priority_queue<int> pqi;
const ll oo = (int)1e9 + 7, mod = oo, moD = 998244353, lloo = 1e18;
const ld eps = 1e-8, PI = 3.14159265359;
inline ll mid(ll l, ll r){ R(r - l) / 2 + l; }
inline ll MSB(int n){ R 63 - __builtin_clzll(n); }
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename y, typename T> y smax(y& a, const T& b){ if(a < b) a = b; R a; }
template<typename y, typename T> y smin(y& a, const T& b){ if(a > b) a = b; R a; }

ll n, x, y, z, k, m;
ll a[2000];
#define TCASES
// #define DEBUG
void maininit(){}
void solve(){
	cin >> n;
	ll ans = 0;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		ans += a[i];
	}
	for(int i = 1; i < n; i++){
		for(int j = 1; j <= n - i; j++) a[j] = a[j + 1] - a[j];
		if(i != n - 1){
			smax(ans, (a[n - i] - a[1]));
			smax(ans, -(a[n - i] - a[1]));
		}
		else{
			smax(ans, a[1]);
			smax(ans, -a[1]);
		}
	}
	cout << ans << endl;

}

int main(){
#ifndef DEBUG
	IOS;
#endif
	auto start = chrono::high_resolution_clock::now();
	maininit();
#ifdef TCASES
	wte
#endif
		solve();
#ifdef DEBUG
	auto end = chrono::high_resolution_clock::now();
	cerr << "\nExecution time: "
		<< chrono::duration_cast<chrono::milliseconds>(end - start).count()
		<< " ms" << endl;
#endif
	return 0;
}