Language: C++

//#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
#include <queue>
#include <algorithm>
#include <sstream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cctype>
#include <cstdlib>      // srand,rand


using namespace std;
#define ll long long

#define modd 1000000007
#define INF 1000000000000000000ll


typedef pair<long long, long long> pl;



typedef string::const_iterator State;
class ParseError {};








class UnionFind {
public:
	vector <ll> par;
	vector <ll> siz;

	// Constructor
	UnionFind(ll sz_) : par(sz_), siz(sz_, 1LL) {
		for (ll i = 0; i < sz_; ++i) par[i] = i;
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool merge(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;

		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}



	bool issame(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll size(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}


};

/*
struct SegmentTree {
private:
	ll n;
	vector<ll> node;

public:
	// 元配列 v をセグメント木で表現する
	SegmentTree(vector<ll> v) {
		// 最下段のノード数は元配列のサイズ以上になる最小の 2 冪 -> これを n とおく
		// セグメント木全体で必要なノード数は 2n-1 個である
		ll sz = v.size();
		n = 1; while (n < sz) n *= 2;
		node.resize(2 * n - 1, INF);

		// 最下段に値を入れたあとに、下の段から順番に値を入れる
		// 値を入れるには、自分の子の 2 値を参照すれば良い
		for (ll i = 0; i < sz; i++) node[i + n - 1] = v[i];
		for (ll i = n - 2; i >= 0; i--) node[i] = min(node[2 * i + 1], node[2 * i + 2]);
	}


	void update(ll x, ll val) {
		// 最下段のノードにアクセスする
		x += (n - 1);

		// 最下段のノードを更新したら、あとは親に上って更新していく
		node[x] = val;
		while (x > 0) {
			x = (x - 1) / 2;
			node[x] = min(node[2 * x + 1], node[2 * x + 2]);
		}
	}

};
*/


ll N, M, K, a, b, c, d, e, H, W, L, T;
ll x, y;
ll A[400][400] = {};
ll B[400][400] = {};
ll C[400][400] = {};
ll D[1000006] = {};
ll E[1000006] = {};
bool f, ff;
string S[200000];
string SS;
set <long long>sll;
pl bufpl;
vector <long long>vl[300005];
vector <long long>vll;
vector <pl>vpl;
vector <string> vs;
set<ll> llset;
multiset<ll> llmset;
queue<ll> ql;
multiset<pl> plmset;


struct ST
{
	ll first;
	ll second;
	ll kaisuu;


	/*bool operator<(const ST& another) const
	{
		return first < another.first;//比較
	};*/

};
queue<ST> qpl;



/*vector <ST> vst;
ST st[200005];
ST bufst;
bitset<5000> bits;*/

/*
long long modinv(long long aa, long long mm) {
	long long bb = mm, uu = 1, vv = 0;
	while (bb) {
		long long tt = aa / bb;
		aa -= tt * bb; swap(aa, bb);
		uu -= tt * vv; swap(uu, vv);
	}
	uu %= mm;
	if (uu < 0) uu += mm;
	return uu;
}


*/


ll zettai(ll aa) {

	if (aa < 0) {
		aa *= -1;
	}
	return aa;

}





/*
struct edge {
	ll from;
	ll to;
	ll cost;
};



ll V, E, d[300000];
edge es[300000];
bool fa[5000][5000];
bool ffa[5000];

bool has_negative_loop(ll s) {
	fill(d, d + V, 50000000000000000);
	d[s] = 0;
	for (ll i = 0; i <=2* V+1; i++) {
		for (ll j = 0; j < E; j++) {
			edge e = es[j];
			if (d[(int)e.to] > d[(int)e.from] + e.cost) {
				d[(int)e.to] = d[(int)e.from] + e.cost;
				if (i >= V+1 && fa[(int)e.to][V-1]==true &&fa[0][(int)e.from] == true) {
					return true;
				}
			}
		}
	}
	return false;
}
*/

/*struct cww { cww() { ios::sync_with_stdio(false); cin.tie(0); } }star;


bool is_prime[1000000 + 1];
vector<int> P;
void Eratosthenes(const int N)
{
	for (int i = 0; i <= N; i++)
	{
		is_prime[i] = true;//初期化
	}
	for (int i = 2; i <= N; i++)
	{
		if (is_prime[i])
		{
			for (int j = 2 * i; j <= N; j += i)
			{
				is_prime[j] = false;
			}
			P.emplace_back(i);
		}
	}
}*/

ll t;

ll RepeatSquaring(ll N, ll P, ll MO) {
	if (P == 0) return 1;
	if (P % 2 == 0) {
		ll t = RepeatSquaring(N, P / 2, MO);
		return t * t % MO;
	}
	return N * RepeatSquaring(N, P - 1, MO);
}

ll gyakugen(ll numb, ll MO) {
	return RepeatSquaring(numb, MO - 2, MO);
}

/*
ll Com(ll NN, ll KK) {
	e = D[NN];
	e *= C[KK];
	e %= modd;
	e *= C[NN - KK];
	e %= modd;
	return e;

}

*/

bool ita[200000] = {};
ll saitan[200000] = {};
pl bpl;

int main() {

	cin >> N;

a=0;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
a+=A[i];
	}

a/=N;
d=a+1;
b=0;
e=0;
for(int i=0;I<N;I++){
b+=zettai (A[i]-a);
e+=zettai(A[i]-d);
}
	cout <<min(b, e) << endl;

	//cout << fixed << setprecision(10) << ansa << endl;
	return 0;



}


Compiler output:
a.cc: In function 'int main()':
a.cc:297:21: error: no match for 'operator>>' (operand types are 'std::istream' {aka 'std::basic_istream<char>'} and 'long long int [400]')
  297 |                 cin >> A[i];
      |                 ~~~ ^~ ~~~~
      |                 |         |
      |                 |         long long int [400]
      |                 std::istream {aka std::basic_istream<char>}
In file included from /usr/include/c++/14/iostream:42,
                 from a.cc:5:
/usr/include/c++/14/istream:170:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(bool&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  170 |       operator>>(bool& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:170:7: note:   conversion of argument 1 would be ill-formed:
a.cc:297:27: error: cannot bind non-const lvalue reference of type 'bool&' to a value of type 'long long int*'
  297 |                 cin >> A[i];
      |                        ~~~^
/usr/include/c++/14/istream:174:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(short int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  174 |       operator>>(short& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:174:7: note:   conversion of argument 1 would be ill-formed:
a.cc:297:27: error: invalid conversion from 'long long int*' to 'short int' [-fpermissive]
  297 |                 cin >> A[i];
      |                        ~~~^
      |                           |
      |                           long long int*
a.cc:297:27: error: cannot bind rvalue '(short int)((long long int*)(& A[i]))' to 'short int&'
/usr/include/c++/14/istream:177:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(short unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  177 |       operator>>(unsigned short& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:177:7: note:   conversion of argument 1 would be ill-formed:
a.cc:297:27: error: invalid conversion from 'long long int*' to 'short unsigned int' [-fpermissive]
  297 |                 cin >> A[i];
      |                        ~~~^
      |                           |
      |                           long long int*
a.cc:297:27: error: cannot bind rvalue '(short unsigned int)((long long int*)(& A[i]))' to 'short unsigned int&'
/usr/include/c++/14/istream:181:7: note: candidate: 'std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(int&) [with _CharT = char; _Traits = std::char_traits<char>]' (near match)
  181 |       operator>>(int& __n);
      |       ^~~~~~~~
/usr/include/c++/14/istream:181:7: note:   conversion of argument 1 would be ill-formed:
a.cc:297:27: error: invalid conversion from 'long long int*' to 'int' [-fpermissive]
  297 |                 cin >> A[i];
      |                        ~~~^
      |                           |
      |                           long long int*
a.cc:297:27: error: cannot bind rvalue '(int)((long long int*)(& A[i]))' to 'int&'
/usr/include/c++/14/istream:184:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  184 |       operator>>(unsigned int& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:184:7: note:   conversion of argument 1 would be ill-formed:
a.cc:297:27: error: invalid conversion from 'long long int*' to 'unsigned int' [-fpermissive]
  297 |                 cin >> A[i];
      |                        ~~~^
      |                           |
      |                           long long int*
a.cc:297:27: error: cannot bind rvalue '(unsigned int)((long long int*)(& A[i]))' to 'unsigned int&'
/usr/include/c++/14/istream:188:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  188 |       operator>>(long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:188:7: note:   conversion of argument 1 would be ill-formed:
a.cc:297:27: error: invalid conversion from 'long long int*' to 'long int' [-fpermissive]
  297 |                 cin >> A[i];
      |                        ~~~^
      |                           |
      |                           long long int*
a.cc:297:27: error: cannot bind rvalue '(long int)((long long int*)(& A[i]))' to 'long int&'
/usr/include/c++/14/istream:192:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  192 |       operator>>(unsigned long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:192:7: note:   conversion of argument 1 would be ill-formed:
a.cc:297:27: error: invalid conversion from 'long long int*' to 'long unsigned int' [-fpermissive]
  297 |                 cin >> A[i];
      |                        ~~~^
      |                           |
      |                           long long int*
a.cc:297:27: error: cannot bind rvalue '(long unsigned int)((long long int*)(& A[i]))' to 'long unsigned int&'
/usr/include/c++/14/istream:199:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  199 |       operator>>(long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:199:7: note:   conversion of argument 1 would be ill-formed:
a.cc:297:27: error: invalid conversion from 'long long int*' to 'long long int' [-fpermissive]
  297 |                 cin >> A[i];
      |                        ~~~^
      |                           |
      |                           long long int*
a.cc:297:27: error: cannot bind rvalue '(long long int)((long long int*)(& A[i]))' to 'long long int&'
/usr/include/c++/14/istream:203:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  203 |       operator>>(unsigned long long& __n)
      |       ^~~~~~~~
/usr/include/c++/14/istream:203:7: note:   conversion of argument 1 would be ill-formed:
a.cc:297:27: error: invalid conversion from 'long long int*' to 'long long unsigned int' [-fpermissive]
  297 |                 cin >> A[i];
      |                        ~~~^
      |                           |
      |                           long long int*
a.cc:297:27: error: cannot bind rvalue '(long long unsigned int)((long long int*)(& A[i]))' to 'long long unsigned int&'
/usr/include/c++/14/istream:328:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]' (near match)
  328 |       operator>>(void*& __p)
      |       ^~~~~~~~
/usr/include/c++/14/istream:328:7: note:   conversion of argument 1 would be ill-formed:
a.cc:297:27: error: cannot bind non-const lvalue reference of type 'void*&' to an rvalue of type 'void*'
  297 |                 cin >> A[i];
      |                        ~~~^
/usr/include/c++/14/istream:219:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(float&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  219 |       operator>>(float& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:219:25: note:   no known conversion for argument 1 from 'long long int [400]' to 'float&'
  219 |       operator>>(float& __f)
      |                  ~~~~~~~^~~
/usr/include/c++/14/istream:223:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  223 |       operator>>(double& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:223:26: note:   no known conversion for argument 1 from 'long long int [400]' to 'double&'
  223 |       operator>>(double& __f)
      |                  ~~~~~~~~^~~
/usr/include/c++/14/istream:227:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long double&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  227 |       operator>>(long double& __f)
      |       ^~~~~~~~
/usr/include/c++/14/istream:227:31: note:   no known conversion for argument 1 from 'long long int [400]' to 'long double&'
  227 |       operator>>(long double& __f)
      |                  ~~~~~~~~~~~~~^~~
/usr/include/c++/14/istream:122:7: note: candidate: 'std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(__istream_type& (*)(__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]'
  122 |       operator>>(__istream_type& (*__pf)(__istream_type&))
      |       ^~~~~~~~
/usr/include/c++/14/istream:122:36: note:   no known conversion for argument 1 from 'long long int [400]' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&)' {aka 'std::basic_istream<char>& (*)(std::basic_istream<char>&)'}
  122 |       operator>>(__istream_type& (*__pf)(__istream_type&))
      |                  ~~~~~~~~~~~~~~~~~~^~~~~~~~~~