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

Previous submission (verdict: Wrong answer on test 2):
#define _CRT_SECURE_NO_WARNINGS                                                                                                                            

#include <algorithm> 
#include <bitset> 
#include <cassert> 
#include <chrono> 
#include <ctime> 
#include <deque> 
#include <fstream> 
#include <functional> 
#include <initializer_list> 
#include <iomanip> 
#include <iostream> 
#include <map> 
#include <math.h> 
#include <queue> 
#include <random> 
#include <set> 
#include <stack> 
#include <stdexcept> 
#include <string> 
#include <unordered_map> 
#include <unordered_set> 
#include <vector> 

using namespace std;

#define ll long long 
#define ld long double 
#define sz(a) (int)a.size() 
#define all(a) a.begin(), a.end() 
#define rall(a) a.rbegin(), a.rend() 

ll mod = (ll)(1e9 + 7);
const int inf = 1e9 + 1;

ll gcd(ll a, ll b) {
	if (b == 0)
		return a;
	else
		return gcd(b, a % b);
}

ll binpow(ll a, ll n) {
	if (n == 0)
		return 1ll;
	if (n % 2 == 1ll)
		return (binpow(a, n - 1ll) * a) % mod;
	else {
		ll b = binpow(a, n / 2);
		return (b * b) % mod;
	}
}

struct point {
	int x; 
	int y;
	int i;
};

void solve() {
	int n; cin >> n;

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

	if (n == 1) {
		cout << a[0] << '\n';
		return;
	}

	int ans = 0;
	ans = sum;

	for (int i = 0; i < n; ++i) {
		sum = 0;
		for (int j = 0; j < n - i - 1; ++j) {
			a[j] = a[j + 1] - a[j];
			sum += a[j];
		}

		ans = max(ans, abs(sum));
	}

	cout << ans << '\n';
}

signed main() {
	ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	//freopen("test.in", "r", stdin); 
	cout << fixed << setprecision(8);
	int t = 1;
	cin >> t;
	while (t--) {
		solve();
	}
}







Submission (verdict: Accepted):
#define _CRT_SECURE_NO_WARNINGS                                                                                                                            

#include <algorithm> 
#include <bitset> 
#include <cassert> 
#include <chrono> 
#include <ctime> 
#include <deque> 
#include <fstream> 
#include <functional> 
#include <initializer_list> 
#include <iomanip> 
#include <iostream> 
#include <map> 
#include <math.h> 
#include <queue> 
#include <random> 
#include <set> 
#include <stack> 
#include <stdexcept> 
#include <string> 
#include <unordered_map> 
#include <unordered_set> 
#include <vector> 

using namespace std;

#define ll long long 
#define ld long double 
#define sz(a) (int)a.size() 
#define all(a) a.begin(), a.end() 
#define rall(a) a.rbegin(), a.rend() 

ll mod = (ll)(1e9 + 7);
const int inf = 1e9 + 1;

ll gcd(ll a, ll b) {
	if (b == 0)
		return a;
	else
		return gcd(b, a % b);
}

ll binpow(ll a, ll n) {
	if (n == 0)
		return 1ll;
	if (n % 2 == 1ll)
		return (binpow(a, n - 1ll) * a) % mod;
	else {
		ll b = binpow(a, n / 2);
		return (b * b) % mod;
	}
}

struct point {
	int x; 
	int y;
	int i;
};

void solve() {
	int n; cin >> n;

	vector<ll> a(n);
	ll sum = 0;
	for (int i = 0; i < n; ++i) {
		cin >> a[i];
		sum += a[i];
	}

	if (n == 1) {
		cout << a[0] << '\n';
		return;
	}

	ll ans = 0;
	ans = sum;

	for (int i = 0; i < n; ++i) {
		sum = 0;
		for (int j = 0; j < n - i - 1; ++j) {
			a[j] = a[j + 1] - a[j];
			sum += a[j];
		}

		ans = max(ans, abs(sum));
	}

	cout << ans << '\n';
}

signed main() {
	ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
	//freopen("test.in", "r", stdin); 
	cout << fixed << setprecision(8);
	int t = 1;
	cin >> t;
	while (t--) {
		solve();
	}
}