ShaysXIA/CodeInsightBench huggingface dataset:
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;
typedef long long ll;

void solve(){
    int n; cin>>n;
    vector<ll> vi;
    ll ans=0;
    for(int i=0;i<n;i++){
        int x; cin>>x;
        vi.push_back(x);
    }
    if(n==1){
        cout<<vi[0];
        return;
    }
    else if(n>2){
        for(int i=1;i<=n-2;i++){
            for(auto it=vi.begin();it!=vi.end()-1;it++){
                ll sum=0;
                *it=*(it)-*(it+1);
                sum+=(*it);
                sum=abs(sum);
                ans=max(ans,sum);
            }
            vi.pop_back();
        }
    }
    auto it=vi.begin();
    ll a=*(it+1)+*it; ll b=(*it)-*(it+1); ll c=*(it+1)-(*it);
    ans=max(ans,max(a,max(b,c)));
    cout<<ans;
}

int main() {
    int t; cin >> t;
    while (t-- > 0) {
        solve();
        cout << "\n";
    }
    return 0;
}


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

void solve(){
    int n; cin>>n;
    vector<ll> vi;
    ll ans=0;
    for(int i=0;i<n;i++){
        int x; cin>>x;
        vi.push_back(x);
        ans+=x;
    }
    if(n==1){
        cout<<vi[0];
        return;
    }
    else if(n>2){
        for(int i=1;i<=n-2;i++){
            ll check=0;
            for(auto j:vi){
                check+=j;
            }
            ans=max(ans,check);
            ll sum=0;
            for(auto it=vi.begin();it!=vi.end()-1;it++){
                *it=*(it+1)-*(it);
                sum+=(*it);
            }
            ans=max(ans,max(sum,-sum));
            vi.pop_back();
        }
    }
    ll a=vi[0]+vi[1]; ll b=vi[0]-vi[1];
    ans=max(ans,(max(a,max(b,-b))));
    cout<<ans;
}

int main() {
    int t; cin >> t;
    while (t-- > 0) {
        solve();
        cout << "\n";
    }
    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;
typedef long long ll;

void solve(){
    int n; cin>>n;
    vector<ll> vi;
    ll ans=0;
    for(int i=0;i<n;i++){
        int x; cin>>x;
        vi.push_back(x);
        ans+=x;
    }
    if(n==1){
        cout<<vi[0];
        return;
    }
    else if(n>2){
        for(int i=1;i<=n-2;i++){
            for(auto it=vi.begin();it!=vi.end()-1;it++){
                ll sum=0;
                *it=*(it)-*(it+1);
                sum+=(*it);
                sum=abs(sum);
                ans=max(ans,sum);
            }
            vi.pop_back();
        }
    }
    auto it=vi.begin();
    ll a=*(it+1)+*it; ll b=(*it)-*(it+1); ll c=*(it+1)-(*it);
    ans=max(ans,max(a,max(b,c)));
    cout<<ans;
}

int main() {
    int t; cin >> t;
    while (t-- > 0) {
        solve();
        cout << "\n";
    }
    return 0;
}


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

void solve(){
    int n; cin>>n;
    vector<ll> vi;
    ll ans=0;
    for(int i=0;i<n;i++){
        int x; cin>>x;
        vi.push_back(x);
    }
    if(n==1){
        cout<<vi[0];
        return;
    }
    else if(n>2){
        for(int i=1;i<=n-2;i++){
            for(auto it=vi.begin();it!=vi.end()-1;it++){
                ll sum=0;
                *it=*(it)-*(it+1);
                sum+=(*it);
                sum=abs(sum);
                ans=max(ans,sum);
            }
            vi.pop_back();
        }
    }
    auto it=vi.begin();
    ll a=*(it+1)+*it; ll b=(*it)-*(it+1); ll c=*(it+1)-(*it);
    ans=max(ans,max(a,max(b,c)));
    cout<<ans;
}

int main() {
    int t; cin >> t;
    while (t-- > 0) {
        solve();
        cout << "\n";
    }
    return 0;
}
Problem: 2050D - Digital string maximization
Language: C++17 (GCC 7-32)


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

#define ll long long

using namespace std;



void solve() {

string s;

cin >> s;

ll n=s.length();

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

ll c=s[i]-'0';

ll indx=i;

for(ll j=i+1;j<min(10LL,n);j++){

if((s[j]-'0'-(j-i))>c){

c=s[j]-'0'-(j-i);

indx=j;

}



}

while(indx>i){

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

indx--;

}

s[i]=char(c+'0');

}

cout<<s<<endl;





}



int main() {

ll t;

cin >> t;

while (t--) {

solve();

}

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>

#define ll long long

using namespace std;



void solve() {

string s;

cin >> s;

ll n=s.length();

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

ll c=s[i]-'0';

ll indx=i;

for(ll j=i+1;j<min(10LL,n);j++){

if((s[j]-'0'-(j-i))>c){

c=s[j]-'0'-(j-i);

indx=j;

}



}

while(indx>i){

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

indx--;

}

s[i]=char(c+'0');

}

cout<<s<<endl;





}



int main() {

ll t;

cin >> t;

while (t--) {

solve();

}

return 0;

}



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

#define ll long long

using namespace std;



void solve() {

string s;

cin >> s;

ll n=s.length();

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

ll c=s[i]-'0';

ll indx=i;

for(ll j=i;j<min(10LL,n);j++){

if((s[j]-'0'-(j-i))>c){

c=s[j]-'0'-(j-i);

indx=j;

}



}

while(indx>i){

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

indx--;

}

s[i]=char(c+'0');

}

cout<<s<<endl;





}



int main() {

ll t;

cin >> t;

while (t--) {

solve();

}

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>

#define ll long long

using namespace std;



void solve() {

string s;

cin >> s;

ll n=s.length();

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

ll c=s[i]-'0';

ll indx=i;

for(ll j=i;j<min(10LL,n);j++){

if((s[j]-'0'-(j-i))>c){

c=s[j]-'0'-(j-i);

indx=j;

}



}

while(indx>i){

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

indx--;

}

s[i]=char(c+'0');

}

cout<<s<<endl;





}



int main() {

ll t;

cin >> t;

while (t--) {

solve();

}

return 0;

}



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

#define ll long long

using namespace std;



void solve() {

string s;

cin >> s;

ll n=s.length();

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

ll c=s[i]-'0';

ll indx=i;

for(ll j=i;j<min(i+10,n);j++){

if((s[j]-'0'-(j-i))>c){

c=s[j]-'0'-(j-i);

indx=j;

}



}

while(indx>i){

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

indx--;

}

s[i]=char(c+'0');

}

cout<<s<<endl;





}



int main() {

ll t;

cin >> t;

while (t--) {

solve();

}

return 0;

}
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;

//#define int long long

signed main()

{

     ios::sync_with_stdio(false);

     cin.tie(0);

     int tt;

    cin >> tt;

    while (tt--)

    {

        string s;

        cin>>s;

        for(int i=0;i<s.size()-1;i++)

        {

            for(int j=i;j<s.size()-1;j++)

            {

                if(s[j]<s[j+1]-1)

                {

                    s[j+1]--;

                    swap(s[j],s[j+1]);

                }

            }

        }

        cout<<s<<endl;

    }

    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;

//#define int long long

signed main()

{

     ios::sync_with_stdio(false);

     cin.tie(0);

     int tt;

    cin >> tt;

    while (tt--)

    {

        string s;

        cin>>s;

        for(int i=0;i<s.size()-1;i++)

        {

            for(int j=i;j<s.size()-1;j++)

            {

                if(s[j]<s[j+1]-1)

                {

                    s[j+1]--;

                    swap(s[j],s[j+1]);

                }

            }

        }

        cout<<s<<endl;

    }

    return 0;

}



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

using namespace std;

//#define int long long

signed main()

{

     ios::sync_with_stdio(false);

     cin.tie(0);

     int tt;

    cin >> tt;

    while (tt--)

    {

        string s;

        cin>>s;

        while(true)

        {

            bool flag=false;

        for(int i=0;i<s.size()-1;i++)

        {

            for(int j=i;j<s.size()-1;j++)

            {

                if(s[j]<s[j+1]-1)

                {

                    s[j+1]--;

                    flag=true;

                    swap(s[j],s[j+1]);

                }

            }

        }

        if(flag==false)

            break;

        }

        cout<<s<<endl;

    }

    return 0;

}
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;

//#define int long long

signed main()

{

     ios::sync_with_stdio(false);

     cin.tie(0);

     int tt;

    cin >> tt;

    while (tt--)

    {

        string s;

        cin>>s;

        while(true)

        {

            bool flag=false;

        for(int i=0;i<s.size()-1;i++)

        {

            for(int j=i;j<s.size()-1;j++)

            {

                if(s[j]<s[j+1]-1)

                {

                    s[j+1]--;

                    flag=true;

                    swap(s[j],s[j+1]);

                }

            }

        }

        if(flag==false)

            break;

        }

        cout<<s<<endl;

    }

    return 0;

}



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

using namespace std;

//#define int long long

signed main()

{

     ios::sync_with_stdio(false);

     cin.tie(0);

     int tt;

    cin >> tt;

    while (tt--)

    {

        string s;

        cin>>s;

        while(true)

        {

            bool flag=false;

        for(int i=0;i<9;i++)

        {

            for(int j=i;j<s.size()-1;j++)

            {

                if(s[j]<s[j+1]-1)

                {

                    s[j+1]--;

                    flag=true;

                    swap(s[j],s[j+1]);

                }

            }

        }

        if(flag==false)

            break;

        }

        cout<<s<<endl;

    }

    return 0;

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


Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include <string>
#include<math.h>
#include<iomanip>
using namespace std;
void solve(){
    long long sum=0;
    long long two=0,three=0;
    string s;
    cin>>s;
    int len=s.length();
    for(int i=0;i<len;i++){
        sum+=s[i]-'0';
        if(s[i]=='2')two++;
        if(s[i]=='3')three++;
    }
    int mod=sum%9;
    if(mod==0){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==2&&two>=1&&three>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==3&&three>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==4&&((two>=7)||(three==1&&two>=4)||(three==2&&two>=1))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==5&&two>=2){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==6&&((two>=6)||(three==1&&two>=3)||(three>=2))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==7&&two>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==8&&((two>=5)||(three==1&&two>=2))){
        cout<<"YES"<<"\n";
        return;
    }

    cout<<"NO\n";
}
int main() {
	std::ios::sync_with_stdio(false);
	cin.tie(0); 
	cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include <string>
#include<math.h>
#include<iomanip>
using namespace std;
void solve(){
    long long sum=0;
    long long two=0,three=0;
    string s;
    cin>>s;
    int len=s.length();
    for(int i=0;i<len;i++){
        sum+=s[i]-'0';
        if(s[i]=='2')two++;
        if(s[i]=='3')three++;
    }
    int mod=sum%9;
    if(mod==0){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==1&&((two>=4)||(three>=1&&two>=1))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==2&&(two>=8||(three>=1&&two>=5)||(three>=2&&two>=2))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==3&&three>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==4&&((two>=7)||(three>=1&&two>=4)||(three>=2&&two>=1))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==5&&two>=2){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==6&&((two>=6)||(three>=1&&two>=3)||(three>=2))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==7&&two>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==8&&((two>=5)||(three>=1&&two>=2))){
        cout<<"YES"<<"\n";
        return;
    }

    cout<<"NO\n";
}
int main() {
	std::ios::sync_with_stdio(false);
	cin.tie(0); 
	cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Submission (verdict: Accepted):
#include <iostream>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include <string>
#include<math.h>
#include<iomanip>
using namespace std;
void solve(){
    long long sum=0;
    long long two=0,three=0;
    string s;
    cin>>s;
    int len=s.length();
    for(int i=0;i<len;i++){
        sum+=s[i]-'0';
        if(s[i]=='2')two++;
        if(s[i]=='3')three++;
    }
    int mod=sum%9;
    if(mod==0){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==1&&((two>=4)||(three>=1&&two>=1))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==2&&(two>=8||(three>=1&&two>=5)||(three>=2&&two>=2))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==3&&(three>=1||two>=3)){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==4&&((two>=7)||(three>=1&&two>=4)||(three>=2&&two>=1))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==5&&two>=2){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==6&&((two>=6)||(three>=1&&two>=3)||(three>=2))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==7&&two>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==8&&((two>=5)||(three>=1&&two>=2))){
        cout<<"YES"<<"\n";
        return;
    }

    cout<<"NO\n";
}
int main() {
	std::ios::sync_with_stdio(false);
	cin.tie(0); 
	cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include <string>
#include<math.h>
#include<iomanip>
using namespace std;
void solve(){
    long long sum=0;
    long long two=0,three=0;
    string s;
    cin>>s;
    int len=s.length();
    for(int i=0;i<len;i++){
        sum+=s[i]-'0';
        if(s[i]=='2')two++;
        if(s[i]=='3')three++;
    }
    int mod=sum%9;
    if(mod==0){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==1&&((two>=4)||(three>=1&&two>=1))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==2&&two>=1&&three>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==3&&three>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==4&&((two>=7)||(three>=1&&two>=4)||(three>=2&&two>=1))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==5&&two>=2){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==6&&((two>=6)||(three>=1&&two>=3)||(three>=2))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==7&&two>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==8&&((two>=5)||(three>=1&&two>=2))){
        cout<<"YES"<<"\n";
        return;
    }

    cout<<"NO\n";
}
int main() {
	std::ios::sync_with_stdio(false);
	cin.tie(0); 
	cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include <string>
#include<math.h>
#include<iomanip>
using namespace std;
void solve(){
    long long sum=0;
    long long two=0,three=0;
    string s;
    cin>>s;
    int len=s.length();
    for(int i=0;i<len;i++){
        sum+=s[i]-'0';
        if(s[i]=='2')two++;
        if(s[i]=='3')three++;
    }
    int mod=sum%9;
    if(mod==0){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==1&&((two>=4)||(three>=1&&two>=1))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==2&&(two>=8||(three>=1&&two>=5)||(three>=2&&two>=2))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==3&&three>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==4&&((two>=7)||(three>=1&&two>=4)||(three>=2&&two>=1))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==5&&two>=2){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==6&&((two>=6)||(three>=1&&two>=3)||(three>=2))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==7&&two>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==8&&((two>=5)||(three>=1&&two>=2))){
        cout<<"YES"<<"\n";
        return;
    }

    cout<<"NO\n";
}
int main() {
	std::ios::sync_with_stdio(false);
	cin.tie(0); 
	cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2050C - Uninteresting Number
Language: C++23 (GCC 14-64, msys2)

Previous submission (verdict: Wrong answer on test 2):
#include <iostream>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include <string>
#include<math.h>
#include<iomanip>
using namespace std;
void solve(){
    long long sum=0;
    long long two=0,three=0;
    string s;
    cin>>s;
    int len=s.length();
    for(int i=0;i<len;i++){
        sum+=s[i]-'0';
        if(s[i]=='2')two++;
        if(s[i]=='3')three++;
    }
    int mod=sum%9;
    if(mod==0){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==2&&two>=1&&three>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==3&&three>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==4&&((two>=7)||(three==1&&two>=4)||(three==2&&two>=1))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==5&&two>=2){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==6&&((two>=6)||(three==1&&two>=3)||(three>=2))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==7&&two>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==8&&((two>=5)||(three==1&&two>=2))){
        cout<<"YES"<<"\n";
        return;
    }

    cout<<"NO\n";
}
int main() {
	std::ios::sync_with_stdio(false);
	cin.tie(0); 
	cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

Submission (verdict: Wrong answer on test 2):
#include <iostream>
#include<algorithm>
#include<map>
#include<vector>
#include<queue>
#include<set>
#include<stack>
#include <string>
#include<math.h>
#include<iomanip>
using namespace std;
void solve(){
    long long sum=0;
    long long two=0,three=0;
    string s;
    cin>>s;
    int len=s.length();
    for(int i=0;i<len;i++){
        sum+=s[i]-'0';
        if(s[i]=='2')two++;
        if(s[i]=='3')three++;
    }
    int mod=sum%9;
    if(mod==0){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==1&&((two>=4)||(three>=1&&two>=1))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==2&&two>=1&&three>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==3&&three>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==4&&((two>=7)||(three>=1&&two>=4)||(three>=2&&two>=1))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==5&&two>=2){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==6&&((two>=6)||(three>=1&&two>=3)||(three>=2))){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==7&&two>=1){
        cout<<"YES"<<"\n";
        return;
    }
    if(mod==8&&((two>=5)||(three>=1&&two>=2))){
        cout<<"YES"<<"\n";
        return;
    }

    cout<<"NO\n";
}
int main() {
	std::ios::sync_with_stdio(false);
	cin.tie(0); 
	cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)

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




int main() 
{
// 	ios_base::sync_with_stdio(false); cin.tie(NULL);

	int t;
	cin>>t;
	while(t--){
		int n;
        cin>>n;
        int arr[n];
        for(int i =0;i<n;i++){
            cin>>arr[i];
        }
        int od_,ev_;
        if(n%2 == 0){
            od_ = n/2;
            ev_ = n/2;
        }
        else{
            od_ = n/2 + 1;
            ev_ = n/2;
        }
        // int a[od];
        // int b[ev];
        long long int od =0;
        long long int ev =0;
        for(int i =0;i<n;i++){
            if((i + 1)%2 == 0){
                ev += arr[i];
            }
            else{
                od += arr[i];
            }
        }
        if ((od/od_) == (ev/ev_) && od%od_ == 0 && ev%ev_ == 0){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }

	}

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




int main() 
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	int t;
	cin>>t;
	while(t--){
		int n;
        cin>>n;
        int arr[n];
        for(int i =0;i<n;i++){
            cin>>arr[i];
        }
        int od_,ev_;
        if(n%2 == 0){
            od_ = n/2;
            ev_ = n/2;
        }
        else{
            od_ = n/2 + 1;
            ev_ = n/2;
        }
        long long int od =0;
        long long int ev =0;
        for(int i =0;i<n;i++){
            if((i + 1)%2 == 0){
                ev += arr[i];
            }
            else{
                od += arr[i];
            }
        }
        if ((od/od_) == (ev/ev_) && od%od_ == 0 && ev%ev_ == 0){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }

	}

	
	return 0;
}
Problem: 2050B - Transfusion
Language: C++17 (GCC 7-32)

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




int main() 
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	int t;
	cin>>t;
	while(t--){
		int n;
        cin>>n;
        int arr[n];
        for(int i =0;i<n;i++){
            cin>>arr[i];
        }
        int od_,ev_;
        if(n%2 == 0){
            od_ = n/2;
            ev_ = n/2;
        }
        else{
            od_ = n/2 + 1;
            ev_ = n/2;
        }
        int od =0;
        int ev =0;
        for(int i =0;i<n;i++){
            if((i + 1)%2 == 0){
                ev += arr[i];
            }
            else{
                od += arr[i];
            }
        }
        if ((od/od_) == (ev/ev_) && od%od_ == 0 && ev%ev_ == 0){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }

	}

	
	return 0;
}

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




int main() 
{
	ios_base::sync_with_stdio(false); cin.tie(NULL);

	int t;
	cin>>t;
	while(t--){
		int n;
        cin>>n;
        int arr[n];
        for(int i =0;i<n;i++){
            cin>>arr[i];
        }
        int od_,ev_;
        if(n%2 == 0){
            od_ = n/2;
            ev_ = n/2;
        }
        else{
            od_ = n/2 + 1;
            ev_ = n/2;
        }
        // int a[od];
        // int b[ev];
        long long int od =0;
        long long int ev =0;
        for(int i =0;i<n;i++){
            if((i + 1)%2 == 0){
                ev += arr[i];
            }
            else{
                od += arr[i];
            }
        }
        if ((od/od_) == (ev/ev_) && od%od_ == 0 && ev%ev_ == 0){
            cout<<"YES"<<endl;
        }
        else{
            cout<<"NO"<<endl;
        }

	}