Language: C++

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

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define rep(i,n) FOR((i),0,(n))

typedef long long ll;

const int INF=1e9+7;
const int MAX_N=43;
int a[MAX_N],b[MAX_N],c[MAX_N];
int dp[450][450][43];
int main(){
	rep(i,450)rep(j,450)rep(k,43)dp[i][j][k]=INF;
	int n,m_a,m_b;
	cin>>n>>m_a>>m_b;
	rep(i,n)cin>>a[i]>>b[i]>>c[i];
	dp[0][0][0]=0;
	rep(l,n){
rep(i,400)rep(j,400){dp[i][j][l+1]=min(dp[i][j][l+1];dp[i][j][l]),dp[i+a[l]][j+b[l]][l+1]=min(dp[i+a[l]][j+b[l]][l],dp[i][j][l]+c[l])}}
	}
	int ans=INF;
	for(int i=1;i*(max(m_a,m_b))<450;i++){
		ans=min(ans,dp[i*m_a][i*m_b][n]);
	}
	rep(i,450)rep(j,450)if(i*m_b==j*m_a)ans=min(ans,dp[i][j][n]);
	if(ans==INF)ans=-1;
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:53: error: expected ')' before ';' token
   22 | rep(i,400)rep(j,400){dp[i][j][l+1]=min(dp[i][j][l+1];dp[i][j][l]),dp[i+a[l]][j+b[l]][l+1]=min(dp[i+a[l]][j+b[l]][l],dp[i][j][l]+c[l])}}
      |                                       ~             ^
      |                                                     )
a.cc:22:65: error: expected ';' before ')' token
   22 | rep(i,400)rep(j,400){dp[i][j][l+1]=min(dp[i][j][l+1];dp[i][j][l]),dp[i+a[l]][j+b[l]][l+1]=min(dp[i+a[l]][j+b[l]][l],dp[i][j][l]+c[l])}}
      |                                                                 ^
      |                                                                 ;
a.cc: At global scope:
a.cc:25:9: error: expected unqualified-id before 'for'
   25 |         for(int i=1;i*(max(m_a,m_b))<450;i++){
      |         ^~~
a.cc:25:21: error: 'i' does not name a type
   25 |         for(int i=1;i*(max(m_a,m_b))<450;i++){
      |                     ^
a.cc:25:42: error: 'i' does not name a type
   25 |         for(int i=1;i*(max(m_a,m_b))<450;i++){
      |                                          ^
a.cc:6:20: error: expected unqualified-id before 'for'
    6 | #define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
      |                    ^~~
a.cc:7:18: note: in expansion of macro 'FOR'
    7 | #define rep(i,n) FOR((i),0,(n))
      |                  ^~~
a.cc:28:9: note: in expansion of macro 'rep'
   28 |         rep(i,450)rep(j,450)if(i*m_b==j*m_a)ans=min(ans,dp[i][j][n]);
      |         ^~~
a.cc:6:39: error: expected constructor, destructor, or type conversion before '<' token
    6 | #define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
      |                                       ^
a.cc:7:18: note: in expansion of macro 'FOR'
    7 | #define rep(i,n) FOR((i),0,(n))
      |                  ^~~
a.cc:28:9: note: in expansion of macro 'rep'
   28 |         rep(i,450)rep(j,450)if(i*m_b==j*m_a)ans=min(ans,dp[i][j][n]);
      |         ^~~
a.cc:6:47: error: expected constructor, destructor, or type conversion before '++' token
    6 | #define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
      |                                               ^~
a.cc:7:18: note: in expansion of macro 'FOR'
    7 | #define rep(i,n) FOR((i),0,(n))
      |                  ^~~
a.cc:28:9: note: in expansion of macro 'rep'
   28 |         rep(i,450)rep(j,450)if(i*m_b==j*m_a)ans=min(ans,dp[i][j][n]);
      |         ^~~
a.cc:6:39: error: expected constructor, destructor, or type conversion before '<' token
    6 | #define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
      |                                       ^
a.cc:7:18: note: in expansion of macro 'FOR'
    7 | #define rep(i,n) FOR((i),0,(n))
      |                  ^~~
a.cc:28:19: note: in expansion of macro 'rep'
   28 |         rep(i,450)rep(j,450)if(i*m_b==j*m_a)ans=min(ans,dp[i][j][n]);
      |                   ^~~
a.cc:6:47: error: expected constructor, destructor, or type conversion before '++' token
    6 | #define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
      |                                               ^~
a.cc:7:18: note: in expansion of macro 'FOR'
    7 | #define rep(i,n) FOR((i),0,(n))
      |                  ^~~
a.cc:28:19: note: in expansion of macro 'rep'
   28 |         rep(i,450)rep(j,450)if(i*m_b==j*m_a)ans=min(ans,dp[i][j][n]);
      |                   ^~~
a.cc:29:9: error: expected unqualified-id before 'if'
   29 |         if(ans==INF)ans=-1;
      |         ^~
a.cc:30:9: error: 'cout' does not name a type
   30 |         cout<<ans<<endl;
      |         ^~~~
a.cc:31:1: error: expected declaration before '}' token
   31 | }
      | ^