Language: C++

#include <iostream>
#include <vector>
#include <cmath>
#include <typeinfo>
#include <set>
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b){
    ll mi = min(a,b);
    ll ma = max(a,b);
    if(mi == 0){
        return ma;
    }else{
        return gcd(mi, ma%mi);
    }
}

int main(void){
    int n, m;
    cin >> n >> m;
    vector<int> d(4096, 0);
    int ai, bi;
    int ci;
    int key;
    for(int i=0; i<m; i++){
        key = 0;
        cin >> ai >> bi;
        for(int j=0; j<bi; j++){
            cin >> ci;
            key += pow(2,ci-1);
        }
        for(int k = 1; k<=key; k++){
            if(key & k != 0){
                if(d[k]==0){
                    d[k] = ai;
                }else{
                    d[k] = min(d[k], ai);
                }
            }   
        }
    }

    vector<vector<vector<vector<int>>>> dp(n,vector<vector<vector<int>>>(n, {{}}));
    dp[0][0] = {{1}};
    for(int i=1; i<n; i++){
        for(int j=0; j<n; j++){
            if(j==0){
                dp[i][j] = dp[i-1][j];
                dp[i][j][0].push_back(i+1);
            }else{
                for(int k=0; k<dp[i-1][j-1].size(); k++){
                    dp[i][j] = dp[i-1][j-1];
                    dp[i][j][k].push_back(i);
                }
            }
        }
    }
    ll ans = 100000000000;
    bool no;
    for(int i=0; i<n; i++){
        int price = 0;
        for(int k=0; k<dp[n][i].size(); k++){
            int count = 0;
            for(int x=0; x<dp[n][i][k].size(); x++){
                count += dp[n][i][k][x] * pow(2,x);
            }
            if(d[count]!=0){
                price += d[count];
            }else{
                no = true;
            }
        }
        if(!no){
            ans = min(ans, price);
        }
    }
    if(ans == 100000000000){
        cout << -1 << endl;
    }else{
        cout << ans;
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:75:22: error: no matching function for call to 'min(ll&, int&)'
   75 |             ans = min(ans, price);
      |                   ~~~^~~~~~~~~~~~
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:75:22: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   75 |             ans = min(ans, price);
      |                   ~~~^~~~~~~~~~~~
/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