Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
f = []
for i in range(M):
    A,B = map(int,input().split())
    a = {A,B}
    for j in range(len(f)):
        if f[j] & a != set():
            f[j] = f[j] | a
            a = set()
    if a != set():
        f.append(a)
count = 1
while count > 0:
    count = 0
    for i in range(len(f)-1):
        for j in range(i+1,len(f)):
            if f[i] & f[j] != set():
                count += 1
                f[i] = f[i] | f[j]
                f.remove(f[j])
for i in range(len(f)):
    f[i] = len(f[i])
print(max(f))

Fixed submission:
N,M = map(int,input().split())
f = [[] for i in range(N)]
for i in range(M):
    A,B = map(int,input().split())
    f[A-1].append(B-1)
    f[B-1].append(A-1)
from collections import deque
d = deque()
x = [-1]*N
for i in range(N):
    if x[i] == -1:
        x[i] = i
        d.append(f[i])
    while len(d) > 0:
        z = d.popleft()
        for j in z:
            if x[j] == -1:
                x[j] = i
                d.append(f[j])
import collections
ans = collections.Counter(x)
print(ans.most_common()[0][1])

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
f = []
for i in range(M):
    A,B = map(int,input().split())
    a = {A,B}
    for i in range(len(f)):
        if f[i] & a != set():
            f[i] = f[i] | a
            a = set()
    if a != set():
        f.append(a)
count = 1
while count > 0:
    count = 0
    for i in range(len(f)-1):
        for j in range(i+1,len(f)):
            if f[i] & f[j] != set():
                count += 1
                f[i] = f[i] | f[j]
                f.remove(f[j])
for i in range(len(f)):
    f[i] = len(f[i])
print(max(f))

Fixed submission:
N,M = map(int,input().split())
f = [[] for i in range(N)]
for i in range(M):
    A,B = map(int,input().split())
    f[A-1].append(B-1)
    f[B-1].append(A-1)
from collections import deque
d = deque()
x = [-1]*N
for i in range(N):
    if x[i] == -1:
        x[i] = i
        d.append(f[i])
    while len(d) > 0:
        z = d.popleft()
        for j in z:
            if x[j] == -1:
                x[j] = i
                d.append(f[j])
import collections
ans = collections.Counter(x)
print(ans.most_common()[0][1])

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
f = []
for i in range(M):
    A,B = map(int,input().split())
    a = {A,B}
    for i in range(len(f)):
        if f[i] & a != set():
            f[i] = f[i] | a
            a = set()
    if a != set():
        f.append(a)
count = 1
while count > 0:
    count = 0
    for i in range(len(f)-1):
        for j in range(i+1,len(f)):
            if f[i] & f[j] != set():
                count += 1
                f[i] = f[i] | f[j]
                f.remove(f[j])
for i in range(len(f)):
    f[i] = len(f[i])
print(max(f))

Fixed submission:
N,M = map(int,input().split())
f = [[] for i in range(N)]
for i in range(M):
    A,B = map(int,input().split())
    f[A-1].append(B-1)
    f[B-1].append(A-1)
from collections import deque
d = deque()
x = [-1]*N
for i in range(N):
    if x[i] == -1:
        x[i] = i
        d.append(f[i])
    while len(d) > 0:
        z = d.popleft()
        for j in z:
            if x[j] == -1:
                x[j] = i
                d.append(f[j])
import collections
ans = collections.Counter(x)
print(ans.most_common()[0][1])

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
f = []
for i in range(M):
    A,B = map(int,input().split())
    a = {A,B}
    for i in f:
        if i & a != set():
            a = i | a
            f.remove(i)
#            print(f,a,i)
    f.append(a)

#print(f)
print(len(max(f)))

Fixed submission:
N,M = map(int,input().split())
f = [[] for i in range(N)]
for i in range(M):
    A,B = map(int,input().split())
    f[A-1].append(B-1)
    f[B-1].append(A-1)
from collections import deque
d = deque()
x = [-1]*N
for i in range(N):
    if x[i] == -1:
        x[i] = i
        d.append(f[i])
    while len(d) > 0:
        z = d.popleft()
        for j in z:
            if x[j] == -1:
                x[j] = i
                d.append(f[j])
import collections
ans = collections.Counter(x)
print(ans.most_common()[0][1])