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

Previous submission (verdict: Wrong answer on test 2):
//SHANKY CAN'T CODE
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long int 
#define loop(i,n) for(int i = 0; i < n; ++i)
#define loop1(i,n) for(int i = 1; i <= n; ++i)
#define endl "\n"
#define rep(i, s, e) for(int i = s; i < e; i++)
#define repd(i, s, e) for(int i = s; i>e; i--)
#define scan(arr) for(auto &x : arr) cin>>x;
#define print(arr) for(auto &x : arr) cout<<x<<" "; cout<<endl;
#define pb        push_back
#define ppb       pop_back
#define vi        vector<ll>
#define vpi        vector<pair<ll,ll>>
#define vvi       vector<vector<ll>>
#define all(x)    (x.begin(),x.end())
#define ppf       pop_front
#define pf        push_front
#define mod       1e9+7
#define YES       cout<<"YES"<<"\n";
#define NO        cout<<"NO"<<"\n";
#define Yes       cout<<"Yes"<<"\n";
#define No        cout<<"No"<<"\n";
#define yes       cout<<"yes"<<"\n";
#define no        cout<<"no"<<"\n";
#define mod 1e9+7
int reversal(int n);                            //reverse intezers
int digit_sum(int n);                           //sum of int digits
int ati(int arr[],int n);                       //array to intezer
int lenint(int n);                              //length of any intezer
string binary(int n);                           //int to binary(string)
int max_sub(string s,char a);                   //return max conse freq of a
void fast()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
/****************************************************************************************************************/
void solve(){
       int n; cin>>n; vi v;
       int sum=0;
       rep(i,0,n){
        int x; cin>>x;
        v.pb(x);
        sum+=x;
       }
    //    print(v);
       int k=v.size();
       while(k){
        int sm=0;
        int x=0;
        reverse(v.begin(),v.end());
        for(int i=0; i<v.size()-1; i++){
            v[i] = v[i+1]-v[i];
            sm+=v[i];
            x=1;
        }
        // print(v);
        v.pop_back();
        k--;
        if(sm==0 && x==0){
            continue;
        }
        else{
            sum=max(sum,sm);
        }
        
       }
       cout<<sum<<endl;
}
/*****************************************************************************************************************/
signed main(){
fast();
int t;
cin>>t;
while(t--){
solve();
}
return 0;
}
int lenint(ll n){
    return floor(log10(n) + 1);
}
int ati(int a[],int n){
    int x=0;
    for(int i=0; i<n; i++){
        x+=a[i];
        x*=10;
    }
    return(x/10);
}
int reversal(int n){
    int x=0,j=(int)pow(10,(int)log10(n));
    while(n){
        x+=(n%10)*j;
        n/=10;
        j/=10;
    }
    return x;
}
// string binary(int n){
//     string str="";
//     int binaryNum[32];
//     int i = 0;
//     while (n > 0) {
//         int x=n%2;
//         str.push_back(x+'0');
//         n = n / 2;
//     }
//     reverse(all(str));
//     return str;
// }
int digit_sum(int n){
    int x=0;
    while(n){
        x+=n%10;
        n/=10;
    }
    return x;
}
int max_sub(string s, char a){
    int temp=0,flag=0,ans=0;
    for(int i=0; i<s.size(); i++){
        if(s[i]==a){
            temp++; flag=1;
        }
        else{
            temp=0; flag=0;
        }
        if(flag==1 && temp>ans)
            ans=temp;
    }
    return ans;
}

Submission (verdict: Wrong answer on test 2):
//SHANKY CAN'T CODE
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define int long long int 
#define loop(i,n) for(int i = 0; i < n; ++i)
#define loop1(i,n) for(int i = 1; i <= n; ++i)
#define endl "\n"
#define rep(i, s, e) for(int i = s; i < e; i++)
#define repd(i, s, e) for(int i = s; i>e; i--)
#define scan(arr) for(auto &x : arr) cin>>x;
#define print(arr) for(auto &x : arr) cout<<x<<" "; cout<<endl;
#define pb        push_back
#define ppb       pop_back
#define vi        vector<ll>
#define vpi        vector<pair<ll,ll>>
#define vvi       vector<vector<ll>>
#define all(x)    (x.begin(),x.end())
#define ppf       pop_front
#define pf        push_front
#define mod       1e9+7
#define YES       cout<<"YES"<<"\n";
#define NO        cout<<"NO"<<"\n";
#define Yes       cout<<"Yes"<<"\n";
#define No        cout<<"No"<<"\n";
#define yes       cout<<"yes"<<"\n";
#define no        cout<<"no"<<"\n";
#define mod 1e9+7
int reversal(int n);                            //reverse intezers
int digit_sum(int n);                           //sum of int digits
int ati(int arr[],int n);                       //array to intezer
int lenint(int n);                              //length of any intezer
string binary(int n);                           //int to binary(string)
int max_sub(string s,char a);                   //return max conse freq of a
void fast()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
/****************************************************************************************************************/
void solve(){
       int n; cin>>n; vi v;
       int sum=0;
       rep(i,0,n){
        int x; cin>>x;
        v.pb(x);
        sum+=x;
       }
    //    print(v);
       int k=v.size();
       while(k>1){
        int sm=0;
        int x=0;
        reverse(v.begin(),v.end());
        for(int i=0; i<k-1; i++){
            v[i] = v[i+1]-v[i];
            sm+=v[i];
            x=1;
        }
        // print(v);
        v.pop_back();
        k--;
        if(sm==0 && x==0){
            continue;
        }
        else{
            sum=max(sum,sm);
        }
        
       }
       cout<<sum<<endl;
}
/*****************************************************************************************************************/
signed main(){
fast();
int t;
cin>>t;
while(t--){
solve();
}
return 0;
}
int lenint(ll n){
    return floor(log10(n) + 1);
}
int ati(int a[],int n){
    int x=0;
    for(int i=0; i<n; i++){
        x+=a[i];
        x*=10;
    }
    return(x/10);
}
int reversal(int n){
    int x=0,j=(int)pow(10,(int)log10(n));
    while(n){
        x+=(n%10)*j;
        n/=10;
        j/=10;
    }
    return x;
}
// string binary(int n){
//     string str="";
//     int binaryNum[32];
//     int i = 0;
//     while (n > 0) {
//         int x=n%2;
//         str.push_back(x+'0');
//         n = n / 2;
//     }
//     reverse(all(str));
//     return str;
// }
int digit_sum(int n){
    int x=0;
    while(n){
        x+=n%10;
        n/=10;
    }
    return x;
}
int max_sub(string s, char a){
    int temp=0,flag=0,ans=0;
    for(int i=0; i<s.size(); i++){
        if(s[i]==a){
            temp++; flag=1;
        }
        else{
            temp=0; flag=0;
        }
        if(flag==1 && temp>ans)
            ans=temp;
    }
    return ans;
}