Language: C++

#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll dp[500][500],a[100],b[100],c[100];
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    for(int i=0; i<=400; i++)
        for(int j=0; j<=400; j++)
            dp[i][j]=1e12;
    int n,p,q;
    cin>>n>>p>>q;
    for(int i=0; i<n; i++)
        cin>>a[i]>>b[i]>>c[i];
    dp[0][0]=0;
    for(int k=0; k<n; k++)
    {
        for(int i=a[k]; i<=400; i++)
        {
            for(int j=b[k]; j<=400; j++)
            {
                dp[i][j]=min(dp[i][j],dp[i-a[k]][j-b[k]]+c[k]);
            }
        }
    }
    int ans=1e12;
    for(int i=1; i<=400; i++)
    {
        if(((p*i)>400) || ((q*i)>400))
            break;
        ans=min(ans,dp[i*p][i*q]);
    }
    if(ans==1e12)
        cout<<"-1"<<endl;
    else
        cout<<ans<<endl;

    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:38:13: warning: overflow in conversion from 'double' to 'int' changes value from '1.0e+12' to '2147483647' [-Woverflow]
   38 |     int ans=1e12;
      |             ^~~~
a.cc:43:16: error: no matching function for call to 'min(int&, ll&)'
   43 |         ans=min(ans,dp[i*p][i*q]);
      |             ~~~^~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/14/algorithm:60,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 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:43:16: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   43 |         ans=min(ans,dp[i*p][i*q]);
      |             ~~~^~~~~~~~~~~~~~~~~~
/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
In file included from /usr/include/c++/14/algorithm:61:
/usr/include/c++/14/bits/stl_algo.h:5686:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(initializer_list<_Tp>)'
 5686 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5686:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5696:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(initializer_list<_Tp>, _Compare)'
 5696 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5696:5: note:   template argument deduction/substitution failed:
a.cc:43:16: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   43 |         ans=min(ans,dp[i*p][i*q]);
      |             ~~~^~~~~~~~~~~~~~~~~~