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

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N,M,D[100000][100000],visited[100000],X,Y,Z,ans;

void dfs(int v){
    visited[v]=1;
    rep(v2,N){
        if(D[v][v2]&&!visited[v2])dfs(v2);
    }
    return;
}

int main(){
    set<int> se;
    cin>>N>>M;
    rep(i,N){
        visited[i]=0;
    }
    rep(i,M){
        cin>>X>>Y>>Z;
        X--;
        Y--;
        se.insert(X);
        se.insert(Y);
        D[X][Y]=1;
        D[Y][X]=1;
    }
        for(auto x:se){
            // out(*itr);
            if(!visited[x]){
                dfs(x);
                ans++;
            }
        }
    out(ans+N-se.size());
    
}


Compiler output:
/tmp/ccPOTXjp.o: in function `dfs(int)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccPOTXjp.o
a.cc:(.text+0x6a): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccPOTXjp.o
/tmp/ccPOTXjp.o: in function `main':
a.cc:(.text+0xed): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccPOTXjp.o
a.cc:(.text+0x116): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccPOTXjp.o
a.cc:(.text+0x132): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccPOTXjp.o
a.cc:(.text+0x147): relocation truncated to fit: R_X86_64_PC32 against symbol `Z' defined in .bss section in /tmp/ccPOTXjp.o
a.cc:(.text+0x158): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccPOTXjp.o
a.cc:(.text+0x161): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccPOTXjp.o
a.cc:(.text+0x167): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccPOTXjp.o
a.cc:(.text+0x170): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccPOTXjp.o
a.cc:(.text+0x17b): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N,M,D[100000][100000],visited[100000],X,Y,Z,ans;

void dfs(int v){
    visited[v]=1;
    rep(v2,N){
        if(D[v][v2]&&!visited[v2])dfs(v2);
    }
    return;
}

int main(){
    set<int> se;
    cin>>N>>M;
    rep(i,N){
        visited[i]=0;
    }
    rep(i,M){
        cin>>X>>Y>>Z;
        X--;
        Y--;
        se.insert(X);
        se.insert(Y);
        D[X][Y]=1;
        D[Y][X]=1;
    }
        for(auto x:se){
            // out(*itr);
            if(!visited[x]){
                dfs(x);
                ans++;
            }
        }
    out(ans+N-se.size());
    
}


Compiler output:
/tmp/ccsQXUB7.o: in function `dfs(int)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccsQXUB7.o
a.cc:(.text+0x6a): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccsQXUB7.o
/tmp/ccsQXUB7.o: in function `main':
a.cc:(.text+0xed): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccsQXUB7.o
a.cc:(.text+0x116): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccsQXUB7.o
a.cc:(.text+0x132): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccsQXUB7.o
a.cc:(.text+0x147): relocation truncated to fit: R_X86_64_PC32 against symbol `Z' defined in .bss section in /tmp/ccsQXUB7.o
a.cc:(.text+0x158): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccsQXUB7.o
a.cc:(.text+0x161): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccsQXUB7.o
a.cc:(.text+0x167): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccsQXUB7.o
a.cc:(.text+0x170): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccsQXUB7.o
a.cc:(.text+0x17b): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: Java

import java.util.*;
public class Main{
   public static void main(String[] args) {
     Scanner sc = new Scanner(System.in);
     int N = sc.nextInt();
     int M = sc.nextInt();
     ArrayList<ArrayList<int>> tree=new ArrayList<>() ;
     int element=0,X,Y,Z,ans=M;
     boolean containX,containY;
     for (int i=0;i<M;i++){
       containX = false;
       containY = false;
       X=sc.nextInt();
       Y=sc.nextInt();
       Z=sc.nextInt();
       for(int j=0;j<element;j++){
         if(tree.get(j).contains(X)){
           for(int k=0;k<element;k++){
             if(tree.get(k).contains(Y)){
               if(k==j){
                 containY = true;
                 break;
               }else{
                 tree.get(j).add(tree.get(k));
                 ans--;
                 containY = true;
                 break;
               }
             }
           }
           if(!containY){
             tree.get(j).add(Y);
              ans--;
           }
           containX = true;
           break;
         }
       }
       if(!containX){
         for(int k=0;k<element;k++){
           if(tree.get(k).contains(Y)){
              tree.get(k).add(X);
               containY = true;
               ans--;
               break;
             }
           }
         }
         if(!containX && !containY){
           tree.get(element).add(X);
           tree.get(element).add(Y);
         }
       }
       System.out.println(ans);
   }
}


Compiler output:
Main.java:7: error: unexpected type
     ArrayList<ArrayList<int>> tree=new ArrayList<>() ;
                         ^
  required: reference
  found:    int
1 error
Language: C++

	int N, M;
	gi2(N, M);

	UnionFind tree(N+1);

	int A, B, C;
	fi(M){
		gi3(A, B, C);
		tree.unite(A, B);
	}

	fi(N){
		dat[tree.root(i+1)] = 1;
	}

	int cnt = 0;
	fi(N){
		if(dat[i+1]) cnt++;
	}
	

	ans(cnt);

	wait();


Compiler output:
a.cc:2:12: error: expected constructor, destructor, or type conversion before '(' token
    2 |         gi2(N, M);
      |            ^
a.cc:4:9: error: 'UnionFind' does not name a type
    4 |         UnionFind tree(N+1);
      |         ^~~~~~~~~
a.cc:7:11: error: expected constructor, destructor, or type conversion before '(' token
    7 |         fi(M){
      |           ^
a.cc:12:11: error: expected constructor, destructor, or type conversion before '(' token
   12 |         fi(N){
      |           ^
a.cc:17:11: error: expected constructor, destructor, or type conversion before '(' token
   17 |         fi(N){
      |           ^
a.cc:22:12: error: expected constructor, destructor, or type conversion before '(' token
   22 |         ans(cnt);
      |            ^
a.cc:24:15: error: expected constructor, destructor, or type conversion before ';' token
   24 |         wait();
      |               ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
 
int main(){
  int N, M, count;
  cin >> N >> M;
  
  vector<int> x, y, z, check;
  for (i = 1; i <= N; i++){
    check.at(i) = 0;
  }
  for (i = 0; i < N; i++){
    cin >> x.at(i) >> y.at(i) >> z.at(i);
    if(x.at(i) == y.at(i) && check.at(x.at(i)) == 0 && check.at(y.at(i)) == 0){
      check.at(x.at(i)) = check.at(y.at(i)) = check.at(z.at(i)) = 1;
      count++;
    } else if(x.at(i) == z.at(i) && check.at(x.at(i)) == 0 && check.at(z.at(i)) == 0){
      check.at(x.at(i)) = check.at(y.at(i)) = check.at(z.at(i)) = 1;
      count++;
    } else if(y.at(i) == z.at(i) && check.at(y.at(i)) == 0 && check.at(z.at(i)) == 0){
      check.at(x.at(i)) = check.at(y.at(i)) = check.at(z.at(i)) = 1;
      count++;
    } else if((check.at(x.at(i)) == 0 && check.at(y.at(i)) == 0)||(check.at(x.at(i)) == 0 && check.at(z.at(i)) == 0)||(check.at(y.at(i)) == 0 && check.at(z.at(i)) == 0)){
      check.at(x.at(i)) = check.at(y.at(i)) = check.at(z.at(i)) = 1;
    } else {
      check.at(x.at(i)) = check.at(y.at(i)) = check.at(z.at(i)) = 1;
      count += 2;
    }
  }
  
  for (i = 0; i < N; i++){
    if(check.at(i) == 0){
      count++;
    }
  }
  
  for (i = 0; i < N; i++){
    cout << count << endl;
  }
  
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:9:8: error: 'i' was not declared in this scope
    9 |   for (i = 1; i <= N; i++){
      |        ^
a.cc:12:8: error: 'i' was not declared in this scope
   12 |   for (i = 0; i < N; i++){
      |        ^
a.cc:31:8: error: 'i' was not declared in this scope
   31 |   for (i = 0; i < N; i++){
      |        ^
a.cc:37:8: error: 'i' was not declared in this scope
   37 |   for (i = 0; i < N; i++){
      |        ^
Language: Java

import java.io.PrintWriter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {
    int count = 0;

    public static void main(String[] args) {
        try (InputReader in = new InputReader(); PrintWriter out = new PrintWriter(System.out)) {
            new Main().solve(in, out);
            out.flush();
        }
    }

    private void solve(InputReader in, PrintWriter out) {
        int n = in.nextInt();
        int m = in.nextInt();

        boolean[][] map = new boolean[n + 2][n + 2];
        for (boolean[] a : map) {
            Arrays.fill(a, false);
        }

        Set<Integer> set = new HashSet<>(n);
        for (int i = 1; i <= n; i++) {
            set.add(i);
        }

        for (int i = 0; i < m; i++) {
            int x = in.nextInt();
            int y = in.nextInt();
            in.nextInt();

            set.remove(x);
            set.remove(y);

            map[x][y] = map[y][x] = true;
            map[x][x] = map[y][y] = true;
        }

        for (int i = 1; i <= n; i++) {
            for (int j = 1; j <= n; j++) {
                if (map[i][j]) {
                    map = dfs(i, j, map);
                    count++;
                }
            }
        }

        int ans = set.size();
        out.println(ans + count);
    }

    void dfs(int i, int j, boolean[][] map) {
        if (map[i][j] == false) {
            return;
        }

        map[i][j] = false;

        map =dfs(i + 1, j, map);
        map =dfs(i - 1, j, map);
        map =dfs(i, j + 1, map);
        map =dfs(i, j - 1, map);
    }
}

class InputReader implements AutoCloseable {
    private final Scanner sc = new Scanner(System.in);

    String next() {
        return this.sc.next();
    }

    int nextInt() {
        return Integer.parseInt(this.sc.next());
    }

    long nextLong() {
        return Long.parseLong(this.sc.next());
    }

    double nextDouble() {
        return Double.parseDouble(this.sc.next());

    }

    @Override
    public void close() {
        this.sc.close();
    }
}


Compiler output:
Main.java:46: error: incompatible types: void cannot be converted to boolean[][]
                    map = dfs(i, j, map);
                             ^
Main.java:63: error: incompatible types: void cannot be converted to boolean[][]
        map =dfs(i + 1, j, map);
                ^
Main.java:64: error: incompatible types: void cannot be converted to boolean[][]
        map =dfs(i - 1, j, map);
                ^
Main.java:65: error: incompatible types: void cannot be converted to boolean[][]
        map =dfs(i, j + 1, map);
                ^
Main.java:66: error: incompatible types: void cannot be converted to boolean[][]
        map =dfs(i, j - 1, map);
                ^
5 errors
Language: C++

#include <stdio.h>
#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <numeric>

using namespace std;

typedef long long int ll;
typedef long int li;

bool compare_by_b(pair<int, int> a, pair<int, int> b) {
    if(a.second != b.second){
        return a.second < b.second;
    }else{
        return a.first < b.first;
    }
}



ll find_all(const string str, const string subStr) {
    vector<ll> result;
    ll k=0;
    ll subStrSize = subStr.size();
    ll pos = str.find(subStr);
    
    while (pos != string::npos) {
        k++;
        result.push_back(pos);
        pos = str.find(subStr, pos + subStrSize);
    }
    
    return k;
}

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};




int main() {
    int N, M;
    vector<int> v;
    cin >> N >> M;
    vector<int> P(N);
    for(int i = 0; i < N; i++){
        cin >> P[i];
    }

    UnionFind tree(N);

    for(int i = 0; i < M; i++) {
        int x, y;
        cin >> x >> y;
        tree.unite(x-1, y-1); // x-1の木とy-1の木を併合する
    }
  
  	for(int i = 0; i < N; i++) {
	v.insert(v.begin(),tree.root(i));
      }
}
  int binary_search(int key) {
    int left = 0, right = (int)v.size() - 1; // 配列 a の左端と右端
    while (right >= left) {
        int mid = left + (right - left) / 2; // 区間の真ん中
        if (v[mid] == key) return mid;
        else if (v[mid] > key) right = mid - 1;
        else if (v[mid] < key) left = mid + 1;
    }
    return -1;
}
int main(){
    int cnt = 0;
    for(int i = 0; i < N; i++) {
	if(binary_search(i)!=-1)cnt++;
    }
    cout << cnt << endl;
    return 0;
}



Compiler output:
a.cc: In function 'int binary_search(int)':
a.cc:92:32: error: 'v' was not declared in this scope
   92 |     int left = 0, right = (int)v.size() - 1; // 配列 a の左端と右端
      |                                ^
a.cc: At global scope:
a.cc:101:5: error: redefinition of 'int main()'
  101 | int main(){
      |     ^~~~
a.cc:70:5: note: 'int main()' previously defined here
   70 | int main() {
      |     ^~~~
a.cc: In function 'int main()':
a.cc:103:24: error: 'N' was not declared in this scope
  103 |     for(int i = 0; i < N; i++) {
      |                        ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define INFF 9223372036854775807
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,m,n) for(int i=m;i<n;i++)
#define ALL(N) (N.begin(),N.end())
#define de cout << "debug" << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() {
    cin.tie(0);
	ios::sync_with_stdio(false);

    int N,M;
    cin >> N >> M;
    int X[10000010],Y[1000010],Z[10000010];
    REP(i,M) cin >> X[i] >> Y[i] >> Z[i];
    int Kak = 0;
    int A[10000010]
    REP(i,N) A[i] = -1;

    REP(i,M){
        if(X[i] == Y[i] && Z[i] == X[i]) A[X[i]] == 2;
        else if(X[i] == Y[i] && X[i] != Z[i]) A[Z] == 2;
        else if(Y[i] == Z[i] && X[i] != Y[i]) X[i] == 2;
        else if(X[i] == Z[i] && X[i] != Y[i]) Y[i] == 2;
    }
    int cnt = 0;

    REP(i,N){
        if(A[i] == 2) cnt++;
    }
    cout << N-cnt << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:6:18: error: expected initializer before 'for'
    6 | #define REP(i,n) for(int i=0;i<n;i++)
      |                  ^~~
a.cc:24:5: note: in expansion of macro 'REP'
   24 |     REP(i,N) A[i] = -1;
      |     ^~~
a.cc:24:9: error: 'i' was not declared in this scope
   24 |     REP(i,N) A[i] = -1;
      |         ^
a.cc:6:30: note: in definition of macro 'REP'
    6 | #define REP(i,n) for(int i=0;i<n;i++)
      |                              ^
a.cc:27:42: error: 'A' was not declared in this scope
   27 |         if(X[i] == Y[i] && Z[i] == X[i]) A[X[i]] == 2;
      |                                          ^
a.cc:28:47: error: 'A' was not declared in this scope
   28 |         else if(X[i] == Y[i] && X[i] != Z[i]) A[Z] == 2;
      |                                               ^
a.cc:35:12: error: 'A' was not declared in this scope
   35 |         if(A[i] == 2) cnt++;
      |            ^
Language: C++

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;

int main(){
  int N;
  cin >> M;
  int a[N];
  rep(i,N) a[i]=-1;
  int cnt=0;
  rep(i,M){
    int x,y,z;
    cin >> x >> y >> z;
    x--;
    y--;
    if(a[x]==-1 and a[y]==-1){
      a[x]=a[y]=cnt;
      cnt++;
      continue;
    }
    if(a[x]==-1){
      a[x]=a[y];
    }
    if(a[y]==-1){
      a[y]=a[x];
    }
  }
  cout << cnt << endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:8:10: error: 'M' was not declared in this scope
    8 |   cin >> M;
      |          ^
Language: C++

#include <cstdio>
#include <string>
#include <cmath>
#include <string>
#include <algorithm>
#include <iostream>
#include <map>
#include <vector>
#include <iomanip>
#include <tuple>
#include <queue>
#include <numeric>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, n) for (int i=a;i<n;++i)
#define repeq(i, a, n) for(int i=a;i<=n;++i)
#define repi(m, itr) for (auto itr = m.begin();itr != m.end();++itr)
#define per(i, a, n) for (int i=n-1; i>=a;--i)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

// Union-Find Tree
class UnionFind {
public:
    vector < ll > par; // 各元の親を表す配列
    vector < ll > siz; // 素集合のサイズを表す配列(1 で初期化)

    // Constructor
    UnionFind(ll sz_): par(sz_), siz(sz_, 1) {
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }
    void init(ll sz_) {
        par.resize(sz_);
        siz.assign(sz_, 1);
        for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
    }

    // Member Function
    // Find
    ll root(ll x) { // 根の検索
        while (par[x] != x) {
            x = par[x] = par[par[x]]; // x の親の親を x の親とする
        }
        return x;
    }

    // Union(Unite, Merge)
    bool merge(ll x, ll y) {
        x = root(x);
        y = root(y);
        if (x == y) return false;
        // merge technique（データ構造をマージするテク．小を大にくっつける）
        if (siz[x] < siz[y]) swap(x, y);
        siz[x] += siz[y];
        par[y] = x;
        return true;
    }

    bool issame(ll x, ll y) { // 連結判定
        return root(x) == root(y);
    }

    ll size(ll x) { // 素集合のサイズ
        return siz[root(x)];
    }
};

// 
int N, M;
int ans = 0;

int main(){
    cin >> N >> M;
    UnionFind uf = {N};
    rep(i, 0, M){
        int x, y, z;
        cin >> x >> y >> z;
        if(!uf.isSame(x,y)){
            uf.unite(x, y);
        }
    }

    rep(i, 0, N){
        if(uf.root(i)==i) ++ans;
    }

    cout << ans << endl;
    return 0;
}




Compiler output:
a.cc: In function 'int main()':
a.cc:82:16: error: 'class UnionFind' has no member named 'isSame'; did you mean 'issame'?
   82 |         if(!uf.isSame(x,y)){
      |                ^~~~~~
      |                issame
a.cc:83:16: error: 'class UnionFind' has no member named 'unite'
   83 |             uf.unite(x, y);
      |                ^~~~~
Language: Java

import java.util.*;
import static java.lang.Math.*;

public class Main{
    static boolean memo[];
    static int j;
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int map[][] = new int[n-1][3];
        int a_cnt[] = new int[m];
        int cnt = 0;
        memo  = new boolean[m];
        
        for(int i=0; i<m; i++){
            map[i][0] = sc.nextInt(); //X
            map[i][1] = sc.nextInt(); //Y
            map[i][2] = sc.nextInt(); //Z
        }
        
        for(int j=0; j<m; j++){
            dfs();
            cnt++;
        }


        boolean ans = true;
        for(int i=0;i<m; i++){
            ans &= memo[i];
        }
        if(ans){
            System.out.println(cnt);
        }
        
    }
    static void dfs(){
        memo[map[j][0]] = true;
        if(memo[map[j][1]]!= true){
            j++;
            dfs();
        }
    }
}

Compiler output:
Main.java:38: error: cannot find symbol
        memo[map[j][0]] = true;
             ^
  symbol:   variable map
  location: class Main
Main.java:39: error: cannot find symbol
        if(memo[map[j][1]]!= true){
                ^
  symbol:   variable map
  location: class Main
2 errors
Language: C

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stdio.h>

using namespace std;

struct UnionFind {
    vector<int> par, rank, mem;  // par[i]: iの親番号

    UnionFind(int N) : par(N), rank(N), mem(N) {  // 最初はすべてが根であるとして初期化
        int tree_num = N;
        for(int i=0; i<N; i++) {
            par[i] = i;
            rank[i] = 0;
            mem[i] = 1;
        }
    }

    int root(int x) {
        if(par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    int unite(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        int temp = mem[rx] * mem[ry];
        if(rx == ry) return 0;
        tree_num--;
        if(rank[rx] < rank[ry]) {
            mem[ry] += mem[rx];  mem[rx] = 0;
            par[rx] = ry;
        } else {
            mem[rx] += mem[ry];  mem[ry] = 0;
            par[ry] = rx;
            if(rank[rx] == rank[ry]) {
                rank[rx]++;
            }
        }
        return temp;
    }

    bool same(int x, int y) {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};



int main()
{
    int n, m, i, x, y, z;
    scanf("%d%d",&n,&m);
    UnionFind tree(n);
    for(i=0; i<m; i++) {
        scanf("%d%d%d",&x,&y,&z);
        tree.unite(x, y);
    }
    printf("%d",tree.tree_num);
    return 0;
}


Compiler output:
main.c:1:10: fatal error: iostream: No such file or directory
    1 | #include <iostream>
      |          ^~~~~~~~~~
compilation terminated.
Language: C

#include <stdio.h>

int main(void)
{
	int n,m;
	
	scanf("%d %d",&n,&m);
	
	int x[m],y[m],z[m];
	
	int i;
	
	for(i = 0; i < m; i++){
		scanf("%d %d %d",&x[i],&y[i],&z[i]);
	}
	
	int count = 0;
	
	int flag[n] = {0}; //探索済みかどうか判定
	
	for(i = 0; i < m; i++){
		if(flag[x[i]] == 0 && flag[y[i]] == 0){
			flag[x[i]] = 1;
			flag[y[i]] = 1;
			count = count + 1;
		}
	}
	
	printf("%d\n",count);
	
	return 0;
	
}
			
			

Compiler output:
main.c: In function 'main':
main.c:19:23: error: variable-sized object may not be initialized except with an empty initializer
   19 |         int flag[n] = {0}; //探索済みかどうか判定
      |                       ^
Language: C

#include <stdio.h>

int main(void)
{
	int n,m;
	
	scanf("%d %d",&n,&m);
	
	int x[m],y[m],z[m];
	
	int i;
	
	for(i = 0; i < m; i++){
		scanf("%d %d %d",&x[i],&y[i],&z[i]);
	}
	
	int count = 0;
	
	int flag[n] = 0; //探索済みかどうか判定
	
	for(i = 0; i < m; i++){
		if(flag[x[i]] == 0 && flag[y[i]] == 0){
			flag[x[i]] = 1;
			flag[y[i]] = 1;
			count = count + 1;
		}
	}
	
	printf("%d\n",count);
	
	return 0;
	
}
			
			

Compiler output:
main.c: In function 'main':
main.c:19:23: error: variable-sized object may not be initialized except with an empty initializer
   19 |         int flag[n] = 0; //探索済みかどうか判定
      |                       ^
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N,M,D[100000][100000],visited[100000],X,Y,Z,ans;

void dfs(int v){
    visited[v]=1;
    rep(v2,N){
        if(D[v][v2]&&!visited[v2])dfs(v2);
    }
    return;
}

int main(){
    set<int> se;
    cin>>N>>M;
    rep(i,N){
        visited[i]=0;
    }
    rep(i,M){
        cin>>X>>Y>>Z;
        X--;
        Y--;
        se.insert(X);
        se.insert(Y);
        D[X][Y]=1;
        D[Y][X]=1;
    }
        for(auto itr = se.begin(); itr!=se.end();++itr){
            // out(*itr);
            if(!visited[*itr]){
                int tmp=*itr;
                dfs(tmp);
                ans++;
            }
        }
    out(ans+N-se.size());
    
}


Compiler output:
/tmp/ccmN0COA.o: in function `dfs(int)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccmN0COA.o
a.cc:(.text+0x6a): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccmN0COA.o
/tmp/ccmN0COA.o: in function `main':
a.cc:(.text+0xed): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccmN0COA.o
a.cc:(.text+0x116): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccmN0COA.o
a.cc:(.text+0x132): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccmN0COA.o
a.cc:(.text+0x147): relocation truncated to fit: R_X86_64_PC32 against symbol `Z' defined in .bss section in /tmp/ccmN0COA.o
a.cc:(.text+0x158): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccmN0COA.o
a.cc:(.text+0x161): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccmN0COA.o
a.cc:(.text+0x167): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccmN0COA.o
a.cc:(.text+0x170): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccmN0COA.o
a.cc:(.text+0x17b): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <iostream>
#include <string>
using namespace std;

int main(void){
	int N,M;
	cin >> N >> M;
	bool b[N+1]={0};
	int need_to_open_to_know=0;
	int known_card=0;
	for(int i = 0;i<M;i++){
		int X,Y,Z;
		cin >> X >> Y >> Z;
		if(X==Y){
			if(b[x]==1){
				need_to_open_to_know--;
			}else{
				b[X]=1;
				known_card++;
			}
			continue;
		}
		if(b[X]==0 && b[Y]==0){
			need_to_open_to_know++;
			b[X]=1;
			b[Y]=1;
			known_card+=2;
		}
		if(b[X]==0 && b[Y]==1){
			b[X]=1;
			b[Y]=1;
			known_card+=1;
		}		
		if(b[X]==1 && b[Y]==0){
			b[X]=1;
			b[Y]=1;
			known_card+=1;
		}			
	}
	cout << (N - known_card)+need_to_open_to_know;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:30: error: 'x' was not declared in this scope
   15 |                         if(b[x]==1){
      |                              ^
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N,M,D[100000][100000],visited[100000],X,Y,Z,ans;

void dfs(int v){
    visited[v]=1;
    rep(v2,N){
        if(D[v][v2]&&!visited[v2])dfs(v2);
    }
    return;
}

int main(){
    set<int> se;
    cin>>N>>M;
    rep(i,N){
        visited[i]=0;
    }
    // out("rt");
    rep(i,M){
        cin>>X>>Y>>Z;
        X--;
        Y--;
        se.insert(X);
        se.insert(Y);
        D[X][Y]=1;
        D[Y][X]=1;
    }
        for(auto itr = se.begin(); itr!=se.end();++itr){
            // out(*itr);
            if(!visited[*itr]){
                dfs(*itr);
                ans++;
            }
        }
    out(ans+N-se.size());
    
}


Compiler output:
/tmp/ccnXuN2m.o: in function `dfs(int)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccnXuN2m.o
a.cc:(.text+0x6a): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccnXuN2m.o
/tmp/ccnXuN2m.o: in function `main':
a.cc:(.text+0xed): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccnXuN2m.o
a.cc:(.text+0x116): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccnXuN2m.o
a.cc:(.text+0x132): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccnXuN2m.o
a.cc:(.text+0x147): relocation truncated to fit: R_X86_64_PC32 against symbol `Z' defined in .bss section in /tmp/ccnXuN2m.o
a.cc:(.text+0x158): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccnXuN2m.o
a.cc:(.text+0x161): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccnXuN2m.o
a.cc:(.text+0x167): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccnXuN2m.o
a.cc:(.text+0x170): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccnXuN2m.o
a.cc:(.text+0x17b): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C

#include <stdio.h>

int main(void)
{
	int n,m;
	
	scanf("%d %d",&n,&m);
	
	int x[m],y[m],z[m];
	
	int i;
	
	for(i = 0; i < m; i++){
		scanf("%d %d %d",&x[i],&y[i],&z[i]);
	}
	
	int count = 0;
	
	int flag[n] = 0; //探索済みかどうか判定
	
	for(i = 0; i < m; i++){
		if(flag[x[i]] == 0 && flag[[y[i]] == 0){
			flag[x[i]] = 1;
			flag[y[i]] = 1;
			count = count + 1;
		}
	}
	
	printf("%d\n",count);
	
	return 0;
	
}
			
			

Compiler output:
main.c: In function 'main':
main.c:19:23: error: variable-sized object may not be initialized except with an empty initializer
   19 |         int flag[n] = 0; //探索済みかどうか判定
      |                       ^
main.c:22:44: error: expected expression before '[' token
   22 |                 if(flag[x[i]] == 0 && flag[[y[i]] == 0){
      |                                            ^
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N,M,D[100000][100000],visited[100000],X,Y,Z,ans;

void dfs(int v){
    visited[v]=1;
    rep(v2,N){
        if(D[v][v2]&&!visited[v2])dfs(v2);
    }
}

int main(){
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    set<int> se;
    cin>>N>>M;
    rep(i,N){
        visited[i]=0;
    }
    // out("rt");
    rep(i,M){
        cin>>X>>Y>>Z;
        X--;
        Y--;
        se.insert(X);
        se.insert(Y);
        D[X][Y]=1;
        D[Y][X]=1;
    }
        for(auto itr = se.begin(); itr!=se.end();++itr){
            // out(*itr);
            if(!visited[*itr]){
                dfs(*itr);
                ans++;
            }
        }
    out(ans+N-se.size());
    
}


Compiler output:
/tmp/ccFWTN8j.o: in function `dfs(int)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccFWTN8j.o
a.cc:(.text+0x6a): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccFWTN8j.o
/tmp/ccFWTN8j.o: in function `main':
a.cc:(.text+0xee): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccFWTN8j.o
a.cc:(.text+0x117): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccFWTN8j.o
a.cc:(.text+0x133): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccFWTN8j.o
a.cc:(.text+0x148): relocation truncated to fit: R_X86_64_PC32 against symbol `Z' defined in .bss section in /tmp/ccFWTN8j.o
a.cc:(.text+0x159): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccFWTN8j.o
a.cc:(.text+0x162): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccFWTN8j.o
a.cc:(.text+0x168): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccFWTN8j.o
a.cc:(.text+0x171): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccFWTN8j.o
a.cc:(.text+0x17c): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include "bits/stdc++.h"

using namespace std;
using ll = long long int;
using pii = pair<int, int>;
using pil = pair<int, ll>;

#include "Graph.h"

void fill(int s, int d, Graph& g, vector<bool>& is_filled) {
	is_filled[d] = true;
	for (const auto &p_e : g.vertices[d]->edges) {
		int nd = p_e->p_dst->id;
		if (is_filled[nd])
			continue;
		fill(d, nd, g, is_filled);
	}
}

int main() {
	int N, M;
	cin >> N >> M;
	vector<int> x(N + 1), y(N + 1);
	for (int i = 0; i < M; i++)
	{
		int dummyz;
		cin >> x[i] >> y[i] >> dummyz;
	}
	Graph g(N + 1);
	for (int i = 0; i < M; i++)
	{
		g.add_edge(x[i], y[i], 0);
		g.add_edge(y[i], x[i], 0);
	}

	vector<bool> is_filled(N + 1, false);
	int ans = 0;
	for (int i = 1; i <= N; i++)
	{
		if (is_filled[i])
			continue;
		fill(0, i, g, is_filled);
		ans++;
	}

	cout << ans << endl;
	return 0;
}


Compiler output:
a.cc:8:10: fatal error: Graph.h: No such file or directory
    8 | #include "Graph.h"
      |          ^~~~~~~~~
compilation terminated.
Language: C++

#include "bits/stdc++.h"
// #include <boost/multi_array.hpp>
// #include <boost/optional.hpp>
// #include <boost/range/irange.hpp>
// #include <boost/range/algorithm.hpp>
// #include <boost/range/adaptors.hpp>

// namespace adaptor = boost::adaptors;

using ll = long long;
using i64 = int64_t;
using namespace std;
int X[100000][100000] = {};
int result[100000] = {};

void check(int n, ll N, set<ll> st)
{
   result[n] = 1;
   ll i;
   for (auto itr = st.begin(); itr != st.end(); ++itr)
   {
      i = *itr;
      if (X[n][i] == 1 && result[i] == 0)
      {
         result[i] = 1;
         check(i, N, st);
      }
   }
}

void Main()
{
   ll N, M;
   std::cin >> N >> M;
   set<ll> st;

   ll i, j, z;
   for (int m = 0; m < M; m++)
   {
      std::cin >> i >> j >> z;
      st.insert(i - 1);
      st.insert(j - 1);
      X[i - 1][j - 1] = 1;
      X[j - 1][i - 1] = 1;
   }
   ll ans = 0;
   ll k;
   for (auto itr = st.begin(); itr != st.end(); ++itr)
   {
      k = *itr;
      if (!result[k])
      {
         ans++;
         check(k, N, st);
      }
   }
   std::cout << ans + N - st.size() << std::endl;
}

int main()
{
   std::cin.tie(nullptr);
   std::ios_base::sync_with_stdio(false);
   std::cout << std::fixed << std::setprecision(15);
   Main();
   return 0;
}


Compiler output:
/tmp/ccFk0i17.o: in function `check(int, long long, std::set<long long, std::less<long long>, std::allocator<long long> >)':
a.cc:(.text+0x24): relocation truncated to fit: R_X86_64_PC32 against symbol `result' defined in .bss section in /tmp/ccFk0i17.o
a.cc:(.text+0x90): relocation truncated to fit: R_X86_64_PC32 against symbol `result' defined in .bss section in /tmp/ccFk0i17.o
a.cc:(.text+0xaa): relocation truncated to fit: R_X86_64_PC32 against symbol `result' defined in .bss section in /tmp/ccFk0i17.o
/tmp/ccFk0i17.o: in function `Main()':
a.cc:(.text+0x2e9): relocation truncated to fit: R_X86_64_PC32 against symbol `result' defined in .bss section in /tmp/ccFk0i17.o
collect2: error: ld returned 1 exit status
Language: C++

#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <random>
#include <string.h>

using namespace std;
int RES = 0;
class Graph
{
	int V;  

	list<int> *adj;

	void DFSUtil(int v, bool visited[]);
public:
	Graph(int V);   
	void addEdge(int v, int w);
	void connectedComponents();
};

void Graph::connectedComponents()
{
	bool *visited = new bool[V];
	for (int v = 0; v < V; v++)
		visited[v] = false;

	for (int v = 0; v<V; v++)
	{
		if (visited[v] == false)
		{
			DFSUtil(v, visited);
			RES++;
		}
	}
}

void Graph::DFSUtil(int v, bool visited[])
{
	visited[v] = true;

	list<int>::iterator i;
	for (i = adj[v].begin(); i != adj[v].end(); ++i)
	if (!visited[*i])
		DFSUtil(*i, visited);
}

Graph::Graph(int V)
{
	this->V = V;
	adj = new list<int>[V];
}

void Graph::addEdge(int v, int w)
{
	adj[v].push_back(w);
	adj[w].push_back(v);
}

int main()
{
	int N, M;
	scanf_s("%d %d", &N, &M);
	Graph g(N);
	for (int l = 0;  l < M; l++) {
		int i, j, z;
		scanf_s("%d %d %d", &i, &j, &z);
		g.addEdge(i, j);
	}
	
	g.connectedComponents();
	cout << RES << endl;

	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:79:9: error: 'scanf_s' was not declared in this scope; did you mean 'scanf'?
   79 |         scanf_s("%d %d", &N, &M);
      |         ^~~~~~~
      |         scanf
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N,M,D[100000][100000],visited[100000],X,Y,Z,ans;

void dfs(int v){
    visited[v]=1;
    rep(v2,N){
        if(D[v][v2]&&!visited[v2])dfs(v2);
    }
}

int main(){
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
    set<int> se;
    cin>>N>>M;
    rep(i,N){
        visited[i]=0;
    }
    // out("rt");
    rep(i,M){
        cin>>X>>Y>>Z;
        X--;
        Y--;
        se.insert(X);
        se.insert(Y);
        D[X][Y]=1;
        D[Y][X]=1;
    }
        for(auto itr = se.begin(); itr!=se.end();++itr){
            // out(*itr);
            if(!visited[*itr]){
                dfs(*itr);
                ans++;
            }
        }
    out(ans+N-se.size());
    
}


Compiler output:
/tmp/ccEb54Gs.o: in function `dfs(int)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccEb54Gs.o
a.cc:(.text+0x6a): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccEb54Gs.o
/tmp/ccEb54Gs.o: in function `main':
a.cc:(.text+0x133): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/ccEb54Gs.o
a.cc:(.text+0x15c): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccEb54Gs.o
a.cc:(.text+0x178): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccEb54Gs.o
a.cc:(.text+0x18d): relocation truncated to fit: R_X86_64_PC32 against symbol `Z' defined in .bss section in /tmp/ccEb54Gs.o
a.cc:(.text+0x19e): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccEb54Gs.o
a.cc:(.text+0x1a7): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/ccEb54Gs.o
a.cc:(.text+0x1ad): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccEb54Gs.o
a.cc:(.text+0x1b6): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/ccEb54Gs.o
a.cc:(.text+0x1c4): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n,m;
  int count=0;
  cin >> n >> m;
  vector<int> x(m);
  vector<int> y(m);
  vector<int> z(m);
  vector<int> ans(n);
  
  for(int i=0; i<m; i++){
    cin >> x.at(i) >> y.at(i) >> z.at(i)
  }
  
  for(int i=0; i<m; i++){
    if(ans.at(x.at(i)-1) == 1){
      ans.at(y.at(i)-1) = 1;
    }else if(ans.at(y.at(i)-1) == 1){
      ans.at(x.at(i)-1) = 1;
    }else{
      ans.at(y.at(i)-1) = 1;
    }
  }
  
  for(int i=0; i<n; i++){
    if(ans.at(i) == 0){
      count++;
    }
  }
  
  cout << count << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:14:41: error: expected ';' before '}' token
   14 |     cin >> x.at(i) >> y.at(i) >> z.at(i)
      |                                         ^
      |                                         ;
   15 |   }
      |   ~
Language: C++

#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N,M,D[100000][100000],visited[100000],X,Y,Z,ans;

void dfs(int v){
    visited[v]=1;
    rep(v2,N){
        if(D[v][v2]&&!visited[v2])dfs(v2);
    }
}

int main(){
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
    set<int> se;
    cin>>N>>M;
    rep(i,N){
        visited[i]=0;
    }
    // out("rt");
    rep(i,M){
        cin>>X>>Y>>Z;
        X--;
        Y--;
        se.insert(X);
        se.insert(Y);
        D[X][Y]=1;
        D[Y][X]=1;
    }
        for(auto itr = se.begin(); itr!=se.end();++itr){
            // out(*itr);
            if(!visited[*itr]){
                dfs(*itr);
                ans++;
            }
        }
    out(ans+N-se.size());

    
    
}


Compiler output:
/tmp/cc47JrDL.o: in function `dfs(int)':
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc47JrDL.o
a.cc:(.text+0x6a): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc47JrDL.o
/tmp/cc47JrDL.o: in function `main':
a.cc:(.text+0x133): relocation truncated to fit: R_X86_64_PC32 against symbol `visited' defined in .bss section in /tmp/cc47JrDL.o
a.cc:(.text+0x15c): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/cc47JrDL.o
a.cc:(.text+0x178): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/cc47JrDL.o
a.cc:(.text+0x18d): relocation truncated to fit: R_X86_64_PC32 against symbol `Z' defined in .bss section in /tmp/cc47JrDL.o
a.cc:(.text+0x19e): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/cc47JrDL.o
a.cc:(.text+0x1a7): relocation truncated to fit: R_X86_64_PC32 against symbol `X' defined in .bss section in /tmp/cc47JrDL.o
a.cc:(.text+0x1ad): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/cc47JrDL.o
a.cc:(.text+0x1b6): relocation truncated to fit: R_X86_64_PC32 against symbol `Y' defined in .bss section in /tmp/cc47JrDL.o
a.cc:(.text+0x1c4): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M=1000000007;
ll ans[M],n,k;
int main(){
	cin >> n >> k;
	if(k >= (1<<n)){cout<<"-1\n";return 0;}
	if (n == 1) {
		if(k == 1) {
			cout << -1 << endl;
			return 0;
		}
		cout << "0 0 1 1" << endl;
		return 0;
	}
	for(ll i=0;i<=(1<<n);i++){
		if(i == k)continue;
		cout << i << " ";
	}
	cout << k << " ";
	for(ll j=(1<<n)-1; j >= 0; j--) {
		if(j == k)continue;
		cout << j << " ";
	}
	cout << k << endl;
	return 0;
}

Compiler output:
/tmp/ccQyMM4i.o: in function `main':
a.cc:(.text+0xb): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccQyMM4i.o
a.cc:(.text+0x27): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccQyMM4i.o
a.cc:(.text+0x39): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccQyMM4i.o
a.cc:(.text+0x4e): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccQyMM4i.o
a.cc:(.text+0x7d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccQyMM4i.o
a.cc:(.text+0x8a): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccQyMM4i.o
a.cc:(.text+0x106): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccQyMM4i.o
a.cc:(.text+0x146): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccQyMM4i.o
a.cc:(.text+0x160): relocation truncated to fit: R_X86_64_PC32 against symbol `k' defined in .bss section in /tmp/ccQyMM4i.o
a.cc:(.text+0x18e): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccQyMM4i.o
a.cc:(.text+0x1ab): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status