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

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    cin >> n;
    ll i = 0;
    while ((i+1)*(i+2)/2 <= n) i++;
    int m = n-i*(i+1)/2;
    REP(j,i-m) cout << j+1 << " ";
    REP(j,m) cout << i-m+j+2 << " ";
    cout << endl;

    return 0;
}#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define pi M_PI
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int main() {
    int n;
    cin >> n;
    ll i = 0;
    while ((i+1)*(i+2)/2 <= n) i++;
    int m = n-i*(i+1)/2;
    REP(j,i-m) cout << j+1 << " ";
    REP(j,m) cout << i-m+j+2 << " ";
    cout << endl;

    return 0;
}

Compiler output:
a.cc:38:2: error: stray '#' in program
   38 | }#include <iostream>
      |  ^
a.cc:38:3: error: 'include' does not name a type
   38 | }#include <iostream>
      |   ^~~~~~~
a.cc:64:5: error: redefinition of 'int main()'
   64 | int main() {
      |     ^~~~
a.cc:27:5: note: 'int main()' previously defined here
   27 | int main() {
      |     ^~~~
Language: C++

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

struct union_find {
  vector<long long> parent, sizes;
  void init(long long n) {
    for (long long i = 0; i < n; i++) {
      parent.push_back(i);
      sizes.push_back(1);
    }
  }
  long long root(long long n) {
    if (parent[n] == n) return n;
    return parent[n];
  }
  void unite(long long a, long long b) {
    parent[b] = a;
    sizes[root(a)] += sizes[root(b)];
  }
  bool is_united(long long a, long long b) {return (root(a) == root(b));}
}

int main() {
  long long n, m;
  cin >> n >> m;
  
  union_find uf;
  uf.init(n);
  
  vector<vector<long long>> v(m, vector<long long>(0));
  for (long long i = 0; i < n; i++) {
    long long k;
    cin >> k;
    for (long long j = 0; j < k; j++) {
      long long l;
      cin >> l;
      v[l - 1].push_back(i);
    }
  }
  for (long long i = 0; i < m; i++) {
    for (long long j = 1; j < v[i].size(); j++) {
      uf.unite(v[i][0], v[i][j]);
    }
  }
  
  for (long long i = 1; i < n; i++) {
    if (!uf.is_united(0, i)) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}


Compiler output:
a.cc:21:2: error: expected ';' after struct definition
   21 | }
      |  ^
      |  ;
Language: C++

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

struct union_find {
  vector<long long> parent, sizes;
  void init(long long n) {
    for (long long i = 0; i < n; i++) {
      parent.push_back(i);
      sizes.push_back(1);
    }
  }
  long long root(long long n) {
    if (parent[n] == n) return n;
    return parent[n];
  }
  void unite(long long a, long long b) {
    parent[b] = a;
    sizes[root(a)] += sizes[root(b)];
  }
  bool is_united(long long a, long long b) {return (root(a) == root(b));}
}

int main() {
  long long n, m;
  cin >> n >> m;
  
  union_find uf;
  uf.init(n);
  
  vector<vector<long long>> v(m, vector<long long>(0));
  for (long long i = 0; i < n; i++) {
    long long k;
    cin >> k;
    for (long long j = 0; j < k; j++) {
      long long l;
      cin >> l;
      v[l - 1].push_back(i);
    }
  }
  for (long long i = 0; i < m; i++) {
    for (long long j = 1; j < v[m].size(); j++) {
      uf.unite(v[i][0], v[i][j]);
    }
  }
  
  for (long long i = 1; i < n; i++) {
    if (!uf.is_united(0, i)) {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}

Compiler output:
a.cc:21:2: error: expected ';' after struct definition
   21 | }
      |  ^
      |  ;
Language: C++

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;scanf("%d%d",&n,&m);
    vector<vector<int>> G(n,vector<int>()),lang(m,vector<int>());
    for(int i=0;i<n;i++){
        int k;scanf("%d",&k);
        for(int j=0;j<k;j++){
            int l;scanf("%d",&l);l--;
            lang[l].push_back(i);
        }
    }
    for(int i=0;i<m;i++){
        int s=lang[i].size();
        if(s<2)continue;
        for(int j=1;j<s;j++){
            G[lang[i][0]].push_back(lang[i][j]);
            G[lang[i][j]].push_back(lang[i][0]);
    }
    vector<int> dist(n,1e9);
    dist[0]=0;
    queue<int> que;que.emplace(0);
    while(que.size()){
        int q=que.front();que.pop();
        for(auto nq:G[q]){
            if(dist[nq]>dist[q]+1){
                dist[nq]=dist[q]+1;
                que.emplace(nq);
            }
        }
    }
    bool check=0;
    for(int i=0;i<n;i++)if(dist[i]==1e9)check=1;
    if(check)printf("%s\n","NO");
    else printf("%s\n","YES");
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:37:2: error: expected '}' at end of input
   37 | }
      |  ^
a.cc:3:11: note: to match this '{'
    3 | int main(){
      |           ^
Language: C++

#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<endl
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define mp make_pair
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define sz(x) (int)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pll = pair<ll, ll>;
using vc = vector<char>;
using vvc = vector<vc>;
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
template<typename T>
struct UnionFind
{
	vector<T> par;
	vector<T> rank;
	vector<T> sizes;
	UnionFind(T n):par(n),rank(n,0),sizes(n,1){
	   for(T i=0;i<n;i++){
	     par[i]=i;
	   }
	}
	T root(T x){
	  return par[x]==x?x:par[x]=root(par[x]);
	}

	bool unite(T x,T y){
	  if(x==y) return false;
	  x=root(x); y=root(y);
	  if(x==y) return false;
	  if(rank[x]<rank[y]) swap(x,y);
	  if(rank[x]==rank[y]) rank[x]++;
	  par[y]=x;
	  sizes[x]=sizes[x]+sizes[y];
	  return true;
	}
	bool same(T x,T y){
	  return root(x)==root(y);
	}
	T size(T x){
	  return sizes[root(x)];
	}
};

int main(){
  ll n,m;
  cin>>n>>m;
  UnionFind<ll> uf(n+1);
  vvll t(m+1,vll(0));
  rep(i,n){
    ll k;
    cin>>k;
    rep(j,k){
      ll a;
      cin>>a;
      t[a].pb(i+1);
    }
  }
  for(int i=1;i<=m;i++){
    for(int j=1;j<sz(t[i]);j++){
      uf.unite(t[i][j],t[i][j-1]);
    }
  }
  set<ll> h;
  for(int i=1;i<=n;i++){
    h.insert(root(i));
  }
  if(sz(h)==1){
    COUT("YES");
  }
  else COUT("NO");
}

Compiler output:
a.cc: In function 'int main()':
a.cc:96:14: error: 'root' was not declared in this scope
   96 |     h.insert(root(i));
      |              ^~~~
Language: C++

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

int parent[1000], ranks[1000];

void initset(int n) {
  for (int i = 0; i < n; i++) {
    parent[i] = i;
    ranks[i] = 0;
  }
}

int findset(int x) {
  if (parent[x] == x) return x;
  parent[x] = findset(parent[x]);
  return parent[x];
}

bool sameset(int x, int y) {
  return findset(x) == findset(y);
}

void mergeset(int x, int y) {
  x = findset(x);
  y = findset(y);
  if (ranks[x] > rank[y]) {
    parent[y] = x;
  }
  else {
    parent[x] = y;
    if (ranks[x] == ranks[y]) {
      ranks[y]++;
    }
  }
}

int N, M, K, L;

int main() {

  cin >> N >> M;
  initset(N+M+5);
  for (int i = 0; i < M; i++) {
    cin >> K;
    for (int j = 0; j < K; j++) {
      cin >> L;
      mergeset(i+1, N+L);
    }
  }
  
  for (int i = 1; i <= N; i++) {
    if (!sameset(i,1)) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
  
}

Compiler output:
a.cc: In function 'void mergeset(int, int)':
a.cc:26:22: error: missing template arguments before '[' token
   26 |   if (ranks[x] > rank[y]) {
      |                      ^
Language: Java

import java.util.*;

public class Main {
  static int[] par;
  static int[] rank;
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int m = sc.nextInt();
    par = new int[n];
    rank = new int[n];
    ArrayList[] list = new ArrayList[m];
    for(int i = 0; i < m; i++) {
      list[i] = new ArrayList<Integer>();
    }
    for(int i = 0; i < n; i++) {
      int k = sc.nextInt();
      for(int j = 0; j < k; j++) {
        int l = sc.nextInt() - 1;
        list[l].add(i);
      }
    }
    init(n);
    for(int i = 0; i < m; i++) {
      for(int j = 0; j < list[i].size() - 1; j++) {
        unite(list[i].get(j), list[i].get(j + 1));
      }
    }
    String ans = "NO";
    HashSet<Integer> set = new HashSet<Integer>();
    for(int i = 0; i < n; i++) {
      set.add(find(i));
    }
    if(set.size() == 1) ans = "YES";
    System.out.println(ans);
  }
  static void init(int m) {
      for(int i = 0; i < m; i++) {
        par[i] = i;
        rank[i] = 0;
      }
    }
  static int find(int x) {
      if(par[x] == x) {
        return x;
      } else {
        return par[x] = find(par[x]);
      }
    }
  static void unite(int x, int y) {
      x = find(x);
      y = find(y);
      if(x != y) {
        if(rank[x] < rank[y]) {
          par[x] = y;
        } else {
          par[y] = x;
          if(rank[x] == rank[y]) {
            rank[x]++;
          }
        }
      }
    }
  static boolean same(int x, int y) {
      return find(x) == find(y);
    }
}

Compiler output:
Main.java:26: error: incompatible types: Object cannot be converted to int
        unite(list[i].get(j), list[i].get(j + 1));
                         ^
Note: Main.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error
Language: C++

#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include <map>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include"time.h"
using namespace std;

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define dump(x)  cerr << #x << " = " << (x) << endl
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
const int INF = (1 << 30);

//毎回変える定数
#define N_MAX 200


//問題文のとおりの変数
int N, M;

//オリジナル変数
vector<vector<int>> P2L;//人から言語への辺
vector<vector<int>> L2P;//言語から人への辺

vector<bool> connectionP;
vector<bool> connectionL;

//サブ関数
//入力
void input() {
	cin >> N >> M;
	REP(i, N)connectionP.push_back(false);
	REP(i, M)connectionL.push_back(false);
	REP(i, M)L2P.push_back(vector<int>());

	int K,tmp;
	REP(i, N) {
		vector<int> tmpL;
		cin >> K;
		REP(j, K) {
			cin >> tmp;
			tmp--;

			tmpL.push_back(tmp);//P2L
			L2P[tmp].push_back(i);//L2P
		}
		P2L.push_back(tmpL);
	}
}

//計算
void connectP2L(int);
void connectL2P(int lang) {
	if (connectionL[lang])return;
	connectionL[lang] = true;
	for (auto var : L2P[lang]) {
		connectP2L(var);
	}
}

void connectP2L(int person) {
	if (connectionP[person])return;
	connectionP[person] = true;
	for (auto var : P2L[person]) {
		connectL2P(var);
	}
}

void calc() {
	connectP2L(0);
}

//出力
void output() {
	bool flag = true;
	for (auto var : connection) {
		if (var == false) {
			flag = false;
			break;
		}
	}
	if (flag)cout << "YES" << endl;
	else cout << "NO" << endl;
}

//デバッグ
void debug() {
	cin >> N;
}

//メイン関数
int main() {

	input();
	calc();
	output();
	debug();

	return 0;
}


Compiler output:
a.cc: In function 'void output()':
a.cc:88:25: error: 'connection' was not declared in this scope; did you mean 'connectionP'?
   88 |         for (auto var : connection) {
      |                         ^~~~~~~~~~
      |                         connectionP
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <queue>
#include <map>

typedef long long ll;
#define rep(i, b) for(int i = 0; i < b; i++)
#define repi(i, a, b) for(int i = a; i < b; i++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define MAX_V 1001
#define MAX_E 401
#define MOD 1000000007
#define EPS 1e-7
#define INF INT_MAX
#define PI  3.14159265358979323846264338327950288
inline ll toll(std::string s) { ll v; std::istringstream sin(s); sin >> v; return v; }
template<class T> inline std::string toString(T x) { std::ostringstream sout; sout << x; return sout.str(); }
using namespace std;
typedef pair<ll, ll> pll;

int ma[100002][100002];

bool C_check[100002];

int main()
{
    int N,M;
    cin >> N >> M;
    vector<int> K(N);
    vector< vector<int> > T(N);
    
    rep(i,N)
    {
        cin >> K[i];
        rep(j,K[i])
        {
            int L;
            cin >> L;
            ma[i][L - 1] = 1;
            T[i].push_back(L - 1);
        }
    }
    
    queue<int> que;
    que.push(0);
    C_check[0] = true;
    while ( !que.empty() )
    {
        const ll cur = que.front();
        que.pop();
        
        rep(i,K[cur])
        {
            rep(j,N)
            {
                if(ma[j][T[cur][i]] == 1 && C_check[j] == false)
                {
                    que.push(j);
                    C_check[j] = true;
                }
            }
        }
    }
    
    rep(i,N)
    {
        if(C_check[i] == 0)
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Compiler output:
/tmp/ccsNsLfe.o: in function `main':
a.cc:(.text+0x1bd): relocation truncated to fit: R_X86_64_PC32 against symbol `C_check' defined in .bss section in /tmp/ccsNsLfe.o
a.cc:(.text+0x26a): relocation truncated to fit: R_X86_64_PC32 against symbol `C_check' defined in .bss section in /tmp/ccsNsLfe.o
a.cc:(.text+0x2ad): relocation truncated to fit: R_X86_64_PC32 against symbol `C_check' defined in .bss section in /tmp/ccsNsLfe.o
a.cc:(.text+0x327): relocation truncated to fit: R_X86_64_PC32 against symbol `C_check' defined in .bss section in /tmp/ccsNsLfe.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <queue>
#include <map>

typedef long long ll;
#define rep(i, b) for(int i = 0; i < b; i++)
#define repi(i, a, b) for(int i = a; i < b; i++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define MAX_V 1001
#define MAX_E 401
#define MOD 1000000007
#define EPS 1e-7
#define INF INT_MAX
#define PI  3.14159265358979323846264338327950288
inline ll toll(std::string s) { ll v; std::istringstream sin(s); sin >> v; return v; }
template<class T> inline std::string toString(T x) { std::ostringstream sout; sout << x; return sout.str(); }
using namespace std;
typedef pair<ll, ll> pll;

int ma[100002][100002];

int C_check[10002];

int main()
{
    int N,M;
    cin >> N >> M;
    vector<int> K(N);
    vector< vector<int> > T(N);
    rep(i,100002)
    {
        rep(j,100002)
        {
            ma[i][j] = 0;
        }
    }
    
    rep(i,N)
    {
        cin >> K[i];
        rep(j,K[i])
        {
            int L;
            cin >> L;
            ma[i][L - 1] = 1;
            T[i].push_back(L - 1);
        }
    }
    
    queue<int> que;
    que.push(0);
    C_check[0] = 1;
    while ( !que.empty() )
    {
        const ll cur = que.front();
        que.pop();
        
        rep(i,K[cur])
        {
            rep(j,N)
            {
                if(ma[j][T[cur][i]] == 1 && C_check[j] == 0)
                {
                    que.push(j);
                    C_check[j] = 1;
                }
            }
        }
    }
    
    rep(i,N)
    {
        if(C_check[i] == 0)
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Compiler output:
/tmp/cczdZv1R.o: in function `main':
a.cc:(.text+0x214): relocation truncated to fit: R_X86_64_PC32 against symbol `C_check' defined in .bss section in /tmp/cczdZv1R.o
a.cc:(.text+0x2cc): relocation truncated to fit: R_X86_64_PC32 against symbol `C_check' defined in .bss section in /tmp/cczdZv1R.o
a.cc:(.text+0x313): relocation truncated to fit: R_X86_64_PC32 against symbol `C_check' defined in .bss section in /tmp/cczdZv1R.o
a.cc:(.text+0x398): relocation truncated to fit: R_X86_64_PC32 against symbol `C_check' defined in .bss section in /tmp/cczdZv1R.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <queue>
#include <map>

typedef long long ll;
#define rep(i, b) for(int i = 0; i < b; i++)
#define repi(i, a, b) for(int i = a; i < b; i++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define MAX_V 1001
#define MAX_E 401
#define MOD 1000000007
#define EPS 1e-7
#define INF INT_MAX
#define PI  3.14159265358979323846264338327950288
inline ll toll(std::string s) { ll v; std::istringstream sin(s); sin >> v; return v; }
template<class T> inline std::string toString(T x) { std::ostringstream sout; sout << x; return sout.str(); }
using namespace std;
typedef pair<ll, ll> pll;

int ma[100002][100002];

int check[10002];

int main()
{
    int N,M;
    cin >> N >> M;
    vector<int> K(N);
    vector< vector<int> > T(N);
    rep(i,100002)
    {
        rep(j,100002)
        {
            ma[i][j] = 0;
        }
    }
    
    rep(i,N)
    {
        cin >> K[i];
        rep(j,K[i])
        {
            int L;
            cin >> L;
            ma[i][L - 1] = 1;
            T[i].push_back(L - 1);
        }
    }
    
    queue<int> que;
    que.push(0);
    check[0] = 1;
    while ( !que.empty() )
    {
        const ll cur = que.front();
        que.pop();
        
        rep(i,K[cur])
        {
            rep(j,N)
            {
                if(ma[j][T[cur][i]] == 1 && check[j] == 0)
                {
                    que.push(j);
                    check[j] = 1;
                }
            }
        }
    }
    
    rep(i,N)
    {
        if(check[i] == 0)
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Compiler output:
/tmp/cccx5z2j.o: in function `main':
a.cc:(.text+0x214): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/cccx5z2j.o
a.cc:(.text+0x2cc): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/cccx5z2j.o
a.cc:(.text+0x313): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/cccx5z2j.o
a.cc:(.text+0x398): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/cccx5z2j.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <queue>
#include <map>

typedef long long ll;
#define rep(i, b) for(int i = 0; i < b; i++)
#define repi(i, a, b) for(int i = a; i < b; i++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define MAX_V 1001
#define MAX_E 401
#define MOD 1000000007
#define EPS 1e-7
#define INF INT_MAX
#define PI  3.14159265358979323846264338327950288
inline ll toll(std::string s) { ll v; std::istringstream sin(s); sin >> v; return v; }
template<class T> inline std::string toString(T x) { std::ostringstream sout; sout << x; return sout.str(); }
using namespace std;
typedef pair<ll, ll> pll;

int ma[100002][100002];

int check[10002];

int main()
{
    int N,M;
    cin >> N >> M;
    vector<int> K(N);
    vector< vector<int> > T(N);
    rep(i,100002)
    {
        rep(j,100002)
        {
            ma[i][j] = 0;
        }
    }
    
    rep(i,N)
    {
        cin >> K[i];
        rep(j,K[i])
        {
            int L;
            cin >> L;
            ma[i][L - 1] = 1;
            T[i].push_back(L - 1);
        }
    }
    
    queue<int> que;
    que.push(0);
    check[0] = 1;
    while ( !que.empty() )
    {
        const ll cur = que.front();
        que.pop();
        
        rep(i,K[cur])
        {
            rep(j,N)
            {
                if(ma[j][T[cur][i]] == 1 && check[j] == 0)
                {
                    que.push(j);
                    check[j] = 1;
                }
            }
        }
    }
    
    rep(i,N)
    {
        if(check[i] == 0)
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Compiler output:
/tmp/ccYyQLmk.o: in function `main':
a.cc:(.text+0x214): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/ccYyQLmk.o
a.cc:(.text+0x2cc): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/ccYyQLmk.o
a.cc:(.text+0x313): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/ccYyQLmk.o
a.cc:(.text+0x398): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/ccYyQLmk.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <queue>
#include <map>

typedef long long ll;
#define rep(i, b) for(int i = 0; i < b; i++)
#define repi(i, a, b) for(int i = a; i < b; i++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define MAX_V 1001
#define MAX_E 401
#define MOD 1000000007
#define EPS 1e-7
#define INF INT_MAX
#define PI  3.14159265358979323846264338327950288
inline ll toll(std::string s) { ll v; std::istringstream sin(s); sin >> v; return v; }
template<class T> inline std::string toString(T x) { std::ostringstream sout; sout << x; return sout.str(); }
using namespace std;
typedef pair<ll, ll> pll;

int ma[100002][100002];

int check[100002];

int main()
{
    int N,M;
    cin >> N >> M;
    vector<int> K(N);
    vector<vector<int>> T(N);
    rep(i,10002)
    {
        rep(j,10002)
        {
            ma[i][j] = 0;
        }
    }
    
    rep(i,N)
    {
        cin >> K[i];
        rep(j,K[i])
        {
            int L;
            cin >> L;
            ma[i][L - 1] = 1;
            T[i].push_back(L - 1);
        }
    }
    
    queue<int> que;
    que.push(0);
    check[0] = 1;
    while ( !que.empty() )
    {
        const ll cur = que.front();
        que.pop();
        
        rep(i,K[cur])
        {
            rep(j,N)
            {
                if(ma[j][T[cur][i]] == 1 && check[j] == 0)
                {
                    que.push(j);
                    check[j] = 1;
                }
            }
        }
    }
    
    rep(i,N)
    {
        if(check[i] == 0)
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Compiler output:
/tmp/ccMfPoiM.o: in function `main':
a.cc:(.text+0x214): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/ccMfPoiM.o
a.cc:(.text+0x2cc): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/ccMfPoiM.o
a.cc:(.text+0x313): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/ccMfPoiM.o
a.cc:(.text+0x398): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/ccMfPoiM.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;


int main() {

	int l[100000];
	bool reached[100001];
	int n, m;
	cin >> n >> m;

	vector<vector<int>> oks(m + 1);

	int k;

	for (int i = 0; i <= m; i++) {
		reached[i] = true;
	}

	for (int i = 0; i < n; i++) {
		cin >> k;
		for (int x = 0; x < k; x++) {
			cin >> l[x];
			reached[l[x]] = false;
		}
		// sort(l, l + k);

		for (int dist = 0; dist < k-1; dist++) {
			for (int sorce = dist + 1; sorce < k; sorce++) {
				int x = l[dist];
				int y = l[sorce];
				oks[x].push_back(y);
				oks[y].puah_back(x);
			}
		}
	}

	queue<int> queue;
	for (int i = 1; i <= m; i++) {
		if (reached[i] == false) {
			queue.push(i);
			reached[i] = true;
			break;
		}
	}

	while (!queue.empty()) {
		int target;
		target = queue.front();
		queue.pop();
		for( auto ooo : oks[target] ){
			if (target == ooo) {
				continue;
			}
			if (reached[ooo] == false) {
				queue.push(ooo);
				reached[ooo] = true;
			}
		}
		// for (int i = 1; i <= m; i++) {
		// 	if (target == i) {
		// 		continue;
		// 	}
		// 	if (ok[target][i] == false) {
		// 		continue;
		// 	}
		// 	if (reached[i] == true) {
		// 		//ignore
		// 	}
		// 	else {
		// 		queue.push(i);
		// 		reached[i] = true;
		// 	}
		// }
	}

	for (int i = 1; i <= m; i++) {
		if (reached[i] == false) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:40: error: '__gnu_cxx::__alloc_traits<std::allocator<std::vector<int> >, std::vector<int> >::value_type' {aka 'class std::vector<int>'} has no member named 'puah_back'; did you mean 'push_back'?
   39 |                                 oks[y].puah_back(x);
      |                                        ^~~~~~~~~
      |                                        push_back
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <queue>
#include <map>

typedef long long ll;
#define rep(i, b) for(int i = 0; i < b; i++)
#define repi(i, a, b) for(int i = a; i < b; i++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define MAX_V 1001
#define MAX_E 401
#define MOD 1000000007
#define EPS 1e-7
#define INF INT_MAX
#define PI  3.14159265358979323846264338327950288
inline ll toll(std::string s) { ll v; std::istringstream sin(s); sin >> v; return v; }
template<class T> inline std::string toString(T x) { std::ostringstream sout; sout << x; return sout.str(); }
using namespace std;
typedef pair<ll, ll> pll;

int ma[100002][100002];
int T[100002][100002];

int check[100002];

int main()
{
    ll N,M;
    cin >> N >> M;
    vector<ll> K(N);
    
    rep(i,100002)
    {
        rep(j,100002)
        {
            ma[i][j] = 0;
            T[i][j] = -1;
        }
    }
    
    rep(i,N)
    {
        int count = 0;
        cin >> K[i];
        rep(j,K[i])
        {
            int L;
            cin >> L;
            ma[i][L - 1] = 1;
            T[i][count++] = L - 1;
        }
    }
    
    queue<ll> que;
    que.push(0);
    check[0] = 1;
    while ( !que.empty() )
    {
        const ll cur = que.front();
        que.pop();
        
        rep(i,K[cur])
        {
            rep(j,N)
            {
                if(ma[j][T[cur][i]] == 1 && check[j] == 0)
                {
                    que.push(j);
                    check[j] = 1;
                }
            }
        }
    }
    
    rep(i,N)
    {
        if(check[i] == 0)
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}


Compiler output:
/tmp/cc1YQFpE.o: in function `main':
a.cc:(.text+0xc2): relocation truncated to fit: R_X86_64_PC32 against symbol `T' defined in .bss section in /tmp/cc1YQFpE.o
a.cc:(.text+0x1a6): relocation truncated to fit: R_X86_64_PC32 against symbol `T' defined in .bss section in /tmp/cc1YQFpE.o
a.cc:(.text+0x223): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/cc1YQFpE.o
a.cc:(.text+0x28b): relocation truncated to fit: R_X86_64_PC32 against symbol `T' defined in .bss section in /tmp/cc1YQFpE.o
a.cc:(.text+0x2cb): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/cc1YQFpE.o
a.cc:(.text+0x305): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/cc1YQFpE.o
a.cc:(.text+0x388): relocation truncated to fit: R_X86_64_PC32 against symbol `check' defined in .bss section in /tmp/cc1YQFpE.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h> // {{{
// clang-format off
#pragma GCC optimize "O3,omit-frame-pointer,inline"
#pragma GCC target "tune=native,sse4.2"
#define ARG4(_1, _2, _3, _4, ...) _4
#define rep(...) ARG4(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define REP(i, a) FOR(i, 0, a)
#define FOR(i, a, b) for (int i = (a); i < (int)(b); ++i)
#define rrep(...) ARG4(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define RREP(i, a) RFOR(i, 0, a)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (int)(a); --i)
#define ALL(c) (c).begin(), (c).end()
#define TEN(n) ((ll)(1e##n))
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define USE1(T) template<typename T>inline
#define USE2(T, U) template<typename T,typename U>inline
#define mygc(c) (c)=getchar_unlocked()
#define mypc(c) putchar_unlocked(c)

template<typename T>using duo=std::pair<T,T>;
template<typename T>using vec=std::vector<T>;
using ll=long long;
using pii=duo<int>;
USE2(T,U)bool chmax(T&x,U a){return x<a&&(x=a,1);}
USE2(T,U)bool chmin(T&x,U a){return a<x&&(x=a,1);}
USE1(T=int)T in(){T x;std::cin>>x;return x;}
USE1(T=int)vec<T>in(int n){vec<T>v;v.reserve(n);rep(i,n)v.pb(in<T>());return v;}
USE1(T=int)vec<T>in(int n,T a){vec<T>v;v.reserve(n);rep(i,n)v.pb(in<T>()+a);return v;}
USE1(T)vec<std::pair<T,int>>enume(const vec<T>&x,int s=0){int N=x.size();vec<std::pair<T,int>>v;v.reserve(N);rep(i,N)v.pb(x[i],s+i);return v;}
USE1(T)vec<T>ndvec(T v,int n){return vec<T>(n,v);}
USE2(T,...Ts)auto ndvec(T v,int n,Ts...ns)->vec<decltype(ndvec(v,ns...))>{return ndvec(ndvec(v,ns...),n);}
USE1(T)void pr(T x){std::cout<<x<<'\n';}
USE2(T,...Ts)void pr(T x,Ts...xs){std::cout<<x<<' ';pr(xs...);}
USE1(T=int)T rd(){T x=0,m=0,k;for(;;){mygc(k);if(k=='-'){m=1;break;}if('0'<=k&&k<='9'){x=k-'0';break;}}for(;;){mygc(k);if(k<'0'||'9'<k)break;x=x*10+k-'0';}return x;}
USE1(T=int)void wr(T x,char c='\n'){int s=0,m=0;char b[32];if(x<0)m=1,x=-x;for(;x;x/=10)b[s++]=x%10;if(!s)b[s++]=0;if(m)mypc('-');for(;s--;)mypc(b[s]+'0');mypc(c);}
// clang-format on
// }}}
#include <copr/ds/uf.hpp>
using namespace std;
const int inf = 1001001001;
const ll infl = 1001001001001001001ll;
const int dd[] = {0, 1, 0, -1, 0};

int L[100100];

signed main() { //
  int N = rd(), M = rd();
  copr::UF uf(N);
  vec<int> U(M, -1);
  rep(i, N) {
    int K = rd();
    rep(j, K) { L[j] = rd() - 1; }
    rep(j, K) {
      if (U[L[j]] == -1) {
        U[L[j]] = i;
      } else {
        uf.unite(U[L[j]], i);
      }
    }
  }
  int G = uf.groups;
  if (G == 1) {
    puts("YES");
  } else {
    puts("NO");
  }

  return 0;
}


Compiler output:
a.cc:41:10: fatal error: copr/ds/uf.hpp: No such file or directory
   41 | #include <copr/ds/uf.hpp>
      |          ^~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <queue>
using namespace std;

bool ok[100001][100001];
int l[100000];

int main() {


	bool reached[100001];
	int n, m;
	cin >> n >> m;

	int k;

	for (int i = 0; i < m; i++) {
		reached[i] = true;
	}

	for (int i = 0; i < n; i++) {
		cin >> k;
		for (int x = 0; x < k; x++) {
			cin >> l[x];
			reached[l[x]] = false;
		}
		// sort(l, l + k);

		for (int dist = 0; dist < k-1; dist++) {
			for (int sorce = dist + 1; sorce < k; sorce++) {
				int x = l[dist];
				int y = l[sorce];
				ok[x][y] = true;
				ok[y][x] = true;
			}
		}
	}

	queue<int> queue;
	queue.push(1);
	reached[1] = true;
	while (!queue.empty()) {
		int target;
		target = queue.front();
		queue.pop();
		for (int i = 1; i <= m; i++) {
			if (ok[target][i] == false) {
				continue;
			}
			if (reached[i] == true) {
				//ignore
			}
			else {
				queue.push(i);
				reached[i] = true;
			}
		}
	}

	for (int i = 1; i <= m; i++) {
		if (reached[i] == false) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}


Compiler output:
/tmp/cc6VlUPH.o: in function `main':
a.cc:(.text+0x9d): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/cc6VlUPH.o
a.cc:(.text+0xc6): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/cc6VlUPH.o
a.cc:(.text+0x10d): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/cc6VlUPH.o
a.cc:(.text+0x127): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/cc6VlUPH.o
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <queue>
using namespace std;

bool ok[100001][100001];
int l[100000];

bool reached[100001];


int main() {
	int n, m;
	cin >> n >> m;

	int k;

	for (int i = 0; i <= m; i++) {
		reached[i] = true;
	}

	for (int i = 0; i < n; i++) {
		cin >> k;
		for (int x = 0; x < k; x++) {
			cin >> l[x];
			reached[l[x]] = false;
		}
		// sort(l, l + k);

		for (int dist = 0; dist < k-1; dist++) {
			for (int sorce = dist + 1; sorce < k; sorce++) {
				int x = l[dist];
				int y = l[sorce];
				ok[x][y] = true;
				ok[y][x] = true;
			}
		}
	}

	queue<int> queue;
	queue.push(1);
	reached[1] = true;
	while (!queue.empty()) {
		int target;
		target = queue.front();
		queue.pop();
		for (int i = 1; i <= m; i++) {
			if (ok[target][i] == false) {
				continue;
			}
			if (reached[i] == true) {
				//ignore
			}
			else {
				queue.push(i);
				reached[i] = true;
			}
		}
	}

	for (int i = 1; i <= m; i++) {
		if (reached[i] == false) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}


Compiler output:
/tmp/ccLxuAqO.o: in function `main':
a.cc:(.text+0x45): relocation truncated to fit: R_X86_64_PC32 against symbol `reached' defined in .bss section in /tmp/ccLxuAqO.o
a.cc:(.text+0x94): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/ccLxuAqO.o
a.cc:(.text+0xbd): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/ccLxuAqO.o
a.cc:(.text+0xc9): relocation truncated to fit: R_X86_64_PC32 against symbol `reached' defined in .bss section in /tmp/ccLxuAqO.o
a.cc:(.text+0x104): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/ccLxuAqO.o
a.cc:(.text+0x11e): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/ccLxuAqO.o
a.cc:(.text+0x1cd): relocation truncated to fit: R_X86_64_PC32 against symbol `reached' defined in .bss section in /tmp/ccLxuAqO.o
a.cc:(.text+0x240): relocation truncated to fit: R_X86_64_PC32 against symbol `reached' defined in .bss section in /tmp/ccLxuAqO.o
a.cc:(.text+0x274): relocation truncated to fit: R_X86_64_PC32 against symbol `reached' defined in .bss section in /tmp/ccLxuAqO.o
a.cc:(.text+0x2ca): relocation truncated to fit: R_X86_64_PC32 against symbol `reached' defined in .bss section in /tmp/ccLxuAqO.o
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
typedef long long LL;
#define SORT(c) sort((c).begin(),(c).end())
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
using namespace std;
class UnionFind {
  vector<int> p;
public:
  UnionFind (int n) : p(n, -1) {}
  int root(int x) {
    return p[x] < 0 ? x : p[x] = root(p[x]);
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  bool unite(int x, int y) {
    x = root(x); y = root(y);
    if (x == y) return false;
    if (p[y] < p[x]) swap(x, y);
    if (p[x] == p[y]) --p[x];
    p[y] = x;
    return true;
  }
};

int main(void)
{
  int n,m;
  UnionFind uf(n);
  vector<int> la(-1,m+1);
  int answer=1;
  REP(i,n){
    int k;
    cin >> k;
    REP(j,k){
      int l;
      cin >> l;
      if(la[l]!=-1) if(uf.union(la[l], i)) ++answer;
    }
  }
  cout << (answer==n ? "YES" : "NO") << endl;
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:27: error: expected unqualified-id before 'union'
   41 |       if(la[l]!=-1) if(uf.union(la[l], i)) ++answer;
      |                           ^~~~~
a.cc:41:27: error: expected ')' before 'union'
   41 |       if(la[l]!=-1) if(uf.union(la[l], i)) ++answer;
      |                       ~   ^~~~~
      |                           )
Language: C++

#include <iostream>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <queue>
using namespace std;

bool ok[100001][100001];
int l[100000];

bool reached[100001];


int main() {
	int n, m;
	cin >> n >> m;

	// cout << n << " " << m << endl;

	int k;

	for (int i = 0; i <= m; i++) {
		reached[i] = true;
	}

	for (int i = 0; i < n; i++) {
		cin >> k;
		for (int x = 0; x < k; x++) {
			cin >> l[x];
			reached[l[x]] = false;
		}
		// sort(l, l + k);

		for (int dist = 0; dist < k-1; dist++) {
			for (int sorce = dist + 1; sorce < k; sorce++) {
				int x = l[dist];
				int y = l[sorce];
				ok[x][y] = true;
				ok[y][x] = true;
			}
		}
	}

	// for (int i = 1; i <= m; i++) {
	// 	for (int j = 1; j <= m; j++) {
	// 		cout << ok[i][j];
	// 	}
	// 	cout << endl;
	// }

	queue<int> queue;
	queue.push(1);
	reached[1] = true;
	while (!queue.empty()) {
		int target;
		target = queue.front();
		queue.pop();
		for (int i = 1; i <= m; i++) {
			if (ok[target][i] == false) {
				continue;
			}
			if (reached[i] == true) {
				//ignore
			}
			else {
				queue.push(i);
				reached[i] = true;
			}
		}
	}

	for (int i = 1; i <= m; i++) {
		if (reached[i] == false) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}


Compiler output:
/tmp/cc46YvJG.o: in function `main':
a.cc:(.text+0x45): relocation truncated to fit: R_X86_64_PC32 against symbol `reached' defined in .bss section in /tmp/cc46YvJG.o
a.cc:(.text+0x94): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/cc46YvJG.o
a.cc:(.text+0xbd): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/cc46YvJG.o
a.cc:(.text+0xc9): relocation truncated to fit: R_X86_64_PC32 against symbol `reached' defined in .bss section in /tmp/cc46YvJG.o
a.cc:(.text+0x104): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/cc46YvJG.o
a.cc:(.text+0x11e): relocation truncated to fit: R_X86_64_PC32 against symbol `l' defined in .bss section in /tmp/cc46YvJG.o
a.cc:(.text+0x1cd): relocation truncated to fit: R_X86_64_PC32 against symbol `reached' defined in .bss section in /tmp/cc46YvJG.o
a.cc:(.text+0x240): relocation truncated to fit: R_X86_64_PC32 against symbol `reached' defined in .bss section in /tmp/cc46YvJG.o
a.cc:(.text+0x274): relocation truncated to fit: R_X86_64_PC32 against symbol `reached' defined in .bss section in /tmp/cc46YvJG.o
a.cc:(.text+0x2ca): relocation truncated to fit: R_X86_64_PC32 against symbol `reached' defined in .bss section in /tmp/cc46YvJG.o
collect2: error: ld returned 1 exit status
Language: C++

#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

#define MAX_N 200000

struct UF {
	int par[MAX_N],rank[MAX_N];
	
	void init(int n){
		for(int i = 0; i < n; i++){
			par[i] = i;
			rank[i] = 0;
		}
	}
	
	int find(int x){
		if(par[x] == x){
			return x;
		}else{
			return par[x] = find(par[x]);
		}
	}
	
	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y) return;
		
		if(rank[x] < rank[y]){
			par[x] = y;
		}else{
			par[y] = par[x];
			if(rank[x] == rank[y]) rank[y]++;
		}
	}
	
	bool same(int x, int y){
		return find(x) == find(y);
	}
};

int n, m;
int l[N];
int main(){
	mset(l, -1);
	cin>>n>>m;
	UF uf;
	uf.init(n);
	rep(i, n){
		int k;
		cin>>k;
		rep(j, k){
			int t;
			cin>>t;
			if(l[t]<0) l[t] = i;
			else uf.unite(l[t], i);
		}
	}
	bool ok = true;
	rep(i, n) if(!uf.same(0, i)) ok = false;
	cout<<(ok?"YES":"NO")<<endl;
	return 0;
}


Compiler output:
a.cc:80:7: error: 'N' was not declared in this scope
   80 | int l[N];
      |       ^
a.cc: In function 'int main()':
a.cc:82:14: error: 'l' was not declared in this scope
   82 |         mset(l, -1);
      |              ^
a.cc:33:27: note: in definition of macro 'mset'
   33 | #define mset(m,v) memset((m),(v),sizeof(m))
      |                           ^
Language: C++

#include<bits/stdc++.h>

using namespace std;

struct UnionFind
{
  vector< int > data;

  UnionFind(int sz)
  {
    data.assign(sz, -1);
  }

  void unite(int x, int y)
  {
    x = find(x), y = find(y);
    if(x != y) {
      if(data[x] > data[y]) swap(x, y);
      data[x] += data[y];
      data[y] = x;
    }
  }

  int find(int k)
  {
    if(data[k] < 0) return (k);
    return (data[k] = find(data[k]));
  }

  int size(int k)
  {
    return (-data[find(k)]);
  }
};

int main()

  int N, M;
  cin >> N >> M;

  UnionFind uf(N + M);
  for(int i = 0; i < N; i++) {
    int K;
    cin >> K;
    for(int j = 0; j < K; j++) {
      int L;
      cin >> L;
      uf.unite(--L, M + i);
    }
  }
  int root = uf.find(M);
  for(int i = 0; i < N; i++) {
    if(root != uf.find(M + i)) {
      cout << "NO" << endl;
      return(0);
    }
  }
  cout << "YES" << endl;
}


Compiler output:
a.cc:38:3: error: expected initializer before 'int'
   38 |   int N, M;
      |   ^~~
a.cc:39:3: error: 'cin' does not name a type
   39 |   cin >> N >> M;
      |   ^~~
a.cc:41:16: error: 'N' was not declared in this scope
   41 |   UnionFind uf(N + M);
      |                ^
a.cc:41:20: error: 'M' was not declared in this scope
   41 |   UnionFind uf(N + M);
      |                    ^
a.cc:42:3: error: expected unqualified-id before 'for'
   42 |   for(int i = 0; i < N; i++) {
      |   ^~~
a.cc:42:18: error: 'i' does not name a type
   42 |   for(int i = 0; i < N; i++) {
      |                  ^
a.cc:42:25: error: 'i' does not name a type
   42 |   for(int i = 0; i < N; i++) {
      |                         ^
a.cc:51:22: error: 'M' was not declared in this scope
   51 |   int root = uf.find(M);
      |                      ^
a.cc:52:3: error: expected unqualified-id before 'for'
   52 |   for(int i = 0; i < N; i++) {
      |   ^~~
a.cc:52:18: error: 'i' does not name a type
   52 |   for(int i = 0; i < N; i++) {
      |                  ^
a.cc:52:25: error: 'i' does not name a type
   52 |   for(int i = 0; i < N; i++) {
      |                         ^
a.cc:58:3: error: 'cout' does not name a type
   58 |   cout << "YES" << endl;
      |   ^~~~
a.cc:59:1: error: expected declaration before '}' token
   59 | }
      | ^
Language: C++

#include<bits/stdc++.h>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = (n)-1; i >= 0; i--)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep1(i,n) for(int i = (n); i > 0; i--)

#define ll long long
#define pi pair<int, int>
#define pll pair<ll, ll>

#define MOD 1000000007
#define INF 1000000000000000LL

using namespace std;

#define MAXM 110000

int main(){
  int n,m;cin>>n>>m;
  vector<int> x(n);
  rep(i, n)cin>>x[i];
  map<int, int>mp, mm;
  rep(i, n){
    mm[x[i]]++;
    mp[x[i]%m]++;
  }

  int result = 0;
  int tr = 0;
  rep(i, m){
    if(i==0 || m%2==0 && i==m/2){
      tr += mp[i]/2;
    }else{
      int j = m-i;
      int s=mp[i],t=mp[j];
      mp[i]=0,mp[j]=0;
      if(s>t){
        swap(s,t);
        j=i;
      }
      //if(s==0)continue;
      result += s;
      t-=s;s=0;

      for(int k=j; k<=MAXM; k+=m){
        if(tt>=2 && mm[k]>=2){
          int x = min(mm[k]/2, t/2);
          result += x;
          t -= 2*x;
        }
      }
    }
  }

  cout<<result+tr<<endl;
//  cout<<result<<' '<<tr<<endl;

  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:47:12: error: 'tt' was not declared in this scope; did you mean 't'?
   47 |         if(tt>=2 && mm[k]>=2){
      |            ^~
      |            t