ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2049C - MEX Cycle
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>



using namespace std;



void dbg_out() { cerr << endl; }

template <typename Head, typename... Tail>

void dbg_out(Head H, Tail... T) {

    cerr << ' ' << H;

    dbg_out(T...);

}

#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)

#define FAST ios::sync_with_stdio(0), cin.tie(0)

#define pb push_back

#define mp make_pair

#define f first

#define s second

#define endl '\n'



typedef long long int  ll;

typedef unsigned long long int ull;

const int inf = (int)1e9;

const ll mod = 1e9 + 7;

const int MAXN = 200007;

//const double eps=numeric_limits<double>::epsilon();



void solve() {

    int n, x, y; cin >> n >> x >> y;

    --x; --y;

    int a[n];

    int f = 0;

    for (int i = 0;i < n;++i) {

        a[i] = f;

        f ^= 1;

    }

    if (a[n - 1] == 0) a[n - 1] = 2;



    auto print = [&]() -> void {

        for (int i = 0;i < n;++i) {

            cout << a[i] << ' ';

        }

        cout << endl;

        };



    if (a[x] != a[y]) {

        print();

        return;

    }



    a[y - 1] = 2;

    f = a[x] ^ 1;

    for (int i = y; i < n;++i) {

        a[i] = f;

        f ^= 1;

    }

    if (a[n - 1] == 0) a[n - 1] = 2;

    print();

}



int main(void) {

    FAST;

    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}

Submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h>



using namespace std;



void dbg_out() { cerr << endl; }

template <typename Head, typename... Tail>

void dbg_out(Head H, Tail... T) {

    cerr << ' ' << H;

    dbg_out(T...);

}

#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)

#define FAST ios::sync_with_stdio(0), cin.tie(0)

#define pb push_back

#define mp make_pair

#define f first

#define s second

#define endl '\n'



typedef long long int  ll;

typedef unsigned long long int ull;

const int inf = (int)1e9;

const ll mod = 1e9 + 7;

const int MAXN = 200007;

//const double eps=numeric_limits<double>::epsilon();



void solve() {

    int n, x, y; cin >> n >> x >> y;

    --x; --y;

    int a[n];

    int f = 0;

    for (int i = 0;i < n;++i) {

        a[i] = f;

        f ^= 1;

    }

    if (a[n - 1] == 0) a[n - 1] = 2;



    auto print = [&]() -> void {

        for (int i = 0;i < n;++i) {

            cout << a[i] << ' ';

        }

        cout << endl;

        };



    if (a[x] != a[y]) {

        print();

        return;

    }



    a[x] = 2;

    print();

}



int main(void) {

    FAST;

    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
//O(n)1e8, O(n*logn)1e6, O(n*sqrt(n))1e5

//O(n^2)5e3, O(n^3)3e2, O(2^n)25, O(n!)11

#include<bits/stdc++.h>

using namespace std;

#define rep(i,l,r) for(int i = l; i <= r; i++)

#define ull unsigned long long

#define pii pair<int,int>

#define int long long

#define pb push_back

#define se second

#define fi first

#define endl '\n'

const int mod1 = 1e9 + 7;

const int mod2 = 998244353;

const int inf = 0x3f3f3f3f;

const int N = 2e5 + 5;



void solve() {

    int n,l,r; cin >> n >> l >> r;

    vector<int> a(n+1);

    rep(i,1,n) cin >> a[i];

    sort(a.begin()+1, a.end());

    int len = r-l+1;

    int sum = 0;

    rep(i,1,len) sum+=a[i];

    cout << sum << endl;

}

signed main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr), cout.tie(nullptr);

    int T = 1;

    cin >> T;

    while (T--) solve();

    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
//O(n)1e8, O(n*logn)1e6, O(n*sqrt(n))1e5

//O(n^2)5e3, O(n^3)3e2, O(2^n)25, O(n!)11

#include<bits/stdc++.h>

using namespace std;

#define rep(i,l,r) for(int i = l; i <= r; i++)

#define ull unsigned long long

#define pii pair<int,int>

#define int long long

#define pb push_back

#define se second

#define fi first

#define endl '\n'

const int mod1 = 1e9 + 7;

const int mod2 = 998244353;

const int inf = 0x3f3f3f3f;

const int N = 2e5 + 5;

//反例:

//6 3 4

//2 1 2 2 1 2

//sort ->

//1 1 2 2 2 2

void solve() {

    int n, l, r;

    cin >> n >> l >> r;

    int len = r - l + 1;

    int sum1 = 0,sum2 = 0;

    vector<int> a(n + 1),b(n+1);

    rep(i, 1, n) cin >> a[i],b[i] = a[i];

    sort(a.begin(),a.begin() + r);

    rep(i,1,len) {

//        cout << a[i] << " ";

        sum1 += a[i];

    }

    sort(b.begin() + l,b.end());

    rep(i,l,r) {

//        cout << b[i] << " ";

        sum2 += b[i];

    }

    cout << min(sum1,sum2) << endl;

}

signed main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr), cout.tie(nullptr);

    int T = 1;

    cin >> T;

    while (T--) solve();

    return 0;

}



Submission (verdict: Accepted):
//O(n)1e8, O(n*logn)1e6, O(n*sqrt(n))1e5

//O(n^2)5e3, O(n^3)3e2, O(2^n)25, O(n!)11

#include<bits/stdc++.h>

using namespace std;

#define rep(i,l,r) for(int i = l; i <= r; i++)

#define ull unsigned long long

#define pii pair<int,int>

#define int long long

#define pb push_back

#define se second

#define fi first

#define endl '\n'

const int mod1 = 1e9 + 7;

const int mod2 = 998244353;

const int inf = 0x3f3f3f3f;

const int N = 2e5 + 5;

//反例:

//6 3 4

//2 1 2 2 1 2

//sort ->

//1 1 2 2 2 2

int a[N],b[N];

void solve() {

    int n, l, r;

    cin >> n >> l >> r;

    memset(a,0,sizeof a);

    memset(b,0,sizeof b);

    int len = r - l + 1;

    int sum1 = 0,sum2 = 0;

    rep(i, 1, n) cin >> a[i],b[i] = a[i];

    sort(a+1,a+1+r);

    rep(i,1,len) {

//        cout << a[i] << " ";

        sum1 += a[i];

    }

    sort(b+l,b+n+1);

    rep(i,l,r) {

//        cout << b[i] << " ";

        sum2 += b[i];

    }

    cout << min(sum1,sum2) << endl;

}

signed main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr), cout.tie(nullptr);

    int T = 1;

    cin >> T;

    while (T--) solve();

    return 0;

}
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
//O(n)1e8, O(n*logn)1e6, O(n*sqrt(n))1e5

//O(n^2)5e3, O(n^3)3e2, O(2^n)25, O(n!)11

#include<bits/stdc++.h>

using namespace std;

#define rep(i,l,r) for(int i = l; i <= r; i++)

#define ull unsigned long long

#define pii pair<int,int>

#define int long long

#define pb push_back

#define se second

#define fi first

#define endl '\n'

const int mod1 = 1e9 + 7;

const int mod2 = 998244353;

const int inf = 0x3f3f3f3f;

const int N = 2e5 + 5;



void solve() {

    int n,l,r; cin >> n >> l >> r;

    vector<int> a(n+1);

    rep(i,1,n) cin >> a[i];

    sort(a.begin()+1, a.end());

    int len = r-l+1;

    int sum = 0;

    rep(i,1,len) sum+=a[i];

    cout << sum << endl;

}

signed main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr), cout.tie(nullptr);

    int T = 1;

    cin >> T;

    while (T--) solve();

    return 0;

}



Submission (verdict: Wrong answer on test 2):
//O(n)1e8, O(n*logn)1e6, O(n*sqrt(n))1e5

//O(n^2)5e3, O(n^3)3e2, O(2^n)25, O(n!)11

#include<bits/stdc++.h>

using namespace std;

#define rep(i,l,r) for(int i = l; i <= r; i++)

#define ull unsigned long long

#define pii pair<int,int>

#define int long long

#define pb push_back

#define se second

#define fi first

#define endl '\n'

const int mod1 = 1e9 + 7;

const int mod2 = 998244353;

const int inf = 0x3f3f3f3f;

const int N = 2e5 + 5;

//反例:

//6 3 4

//2 1 2 2 1 2

//sort ->

//1 1 2 2 2 2

void solve() {

    int n, l, r;

    cin >> n >> l >> r;

    int len = r - l + 1;

    int sum1 = 0,sum2 = 0;

    vector<int> a(n + 1),b(n+1);

    rep(i, 1, n) cin >> a[i],b[i] = a[i];

    sort(a.begin(),a.begin() + r);

    rep(i,1,len) {

//        cout << a[i] << " ";

        sum1 += a[i];

    }

    sort(b.begin() + l,b.end());

    rep(i,l,r) {

//        cout << b[i] << " ";

        sum2 += b[i];

    }

    cout << min(sum1,sum2) << endl;

}

signed main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr), cout.tie(nullptr);

    int T = 1;

    cin >> T;

    while (T--) solve();

    return 0;

}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <math.h>
#include <map>
#include <utility>
#include <set>
#include <cstring>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
using pii=pair<int,int>;
#define fi first;
#define se second;
#define endll "\n";             //\n快于endl
inline int read()               //快读
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	return x*f;
}    

const int N=3e5+10;    
void solve()
{
    int l,r;
    cin>>l>>r;
    int a=0,b=0,c=0;
    for(int i=29;i>=0;i--)
    {
        if(((l^r)>>i)&1)
        {
            b|=1<<i;
            a|=(1<<i)-1;
            break;
        }
        else
        {
            b|=1&(i<<1);
            a|=1&(i<<1);
        }
    }
    cout<<a<<" "<<b<<" "<<c<<endl;

}

int main()
{
    int t;
    cin>>t;
    while(t--) solve();
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <math.h>
#include <map>
#include <utility>
#include <set>
#include <cstring>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
using pii=pair<int,int>;
#define fi first;
#define se second;
#define endll "\n";             //\n快于endl
inline int read()               //快读
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	return x*f;
}    

const int N=3e5+10;    
void solve()
{
    int l,r;
    cin>>l>>r;
    int a=0,b=0,c=0;
    for(int i=29;i>=0;i--)
    {
        if(((l^r)>>i)&1)
        {
            b|=1<<i;
            a|=(1<<i)-1;
            break;
        }
        else
        {
            b|=1&(1<<i);
            a|=1&(1<<i);
        }
    }
    c=l;
    while(c==a||c==b) c++;
    cout<<a<<" "<<b<<" "<<c<<endl;

}

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



Submission (verdict: Accepted):
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <math.h>
#include <map>
#include <utility>
#include <set>
#include <cstring>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
using pii=pair<int,int>;
#define fi first;
#define se second;
#define endll "\n";             //\n快于endl
inline int read()               //快读
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	return x*f;
}    

const int N=3e5+10;    
void solve()
{
    int l,r;
    cin>>l>>r;
    int a=0,b=0,c=0;
    for(int i=29;i>=0;i--)
    {
        if(((l^r)>>i)&1)
        {
            b|=1<<i;
            a|=(1<<i)-1;
            break;
        }
        else
        {
            b|=l&(1<<i);
            a|=l&(1<<i);
        }
    }
    c=l;
    while(c==a||c==b) c++;
    cout<<a<<" "<<b<<" "<<c<<endl;

}

int main()
{
    int t;
    cin>>t;
    while(t--) solve();
    return 0;
}
Problem: 2057C - Trip to the Olympiad
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <math.h>
#include <map>
#include <utility>
#include <set>
#include <cstring>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
using pii=pair<int,int>;
#define fi first;
#define se second;
#define endll "\n";             //\n快于endl
inline int read()               //快读
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	return x*f;
}    

const int N=3e5+10;    
void solve()
{
    int l,r;
    cin>>l>>r;
    int a=0,b=0,c=0;
    for(int i=29;i>=0;i--)
    {
        if(((l^r)>>i)&1)
        {
            b|=1<<i;
            a|=(1<<i)-1;
            break;
        }
        else
        {
            b|=1&(i<<1);
            a|=1&(i<<1);
        }
    }
    cout<<a<<" "<<b<<" "<<c<<endl;

}

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



Submission (verdict: Wrong answer on test 1):
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <math.h>
#include <map>
#include <utility>
#include <set>
#include <cstring>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
using pii=pair<int,int>;
#define fi first;
#define se second;
#define endll "\n";             //\n快于endl
inline int read()               //快读
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	return x*f;
}    

const int N=3e5+10;    
void solve()
{
    int l,r;
    cin>>l>>r;
    int a=0,b=0,c=0;
    for(int i=29;i>=0;i--)
    {
        if(((l^r)>>i)&1)
        {
            b|=1<<i;
            a|=(1<<i)-1;
            break;
        }
        else
        {
            b|=1&(1<<i);
            a|=1&(1<<i);
        }
    }
    c=l;
    while(c==a||c==b) c++;
    cout<<a<<" "<<b<<" "<<c<<endl;

}

int main()
{
    int t;
    cin>>t;
    while(t--) solve();
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <math.h>
#include <map>
#include <utility>
#include <set>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
using pii=pair<int,int>;
#define fi first;
#define se second;
#define endll "\n";             //\n快于endl
inline int read()               //快读
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	return x*f;
}
ll sqrtt(ll x)
{
    ll y=sqrtt(x);
    while(y*y<=x) ++y;
    while(y*y>x) --y;
    return y;
}
void solve()
{
    int n;
    cin>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    int sum=accumulate(a.begin(),a.end(),0LL);
    if(n==1) 
    {
        cout<<sum<<endl;
        return ;
    }
    sum=abs(sum);
    while(a.size())
    {
        int n=a.size();
        vector<ll> arr;
        for(int i=1;i<n;i++) arr.push_back(a[i]-a[i-1]);
        int ans=abs(accumulate(arr.begin(),arr.end(),0LL));
        sum=max(sum,ans); 
        a=arr;
    }
    cout<<sum<<endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);    
    int t;
    cin>>t;
    while(t--) solve();
    return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <math.h>
#include <map>
#include <utility>
#include <set>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
using pii=pair<int,int>;
#define fi first;
#define se second;
#define endll "\n";             //\n快于endl
inline int read()               //快读
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	return x*f;
}
ll sqrtt(ll x)
{
    ll y=sqrtt(x);
    while(y*y<=x) ++y;
    while(y*y>x) --y;
    return y;
}
void solve()
{
    int n;
    cin>>n;
    vector<int> a(n+1);
    for(int i=1;i<=n;i++) cin>>a[i];
    int sum=accumulate(a.begin(),a.end(),0LL);
    if(n==1) 
    {
        cout<<sum<<endl;
        return ;
    }
    int cnt=1;
    while(cnt<n)
    {
        sum=max(sum,abs(a[n]-a[cnt++]));
        for(int i=n;i>=cnt;i--) a[i]-=a[i-1];
        //for(int i=1;i<=n;i++) cout<<a[i]<<" ";
        //cout<<endl; 
    }   
    cout<<sum<<endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);    
    int t;
    cin>>t;
    while(t--) solve();
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <math.h>
#include <map>
#include <utility>
#include <set>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
using pii=pair<int,int>;
#define fi first;
#define se second;
#define endll "\n";             //\n快于endl
inline int read()               //快读
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	return x*f;
}
ll sqrtt(ll x)
{
    ll y=sqrtt(x);
    while(y*y<=x) ++y;
    while(y*y>x) --y;
    return y;
}
void solve()
{
    int n;
    cin>>n;
    vector<int> a(n+1);
    for(int i=1;i<=n;i++) cin>>a[i];
    int sum=accumulate(a.begin(),a.end(),0LL);
    if(n==1) 
    {
        cout<<sum<<endl;
        return ;
    }
    int cnt=1;
    while(cnt<n)
    {
        sum=max(sum,abs(a[n]-a[cnt++]));
        for(int i=n;i>=cnt;i--) a[i]-=a[i-1];
        //for(int i=1;i<=n;i++) cout<<a[i]<<" ";
        //cout<<endl; 
    }   
    cout<<sum<<endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);    
    int t;
    cin>>t;
    while(t--) solve();
    return 0;
}


Submission (verdict: Accepted):
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <math.h>
#include <map>
#include <utility>
#include <set>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
using pii=pair<int,int>;
#define fi first;
#define se second;
#define endll "\n";             //\n快于endl
inline int read()               //快读
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	return x*f;
}
ll sqrtt(ll x)
{
    ll y=sqrtt(x);
    while(y*y<=x) ++y;
    while(y*y>x) --y;
    return y;
}
void solve()
{
    int n;
    cin>>n;
    vector<ll> a(n+1);
    for(int i=1;i<=n;i++) cin>>a[i];
    ll sum=accumulate(a.begin(),a.end(),0LL);
    if(n==1) 
    {
        cout<<sum<<endl;
        return ;
    }
    int cnt=1;
    while(cnt<n)
    {
        sum=max(sum,abs(a[n]-a[cnt++]));
        for(int i=n;i>=cnt;i--) a[i]-=a[i-1];
        //for(int i=1;i<=n;i++) cout<<a[i]<<" ";
        //cout<<endl; 
    }   
    cout<<sum<<endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);    
    int t;
    cin>>t;
    while(t--) solve();
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <math.h>
#include <map>
#include <utility>
#include <set>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
using pii=pair<int,int>;
#define fi first;
#define se second;
#define endll "\n";             //\n快于endl
inline int read()               //快读
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	return x*f;
}
ll sqrtt(ll x)
{
    ll y=sqrtt(x);
    while(y*y<=x) ++y;
    while(y*y>x) --y;
    return y;
}
void solve()
{
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    int sum=accumulate(a.begin(),a.end(),0LL);
    if(n==1) 
    {
        cout<<sum<<endl;
        return ;
    }
    sum=abs(sum);
    while(a.size())
    {
        int n=a.size();
        vector<int> arr;
        for(int i=1;i<n;i++) arr.push_back(a[i]-a[i-1]);
        int ans=abs(accumulate(arr.begin(),arr.end(),0LL));
        sum=max(sum,ans); 
        a=arr;
    }
    cout<<sum<<endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);    
    int t;
    cin>>t;
    while(t--) solve();
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <math.h>
#include <map>
#include <utility>
#include <set>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
using pii=pair<int,int>;
#define fi first;
#define se second;
#define endll "\n";             //\n快于endl
inline int read()               //快读
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	return x*f;
}
ll sqrtt(ll x)
{
    ll y=sqrtt(x);
    while(y*y<=x) ++y;
    while(y*y>x) --y;
    return y;
}
void solve()
{
    int n;
    cin>>n;
    vector<int> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    int sum=accumulate(a.begin(),a.end(),0LL);
    if(n==1) 
    {
        cout<<sum<<endl;
        return ;
    }
    sum=abs(sum);
    while(a.size())
    {
        int n=a.size();
        vector<int> arr;
        for(int i=1;i<n;i++) arr.push_back(a[i]-a[i-1]);
        int ans=abs(accumulate(arr.begin(),arr.end(),0LL));
        sum=max(sum,ans); 
        a=arr;
    }
    cout<<sum<<endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);    
    int t;
    cin>>t;
    while(t--) solve();
    return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <deque>
#include <math.h>
#include <map>
#include <utility>
#include <set>
#include <cstring>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
using pii=pair<int,int>;
#define fi first;
#define se second;
#define endll "\n";             //\n快于endl
inline int read()               //快读
{
	int x=0,f=1;char ch=getchar();
	while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
	while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
	return x*f;
}
ll sqrtt(ll x)
{
    ll y=sqrtt(x);
    while(y*y<=x) ++y;
    while(y*y>x) --y;
    return y;
}
void solve()
{
    int n;
    cin>>n;
    vector<ll> a(n);
    for(int i=0;i<n;i++) cin>>a[i];
    int sum=accumulate(a.begin(),a.end(),0LL);
    if(n==1) 
    {
        cout<<sum<<endl;
        return ;
    }
    sum=abs(sum);
    while(a.size())
    {
        int n=a.size();
        vector<ll> arr;
        for(int i=1;i<n;i++) arr.push_back(a[i]-a[i-1]);
        int ans=abs(accumulate(arr.begin(),arr.end(),0LL));
        sum=max(sum,ans); 
        a=arr;
    }
    cout<<sum<<endl;
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);    
    int t;
    cin>>t;
    while(t--) solve();
    return 0;
}