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

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

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

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

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

Fixed submission:
A,B,C,D = map(int, input().rstrip().split())
print(min([B, D]) - max([A,C]) if min([B, D]) - max([A,C]) > 0 else 0)

Buggy submission (verdict: Runtime Error):
A,B,C,D = map(int, input().rstrip().split())
print(max([A,B]) - min([C,D])
Problem p02705 (python)

Fixed submission:
R = float(input())
print(R*6.28)

Buggy submission (verdict: Runtime Error):
R = input()
print (R*6.28)

Buggy submission (verdict: Runtime Error):
print ((R*6.28))

Buggy submission (verdict: Runtime Error):
print (6.28*R)

Buggy submission (verdict: Runtime Error):
print (2R*3.1419)
Problem p02705 (python)

Fixed submission:
import numpy as np

R = int(input())
print( 2 * np.pi * R )

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

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

boss=[0]*N

for x in A:
    boss[x-1] += 1
for i in boss:
    print(int(boss[i-1]))
Problem p02719 (python)

Fixed submission:
import numpy as np


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

time = N // K
min_ = N- time*K
min = N- (time+1)*K
print (min_ if min_<np.abs(min) else np.abs(min))

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


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

i =N
while i>0:
    i = i-K
    i_ = i #一時避難場所
print (i if i<np.abs(i_) else np.abs(i_))
Problem p02713 (python)

Fixed submission:
import math
 
K = int(input())
ans = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        tmp = math.gcd(i, j)
        for k in range(1, K+ 1):
            ans += math.gcd(k, tmp)
 
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
k = int(input())
l = [a,b,c]
gcd = []
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
for l[0] in range(1,k+1):
    for l[1] in range(1,k+1):
        for l[2] in range(1,k+1):
            gcd.append(gcd_list(l))
print(sum(gcd))
Problem p02731 (python)

Fixed submission:
l = float(input())
print((l/3)**3)

Buggy submission (verdict: Runtime Error):
l = float(input())
print(math.pow((l/3), 3))
Problem p02765 (python)

Fixed submission:
N,R = map(int,input().split())
if N > 10:
    print(R);
else:
    print(R + 100 * (10 - N))

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
import math
print(int(math.log(n,k))+1)
Problem p02717 (python)

Fixed submission:
Y, Z, X =map(int, input().split())
print(X,Y,Z)

Buggy submission (verdict: Runtime Error):
Z,X,Y =int(input().split())
print(X,Y,Z)
Problem p02789 (python)

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

if n == m :
    print("Yes")
else :
    print("No")

Buggy submission (verdict: Runtime Error):
N = int(input())
line = list(map(int,input().split()))
a = 0
p = []
for i in line:
    p.append(i)
    m = min(p)
    if m >= i:
       a += 1

print(a)
Problem p02791 (python)

Fixed submission:
N = int(input())
line = list(map(int,input().split()))
a = 1
m = line[0]
for i in range(N-1):
    if m >= line[i]:
        m = line[i]

    if m >= line[i+1]:
       a += 1

print(a)

Buggy submission (verdict: Runtime Error):
N = int(input())
line = list(map(int,input().split()))
a = 0
p = []
for i in N:
    p.append(N)
    if  min(p) >= N:
       a += 1

print(a)
Problem p02741 (python)

Fixed submission:
List =[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]
 
i = int(input())
 
print(List[i-1])

Buggy submission (verdict: Runtime Error):
List =[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]

i = int(input())

print(List[i])
Problem p02706 (python)

Fixed submission:
n, m = map(int, input().split())
s = sum(map(int, input().split()))
print(n-s if s <= n else -1)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
l = sum(map(int, input().split()))
print(n-s if s <= n else -1)
Problem p02786 (python)

Fixed submission:
h = int(input())
score = 0
fak = 1
while h>1:
	score += fak
	h = int(h/2)
	fak *= 2
print(score+fak)

Buggy submission (verdict: Runtime Error):
h = input()
score = 0
fak = 1
while h>1:
	score += fak
	h = int(h/2)
	fak *= 2
print(score+1)

Buggy submission (verdict: Runtime Error):
h = input()
score = 0
fak = 1
while h>1:
	score += fak
	h //= 2
	fak *= 2
print(score+1)
Problem p02788 (python)

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

D = True

pos = []
pos1 = []

for i in range(n):
	x, h = map(int, input().split())
	pos.append((x, h))

pos.sort(key=lambda x: x[0])

bombs = 0
damage = 0
y, z = 0, 0


while y < n:
	x0 = pos[y][0]
	try:
		x1 = pos1[z][0]
	except IndexError:
		x1 = 1e16
	if x0 <= x1:
		health = pos[y][1]
		health -= damage
		number = max(0, (health-1) // a + 1)
		bombs += number
		damage += number*a
		pos1.append((x0+2*d, number*a))
		y+=1
	else:
		damage -= pos1[z][1]
		z += 1
	

print(bombs)

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <map>
typedef int64_t int64;
using namespace std;



int main() {
	int64 n, d, a;
	cin >> n;
	cin >> d;
	cin >> a;
	map<int64, pair<int64, int64>> m;
	for (int64 i=0; i<n; i++) {
		int64 b, c;
		cin >> b;
		cin >> c;
		m[b] = {c, 0};
	}
	int64 destroy = 0;
	int64 bombs = 0;

	for (auto [x, values]: m) {
		auto [health, update] = values;
		health -= destroy;
		if (health > 0) {
			int64 times = (health-1) / a + 1;
			bombs += times;
			if (d==0) continue;
			destroy += times*a;
			if (m.count(x+2*d)) m[x+2*d] = {m[x+2*d].first, times};
			else m[x+2*d] = {0, times};	
		}
		destroy -= update*a;
	}
	cout << bombs;
	return 0;
			
}
Problem p02791 (python)

Fixed submission:
n = int(input())
l = list(map(int, input().split()))
           
score = 0
m = 1e17
for i in l:
	if i<m:
		m = i
		score += 1
	
print(score)

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
  	l = list(map(int, input().split()))
   
print(min(n, max(0, min(l)-1)))
Problem p02801 (python)

Fixed submission:
print(chr(1+ord(input())))

Buggy submission (verdict: Runtime Error):
import time

# success
# https://atcoder.jp/contests/abc151/tasks/abc151_e
# https://blogarithms.github.io/articles/2019-01/fermats-theorem


MOD =  1000000007
MOD2 = 1000000005
MAX = 100001

# facs = [1 for _ in range(MAX)]



"""for i in range(1, MAX):
	facs[i] = (facs[i-1] * i) % MOD"""


def get_facs(n, k):
	if k<n-k:
		k = n-k
	r = 1
	for i in range(k+1, n+1):
		r *= i
	for i in range(2, n-k+1):
		r /= i
	return r

def choose(n, k):

	if k==0 or n==k:
		return 1
	if n==0:
		return 0
	if k>n:
		return 0
	return get_facs(n, k)



def main():
	N, K = map(int, input().split())
	numbers = sorted(map(int, input().split()))
	if K==1:
		return 0
	if K==N:
		return abs(numbers[0] - numbers[-1])

	score = 0
	for i, x in enumerate(numbers):
		score += ((choose(i, K-1) - choose(N-1-i, K-1)) * x)

	return int(score%MOD)
	
	
print(main())

Buggy submission (verdict: Runtime Error):
print(chr(ord(input())+1)
Problem p02802 (python)

Fixed submission:
n, m = map(int, input().split())
yes = [False for i in range(n)]
negative = [0 for i in range(n)]
score = [0 for i in range(n)]
for i in range(m):
	problem, s = input().split()
	p = int(problem)
	if s=="AC" and not yes[p-1]:
		yes[p-1] = True
		score[p-1] = negative[p-1]
	else:
		negative[p-1] += 1
	

print(sum(yes), sum(score))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
score = [(False, 0) for i in range(n)]
for i in range(m):
	problem, s = input().split()
	p = int(problem)-1
	if not score[p][0]:
		if s=="AC":
			score[p][0] = True
		else:
			score[p][1] += 1
	

print(sum(i[0] for i in score), sum(j if i else 0 for i, j in score))
Problem p02803 (python)

Fixed submission:
def main():
	maximum = 0
	global h, w
	h, w = map(int, input().split())
	street = [[None for i in range(w)] for j in range(h)]
	for y in range(h):
		line = input()
		for x, z in enumerate(line):
			street[y][x] = True if z=="." else False
	for y in range(h):
		for x in range(w):
			if get(x, y, street):
				r = bfs(x, y, [i[::] for i in street])
				# print(f"x: {x} and y: {y} and r: {r} and max: {maximum}")
				# print(street)
				maximum = max(maximum, r)
	print(maximum)
	return		

def get(x, y, l):
	return l[y][x]

def setter(x, y, z, l):
	l[y][x] = z

def bfs(x, y, visited):
	queue = [(x, y, 0)]
	maximum = 0
	setter(x, y, False, visited)
	for x, y, d in queue:
		if x>0 and get(x-1, y, visited):
			queue.append((x-1, y, d+1))
			setter(x-1, y, False, visited)
		if x<w-1 and get(x+1, y, visited):
			queue.append((x+1, y, d+1))
			setter(x+1, y, False, visited)
		if y>0 and get(x, y-1, visited):
			queue.append((x, y-1, d+1))
			setter(x, y-1, False, visited)
		if y<h-1 and get(x, y+1, visited):
			queue.append((x, y+1, d+1))
			setter(x, y+1, False, visited)
		maximum = max(maximum, d)
	return maximum



main()

Buggy submission (verdict: Runtime Error):
def main():
	maximum = 0
	global h, w
	h, w = map(int, input().split())
	street = [[None for i in range(w)] for j in range(h)]
	for y in range(h):
		line = input()
		for x, z in enumerate(line):
			street[y][x] = True if z=="." else False
	for y in range(h):
		for x in range(w):
			if get(x, y, street):
				r = bfs(x, y, [i[::] for i in street])
				print(f"x: {x} and y: {y} and r: {r} and max: {maximum}")
				print(street)
				maximum = max(maximum, r)
	print(maximum)
	return		

def get(x, y, l):
	return l[y][x]

def setter(x, y, z, l):
	l[y][x] = z

def bfs(x, y, visited):
	queue = [(x, y, 0)]
	maximum = 0
	for x, y, d in queue:
		if x>0 and get(x-1, y, visited):
			queue.append((x-1, y, d+1))
			setter(x-1, y, False, visited)
		if x<w-1 and get(x+1, y, visited):
			queue.append((x+1, y, d+1))
			setter(x+1, y, False, visited)
		if y>0 and get(x, y-1, visited):
			queue.append((x, y-1, d+1))
			setter(x, y-1, False, visited)
		if y<h-1 and get(x, y+1, visited):
			queue.append((x, y+1, d+1))
			setter(x, y+1, False, visited)
		maximum = max(maximum, d)
	return maximum



main()
Problem p02705 (python)

Fixed submission:
import math
a = int(input())
print(2*math.pi*a)

Buggy submission (verdict: Runtime Error):

import math
a = int(input())
print(2*math.py:a)
Problem p02705 (python)

Fixed submission:
print(int(input()) * 6.28)

Buggy submission (verdict: Runtime Error):
print(int(input()) * 6.28

Buggy submission (verdict: Runtime Error):
2 * R * (3 + 1/10 + 4/100)

Buggy submission (verdict: Runtime Error):
import math
2 * R * math.pi
Problem p02730 (python)

Fixed submission:
input_str = input().strip()

def main():
  N = len(input_str)
  input_str_part1 = input_str[:int((N-1)/2)]
  input_str_part2 = input_str[int((N+3)/2)-1:]
  flag0 = input_str == input_str[::-1]
  flag1 = input_str_part1 == input_str_part1[::-1]
  flag2 = input_str_part2 == input_str_part2[::-1]
  if flag0 * flag1 * flag2:
    print("Yes")
  else:
      print("No")
  return

if __name__ == "__main__":
  main()

Buggy submission (verdict: Runtime Error):
input_str = input().strip()

def main():
  N = len(input_str)
  input_str_part1 = input_str[:int((N-1)/2)]
  input_str_part2 = input_str[int((N+3)/2)-1:]
  flag0 = input_str == input_str[::-1]
  flag1 = input_str_part1 == input_str_part1[::-1]
  flag2 = input_str_part2 == input_str_part2[::-1]
  if flag0 * flag1 * flag2:
    print("Yes")
  else:
	print("No")
  return

if __name__ == "__main__":
  main()
Problem p02727 (python)

Fixed submission:
X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
p.sort(reverse = True)
q.sort(reverse = True)
a = p[:X] + q[:Y] + r
a.sort(reverse = True)
print(sum(a[:X+Y]))

Buggy submission (verdict: Runtime Error):
X,Y,A,B,C = map(int,input().split())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
r = list(map(int,input().split()))
L = p + r
L.sort(reverse = True)
ans = 0
for i in range(X):
  ans += int(L[i])
for i in range(X):  
  L.remove(L[i])
set(L) = set(L)-set(p)  
M = q + list(L)
M.sort(reverse = True)
abc = 0  
for i in range(Y):
  abc += int(M[i])
print(ans + abc)
Problem p02945 (python)

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

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
if A+B >= A-B and A+B >= A*B:
  print(A+B)
elif A-B >= A+B and A-B >= A*B:
  print(A-B)
else:
  print(A*B)
Problem p03060 (python)

Fixed submission:
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = 0
for i in range(N):
  if V[i]-C[i] > 0:
    ans += V[i]-C[i]
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
ans=0
a=V[i]-C[i]
for i in range(N):
  if a>0:
    ans+=a
print(ans)
Problem p03106 (python)

Fixed submission:
A,B,K = map(int,input().split())
L = []
for i in range(1,101):
  if A % i == 0 and B % i == 0:
    L.append(i)
S = sorted(L, reverse = True)
print(S[K-1])

Buggy submission (verdict: Runtime Error):
N,M = map(int,input().split())
A = list(map(int,input().split()))
A.sort(reverse = True)
if A[M-1] < sum(A)/4/M:
  print("No")
else:
  print("Yes")
Problem p03211 (python)

Fixed submission:
S = input()
L = []
for i in range(len(S)-2):
  x = int(S[i:i+3])
  y = abs(753-x)
  L.append(y)
print(min(L))

Buggy submission (verdict: Runtime Error):
S = int(input())
L = []
for i in range(len(S)-2):
  x = int(S[i:i+3])
  y = abs(753-x)
  L.append(y)
print(min(L))
Problem p02705 (python)

Fixed submission:
R = int(input())
print(2*R*3.14159265)

Buggy submission (verdict: Runtime Error):
import math.pi as pi
r  = input()
print(r*r*pi)
Problem p03050 (python)

Fixed submission:
import math

N = int(input())

total = 0
   
if N != 1:        
    for i in range(1,int(math.sqrt(N)+1)):
        amari = i
        if N % amari == 0:
            k = N // amari - 1
            if amari == N % k:
                total += N//amari - 1
        #print(amari)

print(total)

Buggy submission (verdict: Runtime Error):
import math

N = int(input())

total = 0
   
for i in range(1,int(math.sqrt(N)+1)):
    amari = i
    if N % amari == 0:
        k = N // amari - 1
        if amari == N % k:
            total += N//amari - 1
        #print(amari)

print(total)
Problem p03110 (python)

Fixed submission:
N = int(input())
total = 0
for i in range(N):
    x,u = input().split()
    if u == "JPY":
        total += int(x)
    else:
        total += float(x)*380000

print(total)

Buggy submission (verdict: Runtime Error):
N = int(input())
total = 0
for i in range(N):
    x,u = input().split()
    if u == "JPY":
        total += int(x)
    else:
        total += int(x)*380000

print(total)
Problem p03289 (python)

Fixed submission:
S = input()

if S[0] == "A":
    A = True
else:
    A = False

countC = 0
for i in range(2,len(S)-1):
    if S[i] == "C":
        countC += 1
        place = i
        
if countC == 1:
    C = True
else:
    C = False
    


'''
if C:
    for i in range(1,place):
        lower = S[i].islower()
        if lower == False:
            B = False
    for i in range(place+1,len(S)):
        lower = S[i].islower()
        if (lower):
            B = False
'''

B = False

new = ""
if C:
    for i in range(1,place):
        new = new + S[i]
    for i in range(place+1,len(S)):
        new = new + S[i]

    if new.islower():
        B = True
    else:
        B = False

            
if (A and B and C):
    print("AC")
else:
    print("WA")

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

if S[0] == "A":
    A = True
else:
    A = False

small = "abcdefghijklmnopqrstuvwxyz"
countC = 0
for i in range(2,len(S)-1):
    if S[i] == "C":
        countC += 1
        place = i
        
if countC == 1:
    C = True
else:
    C = False

s = True
for i in range(1,len(S)):
    if i != place and S[i] not in small:
        s = False



if (A and C and s):
    print("AC")
else:
    print("WA")

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

if S[0] == "A":
    A = True
else:
    A = False

small = "abcdefghijklmnopqrstuvwxyz"
countC = 0
for i in range(2,len(S)-1):
    if S[i] == "C":
        countC += 1
        place = i
if countC == 1:
    C = True
else:
    C = False

s = True
for i in range(1,len(S)):
    if i != place:
        if S[i] not in small:
            s = False



if (A and C and s):
    print("AC")
else:
    print("WA")

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

if S[0] == "A":
    A = True
else:
    A = False

small = "abcdefghijklmnopqrstuvwxyz"
countC = 0
for i in range(2,len(S)-3+1):
    if S[i] == "C":
        countC += 1
        place = i
if countC == 1:
    C = True
else:
    C = False

s = True
for i in range(1,len(S)):
    if i != place:
        if S[i] not in small:
            s = False



if (A and C and s):
    print("AC")
else:
    print("WA")
Problem p03352 (python)

Fixed submission:
import math

x =input()
X = int(x)

if X == 1:
    output = 1
    print(output)
else:
    mylist = []
    for i in range(2,X+1):
        bekijo = i
        count = 0
        while bekijo <= X:
            bekijo = bekijo * i
            count = count +1
        if count > 1:
            mylist.append(int(bekijo/i))
    print(max(mylist))

Buggy submission (verdict: Runtime Error):
import math

X =input()

if X == 1:
    output = 1
    print(output)
else:
    mylist = [1]
    biggest = int(math.sqrt(X))
    for i in range(2,biggest):
        bekijo = i
        while bekijo <= X:
            bekijo = bekijo * i
        mylist[i] = bekijo
        #print(mylist[i])
    print(max(mylist))

Buggy submission (verdict: Runtime Error):
import math
X =input()
print(X)
if X == 1:
    output = 1
    print(output)
else:
    mylist = [1]
    biggest = int(math.sqrt(X))
    for i in range(2,biggest):
        bekijo = i
        while bekijo <= X:
            bekijo = bekijo * i
            mylist[i] = bekijo
        #print(mylist[i])
    print(max(mylist))
Problem p03361 (python)

Fixed submission:
H,W = (int(i) for i in input().split())

goal = []
for i in range(H):
    goal.append(input())

canComplete = True

for row in range(H):
    for column in range(W):
        above = row - 1
        bottom = row + 1
        left = column - 1
        right = column + 1
        
        if goal[row][column] == "#":
            if above >= 0 and goal[above][column] == "#":
                continue
            elif bottom < H and goal[bottom][column] == "#":
                continue
            elif left >= 0 and goal[row][left] == "#":
                continue
            elif right < W and goal[row][right] == "#":
                continue
            else:
                canComplete = False
                break

if canComplete:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
H,W = (int(i) for i in input().split())

goal = []
for i in range(H):
    goal.append(input())

canComplete = True

for row in range(W):
    for column in range(H):
        above = row - 1
        bottom = row + 1
        left = column - 1
        right = column + 1
        
        if goal[row][column] == "#":
            if above >= 0 and goal[above][column] == "#":
                continue
            elif bottom < H and goal[bottom][column] == "#":
                continue
            elif left >= 0 and goal[row][left] == "#":
                continue
            elif right < W and goal[row][right] == "#":
                continue
            else:
                canComplete = False
                break

if canComplete:
    print("Yes")
else:
    print("No")
Problem p03487 (python)

Fixed submission:
import bisect

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

a.sort()
pullout = 0
#print(a)

for i in list(set(a)):
    numi = bisect.bisect_right(a,i) - bisect.bisect_left(a,i)
    #print(i,numi)
    if numi == 0 or numi == i:
        continue
    elif numi > i:
        pullout += numi - i
    elif numi < i:
        pullout += numi

print(pullout)

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

a.sort()
for i in range(N):
    if
Problem p03502 (python)

Fixed submission:
N = input()

fx = 0
length = len(N)
for i in range(length):
    fx = fx + int(N[i])

if int(N)%fx == 0:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
Nchar = input()
length = len(Nchar)

N = int(Nchar)
tmp = N
fx = 0
for i in range(length):
    kazu = int(tmp*(0.1**(length-i)))
    fx = fx + kazu
    tmp = tmp - kazu

if(N%fx == 0):
    print("Yes")
else:
    print("No")
Problem p03574 (python)

Fixed submission:
H,W = (int(i) for i in input().split())

#囲い付きで入力　上下左右斜めを確認するとき用
firstline = "*"*(W+2)
bomb = [firstline]
for i in range(H):
    line = "*" + input() + "*"
    bomb.append(line)
lastline = "*"*(W+2)
bomb.append(lastline)

#答えの配列
answer = [[0]*W for i in range(H)]
for i in range(H):
    for j in range(W):
        if bomb[i+1][j+1] == "#":
            answer[i][j] = "#"
        else:
            if bomb[i+1+1][j+1+1] == "#":
                answer[i][j] += 1
            if bomb[i+1+1][j+1+0] == "#":
                answer[i][j] += 1
            if bomb[i+1+1][j+1-1] == "#":
                answer[i][j] += 1
            if bomb[i+1+0][j+1+1] == "#":
                answer[i][j] += 1
            if bomb[i+1+0][j+1-1] == "#":
                answer[i][j] += 1
            if bomb[i+1-1][j+1+1] == "#":
                answer[i][j] += 1
            if bomb[i+1-1][j+1+0] == "#":
                answer[i][j] += 1
            if bomb[i+1-1][j+1-1] == "#":
                answer[i][j] += 1

#print(answer)
for i in range(H):
    tmp = ""
    for j in range(W):
        tmp += str(answer[i][j])
    print(tmp)

Buggy submission (verdict: Runtime Error):
H,W = (int(i) for i in input().split())

original = [input() for i in range(H)]
sujimaru = [[0 for i in range(W+2)for j in range(H+2)]]

for j in range(H):
    for i in range(W):
        if(original[i][j] == "#"):
            sujimaru[i][j] += 1
            sujimaru[i+1][j] += 1
            sujimaru[i+2][j] += 1
            sujimaru[i][j+1] += 1
            sujimaru[i+2][j+1] += 1
            sujimaru[i][j+2] += 1
            sujimaru[i+1][j+2] += 1
            sujimaru[i+2][j+2] += 1

d = [""]*H
for j in range(H):
    for i in range(W):
        if(original[j][i] == "."):
            d[j] += str(sujimaru[j+1][i+1])
        else:
            d[j] += "#"

for s in d:
    print(d)

Buggy submission (verdict: Runtime Error):
H,W = (int(i) for i in input().split())

original = [input() for i in range(H)]
sujimaru = [[0 for i in range(W+2)for j in range(H+2)]]

for j in range(H):
    for i in range(W):
        if(original[i][j] == "#"):
            sujimaru[i][j] += 1
            sujimaru[i+1][j] += 1
            sujimaru[i+2][j] += 1
            sujimaru[i][j+1] += 1
            sujimaru[i+2][j+1] += 1
            sujimaru[i][j+2] += 1
            sujimaru[i+1][j+2] += 1
            sujimaru[i+2][j+2] += 1

d = [""]*H
for j in range(H):
    for i in range(W):
        if(original[j][i] == "."):
            d[j] += str(sujimaru[j+1][i+1])
        else:
            d[j] += "#"

for s in d:
    print(s)