criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
int gcd(int a,int b){return b?gcd(b,a%b):a;}
 
    ll N,A,B,C;
    vector<int> L;
 
int rec(int i, int a, int b, int c){
  if(i == N) {
    if(!a || !b || !c) return INT_MAX;
    return abs(a - A) + abs(b - B) + abs(c - C);
  }
  
  int res = rec(i+1, a, b, c);
  
  chmin(res, rec(i+1, a + L[i], b, c) + (a ? 10 : 0));
  chmin(res, rec(i+1, a, b + L[i], c) + (b ? 10 : 0));
  chmin(res, rec(i+1, a, b, c + L[i]) + (c ? 10 : 0));
  
  return res;
}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
int gcd(int a,int b){return b?gcd(b,a%b):a;}
 
    ll N,A,B,C;
    vector<int> L;
 
int rec(int i, int a, int b, int c){
  if(i == N) {
    if(!a || !b || !c) return INF;
    return abs(a - A) + abs(b - B) + abs(c - C);
  }
  
  int res = rec(i+1, a, b, c);
  
  chmin(res, rec(i+1, a + L[i], b, c) + (a ? 10 : 0));
  chmin(res, rec(i+1, a, b + L[i], c) + (b ? 10 : 0));
  chmin(res, rec(i+1, a, b, c + L[i]) + (c ? 10 : 0));
  
  return res;
}
 
int main(){
    cin >> N >> A >> B >> C;
  	L.resize(N);
  	for(int i = 0; i < N; ++i) cin >> L[i];
    cout << rec(0, 0, 0, 0) << endl;
}

Compiler output:
a.cc: In function 'int rec(int, int, int, int)':
a.cc:25:31: error: 'INF' was not declared in this scope
   25 |     if(!a || !b || !c) return INF;
      |                               ^~~
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
#define sz(x) ((int)(x).size())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
#define MEMSET(v, h) memset((v), h, sizeof(v))
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define pb push_back
#define mp make_pair
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
int gcd(int a,int b){return b?gcd(b,a%b):a;}

    ll N,A,B,C;
    vector<int> L;

int rec(int i, int a, int b, int c){
  if(i == N) {
    if(!a || !b || !c) return INF;
    return abs(a - A) + abs(b - B) + abs(c - C)
  }
  
  int res = rec(i+1, a, b, c);
  
  chmin(res, rec(i+1, a + L[i], b, c) + (a ? 10 : 0));
  chmin(res, rec(i+1, a, b + L[i], c) + (b ? 10 : 0));
  chmin(res, rec(i+1, a, b, c + L[i]) + (c ? 10 : 0));
  
  return res;
}

int main(){
    cin >> N >> A >> B >> C;
  	L.resize(N);
  	for(int i = 0; i < N; ++i) cin >> L[i];
    cout << rec(0, 0, 0, 0) << endl;
}

Compiler output:
a.cc: In function 'int rec(int, int, int, int)':
a.cc:25:31: error: 'INF' was not declared in this scope
   25 |     if(!a || !b || !c) return INF;
      |                               ^~~
a.cc:26:48: error: expected ';' before '}' token
   26 |     return abs(a - A) + abs(b - B) + abs(c - C)
      |                                                ^
      |                                                ;
   27 |   }
      |   ~
Language: C++

# encoding:utf-8
import copy
import numpy as np
import random

n,a,b,c = map(int,input().split())
l = []
for i in range(n):
    l.append(int(input()))

def to_4digit(i):
    digits = [0]*n
    digit = 0
    while(i>1):
        digits[digit] = i%4
        digit += 1
        i//=4
    return digits

ans = 10**10
for i in range(4**n):
    choice = to_4digit(i)
    a_tem = 0
    b_tem = 0
    c_tem = 0
    mp = 0
    for j in range(len(choice)):
        if choice[j]==0:
            if a_tem != 0:
                mp += 10
            a_tem += l[j]
        elif choice[j]==1:
            if b_tem != 0:
                mp += 10
            b_tem+= l[j]
        elif choice[j]==2:
            if c_tem != 0:
                mp += 10
            c_tem+= l[j]
        else:pass
    if a_tem==0 or b_tem==0 or c_tem==0:
        pass
    else:
        mp += abs(a-a_tem)+abs(b-b_tem)+abs(c-c_tem)
        ans = min(ans,mp)
    # print(ans)
print(ans)


# print(to_4digit(10))


Compiler output:
a.cc:1:3: error: invalid preprocessing directive #encoding
    1 | # encoding:utf-8
      |   ^~~~~~~~
a.cc:46:7: error: invalid preprocessing directive #print
   46 |     # print(ans)
      |       ^~~~~
a.cc:50:3: error: invalid preprocessing directive #print
   50 | # print(to_4digit(10))
      |   ^~~~~
a.cc:2:1: error: 'import' does not name a type
    2 | import copy
      | ^~~~~~
a.cc:2:1: note: C++20 'import' only available with '-fmodules-ts'
Language: C++

#include<iostream>
using namespace std;
int jou(int a) {
  int k = 1;
  for (int i = 0; i < a; i ++) k *= 4;
  return k;
}
int ze(int a) {
  if (a < 0) return -a;
  else return a;
}
int main () {
  int N;
  cin >> N;
  int A, B, C;
  cin >> A >> B >> C;
  int leng[8];
  int ans = 1000000;
  for (int i = 0; i < N; i ++) cin >> leng[i];
  int kai = jou(N);
  for (int i = 0; i < kai i ++) {
    int k = i;
    int al = bl = cl = 0;
    int mp = 0;
    for (int o = 0; o < N; o ++) {
      int j = k % 4;
      switch(j) {
        case 0: break;
        case 1: al ++; mp += 10; break;
        case 2: bl ++; mp += 10; break;
        case 3: cl ++; mp += 10; break;
      }
      k /= 4;
    }
    mp += ze(A - al);
    mp += ze(B - bl);
    mp += ze(C - cl);
    if (mp < ans) ans = mp;
  }
  cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:21:26: error: expected ';' before 'i'
   21 |   for (int i = 0; i < kai i ++) {
      |                          ^~
      |                          ;
a.cc:23:14: error: 'bl' was not declared in this scope; did you mean 'al'?
   23 |     int al = bl = cl = 0;
      |              ^~
      |              al
a.cc:23:19: error: 'cl' was not declared in this scope; did you mean 'al'?
   23 |     int al = bl = cl = 0;
      |                   ^~
      |                   al
Language: C++

#include <iostream>
#include <climits>
#include <algorithm>
using namespace std;

const int INF = 1<<29;

//dpテーブル
int dp[1000][1010];

int calc_mp(int x,int N, int* Len){
  //dpテーブルの初期化
  for (int i = 0; i < 1000; i++) for (int j = 0; j < 1010; j++) dp[i][j] = INF;
  for (int i = 0; i < 1000; i++) for (int k = 0; k < N; k++) dp[i][Len[k]] = 0;

  for (int i = 0; i < 1000; i++){
    for (int l = 0; l < 1010; l++){
      if (l != x){
        if (l >= Len[7]) dp[i+1][l] = min({dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len[7]]+10, dp[i][l-Len[6]]+10, dp[i][l-Len[5]]+10, dp[i][l-Len[4]]+10, dp[i][l-Len[3]]+10, dp[i][l-Len[2]]+10, dp[i][l-Len[1]]+10, dp[i][l-Len[0]]+10});
        else if (l >= Len[6] && l < Len[7]) dp[i+1][l] = min({dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len[6]]+10, dp[i][l-Len[5]]+10, dp[i][l-Len[4]]+10, dp[i][l-Len[3]]+10, dp[i][l-Len[2]]+10, dp[i][l-Len[1]]+10, dp[i][l-Len[0]]+10});
        else if (l >= Len[5] && l < Len[6]) dp[i+1][l] = min({dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len[5]]+10, dp[i][l-Len[4]]+10, dp[i][l-Len[3]]+10, dp[i][l-Len[2]]+10, dp[i][l-Len[1]]+10, dp[i][l-Len[0]]+10});
        else if (l >= Len[4] && l < Len[5]) dp[i+1][l] = min({dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len[4]]+10, dp[i][l-Len[3]]+10, dp[i][l-Len[2]]+10, dp[i][l-Len[1]]+10, dp[i][l-Len[0]]+10});
        else if (l >= Len[3] && l < Len[4]) dp[i+1][l] = min({dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len[3]]+10, dp[i][l-Len[2]]+10, dp[i][l-Len[1]]+10, dp[i][l-Len[0]]+10});
        else if (l >= Len[2] && l < Len[3]) dp[i+1][l] = min({dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len[2]]+10, dp[i][l-Len[1]]+10, dp[i][l-Len[0]]+10});
        else if (l >= Len[1] && l < Len[2]) dp[i+1][l] = min({dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len[1]]+10, dp[i][l-Len[0]]+10});
        else if (l >= Len[0] && l < Len[1]) dp[i+1][l] = min({dp[i][l-1]+1, dp[i][l+1]+1, dp[i][l-Len[0]]+10});
        else dp[i+1][l] = min({dp[i][l-1]+1, dp[i][l+1]+1});
      }
      else dp[i+1][l] = dp[i][l];
    }
  }
  return dp[999][x];
}

int main(){
  //入力
  int N,A,B,C;
  cin >> N >> A >> B >> C;
  int Len[8];
  for (int j = 0; j < N; j++) cin >> Len[j];

  sort(Len, Len + 8);

  cout >> calc_mp(A,N,Len.data()) + calc_mp(B,N,Len.data()) + calc_mp(C,N,Len.data()) >> endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:27: error: request for member 'data' in 'Len', which is of non-class type 'int [8]'
   44 |   cout >> calc_mp(A,N,Len.data()) + calc_mp(B,N,Len.data()) + calc_mp(C,N,Len.data()) >> endl;
      |                           ^~~~
a.cc:44:53: error: request for member 'data' in 'Len', which is of non-class type 'int [8]'
   44 |   cout >> calc_mp(A,N,Len.data()) + calc_mp(B,N,Len.data()) + calc_mp(C,N,Len.data()) >> endl;
      |                                                     ^~~~
a.cc:44:79: error: request for member 'data' in 'Len', which is of non-class type 'int [8]'
   44 |   cout >> calc_mp(A,N,Len.data()) + calc_mp(B,N,Len.data()) + calc_mp(C,N,Len.data()) >> endl;
      |                                                                               ^~~~
Language: C++

#include <iostream>
#include <cmath>
using namespace std;

int N, L[8], A, B, C; // 1000 >= a > b > c >=1
int INF = 1<<15; // 2^29 ~= 5*10^8

int dfs(int n, int a, int b, int c){
  if(n==N){
    return
    if(min(a, b, c)>0){ // 最初の1本に対してはMPは使わない。
      abs(A-a) + abs(B-b) + abs(C-c) - 30;
    }else{
      INF;
    }
  }
  int ret0 = dfs(n+1,      a, b, c);
  int reta = dfs(n+1, a+L[n], b, c) +10;
  int retb = dfs(n+1, a, b+L[n], c) +10;
  int retc = dfs(n+1, a, b, c+L[n]) +10;
  return min(ret0, reta, retb, retc);

}

int main(void){
  int i;
  cin >> N;
  cin >> A >> B >> C;
  for(i=0; i<n; i++)  cin >> L[i];

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

  return 0;
}


Compiler output:
a.cc: In function 'int dfs(int, int, int, int)':
a.cc:11:5: error: expected primary-expression before 'if'
   11 |     if(min(a, b, c)>0){ // 最初の1本に対してはMPは使わない。
      |     ^~
a.cc:10:11: error: expected ';' before 'if'
   10 |     return
      |           ^
      |           ;
   11 |     if(min(a, b, c)>0){ // 最初の1本に対してはMPは使わない。
      |     ~~     
a.cc:21:13: error: no matching function for call to 'min(int&, int&, int&, int&)'
   21 |   return min(ret0, reta, retb, retc);
      |          ~~~^~~~~~~~~~~~~~~~~~~~~~~~
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:   candidate expects 2 arguments, 4 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, 4 provided
a.cc: In function 'int main()':
a.cc:29:14: error: 'n' was not declared in this scope
   29 |   for(i=0; i<n; i++)  cin >> L[i];
      |              ^
/usr/include/c++/14/bits/stl_algobase.h: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = int; _Compare = int]':
a.cc:11:11:   required from here
   11 |     if(min(a, b, c)>0){ // 最初の1本に対してはMPは使わない。
      |        ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<int, int> P;
typedef pair<int, P> E;
#define MOD (1000000007ll)
#define l_ength size

int n,a,b,c,l[10],ans=INF;

void dfs(int d, int x, int y, int z, int p){
	if(d<n){
		dfs(d+1,x,y,z,p,q,r);
		dfs(d+1,x+l[d],y,z,p+1);
		dfs(d+1,x,y+l[d],z,p+1);
		dfs(d+1,x,y,z+l[d],p+1);
	}else if(x&&y&&z){
		ans = min(ans,abs(x-a)+abs(y-b)+abs(z-c)+10*(p-3));
	}
}

int main(void){
	int i;
	cin >> n;
	cin >> a >> b >> c;
	for(i=0; i<n; ++i){
		cin >> l[i];
	}
	dfs(0,0,0,0,0);
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc: In function 'void dfs(int, int, int, int, int)':
a.cc:15:33: error: 'q' was not declared in this scope
   15 |                 dfs(d+1,x,y,z,p,q,r);
      |                                 ^
a.cc:15:35: error: 'r' was not declared in this scope
   15 |                 dfs(d+1,x,y,z,p,q,r);
      |                                   ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;

ll N, num, A, B, C, res = LLONG_MAX;
vector<ll> vec;

#define REP(i, N) for(ll i = 0; i < N; ++i)

ll recursion(ll i, ll a, ll b, ll c, ll cost) {
    // 終端処理
    if (i == N) {
        // 一つでも 0 があったらMAXを出力．
        if (!a || !b || !c) return LLONG_MAX;
        else return abs(a - A) + abs(b - B) + abs(c - C) + cost;
    }
    
    // 現在の竹 vec[i] を使用しない場合
    // 竹を合成しないままインデックスを進める．当然合成コストは 0．
    ll ret0 = recursion(i+1, a, b, c, cost);
    
    // vec[i] を A, B, C どれに使うか割り当てる
    // 0 のときは合成コストは 0 を表す
    // それぞれの分岐で min が帰ってくる
    ll ret1 = recursion(i + 1, a + vec[i], b, c, cost + ((a == 0) ? 0 : 10));
    ll ret2 = recursion(i + 1, a, b + vec[i], c, cost + ((b == 0) ? 0 : 10));
    ll ret3 = recursion(i + 1, a, b, c + vec[i], cost + ((c == 0) ? 0 : 10));
    
    return min({ret0, ret1, ret2, ret3});
}

int main() {
    // input
    cin >> N >> A >> B >> C;
    // REP(i, N) {
    //     cin >> num;
    //     vec.push_back(num);
    // }
    // 以下の受け取り方の方がスマート
    vec.resize(N);
    for(ll  i = 0; i < N; i++) cin >> vec[i];
    
    // calculation
    cout << recursion(0, 0, 0, 0, 0) << "\n";
    
    return 0;
}


Compiler output:
a.cc:7:27: error: 'LLONG_MAX' was not declared in this scope
    7 | ll N, num, A, B, C, res = LLONG_MAX;
      |                           ^~~~~~~~~
a.cc:4:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <algorithm>
  +++ |+#include <climits>
    4 | using namespace std;
a.cc: In function 'll recursion(ll, ll, ll, ll, ll)':
a.cc:16:36: error: 'LLONG_MAX' was not declared in this scope
   16 |         if (!a || !b || !c) return LLONG_MAX;
      |                                    ^~~~~~~~~
a.cc:16:36: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int N;
int A,B,C;

  long long brute_force_search(int cnt, int a, int b, int c, int len[]) {
    long long INF = std::pow(10, 9.0);
    if (cnt==N) {
      //return std::abs(a-A)+std::abs(b-B)+std::abs(c-C)-30;
      
      if ((a>0)&&(b>0)&&(c>0)){
        return std::abs(a-A)+std::abs(b-B)+std::abs(c-C)-30;
      } else {
        return INF;
      }
    }
    vector<long long> ansc(4);
    ansc[0] = brute_force_search(cnt+1, a, b, c, len);
    ansc[1] = brute_force_search(cnt+1, a+L[cnt], b, c, len)+10;
    ansc[2] = brute_force_search(cnt+1, a, b+L[cnt], c, len)+10;
    ansc[3] = brute_force_search(cnt+1, a, b, c+L[cnt], len)+10;
    int min = *std::min_element(ansc.begin(), ansc.end());
    return min;
  }

int main() {
  cin >> N >> A >> B >> C;
  
  int L[N];
  for (int i; i<N;i++){
    cin >> L[i];
  } 
  
  long long ans;
  ans = brute_force_search(0, 0, 0, 0, L);
  cout << ans << endl;
  return 0;
}

Compiler output:
a.cc: In function 'long long int brute_force_search(int, int, int, int, int*)':
a.cc:24:43: error: 'L' was not declared in this scope
   24 |     ansc[1] = brute_force_search(cnt+1, a+L[cnt], b, c, len)+10;
      |                                           ^
Language: C++

#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,a,b,c,ans=1e9,num=0,suma=0,sumb=0,sumc=0;
    cin>>n>>a>>b>>c;
    int l[n];
    for(int i=0;i<n;i++){
        cin>>l[i];
    }
    int r=(1<<(n*2))
    for(int i=0;i<r;i++){
        int v;
        int w=i;
        for(int j=0;j<n;j++){
            v=w%4;
            w/=4;
            if(v==0){
                if(suma){
                    num+=10;
                }
                suma+=l[j];
            }
            else if(v==1){
                if(sumb){
                    num+=10;
                }
                sumb+=l[j];         
            }
            else if(v==2){
                if(sumc){
                    num+=10;
                }
                sumc+=l[j];
            }
        }
        num+=(abs(a-suma)+abs(b-sumb)+abs(c-sumc));
        if(suma&&sumb&&sumc){
            ans=min(ans,num);
        }
        num=suma=sumb=sumc=0;
    }
    cout <<ans<<endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:17:5: error: expected ',' or ';' before 'for'
   17 |     for(int i=0;i<r;i++){
      |     ^~~
a.cc:17:17: error: 'i' was not declared in this scope
   17 |     for(int i=0;i<r;i++){
      |                 ^
Language: C++

#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,a,b,c,ans=1e9,num=suma=sumb=sumc=0;;
    cin>>n>>a>>b>>c;
    int l[n];
    for(int i=0;i<n;i++){
        cin>>l[i];
    }
    for(int i=0;i<(1<<(n*2));++i){
        int v;
        int w=i;
        for(int j=0;j<n;j++){
            v=w%4;
            w/=4;
            if(v==0){
                if(suma){
                    num+=10;
                }
                suma+=l[j];
            }
            else if(v==1){
                if(sumb){
                    num+=10;
                }
                sumb+=l[j];         
            }
            else if(v==2){
                if(sumc){
                    num+=10;
                }
                sumc+=l[j];
            }
        }
        num+=(abs(a-suma)+abs(b-sumb)+abs(c-sumc));
        if(suma&&sumb&&sumc){
            ans=min(ans,num);
        }
        num=suma=sumb=sumc=0;
    }
    cout <<ans<<endl;
    return 0;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:10:29: error: 'suma' was not declared in this scope
   10 |     int n,a,b,c,ans=1e9,num=suma=sumb=sumc=0;;
      |                             ^~~~
a.cc:10:34: error: 'sumb' was not declared in this scope
   10 |     int n,a,b,c,ans=1e9,num=suma=sumb=sumc=0;;
      |                                  ^~~~
a.cc:10:39: error: 'sumc' was not declared in this scope
   10 |     int n,a,b,c,ans=1e9,num=suma=sumb=sumc=0;;
      |                                       ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
ll INF = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N,A,B,C;
int ans = 0;
int L[10];
int dfs(int k, int a, int b, int c){
    if(k == N){
        if(min(a,min(b,c))){
            return abs(a-A)+abs(b-B)+abs(c-C);
        } else {
            return MAX;
        }
    }
    ans = min(ans, dfs(k+1,a,b,c));
    ans = min(ans, dfs(k+1, a+L[k], b, c) + (a>0 ? 10:0));
    ans = min(ans, dfs(k+1, a, b+L[k], c) + (b>0 ? 10:0));
    ans = min(ans, dfs(k+1, a, b, c+L[k]) + (c>0 ? 10:0));
    return ans;
}
int main(){
    cin >> N;
    cin >> A >> B >> C;
    int res = dfs();
    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:35:18: error: too few arguments to function 'int dfs(int, int, int, int)'
   35 |     int res = dfs();
      |               ~~~^~
a.cc:18:5: note: declared here
   18 | int dfs(int k, int a, int b, int c){
      |     ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
ll INF = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N,A,B,C;
int ans = 0;
int L[10];
int dfs(int k, int a, int b, int c){
    if(k == N){
        if(min(a,min(b,c))){
            return 1e9;
        } else {
            return abs(a-A)+abs(b-B)+abs(c-C);
        }
    }
    ans = min(ans, dfs(k+1,a,b,c));
    ans = min(ans, dfs(k+1, a+L[k], b, c) + (a>0 ? 10:0));
    ans = min(ans, dfs(k+1, a, b+L[k], c) + (b>0 ? 10:0));
    ans = min(ans, dfs(k+1, a, b, c+L[k]) + (c>0 ? 10:0));
    return ans;
}
int main(){
    cin >> N;
    cin >> A >> B >> C;
    int res = dfs();
    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:35:18: error: too few arguments to function 'int dfs(int, int, int, int)'
   35 |     int res = dfs();
      |               ~~~^~
a.cc:18:5: note: declared here
   18 | int dfs(int k, int a, int b, int c){
      |     ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
ll INF = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N,A,B,C;
int ans = 0;
int L[10];
int dfs(int k, int a, int b, int c){
    if(k == N){
        if(min(a,min(b,c))){
            return 1e9;
        } else {
            return abs(a-A)+abs(b-B)+abs(c-C);
        }
    }
    ans = min(ans, dfs(k+1,a,b,c));
    ans = min(ans, dfs(k+1, a+L[k], b, c) + (a[k]>0 ? 10:0));
    ans = min(ans, dfs(k+1, a, b+L[k], c) + (b[k]>0 ? 10:0));
    ans = min(ans, dfs(k+1, a, b, c+L[k]) + (c[k]>0 ? 10:0));
    return ans;
}
int main(){
    cin >> N;
    cin >> A >> B >> C;
    int res = dfs();
    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int dfs(int, int, int, int)':
a.cc:27:47: error: invalid types 'int[int]' for array subscript
   27 |     ans = min(ans, dfs(k+1, a+L[k], b, c) + (a[k]>0 ? 10:0));
      |                                               ^
a.cc:28:47: error: invalid types 'int[int]' for array subscript
   28 |     ans = min(ans, dfs(k+1, a, b+L[k], c) + (b[k]>0 ? 10:0));
      |                                               ^
a.cc:29:47: error: invalid types 'int[int]' for array subscript
   29 |     ans = min(ans, dfs(k+1, a, b, c+L[k]) + (c[k]>0 ? 10:0));
      |                                               ^
a.cc: In function 'int main()':
a.cc:35:18: error: too few arguments to function 'int dfs(int, int, int, int)'
   35 |     int res = dfs();
      |               ~~~^~
a.cc:18:5: note: declared here
   18 | int dfs(int k, int a, int b, int c){
      |     ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
ll INF = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N,A,B,C;
int ans = 0;
int L[10];
int dfs(int k, int a, int b, int c){
    if(k == N){
        if(min(a,min(b,c))){
            return 1e9;
        } else {
            return abs(a-A)+abs(b-B)+abs(c-C);
        }
    }
    ans = min(ans, dfs(k+1,a,b,c));
    ans = min(ans, dfs(k+1, a+L[k], b, c) + (a[k]>0 ? 10:0));
    ans = min(ans, dfs(k+1, a, b+L[k], c) + (b[k]>0 ? 10:0));
    ans = min(ans, dfs(k+1, a, b, c+L[k]) + (c[k]>0 ? 10:0));
    return ans;
}
int main(){
    cin >> N;
    cin >> a >> b >> c;
    int res = dfs();
    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int dfs(int, int, int, int)':
a.cc:27:47: error: invalid types 'int[int]' for array subscript
   27 |     ans = min(ans, dfs(k+1, a+L[k], b, c) + (a[k]>0 ? 10:0));
      |                                               ^
a.cc:28:47: error: invalid types 'int[int]' for array subscript
   28 |     ans = min(ans, dfs(k+1, a, b+L[k], c) + (b[k]>0 ? 10:0));
      |                                               ^
a.cc:29:47: error: invalid types 'int[int]' for array subscript
   29 |     ans = min(ans, dfs(k+1, a, b, c+L[k]) + (c[k]>0 ? 10:0));
      |                                               ^
a.cc: In function 'int main()':
a.cc:34:12: error: 'a' was not declared in this scope
   34 |     cin >> a >> b >> c;
      |            ^
a.cc:34:17: error: 'b' was not declared in this scope
   34 |     cin >> a >> b >> c;
      |                 ^
a.cc:34:22: error: 'c' was not declared in this scope
   34 |     cin >> a >> b >> c;
      |                      ^
a.cc:35:18: error: too few arguments to function 'int dfs(int, int, int, int)'
   35 |     int res = dfs();
      |               ~~~^~
a.cc:18:5: note: declared here
   18 | int dfs(int k, int a, int b, int c){
      |     ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
ll INF = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N,A,B,C;
int ans = 0;
int L[10];
int dfs(int k, int a, int b, int c){
    ans = min(ans, dfs(k+1,a,b,c));
    ans = min(ans, dfs(k+1, a+L[k], b, c) + (a[k]>0 ? 10:0));
    ans = min(ans, dfs(k+1, a, b+L[k], c) + (b[k]>0 ? 10:0));
    ans = min(ans, dfs(k+1, a, b, c+L[k]) + (c[k]>0 ? 10:0));
    return ans;
}
int main(){
    cin >> N;
    cin >> a >> b >> c;
    int res = dfs();
    cout << ans << endl;
}



Compiler output:
a.cc: In function 'int dfs(int, int, int, int)':
a.cc:20:47: error: invalid types 'int[int]' for array subscript
   20 |     ans = min(ans, dfs(k+1, a+L[k], b, c) + (a[k]>0 ? 10:0));
      |                                               ^
a.cc:21:47: error: invalid types 'int[int]' for array subscript
   21 |     ans = min(ans, dfs(k+1, a, b+L[k], c) + (b[k]>0 ? 10:0));
      |                                               ^
a.cc:22:47: error: invalid types 'int[int]' for array subscript
   22 |     ans = min(ans, dfs(k+1, a, b, c+L[k]) + (c[k]>0 ? 10:0));
      |                                               ^
a.cc: In function 'int main()':
a.cc:27:12: error: 'a' was not declared in this scope
   27 |     cin >> a >> b >> c;
      |            ^
a.cc:27:17: error: 'b' was not declared in this scope
   27 |     cin >> a >> b >> c;
      |                 ^
a.cc:27:22: error: 'c' was not declared in this scope
   27 |     cin >> a >> b >> c;
      |                      ^
a.cc:28:18: error: too few arguments to function 'int dfs(int, int, int, int)'
   28 |     int res = dfs();
      |               ~~~^~
a.cc:18:5: note: declared here
   18 | int dfs(int k, int a, int b, int c){
      |     ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;

#include <iostream>
#include <string>

using namespace std;

int N;
int L[10];
int A,B,C;

int dfs(int k, int a, int b, int c){
	if(k==N){
		if(a==0 || b ==0 || c==0) return 1e9;
		return abs (a-A) + abs(b-B) + abs(c-C);
	}
	int ans =1e9;
	ans = min(ans, dfs(k+1, a+L[k],b,c) + (a>0 ? 10:0));
	ans = min(ans, dfs(k+1, a,b+L[k],c) + (a>0 ? 10:0));
	ans = min(ans, dfs(k+1, a,b,c+L[k]) + (a>0 ? 10:0));
	ans = min(ans, dfs(k+1, a,b,c);
	return ans;
}

int main(){
	cin >> N >> A >> B >>C;
	for(int i= 0; i< N; ++i) cin >> l[i];

}

Compiler output:
a.cc: In function 'int dfs(int, int, int, int)':
a.cc:22:39: error: expected ')' before ';' token
   22 |         ans = min(ans, dfs(k+1, a,b,c);
      |                  ~                    ^
      |                                       )
a.cc: In function 'int main()':
a.cc:28:41: error: 'l' was not declared in this scope
   28 |         for(int i= 0; i< N; ++i) cin >> l[i];
      |                                         ^
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int N, A, B, C, l[10];

int main(void) {

	cin >> N >> A >> B >> C;

	long long int ans = 999999999999;

	for (int i = 1; i <= N; i++) {
		cin >> l[i];
	}
	vector<int> a, b, c;
	for (int i = 1; i <= pow(4, N); i++) {
		int tmp = i;
		int count = 1;
		a.clear(); b.clear(); c.clear();
		while (tmp > 0) {
			if ((tmp % 4) == 1) { a.push_back(count); }
			else if ((tmp % 4) == 2) { b.push_back(count); }
			else if((tmp%4)==3){ c.push_back(count); }
			count++;
			tmp /= 4;
		}

		if ((a.size() == 0) || (b.size() == 0) || (c.size() == 0)) { continue; }

		long long int tmp_A = 0, tmp_B = 0, tmp_C = 0;
		for (int k = 0; k < (int)a.size(); k++) { tmp_A += l[a[k]]; }
		for (int k = 0; k < (int)b.size(); k++) { tmp_B += l[b[k]]; }
		for (int k = 0; k < (int)c.size(); k++) { tmp_C += l[c[k]]; }

		long long int MP = 0;
		MP += (a.size() - 1) * 10 + (b.size() - 1) * 10 + (c.size() - 1) * 10;

		/*cout << "a "; for (int k = 0; k < (int)a.size(); k++) { cout << a[k] << " "; } cout << endl;
		cout << "b "; for (int k = 0; k < (int)b.size(); k++) { cout << b[k] << " "; } cout << endl;
		cout << "c "; for (int k = 0; k < (int)c.size(); k++) { cout << c[k] << " "; } cout << endl;
		//cout << "tmp_A= " << tmp_A << " tmp_B= " << tmp_B << "tmp_C= " << tmp_C << endl;
		*/
		MP += abs(A - tmp_A);
		MP += abs(B - tmp_B);
		MP += abs(C - tmp_C);

		ans = min(ans, MP);

	}

	cout << ans << endl;

	//system("pause");
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:19:30: error: 'pow' was not declared in this scope
   19 |         for (int i = 1; i <= pow(4, N); i++) {
      |                              ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
const ll INF=1e16+7;
int main(){
	ll N,A[3],ans=INF,K=1;
	cin >> N >> A[0] >> A[1] >> A[2];
	vector<ll> L(N);
	FOR(i,0,N)cin>>L[i];
	FOR(i,0,N)K*=4;
	FOR(t,0,K){
		vector<P> a={{0,0},{0,0},{0,0}};
		ll p = t;
		FOR(i,0,N){
			if(p%4!=3){
				a[p%4].first+=L[i];
				a[p%4].second++;
			}
			p /= 4;
		}
		FOR(i,0,3)p+=abs(a[i].first-A[i])
		FOR(i,0,3)p+=(a[i].second-1)*10;
		FOR(i,0,3)if(a[i].second==0)p=INF;
		ans = min(ans,p);
	}
	cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:23:50: error: expected ';' before 'for'
   23 |                 FOR(i,0,3)p+=abs(a[i].first-A[i])
      |                                                  ^
      |                                                  ;
a.cc:24:21: error: 'i' was not declared in this scope
   24 |                 FOR(i,0,3)p+=(a[i].second-1)*10;
      |                     ^
a.cc:5:39: note: in definition of macro 'FOR'
    5 | #define FOR(I,A,B) for(ll I = int(A); I < int(B); ++I)
      |                                       ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
int n, a, b, c, ans = INT_MAX;
vector<int> l;

void dfs(int x, int i, int j, int k, int mp)
{
    if (x == n)
    {
        if (min(i, min(j, k)) > 0) {
            ans = min(ans, mp + abs(a - i) + abs(b - j) + abs(c - k) - 30);
        }
        return;
    }
    dfs(x + 1, i, j, k, mp);
    dfs(x + 1, i + l[x], j, k, mp+10);
    dfs(x + 1, i, j + l[x], k, mp+10);
    dfs(x + 1, i, j, k + l[x], mp+10);
}

int main()
{
    cin >> n >> a >> b >> c;
    l.resize(n);
    for (int i = 0; i < n; i++)
    {
        cin >> l[i];
    }
    dfs(0,0,0,0,0);
    cout << ans << endl;
}

Compiler output:
a.cc:4:23: error: 'INT_MAX' was not declared in this scope
    4 | int n, a, b, c, ans = INT_MAX;
      |                       ^~~~~~~
a.cc:3:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    2 | #include <vector>
  +++ |+#include <climits>
    3 | using namespace std;
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define int int64_t 
const int INF = 1e9;
const int MOD = INF+7;
const int LINF = 1e18;
#define rep(i,N) for(int (i)=0;(i)<(N);++(i))
#define rrep(i,N) for(int (i)=(N-1);(i)>0;--i)
#define FOR(i,j,N) for(int (i)=(j);(i)<(N);++(i))
#define put(n) cout<<(n)<<endl;
#define all(v) v.begin(),v.end()
#define MP make_pair
#define pb(n) push_back(n)

int N,A,B,C;
vector<int> L;
int dfs(int cnt,int a,int b,int c){
    if(cnt == N) return abs(a - A) + abs(b - B) + abs(c - C) + (min(a,b,c) > 0 ? -30 : INF);

    int non = dfs(cnt+1, a, b, c); 
    int use_A = dfs(cnt+1, a+L[cnt], b, c) + 10;
    int use_B = dfs(cnt+1, a, b+L[cnt], c) + 10;
    int use_C = dfs(cnt+1, a, b, c+L[cnt]) + 10;
    return min({non,use_A,use_B,use_C});
}

signed main(){
    int N,A,B,C;
    cin >> N >> A >> B >> C;
    L.resize(N);
    cout << dfs(0,0,0,0) << endl;
}


Compiler output:
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: In instantiation of 'constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare) [with _Tp = long int; _Compare = long int]':
a.cc:18:68:   required from here
   18 |     if(cnt == N) return abs(a - A) + abs(b - B) + abs(c - C) + (min(a,b,c) > 0 ? -30 : INF);
      |                                                                 ~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:284:17: error: '__comp' cannot be used as a function
  284 |       if (__comp(__b, __a))
      |           ~~~~~~^~~~~~~~~~
Language: C

#include <stdio.h>
int minmp(int n,int a,int b,int c){
  int l,min,m1,m2,m3,m4;
  scanf("%d",&l);
  if 
}
int abs(int x){
  if (x<0){
    x=-x;
  }
  return x;
}
int main(){
  int n,a,b,c;
  scanf("%d%d%d%d",&n,&a,&b,&c);
  return 0;
}

Compiler output:
main.c: In function 'minmp':
main.c:6:1: error: expected '(' before '}' token
    6 | }
      | ^
      | (
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N,A,B,C;
int ans = 0;
int L[N];
int dfs(int k, int a, int b, int c){
    if(k == N){
        if(min(a, min(b, c)) > 0){
            return abs(a - A)+abs(b - B)+abs(c - C);
        } else {
            return MAX;
        }
    }
    ans = min(ans, dfs(k+1, a, b, c));
    ans = min(ans, dfs(k+1, a+L[k], b, c) + 10);
    ans = min(ans, dfs(k+1, a, b+L[k], c) + 10);
    ans = min(ans, dfs(k+1, a, b, c+L[k]) + 10);
    return ans;
}
int main(){
    cin >> N >> A >> B >> C;
    for(int i = 0; i < N; i++){
        cin >> L[i];
    }
    int res = dfs(0,0,0,0);
    cout << res << endl;
}



Compiler output:
a.cc:16:7: error: size of array 'L' is not an integral constant-expression
   16 | int L[N];
      |       ^
Language: C++

#include <bits/stdc++.h>
using namespace std;


void min(vector<int > l) {

     while (l.size() >=3){
        for(int i=0;i<n-2;i++){
		    for(int j=i+1;j<n-1;j++){
			     for(int k=j+1 ;k<n ; k++){
			           d= abs(c-l.at(i)) + abs(b-l.at(j)) + abs(a-l.at(k));	 
                       m=min (m,d);		  
				 }
			}
		}
		int e;
		for(int i=0;i<n-1;i++){
		    for(int j=i+1 ; j< n ; j++){
			    e=l.at(i) + l.at(j);
　　　　　　　　　　l.erase(l.begin() + i , l.begin() + j);
                 l.push_back(e);

                 	   
			}
		}
		
   }

  
  return;
}


int main() {
   int n,a,b,c;
   cin >> n >> a >> b >> c;
   vector<int> l(n);
   
   for(int i=0; i<n ;i++){
       cin >> l.at(i);
	   
   }
   int m;
   int d=0;
   sort(l.begin(), l.end());
  
   //cout << l.at(1) <<endl;
}


Compiler output:
a.cc:20:1: error: extended character 　 is not valid in an identifier
   20 | 　　　　　　　　　　l.erase(l.begin() + i , l.begin() + j);
      | ^
a.cc:20:1: error: extended character 　 is not valid in an identifier
a.cc:20:1: error: extended character 　 is not valid in an identifier
a.cc:20:1: error: extended character 　 is not valid in an identifier
a.cc:20:1: error: extended character 　 is not valid in an identifier
a.cc:20:1: error: extended character 　 is not valid in an identifier
a.cc:20:1: error: extended character 　 is not valid in an identifier
a.cc:20:1: error: extended character 　 is not valid in an identifier
a.cc:20:1: error: extended character 　 is not valid in an identifier
a.cc:20:1: error: extended character 　 is not valid in an identifier
a.cc: In function 'void min(std::vector<int>)':
a.cc:8:23: error: 'n' was not declared in this scope
    8 |         for(int i=0;i<n-2;i++){
      |                       ^
a.cc:11:36: error: 'd' was not declared in this scope
   11 |                                    d= abs(c-l.at(i)) + abs(b-l.at(j)) + abs(a-l.at(k));
      |                                    ^
a.cc:11:43: error: 'c' was not declared in this scope
   11 |                                    d= abs(c-l.at(i)) + abs(b-l.at(j)) + abs(a-l.at(k));
      |                                           ^
a.cc:11:60: error: 'b' was not declared in this scope
   11 |                                    d= abs(c-l.at(i)) + abs(b-l.at(j)) + abs(a-l.at(k));
      |                                                            ^
a.cc:11:77: error: 'a' was not declared in this scope
   11 |                                    d= abs(c-l.at(i)) + abs(b-l.at(j)) + abs(a-l.at(k));
      |                                                                             ^
a.cc:12:24: error: 'm' was not declared in this scope
   12 |                        m=min (m,d);
      |                        ^
a.cc:17:31: error: 'n' was not declared in this scope
   17 |                 for(int i=0;i<n-1;i++){
      |                               ^
a.cc:20:1: error: '\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000\U00003000l' was not declared in this scope
   20 | 　　　　　　　　　　l.erase(l.begin() + i , l.begin() + j);
      | ^~~~~~~~~~~~~~~~~~~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int N,A,B,C,ans = 0;
int L[N];
int dfs(int k, int a, int b, int c){
    if(k == N){
        if(min(a, min(b, c)) > 0){
            return abs(a - A)+abs(b - B)+abs(c - C);
        } else {
            return MAX;
        }
    }
    ans = min(ans, dfs(k+1, a, b, c));
    ans = min(ans, dfs(k+1, a+L[k], b, c) + 10);
    ans = min(ans, dfs(k+1, a, b+L[k], c) + 10);
    ans = min(ans, dfs(k+1, a, b, c+L[k]) + 10);
    return ans;
}
int main(){
    cin >> N >> A >> B >> C;
    for(int i = 0; i < N; i++){
        cin >> L[i];
    }
    int res = dfs(0,0,0,0);
    cout << res << endl;
}



Compiler output:
a.cc:15:7: error: size of array 'L' is not an integral constant-expression
   15 | int L[N];
      |       ^
Language: C++

#include<iostream>
#include<vector>
#include<cmath>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#include<string>

using namespace std;

#define ll long long

int N,A,B,C;
int l[10];

int dfs(int n, int a, int b, int c){
    int t1, t2;
    //a,b,c それぞれに対しどの竹か決めるのにそれぞれ10コスト払っている分 -30
    if(n == N){
        if(a != 0 && b != 0 && c != 0){
            return abs(A - a) + abs(B - b) + abs(C - c) - 30;
        }else{
            return 1e9; 
        }
    int ret0 = dfs(n + 1, a, b, c);
    int ret1 = dfs(n + 1, a + l[n], b, c) + 10;
    int ret2 = dfs(n + 1, a, b + l[n], c) + 10;
    int ret3 = dfs(n + 1, a, b, c + l[n]) + 10;

    t1 = min(ret0,ret1);
    t2 = min(ret2,ret3);
    return min(t1, t2);
}

int main(){
    cin >> N >> A >> B >> C;
    for(int i = 0; i < N; i++){
        cin >> l[i];
    }
    
    cout << dfs(0,0,0,0) << endl;

}

Compiler output:
a.cc: In function 'int dfs(int, int, int, int)':
a.cc:36:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   36 | int main(){
      |         ^~
a.cc:36:9: note: remove parentheses to default-initialize a variable
   36 | int main(){
      |         ^~
      |         --
a.cc:36:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:36:11: error: a function-definition is not allowed here before '{' token
   36 | int main(){
      |           ^
a.cc:44:2: error: expected '}' at end of input
   44 | }
      |  ^
a.cc:17:36: note: to match this '{'
   17 | int dfs(int n, int a, int b, int c){
      |                                    ^
a.cc:44:2: warning: control reaches end of non-void function [-Wreturn-type]
   44 | }
      |  ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll L[10];
//! [bitで表される竹を使って][長さiの竹を作るための]=MP
ll mp[300][5];

int main()
{
    int N, S[3];
    cin >> N;
    REP(i, 3)
    {
        cin >> S[i];
    }
    REP(i, N)
    {
        cin >> L[i];
    }

    int m = pow(2, N);
    FOR(i, m, 1)
    {
        ll sum = 0;
        int n = 0;
        REP(j, N)
        {
            if (((i >> j) & 1) == 0)
                continue;
            n++;
            sum += L[j];
        }
        REP(j, 3)
        {
            mp[i][j] = 10 * (n - 1) + abs(sum - K[j]);
        }
    }

    ll min = INF;
    FOR(i, m, 1)
    {
        FOR(j, m, 1)
        {
            FOR(k, m, 1)
            {
                bool f = false;
                REP(l, N)
                {
                    int s = 0;
                    s = ((i >> l) & 1) + ((j >> l) & 1) + ((k >> l) & 1);
                    if (s > 1)
                    {
                        f = true;
                        break;
                    }
                }
                if (f)
                    continue;
                min = std::min(min, mp[i][0] + mp[j][1] + mp[k][2]);
            }
        }
    }
    cout << min << endl;
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:49: error: 'K' was not declared in this scope
   45 |             mp[i][j] = 10 * (n - 1) + abs(sum - K[j]);
      |                                                 ^
Language: C++

#include <bits/stdc++.h>
#define INF 99999999
using namespace std;
 
typedef long long ll;
int n, a, b, c;
int l[8];
int ans = INF;
void dfs(int aa, int bb, int cc, int mp, int t){
	if(t == n){
		ans = min(ans, mp+abs(a-aa)+abs(b-bb)+abs(c-cc)-30);
		return;
	}
	dfs(aa+l[t], bb, cc, mp+10, t+1);
	dfs(aa, bb+l[t], cc, mp+10, t+1);
	dfs(aa, bb, cc+l[t], mp+10, t+1);
	dfs(aa, bb, cc, mp, t+1);
	return;
}
 
int main(){
	cin >> n >> a >> b >> c;
	for(int i = 0; i < n; i++)cin >> l[i];
	dfs(0, 0, 0, 0, 0);
	cout << ans << endl;
	return 0;
}
#include <bits/stdc++.h>
#define INF 9999999
using namespace std;

typedef long long ll;
int n, a, b, c;
int l[8];
int ans = INF;
void dfs(int aa, int bb, int cc, int mp, int t){
	if(t == n){
		ans = min(ans, mp+abs(a-aa)+abs(b-bb)+abs(c-cc)-30);
		return;
	}
	dfs(aa+l[t], bb, cc, mp+10, t+1);
	dfs(aa, bb+l[t], cc, mp+10, t+1);
	dfs(aa, bb, cc+l[t], mp+10, t+1);
	dfs(aa, bb, cc, mp, t+1);
	return;
}

int main(){
	cin >> n >> a >> b >> c;
	for(int i = 0; i < n; i++)cin >> l[i];
	dfs(0, 0, 0, 0, 0);
	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc:29:9: warning: "INF" redefined
   29 | #define INF 9999999
      |         ^~~
a.cc:2:9: note: this is the location of the previous definition
    2 | #define INF 99999999
      |         ^~~
a.cc:33:5: error: redefinition of 'int n'
   33 | int n, a, b, c;
      |     ^
a.cc:6:5: note: 'int n' previously declared here
    6 | int n, a, b, c;
      |     ^
a.cc:33:8: error: redefinition of 'int a'
   33 | int n, a, b, c;
      |        ^
a.cc:6:8: note: 'int a' previously declared here
    6 | int n, a, b, c;
      |        ^
a.cc:33:11: error: redefinition of 'int b'
   33 | int n, a, b, c;
      |           ^
a.cc:6:11: note: 'int b' previously declared here
    6 | int n, a, b, c;
      |           ^
a.cc:33:14: error: redefinition of 'int c'
   33 | int n, a, b, c;
      |              ^
a.cc:6:14: note: 'int c' previously declared here
    6 | int n, a, b, c;
      |              ^
a.cc:34:5: error: redefinition of 'int l [8]'
   34 | int l[8];
      |     ^
a.cc:7:5: note: 'int l [8]' previously declared here
    7 | int l[8];
      |     ^
a.cc:35:5: error: redefinition of 'int ans'
   35 | int ans = INF;
      |     ^~~
a.cc:8:5: note: 'int ans' previously defined here
    8 | int ans = INF;
      |     ^~~
a.cc:36:6: error: redefinition of 'void dfs(int, int, int, int, int)'
   36 | void dfs(int aa, int bb, int cc, int mp, int t){
      |      ^~~
a.cc:9:6: note: 'void dfs(int, int, int, int, int)' previously defined here
    9 | void dfs(int aa, int bb, int cc, int mp, int t){
      |      ^~~
a.cc:48:5: error: redefinition of 'int main()'
   48 | int main(){
      |     ^~~~
a.cc:21:5: note: 'int main()' previously defined here
   21 | int main(){
      |     ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int n,A,B,C,ans;
int L[10],visited[10];
int dfs(int k, int a, int b, int c){
    if(k == n){
        if(a == 0 || b == 0 || c == 0) return MAX;
        return abs(a - A)+abs(b-B)+abs(c-C);
    }
    int ans = MAX;
    ans = min(ans, dfs(k+1, a+L[k], b, c) + (a>0 ? 10:0));
    ans = min(ans, dfs(k+1, a, b+L[k], c) + (b>0 ? 10:0));
    ans = min(ans, dfs(k+1, a, b, c+L[k]) + (c>0 ? 10:0));
    ans = main(ans, dfs(k+1,a,b,c));
    return ans;
}
int main(){
    cin >> n >> A >> B >> C;
    for(int i = 0; i < N; i++){
        cin >> L[i];
    }
    cout << dfs(0,0,0,0) << endl;
    return 0;
}




Compiler output:
a.cc: In function 'int dfs(int, int, int, int)':
a.cc:25:11: error: 'main' was not declared in this scope
   25 |     ans = main(ans, dfs(k+1,a,b,c));
      |           ^~~~
a.cc: In function 'int main()':
a.cc:30:24: error: 'N' was not declared in this scope
   30 |     for(int i = 0; i < N; i++){
      |                        ^