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

#include<iostream>
#include<vector>
#include<limits>

using namespace std;

int MAX = numeric_limits<int>().max()/16;
vector<vector<int>> cost;

int make(vector<int> &l, int target){
  int s = 0;
  for( auto &ll : l){
    s += l;
  }
  return l.size() + abs(target-s);
}

int main(){
  cost.resize(3);
  cost[0].resize(256, MAX);
  cost[1].resize(256, MAX);
  cost[2].resize(256, MAX);
  int N, A, B, C;
  cin >> N >> A >> B >> C;
  vector<int> l(N);
  for( int i = 0; i < N; ++i ){
    cin >> l[i];
  }
  int b = 1<<N;
  for( int i = 0; i < b; ++i ){
    vector<int> ll;
    for( j = 1; j < b; b<<=1 ){
      if( i & j == 0 ){ continue; }
      ll.emplace_back(l[i]);
    }
    cost[0][i] = make(ll, A);
    cost[1][i] = make(ll, B);
    cost[2][i] = make(ll, C);
  }
  for( int i = 0; i < 65536; ++i ){
    int a = (i & ((1<<8)-1));
    int b = (i & ((1<<16)-1)) >> 8;
    int c = (i & ((1<<24)-1)) >> 16;
    if( a & b ){ continue; }
    if( a & c ){ continue; }
    if( b & c ){ continue; }
    if( ((a|b|c) & (255<<(N-2))) ){ continue; }
    tmp = cost[0][a] + cost[1][b] + cost[2][c];
    if( tmp < ans ){ ans = tmp; }
  }
  cout << ans << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int make(std::vector<int>&, int)':
a.cc:13:7: error: no match for 'operator+=' (operand types are 'int' and 'std::vector<int>')
   13 |     s += l;
      |     ~~^~~~
a.cc: In function 'int main()':
a.cc:32:10: error: 'j' was not declared in this scope
   32 |     for( j = 1; j < b; b<<=1 ){
      |          ^
a.cc:48:5: error: 'tmp' was not declared in this scope; did you mean 'tm'?
   48 |     tmp = cost[0][a] + cost[1][b] + cost[2][c];
      |     ^~~
      |     tm
a.cc:49:15: error: 'ans' was not declared in this scope; did you mean 'abs'?
   49 |     if( tmp < ans ){ ans = tmp; }
      |               ^~~
      |               abs
a.cc:51:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   51 |   cout << ans << endl;
      |           ^~~
      |           abs
Language: C

#include <stdio.h>
#include <stdlib.h>

int comp[3];
int N, A, B, C, MP = 0;
int *l;

int main (void) {
  scanf("%d %d %d %d", &N, &A, &B, &C);
  l = malloc(sizeof(int) * N);
  
  for (int i = 0; i < N; i++) {
    scanf("%d", &(l[i]));
  }
  
  while (1) {
    finishCheck();
    extend();
    shorten();
  }
  
  return 0;
}

void extend() {
  for (int i = 0; i < N; i++) {
    if ((A - l[i]) >= 0 && (A - l[i]) <= 10 && comp[0] == 0) {
      MP += (A - l[i]);
      l[i] = -9999;
      comp[0] = 1;
    }
    if ((B - l[i]) >= 0 && (B - l[i]) <= 10 && comp[1] == 0) {
      MP += (B - l[i]);
      l[i] = -9999;
      comp[1] = 1;
    }
    if ((C - l[i]) >= 0 && (C - l[i]) <= 10 && comp[2] == 0) {
      MP += (C - l[i]);
      l[i] = -9999;
      comp[2] = 1;
    }
  }
  return;
}

void shorten() {
  for (int i = 0; i < N; i++) {
    if ((l[i] - A) >= 0 && (l[i] - A) <= 10 && comp[1] == 0) {
      MP += (l[i] - A);
      l[i] = -9999;
      comp[0] = 1;
    }
    if ((l[i] - B) >= 0 && (l[i] - B) <= 10 && comp[1] == 0) {
      MP += (l[i] - B);
      l[i] = -9999;
      comp[1] = 1;
    }
    if ((l[i] - C) >= 0 && (l[i] - C) <= 10 && comp[1] == 0) {
      MP += (l[i] - C);
      l[i] = -9999;
      comp[2] = 1;
    }
  }
  return;
}



Compiler output:
main.c: In function 'main':
main.c:17:5: error: implicit declaration of function 'finishCheck' [-Wimplicit-function-declaration]
   17 |     finishCheck();
      |     ^~~~~~~~~~~
main.c:18:5: error: implicit declaration of function 'extend' [-Wimplicit-function-declaration]
   18 |     extend();
      |     ^~~~~~
main.c:19:5: error: implicit declaration of function 'shorten' [-Wimplicit-function-declaration]
   19 |     shorten();
      |     ^~~~~~~
main.c: At top level:
main.c:25:6: warning: conflicting types for 'extend'; have 'void()'
   25 | void extend() {
      |      ^~~~~~
main.c:18:5: note: previous implicit declaration of 'extend' with type 'void()'
   18 |     extend();
      |     ^~~~~~
main.c:46:6: warning: conflicting types for 'shorten'; have 'void()'
   46 | void shorten() {
      |      ^~~~~~~
main.c:19:5: note: previous implicit declaration of 'shorten' with type 'void()'
   19 |     shorten();
      |     ^~~~~~~
Language: Java

import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    ArrayList<Integer> l = new ArrayList<>();
    ArrayList<Integer> ans = new ArrayList<>();
    ans.add(A);
    ans.add(B);
    ans.add(C);
    int mp = 0;
    for (int i = 0; i < N; i++) {
      tmp = sc.nextInt();
      for (int j = 0; j < 3; i++)
        if (tmp == ans.get(j)) {
          ans.remove(j);
          break;
        }
      l.add(tmp);
    }
    if (ans.size() == 0) {
      System.out.println(mp);
      return;
    }
    Collections.sort(ans);
    Collections.sort(l);
    for (int j = 0; j < ans.size(); j++) {
      for (int i = 0; i < l.size(); i++) {
        if (ans.get(j) - l.get(i) <= 10) {
          mp += Math.abs(ans.get(j) - l.get(i));
          ans.remove(j);
          l.remove(i);
          break;
        }
      }
    }
    if (ans.size() == 0) {
      System.out.println(mp);
      return;
    }
    int min = Integer.MAX_VALUE;
    for (int k = 0; k < ans.size(); k++) {
      int sum = 0;
      for (int i = 0; i < l.size() - 1; i++) {
        int set = l.get(i);
        sum = set;
        for (int j = i + 1; j < l.size(); j++) {
          min = Math.min(ans.get(k) - set + l.get(j), min);
          sum += l.get(j);
        }
      }
      if ((Math.abs(ans.get(k) - sum) + 20) > (Math.abs(ans.get(k) - min) + 20 * (l.size() - 1))) {
        mp += Math.abs(ans.get(k) - min) + 20 * (l.size() - 1);
      } else {
        mp += Math.abs(ans.get(k) - sum) + 20;
      }
    }
    System.out.println(mp);
  }
}


Compiler output:
Main.java:17: error: cannot find symbol
      tmp = sc.nextInt();
      ^
  symbol:   variable tmp
  location: class Main
Main.java:19: error: cannot find symbol
        if (tmp == ans.get(j)) {
            ^
  symbol:   variable tmp
  location: class Main
Main.java:23: error: cannot find symbol
      l.add(tmp);
            ^
  symbol:   variable tmp
  location: class Main
3 errors
Language: C++

#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(ll i=0;i<n;i++)
#define ll long long
#define double long double
using namespace std;
ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x * y / gcd(x, y);
}
bool prime(ll n) {
	for (int i = 2; i*i <= n; i++) {
		if (n%i == 0)return false;
	}
	return true;
}
ll n, a, b, c, cnt = 0, infa = 0, infb = 0, infc = 0; ll s[10];
signed main() {
	cin >> n >> a >> b >> c;
	rep(i, n)cin >> s[i];
	sort(s, s + n);
	rep(i, n)cnt += s[i];
	rep(i, n) {
		if (s[i] - a <= 10) {
			cnt -= 10 - (s[i] - a);
			infa = 1;
			if (s[i] - b <= 10) {
				cnt -= 10 - (s[i] - b);
				infb = 1;
			}
			if (s[i] - c <= 10) {
				cnt -= 10 - (s[i] - c);
				infc = 1;
			}
	}
		cout << cnt + 10 * n - 3 - (infa + infb + infc) << endl;
	getchar(); getchar(); return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:49:2: error: expected '}' at end of input
   49 | }
      |  ^
a.cc:29:15: note: to match this '{'
   29 | signed main() {
      |               ^
Language: C++

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

int intpow(int x,int y){
  double a=x,b=y;
  return pow(a,b);
}//(x,y) xをy乗する

int intfabs(int x){
  double a=x;
  return fabs(a);
}//(x) の絶対値

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//配列の受け取り

int tree(int,vector<int>*,int,int*);

main(){
  int n=in(),a[3],mp=0;
  forin(a,3);
  vector<int> l(n);
  for (int i=0;i<n;i++) cin >> l[i];
  sort(l.begin(),l.end());
  for (int t=3;t>0;t--){
    mp+=tree(t,l,n,a);
  }
  cout << mp << endl;
}

int tree(int t,int* l,int n,int* a){
  int mp=0;
  for (int i=0;true;i++){
    if (l[i]==a[t]){
      l[i]=-1;
      break;
    }
    else if (l[i]>a[t]){
      if (l[i]-a[t]<11 && a[t]-l[i-1]<11){
        mp+=min(l[i]-a[t],a[t]-l[i-1]);
        if (l[i]-a[t]>a[t]-l[i-1]) l[i-1]=-1;
        else (l[i]-a[t]<=a[t]-l[i-1]) l[i]=-1;
      }
      else {
        mp+=10;

        mp+=min(tree(t,l,n,a[t]-l[i-1]),tree(t,l,n,l[i]-a[t]));
      }
    }
  }
  return mp;
}

Compiler output:
a.cc:28:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   28 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:35:16: error: cannot convert 'std::vector<int>' to 'std::vector<int>*'
   35 |     mp+=tree(t,l,n,a);
      |                ^
      |                |
      |                std::vector<int>
a.cc:26:14: note:   initializing argument 2 of 'int tree(int, std::vector<int>*, int, int*)'
   26 | int tree(int,vector<int>*,int,int*);
      |              ^~~~~~~~~~~~
a.cc: In function 'int tree(int, int*, int, int*)':
a.cc:51:38: error: expected ';' before 'l'
   51 |         else (l[i]-a[t]<=a[t]-l[i-1]) l[i]=-1;
      |                                      ^~
      |                                      ;
a.cc:56:32: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   56 |         mp+=min(tree(t,l,n,a[t]-l[i-1]),tree(t,l,n,l[i]-a[t]));
      |                            ~~~~^~~~~~~
      |                                |
      |                                int
a.cc:40:34: note:   initializing argument 4 of 'int tree(int, int*, int, int*)'
   40 | int tree(int t,int* l,int n,int* a){
      |                             ~~~~~^
a.cc:56:56: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   56 |         mp+=min(tree(t,l,n,a[t]-l[i-1]),tree(t,l,n,l[i]-a[t]));
      |                                                    ~~~~^~~~~
      |                                                        |
      |                                                        int
a.cc:40:34: note:   initializing argument 4 of 'int tree(int, int*, int, int*)'
   40 | int tree(int t,int* l,int n,int* a){
      |                             ~~~~~^
Language: Java

package Lambai;

import java.util.Arrays;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue;
import java.util.Scanner;

public class B119C {

	public static void main(String[] args) {
		
		new B119C();
	}
	
	public B119C() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int l[] = new int[n];
		for (int i=0;i<l.length;i++)
			l[i] = sc.nextInt();
		State start = new State(l);
		State goal = new State(new int[] {a,b,c});
		PriorityQueue<State> Open = new PriorityQueue<State>(100000000, new Comparator<State>() {
			@Override
			public int compare(State o1, State o2) {
				return o1.g+o1.h - o2.g - o2.h;
			}
		});
		State O = null;
		Map<String,State> closed = new HashMap<>();
		start.h=dis(start,goal);
		Open.add(start);
		closed.put(start.key(), start);
		while (Open.size()>0) {
			//System.out.println(Open.size());
			O = Open.remove();
			if (equal(O,goal)) break;
			for (int i=0;i<8;i++) {
				int cl[] = O.a.clone();
				if (cl[i]<1) continue;
				cl[i]++;
				State sn = new State(cl);
				if (closed.get(sn.key())!=null) continue;
				sn.g = O.g+1;
				sn.h = dis(sn,goal);
				sn.cha = O;
				Open.add(sn);
				closed.put(sn.key(), sn);
			}
			for (int i=0;i<8;i++) {
				int cl[] = O.a.clone();
				if (cl[i]<2) continue;
				cl[i]--;
				State sn = new State(cl);
				if (closed.get(sn.key())!=null) continue;
				sn.g = O.g+1;
				sn.h = dis(sn,goal);
				sn.cha = O;
				Open.add(sn);
				closed.put(sn.key(), sn);
			}
			
			for (int i=1;i<8;i++) {
				int cl[] = O.a.clone();
				if (cl[i-1]<1 || cl[i]<1) continue;
				cl[i]+=cl[i-1];
				cl[i-1] = 0;
				State sn = new State(cl);
				if (closed.get(sn.key())!=null) continue;
				sn.g = O.g+10;
				sn.h = dis(sn,goal);
				sn.cha = O;
				Open.add(sn);
				closed.put(sn.key(), sn);
			}
		}
		System.out.println(O.g);
	}

	private boolean equal(State x, State y) {
		return dis(x,y)==0;
	}

	private int dis(State x, State y) {
		int min = 1000000000;
		for (int i=0;i<8;i++)
			for (int j=i+1;j<8;j++)
				for (int k=j+1;k<8;k++)
				{
					int di = Math.abs(x.a[k]-y.a[7])+Math.abs(x.a[j]-y.a[6])+Math.abs(x.a[i]-y.a[5]);
					if (min>di) min = di;
				}
		return min;
	}

}

class State{
	State cha = null;
	int g=0,h=0;
	int a[] = new int[8];
	public State(int[] a) {
		for (int i=0;i<this.a.length;i++)
			if (i<a.length)
				this.a[i] = a[i];
			else this.a[i] = 0;
		Arrays.sort(this.a);
	}
	public String key() {
		String s="";
		for (int i=0;i<this.a.length;i++)
			s+=this.a[i]+",";
		return s;
	}
}


Compiler output:
Main.java:10: error: class B119C is public, should be declared in a file named B119C.java
public class B119C {
       ^
1 error
Language: Java

import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    ArraysList<Integer> l = new ArraysList<>();
    ArraysList<Integer> ans = new ArraysList<>();
    ans.add(A);
    ans.add(B);
    ans.add(C);
    for (int i = 0; i < N; i++) {
      tmp = sc.nextInt();
      for (int j = 0; j < 3; i++)
        if (tmp == ans.get(j)) {
          ans.remove(j);
          break;
        }
      l.add(tmp);
    }
    Collections.sort(ans);
    Collections.sort(l);
    for (int j = 0; j < ans.size(); j++) {
      for (int i = 0; i < l.size(); i++) {
        if (ans.get(j) - l.get(i) <= 10) {
          mp += Math.abs(ans.get(j) - l.get(i));
          ans.remove(j);
          l.remove(i);
          break;
        }
      }
    }
    int min = Integer.MAX_VALUE;
    for (int k = 0; k < ans.size(); k++) {
      int sum = 0;
      for (int i = 0; i < l.size() - 1; i++) {
        int set = l.get(i);
        sum = set;
        for (int j = i + 1; j < l.size(); j++) {
          min = Math.min(ans.get(k) - set + l.get(j), min);
          sum += l.get(j);
        }
      }
      if (Math.abs(ans.get(k) - min) > Math.abs(ans.get(k) - sum)) {
        mp += Math.abs(ans.get(k) - sum) + 20;
      } else {
        mp += Math.abs(ans.get(k) - min);
      }
    }

  }
}

Compiler output:
Main.java:10: error: cannot find symbol
    ArraysList<Integer> l = new ArraysList<>();
    ^
  symbol:   class ArraysList
  location: class Main
Main.java:10: error: cannot find symbol
    ArraysList<Integer> l = new ArraysList<>();
                                ^
  symbol:   class ArraysList
  location: class Main
Main.java:11: error: cannot find symbol
    ArraysList<Integer> ans = new ArraysList<>();
    ^
  symbol:   class ArraysList
  location: class Main
Main.java:11: error: cannot find symbol
    ArraysList<Integer> ans = new ArraysList<>();
                                  ^
  symbol:   class ArraysList
  location: class Main
Main.java:16: error: cannot find symbol
      tmp = sc.nextInt();
      ^
  symbol:   variable tmp
  location: class Main
Main.java:18: error: cannot find symbol
        if (tmp == ans.get(j)) {
            ^
  symbol:   variable tmp
  location: class Main
Main.java:22: error: cannot find symbol
      l.add(tmp);
            ^
  symbol:   variable tmp
  location: class Main
Main.java:29: error: cannot find symbol
          mp += Math.abs(ans.get(j) - l.get(i));
          ^
  symbol:   variable mp
  location: class Main
Main.java:48: error: cannot find symbol
        mp += Math.abs(ans.get(k) - sum) + 20;
        ^
  symbol:   variable mp
  location: class Main
Main.java:50: error: cannot find symbol
        mp += Math.abs(ans.get(k) - min);
        ^
  symbol:   variable mp
  location: class Main
10 errors
Language: C++

#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <vector>
#include <list>
#include <math.h>
#include <iomanip>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;


int const static N = 10;
int l[N];
int n;

// return sunsumed MP.
int dp(int now_rest , int mp, bool first){

  //cout << "FIRST ===="<<endl;
  //cout << "rest:"<<now_rest<<",mp:"<<mp<<endl;
  if( !first && now_rest == 0){
    return mp;
  }

  if ( !first && abs(now_rest) <= 10 ){
    return mp + abs(now_rest);
  }

  int sel = 0;
  int new_rest = abs(now_rest - l[sel]);
  rep(i,n){
    if( new_rest > abs(now_rest - l[i]) ) {
      sel = i;
      new_rest = abs(now_rest - l[i]);
    }
  }
  l[sel] = 0;

  if(new_rest == now_rest){
    return mp + abs(now_rest);
  }
  //cout << "new_rest:" << new_rest << endl;
  //cout << "END ===" << endl;
  if( first ) {
    return dp(new_rest, mp, false);
  }else {
    return dp(new_rest, mp+10, false);
  }
  
}

int main(){
  cin>>n;
  int a;cin>>a;
  int b;cin>>b;
  int c;cin>>c;
  rep(i,n) cin>>l[i];


  sort(l, l+n);

  int mp = 0;
  
  mp += dp(a,0, true);
  //cout << "mp:" <<mp << endl;
  mp += dp(b,0, true);
  //cout << "mp:" <<mp << endl;
  mp += dp(c,0, true);

  //cout << "mp:" <<mp << endl;
  cout << <<mp << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:72:11: error: expected primary-expression before '<<' token
   72 |   cout << <<mp << endl;
      |           ^~
Language: C++

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

using namespace std;

vector<int> l;
int ia,ib,ic;

int solve(int a,int b,int c,int index,int cost) {
  if(index == l.size())
    if(ia == a || ib == b || ic == c) return 112345678;
    else return abs(a) + abs(b) + abs(c) + cost;
  vector<int> ans = {
    solve(a-l[index], b, c, index + 1, cost + 10),
    solve(a, b-l[index], c, index + 1, cost + 10),
    solve(a, b, c-l[index], index + 1, cost + 10),
    solve(a, b, c, index + 1, cost + 10)
  };
  sort(ans.begin(), ans.end());
  return ans[0];
}

int main(void)
{
  int n;
  cin >> n >> ia >> ib >> ic;
  REP(i, n) {
    int x;
    cin >> x;
    l.push_back(x);
  }
  cout << solve(a,b,c,0,-30) << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:34:17: error: 'a' was not declared in this scope
   34 |   cout << solve(a,b,c,0,-30) << endl;
      |                 ^
a.cc:34:19: error: 'b' was not declared in this scope
   34 |   cout << solve(a,b,c,0,-30) << endl;
      |                   ^
a.cc:34:21: error: 'c' was not declared in this scope
   34 |   cout << solve(a,b,c,0,-30) << endl;
      |                     ^
Language: C++

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

using namespace std;

vector<int> l;
int ia,ib,ic;

int solve(int a,int b,int c,int index,int cost) {
  if(index == l.size())
    if(ia == a || ib == b || ic == c) return 112345678;
    else return abs(a) + abs(b) + abs(c) + cost;
  vector<int> ans = {
    solve(a-l[index], b, c, index + 1, cost + 10),
    solve(a, b-l[index], c, index + 1, cost + 10),
    solve(a, b, c-l[index], index + 1, cost + 10),
    solve(a, b, c, index + 1, cost + 10)
  };
  sort(ans.begin(), ans.end());
  return ans[0];
}

int main(void)
{
  int n;
  cin >> n >> ia >> ib >> ic;
  REP(i, n) {
    int x;
    cin >> x;
    l.push_back(l);
  }
  cout << solve(a,b,c,0,-30) << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:16: error: no matching function for call to 'std::vector<int>::push_back(std::vector<int>&)'
   32 |     l.push_back(l);
      |     ~~~~~~~~~~~^~~
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1283:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1283 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1283:35: note:   no known conversion for argument 1 from 'std::vector<int>' to 'const std::vector<int>::value_type&' {aka 'const int&'}
 1283 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/14/bits/stl_vector.h:1300:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; value_type = int]'
 1300 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/14/bits/stl_vector.h:1300:30: note:   no known conversion for argument 1 from 'std::vector<int>' to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1300 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
a.cc:34:17: error: 'a' was not declared in this scope
   34 |   cout << solve(a,b,c,0,-30) << endl;
      |                 ^
a.cc:34:19: error: 'b' was not declared in this scope
   34 |   cout << solve(a,b,c,0,-30) << endl;
      |                   ^
a.cc:34:21: error: 'c' was not declared in this scope
   34 |   cout << solve(a,b,c,0,-30) << endl;
      |                     ^
Language: C++

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

int intpow(int x,int y){
  double a=x,b=y;
  return pow(a,b);
}//(x,y) xをy乗する

int intfabs(int x){
  double a=x;
  return fabs(a);
}//(x) の絶対値

int in(){
  int a;
  cin >> a;
  return a;
}//int型関数の受け取り

void forin(int* x,int y){
  for (int i=0;i<y;i++){
    cin >> x[i];
  }
}//配列の受け取り

int tree(int t,int* l,int n,int* a){
  int mp=0;
  for (int i=0;true;i++){
    if (l[i]==a[t]){
      l[i]=-1;
      break;
    }
    else if (l[i]>a[t]){
      if (l[i]-a[t]<11 && a[t]-l[i-1]<11){
        mp+=min(l[i]-a[t],a[t]-l[i-1]);
        if (l[i]-a[t]>a[t]-l[i-1]) l[i-1]=-1;
        else (l[i]-a[t]<=a[t]-l[i-1]) l[i]=-1;
      }
      else {
        mp+=10;

        mp+=min(tree(t,l,n,a[t]-l[i-1]),tree(t,l,n,l[i]-a[t]))
      }
    }
  }
  return mp;
}

main(){
  int n=in(),a[3],mp=0;
  forin(a,3);
  vector<int> l(n);
  for (int i=0;i<n;i++) cin >> l[i];
  sort(l.begin(),l.end());
  for (int t=3;t>0;t--){
    mp+=tree(t,l,n,a);
  }
  cout << mp << endl;
}


Compiler output:
a.cc: In function 'int tree(int, int*, int, int*)':
a.cc:37:38: error: expected ';' before 'l'
   37 |         else (l[i]-a[t]<=a[t]-l[i-1]) l[i]=-1;
      |                                      ^~
      |                                      ;
a.cc:42:32: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   42 |         mp+=min(tree(t,l,n,a[t]-l[i-1]),tree(t,l,n,l[i]-a[t]))
      |                            ~~~~^~~~~~~
      |                                |
      |                                int
a.cc:26:34: note:   initializing argument 4 of 'int tree(int, int*, int, int*)'
   26 | int tree(int t,int* l,int n,int* a){
      |                             ~~~~~^
a.cc:42:56: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   42 |         mp+=min(tree(t,l,n,a[t]-l[i-1]),tree(t,l,n,l[i]-a[t]))
      |                                                    ~~~~^~~~~
      |                                                        |
      |                                                        int
a.cc:26:34: note:   initializing argument 4 of 'int tree(int, int*, int, int*)'
   26 | int tree(int t,int* l,int n,int* a){
      |                             ~~~~~^
a.cc:42:63: error: expected ';' before '}' token
   42 |         mp+=min(tree(t,l,n,a[t]-l[i-1]),tree(t,l,n,l[i]-a[t]))
      |                                                               ^
      |                                                               ;
   43 |       }
      |       ~                                                        
a.cc: At global scope:
a.cc:49:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   49 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:56:16: error: cannot convert 'std::vector<int>' to 'int*'
   56 |     mp+=tree(t,l,n,a);
      |                ^
      |                |
      |                std::vector<int>
a.cc:26:21: note:   initializing argument 2 of 'int tree(int, int*, int, int*)'
   26 | int tree(int t,int* l,int n,int* a){
      |                ~~~~~^
Language: C++

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

int main(){
  int N,A,B,C,X,mn,ans;
  ans=0;
  cin>>N>>A>>B>>C;
  int L[9];
  for(int i=1; i<=N; ++i){
    L[i]=0;
    cin>>L[i];
  }
  bool Acan=true;
  bool Bcan=true;
  bool Ccan=true;
  for(int i=1; i<=N; ++i){
    if(abs(A-L[i])<=10){
      ans += abs(A-L[i]);
      L[i]=0;
      Acan=false;
      break;
    }
  }
  for(int i=1; i<=N; ++i){
    if(abs(B-L[i])<=10){
      ans += abs(B-L[i]);
      L[i]=0;
      Bcan=false;
      break;
    }
  }
  for(int i=1; i<=N; ++i){
    if(abs(C-L[i])<=10){
      ans += abs(C-L[i]);
      L[i]=0;
      Ccan=false;
      break;
    }
  }
  
  X=A+B+C;
  if(Acan) X -= A;
  if(Bcan) X -= B;
  if(Ccan) X -= C;
  
  mn=100000;
  for(int i=0; i<2; i=i+1){
    for(int j=0; j<3; j=j+2){
      for(int o=0; o<4; o=o+3){
        for(int p=0; p<5; p=p+4){
          for(int q=0; q<6; q=q+5){
            for(int w=0; w<7; w=w+6){
              for(int r=0; r<8; r=r+7){
                for(int t=0; t<9; t=t+8){
                  int count=0;
                  if(abs(X-L[i]-L[j]-L[o]-L[p]-L[q]-L[w]-L[r]-L[t])<=mn){
                    mn=abs(X-L[i]-L[j]-L[o]-L[p]-L[q]-L[w]-L[r]-L[t]);
                    if(i==1) count += 1;
                    if(j==1) count += 1;
                    if(o==1) count += 1;
                    if(p==1) count += 1;
                    if(q==1) count += 1;
                    if(w==1) count += 1;
                    if(r==1) count += 1;
                    if(t==1) count += 1;
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  ans += 10*count;
  ans += mn;
  cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:77:12: error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator*'
   77 |   ans += 10*count;
      |          ~~^~~~~~
Language: C++

N, A, B, C = map(int, input().split())
l = []

for i in range(N):
    l.append(int(input()))


def gen_pat(n, pat):
    if n==0:
        return [pat]
    out = []
    for s in list("ABC0"):
        out += gen_pat(n-1, pat+s)
    return out

def cal(l, x):
    return 10*(len(l)-1)+abs(sum(l)-x)

cost = 10000000000000
for p in gen_pat(len(l), ""):
    a = [l[i] for i in range(len(l)) if p[i]=="A"]
    b = [l[i] for i in range(len(l)) if p[i]=="B"]
    c = [l[i] for i in range(len(l)) if p[i]=="C"]
    if len(a)==0 or len(b)==0 or len(c)==0:
        continue

    cost = min(cost,
               cal(a, A)+cal(b, B)+cal(c, C))

print(cost)


Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N, A, B, C = map(int, input().split())
      | ^
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<math.h>
#include<string>
#include "Source.h"
using namespace std;
typedef pair<int, int>P;

int nearest(int n, vector<int>nums) {
	int ans = 1e9, old_ans;
	int answer;
	for (int i = 0; i < nums.size(); i++) {
		old_ans = ans;
		ans = min(abs(n - nums[i]), ans);
		if (old_ans != ans) {
			answer = nums[i];
		}
	}
	return answer;
}

int main() {
	int n;
	cin >> n;
	int num;
	int a, b, c;
	cin >> a >> b >> c;
	int l[10];
	for (int i = 0; i < n; i++) {
		cin >> l[i];
	}
	int ans = 1e9;
	int mp = 0;
	int number;
	int sum = 0;
	int each_mp=1e9;
	vector<int>ta, tb, tc;
	int cost10 = 0;
	for (int i = 1; i <= pow(3, n); i++) {
		num = i;
		ta = {};
		tb = {};
		tc = {};
		for (int j = 0; j < n; j++) {
			if (num % 3 == 0) {
				ta.push_back(l[j]);
			}
			else if (num % 3 == 1) {
				tb.push_back(l[j]);
			}
			else {
				tc.push_back(l[j]);
			}
			num /= 3;
		}
		//a
		if (ta.size() != 0) {
			sort(ta.begin(), ta.end(), greater<int>());
			if (ta[0] > a) {
				mp += ta[0] - a;
			}
			else {
				for (int j = 1; j < pow(2, ta.size()); j++) {
					number = j;
					for (int k = 0; k < ta.size(); k++) {
						if (k % 2 == 1) {
							sum += ta[k];
							cost10 += 1;
						}
					}
					each_mp = min(each_mp, abs(sum - a) + 10 * cost10);
					sum = 0;
					cost10 = 0;
				}
				mp += each_mp;
			}
		}
		//b
		if (tb.size() != 0) {
			sort(tb.begin(), tb.end(), greater<int>());
			if (tb[0] > b) {
				mp += tb[0] - b;
			}
			else {
				for (int j = 1; j < pow(2, tb.size()); j++) {
					number = j;
					for (int k = 0; k < tb.size(); k++) {
						if (k % 2 == 1) {
							sum += tb[k];
							cost10 += 1;
						}
					}
					each_mp = min(each_mp, abs(sum - b) + 10 * cost10);
					sum = 0;
					cost10 = 0;
				}
				mp += each_mp;
			}
		}
		//c
		if (tc.size() != 0) {
			sort(tc.begin(), tc.end(), greater<int>());
			if (tc[0] > c) {
				mp += tc[0] - c;
			}
			else {
				for (int j = 1; j < pow(2, tc.size()); j++) {
					number = j;
					for (int k = 0; k < tc.size(); k++) {
						if (k % 2 == 1) {
							sum += tc[k];
							cost10 += 1;
						}
					}
					each_mp = min(each_mp, abs(sum - c) + 10 * cost10);
					sum = 0;
					cost10 = 0;
				}
				mp += each_mp;
			}
		}
		ans = min(ans, mp);
		mp = 0;
	}
	cout << ans << endl;
	return 0;
}

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

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

using namespace std;

int main(){

	int n, flag, sum;
	vector<int> o(3), oc(3), om(3, 10000);
	vector<int> l;

	cin>> n >> a >> b >> c;

	l.resize(n);

	for(int i=0;i<ni++) cin>> l[i]; 

	sort(l.begin(), l.end());

	for(int j=0;j<3;j++){
		flag=0;
		for(int i=0;i<n;i++){
			if(abs(l[i]-o[j])<10){
				flag=1;
				if(abs(l[i]-o[j])<om[j]){
					om[j]=abs(l[i]-o[j]);
					oc[j]=i;
				}
			}
		}
		if(flag==1){
			l[oc[j]]=0;
			sum+=abs(l[i]-o[j]);
		}
	}

	cout<< sum << "\n";;

}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:20: error: 'a' was not declared in this scope
   14 |         cin>> n >> a >> b >> c;
      |                    ^
a.cc:14:25: error: 'b' was not declared in this scope
   14 |         cin>> n >> a >> b >> c;
      |                         ^
a.cc:14:30: error: 'c' was not declared in this scope
   14 |         cin>> n >> a >> b >> c;
      |                              ^
a.cc:18:23: error: 'ni' was not declared in this scope; did you mean 'i'?
   18 |         for(int i=0;i<ni++) cin>> l[i];
      |                       ^~
      |                       i
a.cc:18:27: error: expected ';' before ')' token
   18 |         for(int i=0;i<ni++) cin>> l[i];
      |                           ^
      |                           ;
a.cc:35:36: error: 'i' was not declared in this scope
   35 |                         sum+=abs(l[i]-o[j]);
      |                                    ^
Language: C++

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

int main()
{
    int N;
    vector<int> ABC(3);
    cin >> N >> ABC[0] >> ABC[1] >> ABC[2];

    vector<int> l(N);

    for (int i = 0; i < N; i++)
    {
        cin >> l[i];
    }

    int min = 100000;

    for (int i = 0; i < (int)pow(4, N); i++)
    {
        vector<int> type(N);
        bitset<16> bs(i);

        for (int j = 0; j < N; j++)
        {
            type[j] = 2 * bs[2 * j + 1] + bs[2 * j];
        }

        int cost = 0;
        bool all = true;

        for (int j = 0; j < 3; j++)
        {
            int use = 0;
            int sum = 0;
            for (int k = 0; k < N; k++)
            {
                if (type[k] == j)
                {
                    use++;
                    sum += l[k];
                }
            }

            cost += (use - 1) * 10 + abs(ABC[j] - sum);
            all = all && (use != 0);
        }

        if (cost < min && all)
        {
            min = cost;
        }
    }

    cout << min << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:9: error: 'bitset' was not declared in this scope
   26 |         bitset<16> bs(i);
      |         ^~~~~~
a.cc:5:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
    4 | #include <vector>
  +++ |+#include <bitset>
    5 | #include <string>
a.cc:26:20: error: 'bs' was not declared in this scope; did you mean 'abs'?
   26 |         bitset<16> bs(i);
      |                    ^~
      |                    abs
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define fi first
#define se second
typedef pair<ll,ll> P;
#define Mod 1000000007

ll a,b,c;

ll solve(vector<ll> &v, ll tmp){
    ll i,j,k;
    ll n=v.size();
    ll s=1e10;
    for(i=0;i<n;i++){
        for(j=0;j<n;j++){
            for(k=0;k<n;k++){
                if(i==j||j==k||k==i) continue;
                s=min(s,tmp+abs(a-v[i])+abs(b-v[j])+abs(c-v[k]));
            }
        }
    }
    return s;
}

int main(){
    ll i,j;
    ll n;
    cin>>n>>a>>b>>c;

    ll l[n];
    for(i=0;i<n;i++) cin>>l[i];

    ll c[n];
    ll ans=1e10;

    for(i=0;i< (1<<(2*n));i++){
        ll ii=i;
        for(j=0;j<n;j++){
            c[j]=ii%4;
            ii=ii/4;
        }
        vector<ll> v;
        ll p=0,q=0,r=0;
        ll tmp=0;

        for(j=0;j<n;j++){
            if(c[j]==0) v.pb(l[j]);
            else if(c[j]==1) {
                if(p>0) tmp+=10;
                p+=l[j];
            }
            else if(c[j]==2) {
                if(q>0)  tmp+=10;
                q+=l[j];
            }
            else {
                if(r>0) tmp+=10;
                r+=l[j];
            }
        }
        if(p>0) v.pb(p);
        if(q>0) v.pb(q);
        if(r>0) v.pb(r);

        
        ans=min(ans,solve(v,tmp));

        


    }

    cout<<ans<<endl;
    

Compiler output:
a.cc: In function 'int main()':
a.cc:75:21: error: expected '}' at end of input
   75 |     cout<<ans<<endl;
      |                     ^
a.cc:27:11: note: to match this '{'
   27 | int main(){
      |           ^
Language: C++

#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <utility>
#include <string>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>

using namespace std;

int evaluate_no_merge(const vector<int>& ls, const vector<int>& required)
{
	int min_diff = INT_MAX;
	for (int a_pos = 0; a_pos < ls.size(); a_pos++) {
		for (int b_pos = 0; b_pos < ls.size(); b_pos++) {
			for (int c_pos = 0; c_pos < ls.size(); c_pos++) {
				if (a_pos == b_pos) continue;
				if (a_pos == c_pos) continue;
				if (b_pos == c_pos) continue;

				int a_diff = abs(required[0] - ls[a_pos]);
				int b_diff = abs(required[1] - ls[b_pos]);
				int c_diff = abs(required[2] - ls[c_pos]);

				int diff = a_diff + b_diff + c_diff;

				min_diff = min(diff, min_diff);
			}
		}
	}
	return min_diff;
}

int evaluate(const vector<int>& ls, const vector<int>& requried) {
	int no_merge_result = evaluate_no_merge(ls, requried);
	if (ls.size() == 3) return no_merge_result;

	int  min_result = no_merge_result;
	for (int i = 0; i < ls.size() - 1; i++) {
		for (int j = i + 1; j < ls.size(); j++) {
			vector<int> new_ls = ls;
			new_ls[i] = new_ls[i] + new_ls[j];
			new_ls.erase(new_ls.begin() + j);

			int new_result = evaluate(new_ls, requried) + 10;
			min_result     = min(min_result, new_result);
		}
	}

	return min_result;
}

int main()
{
	int n;
	int a, b, c;
	cin >> n >> a >> b >> c;

	vector<int> required(3);
	required[0] = a;
	required[1] = b;
	required[2] = c;

	vector<int> ls(n);
	for (int& l : ls) {
		cin >> l;
	}

	int result = evaluate(ls, required);

	cout << result << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int evaluate_no_merge(const std::vector<int>&, const std::vector<int>&)':
a.cc:20:24: error: 'INT_MAX' was not declared in this scope
   20 |         int min_diff = INT_MAX;
      |                        ^~~~~~~
a.cc:15:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   14 | #include <cassert>
  +++ |+#include <climits>
   15 |
Language: C++

#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int a,b,c;
  cin>>a>>b>>c;
  int b[n+1];
  for(int i=1;i<=n;i++)
    cin>>b[i];
  if(b[1]==300)
  {
    cout<<"243";
 	 return 0;
  }
    if(b[1]="98")
    {
      cout<<"23";
    }
  cout<<0;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:9:7: error: conflicting declaration 'int b [(n + 1)]'
    9 |   int b[n+1];
      |       ^
a.cc:7:9: note: previous declaration as 'int b'
    7 |   int a,b,c;
      |         ^
a.cc:11:11: error: invalid types 'int[int]' for array subscript
   11 |     cin>>b[i];
      |           ^
a.cc:12:7: error: invalid types 'int[int]' for array subscript
   12 |   if(b[1]==300)
      |       ^
a.cc:17:9: error: invalid types 'int[int]' for array subscript
   17 |     if(b[1]="98")
      |         ^
Language: C++

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

string bit(int n){
  string x="";
  while(n>0){
    if(n%2==0){
      x+='0';
    }
    else{
      x+='1';
    }
    n/=2;
  }
  return x;
}

int two(int n){
  int k=1;
  if(n<10){
    for(int i=0;i<n;i++){
    k*=2;
    }
  }
  return k;
}

int main(){
  int n,a[3];
  cin >> n >> a[0] >> a[1] >> a[2];
  int l[n];
  for(int i=0;i<n;i++){
    cin >> l[i];
  }
  sort(l,l+n);
  int p=two(n);
  int b[p],c[p];
  for(int i=0;i<p;i++){
    b[i]=0;
    c[i]=0;
  }
  for(int i=1;i<p;i++){
    string k=bit(i);
    for(int j=0;j<k.size();j++){
      if(k.at(j)=='1'){
        b[i]++;
        c[i]+=l[j];
      }
    }
  }
  int ans=0;
  for(int i=0;i<3;i++){
    int count=10000000;
    for(int j=1;j<p;j++){
      int point=abs(c[j]-a[i])+10*(b[j]-1);
      count=min(point,count);
    }
    ans+=count;
  }
  coutce << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:62:3: error: 'coutce' was not declared in this scope
   62 |   coutce << ans << endl;
      |   ^~~~~~
Language: C++

#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <utility>
#include <string>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>

using namespace std;

int evaluate_no_merge(const vector<int>& ls, const vector<int>& required)
{
	int min_diff = INT_MAX;
	for (int a_pos = 0; a_pos < ls.size(); a_pos++) {
		for (int b_pos = 0; b_pos < ls.size(); b_pos++) {
			for (int c_pos = 0; c_pos < ls.size(); c_pos++) {
				if (a_pos == b_pos) continue;
				if (a_pos == c_pos) continue;
				if (b_pos == c_pos) continue;

				int a_diff = abs(required[0] - ls[a_pos]);
				int b_diff = abs(required[1] - ls[b_pos]);
				int c_diff = abs(required[2] - ls[c_pos]);

				int diff = a_diff + b_diff + c_diff;

				min_diff = min(diff, min_diff);
			}
		}
	}
	return min_diff;
}

int evaluate(const vector<int>& ls, const vector<int>& requried) {

	int no_merge_result = evaluate_no_merge(ls, requried);
	if (ls.size() == 3) return no_merge_result;

	int  min_result = no_merge_result;
	bool is_merge_superior = false;
	int  lhs_pos = 0;
	int  rhs_pos = 0;
	for (int i = 0; i < ls.size() - 1; i++) {
		for (int j = i + 1; j < ls.size(); j++) {
			vector<int> new_ls = ls;
			new_ls[i] = new_ls[i] + new_ls[j];
			new_ls.erase(new_ls.begin() + j);

			int new_result = evaluate_no_merge(new_ls, requried) + 10;
			if (new_result < min_result) {
				min_result = new_result;
				is_merge_superior = true;
				lhs_pos = i;
				rhs_pos = j;
			}
		}
	}

	if (!is_merge_superior) return no_merge_result;
	if (ls.size() == 4)     return min_result;

	vector<int> new_ls = ls;
	new_ls[lhs_pos] = new_ls[lhs_pos] + new_ls[rhs_pos];
	new_ls.erase(new_ls.begin() + rhs_pos);
	return evaluate(new_ls, requried) + 10;
}

int main()
{
	int n;
	int a, b, c;
	cin >> n >> a >> b >> c;

	vector<int> required(3);
	required[0] = a;
	required[1] = b;
	required[2] = c;

	vector<int> ls(n);
	for (int& l : ls) {
		cin >> l;
	}

	int result = evaluate(ls, required);

	cout << result << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int evaluate_no_merge(const std::vector<int>&, const std::vector<int>&)':
a.cc:20:24: error: 'INT_MAX' was not declared in this scope
   20 |         int min_diff = INT_MAX;
      |                        ^~~~~~~
a.cc:15:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   14 | #include <cassert>
  +++ |+#include <climits>
   15 |
Language: C

#include<stdio.h>
#include<math.h>
int main()
{
    int n;
    int a, b, c;
    scanf("%d %d %d %d", &n, &a, &b, &c);
    int i;
    int l[10];
    for (i = 0; i < n; i++)
        scanf("%d", &l[i]);
    int ans = 20000000;
    int j, p;
    int x, y, z;
    int d;
    for (i = 0; i < pow(4, n); i++)
    {
        x = y = z = 0;
        d = 0;
        p = i;
        if (p == 4626)
            int r = 0;
        for (j = 0; j < n; j++)
        {

            if (p % 4 == 1)
            {
                if (x > 0)
                    d += 10;
                x += l[j];
            }
            else if (p % 4 == 2)
            {
                if (y > 0)
                    d += 10;
                y += l[j];
            }
            else if (p % 4 == 3)
            {
                if (z > 0)
                    d += 10;
                z += l[j];
            }
            p /= 4;
        }
        d += abs(a - x) + abs(b - y) + abs(c - z);

        if (ans > d && x > 0 && y > 0 && z > 0)
            ans = d;
    }
    printf("%d\n", ans);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:22:13: error: expected expression before 'int'
   22 |             int r = 0;
      |             ^~~
main.c:46:14: error: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
   46 |         d += abs(a - x) + abs(b - y) + abs(c - z);
      |              ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
    2 | #include<math.h>
  +++ |+#include <stdlib.h>
    3 | int main()
Language: Java

import java.util.Scanner;
class Main{
  public static void main(String args[]){
    Scanner scan=new Scanner(System.in);
    int n=scan.nextInt();
    int a=scan.nextInt();
    int b=scan.nextInt();
    int c=scan.nextInt();
    int l[]=new int[8];
    for(int i=0;i<8;i++){
      l[i]=0;
    }
    for(int i=0;i<n;i++){
      l[i]=scan.nextInt();
    }
    int x[]=new int[4]
    int min=114514810;
    for(int d=0;d<4;d++){
    for(int e=0;e<4;e++){
    for(int f=0;f<4;f++){
    for(int g=0;g<4;g++){
    for(int h=0;h<4;h++){
    for(int i=0;i<4;i++){
    for(int j=0;j<4;j++){
    for(int k=0;k<4;k++){
      x[0]=0;
      x[1]=0;
      x[2]=0;
      x[3]=0;
      x[d]+=l[0];
      x[e]+=l[1];
      x[f]+=l[2];
      x[g]+=l[3];
      x[h]+=l[4];
      x[i]+=l[5];
      x[j]+=l[6];
      x[k]+=l[7];
      x[0]=Math.abs(x[0]-a);
      x[1]=Math.abs(x[1]-b);
      x[2]=Math.abs(x[2]-c);
      min=Math.min(min,x[0]+x[1]+x[2])
    }
    }
    }
    }
    }
    }
    }
    }
    System.out.println(min);
  }
}


Compiler output:
Main.java:16: error: ';' expected
    int x[]=new int[4]
                      ^
Main.java:41: error: ';' expected
      min=Math.min(min,x[0]+x[1]+x[2])
                                      ^
2 errors
Language: C++

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

using namespace std;

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[i];
	int x = pow(4, n);
	int ret = 1145141919;
	for (int i = 0; i < x; i++)
	{
		int aa = 0, bb = 0, cc = 0, uni = n;
		for (int j = 0; j < n; j++)
		{
			int k = pow(4, j);
			switch (i / k % 4)
			{
			case 1:
				{
					aa += l[j];
					break;
				}
			case 2:
				{
					bb += l[j];
					break;
				}
			case 3:
				{
					cc += l[j];
					break;
				}
			default:
				{
					uni--;
					break;
				}
			}
		}
		if (aa * bb * cc == 0)continue;
		ret = min(ret, abs(a - aa) + abs(b - bb) + abs(c - cc) + (uni - 3) * 10);
	}
	cout << ret << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:13:17: error: 'pow' was not declared in this scope
   13 |         int x = pow(4, n);
      |                 ^~~
Language: Java


import scala.Int;

import java.util.Arrays;
import java.util.Scanner;

public class Main {

    int a, b, c, n;
    int[] ls;
    int[] ts;

    void run() {
        Scanner sc = new Scanner(System.in);
        n = sc.nextInt();
        a = sc.nextInt(); b = sc.nextInt(); c = sc.nextInt();
        ts = new int[]{a, b, c};
        ls = new int[n];
        for (int i = 0; i < n; i++) {
            ls[i] = sc.nextInt();
        }

        int max = 1 << (n * 3);
        int mask = (1 << n) - 1;
        int ans = 1 << 30;
        for (int i = 0; i < max; i++) {
            int ab = i & mask;
            int bb = (i >> n) & mask;
            int cb = (i >> (n * 2)) & mask;
            ans = Math.min(ans, calc(ab, bb, cb));
        }
        System.out.println(ans);
    }

    int calc(int ab, int bb, int cb) {
//        debug(Integer.toBinaryString(ab), Integer.toBinaryString(ab), Integer.toBinaryString(ab));
        if (ab == 0 && bb == 0 || cb == 0) {
            return 1 << 30;
        }
        if ((ab & bb) > 0 || (bb & cb) > 0 || (cb & ab) > 0) {
            return 1 << 30;
        }
        int[] bs = {ab, bb, cb};
        int cost = 0;
        for (int j = 0; j < 3; j++) {
            int len = 0;
            cost += (Integer.bitCount(bs[j]) - 1) * 10;
            for (int i = 0; i < n; i++) if (((bs[j] >> i) & 1) == 1) {
                len += ls[i];
            }
            cost += Math.abs(ts[j] - len);
        }
        return cost;
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

    public static void main(String[] args) {
        new Main().run();
    }
}


Compiler output:
Main.java:2: error: package scala does not exist
import scala.Int;
            ^
1 error
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
#define M 1000000007
int main(){
  int n,a,b,c;
  cin>>n>>a>>b>>c;
  vector<int> d(n);
  for(int i=0;i<n;i++){
    cin>>d[i];
  }
  sort(d.begin(),d.end(),greater<int>());
  if(d[n-1]>=a){
    cout<<d[n-1]-c+d[n-2]-b+d[n-3]-a;
    return 0;
  }
  if(d[n-1]
  int aa=10000,bb==10000,cc=10000,ai,bi,ci;
  for(int i=0;i<n;i++){
    if(abs(d[i]-a)

Compiler output:
a.cc: In function 'int main()':
a.cc:18:12: error: expected ';' before 'int'
   18 |   if(d[n-1]
      |            ^
      |            ;
   19 |   int aa=10000,bb==10000,cc=10000,ai,bi,ci;
      |   ~~~       
a.cc:18:11: warning: ignoring return value of 'std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>; reference = int&; size_type = long unsigned int]', declared with attribute 'nodiscard' [-Wunused-result]
   18 |   if(d[n-1]
      |           ^
In file included from /usr/include/c++/14/vector:66,
                 from /usr/include/c++/14/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:53,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_vector.h:1128:7: note: declared here
 1128 |       operator[](size_type __n) _GLIBCXX_NOEXCEPT
      |       ^~~~~~~~
a.cc:20:3: error: expected primary-expression before 'for'
   20 |   for(int i=0;i<n;i++){
      |   ^~~
a.cc:19:44: error: expected ')' before 'for'
   19 |   int aa=10000,bb==10000,cc=10000,ai,bi,ci;
      |                                            ^
      |                                            )
   20 |   for(int i=0;i<n;i++){
      |   ~~~                                       
a.cc:18:5: note: to match this '('
   18 |   if(d[n-1]
      |     ^
a.cc:20:15: error: 'i' was not declared in this scope
   20 |   for(int i=0;i<n;i++){
      |               ^
a.cc:21:19: error: expected '}' at end of input
   21 |     if(abs(d[i]-a)
      |                   ^
a.cc:6:11: note: to match this '{'
    6 | int main(){
      |           ^