Language: C++

#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const long long mod = 1000000007;
const long long inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<int,P> PP;
typedef pair<int,PP> PPP;
struct edge { int to;  int cost; };

int l[8];
vector<int>V[4];
int ans=inf;int n, a, b, c; 
int dfs(int now) {
	if (n == now) {
		if (V[0].size() && V[1].size() && V[2].size()) {
			int xa = 0, xb = 0, xc = 0;
			rep(i, V[0].size())xa += V[0][i];
			rep(i, V[1].size())xb += V[1][i];
			rep(i, V[2].size())xc += V[2][i];
			ans = min(ans, abs(xa - a) + abs(xb - b) + abs(xc - c) + 10 * (V[0].size() + V[1].size() + V[2].size()-3));
			return 0;
		}
		else return 0;
	}
	rep(i, 4) {
		V[i].push_back(l[now]);
		dfs(now + 1);
		V[i].pop_back();
	}
	return 0;
}

signed main() {
	cin >> n >> a >> b >> c;
	rep(i, n)cin >> l[i];
	dfs(0);
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'long long int dfs(long long int)':
a.cc:22:34: error: no matching function for call to 'min(long long int&, long long unsigned int)'
   22 |                         ans = min(ans, abs(xa - a) + abs(xb - b) + abs(xc - c) + 10 * (V[0].size() + V[1].size() + V[2].size()-3));
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:22:34: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long long unsigned int')
   22 |                         ans = min(ans, abs(xa - a) + abs(xb - b) + abs(xc - c) + 10 * (V[0].size() + V[1].size() + V[2].size()-3));
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: '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:281:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:22:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   22 |                         ans = min(ans, abs(xa - a) + abs(xb - b) + abs(xc - c) + 10 * (V[0].size() + V[1].size() + V[2].size()-3));
      |                               ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~