Buggy python submission (verdict: Time Limit Exceeded):
N,M=list(map(int,input().split()))
l=[[] for i in range(N)]
l_c=[0 for i in range(N)]
for i in range(M):
   a,b=list(map(int,input().split()))
   a-=1;b-=1
   l[a].append(b)
   l[b].append(a)
from collections import deque
def search(start):
   que=deque([start])
   after=deque([])
   while que:
      A=que.popleft()
      after.append(A)
      l_c[A]=1
      for i in l[A]:
         if i not in que and i not in after:
            que.append(i)
   return len(after)
ans=0
for i in range(N):
   if l_c[i] ==0:
      ans=max(ans,search(i))
   if ans>M//2+1:
      break
print(ans)

Fixed submission:
N,M=list(map(int,input().split()))
l=[[] for i in range(N)]
l_c=[0 for i in range(N)]
for i in range(M):
   a,b=list(map(int,input().split()))
   a-=1;b-=1
   l[a].append(b)
   l[b].append(a)
from collections import deque
def search(start):
   cnt=1
   que=deque([start])
   l_c[start]=1
   while que:
      A=que.popleft()
      for i in l[A]:
         if l_c[i]==0:
            cnt+=1
            l_c[i]=1
            que.append(i)
   return cnt
ans=0
for i in range(N):
   if l_c[i] ==0:
      ans=max(ans,search(i))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=list(map(int,input().split()))
l=[[] for i in range(N)]
l_c=[0 for i in range(N)]
for i in range(M):
   a,b=list(map(int,input().split()))
   a-=1;b-=1
   l[a].append(b)
   l[b].append(a)
from collections import deque
def search(start):
   que=deque([start])
   after=deque([])
   while que:
      A=que.popleft()
      after.append(A)
      l_c[A]=1
      for i in l[A]:
         if i not in que and i not in after:
            que.append(i)
   return len(after)
ans=0
for i in range(N):
   if l_c[i] ==0:
      ans=max(ans,search(i))
   if ans>M//2+1:
      break
print(ans)

Fixed submission:
N,M=list(map(int,input().split()))
l=[[] for i in range(N)]
l_c=[0 for i in range(N)]
for i in range(M):
   a,b=list(map(int,input().split()))
   a-=1;b-=1
   l[a].append(b)
   l[b].append(a)
from collections import deque
def search(start):
   cnt=1
   que=deque([start])
   l_c[start]=1
   while que:
      A=que.popleft()
      for i in l[A]:
         if l_c[i]==0:
            cnt+=1
            l_c[i]=1
            que.append(i)
   return cnt
ans=0
for i in range(N):
   if l_c[i] ==0:
      ans=max(ans,search(i))
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N,M=list(map(int,input().split()))
l=[[] for i in range(N)]
l_c=[0 for i in range(N)]
for i in range(M):
   a,b=list(map(int,input().split()))
   a-=1;b-=1
   l[a].append(b)
   l[b].append(a)
from collections import deque
def search(start):
   que=deque([start])
   after=deque([])
   while que:
      A=que.popleft()
      after.append(A)
      l_c[A]=1
      for i in l[A]:
         if i not in que and i not in after:
            que.append(i)
   return len(after)
ans=0
for i in range(N):
   if l_c[i] ==0:
      ans=max(ans,search(i))
print(ans)

Fixed submission:
N,M=list(map(int,input().split()))
l=[[] for i in range(N)]
l_c=[0 for i in range(N)]
for i in range(M):
   a,b=list(map(int,input().split()))
   a-=1;b-=1
   l[a].append(b)
   l[b].append(a)
from collections import deque
def search(start):
   cnt=1
   que=deque([start])
   l_c[start]=1
   while que:
      A=que.popleft()
      for i in l[A]:
         if l_c[i]==0:
            cnt+=1
            l_c[i]=1
            que.append(i)
   return cnt
ans=0
for i in range(N):
   if l_c[i] ==0:
      ans=max(ans,search(i))
print(ans)