Language: C++

#include<iostream>
#include <cmath>
using namespace std;
int N;
int a[110],sum,ave,min;

int main()
{
	cin >> N;
	sum = 0;
	for (int i = 0; i < N; i++) {
		cin >> a[i];
		sum += a[i];
	}
	//ave = sum / N;
	min = 1000 * N;
	for (int i = 0; i < N; i++) {
		if (min > abs(sum - a[i] * N)) {
			min = abs(sum - a[i] * N);
		}
	}
	
	for (int i = 0; i < N; i++) {
		if (min == abs(sum - a[i] * N)) {
			cout << i << endl;
			//system("pause");
			return 0;
		}
	}

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:16:9: error: reference to 'min' is ambiguous
   16 |         min = 1000 * N;
      |         ^~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:5:20: note:                 'int min'
    5 | int a[110],sum,ave,min;
      |                    ^~~
a.cc:18:21: error: reference to 'min' is ambiguous
   18 |                 if (min > abs(sum - a[i] * N)) {
      |                     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:5:20: note:                 'int min'
    5 | int a[110],sum,ave,min;
      |                    ^~~
a.cc:19:25: error: reference to 'min' is ambiguous
   19 |                         min = abs(sum - a[i] * N);
      |                         ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:5:20: note:                 'int min'
    5 | int a[110],sum,ave,min;
      |                    ^~~
a.cc:24:21: error: reference to 'min' is ambiguous
   24 |                 if (min == abs(sum - a[i] * N)) {
      |                     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidates are: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:                 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
a.cc:5:20: note:                 'int min'
    5 | int a[110],sum,ave,min;
      |                    ^~~