Language: C++

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

typedef pair<int,int>   II;
typedef vector< II >      VII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int 	LL;
typedef unsigned long long int ULL;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define ALL(a) a.begin(),a.end()
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
//Works for forward as well as backward iteration

#define gu getchar
#define pu putchar
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)

#define DRT() int t; si(t); while(t--)

#define PlUSWRAP(index,n) index = (index+1)%n		//index++; if(index>=n) index=0
#define MINUSWRAP(index,n) index = (index + n -1)%n 	//index--; if(index<0) index=n-1
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)	//Round off d to nearest integer

#define FLUSHN while(gu()!='\n')
#define FLUSHS while(gu()!=' ')

#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif

#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const LL N = 4100 + 1;
LL n,m,x;
LL dp[N];
LL set(LL k,LL pos)
{
	return k|(1<<pos);
}
int main() {
	#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
	#endif
	off;
	cin>>n>>m;
	LL lmt = 1<<n;
	rep(i,0,N)
	dp[i] = INT_MAX;
	vector<LL> cost(m);
	vector<LL> bitstate(m,0);
	rep(i,0,m)
	{
		LL t;
		cin>>cost[i]>>t;
		LL val = 0;
		while(t--)
		{
			cin>>x;
			val = set(val,x-1);
		}
		bitstate[i] = val;
	}
	rep(i,0,m)
	{
		rep(j,0,lmt)
		{
			dp[j|bitstate[i]] = min(dp[j|bitstate[i]] , cost[i]+dp[j]);
		}
	}
	if(dp[lmt-1] != INT_MAX)
		cout<<dp[lmt-1];
	else
		cout<<-1;
  	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:114: error: assignment of read-only variable 'i'
   20 | #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
      |                                                                                                                  ^
a.cc:76:9: note: in expansion of macro 'rep'
   76 |         rep(i,0,N)
      |         ^~~
a.cc:88:31: error: reference to 'set' is ambiguous
   88 |                         val = set(val,x-1);
      |                               ^~~
In file included from /usr/include/c++/14/set:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_set.h:96:11: note: candidates are: 'template<class _Key, class _Compare, class _Alloc> class std::set'
   96 |     class set
      |           ^~~
a.cc:64:4: note:                 'LL set(LL, LL)'
   64 | LL set(LL k,LL pos)
      |    ^~~