Problem: 2050C - Uninteresting Number
Language: c++23 

Code 1:
// Problem: B. Transfusion

// Contest: Codeforces - Codeforces Round 991 (Div. 3)

// URL: https://codeforces.com/contest/2050/problem/B

// Memory Limit: 256 MB

// Time Limit: 2000 ms

// 

// Powered by CP Editor (https://cpeditor.org)



//#pragma GCC optimize("O3")

//#pragma GCC optimize("Ofast")



#include <bits/stdc++.h>

#define Begin ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)

#define pii pair<int, int>

#define pdd pair<double, double>

#define lowbit(x) (x & -x)

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



#define Rep(i, x) for(auto &i : x)

#define L(i, x, y) for(int i = x; i <= y; ++ i)

#define R(i, x, y) for(int i = x; i >= y; -- i)

#define rd(x) scanf("%lld", &(x))

#define p_b push_back

#define ft first

#define sd second

using namespace std;

template <class T> using vc = vector<T>;

template <class T> using _pq = priority_queue<T, vector<T>, greater<T>>;

using i64 = long long;

using u64 = unsigned long long;

using u32 = unsigned;

const int N = 2e5 + 10;





































































void solve() {

	int n; cin >> n;

	vc<i64> a(n);

	L(i, 0, n - 1) cin >> a[i];

	i64 sum = reduce(a.begin(), a.end());

	if(sum % n) {

		cout << "NO\n";

		return;

	}

	i64 sd = sum / n;

	//cout << sd << "\n";

	L(i, 0, n - 1) {

		//cout << i << " " << a[i] << "\n";

		if(i >= n - 2 && a[i] != sd) {

			cout << "NO\n";

			return;

		}

		if(a[i] == sd) continue;

		else {

			

				if(a[i] < sd) {

					i64 dif = sd - a[i];

					a[i] = sd;

					if(a[i + 2] >= dif) a[i + 2] -= dif;

					else {

						cout << "NO\n";

						return;

					}

				}

				else {

					i64 dif = a[i] - sd;

					a[i] = sd;

					a[i + 2] += dif;

				}

				

			

			

			

		}

	}

	L(i, 0, n - 1) {

		if(a[i] != sd) {

			cout << "NO\n";

			return;

		}

	}

	cout << "YES\n";

}





int main() {

	Begin;

	int _; _ = 1;

	cin >> _;

	while(_--) solve();

	return 0;

}

Code 2:
// Problem: C. Uninteresting Number

// Contest: Codeforces - Codeforces Round 991 (Div. 3)

// URL: https://codeforces.com/contest/2050/problem/C

// Memory Limit: 256 MB

// Time Limit: 2000 ms

// 

// Powered by CP Editor (https://cpeditor.org)



//#pragma GCC optimize("O3")

//#pragma GCC optimize("Ofast")



#include <bits/stdc++.h>

#define Begin ios::sync_with_stdio(0),cin.tie(0),cout.tie(0)

#define pii pair<int, int>

#define pdd pair<double, double>

#define lowbit(x) (x & -x)

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



#define Rep(i, x) for(auto &i : x)

#define L(i, x, y) for(int i = x; i <= y; ++ i)

#define R(i, x, y) for(int i = x; i >= y; -- i)

#define rd(x) scanf("%lld", &(x))

#define p_b push_back

#define ft first

#define sd second

using namespace std;

template <class T> using vc = vector<T>;

template <class T> using _pq = priority_queue<T, vector<T>, greater<T>>;

using i64 = long long;

using u64 = unsigned long long;

using u32 = unsigned;

const int N = 2e5 + 10;





































































void solve() {

	string s; cin >> s;

	int sum = 0; map<int, int> mp;

	int n = s.size();

	L(i, 0, n - 1) {

		if(s[i] - '0' == 2) mp[2] ++;

		if(s[i] - '0' == 3) mp[3] ++;

		sum += s[i] - '0';

	}

	if(sum % 9 == 0) {

		cout << "YES\n";

		return;

	}

	int dif = sum % 9;

	L(i, 0, mp[2]) {

		L(j, 0, mp[3]) {

			if((i * 2 + j * 6 + dif) % 9 == 0) {

				cout << "YES\n";

				return;

			}

		}

	}

	cout << "NO\n";

}





int main() {

	Begin;

	int _; _ = 1;

	cin >> _;

	while(_--) solve();

	return 0;

}

Answer: 2