Language: C++

#include <iostream>
#include <cmath>

using namespace std;

int n, k[3], l[8], min;

void calc(int b[8],int depth){
	if (depth == n) {
		int m[4] = {}, i, mp=0;
		for (i = 0;i < n;i++) {
			if (b[i] != 3 && m[b[i]] != 0) {
				mp += 10;
			}
			m[b[i]] += l[i];
		}
		for (i = 0;i < 3;i++) {
			if (m[i] == 0) {
				return;
			}
			else {
				mp += abs(m[i] - k[i]);
			}
		}
		if (mp < min) {
			min = mp;
		}
		return;
	}
	else {
		b[depth] = 0;
		calc(b, depth + 1);
		b[depth] = 1;
		calc(b, depth + 1);
		b[depth] = 2;
		calc(b, depth + 1);
		b[depth] = 3;
		calc(b, depth + 1);

		return;
	}
}

int main(void) {
	int i, j;
	cin >> n;
	cin >> k[0] >> k[1] >> k[2];

	for (i = 0;i < n;i++) {
		cin >> l[i];
	}

	min = 2000000000;
	int b[8] = {};
	calc(b, 0);

	cout << min << endl;

	return 0;
}


Compiler output:
a.cc: In function 'void calc(int*, int)':
a.cc:25:26: error: reference to 'min' is ambiguous
   25 |                 if (mp < min) {
      |                          ^~~
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:6:20: note:                 'int min'
    6 | int n, k[3], l[8], min;
      |                    ^~~
a.cc:26:25: error: reference to 'min' is ambiguous
   26 |                         min = mp;
      |                         ^~~
/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:6:20: note:                 'int min'
    6 | int n, k[3], l[8], min;
      |                    ^~~
a.cc: In function 'int main()':
a.cc:53:9: error: reference to 'min' is ambiguous
   53 |         min = 2000000000;
      |         ^~~
/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:6:20: note:                 'int min'
    6 | int n, k[3], l[8], min;
      |                    ^~~
a.cc:57:17: error: reference to 'min' is ambiguous
   57 |         cout << min << endl;
      |                 ^~~
/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:6:20: note:                 'int min'
    6 | int n, k[3], l[8], min;
      |                    ^~~