Language: C++

#include <iostream>
#include<iomanip>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,m,n) for(int i=m;i<n;i++)
#define mrep(i,m,n) for(int i=m;i>n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

int n, a, b, c;
ll ans = INF;
int kado[8];
vector<vector<int>> use(4);

void solve(int i = 0) {
	if (i == n) {
		if (use[1].size() == 0 || use[2].size() == 0 || use[3].size() == 0) {
			return;
		}
		else {
			int kl[4] = { 0 };
			rep(j, 1, 4) {
				rep(k, 0, use[j].size()) {
					kl[j] += use[j][k];
				}
			}
			int sub = 10*(use[1].size()+use[2].size()+use[3].size()-3)+abs(a - kl[1]) + abs(b - kl[2]) + abs(c - kl[3]);
			ans = min(ans, sub);
		}
	}
	else {
		rep(j, 0, 4) {
			use[j].push_back(kado[i]);
			solve(i + 1);
			use[j].pop_back();
		}
	}

	return;
}

int main() {

	cin >> n >> a >> b >> c;
	rep(i, 0, n) {
		cin >> kado[i];
	}
	
	solve();

	cout << ans << endl;

	return 0;
}


Compiler output:
a.cc: In function 'void solve(int)':
a.cc:42:34: error: no matching function for call to 'min(ll&, int&)'
   42 |                         ans = min(ans, sub);
      |                               ~~~^~~~~~~~~~
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: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:42:34: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   42 |                         ans = min(ans, sub);
      |                               ~~~^~~~~~~~~~
/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,
                 from a.cc:3:
/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:42:34: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   42 |                         ans = min(ans, sub);
      |                               ~~~^~~~~~~~~~