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

Code 1:
#include <iostream>

#include <fstream>

#include <string>

#include <vector>

#include <algorithm>

#include <cstdint>

#include <set>

#include <unordered_map>

#include <iomanip>

#include <map>

#include <numeric> 

#include <bitset>

#include <climits>

typedef long long ll;

#define F first

#define S second

#define PB push_back

#define MP make_pair

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

using namespace std;

ll MAX = 1e9 + 7;

void iO() {

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

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

}

vector<int> make_sorted_index(vector<int> const& values) {

    vector<int> index(values.size());

    iota(index.begin(), index.end(), 0);

    stable_sort(index.begin(), index.end(), [&values](int a, int b) { return values[a] < values[b]; } );

    return index;

}



ll iSqrt(ll n) {

    ll lo = 1, hi = min((ll)3037000500, n); // long long

    ll res = 1;

    while(lo <= hi) {

        ll mid = lo + (hi - lo)/2;

        if(mid*mid <= n) {

            res = mid;

            lo = mid + 1;

        }

        else {

            hi = mid - 1;

        }

    }

    return res;

}



int solve() {

    ll n;

    cin >> n;

    ll alter = 0;

    ll alter2 = 0;

    ll size1 = 0;

    ll size2 = 0;

    LOO(i, 0, n -1 ) {

        ll temp;

        cin >> temp;

        if (i%2==0) {

            size1++;

            alter += temp;

        }

        else {

            size2++;

            alter2 += temp;

        }

    }

    if (alter%size1==0 && alter2%size2==0 && alter/size1==alter2/size2) {

        cout << "YES" << endl;

    }

    else {

        cout << "NO" << endl;

    }

    return 0;

}





int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    //iO();

    //pre_process();

    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

}

Code 2:
#include <iostream>

#include <fstream>

#include <string>

#include <vector>

#include <algorithm>

#include <cstdint>

#include <set>

#include <unordered_map>

#include <iomanip>

#include <map>

#include <numeric> 

#include <bitset>

#include <climits>

typedef long long ll;

#define F first

#define S second

#define PB push_back

#define MP make_pair

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

using namespace std;

ll MAX = 1e9 + 7;

void iO() {

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

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

}

vector<int> make_sorted_index(vector<int> const& values) {

    vector<int> index(values.size());

    iota(index.begin(), index.end(), 0);

    stable_sort(index.begin(), index.end(), [&values](int a, int b) { return values[a] < values[b]; } );

    return index;

}



ll iSqrt(ll n) {

    ll lo = 1, hi = min((ll)3037000500, n); // long long

    ll res = 1;

    while(lo <= hi) {

        ll mid = lo + (hi - lo)/2;

        if(mid*mid <= n) {

            res = mid;

            lo = mid + 1;

        }

        else {

            hi = mid - 1;

        }

    }

    return res;

}



int solve() {

    ll n;

    cin >> n;

    ll alter = 0;

    LOO(i, 0, n -1 ) {

        ll temp;

        cin >> temp;

        if (i%2==0) {

            alter += temp;

        }

        else {

            alter -= temp;

        }

    }

    if (alter == 0) {

        cout << "YES" << endl;

    }

    else {

        cout << "NO" << endl;

    }

    return 0;

}





int main() {

    ios_base::sync_with_stdio(false);

    cin.tie(NULL);

    //iO();

    //pre_process();

    int t = 1;

    cin >> t;

    while (t--) {

        solve();

    }

}

Answer: 1