Problem p02573 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
#define endl '\\n'
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(), x.end()
#define mem0(s) memset(s, 0, sizeof(s))
#define meminf(s) memset(s, 0x3f, sizeof(s))
#define mp_insert(a, b, c)                                                     \\
  mp.insert(map<pair<int, int>, int>::value_type(make_pair(a, b), c))
double pi = acos(-1);
typedef long long ll;
typedef unsigned long long ull;
inline ll lowbit(ll x) { return x & (-x); }
inline ll min(ll a, ll b) { return a < b ? a : b; }
inline ll max(ll a, ll b) { return a > b ? a : b; }
const int INF = 0x3f3f3f3f, max_n = 200005, mod = 1e9 + 7;
inline ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
inline ll pow(ll a, ll b, ll mod) {
  ll res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1)
      res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}

int dad[max_n];
int deep[max_n];
int people[max_n];
int find(int x) {
  if (dad[x] == x)
    return x;
  return dad[x] = find(dad[x]);
}
void link(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) {
    return;
  } else if (deep[x] < deep[y]) {
    dad[x] = y;
    people[y] += people[x];
  } else if (deep[x] > deep[y]) {
    dad[y] = x;
    people[x] += people[y];
  } else if (deep[x] == deep[y]) {
    dad[x] = y;
    deep[y]++;
    people[y] += people[x];
  }
}
struct Edge {
  int from, to;
} e[200005];
int V, E, q;
int cnt;
int x;
int tt;
vector<int> v1;
long long ans;
int peng[200005];
int feng[200005];
int main() {
  int V, m;
  cin >> V >> m;
  int a, b;
  for (int i = 1; i <= V; i++) {
    dad[i] = i;
    people[i] = 1;
  }
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    peng[a]++;
    peng[b]++;
    link(a, b);
  }
  cout << *max_element(people + 1, people + V);
}

Error: WA

Fixed submission:

#include <bits/stdc++.h>
using namespace std;
#define endl '\\n'
#define pb push_back
#define mp make_pair
#define SZ(x) ((int)(x).size())
#define all(x) x.begin(), x.end()
#define mem0(s) memset(s, 0, sizeof(s))
#define meminf(s) memset(s, 0x3f, sizeof(s))
#define mp_insert(a, b, c)                                                     \\
  mp.insert(map<pair<int, int>, int>::value_type(make_pair(a, b), c))
double pi = acos(-1);
typedef long long ll;
typedef unsigned long long ull;
inline ll lowbit(ll x) { return x & (-x); }
inline ll min(ll a, ll b) { return a < b ? a : b; }
inline ll max(ll a, ll b) { return a > b ? a : b; }
const int INF = 0x3f3f3f3f, max_n = 100005, mod = 1e9 + 7;
inline ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
inline ll pow(ll a, ll b, ll mod) {
  ll res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1)
      res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}

int dad[max_n];
int deep[max_n];
int people[max_n];
int find(int x) {
  if (dad[x] == x)
    return x;
  return dad[x] = find(dad[x]);
}
void link(int x, int y) {
  x = find(x);
  y = find(y);
  if (x == y) {
    return;
  } else if (deep[x] < deep[y]) {
    dad[x] = y;
    people[y] += people[x];
  } else if (deep[x] > deep[y]) {
    dad[y] = x;
    people[x] += people[y];
  } else if (deep[x] == deep[y]) {
    dad[x] = y;
    deep[y]++;
    people[y] += people[x];
  }
}
struct Edge {
  int from, to;
} e[100005];
int V, E, q;
int cnt;
int x;
int tt;
vector<int> v1;
long long ans;
int peng[100005];
int feng[100005];
int main() {
  int V, m;
  cin >> V >> m;
  int a, b;
  for (int i = 1; i <= V; i++) {
    dad[i] = i;
    people[i] = 1;
  }
  for (int i = 1; i <= m; i++) {
    cin >> a >> b;
    peng[a]++;
    peng[b]++;
    link(a, b);
  }
  cout << *max_element(people + 1, people + V);
}