Language: C++

#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define s second
#define f first
#define mk make_pair
using namespace std;
main(){
  int a,b,c,a1,b1,c1,x,y,z;
  cin>>a>>b>>c>>x>>y>>z;
  long int dp[2][a+3][b+3][c+3];
  memset(dp,0,sizeof(dp));
  vector<pair<int,pair<int,int> > >v[2];
 // if(a)dp[0][1][0][0]=x,v[0].push_back(mk(1,mk(0,0)));
  //if(b)dp[0][0][1][0]=y,v[0].push_back(mk(0,mk(1,0)));
  //if(c)dp[0][0][0][1]=z,v[0].push_back(mk(0,mk(0,1)));
  for(int i=1;i<a+b+c;i++){
    cin>>x>>y>>z;
    //set<pair<int,pair<int,int> > >se;//cout<<v[(i+1)%2].size()<<endl;
    for(int j=0;j<v[(i+1)%2].siz//e();j++){
      pair<int,pair<int,int> >p=v[(i+1)%2][j];
      a1=p.f,b1=p.s.f,c1=p.s.s;//cout<<a1<<b1<<c1<<endl;
      if(a1<a)dp[i%2][a1+1][b1][c1]=max(dp[i%2][a1+1][b1][c1],dp[(i+1)%2][a1][b1][c1]+x);
      if(b1<b)dp[i%2][a1][b1+1][c1]=max(dp[i%2][a1][b1+1][c1],dp[(i+1)%2][a1][b1][c1]+y);
      if(c1<c)dp[i%2][a1][b1][c1+1]=max(dp[i%2][a1][b1][c1+1],dp[(i+1)%2][a1][b1][c1]+z);
      p=mk(a1+1,mk(b1,c1));if(a1<a)v[i%2].push_back(p);
      //if(!se.count(p)&&a1<a)v[i%2].push_back(p),se.insert(p);
      p=mk(a1,mk(b1+1,c1));if(b1<b)v[i%2].push_back(p);
      //if(!se.count(p)&&b1<b)v[i%2].push_back(p),se.insert(p);
      p=mk(a1,mk(b1,c1+1));if(c1<c)v[i%2].push_back(p);
      //if(!se.count(p)&&c1<c)v[i%2].push_back(p),se.insert(p);
    }
    v[(i+1)%2].clear();
  }
  long int ans=0;
  r(i,a)r(j,b)r(k,c)ans=max(ans,dp[(a+b+c-1)%2][a][b][c]);
  cout<<ans<<endl;
  return 0;
}

Compiler output:
a.cc:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main(){
      | ^~~~
a.cc: In function 'int main()':
a.cc:19:30: error: 'class std::vector<std::pair<int, std::pair<int, int> > >' has no member named 'siz'; did you mean 'size'?
   19 |     for(int j=0;j<v[(i+1)%2].siz//e();j++){
      |                              ^~~
      |                              size
a.cc:19:33: error: expected ';' before 'pair'
   19 |     for(int j=0;j<v[(i+1)%2].siz//e();j++){
      |                                 ^
      |                                 ;
   20 |       pair<int,pair<int,int> >p=v[(i+1)%2][j];
      |       ~~~~                       
a.cc:20:31: error: expected primary-expression before 'p'
   20 |       pair<int,pair<int,int> >p=v[(i+1)%2][j];
      |                               ^
a.cc:20:31: error: expected ')' before 'p'
   20 |       pair<int,pair<int,int> >p=v[(i+1)%2][j];
      |                               ^
      |                               )
a.cc:19:8: note: to match this '('
   19 |     for(int j=0;j<v[(i+1)%2].siz//e();j++){
      |        ^
a.cc:20:31: error: 'p' was not declared in this scope
   20 |       pair<int,pair<int,int> >p=v[(i+1)%2][j];
      |                               ^
a.cc:21:10: error: 'p' was not declared in this scope
   21 |       a1=p.f,b1=p.s.f,c1=p.s.s;//cout<<a1<<b1<<c1<<endl;
      |          ^
a.cc:32:8: error: 'i' was not declared in this scope
   32 |     v[(i+1)%2].clear();
      |        ^
a.cc: At global scope:
a.cc:2:16: error: expected unqualified-id before 'for'
    2 | #define r(i,n) for(int i=0;i<n;i++)
      |                ^~~
a.cc:35:3: note: in expansion of macro 'r'
   35 |   r(i,a)r(j,b)r(k,c)ans=max(ans,dp[(a+b+c-1)%2][a][b][c]);
      |   ^
a.cc:35:5: error: 'i' does not name a type
   35 |   r(i,a)r(j,b)r(k,c)ans=max(ans,dp[(a+b+c-1)%2][a][b][c]);
      |     ^
a.cc:2:28: note: in definition of macro 'r'
    2 | #define r(i,n) for(int i=0;i<n;i++)
      |                            ^
a.cc:35:5: error: 'i' does not name a type
   35 |   r(i,a)r(j,b)r(k,c)ans=max(ans,dp[(a+b+c-1)%2][a][b][c]);
      |     ^
a.cc:2:32: note: in definition of macro 'r'
    2 | #define r(i,n) for(int i=0;i<n;i++)
      |                                ^
a.cc:35:11: error: 'j' does not name a type
   35 |   r(i,a)r(j,b)r(k,c)ans=max(ans,dp[(a+b+c-1)%2][a][b][c]);
      |           ^
a.cc:2:28: note: in definition of macro 'r'
    2 | #define r(i,n) for(int i=0;i<n;i++)
      |                            ^
a.cc:35:11: error: 'j' does not name a type
   35 |   r(i,a)r(j,b)r(k,c)ans=max(ans,dp[(a+b+c-1)%2][a][b][c]);
      |           ^
a.cc:2:32: note: in definition of macro 'r'
    2 | #define r(i,n) for(int i=0;i<n;i++)
      |                                ^
a.cc:35:17: error: 'k' does not name a type
   35 |   r(i,a)r(j,b)r(k,c)ans=max(ans,dp[(a+b+c-1)%2][a][b][c]);
      |                 ^
a.cc:2:28: note: in definition of macro 'r'
    2 | #define r(i,n) for(int i=0;i<n;i++)
      |                            ^
a.cc:35:17: error: 'k' does not name a type
   35 |   r(i,a)r(j,b)r(k,c)ans=max(ans,dp[(a+b+c-1)%2][a][b][c]);
      |                 ^
a.cc:2:32: note: in definition of macro 'r'
    2 | #define r(i,n) for(int i=0;i<n;i++)
      |                                ^
a.cc:36:3: error: 'cout' does not name a type
   36 |   cout<<ans<<endl;
      |   ^~~~
a.cc:37:3: error: expected unqualified-id before 'return'
   37 |   return 0;
      |   ^~~~~~
a.cc:38:1: error: expected declaration before '}' token
   38 | }
      | ^