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 int long long
    #define ull unsigned long long
    #define all(x)  (x).begin(), (x).end()
    #define ed '\n' 
    #define sz size
    #define pb push_back
    #define vt vector
    #define pro priority_queue<int, vector<int>, greater<int> >
    #define TEST int t;  cin>>t;  while(t--)
    #define yes cout << "Yes" << '\n'
    #define no cout << "No" << '\n'
    typedef pair<int,int> PII;	
    void show1(string s1, int x) {cout<< s1 << " = "<< x << endl;}
    void show2(string s1, string s2, int x, int y) {cout<<s1 << " = "<< x << ' ' << s2 << " = " << y << endl;}
    void show3(string s1,string s2, string s3,int x, int y, int z) {cout<< s1 <<" = " << x << ' ' <<s2 << " = " << y << ' ' << s3 << " = "<<  z << endl;}
    void stop() {cout<<"***" << endl; return ;}
    // ---------------------------------------------------------------------------//
    
    // an - a1
    void solve() {
        int n;
        cin >> n;
        vt<int> a(n + 1);
        for (int i = 1; i <= n; i++)
            cin >> a[i];
        if (n == 1) {
            cout << a[1] << ed;
            return ;
        }
        int ans = abs(a[1] - a[n]);
        int tot = n;
        for (int i = 0; i < n; i++) {
            int s = 0;
            for (int j = 1; j <= tot; j++) {
                s += a[j];
            } 
            ans = max(ans, abs(s));
            for (int j = 1; j < tot; j++) {
                a[j] = a[j + 1] - a[j];
            }
            tot--;
        }
        cout << ans << ed;
    }
    signed main() {
    	ios::sync_with_stdio(false);
		cin.tie(nullptr);
		cout.tie(nullptr);
        TEST
        solve();
        return 0;
    }
    





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

    #define int long long
    #define ull unsigned long long
    #define all(x)  (x).begin(), (x).end()
    #define ed '\n' 
    #define sz size
    #define pb push_back
    #define vt vector
    #define pro priority_queue<int, vector<int>, greater<int> >
    #define TEST int t;  cin>>t;  while(t--)
    #define yes cout << "Yes" << '\n'
    #define no cout << "No" << '\n'
    typedef pair<int,int> PII;	
    void show1(string s1, int x) {cout<< s1 << " = "<< x << endl;}
    void show2(string s1, string s2, int x, int y) {cout<<s1 << " = "<< x << ' ' << s2 << " = " << y << endl;}
    void show3(string s1,string s2, string s3,int x, int y, int z) {cout<< s1 <<" = " << x << ' ' <<s2 << " = " << y << ' ' << s3 << " = "<<  z << endl;}
    void stop() {cout<<"***" << endl; return ;}
    // ---------------------------------------------------------------------------//
    
    // an - a1
    void solve() {
        int n;
        cin >> n;
        vt<int> a(n + 1);
        for (int i = 1; i <= n; i++)
            cin >> a[i];
        if (n == 1) {
            cout << a[1] << ed;
            return ;
        }
        int ans = abs(a[1] - a[n]);
        int tot = n;
        for (int i = 0; i < n; i++) {
            int s = 0;
            for (int j = 1; j <= tot; j++) {
                s += a[j];
            } 
            ans = max(ans, abs(s));
            if (s < 0) {
                reverse(a.begin() + 1, a.begin() + 1 + tot);
            }
            for (int j = 1; j < tot; j++) {
                a[j] = a[j + 1] - a[j];
            }
            tot--;
        }
        cout << ans << ed;
    }
    signed main() {
    	ios::sync_with_stdio(false);
		cin.tie(nullptr);
		cout.tie(nullptr);
        TEST
        solve();
        return 0;
    }