Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B =  [int(input()) for _ in range(N)]

for b in B:
  if i in range(3):
    for j in range(3):
      if A[i][j] == b:
        A[i][j] = 0

for i in range(3):
  if A[i][0] == A[i][1] == A[i][2] == 0:
    print('Yes')
    exit()

  if A[0][i] == A[1][i] == A[2][i] == 0:
    print('Yes')
    exit()
    
if A[0][0] == A[1][1] == A[2][2] == 0:
    print('Yes')
    exit()
 

if A[0][2] == A[1][1] == A[2][0] == 0:
    print('Yes')
    exit()
    
  
print('No')


Fixed submission:
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B =  [int(input()) for _ in range(N)]

for b in B:
  for i in range(3):
    for j in range(3):
      if A[i][j] == b:
        A[i][j] = 0

for i in range(3):
  if A[i][0] == A[i][1] == A[i][2] == 0:
    print('Yes')
    exit()

  if A[0][i] == A[1][i] == A[2][i] == 0:
    print('Yes')
    exit()
    
if A[0][0] == A[1][1] == A[2][2] == 0:
    print('Yes')
    exit()
 

if A[0][2] == A[1][1] == A[2][0] == 0:
    print('Yes')
    exit()
    
  
print('No')

Buggy python submission (verdict: Runtime Error):
a1,a2,a3 = map(int,input().split())
b1,b2,b3 = map(int,input().split())
c1,c2,c3 = map(int,input().split())
N = int(input())
b =  [int(input()) for _ in range(N)]

if a1 and a2 and a3 in b or
    b1 and b2 and b3 in b or
    c1 and c2 and c3 in b or
    a1 and b1 and c1 in b or
    a2 and b2 and c2 in b or
    a3 and b3 and c3 in b or
    a1 and b2 and c3 in b or
    a3 and b2 and c1 in b:
    print('Yes')
else:
    print('No')

Fixed submission:
A = [list(map(int, input().split())) for _ in range(3)]
N = int(input())
B =  [int(input()) for _ in range(N)]

for b in B:
  for i in range(3):
    for j in range(3):
      if A[i][j] == b:
        A[i][j] = 0

for i in range(3):
  if A[i][0] == A[i][1] == A[i][2] == 0:
    print('Yes')
    exit()

  if A[0][i] == A[1][i] == A[2][i] == 0:
    print('Yes')
    exit()
    
if A[0][0] == A[1][1] == A[2][2] == 0:
    print('Yes')
    exit()
 

if A[0][2] == A[1][1] == A[2][0] == 0:
    print('Yes')
    exit()
    
  
print('No')
Buggy python submission (verdict: Runtime Error):
N,R = map(int,input())

print( R if N >10 else R - 100*(10-N))

Fixed submission:
N,R = map(int,input().split())

print( R if N >= 10 else R + 100*(10-N))

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input())

print(100*(10-K) if N <=10 else K)

Fixed submission:
N,R = map(int,input().split())

print( R if N >= 10 else R + 100*(10-N))
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
X = list(map(int,input().split()))
P = math.ceil(sum(X)/N)
P1 = P - 1
hp = 0

for x in X:
  hp_x = (P-x)**2
  hp2_x = (P1 - x)**2
  hp = hp + hp_x
  hp2 = hp2 + hp2_x
print(min(hp,hp2))

Fixed submission:
import math
N = int(input())
X = list(map(int,input().split()))
P = math.ceil(sum(X)/N)
P1 = P - 1
hp = 0
hp2 = 0

for x in X:
  hp_x = (P-x)**2
  hp2_x = (P1 - x)**2
  hp = hp + hp_x
  hp2 = hp2 + hp2_x
print(min(hp,hp2))

Buggy python submission (verdict: Runtime Error):
N = int(input())
X = list(map(input().split()))
P = ceil(sum(X)/2)

hp = 0

for x in X:
  hp_x = (P-X)**2
  hp = hp + hp_x
print(hp)

Fixed submission:
import math
N = int(input())
X = list(map(int,input().split()))
P = math.ceil(sum(X)/N)
P1 = P - 1
hp = 0
hp2 = 0

for x in X:
  hp_x = (P-x)**2
  hp2_x = (P1 - x)**2
  hp = hp + hp_x
  hp2 = hp2 + hp2_x
print(min(hp,hp2))
Buggy python submission (verdict: Runtime Error):
S,T = map(input().split())
A,B = map(int,input().split())
U = input()

if U == S:
  print(A-1, B)
else:
  print(A, B-1)

Fixed submission:
S,T = input().split()
A,B = map(int,input().split())
U = input()

if U == S:
  print(A-1, B)
else:
  print(A, B-1)
Buggy python submission (verdict: Runtime Error):
C = input()

abc ='abcdefghijklmnopqrstuvwxyz'

print(abc[abc.index(C+1))]

Fixed submission:
C = input()

abc ='abcdefghijklmnopqrstuvwxyz'

print(abc[abc.index(C) +1])
Buggy python submission (verdict: Runtime Error):
S,T = map(input().split())

print(T,S)

Fixed submission:
S,T = input().split()

print(T+S)
Buggy python submission (verdict: Runtime Error):
N = int(inoput())
S = input()

print('Yes' if S[N//2:] == S[:N//2] else 'No')

Fixed submission:
N = int(input())
S = input()

print('Yes' if S[N//2:] == S[:N//2] else 'No')
Buggy python submission (verdict: Runtime Error):
N = int(input())

print( 0.5 if N % == 0 else ((N//2)+1) /N )


Fixed submission:
N = int(input())
print(0.5 if N % 2 == 0 else ((N//2)+1)/N)

Buggy python submission (verdict: Runtime Error):
N = int(input())

print(0.5 if N % ==0 else ((N//2)+1)/N)


Fixed submission:
N = int(input())
print(0.5 if N % 2 == 0 else ((N//2)+1)/N)

Buggy python submission (verdict: Runtime Error):
N = int(input())

print(0.5 if N % ==0 else (N//2)+1/N)

Fixed submission:
N = int(input())
print(0.5 if N % 2 == 0 else ((N//2)+1)/N)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

lists = [0]*N

for i in range(N):
  lists[i] = A.index(i+1)+1
  
for i in lists:
  print(i, end = ' ')

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
lists = [0] * n

for i in range(n):
    lists[a[i] - 1] = i + 1
    
for i in lists:
  print(i , end =' ')

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = map(int,input().split())

lists = [0]*N

for i in range(N):
  lists[i] = A.index(i+1)+1
  
for i in lists:
  print(i, end=' ')

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
lists = [0] * n

for i in range(n):
    lists[a[i] - 1] = i + 1
    
for i in lists:
  print(i , end =' ')

Buggy python submission (verdict: Time Limit Exceeded):
L = [input(), input()]
A = L[1].split()
print(' '.join([str(A.index(str(i))+1) for i in range(1, int(L[0])+1)]))


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
lists = [0] * n

for i in range(n):
    lists[a[i] - 1] = i + 1
    
for i in lists:
  print(i , end =' ')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

lists = []
for i in range(1,len(A)+1):
    lists.append(A.index(i)+1)
         
for i in lists:
         print(i, end = ' ')

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
lists = [0] * n

for i in range(n):
    lists[a[i] - 1] = i + 1
    
for i in lists:
  print(i , end =' ')
Buggy python submission (verdict: Runtime Error):
print(int(input()**3)

Fixed submission:
N = int(input())

print(N**3)

Buggy python submission (verdict: Runtime Error):
print(int(input()**3)

Fixed submission:
N = int(input())

print(N**3)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

count = 0

for i,j in S,T:
  if S[i] == T[j]:
    count +=1
print(count)


Fixed submission:
S = input()
T = input()

count = 0

if S[0] == T[0]:
  count += 1
if S[1] == T[1]:
  count +=1
if S[2] == T[2]:
  count +=1
print(count)

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

count = 0

for i in S,T:
  if S[i] == T[i]:
    count +=1
print(count)

Fixed submission:
S = input()
T = input()

count = 0

if S[0] == T[0]:
  count += 1
if S[1] == T[1]:
  count +=1
if S[2] == T[2]:
  count +=1
print(count)
Buggy python submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print(math.cail((B-A)/(A-1))+1)

Fixed submission:
import math
A, B = map(int,input().split())

x = math.ceil(1+(B-A)/(A-1))

print(x)

Buggy python submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print(math.cail((B-A)/(A-1))+1))

Fixed submission:
import math
A, B = map(int,input().split())

x = math.ceil(1+(B-A)/(A-1))

print(x)

Buggy python submission (verdict: Runtime Error):
import math
A, B = map(int, input().split())
print(math.cail((B-A)/(A-1))+1)

Fixed submission:
import math
A, B = map(int,input().split())

x = math.ceil(1+(B-A)/(A-1))

print(x)

Buggy python submission (verdict: Runtime Error):
import math
A,B = map(int, input().split())

print(math.ceil(B/(A-1))

Fixed submission:
import math
A, B = map(int,input().split())

x = math.ceil(1+(B-A)/(A-1))

print(x)

Buggy python submission (verdict: Runtime Error):
A,B = map(int,input())

print(B//A +1)

Fixed submission:
import math
A, B = map(int,input().split())

x = math.ceil(1+(B-A)/(A-1))

print(x)
Buggy python submission (verdict: Runtime Error):
n =  int(input())
a =[int(input) for _ in range(n)]
b = 0
rev_a =[]

for i in a:
    j = 1 / i
    rev_a.append(j)

for k in rev_a:
    b += k

print(1/b)
  
  



Fixed submission:
n =  int(input())
a =list(map(int,input().split()))
rev_a=[]
b=0
       

for i in a:
    j = 1 / i
    rev_a.append(j)
b=0
for k in rev_a:
    b += k

print(1/b)

Buggy python submission (verdict: Runtime Error):
n =  int(input())
a =[int(input) for _ in range(n)]
rev_a =[]

for i in a:
    j = 1 / i
    rev_a.append(j)
    
print(1/ sum(rev_a))


Fixed submission:
n =  int(input())
a =list(map(int,input().split()))
rev_a=[]
b=0
       

for i in a:
    j = 1 / i
    rev_a.append(j)
b=0
for k in rev_a:
    b += k

print(1/b)
Buggy python submission (verdict: Runtime Error):
N = int(input())
count = 0

for i in range(1,N+1):
  if len(i)%2 == 1:
    count+=1
print(count)

Fixed submission:
N = int(input())
count = 0

for i in range(1,N+1):
  if len(str(i))%2 == 1:
    count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().split())

print((A+B)//2 if (A+B)% ==0 else 'IMPOSSIBLE')


Fixed submission:
A,B =map(int, input().split())

print( (A+B)//2 if (A+B)%2 ==0 else 'IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().split())

print( (A+B)//2 if (A+B)% ==0 else 'IMPOSSIBLE')


Fixed submission:
A,B =map(int, input().split())

print( (A+B)//2 if (A+B)%2 ==0 else 'IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().split())

print( (A+B)/2 if type((A+B)/2) =int else 'IMPOSSIBLE')

Fixed submission:
A,B =map(int, input().split())

print( (A+B)//2 if (A+B)%2 ==0 else 'IMPOSSIBLE')
Buggy python submission (verdict: Runtime Error):
import math
N, D = map(int, input().split())

print(math.ceil(N/(2*D+1))

Fixed submission:
import math
N,D = map(int, input().split())
print(math.ceil(N/(2*D+1)))
Buggy python submission (verdict: Runtime Error):
S = input()
s = set(S)

print('Yes' if len(s)==2 and S.count(s[0]) == S.count(s[1]) == 2 else 'No')

Fixed submission:
S = input()
s = list(set(S))

print('Yes' if len(s)==2 and S.count(s[0]) == S.count(s[1]) == 2 else 'No')
Buggy python submission (verdict: Runtime Error):
print(B if A >=13 else B//2 if 6 <= A <= 12 else 0)

Fixed submission:
A,B = map(int, input().split())
print(B if A >=13 else B//2 if 6 <= A <= 12 else 0)
Buggy python submission (verdict: Runtime Error):
N,M =map(int, input().split())
L,R =[],[]

for i in range(M+1):
  x,y = map(int,input().split())
  L.append(x)
  R.append(y)

print(max(0,min(R)-max(L)+1))

Fixed submission:
N,M =map(int, input().split())
L,R =[],[]
 
for i in range(M):
  x,y = map(int,input().split())
  L.append(x)
  R.append(y)
 
print(max(0,min(R)-max(L)+1))

Buggy python submission (verdict: Runtime Error):
N,M =map(int, input().split())
L,R =[],[]

for i in range(M+1):
  x,y = map(int,input().split())
  L.append(x)
  R.append(y)

print(max(0,min(R)-max(L))

Fixed submission:
N,M =map(int, input().split())
L,R =[],[]
 
for i in range(M):
  x,y = map(int,input().split())
  L.append(x)
  R.append(y)
 
print(max(0,min(R)-max(L)+1))
Buggy python submission (verdict: Runtime Error):
A,B,T = map(int(input().split()))

print((T//A)*B)

Fixed submission:
A,B,T = map(int,input().split())

print((T//A)*B)
Buggy python submission (verdict: Runtime Error):
A,B,K = map(int,input().split())
a = []
b = []

for i in range(1,A+1):
  if A%i==0:
    a.append(i)
for j in range(1,B+1):
  if B%j==0:
    b.append(j)

abset = list(set(a)&set(b))

print(abset[K+1])

Fixed submission:
A,B,K = map(int,input().split())
a = []
b = []

for i in range(1,A+1):
  if A%i==0:
    a.append(i)
for j in range(1,B+1):
  if B%j==0:
    b.append(j)

abset = list(sorted(set(a)&set(b)))[::-1]

print(abset[K-1])
Buggy python submission (verdict: Runtime Error):
A,B =map(int, input().split())

print( X + Y/2)

Fixed submission:
X,Y = map(int, input().split())

print(X + Y//2)
Buggy python submission (verdict: Runtime Error):
if input() ==1:
  'Hello World'
else:
  A = int(input())
  B = int(input())
  print(A+B)

Fixed submission:
if int(input()) ==1:
  print('Hello World')
else:
  A = int(input())
  B = int(input())
  print(A+B)
Buggy python submission (verdict: Runtime Error):
A,B = int(input().split())

print('Yes' if A*B % 2 ==0 else 'No')

Fixed submission:
A,B = map(int,input().split())

print('No' if A*B % 2 == 0 else 'Yes')
Buggy python submission (verdict: Runtime Error):
N = int(input())

if N% == 0:
  print((N//2)**2)
else:
  print(((N+1)//2)*((N-1)//2))

Fixed submission:
N = int(input())

if N %2 == 0:
  print((N//2)**2)
else:
  print( ((N+1)//2) * ((N-1)//2) )
Buggy python submission (verdict: Runtime Error):
R = int(input())

print('ABC' if R <1200 else 'ARC' if N < 2800 else 'AGC')

Fixed submission:
R = int(input())

print('ABC' if R <1200 else 'ARC' if R < 2800 else 'AGC')
Buggy python submission (verdict: Runtime Error):
N = input()
a = sorter(map(int,input().split()))

print(a[-1] - a[0])

Fixed submission:
N = input()
a = sorted(map(int,input().split()))

print(a[-1] - a[0])
Buggy python submission (verdict: Runtime Error):
A,B,X = map(int, input().split())

print('YES' if A =< X and A+B >= X else 'NO')


Fixed submission:
A,B,X = map(int, input().split())

print('YES' if A <= X and A+B >= X else 'NO')
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())

print('Even' if a*b % == 0 else 'Odd')

Fixed submission:
a,b = map(int,input().split())

print('Even' if a*b %2 == 0 else 'Odd')
Buggy python submission (verdict: Runtime Error):
S = input()

print( 2018 + S[:4])

Fixed submission:
S = input()
print("2018"+S[4:])
Buggy python submission (verdict: Runtime Error):
n,y = map(int,input().split())

or i in range(n+1):
    for j in range(n-i+1):
        print(i,j,n-i-j)
        if 10000*i + 5000*j + 1000*(n-i-j) == y:
            print(i, j, n-i-j)
            exit()
        print(-1,-1,-1)

Fixed submission:
n,y = map(int,input().split())

for i in range(n+1):
    for j in range(n-i+1):
        if 10000*i + 5000*j + 1000*(n-i-j) == y:
            print(i, j, n-i-j)
            exit()
print(-1,-1,-1)
Buggy python submission (verdict: Runtime Error):
print(48 -int(input())

Fixed submission:
print( 48 - int(input()) )
Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int, input().split())

print('Left' if A+B > C+D  'Balanced' elif A+B == C+D else 'Right')


Fixed submission:
A, B, C, D = map(int, input().split())
print("Left" if A+B > C+D else "Balanced" if A+B == C+D else "Right")

Buggy python submission (verdict: Runtime Error):
A,B,C,D = map(int, input().split())

print('Left' if A+B > C+D else 'Balanced' A+B == C+D else 'Right')

Fixed submission:
A, B, C, D = map(int, input().split())
print("Left" if A+B > C+D else "Balanced" if A+B == C+D else "Right")
Buggy python submission (verdict: Runtime Error):
import math
a,b = map(int, input().split())
print(math.cail((a+B)/2))

Fixed submission:
import math

a,b, = map(int, input().split())

x = math.ceil((a+b)/2)

print(x)

Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())

print(math.ceil((a+b)/2))

Fixed submission:
import math

a,b, = map(int, input().split())

x = math.ceil((a+b)/2)

print(x)
Buggy python submission (verdict: Runtime Error):
N = input()
A = list(map(int,input().split()))

count = 0

while all(a % == 0 for a in A):
  A =[a/2 for a in A]
  count += 1
print(count)

Fixed submission:
N = input()
A = list(map(int,input().split()))

count = 0

while all(a % 2 == 0 for a in A):
  A =[a/2 for a in A]
  count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())

print('Yes' if sum(map(N)) % N == 0 else 'No')


Fixed submission:
N = input()
print("No" if int(N) % sum(map(int, N)) else "Yes")

Buggy python submission (verdict: Runtime Error):
N = input()

print('Yes' if sum(map(int,N)) % N == 0 else 'No')

Fixed submission:
N = input()
print("No" if int(N) % sum(map(int, N)) else "Yes")
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())

print('Yes' if a == b == c or b == c == d else 'No')


Fixed submission:
a,b,c,d = input()

print('Yes' if a == b == c or b == c == d else 'No')

Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())

print('Yes' if a = b = c or b = c = d else 'No')

Fixed submission:
a,b,c,d = input()

print('Yes' if a == b == c or b == c == d else 'No')
Buggy python submission (verdict: Runtime Error):
s = input()

print(s[0] + (len(s)-2) + s[-1]) 

Fixed submission:
s = input()

print(s[0] + str(len(s)-2) + s[-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())

print('ABC'+ N)


Fixed submission:
N = int(input())

print('ABC'+ str(N))

Buggy python submission (verdict: Runtime Error):
N = int(input())

print('ABC'+ N, end='')

Fixed submission:
N = int(input())

print('ABC'+ str(N))
Buggy python submission (verdict: Runtime Error):
a,b,c = sorted(map(int.input().split()))

print(a+b)

Fixed submission:
a,b,c = sorted(map(int,input().split()))

print(a+b)
Buggy python submission (verdict: Runtime Error):
import math

N = int(input())
end = int(math.sqrt(N))+1
ans = len(str(N))

for a in range(1,end):
  if N%a == 0:
    b = N//a
    ans = min(ans, len(str(max(a,b)))
print(ans)


Fixed submission:
N = int(input())

import math

end = int(math.sqrt(N))+1
ans = len(str(N))

for a in range(1,end):
  if N % a ==0:
    b = N//a
    ans = min(ans, len(str(max(a,b))))
print(ans)

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

N = int(input())
end = int(math.sqrt(N))+1
ans = len(str(N))

for a in range(1,end):
  if N%a == 0:
    b = N//i
    ans = min(ans, len(str(max(a,b)))
print(ans)


Fixed submission:
N = int(input())

import math

end = int(math.sqrt(N))+1
ans = len(str(N))

for a in range(1,end):
  if N % a ==0:
    b = N//a
    ans = min(ans, len(str(max(a,b))))
print(ans)
Buggy python submission (verdict: Runtime Error):
abc = lits(input().split())

print(len(set(abc)))

Fixed submission:
abc = list(input().split())

print(len(set(abc)))
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    n,k=map(int, input().split())
    s=[]
    for _ in range(k):
        l,r=map(int,input().split())
        for j in range(l,r+1):
            s.append(j)
    mod=998244353
    dp=[0]*n
    dp[0]=1
    for i in range(1,n):
        for j in s:
            if i-j>=0:
                dp[i]+=dp[i-j]
                dp[i]%=mod
    print(dp[-1])
main()

Fixed submission:
n,k=map(int, input().split())
lr=[list(map(int,input().split())) for _ in range(k)]
mod=998244353
dp2=[0]*n
dp2[0]=1
for i in range(1,n):
    dp2[i]+=dp2[i-1]
    for l,r in lr:
        if i-l>=0:
            dp2[i]+=dp2[i-l]
        elif i-l<0 and i-r>=0:
            dp2[i]+=dp2[0]
        if i-r-1>=0:
            dp2[i]-=dp2[i-r-1]
    dp2[i]%=mod
print((dp2[-1]-dp2[-2])%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int, input().split())
s=[]
for _ in range(k):
    l,r=map(int,input().split())
    for j in range(l,r+1):
        s.append(j)
mod=998244353
dp=[0]*n
dp[0]=1
for i in range(1,n):
    for j in s:
        if i-j>=0:
            dp[i]+=dp[i-j]
            dp[i]%=mod
print(dp[-1])

Fixed submission:
n,k=map(int, input().split())
lr=[list(map(int,input().split())) for _ in range(k)]
mod=998244353
dp2=[0]*n
dp2[0]=1
for i in range(1,n):
    dp2[i]+=dp2[i-1]
    for l,r in lr:
        if i-l>=0:
            dp2[i]+=dp2[i-l]
        elif i-l<0 and i-r>=0:
            dp2[i]+=dp2[0]
        if i-r-1>=0:
            dp2[i]-=dp2[i-r-1]
    dp2[i]%=mod
print((dp2[-1]-dp2[-2])%mod)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int, input().split())
class UnionFind():
    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())
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 uf.roots():
    ans=max(ans,len(uf.members(i)))
print(ans)

Fixed submission:
n,m=map(int, input().split())
class UnionFind():
    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())
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 uf.roots():
    ans=max(ans,uf.size(i))
print(ans)