Language: C++


#include <iostream>
#include <stdio.h>
#include <stdlib.h> //rand() 0~RAND_MAX2147483647
#include <math.h>
#include <time.h>   //srand((unsigned int)time(NULL));
#include <unistd.h> //sleep
#include <algorithm>
#include <cmath>
#include <vector>
#include <regex> //正規表現
#include <map>
#include <unordered_map>
#include <set>
#include <cassert> //assart
#include <numeric>
#include <iterator>
#include <list>

using namespace std;
#define ll long long int
#define FOR(i,min,max) for(int i=(min);i<(max);i++)
#define FOReq(i,min,max) for(int i=(min);i<=(max);i++)
#define FORREV(i,max,min) for(int i=(max)-1;i>=(min);i--)
#define FORREVeq(i,max,min) for(int i=(max);i>=(min);i--)
const int MOD=1e9+7;
const int MOD2=998244353;

const int INF=2000000001;
const ll INFll=2e18;
//const int MAX_V=10000;
const double  Micro=1e-5;

int UnUsedVariable(){
    if(INF || Micro || MOD || INFll || MOD2){;}
    return 0;
}

#define pf printf
#define sf scanf
#define inarray(array,min,max) FOR(i,min,max){cin>>array[i];}
#define inarrayW(arrayA,arrayB,min,max) FOR(i,min,max){cin>>arrayA[i]>>arrayB[i];}
#define br printf("\n");
#define OutputAndReturn0(x) {cout<<(x)<<endl;return 0;}
#define elif else if

#define issame(a,b,c,d) ((a)==(b) and (b)==(c) and (c)==(d))
#define isdiff3(a,b,c) ((a)!=(b) and (b)!=(c) and (c)!=(a))
#define isdiff4(a,b,c,d) ((a)!=(b) and (b)!=(c) and (c)!=(a) and (d)!=(a) and (d)!=(b) and (d)!=(c))
inline int isEven(int x){return x%2==0;}
inline int isOdd (int x){return x%2==1;}
inline ll  gcd(ll a,ll b){ if(b==0)return a;else return gcd(b,a%b);}//最大公約数 なお一方が0なら答えは他方になるので番兵は０で良い また、負の数もOK -4%3=-1となるため
inline ll  lcm(ll a,ll b){return a*b/gcd(a,b);}//MODやオーバーフローには注意！
//inline ll  ceil(double a){return (ll)a+1;}


//Eと名のつくのはデバッグ用！
int EintN(ll array[],const ll num){
    for(int i=0;i<num;i++){cerr<<array[i]<<" ";}
    br;
    return 0;
}
int EintNN(const int heighth,const int width,int array[heighth][width]){
    FOR(i, 0, heighth){
        FOR(k, 0, width){
            {cerr<<array[i][k]<<" ";}
        }
        br;
    }
    br;
    return 0;
}
int Eint(string str,const ll num){
    cerr<<str<<" is "<<num<<" now."<<endl;
    return 0;
}











ll bamboo[8];
ll N,A,B,C;

ll re(ll num,ll useA,ll useB,ll useC){
    if(num==N){
        if(min({useA,useB,useC})==0)return INF;
        else return abs(A-useA)+abs(B-useB)+abs(C-useC)-30;
    }
    ll ans0=re(num+1,useA,useB,useC);
    ll ans1=re(num+1,useA+bamboo[num],useB,useC)+10;
    ll ans2=re(num+1,useA,useB+bamboo[num],useC)+10;
    ll ans3=re(num+1,useA,useB,useC+bamboo[num])+10;
    return min({ans0,ans1,ans2,ans3});
}

int prob(){
    ll ans;ans=0;
    cin>>N>>A>>B>>C;
    inarray(bamboo, 0, N);
    OutputAndReturn0(re(0,0,0,0));
    return 0;
}


signed main(){
    prob();
    return 0;
}


Compiler output:
a.cc:63:63: error: use of parameter outside function body before ']' token
   63 | int EintNN(const int heighth,const int width,int array[heighth][width]){
      |                                                               ^
a.cc:63:70: error: use of parameter outside function body before ']' token
   63 | int EintNN(const int heighth,const int width,int array[heighth][width]){
      |                                                                      ^
a.cc: In function 'int EintNN(...)':
a.cc:64:15: error: 'heighth' was not declared in this scope
   64 |     FOR(i, 0, heighth){
      |               ^~~~~~~
a.cc:22:43: note: in definition of macro 'FOR'
   22 | #define FOR(i,min,max) for(int i=(min);i<(max);i++)
      |                                           ^~~
a.cc:65:19: error: 'width' was not declared in this scope; did you mean 'wcwidth'?
   65 |         FOR(k, 0, width){
      |                   ^~~~~
a.cc:22:43: note: in definition of macro 'FOR'
   22 | #define FOR(i,min,max) for(int i=(min);i<(max);i++)
      |                                           ^~~
a.cc:66:25: error: missing template arguments before '[' token
   66 |             {cerr<<array[i][k]<<" ";}
      |                         ^