Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int,input().split()))
gcd_list = []
min_element = min(A)
max_element = max(A)

def gcd(a, b):
    while a % b != 0:
        b_next = a % b
        a = b
        b = b_next
    return b

for i in range(n):
    y = A[i]
    for j in range(min_element, max_element + 1):
        A[i] = j
        x = A[0]
        for k in range(1, n):
            x = gcd(x, A[k])
            if x == 1:
                break
        gcd_list.append(x)
    A[i] = y
print(max(gcd_list))


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

def gcd(a, b):
    a, b = max(a, b), min(a, b)
    if b == 0:
        return a
    if a % b == 0:
        return b
    return gcd(b, a%b)

L = [0]; R = [0]
for i in range(N-1):
    L.append(gcd(L[i], A[i]))
    R.append(gcd(R[i], A[N-1-i]))

maxGCD = 1
for j in range(N):
    maxGCD = max(maxGCD, gcd(L[j], R[N-j-1]))
print(maxGCD)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int,input().split()))
gcd_list = []
min_element = min(A)
max_element = max(A)

def gcd(a, b):
    while a % b != 0:
        b_next = a % b
        a = b
        b = b_next
    return b

for i in range(n):
    y = A[i]
    for j in range(min_element, max_element + 1):
        A[i] = j
        x = A[0]
        for k in range(1, n):
            x = gcd(x, A[k])
        gcd_list.append(x)
    A[i] = y
print(max(gcd_list))


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

def gcd(a, b):
    a, b = max(a, b), min(a, b)
    if b == 0:
        return a
    if a % b == 0:
        return b
    return gcd(b, a%b)

L = [0]; R = [0]
for i in range(N-1):
    L.append(gcd(L[i], A[i]))
    R.append(gcd(R[i], A[N-1-i]))

maxGCD = 1
for j in range(N):
    maxGCD = max(maxGCD, gcd(L[j], R[N-j-1]))
print(maxGCD)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int,input().split()))
gcd_list = []
max_element = max(A)

def gcd(a, b):
    while a % b != 0:
        b_next = a % b
        a = b
        b = b_next
    return b

for i in range(n):
    y = A[i]
    for j in range(1, max_element + 1):
        A[i] = j
        x = A[0]
        for k in range(1, n):
            x = gcd(x, A[k])
        gcd_list.append(x)
    A[i] = y
print(max(gcd_list))


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

def gcd(a, b):
    a, b = max(a, b), min(a, b)
    if b == 0:
        return a
    if a % b == 0:
        return b
    return gcd(b, a%b)

L = [0]; R = [0]
for i in range(N-1):
    L.append(gcd(L[i], A[i]))
    R.append(gcd(R[i], A[N-1-i]))

maxGCD = 1
for j in range(N):
    maxGCD = max(maxGCD, gcd(L[j], R[N-j-1]))
print(maxGCD)
Buggy python submission (verdict: Runtime Error):
N = int(input())
str = list(input())
K = int(input())
str_list = list(str)
for i in range(N):
    if str[i] != str[K]:
        str[i] = '*'
str_changed = ''.join(str)
print(str_changed)


Fixed submission:
a, b, c = map(int, input().split())
if a > c and c > b:
    print('Yes')
elif b > c and c > a:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
str = str(input())
K = int(input())
str_list = list(str)
for i in range(N):
    if str_list[i] != str_list[int(K)]:
        str_list[i] = '*'
str_changed = ''.join(str_list)
print(str_changed)

Fixed submission:
N = int(input())
str = list(input())
K = int(input()) - 1
str_list = list(str)
for i in range(N):
    if str[i] != str[K]:
        str[i] = '*'
str_changed = ''.join(str)
print(str_changed)

Buggy python submission (verdict: Runtime Error):
N = int(input())
str = str(input())
K = int(input())
str_list = list(str)
for i in range(N):
    if str_list[i] != str_list[int(K)]:
        str_list[i] = '*'
str_changed = ''.join(str_list)
print(str_changed)

Fixed submission:
N = int(input())
str = list(input())
K = int(input()) - 1
str_list = list(str)
for i in range(N):
    if str[i] != str[K]:
        str[i] = '*'
str_changed = ''.join(str)
print(str_changed)

Buggy python submission (verdict: Runtime Error):
N = int(input())
str = str(input())
K = int(input())
str_list = list(str)
for i in range(N):
    if str_list[i] != str_list[int(K)]:
        str_list[i] = '*'
str_changed = ''.join(str_list)
print(str_changed)

Fixed submission:
N = int(input())
str = list(input())
K = int(input()) - 1
str_list = list(str)
for i in range(N):
    if str[i] != str[K]:
        str[i] = '*'
str_changed = ''.join(str)
print(str_changed)
Buggy python submission (verdict: Runtime Error):
from math import ceil
time_list = [int(input()) for i in range(5)]
sum_list = []
time_list_0 = []
for i in range(5):
    time_list_0[i] = ceil(time_list[i] / 10) * 10
for j in range(5):
    if time_list[j] == 0:
        sum_list[j] = sum(time_list_0)
    else:
        sum_list[j] = sum(time_list_0) - 10 + time_list[j] % 10
print(min(sum_list))


Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e - a > k:
  	print(':(')
else:
  	print('Yay!')

Buggy python submission (verdict: Runtime Error):
a, b, c, d, e, k = map(int,input().split())
if e - a > k:
  	print(':(')
else:
  	print('Yay!')

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e - a > k:
  	print(':(')
else:
  	print('Yay!')

Buggy python submission (verdict: Runtime Error):
a = input()
b = input()
c = input()
d = input()
e = input()
k = input()
if e - a > k:
  	print(':(')
else:
  	print('Yay!')


Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e - a > k:
  	print(':(')
else:
  	print('Yay!')

Buggy python submission (verdict: Runtime Error):
a = input()



e = input()
k = input()
if e - a > k:
  	print(':(')
else:
  	print('Yay!')

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
if e - a > k:
  	print(':(')
else:
  	print('Yay!')
Buggy python submission (verdict: Runtime Error):
from math import ceil
time_list = [int(input()) for i in range(5)]
sum_list = []
time_list_0 = []
for i in range(5):
    time_list_0[i] = ceil(time_list[i] / 10) * 10
for j in range(5):
    if time_list[j] == 0:
        sum_list[j] = sum(time_list_0)
    else:
        sum_list[j] = sum(time_list_0) - 10 + (time_list[j] % 10)
print(min(sum_list))


Fixed submission:
from math import ceil
time_list = [int(input()) for i in range(5)]
sum_list = []
time_list_0 = []
for i in range(5):
    time_list_0.append(ceil(time_list[i] / 10) * 10)
for j in range(5):
    if time_list[j] % 10 == 0:
        sum_list.append(sum(time_list_0))
    else:
        sum_list.append(sum(time_list_0) - 10 + (time_list[j] % 10))
print(min(sum_list))

Buggy python submission (verdict: Runtime Error):
from math import ceil
time_list = [int(input()) for i in range(5)]
sum_list = []
time_list_0 = []
for i in range(5):
    time_list_0[i] = ceil(time_list[i] / 10) * 10
for j in range(5):
    if time_list[i] == 0:
        sum_list[i] = sum(time_list_0)
    else:
        sum_list[i] = sum(time_list_0) - 10 + time_list[i] % 10
print(min(sum_list))


Fixed submission:
from math import ceil
time_list = [int(input()) for i in range(5)]
sum_list = []
time_list_0 = []
for i in range(5):
    time_list_0.append(ceil(time_list[i] / 10) * 10)
for j in range(5):
    if time_list[j] % 10 == 0:
        sum_list.append(sum(time_list_0))
    else:
        sum_list.append(sum(time_list_0) - 10 + (time_list[j] % 10))
print(min(sum_list))

Buggy python submission (verdict: Runtime Error):
from math import ceil
time_list = [int(input()) for i in range(5)]
sum_list = []
time_list_0 = []
for i in range(5):
    time_list_0[i] = ceil(time_list[i] / 10) * 10
for j in range(5):
    sum_list[i] = sum(time_list_0) - 10 + time_list[i] % 10
print(min(sum_list))


Fixed submission:
from math import ceil
time_list = [int(input()) for i in range(5)]
sum_list = []
time_list_0 = []
for i in range(5):
    time_list_0.append(ceil(time_list[i] / 10) * 10)
for j in range(5):
    if time_list[j] % 10 == 0:
        sum_list.append(sum(time_list_0))
    else:
        sum_list.append(sum(time_list_0) - 10 + (time_list[j] % 10))
print(min(sum_list))
Buggy python submission (verdict: Runtime Error):
n = int(input())
cap_list = [int(input()) fot i in range(5)]
min_cap = min(cap_list)
c = (n + min_cap - 1) // min_cap
print(c + 4)


Fixed submission:
n = int(input())
cap_list = [int(input()) for i in range(5)]
min_cap = min(cap_list)
c = (n + min_cap - 1) // min_cap
print(c + 4)
Buggy python submission (verdict: Time Limit Exceeded):
n, q = map(int,input().split())
S = input()
L = []
R = []
for i in range(q):
    l, r = [int(i) for i in input().split()]
    L.append(l)
    R.append(r)
for i in range(q):
    ans = S[L[i]-1:R[i]].count("AC")

    print(ans)


Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
	t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
	l, r = map(int, input().split())
	print(t[r-1] - t[l-1])

Buggy python submission (verdict: Runtime Error):
n, q = map(int,input().split())
S = list(input())
L = []
R = []
for i in range(q):
    l, r = [int(i) for i in input().split()]
    L.append(l)
    R.append(r)
for i in range(q):
    S_0 = ""
    for k in range(L[i], R[i] + 1):
        S_0 += S[k]
    print(S_0.count("AC"))


Fixed submission:
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
	t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)
for i in range(Q):
	l, r = map(int, input().split())
	print(t[r-1] - t[l-1])
Buggy python submission (verdict: Runtime Error):
n, m, c = map(int,input().split())
B = list(map(int,input().split()))
A = [input().split() for l in range(n)]
cnt = 0
for i in range(n):
    sum = 0
    for j in range(m):
        sum += int(A[i][j]) * B[j]
    if sum + c > 0:
        cnt += 1
print(cnt)


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

white_cells_int = H * W - ((h * W) + (w * H) - (h * w))
print(str(white_cells_int))

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

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


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

white_cells_int = H * W - ((h * W) + (w * H) - (h * w))
print(str(white_cells_int))
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
*storeList = map(int, open().read().split())
ans = 0
for a, b in sorted(zip(storeList[::2], storeList[1::2])):
    ans += a * min(m, b) ; m = max(0, m - b)
print(ans)


Fixed submission:
n, m = map(int, input().split())
tupList = []
for i in range(n):
    a, b = [int(i) for i in input().split()]
    tupList.append((a, b))

def tupVal(tup):
    return tup[0]
tupList.sort(key = tupVal)
ans = 0
for i in tupList:
    if m >= i[1]:
        ans += i[0] * i[1]
        m -= i[1]
    else:
        ans += i[0] * m
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import deque

N, A, B, C = map(int, input().split())
L = [int(input()) for _ in range(N)]
minMP = 10**5

p = deque()
p.append([-1] * len(L))
while p:
    stats = p.pop()
    stats = list(stats)
    a, b, c = 0, 0, 0
    MP = 0
    cntA = 0; cntB = 0; cntC = 0
    for i in range(N):
        if stats[i] == 1:
            a += L[i]
            cntA += 1
        elif stats[i] == 2:
            b += L[i]
            cntB += 1
        elif stats[i] == 3:
            c += L[i]
            cntC += 1

    if cntA >= 1 and cntB >= 1 and cntC >= 1:
        MP += abs(A - a) + abs(B - b) + abs(C - c) + 10 * (cntA+cntB+cntC-3)
        minMP = min(minMP, MP)

    if not -1 in stats:
        continue
    j = stats.index(-1)
    for k in range(4):
        stats[j] = k
        newStats = tuple(stats)
        p.append(newStats)
        print(newStats)
print(minMP)
input()


Fixed submission:
from collections import deque

N, A, B, C = map(int, input().split())
L = [int(input()) for _ in range(N)]
minMP = 10**5

p = deque()
p.append([-1] * len(L))
while p:
    stats = p.pop()
    stats = list(stats)
    a, b, c = 0, 0, 0
    MP = 0
    cntA = 0; cntB = 0; cntC = 0
    for i in range(N):
        if stats[i] == 1:
            a += L[i]
            cntA += 1
        elif stats[i] == 2:
            b += L[i]
            cntB += 1
        elif stats[i] == 3:
            c += L[i]
            cntC += 1

    if cntA >= 1 and cntB >= 1 and cntC >= 1:
        MP += abs(A - a) + abs(B - b) + abs(C - c) + 10 * (cntA+cntB+cntC-3)
        minMP = min(minMP, MP)

    if not -1 in stats:
        continue
    j = stats.index(-1)
    for k in range(4):
        stats[j] = k
        newStats = tuple(stats)
        p.append(newStats)

print(minMP)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
like_set = {}
for i in range(1, M+1):
    like_set.add(i)
for i in range(N):
    like = input().split()
    like = set(like[1:])
    like_set = like_set & like
print(len(like_set))


Fixed submission:
N, M = map(int, input().split())
like_set = {0}
for i in range(1, M+1):
    like_set.add(i)
for i in range(N):
    like = list(map(int,input().split()))
    like = set(like[1:])
    like_set = like_set & like
print(len(like_set))

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
like_set = {}
for i in range(1,M+1):
    like_set = like_set | {i}
for i in range(N):
    k_a = input().split()
    a = k_a[1:]
    like_set = set(a) & like_set
print(len(like_set))


Fixed submission:
N, M = map(int, input().split())
like_set = {0}
for i in range(1, M+1):
    like_set.add(i)
for i in range(N):
    like = list(map(int,input().split()))
    like = set(like[1:])
    like_set = like_set & like
print(len(like_set))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = list(map(int, input().split()))

res = 0; i = 0
while True:
    if max(H) == 0:
        break

    while i < N:
        if H[i] == 0:
            i += 1
        else:
            res += 1
            while i < N and H[i] > 0:
                H[i] -= 1
                i += 1
print(res)


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

def flower(lst=H):
    if not lst:
        return 0
    ans = min(lst)
    lst = list(map(lambda x:x-ans, lst))
    indexes = [-1]
    indexes.extend([i for i, j in enumerate(lst) if j == 0])
    m = len(indexes)
    indexes.append(len(lst))
    for i in range(m):
        ans += flower(lst[indexes[i]+1:indexes[i+1]])
    return ans

print(flower())

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = list(map(int, input().split()))

res = 0; i = 0
while True:
    if max(H) == 0:
        break

    while i < N:
        if H[i] == 0:
            i += 1
        else:
            res += 1
            while i < N and H[i] > 0:
                H[i] -= 1
                i += 1
print(res)


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

def flower(lst=H):
    if not lst:
        return 0
    ans = min(lst)
    lst = list(map(lambda x:x-ans, lst))
    indexes = [-1]
    indexes.extend([i for i, j in enumerate(lst) if j == 0])
    m = len(indexes)
    indexes.append(len(lst))
    for i in range(m):
        ans += flower(lst[indexes[i]+1:indexes[i+1]])
    return ans

print(flower())
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
H = list(map(int, input().split()))
INF = float('inf')
dp = [INF]*N
dp[0] = 0

for i in range(N):
    for j in range(1, K+1):
        if i+j > N-1:
            break
        dp[i+j] = min(dp[i+j], dp[i]+abs(H[i+j]-H[i]))
print(dp[N-1])


Fixed submission:
N, K = map(int, input().split())
H = list(map(int, input().split()))
INF = float('inf')
dp = [INF]*N
dp[0] = 0

for i in range(N):
    for j in range(1, K+1):
        if i+j > N-1:
            break
        dp[i+j] = min(dp[i+j], dp[i]+abs(H[i+j]-H[i]))
print(dp[N-1])

Buggy python submission (verdict: Runtime Error):
def chmin(a, b):
    if a > b:
        a = b
N, K = map(int,input().split())
dp = [10**5] * (N+K+10)
h = [0] * (N+K+10)
for i in range(N):
    h[i] = int(input())
for i in range(N):
    for j in range(1, K+1):
        dp[i+j] = chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]))
print(dp[N-1])


Fixed submission:
N, K = map(int, input().split())
H = list(map(int, input().split()))
INF = float('inf')
dp = [INF]*N
dp[0] = 0

for i in range(N):
    for j in range(1, K+1):
        if i+j > N-1:
            break
        dp[i+j] = min(dp[i+j], dp[i]+abs(H[i+j]-H[i]))
print(dp[N-1])
Buggy python submission (verdict: Runtime Error):
S = input()
diff = 1000
for i in range(len(S)-2):
    S_int = int(S[i:i+3])
    diff = min(diff, abs(753-S_int)
print(diff)


Fixed submission:
S = input()
diff = 1000
for i in range(len(S)-2):
    S_int = int(S[i:i+3])
    diff = min(diff, abs(753-S_int))
print(diff)

Buggy python submission (verdict: Runtime Error):
S = input()
abs = 1000
for i in range(len(S)-2):
    abs = min(abs, abs(753-S[i:i+3]))
print(abs)


Fixed submission:
S = input()
diff = 1000
for i in range(len(S)-2):
    S_int = int(S[i:i+3])
    diff = min(diff, abs(753-S_int))
print(diff)
Buggy python submission (verdict: Runtime Error):
N = int(input())
for i in range(1, 10):
    num = int("i"*3)
    if N <= num:
        print(num)
        break


Fixed submission:
N = int(input())
for i in range(1, 10):
    num = i*111
    if N <= num:
        print(num)
        break
Buggy python submission (verdict: Runtime Error):
k = int(input())
if k % 2 == 0:
    print((k//2)**2)
else:
    print((k//2-1)(k//2))


Fixed submission:
k = int(input())
if k % 2 == 0:
    print((k//2)**2)
else:
    print((k//2+1)*(k//2))
Buggy python submission (verdict: Runtime Error):
S = input()
Slist = list(S)
L = len(S)
if S[0] == 'A' and 'C' in S[1:L-1] and Slist.count('C') == 1:
    Slist.remove('A', 'C')
    flag = True
    for s in Slist:
        if s.isupper():
            flag = False
    if flag:
        print('AC')
        exit()
print('WA')


Fixed submission:
S = input()
Slist = list(S)
L = len(S)
if S[0] == 'A' and 'C' in S[2:L-1] and Slist.count('C') == 1:
    Slist.remove('A')
    Slist.remove('C') 
    flag = True
    for s in Slist:
        if s.isupper():
            flag = False
    if flag:
        print('AC')
        exit()
print('WA')
Buggy python submission (verdict: Runtime Error):
D, G = map(int, input().split())
PC = [tuple(map(int, input().split())) for _ in range(D)]
minNum = 10**3

for i in range(2**D):
    point = 0
    num = 0
    leftOvers = []
    for j in range(D):
        if ((i>>j) & 1):
            num += PC[j][0]
            point += PC[j][1] + 100 * (j+1) * PC[j][0]
        else:
            leftOvers.extend([100*(j+1)]*PC[j][0])

    while point < G:
        point += leftOvers.pop()
        num += 1
    minNum = min(num, minNum)
print(minNum)


Fixed submission:
D, G = map(int, input().split())
PC = [tuple(map(int, input().split())) for _ in range(D)]
minNum = 10**3

for i in range(2**D):
    point = 0
    num = 0
    leftOvers = []
    for j in range(D):
        if ((i>>j) & 1):
            num += PC[j][0]
            point += PC[j][1] + 100 * (j+1) * PC[j][0]
        else:
            leftOvers.extend([100*(j+1)]*PC[j][0])

    while point < G:
        if not leftOvers:
            break
        point += leftOvers.pop()
        num += 1
    minNum = min(num, minNum)
print(minNum)
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = 0
for i in range(1, 10):
    S += N % 10**i

print('Yes' if N % S == 0 else 'No')


Fixed submission:
N = int(input())
S = 0

for i in range(10):
    S += (N % 10**(i+1)) // 10**i 
print('Yes' if N % S == 0 else 'No')
Buggy python submission (verdict: Runtime Error):
a, b = int(input())
print(max(a+b,a-b,a*b))


Fixed submission:
a, b = map(int,input().split())
print(max(a+b,a-b,a*b))
Buggy python submission (verdict: Runtime Error):
S = input()
toppings = S.count(o)
print(700 + toppings*100)


Fixed submission:
S = input()
toppings = S.count("o")
print(700 + toppings*100)
Buggy python submission (verdict: Runtime Error):
n = int(input())
A = list(map(int,input().split()))
A_0 = A.sort(reverse=True)
swt = 0
Alice_point = 0
Bob_point = 0

for i in range(n):
    if swt == 0:
        Alice_point += A_0[i]
        swt = 1
    else:
        Bob_point += A_0[i]
        swt = 0
print(Alice_point - Bob_point)


Fixed submission:
n = int(input())
A = list(map(int,input().split()))
A_0 = A.sort(reverse=True)
swt = 0
Alice_point = 0
Bob_point = 0

for i in range(n):
    if swt == 0:
        Alice_point += A[i]
        swt = 1
    else:
        Bob_point += A[i]
        swt = 0
print(Alice_point - Bob_point)
Buggy python submission (verdict: Runtime Error):
from collections import deque

H, W = map(int,input().split())
S = [list(input()) for _ in range(H)]

q = deque()
q.append((0, 0, 0))
S[0][0] = "#"
while q:
    y, x, cnt = q.popleft()
    for dy, dx in [[1, 1], [-1, 1], [1, -1], [-1, -1]]:
        if 0 <= y + dy < H and 0 <= x + dx < W and S[y + dy][x + dx] == ".":
            q.append(y + dy, x + dx, cnt + 1)
            S[y + dy][x + dx] = "#"
if S[H-1][W-1] == ".":
    print(-1)
else:
    score = H * W - (cnt + 1)
    print(score)


Fixed submission:
from collections import deque

H, W = map(int,input().split())
S = []
wall = 0
for i in range(H):
    s = list(input())
    wall += s.count("#")
    S.append(s)
q = deque()
q.append([0, 0, 0])
S[0][0] = "#"
while q:
    y, x, cnt = q.popleft()
    if y == H-1 and x == W-1:
        break
    for dy, dx in [[1, 0], [-1, 0], [0, 1], [0, -1]]:
        if 0 <= y + dy < H and 0 <= x + dx < W and S[y + dy][x + dx] == ".":
            q.append([y + dy, x + dx, cnt + 1])
            S[y + dy][x + dx] = "#"

if S[H-1][W-1] == ".":
    print(-1)
else:
    score = H * W - (cnt + 1) - wall
    print(score)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
c = a * b
if c % 2 == 0;
	print('Even')
else;
	print('Odd')

Fixed submission:
a, b = map(int, input().split())
c = a * b
if c % 2 == 0:
	print('Even')
else:
	print('Odd')
Buggy python submission (verdict: Runtime Error):
n = int(input())
D = list(map(int,input().split()))
daburi = 0
for i in range(n):
    for j in range(n):
        if i != j and D[i] == D[j]:
            daburi += 1
print(n - daburi)


Fixed submission:
n = int(input())
D = list(input() for i in range(n))
D = set(map(int,D))
print(len(D))

Buggy python submission (verdict: Runtime Error):
n = int(input())
D = list(map(int,input().split()))
daburi = 0
for i in range(n):
    for j in range(n):
        if i != j and D[i] == D[j]
            daburi += 1
print(n - daburi)


Fixed submission:
n = int(input())
D = list(input() for i in range(n))
D = set(map(int,D))
print(len(D))
Buggy python submission (verdict: Time Limit Exceeded):
n, y = map(int,input().split())
ans = 0
for a in range(0, y//10000+1):
    if ans == 0:
        for b in range(0, y//5000+1):
            if ans == 0:
                for c in range(0, y//1000+1):
                    if a+b+c==n and 10000*a + 5000*b + 1000*c == y:
                        print(a, b, c)
                        ans = 1
                        break
    else:
        break
if ans == 0:
    print(-1, -1, -1)


Fixed submission:
n, y = map(int,input().split())
ans = 0
for a in range(0, n+1):
    for b in range(0, n+1):
        c = n - a - b
        if 10000*a + 5000*b + 1000*c == y and c >= 0 and ans ==0:
            print(a, b, c)
            ans = 1
if ans == 0:
    print(-1, -1, -1)
Buggy python submission (verdict: Runtime Error):
s = input()
print(s.count(1))


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

Buggy python submission (verdict: Runtime Error):
s = input()
print(s.count(1))
		
  	


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

Buggy python submission (verdict: Runtime Error):
a, b, c = map(str,input().split())
d = 0
if a == 1:
  	d += 1
if b == 1:
  	d += 1
if c == 1:
  	d += 1
print(d)    
		
  	

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