Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long ull;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long int>> vvl;
typedef pair<int, int> pii;
typedef pair<long long int, long long int> pll;
typedef vector<pair<int, int>> vii;
typedef vector<pair<long long int, long long int>> vll;
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define test() long long int t; cin >> t; cin.ignore(); while(t--) 
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define MOD 1000000007
#define SMOD 998244353
#define pq priority_queue
#define all(x) x.begin(),x.end()
#define SP(x) setprecision(x)
#define sp " "
#define inp(a) ll a;cin>>a;cin.ignore()
#define inps(a,b) ll a,b;cin>>a>>b;cin.ignore()
#define out(a) cout<<SP(20)<<a<<'\n'
#define outs(a,b) cout<<SP(20)<<a<<" "<<b<<'\n'
#define ins insert
#define er erase
#define lb lower_bound
#define ub upper_bound
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
#define inpa(a,n) ll a[n]; for(int i=0; i<n; i++){cin>>a[i];}
#define inpv(a,n) vl a; for(int i=0; i<n; i++){inp(x);a.pb(x);}
#define outa(a,n) for(int i=0;i<n;i++){cout<<a[i]<<" ";}cout<<'\n';
#define outv(v) for(auto i:v){cout<<i<<" ";}cout<<'\n';
set<char> vow = {'a','e','i','o','u','A','E','I','O','U'};
ll xpow(ll n, ll m){if(m==0){return 1;}else{ll x = xpow(n, m/2);if(m&1){return x*x*n;}else{return x*x;}}}
ll xmod(ll a, ll m){return (((a%m)+m)%m);}
ll xmodpow(ll n, ll m, ll y){if(m==0){return 1;}else{ll x = xmodpow(n, m/2, y);if(m&1){return xmod((xmod((xmod(x,y)*xmod(x,y)),y)*xmod(n,y)),y);}else{return xmod((xmod(x,y)*xmod(x,y)),y);}}}

vector <int> p(1005);
vector <int> g[1005];
map <pair<int, vector<int>>, bool> vis;
map <pair<int, vector<int>>, int> dp;
int n, m;

int solve(int ind, vector <int> x){
    if(ind==m){
        bool check = 1;
        for(auto j:x){
            if(j==0){
                check = 0;
            }
        }
        if(check){
            return 0;
        }
        else{
            return (ll)(1e9);
        }
    }
    if(vis[{ind,x}]){
        return dp[{ind, x}];
    }
    vis[{ind, x}]=1;
    ll v = p[ind];
    vl y = x;
    for(auto j:g[ind]){
        y[j]=1;
    }
    return dp[{ind, x}]=min(v+solve(ind+1, y), solve(ind+1, x));
}

int main(){
    // fast();

/* you get what you work for not what you wish for */
    scanf("%d%d", &n, &m)
    for(int i=0; i<m; i++){
        scanf("%d", &p[i]);
        int sz;
        scanf("%d", &sz);
        for(int j=0; j<sz; j++){
            int x;
            scanf("%d", &x);
            x--;
            g[i].pb(x);
        }
    }
    vector <int> x;
    for(int i=0; i<n; i++){
        x.pb(0);
    }
    int y = solve(0, x);
    if(y>=1e9){
        out(-1);
    }
    else{
        out(y);
    }
}

Compiler output:
a.cc: In function 'int solve(int, std::vector<int>)':
a.cc:71:12: error: conversion from 'vector<int>' to non-scalar type 'vector<long long int>' requested
   71 |     vl y = x;
      |            ^
a.cc:75:44: error: could not convert 'y' from 'vector<long long int>' to 'vector<int>'
   75 |     return dp[{ind, x}]=min(v+solve(ind+1, y), solve(ind+1, x));
      |                                            ^
      |                                            |
      |                                            vector<long long int>
a.cc: In function 'int main()':
a.cc:82:26: error: expected ';' before 'for'
   82 |     scanf("%d%d", &n, &m)
      |                          ^
      |                          ;
   83 |     for(int i=0; i<m; i++){
      |     ~~~                   
a.cc:83:18: error: 'i' was not declared in this scope; did you mean 'vi'?
   83 |     for(int i=0; i<m; i++){
      |                  ^
      |                  vi