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

Fixed submission:
# coding: UTF-8
num = (raw_input("")).split()
x = (int(num[0]) * int(num[1]))
y = (int(num[0]) + int(num[1]))
if x == 15:
    print "*"
elif y == 15:
    print "+"
else:
    print "x"

Buggy submission (verdict: Runtime Error):
# coding: UTF-8
num = (raw_input("")).split("")
if (num[0] * num[1]) == 15:
    print "*"
el if (num[0] + num[1]) == 15:
    print "+"
else:
    print "x"

Buggy submission (verdict: Runtime Error):
# coding: UTF-8
num = (raw_input("")).split("")
if num[0]*num[1] == 15:
    print "*"
el if num[0]+num[1] == 15:
    print "+"
else:
    print "x"
Problem p03316 (python)

Fixed submission:
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(a):
    s = 0
    for b in str(a):
        s += int(b)
    if a%s==0:
        return "Yes"
    else:
        return "No"
# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    return int(line)

def main():
    n = readQuestion()
    answer = solve(n)
    print(answer)
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys

# 関数 solve は，もちろん，問題に応じて書き換える
def solve(a):
    s = 0
    for b in str(a):
        s += int(b)
    if a%s==0:
        return "Yes"
    else:
        return "No"
        
# ここから下は，入力・出力形式が同じであれば，変えなくて良い．
def readQuestion():
    line = sys.stdin.readline().rstrip()
    return line

def main():
    n = readQuestion()
    answer = solve(n)
    print(answer)
    
if __name__ == '__main__':
    main()
Problem p03309 (python)

Fixed submission:
import numpy as np
def sadness(l, b):
    sad = 0
    for a in l:
        sad += abs(a - b)
    return int(sad)

if __name__ == '__main__':
    n = int(input())
    l = list(map(int, input().split()))
    if n == 1:
        print('0')
        exit()

    for i in range(len(l)):
        l[i] -= (i+1)
    nl = np.array(l)
    nl.sort()
    m = np.median(nl)

    s = sadness(l, m)
    print("{}".format(s))

Buggy submission (verdict: Runtime Error):
def sadness(l, b):
    sad = 0
    for i, a in enumerate(l, 1):
        sad += abs(a - (b+i))
    return sad

if __name__ == '__main__':
    n = int(input())
    l = list(map(int, input().split()))

    # y=x+b
    # rough estimate
    if len(l) > 5:
        ls = l[0:5]

    diffset = set()
    for i, a in enumerate(l, 1):
        #print("{} {}".format(i, a))
        diff = i-a
        diffset.add(diff)

    s = set()
    for i in range(max(diffset)+1):
        s.add(sadness(l, i*-1))
    if max(diffset) == 0:
        s.add(sadness(l, 0))

    print("{}".format(min(s)))
Problem p03323 (python)

Fixed submission:

A, B = map(int,input().split())
if A<9 and B< 9:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):

A = int(input())
B = int(input())

if A<9 and B< 9:
    print("Yay!")
else:
    print(":(")
Problem p03352 (python)

Fixed submission:
import sys
X = int(input())

lim = int(X**(1/2))

listx =[]

if X == 1 or X == 2 or X ==3:
    print(1)
    sys.exit()

if X >= 4 and X <= 8:
    print(4)
    sys.exit()

for i in range(lim+1):
    if i == 0 or i ==1:
        continue
    a = i
    p = 0
    while a <= X:
        a = i ** p
        p += 1
    listx.append(i**(p-2))

print(max(listx))

Buggy submission (verdict: Runtime Error):

X = int(input())

lim = int(X**(1/2))

listx =[]

for i in range(lim+1):
    if i == 0 or i ==1:
        continue
    a = i
    p = 0
    while a < X:
        a = i ** p
        p += 1
    listx.append(i**(p-2))

print(max(listx))
Problem p03359 (python)

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

if a>b:
    print(a-1)
else:
    print(a)

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

if a>b:
    print(a-1)
else:
    print(a)

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

if a>b:
    print(a-1)
else:
    print(a)
Problem p03363 (python)

Fixed submission:
from math import factorial
from collections import Counter

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

S = [0]

for i in A:
    S.append(S[-1] + i)

count = 0
count_dict = Counter(S)
for i in count_dict.values():
    if i == 1:
        continue
    count += factorial(i) // (factorial(i - 2) * factorial(2))
print(count)

Buggy submission (verdict: Runtime Error):
import collections

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

S = [0]

def comb(n,r):
    if n < 0 or r < 0 or n < r: 
        return 0
    elif n == 0 or r == 0: 
        return 1
    return comb(n-1,r-1)+comb(n-1,r)

for i in A:
    S.append(S[-1] + i)

count = 0
count_dict = collections.Counter(S)
for i in count_dict.values():
    count += comb(i,2)
print(count)
Problem p03379 (python)

Fixed submission:
from statistics import median
N = int(input())
X = list(map(int, input().split()))

Y = X + [0]
Z = X + [10**9 + 1]

ymed = median(Y)
zmed = median(Z)

if ymed == zmed:
    for _ in range(N):
        print(ymed)
else:
    for i in X:
        if i <= ymed:
            print(zmed)
        else:
            print(ymed)

Buggy submission (verdict: Runtime Error):
from statistics import median
N = int(input())
X = list(map(int, input.split()))

Y = X + [0]
Z = X + [10*9+1]

ymed = median(ymed)
zmed = median(zmed)

if ymed == zmed:
  for _ in range(N):
    print(ymed)
else:
  for i in X:
    if i <= ymed:
      print(zmed)
    else:
      print(ymed)
Problem p03387 (python)

Fixed submission:
T = list(map(int, input().split()))
T.sort()
T.reverse()

ope = 0

while T[1]!=T[0]:
    ope += 1
    T[1] += 1
    T[2] += 1
    
while T[2]<T[0]:
    ope += 1
    T[2] += 2

if T[0]==T[2]:
    print(ope)
    
else:print(ope+1)

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

ope = 0

while T[1]!=T[0]:
    ope += 1
    T[1] += 1
    T[2] += 1
    
while T[2]<T[0]:
    ope += 1
    T[2] += 2

if T[0]==T[2]:
    print(ope)
    
else:print(ope+1)T = list(map(int, input().split()))
T.sort()
T.reverse()

ope = 0

while T[1]!=T[0]:
    ope += 1
    T[1] += 1
    T[2] += 1
    
while T[2]<T[0]:
    ope += 1
    T[2] += 2

if T[0]==T[2]:
    print(ope)
    
else:print(ope+1)
Problem p03424 (python)

Fixed submission:
N = int(input())

S = list(map(str,input().split()))

if "Y" in S:
    print("Four")

else:
    print("Three")

Buggy submission (verdict: Runtime Error):

N = int(input())

S = list(map(input().split()))

if "Y" in S:
    print("four")

else:
    print("three")
Problem p03425 (python)

Fixed submission:
import itertools

N = int(input())

S = []
for _ in range(N):
    S.append(input())
    
M, A, R, C, H = [], [], [], [], []

march = ["M","A","R","C","H"]

for s in S:
    top = s[0]
    if top in march:
        if top == "M":
            M.append(s)
        elif top == "A":
            A.append(s)
        elif top == "R":
            R.append(s)
        elif top == "C":
            C.append(s)
        elif top == "H":
            H.append(s)

MARCH = [len(M), len(A), len(R), len(C), len(H)]

if MARCH.count(0) >= 3:
    print(0)

else:
    x = 0
    pattern = list(itertools.combinations(MARCH, 3))
    for i in pattern:
        x += i[0]*i[1]*i[2]
    print(x)

Buggy submission (verdict: Runtime Error):
import itertools

N = int(input())

S = []
for _ in range(N):
    S.append(input())
    
M, A, R, C, H = [], [], [], [], []

march = ["M","A","R","C","H"]

for s in S:
    top = s[0]
    if top in march:
        if top == "M":
            M.append(s)
        elif top == "A":
            A.append(s)
        elif top == "R":
            R.append(s)
        elif top == "C":
            C.append(s)
        elif top == "H":
            H.append(s)

MARCH = [len(M), len(A), len(R), len(C), len(H)]

for i in range(len(MARCH)):
    if MARCH[i] == 0:
        del march[i]

if len(march) <= 2:
    print(0)

else:
    x = 0
    pattern = list(itertools.combinations(MARCH, 3))
    for i in pattern:
        x += i[0]*i[1]*i[2]
    print(x)
Problem p03643 (python)

Fixed submission:
x=input()
print("ABC"+str(x))

Buggy submission (verdict: Runtime Error):
N, M = map(int, raw_input().split())
a={}
b={}
for i in range(M):
    k,l=map(int, raw_input().split())
    if k==1:
        a.add(k)
    if l==N:
        b.add(l)
if a&b:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
N, M = map(int, raw_input().split())
a={}
b={}
for i in range(M):
    k,l=a.append(map(int, raw_input().split()))
    if k==1:
        a.add(k)
    if l==1: 
        b.add(l)
if a&b: 
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Problem p03645 (python)

Fixed submission:
N, M = map(int, input().split())
a=set()
b=set()
for i in range(M):
    k,l=map(int, input().split())
    if k==1:
        a.add(l)
    if l==N:
        b.add(k)
if a&b:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
a={}
b={}
for i in range(M):
    k,l=map(int, input().split())
    if k==1:
        a.add(k)
    if l==N:
        b.add(l)
if a&b:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
N, M = map(int, raw_input().split())
a={}
b={}
for i in range(M):
    k,l=map(int, raw_input().split())
    if k==1:
        a.add(k)
    if l==N:
        b.add(l)
if a&b:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
N, M = map(int, raw_input().split())
a={}
b={}
for i in range(M):
    k,l=map(int, raw_input().split())
    if k==1:
        a.add(k)
    if l==1: 
        b.add(l)
if a&b: 
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
N, M = map(int, raw_input().split())
a={}
b={}
for i in range(M):
    k,l=a.append(map(int, raw_input().split()))
    if k==1:
        a.add(k)
    if l==1: 
        b.add(l)
if a&b: 
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
Problem p03309 (python)

Fixed submission:
from math import ceil, floor
import statistics

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

Ai_i = [0 for i in range(len(A))]

for i in range(len(A)):
    Ai_i[i] = A[i] - (i+1)

n = 5

b_ceil = ceil(sum(Ai_i) / len(Ai_i))

bs = list(range(b_ceil-n, b_ceil+n))

bs = [int(statistics.median(Ai_i))]
abss_ls = [ 0 for i in range(len(bs)) ]
for i in range(len(bs)):
    for j in range(len(Ai_i)):
        abss_ls[i] += abs(Ai_i[j] - bs[i])

min_abs = min(abss_ls)
print(min_abs)

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

Ai_i = []

for i in range(len(A)):
    Ai_i.append(A[i] - (i+1))

#max_abs = 0
#for i in range(len(Ai_i)):
#    if abs(Ai_i[i]) > max_abs:
#        max_abs = abs(Ai_i[i])

min_ = min(Ai_i)
max_ = max(Ai_i)

if min_ <= 0 and max_ <= 0:
    max_ = max([abs(min_), abs(max_)])

if min_ >= 0 and max_ >= 0:
    min_ = min([-abs(min_), -abs(max_)])    

min_abs = float("inf")
min_index = 0
bb = 0

bs = list(range(min_, max_+1))
l = len(bs)

if sum(Ai_i) < 0:
    min_ = 0
elif sum(Ai_i) > 0:
    max_ = 0

for b in range(min_, max_+1):
    abss = []
    for i in range(len(Ai_i)):
        abss.append(abs(Ai_i[i] + b))
    abs_sum = sum(abss)
    if abs_sum < min_abs:
        min_abs = abs_sum
print(min_abs)
Problem p03323 (python)

Fixed submission:
a, b = (int(i) for i in input().split())
if a > 8 or b > 8:
  print(':(')
else:
  print('Yay!')

Buggy submission (verdict: Runtime Error):
N = int(input())
a_li = list(map(int,input().split()))
     
cnt = 0
for i in a_li:
    while i % 2 == 0:
        cnt += 1
        i //= 2
        if i % 2 != 0:
            break
     
print(cnt)
Problem p03325 (python)

Fixed submission:
N = int(input())
a_li = list(map(int,input().split()))
         
cnt = 0
for i in a_li:
    while i % 2 == 0:
        cnt += 1
        i //= 2
        if i % 2 != 0:
            break
        
print(cnt)

Buggy submission (verdict: Runtime Error):
    N = int(input())
    a_li = list(map(int,input().split()))
     
    count = 0
    for i in a_li:
        while i % 2 == 0:
            cnt += 1
            i //= 2
            if i % 2 != 0:
                break
     
    print(count)

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


count = 0
i=0
while(i <= len(a)):
    if a[i] % 2 == 0:
        count += 1
        a[i] = int(a[i] // 2)
        continue
    else:
        i += 1

print(count)

Buggy submission (verdict: Runtime Error):
count = 0
i=0
while(i < len(a)):
    if a[i] % 2 == 0:
        count += 1
        a[i] = int(a[i] // 2)
        continue
    else:
        i += 1

print(count)

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


count = 0



while(True):
    even_count = 0
    even_index = 0
    for i in range(len(i)):
        if a[i] % 2 == 0:
            even_index = i
            even_count += 1

    if even_count >= 2:
        count += 1
        a[even_index] = int(a[even_index] / 2)
    else:
        break

print(count)
Problem p03497 (python)

Fixed submission:
from collections import Counter

n,k = map(int, input().split())
a = input().split()
c = Counter(a)
t = len(c) - k
r = 0

if t > 0:
    serial = c.most_common()[-t:]
    for s in serial:
        r += s[1]

print(r)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n,k = map(int, input().split())
a = input().split()
c = Counter(a)
t = len(c) - k
r = 0

if t > 0:
    serial = c.most_common[-t:]
    for s in serial:
        r += s[1]

print(r)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n,k = map(int, input().split())
a = input().split()
c = Counter(a)
t = len(c) - k
r = 0

if t > 0:
    serial = list(map(list, c.most_common[-t:]))
    for s in serial:
        r += s[1]

print(r)

Buggy submission (verdict: Runtime Error):
from collections import Counter

n,k = map(int, input().split())
a = [input() for _ in range(n)]
c = Counter(a)
t = len(c) - k
r = 0

if t > 0:
    serial = list(map(list, c.most_common[-t:]))
    for s in serial:
        r += s[1]

print(r)
Problem p03647 (python)

Fixed submission:
N, M = map(int,input().split())
route_1 = set()
route_N = set()

for _ in range(M):
    a, b = map(int,input().split())
    if a == 1:
        route_1.add(b)
    elif b == N:
        route_N.add(a)

if route_1&route_N:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

s = sum(A) - N*(N-1)
m = sum(list(map(lambda x: (x+s)//N, A)))
while m > s:
    s = m
    m = sum(list(map(lambda x: (x+s)//N, A)))
else:
    print(m)

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

s = sum(A) - N*(N-1)
m = list(map(lambda x: (x+s)//N, A))
while m > s:
    s = m
    m = list(map(lambda x: (x+s)//N, A))
else:
    print(m)
Problem p03302 (python)

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

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

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

if a+b=15:
    print('+')

elif:
    a*b=15
    print('*')

else:
    print('×')
Problem p03304 (python)

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

s = input().split()
n = int(s[0])
m = int(s[1])
d = int(s[2])

if d==0:
    print(1.0*n*(m-1)/n/n)
else:
    print(2.0*(n-d)*(m-1)/n/n)

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

n = int(input())
m = int(input())
d = int(input())

if n < d:
    print(0.00000)
    exit()

print((m-d)/n)
Problem p03311 (python)

Fixed submission:
import statistics

def f(a, n):
    a2 = [ai - (i+1) for (i,ai) in enumerate(a)]
    b = int(statistics.median(a2))
    
    sadness = sum(abs(ai - b) for ai in a2)
    
    b += 1
    sadness2 = sum(abs(ai - b) for ai in a2)

    
    return min(sadness, sadness2)
    
n = int(input())
a = [int(i) for i in input().split()]
print(f(a, n))

Buggy submission (verdict: Runtime Error):
import math
def f(a, n):
    b = sum(a) / n
    b2 = (1+n) / 2 
    
    res = []
    for x in [b, b2, b-b2, b2-b, ceil(b), ceil(b2), floor(b), floor(b2), ceil(b-b2), ceil(b2 - b), floor(b-b2), floor(b2-b)]:
        s = (int(x+i) for i in range(1, n+1))
        sadness = sum(abs(ai - xi) for (ai, xi) in zip(a, s))
        res.append(sadness)
        
    return min(res)
    
n = int(input())
a = [int(i) for i in input().split()]
print(f(a, n))

Buggy submission (verdict: Runtime Error):
import math
def f(a, n):
    b = sum(a) / n
    b2 = (1+n) / 2 
    
    res = []
    for x in [b, b2, b-b2, b2-b, ceil(b), ceil(b2), floor(b), floor(b2), ceil(b-b2), ceil(b2 - b), floor(b-b2), floor(b2-b)]:
        s = (x+i for i in range(1, n+1))
        sadness = sum(abs(ai - xi) for (ai, xi) in zip(a, s))
        res.append(sadness)
        
    return min(res)
    
n = int(input())
a = [int(i) for i in input().split()]
print(f(a, n))

Buggy submission (verdict: Runtime Error):
import math

def f(a, n):
    res = math.inf
    for b in range(-n-1, n+1):
        s = (b+i for i in range(1, n+1))
        sadness = sum(abs(ai - xi) for (ai, xi) in zip(a, s))
        res = min(res, sadness)
    
    return res
    
n = int(input())
a = [int(i) for i in input().split()]
print(f(a, n))
Problem p03408 (python)

Fixed submission:
blue = []
red = []
N = int(input())
for card in range(N):
    blue.append(input())
M = int(input())
for card in range(M):
    red.append(input())

max = 0
for b in blue:
    if max < blue.count(b) - red.count(b):
        max = blue.count(b) - red.count(b)
        
print(max)

Buggy submission (verdict: Runtime Error):
blue = []
red = []
N = int(input())
for card in range(N):
    blue.append(input())
M = int(input())
for card in range(M):
    red.append(input())

s = input()
prize = blue.count(s) - red.count(s)
print(prize)

Buggy submission (verdict: Runtime Error):
blue = []
red = []
N = int(input())
for card in range(N):
    blue.append(input())
M = int(input())
for card in range(M):
    red.append(input())

s = input()
prize = blue.count(s) - red.count(s)
print(prize)

Buggy submission (verdict: Runtime Error):
blue = []
red = []
N = int(input())
for card in range(N):
    blue.append(input())
M = int(input())
for card in range(M):
    red.append(input())

prize = 0
s = input()
for n in blue:
    if s == n:
        prize +=1
for m in red:
    if s == m:
        prize -=1
print(prize)
Problem p03415 (python)

Fixed submission:
a = list(input())
b = list(input())
c = list(input())
print(a[0]+b[1]+c[2])

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

if N == 1 or M == 1:    
    if N+M == 2:
        print(1)
    else:
        print(max(N,M)-2)

elif N == 2 or M == 2:
    print(0)
    
else:
    print(N*M - ((N-2)*2+(M-2)*2+4))
Problem p03417 (python)

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

if N == 1 or M == 1:    
    if N+M == 2:
        print(1)
    else:
        print(max(N,M)-2)

elif N == 2 or M == 2:
    print(0)
    
else:
    print(N*M - ((N-2)*2+(M-2)*2+4))

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M = map(int, input().split())
bord = np.zeros((N, M))

if N < 3 or M < 3:
    for n in range(N):
        for m in range(M):
            if n < 1 and m < 1:
                bord[0:n+2,0:m+2] += 1
            elif n < 1:
                bord[0:n+2,m-1:m+2] += 1
            elif m < 1:
                bord[n-1:n+2,0:m+2] += 1
            else:
                bord[n-1:n+2,m-1:m+2] += 1
    bord = bord % 2

#     print(bord)
    print(int(np.sum(bord)))
else:
    print(N*M - ((N-2)*2+(M-2)*2+4))

Buggy submission (verdict: Runtime Error):
import numpy as np
N,M = map(int, input().split())
bord = np.zeros((N, M))

for n in range(N):
    for m in range(M):
#         print(n,m)
        if n < 1 and m < 1:
            bord[0:n+2,0:m+2] += 1
        elif n < 1:
            bord[0:n+2,m-1:m+2] += 1
        elif m < 1:
            bord[n-1:n+2,0:m+2] += 1
        else:
            bord[n-1:n+2,m-1:m+2] += 1
#         print(bord)
#         print('-'*10)

# for n in range(N):
#     for m in range(M):
# #         print(n,m)
#         if n < 1 and m < 1 or n == N-1 and m == M-1 or n < 1 and m == M-1 or m < 1 and n == N-1:
#             bord[n,m] = 4
#         elif n < 1 or n == N-1:
#             bord[n,m] = 6
#         elif m < 1 or m == M-1:
#             bord[n,m] = 6
#         else:
#             bord[n,m] = 1
    
bord = bord % 2

# print(bord)
print(int(np.sum(bord)))
Problem p03435 (python)

Fixed submission:
grid = [list(map(int,input().split(' ')))]
grid.append(list(map(int,input().split(' '))))
grid.append(list(map(int,input().split(' '))))

flg =False
for i in range(100):
    b0,b1,b2  = grid[0][0]-i,grid[0][1]-i,grid[0][2]-i
    a1,a2 = grid[1][0]-b0,grid[2][0]-b0
    if grid[1][1] == a1+b1 and grid[1][2] == a1+b2 and grid[2][1] == a2+b1 and grid[2][2] == a2+b2:
        if grid[0][0] == i+b0 and grid[0][1] == i+b1 and grid[0][2] == i+b2 and grid[1][0] == a1+b0 and grid[2][0] == a2+b0:
            flg =True
            break
    if min([b0,b1,b2]) < 0:
        break
    
if flg:
    print('Yes')
    
else:
    print('No')

Buggy submission (verdict: Runtime Error):
    grid = [list(map(int,input().split(' ')))]
    grid.append(list(map(int,input().split(' '))))
    grid.append(list(map(int,input().split(' '))))
     
    flg =False
    for i in range(100):
        b0,b1,b2  = grid[0][0]-i,grid[0][1]-i,grid[0][2]-i
        a1,a2 = grid[1][0]-b0,grid[2][0]-b0
        if grid[1][1] == a1+b1 and grid[1][2] == a1+b2 and grid[2][1] == a2+b1 and grid[2][2] == a2+b2:
            flg =True
            break
        if min([b0,b1,b2]) < 0:
            break
        
    if flg:
        print('Yes')
Problem p03323 (python)

Fixed submission:
A, B = map(int, input().split())
if A <= 8 and B <= 8:
    print("Yay!")
else:
    print(":(")

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())

if A <= 8 and B <= 8:
    print("Yay!")
else:
    print(":(")
Problem p03303 (python)

Fixed submission:
s=input()
w=int(input())
a=''
for i in range(0,(len(s)-1)//w+1):
    a+=s[w*i]
print(a)

Buggy submission (verdict: Runtime Error):
s=input()
w=int(input())
a=''
for i in range(0,len(s)//w+1):
    a+=s[w*i]
print(a)