Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
M=[1 for i in range(n)]
F=[]
for i in range(m):
    a,b=map(int,input().split())
    a,b=min(a,b),max(a,b)
    if [a,b] not in F:
        F.append([a,b])
        M[a-1]+=1
print(max(M))


Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
 
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
 
        if x == y:
            return
 
        if self.parents[x] > self.parents[y]:
            x, y = y, x
 
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    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 size(self, x):
        return -self.parents[self.find(x)]

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

ans = 0
for i in range(n):
    ans = max(ans,uf.size(i))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
M=[1 for i in range(n)]
F=[]
for i in range(m):
    a,b=map(int,input().split())
    a,b=min(a,b),max(a,b)
    if [a,b] not in F:
        F.append([a,b])
for f in F:
    M[f[0]-1]+=1
print(max(M))


Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
 
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
 
        if x == y:
            return
 
        if self.parents[x] > self.parents[y]:
            x, y = y, x
 
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    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 size(self, x):
        return -self.parents[self.find(x)]

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

ans = 0
for i in range(n):
    ans = max(ans,uf.size(i))

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
M=[[0 for i in range(n)] for j in range(n)]
for i in range(m):
    a,b=map(int,input().split())
    if a>b:
        M[b-1][a-1]=1
    else:
        M[a-1][b-1]=1
ans=0
for m in M:
    ans=max(ans,m.count(1))
print(ans+1)

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
 
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
 
        if x == y:
            return
 
        if self.parents[x] > self.parents[y]:
            x, y = y, x
 
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    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 size(self, x):
        return -self.parents[self.find(x)]

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

ans = 0
for i in range(n):
    ans = max(ans,uf.size(i))

print(ans)