Buggy python submission (verdict: Time Limit Exceeded):
class UnionFindTree():
    def __init__(self, n):
        self.parents = list(range(n))
        self.rank = [0] * n

    def find(self, x):
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.rank[x] < self.rank[y]:
            self.parents[x] = y
        else:
            self.parents[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
  
N, M = map(int, input().split())
uft = UnionFindTree(N)
for m in range(M):
  a, b = map(lambda x: int(x)-1, input().split())
  uft.union(a, b)
  
size = [uft.parents.count(n) for n in range(N)]
print(max(size))

Fixed submission:
class UnionFindTree():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return
        
        # 常にxの要素数＞yの要素数とする
        if self.parents[x] > self.parents[y]:
            x, y = y, x
            
        # self.parents[x] に　yの要素数を追加してから併合
        self.parents[x] += self.parents[y]
        self.parents[y] = x
  
N, M = map(int, input().split())
uft = UnionFindTree(N)
for m in range(M):
  a, b = map(lambda x: int(x)-1, input().split())
  uft.union(a, b)
  
print(-min(uft.parents))

Buggy python submission (verdict: Runtime Error):
class UnionFindTree():
    def __init__(self, num_leaves):
        #self.num_leaves = num_leaves
        self.root = [i for i in range(num_leaves+1)]
        
    def find(self, leaf):
        if self.root[leaf] == leaf:
            return self.root[leaf]
        else:
            self.root[leaf] = self.find(self.root[leaf])
            return self.root[leaf]
        
    def union(self, leaf_a, leaf_b):
      	# find roots
        root_a = self.find(leaf_a)
        root_b = self.find(leaf_b)
        if root_a != root_b:
            # then union roots
            self.root[leaf_b] = root_a
            
        
N, M = map(int, input().split())
uft = UnionFindTree(N)
for m in range(M):
  a, b = map(int, input().split())
  uft.union(a, b)
  
# 経路圧縮
for n in range(N):
  uft.find(n)
  
max_size = [uft.root.count(n) for n in range(N)].max()
print(num_group)

Fixed submission:
class UnionFindTree():
    def __init__(self, n):
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return
        
        # 常にxの要素数＞yの要素数とする
        if self.parents[x] > self.parents[y]:
            x, y = y, x
            
        # self.parents[x] に　yの要素数を追加してから併合
        self.parents[x] += self.parents[y]
        self.parents[y] = x
  
N, M = map(int, input().split())
uft = UnionFindTree(N)
for m in range(M):
  a, b = map(lambda x: int(x)-1, input().split())
  uft.union(a, b)
  
print(-min(uft.parents))