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

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

#include<ext/pb_ds/assoc_container.hpp>

#include<ext/pb_ds/tree_policy.hpp>

using namespace std;

using namespace __gnu_pbds;

#define x27pert              \

    ios::sync_with_stdio(0); \

    cin.tie(0);              \

    cout.tie(0);             \

    cout << setiosflags(ios::fixed) << setprecision(15);

using ll = long long;

using ld = long double;

// Define the PBDS type with pairs (value, frequency)

typedef tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> pbds;

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

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

#define mp make_pair

#define pb push_back

#define rep(i, n, m) for (ll i = (n); i < (ll)(m); i++)

#define rrep(i, n, m) for (ll i = (ll)(m) - 1; i >= (ll)(n); i--)

#define no cout << "NO" << "\n";

#define yes cout << "YES" << "\n";

const ll MOD = 1e9 + 7;

const ld pi = 3.1415926535897932384626433832795;

using gint = greater<int>;

vector<pair<int,int>>d={{-1,0},{0,1},{1,0},{0,-1}};

bool isvalid(int n, int m,int i ,int j,vector<vector<char>>&v,vector<vector<bool>>&visited)

{

  return i<n && i>=0 && j<m && j>=0  && v[i][j]!='*' && !visited[i][j]  ;

}

void solve() {

           int n;

           cin>>n;

           vector<int>v(n);

           int sum=0;

           int ans=0;

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

           {

             cin>>v[i];

             if(i%2==0)

             {

               sum+=v[i]; 

             }

             else{

               ans+=v[i];

             }

           }

           int m=n/2;

           int l=m;

           if(n%2==1)

           {

             l++;

           }

           if(sum/l == ans/m && sum%l==0 && ans%l==0)

           {

             yes;

           }

           else{

             no;

           }

}

signed main()

{

    x27pert;

    int _;

    _ = 1;

  cin >> _;



    while (_--)

    {

        solve();

    }

    return 0;

}

// ll exp(ll x, ll n)

// {

//     assert(n >= 0);

//     // note: m * m must be less than 2^63 to avoid ll overflow

//     ll res = 1;

//     while (n > 0)

//     {

//         if (n % 2 == 1)

//         {

//             res = res * x ;

//         }

//         x = x * x ;

//         n /= 2;

//     }

//     return res;

// }

//

// bool isvalid(int i ,int j , vector<vector<ll>>&v,vector<vector<bool>>&visited)

// {

//   return i>=0 && i<n && j>=0 && j<m && !visited[i][j] && v[i][j]>0; 

// }

// vector<pair<int,int>>dx={{-1,0},{0,-1},{1,0},{0,1}};

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

#include<ext/pb_ds/assoc_container.hpp>

#include<ext/pb_ds/tree_policy.hpp>

using namespace std;

using namespace __gnu_pbds;

#define x27pert              \

    ios::sync_with_stdio(0); \

    cin.tie(0);              \

    cout.tie(0);             \

    cout << setiosflags(ios::fixed) << setprecision(15);

using ll = long long;

using ld = long double;

// Define the PBDS type with pairs (value, frequency)

typedef tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tree_tag, tree_order_statistics_node_update> pbds;

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

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

#define mp make_pair

#define pb push_back

#define rep(i, n, m) for (ll i = (n); i < (ll)(m); i++)

#define rrep(i, n, m) for (ll i = (ll)(m) - 1; i >= (ll)(n); i--)

#define no cout << "NO" << "\n";

#define yes cout << "YES" << "\n";

# define int long long 

const ll MOD = 1e9 + 7;

const ld pi = 3.1415926535897932384626433832795;

using gint = greater<int>;

vector<pair<int,int>>d={{-1,0},{0,1},{1,0},{0,-1}};

bool isvalid(int n, int m,int i ,int j,vector<vector<char>>&v,vector<vector<bool>>&visited)

{

  return i<n && i>=0 && j<m && j>=0  && v[i][j]!='*' && !visited[i][j]  ;

}

void solve() {

           int n;

           cin>>n;

           vector<int>v(n);

           int sum=0;

           int ans=0;

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

           {

             cin>>v[i];

             if(i%2==0)

             {

               sum+=v[i]; 

             }

             else{

               ans+=v[i];

             }

           }

           int m=n/2;

           int l=m;

           if(n%2==1)

           {

             l++;

           }

           if(sum/l == ans/m && sum%l==0 && ans%m==0)

           {

             yes;

           }

           else{

             no;

           }

}

signed main()

{

    x27pert;

    int _;

    _ = 1;

  cin >> _;



    while (_--)

    {

        solve();

    }

    return 0;

}

// ll exp(ll x, ll n)

// {

//     assert(n >= 0);

//     // note: m * m must be less than 2^63 to avoid ll overflow

//     ll res = 1;

//     while (n > 0)

//     {

//         if (n % 2 == 1)

//         {

//             res = res * x ;

//         }

//         x = x * x ;

//         n /= 2;

//     }

//     return res;

// }

//

// bool isvalid(int i ,int j , vector<vector<ll>>&v,vector<vector<bool>>&visited)

// {

//   return i>=0 && i<n && j>=0 && j<m && !visited[i][j] && v[i][j]>0; 

// }

// vector<pair<int,int>>dx={{-1,0},{0,-1},{1,0},{0,1}};

Answer: 2