ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063B - Subsequence Update
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>

#include<vector>

#include<set>

#include<cstring>

#include<algorithm>

#include<cmath>

#include<map>

#include<stack>

#include<queue>

using namespace std;

using ll = long long; 

int main() {

    ll t;

    cin >> t;

    while (t--) {

        priority_queue<int> a;

        priority_queue<int> b;

        int n,l,r;

        cin >> n >> l >> r;

        vector<int>fa(n);

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

            cin >> fa[i];

            if (i >= l - 1 && i < r) {

                a.push(fa[i]);

                b.push(fa[i]);

            }

        }

        for (int i = 0; i < l - 1; i++) {

            if (fa[i] < a.top()) {

                a.pop();

                a.push(fa[i]);

            }

        }

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

            if (fa[i] < b.top()) {

                a.pop();

                a.push(fa[i]);

            }

        }

        ll cm = 0, dm = 0;

        while (a.size()) {

            cm += a.top();

            a.pop();

        }

        while (b.size()) {

            dm += b.top();

            b.pop();

        }

        cout << min(cm, dm) << endl;

   }

    return 0;

}

Submission (verdict: Accepted):
#include<iostream>

#include<vector>

#include<set>

#include<cstring>

#include<algorithm>

#include<cmath>

#include<map>

#include<stack>

#include<queue>

using namespace std;

using ll = long long; 

int main() {

    ll t;

    cin >> t;

    while (t--) {

        priority_queue<int> a;

        priority_queue<int> b;

        int n,l,r;

        cin >> n >> l >> r;

        vector<int>fa(n);

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

            cin >> fa[i];

            if (i >= l - 1 && i < r) {

                a.push(fa[i]);

                b.push(fa[i]);

            }

        }

        for (int i = 0; i < l - 1; i++) {

            if (fa[i] < a.top()) {

                a.pop();

                a.push(fa[i]);

            }

        }

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

            if (fa[i] < b.top()) {

                b.pop();

                b.push(fa[i]);

            }

        }

        ll cm = 0, dm = 0;

        while (a.size()) {

            cm += a.top();

            a.pop();

        }

        while (b.size()) {

            dm += b.top();

            b.pop();

        }

        cout << min(cm, dm) << endl;

   }

    return 0;

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

Previous submission (verdict: Wrong answer on test 2):
#include<iostream>

#include<vector>

#include<set>

#include<cstring>

#include<algorithm>

#include<cmath>

#include<map>

#include<stack>

#include<queue>

using namespace std;

using ll = long long; 

int main() {

    ll t;

    cin >> t;

    while (t--) {

        priority_queue<int> a;

        priority_queue<int> b;

        int n,l,r;

        cin >> n >> l >> r;

        vector<int>fa(n);

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

            cin >> fa[i];

            if (i >= l - 1 && i < r) {

                a.push(fa[i]);

                b.push(fa[i]);

            }

        }

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

            if (fa[i] < a.top()) {

                a.pop();

                a.push(fa[i]);

            }

        }

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

            if (fa[i] < b.top()) {

                a.pop();

                a.push(fa[i]);

            }

        }

        ll cm = 0, dm = 0;

        while (a.size()) {

            cm += a.top();

            a.pop();

        }

        while (b.size()) {

            dm += b.top();

            b.pop();

        }

        cout << min(cm, dm) << endl;

   }

    return 0;

}

Submission (verdict: Wrong answer on test 2):
#include<iostream>

#include<vector>

#include<set>

#include<cstring>

#include<algorithm>

#include<cmath>

#include<map>

#include<stack>

#include<queue>

using namespace std;

using ll = long long; 

int main() {

    ll t;

    cin >> t;

    while (t--) {

        priority_queue<int> a;

        priority_queue<int> b;

        int n,l,r;

        cin >> n >> l >> r;

        vector<int>fa(n);

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

            cin >> fa[i];

            if (i >= l - 1 && i < r) {

                a.push(fa[i]);

                b.push(fa[i]);

            }

        }

        for (int i = 0; i < l - 1; i++) {

            if (fa[i] < a.top()) {

                a.pop();

                a.push(fa[i]);

            }

        }

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

            if (fa[i] < b.top()) {

                a.pop();

                a.push(fa[i]);

            }

        }

        ll cm = 0, dm = 0;

        while (a.size()) {

            cm += a.top();

            a.pop();

        }

        while (b.size()) {

            dm += b.top();

            b.pop();

        }

        cout << min(cm, dm) << endl;

   }

    return 0;

}
Problem: 2057C - Trip to the Olympiad
Language: C++17 (GCC 7-32)


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

#define rep(i,a,b) for( long long i=a;i<( long long)b;i++)
#define F first
#define S second
#define pb push_back
#define yes() cout << "YES\n"
#define no() cout << "NO\n"
typedef long long ll;
typedef unsigned long long ull;
//typedef tree<long long, null_type, less_equal<>, rb_tree_tag, tree_order_statistics_node_update> indexed_multiset; 

//bool comp(const pair<int,int>&a, const pair<int,int>&b){
//  return (a.f>b.f || (a.f==b.f && a.s<b.s));
//}

/*
//lowerbound
//imprime -1 si ningún valor cumple la condición
ll binsearchpos(ll mini, ll maxi){
    ll l=mini,r=maxi,ans=-1;
    
    while(l<=r){
        ll mid=l+(r-l)/2, target=0LL;
        ll f=gauss(mid-1)+(mid*k) - (gauss(n-1)+(n*k)-gauss(mid-1)-(mid*k));
        
        if(f>=target){
            //ans se actualiza si se cumple la condición
            ans=mid;
            r=mid-1;
        }else{
            l=mid+1;
        }
    }
    return ans;
}
*/  


void solve(){
    
    ll l,r;

    cin>>l>>r;

    ll c=0;

    ll con=0,num=0;
    rep(pot,0,32){
        ll mask=(1<<pot);
        num |= (mask&r);
        if(num==r){
            con=pot;
            break;
        }
    }
    //cout<<con<<"\n";
    bool found=false,firstone=false;
    for(int pot=con; pot>=0; pot--){
        ll mask=(1<<pot);

        if(!found){
            if((r&mask)==(l&mask)){
                c|=(r&mask);
                continue;
            }else{
                c|=(l&mask);
                found=true;
                continue;
            }
        }

        if((r&mask)!=(l&mask)){
            c|=(l&mask);
        }else{
            if((l&mask)==0){
                firstone=true;
                c|=mask;
                continue;
            }
            //==1
            if(!firstone){
                c|=mask;
                continue;
            }
            
        }


    }
    if(c==l)
        c++;
    cout<<l<<" "<<r<<" "<<c;
   
    return;
}


int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int tt=1;
    cin>>tt;
    
    while(tt--){
        solve();
        cout<<"\n";
    }

    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#include <print>
using namespace std;
#define i64 int64_t
constexpr int MAXN = 2e5 + 5;
//constexpr int MDL = 1'000'000'007;
//constexpr int MDL = (119<<23) + 1;

void solve(){
    string s;
    cin >> s;

    int c2 = 0, c3 = 0, sum = 0;
    for (const auto& x : s){
        sum += (x - '0');
        c2 += (x == '2');
        c3 += (x == '3');
    }

    c2 %= 9;
    c3 %= 9;

    // 0 2 4 6 8 1 3 5 7 0
    // 0 6 3 0

    sum %= 9;

    if (sum == 0){
        println("YES");
        return;
    }

    for (int i=0;i<=c2;i++){
        for (int j=0;j<=c3;j++){
            if ((sum + (i * 2) + (j * 6)) % 9 == 0){
                println("YES");
                return;
            }
        }
    }
    println("NO");
}

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    cin >> t; void("singlecase");
    for (int tc=0;tc<t;tc++){
#ifdef ONPC
        println("Case #{}",tc+1);
#endif
        solve();
    }
}


Submission (verdict: Compilation error):
#include <bits/stdc++.h>
#include <print>
using namespace std;
#define i64 int64_t
constexpr int MAXN = 2e5 + 5;
//constexpr int MDL = 1'000'000'007;
//constexpr int MDL = (119<<23) + 1;

void solve(){
    string s;
    cin >> s;

    int c2 = 0, c3 = 0, sum = 0;
    for (const auto& x : s){
        sum += (x - '0');
        c2 += (x == '2');
        c3 += (x == '3');
    }

    // 0 2 4 6 8 1 3 5 7 0
    // 0 6 3 0

    sum %= 9;

    c2 = min(c2, 9);
    c3 = min(c3, 3);

    if (sum == 0){
        println("YES");
        return;
    }

    for (int i=0;i<=c2;i++){
        for (int j=0;j<=c3;j++){
            if ((sum + (i * 2) + (j * 6)) % 9 == 0){
                println("YES");
                return;
            }
        }
    }#include <bits/stdc++.h>
#include <print>
using namespace std;
#define i64 int64_t
constexpr int MAXN = 2e5 + 5;
//constexpr int MDL = 1'000'000'007;
//constexpr int MDL = (119<<23) + 1;

void solve(){
    string s;
    cin >> s;

    int c2 = 0, c3 = 0, sum = 0;
    for (const auto& x : s){
        sum += (x - '0');
        c2 += (x == '2');
        c3 += (x == '3');
    }

    // 0 2 4 6 8 1 3 5 7 0
    // 0 6 3 0

    sum %= 9;

    c2 = min(c2, 9);
    c3 = min(c3, 3);

    if (sum == 0){
        println("YES");
        return;
    }

    for (int i=0;i<=c2;i++){
        for (int j=0;j<=c3;j++){
            if ((sum + (i * 2) + (j * 6)) % 9 == 0){
                println("YES");
                return;
            }
        }
    }
    println("NO");
}

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    cin >> t; void("singlecase");
    for (int tc=0;tc<t;tc++){
#ifdef ONPC
        println("Case #{}",tc+1);
#endif
        solve();
    }
}

    println("NO");
}

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    cin >> t; void("singlecase");
    for (int tc=0;tc<t;tc++){
#ifdef ONPC
        println("Case #{}",tc+1);
#endif
        solve();
    }
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#include <print>
using namespace std;
#define i64 int64_t
constexpr int MAXN = 2e5 + 5;
//constexpr int MDL = 1'000'000'007;
//constexpr int MDL = (119<<23) + 1;

void solve(){
    string s;
    cin >> s;

    int n;
    n = int(s.size());

    int c2 = 0, c3 = 0, sum = 0;
    for (const auto& x : s){
        sum += (x - '0');
        c2 += (x == '2');
        c3 += (x == '3');
    }

    c2 %= 9;
    c3 %= 3;

    if (sum % 9 == 0){
        println("YES");
        return;
    }

    for (int i=0;i<=c2;i++){
        for (int j=0;j<=c3;j++){
            if ((sum + i * 2 + j * 6) % 9 == 0){
                println("YES");
                return;
            }
        }
    }
    println("NO");
}

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    cin >> t; void("singlecase");
    for (int tc=0;tc<t;tc++){
#ifdef ONPC
        println("Case #{}",tc+1);
#endif
        solve();
    }
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Compilation error):
#include <bits/stdc++.h>
#include <print>
using namespace std;
#define i64 int64_t
constexpr int MAXN = 2e5 + 5;
//constexpr int MDL = 1'000'000'007;
//constexpr int MDL = (119<<23) + 1;

void solve(){
    string s;
    cin >> s;

    int c2 = 0, c3 = 0, sum = 0;
    for (const auto& x : s){
        sum += (x - '0');
        c2 += (x == '2');
        c3 += (x == '3');
    }

    // 0 2 4 6 8 1 3 5 7 0
    // 0 6 3 0

    sum %= 9;

    c2 = min(c2, 9);
    c3 = min(c3, 3);

    if (sum == 0){
        println("YES");
        return;
    }

    for (int i=0;i<=c2;i++){
        for (int j=0;j<=c3;j++){
            if ((sum + (i * 2) + (j * 6)) % 9 == 0){
                println("YES");
                return;
            }
        }
    }#include <bits/stdc++.h>
#include <print>
using namespace std;
#define i64 int64_t
constexpr int MAXN = 2e5 + 5;
//constexpr int MDL = 1'000'000'007;
//constexpr int MDL = (119<<23) + 1;

void solve(){
    string s;
    cin >> s;

    int c2 = 0, c3 = 0, sum = 0;
    for (const auto& x : s){
        sum += (x - '0');
        c2 += (x == '2');
        c3 += (x == '3');
    }

    // 0 2 4 6 8 1 3 5 7 0
    // 0 6 3 0

    sum %= 9;

    c2 = min(c2, 9);
    c3 = min(c3, 3);

    if (sum == 0){
        println("YES");
        return;
    }

    for (int i=0;i<=c2;i++){
        for (int j=0;j<=c3;j++){
            if ((sum + (i * 2) + (j * 6)) % 9 == 0){
                println("YES");
                return;
            }
        }
    }
    println("NO");
}

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    cin >> t; void("singlecase");
    for (int tc=0;tc<t;tc++){
#ifdef ONPC
        println("Case #{}",tc+1);
#endif
        solve();
    }
}

    println("NO");
}

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    cin >> t; void("singlecase");
    for (int tc=0;tc<t;tc++){
#ifdef ONPC
        println("Case #{}",tc+1);
#endif
        solve();
    }
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
#include <print>
using namespace std;
#define i64 int64_t
constexpr int MAXN = 2e5 + 5;
//constexpr int MDL = 1'000'000'007;
//constexpr int MDL = (119<<23) + 1;

void solve(){
    string s;
    cin >> s;

    int c2 = 0, c3 = 0, sum = 0;
    for (const auto& x : s){
        sum += (x - '0');
        c2 += (x == '2');
        c3 += (x == '3');
    }

    // 0 2 4 6 8 1 3 5 7 0
    // 0 6 3 0

    sum %= 9;

    c2 = min(c2, 9);
    c3 = min(c3, 3);

    if (sum == 0){
        println("YES");
        return;
    }

    for (int i=0;i<=c2;i++){
        for (int j=0;j<=c3;j++){
            if ((sum + (i * 2) + (j * 6)) % 9 == 0){
                println("YES");
                return;
            }
        }
    }
    println("NO");
}

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    cin >> t; void("singlecase");
    for (int tc=0;tc<t;tc++){
#ifdef ONPC
        println("Case #{}",tc+1);
#endif
        solve();
    }
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#include <print>
using namespace std;
#define i64 int64_t
constexpr int MAXN = 2e5 + 5;
//constexpr int MDL = 1'000'000'007;
//constexpr int MDL = (119<<23) + 1;

void solve(){
    string s;
    cin >> s;

    int n;
    n = int(s.size());

    int c2 = 0, c3 = 0, sum = 0;
    for (const auto& x : s){
        sum += (x - '0');
        c2 += (x == '2');
        c3 += (x == '3');
    }

    c2 %= 9;
    c3 %= 3;

    // 0 2 4 6 8 1 3 5 7 0
    // 0 6 3 0

    sum %= 9;

    if (sum == 0){
        println("YES");
        return;
    }

    for (int i=0;i<=c2;i++){
        for (int j=0;j<=c3;j++){
            if ((sum + i * 2 + j * 6) % 9 == 0){
                println("YES");
                return;
            }
        }
    }
    println("NO");
}

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    cin >> t; void("singlecase");
    for (int tc=0;tc<t;tc++){
#ifdef ONPC
        println("Case #{}",tc+1);
#endif
        solve();
    }
}


Submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h>
#include <print>
using namespace std;
#define i64 int64_t
constexpr int MAXN = 2e5 + 5;
//constexpr int MDL = 1'000'000'007;
//constexpr int MDL = (119<<23) + 1;

void solve(){
    string s;
    cin >> s;

    int c2 = 0, c3 = 0, sum = 0;
    for (const auto& x : s){
        sum += (x - '0');
        c2 += (x == '2');
        c3 += (x == '3');
    }

    c2 %= 9;
    c3 %= 9;

    // 0 2 4 6 8 1 3 5 7 0
    // 0 6 3 0

    sum %= 9;

    if (sum == 0){
        println("YES");
        return;
    }

    for (int i=0;i<=c2;i++){
        for (int j=0;j<=c3;j++){
            if ((sum + (i * 2) + (j * 6)) % 9 == 0){
                println("YES");
                return;
            }
        }
    }
    println("NO");
}

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    cin >> t; void("singlecase");
    for (int tc=0;tc<t;tc++){
#ifdef ONPC
        println("Case #{}",tc+1);
#endif
        solve();
    }
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#include <print>
using namespace std;
#define i64 int64_t
constexpr int MAXN = 2e5 + 5;
//constexpr int MDL = 1'000'000'007;
//constexpr int MDL = (119<<23) + 1;

void solve(){
    string s;
    cin >> s;

    int n;
    n = int(s.size());

    int c2 = 0, c3 = 0, sum = 0;
    for (const auto& x : s){
        sum += (x - '0');
        c2 += (x == '2');
        c3 += (x == '3');
    }

    c2 %= 9;
    c3 %= 3;

    if (sum % 9 == 0){
        println("YES");
        return;
    }

    for (int i=0;i<=c2;i++){
        for (int j=0;j<=c3;j++){
            if ((sum + i * 2 + j * 6) % 9 == 0){
                println("YES");
                return;
            }
        }
    }
    println("NO");
}

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    cin >> t; void("singlecase");
    for (int tc=0;tc<t;tc++){
#ifdef ONPC
        println("Case #{}",tc+1);
#endif
        solve();
    }
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
#include <print>
using namespace std;
#define i64 int64_t
constexpr int MAXN = 2e5 + 5;
//constexpr int MDL = 1'000'000'007;
//constexpr int MDL = (119<<23) + 1;

void solve(){
    string s;
    cin >> s;

    int n;
    n = int(s.size());

    int c2 = 0, c3 = 0, sum = 0;
    for (const auto& x : s){
        sum += (x - '0');
        c2 += (x == '2');
        c3 += (x == '3');
    }

    c2 %= 9;
    c3 %= 3;

    // 0 2 4 6 8 1 3 5 7 0
    // 0 6 3 0

    sum %= 9;

    if (sum == 0){
        println("YES");
        return;
    }

    for (int i=0;i<=c2;i++){
        for (int j=0;j<=c3;j++){
            if ((sum + i * 2 + j * 6) % 9 == 0){
                println("YES");
                return;
            }
        }
    }
    println("NO");
}

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    cin >> t; void("singlecase");
    for (int tc=0;tc<t;tc++){
#ifdef ONPC
        println("Case #{}",tc+1);
#endif
        solve();
    }
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
//
// Created by EDY on 25-2-6.
//
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
using i32 = int32_t;

void solve() {
    i64 maxs = numeric_limits<i64>::min();
    int n;
    cin >> n;
    if (n == 1) {
        int x;
        cin >> x;
        cout << x << endl;
    } else {
        vector<i64> v(n);
        int now = n;
        for (int i = 0; i <= n - 1; i++) {
            cin >> v[i];
        }
        while (now > 1) {
            i64 sum = 0;
            for (int i = 0; i <= now - 1; i++) {
                sum += v[i];
            }
            maxs = max(maxs, abs(sum));
            now = now - 1;
            for (int i = 0; i <= now - 1; i++) {
                v[i] = v[i + 1] - v[i];
            }
        }
        maxs = max(maxs, abs(v[0]));
        cout << maxs << endl;
    }
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}


Submission (verdict: Wrong answer on test 2):
//
// Created by EDY on 25-2-6.
//
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
using i32 = int32_t;

void solve() {
    i64 maxs = numeric_limits<i64>::min();
    int n;
    cin >> n;
    if (n == 1) {
        int x;
        cin >> x;
        cout << x << endl;
    } else {
        vector<i64> v(n);
        int now = n;
        for (int i = 0; i <= n - 1; i++) {
            cin >> v[i];
        }
        i64 sums = 0;
        for (int i = n - 1; i >= 0; i--) {
            sums += v[i];
        }
        // cout << sums << endl;
        maxs = max(maxs, sums);
        while (now > 1) {

            now = now - 1;
            for (int i = 0; i <= now - 1; i++) {
                v[i] = v[i + 1] - v[i];
            }
            i64 sum = 0;
            for (int i = 0; i <= now - 1; i++) {
                sum += v[i];
            }
            maxs = max(maxs, sum);
        }
        maxs = max(maxs, abs(v[0]));
        cout << maxs << endl;
    }
}

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

Previous submission (verdict: Wrong answer on test 2):
//
// Created by EDY on 25-2-6.
//
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
using i32 = int32_t;

void solve() {
    i64 maxs = numeric_limits<i64>::min();
    int n;
    cin >> n;
    if (n == 1) {
        int x;
        cin >> x;
        cout << x << endl;
    } else {
        vector<i64> v(n);
        int now = n;
        for (int i = 0; i <= n - 1; i++) {
            cin >> v[i];
        }
        i64 sums = 0;
        for (int i = n - 1; i >= 0; i--) {
            sums += v[i];
        }
        // cout << sums << endl;
        maxs = max(maxs, sums);
        while (now > 1) {

            now = now - 1;
            for (int i = 0; i <= now - 1; i++) {
                v[i] = v[i + 1] - v[i];
            }
            i64 sum = 0;
            for (int i = 0; i <= now - 1; i++) {
                sum += v[i];
            }
            maxs = max(maxs, sum);
        }
        maxs = max(maxs, abs(v[0]));
        cout << maxs << endl;
    }
}

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


Submission (verdict: Wrong answer on test 1):
//
// Created by EDY on 25-2-6.
//
#include<bits/stdc++.h>
using namespace std;
using i64 = long long;
using i32 = int32_t;

void solve() {

    int n;
    cin >> n;
    if (n == 1) {
        int x;
        cin >> x;
        cout << x << endl;
    } else {
        vector<i64> v(n);
        i64 maxs = numeric_limits<i64>::min();
        int now = n;
        for (int i = 0; i <= n - 1; i++) {
            cin >> v[i];
        }
        i64 sums = 0;
        for (int i = n - 1; i >= 0; i--) {
            sums += v[i];
        }
        // cout << sums << endl;
        maxs = max(maxs, sums);
        while (now > 1) {
            now = now - 1;
            for (int i = 0; i <= now - 1; i++) {
                v[i] = v[i + 1] - v[i];
            }
            i64 sum = 0;
            for (int i = 0; i <= now - 1; i++) {
                sum += v[i];
            }
            maxs = max(maxs, abs(sum));
        }
        cout << maxs << endl;
    }
}

int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    freopen("input.txt", "r", stdin);
    int t;
    cin >> t;
    while (t--) {
        solve();
    }
}