Problem: 2062C - Cirno and Operations
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>
using namespace std;
 
// PBDS:
#include <ext/pb_ds/assoc_container.hpp> // find_by_order(x) = s[x]
#include <ext/pb_ds/tree_policy.hpp>     // order_of_key(x)  = # of elements strictly smaller than x
using namespace __gnu_pbds;
template<typename dataType>
using ordered_set = tree<dataType, null_type, less<dataType>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename dataType1, typename dataType2>
using ordered_map = tree<dataType1, dataType2, less<dataType1>, rb_tree_tag, tree_order_statistics_node_update>;
template<typename dataType>
using ordered_multiset = tree<dataType, null_type, less_equal<dataType>, rb_tree_tag, tree_order_statistics_node_update>;
 
 
typedef long long int         ll;
typedef long double           ld;
typedef pair<int, int>          pi;
typedef vector<int>            vi;
typedef vector<ll>            vll;
typedef vector<vector<int>>    vvi;
typedef vector<pair<int, int>>  vpi;
typedef vector<bool>          vb;
 
#define pb            push_back
#define pf            push_front
#define all(x)        begin(x), end(x)
#define sz(x)         (int)(x).size()
#define ff            first
#define ss            second
#define mp            make_pair
#define mt            make_tuple
#define lb            lower_bound
#define ub            upper_bound
#define Tcase()       int tcc; cin >> tcc; while(tcc--)
#define FOR(i, a, b)  for(ll i = (a); i < (b); i++)
#define F0R(i, a)     FOR(i, 0, a)
#define YES           cout << "YES\n"
#define NO            cout << "NO\n"
#define lcm(a, b)     ((a / __gcd(a, b)) * b)
#define rrep(i, a, b)  for(ll i = (a); i < (b); i++)
#define rep(i, a)     FOR(i, 0, a)
 
ll  MOD   = 1e9 + 7;   //998244353
const ll  INF   = 9e18;
const int MX    = 2e5 + 5;
const ld  PI    = acos((ld) -1);
const int dx[8] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[8] = {1, 0, -1, 0, 1, -1, -1, 1};
 
void setIO(string name = "") {
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    if(sz(name)){
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}
 
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); }
inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); }
inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline ll modPow(ll b, ll p) { ll r = 1LL; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1LL; } return r; }
inline ll modDiv(ll a, ll b) { return modMul(a, modPow(b, MOD-2)); }
 
 
ll Bigmod(ll a, ll b, ll m){
    if(b == 0) return 1 % m;
    ll x = Bigmod(a, b / 2LL, m);
    x = (x * x) % m;
    if(b % 2 == 1) x = (x * a) % m;
    return x;
}
void C(int ttt){
    int n; cin>>n; vi a(n); rep(i,n) cin>>a[i];
    if(n==1) {cout << a[0] << endl; return;}
    while(n>2){
        rep(i,n-1){
            a[i]=a[i+1]-a[i];
        }
        n--;
    }
    cout << max(a[0]-a[1],a[1]-a[0]) << endl;
}
int main(){
    setIO();
    int ttt=1;
    Tcase()
        C(ttt++);
}