Problem:


Score : 400 points

Problem Statement

There are N persons called Person 1 through Person N.

You are given M facts that "Person A_i and Person B_i are friends." The same fact may be given multiple times.

If X and Y are friends, and Y and Z are friends, then X and Z are also friends. There is no friendship that cannot be derived from the M given facts.

Takahashi the evil wants to divide the N persons into some number of groups so that every person has no friend in his/her group.

At least how many groups does he need to make?

Constraints

2 \leq N \leq 2\times 10^5

0 \leq M \leq 2\times 10^5

1\leq A_i,B_i\leq N

A_i \neq B_i

Input

Input is given from Standard Input in the following format:

N M
A_1 B_1
\vdots
A_M B_M

Output

Print the answer.

Sample Input 1

5 3
1 2
3 4
5 1

Sample Output 1

3

Dividing them into three groups such as \{1,3\}, \{2,4\}, and \{5\} achieves the goal.

Sample Input 2

4 10
1 2
2 1
1 2
2 1
1 2
1 3
1 4
2 3
2 4
3 4

Sample Output 2

4

Sample Input 3

10 4
3 1
4 1
5 9
2 6

Sample Output 3

3



Sample input:
5 3
1 2
3 4
5 1


Sample output:
3

Submission status: Accepted

Solution code:
class UFTree:
    def __init__(self, N):
        self.nodes = [Node(i) for i in range(N)]
        self.N = N
 
    def find_max_child_num(self):
        result = 0
        for i in range(self.N):
            result = max(result, self.nodes[i].child_num)
        return result
 
class Node:
    def __init__(self, ID):
        self.ID = ID
        self.parent = None
        self.child_num = 0
        self.rank = 1
 
    def get_root(self):
        if self.parent is None:
            return self
        
        return self.parent.get_root()
 
    def concat(self, another):
        sr = self.get_root()
        ar = another.get_root()
 
        # is in a same tree.
        if sr.ID == ar.ID:
            return
 
        if sr.rank > ar.rank:
            parent, child = sr, ar
        else:
            parent, child = ar, sr
 
        parent.child_num += child.child_num + 1
        parent.rank = max(parent.rank, child.rank + 1)
        child.parent = parent
 
N, M = map(int, input().split())
tree = UFTree(N)
 
AB = []
for i in range(M):
    l = list(map(int, input().split()))
    AB.append(l)
 
for i in range(M):
    a, b = AB[i][0], AB[i][1]
    a -= 1;
    b -= 1;
 
    tree.nodes[a].concat(tree.nodes[b])
 
print(tree.find_max_child_num() + 1)

Submission status: Accepted

Solution code:
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('tourist.pyx', 'wb').write(zlib.decompress(base64.b85decode("c${TY%Wi`(5WFMt58Fc(Xq*VD9x7D&BPj>l7_bTkIj*Ai>${5yulNExGoBr<UD>{aRttH)I;%|$Qg=gd9dxR@Di;P73FNP9dUGDQ<!!6lSu|K~YBh-_ms0mLUn?gYZW#)-aa9<|QdNMzm)C?=0Ye!0PSL>Nlrr!HyueleslJL(9LLK>v^G%;rmuCIg#qB2DZxNO4vB|vjcygBlZci;a!M4%3#=<-KH%*=17Q{aUKnzd7$r^Mh?)~>JZY8tu?FNSSF3obEX4)B&4>QOg%{W&$?iM3r$#)#@1-i<G$3Tv!!YO=a7HK93>>2bH|?5DKSQZ$O1|v2Wz}2I=r-M5)Wxd_@vZhgv>n8k$Q*}~?$i?{b`*|*!&44o)o(qXPyC2tN78cW$sb`#As%5$;I{B+f6Pb!JtGS5K99vu#l*|yora61crqIw#8`%bf6>w5x%@H*ya+t$KlVq{`2")))
    os.system('cythonize -i -3 -b tourist.pyx')
import tourist

Submission status: Accepted

Solution code:
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True

class UnionFind(object):
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    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 union(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 size(self, x):
        return -self.parents[self.find(x)]

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

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots()),


def main():
    N, M = MI()
    uf = UnionFind(N)

    for i in range(M):
        a, b = MI()
        uf.union(a-1, b-1)

    ret = [uf.size(i) for i in uf.roots()]

    print(max(ret))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c$|Gw%Wi`(5WFMt58Fc(+?WWe9x7D&BPj>l7_e##a$H62*LRHxk5uYj%<hb5XV)}#=s_zkP8VmDX+fxd9IS(0_7~~msPP2x?YhC7MrN7TQZJ;@GSkYLG^^BVSnyUl(J@PrsEljkNYt_c{5(HrJ}MaFD0E6j3TaLu0PqAC^&^KSK{6rhMU*xP0W-8p7jXm_3&bf1C?N~wYp1k?d?xwe2+ocYvX)hY$Q!)87Qn4!pDW_k1X{^6I3g!SP5`ZRU)F%w_|lTq(t5kV_Wn?RJhKX0WX0_!3(!<AZ+Cr0b`5-G)5B2cDKP3MRTLcc4z9{|yMD&I_FD>RzfYUNf<m?V?UJ5sHpEslVb3Y#WWT_FU>uaeLkWDNxLv?I9=y5(eK^!*f6Lwt|6BGh+`c@?AInMq9^q9`Uj`3z8?ru6I-ZrcCyMFGr!<bjKbssL>ko6lRpX?;6zb1Q")))
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Submission status: Accepted

Solution code:
import sys
if sys.argv[-1] != 'ONLINE_JUDGE': import solve
else:
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c${TY%Wi`(5WFMt58Fc(Xq*VD9x7D&BPj>l7_bTkIj*Ai>${5yulNExGoBr<UD>{aRttH)I;%|$Qg=gd9dxR@Di;P73FNP9dUGDQ<!!6lSu|K~YBh-_ms0mLUn?gYZW#)-aa9<|QdNMzm)C?=0Ye!0PSL>Nlrr!HyueleslJL(9LLK>v^G%;rmuCIg#qB2DZxNO4vB|vjcygBlZci;a!M4%3#=<-KH%*=17Q{aUKnzd7$r^Mh?)~>JZY8tu?FNSSF3obEX4)B&4>QOg%{W&$?iM3r$#)#@1-i<G$3Tv!!YO=a7HK93>>2bH|?5DKSQZ$O1|v2Wz}2I=r-M5)Wxd_@vZhgv>n8k$Q*}~?$i?{b`*|*!&44o)o(qXPyC2tN78cW$sb`#As%5$;I{B+f6Pb!JtGS5K99vu#l*|yora61crqIw#8`%bf6>w5x%@H*ya+t$KlVq{`2")))
    os.system('cythonize -i -3 -b solve.pyx')

Submission status: Accepted

Solution code:
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c${TY%Wi`(5WFMt58Fc(Xq*VD9x7D&BPj>l7_bTkIj*Ai>${5yulNExGoBr<UD>{aRttH)I;%|$Qg=gd9dxR@Di;P73FNP9dUGDQ<!!6lSu|K~YBh-_ms0mLUn?gYZW#)-aa9<|QdNMzm)C?=0Ye!0PSL>Nlrr!HyueleslJL(9LLK>v^G%;rmuCIg#qB2DZxNO4vB|vjcygBlZci;a!M4%3#=<-KH%*=17Q{aUKnzd7$r^Mh?)~>JZY8tu?FNSSF3obEX4)B&4>QOg%{W&$?iM3r$#)#@1-i<G$3Tv!!YO=a7HK93>>2bH|?5DKSQZ$O1|v2Wz}2I=r-M5)Wxd_@vZhgv>n8k$Q*}~?$i?{b`*|*!&44o)o(qXPyC2tN78cW$sb`#As%5$;I{B+f6Pb!JtGS5K99vu#l*|yora61crqIw#8`%bf6>w5x%@H*ya+t$KlVq{`2")))
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Submission status: Accepted

Solution code:
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c$`&I!ES>v480@q58h!atm#yy9VRsPBOM1P1R4zjN;6H{*Uu)DfG;HPJ=@O?ts4jEja1J!?~Lt0nPD28hd~cF?bD=Xf%^5=(LPV;u<v!hiYAA)(~D@S(wK4OJMGmKogksHzD*O==oaXBc{y{`Fr`W8luZIog@8c76Wq+79@~t>c^(s~w9Rs`V`us@O@LyhqyPmKoCExGHNA#n5phT&7e`qhVbc=x4zF(|NT=~DGF(lOmEsIX(ws;WNT>a`v!FJ<dX0^CY!`6vkLphstf|Ghyk}ydX1u!R@-5#rU}V$73K#^S;7N@DFW7-)le`q#WIVQ`14Bv66J?Y)d#Z|jv4v55U(V)=(H7F+#YVNjas$(d2oDv=a<|rbybt=wdP8t{s)KuoJIX!8-F$@Ra>r_}w?$<gs;x7Jk!>Cy;51zfTT$iwsPi>V!e5yk9-B{lpk>lD|KRh>h5")))
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Submission status: Accepted

Solution code:
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c${5PL2iRE5WFMthv^{+v?dBYMx`G~IoQTdEE$80tEzo{*Wd=yz1W_eo!MP$KlHFh$m0~eaaTywkAn~BRX?eaXF3w(ceoAiIC9UeRrXFAJ$F}?NJ*tL!#zJq?ldEsaY5&q?34ywFR!N<Eyg@se2S5wsu`99o-vspHRyuKWw{o@D&8p{Vek@exEg!TGf)_f@xoiY;dF*q;nO?tB{k#CUu}GqOCr%Cvhi>XJp*SD42B^v$UK`TDGs}C*Bu!4#M$?xq6ZH{RcR9i70yjHb(#A5S4gsZk?i@}6i0<R!D5BQ2BrZyo*IZGydC<T4$*EBF#_rEM<_aqM<}|56`JK<nptm)igr=^x*4nBl9fZ%puYE4jTaZ2k!MJv&(Aztem}0@!_f*P&GQQng{I2")))
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Submission status: Accepted

Solution code:
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c${5PL2kn!5WHLRAEt*Sc1xnT$EfZ{QXc?Aiev-A^w7S(i%nyvdjV!=XLlAI+=#&ld75G{_6BK2??S|=#!1Dp(1{?w<EOJH&jTL@HQY%)aC=jklvR4;?)gb_s~ORZjk+vkuQcd-eLbh>;LBp^Q+bAC!>}aqjLG~crz;}Y^;(EQ@m_@lgV(U`W`;{yfWm0_EAQ}z^94c0uVBHK)Qq=(wdqwaiA+n#riW!1890MrFbt7Fmc{I(I_&yge_+@XXFrmPb^(T}@+K-OoQG<gI?wg5kYx8Fx996n97i-67Aq_^Fd5`{Y9X@l*7Q3aqT3`=MAG4pQ0gciq0}v|&@A`T&U#x^bc@>E@Z#6j>-vxWYSJk30!ifgSr*IRrv-diT7V=sza4$2?E")))
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Submission status: Accepted

Solution code:
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c${5PL2kn!5WHLRAEt*Sc1xnT$EfZ{QXc?Aiev-A^w7S(i%nyvdjV!=XLlAI+=#&ld75G{_6BK2??S|=#!1Dp(1{?w<EOJH&jTL@HQY%)aC=jklvR4;?)gb_s~ORZjk+vkuQcd-eLbh>;LBp^Q+bAC!>}aqjLG~crz;}Y^;(EQ@m_@lgV(U`W`;{yfWm0_EAQ}z^94c0uVBHK)Qq=(wdqwaiA+n#riW!1890MrFbt7Fmc{I(I_&yge_+@XXFrmPb^(T}@+K-OoQG<gI?wg5kYx8Fx996n97i-67Aq_^Fd5`{Y9X@l*7Q3aqT3`=MAG4pQ0gciq0}v|&@A`T&U#x^bc@>E@Z#6j>-vxWYSJk30!ifgSr*IRrv-diT7V=sza4$2?E")))
    os.system('cythonize -i -3 -b -j 36 solve.pyx')
import solve

Submission status: Accepted

Solution code:
#!/usr/bin/env python

import queue

def dfs(node, edge, vis):
    vis[node] = True
    count = 1
    vq = []
    vq.append(node)
    vq = queue.LifoQueue()
    vq.put(node)
    while not vq.empty():
        fnode = vq.get()
        for b in edge[fnode]:
            if not vis[b]:
                count += 1
                vq.put(b)
                vis[b] = True
    return count

n, m = [int(i) for i in input().split(' ')]

edge = [[] for i in range(n)]

for _ in range(m):
    a, b = [int(i) for i in input().split(' ')]
    edge[a-1].append(b-1)
    edge[b-1].append(a-1)

vis = [False]*n

count = 0

for i in range(n):
    if not vis[i]:
        count = max(count, dfs(i, edge, vis))

print(count)

Submission status: Accepted

Solution code:
#D
from queue import Queue

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

for i in range(M):
    a,b=map(int,input().split())
    Friend[a].append(b)
    Friend[b].append(a)
    

Flag=[False for i in range(N+1)]
ans=1

for i in range(1,N+1):
    if Flag[i]:
        continue
    q=Queue()
    q.put(i)
    cnt=1
    while not q.empty():
        st=q.get()
        Flag[st]=True
        for j in Friend[st]:
            if Flag[j]:
                continue
            cnt+=1
            Flag[j]=True
            q.put(j)
            
        ans=max(ans,cnt)
print(ans)

Submission status: Accepted

Solution code:
n,m = map(int,input().split())
a = [1]*(n+1)
b = [0]*(n+1)
for i in range(m):
  x,y = map(int,input().split())
  u = x
  while a[u]==0:
    u = b[u]
  v = y
  while a[v]==0:
    v = b[v]
  if u!=v:
    b[v] = u
    b[y] = u
    b[x] = u
    a[u] += a[v]
    a[v] = 0
print(max(a))

Submission status: Accepted

Solution code:
#UnionFind
import sys
sys.setrecursionlimit(10**9)
class UnionFind:
  def __init__(self, n):
    self.n = [-1]*n
    self.r = [0]*n
    self.siz = n

  def find_root(self, x):
    if self.n[x] < 0:
      return x
    else:
      self.n[x] = self.find_root(self.n[x])
      return self.n[x]

  def unite(self, x, y):
    x = self.find_root(x)
    y = self.find_root(y)
    if x == y:
      return
    elif self.r[x] > self.r[y]:
      self.n[x] += self.n[y]
      self.n[y] = x
    else:
      self.n[y] += self.n[x]
      self.n[x] = y
      if self.r[x] == self.r[y]:
        self.r[y] += 1
    self.siz -= 1

  def root_same(self, x, y):
    return self.find_root(x) == self.find_root(y)

  def count(self, x):
    return -self.n[self.find_root(x)]

  def size(self):
    return self.siz

n,m=map(int,input().split())
u=UnionFind(n)
for _ in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  u.unite(a,b)
ans=0
for i in range(n):
  ans=max(ans,u.count(i))
print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1
 
N,M=map(int,input().split())
 
class UnionFind:
    def __init__(self,n):
        self.par=[i for i in range(n)]
        self.siz=[1]*n
        
    def root(self,x):
        while self.par[x]!=x:
            self.par[x]=self.par[self.par[x]]
            x=self.par[x]
        return x
    
    def unite(self,x,y):
        x=self.root(x)
        y=self.root(y)
        if x==y:
            return False
        if self.siz[x]<self.siz[y]:
            x,y=y,x
        self.siz[x]+=self.siz[y]
        self.par[y]=x
        return True
    
    def is_same(self,x,y):
        return self.root(x)==self.root(y)
    
    def size(self,x):
        return self.siz[self.root(x)]
    
u=UnionFind(N)
 
for _ in range(M):
    a,b=map(int1,input().split())
    #print(a)
    u.unite(a,b)
    
#print(u.par)
#print(u.siz)

ans = 0
for aa in u.siz:
    ans=max(ans,aa)
print(ans)

Submission status: Accepted

Solution code:
# This code is generated by [Atcoder_base64](https://github.com/kyomukyomupurin/AtCoder_base64)
import base64
import subprocess
import zlib


exe_bin = "c%1D#e|QtemAkTR3$VQ+F~krEDiw)Mu(81qE3q5PNM@B!5Etx({Gf}FWvs(Lh`lCu?mj{+n`RLLE=^O~l7=R|9&OVLrTr)nN^Kwpw={(&X}OR#q%DaADLA1R6TrInW@qHpTI!Gc?!ROFNpI)PdvD&ndGmH=G~=h8?n(pCb1bEBU*IseBU{avQ@rW^7zyA?xH0g32RD^VgS=5gr-ws)JT%4XQTa*?YF-bgaPg4Wz*H`InmH{Va-1c`hq~tGtJvIpOB@`a^=^I16vt<veC3p{oYFIBrhE)CZX^9vQ@kEJxOix!u<EQ_OYBJ-u7|Z;JY;-d1im!xA5Ufqm(co>+2s_~mqFGKvm5*?=NHdzsLgNiH?_6rx0lS%pI=<i+FUS)=wzm}3m4ZAdhBn5M(1pb!}1qCedGA+9~E04`Q(cm0+xyMb}xG8L8P6)jr1G#$9mpOa1-H^H+9pLRW%;gj8Ul(KDQ*mSAf9j3GkEn#Pq{S<lL2nJ|hW!LlQYJC&7P|1Yep&{>~)yUra(DN<xpr#*zU4W)k{GlE^nFk#k=X{JbP`YLe7z0s8UWB+gQ(N@L@0h*R-}Iy?vd+A7z2@4g#-bUr6Zs~Ve|q*mF}B1;k{xvCdQwZ0bLDu1i&YpGteprN_RSM6EZ;8V*Impr<7sa)c3Zk1MgT7AW?Cco?`a;^pZQn~0JNs{YZnxBNSTFKMU(Co#6+J>sNSb2N9w8q!c+T7%6@XH<2+CnI6da^N*$OR}8)L-TGO0B4U5hv9&J?U?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&1B^64Uz_GW)=1Ha_UbJz9TT}_rfVzSF4H$Z{;t@F5G<=+w19QyNF$eeJxxu%mSVgR=JLD!g-)k)?UHIKfg$FRyJImTq>-?zXb+P+W%{<RY;9!@koX#$z5(RwnYXo#co4girk6U}(&govyJ>&(>R;SFI}l8-wrOg{K{NUi+$bHimksO4O}hl)=5JgzRIlRc`+1c2skaXk-b#$O9aqrW(I|UX0+d@+SkIn_s5M+cQ?u+V05j#wo>errs;RADWt+dDHs4>%kzBo}wVo@e?PvmdDwJE)lC@xSXkT1Lg0dE0g9i!e)0zeutAzf;$AVSO@BmH?-^8>9EzM+v7x?OF1gfuX8OeckuUGQ5dwpwUNhYQ$7zrn;4E79ldK&#+cpw77+qeP<jExY%61^Gzsf6zzoJz#@Lz3KQXNlM4@$h82hF^bQ+@hn`FKdf*{A~Tqp!M(Y<2j4LXtbH}vvoFuY?j0Jll05p#hki##Q52IoWWcQae2*a_}M<sLtOkFakg$}@Kv3`^!ED_r|$hQezv}6ut2B3K?hfJ>RuAdvwZ*t*#)ySs;9pFPjRYE89&=EV36%^>Fvkb-$nT=XrApWFsS9fEdl>#PJ35=WPg!CwhzaWzW)^+Kij8>K^?tW2cOsRv;7PP_4YF9;EOtbwmxF;Io$yq{dt^Mbo^{R!=QfKMc@AKaq;7qt@9Y{(a~FU`5)={ll|X@WcB}C$Itd<7+j{?-_qN&U&kNYzhVCmLr1S4KX^$9?+dei(~<uJq2~4W*7qOoLkJpvwr(%UPpq$={}MMcwlIzSpAA~SCVpu7m|ojxoAmqBRkPLnuD?_Nbsc|fy+?OA**Melvt*zf(u|+&H{?+MZQJ8HEIR&lUaeohq00F4bofNSJ0#cw<wVNAmsXGNRK$&rA7eDS$0eHzhI9_A_n+}e_=n0=X#P9#`+oo-O@(I"

open("./kyomu", 'wb').write(zlib.decompress(base64.b85decode(exe_bin)))
subprocess.run(["chmod +x ./kyomu"], shell=True)
subprocess.run(["./kyomu"], shell=True)

Submission status: Accepted

Solution code:
# This code is generated by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pXlj?LZ(JnBq`HzGj;Ds{=Z!YUuf&G)8OePm()Y9;aIREej}+PhR7xteo7JLmFu9F$#S>D*1u?3XLR%@fHJ)~DNk?Ph+Gv;~Tz4qd&AGyTaj>UQDXFw<hk%3A8b*M&WF!_sL0a1uldwy;PFQtqO+W=^HT)$3bR`pHExRJ!bYJNXC&xLkE{Z~=SBz|v1c{8_HNHtGHdr0{4E01ss1SoNt2h^IcRjE#mD=$CxPs>yc#C59FQfc#R!lk`KPIYkxb*qePMy5|HPEfoXYZSg)_jIOe%HBFC?uFZdoN{l5yjcLi~cpSl~c}Gm_B=dWt8QU<7=u(rO(boHgejWYWAMXs9pCytdHLloN`9O#Mt{Vqxb3jH|ywAoO0&Ec=q1RC`-6vd4>A%Kf@_8W%}&>no)KRq>mpP{~oH}M0xfe&ZtwRe@6-Z{hT_teEb}aQFdO%ivIe`I(_zD&*)j5yhBI-Qm4<}{~6WCt3pS=q0?vY6O5X51{_+JzORn!v-bi<^~V?b@qdTYuHWLh1N(mkoxD@W|C3JN=>Hsy`aiDIXXhA<9@R~FeLR1p?|-J2>iyNPpLaMVFP5Dzj{n~T^+PAGzka{vlzdF4&)#zz=au$XuYZx#=IoCDUkdGCwSTDfm|q9!nDpnko%0p`<<IE<x=z3No<#{;XL@~B%=F;4IDV>MP4ydf`&Xk*zuctsuRnlf`ipgVsq^_#|2)D|eFt?I??Y~G;{GvN<-59c(vAP8x(TbFKhq8LzgSEA*D2`r{}*)uI*$"
    open("./kyomu", 'wb').write(zlib.decompress(base64.b85decode(exe_bin)))

subprocess.run(["chmod +x ./kyomu"], shell=True)
subprocess.run(["./kyomu"], shell=True)

Submission status: Accepted

Solution code:
# Union Find
class UnionFind():
    # parents:親要素の番号，要素が根なら-グループの要素数
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    # 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]

    # xとyのグループを併合
    def union(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 size(self, x):
        return -self.parents[self.find(x)]

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

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r))
                         for r in self.roots())

    # def max_size_group(self):
    #     ret = 0
    #     for mem in self.all_group_members():
    #         ret = max(ret, len(self.members(mem)))
    #         # print(self.members(mem))
    #     return ret


N, M = map(int, input().split())
uf = UnionFind(N)
for i in range(M):
    a, b = map(int, input().split())
    uf.union(a - 1, b - 1)
ans = 0
for i in range(N):
    ans = max(ans, uf.size(i))
print(ans)