Buggy python submission (verdict: Time Limit Exceeded):
def find(e):
  if parent[e] == e:
    return e
  return find(parent[e])
n, m = map(int,input().split())
l = []
for _ in range(m):
  p, q = map(int,input().split())
  p -= 1
  q -= 1
  if (p,q) not in l:
    l.append((p,q))
parent = [i for i in range(n)]
for i,j in l:
  x = find(i)
  y = find(j)
  if x > y:
      x, y = y, x
  parent[y] = x
mx = 0
for i in set(parent):
    mx = max(mx,parent.count(i))
print(mx)


Fixed submission:
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

n,m = map(int,input().split())
uf1=UnionFind(n)
for i in range(m):
    a,b=map(int, input().split())
    uf1.union(a-1,b-1)

for i in range(n):uf1.find(i)
X = uf1.par

ans = [0]*n
for i in range(n):
    ans[X[i]] += 1

print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
def find(e):
  if parent[e] == e:
    return e
  return find(parent[e])
n, m = map(int,input().split())
l = []
for _ in range(m):
  p, q = map(int,input().split())
  p -= 1
  q -= 1
  if (p,q) not in l:
    l.append((p,q))
parent = [i for i in range(n)]
for i,j in l:
  x = find(i)
  y = find(j)
  if x > y:
      x, y = y, x
  parent[y] = x
dic = {}
for i in parent:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
mx = 0
for i in dic.values():
    mx = max(mx,i)
print(mx)


Fixed submission:
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

n,m = map(int,input().split())
uf1=UnionFind(n)
for i in range(m):
    a,b=map(int, input().split())
    uf1.union(a-1,b-1)

for i in range(n):uf1.find(i)
X = uf1.par

ans = [0]*n
for i in range(n):
    ans[X[i]] += 1

print(max(ans))

Buggy python submission (verdict: Time Limit Exceeded):
def find(e):
  if parent[e] == e:
    return e
  return find(parent[e])
n, m = map(int,input().split())
l = []
for _ in range(m):
  p, q = map(int,input().split())
  p -= 1
  q -= 1
  if (p,q) not in l:
    l.append((p,q))
parent = [i for i in range(n)]
rank = [0 for i in range(n)]
for i,j in l:
  x = find(i)
  y = find(j)
  if rank[x]<rank[y]:
      parent[x] = y
      rank[y] += 1
  else:
      parent[y] = x
      rank[x] += 1
dic = {}
for i in parent:
    if i in dic:
        dic[i] += 1
    else:
        dic[i] = 1
mx = 0
for i in dic.values():
    mx = max(mx,i)
print(mx)


Fixed submission:
class UnionFind(object):
    def __init__(self, n=1):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

n,m = map(int,input().split())
uf1=UnionFind(n)
for i in range(m):
    a,b=map(int, input().split())
    uf1.union(a-1,b-1)

for i in range(n):uf1.find(i)
X = uf1.par

ans = [0]*n
for i in range(n):
    ans[X[i]] += 1

print(max(ans))