Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p04043 (python)

Fixed submission:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    if a == [5, 5, 7]:
        print("YES")
    else:

        print("NO")
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a = LI()
    a.sort()
    if a = [5, 5, 7]:
        print("YES")
    else:

        print("NO")
    return

#B
def B():
    return

#C
def C():
    return

#D
def D():
    return

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == '__main__':
    A()
Problem p02945 (python)

Fixed submission:
def larger(x, y):
	if x > y: return x
	return y

A, B = map(int, input().split())
p = A + B
m = A - B
t = A * B
print(larger(p, larger(m, t)))

Buggy submission (verdict: Runtime Error):
def larger(x, y):
	if x > y: return x
	return y

A, B = map(int, input().split())
p = A + B
m = A - B
t = A * B
print(larger(p. larger(m, t)))
Problem p03761 (python)

Fixed submission:
def smaller(x, y):
	if x < y:
		return x
	return y

N = int(input())
anscounter = []
for i in range(0, 26):
	anscounter.append(0)
S = input()
for i in range(0, len(S)):
	anscounter[ord(S[i])-97] += 1
for i in range(1, N):
	tmpcounter = []
	for j in range(0, 26):
		tmpcounter.append(0)
	newS = input()
	for j in range(0, len(newS)):
		tmpcounter[ord(newS[j])-97] += 1
	for j in range(0, 26):
		anscounter[j] = smaller(anscounter[j], tmpcounter[j])
ans = ''
for i in range(0, 26):
	for j in range(0, anscounter[i]):
		ans = ans + str(chr(i+97))
print(ans)

Buggy submission (verdict: Runtime Error):
def smaller(x, y):
	if x < y:
		return x
	return y

N = int(input())
anscounter = []
for i in range(0, 26):
	anscounter.append(0)
S = input()
for i in range(0, len(S)):
	anscounter[ord(S[i])-97] += 1
for i in range(1, N):
	tmpcounter = []
	for j in range(0, 26):
		tmpcounter.append(0)
	newS = input()
	for j in range(0, len(S)):
		tmpcounter[ord(newS[j])-97] += 1
	for j in range(0, 26):
		anscounter[j] = smaller(anscounter[j], tmpcounter[j])
ans = ''
for i in range(0, 26):
	for j in range(0, anscounter[i]):
		ans = ans + str(chr(i+97))
print(ans)

Buggy submission (verdict: Runtime Error):
def smaller(x, y):
	if x < y:
		return x
	return y

N = int(input())
anscounter = []
for i in range(0, 26):
	anscounter.append(0)
S = input()
for i in range(0, len(S)):
	anscounter[ord(S[i])-97] += 1
for i in range(1, N):
	tmpcounter = []
	for j in range(0, 26):
		tmpcounter.append(0)
	newS = input()
	for j in range(0, len(S)):
		tmpcounter[ord(newS[j])-97] += 1
	for j in range(0, 26):
		anscounter[j] = smaller(anscounter[j], tmpcounter[j])
ans = ''
for i in range(0, 26):
	for j in range(0, anscounter[i]):
		ans = ans + str(chr(i+97))
print(ans)
Problem p02612 (python)

Fixed submission:
N = int(input())

if N % 1000 == 0:
	print(0)
else:
	print(1000 - (N % 1000))

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

ACcount = 0 
WAcount = 0
TLEcount = 0
REcount = 0
for i in range(N):
	S=input()

	if S == "AC":
		ACcount = ACcount + 1
	elif S == "WA":
		WAcount = WAcount + 1
	elif S == "TLE":
		TLEcount = TLEcount + 1
	elif S == "RE":
		REcount = REcount + 1

print("AC x", ACcount)
print("WA x", WAcount)
print("TLE x", TLEcount)
print("RE x", REcount)

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

ACcount = 0 
WAcount = 0
TLEcount = 0
REcount = 0
for i in range(N):
	S=input()

	if S == "AC":
		ACcount = ACcount + 1
	elif S == "WA":
		WAcount = WAcount + 1
	elif S == "TLE":
		TLEcount = TLEcount + 1
	elif S == "RE":
		REcount = REcount + 1

print("AC x" + str(ACcount))
print("WA x" + str(WAcount))
print("TLE x" + str(TLEcount))
print("RE x" + str(REcount))
Problem p02621 (python)

Fixed submission:
a = int(input())

print(a + a * a  + a * a * a)

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

count = 0
for i in range(len(S)):
	if S[i] != T[i]:
		count = count + 1

print(count)
Problem p02657 (python)

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

print(A * B)

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

print(A * B)

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

print(A * B)
Problem p02687 (python)

Fixed submission:
S = input()

if S == "ABC":
	print("ARC")
else:
	print("ABC")

Buggy submission (verdict: Runtime Error):
for okashi_number in range(k):
	di = int(input())
	D = map(int,input().split())
	for x in range(di)
		A[[x]-1] = 1

for i in range(N):
	if A[i] == 0:
	print(A[i])
Problem p02760 (python)

Fixed submission:
s = 3
arr =[]
for _ in range(s):
        arr.append(list(map(int, input().rstrip().split())))
#print(arr)
 
check = [[0,0,0],[0,0,0],[0,0,0]]
#print(check)
 
#check データ
N = int(input())
#print(N)
 
for i in range(N):
    data = int(input())
    for k in range(3):
        for j in range(3):
            if data == arr[j][k]:
                check[j][k]= 1
#print(check)
 
#chek ビンゴ
answer = "No"
for k in range(3):
    if check[k][0] == 1 and check[k][1]== 1 and check[k][2] == 1:
        answer = "Yes"
 
for j in range(3):
    if check[0][j] == 1 and check[1][j] == 1 and check[2][j] == 1:
        answer = "Yes"
 
if check[0][0] == 1 and check[1][1] == 1 and check[2][2] == 1:
    answer = "Yes"
 
if check[0][2] == 1 and check[1][1] == 1 and check[2][0] == 1:
    answer = "Yes"
 
 
print(answer)

Buggy submission (verdict: Runtime Error):
s = 3
arr =[]
for _ in range(s):
        arr.append(list(map(int, input().rstrip().split())))
#print(arr)
 
check = [[0,0,0],[0,0,0],[0,0,0]]
#print(check)
 
#check データ
N = int(input())
#print(N)
 
for i in range(N):
    data = int(input())
    for k in range(3):
        for j in range(3):
            if data == arr[j][k]:
                check[j][k]= 1
#print(check)
 
#chek ビンゴ
answer = "No"
for k in range(3):
    if check[k][0] == 1 and check[k][1]== 1 and check[k][2] == 1:
        answer = "Yes"
 
for j in range(3):
    if check[0][j] == 1 and check[1][j] == 1 and check[2][j] == 1:
        answer = "Yes"
 
if check[0][0] == 1 and check[1][1] == 1 and check[2][2] == 1:
    answer = "Yes"
 
if check[0][2] == 1 and check[1][1] == 1 and check[2][0] == 1:
    answer = "Yes"
 
 
print(answer)
s = 3
arr =[]
for _ in range(s):
        arr.append(list(map(int, input().rstrip().split())))
print(arr)

check = [[0,0,0],[0,0,0],[0,0,0]]
#print(check)

#check データ
N = int(input())
#print(N)

for i in range(N):
    data = int(input())
    for k in range(3):
        for j in range(3):
            if data == arr[j][k]:
                check[j][k]= 1
#print(check)

#chek ビンゴ
answer = "No"
for k in range(3):
    if check[k][0] == 1 and check[k][1]== 1 and check[k][2] == 1:
        answer = "Yes"

for j in range(3):
    if check[0][j] == 1 and check[1][j] == 1 and check[2][j] == 1:
        answer = "Yes"

if check[0][0] == 1 and check[1][1] == 1 and check[2][2] == 1:
    answer = "Yes"

if check[0][2] == 1 and check[1][1] == 1 and check[2][0] == 1:
    answer = "Yes"


print(answer)
提出情報
Problem p02945 (python)

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

x = A + B
y = A - B
z = A * B

if x >= y and x >= z:
	answer = x

elif y >= x and y >=z:
	answer = y

elif z >= x and z >= y:
	answer = z
    
print(answer)

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

x = A + B
y = A - B
z = A * B

if x > y and x > z:
	answer = x

elif y > x and y >z:
	answer = y

elif z > x and z > y:
	answer = z
    
print(answer)
Problem p02957 (python)

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

k = (A + B) / 2

answer = 0

if A != B and (A + B) % 2 == 0 and (A - k) * (B - k) < 0:
	print(int(k))
else:
	print("IMPOSSIBLE")

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

k = (A + B) / 2

answer = 0
if A - k >= 0 and -B + k <=0 :
	answer = 1
    
elif -A + K <=0 and B - k >= 0 :
	answer = 1 
    
if anaswer == 1 and (A + B) % 2 == 0  :
	print(k)
else :
	print("IMPOSSIBLE")
Problem p03035 (python)

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

if 6 <= A <=12 :
	answer = B / 2
elif A <=5 :
	answer = 0
else:
	answer = B

print(int(answer))

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

if 6 <= A <= 12 :
	amswer = B / 2
elif A <=5 :
	answer = 0
else:
answer = B

print(answer)
Problem p03071 (python)

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

score = 0
if A >= B:
    score= score + A
    A = A - 1    
else:
    score = score + B
    B = B - 1

if A >= B:
    score = score + A
    A = A - 1
else:
    score = score + B
    B = B - 1
    
print(score)

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

scoew = 0
if A >= B:
	score = score + A
    A = A -1
else:
	score = score + B
    B = B -1

if A >= B:
	score = score + A
    A = A -1
else:
	score = score + B
    B = B -1
    
print(score)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
if A >= B:
	answer = A - 1
else:
	amswer = B -1
    
if A - 1 >= B - 1:
	answer = A - 2
else:
	amswer = B - 2
    
print(answer)
Problem p03145 (python)

Fixed submission:
AB,BC,CA = map(int,input().split())

answer = (BC * AB) /2

print(int(answer))

Buggy submission (verdict: Runtime Error):
AB,BC,CA = map(int,input().split())

answer = (|BC| * |AB|) /2

print(int(answer))
Problem p03206 (python)

Fixed submission:
D = int(input())
 
if D == 25:
	print("Christmas")
elif D == 24:
	print("Christmas Eve")
elif D == 23:
	print("Christmas Eve Eve")
elif D == 22:
	print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
D = input()
 
if D == "25":
	print("Christmas")
elif D === "24":
	print("Christmas Eve")
elif D == "23":
	print("Christmas Eve Eve")
elif D == "22":
	print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
D = input()

if D == "25":
	print("Christmas")
elif D === "24":
	print("Christmas Eve")
elif D == "23":
	print("Christmas Eve Eve")
elif D == "22":
	print("Christmas Eve Eve Eve")

Buggy submission (verdict: Runtime Error):
D = input()

if D == "25"
	print("Christmas")
elif D == "24"
	print("Christmas Eve")
elif D == "23"
	print("Christmas Eve Eve Eve")
Problem p03238 (python)

Fixed submission:
N = int(input())

if N == 1:
	answer = "Hello World"
	print(answer)
elif N == 2:
	A = int(input())
	B = int(input())
	answer = A + B
	print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
 
if N == 1:
	answer = "Hello World"
	print(answer)
elif N == 2:
	A = input(int())
    B = input(int())
	answer = A + B
	print(int(answer))

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

if N == 1:
	answer = "Hello World"
    print(answer)
elif N == 2:
	A = input(int())
    B = input(int())
	answer = A + B
	print(int(answer))

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

if N == 1:
	answer = "Hello World"
    print(answer)
elif N == 2:
	A,B = map(int,input().split())
	answer = A + B
	print(int(answer))

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

if N == 1:
	answer = "Hello World"
elif N == 2:
	A,B = map(int,input().split())
	answer = A + B

print(answer)
Problem p03264 (python)

Fixed submission:
K = int(input())

if K % 2 == 0:
	answer = (K/2) * (K/2)
else:
	answer = (K//2) * ((K//2) + 1) 
print(int(answer))

Buggy submission (verdict: Runtime Error):
k = int(input())

if k % 2 == 0:
	answer = (k/2) * (K/2)
else:
	answer = (k//2) * ((k//2) + 1) 
print(int(answer))
Problem p03292 (python)

Fixed submission:
A1,A2,A3 = map(int,input().split())
 
x = abs(A1 - A2)
y = abs(A2 - A3)
z = abs(A3 - A1)
 
if x + y <= y + z and x + y <= z + x:
	print(x + y )
elif y + z <= x + y and  y + z <= z + x:
	print(y + z )
else:
	print(z + x)

Buggy submission (verdict: Runtime Error):
A1,A2,A3 = map(int,input().split())

x = abs(A1 - A2)
y = abs(A2 - A3)
z = abs(A3 - A1)

if x + y <= y + z and x <= z + x:
	print(x + y )
elif y + z <= x + y and  y + Z <= z + x:
	print(y + z )
else:
	print(z + x)
Problem p03337 (python)

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

a1 = A + B
a2 = A - B
a3 = A * B

if a1 >= a2 and a1 >= a3:
	print(a1)
elif a2 >= a1 and a2>= a3:
	print(a2)
elif a3 >= a1 and a3 >= a2:
	print(a3)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
 
return(max([A+B, A-B, A*B]))

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

a1 = A + B
a2 = A - B
a3 = A * B

if a1 >= a2 and a1 >= a3:
	print(a1)
elif a2 >= a1 and a>= a3:
	print(a2)
elif a3 >= a1 and a3 >=a2:
	print(a3)
Problem p03359 (python)

Fixed submission:
a,b = map(int,input().split())
 
if b >= a:
	print(a)
else:
	print(a - 1)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input(),split())
 
if b >= a:
	print(a)
else:
	print(a - 1)

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

if b >= a:
	print(a)
else
	print(a - 1)
Problem p03415 (python)

Fixed submission:
C1= input()
C2= input()
C3= input()

print(C1[0] + C2[1] + C3[2])

Buggy submission (verdict: Runtime Error):
C11,C12,C13 = input().split()
C21,C22,C23 = input().split()
C31,C32,C33 = input().split()

print(C11 + C22 + C33)

Buggy submission (verdict: Runtime Error):
C11,C12,C13 = input().split()
C21,C22,C23 = input().split()
C31,C32,C33 = input().split()

print(C11 + C22 + C33)

Buggy submission (verdict: Runtime Error):
C11,C12,C13 = input().split()
C21,C22,C23 = input().split()
C31,C32,C33 = input().split()
 
print(C11 + C22 + C33)

Buggy submission (verdict: Runtime Error):
C11,C12,C13 = input().split()
C21,C22,C23 = input().split()
C31,C32,C33 = input().split()

print(C11 + C22 + C33)

Buggy submission (verdict: Runtime Error):
C11,C12,C13 = input().split()
C21,C22,C23 = input().split()
C31,C32,C33 = input().split()

print(C11 + C22 + C33)
Problem p03455 (python)

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

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

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

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())

if a * b % 2 == 0:
	print("Even")
else:
	print("Odd")
Problem p03573 (python)

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

if A == B:
	answer = C
elif B == C:
	answer = A
else:
	answer = B

print(answer)

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

if A == B:
	answer = C
elif B == C:
	answer = A
elif A ==C:
	answer = B

print(answer)
Problem p03657 (python)

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

if A % 3 == 0 or B % 3 == 0 or (A + B) % 3 ==0:
	print("Possible")
else:
	print("Impossible")

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

if A + B % == 0 and A + B != 0:
	print("Possible")
else:
	print("Impossible")
Problem p03719 (python)

Fixed submission:
A,B,C = map(int,input().split())
 
if A <= C <= B:
	print("Yes")
else:
	print("No")

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

if A <= C <= B:
	print("Yes")
else:
	print("No")
Problem p03962 (python)

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

if a == b and a == c:
	print(1)
elif a ==b and a != c:
	print(2)
elif b == c and b != a:
	print(2)
elif c ==a and c != b:
	print(2)
elif a != b and b != c and c != a:
	print(3)

Buggy submission (verdict: Runtime Error):
a,b,c = input().split()
 
score = 1
if a != b:
	score = score + 1
elif b !=c:
	score = score + 1
elif c !=a:
else:
	score = score
print(score)
Problem p03997 (python)

Fixed submission:
a =int(input())
b =int(input())
h = int(input())

answer = (a + b) * h / 2

print(int(answer))

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

answer = (a + b) * h / 2

print(int(answer))

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

answer = (a + b) * h / 2

print(answer)
Problem p04011 (python)

Fixed submission:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
 
if N <= K :
	answer = X * N
elif N >= K + 1:
	answer = (X * K) + (Y * (N - K) )
print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
 
if  K > N:
	answer = (K * X) + (N - K) * Y:
else:
	answer = N * X
print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())
X = int(input())
Y = int(input())

if K <= N:
	answer = N * X
elif K > N:
	answer = (K * X) + (N - K) * Y:
print(answer)
Problem p04043 (python)

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

if A == 5 and B == 5 and C == 7:
	print("YES")
elif B == 5 and C == 5 and A == 7:
	print("YES")
elif C == 5 and A == 5 and B == 7:
	print("YES")
else:
	print("NO")

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

if A == 5 and B == 5 and C == 7:
	print("Yes")
elif B == 5 and C == 5 and A == 7:
	print("Yes")
elif C == 5 and A == 5 and B == 7:
	print("Yes")
else:
	print("No")
Problem p02573 (python)

Fixed submission:
from collections import deque

n,m = map(int,input().split())
graph = [[] for _ in range(n+1)]
for _ in range(m):
    a,b = map(int,input().split())
    graph[a].append(b)
    graph[b].append(a)
ans = 1

def dfs(node):
    while len(todo) > 0:
        node = todo.pop()
        if tf[node] == 0:
            tf[node] = 1
            seen.add(node)
            for nextnode in graph[node]:
                todo.append(nextnode)

todo = deque()
done = set()
tf = [0 for _ in range(n+1)]
for i in range(1,n+1):
    if i in done:
        continue
    else:
        todo.append(i)
        seen = set()
        dfs(i)
        #print(i,seen)
        ans = max(ans,len(seen))
        done |= seen
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import *
n,m = map(int,input().split())
par = [-1 for _ in range(n)]#par<0なら自身が親で要素の個数、>0なら子で親の位置示す

def root(i):
    if par[i] < 0:
        return i
    else:
        return root(par[i])

def size(a):
    return -par[root(a)]

def union(a,b):
    a = root(a)
    b = root(b)
    if a == b:#親が等しい
        return False
    if size(a) < size(b):#サイズが大きい方に繋げる
        a,b = b,a
    par[a] += par[b]
    par[b] = a
    return True

for i in range(m):
    a = [int(j)-1 for j in input().split()]#数字を一つ減らして足を揃える
    if root(a[0]) != root(a[1]):
        union(a[0],a[1])
par = [ i for i in par if i >= 0]
print(Counter(par).most_common()[0][1]+1)

Buggy submission (verdict: Runtime Error):
from collections import *
n,m = map(int,input().split())
par = [-1 for _ in range(n)]#par<0なら自身が親で要素の個数、>0なら子で親の位置示す

def root(i):
    if par[i] < 0:
        return i
    else:
        return root(par[i])

def size(a):
    return -par[root(a)]

def union(a,b):
    a = root(a)
    b = root(b)
    if a == b:#親が等しい
        return False
    if size(a) < size(b):#サイズが大きい方に繋げる
        a,b = b,a
    par[a] += par[b]
    par[b] = a
    return True

for i in range(m):
    a = [int(j)-1 for j in input().split()]#数字を一つ減らして足を揃える
    if root(a[0]) != root(a[1]):
        union(a[0],a[1])
par = [ i for i in par if i > 0]
print(Counter(par).most_common()[0][1]+1)
Problem p02630 (python)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
dist = [0]*100000
ans = sum(a)
for i in a:
    dist[i-1] += 1

q = int(input())
for i in range(q):
    b,c = map(int,input().split())
    if dist[b-1] != 0:
        dist[c-1] += dist[b-1]
        ans += dist[b-1] * (c-b)
        dist[b-1] = 0
    print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
dist = [0]*max(a)
ans = sum(a)
for i in a:
    dist[i-1] += 1

q = int(input())
for i in range(q):
    b,c = map(int,input().split())
    if dist[b-1] != 0:
        dist[c-1] += dist[b-1]
        ans += dist[b-1] * (c-b)
        dist[b-1] = 0
    print(ans)
Problem p02639 (python)

Fixed submission:
a = list(map(int,input().split()))
print(a.index(0)+1)

Buggy submission (verdict: Runtime Error):
x,n = map(int,input().split())
p = list(map(int,input().split()))
ans = float('inf')
for i in range(101):
    if i not in p:
        if abs(i-x) < abs(ans-x):
            ans = i
        elif abs(i-x) == abs(ans -x):
            ans = min(ans,i)
print(ans)
Problem p02641 (python)

Fixed submission:
x,n = map(int,input().split())
p = list(map(int,input().split()))
i = 0
while True:
    if x - i not in p:
        print(x-i)
        exit()
    elif x + i not in p:
        print(x+i)
        exit()
    i += 1

Buggy submission (verdict: Runtime Error):
x,n = map(int,input().split())
p = list(map(int,input().split()))
ans = []
for i in range(max(p)+2):
    if i not in p:
        ans.append([abs(i-x),i])
ans.sort()
print(ans[0][1])
Problem p02714 (python)

Fixed submission:
n = int(input())
s = input()
R = s.count("R")
G = s.count("G")
B = s.count("B")
cnt = 0
for i in range(n-1):
    for j in range(i+1,n):
        if j - i <= n - 1 - j:
            if s[i] != s[j] and s[j] != s[2*j - i] and s[i] != s[2*j - i]:
                cnt += 1
print(R*G*B - cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
R = s.count("R")
G = s.count("G")
B = s.count("B")
cnt = 0
for i in range(n-1):
    for j in range(i+1,n):
        if 2*j - i <= n - 1:
            k = 2*j - i
            if len(set(s[i],s[j],s[k])) == 3:
                cnt += 1
print(R*G*B - cnt)