Buggy python submission (verdict: Runtime Error):
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

#setrecursionlimit(10**6)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')
MOD = 10**9 + 7

def main():
	n, m = rli()
	seen = defaultdict(lambda: False)
	G = [[] for _ in range(n+100)]
	for _ in range(m):
		u, v = rli()
		u -= 1
		v -= 1
		u, v = min(u, v), max(u, v)
		if seen[(u, v)]: continue
		seen[(u, v)] = True
		G[u].append(v)
		G[v].append(u)
	sizes = []
	seen2 = defaultdict(lambda: False)
	loc_size = 0
	def dfs(node):
		nonlocal loc_size 
		seen2[node] = True
		loc_size += 1
		for nbhr in G[node]:
			if seen2[nbhr]: continue
			dfs(nbhr)

	for i in range(n):
		if seen[i]: continue
		loc_size = 0
		dfs(i)
		sizes.append(loc_size)
	print(max(sizes))
	stdout.close()

if __name__ == "__main__":
	main()

Fixed submission:
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

setrecursionlimit(10**6)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')
MOD = 10**9 + 7

def main():
	n, m = rli()
	seen = defaultdict(lambda: False)
	G = [[] for _ in range(n)]
	for _ in range(m):
		u, v = rli()
		u -= 1
		v -= 1
		u, v = min(u, v), max(u, v)
		if seen[(u, v)]: continue
		seen[(u, v)] = True
		G[u].append(v)
		G[v].append(u)
	sizes = []
	seen2 = defaultdict(lambda: False)
	loc_size = 0
	def dfs(node):
		nonlocal loc_size 
		seen2[node] = True
		loc_size += 1
		for nbhr in G[node]:
			if seen2[nbhr]: continue
			dfs(nbhr)

	for i in range(n):
		if seen[i]: continue
		loc_size = 0
		dfs(i)
		sizes.append(loc_size)
	print(max(sizes))
	stdout.close()

if __name__ == "__main__":
	main()

Buggy python submission (verdict: Runtime Error):
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

#setrecursionlimit(10**6)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')
MOD = 10**9 + 7

def main():
	n, m = rli()
	seen = defaultdict(lambda: False)
	G = [[] for _ in range(n)]
	for _ in range(m):
		u, v = rli()
		u -= 1
		v -= 1
		u, v = min(u, v), max(u, v)
		if seen[(u, v)]: continue
		seen[(u, v)] = True
		G[u].append(v)
		G[v].append(u)
	sizes = []
	seen2 = defaultdict(lambda: False)
	loc_size = 0
	def dfs(node):
		nonlocal loc_size 
		seen2[node] = True
		loc_size += 1
		for nbhr in G[node]:
			if seen2[nbhr]: continue
			dfs(nbhr)

	for i in range(n):
		if seen[i]: continue
		loc_size = 0
		dfs(i)
		sizes.append(loc_size)
	print(max(sizes))
	stdout.close()

if __name__ == "__main__":
	main()

Fixed submission:
from sys import stdin, stdout, setrecursionlimit
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop
from functools import lru_cache
import math

setrecursionlimit(10**6)
rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())
rlf = lambda: map(float, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')
MOD = 10**9 + 7

def main():
	n, m = rli()
	seen = defaultdict(lambda: False)
	G = [[] for _ in range(n)]
	for _ in range(m):
		u, v = rli()
		u -= 1
		v -= 1
		u, v = min(u, v), max(u, v)
		if seen[(u, v)]: continue
		seen[(u, v)] = True
		G[u].append(v)
		G[v].append(u)
	sizes = []
	seen2 = defaultdict(lambda: False)
	loc_size = 0
	def dfs(node):
		nonlocal loc_size 
		seen2[node] = True
		loc_size += 1
		for nbhr in G[node]:
			if seen2[nbhr]: continue
			dfs(nbhr)

	for i in range(n):
		if seen[i]: continue
		loc_size = 0
		dfs(i)
		sizes.append(loc_size)
	print(max(sizes))
	stdout.close()

if __name__ == "__main__":
	main()