ShaysXIA/CodeInsightBench huggingface dataset:
Problem: 2050B - Transfusion
Language: c++17 

Code 1:
#include <bits/stdc++.h>
using namespace std;

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

    int n;
    cin >> n;
    
    for (int i = 0; i < n; i++) {
        int seq_len; cin >> seq_len;
        int odd_sum = 0;
        int even_sum = 0;
        int odd_seq_len = (seq_len / 2) + (seq_len % 2);
        int even_seq_len = (seq_len / 2);
        for (int j = 0; j < seq_len; j++) {
            int val;
            cin >> val;
            if (j % 2 == 0) {
                odd_sum += val;
            }
            else even_sum += val;
        }
        int desired = (odd_sum + even_sum) / seq_len;
        if (odd_sum / odd_seq_len == desired && even_sum / even_seq_len == desired && odd_sum % odd_seq_len == 0 && even_sum % even_seq_len == 0) {
            cout << "YES\n";
        }
        else cout << "NO\n";
    }
}



Code 2:
#include <bits/stdc++.h>
using namespace std;

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

    int n;
    cin >> n;
    
    for (int i = 0; i < n; i++) {
        int seq_len; cin >> seq_len;
        long long odd_sum = 0;
        long long even_sum = 0;
        int odd_seq_len = (seq_len / 2) + (seq_len % 2);
        int even_seq_len = (seq_len / 2);
        for (int j = 0; j < seq_len; j++) {
            int val;
            cin >> val;
            if (j % 2 == 0) {
                odd_sum += val;
            }
            else even_sum += val;
        }
        long long desired = (odd_sum + even_sum) / seq_len;
        if (odd_sum / odd_seq_len == desired && even_sum / even_seq_len == desired && odd_sum % odd_seq_len == 0 && even_sum % even_seq_len == 0) {
            cout << "YES\n";
        }
        else cout << "NO\n";
    }
}



Answer: 2
Problem: 2050B - Transfusion
Language: python

Code 1:
t = int(input())

for i in range(t):

    n = int(input())

    inputs = list(map(int, input().split()))

    even_sum = 0

    odd_sum = 0

    for i in range(n):

        if i%2 == 0:

            even_sum += inputs[i]

        else:

            odd_sum += inputs[i]

    if n%2 == 1:

        if even_sum/(n//2+1) == odd_sum*(n-n//2-1):

            print("YES")

        else:

            print("NO")

    else:

        if even_sum/(n//2) == odd_sum*(n-n//2):

            print("YES")

        else:

            print("NO")

Code 2:
t = int(input())

for i in range(t):

    n = int(input())

    inputs = list(map(int, input().split()))

    even_sum = 0

    odd_sum = 0

    for i in range(n):

        if i%2 == 0:

            even_sum += inputs[i]

        else:

            odd_sum += inputs[i]

    if n%2 == 0:

        even = odd = n/2

    else:

        even = n//2+1

        odd = n - even

    if even_sum/even == int(even_sum/even) and odd_sum/odd == int(odd_sum/odd):

        if even_sum/even == odd_sum/odd:

            print("YES")

        else:

            print("NO")

    else:

        print("NO")

    

Answer: 2
Problem: 2050B - Transfusion
Language: c++17 

Code 1:
#include <bits/stdc++.h>

using namespace std;

int main(){

    int t;

    cin>>t;

    while(t--){

        long long int n;

        cin>>n;

        vector<int>ritik(n);

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

        cin>>ritik[i];

        long long int sum_o=0,sum_e=0;

        long long int c1=0,c2=0;

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

            if(i%2==0){

              sum_e+=ritik[i];  

              c1++;

            }

            else{

                sum_o+=ritik[i];

                c2++;

            }

        }

        if(sum_e/c1==sum_o/c2 && sum_e%c1==0&& sum_o%c2==0){

            cout<<"YES"<<endl;

        }

        else

            cout<<"NO"<<endl;

    }

}





Code 2:
#include <bits/stdc++.h>

using namespace std;

int main(){

    int t;

    cin>>t;

    while(t--){

        int n;

        cin>>n;

        vector<int>ritik(n);

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

        cin>>ritik[i];

        int sum_o=0,sum_e=0;

        int c1=0,c2=0;

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

            if(i%2==0){

              sum_e+=ritik[i];  

              c1++;

            }

            else{

                sum_o+=ritik[i];

                c2++;

            }

        }

        if(sum_e/c1==sum_o/c2 && sum_e%c1==0){

            cout<<"YES"<<endl;

        }

        else

            cout<<"NO"<<endl;

    }

}





Answer: 1
Problem: 2050B - Transfusion
Language: c++17 

Code 1:
#include<bits/stdc++.h>

using namespace std;

#define ll long long

signed solve()

{

	ll n;

	cin>>n;

	vector<ll> arr(n);

	ll sum=0;

	ll odd_sum=0,odd_cnt=0;

	ll eve_sum=0,eve_cnt=0;

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

	{

		cin>>arr[i];

		sum+=arr[i];

		if(i%2==0)

			{

				eve_sum+=arr[i];

				eve_cnt++;

			}

			else

			{

				odd_sum+=arr[i];

				odd_cnt++;

			}

	}

	if(sum%n==0)

	{

		ll eve_avg=eve_sum/eve_cnt;

		ll odd_avg=odd_sum/odd_cnt;

		if(eve_avg==odd_avg)

		{

			cout<<"YES"<<endl;

		}

		else

		{

			cout<<"NO"<<endl;

		}

	}

	else

	{

		cout<<"NO"<<endl;

	}

    return 0;

}

signed main()

{

    int t;

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    cout.tie(NULL);

    cin>>t;

    //t=1;

    while(t--)

    {

        solve();

    }

    return 0;

}

Code 2:
#include<bits/stdc++.h>

using namespace std;

#define ll long long

signed solve()

{

	ll n;

	cin>>n;

	vector<ll> arr(n);

	ll sum=0;

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

	{

		cin>>arr[i];

		sum+=arr[i];

	}

	if(sum%n==0)

	{

		ll ans=sum/n;

		for(int i=0;i<n-2;i++)

		{

			int avg=(arr[i]+arr[i+2]);

			if(avg%2==0)

			{

				arr[i+2]=avg/2;

			}

			else

			{

				arr[i+2]=(avg/2)+1;

			}

			arr[i]=avg/2;		

		}

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

		// {

		// 	cout<<arr[i]<<" ";

		// }

		// cout<<endl;

		bool flag=true;

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

		{

			if(arr[i]!=ans)

			{

				flag=false;

				break;

			}	

		}

		if(flag) cout<<"YES"<<endl;

		else cout<<"NO"<<endl;

	}

	else

	{

		cout<<"NO"<<endl;

	}

    return 0;

}

signed main()

{

    int t;

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    cout.tie(NULL);

    cin>>t;

    //t=1;

    while(t--)

    {

        solve();

    }

    return 0;

}

Answer: 1
Problem: 2050B - Transfusion
Language: c++17 

Code 1:
#include<bits/stdc++.h>

using namespace std;



int main(){

  int t;

  cin>>t;

  while(t--){

    int n;

    cin>>n;

    vector<int> vec(n);

    int sum = 0;

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

    {

       cin>>vec[i];

       sum += vec[i];

    }

    if(sum%n != 0){cout<<"NO"<<endl;continue;}

    int sum0 = 0;

    int sum1 = 0;

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

    {

      sum0 += vec[i];

    }

    for (int i = 1; i < n; i+= 2)

    {

      sum1 += vec[i];

    }

    int u = n/2;

    int beta = sum/n;

    if(n%2 == 0){if(sum0/u == beta && sum1/u == beta){cout<<"YES"<<endl;continue;}}

    else if(n%2 != 0){if(sum0/(u+1) == beta && sum1/u == beta){cout<<"YES"<<endl;continue;}}

    cout<<"NO"<<endl;

  }

  return 0 ;

}

Code 2:
#include<bits/stdc++.h>

using namespace std;



int main(){

  int t;

  cin>>t;

  while(t--){

    int n;

    cin>>n;

    vector<int> vec(n);

    long long sum = 0;

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

    {

       cin>>vec[i];

       sum += vec[i];

    }

    if(sum%n != 0){cout<<"NO"<<endl;continue;}

    long long sum0 = 0;

    long long sum1 = 0;

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

    {

      sum0 += vec[i];

    }

    for (int i = 1; i < n; i+= 2)

    {

      sum1 += vec[i];

    }

    int u = n/2;

    int beta = sum/n;

    if(n%2 == 0){if(sum0/u == beta && sum1/u == beta){cout<<"YES"<<endl;continue;}}

    else if(n%2 != 0){if(sum0/(u+1) == beta && sum1/u == beta){cout<<"YES"<<endl;continue;}}

    cout<<"NO"<<endl;

  }

  return 0 ;

}

Answer: 2
Problem: 2050B - Transfusion
Language: c++17 

Code 1:
#include <bits/stdc++.h>

using namespace std;

#define all(v) v.begin(), v.end()
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define ll long long
#define ld long double
#define fr(i, n) for (int i = 0; i < n; i++)
#define vi vector<ll>
#define pii pair<int, int>
#define mii map<int, int>
#define pb push_back
#define int long long
#define endl "\n"

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vi a(n);
        fr(i, n) cin >> a[i];
        int x = 0;
        int b = 0;
        int y = 0;
        int z = 0;
        for (int i = 0; i < n; i++)
        {
            if (i % 2 == 0)
            {
                x += a[i];
                y++;
            }
            else
            {
                b += a[i];
                z++;
            }
        }
        if (x / y == b / z && x % y == 0 && b % z == 0)
        {
            cout << "YES" << endl;
        }
        else
        {
            cout << "NO" << endl;
        }
    }
    return 0;
}

Code 2:
#include <bits/stdc++.h>

using namespace std;

#define all(v) v.begin(), v.end()
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
#define ll long long
#define ld long double
#define fr(i, n) for (int i = 0; i < n; i++)
#define vi vector<ll>
#define pii pair<int, int>
#define mii map<int, int>
#define pb push_back
#define int long long
#define endl "\n"

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        vi a(n);
        fr(i, n) cin >> a[i];
        if (a[0] < a[1] && a[1] < a[2])
        {
            cout << "yes" << endl;
        }
        else if (a[0] > a[1] && a[1] > a[2])
        {
            cout << "yes" << endl;
        }
        else
        {
            cout << "no" << endl;
        }
    }
    return 0;
}

Answer: 1
Problem: 2050B - Transfusion
Language: c++17 

Code 1:
#include<iostream>

#include<vector>

using namespace std;



void Solve(){

    int n;

    cin>>n;

    vector<long long int> vec(n);

    int sodd=0,seven=0,countodd=0,counteven=0;

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

        cin>>vec[i];

        if(i%2==0){

            sodd+=vec[i];

            countodd+=1;

        }

        else{

            seven+=vec[i];

            counteven+=1;

        }

    }

    if(seven*countodd==sodd*counteven && (seven+sodd)%(countodd+counteven)==0){

        cout<<"YES"<<endl;

    }else{cout<<"NO"<<endl;}

}



int main(){

    int t;

    cin>>t;

    while(t--){

        Solve();

    }

    return 0;

}

Code 2:
#include<iostream>

#include<vector>

using namespace std;



void Solve(){

    int n;

    cin>>n;

    vector<long long> vec(n);

    long long sodd=0,seven=0,countodd=0,counteven=0;

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

        cin>>vec[i];

        if(i%2==0){

            sodd+=vec[i];

            countodd++;

        }

        else{

            seven+=vec[i];

            counteven++;

        }

    }

    if((seven*countodd)==(sodd*counteven) && ((seven+sodd)%(countodd+counteven))==0){

        cout<<"YES"<<endl;

    }else{cout<<"NO"<<endl;}

}



int main(){

    int t;

    cin>>t;

    while(t--){

        Solve();

    }

    return 0;

}

Answer: 2
Problem: 2050B - Transfusion
Language: c++17 

Code 1:
#include <iostream>

using namespace std;

int main()
{
    int t;
    cin >> t;
    while (t--){
        int n;
        cin >> n;
        int a[n];
        int s = 0;
        for (int i=0; i<n; i++){
            cin >> a[i];
            s += a[i];
        }
        if (s%n){
            cout << "NO" << endl;
            continue;
        }
        s /= n;
        string ans = "YES";
        for (int i=1; i<n-1; i+=2){
            int f = s-a[i-1];
            a[i-1] = s;
            a[i+1] -= f;
        }
        for (int i=2; i<n-1; i+=2){
            int f = s-a[i-1];
            a[i-1] = s;
            a[i+1] -= f;
        }
        for (int i=0; i<n; i++){
            if (a[i]!=s){
                ans = "NO";
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Code 2:
#include <iostream>

using namespace std;

int main()
{
    int t;
    cin >> t;
    while (t--){
        int n;
        cin >> n;
        long long int a[n];
        long long int s = 0;
        for (int i=0; i<n; i++){
            cin >> a[i];
            s += a[i];
        }
        if (s%n){
            cout << "NO" << endl;
            continue;
        }
        s /= n;
        string ans = "YES";
        for (int i=1; i<n-1; i+=2){
            int f = s-a[i-1];
            a[i-1] = s;
            a[i+1] -= f;
        }
        for (int i=2; i<n-1; i+=2){
            int f = s-a[i-1];
            a[i-1] = s;
            a[i+1] -= f;
        }
        for (int i=0; i<n; i++){
            if (a[i]!=s){
                ans = "NO";
            }
        }
        cout << ans << endl;
    }
    return 0;
}


Answer: 2
Problem: 2050B - Transfusion
Language: other

Code 1:
#include <bits/stdc++.h>

using namespace std;



int main()

{

	int t;

	cin >> t;

	while (t--)

	{

		int n;

		cin >> n;

		double ji = 0;

		int cnt_ji = 0;

		double ou = 0;

		int cnt_ou = 0;

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

		{

			int now;

			cin >> now;

			if (i % 2 == 0)

			{

				ji += now;

				cnt_ji++;

			}

			else

			{

				ou += now;

				cnt_ou++;

			}

		}

		double a = ou / cnt_ou;

		double b = ji / cnt_ji;

		int A = a;

		int B = b;

		if (a == b&&a-A==0&&b-B==0)

		{

			cout << "YES" << endl;

		}

		else

		{

			cout << "NO" << endl;

		}



	}



}

Code 2:
#include <bits/stdc++.h>

using namespace std;



int main()

{

	int t;

	cin >> t;

	while (t--)

	{

		int n;

		cin >> n;

		double ji = 0;

		int cnt_ji = 0;

		double ou = 0;

		int cnt_ou = 0;

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

		{

			int now;

			cin >> now;

			if (i % 2 == 0)

			{

				ji += now;

			

			}

			else

			{

				ou += now;

		

			}

		}



		if (n % 2 == 0)

		{

			cnt_ou = n / 2;

			cnt_ji = n / 2;

		}

		else

		{

			cnt_ou = n / 2;

			cnt_ji = n / 2+1;

		}



		double a = ou / cnt_ou;

		double b = ji / cnt_ji;

		int A = a;

		int B = b;

		if (a == b&&a-A==0&&b-B==0)

		{

			cout << "YES" << endl;

		}

		else

		{

			cout << "NO" << endl;

		}



	}



}

Answer: 2
Problem: 2050B - Transfusion
Language: c++17 

Code 1:
#include <bits/stdc++.h>

using namespace std;



void solve() {

    int n; cin>> n;

    int sumodd =0, sumeven = 0;

   

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

      int u; cin>> u;

      

      if(i&1){

        sumodd += u;

      }

      else sumeven += u;

    }

    

    int oddsize = n/2 + (n&1);

    int evensize = n/2;

    

    if((sumodd%evensize) != 0 || (sumeven% oddsize) != 0  ) {

      cout<< "NO"<< endl;

    return;

      

    }

    if((sumodd/evensize) == (sumeven/oddsize)){

      cout<<"YES"<< endl;

    }

      else cout<<"NO"<< endl;

    

}



int main() {

    int t;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}



Code 2:
#include <bits/stdc++.h>

using namespace std;



void solve() {

    int n; cin>> n;

    long long int sumodd =0, sumeven = 0;

   

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

      int u; cin>> u;

      

      if(i&1){

        sumodd += u;

      }

      else sumeven += u;

    }

    

    int oddsize = n/2 + (n&1);

    int evensize = n/2;

    

    if((sumodd%evensize) != 0 || (sumeven% oddsize) != 0  ) {

      cout<< "NO"<< endl;

    return;

      

    }

    if((sumodd/evensize) == (sumeven/oddsize)){

      cout<<"YES"<< endl;

    }

      else cout<<"NO"<< endl;

    

}



int main() {

    int t;

    cin >> t;

    while (t--) {

        solve();

    }

    return 0;

}



Answer: 2
Problem: 2050B - Transfusion
Language: c++20 

Code 1:
#include<bits/stdc++.h>

using namespace std;

void solve(){

	int n;

	cin>>n;

	vector<int>a(n);

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

		cin>>a[i];

	}

	bool flag=true;

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

		if(a[i]==a[i-1]){

			flag=false;

			break;

		}

	}

if(flag){

	cout<<"yes"<<endl;

}

else{

	cout<<"no"<<endl;

}

}

int main(){

	int t;

	cin>>t;

	while(t--){

		solve();

	}

	return 0;

}

Code 2:
#include<bits/stdc++.h>

using namespace std;

void solve(){

	int n;

	cin>>n;

	vector<int>a(n);

	

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

		cin>>a[i];

		

	}

	bool flag=true;

	if(a[0]==a[n-1]){

		flag=false;

		

	}

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

		if(a[i]==a[i+1]){

			flag=false;

			break;

		}

	}

	if(flag){

		cout<<"yes"<<endl;

	}

	else{

		cout<<"no"<<endl;

	}

}

int main(){

	int t;

	cin>>t;

	while(t--){

		solve();

	}

	return 0;

}

Answer: 2
Problem: 2050B - Transfusion
Language: c++23 

Code 1:
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        vector<ll>vec(n);
        ll sum=0,d,b;

        for(int i=0; i<n; i++)
        {
            cin>>vec[i];
            sum+=vec[i];
        }
        if(sum%n!=0)
            cout<<"NO"<<endl;
        else
        {
            d=sum/n;
            bool pos=true;
            for(int a=n-2; a>=0; --a)
            {
                if(vec[a+1]>d)
                {
                    b=vec[a+1]-d;
                    vec[a+1]=d;
                    vec[a-1]+=b;
                }
                else if(vec[a+1]<d)
                {
                    b=d-vec[a+1];
                    vec[a+1]=d;
                    vec[a-1]-=b;
                }

            }
            for(int i=1; i<n; i++)
            {
                if(vec[0]!=vec[i])
                {
                    pos=false;
                    break;
                }
            }
            if(pos) cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }
    }
}


Code 2:
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
    int t;
    cin>>t;
    while(t--)
    {
        int n;
        cin>>n;
        vector<ll>vec(n);
        ll sum=0,d,b;

        for(int i=0; i<n; i++)
        {
            cin>>vec[i];
            sum+=vec[i];
        }
        if(sum%n!=0)
            cout<<"NO"<<endl;
        else
        {
            d=sum/n;
            bool pos=true;
            for(int a=n-2; a>0; --a)
            {
                if(vec[a+1]>d)
                {
                    b=vec[a+1]-d;
                    vec[a+1]=d;
                    vec[a-1]+=b;
                }
                else if(vec[a+1]<d)
                {
                    b=d-vec[a+1];
                    vec[a+1]=d;
                    vec[a-1]-=b;
                }

            }
            for(int i=1; i<n; i++)
            {
                if(vec[0]!=vec[i])
                {
                    pos=false;
                    break;

                }
            }
            if(pos) cout<<"YES"<<endl;
            else cout<<"NO"<<endl;
        }
    }
}


Answer: 2
Problem: 2050B - Transfusion
Language: c++17 

Code 1:
#include <iostream>

#include<vector>

using namespace std;

int main() {

    int t;

    cin>>t;

    while(t--){

        int n;

        cin>>n;

        vector<int> arr(n);

        int seven=0;

        int sodd=0;

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

            cin>>arr[i];

            if(i%2){

                sodd+=arr[i];

            }

            else{

                seven+=arr[i];

            }

        }

        if(seven% (n-n/2) !=0  && sodd%n/2!=0){

            cout<<"NO"<<endl;

        }

        else if(seven/(n-n/2) == sodd/(n/2)){

            cout<<"YES"<<endl;

        }

        else{

            cout<<"NO"<<endl;

        }

    }



    return 0;

}

Code 2:
#include <iostream>

#include<vector>

using namespace std;

int main() {

    int t;

    cin>>t;

    while(t--){

        int n;

        cin>>n;

        vector<int> arr(n);

        long long seven=0;

        long long sodd=0;

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

            cin>>arr[i];

            if((i+1)%2==1){

                sodd+=arr[i];

            }

            else{

                seven+=arr[i];

            }

        }

        if(seven% (n/2) != 0  ||  sodd%(n-n/2)!=0){

            cout<<"NO"<<endl;

        }

        else if(seven/(n/2) == sodd/(n-n/2)){

            cout<<"YES"<<endl;

        }

        else{

            cout<<"NO"<<endl;

        }

    }



    return 0;

}

Answer: 2
Problem: 2050B - Transfusion
Language: c++17 

Code 1:
#include <bits/stdc++.h>

using namespace std;

int main(){

    int t;

    cin>>t;

    while(t--){

        long long n;

        cin>>n;

        long long arr[n];

        for(int i = 0 ; i<n ;i++){cin>>arr[i];}

        long long sum1 = 0, sum2 =0 ,odd = 0,even = 0;

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

            sum1 = sum1 + arr[i];

            odd++;

        } //odd sum

        for(long long i =1; i<n; i+=2){

            sum2 = sum2 + arr[i];

            even++;

        }//even sum

        if((sum1%odd==0)&&(sum2%even==0)&&(sum1/odd) == (sum2/even)){cout<<"YES"<<endl;}

        else{cout<<"NO"<<endl;}

        

    }

}

Code 2:
#include <bits/stdc++.h>

using namespace std;

int main(){

    int t;

    cin>>t;

    while(t--){

        int n;

        cin>>n;

        int arr[n];

        for(int i = 0 ; i<n ;i++){cin>>arr[i];}

        int sum1 = 0, sum2 =0 ,odd = 0,even = 0;

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

            sum1 = sum1 + arr[i];

            odd++;

        } //odd sum

        for(int i =1; i<n; i+=2){

            sum2 = sum2 + arr[i];

            even++;

        }//even sum

        if((sum1%odd==0)&&(sum2%even==0)&&sum1/odd == sum2/even){cout<<"YES"<<endl;}

        else{cout<<"NO"<<endl;}

        

    }

}



Answer: 1
Problem: 2050B - Transfusion
Language: c++17 

Code 1:
#include<iostream>

int main(){
    int t;
    std::cin>>t;
    while(t--){
        int n;
        std::cin>>n;
        int arr[n];
        for(int j=0;j<n;j++){
            std::cin>>arr[j];
        } 
        long long odd=0;
        long long even=0;
        for(int i=0;i<n;i++){
            if(i%2==0) even+=arr[i];
            else odd+=arr[i];
        }
        long oddPlace=n/2;
        long evenPlace=(n+1)/2;

        if(odd%oddPlace==0 && even%evenPlace==0 && odd/oddPlace==even/evenPlace) std::cout<<"Yes"<<std::endl;

        else std::cout<<"No"<<std::endl;
    }
        
    return 0;
}

Code 2:
#include<iostream>

int main(){
    int t;
    std::cin>>t;
    while(t--){
        int n;
        std::cin>>n;
        int arr[n];
        for(int j=0;j<n;j++){
            std::cin>>arr[j];
        } 
        int odd=0;
        int even=0;
        for(int i=0;i<n;i++){
            if(i%2==0) even+=arr[i];
            else odd+=arr[i];
        }
        int oddPlace=n/2;
        int evenPlace=(n+1)/2;

        if(odd%oddPlace==0 && even%evenPlace==0 && odd/oddPlace==even/evenPlace) std::cout<<"Yes"<<std::endl;

        else std::cout<<"No"<<std::endl;
    }
        
    return 0;
}

Answer: 1