Problem: 2062C - Cirno and Operations
Language: c++17 

Code 1:
#include <bits/stdc++.h>
#include<conio.h>
#define whc long long int
#define whl ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define nl "\n"
using namespace std;
vector<whc> divisor(whc n)
{
    vector<whc> div;
    whc i;
    for(i=1;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            if(n/i==i)
                div.push_back(i);
            else
                div.push_back(i),div.push_back(n/i);
        }
    }
    sort(div.begin(),div.end());
    return div;
}
bool is_prime(whc n)
{
    if(n==1)
        return false;
    whc i;
    i=2;
    while(i*i<=n)
    {
        if (n%i==0)
            return false;
        i+=1;
    }
    return true;
}
whc distance(whc x1,whc y1,whc x2,whc y2)
{
    return (((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)));
}
whc lcm(vector<whc> vec)
{
    whc x=2,i,m,r=1;
    sort(vec.begin(),vec.end());
    m=vec[vec.size()-1];
    while(x<=m)
    {
        vector<whc> cnt;
        for(i=0;i<vec.size();i++)
        {
            if(vec[i]%x==0)
                cnt.push_back(i);
        }
        if(cnt.size()>=2)
        {
            for(i=0;i<cnt.size();i++)
                vec[cnt[i]]/=x;
            r*=x;
        }
        else
            x++;
    }
    for(i=0;i<vec.size();i++)
        r*=vec[i];
    return r;
}
int main()
{
    whl
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    whc t;
    cin>>t;
    //t=1;
    while(t--)
    {
        whc n,i,x,s=-1e18,a;
        cin>>n;
        vector<whc> vec,tmp;
        for(i=0;i<n;i++)
        {
            cin>>x;
            vec.push_back(x);
        }
        a=accumulate(vec.begin(),vec.end(),0);
        s=max(s,a);
        while(n>1)
        {
            for(i=1;i<n;i++)
            {
                tmp.push_back(vec[i]-vec[i-1]);
            }
            n--;
            a=abs(accumulate(tmp.begin(),tmp.end(),0));
            vec=tmp;
            tmp.clear();
            s=max(s,a);
        }
        cout<<s<<nl;
    }
}


Code 2:
#include <bits/stdc++.h>
#include<conio.h>
#define whc long long int
#define whl ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define nl "\n"
using namespace std;
vector<whc> divisor(whc n)
{
    vector<whc> div;
    whc i;
    for(i=1;i<=sqrt(n);i++)
    {
        if(n%i==0)
        {
            if(n/i==i)
                div.push_back(i);
            else
                div.push_back(i),div.push_back(n/i);
        }
    }
    sort(div.begin(),div.end());
    return div;
}
bool is_prime(whc n)
{
    if(n==1)
        return false;
    whc i;
    i=2;
    while(i*i<=n)
    {
        if (n%i==0)
            return false;
        i+=1;
    }
    return true;
}
whc distance(whc x1,whc y1,whc x2,whc y2)
{
    return (((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)));
}
whc lcm(vector<whc> vec)
{
    whc x=2,i,m,r=1;
    sort(vec.begin(),vec.end());
    m=vec[vec.size()-1];
    while(x<=m)
    {
        vector<whc> cnt;
        for(i=0;i<vec.size();i++)
        {
            if(vec[i]%x==0)
                cnt.push_back(i);
        }
        if(cnt.size()>=2)
        {
            for(i=0;i<cnt.size();i++)
                vec[cnt[i]]/=x;
            r*=x;
        }
        else
            x++;
    }
    for(i=0;i<vec.size();i++)
        r*=vec[i];
    return r;
}
int main()
{
    whl
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
    whc t;
    cin>>t;
    //t=1;
    while(t--)
    {
        whc n,s=-1e18,i,j,m,a;
        cin>>n;
        vector<whc> vec(n+1);
        for (i=1;i<=n;i++)
            cin>>vec[i];
        m=n;
        for(j=1;j<=n;j++)
        {
            a=0;
            for(i=1;i<=m;i++)
                a+=vec[i];
            if(j==1)
                s=max(s,a);
            else
                s=max(s,max(a,(-a)));
            for(i=1;i<m;i++)
                vec[i]=(vec[i+1]-vec[i]);
            m--;
        }
        cout<<s<<nl; 
    }
}


Answer: 2