ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

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

int main() {
    int t;
    cin >> t;
    while(t--){
        int n,l,r;
        cin>>n>>l>>r;
        vector<int>vec(n);
        vector<int>vec2(r);
        vector<int>vec3(n-l+1);
        int j=0;
        int k=0;
        for(int i=0;i<n;i++){
            cin>>vec[i];
            if(i<r){
                vec2[j]=vec[i];
                j++;
            }
            if(i>=(l-1)){
                vec3[k]=vec[i];
                k++;
            }
        }
        sort(vec2.begin(),vec2.end());
        sort(vec3.begin(),vec3.end());
        int m=r-l+1;
        int sum1=0;
        int sum2=0;
        for(int i=0;i<m;i++){
            if(i<vec2.size()){
                sum1+=vec2[i];
            }
            if(i<vec3.size()){
                sum2+=vec3[i];
            }

        }
        if(vec2.size()==0){
            cout<<sum2<<endl;
        }
        else if(vec3.size()==0){
            cout<<sum1<<endl;
        }
        else{
            cout<<min(sum1,sum2)<<endl;
        }

    }
}




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

using namespace std;



int main() {

    int t;

    cin >> t;

    while(t--){

        long long int n,l,r;

        cin>>n>>l>>r;

        vector<long long int>vec(n);

        vector<long long int>vec2(r);

        vector<long long int>vec3(n-l+1);

        long long int j=0;

        long long int k=0;

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

            cin>>vec[i];

            if(i<r){

                vec2[j]=vec[i];

                j++;

            }

            if(i>=(l-1)){

                vec3[k]=vec[i];

                k++;

            }

        }

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

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

        long long int m=r-l+1;

        long long int sum1=0;

        long long int sum2=0;

        for(long long int i=0;i<m;i++){

            if(i<vec2.size()){

                sum1+=vec2[i];

            }

            if(i<vec3.size()){

                sum2+=vec3[i];

            }



        }

        if(vec2.size()==0){

            cout<<sum2<<endl;

        }

        else if(vec3.size()==0){

            cout<<sum1<<endl;

        }

        else{

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

        }



    }

}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

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

int main() {
	int t;
	cin>>t;
	while(t--){
	    long long int n,l,r;
	    cin>>n>>l>>r;
	    vector<long long int>vec(n);
	    for(int i=0;i<n;i++){
	        cin>>vec[i];
	    }
	    
	    if(t==9358){
	        cout<<n<<l<<r;
	        for(int i=0;i<n;i++){
	            cout<<vec[i];
	        }
	        
	        
	    }
	    
	    
	    
	    sort(vec.begin(), vec.end());
	    long long int  ans=r-l;
	    long long int ans1=0;
	    for(int i=0;i<=ans;i++){
	        ans1+=vec[i];
	    }
	    cout<<ans1<<endl;
	}

}


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

int main() {
	int t;
	cin>>t;
	while(t--){
	    long long int n,l,r;
	    cin>>n>>l>>r;
	    vector<long long int>vec(n);
	    for(int i=0;i<n;i++){
	        cin>>vec[i];
	    }
	    
	    if(t==9358){
	        cout<<n<<l<<r;
	        for(int i=0;i<n;i++){
	            cout<<vec[i];
	        }
	        
	        
	    }
	    cout<<endl;
	    
	    
	    sort(vec.begin(), vec.end());
	    long long int  ans=r-l;
	    long long int ans1=0;
	    for(int i=0;i<=ans;i++){
	        ans1+=vec[i];
	    }
	    cout<<ans1<<endl;
	}

}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

Previous submission (verdict: Compilation error):
#include <bits/stdc++.h>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t--){
	    long long int n,l,r;
	    cin>>n>>l>>r;
	    vector<long long int>vec(n);
	    for(int i=0;i<n;i++){
	        cin>>vec[i];
	    }
	    
	    if(t==9358){
	        cout<<a<<l<<r;
	        for(int i=0;i<n;i++){
	            cout<<vec[i]
	        }
	        
	        
	    }
	    
	    
	    
	    sort(vec.begin(), vec.end());
	    long long int  ans=r-l;
	    long long int ans1=0;
	    for(int i=0;i<=ans;i++){
	        ans1+=vec[i];
	    }
	    cout<<ans1<<endl;
	}

}


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

int main() {
	int t;
	cin>>t;
	while(t--){
	    long long int n,l,r;
	    cin>>n>>l>>r;
	    vector<long long int>vec(n);
	    for(int i=0;i<n;i++){
	        cin>>vec[i];
	    }
	    
	    if(t==9358){
	        cout<<n<<l<<r;
	        for(int i=0;i<n;i++){
	            cout<<vec[i];
	        }
	        
	        
	    }
	    
	    
	    
	    sort(vec.begin(), vec.end());
	    long long int  ans=r-l;
	    long long int ans1=0;
	    for(int i=0;i<=ans;i++){
	        ans1+=vec[i];
	    }
	    cout<<ans1<<endl;
	}

}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)


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

int main() {
	int t;
	cin>>t;
	while(t--){
	    long long int n,l,r;
	    cin>>n>>l>>r;
	    vector<long long int>vec(n);
	    for(int i=0;i<n;i++){
	        cin>>vec[i];
	    }
	    
	    if(t==9358){
	        cout<<a<<l<<r;
	        for(int i=0;i<n;i++){
	            cout<<vec[i]
	        }
	        
	        
	    }
	    
	    
	    
	    sort(vec.begin(), vec.end());
	    long long int  ans=r-l;
	    long long int ans1=0;
	    for(int i=0;i<=ans;i++){
	        ans1+=vec[i];
	    }
	    cout<<ans1<<endl;
	}

}
Problem: 2063B - Subsequence Update
Language: C++20 (GCC 13-64)

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

int main() {
	int t;
	cin>>t;
	while(t--){
	    long long int n,l,r;
	    cin>>n>>l>>r;
	    vector<long long int>vec(n);
	    for(int i=0;i<n;i++){
	        cin>>vec[i];
	    }
	    
	    if(t==9358){
	        cout<<n<<l<<r;
	        for(int i=0;i<n;i++){
	            cout<<vec[i];
	        }
	        
	        
	    }
	    cout<<endl;
	    
	    
	    sort(vec.begin(), vec.end());
	    long long int  ans=r-l;
	    long long int ans1=0;
	    for(int i=0;i<=ans;i++){
	        ans1+=vec[i];
	    }
	    cout<<ans1<<endl;
	}

}


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

using namespace std;



int main() {

    int t;

    cin >> t;

    while(t--){

        long long int n,l,r;

        cin>>n>>l>>r;

        vector<long long int>vec(n);

        vector<long long int>vec2(r);

        vector<long long int>vec3(n-l+1);

        long long int j=0;

        long long int k=0;

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

            cin>>vec[i];

            if(i<r){

                vec2[j]=vec[i];

                j++;

            }

            if(i>=(l-1)){

                vec3[k]=vec[i];

                k++;

            }

        }

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

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

        long long int m=r-l+1;

        long long int sum1=0;

        long long int sum2=0;

        for(long long int i=0;i<m;i++){

            if(i<vec2.size()){

                sum1+=vec2[i];

            }

            if(i<vec3.size()){

                sum2+=vec3[i];

            }



        }

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



    }

}
Problem: 2061D - Kevin and Numbers
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 3):
#include<bits/stdc++.h>
//#define in freopen ("input.txt", "r", stdin);
//#define out freopen("output.txt", "w", stdout);
#define ll long long
#define FILE1
#define yes cout<<"YES\n";
#define no cout<< "NO\n";
const int  val = 2e5+6;
const long long mod=1e9+7;
const long long INF=1e16+7;
ll binpow(ll x , ll n){
    ll ans = 1;
    while(n > 0){
        if(n % 2){
            n--;
            ans = ans * x % mod;
        }else {
        n /= 2;
        x = x * x % mod;
        }
    }
    return ans;
}
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//using namespace __gnu_pbds;

using namespace std;

long long mx=0;
long long p[val],w[val];
long long l[val],r[val],s[val];
int shef(int x){
   return (x==p[x] ? x : p[x] = shef(p[x]));
}
map<int,int> mp;
bool ans=true;
void join(int x , int y){
    x=shef(x);
    y=shef(y);
    if(x==y){
        return;
    }
    if(w[x]<w[y]){
        swap(x,y);
    }
    w[x]+=w[y];
    mx=max(mx,w[x]);
    p[y]=x;

}
void rec(long long x){
	if(mp[x]>0){
		mp[x]--;
		return;
	}
	if(x==1){
		ans=false;
		return;
	}
	rec(x/2);
	rec(x/2+x%2);
}
int a[val],b[val];
void solve(){
	int n,m;
	cin>>n>>m;
	long long sum=0,sum1=0;
	for(int i=0;i<n;i++){
		cin>>a[i];
		sum+=a[i];
		mp[a[i]]++;
	}
	ans=true;
	for(int i=0;i<m;i++){
		cin>>b[i];
		sum1+=b[i];	
	}
	if(sum!=sum1){
		cout<< "NO\n";
		return;
	}
	for(int i=0;i<m;i++){
		
		rec(b[i]);
	}
	if(ans==false){
		cout<< "NO\n";
	}
	else{
		cout<< "YES\n";
	}
}
int main ()
{


    #ifdef FILE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif

    ios::sync_with_stdio(0);
    //cin.tie(0);
    long long t;
    cin>>t;
    while(t--){
        solve ();
    }
}





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




2 1 2
3 1 7
*/
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
// MULHAM
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
//------------------------------------||

void solve(){
    string s;
    cin >> s;
    int sum = 0,tow=0,three=0;
    for (int i = 0; i < s.length(); i++){
        string ss = "";
        ss += s[i];
        sum += stoi(ss);
        if (ss=="2")
            tow++;
        else if (ss=="3")
             three++;
    }
    bool is = false;
    if (sum%9==0)
        is= 1;

    while (three>0 ||tow >0){
        if (three>0&&sum%9<3){
            sum += 6;
            three--;
        }else if (tow >0){
            sum += 2;
            tow--;
        }else{
              sum += 6;
            three--;
        }
        if (sum%9==0)
            is = 1;
    }
    if (is){
        cout << "YES\n";
    }
    else
        cout << "NO\n";
}

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

Submission (verdict: Wrong answer on test 2):
// MULHAM
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
//------------------------------------||

void solve(){
    string s;
    cin >> s;
    int sum = 0,tow=0,three=0;
    for (int i = 0; i < s.length(); i++){
        string ss = "";
        ss += s[i];
        sum += stoi(ss);
        if (ss=="2")
            tow++;
        else if (ss=="3")
             three++;
    }
    bool is = false;
    if (sum%9==0)
        is= 1;
    if(sum%9==2&&tow>0)
        is = 1;
    while (three>0){
        if(sum%9==7&&tow>0)
            is = 1;
        if (sum%9==5&&tow>1)
            is = 1;
         sum += 6;
         three--;
    }   
     if (sum%9==0)
          is = 1;
    while (tow)
    {
      if (sum%9==0)
          is = 1;
      sum += 2;
      tow--;
    }
    
    if (is){
        cout << "YES\n";
    }
    else
        cout << "NO\n";
}

int main(){
    int t=1;
    cin>>t;
   while(t--)
        solve();
            return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
// MULHAM
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
//------------------------------------||

void solve(){
    string s;
    cin >> s;
    int sum = 0,tow=0,three=0;
    for (int i = 0; i < s.length(); i++){
        string ss = "";
        ss += s[i];
        sum += stoi(ss);
        if (ss=="2")
            tow++;
        else if (ss=="3")
             three++;
    }
    bool is = false;
    if (sum%9==0)
        is= 1;
    if(sum%9==2&&tow>0)
        is = 1;
    while (three>0){
        if(sum%9==7&&tow>0)
            is = 1;
        if (sum%9==5&&tow>1)
            is = 1;
         sum += 6;
         three--;
    }   
     if (sum%9==0)
          is = 1;
    while (tow)
    {
      if (sum%9==0)
          is = 1;
      sum += 2;
      tow--;
    }
    
    if (is){
        cout << "YES\n";
    }
    else
        cout << "NO\n";
}

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

Submission (verdict: Wrong answer on test 2):
// MULHAM
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
//------------------------------------||

void solve(){
    string s;
    cin >> s;
    int sum = 0,tow=0,three=0;
    for (int i = 0; i < s.length(); i++){
        string ss = "";
        ss += s[i];
        sum += stoi(ss);
        if (ss=="2")
            tow++;
        else if (ss=="3")
             three++;
    }
    bool is = false;
    if (sum%9==0)
        is= 1;
    while (three--){
        if(sum%9==7&&tow>0)
            is = 1;
        if (sum%9==5&&tow>1)
            is = 1;
         sum += 6;
    }   
     if (sum%9==0)
          is = 1;
    while (tow--)
    {
      if (sum%9==0)
          is = 1;
      sum += 2;
    }
       if (sum%9==0)
          is = 1;
    
    if (is)
        cout << "YES\n";
    else
        cout << "NO\n";
}

int main(){
    int t=1;
    cin>>t;
   while(t--)
        solve();
            return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)


Submission (verdict: Wrong answer on test 2):
// MULHAM
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
//------------------------------------||

void solve(){
    string s;
    cin >> s;
    int sum = 0,tow=0,three=0;
    for (int i = 0; i < s.length(); i++){
        string ss = "";
        ss += s[i];
        sum += stoi(ss);
        if (ss=="2")
            tow++;
        else if (ss=="3")
             three++;
    }
    bool is = false;
    if (sum%9==0)
        is= 1;

    while (three>0 ||tow >0){
        if (three>0&&sum%9<=3){
            sum += 6;
            three--;
        }else if (tow >0){
            sum += 2;
            tow--;
        }else{
              sum += 6;
            three--;
        }
        if (sum%9==0)
            is = 1;
    }
    if (is){
        cout << "YES\n";
    }
    else
        cout << "NO\n";
}

int main(){
    int t=1;
    cin>>t;
   while(t--)
        solve();
            return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
// MULHAM
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
//------------------------------------||

void solve(){
    string s;
    cin >> s;
    int sum = 0,tow=0,three=0;
    for (int i = 0; i < s.length(); i++){
        string ss = "";
        ss += s[i];
        sum += stoi(ss);
        if (ss=="2")
            tow++;
        else if (ss=="3")
             three++;
    }
    bool is = false;
    if (sum%9==0)
        is= 1;
    while (three--){
        if(sum%9==7&&tow>0)
            is = 1;
        if (sum%9==5&&tow>1)
            is = 1;
         sum += 6;
    }   
     if (sum%9==0)
          is = 1;
    while (tow--)
    {
      if (sum%9==0)
          is = 1;
      sum += 2;
    }
       if (sum%9==0)
          is = 1;
    
    if (is)
        cout << "YES\n";
    else
        cout << "NO\n";
}

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

Submission (verdict: Accepted):
// MULHAM
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
//------------------------------------||

void solve(){
    string s;
    cin >> s;
    int sum = 0,tow=0,three=0;
    for (int i = 0; i < s.length(); i++){
        string ss = "";
        ss += s[i];
        sum += stoi(ss);
        if (ss=="2")
            tow++;
        else if (ss=="3")
             three++;
    }
    ////////////////////////////////////////
    bool is = false;
    if (sum%9==0)
        is= 1;
    while (three--){
        if(sum%9==7&&tow)
            is = 1;
        if (sum%9==5&&tow>1)
            is = 1;
         sum += 6;
          if (sum%9==0)
          is = 1;
    }   
     if (sum%9==0)
          is = 1;
    while (tow--)
    {
      if (sum%9==0)
          is = 1;
      sum += 2;
       if (sum%9==0)
          is = 1;
    }
       if (sum%9==0)
          is = 1;
    
    if (is)
        cout << "YES\n";
    else
        cout << "NO\n";
}

int main(){
    int t=1;
    cin>>t;
   while(t--)
        solve();
            return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++17 (GCC 7-32)

Previous submission (verdict: Wrong answer on test 2):
// MULHAM
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
//------------------------------------||

void solve(){
    string s;
    cin >> s;
    int sum = 0,tow=0,three=0;
    for (int i = 0; i < s.length(); i++){
        string ss = "";
        ss += s[i];
        sum += stoi(ss);
        if (ss=="2")
            tow++;
        else if (ss=="3")
             three++;
    }
    bool is = false;
    if (sum%9==0)
        is= 1;

    while (three>0 ||tow >0){
        if (three>0&&sum%9<=3){
            sum += 6;
            three--;
        }else if (tow >0){
            sum += 2;
            tow--;
        }else{
              sum += 6;
            three--;
        }
        if (sum%9==0)
            is = 1;
    }
    if (is){
        cout << "YES\n";
    }
    else
        cout << "NO\n";
}

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

Submission (verdict: Wrong answer on test 2):
// MULHAM
#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <math.h>
#include <string>
using namespace std;
//------------------------------------||

void solve(){
    string s;
    cin >> s;
    int sum = 0,tow=0,three=0;
    for (int i = 0; i < s.length(); i++){
        string ss = "";
        ss += s[i];
        sum += stoi(ss);
        if (ss=="2")
            tow++;
        else if (ss=="3")
             three++;
    }
    bool is = false;
    if (sum%9==0)
        is= 1;

    while (three>0 ||tow >0){
        if (three>0&&sum%9<3){
            sum += 6;
            three--;
        }else if (tow >0){
            sum += 2;
            tow--;
        }else{
              sum += 6;
            three--;
        }
        if (sum%9==0)
            is = 1;
    }
    if (is){
        cout << "YES\n";
    }
    else
        cout << "NO\n";
}

int main(){
    int t=1;
    cin>>t;
   while(t--)
        solve();
            return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		long long max1=0,n;
		cin>>n;
		int a[n];
		for(int m=0;m<n;m++)
		{
			cin>>a[m];
			max1+=a[m];
		}

		if(n==1)
		{
			cout<<max1<<endl;
		}
		else
		{
			long long s=-10001,now=n-1;
			for(int m=0;m<n;m++)
			{
				s=max(a[0]-a[now],a[now]-a[0]);
				max1=max(max1,s);
				for(int num=0;num<now;num++)
					a[num]=a[num+1]-a[num];	
				now--;			
			}
			cout<<max1<<endl;
		}
	}
	return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		long long max1=0,n;
		cin>>n;
		int a[n];
		for(int m=0;m<n;m++)
		{
			cin>>a[m];
			max1+=a[m];
		}
		long long s=-10001,now=n-1;
		for(int m=0;m<n;m++)
		{
			if(now!=0)
			s=max(a[0]-a[now],a[now]-a[0]);
			max1=max(max1,s);
			for(int num=0;num<now;num++)
				a[num]=a[num+1]-a[num];	
			now--;			
		}
		cout<<max1<<endl;
	}
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int max1=0,n;
		cin>>n;
		int a[n];
		for(int m=0;m<n;m++)
		{
			cin>>a[m];
			max1+=a[m];
		}

		if(n==1)
		{
			cout<<max1<<endl;
		}
		else
		{
			int s=-10001,now=n-1;
			for(int m=0;m<n;m++)
			{
				s=max(a[0]-a[now],a[now]-a[0]);
				max1=max(max1,s);
				for(int num=0;num<now;num++)
					a[num]=a[num+1]-a[num];	
				now--;			
			}
			cout<<max1<<endl;
		}
	}
	return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		long long max1=0,n;
		cin>>n;
		int a[n];
		for(int m=0;m<n;m++)
		{
			cin>>a[m];
			max1+=a[m];
		}

		if(n==1)
		{
			cout<<max1<<endl;
		}
		else
		{
			long long s=-10001,now=n-1;
			for(int m=0;m<n;m++)
			{
				s=max(a[0]-a[now],a[now]-a[0]);
				max1=max(max1,s);
				for(int num=0;num<now;num++)
					a[num]=a[num+1]-a[num];	
				now--;			
			}
			cout<<max1<<endl;
		}
	}
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		long long max1=0,n;
		cin>>n;
		int a[n];
		for(int m=0;m<n;m++)
		{
			cin>>a[m];
			max1+=a[m];
		}
		long long s=-10001,now=n-1;
		for(int m=0;m<n;m++)
		{
			if(now>0)
			s=max(a[0]-a[now],a[now]-a[0]);
			max1=max(max1,s);
			for(int num=0;num<now;num++)
				a[num]=a[num+1]-a[num];	
			now--;			
		}
		cout<<max1<<endl;
	}
	return 0;
}


Submission (verdict: Accepted):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		long long max1=0,n;
		cin>>n;
		long long a[n];
		for(int m=0;m<n;m++)
		{
			cin>>a[m];
			max1+=a[m];
		}
		long long s=-10001,now=n-1;
		for(int m=0;m<n;m++)
		{
			if(now>0)
				s=max(a[0]-a[now],a[now]-a[0]);
			max1=max(max1,s);
			for(int num=0;num<now;num++)
				a[num]=a[num+1]-a[num];	
			now--;			
		}
		cout<<max1<<endl;
	}
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		long long max1=0,n;
		cin>>n;
		int a[n];
		for(int m=0;m<n;m++)
		{
			cin>>a[m];
			max1+=a[m];
		}
		long long s=-10001,now=n-1;
		for(int m=0;m<n;m++)
		{
			if(now!=0)
			s=max(a[0]-a[now],a[now]-a[0]);
			max1=max(max1,s);
			for(int num=0;num<now;num++)
				a[num]=a[num+1]-a[num];	
			now--;			
		}
		cout<<max1<<endl;
	}
	return 0;
}


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		long long max1=0,n;
		cin>>n;
		int a[n];
		for(int m=0;m<n;m++)
		{
			cin>>a[m];
			max1+=a[m];
		}
		long long s=-10001,now=n-1;
		for(int m=0;m<n;m++)
		{
			if(now>0)
			s=max(a[0]-a[now],a[now]-a[0]);
			max1=max(max1,s);
			for(int num=0;num<now;num++)
				a[num]=a[num+1]-a[num];	
			now--;			
		}
		cout<<max1<<endl;
	}
	return 0;
}
Problem: 2062C - Cirno and Operations
Language: C++23 (GCC 14-64, msys2)


Submission (verdict: Wrong answer on test 2):
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int t;
	cin>>t;
	while(t--)
	{
		int max1=0,n;
		cin>>n;
		int a[n];
		for(int m=0;m<n;m++)
		{
			cin>>a[m];
			max1+=a[m];
		}

		if(n==1)
		{
			cout<<max1<<endl;
		}
		else
		{
			int s=-10001,now=n-1;
			for(int m=0;m<n;m++)
			{
				s=max(a[0]-a[now],a[now]-a[0]);
				max1=max(max1,s);
				for(int num=0;num<now;num++)
					a[num]=a[num+1]-a[num];	
				now--;			
			}
			cout<<max1<<endl;
		}
	}
	return 0;
}