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

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

#define kevat ios::sync_with_stdio(false);

#define patel cin.tie(0);

using namespace std;

#define ll long long

#define pb push_back

#define F for(int i=2;i<n;i++)

#define cntsetbit  __builtin_popcount

#define ss second

#define ff first

#define yes cout<<"yes"<<endl

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

//-------------------------------------------------------------

bool ispalindrome(string s)

{

    for(int i=0; 2*i<s.size(); i++)

    {

        if(s[i]!=s[s.size()-1-i])

        return false;

    }

    return true;

}

//-------------------------------------------------------------

bool isprime(ll a) {

    if (a != 2 && a % 2 == 0 || a < 2)

        return 0;

    for (ll i = 3; i * i <= a; i += 2)

        if (a % i == 0)

            return 0;

    return 1;

}

//-------------------------------------------------------------

void reverse(string str)

{

    for (int i = str.length() - 1; i >= 0; i--)

        cout << str[i];

}

//-------------------------------------------------------------

string lowercase(string s1)

{

      for(int i=0; i<s1.size(); i++)

        {

            if(s1[i]>='A'&&s1[i]<='Z')

                s1[i]=s1[i]-'A'+97;

        }

        return s1;

}

//-------------------------------------------------------------

void uppercase(string s1)

{

      for(int i=0; i<s1.size(); i++)

        {

            if(s1[i]>='a'&&s1[i]<='z')

                cout << char(s1[i] & '_');

        }

}

//-------------------------------------------------------------

void pb(int num)

{

    for(int i=10;i>=0;i--)

    {

        cout<<((num>>i) & 1);

    }

    cout<<endl;

}

//-------------------------------------------------------------

bool setunset(int num,int i)

{

    if((num & (1<<i)) != 0)  // Fix this condition

    {

        return true;

    }

    else

    {

        return false;

    }

}

//-------------------------------------------------------------

bool isperfectsquare(int x)

{

    if(x>=0)

    {

        ll sr=sqrt(x);

        return(sr*sr==x);

    }

    return false;

}

//-------------------------------------------------------------

void solve() 

{

    ll n;

        cin >> n;

        ll sum1 = 0, cnt1 = 0;

        ll sum2 = 0, cnt2 = 0;

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

            int x;

            cin >> x;

            if(i & 1){

                sum1 += x;

                cnt1++;

            }else{

                sum2 += x;

                cnt2++;

            }

        }

        bool flg = (sum2 % cnt2 == 0 && sum1 % cnt1 == 0 && sum1 / cnt1 == sum2 / cnt2);

        cout << (flg ? "YES\n" : "NO\n");

}

int32_t main()

{

    kevat;

    patel;

    int t;

    cin>>t;

    while(t--)

    {

        solve();

    }

}

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

#define kevat ios::sync_with_stdio(false);

#define patel cin.tie(0);

using namespace std;

#define ll long long

#define pb push_back

#define F for(int i=2;i<n;i++)

#define cntsetbit  __builtin_popcount

#define ss second

#define ff first

#define yes cout<<"yes"<<endl

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

//-------------------------------------------------------------

bool ispalindrome(string s)

{

    for(int i=0; 2*i<s.size(); i++)

    {

        if(s[i]!=s[s.size()-1-i])

        return false;

    }

    return true;

}

//-------------------------------------------------------------

bool isprime(ll a) {

    if (a != 2 && a % 2 == 0 || a < 2)

        return 0;

    for (ll i = 3; i * i <= a; i += 2)

        if (a % i == 0)

            return 0;

    return 1;

}

//-------------------------------------------------------------

void reverse(string str)

{

    for (int i = str.length() - 1; i >= 0; i--)

        cout << str[i];

}

//-------------------------------------------------------------

string lowercase(string s1)

{

      for(int i=0; i<s1.size(); i++)

        {

            if(s1[i]>='A'&&s1[i]<='Z')

                s1[i]=s1[i]-'A'+97;

        }

        return s1;

}

//-------------------------------------------------------------

void uppercase(string s1)

{

      for(int i=0; i<s1.size(); i++)

        {

            if(s1[i]>='a'&&s1[i]<='z')

                cout << char(s1[i] & '_');

        }

}

//-------------------------------------------------------------

void pb(int num)

{

    for(int i=10;i>=0;i--)

    {

        cout<<((num>>i) & 1);

    }

    cout<<endl;

}

//-------------------------------------------------------------

bool setunset(int num,int i)

{

    if((num & (1<<i)) != 0)  // Fix this condition

    {

        return true;

    }

    else

    {

        return false;

    }

}

//-------------------------------------------------------------

bool isperfectsquare(int x)

{

    if(x>=0)

    {

        ll sr=sqrt(x);

        return(sr*sr==x);

    }

    return false;

}

//-------------------------------------------------------------

void solve() 

{

    int n;

        cin >> n;

        int sum1 = 0, cnt1 = 0;

        int sum2 = 0, cnt2 = 0;

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

            int x;

            cin >> x;

            if(i & 1){

                sum1 += x;

                cnt1++;

            }else{

                sum2 += x;

                cnt2++;

            }

        }

        bool flg = (sum2 % cnt2 == 0 && sum1 % cnt1 == 0 && sum1 / cnt1 == sum2 / cnt2);

        cout << (flg ? "YES\n" : "NO\n");

}

int32_t main()

{

    kevat;

    patel;

    int t;

    cin>>t;

    while(t--)

    {

        solve();

    }

}

Answer: 1