Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())

frends = []

for i in range(m):
  a,b = map(int, input().split())
  ainclude = set()
  binclude = set()
  flag = False
  for j in frends:
    if a in j:
      if b in j:
        flag = 'Y'
      ainclude = j
      frends.remove(j)
      flag = True
    elif b in j:
      binclude = j
      frends.remove(j)
      flag = True
  if flag == False:
    frends.append({a,b})
  elif flag == 'Y':
    continue
  else:
    c = {a,b}
    frends.append(ainclude|binclude|c)

cnt = 1

for i in frends:
  num = len(i)
  if cnt < num:
    cnt = num


print(cnt)

Fixed submission:
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def same(x, y):
    return find(x) == find(y)

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    if par[x] > par[y]:
        x, y = y, x
    par[x] += par[y]
    par[y] = x


N, M = map(int, input().split())
par = [-1 for i in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    unite(a - 1, b - 1)

print(-min(par))

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())

frends = []

for i in range(m):
  a,b = map(int, input().split())
  ainclude = set()
  binclude = set()
  flag = False
  for j in frends:
    if a in j and b in j:
      flag = 'M'
      continue
    elif a in j:
      ainclude = j
      frends.remove(j)
      flag = True
    elif b in j:
      binclude = j
      frends.remove(j)
      flag = True
  if flag == False:
    frends.append({a,b})
  elif flag == 'Y':
    continue
  else:
    c = {a,b}
    frends.append(ainclude|binclude|c)

cnt = 1

for i in frends:
  num = len(i)
  if cnt < num:
    cnt = num


print(cnt)

Fixed submission:
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def same(x, y):
    return find(x) == find(y)

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    if par[x] > par[y]:
        x, y = y, x
    par[x] += par[y]
    par[y] = x


N, M = map(int, input().split())
par = [-1 for i in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    unite(a - 1, b - 1)

print(-min(par))

Buggy python submission (verdict: Runtime Error):
import copy

n, m = map(int, input().split())

frends = {}

for i in range(m):
  a,b = map(int, input().split())
  if a not in frends:
    frends[a] = set([a])
  if b not in frends:
    frends[b] = set([b])
  frends[a].add(b)
  frends[b].add(a)

group = copy.copy(frends) 
  
for i in frends:
  flag = False
  r = group[i]
  for j in r:
    if j > i:
      flag = True
      break
  if flag == True:
    group[max(r)].update(group.pop(i))

    
cnt = 0
for i in group:
  c = len(group[i])
  if c > cnt:
    cnt = c

print(cnt)

Fixed submission:
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def same(x, y):
    return find(x) == find(y)

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    if par[x] > par[y]:
        x, y = y, x
    par[x] += par[y]
    par[y] = x


N, M = map(int, input().split())
par = [-1 for i in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    unite(a - 1, b - 1)

print(-min(par))

Buggy python submission (verdict: Runtime Error):
import copy

n, m = map(int, input().split())

frends = {}

for i in range(m):
  a,b = map(int, input().split())
  if a not in frends:
    frends[a] = set()
  if b not in frends:
    frends[b] = set()
  frends[a].add(b)
  frends[b].add(a)

group = copy.copy(frends) 
  
for i in frends:
  flag = False
  r = group[i]
  for j in r:
    if j > i:
      flag = True
      break
  if flag == True:
    group[max(r)].update(group.pop(i))
    
cnt = 0
for i in group:
  c = len(group[i])
  if c > cnt:
    if i not in group[i]:
      c += 1
    cnt = c

print(cnt)

Fixed submission:
def find(x):
    if par[x] < 0:
        return x
    else:
        par[x] = find(par[x])
        return par[x]

def same(x, y):
    return find(x) == find(y)

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    if par[x] > par[y]:
        x, y = y, x
    par[x] += par[y]
    par[y] = x


N, M = map(int, input().split())
par = [-1 for i in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    unite(a - 1, b - 1)

print(-min(par))