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

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

using namespace std;



#define ll long long

#define vi vector<int>

#define vll vector<long long>

#define vvi vector<vector<int>> 

#define pb push_back

#define all(x) begin(x), end(x)

#define rall(v) v.rbegin(), v.rend()

#define sz(x) (int)(x).size()

#define ull unsigned long long

#define fr(i, a, b) for (long long i = a; i < b; i++)

#define bug(...) __f(#__VA_ARGS__, __VA_ARGS__)



// Debugging function

template <typename Arg1>

void __f(const char *name, Arg1 &&arg1) { cout << name << " : " << arg1 << endl; }

template <typename Arg1, typename... Args>

void __f(const char *names, Arg1 &&arg1, Args &&...args) {

    const char *comma = strchr(names + 1, ',');

    cout.write(names, comma - names) << " : " << arg1 << " | ";

    __f(comma + 1, args...);

}



// Input and Output Overloads for Vectors

template <typename T>

istream &operator>>(istream &istream, vector<T> &vec) {

    for (auto &a : vec) cin >> a;

    return istream;

}

template <typename T>

ostream &operator<<(ostream &ostream, const vector<T> &vec) {

    for (auto &a : vec) cout << a << " ";

    return ostream;

}





void to_lower(string &s) { transform(all(s), s.begin(), ::tolower); }





void to_upper(string &s) { transform(all(s), s.begin(), ::toupper); }





string helper(string a, string b) {

    if (a + b != b + a) return ""; 

    int Gcd_len = __gcd(a.size(), b.size());

    return a.substr(0, Gcd_len);

}

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





vi factors(int n) {

    vi ans;

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

        if (n % i == 0) {

            ans.pb(i);

            if (i != n / i) ans.pb(n / i);

        }

    }

    return ans;

}

 

 bool bit(int mask, int pos){

        return (mask >> pos ) &1;

 } 

  

 bool check(int k , vi &v ,int h){   

    vi tmp;

       fr(i,0,k){

            tmp.pb(v[i]);

       }

       sort(all(tmp));

       reverse(all(tmp));



       int t = 0;

          for(int i = 0 ; i < k ;i+=2) t += tmp[i];

      return t <= h;

 }

 

 

 

   

 void solve() {

    int n;

    cin >> n;

    vi v(n);

    for (int &x : v) cin >> x;



    

    int Odd_sum = 0, Even_sum = 0;

    

     

    fr(i,0,n){ 



          if(i &1) Odd_sum += v[i];

          else Even_sum += v[i];

    }



    int odd = n/2, eve = n/2;

    if( n&1) eve++;

   

   if( (Odd_sum % odd != 0 || Even_sum % eve != 0 ) ||  Odd_sum/odd != Even_sum/eve ){

      cout << "NO" << endl;

      return;

   }

   

     cout << "YES" << endl;

   







 }

  







signed main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    int tc; cin >> tc;

    while(tc--){

    solve();

    }

    return 0;

}



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

using namespace std;



#define ll long long

#define vi vector<int>

#define vll vector<long long>

#define vvi vector<vector<int>> 

#define pb push_back

#define all(x) begin(x), end(x)

#define rall(v) v.rbegin(), v.rend()

#define sz(x) (int)(x).size()

#define ull unsigned long long

#define fr(i, a, b) for (long long i = a; i < b; i++)

#define bug(...) __f(#__VA_ARGS__, __VA_ARGS__)



// Debugging function

template <typename Arg1>

void __f(const char *name, Arg1 &&arg1) { cout << name << " : " << arg1 << endl; }

template <typename Arg1, typename... Args>

void __f(const char *names, Arg1 &&arg1, Args &&...args) {

    const char *comma = strchr(names + 1, ',');

    cout.write(names, comma - names) << " : " << arg1 << " | ";

    __f(comma + 1, args...);

}



// Input and Output Overloads for Vectors

template <typename T>

istream &operator>>(istream &istream, vector<T> &vec) {

    for (auto &a : vec) cin >> a;

    return istream;

}

template <typename T>

ostream &operator<<(ostream &ostream, const vector<T> &vec) {

    for (auto &a : vec) cout << a << " ";

    return ostream;

}





void to_lower(string &s) { transform(all(s), s.begin(), ::tolower); }





void to_upper(string &s) { transform(all(s), s.begin(), ::toupper); }





string helper(string a, string b) {

    if (a + b != b + a) return ""; 

    int Gcd_len = __gcd(a.size(), b.size());

    return a.substr(0, Gcd_len);

}

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





vi factors(int n) {

    vi ans;

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

        if (n % i == 0) {

            ans.pb(i);

            if (i != n / i) ans.pb(n / i);

        }

    }

    return ans;

}

 

 bool bit(int mask, int pos){

        return (mask >> pos ) &1;

 } 

  

 bool check(int k , vi &v ,int h){   

    vi tmp;

       fr(i,0,k){

            tmp.pb(v[i]);

       }

       sort(all(tmp));

       reverse(all(tmp));



       int t = 0;

          for(int i = 0 ; i < k ;i+=2) t += tmp[i];

      return t <= h;

 }

 

 

 

   

 void solve() {

    int n;

    cin >> n;

    vi a(n);

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



    

    long long ods = 0, evs = 0;

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

        if (i & 1) ods += a[i];

        else evs += a[i];

    }

    int odc = n / 2, evc = n / 2;

    if (n & 1) evc++;



    if (ods % odc != 0 || evs % evc != 0 || ods / odc != evs / evc) {

        cout << "NO" << endl;

        return;

    }

    cout << "YES" << endl;





 }

  







signed main() {

    ios::sync_with_stdio(false);

    cin.tie(nullptr);

    int tc; cin >> tc;

    while(tc--){

    solve();

    }

    return 0;

}



Answer: 2