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

Fixed submission:
a = list(map(int,input().split("/")))



if a[0]== 2019 and a[1]<5:
    print("Heisei")
elif a[0]<2019 and a[1]< 12:
    print("Heisei")
else:
    print("TBD")

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split("/"))

if a[0]== 2019 and a[1]<=430 or a[0]<2019 :
    print('Heisei')
else:
   print('TBD')

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split("/"))

if a[0]>= 2019:
    print("Heisei")
else:
    print("TBD")

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split("/"))

if  a[0]>= 2019
    print("Heisei")
else:
    print("TBD")

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

del a[4]
del a[7]

b =sum(a)
q = 19
if q <=a:
    print("Heisei")
else :
    print("TBD")
Problem p03359 (python)

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

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

Buggy submission (verdict: Runtime Error):
A, B, C = map(int,input().split())
K = int(input())
L = [A, B, C]
S = sorted(L)

print(S[2] * 2 ** K + S[0] + S[1])
Problem p04044 (python)

Fixed submission:
n, l = map(int, input().split())
s = [input() for i in range(n)]
s.sort()
mojiretsu = ''

for x in s:
    mojiretsu += x
print(mojiretsu)

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().split())
s = [input() for i in range(l)]
s.sort()
mojiretu = ''

for x in s:
    mojiretu += x
print(mojiretu)
Problem p03377 (python)

Fixed submission:
cat, doccat, cat_much = input().split(" ")

if int(cat) > int(cat_much):
    answer = "NO"
elif int(cat) == int(cat_much):
    answer = "YES"
else:
    if int(cat) + int(doccat) >= int(cat_much):
        answer = "YES"
    else:
        answer = "NO"

print(answer)

Buggy submission (verdict: Runtime Error):
cat, doccat, cat_much = input().split(" ")

If cat > cat_much:
    answer = "No"
elif cat == cat_much:
    answer = "no"
else cat < cat_much:
    elif cat + doccat >= cat_much:
        answer = "yes"
    else cat + doccat < cat_much

print(answer)
Problem p03455 (python)

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

product = a*b
surplus = product % 2

if surplus == 0:
    answer = "Even"
else:
    answer = "Odd"

print(answer)

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

product = a*b

If product = 0;
    answer = "Even"
else;
    answer = "Odd"

print(answer)
Problem p03101 (python)

Fixed submission:
H,W = list(map(int, input().split()))
h,w = list(map(int, input().split()))
print((W-w)*(H-h))

Buggy submission (verdict: Runtime Error):
H,W = list(map(int, input().split()))
h,w = list(map(int, input().split()))
print(W*H-(W-w)*(H-h)
Problem p03101 (python)

Fixed submission:
H,W = map(int, input().split())
h,w = map(int, input().split())

ans = H*W-h*W-H*w+h*w
print(ans)

Buggy submission (verdict: Runtime Error):
input_lines = sys.stdin.read()

[H W] = input_lines[0].split()
[h w] = input_lines[1].split()

ans = H*W-h*W-H*w+h*w
print(ans)
Problem p03102 (python)

Fixed submission:
N,M,C = list(map(int, input().split()))
B = list(map(int, input().split()))
A = []

for i in range(N):
	A.append(list(map(int, input().split())))

ans = 0

for i in range(N):
	tmp = 0
	for j in range(M):
		tmp = tmp + A[i][j]*B[j]
	if(tmp+C>0):
		ans += 1

print(ans)

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

for i in range(20):
	A.append(map(int, input().split()))

ans = 0

for i in range(N):
	tmp = 0
	for j in range(M):
		tmp = tmp + A[i][j]*B[j]
	if(tmp+C>0):
		ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N,M,C = map(int, input().split())
B = map(int, input().split())
A = [[0 for i in range(M)] for j in range(N)]

for i in range(N):
	A[i] = map(int, input().split())

ans = 0

for i in range(N):
	tmp = 0
	for j in range(M):
		tmp = tmp + A[i][j]*B[j]
	if(tmp+C>0):
		ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
N,M,C = map(int, input().split())
B = map(int, input().split())
A = [[0 for i in range(M)] for j in range(N)]

for i in range(N):
	A[i] = map(int, input().split())

ans = 0

for i in range(N):
	tmp = 0
	for n in range(M):
		tmp += A[i][n]*B[n]
	if(tmp+C>0):
		ans += 1

print(ans)

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

for i in range(N):
	A[i] = map(int, input().split())

ans = 0

for i in range(N):
	tmp = 0
	for n in range(M):
		tmp += A[i][n]*B[n]
	if(tmp+C>0):
		ans += 1

print(ans)
Problem p03103 (python)

Fixed submission:
import numpy as np

N,M = list(map(int, input().split()))
A = [0] * N
B = [0] * N

for i in range(N):
	A[i],B[i]=list(map(int, input().split()))

sum = 0
ans = 0

idx = np.argsort(A)

for i in range(N):
	if(sum+B[idx[i]] >= M):
		for j in range(B[idx[i]]):
			ans += A[idx[i]]
			sum += 1
			if(sum >= M):
				break
		break
	ans += A[idx[i]]*B[idx[i]]
	sum += B[idx[i]]
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = list(map(int, input().split()))
A = []
B = []

for i in range(N):
	A[i],B[i]=list(map(int, input().split()))

sum = 0
ans = 0
for i in range(N):
	idx = num_list.index(min(A))
	sum += A[idx]*B[idx]
	A[idx] = 10000000
	ans += 1
	if(sum >= M):
		break

print(ans)
Problem p03288 (python)

Fixed submission:
rate=int(input())
result=""
if rate<1200:
  result="ABC"
elif rate<2800:
  result="ARC"
else:
  result="AGC"
print(result)

Buggy submission (verdict: Runtime Error):
D,G= map(int,input().split())
pc=[]
for i in range(D):
  p,c= map(int,input().split())
  pc.append([p,c])
i=D
minN=100000
while i>0:
  #t=pc[i][0]*100*(i+1)+pc[i][1]
  t=pc[i-1][0]*100*(i)+pc[i-1][1]
  if t>=G:
    
    n=pc[i-1][0]
    minN=min(n,minN)
    while n-1>0:
      t1=(n-1)*100*(i)
      if t1>G:
        n=n-1
        continue
      else:
        minN=minN(minN,n+1)
      n=n-1
    
  i=i-1
print(minN)

Buggy submission (verdict: Runtime Error):
s=input()
result=""
count=0
l=len(s)
for i in range(l):
  if i==0 and s[i]="A":
    result="WA"
    break
  elif i==1 and ord(s[1])<97 
    result="WA"
    break
  elif i==l-1 and ord(s[l-1])<97:
    result="WA"
    break
  else:
    if ord(s[i])<97:
      count+=1
    if count>1 or s[i]!="C":
      result="WA"
      break
if result!="WA"
  result="AC"
print(result)

Buggy submission (verdict: Runtime Error):
rate=input()
result=""
if rate<1200:
  result="ABC"
elif rate<2800:
  result="ARC"
else:
  result="AGC"
print(result)
Problem p03289 (python)

Fixed submission:
s=input()
result=""
count=0
l=len(s)
if s[0]!="A":
  result="WA"
elif ord(s[1:2])<97 or ord(s[l-1])<97:
  result="WA"
for i in s[2:l-1]:
  if ord(i)<97:
    count+=1
  if ord(i)<97 and i!="C":
    result="WA"
    break
  if count>1:
    result="WA"
    break
if count==0:
  result="WA"
if result!="WA":
  result="AC"
print(result)

Buggy submission (verdict: Runtime Error):
s=input()
result=""
count=0
l=len(s)
for i in range(l):
  if i==0 and s[i]="A":
    result="WA"
    break
  elif i==1 and ord(s[1])<97 
    result="WA"
    break
  elif i==l-1 and ord(s[l-1])<97:
    result="WA"
    break
  else:
    if ord(i)<97:
      count+=1
    if count>1:
      result="WA"
      break
if result!="WA"
  result="AC"
print(result)
Problem p03469 (python)

Fixed submission:
date=input()
#if date[0:4]=="2017":
date="2018"+date[4:]
print(date)

Buggy submission (verdict: Runtime Error):
date=input()
#if date[0:4]=="2017":
date="2018"+[4:]
print(date)
Problem p03807 (python)

Fixed submission:
n=int(input())
s=input().split()
i=0
count=0
while i<n:
  if int(s[i])%2!=0:
    count+=1
  i+=1
if count%2==0:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
s=input().split()
i=0
count=0
while i<n:
  if int(s[i])%2!=0:
    count+=1
  i+=1
if count%2==0:
  print("Yes")
else:
  print("No")
Problem p03889 (python)

Fixed submission:
s = input()
ss = s[::-1]
s3 = ""
for i,j in enumerate(ss):
  if j == "p":
      s3 += "q"
  elif j == "q":
      s3 += "p"
  elif j == "b":
      s3 += "d"
  else:
      s3 += "b"
if s == s3:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
s = input()
ss = s[::-1]
for i,j in enumerate(ss):
    if j == "p":
      ss[i] = "q"
    elif j == "q":
      ss[i] = "p"
    elif j == "b":
      ss[i] = "d"
    else:
      ss[i] = "b"
if ss == s:
  print("Yes")
else:
  print("No")
Problem p03238 (python)

Fixed submission:
# atcoder abc112 A

try:
	age = int(input())
	A = int(input())
	B = int(input())

except:
	pass

if age == 2:
	print(A+B)
else:
	print("Hello World")

Buggy submission (verdict: Runtime Error):
# atcoder abc112 A




age = int(input())
A = int(input())
B = int(input())


if age == 2:
	print(A+B)
else:
	print("Hello World")
Problem p03273 (python)

Fixed submission:

def compression(init, matrix):
	
	mir = []
	
	for row in matrix:
		if "#"in row:
			mir.append(row)
	matrix = []
	
	mir = list(map(list, zip(*mir)))
	
	for row in mir:
		if "#"in row:
			matrix.append(row)
		
	matrix = list(map(list, zip(*matrix)))	
			
	
	return matrix


init = input().split(" ")
init = [int(c) for c in init]

matrix = [[] for j in range(init[0])]

for j in range(init[0]):
	matrix[j] = input()

result = compression(init, matrix)
for row in result:
	print("".join(row))

Buggy submission (verdict: Runtime Error):

def compression(init, matrix):
	
	mir = []
	
	for row in matrix:
		if "#"in row:
			mir.append(row)
	matrix = []
	
	mir = list(map(list, zip(*mir)))
	
	for row in mir:
		if "#"in row:
			matrix.append(row)
		
	matrix = list(map(list, zip(*matrix)))	
			
	
	return matrix


init = input().split(" ")
init = [int(c) for c in init]

matrix = [[] for j in range(init[0])]
j = 0

for j in range(init[1]+1):
	matrix[j] = input()

result = compression(init, matrix)
for row in result:
	print("".join(row))
Problem p03109 (python)

Fixed submission:
a,b,c=map(int,input().split("/"))
print("Heisei" if b*100+c<=430 else "TBD")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input()split("/"))
print("Heisei" if b*10+c<=70 else "TBD")

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input()split("/"))
print("Heisei" if b*10+c>=70 else "TBD")
Problem p03494 (python)

Fixed submission:
num=int(input())
a=list (map(int,input().split()))
count=0
while  all(i%2==0 for i in a):
  a=[i/2 for i in a]
  count+=1
print(count)

Buggy submission (verdict: Runtime Error):
n=input()
a=list(int,input().split())
count=0
while (i%==0):
  a=a/2
  count+=1
print(count)
Problem p03543 (python)

Fixed submission:
a,b,c,d=input()
print('Yes' if a==b==c or b==c==d else 'No')

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
print('Yes' if a==b==c or b==c==d else 'No')
Problem p03636 (python)

Fixed submission:
a,*List,b=input()
print(a+str(len(List))+b)

Buggy submission (verdict: Runtime Error):
a,*List,b=input()
print(a+len(List)+b)
Problem p03264 (python)

Fixed submission:
K = int(input())
a = K//2
b = K-a
print(a*b)

Buggy submission (verdict: Runtime Error):
K = int(input)
a = K//2
b = K-a
print(a*b)
Problem p03280 (python)

Fixed submission:
A,B=map(int,input().split())
A=A-1
B=B-1
print(A*B)

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

Buggy submission (verdict: Runtime Error):
A,B-map(int,inout().split())
A=A-1
B=B-1
print(A*B)
Problem p03337 (python)

Fixed submission:
A, B = map(int, input().split())
print(max(A+B, A-B, A*B))

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
print(max(A+B),(A-B),(A*B))
Problem p03632 (python)

Fixed submission:
A,B,C,D=map(int,input().split())
if A <= C and C <= B and B <= D:
  print(B-C)
elif C <= A and A <= B and B <= D:
  print(B-A)
elif A <= B and B <= C and C <= D:
  print(0)
elif C <= A and A <= D and D <= B:
  print(D-A)
elif A <= C and C <= D and D <= B:
  print(D-C)
elif C <= D and D <= A and A <= B:
  print(0)

Buggy submission (verdict: Runtime Error):
A,B,C,D=map(int,input().split())
if A <= C and C <= B and B <= D:
  print(B-C)
elif C <= A and A <= B and B <= D:
  print(B-A)
elif A <= B and B <= C and C <= D:
  print(0)
elif C <= A and A <= D and D <= B:
  print(D-A)
elif A <= C and C <= D and D <= B:
  print(D-C)
else C <= D and D <= A and A <= B:
  print(0)
Problem p03128 (python)

Fixed submission:
import sys
sys.setrecursionlimit(1000000)
 
ma_map = [ -1, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]
N, M = (int(i) for i in input().split())
ma = list(int(i) for i in input().split())
memo = [-1] * 100000
 
def dfs(num):
	if memo[num] != -1: return memo[num]
	if num == 0: return 0
 
	ret = -1
	for p in ma:
		if 0 <= num - ma_map[p]:
			ret = max(dfs(num - ma_map[p]) * 10 + p, ret)
 
	memo[num] = ret
	return ret
 
ma.sort()
print(dfs(N))

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(1000000)

N,M = map(int,input().split())
ma = list(map(int,input().split()))
n = len(a)
ma_map = [ -1, 2, 5, 5, 4, 5, 6, 3, 7, 6 ]
memo = [-1] * 100000

def dp(num):
	if memo[num] != -1: return memo[num]
	if num == 0: return 0

	ret = -1
	for p in ma:
		if 0 <= num - ma_map[p]:
			ret = max(dp(num - ma_map[p]) * 10 + p, ret)

	memo[num] = ret
	return ret

ma.sort()
print(dp(N))
Problem p03337 (python)

Fixed submission:
a, b = [int(x) for x in input().split()]
ans = max(a+b, a-b, a*b)
print(ans)

Buggy submission (verdict: Runtime Error):
a, b = input().split()
ans = max(a+b, a-b, a*b)
print(ans)
Problem p03338 (python)

Fixed submission:
n = int(input())
s = input()
num = []
for i in range(n):
  a = set(s[:i])
  b = set(s[i:])
  num.append(len(a.intersection(b)))
print(max(num))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
for i in xrange(n):
  print(s[:i])
  print(s[i+1:])
  a = set(s[:i])
  b = set(s[i+1:])
  num = []
  num.append(len(a.intersection(b)))
print(max(num))
Problem p03353 (python)

Fixed submission:
s = list(input())
k = int(input())
subs = []
for i in range(min(k,len(s))):
  for j in range(len(s)-i):
    subs.append(''.join(s[j:j+i+1]))
subs = list(set(subs))
subs.sort()
#print(subs)
print(subs[k-1])

Buggy submission (verdict: Runtime Error):

s = list(input())
k = int(input())
ansnum = 0

for j in range(k):
    # listj = []
    # for i in range(len(s)-j):
    #     #print(s[i:i+j+1])
    #     listj.append(s[i:i+j+1])
    listj = [s[i:i + j + 1] for i in range(len(s) - j)]
    listj.sort()
    # print('listj:',listj)
    # print('j:',j)
    if len(listj) >= 2 and listj[0] == listj[1]:
        # print('choufuku')
        pass
    else:
        # j+1文字で重複なしの場合(j=0,1,2,3,4)
        s = ''.join(s)
        lens = len(s)
        for i in range(len(listj)):
            num = s.index(''.join(listj[i]))
            a = lens - num
            # print('index:',num)
            # print('ansnum:',ansnum)
            if a < k - ansnum:
                ansnum += a
            else:
                ans = s[num:num + k - ansnum]
                ansnum = k + 1
                break
#print('ans:',ans)
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
k = int(input())
ansnum = 0

for j in range(k):
    # listj = []
    # for i in range(len(s)-j):
    #     #print(s[i:i+j+1])
    #     listj.append(s[i:i+j+1])
    listj = [s[i:i + j + 1] for i in range(len(s) - j)]
    listj.sort()
    # print('listj:',listj)
    # print('j:',j)
    if len(listj) >= 2 and listj[0] == listj[1]:
        # print('choufuku')
        pass
    else:
        # j+1文字で重複なしの場合(j=0,1,2,3,4)
        s = ''.join(s)
        lens = len(s)
        for i in range(len(listj)):
            num = s.index(''.join(listj[i]))
            a = lens - num
            # print('index:',num)
            # print('ansnum:',ansnum)
            if a < k - ansnum:
                ansnum += a
            else:
                ans = s[num:num + k - ansnum]
                ansnum = k + 1
                break
    if ansnum > k:
        break

#print('ans:',ans)
print(ans)

Buggy submission (verdict: Runtime Error):
s = list(input())
k = int(input())
ansnum = 0

for j in range(k):
    # listj = []
    # for i in range(len(s)-j):
    #     #print(s[i:i+j+1])
    #     listj.append(s[i:i+j+1])
    listj = [s[i:i + j + 1] for i in range(len(s) - j)]
    listj.sort()
    # print('listj:',listj)
    # print('j:',j)
    if len(listj) >= 2 and listj[0] == listj[1]:
        # print('choufuku')
        pass
    else:
        # j+1文字で重複なしの場合(j=0,1,2,3,4)
        s = ''.join(s)
        lens = len(s)
        for i in range(len(listj)):
            num = s.index(''.join(listj[i]))
            a = lens - num
            # print('index:',num)
            # print('ansnum:',ansnum)
            if a < k - ansnum:
                ansnum += a
            else:
                ans = s[num:num + k - ansnum]
                ansnum = k + 1
                break
    if ansnum > k:
        break

#print('ans:',ans)
print(ans)
Problem p03371 (python)

Fixed submission:
a,b,c,x,y = [int(x) for x in input().split()]

#そのまま
aprice = a*x + b*y
#組み合わせ
if x > y:
    amari = a*(x-y)
elif x < y:
    amari = b*(y-x)
else:
    amari = 0
bprice = min(x,y)*c*2 + amari
#セットのみ
cprice = c*max(x, y)*2

#print(aprice,bprice,cprice)
print(min(aprice,bprice,cprice))

Buggy submission (verdict: Runtime Error):
a,b,c,x,y = [int(x) for x in input().split()]

#そのまま
aprice = a*x + b*y
#組み合わせ
if x > y:
    amari = a*(x-y)
elif x < y:
    amari = b*(y-x)
else:
    amaru = 0
bprice = min(x,y)*c*2 + amari
#セットのみ
cprice = c*max(x, y)*2

#print(aprice,bprice,cprice)
print(min(aprice,bprice,cprice))
Problem p03479 (python)

Fixed submission:
x, y = [int(x) for x in input().split()]
size = int(y//x).bit_length()
print(size)

Buggy submission (verdict: Runtime Error):
x, y = [int(x) for x in input().split()]
size = int.bit_length(y/x)
if x == y:
  print(0)
else:
  print(size)
Problem p03999 (python)

Fixed submission:
# -*- coding: utf-8 -*-

s = input()
if len(s) == 1:
    total = int(s)
else:
    bitlist = []
    # 文字列の長さ-1箇所にプラスを入れるかどうかbit演算によって考える
    for i in range(2 ** (len(s) - 1)):
        bitlist.append([int(x) for x in list(bin(i)[2::].zfill(len(s) - 1))])
    # print(bitlist)
    total = 0
    for bit in bitlist:
        befnum = int(s[0])
        # print(bit)
        for i, plus in enumerate(bit):
            if plus == 0:
                # プラスが入らない場合、前のケタの数を10倍して加える
                befnum = befnum * 10 + int(s[i + 1])
                # print(befnum)
            else:  # plus==1
                # プラスが入る場合、そこまでの数をtotalに加えてbefnumを初期化
                total += befnum
                befnum = int(s[i + 1])
                # print(befnum)
            if i == len(bit) - 1:
                total += befnum
            # print('total:' + str(total))
print(total)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

s = input()
bitlist = []
#文字列の長さ-1箇所にプラスを入れるかどうかbit演算によって考える
for i in range(2**(len(s)-1)):
    bitlist.append([int(x) for x in list(bin(i)[2::].zfill(len(s)-1))])
#print(bitlist)
total = 0
for bit in bitlist:
    befnum = int(s[0])
    #print(bit)
    for i, plus in enumerate(bit):
        if plus == 0:
            #プラスが入らない場合、前のケタの数を10倍して加える
            befnum = befnum*10 + int(s[i+1])
            #print(befnum)
        else:#plus==1
            #プラスが入る場合、そこまでの数をtotalに加えてbefnumを初期化
            total += befnum
            befnum = int(s[i+1])
            #print(befnum)
        if i == len(bit)-1:
            total += befnum
        #print('total:' + str(total))
print(total)
Problem p03351 (python)

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

if abs(a-c) <= d or (abs(a-b) <= d and abs(b-c) <= d):
    print('Yes')
else:
    print('No')

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

if abs(a, c) <= d or (abs(a, b) <= d and abs(b, c) <= d):
    print('Yes')
else:
    print('No')
Problem p03352 (python)

Fixed submission:
import math
X = int(input())
max = 0
bRange = math.floor(math.sqrt(X))
pRange = math.floor(math.log(X,2))
for b in range(bRange + 1):
    for p in range(pRange + 1):
        # print(b**p)
        if(max < b**p <= X):
            max = b**p
print(max)

Buggy submission (verdict: Runtime Error):
import math
X = int(input())
max = 0
bRange = math.floor(math.sqrt(X))
pRange = math.floor(math.log(X,2))
for b in range(bRange + 1):
    for p in range(pRange + 1):
            if(max < b**p <= X):
            max = b**p
print(max)

Buggy submission (verdict: Runtime Error):
X = int(input())
max_num = 1
root = math.floor(math.sqrt(X))
if root >= 2:
    for b in range(2, root+1):
        p = math.floor(math.log(X, b))
        if b**p > max_num:
            max_num = b**p
else:
    print(1)

if root >= 2:
    print(max_num)

Buggy submission (verdict: Runtime Error):
import math
X = int(input())
max_num = 1
root = math.floor(math.sqrt(X))
if root >= 2:
    for b in range(2, root+1):
        p = math.floor(math.log(X, b))
        if b**p > max_num:
            max_num = b**p
else:
    print(1)

if root >= 2:
    print(max(file))

Buggy submission (verdict: Runtime Error):
import math
X = int(input())
file = []
root = int(math.sqrt(X))
for b in range(2, root+1):
    p = int(math.log(X, b))
    file.append(b**p)

print(max(file))
Problem p03354 (python)

Fixed submission:
n,m = map(int, input().split())
p = list(map(int, input().split()))

par = [i for i in range(n)]
#rootの計算量は、parが最初の状態に近いほど値は小さくて、高々O(n)
def root(x):
	tmp = par[x]
	if tmp == x:
		return x
	else:
		a = root(tmp)
		par[x] = a
		return a

def merge(x, y):
	x = root(x)
	y = root(y)
	if x != y:
		par[x] = y
		return

for i in range(m):
	x, y = map(int, input().split())
	merge(x-1, y-1)
	#print(par)

ans = 0

for i in range(n):
	if p[i]-1 == i:
		ans += 1
	elif root(p[i]-1) == root(i):
		ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int, input().split())
p = list(map(int, input().split()))

par = [i for i in range(n)]
#rootの計算量は、parが最初の状態に近いほど値は小さくて、高々O(n)
def root(x):
	tmp = par[x]
	if tmp == x:
		return x
	else:
		a = root(tmp)
		par[x] = a
		return a

def merge(x, y):
	x = root(x)
	y = root(y)
	if x != y:
		par[x] = y
		return

for i in range(m):
	x, y = map(int, input().split())
	merge(x-1, y-1)
	print(par)

ans = 0

for i in range(n):
	if p[i]-1 == i:
		ans += 1
	elif root(p[i]-1) == root(i):
		ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, M = list(map(int, input().split()))
sigma = list(map(int, input().split()))
gokans = []

for i in range(M):
    pair = list(map(int, input().split()))
    gokans.append(pair)

def connected(i, j, paths, chains):
    old_chain = []
    if i == 1:
        for pair in chains:
            paths.remove(pair)
    narabi = [couple[0] for couple in chains] + [couple[1] for couple in chains]
    if j in narabi:
        return True

    while chains != old_chain:
        old_chain = chains
        for pair in chains:
            new_chain = [couple for couple in paths if set(couple) & set(pair) != set()]
            chains += new_chain
            for pair in new_chain:
                paths.remove(pair)
        narabi = [couple[0] for couple in chains] + [couple[1] for couple in chains]
        if j in narabi:
            return True
    return False

count = 0
chain = []
for i in range(1, N+1):
    if i != sigma[i-1]:
        gokans1 = gokans.copy()
        chain += [pair for pair in gokans if i in pair]
        if ([pair for pair in gokans if i in pair] != []) and [pair for pair in paths if sigma[i-1] in pair] and connected(i, sigma[i-1], gokans1, chain):
            count += 1
    else:
        count += 1

print(count)