Language: C++

#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <locale>
#include <map>
#include <numeric>
#include <queue>
#include <string>
#include <vector>

const long long int INF = 1e9;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define Rep(i, n) for(int i = 1; i <= (int)(n); i++)
#define llrep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define llRep(i, n) for(ll i = 1; i <= (ll)(n); i++)

using namespace std;

struct Point{
	int x,y;
};

bool vector_finder(std::vector<ll> vec, ll number) {
    auto itr = std::find(vec.begin(), vec.end(), number);
    size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return true;
    }
  else { // 発見できなかったとき
    return false;
    }
}

ll factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
    }
    return ans;
}

ll extended_factorial(ll N){
    ll ans = 1;
    llRep(i,N){
        ans *= i;
        ans %= (ll)(1e9+7);
    }
    return ans;
}

vector<ll> Eratosthenes(ll N){
    bool arr[N+1];
    //initialization
    arr[0] = false;
    arr[1] = false;
	for(ll i = 2; i < N+1; i++){
		arr[i] = true;
	}
    //eratosthenes
	for(ll i = 2; i <= sqrt(N); i++){
		if(arr[i]){
			for(ll j = 0; i * (j + 2) <= N; j++){
				arr[i *(j + 2)] = false;//not prime number
			}
		}
	}
    vector<ll> prime;
    llRep(i,N){
        if (arr[i]==true){
            prime.push_back(i);
        }
    }
    return prime;
}

char alphabet[] = {
    'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'
};

// 二分探索
// llrep(i,N){
//     b = B[i];
//     auto cntA = lower_bound(A.begin(), A.end(), b);//イテレータなのでそのままllに変換とかはできない
//     auto cntC = upper_bound(C.begin(), C.end(), b);
//     ll cntA_ll = distance(A.begin(), cntA);
//     ll cntC_ll = C.size() - distance(C.begin(), cntC);
//     cnt += (cntA_ll * cntC_ll);
// }


// void dfs(int v){
//     visited[v] = true;
//     Rep(i,N){
//         if (edge[v][i] && !visited[i]){
//             dfs(i);
//         }
//     }
// }

ll minimum_m(ll goal, ll cur){
    ll ans=0;
    while(cur<goal){
        cur *= 2;
        ans ++;
    }
    return ans;
}

// -------------------------

ll N,M,x,y,z;
bool visited[100002];
bool edge[100002][100002];
bool used[100002];

void dfs(ll i){
    // visitedにする
    visited[i] = true;
    // cout << "visited "<<i << endl;

    //繋がっているてんのうち、visitedじゃない点を選んでdfsする
    llRep(j,N){
        // cout << "j = " << j << endl;
        if(edge[i][j] && !visited[j]){
            // cout << "AAAAA" << endl;
            dfs(j);
        }
    }
    return;
}

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

    // llrep(i,100002){
    //     llrep(j,100002){
    //         edge[i][j]=false;
    //     }
    // }
    llrep(i,100002){
        visited[i]=false;
        used[i] = false;
    }


    llrep(i,M){
        cin >> x >> y >> z;
        edge[x][y] = edge[y][x] = true;
        used[x] = true;
        used[y] = true;
    }
    ll ans=0;
    llRep(i,N){
        if (!used[i]){
            ans++;
            visited[i] = true;
        }
    }
    //グラフの連結成分を数える
    llRep(i,N){
        if(!visited[i]){
            dfs(i);
            // cout << "aaa" << endl;
            ans ++;
        }
    }

    cout << ans << endl;

    return 0;
}


Compiler output:
/tmp/cckKFKur.o: in function `main':
a.cc:(.text+0x3f4): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/cckKFKur.o
a.cc:(.text+0x4cc): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/cckKFKur.o
a.cc:(.text+0x4de): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/cckKFKur.o
a.cc:(.text+0x511): relocation truncated to fit: R_X86_64_PC32 against symbol `used' defined in .bss section in /tmp/cckKFKur.o
collect2: error: ld returned 1 exit status