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

Fixed submission:
# C
N,M=map(int,input().split())
cnd=[tuple(int(i) for i in input().split()) for j in range(M)]
ans=-1
for n in range(10**N):
    # print(n)
    flag=True
    n_str=str(n)
    if len(n_str)!= N:
        continue
    for s,c in cnd:
        if n_str[s-1]!=str(c):
            # print(n_str[s-1],c)
            flag=False
            break
    if flag:
        ans=n
        break
print(ans)

Buggy submission (verdict: Runtime Error):
# C
N,M=map(int,input().split())
cnd=[tuple(int(i) for i in input().split()) for j in range(M)]
ans=-1
for n in range(10**N-1):
    # print(n)
    flag=True
    n_str=str(n)
    for s,c in cnd:
        if n_str[s-1]!=str(c):
            # print(n_str[s-1],c)
            flag=False
            break
    if flag:
        ans=n
        break
print(ans)
Problem p02783 (python)

Fixed submission:
# 0405の分もやる

# ABC153-C
if False:
    N,K=map(int,input().split())
    H=[int(i) for i in input().split()]
    H.sort(reverse=True)
    print(sum(H[K:]))

# ABC153-D
if False:
    H=int(input())
    cnt=1
    ans=0
    while H>1:
        ans+=cnt
        H//=2
        cnt*=2
    print(ans+cnt)

# ABC153-A
if True:
    # ceil関数
    def ceil(a,b): #ceil(a/b)
        return (a+b-1)//b

    H,A=map(int,input().split())
    print(ceil(H,A))

Buggy submission (verdict: Runtime Error):
# ceil関数(2引数)
def ceilT(a,b): #ceil(a/b)
    return (a+b-1)//b
H,A=map(int,input().split())
print(ceil(H,A))
Problem p02903 (python)

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

for i in range(H):
    if i < B:
        print('1'*A+'0'*(W-A))
    else:
        print('0'*A+'1'*(W-A))

# height,width,a,b = map(int,input().split())
# if a != 0 and b != 0:
#     table = [['0' for i in range(width)] for j in range(height)]
#     replacement = a*height
#     i = 0
#     j = 0
#     while replacement != 0:
#         # print('replace:',i,j)
#         table[i][j] = '1'
#         replacement -= 1
#         if replacement%a == 0:
#             # print('shift')
#             i += 1
#             # print(i)
#         j =(j+1)%width
        
#     # print('made table:',table)
#     flag = []
#     for j in range(width):
#         x = sum(int(table[i][j]) for i in range(height)) 
#         flag += [b == min(x,height-x)]
#     if all(flag):
#         for i in range(height):
#             print(''.join(table[i]))
#     else:
#         print('No')
# else:
#     if a == 0:
#         for i in range(b):
#             print('1'*width)
#         for i in range(height-b):
#             print('0'*width)
#     else:
#         for i in range(height):
#             print('1'*a+'0'*(width-a))

Buggy submission (verdict: Runtime Error):
height,width,a,b = map(int,input().split())
table = [['0' for i in range(width)] for j in range(height)]
replacement = a*height
i = 0
j = 0
while replacement != 0:
    # print('replace:',i,j)
    table[i][j] = '1'
    replacement -= 1
    if replacement%a == 0:
        # print('shift')
        i += 1
        # print(i)
    j += 1
# print('made table:',table)
flag = []
for j in range(width):
    x = sum(int(table[i][j]) for i in range(height)) 
    flag += [b == min(x,height-x)]
if all(flag):
    for i in range(height):
        print(''.join(table[i]))
else:
    print('No')

Buggy submission (verdict: Runtime Error):
height,width,a,b = map(int,input().split())
table = [[0 for i in range(width)] for j in range(height)]
replacement = a*height
i = 0
j = 0
while replacement != 0:
    # print('replace:',i,j)
    table[i][j] = 1
    replacement -= 1
    if replacement%a == 0:
        # print('shift')
        i += 1
        # print(i)
    j += 1
# print('made table:',table)
flag = []
for j in range(width):
    x = sum(table[i][j] for i in range(height)) 
    flag += [b == min(x,height-x)]
if all(flag):
    print(table)
else:
    print('No')
Problem p02971 (python)

Fixed submission:
n = int(input())
a = []
#print('n a',n,a)
for i in range(n):
        a.append(int(input()))
#print('As',a)
max1 = max(a)
location1 = a.index(max1)
#print('1st MAX',max1,'INDEX',location1)
a.remove(a[location1])
max2 = max(a)
#print('2nd MAX',max2)
if max1 == max2:
        #print('1=2')
        for i in range(n):
                print(max1)
else:
        #print('1!=2')
        for i in range(n):
                if i == location1:
                        #print('max2')
                        print(max2)
                else:
                        #print('max1')
                        print(max1)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
print('n a',n,a)
for i in range(n):
	a.append(int(input()))
print('As',a)
max1 = max(a)
location1 = a.index(max1)
print('1st MAX',max1,'INDEX',location1)
a.remove(a[location1])
max2 = max(a)
print('2nd MAX',max2)
if max1 == max2:
    print('1=2')
    for i in range(n):
        print(max1)
else:
    print('1!=2')
    for i in range(n):
    	if i == location1:
            print(max2)
        else:
            print(max1)
Problem p03061 (python)

Fixed submission:
from fractions import gcd

n = int(input())
a = [int(i) for i in input().split()]

l = [0]
r = [0]
for i in range(n-1):
    l.append(gcd(l[i],a[i]))
    r.append(gcd(r[i],a[-1-i]))

m = 0
for i in range(n):
    m = max(m,gcd(l[i],r[-i-1]))

print(m)

Buggy submission (verdict: Runtime Error):
from functools import reduce
from math import gcd

n = int(input())
a = [int(i) for i in input().split()]
ans = -1
for i in range(1,n+1):
    ans = max(ans,reduce(gcd,a[:i-1]+a[i:]))
print(ans)
Problem p03103 (python)

Fixed submission:
N,M = map(int,input().split())
AB = [tuple(int(i) for i in input().split()) for j in range(N)]
AB.sort()
ans = 0
for i in range(N):
    a,b = AB[i]
    if M -b > 0:
        ans += a*b
        M -= b
    else:
        ans += M*a
        break
print(ans)

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
AB = [tuple(int(i) for i in input().split()) for j in range(N)]
AB.sort()
ans = 0
for i in range(N):
	a,b = AB[i]
	if M-b > 0:
		ans += a*b
		M -= b
    else:
		ans += M*b
		break
print(ans)
Problem p03273 (python)

Fixed submission:
h,w = map(int,input().split())
m = []

for i in range(h):
    m.append(list(input()))


#行に着目
dl = []

for i in range(h):
    if all(j =='.' for j in m[i]):
        dl.append(int(i))
# print(dl)
if dl:
    for i in dl:
        del m[i-dl.index(i)]
h = len(m)
# print(m)

dl = []
for i in range(w):
    s = ''
    for j in range(h):
        s = s + m[j][i]
    if all(j == '.' for j in list(s)):
        dl.append(int(i))
# print(dl)
if dl:
    for i in range(h):
        for j in dl:
            del m[i][j-dl.index(j)]

# print(m)
for i in range(h):
    print(''.join(m[i]))

#転置して同様
# m = list(zip(*m)) 
# if m:
#     dl = []
#     for i in range(w):
#         if all(j =='.' for j in m[i]):
#             dl.append(int(i))

#     if dl:
#         for i in range(len(dl)):
#             del m[dl[len(dl)-i-1]]
            


# #転置して元に戻す
# m = list(zip(*m))


# #出力
# for i in range(len(m)):
#     m[i] = ''.join(m[i])
#     print(m[i])

Buggy submission (verdict: Runtime Error):
h,w = map(int,input().split())
m = []

for i in range(h):
    m.append(list(input()))


#行に着目
dl = []

for i in range(h):
    if all(j =='.' for j in m[i]):
        dl.append(int(i))

if dl:
    for i in dl:
        del m[i]

#転置して同様
m = list(zip(*m)) 
if m:
    dl = []
    for i in range(w):
        if all(j =='.' for j in m[i]):
            dl.append(int(i))

    if dl:
        for i in range(len(dl)):
            del m[dl[len(dl)-i-1]]
            


#転置して元に戻す
m = list(zip(*m))


#出力
for i in range(len(m)):
    m[i] = ''.join(m[i])
    print(m[i])
Problem p03294 (python)

Fixed submission:
print(-int(input())+sum(int(i) for i in input().split()))

Buggy submission (verdict: Runtime Error):
print(-int(input())+sum(int(i) for i in input().split())))
Problem p03435 (python)

Fixed submission:
c=[[int(i) for i in input().split()] for j in range(3)]
ans='No'
for x in range(101):
  for y in range(101):
    for z in range(101):
      d=[]
      d.append([c[0][j]-x for j in range(3)])
      d.append([c[1][j]-y for j in range(3)])
      d.append([c[2][j]-z for j in range(3)])
      if sum(len(set(d[i][j] for i in range(3))) for j in range(3))==3:
             ans='Yes'
print(ans)

Buggy submission (verdict: Runtime Error):
C=[[int(i) for i in input().split()] for j in range(3)]
ans=False
for a1 in range(101):
  for a2 in range(101):
    for a3 in range(101):
      if len(set([c[i][0]-a1 for i in range(3)]))==1:
        if len(set(c[j][1]-a2 for j in range(3)))==1:
          if len(set(c[k][2]-a3 for k in range(3)))==1:
            ans=True
print('Yes' if ans else 'No')
Problem p03455 (python)

Fixed submission:
a,b=map(int,input().split())
if (a*b)%2==1:
    print('Odd')
else:
    print('Even')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input())
if (a*b)%2==1:
    print('Odd')
else:
    print('Even')
Problem p03495 (python)

Fixed submission:
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
cnt=[0 for i in range(N)]
for a in A:
  cnt[a-1]+=1
knd=[]
for i,c in enumerate(cnt):
  if c!=0:
    knd.append((i+1,c))
knd.sort(key=lambda x: x[1],reverse=True)
ans=0
while len(knd)>K:
  j,d=knd.pop()
  ans+=d
print(ans)

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=[int(i) for i in input().split()]
cnt=[0 for i in range(N)]
for a in A:
  cnt[a-1]+=1
knd=[]
for i,c in enumerate(cnt):
  if c!=0:
    knd.append((i+1,c))
knd.sort(key=lambda x: x[1],reverse=True)
ans=0
while len(knd)<=K:
  j,d=knd.pop()
  ans+=d
print(ans)
Problem p03545 (python)

Fixed submission:
n=[int(i) for i in list(input())]
op=[1,-1]
ans=[]
for op1 in op:
	for op2 in op:
		for op3 in op:
			if n[0]+op1*n[1]+op2*n[2]+op3*n[3]==7:
				ans=[op1,op2,op3]
out=''
for i in range(3):
	out+=str(n[i])
	out+='+' if ans[i]==1 else '-'
print(out+str(n[3])+'=7')

Buggy submission (verdict: Runtime Error):
nums=[int(i) for i in input()]
ops=[1,-1]
for op1 in ops:
  for op2 in ops:
    for op3 in ops:
      if nums[0]+op1*nums[1]+op2*nums[2]+op3*nums[3]==7:
        ans=''+str(nums[0])
        ans+='+' if op1==1 else '-'
        ans+=str(nums[1])
        ans+='+' if op2==1 else '-'
        ans+=str(nums[2])
        ans+='+' if op3==1 else '-'
        ans+=nums[3]
print(ans)
Problem p03671 (python)

Fixed submission:
a,b,c = map(int,input().split())
print(a+b+c-max(a,b,c))

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(a+b+c-max(a+b+c))
Problem p03680 (python)

Fixed submission:
n = int(input())
a = [int(input())-1 for i in range(n)]
#ボタンを押す=listから値を取得して-1にする
#取得した値=光っているボタンの番号
#光っているボタンの番号が1ならbreak
#取得した値が-1なら2を通らずループしてしまっている
sb = 0
ans = 0
while True:
    if sb == 1:
        flag = True
        break
    elif sb == -1:
        flag = False
        break
    tmp = a[sb]
    a[sb] = -1
    sb = tmp
    ans += 1
if flag:
    print(ans)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(input())-1 for i in range(n)]
#ボタンを押す=listから値を取得して-1にする
#取得した値=光っているボタンの番号
#光っているボタンの番号が1ならbreak
#取得した値が-1なら2を通らずループしてしまっている
sb = 0
ans = 0
for i in range(n):
    if sb == 1:
        flag = True
        break
    elif sb == -1:
        flag = False
        break
    tmp = a[sb]
    a[sb] = -1
    sb = tmp
    ans += 1
if flag:
    print(ans)
else:
    print(-1)
Problem p03693 (python)

Fixed submission:
r,g,b = map(int,input().split())
if (g*10+b)%4 == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
r,g,b = map(int,input().spllit())
if (g+b)%4 == 0:
    print('YES')
else:
    print('NO')
Problem p03730 (python)

Fixed submission:
import fractions
a,b,c = map(int,input().split())
if c%fractions.gcd(a,b) == 0:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
import math
a,b,c = map(int,input().split())
if math.gcd(a,b) == 1:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
import math
a,b,c = map(int,input().split())
if math.gcd(a,b) == 1:
    print('YES')
else:
    print('NO')
Problem p03731 (python)

Fixed submission:
N,T = map(int,input().split())
t = [int(i) for i in input().split()]
fin = 0
ans = 0
for i in range(N):
    if t[i] <= fin - T:
        continue
    elif fin <= t[i]:
        fin = t[i]+T
        ans += T
    else:
        ans += T+t[i]-fin
        fin += T+t[i]-fin
print(ans)

Buggy submission (verdict: Runtime Error):
N,T = map(int,input().split())
Ts = [int(i) for i in input().split()]
flow = set()
for i in range(N):
    flow = set(list(flow)+list(range(Ts[i]+1,Ts[i]+T+1)))
print(len(flow))
Problem p03848 (python)

Fixed submission:
#AGC015-B
if False:
    S=list(input())
    N=len(S)
    ans=0
    for i in range(N):
        if S[i]=='U':
            ans+=N-(i+1)
            ans+=i*2
        else:
            ans+=(N-(i+1))*2
            ans+=i
    print(ans)
            
#ARC069-C
if False:
    N,M=map(int,input().split())
    ans=min(N,M//2)
    if N<(M//2):
        ans+=((M//2-N)*2+(M%2))//4
    print(ans)

#ABC028-D
if False:
    N,K=map(int,input().split())
    ans=3*(N-1)+6*(K-1)*(N-K)+1
    ans=ans/(N**3)
    print(ans)

#ABC133-D
if False:
    N=int(input())
    A=[int(i) for i in input().split()]
    ANS=[sum(A)-2*sum(A[1::2])]
    for i in range(N-1):
        ANS.append(2*A[i]-ANS[-1])
    print(*ANS)

#ARC066-C
N=int(input())
A=[int(i) for i in input().split()]
const=10**9+7
cnt={}
ans=0
flag=True
if N%2==0:
    for k in range(N):
        cnt[k]=0
    for a in A:
        cnt[a]+=1
    for k in range(1,N,2):
        if cnt[k]!=2:
            flag=False
            break
    if flag: ans=pow(2,N//2,const)
else:
    for k in range(N):
        cnt[k]=0
    for a in A:
        cnt[a]+=1
    for k in range(0,N,2):
        if k==0:
            if cnt[0]!=1:
                flag=False
                break
        else:
            if cnt[k]!=2:
                flag=False
                break
    if flag: ans=pow(2,(N-1)//2,const)
print(ans)

Buggy submission (verdict: Runtime Error):
#ARC066-C
N=int(input())
A=[int(i) for i in input().split()]
const=10**9+7
cnt={}
ans=0
flag=True
if N%2==0:
    for k in range(1,N,2):
        cnt[k]=0
    for a in A:
        cnt[a]+=1
    for k in range(1,N,2):
        if cnt[k]!=2:
            flag=False
            break
    if flag: ans=pow(2,N//2,const)
else:
    for k in range(0,N,2):
        cnt[k]=0
    for a in A:
        cnt[a]+=1
    for k in range(0,N,2):
        if k==0:
            if cnt[0]!=1:
                flag=False
                break
        else:
            if cnt[k]!=2:
                flag=False
                break
    if flag: ans=pow(2,(N-1)//2,const)
print(ans)

Buggy submission (verdict: Runtime Error):
#ARC066-C
N=int(input())
A=[int(i) for i in input().split()]
const=10**9+7
cnt={}
if N%2==0:
    for k in range(1,N,2):
        cnt[k]=0
    for a in A:
        cnt[a]+=1
    for k in range(1,N,2):
        if cnt[k]!=2:
            print(0)
            exit()
    print(pow(2,N//2,const))
else:
    for k in range(0,N,2):
        cnt[k]=0
    for a in A:
        cnt[a]+=1
    if cnt[0]!=1:
        print(0)
        exit()
    for k in range(2,N,2):
        if cnt[k]!=2:
            print(0)
            exit()
    print(pow(2,(N-1)//2,const))
Problem p03302 (python)

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

if a + b == 15:
    print("+")
elif a * b == 15:
    print("*")
else:
    print("x")

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

if a + b == 15:
    print("+")
elif a * b == 15:
    print("*")
else:
    print("x")
Problem p03424 (python)

Fixed submission:
N = int(input())
S = set(input().split())

print('Three' if len(S) == 3 else 'Four')

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

print('Three' if len(S) == 3 else 'Four')
Problem p03497 (python)

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

cnt = {}

for a in A:
    if a not in cnt:
        cnt[a] = 0
    cnt[a] += 1

cnt = sorted(cnt.items(), key=lambda x: x[1])
ans = 0

for i in range(len(cnt)):
    if len(cnt) - i <= K:
        break
    ans += cnt[i][1]

print(ans)

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

cnt = {}

for a in A:
    if a not in cnt:
        cnt[a] = 0
    cnt[a] += 1

cnt = sorted(cnt.items(), key=lambda x: x[1])
ans = 0
i = 0

while len(cnt) > K:
    ans += cnt[i][1]
    i += 1

print(ans)
Problem p03608 (python)

Fixed submission:
from itertools import permutations

def input_list():
    return list(map(int, input().split()))

def main():
    n, m, r = input_list()
    rlist = input_list()
    rlist = [r-1 for r in rlist]
    d = [[float('inf')]*n for i in range(n)]
    for i in range(n):
        d[i][i] = 0
    
    for i in range(m):
        a, b, c = input_list()
        d[a-1][b-1] = c
        d[b-1][a-1] = c

    for k in range(n):
        for i in range(n):
            for j in range(n):
                distance = d[i][k]+d[k][j]
                if d[i][j] > distance:
                    d[i][j] = distance

    ans = float('inf')
    for p in permutations(rlist):
        distance = 0
        for i in range(r-1):
            distance += d[p[i]][p[i+1]]

        if ans > distance:
            ans = distance

    print(ans)

main()

Buggy submission (verdict: Runtime Error):
from itertools import permutations

def hoge():
  N, M, R = map(int, input().split())
  r = map(int, input().split())
  r = [x - 1 for x in r]
  inf = float('inf')
  d = [[inf] * N for i in range(N)]

  for i in range(N):
      d[i][i] = 0

  for i in range(M):
      a, b, c = map(int, input().split())
      d[a-1][b-1] = c
      d[b-1][a-1] = c


  for k in range(N):
      for i in range(N):
          for j in range(N):
              t = d[i][k] + d[k][j]
              if d[i][j] > t:
                d[i][j] = t


  ans = inf
  for i in permutations(r):
      tmphoge = len(i) - 1
      temp = 0
      for j in range(tmphoge):
          temp += d[i[j]][i[j+1]]
          if temp > ans:
              break
      if ans > temp:
        ans = tmp
      # ans = min(ans, temp)

  print(ans)
hoge()
Problem p03658 (python)

Fixed submission:
N, K = map(int, input().split())
l = sorted(map(int, input().split()), reverse=True)
print(sum(l[:K]))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = sorted(map(int, input().split()), reversed=True)
print(sum(l[:K]))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = soted(map(int, input().split()), reversed=True)
print(sum(l[:K]))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
l = soted(map(int, input().split()))
print(sum(l[:-K]))
Problem p02727 (python)

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

a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))

a.sort(reverse=True)
b.sort(reverse=True)

a = a[:x]
b = b[:y]

d = a + b + c
d.sort(reverse=True)

print(sum(d[:x+y]))

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

a = list(map(int, input().split(' ')))
b = list(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))

a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)

a = a[:x]
b = b[:y]

a_index = -1
b_index = -1

a_sum = sum(a)
b_sum = sum(b)

a_target = a[a_index]
b_target = b[b_index]

for i in c:
  if a_target > i and b_target > i:
    # もうりんごの更新はされない
    break
    
  if a_target > b_target:
    b_index -= 1
    b_sum -= b_target
    b_target = b[b_index]
    b_sum += i
  else:
    a_index -= 1
    a_sum -= a_target
    a_target = a[a_index]
    a_sum += i
    
print(a_sum + b_sum)
Problem p02741 (python)

Fixed submission:
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

n = int(input())
  
print(l[n-1])

Buggy submission (verdict: Runtime Error):
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

n = int(input())
  
print(l[n])
Problem p03262 (python)

Fixed submission:
def lcm(a, b):
  if b > a:
    a, b = b, a
  
  while b != 0:
    a, b = b, a % b
  
  return a

city_num, start = map(int, input().split())

cities = list(map(int, input().split()))

for i in range(len(cities)):
  cities[i] = abs(start - cities[i])

cities.sort()

a = cities[0]
for num in cities[1:]:
  a = lcm(a, num)
  
print(a)

Buggy submission (verdict: Runtime Error):
def lcm(a, b):
  if b > a:
    a, b = b, a
  
  while b != 0:
    a, b = b, a % b
  
  return a

city_num, start = map(int, input().split())

cities = list(map(int, input().split()))

for i in range(len(cities)):
  cities[i] = abs(start - cities[i])

cities.sort()
  
a = reduce(lcm, cities)  

print(a)
Problem p02613 (python)

Fixed submission:
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
  k = input().upper()
  if k == 'AC':
    ac +=1
  elif k == 'WA':
    wa +=1
  elif k == 'TLE':
    tle +=1
  elif k == 'RE':
    re +=1
    
print('{} x {}'.format('AC',ac))
print('{} x {}'.format('WA',wa))
print('{} x {}'.format('TLE',tle))
print('{} x {}'.format('RE',re))

Buggy submission (verdict: Runtime Error):
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(n):
  k = input().upper()
  if k == 'AC':
    ac +=1
  elif k == 'WA':
    wa +=1
  elif k == 'TLE':
    tle +=1
  elif k == 'RE':
    re +=1
    
print('AC x ' + ac + '\n' + 'WA x ' + wa + '\n' + 'TLE x ' + tle + '\n' + 'RE x ' + re)
Problem p03035 (python)

Fixed submission:
a,b = input().split(" ")
if int(a) >= 13:
  print(b)
elif int(a) in range(6,13):
  print(int(b)//2)
elif int(a) <= 5:
  print(0)

Buggy submission (verdict: Runtime Error):
a,b = input().split(" ")
if int(a) >= 13:
  print(b)
elif int(a) in range(6,13):
  print(b/2)
elif int(a) <= 5:
  print(0)
Problem p02675 (python)

Fixed submission:
N = str(input())
hon = ["2","4","5","7","9"]
pon = ["0","1","6","8"]
bon = ["3"]
if N[len(N)-1] in hon:
  print("hon")
elif N[len(N)-1] in pon:
  print("pon")
elif N[len(N)-1] in bon:
  print("bon")

Buggy submission (verdict: Runtime Error):
N = str(input())
print()
hon = [2,4,5,7,9]
pon = [0,1,6,8]
bon = [3]

if hon in int(N[len(N)-1]):
  print(
Problem p02641 (python)

Fixed submission:
X, N = map(int, input().split())
P = list(sorted(map(int, input().split())))

mindiff = 1000
minval = None
for i in range(0, 101+1):
    diff = abs(X- i)
    if i not in P and diff < mindiff:
        mindiff = diff
        minval = i
print(minval)

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

flags = [True] * N

count = 0
for i in range(N):
    if flags[i]:
        for j in range(i+1, N):
            if A[j] % A[i] == 0:
                flags[j] = False
            if A[j] == A[i]:
                flags[i] = False
        if flags[i]:
            count += 1
print(count)
Problem p03087 (python)

Fixed submission:
N, Q = map(int, input().split())
S = ['0'] + list(input())
C = [0] * len(S)
c = 0
for i in range(1, len(S)):
    if S[i-1] == "A" and S[i] == "C":
        c += 1
    C[i] = c
for _ in range(Q):
    l, r = map(int, input().split())
    print(C[r] - C[l])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = ['0'] + list(input())
C = [0] * len(S)
c = 0
for i in range(1, len(S)):
    if S[i-1] == "A" and S[i] == "C":
        c += 1
    C[i] = c
for _ in range(N):
    l, r = map(int, input().split())
    print(C[r] - C[l])