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

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define int long long
using namespace std;

void solve_1() {
    int n;
    cin >> n;
    vector<string> g(n);

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

    vector<int> p(n, LONG_LONG_MAX);
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            if (g[i][j] == '0') {
                p[j] = i;
            } else {
                if (p[i] > j) {
                    p[i] = j;
                }
            }
        }
        cout << "p: "; for (int b : p) cout << b << ' '; cout << '\n';
    }

    int mex = 0;
    vector<bool> f(n + 1);
    for (int i = 0; i < n; ++i) {
        if (p[i] < n) {
            f[p[i]] = true;
        }
    }

    for (int i = 0; i <= n; ++i) {
        if (!f[i]) {
            mex = i;
            break;
        }
    }

    cout << "f: "; for (bool b : f) cout << b << ' '; cout << '\n';
    cout << "p: "; for (int b : p) cout << b << ' '; cout << '\n';

    int t = mex;
    while (t != LONG_LONG_MAX) {
        cout << t << ' ';
        t = p[t];
    }
    cout << '\n';
}

void printIntVec(vector<int> &v, string name) {
    cout << name << ": ";
    for (int i : v) cout << i << ' ';
    cout << '\n';
}

void inIntVec(vector<int> &v) {
    for (int i = 0; i < v.size(); ++i) {
        cin >> v[i];
    }
}

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    inIntVec(a);
    int mx = accumulate(a.begin(), a.end(), 0);
    if (a.size() == 1) {
        cout << mx << '\n';
        return;
    }
    while (a.size() > 1) {
        vector<int> tmp;
        for (int i = 1; i < a.size(); ++i) {
            tmp.push_back(a[i] - a[i - 1]);
        }
        a = tmp;
    }
    cout << max(mx, abs(a[0])) << '\n';
}

int32_t main() {
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#define int long long
using namespace std;

void solve_1() {
    int n;
    cin >> n;
    vector<string> g(n);

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

    vector<int> p(n, LONG_LONG_MAX);
    for (int i = 0; i < n; ++i) {
        for (int j = i + 1; j < n; ++j) {
            if (g[i][j] == '0') {
                p[j] = i;
            } else {
                if (p[i] > j) {
                    p[i] = j;
                }
            }
        }
        cout << "p: "; for (int b : p) cout << b << ' '; cout << '\n';
    }

    int mex = 0;
    vector<bool> f(n + 1);
    for (int i = 0; i < n; ++i) {
        if (p[i] < n) {
            f[p[i]] = true;
        }
    }

    for (int i = 0; i <= n; ++i) {
        if (!f[i]) {
            mex = i;
            break;
        }
    }

    cout << "f: "; for (bool b : f) cout << b << ' '; cout << '\n';
    cout << "p: "; for (int b : p) cout << b << ' '; cout << '\n';

    int t = mex;
    while (t != LONG_LONG_MAX) {
        cout << t << ' ';
        t = p[t];
    }
    cout << '\n';
}

void printIntVec(vector<int> &v, string name) {
    cout << name << ": ";
    for (int i : v) cout << i << ' ';
    cout << '\n';
}

void inIntVec(vector<int> &v) {
    for (int i = 0; i < v.size(); ++i) {
        cin >> v[i];
    }
}

void solve() {
    int n;
    cin >> n;
    vector<int> a(n);
    inIntVec(a);
    int mx = accumulate(a.begin(), a.end(), 0ll);
    if (a.size() == 1) {
        cout << mx << '\n';
        return;
    }
    while (a.size() > 1) {
        vector<int> tmp;
        for (int i = 1; i < a.size(); ++i) {
            tmp.push_back(a[i] - a[i - 1]);
        }
        a = tmp;
        int sm = accumulate(a.begin(), a.end(), 0ll);
        mx = max(mx, sm);
    }
    cout << max(mx, abs(a[0])) << '\n';
}

int32_t main() {
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
    return 0;
}