Language: C++

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define MOD 1000000007


#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define all(i) (i).begin(),(i).end()
#define rall(i) (i).begin(),(i).end(),greater<int>()


#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T> void print(T x) { std::cout << x << '\n'; }
 
//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
 
int N;
int l[N];

int dfs(int i,int a,int b,int c){

    if(i==N){
        if(a==0||b==0||c==0){
            return 1e9;
        }else{
            return abs(A-a)+abs(B-b)+abs(C-c);
        }
    }

    int res1 = dfs(i+1,a,b,c);
    int res2 = dfs(i+1,a+l[i],b,c)+(a>0?10:0);
    int res3 = dfs(i+1,a,b+l[i],c)+(b>0?10:0);
    int res3 = dfs(i+1,a,b,c+l[i])+(c>0?10:0);

    return min({res1,res2,res3,res4});


}

signed main(){
 
    int A,B,C;
    cin >> N >> A >> B >> C;

    int abc[3];
    abc[0]=A;
    abc[1]=B;
    abc[2]=C;

    //int l[N];
    rep(i,N){
        cin >> l[i];
    }

   cout << dfs(0,0,0,0) <<endl;


    return 0;
 
}


Compiler output:
a.cc:31:7: error: size of array 'l' is not an integral constant-expression
   31 | int l[N];
      |       ^
a.cc: In function 'long long int dfs(long long int, long long int, long long int, long long int)':
a.cc:39:24: error: 'A' was not declared in this scope
   39 |             return abs(A-a)+abs(B-b)+abs(C-c);
      |                        ^
a.cc:39:33: error: 'B' was not declared in this scope
   39 |             return abs(A-a)+abs(B-b)+abs(C-c);
      |                                 ^
a.cc:39:42: error: 'C' was not declared in this scope
   39 |             return abs(A-a)+abs(B-b)+abs(C-c);
      |                                          ^
a.cc:46:9: error: redeclaration of 'long long int res3'
   46 |     int res3 = dfs(i+1,a,b,c+l[i])+(c>0?10:0);
      |         ^~~~
a.cc:45:9: note: 'long long int res3' previously declared here
   45 |     int res3 = dfs(i+1,a,b+l[i],c)+(b>0?10:0);
      |         ^~~~
a.cc:48:32: error: 'res4' was not declared in this scope; did you mean 'res3'?
   48 |     return min({res1,res2,res3,res4});
      |                                ^~~~
      |                                res3
a.cc:48:15: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   48 |     return min({res1,res2,res3,res4});
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~
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:   candidate expects 2 arguments, 1 provided
/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, 1 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:   template argument deduction/substitution failed:
/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:   candidate expects 2 arguments, 1 provided