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

#include <iostream>
using namespace std ;

int a[50], b[50], c[50], n, ma, mb, opt;
int search(int sumA, int sumB, int sumC, int st){
    if(sumC>=opt) return 5000;
    if((sumA+a[st])*mb==(sumB+b[st])*ma){
        if(sumC+c[st]<opt) opt=sumC+c[st];
        return sumC+c[st];
    }
    else{
        if(st==n-1) return 5000;
        else{
            int a=search(sumA, sumB, sumC, st+1);
            int b=search(sumA+a[st], sumB+b[st], sumC+c[st], st+1);
            return min(a,b);
        }
    }   
}
int main(void){
    opt=5000;
    cin>>n>>ma>>mb;
    for(int i=0;i<n;i++) cin>>a[i]>>b[i]>>c[i];
    search(0,0,0,0);
    if(opt>=5000||opt==0) opt=-1;
    cout<<opt<<endl;
}

Compiler output:
a.cc: In function 'int search(int, int, int, int)':
a.cc:15:32: error: invalid types 'int[int]' for array subscript
   15 |             int b=search(sumA+a[st], sumB+b[st], sumC+c[st], st+1);
      |                                ^
a.cc:15:44: error: invalid types 'int[int]' for array subscript
   15 |             int b=search(sumA+a[st], sumB+b[st], sumC+c[st], st+1);
      |                                            ^
Language: C++

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

int a[50], b[50], c[50], n, ma, mb, opt;
int search(int sumA, int sumB, int sumC, int st){
    if(sumC>=opt){
        string s=(sumA+" "+sumB+" "+sumC+" "+st+" "+" opt:"+opt);
        return 5000;
    }
    if((sumA+a[st])*mb==(sumB+b[st])*ma){
        if(sumC+c[st]<opt) opt=sumC+c[st];
        return sumC+c[st];
    }
    else{
        if(st==n-1) return 5000;
        else return min(search(sumA, sumB, sumC, st+1), search(sumA+a[st], sumB+b[st], sumC+c[st], st+1));
    }   
}
int main(void){
    opt=5000;
    cin>>n>>ma>>mb;
    for(int i=0;i<n;i++) cin>>a[i]>>b[i]>>c[i];
    search(0, 0, 0, 0);
    int ans=opt;
    if(ans>=5000||ans==0) ans=-1;
    cout<<ans<<endl;
}

Compiler output:
a.cc: In function 'int search(int, int, int, int)':
a.cc:8:32: error: invalid operands of types 'const char*' and 'const char [2]' to binary 'operator+'
    8 |         string s=(sumA+" "+sumB+" "+sumC+" "+st+" "+" opt:"+opt);
      |                   ~~~~~~~~~~~~~^~~~
      |                           |     |
      |                           |     const char [2]
      |                           const char*
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INTINF = 1<<30;
const int MOD = 1000000007;

void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N;
ll ma,mb;
vector<ll> a,b,c;

ll dp[51][510][510];

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> ma >> mb;
    a.resize(N); b.resize(N); c.resize(N);
    rep(i,N) cin >> a[i] >> b[i] >> c[i];
    for (int i = 0; i < 51; ++i) for (int j = 0; j < 510; ++j) for (int k = 0; k < 510; ++k) dp[i][j][k] = LLINF;
    dp[0][0][0] = 0;
    rep(i,N){
      rep(wa,500){
        rep(wb,500){
          if(dp[i][wa][wb] >= LLINF) continue;

          chmin(dp[i+1][wa][wb], dp[i][wa][wb]);
          chmin(dp[i+1][wa][wb], dp[i][wa][wb] + c[i]);
        }
      }
    }
    ll ans = LLINF;
    REP(wa,1,500){
      REP(wb,1,500){
        if (wa * mb != wb * ma) continue;
        chmin(ans, dp[N][wa][wb]);
      }
    }
    if (ans < INF) cout << ans << endl;
    else cout << -1 << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:54:15: error: 'INF' was not declared in this scope
   54 |     if (ans < INF) cout << ans << endl;
      |               ^~~
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INTINF = 1<<30;
const int MOD = 1000000007;

void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N;
ll ma,mb;
vector<ll> a,b,c;

ll dp[51][510][510];

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> ma >> mb;
    a.resize(N); b.resize(N); c.resize(N);
    rep(i,N) cin >> a[i] >> b[i] >> c[i];
    for (int i = 0; i < 51; ++i) for (int j = 0; j < 510; ++j) for (int k = 0; k < 510; ++k) dp[i][j][k] = LLINF;
    dp[0][0][0] = 0;
    rep(i,N){
      rep(wa,500){
        rep(wb,500){


Compiler output:
a.cc: In function 'int main()':
a.cc:39:21: error: expected '}' at end of input
   39 |         rep(wb,500){
      |                    ~^
a.cc:39:21: error: expected '}' at end of input
a.cc:38:18: note: to match this '{'
   38 |       rep(wa,500){
      |                  ^
a.cc:39:21: error: expected '}' at end of input
   39 |         rep(wb,500){
      |                     ^
a.cc:37:13: note: to match this '{'
   37 |     rep(i,N){
      |             ^
a.cc:39:21: error: expected '}' at end of input
   39 |         rep(wb,500){
      |                     ^
a.cc:29:15: note: to match this '{'
   29 | int main(void){
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
typedef long long ll;
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(ll i=num, i##_len=(n); i<i##_len; ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const ll LLINF = 1LL<<60;
const int INTINF = 1<<30;
const int MOD = 1000000007;

void add(long long &a, long long b) {
  a += b;
  if (a >= MOD) a -= MOD;
}

const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N;
ll ma,mb;
vector<ll> a,b,c;

ll dp[51][510][510];

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> N >> ma >> mb;
    a.resize(N); b.resize(N); c.resize(N);
    rep(i,N) cin >> a[i] >> b[i] >> c[i];
    for (int i = 0; i < 51; ++i) for (int j = 0; j < 510; ++j) for (int k = 0; k < 510; ++k) dp[i][j][k] = LLINF;
    dp[0][0][0] = 0;
    rep(i,N){
      rep(wa,500){
        rep(wb,500){
          

          chmin(dp[i+1][wa][wb], dp[i][wa][wb]);
          chmin(dp[i+1][wa][wb], dp[i][wa][wb] + c[i]);
        }
      }
    }
    ll ans = LLINF;
    REP(wa,1,500){
      REP(wb,1,500){
        if (wa * mb != wb * ma) continue;
        chmin(res, dp[N][wa][wb]);
      }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:51:15: error: 'res' was not declared in this scope; did you mean 'rep'?
   51 |         chmin(res, dp[N][wa][wb]);
      |               ^~~
      |               rep
Language: C

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

const int INF=1e18;
int dp[50][1010][1010];

signed main()
{
  int N,X,Y; cin>>N>>X>>Y;
  vector<int> a(N),b(N),c(N);
  for(int i=0;i<N;i++){
    cin>>a[i]>>b[i]>>c[i];
  }

  for(int i=0;i<=N;i++){
    for(int j=0;j<=1000;j++){
      for(int k=0;k<=1000;k++){
        dp[i][j][k]=INF;
      }
    }
  }
  dp[0][0][0]=0;

  for(int i=0;i<N;i++){
    for(int j=0;j<=1000;j++){
      for(int k=0;k<=1000;k++){
        if(dp[i][j][k]==INF) continue;

        dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k]);
        if(j+a[i]<=1000 and k+b[i]<=1000){
          dp[i+1][j+a[i]][k+b[i]]=min(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i]);
        }
      }
    }
  }

  int ans=INF;
  for(int r=1;;r++){
      int x=r*X;
      int y=r*Y;
      if(x<=1000 and y<=1000){
        ans=min(ans,dp[N][x][y]);
      }else break;
  }
  cout<<(ans==INF? -1:ans)<<endl;

  return 0;
}


Compiler output:
main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
    1 | #include<bits/stdc++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<iostream>
#include<sstream>
#include<fstream>
#include<cstring>/*The header <string> and
<string.h> does not contain the useful
function 'memset' and 'memcpy'.*/
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<utility>
#include<algorithm>
#include<functional>
#include<ctime>
#include<cmath>
#include<cstdlib>
#include<cstdio>
using namespace std;
vector<pair<pair<int,int>,int> > X;
int init=1000000000,ans=1000000000,dp[50],N,A,B;
void dfs(int pos,int a,int b,int c)
{
	if(pos==X.size())
	{
		if(a==A&&b==B)
			ans=min(ans,c);
		return ;
	}
	dfs(pos+1,a,b,c);
	if(a+X[pos].first.first<=A&&b+X[pos].first.second<=B)
		dfs(pos+1,a+X[pos].first.first,b+X[pos].first.second,c+X[pos].second);
	return ;
}
int main()
{
	cin.tie();
	cout.tie();
	ios_base::sync_with_stdio(false);
	cin>>N>>A>>B;
	for(int i=0;i<N;i++)
	{
		int x,y,z;
		cin>>x>>y>>z;
		if(x*B==y*A)
			init=min(init,z);
		else	X.push_back(make_pair(make_pair(x,y),z));
	}
	sort(X.begin(),X.end());
	int Ai=A,Bi=B;
	while(A<=10&&B<=10)
	{
		vector<pair<pair<int,int>,int> > V;
		for(int i=0;i<X.size();i++)
			if(X[i].first.first<=A&&X[i].first.second<=B)
				V.push_back(X[i]);
		swap(V,X);
		dfs(0,0,0,0);
		A+=Ai;
		B+=Bi;
		swap(V,X);
	}
	cout<<(init==INT_MAX&&ans==INT_MAX?-1:min(init,ans))<<endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:65:22: error: 'INT_MAX' was not declared in this scope
   65 |         cout<<(init==INT_MAX&&ans==INT_MAX?-1:min(init,ans))<<endl;
      |                      ^~~~~~~
a.cc:21:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
   20 | #include<cstdio>
  +++ |+#include <climits>
   21 | using namespace std;
Language: C++

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

int INF = 1'000'000'000;

int main(){
    int n, ma, mb;
    cin >> n >> ma >> mb;
    vector<vector<int>> med(401, vector<int>(401, INF));
    queue<tuple<int, int, int>> que; 
    int a, b, c;
    for (int i = 0; i < n; i++){
        cin >> a >> b >> c;
        que.push(tie(a, b, c));
        for (int x = 0; x < 401; x++){
            for (int y = 0; y < 401; y++){
                if (med[x][y] != INF) que.push(tie(x + a, y + b, med[x][y] + c));
            }
        }
        while (que.size() > 0){
            a = get<0>(que.front());
            b = get<1>(que.front());
            c = get<2>(que.front());
            que.pop();
            med[a][b] = min(med[a][b], c);
        }
    }
    int ans = INF;
    int x = 0;
    int y = 0;
    while (1){
        x += ma;
        y += mb;
        if (x > 400 || y > 400) break;
        ans = min(ans, med[x][y]);
    }
    if (ans == INF) cout << -1 << endl;
    else cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:54: error: cannot bind non-const lvalue reference of type 'int&' to an rvalue of type 'int'
   17 |                 if (med[x][y] != INF) que.push(tie(x + a, y + b, med[x][y] + c));
      |                                                    ~~^~~
In file included from /usr/include/c++/14/bits/memory_resource.h:47,
                 from /usr/include/c++/14/string:68,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/tuple:2791:19: note:   initializing argument 1 of 'constexpr std::tuple<_Elements& ...> std::tie(_Elements& ...) [with _Elements = {int, int, int}]'
 2791 |     tie(_Elements&... __args) noexcept
      |         ~~~~~~~~~~^~~~~~~~~~
Language: C++

#include <iostream>
#include <cstdio>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(int i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない
//UnionFind

const int nmax=40,abmax=10,inf = 1000000;
int a[nmax],b[nmax],c[nmax];
int dp[nmax+1][nmax*abmax+1][nmax*abmax+1];
int main(void){
    int n,ma,mb;
    cin >> n >> ma >> mb;
    for(int i=0;i<n;++i){
        cin >> a[i] >> b[i] >> c[i];
}
    for(int i = 0; i <= n; ++i){
        for(int ca = 0; ca <= nmax*abmax; ++ca){
            for(int cb = 0; cb <= nmax*abmax; ++cb){
                dp[i][ca][cb]=inf;
} }
    }
    dp[0][0][0]=0;

for(inti=0;i<n;++i){
for(int ca = 0; ca <= nmax*abmax; ++ca){
            for(int cb = 0; cb <= nmax*abmax; ++cb){
                if(dp[i][ca][cb]==inf) continue;
                dp[i+1][ca][cb]=min(dp[i+1][ca][cb],dp[i][ca][cb]);
                dp[i+1][ca+a[i]][cb+b[i]]=min(dp[i+1][ca+a[i]][cb+b[i]],dp[i][ca][cb]+c[i]);
} }
}
    int ans=inf;
    for(int ca = 1; ca <= nmax*abmax; ++ca){
        for(int cb = 1; cb <= nmax*abmax; ++cb){
            if(ca*mb==cb*ma) ans=min(ans,dp[n][ca][cb]);
} }
    if(ans==inf) ans=-1;
    cout << ans << endl;
return 0; }

Compiler output:
a.cc: In function 'int main()':
a.cc:43:5: error: 'inti' was not declared in this scope; did you mean 'int'?
   43 | for(inti=0;i<n;++i){
      |     ^~~~
      |     int
a.cc:43:12: error: 'i' was not declared in this scope
   43 | for(inti=0;i<n;++i){
      |            ^
Language: C++

/*#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <array>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <unordered_map>
#include <unordered_set>
*/

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

#define int long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define FOR(i,a,b) for(int (i)=(a);(i)<(b);(i)++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(a) reverse((c).begin(),(c).end())

typedef long long ll;
const ll INF = 1LL<<60;
const ll mod = 1e9 + 7;
const int MAX_N = 5e5 + 5;
int dx[] = { -1,0,1,0 }, dy[] = { 0,1,0,-1 };
vector<ll> prime;

ll inv[MAX_N], fac[MAX_N];

template <class T = ll> T in() { T x; cin >> x; return (x); }
inline ll GCD(ll a, ll b) { ll c; while (b != 0) { c = a % b; a = b; b = c; }return a; }
inline ll LCM(ll a, ll b) { return a * b / GCD(a, b); }
inline ll POW(ll a, ll b) { ll c = 1; while (b > 0) { if (b & 1) { c = a * c%mod; }a = a * a%mod; b >>= 1LL; }return c; }
inline void _nCr() { fac[0] = 1; for (int i = 1LL; i < MAX_N; i++) { fac[i] = fac[i - 1] * i%mod; }for (int i = 0; i < MAX_N; i++) { inv[i] = POW(fac[i], mod - 2); } }
inline ll nCr(ll n, ll r) { return (fac[n] * inv[r] % mod)*inv[n - r] % mod; }
inline void PRI(ll n) { bool a[n + 1]; for (int i = 0; i < n + 1; i++) { a[i] = 1; }for (int i = 2; i < n + 1; i++) { if (a[i]) { prime.pb(i); ll b = i; while (b <= n) { a[b] = 0; b += i; } } } }

typedef pair<int, pair<int, int>> edge;

int dp[500][500];

signed main() {
	int n,Ma,Mb;
	cin >> n >> Ma >> Mb;
	pair<int,pair<int,int>> C[n];
	REP (i,n) {
		cin >> C[i].F >> C[i].S.F >> C[i].S.S;
	}
	REP (i,500) REP (j,500) dp[i][j] = INF;
	sort(C,C+n);
	dp[0][0] = 0;
	REP (i,n) {
		int x = C[i].S.F,y = C[i].S.S;
		int cost = C[i].F;
		REP (j,410) {
			REP (k,410) {
				if (dp[i][j] != INF) {
					dp[i+x][j+y] = min(dp[i+x][j+y],dp[i][j] + cost);
				}
			}
		}
	}
	int ans = INF;
	FOR (i,1,410) {
		FOR (j,1,410) {
			if (i * mb == j * ma) ans = min(ans,dp[i][j]);
		}
	}
	if (ans == INF) cout << -1 << endl;
	else cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:77:33: error: 'mb' was not declared in this scope; did you mean 'Mb'?
   77 |                         if (i * mb == j * ma) ans = min(ans,dp[i][j]);
      |                                 ^~
      |                                 Mb
a.cc:77:43: error: 'ma' was not declared in this scope; did you mean 'Ma'?
   77 |                         if (i * mb == j * ma) ans = min(ans,dp[i][j]);
      |                                           ^~
      |                                           Ma
Language: C

#pragma comment (linker, "/STACK:256000000")
#include "bits/stdc++.h"
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a),i##_len=(b);i<i##_len;++i)
#define BUGAVOID(x) x
#define rep(...) BUGAVOID(_overload3(__VA_ARGS__,repi,_rep,_rep)(__VA_ARGS__))
#define sz(c) (int)(c.size())
#define all(c) c.begin(),c.end()
#define mp make_pair
#define write(x) cout<<(x)<<"\n"
using namespace std; typedef long long ll;
typedef vector<int> vi; typedef vector<ll> vll; template<class T, class U>using vp = vector<pair<T, U>>;
template<class T>using vv = vector<vector<T>>; template<class T, class U>using vvp = vv<pair<T, U>>;
template<class T>vv<T> vvec(const size_t n, const size_t m, const T v) { return vv<T>(n, vector<T>(m, v)); }
template<class T>bool chmax(T &a, const T &b) { if (a < b) { a = b; return 1; }return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; }return 0; }
constexpr ll pow2(const int n) { return 1ll << n; }
constexpr int INF = 1 << 28; constexpr ll LINF = 1ll << 60;
constexpr int MAX = 1e5 + 5; constexpr int MOD = 1e9 + 7; constexpr double EPS = 1e-6;
constexpr int dy[4] = { 0,1,0,-1 }; constexpr int dx[4] = { 1,0,-1,0 };
struct aaa { aaa() { cin.tie(0); ios::sync_with_stdio(0); }; }aaaa;

int N, Ma, Mb;
vi A, B, C;
vv<int> dp;

int main() {
    cin >> N >> Ma >> Mb;
    A.resize(N);
    B.resize(N);
    C.resize(N);
    rep(i, N) {
        cin >> A[i] >> B[i] >> C[i];
    }

    dp = vvec(N + 1, 401 * 401, INF);
    dp[0][0] = 0;

    rep(i, 1, N + 1) {
        rep(j, 401 * 401) {
            const int a = j % 401;
            const int b = j / 401;
            if (a + A[i - 1] > 400 || b + B[i - 1] > 400) continue;
            const int k = a + A[i - 1] + 401 * (b + B[i - 1]);

            chmin(dp[i][j], dp[i - 1][j]);
            chmin(dp[i][k], dp[i - 1][j] + C[i - 1]);
        }
    }

    int ans = INF;
    rep(j, 401 * 401) {
        const int a = j % 401;
        const int b = j / 401;
        if (a * Mb == b * Ma && a != 0 && b != 0) {
            chmin(ans, dp[N][j]);
        }
    }
    if (ans == INF) {
        write(-1);
    }
    else {
        write(ans);
    }
}

Compiler output:
main.c:2:10: fatal error: bits/stdc++.h: No such file or directory
    2 | #include "bits/stdc++.h"
      |          ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define LLIandI pair<long long int , int>
#define ll long long

//DPバージョン
int main(void){
    int N,Ma,Mb;
    scanf("%d %d %d",&N,&Ma,&Mb);
    int A[50],B[50],C[50];
    int dp[41][41*11*11*2];
    //dp[i][j]=m i番までの薬品を使ってM_a*b-M_b*a(絶対値N(=40)*Ma,Mb(=10)*max(a),max(b)(=10)=4000以下)=Jにしたときの最低のコストがmということを表す
    //Jについては、添字jについてJ=k-N*10*10とする。(kは0以上2*N*10*10以下 )
    rep(i,N)rep(j,N*10*10*2+1)dp[i][j]=INF;
    rep(i,N){
        scanf("%d %d %d",&A[i],&B[i],&C[i]);
        if(i==0){
            dp[i][N*100]=0;
            dp[i][N*100+Ma*B[i]-Mb*A[i]]=C[i];
        }
    }
    rep(i,N){
        rep(k,2*100*N+1){
            //i-1番めまでは一切使わない時の例外処理
            dp[i][　N*100+Ma*B[i]-Mb*A[i]　]=min (C[i], dp[i][ N*100+Ma*B[i]-Mb*A[i] ] );
            if(i<N-1){
                if(dp[i][k]==0)continue;//i番目までは全く使っていないものについては上で処理するので継承しない
                int newJ=Ma*B[i+1]-Mb*A[i+1];
                //i+1を使う時
                dp[i+1][k+newJ]=min(dp[i][k]+C[i+1], dp[i+1][k+newJ] );
                //i+1を使わない時
                dp[i+1][k]=min(dp[i][k],dp[i+1][k]);
            }
            
        }
    }
    
    if(dp[N-1][N*100]>=INF||dp[N-1][N*100]<=0)printf("%d\n",-1);
    else printf("%d\n",dp[N-1][N*100]);
}


Compiler output:
a.cc:39:19: error: extended character 　 is not valid in an identifier
   39 |             dp[i][　N*100+Ma*B[i]-Mb*A[i]　]=min (C[i], dp[i][ N*100+Ma*B[i]-Mb*A[i] ] );
      |                   ^
a.cc:39:42: error: extended character 　 is not valid in an identifier
   39 |             dp[i][　N*100+Ma*B[i]-Mb*A[i]　]=min (C[i], dp[i][ N*100+Ma*B[i]-Mb*A[i] ] );
      |                                          ^
a.cc: In function 'int main()':
a.cc:39:19: error: '\U00003000N' was not declared in this scope
   39 |             dp[i][　N*100+Ma*B[i]-Mb*A[i]　]=min (C[i], dp[i][ N*100+Ma*B[i]-Mb*A[i] ] );
      |                   ^~~
a.cc:39:42: error: expected ']' before '\U00003000'
   39 |             dp[i][　N*100+Ma*B[i]-Mb*A[i]　]=min (C[i], dp[i][ N*100+Ma*B[i]-Mb*A[i] ] );
      |                                          ^~
      |                                          ]
Language: C++

#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<set>
#include<cstring>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define mp make_pair
#define pb push_back
#define LLIandI pair<long long int , int>
#define ll long long

//DPバージョン
int main(void){
    int N,Ma,Mb;
    scanf("%d %d %d",&N,&Ma,&Mb);
    int A[50],B[50],C[50];
    int dp[41][41*11*11*2];
    //dp[i][j]=m i番までの薬品を使ってM_a*b-M_b*a(絶対値N(=40)*Ma,Mb(=10)*max(a),max(b)(=10)=4000以下)=Jにしたときの最低のコストがmということを表す
    //Jについては、添字jについてJ=k-N*10*10とする。(kは0以上2*N*10*10以下 )
    rep(i,N)rep(j,N*10*10*2+1)dp[i][j]=INF;
    rep(i,N){
        scanf("%d %d %d",&A[i],&B[i],&C[i]);
        if(i==0){
            dp[i][N*100]=0;
            dp[i][N*100+Ma*B[i]-Mb*A[i]]=C[i];
        }
    }
    rep(i,N){
        rep(k,2*100*N+1){
            //i-1番めまでは一切使わない時の例外処理
            dp[i][　N*100+Ma*B[i]-Mb*A[i]　]=min(C[i],dp[i][N*100+Ma*B[i]-Mb*A[i]] );
            if(i<N-1){
                if(dp[i][k]==0)continue;//i番目までは全く使っていないものについては上で処理するので継承しない
                int newJ=Ma*B[i+1]-Mb*A[i+1];
                //i+1を使う時
                dp[i+1][k+newJ]=min(dp[i][k]+C[i+1], dp[i+1][k+newJ] );
                //i+1を使わない時
                dp[i+1][k]=min(dp[i][k],dp[i+1][k]);
            }
            
        }
    }
    
    if(dp[N-1][N*100]>=INF||dp[N-1][N*100]<=0)printf("%d\n",-1);
    else printf("%d\n",dp[N-1][N*100]);
}


Compiler output:
a.cc:39:19: error: extended character 　 is not valid in an identifier
   39 |             dp[i][　N*100+Ma*B[i]-Mb*A[i]　]=min(C[i],dp[i][N*100+Ma*B[i]-Mb*A[i]] );
      |                   ^
a.cc:39:42: error: extended character 　 is not valid in an identifier
   39 |             dp[i][　N*100+Ma*B[i]-Mb*A[i]　]=min(C[i],dp[i][N*100+Ma*B[i]-Mb*A[i]] );
      |                                          ^
a.cc: In function 'int main()':
a.cc:39:19: error: '\U00003000N' was not declared in this scope
   39 |             dp[i][　N*100+Ma*B[i]-Mb*A[i]　]=min(C[i],dp[i][N*100+Ma*B[i]-Mb*A[i]] );
      |                   ^~~
a.cc:39:42: error: expected ']' before '\U00003000'
   39 |             dp[i][　N*100+Ma*B[i]-Mb*A[i]　]=min(C[i],dp[i][N*100+Ma*B[i]-Mb*A[i]] );
      |                                          ^~
      |                                          ]
Language: Java

import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int N=sc.nextInt();
		int Ma=sc.nextInt();
		int Mb=sc.nextInt();
		int[][][] dp=new int[41][401][401];
		int INF=1000000007;
		for(int i=0; i<=40; i++) {
			for(int j=0; j<=400; j++) {
				Arrays.fill(dp[i][j],INF);
			}
		}
		dp[0][0][0]=0;
		int[][] kusuri=new int[N][3];
		for(int i=0; i<N; i++) {
			kusuri[i][0]=sc.nextInt();
			kusuri[i][1]=sc.nextInt();
			kusuri[i][2]=sc.nextInt();
		}
		for(int i=0; i<N; i++) {
			for(int j=0; j<=400; j++) {
				for(int k=0; k<=400; k++) {
					if(dp[i][j][k]<INF) {
						dp[i+1][j][k]=Math.min(dp[i+1][j][k],dp[i][j][k]);
						dp[i+1][j+kusuri[i][0]][k+kusuri[i][1]]=Math.min(dp[i+1][j+kusuri[i][0]][k+kusuri[i][1]],dp[i][j][k]+kusuri[i][2]);
					}
				}
			}
		}
		int min=114514810;
		int counter=1;
		while(Ma*counter<=400 && Mb*counter<=400) {
			min=Math.min(dp[N][Ma*counter][Mb*counter],min);
			counter++;
		}
		System.out.println(min);
	}
}

Compiler output:
Main.java:13: error: cannot find symbol
				Arrays.fill(dp[i][j],INF);
				^
  symbol:   variable Arrays
  location: class Main
1 error
Language: C++

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

int N,Ma,Mb;
vector<int> a(50),b(50),c(50);

int dp(int n,int x,int y,int z,int m){
  if(n==1){
    if(Ma*(y+b[1])==Mb*(x+a[1])){
      if(z+c[1]<m){return z+c[1];}
      else{return m;}
    }
    else{return m;}
  }
  else{
    if(Ma*(y+b[n])!=Mb*(x+a[n])){
      return dp(
  
int main(){
  cin >> N >> Ma >> Mb;
  for(int i=1;i<=N;i++){cin >> a[i] >> b[i] >> c[i];}


Compiler output:
a.cc: In function 'int dp(int, int, int, int, int)':
a.cc:19:1: error: expected primary-expression before 'int'
   19 | int main(){
      | ^~~
a.cc:21:54: error: expected ';' at end of input
   21 |   for(int i=1;i<=N;i++){cin >> a[i] >> b[i] >> c[i];}
      |                                                      ^
      |                                                      ;
a.cc:21:54: error: expected '}' at end of input
a.cc:16:33: note: to match this '{'
   16 |     if(Ma*(y+b[n])!=Mb*(x+a[n])){
      |                                 ^
a.cc:21:54: error: expected '}' at end of input
   21 |   for(int i=1;i<=N;i++){cin >> a[i] >> b[i] >> c[i];}
      |                                                      ^
a.cc:15:7: note: to match this '{'
   15 |   else{
      |       ^
a.cc:21:54: error: expected '}' at end of input
   21 |   for(int i=1;i<=N;i++){cin >> a[i] >> b[i] >> c[i];}
      |                                                      ^
a.cc:7:38: note: to match this '{'
    7 | int dp(int n,int x,int y,int z,int m){
      |                                      ^
Language: Java

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int Ma = sc.nextInt();
		int Mb = sc.nextInt();
		int[] a = new int[N];
		int[] b = new int[N];
		int[] c = new int[N];
		for(int i = 0; i < N; i++) {
			a[i] = sc.nextInt();
			b[i] = sc.nextInt();
			c[i] = sc.nextInt();
		}
		sc.close();
		int n = 401;

		int[][][] dp = new int[N + 1][n][n];
		int INF = 100000000;
		for(int i = 0; i <= N; i++) {
			for(int j = 0; j < n; j++) {
				for(int k = 0; k < n; k++) {
					dp[i][j][k] = INF;
				}
			}
		}
		dp[0][0][0] = 0;
		for(int i = 0; i < N; i++) {
			for(int j = 0; j < n; j++) {
				for(int k = 0; k < n; k++) {
					if(dp[i][j][k] != INF) {
						int A = j + a[i];
						int B = k + b[i];
						dp[i + 1][j][k] = Math.min(dp[i + 1][j][k], dp[i][j][k]);
						dp[i + 1][A][B] = Math.min(dp[i + 1][A][B], dp[i][A][B] + c[i]);
					}
				}
			}
		}
		int min = INF;
		for(int j = 1; j < n; j++) {
			for(int k = 0; k < n; k++) {
				if(Ma * j == Mb * k) {
					min = Math.min(min, dp[N][j][k]);
				}
			}
		}
		if(min == INF) min = -1;
		System.out.println(min);
	}

Compiler output:
Main.java:52: error: reached end of file while parsing
	}
	 ^
1 error
Language: C

#include<stdio.h>
#define INF 999999

int dp[41][160801];

int min(int x,int y){
	if(x<y)return x;
	return y;
}

int max(int x,int y){
	if(x>y)return x;
	return y;
}

int main(){
	int N,A,B,i,m=INF;
	scanf("%d%d%d",&N,&A,&B);
	int a[N],b[N],c[N],s[N];
	for(i=0;i<N;i++){
		scanf("%d%d%d",&a[i],&b[i],&c[i]);
		s[i]=a[i]*401+b[i];
	}
	
	for(i=0;i<41;i++)for(int j=0;j<160801;j++)dp[i][j]=INF;
	dp[0][0]=0;
	for(i=0;i<N;i++){
		for(int j=0;j<160801;j++){
			dp[i+1][j] = min(dp[i+1][j], dp[i][j]);
			if(j>=s[i])dp[i+1][j]=min(dp[i+1][j],dp[i][j-s[i]]+c[i]);
		}
	for(i=1;i<=400/max(A,B);i++){
		if(dp[N][A*i*401+B*i]<m){
			m=dp[N][A*i*401+B*i];
		}
	}
	if(m<INF)printf("%d\n",m);
	else printf("-1\n");
	return 0;
}

Compiler output:
main.c: In function 'main':
main.c:40:1: error: expected declaration or statement at end of input
   40 | }
      | ^
Language: C++

#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(){
	int n,x,y;
	cin>>n>>x>>y;
	int a[n+1],b[n+1],c[n+1];
	ll dp[50][501][501];
	ll INF=10000000;
	for(int i=0; i<n; i++){
		cin>>a[i]>>b[i]>>c[i];
	}
	for(int i=0; i<=50; i++){
		for(int j=0; j<=500; j++){
			for(int k=0; k<=500; k++){
				dp[i][j][k]=INF;
			}
		}
	}
	dp[0][0][0]=0;
	for(int i=0; i<n; i++){
		for(int j=0; j<500; j++){
			for(int k=0; k<500; k++){
				if(dp[i][j][k]==INF){continue;}
				dp[i+1][j+a[i]][k+b[i]]=min(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i]);
				dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k]);
			}
		}
	}
	ll ans=10000000;
		for(int j=0; j<500; j++){
			for(int k=0; k<500; k++){
				if(dp[i][j][k]){
					if(j*y==k*x){
						ans=min(ans,dp[n][j][k]);
					}
				}
			}
	}
	if(ans==10000000){
		cout<<-1;
	}
	else{
		cout<<ans;
    }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:33:39: error: 'i' was not declared in this scope
   33 |                                 if(dp[i][j][k]){
      |                                       ^
Language: C++

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

typedef pair<int, int> P;
const ll LLINF = LLONG_MAX;
#define REP(i, n) for (int i = 0; i < n; i++)

int n, ma, mb, a[45], b[45], c[45];

void build(int bg, int en, map<P, int> &mp) {
    int _n = en - bg;
    REP(i, (1 << _n)) {
        int at = 0, bt = 0, ct = 0;
        REP(j, _n) {
            if ((i >> j) & 1) {
                at += a[j + bg];
                bt += b[j + bg];
                ct += c[j + bg];
            }
        }
        if (!mp.count({at, bt}) || mp[{at, bt}] > ct) {
            mp[{at, bt}] = ct;
        }
    }
}

int main() {
    map<P, int> mp1, mp2;
    cin >> n >> ma >> mb;
    REP(i, n) cin >> a[i] >> b[i] >> c[i];
    build(0, n / 2, mp1);
    build(n / 2, n, mp2);
    int ans = IINF;
    for (auto it1 : mp1) {
        for (auto it2 : mp2) {
            int as, bs;
            as = it1.first.first + it2.first.first;
            bs = it1.first.second + it2.first.second;
            if (as * bs > 0 && as * mb == bs * ma) {
                ans = min(ans, it1.second + it2.second);
            }
        }
    }
    cout << (ans != IINF ? ans : -1) << endl;
    return 0;
}


Compiler output:
a.cc:5:7: error: 'll' does not name a type
    5 | const ll LLINF = LLONG_MAX;
      |       ^~
a.cc: In function 'int main()':
a.cc:33:15: error: 'IINF' was not declared in this scope
   33 |     int ans = IINF;
      |               ^~~~
Language: C++

#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<functional>
#include<vector>
#include<math.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(int i=0;i<(n);i++)
int inf = 1000000000;
ll INF = 1000000000000000000;
int n, ma, mb, a[50], b[50], c[50];
int dp[50][1000][1000];
int main() {
	cin >> n >> ma >> mb;
	rep(i, 50) {
		rep(j, 1000) {
			rep(k, 1000)dp[i][j][k] = inf;
		}
	}
	rep(i, n)cin >> a[i] >> b[i] >> c[i];
	dp[0][0][0] = 0;
	for (int i = 1; i <= n; i++) {
		rep(j, 1000) {
			rep(k, 1000) {
				if (j < a[i - 1] || k < b[i - 1])dp[i][j][k] = dp[i - 1][j][k];
				else dp[i][j][k] = min(dp[i - 1][j][k], dp[i - 1][j - a[i - 1]][k - b[i - 1]] + c[i - 1]);
			}
		}
	}
	int ans = inf;
	for (int i = 1; ma*i < 1000 && mb*i < 1000; i++) {
		int z = ans;
		ans = min(ans, dp[n][ma * i][mb * i]);
	}
	if (ans == inf)cout << -1 << endl;
	else cout << ans << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:9: error: 'cin' was not declared in this scope
   17 |         cin >> n >> ma >> mb;
      |         ^~~
a.cc:8:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    7 | #include<math.h>
  +++ |+#include <iostream>
    8 | using namespace std;
a.cc:38:24: error: 'cout' was not declared in this scope
   38 |         if (ans == inf)cout << -1 << endl;
      |                        ^~~~
a.cc:38:24: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:38:38: error: 'endl' was not declared in this scope
   38 |         if (ans == inf)cout << -1 << endl;
      |                                      ^~~~
a.cc:8:1: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
    7 | #include<math.h>
  +++ |+#include <ostream>
    8 | using namespace std;
a.cc:39:14: error: 'cout' was not declared in this scope
   39 |         else cout << ans << endl;
      |              ^~~~
a.cc:39:14: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
a.cc:39:29: error: 'endl' was not declared in this scope
   39 |         else cout << ans << endl;
      |                             ^~~~
a.cc:39:29: note: 'std::endl' is defined in header '<ostream>'; this is probably fixable by adding '#include <ostream>'
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <cstring>

using namespace std;
// ascending order
#define vsort(v) sort(v.begin(), v.end())
// descending order
#define vsort_r(v) sort(v.begin(), v.end(), greater<int>())
#define vunique(v) unique(v.begin(), v.end())
#define mp make_pair
#define ts(x) to_string(x)
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define repm(i, a, b) for(int i = (int)a; i > (int)b; i--)
#define bit(a) bitset<8>(a)
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, Ma, Mb;
	cin >> N >> Ma >> Mb;
	int a[N], b[N], c[N];
	rep(i, 0, N) cin >> a[i] >> b[i] >> c[i];

	if((Ma * i) % Mb != 0) {
		cout << -1 << endl;
		return 0;
	}

	int dp[N + 1][N * Ma + 1][N * Mb + 1];

	rep(i, 0, N + 1) rep(j, 0, N * Ma + 1) rep(k, 0, N * Mb + 1) dp[i][j][k] = 1e9;

	dp[0][0][0] = 0;
	
	rep(i, 0, N) {
		rep(j, 0, N * Ma + 1) {
			rep(k, 0, N * Mb + 1) {
				if(k - b[i] >= 0 && j - a[i] >= 0) {
					dp[i + 1][j][k] = min(dp[i][j][k], dp[i][j - a[i]][k - b[i]] + c[i]);
				} else dp[i + 1][j][k] = dp[i][j][k];
			}
		}
	}
	
	int i = 1;
	int ans = 1e9;
	while(true) {
		if(i >= N * Ma + 1 || ((Ma * i) / Mb) >= N * Mb + 1) break;
		ans = min(ans, dp[N][i][(Ma * i) / Mb]);
		i++;	
	}

	if(ans == 0 || ans == 1e9) cout << -1 << endl;
	else cout << ans << endl;

}


Compiler output:
a.cc: In function 'int main()':
a.cc:37:18: error: 'i' was not declared in this scope
   37 |         if((Ma * i) % Mb != 0) {
      |                  ^
Language: C

#define T 999 D[T][T],i,j,x,y,a,b,c,R;main(k){scanf("%*d%d%d",&x,&y);for(D[0][0]=9999;~scanf("%d%d%d",&a,&b,&c);)for(i=T;i-->a;)for(j=T;j-->b;)k=D[i-a][j-b]-c,D[i][j]<k?D[i][j]=k:0;for(i=x,j=y;i<T&&j<T;i+=x,j+=y)D[i][j]>R?R=D[i][j]:0;printf("%d\n",R>0?9999-R:-1);}

Compiler output:
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/14/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int ll;

#define all(x) x.begin(),x.end()

const ll mod = 1e9+7;
const int INF = 1e9;
const ll MAXN = 1e9;

int main()
{
	int n,m_a,m_b;
	cin >> n >> m_a >> m_b;
	vector<int> a(n+1),b(n+1),c(n+1);
	for(int i = 1; i <= n; i++){
		cin >> a[i] >> b[i] >> c[i];
	}

	int dp[41][401][401] = {0};

	for(int i = 0; i <= 40; i++){
		for(int j = 0; j <=400; j++){
			for(int k = 0; k <= 400; k++){
				dp[i][j][k] = INF;
			}
		}
	}

	dp[0][0][0] = 0;
	for(int i = 1; i <= 40; i++){
		for(int j = 400; j >= 0; j--){
			for(int k = 400; k >= 0; k--){
				if(j-a[i]>=0 && k-b[i]>=0){
					dp[i][j][k] = min(dp[i-1][j-a[i]][k-b[i]]+c[i],dp[i-1][j][k]);
				}else{
					dp[i][j][k] = min(dp[i][j][k],dp[i-1][j][k]);
				}
			}
		}
	}

	int ans = INF;
	for(int j = 1; j <= 400; j++){
			for(int k = 1; k <= 400; k++){
				if(k*m_a == j*m_b && dp[n][j][k] < ans) ans = dp[i][j][k];
			}
		}

	if(ans == INF) cout << -1 << endl;
	else cout << ans << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:82: error: 'i' was not declared in this scope
   56 |                                 if(k*m_a == j*m_b && dp[n][j][k] < ans) ans = dp[i][j][k];
      |                                                                                  ^
Language: C

#include<iostream>
using namespace std;

int a[100], b[100], c[100];
int N, Ma, Mb;

int min_cost = 9999;

void comb(int current_chemical, int sum_a, int sum_b, int sum_c){
  sum_a += a[current_chemical];
  sum_b += b[current_chemical];
  sum_c += c[current_chemical];
  if(sum_c < min_cost){
    if(Ma*sum_b != Mb*sum_a){
      for(int i=current_chemical+1;i<N;++i){
        comb(i, sum_a, sum_b, sum_c);
      }
    }
    else{
      min_cost = sum_c;
    }
  }
}

int main(void){
  int sum_a=0, sum_b=0, sum_c=0;
  cin >> N >> Ma >> Mb;

  for(int i=0;i<N;++i){
      cin >> a[i] >> b[i] >> c[i];
  }
  comb(0, sum_a, sum_b, sum_c);
  cout << ((min_cost == 9999) ? -1 : min_cost) << endl;
}


Compiler output:
main.c:1:9: fatal error: iostream: No such file or directory
    1 | #include<iostream>
      |         ^~~~~~~~~~
compilation terminated.
Language: C++

object Main extends App {
  val scan = new java.util.Scanner(System.in)
  val n = scan.next().toInt
  val ma = scan.next().toInt
  val mb = scan.next().toInt
  val ns = for ( _ <- (1 to n).toArray ) 
    yield (scan.next().toInt, scan.next().toInt, scan.next().toInt)
  val dp: Array[Array[Array[Option[Int]]]] = Array.fill(n+1, 400, 400)(None)
  dp(0)(0)(0) = Some(0)
  for ( i <- 1 to n ) {
    val (a, b, value) = ns(i-1)
    for ( j <- 0 until n ) {
      for ( k <- 0 until n ) {
        dp(i)(j)(k) = (dp(i-1)(j)(k), dp(i)(j)(k)) match {
          case (Some(n), Some(m)) => Some(math.min(n,m))
          case (Some(n), _)       => Some(n)
          case (_, Some(m))       => Some(m)
          case _                  => None
        }
        if (a+j<400 && b+k<400) {
          dp(i)(a+j)(b+k) = (dp(i-1)(j)(k), dp(i-1)(a+j)(b+k)) match {
            case (Some(n), Some(m)) => Some(math.min(n+value,m))
            case (Some(n), _)       => Some(n+value)
            case (_, Some(m))       => Some(m)
            case _                  => None
          }
        }
      }
    }
  }

  val costs = for (i <- 1 until 400; j <- 1 until 400;
    if ma*j == mb*i; if dp(n)(i)(j) != None) yield { dp(n)(i)(j).get }
          
  println(if (costs.nonEmpty) { costs.min } else { -1 })
}

Compiler output:
a.cc:1:1: error: 'object' does not name a type
    1 | object Main extends App {
      | ^~~~~~
Language: C++

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

struct Y {
  int a, b, c;
};

Y v[50];

map<P, int> y;


signed main() {
  int n, m1, m2;
  int ans = 1145141919;
  cin >> n >> m1 >> m2;

  rep(i, 0, n) cin >> v[i].a >> v[i].b >> v[i].c;

  rep(i, 0, 1 << n / 2) {
    Y p;
    rep(j, 0, n / 2) {
      if(1 & i >> j) {
        p.a += v[j].a;
        p.b += v[j].b;
        p.c += v[j].c;
      }
    }

    int n1 = p.a, n2 = p.b;
    while(n1 != n2) {
      if(n1 > n2) n1 -= n2;
      else n2 -= n1;
    }
    if(n1) p.a /= n1;
    if(n1) p.b /= n1;
    y[P(p.a, p.b)] = p.c;
  }

  rep(i, 0, 1 << n / 2 + ((n / 2) % 2 ? 1 : 0)) {
    Y p;
    rep(j, 0, n / 2 + ((n / 2) % 2 ? 1 : 0)) {
      if(1 & i >> j) {
        p.a += v[j + n / 2].a;
        p.b += v[j + n / 2].b;
        p.c += v[j + n / 2].c;
      }
    }
    int n1 = p.a, n2 = p.b;
    if(n1 && n2) {
      while(n1 != n2) {
        if(n1 > n2) n1 -= n2;
        else n2 -= n1;
      }
    }

    int a1m1 - p.a, a2 = m2 - p.b;
    if(n1) a1 = m1 - p.a / n1;
    if(n1) a2 = m2 - p.b / n1;

    rep(i, 0, 10) {
      if(y[P(a1 + i, a2 + i)]) {
        ans = min(ans, p.c + y[P(a1 + i, a2 + i)]);
      }
      if(y[P(a2 + i, a1 + i)]) {
        ans = min(ans, p.c + y[P(a2 + i, a1 + i)]);
      }
    }
  }

  if(ans != 1145141919) {
    cout << ans << endl;
  }else {
    cout << -1 << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:14: error: expected initializer before '-' token
   73 |     int a1m1 - p.a, a2 = m2 - p.b;
      |              ^
a.cc:74:12: error: 'a1' was not declared in this scope; did you mean 'n1'?
   74 |     if(n1) a1 = m1 - p.a / n1;
      |            ^~
      |            n1
a.cc:75:12: error: 'a2' was not declared in this scope; did you mean 'n2'?
   75 |     if(n1) a2 = m2 - p.b / n1;
      |            ^~
      |            n2
a.cc:78:14: error: 'a1' was not declared in this scope; did you mean 'n1'?
   78 |       if(y[P(a1 + i, a2 + i)]) {
      |              ^~
      |              n1
a.cc:78:22: error: 'a2' was not declared in this scope; did you mean 'n2'?
   78 |       if(y[P(a1 + i, a2 + i)]) {
      |                      ^~
      |                      n2
a.cc:81:14: error: 'a2' was not declared in this scope; did you mean 'n2'?
   81 |       if(y[P(a2 + i, a1 + i)]) {
      |              ^~
      |              n2
a.cc:81:22: error: 'a1' was not declared in this scope; did you mean 'n1'?
   81 |       if(y[P(a2 + i, a1 + i)]) {
      |                      ^~
      |                      n1
Language: C++

#include <iostream>
using namespace std;
const int nmax=40,abmax=10,inf=1000000;

int a[nmax],b[nmax],c[nmax];
long long int dp[nmax+1][nmax*abmax+1][nmax*abmax+1];
int main() {
	
	int n,na,nb;
	cin>>n>>na>>nb;
	for(int i=0;i<n;i++)cin>>a[i]>>b[i]>>c[i];
	
	
	for(int i=0;i<=n;i++){
		for(int j=0;j<=nmax*abmax;j++){
			for(int k=0;k<=nmax*abmax;k++){
				dp[i][j][k]=inf;
			}
		}
	}
	
	dp[0][0][0]=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<=nmax*abmax;j++){
			for(int k=0;k<=nmax*abmax;k++){
				if(dp[i][j][k]==inf) continue;
				dp[i+1][j][k]              
				=min(dp[i+1][j][k],
				dp[i][j][k]);
				
				dp[i+1][j+a[i]][k+b[i]]
				=min(dp[i+1][j+a[i]][k+b[i]],
				dp[i][j][k]+c[i]);
				
			}
		}
	}
	
	int ans=inf;
	for(int i=1;i<=nmax*abmax;++i){
		for(int j=1;j<=nmax*abmax;j++){
			if(i*na==j*nb) ans=min(ans,dp[n][i][j]);
		}
	}
	
	if(ans==inf)ans=-1;
	cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:47: error: no matching function for call to 'min(int&, long long int&)'
   42 |                         if(i*na==j*nb) ans=min(ans,dp[n][i][j]);
      |                                            ~~~^~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:233:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  233 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:233:5: note:   template argument deduction/substitution failed:
a.cc:42:47: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'long long int')
   42 |                         if(i*na==j*nb) ans=min(ans,dp[n][i][j]);
      |                                            ~~~^~~~~~~~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  281 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:281:5: note:   candidate expects 3 arguments, 2 provided
Language: C++

#include <iostream>
using namespace std;
int n,na,nb;
int na_max,nb_max;
int a[45],b[45],c[45];
const long long int inf=1145141919;
int main() {
	cin>>n>>na>>nb;
	for(int i=0;i<n;i++)cin>>a[i]>>b[i]>>c[i];
	na_max=na*n*10;
	nb_max=nb*n*10;
	
	int dp[n+5][na_max][nb_max];
	for(int i=0;i<n;i++){
		for(int j=0;j<na_max;j++){
			for(int k=0;k<nb_max;k++){
				dp[i][j][k]=inf;
			}
		}
	}
	
	dp[0][0][0]=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<na_max;j++){
			for(int k=0;k<nb_max;k++){
				
				dp[i+1][j][k]              
				=min(dp[i+1][j][k],dp[i][j][k]);
				
				dp[i+1][j+a[i+1]][k+b[i+1]]
				=min(dp[i+1][j+a[i+1]][k+b[i+1]],dp[i][j][k]+c[i+1]);
			}
		}
	}
	
	for(int i=0;i<n;i++){
		cout<<""<<endl;
		for(int j=0;j<na;j++){
			for(int k=0;k<nb;k++){
				cout<<dp[i][j][k]<<endl;

Compiler output:
a.cc: In function 'int main()':
a.cc:40:57: error: expected '}' at end of input
   40 |                                 cout<<dp[i][j][k]<<endl;
      |                                                         ^
a.cc:39:46: note: to match this '{'
   39 |                         for(int k=0;k<nb;k++){
      |                                              ^
a.cc:40:57: error: expected '}' at end of input
   40 |                                 cout<<dp[i][j][k]<<endl;
      |                                                         ^
a.cc:38:38: note: to match this '{'
   38 |                 for(int j=0;j<na;j++){
      |                                      ^
a.cc:40:57: error: expected '}' at end of input
   40 |                                 cout<<dp[i][j][k]<<endl;
      |                                                         ^
a.cc:36:29: note: to match this '{'
   36 |         for(int i=0;i<n;i++){
      |                             ^
a.cc:40:57: error: expected '}' at end of input
   40 |                                 cout<<dp[i][j][k]<<endl;
      |                                                         ^
a.cc:7:12: note: to match this '{'
    7 | int main() {
      |            ^