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

Fixed submission:
import math

a, b, c, d, e, f = map(int, input().split())

highest = 0
sugarwater = 0
maxsugar = 0
amax = math.ceil(f / (100 * a))
bmax = math.ceil(f / (100 * b))
cmax = math.ceil(30 * e / c)
dmax = math.ceil(30 * e / d)
for aa in range(amax):
    for bb in range(bmax):
        water = 100 * (aa * a + bb * b)
        if water == 0 or water > f:
            continue
        for cc in range(cmax):
            for dd in range(dmax):
                sugar = cc * c + dd * d
                if sugar / (water / 100) > e or water + sugar > f:
                    continue
                density = 100 * sugar / (water + sugar)
                if density >= highest:
                    highest = density
                    sugarwater = sugar + water
                    maxsugar = sugar
print(sugarwater, maxsugar)

Buggy submission (verdict: Runtime Error):
import math

a, b, c, d, e, f = map(int, input().split())

highest = 0
sugarwater = 0
maxsugar = 0
for aa in range(math.ceil(f / (100 * a))):
    for cc in range(math.ceil(f / c)):
        for bb in range(math.ceil(f / (100 * b))):
            for dd in range(math.ceil(f / d)):
                sugar = cc * c + dd * d
                water = 100 * (aa * a + bb * b)
                if (
                    sugar == 0
                    or water == 0
                    or sugar / (water / 100) > e
                    or water + sugar > f
                ):
                    continue
                density = 100 * sugar / (water + sugar)
                if density > highest:
                    highest = density
                    sugarwater = sugar + water
                    maxsugar = sugar
print(f"{sugarwater} {maxsugar}")

Buggy submission (verdict: Runtime Error):
import math

a, b, c, d, e, f = map(int, input().split())

highest = 0
sugarwater = 0
maxsugar = 0
for aa in range(math.ceil(f / (100 * a))):
    for cc in range(math.ceil(f / c)):
        for bb in range(math.ceil(f / (100 * b))):
            for dd in range(math.ceil(f / d)):
                sugar = cc * c + dd * d
                water = 100 * (aa * a + bb * b)
                if (
                    sugar == 0
                    or water == 0
                    or sugar / (water / 100) > e
                    or water + sugar > f
                ):
                    continue
                density = 100 * sugar / (water + sugar)
                if density > highest:
                    highest = density
                    sugarwater = sugar + water
                    maxsugar = sugar
print(f"{sugarwater} {maxsugar}")
Problem p03457 (python)

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

import numpy
import scipy
#import sys


N = int(input())
P = []
for n in range(N):
    P.append(list(map(int, input().split())))

for i, p in enumerate(P):
    if i == 0:
        t_p, x_p, y_p = 0, 0, 0
    else:
        t_p, x_p, y_p = P[i-1][0], P[i-1][1], P[i-1][2]
    t, x, y = p
    dt = t - t_p
    dx = x - x_p
    dy = y - y_p
    dist = abs(dx) + abs(dy)

    if dist > dt:
        print("No")
        exit()

    if dist%2 != dt%2:
        print("No")
        exit()

print("Yes")

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

import numpy
import scipy
#import sys


N = int(input())
P = []
for n in range(N):
    P.append(map(int, input().split()))

for i, p in enumerate(P):
    if i == 0:
        t_p, x_p, y_p = 0, 0, 0
    else:
        t_p, x_p, y_p = P[i-1][0], P[i-1][1], P[i-1][2]
    t, x, y = p
    dt = t - t_p
    dx = x - x_p
    dy = y - y_p
    dist = abs(dx) + abs(dy)

    if dist > dt:
        print("No")
        exit()

    if dist%2 != dt%2:
        print("No")
        exit()

print("Yes")
Problem p03494 (python)

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

import numpy
import scipy

N = int(input())
A = list(map(int, input().split()))
#print(A)

c = 0
flg = False
while True:
    #print(A)
    for i, a in enumerate(A):
        if a%2 == 0:
            A[i] /= 2
            #pass
        else:
            flg = True
            break
    if flg:
        break
    c += 1
print(c)

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

import numpy
import scipy

N = int(input())
A = map(int, input().split())

c = 0
while True:
    for i, a in enumerate(A):
        if a%2 == 0:
            A[i] = A[i]/2
        else:
            break;
    c += 1
print(c)
Problem p03807 (python)

Fixed submission:

a = int(input())
b = input().split()
x = []
for i in b:
    x.append(int(i))

count = 0

for i in x:
    if i % 2 != 0:
        count += 1

z = divmod(count,2)


if z[1] == 1:
    print("NO")
else:
    print("YES")

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

count = 0

for i in x:
    if i % 2 != 0:
        count += 1

flag = 0
while True:
    z = divmod(count,2)

    #print(z)

    if z[0] == 1:
        break

    if z[1] == 1:
        flag = 1
        break

    count = z[0]

if flag == 1:
    print("NO")
else:
    print("YES")a = int(input())
b = input().split()
x = []
for i in b:
    x.append(int(i))

count = 0

for i in x:
    if i % 2 != 0:
        count += 1

flag = 0
while True:
    z = divmod(count,2)

    #print(z)

    if z[0] == 1:
        break

    if z[1] == 1:
        flag = 1
        break

    count = z[0]

if flag == 1:
    print("NO")
else:
    print("YES")
Problem p03391 (python)

Fixed submission:
N = int(input())

same = True
sum_a = 0
min_b = None

for _ in range(N):
    a, b = map(int, input().split())
    # Aの総和を求める
    sum_a += a
    # AとBが等しいどうかを調べる
    if a != b:
        same = False
    # Ai > Biの中で最小のbを求める
    if a > b and (min_b is None or b < min_b):
        min_b = b

# 初めから同じなら手数なし
if same:
    print(0)
    exit()

# Ai > Biの中で最小のbを求める
if min_b is None:
    min_b = 0

print(sum_a - min_b)

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

c = 0

if A == B:
    print(c)
    exit()

# A[i] < B[i]のところはA[i] == 0になるまで追いつけない
for i in range(N):
    if A[i] < B[i]:
        c += A[i]
        B[i] -= A[i]
        A[i] = 0

while A != B:
    x = 0
    for i in range(N):
        if A[i] == 0:
            continue
        x = i
        if A[i] < B[i]:
            break
    A[x] -= 1
    y = 0
    for i in range(N):
        if A[i] == B[i]:
            continue
        y = i
        if A[i] < B[i]:
            break
    B[y] -= 1
    candy += 1

print(candy)
Problem p03402 (python)

Fixed submission:
def print_component(a, b, n):
    for _ in range(25):
        print(a * 100)
        if n:
            x = min(n, 50)
            n -= x
            print((a+b)*x + a*2*(50-x))
        else:
            print(a * 100)


A, B = map(int, input().split())

print('100 100')
print_component('#', '.', A - 1)
print_component('.', '#', B - 1)

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

print('100 100')

for i in range(25):
    print('#' * 100)
    if A:
        x = min(A, 50)
        A = A - x
        print('#.'*x + '##'*(50-x))
    else:
        print('#' * 100)

for i in range(25):
    print('.' * 100)
    if B:
        x = min(B, 50)
        B = B - x
        print('.#'*x + '..'*(50-x))
    else:
        print('.' * 100)
A, B = map(int, input().split())
A -= 1
B -= 1

print('100 100')

for i in range(25):
    print('#' * 100)
    if A:
        x = min(A, 50)
        A = A - x
        print('#.'*x + '##'*(50-x))
    else:
        print('#' * 100)

for i in range(25):
    print('.' * 100)
    if B:
        x = min(B, 50)
        B = B - x
        print('.#'*x + '..'*(50-x))
    else:
        print('.' * 100)
Problem p03574 (python)

Fixed submission:
# ABC 075 B

# H, W = 4, 3
# S = "#.."\
#     "..#"\
#     ".#."\
#     ".#."

H, W = map(int, input().split())
S = ''
for _ in range(H):
    S += input()
    

def cell_of(x, y):
    return S[W*x + y]

def neighbor_indice_of(x, y):
    return [
        (x+m, y+n)
        for m in range(-1, 2)
        for n in range(-1, 2)
        if 0 <= x+m < H and 0 <= y+n < W
    ]

def neighbors_of(x, y):
    return [cell_of(i, j) for i, j in neighbor_indice_of(x, y)]

def mine(x, y):
    cell = cell_of(x, y)
    if cell != '.':
        return cell
    return str(neighbors_of(x, y).count('#'))


for x in range(H):
    print(''.join([mine(x, y) for y in range(W)]))

Buggy submission (verdict: Runtime Error):
# ABC 075 B

# H, W = 4, 3
# S = "#.."\
#     "..#"\
#     ".#."\
#     ".#."

H, W = map(int, input().split())
S = ''
for _ in range(H):
    S += input()
    

def cell_of(x, y):
    return S[W*x + y]

def neighbor_indice_of(x, y):
    return [
        (x+m, y+n)
        for m in range(-1, 2)
        for n in range(-1, 2)
        if 0 <= x+m < H and 0 <= y+n < W
    ]

def neighbors_of(x, y):
    return [
        cell_of(i, j)
        for i, j in neighbor_indice(x, y)
    ]

def mine(x, y):
    cell = cell_of(x, y)
    if cell != '.':
        return cell
    return str(neighbors_of(x, y).count('#'))


for x in range(H):
    print(''.join([mine(x, y) for y in range(W)]))
Problem p03407 (python)

Fixed submission:
x = raw_input().split()
if (int(x[2]) <= int(x[0])+int(x[1])):
    print("Yes")

else:
    print("No")

Buggy submission (verdict: Runtime Error):
x = input().split
if x[2] <= x[0] + x[1]:
    print("Yes")
else:
    print("No")
Problem p03944 (python)

Fixed submission:
import numpy as np

W,H,N = map(int,input().split())
l = np.zeros((H,W)) #	要素0のH×W配列

for i in range(N):
  x,y,a = map(int,input().split())

  if a==1:
    l[:,:x] = 1
    #print(l[:,x:])
  elif a==2:
    l[:,x:] = 1
  elif a==3:
    l[:y,:] = 1
  elif a==4:
    l[y:,:] = 1
#print(H*W-int(l.sum().sum()))
print(H*W-int(l.sum()))

Buggy submission (verdict: Runtime Error):
import numpy as np

W,H,N = map(int,input().split())
l = np.zeros((H,W)) #	要素0のH×W配列

for i in range(N):
  x,y,a = map(int,input().split())

  if a==1:
    l[:,:x] = 1
    #print(l[:,x:])
  elif a==2:
    l[:,x:] = 1
  elif a==3:
    l[:y,:] = 1
  elif a==4:
    l[y:,:] = 1
#print(H*W-int(l.sum().sum()))
print(H*W-int(l.sum()))
Problem p03998 (python)

Fixed submission:
#辞書型リスト作成
dic ={
  "a":list(input()),
  "b":list(input()),
  "c":list(input())
}
#print(dic)

now = "a"
while True:
  if len(dic[now]) == 0:
    print(now.upper()) #大文字変換
    break
  now = dic[now].pop(0) #値削除

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

ans = (K-1)**(N-1)*K

print(ans)
Problem p03399 (python)

Fixed submission:
input_train_price1=input()
input_train_price2=input()
input_bus_price1=input()
input_bus_price2=input()

train_price=[int(input_train_price1),int(input_train_price2)]
bus_price=[int(input_bus_price1),int(input_bus_price2)]

best_train_price=min(train_price)
best_bus_price=min(bus_price)

#print(best_train_price+"+"+best_bus_price)

total_price=best_train_price+best_bus_price

print(str(total_price))

Buggy submission (verdict: Runtime Error):
input_train_price1=input("電車の通常の切符の料金を入力:")
input_train_price2=input("電車の乗り放題切符の料金を入力":)
input_bus_price1=input("バスの通常の切符の料金を入力:")
input_bus_price2=input("バスの乗り放題切符の料金を入力":)

train_price1=int(input_train_price1)
train_price2=int(input_train_price2)
bus_price1=int(input_bus_price1)
bus_price2=int(input_bus_price2)

train_price=["train_price1,train_price2"]
bus_price=["bus_price1,bus_price2"]

best_train_price=min(train_price)
best_bus_price=min(bus_price)

print("運賃の合計の最小値は"+best_train_price+best_bus_price+"円です。")
Problem p03423 (python)

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

Buggy submission (verdict: Runtime Error):
num = int(input())
colors = map(str, input().split())

if len(set(colors)) == 3:
    print('Three')
else:
    print('Four')
Problem p03423 (python)

Fixed submission:
while True:
    N = int(input())
    if N >= 1 and N <= 1000:
        break
if N < 3:
    print(0)
if N >= 3:
    print(int(N/3))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
while True:
    N = int(input())
    if N >= 1 and N <= 1000:
        continue
    if N < 3:
        print(0)
    else:
        if N/3 > 3.0:
            print(int(N/3)+1)
        else:
            print(int(N/3))
Problem p03721 (python)

Fixed submission:
N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()
counter=0
for i in range(N):
     counter+=A[i][1]
     if counter>=K:
         counter=i
         break   
print(A[counter][0])

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()
counter=0
for i in range(N):
     counter+=A[i][1]
     if counter>K:
         counter=i
         break
print(A[counter][0])

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
A=[]
C=[]
for i in range(N):
    a,b=map(int,input().split())
    T=[a,b]
    A.append(T)
A.sort()
counter=0
for i in range(N):
     counter+=A[i][1]
     if counter>K:
         counter=i
         break
print(A[counter-1][0])
Problem p03773 (python)

Fixed submission:
A,B=map(int,input().split())
print((A + B) % 24)

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
print((a + b) % 24)
Problem p03399 (python)

Fixed submission:
def solver(a, b, c, d):
  """
  >>> solver(600, 300, 220, 420)
  520
  >>> solver(555, 555, 400, 200)
  755
  >>> solver(549, 817, 715, 603)
  1152
  """

  result = 0

  result += a if a < b else b
  result += c if c < d else d

  return result

if __name__ == '__main__':
  inputs = [int(input()) for _ in range(4)]
  print(solver(inputs[0], inputs[1], inputs[2], inputs[3]))

Buggy submission (verdict: Runtime Error):
def solver(a, b, c, d):
  """
  >>> solver(600, 300, 220, 420)
  520
  >>> solver(555, 555, 400, 200)
  755
  >>> solver(549, 817, 715, 603)
  1152
  """

  result = 0

  result += a if a < b else b
  result += c if c < d else d

  return result

if __name__ == '__main__':
  inputs = [int(input()) for _ in range(4)]
  print solver(inputs[0], inputs[1], inputs[2], inputs[3])
Problem p03469 (python)

Fixed submission:
d=input()
print(d.replace('7/','8/'))

Buggy submission (verdict: Runtime Error):
d=input()
print(d.repalace('7/','8/'))

Buggy submission (verdict: Runtime Error):
d=input()
print(f'{d[:3]}8{d[4:]}')
Problem p03485 (python)

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

Buggy submission (verdict: Runtime Error):
from math import ceil
a, b = map(int, input())
print(ceil((a+b)/2))
Problem p03693 (python)

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

Buggy submission (verdict: Runtime Error):
r, b, g = map(int, input().split())
print(['NO', 'YES'][(10*b+g)%4 == 0]
Problem p03403 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

N = int(sys.stdin.readline())

A = sys.stdin.readline().split(' ')

A = [int(x) for x in A]

A.insert(0, 0)
A.append(0)

total = 0

for i in range(N + 1):
	total += abs(A[i] - A[i+1])

for i in range(1, N + 1):
	print(str(total - abs(A[i] - A[i + 1]) - abs(A[i] - A[i - 1]) + abs(A[i -1] - A[i + 1])))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

N = int(sys.stdin.readline())

A = map(lambda x: int(x), sys.stdin.readline().split(' '))

total = 0
A.insert(0, 0)
A.append(0)

for i in range(N + 1):
	total += abs(A[i] - A[i+1])

for i in range(1, N + 1):
	print(str(total - abs(A[i] - A[i + 1]) - abs(A[i] - A[i - 1]) + abs(A[i -1] - A[i + 1])))

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

N = int(sys.stdin.readline())

A = sys.stdin.readline().split(' ')


for rem in range(len(A)):
	pay = 0
	B = A.copy()
	del(B[rem])

	for i in range(len(B)):

		a = B[i]
		s = B[i - 1] if i > 0 else 0

		l = a - s
		pay += l if l > 0 else -l

	lastPoint = B[len(B) - 1]
	pay += lastPoint if lastPoint > 0 else -lastPoint

	print(pay)
Problem p03657 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

input_line = sys.stdin.readline()

line = input_line.split(' ')
a = int(line[0])
b = int(line[1])
c = a + b

if c > 2 and c % 3 == 0:
	print('Possible')
elif a > 2 and a % 3 == 0:
	print('Possible')
elif b > 2 and b % 3 == 0:
	print('Possible')
else:
	print('Impossible')

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

input_line = sys.stdin.readline()

line = input_line.split(' ')
a = int(line[0])
b = int(lint[1])
c = a + b

if c > 2 and c % 3 == 0:
	print('Possible')

if a > 2 and a % 3 == 0:
	print('Possible')
	return

if b > 2 and b % 3 == 0:
	print('Possible')
	return

print('Impossible')
Problem p03763 (python)

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

input_line = sys.stdin.readline()

n = int(input_line)
S = []

if n==0:
	print("")
	quit()

for i in range(n):
	input_line = sys.stdin.readline()
	S.append(input_line)

used_list = []
used_count = {}
maxLength = 0
for mojiretsu in S:
	_used_dict = {}
	if len(mojiretsu) > maxLength :
		maxLength = len(mojiretsu)
	for moji in mojiretsu:
		if not moji in _used_dict:
			_used_dict[moji] = 0
		if _used_dict[moji] == 0:
			if not moji in used_count:
				used_count[moji] = 0
			used_count[moji] += 1
			_used_dict[moji] = 0
		_used_dict[moji] += 1

	sorted(_used_dict.items(), key=lambda x:x[1], reverse=True)
	used_list.append(_used_dict)

used_flags = []
mojiKeys = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm','n','o','p','q','r','s','t','u','v','w','x','y','z']

i = 0
candidates = {}
for alpha in mojiKeys:
	if alpha in used_count and used_count[alpha] == n:
		candidates[alpha] = 0
		minimum = maxLength
		for used in used_list:
			if used[alpha] < minimum :
				minimum = used[alpha]
		candidates[alpha] = minimum

output = ""

for i in range(len(mojiKeys)):
	if not mojiKeys[i] in candidates:
		continue
	for j in range(candidates[mojiKeys[i]]):
		output += mojiKeys[i]

print(output)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

input_line = sys.stdin.readline()
nm = input_line.split()
n = nm[0]
m = nm[1]

div = int(1e9 + 7)

input_line = sys.stdin.readline()
xn = [int(v) for v in input_line.split()]

input_line = sys.stdin.readline()
ym = [int(v) for v in input_line.split()]

i = 0
j = 0
S = 0
for i in range(len(xn) - 1):
	sx = xn[i]
	for j in range(len(ym) - 1):
		sy = ym[j]

		for ii in range(i + 1, len(xn)):
			for jj in range(j + 1, len(ym)):
				S += abs((sx - xn[ii]) * (sy - ym[jj]))

S %= div

print(int(S))
Problem p03399 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())

print(min(A,B)+min(C,D))

Buggy submission (verdict: Runtime Error):
PList = [int(i) for i in input().split()]

Price = min(PList[1],PList[2]) + min(Plist[3],PList[4])

print(Price)

Buggy submission (verdict: Runtime Error):

P  = 0
if A > B:
  P = A
else:
  P = B
if C > D:
  P = P + C
else:
  P = P + D
  
print(P)
Problem p03407 (python)

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

if D[2] > D[0] + D[1]:
  print("No")
else:
  print("Yes")

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

if D[2] > D[0] + D[1]:
  print(No)
else:
  print(Yes)

Buggy submission (verdict: Runtime Error):
D = [map(int(),input().split())]
 
if D[2] > D[0] + D[1]:
  print(No)
else:
  print(Yes)

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

if D[2] > D[0] + D[1]:
  print(No)
else:
  print(Yes)
Problem p03415 (python)

Fixed submission:
 
C_0=list(input())
C_1=list(input())
C_2=list(input())

# D = C[0][0]+C[1][1]+C[2][2]
# print(str(D))
print(C_0[0]+C_1[1]+C_2[2])

Buggy submission (verdict: Runtime Error):
import numpy as np
 
C = np.chararray((3,3))
C[0][:]=input().split()
C[1][:]=input().split()
C[2][:]=input().split()
 
print(C[0][0]C[1][1]C[2][2])

Buggy submission (verdict: Runtime Error):
import numpy as np

C = np.chararray(input(),input(),input())

print(C[0][0],C[1][1],C[2][2])

Buggy submission (verdict: Runtime Error):
import numpy as np

C = np.charray(input(),input(),input())

print(C[0][0],C[1][1],C[2][2])
Problem p03573 (python)

Fixed submission:
# coding:utf-8
a,b,c = map(int,input().split())#標準入力を行う

def out_of_three():
	if a == b:
		return c
	if a == c:
		return b
	if b == c:
		return a

print (out_of_three())

Buggy submission (verdict: Runtime Error):
# coding:utf-8
H,W = map(int,input().split())

A = [[0 for i in range(W)] for j in range(H)]
ans = [[0 for i in range(W)] for j in range(H)]
B = [0] * H

for i in range(H):
	B[i] = input()

for i in range(H):
	char = list(B[i])
	for j in range(W):
		A[i][j] = char[j]


for i in range(H):
	for j in range(W):
		if A[i][j] == '#':
			for h in range(-1,2):
				for k in range(-1,2):
					if h == 0 and k == 0:
						continue
					if (i == 0 and h == -1) or (i == H -1 and h == 1) or (j == 0 and k == -1) or (j == W-1 and k == 1):
						continue

					if (A[i+h][j+k]) != '#':
 						ans[i+h][j+k] += 1  
			ans[i][j] = '#'
		
print (ans)
Problem p03574 (python)

Fixed submission:
# coding:utf-8
H, W = list(map(int, input().split()))
s = []
ans = []
for i in range(H):
    s.append(input())
    ans.append([])
for i in range(H):
    for j in range(W):
        if(s[i][j] == "#"):
            ans[i].append("#")
            continue
        ans[i].append(0)

for i in range(H):
	for j in range(W):
		if s[i][j] == '#':
			for h in range(-1,2):
				for k in range(-1,2):
					if h == 0 and k == 0:
						continue
					if (i == 0 and h == -1) or (i == H -1 and h == 1) or (j == 0 and k == -1) or (j == W-1 and k == 1):
						continue

					if (s[i+h][j+k]) != '#':
 						ans[i+h][j+k] += 1  
			ans[i][j] = '#'

o = ""
for i in range(H):
	for j in range(W):
		o += str(ans[i][j])
	o += "\n"
print (o)

Buggy submission (verdict: Runtime Error):
 coding:utf-8
H, W = list(map(int, input().split()))
s = []
ans = []
for i in range(H):
    s.append(input())
    ans.append([])
for i in range(H):
    for j in range(W):
        if(s[i][j] == "#"):
            ans[i].append("#")
            continue
        ans[i].append(0)

for i in range(H):
	for j in range(W):
		if s[i][j] == '#':
			for h in range(-1,2):
				for k in range(-1,2):
					if h == 0 and k == 0:
						continue
					if (i == 0 and h == -1) or (i == H -1 and h == 1) or (j == 0 and k == -1) or (j == W-1 and k == 1):
						continue

					if (s[i+h][j+k]) != '#':
 						ans[i+h][j+k] += 1  
			ans[i][j] = '#'
		
print (ans)
Problem p03399 (python)

Fixed submission:
# -*- coding: utf-8 -*-
#値の取得
t_1 = int(input())
t_2 = int(input())
if (t_1 < t_2):
  sum_1 = t_1
else:
  sum_1 = t_2
  
b_1 = int(input())
b_2 = int(input())
if (b_1 < b_2):
  sum_2 = b_1
else:
  sum_2 = b_2
  
print(sum_1 + sum_2)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
#値の取得
t_1 = input()
t_2 = input()
if (t_1 < t_2):
  sum_1 = t_1
else:
  sum_1 = t_2
  
b_1 = input()
b_2 = input()
if (b_1 < b_2):
  sum_2 = b_1
else:
  sum_2 = b_2
  
print(int(s_1) + int(s_2))
Problem p03423 (python)

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

Buggy submission (verdict: Runtime Error):
print(int(input() // 3)
Problem p03493 (python)

Fixed submission:
print(input().count("1"))

Buggy submission (verdict: Runtime Error):
 print(input().count("1"))

Buggy submission (verdict: Runtime Error):
 print(input().count("1"))
Problem p03861 (python)

Fixed submission:
a, b, x = [int(i) for i in input().split()]
def f(n):
    if n == -1:
        return 0
    else:
        return n // x + 1
print(f(b) - f(a-1))

Buggy submission (verdict: Runtime Error):
a, b, x = [int(i) for i in input().split()]
for i in range(a, b+1):
    if i % x == 0:
        first_num = i
        break
print(-(-(b - first_num) // x))

Buggy submission (verdict: Runtime Error):
a, b, x = [int(i) for i in input().split()]
for i in range(a, b+1):
    if i % x == 0:
        first_num = i
        break
print(-(-(b - first_num) // x))