Problem p02573 (C++)

Buggy submission (status: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
#define bit(a) __builtin_popcount(a)
#define all(x) x.begin(), x.end()
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)), v.erase(unique(all(v)), v.end())
#define w(x) while (x--)
#define rep(i, a, b) for (i = a; i <= b; i++)
#define ll long long
#define pb push_back
#define vii vector<int>
#define vll vector<ll>
#define vcc vector<char>
#define sii set<int>
#define sll set<ll>
#define scc set<char>
#define li list<int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mii map<int, int>
#define mll map<ll, ll>
#define fill(arr, x) memset(arr, x, sizeof(arr))
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * (b / gcd(a, b)))
#define srtc(a, b) sort(a, a + b, greater<int>())
#define pi acos(-1.00)
#define _ios                                                                   \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);
/*
//find the position of 0 or 1 in binary representation
int zero(int n)
{
    int i=1,pos=0;
    while(n)
    {
        if(n%2==0)pos=i;
        n/=2;
        i++;
    }
    return pos;
}
*/
//--------------Graph Moves--------------------------------------
const int dx[] = {+1, -1, +0, +0};
const int dy[] = {+0, +0, +1, -1};
// const int dx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
// const int dy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
// const int dx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
// const int dy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
//---------------------------------------------------------------
int t, n, m;
int parent[100005];
int ra[100005];
string s;
void make_set() {
  for (int i = 1; i <= n; i++) {
    parent[i] = i;
    ra[i] = 1;
  }
}
int find_par(int n) {
  if (n == parent[n])
    return n;
  return parent[n] = find_par(parent[n]);
}
void conect(int a, int b) {
  int u = find_par(a);
  int v = find_par(b);
  parent[u] = v;
  if (u != v)
    ra[v] += ra[u];
}
int main() {
  _ios;
  cin >> n >> m;
  make_set();
  w(m) {
    int x, y;
    cin >> x >> y;
    conect(x, y);
  }
  int ans = -1;
  for (int i = 1; i <= n; i++) {
    ans = max(ans, ra[i]);
  }
  cout << ans << endl;
  return 0;
}


Fixed submission:
#include <bits/stdc++.h>
using namespace std;
#define bit(a) __builtin_popcount(a)
#define all(x) x.begin(), x.end()
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)), v.erase(unique(all(v)), v.end())
#define w(x) while (x--)
#define rep(i, a, b) for (i = a; i <= b; i++)
#define ll long long
#define pb push_back
#define vii vector<int>
#define vll vector<ll>
#define vcc vector<char>
#define sii set<int>
#define sll set<ll>
#define scc set<char>
#define li list<int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define mii map<int, int>
#define mll map<ll, ll>
#define fill(arr, x) memset(arr, x, sizeof(arr))
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) (a * (b / gcd(a, b)))
#define srtc(a, b) sort(a, a + b, greater<int>())
#define pi acos(-1.00)
#define _ios                                                                   \
  ios::sync_with_stdio(0);                                                     \
  cin.tie(0);                                                                  \
  cout.tie(0);
/*
//find the position of 0 or 1 in binary representation
int zero(int n)
{
    int i=1,pos=0;
    while(n)
    {
        if(n%2==0)pos=i;
        n/=2;
        i++;
    }
    return pos;
}
*/
//--------------Graph Moves--------------------------------------
const int dx[] = {+1, -1, +0, +0};
const int dy[] = {+0, +0, +1, -1};
// const int dx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's move
// const int dy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
// const int dx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's move
// const int dy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's move
//---------------------------------------------------------------
int t, n, m;
int parent[200005];
int ra[200005];
string s;
void make_set() {
  for (int i = 1; i <= n; i++) {
    parent[i] = i;
    ra[i] = 1;
  }
}
int find_par(int n) {
  if (n == parent[n])
    return n;
  return parent[n] = find_par(parent[n]);
}
void conect(int a, int b) {
  int u = find_par(a);
  int v = find_par(b);
  parent[u] = v;
  if (u != v)
    ra[v] += ra[u];
}
int main() {
  _ios;
  cin >> n >> m;
  make_set();
  w(m) {
    int x, y;
    cin >> x >> y;
    conect(x, y);
  }
  int ans = -1;
  for (int i = 1; i <= n; i++) {
    ans = max(ans, ra[i]);
  }
  cout << ans << endl;
  return 0;
}