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

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>
#include<algorithm>
#include<set>
#include<vector>
#include<queue>
#include<map>
#define ll long long
#define endl "\n"
//#define debug(x) cout<<x<<endl;
#define debug(x) ;
using namespace std;
ll sum(vector<ll>arr) {
	ll answer = 0;
	for (auto val : arr) {
		answer += val;
	}
	return answer;
}
void print(vector<ll>arr) {
	for (auto point : arr) {
		cout << point << endl;
	}
}
ll func(vector<ll>arr, ll times) {
	if (times == 12) {
		return sum(arr);
	}
	else {
		vector<ll>_1, _2;
		_1 = arr;
		reverse(_1.begin(), _1.end());
		for (ll q = 1; q < arr.size(); ++q) {
			_2.push_back(arr[q] - arr[q - 1]);
		}
		return max(func(arr, times + 1), max(func(_1, times + 1), func(_2, times + 1)));
	}
}
void solve() {
	ll n;
	cin >> n;
	vector<ll>arr(n);
	for (ll q = 0; q < n; ++q) {
		cin >> arr[q];
	}
	vector<ll>now = arr;
	//for (ll q = 1; q <= n; ++q) {
	//	//cout << sum(now) << endl;
	//	vector<ll>_1;
	//	for (ll i = 1; i < now.size(); ++i) {
	//		_1.push_back(now[i] - now[i - 1]);
	//	}
	//	now = _1;
	//}
	if (n == 1) {
		cout << now[0] << endl;
		return;
	}
	while (now.size() > 1) {
		vector<ll>_1;
		for (ll i = 1; i < now.size(); ++i) {
			_1.push_back(now[i] - now[i - 1]);
		}
		now = _1;
	}
	cout << max(sum(arr), abs(sum(now))) << endl;
}
//while (now.size() > 1) {
//	vector<ll>_1;
//	for (ll i = 1; i < now.size(); ++i) {
//		_1.push_back(now[i] - now[i - 1]);
//	}
//	now = _1;
//}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(nullptr);
	cout.tie(nullptr);
	ll t = 1;
	cin >> t;
	while (t--) {
		solve();
	}
}

Submission (verdict: Accepted):
#include<iostream>
#include<algorithm>
#include<set>
#include<vector>
#include<queue>
#include<map>
#define ll long long
#define endl "\n"
//#define debug(x) cout<<x<<endl;
#define debug(x) ;
using namespace std;
ll sum(vector<ll>arr) {
	ll answer = 0;
	for (auto val : arr) {
		answer += val;
	}
	return answer;
}
void print(vector<ll>arr) {
	for (auto point : arr) {
		cout << point << endl;
	}
}
ll func(vector<ll>arr, ll times) {
	if (times == 12) {
		return sum(arr);
	}
	else {
		vector<ll>_1, _2;
		_1 = arr;
		reverse(_1.begin(), _1.end());
		for (ll q = 1; q < arr.size(); ++q) {
			_2.push_back(arr[q] - arr[q - 1]);
		}
		return max(func(arr, times + 1), max(func(_1, times + 1), func(_2, times + 1)));
	}
}
void solve() {
	ll n;
	cin >> n;
	vector<ll>arr(n);
	for (ll q = 0; q < n; ++q) {
		cin >> arr[q];
	}
	vector<ll>now = arr;
	//for (ll q = 1; q <= n; ++q) {
	//	//cout << sum(now) << endl;
	//	vector<ll>_1;
	//	for (ll i = 1; i < now.size(); ++i) {
	//		_1.push_back(now[i] - now[i - 1]);
	//	}
	//	now = _1;
	//}
	if (n == 1) {
		cout << now[0] << endl;
		return;
	}
	ll answer = sum(arr);
	while (now.size() > 1) {
		vector<ll>_1;
		for (ll i = 1; i < now.size(); ++i) {
			_1.push_back(now[i] - now[i - 1]);
		}
		now = _1;
		answer = max(answer, abs(sum(now)));
	}
	cout << answer << endl;
}
//while (now.size() > 1) {
//	vector<ll>_1;
//	for (ll i = 1; i < now.size(); ++i) {
//		_1.push_back(now[i] - now[i - 1]);
//	}
//	now = _1;
//}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(nullptr);
	cout.tie(nullptr);
	ll t = 1;
	cin >> t;
	while (t--) {
		solve();
	}
}