Language: C++

#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<queue>
#include<map>
#include<algorithm>
#include<set>
#include<complex>
#include<string>
#include<cstring>
using namespace std;
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
#define INF 100000000
#define debug(x) cout<<#x<<": "<<x<<endl

#define all(x) x.begin(),x.end()
typedef pair<int,int> P;
typedef pair<int,P> PP;
int n;
int A,B,C;
int L[10];
int cou;
int select[8];
int eachsum[8];
int subans;
int ans;
int asize;
int num[4];
vector<int> array;
void saiki(int now)
{
	if(now==n)
	{
		rep(i,4)
		{
			eachsum[i]=0;
			num[i]=0;
		}
		rep(i,n)
		{
			eachsum[select[i]]+=L[i];
			num[select[i]]++;
		}
		rep(i,3)
		{
			if(num[i]==0)break;
			if(i==2)
			{
				subans=10*(num[0]+num[1]+num[2]-3);
				subans+=abs(eachsum[0]-A);
				subans+=abs(eachsum[1]-B);
				subans+=abs(eachsum[2]-C);
				if(ans==-1||ans>subans)ans=subans;
			}
		}
		
	}
	else
	{
		rep(i,4)
		{
			select[now]=i;
			saiki(now+1);
		}
	}
}
int main()
{
	ans=-1;
	cin>>n;
	cin>>A>>B>>C;
	rep(i,n)
	{
		cin>>L[i];
	}
	saiki(0);
	cout<<ans<<endl;
	return 0;
}

Compiler output:
a.cc:25:13: error: 'int select [8]' redeclared as different kind of entity
   25 | int select[8];
      |             ^
In file included from /usr/include/x86_64-linux-gnu/sys/types.h:179,
                 from /usr/include/stdlib.h:514,
                 from /usr/include/c++/14/cstdlib:79,
                 from /usr/include/c++/14/ext/string_conversions.h:43,
                 from /usr/include/c++/14/bits/basic_string.h:4154,
                 from /usr/include/c++/14/string:54,
                 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/x86_64-linux-gnu/sys/select.h:102:12: note: previous declaration 'int select(int, fd_set*, fd_set*, fd_set*, timeval*)'
  102 | extern int select (int __nfds, fd_set *__restrict __readfds,
      |            ^~~~~~
a.cc: In function 'void saiki(int)':
a.cc:43:41: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   43 |                         eachsum[select[i]]+=L[i];
      |                                         ^
a.cc:43:32: error: invalid types 'int [8][int(int, fd_set*, fd_set*, fd_set*, timeval*)]' for array subscript
   43 |                         eachsum[select[i]]+=L[i];
      |                                ^
a.cc:44:37: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   44 |                         num[select[i]]++;
      |                                     ^
a.cc:44:28: error: invalid types 'int [4][int(int, fd_set*, fd_set*, fd_set*, timeval*)]' for array subscript
   44 |                         num[select[i]]++;
      |                            ^
a.cc:64:35: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   64 |                         select[now]=i;
      |                                   ^
a.cc:64:36: error: assignment of read-only location '*(select + ((sizetype)now))'
   64 |                         select[now]=i;
      |                         ~~~~~~~~~~~^~