ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)


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

#define ll long long
#define ld long double
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
    bool customSort(const pair<int, int>& a, const pair<int, int>& b) {
    if (a.first == b.first) { 
        return a.second > b.second; 
    }
    return a.first < b.first; }
char rect(vector<char> &s){
    ll n=s.size();
    vector<pair<char,ll>> v(n);
    vector<char> vis;

    for(int i=0; i<n; i++){
      if(s[i]!='\0'){
        v[i].fi=s[i]-i;
        v[i].se=i;}
    
    }
sort(v.begin(),v.end(),customSort);
    s.erase(s.begin()+v[v.size()-1].se);
    return v[v.size()-1].fi;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    // Declare any additional variables here
    
    int t; // number of test cases
    cin >> t;
    
    while (t--) {
      string s;
      cin >> s;
      ll n;
      n=s.size();
     vector<char> v;
     for(int i=0;i<n;i++){
        v.pb(s[i]);
     }
     for(int i=0;i<n;i++)
      cout<<rect(v);
      
cout<<endl;
    }
    
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 3):
#include <bits/stdc++.h> // include all standard headers
using namespace std;

#define ll long long
#define ld long double
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
    bool customSort(const pair<int, int>& a, const pair<int, int>& b) {
    if (a.first == b.first) { 
        return a.second > b.second; 
    }
    return a.first < b.first; }
char rect(vector<char> &s){
    ll n=s.size();
    vector<pair<char,ll>> v(n);
    vector<char> vis;

    for(int i=0; i<n; i++){
      if(s[i]!='\0'){
        v[i].fi=s[i]-i;
        v[i].se=i;}
    
    }
sort(v.begin(),v.end(),customSort);
    s.erase(s.begin()+v[v.size()-1].se);
    return v[v.size()-1].fi;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    // Declare any additional variables here
    
    int t; // number of test cases
    cin >> t;
    
    while (t--) {
      string s;
      cin >> s;
      ll n;
      n=s.size();
     vector<char> v;
     for(int i=0;i<n;i++){
        v.pb(s[i]);
     }
     for(int i=0;i<n;i++)
      cout<<rect(v);
      
cout<<endl;
    }
    
    return 0;
}

Submission (verdict: Time limit exceeded on test 4):
#include <bits/stdc++.h> // include all standard headers
using namespace std;

#define ll long long
#define ld long double
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
    bool customSort(const pair<int, int>& a, const pair<int, int>& b) {
    if (a.first == b.first) { 
        return a.second > b.second; 
    }
    return a.first < b.first; }
char rect(vector<char> &s){
    ll n=s.size();
    vector<pair<int,ll>> v(n);
    vector<char> vis;

    for(int i=0; i<n; i++){
      if(s[i]!='\0'){
     v.pb({s[i] - i, i});}
    
    }
sort(v.begin(),v.end(),customSort);
    s.erase(s.begin()+v[v.size()-1].se);
    return v[v.size()-1].fi;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    // Declare any additional variables here
    
    int t; // number of test cases
    cin >> t;
    
    while (t--) {
      string s;
      cin >> s;
      ll n;
      n=s.size();
     vector<char> v;
     for(int i=0;i<n;i++){
        v.pb(s[i]);
     }
     for(int i=0;i<n;i++)
      cout<<rect(v);
      
cout<<endl;
    }
    
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)

Previous submission (verdict: Time limit exceeded on test 4):
#include <bits/stdc++.h> // include all standard headers
using namespace std;

#define ll long long
#define ld long double
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
    bool customSort(const pair<int, int>& a, const pair<int, int>& b) {
    if (a.first == b.first) { 
        return a.second > b.second; 
    }
    return a.first < b.first; }
char rect(vector<char> &s){
    ll n=s.size();
    vector<pair<int,ll>> v(n);
    vector<char> vis;

    for(int i=0; i<n; i++){
      if(s[i]!='\0'){
     v.pb({s[i] - i, i});}
    
    }
sort(v.begin(),v.end(),customSort);
    s.erase(s.begin()+v[v.size()-1].se);
    return v[v.size()-1].fi;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    // Declare any additional variables here
    
    int t; // number of test cases
    cin >> t;
    
    while (t--) {
      string s;
      cin >> s;
      ll n;
      n=s.size();
     vector<char> v;
     for(int i=0;i<n;i++){
        v.pb(s[i]);
     }
     for(int i=0;i<n;i++)
      cout<<rect(v);
      
cout<<endl;
    }
    
    return 0;
}

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

#define ll long long
#define ld long double
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
    bool customSort(const pair<int, int>& a, const pair<int, int>& b) {
    if (a.first == b.first) { 
        return a.second > b.second; 
    }
    return a.first < b.first; }
char rect(vector<char> &s){
    int n=s.size();
    vector<pair<char,ll>> v(n);
    vector<char> vis;

    for(int i=0; i<min(n,10); i++){
      if(s[i]!='\0'){
        v[i].fi=s[i]-i;
        v[i].se=i;}
    
    }
sort(v.begin(),v.end(),customSort);
    s.erase(s.begin()+v[v.size()-1].se);
    return v[v.size()-1].fi;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    // Declare any additional variables here
    
    int t; // number of test cases
    cin >> t;
    
    while (t--) {
      string s;
      cin >> s;
      ll n;
      n=s.size();
     vector<char> v;
     for(int i=0;i<n;i++){
        v.pb(s[i]);
     }
     for(int i=0;i<n;i++)
      cout<<rect(v);
      

    }
    
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 1):
#include <bits/stdc++.h> // include all standard headers
using namespace std;

#define ll long long
#define ld long double
#define pii pair<int, int>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
    bool customSort(const pair<int, int>& a, const pair<int, int>& b) {
    if (a.first == b.first) { 
        return a.second > b.second; 
    }
    return a.first < b.first; }
char rect(vector<char> &s){
    int n=s.size();
    vector<pair<char,ll>> v(n);
    vector<char> vis;

    for(int i=0; i<min(n,10); i++){
      if(s[i]!='\0'){
        v[i].fi=s[i]-i;
        v[i].se=i;}
    
    }
sort(v.begin(),v.end(),customSort);
    s.erase(s.begin()+v[v.size()-1].se);
    return v[v.size()-1].fi;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    // Declare any additional variables here
    
    int t; // number of test cases
    cin >> t;
    
    while (t--) {
      string s;
      cin >> s;
      ll n;
      n=s.size();
     vector<char> v;
     for(int i=0;i<n;i++){
        v.pb(s[i]);
     }
     for(int i=0;i<n;i++)
      cout<<rect(v);
      

    }
    
    return 0;
}

Submission (verdict: Wrong answer on test 3):


    #include <bits/stdc++.h> // include all standard headers
    using namespace std;
     
    #define ll long long
    #define ld long double
    #define pii pair<int, int>
    #define mp make_pair
    #define pb push_back
    #define eb emplace_back
    #define fi first
    #define se second
     
    const int INF = 1e9;
    const ll INFLL = 1e18;
    const int MOD = 1e9 + 7;

    char rect(vector<char> &s){
        int n=s.size();
     
    
     char max=s[0];
     int ind=0;
        for(int i=1; i<min(n,10); i++){
          if(s[i]-i>max){
          max=s[i]-i;
          ind=i;
        }}
        s.erase(s.begin()+ind);
        return max;
    
    }
    int main() {
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        
        // Declare any additional variables here
        
        int t; // number of test cases
        cin >> t;
        
        while (t--) {
          string s;
          cin >> s;
          ll n;
          n=s.size();
          int k=n/10;
          int g=k;
          while(k--){
          int j=0;
         vector<char> v;
         int p=0;
         for(int i=j*10;i<(j+1)*10;i++){
            v.pb(s[p]);
            p++;
         }
       int size=v.size();
        for(int i=0;i<size;i++)
        cout<<rect(v);
        j++;
       
        }
        int h=(n-(g*10));
       
        vector<char> v;
        int l=0;
        for(int i=n-h;i<n;i++){
        v.pb(s[l]);
        l++;
        }
        int size=v.size();
        for(int i=0;i<size;i++)
        cout<<rect(v);
        cout<<"\n";
        }
       
        
        return 0;
    }
Problem: 2050E - Three Strings
Language: C++17 (GCC 7-32)


Submission (verdict: Memory limit exceeded on test 6):
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int p=1e9+7;
    bool valid(int k,int m){
        if(k>=1 && k<=m){
            return true;
        }
        return false;
    }
  long long  binpow(long long  a,  long long b) {
    long long ans = 1;
    while (b > 0) {
        if (b & 1)
            ans = (ans) * (a);
        a = (a*a);
        b >>= 1;
    }
    return ans;
}
int modulo(int m){
    if(m<0){
       return (p-(abs(m))%p)%p;
    }
    else{
        return m%p;
    }
}
vector<int> printDivisors(int n) 
{ 
    vector<int>vec;

    for (int i = 1; i <= sqrt(n); i++) 
    { 
        if (n % i == 0) 
        { 
            // If divisors are equal,  
            // print only one 
            if (n / i == i) 
                vec.push_back(i);
  
            // Otherwise print both 
            else {
               vec.push_back(i);
               vec.push_back(n/i); }
        } 
    }
    sort(vec.begin(),vec.end());
    reverse(vec.begin(),vec.end()); 
    return vec;
}
bool check(vector<string>&vec,int i,int j){
int n=vec.size();
int m=vec[0].size();
if(i<n && i>=0 && j<m && j>=0){
    return true;
}
return false;
}
bool comp(const pair<int, int>& a, const pair<int, int>& b) {
        if(a.first==b.first){
            return a.second<b.second;
        }
        return a.first>b.first;
    }

void findsubsets(int i,int j,string &a,string &b,string &s,vector<string>&vec){
    if(i==a.size()){
        s+=b.substr(j);
        vec.push_back(s);
        return;
    }
    if(j==b.size()){
        s+=a.substr(i);
        vec.push_back(s);
        return;
        
    }
    string s1=s+a[i];
    findsubsets(i+1,j,a,b,s1,vec);
    string s2=s+b[j];
    findsubsets(i,j+1,a,b,s2,vec);
   
    
}
 
 
 
int32_t main(){
int tests;
cin>>tests;
while(tests--){
   string a,b,c;
   cin>>a>>b>>c;
   vector<string>vec;
   string s="";
   findsubsets(0,0,a,b,s,vec);
   int mini=INT_MAX;
   for(string str:vec){
    int cnt=0;
    for(int i=0;i<str.size();i++){
        if(c[i]!=str[i]){
            cnt++;
        }

    }   
    mini=min(mini,cnt); 
   }
   cout<<mini<<endl;


   
   
    
    
  
  }
 

    
    
    

   
   
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Runtime error on test 1):
//------ADIL SAYYED--------
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define all(v) v.begin(),v.end()
#define vin(v,n) for(ll i=0;i<n;i++) cin>>v[i]
#define rep(i, n) for (ll i = 0; i < n; i++)
#define forf(i, a, b) for (ll i = a; i < b; i++)
#define forb(i, s, e) for (ll i = s; i >= e; i--)
#define vt vector<ll>
#define vp vector<pair<long long, long long>>
#define srt(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define pn cout<<"NO"<<'\n'
#define py cout<<"YES"<<'\n'

void solve(){  
    ll n; cin>>n;
    vt v(n); 
    // vin(v,n);
    // if(n==1) {cout<<v[0]<<'\n'; return;}
    ll s=0;
    for(ll i=1;i<=n;i++){cin>>v[i]; s+=v[i];}
    ll ans = s;
    for(ll i=1;i<=n-1;i++){
        ll k=0;
        for(ll j=1;j<=n-i;j++){
            v[j]=v[j+1]-v[j];
        }
        for(ll j=1;j<=n-i;j++) k+=v[j];
        ans=max(ans,max(k,-k));
    }
    cout<<ans<<'\n';

}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t; cin>>t;
    // vector<vector<ll> >bc(50,vector<ll> (51,0));
    // rep(i,51){
    //     rep(j,i+1){
    //         if(j==0 || j==i) bc[i][j]=1;
    //         else bc[i][j] = bc[i-1][j-1] + bc[i-1][j];
    //     }
    // }
    while(t--)
    solve();
    return 0;
}






Submission (verdict: Accepted):
//------ADIL SAYYED--------
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define all(v) v.begin(),v.end()
#define vin(v,n) for(ll i=0;i<n;i++) cin>>v[i]
#define rep(i, n) for (ll i = 0; i < n; i++)
#define forf(i, a, b) for (ll i = a; i < b; i++)
#define forb(i, s, e) for (ll i = s; i >= e; i--)
#define vt vector<ll>
#define vp vector<pair<long long, long long>>
#define srt(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define pn cout<<"NO"<<'\n'
#define py cout<<"YES"<<'\n'

void solve(){  
    ll n; cin>>n;
    vt v(n+1); 
    // vin(v,n);
    // if(n==1) {cout<<v[0]<<'\n'; return;}
    ll s=0;
    for(ll i=1;i<=n;i++){cin>>v[i]; s+=v[i];}
    ll ans = s;
    for(ll i=1;i<=n-1;i++){
        ll k=0;
        for(ll j=1;j<=n-i;j++){
            v[j]=v[j+1]-v[j];
        }
        for(ll j=1;j<=n-i;j++) k+=v[j];
        ans=max(ans,max(k,-k));
    }
    cout<<ans<<'\n';

}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t; cin>>t;
    // vector<vector<ll> >bc(50,vector<ll> (51,0));
    // rep(i,51){
    //     rep(j,i+1){
    //         if(j==0 || j==i) bc[i][j]=1;
    //         else bc[i][j] = bc[i-1][j-1] + bc[i-1][j];
    //     }
    // }
    while(t--)
    solve();
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
//------ADIL SAYYED--------
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define all(v) v.begin(),v.end()
#define vin(v,n) for(ll i=0;i<n;i++) cin>>v[i]
#define rep(i, n) for (ll i = 0; i < n; i++)
#define forf(i, a, b) for (ll i = a; i < b; i++)
#define forb(i, s, e) for (ll i = s; i >= e; i--)
#define vt vector<ll>
#define vp vector<pair<long long, long long>>
#define srt(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define pn cout<<"NO"<<'\n'
#define py cout<<"YES"<<'\n'

// void solve(){  
    
// }

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t; cin>>t;
    vector<vector<ll> >bc(51,vector<ll> (51,0));
    rep(i,51){
        rep(j,i+1){
            if(j==0 || j==i) bc[i][j]=1;
            else bc[i][j] = bc[i-1][j-1] + bc[i-1][j];
        }
    }
    while(t--){
        ll n; cin>>n;
        vt v(n); vin(v,n);
        if(n==1) {cout<<v[0]<<'\n'; continue;}
        ll s=0;
        rep(i,n) s+=v[i];
        ll s1=0;
        rep(i,n){
            ll s2=0;
            if(i%2==0) s2=1;
            else s2=-1;
            s1+=s2*bc[n-1][i]*v[i]; 
        }
        ll ans = max(s,abs(s1));
        cout<<ans<<'\n';
    }
    // solve();
    // return 0;
}






Submission (verdict: Wrong answer on test 2):
//------ADIL SAYYED--------
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define all(v) v.begin(),v.end()
#define vin(v,n) for(ll i=0;i<n;i++) cin>>v[i]
#define rep(i, n) for (ll i = 0; i < n; i++)
#define forf(i, a, b) for (ll i = a; i < b; i++)
#define forb(i, s, e) for (ll i = s; i >= e; i--)
#define vt vector<ll>
#define vp vector<pair<long long, long long>>
#define srt(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define pn cout<<"NO"<<'\n'
#define py cout<<"YES"<<'\n'

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t; cin>>t;
    vector<vector<ll> >bc(101,vector<ll> (101,0));
    rep(i,101){
        rep(j,i+1){
            if(j==0 || j==i) bc[i][j]=1;
            else bc[i][j] = bc[i-1][j-1] + bc[i-1][j];
        }
    }
    while(t--){
        ll n; cin>>n;
        vt v(n); vin(v,n);
        if(n==1) {cout<<v[0]<<'\n'; continue;}
        ll s=0;
        rep(i,n) s+=v[i];
        ll s1=0;
        rep(i,n){
            ll s2=0;
            if(i%2==0) s2=1;
            else s2=-1;
            s1+=s2*bc[n-1][i]*v[i]; 
        }
        ll ans = max(s,abs(s1));
        cout<<ans<<'\n';
    }

}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)


Submission (verdict: Wrong answer on test 2):
//------ADIL SAYYED--------
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define all(v) v.begin(),v.end()
#define vin(v,n) for(ll i=0;i<n;i++) cin>>v[i]
#define rep(i, n) for (ll i = 0; i < n; i++)
#define forf(i, a, b) for (ll i = a; i < b; i++)
#define forb(i, s, e) for (ll i = s; i >= e; i--)
#define vt vector<ll>
#define vp vector<pair<long long, long long>>
#define srt(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define pn cout<<"NO"<<'\n'
#define py cout<<"YES"<<'\n'

// void solve(){  
    
// }

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t; cin>>t;
    vector<vector<ll> >bc(51,vector<ll> (51,0));
    rep(i,51){
        rep(j,i+1){
            if(j==0 || j==i) bc[i][j]=1;
            else bc[i][j] = bc[i-1][j-1] + bc[i-1][j];
        }
    }
    while(t--){
        ll n; cin>>n;
        vt v(n); vin(v,n);
        if(n==1) {cout<<v[0]<<'\n'; continue;}
        ll s=0;
        rep(i,n) s+=v[i];
        ll s1=0;
        rep(i,n){
            ll s2=0;
            if(i%2==0) s2=1;
            else s2=-1;
            s1+=s2*bc[n-1][i]*v[i]; 
        }
        ll ans = max(s,abs(s1));
        cout<<ans<<'\n';
    }
    // solve();
    // return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
//------ADIL SAYYED--------
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define all(v) v.begin(),v.end()
#define vin(v,n) for(ll i=0;i<n;i++) cin>>v[i]
#define rep(i, n) for (ll i = 0; i < n; i++)
#define forf(i, a, b) for (ll i = a; i < b; i++)
#define forb(i, s, e) for (ll i = s; i >= e; i--)
#define vt vector<ll>
#define vp vector<pair<long long, long long>>
#define srt(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define pn cout<<"NO"<<'\n'
#define py cout<<"YES"<<'\n'

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t; cin>>t;
    vector<vector<ll> >bc(101,vector<ll> (101,0));
    rep(i,101){
        rep(j,i+1){
            if(j==0 || j==i) bc[i][j]=1;
            else bc[i][j] = bc[i-1][j-1] + bc[i-1][j];
        }
    }
    while(t--){
        ll n; cin>>n;
        vt v(n); vin(v,n);
        if(n==1) {cout<<v[0]<<'\n'; continue;}
        ll s=0;
        rep(i,n) s+=v[i];
        ll s1=0;
        rep(i,n){
            ll s2=0;
            if(i%2==0) s2=1;
            else s2=-1;
            s1+=s2*bc[n-1][i]*v[i]; 
        }
        ll ans = max(s,abs(s1));
        cout<<ans<<'\n';
    }

}






Submission (verdict: Runtime error on test 1):
//------ADIL SAYYED--------
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define all(v) v.begin(),v.end()
#define vin(v,n) for(ll i=0;i<n;i++) cin>>v[i]
#define rep(i, n) for (ll i = 0; i < n; i++)
#define forf(i, a, b) for (ll i = a; i < b; i++)
#define forb(i, s, e) for (ll i = s; i >= e; i--)
#define vt vector<ll>
#define vp vector<pair<long long, long long>>
#define srt(v) sort(v.begin(), v.end())
#define rev(v) reverse(v.begin(), v.end())
#define pn cout<<"NO"<<'\n'
#define py cout<<"YES"<<'\n'

void solve(){  
    ll n; cin>>n;
    vt v(n); 
    // vin(v,n);
    // if(n==1) {cout<<v[0]<<'\n'; return;}
    ll s=0;
    for(ll i=1;i<=n;i++){cin>>v[i]; s+=v[i];}
    ll ans = s;
    for(ll i=1;i<=n-1;i++){
        ll k=0;
        for(ll j=1;j<=n-i;j++){
            v[j]=v[j+1]-v[j];
        }
        for(ll j=1;j<=n-i;j++) k+=v[j];
        ans=max(ans,max(k,-k));
    }
    cout<<ans<<'\n';

}

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    ll t; cin>>t;
    // vector<vector<ll> >bc(50,vector<ll> (51,0));
    // rep(i,51){
    //     rep(j,i+1){
    //         if(j==0 || j==i) bc[i][j]=1;
    //         else bc[i][j] = bc[i-1][j-1] + bc[i-1][j];
    //     }
    // }
    while(t--)
    solve();
    return 0;
}
Problem: 2062C - Cirno and Operations
Language: Python 3

Previous submission (verdict: Wrong answer on test 2):
import sys

# Fast Input
def inp(): return sys.stdin.readline().strip()
def inplist(): return list(map(int, inp().split()))

# Debugging function
def debug(*args):
    print("DEBUG:", *args, file=sys.stderr)

def solve():
    n = int(input())
    a = list(map(int, input().split()))

    ans = sum(a)
    while n > 1:
        n -= 1
        a = a[::-1]
        a = [a[i+1] - a[i] for i in range(n)]
        ans = max(ans, sum(a))
    print(ans)

def main():
    t = 1
    t = int(inp())  # Uncomment if multiple test cases exist
    for _ in range(t):
        solve()

if __name__ == "__main__":
    main()

Submission (verdict: Wrong answer on test 2):
import sys

# Fast Input
def inp(): return sys.stdin.readline().strip()
def inplist(): return list(map(int, inp().split()))

# Debugging function
def debug(*args):
    print("DEBUG:", *args, file=sys.stderr)

def solve():
    n = int(input())
    a = list(map(int, input().split()))

    if n == 1:
        print(a[0])
        return
    ans = sum(a)
    while n > 1:
        n -= 1
        a = a[::-1]
        a = [a[i+1] - a[i] for i in range(n)]
        ans = max(ans, sum(a))
    print(ans)

def main():
    t = 1
    t = int(inp())  # Uncomment if multiple test cases exist
    for _ in range(t):
        solve()

if __name__ == "__main__":
    main()
Problem: 2062C - Cirno and Operations
Language: Python 3

Previous submission (verdict: Wrong answer on test 2):
import sys

# Fast Input
def inp(): return sys.stdin.readline().strip()
def inplist(): return list(map(int, inp().split()))

# Debugging function
def debug(*args):
    print("DEBUG:", *args, file=sys.stderr)

def solve():
    n = int(input())
    a = list(map(int, input().split()))

    if n == 1:
        print(a[0])
        return
    ans = sum(a)
    while n > 1:
        n -= 1
        a = a[::-1]
        a = [a[i+1] - a[i] for i in range(n)]
        ans = max(ans, sum(a))
    print(ans)

def main():
    t = 1
    t = int(inp())  # Uncomment if multiple test cases exist
    for _ in range(t):
        solve()

if __name__ == "__main__":
    main()

Submission (verdict: Wrong answer on test 2):
import sys

# Fast Input
def inp(): return sys.stdin.readline().strip()
def inplist(): return list(map(int, inp().split()))

# Debugging function
def debug(*args):
    print("DEBUG:", *args, file=sys.stderr)

def solve():
    n = int(input())
    a = list(map(int, input().split()))

    if n == 1:
        print(a[0])
        return
    ans = sum(a)
    while n > 1:
        a = a[::-1]
        n -= 1
        a = [a[i+1] - a[i] for i in range(n)]
        ans = max(ans, sum(a))
    print(ans)

def main():
    t = 1
    t = int(inp())  # Uncomment if multiple test cases exist
    for _ in range(t):
        solve()

if __name__ == "__main__":
    main()