Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
const long long INF = 1LL<<58;

int ncr(int n,int r){
    int ans=1;
    for (int i=1;i<n+1;i++){
        ans * =i;
    }
    for (int i=1;i<r+1;r++){
        ans / i;
    }
    return ans;
    
}

int main(){
    int a,b,c,n;
    cin >> a >>b >>c >> n;
    vector<int> l;
    l.resize(n);
    al.resize(n);
    bl.resize(n);
    cl.resize(n);
    for (int i=0;i<n;i++){
        cin>> l[i];
        al[i]=0;
        bl[i]=0;
        cl[i]=0;
    }
    
    for (int i=1;i<n-1;i++){
        for (int j=1;j<n-i;j++){
            int k = n - i - j;
            int tmp1,tmp2,tmp3;
            for (int x=0;x<ncr(n, i) ;x++){
                int code=x;
                int w;
                int last=0;
                int nokori = i;
                
                while(nokori!=0){
                    w = n - last - nokori +1;
                    index = code % w;
                    code = (code - index)%w;
                    w = w - index -1;
                    last = last + index;
                    al[last]=1;
                    nokori --;
                }

            }
            for (int x=0;x<(ncr(n-i, j) ;x++){
                int tmp=x;
                int w;
                int last=0;
                int nokori = j;
                
                while(nokori!=0){
                    w = n - i - last - nokori +1;
                    index = tmp % w;
                    tmp = (tmp - index)%w;
                    w = w - index -1;
                    last = last+index;
                    bl[last]=1;
                    nokori --;
                }                
                
            }
            update(al, bl, cl);
            va.resize(i);
            vb.resize(j);
            vc.resize(n-i-j);
            for (int t=0;t<n;t++){
                if (al[t]==1) va.push_back(l[t]);
                if (bl[t]==1) vb.push_back(l[t]);
                if (cl[t]==1) vc.push_back(l[t]);
            }
            
            int cost = 0;
            cost+= compute_lowest_cost(va, a);
            cost+= compute_lowest_cost(vb, b);
            cost+= compute_lowest_cost(vc, c);
            
            if (ans > cost) ans =cost;
            
            for (int t=0;t<n;t++){
                al[t]=0;
                bl[t]=0;
                cl[t]=0;
            }
        }
    }
    cout<< ans << endl;
    
    return 0;
}




Compiler output:
a.cc: In function 'int ncr(int, int)':
a.cc:11:15: error: expected primary-expression before '=' token
   11 |         ans * =i;
      |               ^
a.cc: In function 'int main()':
a.cc:25:5: error: 'al' was not declared in this scope; did you mean 'l'?
   25 |     al.resize(n);
      |     ^~
      |     l
a.cc:26:5: error: 'bl' was not declared in this scope; did you mean 'l'?
   26 |     bl.resize(n);
      |     ^~
      |     l
a.cc:27:5: error: 'cl' was not declared in this scope; did you mean 'l'?
   27 |     cl.resize(n);
      |     ^~
      |     l
a.cc:47:21: error: 'index' was not declared in this scope
   47 |                     index = code % w;
      |                     ^~~~~
a.cc:56:40: error: expected ')' before ';' token
   56 |             for (int x=0;x<(ncr(n-i, j) ;x++){
      |                            ~           ^~
      |                                        )
a.cc:64:21: error: 'index' was not declared in this scope
   64 |                     index = tmp % w;
      |                     ^~~~~
a.cc:73:13: error: 'update' was not declared in this scope
   73 |             update(al, bl, cl);
      |             ^~~~~~
a.cc:74:13: error: 'va' was not declared in this scope; did you mean 'a'?
   74 |             va.resize(i);
      |             ^~
      |             a
a.cc:75:13: error: 'vb' was not declared in this scope; did you mean 'b'?
   75 |             vb.resize(j);
      |             ^~
      |             b
a.cc:76:13: error: 'vc' was not declared in this scope; did you mean 'c'?
   76 |             vc.resize(n-i-j);
      |             ^~
      |             c
a.cc:84:20: error: 'compute_lowest_cost' was not declared in this scope
   84 |             cost+= compute_lowest_cost(va, a);
      |                    ^~~~~~~~~~~~~~~~~~~
a.cc:88:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   88 |             if (ans > cost) ans =cost;
      |                 ^~~
      |                 abs
a.cc:97:12: error: 'ans' was not declared in this scope; did you mean 'abs'?
   97 |     cout<< ans << endl;
      |            ^~~
      |            abs