ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)


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

int main() {
	int t; cin>>t;
	while(t--){
	    int n;cin>>n;
	    vector<int> vec(n);
	    for(int i=0; i<n; i++) cin>>vec[i];
	    bool no=false;;
	    for(int i=1; i<n-1; i++){
	        if(vec[i]<=vec[i-1] && vec[i]>vec[i+1]){
	            no=true;
	            break;
	        }
	    }
	    if(no){
	        cout<<"NO"<<"\n";
	    }
	    else{
	        cout<<"YES"<<"\n";
	    }
	}
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

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

int main() {
	int t; cin>>t;
	while(t--){
	    int n;cin>>n;
	    vector<int> vec(n);
	    for(int i=0; i<n; i++) cin>>vec[i];
	    bool no=false;;
	    for(int i=1; i<n-1; i++){
	        if(vec[i]<=vec[i-1] && vec[i]>vec[i+1]){
	            no=true;
	            break;
	        }
	    }
	    if(no){
	        cout<<"NO"<<"\n";
	    }
	    else{
	        cout<<"YES"<<"\n";
	    }
	}
}


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

using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector < int > vec(n);
        for (int i = 0; i < n; i++) cin >> vec[i];
        if (n == 2) {
            if (vec[0] > vec[1]) {
                cout << "NO" << "\n";
            }
            else {
                cout << "YES" << "\n";
            }
        }
        else {
            bool no = false;;
            for (int i = 1; i < n - 1; i++) {
                if (vec[i] <= vec[i - 1] && vec[i] > vec[i + 1]) {
                    no = true;
                    break;
                }
            }
            if (no) {
                cout << "NO" << "\n";
            }
            else {
                cout << "YES" << "\n";
            }
        }

    }
}
Problem: 2060D - Subtract Min Sort
Language: C++17 (GCC 7-32)

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

using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector < int > vec(n);
        for (int i = 0; i < n; i++) cin >> vec[i];
        if (n == 2) {
            if (vec[0] > vec[1]) {
                cout << "NO" << "\n";
            }
            else {
                cout << "YES" << "\n";
            }
        }
        else {
            bool no = false;;
            for (int i = 1; i < n - 1; i++) {
                if (vec[i] <= vec[i - 1] && vec[i] > vec[i + 1]) {
                    no = true;
                    break;
                }
            }
            if (no) {
                cout << "NO" << "\n";
            }
            else {
                cout << "YES" << "\n";
            }
        }

    }
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>

using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector < int > vec(n);
        for (int i = 0; i < n; i++) cin >> vec[i];
        if(vec[0]>vec[1]){
            cout<<"NO"<<endl;
        }
        else{
            bool no=false;
            for(int i = 0; i < n-1; i++){
                int mn = min(vec[i], vec[i+1]);
                vec[i] -= mn;
                vec[i+1] -= mn;
                if(vec[i]>vec[i+1]){
                    no=true;
                    break;
                }
            }
            if(no){
                cout<<"NO"<<endl;
            }
            else{
                cout<<"YES"<<endl;
            }
        }

    }
}
Problem: 2050D - Digital string maximization
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Time limit exceeded on test 8):
#include "bits/stdc++.h"

#define int long long

#define fi first

#define se second

#define vi vector<int>

#define vii vector<pair<int,int>>

#define vvi vector<vector<int>>

#define vch vector<char>

#define vb vector<bool>

#define vst vector<string>

#define pi pair<int,int>

#define eb emplace_back

#define pb push_back

#define all(x) (x).begin(),(x).end()

#define allr(x) (x).rbegin(),(x).rend()

#define input(v,n) for(int i=0;i<n;i++) cin>>v[i];

#define print(v) for(auto &x:v) cout<<x<<" "; cout<<endl;

#define total(a) accumulate(all(a),0LL)

#define fo(i,n) for(decltype(n) i=0;i<n;++i)

#define re(i,n) for(decltype(n) i=n-1;i>=0;--i)

#define fo1(i,a,b) for(decltype(b) i=a;i<b;++i)

#define re1(i,a,b) for(decltype(a) i=a;i>=b;--i)

#define w(t) int t; cin>>t; while(t--)

#define debug(x) cerr << #x << " = " << x << endl

#define debugv(x) for(auto &i:x) cerr << i << " "; cerr << endl

#define mini(v) *min_element(all(v))

#define maxi(v) *max_element(all(v))

#define popcount(x) __builtin_popcountll(x)

#define bit(x) (1LL << (x))

#define lowbit(x) (x & -x)

#define checkbit(x, i) ((x >> i) & 1)

#define yesno(x) if(x) cout<<"YES"<<endl; else cout<<"NO"<<endl;

#define yes cout<<"YES"<<endl;

#define no cout<<"NO"<<endl;

#define mod 1000000007

#define endl '\n'

using namespace std;

void fastio() {

ios::sync_with_stdio(false);

cin.tie(NULL); cout.tie(0); cout.precision(10);

srand(chrono::high_resolution_clock::now().time_since_epoch().count());

}

void solve() {

string s ; cin >> s ;

int n = s.size() ;

while(1){

bool check = true;

re1(i,n-1,1){

if(s[i]-s[i-1]>=2){

check = false;

s[i]--;

swap(s[i],s[i-1]);

}

}

if(check) break;

}

cout << s << endl;

}

int32_t main() {

fastio();

w(t) solve();

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>
using namespace std ;


int main (){
   int t  ;
   cin>>t ;
   while (t--){

   string s ;
   cin>> s ;
   vector<int>v ;
   for(int i = 0 ; i<s.size() ; i++){
      v.push_back(int(s[i] - '0')) ;
   }
   for(int i = 0 ; i<s.size() ; i++){
      int maxi = v[i] ;
      int maxidx = -1 ;
     
       for (int j = i; j < min(i + 10, (int)v.size()); j++) {
         if(v[j]-j+i> maxi){
            maxi = v[j] + i ;
            maxidx = j ;
         }
      }
      while(maxidx>i){
         swap(v[maxidx],v[maxidx-1]) ;
         maxidx-- ;
      }
      v[i] = maxi ;

   
   }
   for(int i = 0 ; i< v.size() ;i++){
      cout<<v[i] ;
   }
   cout<<endl;
}
}

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std ;


int main (){
   int t  ;
   cin>>t ;
   while (t--){

   string s ;
   cin>> s ;
   vector<int>v ;
   for(int i = 0 ; i<s.size() ; i++){
      v.push_back(int(s[i] - '0')) ;
   }
   for(int i = 0 ; i<s.size() ; i++){
      int maxi = v[i] ;
      int maxidx = -1 ;
     
       for (int j = i; j < min(i + 10, (int)v.size()); j++) {
         if(v[j]-j+i> maxi){
            maxi = v[j] -j + i;
            maxidx = j ;
         }
      }
      while(maxidx>i){
         swap(v[maxidx],v[maxidx-1]) ;
         maxidx-- ;
      }
      v[i] = maxi ;

   
   }
   for(int i = 0 ; i< v.size() ;i++){
      cout<<v[i] ;
   }
   cout<<endl;
}
}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)

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


int main (){
   int t  ;
   cin>>t ;
   while (t--){

   string s ;
   cin>> s ;
   vector<int>v ;
   for(int i = 0 ; i<s.size() ; i++){
        v.push_back(int(s[i] - '0')) ;
   }
   bool b = false ;
   for(int j = 0 ; j<s.size() ; j++){
   for(int i = 1; i<s.size() ; i++){
        if(v[i]-v[i-1]>=2){
            v[i] -- ;
            swap(v[i] , v[i-1]) ;
            
        }

   }
   }
   for(int i = 0 ; i<v.size() ; i++){
      cout<<v[i] ;
   }
   cout<<endl ;

   }
}

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


int main (){
   int t  ;
   cin>>t ;
   while (t--){

   string s ;
   cin>> s ;
   vector<int>v ;
   for(int i = 0 ; i<s.size() ; i++){
      v.push_back(int(s[i] - '0')) ;
   }
   for(int i = 0 ; i<s.size() ; i++){
      int maxi = v[i] ;
      int maxidx = -1 ;
     
       for (int j = i; j < min(i + 10, (int)v.size()); j++) {
         if(v[j]-j+i> maxi){
            maxi = v[j] + i ;
            maxidx = j ;
         }
      }
      while(maxidx>i){
         swap(v[maxidx],v[maxidx-1]) ;
         maxidx-- ;
      }
      v[i] = maxi ;

   
   }
   for(int i = 0 ; i< v.size() ;i++){
      cout<<v[i] ;
   }
   cout<<endl;
}
}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)

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


int main (){
   int t  ;
   cin>>t ;
   while (t--){

   string s ;
   cin>> s ;
   vector<int>v ;
   for(int i = 0 ; i<s.size() ; i++){
        v.push_back(int(s[i] - '0')) ;
   }
   bool b = false ;
   for(int j = 0 ; j<s.size() ; j++){
   for(int i = 1; i<s.size() ; i++){
        if(v[i]-v[i-1]>=2){
            v[i] -- ;
            swap(v[i] , v[i-1]) ;
            
        }

   }
   }
   for(int i = 0 ; i<v.size() ; i++){
      cout<<v[i]<<endl ;
   }

   }
}

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


int main (){
   int t  ;
   cin>>t ;
   while (t--){

   string s ;
   cin>> s ;
   vector<int>v ;
   for(int i = 0 ; i<s.size() ; i++){
        v.push_back(int(s[i] - '0')) ;
   }
   bool b = false ;
   for(int j = 0 ; j<s.size() ; j++){
   for(int i = 1; i<s.size() ; i++){
        if(v[i]-v[i-1]>=2){
            v[i] -- ;
            swap(v[i] , v[i-1]) ;
            
        }

   }
   }
   for(int i = 0 ; i<v.size() ; i++){
      cout<<v[i] ;
   }
   cout<<endl ;

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

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


int main (){
   int t  ;
   cin>>t ;
   while (t--){

   string s ;
   cin>> s ;
   vector<int>v ;
   for(int i = 0 ; i<s.size() ; i++){
        v.push_back(int(s[i] - '0')) ;
   }
   bool b = false ;
   for(int j = 0 ; j<s.size() ; j++){
   for(int i = 1; i<s.size() ; i++){
        if(v[i]-v[i-1]>=2){
            v[i] -- ;
            swap(v[i] , v[i-1]) ;
            
        }

   }
   }
   for(int i = 0 ; i<v.size() ; i++){
      cout<<v[i] ;
   }

   }
}

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


int main (){
   int t  ;
   cin>>t ;
   while (t--){

   string s ;
   cin>> s ;
   vector<int>v ;
   for(int i = 0 ; i<s.size() ; i++){
        v.push_back(int(s[i] - '0')) ;
   }
   bool b = false ;
   for(int j = 0 ; j<s.size() ; j++){
   for(int i = 1; i<s.size() ; i++){
        if(v[i]-v[i-1]>=2){
            v[i] -- ;
            swap(v[i] , v[i-1]) ;
            
        }

   }
   }
   for(int i = 0 ; i<v.size() ; i++){
      cout<<v[i]<<endl ;
   }

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


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


int main (){
   int t  ;
   cin>>t ;
   while (t--){

   string s ;
   cin>> s ;
   vector<int>v ;
   for(int i = 0 ; i<s.size() ; i++){
        v.push_back(int(s[i] - '0')) ;
   }
   bool b = false ;
   for(int j = 0 ; j<s.size() ; j++){
   for(int i = 1; i<s.size() ; i++){
        if(v[i]-v[i-1]>=2){
            v[i] -- ;
            swap(v[i] , v[i-1]) ;
            
        }

   }
   }
   for(int i = 0 ; i<v.size() ; i++){
      cout<<v[i] ;
   }

   }
}
Problem: 2063B - Subsequence Update
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/tree_policy.hpp>
#include <iomanip>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vc = vector<char>;
using vb = vector<bool>;
#define ppi pair<int,pair<int,int>>
#define pi pair<int,int>
#define ss second
#define ff first
#define endl "\n"
#define pb push_back
#define sz(x) (int)(x).size()
#define ONPC
#define in(n) cin>>(n)
const int mod = 1e9+7;

void solve(){
    int n,l,r;cin>>n>>l>>r;
    vi a(n);
    for (auto &i:a)cin>>i;
    int numbers = r-l+1;
    sort(a.begin(),a.end());
    ll sum=0;
    for (int i=0;i<numbers;i++)sum += a[i];
    cout<<sum<<endl;
}


int32_t main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    int t;cin>>t;
    while(t--){
        solve();
    }
    #ifdef ONPC
     cerr<< endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
    #endif
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

#include <iomanip>

using namespace std;

using namespace __gnu_pbds;

typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds;

using ll = long long;

using vi = vector<int>;

using vl = vector<long long>;

using vc = vector<char>;

using vb = vector<bool>;

#define ppi pair<int,pair<int,int>>

#define pi pair<int,int>

#define ss second

#define ff first

#define endl "\n"

#define pb push_back

#define sz(x) (int)(x).size()

#define ONPC

#define in(n) cin>>(n)

const int mod = 1e9+7;





void solve(){

    ll n,l,r;cin>>n>>l>>r;

    vl a(n+1);

    for (int i=1;i<=n;i++)cin>>a[i];

    ll numbers = (r-l)+1;

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

    ll sum=0;

    for (int i=1;i<=numbers;i++)sum += a[i];

    cout<<sum<<endl;

}





int32_t main(){

    ios::sync_with_stdio(0);

    cin.tie(0);

    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

    int t;cin>>t;

    while(t--){

        solve();

    }

    #ifdef ONPC

     cerr<< endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;

    #endif

}







Submission (verdict: Accepted):
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iomanip>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vc = vector<char>;
using vb = vector<bool>;
#define ppi pair<int,pair<int,int>>
#define pi pair<int,int>
#define ss second
#define ff first
#define endl "\n"
#define pb push_back
#define sz(x) (int)(x).size()
#define ONPC
#define in(n) cin>>(n)
#define inf LONG_LONG_MAX;
const int mod = 1e9+7;

void solve(){
	int n;
	ll suml=0,sumr=0,l,r,ans=inf;
	cin>>n>>l>>r;
	vector<ll> a(n),left,right;
	for(int i=0;i<n;i++)cin>>a[i];
	for(int i=0;i<r;i++)left.push_back(a[i]);
	sort(left.begin(),left.end());
	for(int i=0;i<r-l+1;i++) suml+=left[i];
	for(int i=l-1;i<n;i++) right.push_back(a[i]);
	sort(right.begin(),right.end());
	for(int i=0;i<r-l+1;i++)sumr+=right[i];
	ans=min(suml,sumr);
	cout<<ans<<"\n";
}


int32_t main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    int t;cin>>t;
    while(t--){
        solve();
    }
    #ifdef ONPC
     cerr<< endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
    #endif
}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iomanip>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vc = vector<char>;
using vb = vector<bool>;
#define ppi pair<int,pair<int,int>>
#define pi pair<int,int>
#define ss second
#define ff first
#define endl "\n"
#define pb push_back
#define sz(x) (int)(x).size()
#define ONPC
#define in(n) cin>>(n)
const int mod = 1e9+7;

void solve(){
    ll n,l,r;cin>>n>>l>>r;
    vl a(n);
    for (auto &i:a)cin>>i;
    ll numbers = (r-l)+1;
    sort(a.begin(),a.end());
    ll sum=0;
    for (int i=0;i<numbers;i++)sum += a[i];
    cout<<sum<<endl;
}


int32_t main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    int t;cin>>t;
    while(t--){
        solve();
    }
    #ifdef ONPC
     cerr<< endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
    #endif
}




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

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

#include <iomanip>

using namespace std;

using namespace __gnu_pbds;

typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds;

using ll = long long;

using vi = vector<int>;

using vl = vector<long long>;

using vc = vector<char>;

using vb = vector<bool>;

#define ppi pair<int,pair<int,int>>

#define pi pair<int,int>

#define ss second

#define ff first

#define endl "\n"

#define pb push_back

#define sz(x) (int)(x).size()

#define ONPC

#define in(n) cin>>(n)

const int mod = 1e9+7;





void solve(){

    ll n,l,r;cin>>n>>l>>r;

    vl a(n+1);

    for (int i=1;i<=n;i++)cin>>a[i];

    ll numbers = (r-l)+1;

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

    ll sum=0;

    for (int i=1;i<=numbers;i++)sum += a[i];

    cout<<sum<<endl;

}





int32_t main(){

    ios::sync_with_stdio(0);

    cin.tie(0);

    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

    int t;cin>>t;

    while(t--){

        solve();

    }

    #ifdef ONPC

     cerr<< endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;

    #endif

}
Problem: 2063B - Subsequence Update
Language: C++17 (GCC 7-32)

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

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iomanip>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vc = vector<char>;
using vb = vector<bool>;
#define ppi pair<int,pair<int,int>>
#define pi pair<int,int>
#define ss second
#define ff first
#define endl "\n"
#define pb push_back
#define sz(x) (int)(x).size()
#define ONPC
#define in(n) cin>>(n)
const int mod = 1e9+7;

void solve(){
    int n,l,r;cin>>n>>l>>r;
    vi a(n);
    for (auto &i:a)cin>>i;
    int numbers = r-l+1;
    sort(a.begin(),a.end());
    ll sum=0;
    for (int i=0;i<numbers;i++)sum += a[i];
    cout<<sum<<endl;
}


int32_t main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    int t;cin>>t;
    while(t--){
        solve();
    }
    #ifdef ONPC
     cerr<< endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
    #endif
}




Submission (verdict: Wrong answer on test 2):

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iomanip>
using namespace std;
using namespace __gnu_pbds;
typedef tree<long long, null_type, less<long long>, rb_tree_tag, tree_order_statistics_node_update> pbds;
using ll = long long;
using vi = vector<int>;
using vl = vector<long long>;
using vc = vector<char>;
using vb = vector<bool>;
#define ppi pair<int,pair<int,int>>
#define pi pair<int,int>
#define ss second
#define ff first
#define endl "\n"
#define pb push_back
#define sz(x) (int)(x).size()
#define ONPC
#define in(n) cin>>(n)
const int mod = 1e9+7;

void solve(){
    ll n,l,r;cin>>n>>l>>r;
    vl a(n);
    for (auto &i:a)cin>>i;
    ll numbers = (r-l)+1;
    sort(a.begin(),a.end());
    ll sum=0;
    for (int i=0;i<numbers;i++)sum += a[i];
    cout<<sum<<endl;
}


int32_t main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
    int t;cin>>t;
    while(t--){
        solve();
    }
    #ifdef ONPC
     cerr<< endl << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
    #endif
}
Problem: 2062C - Cirno and Operations
Language: C++20 (GCC 13-64)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define printarr(arr,n) {for (int i = 0; i<n; i++) cout << arr[i] << " "; cout << endl;}
#define ll long long
#define pb push_back

void solve() {
	int n;
	cin >> n;
	vector<int> vec(n);
	int ans = 0;
	for (int i = 0; i<n; i++) {
		cin >> vec[i];
		ans += vec[i];
	}
	while (vec.size()>1) {
		n = vec.size();
		if (vec[n-1]<vec[0]) reverse(vec.begin(), vec.end());
		ans = max(ans,vec[n-1]-vec[0]);
		for (int i = 1; i<n; i++) {
			vec[i-1] = vec[i]-vec[i-1];
		}
		vec.pop_back();
	}
	cout << ans << endl;
}

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

Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define printarr(arr,n) {for (int i = 0; i<n; i++) cout << arr[i] << " "; cout << endl;}
#define ll long long
#define pb push_back

void solve() {
	int n;
	cin >> n;
	vector<int> vec(n);
	int ans = 0;
	for (int i = 0; i<n; i++) {
		cin >> vec[i];
		ans += vec[i];
	}
	while (n>1) {
		if (vec[n-1]<vec[0]) reverse(vec.begin(), vec.end());
		ans = max(ans,vec[n-1]-vec[0]);
		for (int i = 1; i<n; i++) {
			vec[i-1] = vec[i]-vec[i-1];
		}
		vec.pop_back();
		n--;
	}
	ans = max(ans,vec[0]);
	cout << ans << endl;
}

int main() {
	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):
#include <bits/stdc++.h>
using namespace std;
#define printarr(arr,n) {for (int i = 0; i<n; i++) cout << arr[i] << " "; cout << endl;}
#define ll long long
#define pb push_back

void solve() {
	int n;
	cin >> n;
	vector<int> vec(n);
	int ans = 0;
	for (int i = 0; i<n; i++) {
		cin >> vec[i];
		ans += vec[i];
	}
	while (n>1) {
		if (vec[n-1]<vec[0]) reverse(vec.begin(), vec.end());
		ans = max(ans,vec[n-1]-vec[0]);
		for (int i = 1; i<n; i++) {
			vec[i-1] = vec[i]-vec[i-1];
		}
		vec.pop_back();
		n--;
	}
	ans = max(ans,vec[0]);
	cout << ans << endl;
}

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

Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
#define printarr(arr,n) {for (int i = 0; i<n; i++) cout << arr[i] << " "; cout << endl;}
#define ll long long
#define pb push_back

void solve() {
	int n;
	cin >> n;
	vector<ll> vec(n);
	ll ans = 0;
	for (int i = 0; i<n; i++) {
		cin >> vec[i];
		ans += vec[i];
	}
	while (n>1) {
		if (vec[n-1]<vec[0]) reverse(vec.begin(), vec.end());
		ans = max(ans,vec[n-1]-vec[0]);
		for (int i = 1; i<n; i++) {
			vec[i-1] = vec[i]-vec[i-1];
		}
		vec.pop_back();
		n--;
	}
	ans = max(ans,vec[0]);
	cout << ans << endl;
}

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


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
#define printarr(arr,n) {for (int i = 0; i<n; i++) cout << arr[i] << " "; cout << endl;}
#define ll long long
#define pb push_back

void solve() {
	int n;
	cin >> n;
	vector<int> vec(n);
	int ans = 0;
	for (int i = 0; i<n; i++) {
		cin >> vec[i];
		ans += vec[i];
	}
	while (vec.size()>1) {
		n = vec.size();
		if (vec[n-1]<vec[0]) reverse(vec.begin(), vec.end());
		ans = max(ans,vec[n-1]-vec[0]);
		for (int i = 1; i<n; i++) {
			vec[i-1] = vec[i]-vec[i-1];
		}
		vec.pop_back();
	}
	cout << ans << endl;
}

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