Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

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

#define putchar_unlocked putchar
#define getchar_unlocked getchar

struct Reader { int ch; operator bool() { return ch != EOF; } template<typename T> Reader &operator>>(T &x) { x = 0; int f = 1; ch = getchar_unlocked(); while (ch != EOF && (ch < '0' || ch > '9')) { if (ch == '-') f = -1; ch = getchar_unlocked(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar_unlocked(); } x *= f; return *this; } Reader &operator>>(char &s) { ch = getchar_unlocked(); while (ch == ' ' || ch == '\n' || ch == '\r') ch = getchar_unlocked(); s = ch; return *this; } Reader &operator>>(char *s) { char ch = getchar_unlocked(); while (ch == ' ' || ch == '\n' || ch == '\r') ch = getchar_unlocked(); while (ch != ' ' && ch != '\n' && ch != '\r' && ch != EOF) *(s++) = ch, ch = getchar_unlocked(); *s = '\0'; return *this; } } reader; struct Writer { template<typename T> Writer &operator<<(T x) { if (x < 0) { putchar_unlocked('-'); x = -x; } if (x > 9) *this << x / 10; putchar_unlocked(x % 10 + '0'); return *this; } Writer &operator<<(char ch) { putchar_unlocked(ch); return *this; } Writer &operator<<(const char *s) { for (int i = 0; s[i]; i++) putchar_unlocked(s[i]); return *this; } } writer;

#define cin reader
#define cout writer
#define endl '\n'

#define f(i, a, b) for (int i = (a), _##i = (b); i <= _##i; i++)
#define fr(i, a, b) for (int i = (a), _##i = (b); i >= _##i; i--)
typedef long long LL;

const int N = 55;
int n, a[N];
int solve() {
    cin >> n; f(i, 1, n) cin >> a[i];
    LL ans = accumulate(a + 1, a + n + 1, 0ll);
    while (n > 1) {
        f(i, 1, n - 1) a[i] = a[i + 1] - a[i];
        n--;
        LL sum = accumulate(a + 1, a + n + 1, 0ll);
        ans = max(ans, abs(sum));
    }
    return ans;
}
int main() {
    int T; cin >> T;
    while (T--) cout << solve() << endl;
}

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

#define putchar_unlocked putchar
#define getchar_unlocked getchar

struct Reader { int ch; operator bool() { return ch != EOF; } template<typename T> Reader &operator>>(T &x) { x = 0; int f = 1; ch = getchar_unlocked(); while (ch != EOF && (ch < '0' || ch > '9')) { if (ch == '-') f = -1; ch = getchar_unlocked(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar_unlocked(); } x *= f; return *this; } Reader &operator>>(char &s) { ch = getchar_unlocked(); while (ch == ' ' || ch == '\n' || ch == '\r') ch = getchar_unlocked(); s = ch; return *this; } Reader &operator>>(char *s) { char ch = getchar_unlocked(); while (ch == ' ' || ch == '\n' || ch == '\r') ch = getchar_unlocked(); while (ch != ' ' && ch != '\n' && ch != '\r' && ch != EOF) *(s++) = ch, ch = getchar_unlocked(); *s = '\0'; return *this; } } reader; struct Writer { template<typename T> Writer &operator<<(T x) { if (x < 0) { putchar_unlocked('-'); x = -x; } if (x > 9) *this << x / 10; putchar_unlocked(x % 10 + '0'); return *this; } Writer &operator<<(char ch) { putchar_unlocked(ch); return *this; } Writer &operator<<(const char *s) { for (int i = 0; s[i]; i++) putchar_unlocked(s[i]); return *this; } } writer;

#define cin reader
#define cout writer
#define endl '\n'

#define f(i, a, b) for (int i = (a), _##i = (b); i <= _##i; i++)
#define fr(i, a, b) for (int i = (a), _##i = (b); i >= _##i; i--)
typedef long long LL;

const int N = 55;
int n, a[N];
LL solve() {
    cin >> n; f(i, 1, n) cin >> a[i];
    LL ans = accumulate(a + 1, a + n + 1, 0ll);
    while (--n >= 1) {
        f(i, 1, n) a[i] = a[i + 1] - a[i];
        LL sum = accumulate(a + 1, a + n + 1, 0ll);
        ans = max(ans, abs(sum));
    }
    return ans;
}
int main() {
    int T; cin >> T;
    while (T--) cout << solve() << endl;
}