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

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

template<class T> inline bool chmin(T& a, T b) {
    if (a > b){
        a = b;
        return true;
    }
    return false;
}

template<class T> inline bool chmax(T& a, T b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
} 

const int INF = 1LL << 20;

int N, A, B, C;
vactor<int> L;

int dfs(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 dfs = dfs(i+1, a, b, c);

    chmin(dfs, dfs(i+1, a + L[i], b, c) + (a ? 10 : 0));
    chmin(dfs, dfs(i+1, a, b + L[i], c) + (b ? 10 : 0));
    chmin(dfs, dfs(i+1, a, b, c + L[i]) + (c ? 10 : 0));

    return dfs;
}

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:24:1: error: 'vactor' does not name a type
   24 | vactor<int> L;
      | ^~~~~~
a.cc: In function 'int dfs(int, int, int, int)':
a.cc:32:18: error: 'dfs' cannot be used as a function
   32 |     int dfs = dfs(i+1, a, b, c);
      |               ~~~^~~~~~~~~~~~~~
a.cc:34:29: error: 'L' was not declared in this scope
   34 |     chmin(dfs, dfs(i+1, a + L[i], b, c) + (a ? 10 : 0));
      |                             ^
a.cc:34:19: error: 'dfs' cannot be used as a function
   34 |     chmin(dfs, dfs(i+1, a + L[i], b, c) + (a ? 10 : 0));
      |                ~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:35:19: error: 'dfs' cannot be used as a function
   35 |     chmin(dfs, dfs(i+1, a, b + L[i], c) + (b ? 10 : 0));
      |                ~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:36:39: error: 'dfs' cannot be used as a function
   36 |     chmin(dfs, dfs(i+1, a, b, c + L[i]) + (c ? 10 : 0));
      |                                       ^
a.cc: In function 'int main()':
a.cc:43:40: error: 'l' was not declared in this scope
   43 |     for (int i = 0; i < N; i++) cin >> l[i];
      |                                        ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
#define INF ULLONG_MAX;
//using ull = unsigned long long;
using ull = long long;

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }

/**
 *  @param bottom 与えられた竹の本数
 *  @param l 竹配列
 *  @param A 求めたいAの長さ
 *  @param B 求めたいBの長さ
 *  @param C 求めたいCの長さ
 *  @param depth 探索中の深さ
 *  @param a 現在までのAの長さ
 *  @param b 現在までのBの長さ
 *  @param c 現在までのCの長さ
 */
ull dfs(ull bottom, const vector<ull>& l, ull A, ull B, ull C, ull depth, ull a, ull b, ull c) {
  if (depth == bottom) {
    // 最下層まで行ったので延長魔法と短縮魔法を使用してMPを算出 (無は除外)
    if (a > 0 && b > 0 && c > 0) {
      return abs(A-a) + abs(B-b) + abs(C-c) - 30;
    } else {
      return INF;
    }
  }

  vector<ull> res;

  // 選ばない
  res.push(dfs(bottom, l, A, B, C, depth+1, a, b, c));

  // Aの材料にする
  res.push(dfs(bottom, l, A, B, C, depth+1, a + l[depth], b, c) + 10);

  // Bの材料にする
  res.push(dfs(bottom, l, A, B, C, depth+1, a, b + l[depth], c) + 10);

  // Cの材料にする
  res.push(dfs(bottom, l, A, B, C, depth+1, a, b, c + l[depth]) + 10);

  return *min_element(res.begin(), res.end());
}

int main() {
  ull n, a, b, c;
  vector<ull> l;
  cin >> n >> a >> b >> c;
 
  each(i, n) {
    ull tmp;
    cin >> tmp;
    l.push(tmp);
  }

  /*
    1. 延長短縮したあとにがっちゃんこするのと、がっちゃんこしたあとに延長短縮するのは手数が同じ
    2. 延長短縮は求めたい値A,B,Cとがっちゃんこ後の絶対値差分ですぐわかるので、まずはがっちゃんこする
    3. 所有している竹に対して採用できる選択肢は下記
         (1) 求めたい竹長Aの材料にする
         (2) 求めたい竹長Bの材料にする
         (3) 求めたい竹長Cの材料にする
         (4) どこにも使わない
    4. 各竹(最大8本)に対して(1)〜(4)を採用するので、フルケースで4 ^ 8 = 65536通り
         l (竹1) : (1)〜(4)のいずれかを採用
         l (竹2) : (1)〜(4)のいずれかを採用
         l (竹3) : (1)〜(4)のいずれかを採用
         l (竹4) : (1)〜(4)のいずれかを採用
         l (竹5) : (1)〜(4)のいずれかを採用
         l (竹6) : (1)〜(4)のいずれかを採用
         l (竹7) : (1)〜(4)のいずれかを採用
         l (竹8) : (1)〜(4)のいずれかを採用
    5. AもBもCも1以上
  */

  auto r = dfs(n, l, a, b, c, 0, 0, 0, 0);
  cout << r << endl;

  return 0;
}


Compiler output:
a.cc: In function 'ull dfs(ull, const std::vector<long long int>&, ull, ull, ull, ull, ull, ull, ull)':
a.cc:15:13: error: 'ULLONG_MAX' was not declared in this scope
   15 | #define INF ULLONG_MAX;
      |             ^~~~~~~~~~
a.cc:42:14: note: in expansion of macro 'INF'
   42 |       return INF;
      |              ^~~
a.cc:12:1: note: 'ULLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   11 | #include <bitset>
  +++ |+#include <climits>
   12 |
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <cmath>
#include <tuple>
#include <bitset>

#define push emplace_back
#define each(i, x) for (auto i=0; i < x; i++)
#define INF LLONG_MAX;
//using ull = unsigned long long;
using ull = long long;

using namespace std;
template <typename T> inline void dump(const T& x) { cout << "[" << x << "]" << endl; }
template <typename T> inline void dump(const vector<T>& x) { for (const auto v : x) { cout << v << " "; } cout << endl; }
template <typename T> inline void sort_asc(vector<T>& x) { std::sort(x.begin(), x.end()); }
template <typename T> inline void sort_desc(vector<T>& x) { std::sort(x.begin(), x.end(), greater<T>()); }

/**
 *  @param bottom 与えられた竹の本数
 *  @param l 竹配列
 *  @param A 求めたいAの長さ
 *  @param B 求めたいBの長さ
 *  @param C 求めたいCの長さ
 *  @param depth 探索中の深さ
 *  @param a 現在までのAの長さ
 *  @param b 現在までのBの長さ
 *  @param c 現在までのCの長さ
 */
ull dfs(ull bottom, const vector<ull>& l, ull A, ull B, ull C, ull depth, ull a, ull b, ull c) {
  if (depth == bottom) {
    // 最下層まで行ったので延長魔法と短縮魔法を使用してMPを算出 (無は除外)
    if (a > 0 && b > 0 && c > 0) {
      return abs(A-a) + abs(B-b) + abs(C-c) - 30;
    } else {
      return INF;
    }
  }

  vector<ull> res;

  // 選ばない
  res.push(dfs(bottom, l, A, B, C, depth+1, a, b, c));

  // Aの材料にする
  res.push(dfs(bottom, l, A, B, C, depth+1, a + l[depth], b, c) + 10);

  // Bの材料にする
  res.push(dfs(bottom, l, A, B, C, depth+1, a, b + l[depth], c) + 10);

  // Cの材料にする
  res.push(dfs(bottom, l, A, B, C, depth+1, a, b, c + l[depth]) + 10);

  return *min_element(res.begin(), res.end());
}

int main() {
  ull n, a, b, c;
  vector<ull> l;
  cin >> n >> a >> b >> c;
 
  each(i, n) {
    ull tmp;
    cin >> tmp;
    l.push(tmp);
  }

  /*
    1. 延長短縮したあとにがっちゃんこするのと、がっちゃんこしたあとに延長短縮するのは手数が同じ
    2. 延長短縮は求めたい値A,B,Cとがっちゃんこ後の絶対値差分ですぐわかるので、まずはがっちゃんこする
    3. 所有している竹に対して採用できる選択肢は下記
         (1) 求めたい竹長Aの材料にする
         (2) 求めたい竹長Bの材料にする
         (3) 求めたい竹長Cの材料にする
         (4) どこにも使わない
    4. 各竹(最大8本)に対して(1)〜(4)を採用するので、フルケースで4 ^ 8 = 65536通り
         l (竹1) : (1)〜(4)のいずれかを採用
         l (竹2) : (1)〜(4)のいずれかを採用
         l (竹3) : (1)〜(4)のいずれかを採用
         l (竹4) : (1)〜(4)のいずれかを採用
         l (竹5) : (1)〜(4)のいずれかを採用
         l (竹6) : (1)〜(4)のいずれかを採用
         l (竹7) : (1)〜(4)のいずれかを採用
         l (竹8) : (1)〜(4)のいずれかを採用
    5. AもBもCも1以上
  */

  auto r = dfs(n, l, a, b, c, 0, 0, 0, 0);
  cout << r << endl;

  return 0;
}


Compiler output:
a.cc: In function 'ull dfs(ull, const std::vector<long long int>&, ull, ull, ull, ull, ull, ull, ull)':
a.cc:15:13: error: 'LLONG_MAX' was not declared in this scope
   15 | #define INF LLONG_MAX;
      |             ^~~~~~~~~
a.cc:42:14: note: in expansion of macro 'INF'
   42 |       return INF;
      |              ^~~
a.cc:12:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   11 | #include <bitset>
  +++ |+#include <climits>
   12 |
Language: Java

// 理解できていない

import static java.lang.Math.*;

import java.util.Scanner;

public class CSyntheticKadomatsu {
	static int A, B, C, N;
	static int[] L;
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt(); //元の竹の数
		L = new int[N];
		A = sc.nextInt(); // 欲しい竹1
		B = sc.nextInt();
		C = sc.nextInt();
		int i;
		for (i = 0; i < N; i++) {
			L[i] = sc.nextInt();
		}
		sc.close();
		sc = null;
		System.out.println(calmp(0,0,0,0));
	}
	static int calmp(int n, int a, int b, int c) {
//		System.out.println("n"+n);
//		System.out.println("a"+a);
//		System.out.println("b"+b);
//		System.out.println("c"+c);

		if (n == N) {
			return (min(min(a,b),c) > 0) ? (abs(A-a)+abs(B-b)+abs(C-c)-30) : 3000;
		}
		int mp0 = calmp(n+1, a, b, c);
		int mp1 = calmp(n+1, a+L[n], b, c) + 10;
		int mp2 = calmp(n+1, a, b+L[n], c) + 10;
		int mp3 = calmp(n+1, a, b, c+L[n]) + 10;
		System.out.println("mp:"+min(min(mp0, mp1), min(mp2, mp3)));
		return min(min(mp0, mp1), min(mp2, mp3));
		}
}


Compiler output:
Main.java:7: error: class CSyntheticKadomatsu is public, should be declared in a file named CSyntheticKadomatsu.java
public class CSyntheticKadomatsu {
       ^
1 error
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef map<int, int> mi;
typedef set<int> si;
#define VV(T) vector<vector< T > >
#define dump(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl

#define rep(i, n) REP(i, 0, n)                              // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
#define invrep(i, n) for(int i = (n)-1; i >= 0; i--)        // n-1, n-2, ..., 0
#define invREP(i, x, n) for(int i = (n)-1; i >= (x; i--)    // n-1, n-2, ..., x
#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(v) (v).begin() , (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define PB push_back

#define COUT(x) cout << (x) << endl
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

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

void dfs(int x, int A, int B, int C, int s){
    if(x > n){
        if(A && B && C) ans = min(ans, s + abs(a - A) + abs(b - B) + abs(c - C))
        return ;
    }
    dfs(x + 1, A, B, C, s);
    dfs(x + 1, A + l[x], B, C, s + 10*(A > 0));
    dfs(x + 1, A, B + l[x], C, s + 10*(B > 0));
    dfs(x + 1, A, B, C + l[x], s + 10*(C > 0));
}

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

Compiler output:
a.cc: In function 'void dfs(int, int, int, int, int)':
a.cc:44:81: error: expected ';' before 'return'
   44 |         if(A && B && C) ans = min(ans, s + abs(a - A) + abs(b - B) + abs(c - C))
      |                                                                                 ^
      |                                                                                 ;
   45 |         return ;
      |         ~~~~~~                                                                   
a.cc: In function 'int main()':
a.cc:55:15: error: 'N' was not declared in this scope
   55 |     REP(i, 1, N + 1) cin >> l[i];
      |               ^
a.cc:23:41: note: in definition of macro 'REP'
   23 | #define REP(i, x, n) for(int i = x; i < n; i++)             // x, x + 1, ..., n-1
      |                                         ^
Language: C++

#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <unordered_set>
#include <set>
#include <vector>
#include <cmath>
#include <string>
#include <queue>
#include <list>
#include <stack>
#include <ctime>
#include <random>
#include <bitset>
#include <cstring>
#define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) 
#define ll long long
#define eps 1e-8
#define inf INT_MAX
using namespace std;

vector<int>v;
int n, A, B, C;

int dfs(int pos, int a, int b, int c) {
	if (pos == n) {
		if (min({ a,b,c }) >= 0)
			return abs(a - A) + abs(b - B) + abs(c - C) - 30;
		else
			return inf;
	}
	int q = dfs(pos + 1, a, b, c), w = dfs(pos + 1, a + v[pos], b, c) + 10,
		e = dfs(pos + 1, a, b + v[pos], c) + 10, r = dfs(pos + 1, a, b, c + v[pos]) + 10;
	return min({ q,w,e,r });
}

int main() {
	speed;
	cin >> n >> A >> B >> C;
	v.resize(n);
	for (int i = 0; i < n; ++i)
		cin >> v[i];
	cout << dfs(0, 0, 0, 0);
}

Compiler output:
a.cc: In function 'int dfs(int, int, int, int)':
a.cc:20:13: error: 'INT_MAX' was not declared in this scope
   20 | #define inf INT_MAX
      |             ^~~~~~~
a.cc:31:32: note: in expansion of macro 'inf'
   31 |                         return inf;
      |                                ^~~
a.cc:17:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   16 | #include <cstring>
  +++ |+#include <climits>
   17 | #define speed ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
Language: C++

#include "pch.h"
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
using namespace std;
#define FOR(i, s, e) for(int i=s; i<e; i++)
#define REF(i, s, e) for(int i=s; i>e; i--)

int n, a, b, c;
vector<int> bamboo(8);
int min1 = 9999999;

void calc(vector<int> flag) {
	//FOR(i, 0, n) cout << flag[i] << ",";
	//cout << endl;

	int cost = -30; //a,b,cの1回分の合成costを始めに引いておく

	//合成
	vector<int> synthesis(4,0);
	FOR(i,0,n) {
		synthesis[ flag[i] ] += bamboo[i];
		//a,b,cのどれかに使うならcostに10足す
		if (flag[i] != 0) cost += 10;
	}

	//FOR(i, 0, 4) cout << synthesis[i] << ",";
	//cout << endl;
	//cout << a << " " << b << " " << c << endl;

	if (synthesis[1] != 0 && synthesis[2] != 0 && synthesis[3] != 0) {
		cost += abs(a - synthesis[1]) + abs(b - synthesis[2]) + abs(c - synthesis[3]);
		min1 = min(min1, cost);
		//cout << cost << " : " << min1 << endl;
	}
}

//0: 未使用、1:a、2:b、3:c
void dfs(int depth, vector<int> flag) {
	if (depth == n) calc(flag);
	else{
		FOR(i, 0, 4) {
			flag[depth] = i;
			dfs(depth + 1, flag);
		}
	}
}

int main(void) {
	
	cin >> n >> a >> b >> c;
	
	FOR(i, 0, n) {
		cin >> bamboo[i];
	}

	vector<int> comb(n);
	dfs(0, comb);

	//cout << "ans:" << endl;
	cout << min1 << endl;

	//vector<int> flag({1,2,2,2,3});
	//calc(flag);
}

Compiler output:
a.cc:1:10: fatal error: pch.h: No such file or directory
    1 | #include "pch.h"
      |          ^~~~~~~
compilation terminated.
Language: C++

    #include <cstdio>
    #include <cstdlib>
    #include <cstring>
    #include <cmath>
    #include <iostream>
    #include <string>
    #include <vector>
    #include <map>
    #include <set>
    #include <stack>
    #include <list>
    #include <queue>
    #include <deque>
    #include <algorithm>
    #include <numeric>
    #include <utility>
    #include <complex>
    #include <functional>
    #include <climits>

    using namespace std;
    int N, A, B, C, m = INT_MAX;
    vector<int> take;

    int calc(vector<int> v)
    {
        int a = 0, b = 0, c = 0, mp = 0;
        for (int i = 0; i < N; i++)
        {
            if (v[i] == 0)
            {
                if (a > 0)
                {
                    mp += 10;
                }
                a += take[i];
            }
            else if (v[i] == 1)
            {
                if (b > 0)
                {
                    mp += 10;
                }
                b += take[i];
            }
            else if (v[i] == 2)
            {
                if (c > 0)
                {
                    mp += 10;
                }
                c += take[i];
            }
        }
        if(!a || !b || !c) {
            return INT_MAX;
        }
        mp += abs(A - a);
        mp += abs(B - b);
        mp += abs(C - c);
        return mp;
    }

    int dfs(int d, vector<int> v)
    {
        if (d == N)
        {
            return m = min(calc(v), m);
        }
        for (int i = 0; i < 4; i++)
        {
            v[d] = i;
            dfs(d + 1, v);
        }
    }

    int main()
    {
        cin >> N >> A >> B >> C;
        for (int i = 0; i < N; i++)
        {
            int l;
            cin >> l;
            take.push_back(l);
        }
        vector<int> v(N, 0);
        dfs(0, v);
        cout << m << endl;
    }#include


Compiler output:
a.cc:89:6: error: stray '#' in program
   89 |     }#include
      |      ^
a.cc:89:7: error: 'include' does not name a type
   89 |     }#include
      |       ^~~~~~~
a.cc: In function 'int dfs(int, std::vector<int>)':
a.cc:75:5: warning: control reaches end of non-void function [-Wreturn-type]
   75 |     }
      |     ^
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(n,m,v) vector<long long> v((n),(m));
int ans=INT_MAX;
int n;
vec(8,0,k);
int a[3];
vec(8,0,v);
void init(){
    cin>>n>>a[0]>>a[1]>>a[2];
    
    rep(i,n)cin>>v[i];
}

int dfs(int i){
    if(i==n){
        int mp=0;
       /* rep(kk,n){
            cout<<k[kk]<<" ";
        }
        cout<<endl;*/
        rep(jj,n){
            cnt[k[jj]]++;
            tmp[k[jj]]+=v[jj];
        }
        if(cnt[0]*cnt[1]*cnt[2]!=0){
            rep(jj,3)mp+=abs(tmp[jj]-a[jj]);
            mp+=((cnt[0]+cnt[1]+cnt[2]-3)*10);
            return mp;
        }
        return INT_MAX;
    }
    rep(j,4){
        k[i]=j;
        //cout<<"dd"<<endl;
        ans=min(dfs(i+1),ans);
    }
    return ans;
}

int main(){
    
    init();
    cout<<dfs(0)<<endl;
    return 0;


}



Compiler output:
a.cc: In function 'int dfs(int)':
a.cc:32:13: error: 'cnt' was not declared in this scope; did you mean 'int'?
   32 |             cnt[k[jj]]++;
      |             ^~~
      |             int
a.cc:33:13: error: 'tmp' was not declared in this scope; did you mean 'mp'?
   33 |             tmp[k[jj]]+=v[jj];
      |             ^~~
      |             mp
a.cc:35:12: error: 'cnt' was not declared in this scope; did you mean 'int'?
   35 |         if(cnt[0]*cnt[1]*cnt[2]!=0){
      |            ^~~
      |            int
a.cc:36:30: error: 'tmp' was not declared in this scope; did you mean 'mp'?
   36 |             rep(jj,3)mp+=abs(tmp[jj]-a[jj]);
      |                              ^~~
      |                              mp
Language: C++

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <cmath>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++ )
#define repf(i,m,n) for(int (i)=m;(i)<n;(i)++)
#define all(v) (v).begin(), (v).end()
#define ll long long
#define vec(n,m,v) vector<long long> v((n),(m));
int ans=INT_MAX;
int n;
vec(8,0,k);
int a[3];
vec(8,0,v);
void init(){
    cin>>n>>a[0]>>a[1]>>a[2];
    
    rep(i,n)cin>>v[i];
}

int dfs(int i){
    if(i==n){
        int mp=0;
       /* rep(kk,n){
            cout<<k[kk]<<" ";
        }
        cout<<endl;
        rep(jj,n){
            cnt[k[jj]]++;
            tmp[k[jj]]+=v[jj];
        }*/
        if(cnt[0]*cnt[1]*cnt[2]!=0){
            rep(jj,3)mp+=abs(tmp[jj]-a[jj]);
            mp+=((cnt[0]+cnt[1]+cnt[2]-3)*10);
            return mp;
        }
        return INT_MAX;
    }
    rep(j,4){
        k[i]=j;
        //cout<<"dd"<<endl;
        ans=min(dfs(i+1),ans);
    }
    return ans;
}

int main(){
    
    init();
    cout<<dfs(0)<<endl;
    return 0;


}



Compiler output:
a.cc: In function 'int dfs(int)':
a.cc:35:12: error: 'cnt' was not declared in this scope; did you mean 'int'?
   35 |         if(cnt[0]*cnt[1]*cnt[2]!=0){
      |            ^~~
      |            int
a.cc:36:30: error: 'tmp' was not declared in this scope; did you mean 'mp'?
   36 |             rep(jj,3)mp+=abs(tmp[jj]-a[jj]);
      |                              ^~~
      |                              mp
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

void chmin(int &a, int b) { if (a > b) a = b; }

int 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:39:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   39 | int main() {
      |         ^~
a.cc:39:9: note: remove parentheses to default-initialize a variable
   39 | int main() {
      |         ^~
      |         --
a.cc:39:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:39:12: error: a function-definition is not allowed here before '{' token
   39 | int main() {
      |            ^
a.cc:46:2: error: expected '}' at end of input
   46 | }
      |  ^
a.cc:24:37: note: to match this '{'
   24 | int rec(int i, int a, int b, int c) {
      |                                     ^
a.cc:46:2: warning: control reaches end of non-void function [-Wreturn-type]
   46 | }
      |  ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7

typedef long long ll;
typedef long long int lli;

void chmin(int &a, int b) { if (a > b) a = b; }

int 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;
}

 {

    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:39:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   39 | int main() {
      |         ^~
a.cc:39:9: note: remove parentheses to default-initialize a variable
   39 | int main() {
      |         ^~
      |         --
a.cc:39:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:39:12: error: a function-definition is not allowed here before '{' token
   39 | int main() {
      |            ^
a.cc:55:2: error: expected '}' at end of input
   55 | }
      |  ^
a.cc:24:37: note: to match this '{'
   24 | int rec(int i, int a, int b, int c) {
      |                                     ^
a.cc:54:32: warning: control reaches end of non-void function [-Wreturn-type]
   54 |     cout << rec(0, 0, 0, 0) << endl;
      |                                ^~~~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)
#define INF 1e7
typedef long long ll;
typedef long long int lli;

void chmin(int &a, int b) { if (a > b) a = b; }

int 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:38:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse]
   38 | int main() {
      |         ^~
a.cc:38:9: note: remove parentheses to default-initialize a variable
   38 | int main() {
      |         ^~
      |         --
a.cc:38:9: note: or replace parentheses with braces to value-initialize a variable
a.cc:38:12: error: a function-definition is not allowed here before '{' token
   38 | int main() {
      |            ^
a.cc:45:2: error: expected '}' at end of input
   45 | }
      |  ^
a.cc:23:37: note: to match this '{'
   23 | int rec(int i, int a, int b, int c) {
      |                                     ^
a.cc:45:2: warning: control reaches end of non-void function [-Wreturn-type]
   45 | }
      |  ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <stdio.h>
#include <ctype.h>
using namespace std;

#define N_MAX   (100000)
#define LL_MAX_NUM (1LL<<60)

typedef long long ll;
typedef long long int lli;

void chmin(int &a, int b) { if (a > b) a = b; }

int 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; // A, B, C いずれも竹は 1 本は必ず使ってないとダメ
        return abs(a - A) + abs(b - B) + abs(c - C); // 合体してできた a, b, c を A, B, C にするコスト
    }

    // 今ある竹を採用しない場合
    int res = rec(i+1, a, b, c);
    
    // A, B, C を使う場合。
    // (a ? 10 : 0) とかは、最初の 1 本目は合体コストなし、2 本目からはコスト 10 かかることを意味する
    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:26:36: error: 'INF' was not declared in this scope
   26 |         if (!a || !b || !c) return INF; // A, B, C いずれも竹は 1 本は必ず使ってないとダメ
      |                                    ^~~
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

int N,A,B,C,ans = 1e9;
vector<int> L;

void dfs(int n,int add,int a,int b,int c){
	if(n == N){
		ans = min(ans,abs(A - a) + abs(B - b) + abs(C - c) + add * 10);
		return;
	}

	dfs(n + 1,a,b,c);
	dfs(n + 1,add + 1, a + L[n],b,c);
	dfs(n + 1,add + 1, a,b + L[n],c);
	dfs(n + 1,add + 1, a,b,c + L[n]);
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

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

	REP(i,N){
		int x;
		cin >> x;
		L.push_back(x);
	}

	
	dfs(0,0,0,0,0);

	cout << ans << endl;

}

Compiler output:
a.cc: In function 'void dfs(int, int, int, int, int)':
a.cc:15:12: error: too few arguments to function 'void dfs(int, int, int, int, int)'
   15 |         dfs(n + 1,a,b,c);
      |         ~~~^~~~~~~~~~~~~
a.cc:9:6: note: declared here
    9 | void dfs(int n,int add,int a,int b,int c){
      |      ^~~
Language: C++

#include <iostream>
#include <vector>
#include <deque>
#include <map>
#include <limits.h>
using namespace std;

int N, A, B, C;
vector<int> bamboo;
map<int, int> m;

int rec(int a, int b, int c, int index, int mp, int use)
{
    if (index == bamboo.size())
    {
        if (use == 0b111)
        {
            return abs(A - a) + abs(B - b) + abs(C - c) - 30 + mp;
        }
        else
        {
            return INT_MAX;
        }
    }

    int first = bamboo[index];

    int ans1 = rec(a, b, c, index + 1, mp, use);
    int ans2 = rec(a + first, b, c, index + 1, mp + 10, use | 0b100);
    int ans3 = rec(a, b + first, c, index + 1, mp + 10, use | 0b010);
    int ans4 = rec(a, b, c + first, index + 1, mp + 10, use | 0b001);

    return min({ans1, ans2, ans3, ans4});
}

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

    for (int i = 0; i < N; i++)
    {
        int bi;
        cin >> bi;
        bamboo.push_back(bi);
    }

    cout << rec(0, 0, 0, 0, 0, 0) << endl;
}

Compiler output:
a.cc: In function 'int rec(int, int, int, int, int, int)':
a.cc:33:15: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   33 |     return min({ans1, ans2, ans3, ans4});
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
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, 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
Language: C++

#include <iostream>
#include <vector>
#include <deque>
#include <map>
using namespace std;

int N, A, B, C;
vector<int> bamboo;
map<int, int> m;

int rec(int a, int b, int c, int index, int mp, int use)
{
    if (index == bamboo.size())
    {
        if (use == 0b111)
        {
            return abs(A - a) + abs(B - b) + abs(C - c) - 30 + mp;
        }
        else
        {
            return INT_MAX;
        }
    }

    int first = bamboo[index];

    int ans1 = rec(a, b, c, index + 1, mp, use);
    int ans2 = rec(a + first, b, c, index + 1, mp + 10, use | 0b100);
    int ans3 = rec(a, b + first, c, index + 1, mp + 10, use | 0b010);
    int ans4 = rec(a, b, c + first, index + 1, mp + 10, use | 0b001);

    return min({ans1, ans2, ans3, ans4});
}

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

    for (int i = 0; i < N; i++)
    {
        int bi;
        cin >> bi;
        bamboo.push_back(bi);
    }

    cout << rec(0, 0, 0, 0, 0, 0) << endl;
}

Compiler output:
a.cc: In function 'int rec(int, int, int, int, int, int)':
a.cc:21:20: error: 'INT_MAX' was not declared in this scope
   21 |             return INT_MAX;
      |                    ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <map>
  +++ |+#include <climits>
    5 | using namespace std;
a.cc:32:15: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   32 |     return min({ans1, ans2, ans3, ans4});
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
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, 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
Language: C++

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

const enum treeNums { Not, ANum, BNum, CNum};

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

  int depth = pow(4, N);

  vector<vector<int>> base4_Array(pow(4, N), vector<int>(N));

  for (int i = 0; i < depth; i++) {
    int remainder = i;
    for(int j = 0; j < N; j++) {
      int quotient = (remainder / (pow(4, (N - 1) - j)));
      remainder %= pow(4, (N - 1) -j);
      base4_Array[i][j] = quotient;
    }
  }

  vector<int> costList(depth);
  for (int i = 0; i < depth; i++) {
    int cost = 0;
    int connectLengthA = 0;
    int connectLengthB = 0;
    int connectLengthC = 0;
    for (int j = 0; j < N; j++) {
      int base4 = base4_Array[i][j];
      if (base4 == ANum) {
        connectLengthA += ls[j];
        cost += 10;
      } else if (base4 == BNum) {
        connectLengthB += ls[j];
        cost += 10;
      } else if (base4 == CNum) {
        connectLengthC += ls[j];
        cost += 10;
      }
      if ((connectLengthA != 0) && (connectLengthB != 0) && (connectLengthC != 00)) {
        cost = (abs(connectLengthA - A) + abs(connectLengthB - B) + abs(connectLengthC - C) - 30);
      } else {
        cost = 1e9;
      }
    }
  }

  sort(costList.begin(), costList.end());
  cout << costList[0] << endl;
};

Compiler output:
a.cc:4:1: error: 'const' can only be specified for objects and functions
    4 | const enum treeNums { Not, ANum, BNum, CNum};
      | ^~~~~
a.cc: In function 'int main()':
a.cc:22:17: error: invalid operands of types 'int' and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
   22 |       remainder %= pow(4, (N - 1) -j);
      |       ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:22:17: note:   in evaluation of 'operator%=(int, __gnu_cxx::__promote<double>::__type {aka double})'
Language: C++

void dfs(int depth){
  if(depth == N) calc(v);
  for(int i = 0; i<4 i++){
    v[depth]i;
    dfs(depth+1,v);
  }
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:2:15: error: 'N' was not declared in this scope
    2 |   if(depth == N) calc(v);
      |               ^
a.cc:2:23: error: 'v' was not declared in this scope
    2 |   if(depth == N) calc(v);
      |                       ^
a.cc:2:18: error: 'calc' was not declared in this scope
    2 |   if(depth == N) calc(v);
      |                  ^~~~
a.cc:3:21: error: expected ';' before 'i'
    3 |   for(int i = 0; i<4 i++){
      |                     ^~
      |                     ;
a.cc:4:5: error: 'v' was not declared in this scope
    4 |     v[depth]i;
      |     ^
Language: C++

void dfs(int depth){
  if(depth = N) calc(v);
  for(int i = o; i<4 i++){
    v[depth]i;
    dfs(depth+1,v);
  }
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:2:14: error: 'N' was not declared in this scope
    2 |   if(depth = N) calc(v);
      |              ^
a.cc:2:22: error: 'v' was not declared in this scope
    2 |   if(depth = N) calc(v);
      |                      ^
a.cc:2:17: error: 'calc' was not declared in this scope
    2 |   if(depth = N) calc(v);
      |                 ^~~~
a.cc:3:15: error: 'o' was not declared in this scope
    3 |   for(int i = o; i<4 i++){
      |               ^
a.cc:3:21: error: expected ';' before 'i'
    3 |   for(int i = o; i<4 i++){
      |                     ^~
      |                     ;
a.cc:4:5: error: 'v' was not declared in this scope
    4 |     v[depth]i;
      |     ^
Language: C++

#include <iostream>
#include <stack>
#include <cstdio>
#include <queue>
#include <vector>
using namespace std;
#define endl "\n"

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

int dfs(int k,int a,int b,int c){
    int ans=1e9;
    if(k==N){
        if(a==0||b==0||c==0)return 1e9;
        return abs(a-A)+abs(b-B)+abs(c-C);
    }
    ans=min(2,3);
    ans=min({dfs(k+1,a,b,c),dfs(k+1,a+l[k],b,c),dfs(k+1,a,b+l[k],c),dfs(k+1,a,b,c+l[k])});
    
    return ans;
}

int main(int argc, const char * argv[]) {
    ios::sync_with_stdio(false);
    cin>>N>>A>>B>>C;
    for(int i=0;i<8;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:19:12: error: no matching function for call to 'min(<brace-enclosed initializer list>)'
   19 |     ans=min({dfs(k+1,a,b,c),dfs(k+1,a+l[k],b,c),dfs(k+1,a,b+l[k],c),dfs(k+1,a,b,c+l[k])});
      |         ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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, 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
Language: C

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
#include <iostream>
 
inline int min(int x, int y) {return x < y ? x : y;}
inline long min(long x, long y) {return x < y ? x : y;}
inline int max(int x, int y) {return x > y ? x : y;}
inline long max(long x, long y) {return x > y ? x : y;}
 
using namespace std;
 
int main() {
    int N, A, B, C;
    int l[8];
    cin >> N >> A >> B >> C;
    for (int i = 0; i < N; i++) {
        cin >> l[i];
    }

    int loop_num = 1;
    for (int i = 0; i < N; i++) {
        loop_num *= 4;
    }
    int min_cost = 100000000;
    for (int s = 0; s < loop_num; s++) {
        int tmp = s;
        int null_cnt = 0;
        int group[4] = {0, 0, 0, 0};
        for (int i = 0; i < N; i++) {
            group[tmp % 4] += l[i];
            if (tmp % 4 == 3) null_cnt++;
            tmp /= 4;
        }

        if (group[0] == 0 || group[1] == 0 || group[2] == 0) continue;

        int cost = (N - null_cnt - 3) * 10;
        cost += abs(group[0] - A);
        cost += abs(group[1] - B);
        cost += abs(group[2] - C);
        min_cost = min(min_cost, cost);
    }

    cout << min_cost << endl;
}


Compiler output:
main.c:6:10: fatal error: iostream: No such file or directory
    6 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C++

using namespace std;
int n,a,b,c,v[10];
int solve(int k,int x,int y,int z) {
    if(k==n+1) {
        int ans=abs(a-x)+abs(b-y)+abs(c-z);
        if(x==0||y==0||z==0)
            return 10000;
        return ans;
    }
    int ans=min(solve(k+1,x+v[k],y,z)+10,solve(k+1,x,y+v[k],z)+10);
    ans=min(ans,solve(k+1,x,y,z+v[k])+10);
    ans=min(ans,solve(k+1,x,y,z));
    return ans;
}
int main() {
    int i;
    cin >> n >> a >> b >> c;
    for(i=1;i<=n;i++)
        cin >> v[i];
    cout << solve(1,0,0,0)-30;
    return 0;
}

Compiler output:
a.cc: In function 'int solve(int, int, int, int)':
a.cc:5:17: error: 'abs' was not declared in this scope; did you mean 'ans'?
    5 |         int ans=abs(a-x)+abs(b-y)+abs(c-z);
      |                 ^~~
      |                 ans
a.cc:10:13: error: 'min' was not declared in this scope
   10 |     int ans=min(solve(k+1,x+v[k],y,z)+10,solve(k+1,x,y+v[k],z)+10);
      |             ^~~
a.cc: In function 'int main()':
a.cc:17:5: error: 'cin' was not declared in this scope
   17 |     cin >> n >> a >> b >> c;
      |     ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | using namespace std;
a.cc:20:5: error: 'cout' was not declared in this scope
   20 |     cout << solve(1,0,0,0)-30;
      |     ^~~~
a.cc:20:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

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


vector<int> v( 9, 0 );
vector<int> l( 9, 0 );
int ans = INT_MAX;
int A, B, C;
int N;

void calc()
{
	int a = 0, b = 0, c = 0;
	int mp = 0;
	for( int i = 0; i < N; ++i )
	{
		if( v[i] == 1 )
		{
			if( a != 0 ) mp += 10;
			a += l[i];
		}
		else if( v[i] == 2 )
		{
			if( b != 0 ) mp += 10;
			b += l[i];
		}
		else if( v[i] == 3 )
		{
			if( c != 0 ) mp += 10;
			c += l[i];
		}
	}
	
	mp += abs( A - a ) + abs( B - b ) + abs( C - c );
	ans = min( ans, mp );
}

void dfs( int depth )
{
	if( depth == N )
	{
		calc();
		return;
	}

	for( int i = 0; i < 4; ++i )
	{
		v[depth] = i;
		dfs( depth + 1);
	}
}

int main()
{


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

	cout << ans << endl;
	return 0;
}

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

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

int N,a,b,c,ans;

void dfs(int now, int sa, int sb, int sc, int na, int nb, int nc) {
    if (now > N) {
        if (na > 0 && nb > 0 && nc > 0) {
            int cost = (na + nb + nc - 3) * 10;
            cost += abs(sa - a) + abs(sb - b) + abs(sc - c);
            ans = min(ans, cost);
        }
        return 0;
    }
    dfs(now + 1, sa, sb, sc, na, nb, nc);
    dfs(now + 1, sa + a[now], sb, sc, na + 1, nb, nc);
    dfs(now + 1, sa, sb + a[now], sc, na, nb + 1, nc);
    dfs(now + 1, sa, sb, sc + a[now], na, nb, nc + 1);
}

int main(){
    cin>>N>>a>>b>>c;
    int a[10];
    for(int i = 1; i <= N; i++)
        cin>>a[i];
    ans=1000000000;
    dfs(1,0,0,0,0,0,0);
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'void dfs(int, int, int, int, int, int, int)':
a.cc:14:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   14 |         return 0;
      |                ^
a.cc:17:24: error: invalid types 'int[int]' for array subscript
   17 |     dfs(now + 1, sa + a[now], sb, sc, na + 1, nb, nc);
      |                        ^
a.cc:18:28: error: invalid types 'int[int]' for array subscript
   18 |     dfs(now + 1, sa, sb + a[now], sc, na, nb + 1, nc);
      |                            ^
a.cc:19:32: error: invalid types 'int[int]' for array subscript
   19 |     dfs(now + 1, sa, sb, sc + a[now], na, nb, nc + 1);
      |                                ^
Language: C++

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

int N,a,b,c;

void dfs(int now, int sa, int sb, int sc, int na, int nb, int nc) {
    if (now > N) {
        if (na > 0 && nb > 0 && nc > 0) {
            int cost = (na + nb + nc - 3) * 10;
            cost += abs(sa - a) + abs(sb - b) + abs(sc - c);
            ans = min(ans, cost);
        }
        return 0;
    }
    dfs(now + 1, sa, sb, sc, na, nb, nc);
    dfs(now + 1, sa + a[now], sb, sc, na + 1, nb, nc);
    dfs(now + 1, sa, sb + a[now], sc, na, nb + 1, nc);
    dfs(now + 1, sa, sb, sc + a[now], na, nb, nc + 1);
}

int main(){
    cin>>N>>a>>b>>c;
    int a[10];
    for(int i = 1; i <= N; i++)
        cin>>a[i];
    ans=1000000000;
    dfs(1,0,0,0,0,0,0);
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'void dfs(int, int, int, int, int, int, int)':
a.cc:12:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   12 |             ans = min(ans, cost);
      |             ^~~
      |             abs
a.cc:14:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   14 |         return 0;
      |                ^
a.cc:17:24: error: invalid types 'int[int]' for array subscript
   17 |     dfs(now + 1, sa + a[now], sb, sc, na + 1, nb, nc);
      |                        ^
a.cc:18:28: error: invalid types 'int[int]' for array subscript
   18 |     dfs(now + 1, sa, sb + a[now], sc, na, nb + 1, nc);
      |                            ^
a.cc:19:32: error: invalid types 'int[int]' for array subscript
   19 |     dfs(now + 1, sa, sb, sc + a[now], na, nb, nc + 1);
      |                                ^
a.cc: In function 'int main()':
a.cc:27:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   27 |     ans=1000000000;
      |     ^~~
      |     abs
Language: C++

#include <iostream>
using namespace std;

int N,a,b,c;

void dfs(int now, int sa, int sb, int sc, int na, int nb, int nc) {
    if (now > N) {
        if (na > 0 && nb > 0 && nc > 0) {
            int cost = (na + nb + nc - 3) * 10;
            cost += abs(sa - a) + abs(sb - b) + abs(sc - c);
            ans = min(ans, cost);
        }
        return 0;
    }
    dfs(now + 1, sa, sb, sc, na, nb, nc);
    dfs(now + 1, sa + a[now], sb, sc, na + 1, nb, nc);
    dfs(now + 1, sa, sb + a[now], sc, na, nb + 1, nc);
    dfs(now + 1, sa, sb, sc + a[now], na, nb, nc + 1);
}

int main(){
    cin>>N>>a>>b>>c;
    int a[10];
    for(int i = 1; i <= N; i++)
        cin>>a[i];
    ans=1000000000;
    dfs(1,0,0,0,0,0,0);
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'void dfs(int, int, int, int, int, int, int)':
a.cc:11:13: error: 'ans' was not declared in this scope; did you mean 'abs'?
   11 |             ans = min(ans, cost);
      |             ^~~
      |             abs
a.cc:13:16: error: return-statement with a value, in function returning 'void' [-fpermissive]
   13 |         return 0;
      |                ^
a.cc:16:24: error: invalid types 'int[int]' for array subscript
   16 |     dfs(now + 1, sa + a[now], sb, sc, na + 1, nb, nc);
      |                        ^
a.cc:17:28: error: invalid types 'int[int]' for array subscript
   17 |     dfs(now + 1, sa, sb + a[now], sc, na, nb + 1, nc);
      |                            ^
a.cc:18:32: error: invalid types 'int[int]' for array subscript
   18 |     dfs(now + 1, sa, sb, sc + a[now], na, nb, nc + 1);
      |                                ^
a.cc: In function 'int main()':
a.cc:26:5: error: 'ans' was not declared in this scope; did you mean 'abs'?
   26 |     ans=1000000000;
      |     ^~~
      |     abs