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

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;

template <typename T>

using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long

typedef vector<int> vi;

typedef vector<long long> vll;

#define REP(i, a, b) for(int i=a; i<b; i++)

#define REPI(a) for(auto &it : a)

#define PB push_back

#define F first

#define S second

#define MB make_pair

#define ln '\n'



void solve() {

    ll n;

    cin >> n;

    vll a(n);

    for (ll &x : a) cin >> x;

    vll even, odd;

    ll sumEven = 0, sumOdd = 0;

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

        if (i % 2 == 0) {

            even.push_back(a[i]);

            sumEven += a[i];

        } else {

            odd.push_back(a[i]);

            sumOdd += a[i];

        }

    }

    bool one = ceil(double(sumEven) / double(even.size())) == floor(double(sumEven) / double(even.size()));

    bool two = ceil(double(sumOdd) / double(odd.size())) == floor(double(sumOdd) / double(odd.size()));

    if (one == true && two == true && sumEven / even.size() == sumOdd / odd.size()) {

        cout << "YES" << endl;

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

}



int main() {

#ifndef ONLINE_JUDGE

    //for getting input from input1.txt

    freopen("input1.txt", "r", stdin);

    //for writing output to output1.txt

    freopen("output1.txt", "w", stdout);

#endif



    ios::sync_with_stdio(0);

    cin.tie(0);



    int t;

    cin >> t;

    while (t--) {

        solve();

    }



    return 0;

}

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;

template <typename T>

using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define ll long long

typedef vector<int> vi;

typedef vector<long long> vll;

#define REP(i, a, b) for(int i=a; i<b; i++)

#define REPI(a) for(auto &it : a)

#define PB push_back

#define F first

#define S second

#define MB make_pair

#define ln '\n'



void solve() {

    ll n;

    cin >> n;

    vll a(n);

    for (ll &x : a) cin >> x;

    vll even, odd;

    ll sumEven = 0, sumOdd = 0;

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

        if (i % 2 == 0) {

            even.push_back(a[i]);

            sumEven += a[i];

        } else {

            odd.push_back(a[i]);

            sumOdd += a[i];

        }

    }

    bool one = ceil(float(sumEven) / float(even.size())) == floor(float(sumEven) / float(even.size()));

    bool two = ceil(float(sumOdd) / float(odd.size())) == floor(float(sumOdd) / float(odd.size()));

    if (one == true && two == true && sumEven / even.size() == sumOdd / odd.size()) {

        cout << "YES" << endl;

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

}



int main() {

#ifndef ONLINE_JUDGE

    //for getting input from input1.txt

    freopen("input1.txt", "r", stdin);

    //for writing output to output1.txt

    freopen("output1.txt", "w", stdout);

#endif



    ios::sync_with_stdio(0);

    cin.tie(0);



    int t;

    cin >> t;

    while (t--) {

        solve();

    }



    return 0;

}

Answer: 1