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

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

#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP0(i,n) for(LL i=0, i##_len=(n); i<i##_len; ++i)
#define REP1(i,n) for(LL i=1, i##_len=(n); i<=i##_len; ++i)
#define RREP0(i,n) for(LL i=n-1; i>=0; --i)
#define RREP1(i,n) for(LL i=n; i>=1; --i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define FILL(c, v) fill((c).begin(),(c).end(), v)
#define SZ(a) LL((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define CLR(a) memset((a), 0 ,sizeof(a))

inline LL toInt(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long LL;
typedef unsigned long long ULL;

const LL INTINF = 2147483647;
const LL LLINF = 9223372036854775807;
LL gcd(LL a,LL b){return b?gcd(b,a%b):a;}


const LL MAX_V = 1+12+100+1 +1;
struct edge {
  LL to, cap, cost, rev;
};
LL V;
vector<edge> G[MAX_V]; // array of vec
LL dist[MAX_V];
LL prevv[MAX_V], preve[MAX_V];

void add_edge(LL from, LL to, LL cap, LL cost) {
  G[from].push_back( (edge){to, cap, cost, SZ(G[to])} );
  G[to].push_back( (edge){from, 0, -cost, SZ(G[from])-1} );
}

LL mincostflow(LL s, LL t, LL f) {
  LL res=0;
  while(f>0) {
    fill(dist, dist+V, INTINF);
    dist[s]=0;
    bool update = true;
    while (update) {
      update = false;
      REP0(v, V) {
        if (dist[v] == INTINF) continue;
        REP0(i, SZ(G[v])) {
          edge &e = G[v][i];
          if (e.cap > 0 && dist[e.to] > dist[v] + e.cost) {
            dist[e.to] = dist[v] + e.cost;
            prevv[e.to] = v;
            preve[e.to] = i;
            update = true;
          }
        }
      }
    }
    if (dist[t]==INTINF) return -1;
    LL d = f;
    for (LL v=t; v!=s; v=prevv[v]) {
      d = min(d, G[prevv[v]][preve[v]].cap);
    }
    f -= d;
    res += d * dist[t];  
    for (LL v=t; v!=s; v=prevv[v]) {
      edge &e = G[prevv[v]][preve[v]];
      e.cap -= d;
      G[v][e.rev].cap += d;
    }
  }
  return res;
}

void solve() {
  LL N, M; cin >> N >> M;
  V = 2 + N + M;
  REP1(i, M){
    LL a, b; cin >> a >> b;
    add_edge(0, i, 1, a);
    REP1(j, b) {
      LL c; cin >> c;
      add_edge(i, M+c, 1, 0);
      }
  }
  REP1(i, N){
    add_edge(M+i, N+M+1, INTINF, 0);
  }
  cout << mincostflow(0, N+M+1, N) << endl;
}

LL main(LL argc, char const *argv[])
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  std::cout<<std::fixed<<std::setprecision(10);
  solve();
  return 0;
}


Compiler output:
a.cc:16:8: error: 'LL' does not name a type
   16 | inline LL toInt(string s) {LL v; istringstream sin(s);sin>>v;return v;}
      |        ^~
a.cc:95:1: error: '::main' must return 'int'
   95 | LL main(LL argc, char const *argv[])
      | ^~
a.cc:95:4: warning: first argument of 'int main(LL, const char**)' should be 'int' [-Wmain]
   95 | LL main(LL argc, char const *argv[])
      |    ^~~~
Language: C++

#include <bits/stdc++.h>
#include <boost/algorithm/string/join.hpp>
#include <boost/range/irange.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using boost::irange;
using boost::algorithm::join;

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
constexpr int INF = 1<<30;
constexpr ll  LINF = 1LL<<60;

#define Sort(x) sort(x.begin(),x.end())
#define Reverse(x) reverse(x.begin(),x.end())
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ll<<(n))

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

// a = (a+b)%MOD;
void addmod(ll& a, ll b) {
  a = (a+b)%MOD;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========
using boost::multiprecision::cpp_int;

constexpr int N_MAX = 12;
constexpr int M_MAX = 1001;
int N, M;

vi A;
vi B;
vi C;
ll dp[M_MAX][4100] = LINF;


int main(int argc, char** argv) {
  cin >> N >> M;
  A.resize(M);
  B.resize(M);
  C.resize(M);

  // key
  for (int i=0; i<M; i++) {
    cin >> A[i] >> B[i];

    ull x = 0;
    for (int j=0; j<B[i]; j++) {
      int c;
      cin >> c;
      x = x | 1ull<<c;
    }
    C[i] = x;
  }

  for (int i=0; i<M; i++) {
    for (int j=0; j<N; j++) {
      int newJ = j | C[i];
      dp[i+1][newJ] = min({dp[i+1][newJ], dp[i][j] + A[i]});
    }
  }

  int full = int(1ull<<N_MAX) - 1;
  if (dp[M][full] == LINF) {
    cout << -1 << endl;
  } else {
    cout << dp[M][full] << endl;
  }

  return 0;
}


Compiler output:
a.cc:2:10: fatal error: boost/algorithm/string/join.hpp: No such file or directory
    2 | #include <boost/algorithm/string/join.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(ll i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(ll i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;
typedef pair<ll,set<ll>> ve;

const ll INF=(1LL<<50);

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}



int main(){
  ll N,M;
  cin>>N>>M;
  vector<pair<ll,set<ll>>> key;
  set<ll> s;
  REP(M){
    ll yen,cnt;
    cin>>yen>>cnt;
    set<ll> x;
    For(j,cnt){
      ll tmp;
      cin>>tmp;
      s.insert(tmp);
      x.push_back(tmp);
    }
    key.push_back(make_pair(yen,x));
  }
  if(s.size()!=N){
    cout<<-1<<endl;
    return 0;
  }
  auto cmp = [](ve a,ve b){
    return a.first>b.first;
  };
  priority_queue<ve,vector<ve>,decltype(cmp)>q(cmp);
  q.push(ve(0,set<ll>()));
  while(true){
    auto tmp=q.top();q.pop();
    if(tmp.second.size()==N){
      cout<<tmp.first<<endl;
      return 0;
    }
    for (auto &&i : key)
    {
      set<ll> ins;
      ins.merge(i.second);
      ins.merge(tmp.second);
      if(ins.size()>tmp.second.size()){
        q.push(make_pair(tmp.first+i.first,move(ins)));
      }
    }
    
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:59:9: error: 'class std::set<long long int>' has no member named 'push_back'
   59 |       x.push_back(tmp);
      |         ^~~~~~~~~
Language: C++

#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define MOD (ll)(1e9+7)
#define INF 1e17
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }

int fpow(int b,int p)
{
	if(p==0) return 1;
	int h=fpow(b,p/2);
	if(p%2) return h*b%MOD*h%MOD;
	return h*h%MOD;
}

struct Node{
	vector<int> con;
	int tag;
	Node(){
		tag=-1;
		con.clear();
	}
}grp[1050];
int nt=1;
set<int> st;
int dfs(int now){
	st.insert(now);
	grp[now].tag=nt; nt++;
	
	int mt=0,id=0;
	for(auto &i:grp[now].con){
		if(grp[i].tag>mt){
			mt=grp[i].tag;
			id=i;
		}
	}
	if(id!=0) return id;
	
	for(auto &i:grp[now].con){
		int t=dfs(i);
		if(t!=-1) return t;
	}
	
	grp[now].tag=-1; nt--;
	st.erase(now);
	return -1;
}

int32_t main() {
	//ios::sync_with_stdio(false);
	//cin.tie(0);
	
	int n,m;; cin>>n>>m;
	int s,t;
	For(i,0,m-1){
		cin>>s>>t;
		grp[s].con.emplace_back(t);
	}
	grp[1].tag=0;
	int ans=dfs(1);
	if(ans==-1){
		cout<<"-1\n";
		return 0;
	}
	int now=ans;
	vector<int> out;
	while(sz(out)==0 || now!=ans){
		//cout<<now<<"\n";
		//int mt=grp[grp[now].con[0]].tag,id=grp[now].con[0];
		int mt=0,id=0;
		for(auto &i:grp[now].con){
			if(!st.count(i)) continue;
			if(grp[i].tag>mt){
				id=i;
				mt=grp[i].tag;
			}
		}
		out.emplace_back(id);
		now=id;
	}
	vector<int> v;
	for(auto beg:out){
		now=beg;
		while(sz(v)==0 || now!=beg){
			//cout<<now<<"\n";
			//int mt=grp[grp[now].con[0]].tag,id=grp[now].con[0];
			int mt=0,id=0;
			for(auto &i:grp[now].con){
				if(!st.count(i)) continue;
				if(grp[i].tag>mt){
					id=i;
					mt=grp[i].tag;
				}
			}
			v.emplace_back(id);
			now=id;
		}
		if(sz(v)<sz(out)) out=v;
	}
	set<int> st;
	for(auto &i:out) st.inesrt(i);
	for(auto &i:out){
		int cnt=0;
		for(auto &j:grp[i].con)
			if(st.count(j)) cnt++;
		if(cnt>1){
			cout<<"-1\n";
			return 0;
		}
	}
	cout<<sz(out)<<"\n";
	for(auto &i:out) cout<<i<<"\n";
	return 0;
}





























Compiler output:
a.cc: In function 'int32_t main()':
a.cc:112:29: error: 'class std::set<long long int>' has no member named 'inesrt'; did you mean 'insert'?
  112 |         for(auto &i:out) st.inesrt(i);
      |                             ^~~~~~
      |                             insert
Language: C++

#include <iostream>
#include <boost/dynamic_bitset.cpp>
#include <vector>

using namespace std;

int main(void){
    int N, M;
    cin >> N >> M;
    
    vector<int> a(M);
    vector<int, dynamic_bitset<>> c(M, bitset<>(N));
    
    for(int i=0; i<M; i++) {
        int b;
        cin >> a[i] >> b;
        for(int j=0; j<b; j++) {
            int c;
            cin >> c;
            c[i][c-1].set(1);
        }
    }
    
    
    
}


Compiler output:
a.cc:2:10: fatal error: boost/dynamic_bitset.cpp: No such file or directory
    2 | #include <boost/dynamic_bitset.cpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <boost/dynamic_bitset>
#include <vector>

using namespace std;

int main(void){
    int N, M;
    cin >> N >> M;
    
    vector<int> a(M);
    vector<int, dynamic_bitset<>> c(M, bitset<>(N));
    
    for(int i=0; i<M; i++) {
        int b;
        cin >> a[i] >> b;
        for(int j=0; j<b; j++) {
            int c;
            cin >> c;
            c[i][c-1].set(1);
        }
    }
    
    
    
}


Compiler output:
a.cc:2:10: fatal error: boost/dynamic_bitset: No such file or directory
    2 | #include <boost/dynamic_bitset>
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
  #include "LOCAL_DEBUG.hpp"
#endif
#define int long long

const int INF = 1LL << 60;

signed main(){

  int n,m; cin >> n >> m;
  vector<int> a(m),b(m);
  vector<int> c(m);
  for(int i = 0; i < m; i++){
    cin >> a[i] >> b[i];
    int res = 0;
    for(int j = 0; j < b[i]; j++){
      int cost; cin >> cost;
      cost--;
      res += 1 << cost;
    }
    c[i] = res;
  }

  static int dp[1002][(1<<12)+1];
  fill(dp[0],dp[1001]+1<<12,INF);
  dp[0][0] = 0;
  for(int i = 0; i < m; i++){
    for(int k = 0; k < 1<<n; k++){
      dp[i+1][k] = min(dp[i+1][k],dp[i][k]);
      dp[i+1][k|c[i]] = min(dp[i+1][k|c[i]],dp[i][k|c[i]]);
      if(dp[i][k] >= INF) continue;
      dp[i+1][k|c[i]] = min(dp[i+1][k|c[i]],dp[i][k] + a[i]);
    }
    // for(int k = (1<<n)-1; k >= 0; k--){
    //   dp[i+1][k] = min(dp[i+1][k],dp[i][k]);
    //   if(dp[i][k] >= INF) continue;
    //   //cout << a[i] << " " << dp[i][k] << " " << dp[i][k]+a[i] << endl;
    //   dp[i+1][k|c[i]] = min(dp[i+1][k|c[i]],dp[i][k] + a[i]);
    // }
  }
  int ans = dp[m][(1<<n)-1];
  if(ans >= INF) ans = -1;
  cout << ans << endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:27:24: error: invalid operands of types 'long long int*' and 'int' to binary 'operator<<'
   27 |   fill(dp[0],dp[1001]+1<<12,INF);
      |              ~~~~~~~~~~^~~~
      |                      |   |
      |                      |   int
      |                      long long int*
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

ll inf = 1LL<<50;

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  cerr << inf << endl;

  ll n, m;
  cin >> n >> m;
  vl dp(1<<n, inf);
  vl a(m), b(m);
  vector<vi> c(m);
  rep(i, m) {
    cin >> a[i] >> b[i];
    rep(j, b[i]) {
      int cc;
      cin >> cc;
      c[i].push_back(cc-1);
    }
  }

//  rep(i, 1<<n) {
//    cerr << dp[i] << endl;
//  }

  vector<bool> ch(1<<n);

  dp[0] = 0;
  priority_queue<pll, vector<pll>, greater<pll>> pq;
  pq.push({0, 0});
  while (pq.size()) {
    ll cnt, bit;
    tie(cnt, bit) = pq.top();
    pq.pop();

    rep(i, m) {
      ll bi = bit;
      rep(j, b[i]) {
        if ((bi & 1<<c[i][j]) == 0) {
          bi |= 1<<c[i][j];
          cnt++;
        }
      }
      cmin(dp[bi], dp[bit]+a[i]);
      if (bi != (1<<n)-1 && bi != bit && ch[bi] == 0) {
        ch[bi] = 1;
        pq.push({cnt, bi});
      }
    }
  }

  if (dp[(1<<n)-1] == inf) cout << -1 << endl;
  else cout << dp[(1<<n)-1] << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:18: error: 'pll' was not declared in this scope; did you mean 'll'?
   39 |   priority_queue<pll, vector<pll>, greater<pll>> pq;
      |                  ^~~
      |                  ll
a.cc:39:33: error: template argument 2 is invalid
   39 |   priority_queue<pll, vector<pll>, greater<pll>> pq;
      |                                 ^
a.cc:39:47: error: template argument 1 is invalid
   39 |   priority_queue<pll, vector<pll>, greater<pll>> pq;
      |                                               ^~
a.cc:39:47: error: template argument 2 is invalid
a.cc:39:47: error: template argument 3 is invalid
a.cc:40:6: error: request for member 'push' in 'pq', which is of non-class type 'int'
   40 |   pq.push({0, 0});
      |      ^~~~
a.cc:41:13: error: request for member 'size' in 'pq', which is of non-class type 'int'
   41 |   while (pq.size()) {
      |             ^~~~
a.cc:43:24: error: request for member 'top' in 'pq', which is of non-class type 'int'
   43 |     tie(cnt, bit) = pq.top();
      |                        ^~~
a.cc:44:8: error: request for member 'pop' in 'pq', which is of non-class type 'int'
   44 |     pq.pop();
      |        ^~~
a.cc:57:12: error: request for member 'push' in 'pq', which is of non-class type 'int'
   57 |         pq.push({cnt, bi});
      |            ^~~~
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 <ll> p(1005);
vl g[1005];
map <pair<ll, vector<ll>>, bool> vis;
map <pair<ll, vector<ll>>, ll> dp;
ll n;

ll solve(ll ind, vl x){
    if(ind==m){
        bool check = 1;
        for(auto j:x){
            if(j==0){
                check = 0;
            }
        }
        if(check){
            return 0;
        }
        else{
            return (ll)(1e18);
        }
    }
    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 */
    cin >> n;
    inp(m);
    for(int i=0; i<m; i++){
        cin >> p[i];
        ll sz;
        cin >> sz;
        for(int j=0; j<sz; j++){
            ll x;
            cin >> x;
            x--;
            g[i].pb(x);
        }
    }
    vl x;
    for(int i=0; i<n; i++){
        x.pb(0);
    }
    ll y = solve(0, x);
    if(y>=1e10){
        out(-1);
    }
    else{
        out(y);
    }
}

Compiler output:
a.cc: In function 'll solve(ll, vl)':
a.cc:52:13: error: 'm' was not declared in this scope
   52 |     if(ind==m){
      |             ^
Language: C++

#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
const int maxv=1e8+5,N=1005;
int a[4100],w[N];
vector<int> vec[N]
int min(int x,int y){return x<y?x:y;}
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		int k;scanf("%d%d",&w[i],&k);
		for(int j=1;j<=k;j++){
			int x;scanf("%d",&x);
			vec[i].push_back(x);
		}
	}
	int l=(1<<(n+1))-2;
	for(int i=1;i<=l;i++)
		a[i]=maxv;
	a[0]=0;
	for(int i=1;i<=m;i++){
		for(int k=0;k<vec[i].size();k++){
			int sum=(1<<vec[i][k]);
			for(int j=l;j>=sum;j--)
				a[j]=min(a[j-sum]+w[i],a[j]);
		}
	}
	if(a[l]==maxv) cout<<"-1"<<endl;
	else cout<<a[l]<<endl;
	return 0;
}

Compiler output:
a.cc:8:1: error: expected initializer before 'int'
    8 | int min(int x,int y){return x<y?x:y;}
      | ^~~
a.cc: In function 'int main()':
a.cc:16:25: error: 'vec' was not declared in this scope
   16 |                         vec[i].push_back(x);
      |                         ^~~
a.cc:24:31: error: 'vec' was not declared in this scope
   24 |                 for(int k=0;k<vec[i].size();k++){
      |                               ^~~
Language: C++

#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <cstdio>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <utility>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <unordered_map>
#include <limits.h>
#define int long long
using namespace std;
using P = pair<int, int>;
using ll = long long;
using prique = priority_queue<int>;
const int MOD = 1000000007;
const int INF = LLONG_MAX/3;
int dp[1001][4096];
signed main(){
    int n;
    cin>>n;
    int m;
    cin>>m;
    for(int i=0;i<1000;i++){
        for(int j=0;j<4096;j++){
            dp[i][j]=INF;
        }
    }
    dp[0][0]=0;
    for(int i=1;i<=m;i++){
        int a;
        cin>>a;
        int b;
        cin>>b;
        bitset<12> s;
        for(int j=0;j<b;j++){
            int k;
            cin>>k;
            s.set(k-1);
        }
        for(int j=0;j<4096;j++){
            bitset<12> t=j;
            if(dp[i-1][j]!=INF){
                dp[i][(s|t).to_ulong()]=min(dp[i-1][j]+a,dp[i][(s|t).to_ulong()]);
                dp[i][j]=min(dp[i-1][j],dp[i][j]);
            }
            else dp[i][j]=min(dp[i-1][j],dp[i][j]);
        }
    }
    if(dp[m][(int)pow(2,n)-1]!=INF)cout<<dp[m][(int)pow(2,n)-1]<<endl;
    else cout<<-1<<endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:41:9: error: 'bitset' was not declared in this scope
   41 |         bitset<12> s;
      |         ^~~~~~
a.cc:17:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
   16 | #include <limits.h>
  +++ |+#include <bitset>
   17 | #define int long long
a.cc:41:20: error: 's' was not declared in this scope
   41 |         bitset<12> s;
      |                    ^
a.cc:48:24: error: 't' was not declared in this scope
   48 |             bitset<12> t=j;
      |                        ^
Language: C++

#include<iostream>
using namespace std;
#define ll long long

int main(){
  ll N, M;
  cin >> N >> M;
  ll K = 1<<N;

  ll dp[K][M+1];
  for(ll k=0; k<K; ++k) for(ll m=0; m<M+1; ++m) dp[k][m] = (k>0) ? LLONG_MAX : 0;

  for(ll m=0; m<M; ++m){
    ll a, b;
    cin >> a >> b;

    ll x=0, c;
    for(ll i=0; i<b; ++i){
      cin >> c;
      x += 1<<(c-1);
    }

    for(ll k=0; k<K; ++k){
      dp[k][m+1] = dp[k][m];
    }

    for(ll k=0; k<K; ++k){
      if(dp[k][m]!=LLONG_MAX){
        dp[k|x][m+1] = min(dp[k|x][m+1], dp[k][m]+a);
      }
    }
  }

  if(dp[K-1][M]!=LLONG_MAX){
    cout << dp[K-1][M] << endl;
  }else{
    cout << -1 << endl;
  }


  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:11:68: error: 'LLONG_MAX' was not declared in this scope
   11 |   for(ll k=0; k<K; ++k) for(ll m=0; m<M+1; ++m) dp[k][m] = (k>0) ? LLONG_MAX : 0;
      |                                                                    ^~~~~~~~~
a.cc:2:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    1 | #include<iostream>
  +++ |+#include <climits>
    2 | using namespace std;
a.cc:28:20: error: 'LLONG_MAX' was not declared in this scope
   28 |       if(dp[k][m]!=LLONG_MAX){
      |                    ^~~~~~~~~
a.cc:28:20: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
a.cc:34:18: error: 'LLONG_MAX' was not declared in this scope
   34 |   if(dp[K-1][M]!=LLONG_MAX){
      |                  ^~~~~~~~~
a.cc:34:18: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
Language: C++

#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define takeline cin.ignore();
#define sc second
#define N 1005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
ll n,m; ll ar[N]; vector<ll> vc[N]; ll dp[N][(1LL<<13)];
ll maxval(ll i,ll mask){
	if(__builtin_popcountll(mask)==n) return 0;
	if(i==m+1){
		return 1e15;
	}
	if(dp[i][mask]!=-1){
		return dp[i][mask];
	}
	ll a,b;
	a=maxval(i+1,mask);
	ll new_mask=mask;
	for(auto it:vc[i]){
		ll k=(1LL<<(it-1));
		new_mask=(new_mask|k);
	}
	b=maxval(i+1,new_mask)+ar[i];
	return dp[i][mask]=min(a,b);	
}
int main(){	#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l;
	cin>>n>>m;
	memset(dp,-1,sizeof(dp));
	for(i=1;i<=m;i++){
		cin>>ar[i]>>k;
		for(j=1;j<=k;j++){
			cin>>l;
			vc[i].ps(l);
		}
	}

	ll an=maxval(1,0);
	if(an>=1e15){
		cout<<"-1";
	}
	else cout<<an;
	return 0;
}

Compiler output:
a.cc:44:17: error: stray '#' in program
   44 | int main(){     #ifndef ONLINE_JUDGE
      |                 ^
a.cc:47:10: error: #endif without #if
   47 |         #endif
      |          ^~~~~
a.cc: In function 'int main()':
a.cc:44:18: error: 'ifndef' was not declared in this scope; did you mean 'index'?
   44 | int main(){     #ifndef ONLINE_JUDGE
      |                  ^~~~~~
      |                  index
Language: C++

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

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define sz(v) (int)(v).size()

using namespace std;

typedef long long ll;
typedef long double ld;

using P = pair<int, int>;
template<typename T>
struct Edge {
    int u, v;
    T cost;
    Edge(int u, int v, T c) : u(u), v(v), cost(c) {}
    bool operator< (const Edge &e) const {return cost < e.cost;}
};

static const long long MOD = 1000000007;
static const long long LINF = (ll)(1e18+99);
static const int INF = 1e9+99;
static const int MAX = 1005;


vector<int> G[MAX], rG[MAX], vs, ans[1005];
bool used[MAX];
int cmp[MAX];

void dfs(int u) {
  used[u] = true;
  for (int v : G[u]) if (!used[v]) dfs(v);
  vs.pb(u);
}

void rdfs(int u, int k) {
  used[u] = true;
  cmp[u] = k;
  for (int v : rG[u]) if (!used[v]) rdfs(v, k);
}

int scc(int N) {
  for (int i=1; i<=N; i++) used[i] = false;
  for (int i=1; i<=N; i++) if (!used[i]) dfs(i);
  for (int i=1; i<=N; i++) used[i] = false;
  int k = 0;
  for (int i=N-1; i>=0; i--) if (!used[vs[i]]) rdfs(vs[i], k++);
  return k;

}

int main(void) {
    int N, M;
    cin >> N >> M;
    rep(i, 0, M) {
        int a, b;
        cin >> a >> b;
        G[a].pb(b);
        rG[b].pb(a);
    }
    
    int num = scc(N);
    

    if (num==N) {
      puts("-1");
      return 0;
    }
    
    
    
    
    for (int i=1; i<=N; i++) ans[cmp[i]].pb(i);
    for (int i=0; i<num; i++) {
      if (sz(ans[i])>1) {
        cout << sz(ans[i]) << endl;
        for (int u : ans[i]) cout << u << endl;
        return 0;
      }
    }

    assert(0);


    
    return 0;
}





Compiler output:
a.cc: In function 'int main()':
a.cc:97:5: error: 'assert' was not declared in this scope
   97 |     assert(0);
      |     ^~~~~~
a.cc:9:1: note: 'assert' is defined in header '<cassert>'; this is probably fixable by adding '#include <cassert>'
    8 | #include <map>
  +++ |+#include <cassert>
    9 | #include <string>
Language: C++

#include <iostream>
#include <stack>
#include <queue>
#include <string.h>
#include <vector>

using namespace std;

typedef vector <vector<int>> Graph;
const int MAX_N = 10000;

int root;
bool visited[MAX_N];
bool finished[MAX_N];

void dfs(int u, int parent, const Graph &G, stack<int> &path) {
  visited[u] = true;
  path.push(u);

  for (int v : G[u]) {
    if (v == parent) continue;
    if (finished[v]) continue;

    if (visited[v] && !finished[v]) {
      root = v;
      return;
    }

    dfs(v, u, G, path);

    if (root != -1) return;
  }

  path.pop();
  finished[u] = true;
}

vector<int> cycle_detection(int start, const Graph &G) {
  root = -1;
  memset(visited, false, sizeof(visited));
  memset(finished, false, sizeof(finished));
  stack<int> path;

  dfs(start, -1, G, path);

  vector<int> res;

  while (!path.empty()) {
    res.push_back(path.top());
    path.pop();
  }

  return res;
}

int main() {
  int N, M;
  cin >> N >> M;
  Graph G(N + 1);

  int a, b;
  for (int i = 0; i < M; ++i) {
    cin >> a >> b;

    G[a].push_back(b);
  }

  vector<int> path = cycle_detection(1, G);

  if (path.empty()) {
    cout << -1 << endl;
  } else {
    int minV = INT_MAX;
    vector<int> ans;

    for (int root : path) {
      queue<int> que;
      que.push(root);
      memset(visited, false, sizeof(visited));
      int parents[N + 1];
      memset(parents, -1, sizeof(parents));

      while (!que.empty()) {
        int u = que.front();
        que.pop();

        visited[u] = true;

        for (int v : G[u]) {
          if (v == root) {
            int cur = u;
            vector<int> res;

            while (cur != -1) {
              res.push_back(cur);
              cur = parents[cur];
            }

            if (minV > res.size()) {
              minV = res.size();
              ans = res;
            }

            break;
          }

          if (visited[v]) continue;

          parents[v] = u;
          que.push(v);
        }
      }
    }

    cout << minV << endl;
    for (int v : ans) {
      cout << v << endl;
    }
  }

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:73:16: error: 'INT_MAX' was not declared in this scope
   73 |     int minV = INT_MAX;
      |                ^~~~~~~
a.cc:5:1: note: 'INT_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    4 | #include <string.h>
  +++ |+#include <climits>
    5 | #include <vector>
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef map<int, bool> mp;
#define rep(i, n) for(int (i)=0;(i)<(n);(i)++)
#define pr(x) cout<<(x)<<endl

int main(void){
  int n,m,a,b,ok;cin>>n>>m;vector<vi> g(n);vector<vb> l(n,vb(n,0));vb rm(n,0),vs(n,0);
  rep(i,m){cin>>a>>b;g[--a].push_back(--b); if(!l[b][a])l[a][b]=1;else{pr(2);pr(++a);pr(++b);return 0;}}
  auto update=[&](int s,mp& nx,bool r){for(int t:g[s])swap(rm[t],nx[t]),rm[t]=r?rm[t]:1;};
  auto f = [&](auto f, int s, int r) -> bool{
    for(int t:g[s])if(t!=r&&vs[t])return 0;
    if(l[s][r])return vs[s]=1;
    vs[s]=1,ok=0;mp nx;update(s,nx,0);
    for(int t:g[s])if(!nx[t]&&f(f,t,r))ok=1&break;
    update(s,nx,1);
    return vs[s]=ok;
  };
  rep(i, n){rm.assign(n,0),vs.assign(n,0);if (f(f,i,i)){pr(count(vs.begin(),vs.end(),1));rep(j,n)if(vs[j])pr(j+1);return 0;}}
  pr(-1);return 0;
}


Compiler output:
a.cc: In lambda function:
a.cc:17:45: error: expected primary-expression before 'break'
   17 |     for(int t:g[s])if(!nx[t]&&f(f,t,r))ok=1&break;
      |                                             ^~~~~
Language: C++

#include <bits/stdc++.h>
#define um unordered_map
#define us unordered_set
#define f first
#define s second
#define pb push_back
#define MOD 998244353
#define eps 1e-9
#define INF 1000000002

using namespace std;ddafaf

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
const int N = 1001;aefaefafafadf

int n, m;
vector<int> adjList[N];
bool inGraph[N];
vector<int> ans;

bool check(set<int> &temp)
{
    int sum = 0;
    for (int i : temp)
    {
        for (int j : adjList[i])
        {
            if (temp.find(j) != temp.end())
                sum++;
        }
    }
    return sum == temp.size();
}

void solve(int node)
{
    ans.pb(node);
    inGraph[node] = true;
    for (int ch : adjList[node])
    {
        set<int> tmp;
        vector<int> bla;
        if (inGraph[ch])
        {
            tmp.insert(ch);
            while (ans.back() != ch)
            {
                tmp.insert(ans.back());
                bla.pb(ans.back());
                ans.pop_back();
            }
            if (check(tmp))
            {
                cout << tmp.size() << endl;
                for (int i : tmp)
                    cout << i << endl;
                exit(EXIT_SUCCESS);
            }
            else
            {
                while (!bla.empty())
                    ans.pb(bla.back()), bla.pop_back();
            }
        }
        else
        {
            solve(ch);
        }
    }
    inGraph[node] = false;
    ans.pop_back();
}

int main()
{
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        int x, y;
        cin >> x >> y;
        adjList[x].pb(y);
    }
    for (int i = 1; i <= n; i++)
        solve(i);
    cout << -1;
    return 0;
}


Compiler output:
a.cc:11:21: error: 'ddafaf' does not name a type
   11 | using namespace std;ddafaf
      |                     ^~~~~~
a.cc:16:20: error: 'aefaefafafadf' does not name a type
   16 | const int N = 1001;aefaefafafadf
      |                    ^~~~~~~~~~~~~
a.cc: In function 'int main()':
a.cc:78:12: error: 'n' was not declared in this scope
   78 |     cin >> n >> m;
      |            ^
a.cc:78:17: error: 'm' was not declared in this scope; did you mean 'tm'?
   78 |     cin >> n >> m;
      |                 ^
      |                 tm
Language: C++

include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 
const int INF = 1001001001;
int n;
vector<int> to[1005];
 
vector<int> bfs(int sv) {
  vector<int> dist(n,INF), pre(n,-1);
  queue<int> q;
  dist[sv] = 0;
  q.push(sv);
  while (!q.empty()) {
    int v = q.front(); q.pop();
    for (int u : to[v]) {
      if (dist[u] != INF) continue;
      pre[u] = v;
      dist[u] = dist[v]+1;
      q.push(u);
    }
  }
 
  pair<int,int> best(INF,-1);
  rep(v,n) {
    if (v == sv) continue;
    for (int u : to[v]) {
      if (u == sv) {
        best = min(best, make_pair(dist[v],v));
      }
    }
  }
  if (best.first == INF) return vector<int>(n+1);
  int v = best.second;
  vector<int> res;
  while (v != -1) {
    res.push_back(v);
    v = pre[v];
  }
  return res;
}
 
int main() {
  int m;
  cin >> n >> m;
  rep(i,m) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    to[a].push_back(b);
  }
 
  vector<int> ans(n+1);
  rep(s,n) {
    auto now = bfs(s);
    if (now.size() < ans.size()) ans = now;
  }
  if (ans.size() == n+1) {
    cout<<-1<<endl;
    return 0;
  }
  cout << ans.size() << endl;
  for (int v : ans) {
    cout << v+1 << endl;
  }
  return 0;
}

Compiler output:
a.cc:1:1: error: 'include' does not name a type
    1 | include <bits/stdc++.h>
      | ^~~~~~~
a.cc:8:1: error: 'vector' does not name a type
    8 | vector<int> to[1005];
      | ^~~~~~
a.cc:10:1: error: 'vector' does not name a type
   10 | vector<int> bfs(int sv) {
      | ^~~~~~
a.cc: In function 'int main()':
a.cc:46:3: error: 'cin' was not declared in this scope
   46 |   cin >> n >> m;
      |   ^~~
a.cc:51:5: error: 'to' was not declared in this scope
   51 |     to[a].push_back(b);
      |     ^~
a.cc:54:3: error: 'vector' was not declared in this scope
   54 |   vector<int> ans(n+1);
      |   ^~~~~~
a.cc:54:10: error: expected primary-expression before 'int'
   54 |   vector<int> ans(n+1);
      |          ^~~
a.cc:56:16: error: 'bfs' was not declared in this scope
   56 |     auto now = bfs(s);
      |                ^~~
a.cc:57:22: error: 'ans' was not declared in this scope
   57 |     if (now.size() < ans.size()) ans = now;
      |                      ^~~
a.cc:59:7: error: 'ans' was not declared in this scope
   59 |   if (ans.size() == n+1) {
      |       ^~~
a.cc:60:5: error: 'cout' was not declared in this scope
   60 |     cout<<-1<<endl;
      |     ^~~~
a.cc:60:15: error: 'endl' was not declared in this scope
   60 |     cout<<-1<<endl;
      |               ^~~~
a.cc:63:3: error: 'cout' was not declared in this scope
   63 |   cout << ans.size() << endl;
      |   ^~~~
a.cc:63:11: error: 'ans' was not declared in this scope
   63 |   cout << ans.size() << endl;
      |           ^~~
a.cc:63:25: error: 'endl' was not declared in this scope
   63 |   cout << ans.size() << endl;
      |                         ^~~~
Language: C++

#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

uint64_t getZ() {
  uint64_t v = 0; int c;
  while((c = getchar_unlocked()) >= '0') v=v*10+c-'0';
  return v;
}

template<int BUFSIZE>
struct ans_buf {
  char buf[BUFSIZE];
  int i;
  ans_buf(): i(0) {}
  void putZ(uint64_t v, char delim='\n') {
    uint64_t k = 1;
    while(k <= v/10) k*=10;
    for(; k>0; v%=k, k/=10) buf[i++] = (v/k)+'0';
    buf[i++] = delim;
  }
  void out() { std::fwrite(buf, 1, i, stdout); }
};

int const MAXN = 1000;
int N, M;
std::vector<int> G[MAXN];
bool used[MAXN];
int d[MAXN];

int nv[MAXN], n;
bool dfs(int v) {
  used[v] = true;
  for(auto c: G[v]) {
    nv[v] = c;
    if(c == n) return true;
    if(!used[c] && dfs(c)) return true;
  }
  return false;
}

int main() {
  N = getZ(); M = getZ();
  for(int i = 0; i < M; ++i) G[getZ()-1].push_back(getZ()-1);
  std::fill_n(d, N-1, 0);
  for(int i = 0; i < N-1; ++i) {
    for(int j = 0; j < N; ++j) for(auto k: G[j]) d[k] = std::min(d[k], d[j]-1);
  }
  n = -1;
  for(int j = 0; j < N; ++j) for(auto k: G[j]) if(d[k] >  d[j]-1) { n = k; break; }
  if(n < 0) fin(n);
  std::fill_n(used, N, false);
  dfs(n);
  for(;;) {
    std::fill_n(used, N, false);
    used[n] = true;
    for(int k = nv[n]; k!=n; k=nv[k]) used[k] = true;
    bool ok = true;
    for(auto c: G[n]) if(used[c] && c != nv[i]) {
      nv[i] = c; ok = false; break;
    }
    if(!ok) continue;
    for(int k = nv[n]; k!=n; k=nv[k]) {
      for(auto c: G[k]) if(used[c] && c != nv[k]) {
        nv[k] = n = c;
        ok = false;
        break;
      }
      if(!ok) break;
    }
    if(ok) break;
  }
  int ans = 0;
  for(int i = 0; i < N; ++i) if(used[i]) ++ans;
  ans_buf<4000> buf;
  buf.putZ(ans); 
  for(int i = 0; i < N; ++i) if(used[i]) buf.putZ(i+1);
  buf.out();
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:63:45: error: 'i' was not declared in this scope
   63 |     for(auto c: G[n]) if(used[c] && c != nv[i]) {
      |                                             ^
Language: C++

#pragma warning(disable:4996)
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int maxn = 1007, maxm = 2007;
const int inf = 1e9 + 7;
int cnt = 1;
int head[maxn], vis[maxn], vis2[maxn], dfn[maxn];
int b[maxn];
struct edge
{
	int u, v, next;
}e[maxm];
void addedge(int u, int v)
{
	e[cnt].u = u;
	e[cnt].v = v;
	e[cnt].next = head[u];
	head[u] = cnt;
	cnt++;
}
vector<int> v;
int ans = inf;
void dfs(int x, int num)
{
	vis[x] ++;//x访问次数增加
	dfn[x] = num;//x被访问到的时间戳
	for (int i = head[x]; i; i = e[i].next)//遍历x点连接的所有边
	{
		int y = e[i].v;
		if ((vis[y] >= 1)&&(dfn[x] - dfn[y] + 1 < ans))//y第二次被访问，说明形成环，则记录最小环
		{
			ans = dfn[x] - dfn[y] + 1;//ans存环中点的个数
			int sz = v.size();
			for (int i = 1; i <= ans; i++)
				b[i] = v[sz - i];//倒着记录环中的点
		}
		if (vis[y] == 0)//y没有访问过
		{
			vis2[y] = 1;
			v.push_back(y);
			dfs(y, num + 1);
		}
	}
	v.pop_back();
	vis[x]--;
}
int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; i++)
	{
		int x, y;
		scanf("%d%d", &x, &y);
		addedge(x, y);
	}
	for (int i = 1; i <= n; i++)
	{
		if (vis[i]2 == 0)
		{
			v.clear();
			v.push_back(i);
			vis2[i] = 1;
			dfs(i, 1);
		}
	}
	if (ans == inf)
		printf("-1\n");
	else
	{
		printf("%d\n", ans);
		for (int i = ans; i >= 1; i--)
			printf("%d\n", b[i]);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:60:27: error: expected ')' before numeric constant
   60 |                 if (vis[i]2 == 0)
      |                    ~      ^
      |                           )
Language: C++

#pragma warning(disable:4996)
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int maxn = 1007, maxm = 2007;
const int inf = 1e9 + 7;
int cnt = 1;
int head[maxn], vis[maxn], dfn[maxn];
int b[maxn];
struct edge
{
	int u, v, next;
}e[maxm];
void addedge(int u, int v)
{
	e[cnt].u = u;
	e[cnt].v = v;
	e[cnt].next = head[u];
	head[u] = cnt;
	cnt++;
}
vector<int> v;
int ans = inf;
void dfs(int x, int num)
{
	vis[x] ++;//x访问次数增加
	dfn[x] = num;//x被访问到的时间戳
	for (int i = head[x]; i; i = e[i].next)//遍历x点连接的所有边
	{
		int y = e[i].v;
		if (vis[y] >= 1)//y第二次被访问，说明形成环
		{
			if (dfn[x] - dfn[y] + 1 < ans)
			{
				ans = dfn[x] - dfn[y] + 1;
				int sz = v.size();
				for (int i = 1; i <= ans; i++)
					b[i] = v[sz - i];
			}
		}
		if (vis[y] == 0)//y没有访问过
		{
			v.push_back(y);
			dfs(y, num + 1);
		}
	}
	v.pop_back();
	vis[x] = 0;
}
int main()
{
	int n, m;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= m; i++)
	{
		int x, y;
		scanf("%d%d", &x, &y);
		addedge(x, y);
	}
	for (int i = 1; i <= n; i++)
	{
		if (vis[i] == 0)
		{
			v.clear();
			v.push_back(i);
			vis2[i] = 1;
			dfs(i, 1);
		}
	}
	if (ans == inf)
		printf("-1\n");
	else
	{
		printf("%d\n", ans);
		for (int i = ans; i >= 1; i--)
			printf("%d\n", b[i]);
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:66:25: error: 'vis2' was not declared in this scope; did you mean 'vis'?
   66 |                         vis2[i] = 1;
      |                         ^~~~
      |                         vis
Language: C++

#include<iostream>
#include<vector>
#include<stack>
using namespace std;

vector<int> ans;

int go_check(int now, vector<vector<int>>& adj, vector<bool>& checked_gl, vector<bool>& checked_local){
  //cout << '*' << now << endl;
  checked_gl[now] = true;
  checked_local[now] = true;
  for(auto next: adj[now]){
    //cout << "***" << now << ' ' << next << endl;
    if(checked_local[next]){
      ans.push_back(next);
      return next;
    }else{
      int ret = go_check(next, adj, checked_gl, checked_local);
      if(ret != -1){
        ans.push_back(next);
        return ret;
      }
    }
  }
  checked_local[now] = false;
  return -1;
}

int cyclic_check(vector<vector<int>>& adj){
  int N = adj.size();
  vector<bool> checked(N, false);
  for(int i = 0; i < N; i++){
    if(!checked[i]){
      vector<bool> checked_local(N, false);
      int ret = go_check(i, adj, checked, checked_local);
      //cout << "**" << i << ' ' << ret << endl;
      if(ret != -1){
        return ret;
      }
    }
  }
  return -1;
}


int main(){
  int N, M;
  cin >> N >> M;

  vector<vector<int>> adj(N, vector<int>(0));
  for(int m = 0; m < M; m++){
    int a, b;
    cin >> a >> b;
    adj[a - 1].push_back(b - 1);
  }

  int cyclic_node = cyclic_check(adj);
  if(cyclic_node == -1){
    cout << -1 << endl;
    return 0;
  }
  cout << a.size() << endl;
  for(auto a: ans){
    cout << a + 1 << endl;
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:62:11: error: 'a' was not declared in this scope
   62 |   cout << a.size() << endl;
      |           ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 2e3+2;
int n, m;
vector<int> g[N];
int vis[N];
vector<int> tmp, ans;
void dfs(int u) {
    tmp.push_back(u);
    vis[u] = 1;
    for(int v : g[u]) {
        if(!vis[v]) dfs(v);
        else if((tmp.size() < ans.size() || ans.empty()) && v == tmp[0]) {
            ans = tmp;
        }
    }
    vis[u] = 0;
    tmp.pop_back();
}

int main() {
    cin >> n >> m;
    for(int i = 0, u, v; i < m; i++) {
        cin >> u >> v;
        g[u].push_back(v);
    }
    vector<int> v;
    for(int i = 1; i <= n; i++) {
        dfs(i, v);
    }
    if(ans.size() == 0) cout << -1 << endl;
    else {
        cout << ans.size() << '\n';
        for(int x : ans) {
            cout << x << '\n';
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:12: error: too many arguments to function 'void dfs(int)'
   30 |         dfs(i, v);
      |         ~~~^~~~~~
a.cc:9:6: note: declared here
    9 | void dfs(int u) {
      |      ^~~
Language: C++

#include <iostream>
#include <cstdio>
#include <vector>
#include <cstring>
using namespace std;

int n, m, a, b, vt[1005];
vector<int> gr[1005], tmp, ans;

void dfs(int p) {
	tmp.push_back(p);
	vt[p] = 1;
	for(auto x:gr[p]) {
		if(x == tmp[0]) {
			if(ans.empty() || tmp.size() < ans.size()) ans = tmp;
		} else if (!vt[p]) {
			dfs(v);
		}
	}
	tmp.pop_back();
}

int main() {
	cin >> n >> m;
	while(m--) {
		cin >> a >> b;
		gr[a].push_back(b);
	}
	for(i=1; i<=n; i++) {
		memset(vt, 0, sizeof(vt));
		tmp.clear();
		dfs(i);
	}
	if(ans.empty()) {puts("-1"); return 0;}
	cout << ans.size() << endl;
	for(auto x:ans) cout << x << endl;
	return 0;
}

Compiler output:
a.cc: In function 'void dfs(int)':
a.cc:17:29: error: 'v' was not declared in this scope
   17 |                         dfs(v);
      |                             ^
a.cc: In function 'int main()':
a.cc:29:13: error: 'i' was not declared in this scope
   29 |         for(i=1; i<=n; i++) {
      |             ^
Language: C++

#include<iostream>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int n, m, st;
vector<int>v[1010];
vector<int>topo;
bool used[10005];
void toposort(int x) {
	used[x] = true;
	for (int i : v[x]) {
		if (!used[i]) {
			toposort(i);
		}
		else if()
		}
	}

	topo.push_back(x);
}
int main() {
	cin >> n >> m;
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		v[a].push_back(b);
		v[b].push_back(a);
	}
	rep(i, n) {
		if (!used[i])toposort(i);
	}

	return 0;
}

Compiler output:
a.cc: In function 'void toposort(int)':
a.cc:15:25: error: expected primary-expression before ')' token
   15 |                 else if()
      |                         ^
a.cc:16:17: error: expected primary-expression before '}' token
   16 |                 }
      |                 ^
a.cc: At global scope:
a.cc:19:9: error: 'topo' does not name a type
   19 |         topo.push_back(x);
      |         ^~~~
a.cc:20:1: error: expected declaration before '}' token
   20 | }
      | ^