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

Fixed submission:
n = int(input())

if n == 1:
    print('Hello World')

if n == 2:
    a = [int(input()) for _ in range(2)]

    print(sum(a))

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

print('Hello World' if n == 1)

if n == 2:
    a = [int(input()) for _ in range(2)]

    print(sum(a))

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

print('Hello World' if n == 1)

if n == 2:
    for _ in range(2):
        a = [int(input())]

    print(sum(a))

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

print('Hello World' if n == 1)

if n == 2:
    for _ in range(2):
        a = [int(input())]

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

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

print('Hello World' if n == 1)

if n == 2:
    for _ in range():
        a, b = int(input())

    print(a+b)
Problem p03288 (python)

Fixed submission:
def rate(n):
    if n < 1200:
        print('ABC')
    elif 1200 <= n <2800:
        print('ARC')
    else:
        print('AGC')

rate(int(input()))

Buggy submission (verdict: Runtime Error):
def rate(n):
    if n < 1200:
        print('ABC')
    elif 1200 <= n <2800:
        print('ARC')
    else:
        print('AGC')

rate(input())
Problem p03377 (python)

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

print('YES' if a <= x <= a+b else 'NO')

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

print('YES'　if a<= x <= a+b else 'NO')
Problem p03385 (python)

Fixed submission:
s = str(input())

print('Yes' if s.count('a')==1 and s.count('b')==1 else 'No')

Buggy submission (verdict: Runtime Error):
s = str(input())

print('Yes' if s.count('a')==1 and c.count('b')==1 else 'No')

Buggy submission (verdict: Runtime Error):
s = str(input())

print('Yes' if s.count(a)==1 and c.count(b)==1 else 'No')

Buggy submission (verdict: Runtime Error):
s = str(input())

print('Yes' if s.count(a)+s.count(b) == 2 else 'No')

Buggy submission (verdict: Runtime Error):
s = str(input())

print('Yes' if s.count(a)+s.count(b)==2 else 'No')

Buggy submission (verdict: Runtime Error):
s = str(input())

print('Yes' if s.count(a)+s.count(b)=2 else 'No')
Problem p03415 (python)

Fixed submission:
x = str(input())
y = str(input())
z = str(input())
 
s = [x[0], y[1], z[2]]

print(''.join(s))

Buggy submission (verdict: Runtime Error):
x = [map(str, input().split())]
y = [map(str, input().split())]
z = [map(str, input().split())]

print(''.join([x[0], y[1], z[2]]))

Buggy submission (verdict: Runtime Error):
x = list(map(str, input().split()))
y = list(map(str, input().split()))
z = list(map(str, input().split()))

print(''.join([x[0], y[1], z[2]]))

Buggy submission (verdict: Runtime Error):
x = list(map(str, input().split()))
y = list(map(str, input().split()))
z = list(map(str, input().split()))

print(''.join(x[0], y[1], z[2]))
Problem p03469 (python)

Fixed submission:
s = input()
print('2018/01/' + s[-2] + s[-1])

Buggy submission (verdict: Runtime Error):
s = str(input())
print('2018/01' + s[-2] + a[-1])

Buggy submission (verdict: Runtime Error):
s = input()
print('2018/01' + s[-2] + a[-1])

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

if a == 2017:
    print('{}/{}/{}'.format(2018, b, c))
Problem p03477 (python)

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

if a+b > c+d:
    print('Left')

elif a+b == c+d:
    print('Balanced')

else:
    print('Right')

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

if a+b > c+d:
    print('Left')

elif a+b = c+d:
    print('Balanced')

else:
    print('Right')
Problem p03493 (python)

Fixed submission:
s = str(input())

print(s.count('1'))

Buggy submission (verdict: Runtime Error):
s = str(input())

print(s.count(1))
Problem p03547 (python)

Fixed submission:
dic = {'A':10, 'B':11, 'C':12, 'D':13, 'E':14, 'F':15}
x, y = map(str, input().split())

if dic[x] < dic[y]:
    print('<')

elif dic[x] == dic[y]:
    print('=')

else:
    print('>')

Buggy submission (verdict: Runtime Error):
dic = {'A':10, 'B':11, 'C':12, 'D':13, 'E':14, 'F':15}
x, y = map(str, input().split())

if dic[x] < dic[y]:
    print('<')

elif dic[x] = dic[y]:
    print('=')

else:
    print('>')
Problem p03573 (python)

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

for i in range(2):
    if lst[i] == lst[i+1]:
        print(sum(lst) - 2*lst[i])

Buggy submission (verdict: Runtime Error):
tx = [map(int, input().split(,))]
cx = sorted(tx)

for i in range(2):
    if cx[i] == cx[i+1]:
        print(sum(cx) - 2*cx[i])

Buggy submission (verdict: Runtime Error):
tx = [map(int, input().split())]
cx = [sorted(tx)]

for i in range(2):
    if cx[i] == cx[i+1]:
        print(sum(cx) - 2*cx[i])

Buggy submission (verdict: Runtime Error):
tx = [map(int, input().split())]
cx = sorted(tx)

for i in range(2):
    if cx[i] == cx[i+1]:
        print(sum(cx) - 2*int(cx[i]))
        break

Buggy submission (verdict: Runtime Error):
tx = [map(int, input().split())]
cx = sorted(tx)

for i in range(2):
    if cx[i] == cx[i+1]:
        print(sum(cx) - 2*cx[i])

Buggy submission (verdict: Runtime Error):
tx = [map(int, input().split())]
cx = sorted(x)

for i in range(2):
    if cx[i] == cx[i+1]:
        print(sum(cx) - 2*cx[i])
Problem p03711 (python)

Fixed submission:
lst0 = [1, 3, 5, 7, 8, 10, 12]
lst1 = [4, 6, 9, 11]
x, y = map(int, input().split())

if (x in lst0 and y in lst0) or (x in lst1 and y in lst1):
    print('Yes')

else:
    print('No')

Buggy submission (verdict: Runtime Error):
lst0 = [1, 3, 5, 7, 8, 10, 12]
lst1 = [4, 6, 9, 11]
x, y = map(int, input().split())

for i in range(2):
    if x in lst[i] and y in lst[i]:
        print('Yes')
        break

else:
    print('No')

Buggy submission (verdict: Runtime Error):
lst0 = [1, 3, 5, 7, 8, 10, 12]
lst1 = [4, 6, 9, 11]
x, y = map(int, input().split())

for i in range(2):
    if x in lst[i] and y in lst[i]:
        print('Yes')
        break

else:
    print('No')

Buggy submission (verdict: Runtime Error):
lst1 = [1, 3, 5, 7, 8, 10, 12]
lst2 = [4, 6, 9, 11]
x, y = map(int, input().split())

for i in range(2):
    if x in lst[i] and y in lst[i]:
        print('Yes')
        break

else:
    print('No')
Problem p03729 (python)

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

print('YES' if a[-1]==b[0] and b[-1]==c[0] else 'NO')

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

Fixed submission:
s1, s2, s3 = map(str, input().split())
lst = [s1[0].capitalize(), s2[0].capitalize(), s3[0].capitalize()]
print(''.join(lst))

Buggy submission (verdict: Runtime Error):
s1, s2, s3 = map(str, input().split())
lst = [s[0], s[1], s[2]].capitallize()
print(''.join(lst))
Problem p03845 (python)

Fixed submission:
n = int(input())
t = list(map(int,input().split()))
m = int(input())
px = [list(map(int,input().split())) for _ in range(m)]

for i in range(m):
    print(sum(t)-t[px[i][0]-1]+px[i][1])

Buggy submission (verdict: Runtime Error):
n = int(input())
t = list(map(int,input().split()))
m = int(input())
px = [list(map(int,input().split())) for _ in range(m)]

for i in range(m):
    print(sum(t)-t[px[i][0]]+px[i][1])

Buggy submission (verdict: Runtime Error):
n = int(input())
t = list(map(int,input().split()))
m = int(input())
px = [list(map(int,input().split())) for _ in range(m)]

for i in range(m):
    print(sum(t)-t[i]+px[i][1])
Problem p02899 (python)

Fixed submission:
n=int(input())
a=[0]*n
m=list(map(int,input().split()))
#print(m)
for i in range(n):
    a[m[i]-1]=i+1
for i in range(n):
    print(a[i],end=" ")

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[0]*10
#print(a)
m=list(map(int,input().split()))
#print(m)
for i in range(n):
    a[m[i]-1]=i+1
for i in range(n):
    print(a[i],end=" ")
Problem p02900 (python)

Fixed submission:

import fractions

"""
def gcd(a,b):
    if a>b:swap(a,b)
    if a==0:return b
    return gcd(b%a,a)
"""

a,b=map(int,input().split())
g=fractions.gcd(a,b)
#print(g)
ans=1
i=2
while i*i<=g:
    if(g%i==0):
        ans+=1
        while g%i==0:
            g/=i
    i=i+1
if(g!=1):ans+=1
print(ans)

Buggy submission (verdict: Runtime Error):

import math

"""
def gcd(a,b):
    if a>b:swap(a,b)
    if a==0:return b
    return gcd(b%a,a)
"""

a,b=map(int,input().split())
g=math.gcd(a,b)
#print(g)
ans=1
i=2
while i*i<=g:
    if(g%i==0):
        ans+=1
        g/=i
    i=i+1
if(g!=1):ans+=1
print(ans)
Problem p03101 (python)

Fixed submission:
hh, ww = map(int,input().split(' '))
h, w = map(int,input().split(' '))
ans = (hh-h)*(ww-w)
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split(' '))
cost = 0
count = 0

mlist = list()
for i in range(n):
  mlist.append(list(map(int,input().split(' '))))
mlist.sort(key=lambda x: x[0])

for i in range(n):
  ablist = mlist[i]
  if count+ablist[1] <= m:
    count += ablist[1]
    cost += ablist[0]*ablist[1] 
  else:
    for j in range(ablist[1]):
      count += 1
      if count <= m:
        cost += ablist[0]
      else:
        break_t = True
        break
    if break_t:
      break
print(cost)
Problem p03284 (python)

Fixed submission:
n, k = map(int, input().split(" "))
if n%k==0:
    print("0")
else:
    print("1")

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split(" "))
if n%k=0:
    print("0")
else:
    print("1")

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split(" "))
if n%k=0:
    print("0")
else:
    print("1")
Problem p03377 (python)

Fixed submission:
a, b, x = map(lambda anm: int(anm),input().split(' '))
if a <= x <= a + b:
 print('YES')
else:
 print('NO')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split(' ')))
i = 0
for i in range(n):
    ai = a[0:i] + a[i+1:n]
    aisrt = sorted(ai)
    l = int(len(aisrt)/2)
    print(aisrt[l])

Buggy submission (verdict: Runtime Error):
n, m, x = map(int, input().split(' '))
ai = map(int, input().split(' '))
lcost = 0
rcost = 0
for gate in ai:
  if gate < x:
    lcost += 1
  else:
    rcost += 1

print(min(lcost, rcost))
Problem p03423 (python)

Fixed submission:
n = int(input())
print(int(n/3))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(map(str, input().split(' ')))
#print(s)

si = [print('Four')if 'Y' in s else print('Three') ]
Problem p03433 (python)

Fixed submission:
n = int(input())
a = int(input())
coins = 'No' if a < (n%500) else 'Yes'
print(coins)

Buggy submission (verdict: Runtime Error):
alice = 0
bob = 0
n = int(input())
a = sorted(list(map(int, input().split(' ')))).reverse()

for i in a[::2]: alice += i
for i in a[1::2]: bob += i
print(alice - bob)
Problem p03434 (python)

Fixed submission:
alice = 0
bob = 0
n = int(input())
a = list(map(int, input().split(' ')))
asrt = sorted(a, reverse = True)

for i in asrt[::2]: alice += i
for i in asrt[1::2]: bob += i
print(alice - bob)

Buggy submission (verdict: Runtime Error):
alice = 0
bob = 0
n = int(input())
a = sorted(list(map(int, input().split(' ')))).reverse()

for i in a[::2]: alice += i
for i in a[1::2]: bob += i
print(alice - bob)

Buggy submission (verdict: Runtime Error):
alice = 0
bob = 0
n = int(input())
a = sorted(list(map(int, input().split(' ')))).reverse()

for i in asorted[::2]: alice += i
for i in asorted[1::2]: bob += i
print(alice - bob)
Problem p03456 (python)

Fixed submission:
ab = int(input().replace(' ', ''))
import math
sq = math.sqrt(ab)
if sq - int(sq) == 0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
ab = int(input().replace(' ', ''))
if type(sqrt(ab)) is int:
  print('Yes')
else:
  print('No')
Problem p03477 (python)

Fixed submission:
a, b, c, d = map(int, input().split(' '))
l = a + b
r = c + d

if l > r:
  print('Left')
elif l == r:
  print('Balanced')
else:
  print('Right')

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split(' '))
l = a + b
r = c + d

if l > r:
  print('Left')
elsif l = r:
  print('Balanced')
else:
  print('Right')

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split(' '))
r = a + b
l = c + d

if l > r:
  print('Left')
elsif l = r:
  print('Balanced')
else:
  print('Right')

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split(' '))
r = a + b
l = c + d

if l > r:
  print('left')
elsif l = r:
  print('Balanced')
else:
  print('Right')
Problem p03485 (python)

Fixed submission:
a, b = map(int, input().split(' '))
import math
print(math.ceil((a + b)/2))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split(' '))
print(floor((a + b)/2))
Problem p02900 (python)

Fixed submission:
from fractions import gcd
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
    
    
a, b = map(int,input().split())
a_d = make_divisors(a)
b_d = make_divisors(b)

yakusu = []

for i in a_d:
    if i in b_d:
        yakusu.append(i)

ans = [yakusu.pop(0)]
for i in yakusu:
    flg=0
    tmp = 0
    for j,num in enumerate(ans):
        if gcd(num,i) != 1:
            ans[j] = min(i,num)
            flg = 1
            break
    if flg == 0:
        ans.append(i)

print(len(ans))

Buggy submission (verdict: Runtime Error):
from math import gcd
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
    
    
a, b = map(int,input().split())
a_d = make_divisors(a)
b_d = make_divisors(b)

yakusu = []

for i in a_d:
    if i in b_d:
        yakusu.append(i)

ans = [yakusu.pop(0)]
for i in yakusu:
    flg=0
    tmp = 0
    for j,num in enumerate(ans):
        if gcd(num,i) != 1:
            ans[j] = min(i,num)
            flg = 1
            break
    if flg == 0:
        ans.append(i)

print(len(ans))

Buggy submission (verdict: Runtime Error):
from math import gcd
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors
    
    
a, b = map(int,input().split())
a_d = make_divisors(a)
b_d = make_divisors(b)

yakusu = []

for i in a_d:
    if i in b_d:
        yakusu.append(i)

ans = [yakusu.pop(0)]
for i in yakusu:
    flg=0
    tmp = 0
    for j,num in enumerate(ans):
        if gcd(num,i) != 1:
            ans[j] = min(i,num)
            flg = 1
            break
    if flg == 0:
        ans.append(i)

print(len(ans))
Problem p02995 (python)

Fixed submission:
import fractions


def lcm(a, b):
    return a * b // fractions.gcd(a, b)


def f(x, a, b):
    return x - x // a - x // b + x // lcm(a, b)


def main():
    a, b, c, d = map(int, input().split())
    print(f(b, c, d) - f(a - 1, c, d))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import gcd from fractions

def lcm(a, b):
    return a * b // gcd(a, b)

def f(x, a, b):
    return x - x // a - x // b + x // lcm(a, b)

def main():
    a, b, c, d = map(int, input().split())
    print(f(b, c, d) - f(a - 1, c, d))

if __name__ == '__main__':
    main()
Problem p03102 (python)

Fixed submission:
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
a = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for ai in a:
    absum = 0
    for i in range(m):
        absum += ai[i] * b[i]
    if absum + c > 0:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0
for _ in range(n):
    a = list(map(int, input().split()))
    if a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + c > 0:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0
for _ in range(n):
    a = list(map(int, input().split()))

    if a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + c > 0:
         ans += 1
print(ans)
Problem p03106 (python)

Fixed submission:
a,b,k=map(int,input().split())
tar=[1]
r=min(a,b)
for i in range(2,r+1):
    if a%i==0 and b%i==0:
        tar.append(i)
print(tar[-k])

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
tar=[1]
r=min(a,b)
for i in range(2,r):
    if a%i==0 & b%i==0:
        tar.append(i)
print(tar[-k])

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
tar=[1]
r=min(a,b)-1
for i in range(2,r):
    if a%i==0 & b%i==0:
        tar.append(i)
print(tar[-k])

Buggy submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
tar=[1]
r=min(a,b)-1
for i in range(2,r):
    if a%i==0 & b%i==0:
        tar.append(i)
tar.sort(reverse=True)
print(tar[k-1])
Problem p03194 (python)

Fixed submission:
n, p = map(int, input().split())
if n == 1:
    print(p)
else:
    for i in range(1, round(p**(1/n))+1):
        if p % i**n ==0:
            res = i
    print(res)

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

def yakusuSub(p,d,arr):
    if p==1:return arr
    if p/d==int(p/d):
        arr.append(d)
        return yakusuSub(p/d,d,arr)
    else:
        return yakusuSub(p,d+1,arr)
 
def yakusu(p):
    return yakusuSub(p,2,[])
 
if n==1:
    print(p)
    exit()
 
y=yakusu(p)
if not y:
    print(1)
    exit()
ans=1
cnt=1
before=0
f=False
for i in y:
    if i==before:
        cnt+=1
    else:
        cnt=1
    if cnt>=n:
        ans*=i
        cnt=1
        f=True
    before=i
if f:
    print(ans)
else:
    print(p)

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



def yakusuSub(p,d,arr):
    if p==1:return arr
    if p/d==int(p/d):
        arr.append(d)
        return yakusuSub(p/d,d,arr)
    else:
        return yakusuSub(p,d+1,arr)

def yakusu(p):
    return yakusuSub(p,2,[])

if n==1:
    print(p)
    exit()

y=yakusu(p)
if not y:
    print(1)
    exit()
ans=1
cnt=1
before=0
f=False
for i in y:
    if i==before:
        cnt+=1
    else:
        cnt=1
    if cnt>=n:
        ans*=i
        cnt=1
        f=True
    before=i
if f:
    print(ans)
else:
    print(p)

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



def yakusuSub(p,d,arr):
    if p==1:return arr
    if p/d==int(p/d):
        arr.append(d)
        return yakusuSub(p/d,d,arr)
    else:
        return yakusuSub(p,d+1,arr)

def yakusu(p):
    return yakusuSub(p,2,[])

if n==1:
    print(p)
    exit()

y=yakusu(p)
ans=1
cnt=1
before=0
f=False
for i in y:
    if i==before:
        cnt+=1
    else:
        cnt=1
    if cnt>=n:
        ans*=i
        cnt=1
        f=True
    before=i
if f:
    print(ans)
else:
    print(p)

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

def yakusuSub(p,d,arr):
    if p==1:return arr
    if p/d==int(p/d):
        arr.append(d)
        return yakusuSub(p/d,d,arr)
    else:
        return yakusuSub(p,d+1,arr)

def yakusu(p):
    return yakusuSub(p,2,[])

if n==1:
    print(p)
    exit()

y=yakusu(p)
ans=1
cnt=1
before=0
for i in y:
    if i==before:
        cnt+=1
    else:
        cnt=1       
    if cnt>=n:
        ans*=i
        cnt=1
    before=i
print(ans)

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



def yakusuSub(p,d,arr):
    if p==1:return arr
    if p/d==int(p/d):
        arr.append(d)
        return yakusuSub(p/d,d,arr)
    else:
        return yakusuSub(p,d+1,arr)

def yakusu(p):
    return yakusuSub(p,2,[])

if n==1:
    print(p)
    exit()

y=yakusu(p)
ans=1
ys=set(y)
for i in ys:
    if y.count(i)>=n:
        ans*=i
print(ans)
Problem p03206 (python)

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

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
h=[int(input()) for i in range(n)]
h=sorted(h)
mi=float('inf')
 
for i in range(n-k+1):
    mi = min(mi, h[i+k-1]-h[i])
 
print(mi)
Problem p03238 (python)

Fixed submission:
n = int(input())
if n == 1:
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a + b)  
exit()

Buggy submission (verdict: Runtime Error):
n = int(input())
a = int(input())
b = int(input())
 
if n == 1:
    print("Hello World")
    exit()
else:
    print(a + b)
    exit()

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

if n == 1:
    print("Hello World")
else:
    print(a + b)
Problem p03574 (python)

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

s = ['-'*(w+2)]
for i in range(h):
    s += ['-'+input()+'-']
s += ['-'*(w+2)]

for hi in range(1,h+1):
    ans = ''
    for wi in range(1,w+1):
        if s[hi][wi] == '#':
            ans += '#'
        else:
            c = [s[hi-1][wi-1],s[hi][wi-1],s[hi+1][wi-1],s[hi-1][wi],s[hi+1][wi],s[hi-1][wi+1],s[hi][wi+1],s[hi+1][wi+1]]
            ans += str(c.count('#'))
    print(ans)

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

s = ['-' * (w + 2)]
for i in range(h):
    s.append('-' + input() + '-')
s.append('-' * (w + 2))

for hi in range(1,h+1):
    ans=''
    for wi in range(1,h+1):
        if s[hi][wi] == '#':
            ans += '#'
        else:
            c = [s[hi-1][wi-1],s[hi][wi-1],s[hi+1][wi-1],s[hi-1][wi],s[hi+1][wi],s[hi-1][wi+1],s[hi][wi+1],s[hi+1][wi+1]]
            ans += str(c.count('#'))
    print(ans)
Problem p03607 (python)

Fixed submission:
n=int(input())
s=set()
for _ in range(n):
    a = input()
    if a in s:
        s.remove(a)
    else:
        s.add(a)
print(len(s))

Buggy submission (verdict: Runtime Error):
n=int(input())
paper=[]
for _ in range(n):
    a = input()
    if a in paper:
        paper.remove(a)
    else:
        paper.add(a)
print(len(paper))
Problem p03633 (python)

Fixed submission:
def gcd(a, b):
    while b != 0:
        a, b = b, a%b
    return a
 
N = int(input())
A = [int(input()) for i in range(N)]
 
ans = A[0]
 
for i in A:
    ans = (ans*i)//gcd(ans, i)
print(ans)

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

n=int(input())
tl=[int(input()) for _ in range(n)]

def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)
    
def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)


print(lcm(*tl))
Problem p04044 (python)

Fixed submission:
n, l = map(int, input().split())
s = [input() for _ in range(n)]
s.sort()
print("".join(s))

Buggy submission (verdict: Runtime Error):
n, l = map(int, input().sprit())
s = [input() for _ in range(n)]
s.sort()
print("".join(s))
Problem p02830 (python)

Fixed submission:
N = int(input())
S,T = input().split()
 
a = ""
for i in range(N):
  a+=S[i]+T[i]
print(a)

Buggy submission (verdict: Runtime Error):
N = input()
S,T = input().split()

a = []
for i in range(N):
  a.append(S[i])
  a.append(T[i])
print(a)
Problem p02945 (python)

Fixed submission:
a, b = map(int, input().split())
wa = a + b
sa = a - b
seki = a * b
s = [a + b, a - b, a * b]
print(max(s))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
wa = a + b
sa = a - b
seki = a * b
if wa > sa and wa > seki:
    print(wa)
    break
elif sa > wa and sa > seki:
    print(sa)
    break
else:
    print(seki)
Problem p02993 (python)

Fixed submission:
s = input()
for w in range(3):
    if s[w] == s[w+1]:
        print("Bad")
        break
    else:
        continue
else:
    print("Good")

Buggy submission (verdict: Runtime Error):
s = input()
for w in s:
    a = s.index(w)
    if w == s[a+1]:
        print("Bad")
        break
    else:
        continue
else:
    print("Good")
Problem p03359 (python)

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

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