Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
k, s = list(map(int, input().split()))
xyz_l = []
count = int(0)

for x in range(k+1)[::-1]:
    yz = s - x
    for y in range(k+1)[::-1]:
        z = yz - y
        if x >= y >= z >= 0:
            xyz_l.append([x, y, z])
            if len({x, y, z}) == 1:
                count += 1
            elif len({x, y, z}) == 2:
                count += 3
            else:
                count += 6

print(count)


Fixed submission:
k, s = list(map(int, input().split()))
count = int(0)

for x in range(k+1)[::-1]:
    yz = s - x
    if yz > k*2:
        break
    for y in range(k+1)[::-1]:
        z = yz - y
        if x >= y >= z >= 0:
            if len({x, y, z}) == 1:
                count += 1
            elif len({x, y, z}) == 2:
                count += 3
            else:
                count += 6

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = list(map(int, input().split()))
r_k = range(k+1)[::-1]
count = int(0)

for x in r_k:
    a = s-x
    if a > k*2:
        break
    for y in r_k:
        b = a - y
        if b > k:
            break
        for z in r_k:
            c = b - z
            if c == 0:
                count += 1
print(count)

Fixed submission:
k, s = list(map(int, input().split()))
count = int(0)

for x in range(k+1)[::-1]:
    yz = s - x
    if yz > k*2:
        break
    for y in range(k+1)[::-1]:
        z = yz - y
        if x >= y >= z >= 0:
            if len({x, y, z}) == 1:
                count += 1
            elif len({x, y, z}) == 2:
                count += 3
            else:
                count += 6

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
k, s = list(map(int, input().split()))
xyz_l = []
r_k = range(k+1)[::-1]

for x in r_k:
    a = s-x
    if a > k*2:
        break
    for y in r_k:
        b = a - y
        if b > k:
            break
        for z in r_k:
            c = b - z
            if c == 0:
                xyz_l.append([x, y, z])
print(len(xyz_l))


Fixed submission:
k, s = list(map(int, input().split()))
count = int(0)

for x in range(k+1)[::-1]:
    yz = s - x
    if yz > k*2:
        break
    for y in range(k+1)[::-1]:
        z = yz - y
        if x >= y >= z >= 0:
            if len({x, y, z}) == 1:
                count += 1
            elif len({x, y, z}) == 2:
                count += 3
            else:
                count += 6

print(count)
Buggy python submission (verdict: Runtime Error):
n = input()
ti = input().split()
sum_ti = sum(map(int, ti))

m = input()
for m in range(int(m)):
    px = input().split()
    sum_p = sum_ti - int(ti[int(px[0])-1]) + int(px[1])
    print(sum_p)


Fixed submission:
aopb = input().split()

if aopb[1] == '+':
    print(int(aopb[0]) + int(aopb[2]))
else:
    print(int(aopb[0]) - int(aopb[2]))

Buggy python submission (verdict: Runtime Error):
aopb = input().split('+'or'-')

if aopb[1] == '+':
    print(int(aopb[0]) + int(aopb[2]))
else:
    print(int(aopb[0]) - int(aopb[2]))


Fixed submission:
aopb = input().split()

if aopb[1] == '+':
    print(int(aopb[0]) + int(aopb[2]))
else:
    print(int(aopb[0]) - int(aopb[2]))
Buggy python submission (verdict: Runtime Error):
A,B = map(int, input().split())
print('Alice' if cards.index(A) > cards.index(B) else 'Bob' if cards.index(A) < cards.index(B) else 'Draw' )

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

if A == 1:
    A = 14
if B == 1:
    B = 14

if A > B:
    print('Alice')
elif A == B:
    print('Draw')
else:
    print('Bob')
Buggy python submission (verdict: Runtime Error):
import numpy as np
#from scipy.interpolate import interpld
from matplotlib import pyplot as plt
%matplotlib inline
import sys
x, y = [int(i) for i in input().split()]
list = [1,3,5,7,8,10,12,4,6,9,11,2,0]
slice1 = list[0:7]
slice2 = list[7:11]
slice3 = list[11:12]

if x in slice1 and y in slice1:
    print('Yes')
elif x in slice2 and y in slice2:
    print ('Yes')
elif x in slice3 and y in slice3:
    print ('Yes')
else:
    print ('No')

Fixed submission:
import sys
x, y = [int(i) for i in input().split()]
list = [1,3,5,7,8,10,12,4,6,9,11,2,0]
slice1 = list[0:7]
slice2 = list[7:11]
slice3 = list[11:12]

if x in slice1 and y in slice1:
    print('Yes')
elif x in slice2 and y in slice2:
    print ('Yes')
elif x in slice3 and y in slice3:
    print ('Yes')
else:
    print ('No')

Buggy python submission (verdict: Runtime Error):
hw = raw_input().split(" ")
h = int(hw[0])
w = int(hw[1])
print("#"*(w+2))
for i in range(h):
    print("#" + raw_input() + "#")

print("#"*(w+2))

Fixed submission:

i = raw_input().strip().split(" ")
x = int(i[0])
y = int(i[1])

groups = []
groups.append([1, 3, 5, 7, 8, 10, 12])
groups.append([4, 6, 9, 11])
groups.append([2])

for g in groups:
    if x in g and y in g:
        print "Yes"
        break
else:
    print "No"
Buggy python submission (verdict: Runtime Error):
i = input().split()
a = int(i[0])
b = int(i[1])
c = int(i[2])

answer = "NO"
while a <= a*b:
    if a%b==c:
        answer = "YES"
        break
    a += a 
    
print(answer)



Fixed submission:
a = input()
b = a.split()

if b[0][-1] == b[1][0] and b[1][-1] == b[2][0]:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
power = 1

for i in range(1, n+1):
    power = power*i

power = power%(1000000000+7)

print(power)

Fixed submission:
n = int(input())
power = 1

for i in range(1, n+1):
    power = power*i%(1000000000+7)



print(power)
Buggy python submission (verdict: Time Limit Exceeded):
a = input().split()
k = int(a[0])
s = int(a[1])
count = 0
for n1 in range(k+1):
    for n2 in range(k+1):
        for n3 in range(k+1):
            if n1+n2+n3==s:
                count += 1

print(count)

Fixed submission:
a = input().split()
k = int(a[0])
s = int(a[1])
count = 0
for n1 in range(k+1):
    for n2 in range(k+1):
        if 0<=(s - n1 - n2)<=k:
            count += 1

print(count)
Buggy python submission (verdict: Runtime Error):
h, w = [int(n) for n in input().split()]

ans=''
for i in range(h):
    ipt = input().split()
    ans+='#'+ipt[0]+ipt[1]+'#'+'\n'
print('#'*(w + 2))
print(ans+'#'*(w + 2))


Fixed submission:
h, w = [int(n) for n in input().split()]

ans=''
for i in range(h):
    ans+='#'+input()+'#'+'\n'
print('#'*(w + 2))
print(ans+'#'*(w + 2))

Buggy python submission (verdict: Runtime Error):
h, w = [int(n) for n in input().split()]


print('#'*(w + 2))
for i in range(h):
    ipt = input().split()
    print('#'+ipt[0]+ipt[1]+'#')
print('#'*(w + 2))

Fixed submission:
h, w = [int(n) for n in input().split()]

ans=''
for i in range(h):
    ans+='#'+input()+'#'+'\n'
print('#'*(w + 2))
print(ans+'#'*(w + 2))

Buggy python submission (verdict: Runtime Error):
h, w = [int(n) for n in input().split()]


print('#'*(w + 2))
for i in range(h):
    ans='#'
    ans+=input().split()
    ans+='#'
    print(ans)
print('#'*(w + 2))

Fixed submission:
h, w = [int(n) for n in input().split()]

ans=''
for i in range(h):
    ans+='#'+input()+'#'+'\n'
print('#'*(w + 2))
print(ans+'#'*(w + 2))

Buggy python submission (verdict: Runtime Error):
ipt=input().split()
h,w = [int(n) for n in ipt[:1]]
img= [input().split()[2:]]
print(
    for i in w+2:
        '#',
    "/n",
    for i in h:
    '#',img[w*i,w*(i+1)],'#',"/n"
    for i in w+2:
        ,'#')

Fixed submission:
h, w = [int(n) for n in input().split()]

ans=''
for i in range(h):
    ans+='#'+input()+'#'+'\n'
print('#'*(w + 2))
print(ans+'#'*(w + 2))

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

ipt =np.array(input()[3:])

np.pad(ipt,1,'#')

Fixed submission:
h, w = [int(n) for n in input().split()]

ans=''
for i in range(h):
    ans+='#'+input()+'#'+'\n'
print('#'*(w + 2))
print(ans+'#'*(w + 2))
Buggy python submission (verdict: Runtime Error):
x, y = map(int,input().split())

grpup_1 = [1, 3, 5, 7, 8, 10, 12]
group_2 = [4, 6, 9, 11]
group_3 = [2]

groups = [group1, group_2, group_3]

for group in groups:
    if x, y in group:
        print("Yes")
    else:
        print("No")

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

group_1 = [1, 3, 5, 7, 8, 10, 12]
group_2 = [4, 6, 9, 11]
group_3 = [2]

groups = [group_1, group_2, group_3]

for group in groups:
    if x in group and y in group:
        print("Yes")
        break
    else:
        None
    if group == group_3:
        print("No")

Buggy python submission (verdict: Runtime Error):
x, y = map(int, input().split())
if x == 2 or y == 2:
    print('No')
else:
    m1 = set(1, 3, 5, 7, 8, 10, 12)
    m2 = set(4, 6, 9, 11)
    if (x in m1 and y in m1) or (x in m2 and y in m2):
        print('Yes')
    else:
        print('No')

Fixed submission:
x, y = map(int, input().split())
if x == 2 or y == 2:
    print('No')
else:
    m1 = set([1, 3, 5, 7, 8, 10, 12])
    m2 = set([4, 6, 9, 11])
    if (x in m1 and y in m1) or (x in m2 and y in m2):
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Runtime Error):
G1 = [1, 3, 5, 7, 8, 10, 12]
G2 = [4, 6, 9, 11]

x, y = map(int, input().strip().split(' '))

if x in G1 and y in G1or x in G2 and y in G2:
    print("Yes")
else:
    print("No")

Fixed submission:
G1 = [1, 3, 5, 7, 8, 10, 12]
G2 = [4, 6, 9, 11]
 
x, y = map(int, input().strip().split(' '))
 
if x in G1 and y in G1 or x in G2 and y in G2:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
def paralell_divide(H, W):
    return 0 if W % 3 == 0 else H

def perpendicular_divide(H, W):
    if W % 2 == 0:
        return W / 2
    a = (H - 1) / 3 if H % 3 == 1 else (H + 1) / 3
    b = (W + 1) / 2 * (H - a)
    c = (W - 1) / 2 * (H - a)
    a = a * W
    return max(a, b, c) - min(a, b, c)

H, W = map(int, input().strip().split(' '))
print min(parallel_divide(H, W), parallel_divide(W, H), perpendicular_divide(H, W), perpendicular_divide(W, H))

Fixed submission:
def parallel_divide(H, W):
    return 0 if W % 3 == 0 else H
 
def perpendicular_divide(H, W):
    if W % 2 == 0:
        return W // 2
    S1 = (H - 1) // 3 if H % 3 == 1 else (H + 1) // 3
    S2 = (W + 1) // 2 * (H - S1)
    S3 = (W - 1) // 2 * (H - S1)
    S1 = S1 * W
    return max(S1, S2, S3) - min(S1, S2, S3)
 
H, W = map(int, input().strip().split(' '))
print(min(parallel_divide(H, W), parallel_divide(W, H), perpendicular_divide(H, W), perpendicular_divide(W, H)))
Buggy python submission (verdict: Runtime Error):
b = input().split(" ")
num = [0 for i in range(int(b[0]))] 
for i in range(int(b[1])):
    a = input().split(" ")
    num[int(a[0])-1] = num[int(a[0])-1]+1
    num[int(a[1])-1] = num[int(a[1])-1]+1

for i in range(int(b[0])):
    print(num[i])

Fixed submission:
def siritori(a):
    s1 = int(a[0])
    s2 = int(a[1])
    s3 = int(a[2])
    if s1<=s3 and s3<=s2:
        print("Yes")
    else:
        print("No")

siritori(input().split(" "))

Buggy python submission (verdict: Runtime Error):
a = input().split(" ")
num = [0 for i in range(int(a[0]))] 
for i in range(int(a[1])):
    a = input().split(" ")
    num[int(a[0])-1] = num[int(a[0])-1]+1
    num[int(a[1])-1] = num[int(a[1])-1]+1

for i in range(int(a[1])):
    print(num[i])

Fixed submission:
def siritori(a):
    s1 = int(a[0])
    s2 = int(a[1])
    s3 = int(a[2])
    if s1<=s3 and s3<=s2:
        print("Yes")
    else:
        print("No")

siritori(input().split(" "))
Buggy python submission (verdict: Runtime Error):
tmp = input().split(" ")
N = int(tmp[0])
K = int(tmp[1])

num = [0 for i in range(N)] 
for i in range(N):
    tmp = input().split(" ")
    a = int(tmp[0])
    b = int(tmp[1])
    num[a-1] = num[a-1] + b

tmp = 0
i = 0
while tmp < K:
    tmp = tmp + num[i]
    if tmp >= K:
        print(i+1)
    i = i + 1

Fixed submission:
tmp = input().split(" ")
N = int(tmp[0])
K = int(tmp[1])

num = [0 for i in range(10**5)]
for i in range(N):
    tmp = input().split(" ")
    a = int(tmp[0])
    b = int(tmp[1])
    num[a-1] = num[a-1] + b

tmp = 0
i = 0
while tmp < K:
    tmp = tmp + num[i]
    if tmp >= K:
        print(i+1)
    i = i + 1

Buggy python submission (verdict: Runtime Error):
tmp = input().split(" ")
N = int(tmp[0])
K = int(tmp[1])

num = [0 for i in range(N-1)] 
for i in range(N-1):
    tmp = input().split(" ")
    a = int(tmp[0])
    b = int(tmp[1])
    num[a-1] = num[a-1] + b

tmp = 0
i = 0
while tmp <= K:
    tmp = tmp + num[i]
    if tmp >= K:
        print(i+1)
    i = i + 1

Fixed submission:
tmp = input().split(" ")
N = int(tmp[0])
K = int(tmp[1])

num = [0 for i in range(10**5)]
for i in range(N):
    tmp = input().split(" ")
    a = int(tmp[0])
    b = int(tmp[1])
    num[a-1] = num[a-1] + b

tmp = 0
i = 0
while tmp < K:
    tmp = tmp + num[i]
    if tmp >= K:
        print(i+1)
    i = i + 1

Buggy python submission (verdict: Runtime Error):
tmp = input().split(" ")
N = int(tmp[0])
K = int(tmp[1])

num = [0 for i in range(N-1)] 
for i in range(N):
    tmp = input().split(" ")
    a = int(tmp[0])
    b = int(tmp[1])
    num[a-1] = num[a-1] + b

tmp = 0
i = 0
while tmp <= K:
    tmp = tmp + num[i]
    if tmp >= K:
        print(i+1)
    i = i + 1

Fixed submission:
tmp = input().split(" ")
N = int(tmp[0])
K = int(tmp[1])

num = [0 for i in range(10**5)]
for i in range(N):
    tmp = input().split(" ")
    a = int(tmp[0])
    b = int(tmp[1])
    num[a-1] = num[a-1] + b

tmp = 0
i = 0
while tmp < K:
    tmp = tmp + num[i]
    if tmp >= K:
        print(i+1)
    i = i + 1

Buggy python submission (verdict: Runtime Error):
tmp = input().split(" ")
N = int(tmp[0])
K = int(tmp[1])

num = [0 for i in range(N)] 
for i in range(N):
    tmp = input().split(" ")
    a = int(tmp[0])
    b = int(tmp[1])
    num[a-1] = num[a-1] + b

tmp = 0
i = 0
while tmp <= K:
    tmp = tmp + num[i]
    if tmp >= K:
        print(i+1)
    i = i + 1

Fixed submission:
tmp = input().split(" ")
N = int(tmp[0])
K = int(tmp[1])

num = [0 for i in range(10**5)]
for i in range(N):
    tmp = input().split(" ")
    a = int(tmp[0])
    b = int(tmp[1])
    num[a-1] = num[a-1] + b

tmp = 0
i = 0
while tmp < K:
    tmp = tmp + num[i]
    if tmp >= K:
        print(i+1)
    i = i + 1
Buggy python submission (verdict: Runtime Error):
n = int(input())
p2 = [ int(i) for i in input().split() ]
ps = sorted(p2)

cnt=0
while True:
    if p2 == ps: break
    cnt += 1
    high = []
    low = []
    for i in range(len(p2)):
        if p2[i] == max(p2[0:i+1]):
            high.append(p2[i])
        else:
            low.append(p2[i])
    p2 = low + high

print(cnt)


Fixed submission:
### A - Cookie Exchanges
a = [ int(i) for i in input().split() ]

cnt=0
if a[0] % 2 == 1 or a[1] % 2 == 1 or a[2] % 2 == 1:
    pass
elif a[0] == a[1] and a[1] == a[2]:
    cnt=-1
else:
    while True:
        if a[0] % 2 == 1 or a[1] % 2 == 1 or a[2] % 2 == 1: break
        cnt += 1
        a[0], a[1], a[2] = (a[1]+a[2])/2 , (a[0]+a[2])/2, (a[0]+a[1])/2

print(cnt)
Buggy python submission (verdict: Runtime Error):
n = int(input())
S=[]
for i in range(n):
    S.append(input())

ans = []
#チェックする文字をS[0]から取得
for i in S[0]:
    #すべてのSについてチェックする文字の存在判定
    hantei=[]
    for j in range(1,n):
        hantei.append(S[j].find(i)) #存在する位置をリストに追加
    if min(hantei) >= 0: ans.append(i)

#辞書順にする
ans.sort()
#文字列にする
ans2 = ''.join(ans)
print(ans2)

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

a = int(a)
b = int(b)
c = int(c)

print('YES') if b-a == c-b else print('NO')
Buggy python submission (verdict: Runtime Error):
n = int(input())
S=[]
for i in range(n):
    S.append(input())

ans = []
#チェックする文字をS[0]から取得
for i in S[0]:
    #すべてのSについてチェックする文字の存在判定
    hantei=[]
    for j in range(1,n):
        idx = S[j].find(i)
        hantei.append(idx) #存在する位置をリストに追加
        if idx >= 0: S[j] = S[j][:idx] + S[j][idx+1:] #存在した場合はそれを除去そておく
    if min(hantei) >= 0: ans.append(i)

#辞書順にする
ans.sort()
#文字列にする
ans2 = ''.join(ans)
print(ans2)


Fixed submission:
n = int(input())
S=[]
for i in range(n):
    S.append(input())

ans = []

if n>1:
    #チェックする文字をS[0]から取得
    for i in S[0]:
        #すべてのSについてチェックする文字の存在判定
        hantei=[]
        for j in range(1,n):
            idx = S[j].find(i)
            hantei.append(idx) #存在する位置をリストに追加
            if idx >= 0: S[j] = S[j][:idx] + S[j][idx+1:] #存在した場合はそれを除去そておく
        if min(hantei) >= 0: ans.append(i)
else:
    ans = [i for i in S[0]]

#辞書順にする
ans.sort()
#文字列にする
ans2 = ''.join(ans)
print(ans2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
S=[]
for i in range(n):
    S.append(input())

ans = []
#チェックする文字をS[0]から取得
for i in S[0]:
    #すべてのSについてチェックする文字の存在判定
    hantei=[]
    for j in range(1,n):
        hantei.append(S[j].find(i)) #存在する位置をリストに追加
    if min(hantei) >= 0: ans.append(i)

#辞書順にする
ans.sort()
#文字列にする
ans2 = ''.join(ans)
print(ans2)


Fixed submission:
n = int(input())
S=[]
for i in range(n):
    S.append(input())

ans = []

if n>1:
    #チェックする文字をS[0]から取得
    for i in S[0]:
        #すべてのSについてチェックする文字の存在判定
        hantei=[]
        for j in range(1,n):
            idx = S[j].find(i)
            hantei.append(idx) #存在する位置をリストに追加
            if idx >= 0: S[j] = S[j][:idx] + S[j][idx+1:] #存在した場合はそれを除去そておく
        if min(hantei) >= 0: ans.append(i)
else:
    ans = [i for i in S[0]]

#辞書順にする
ans.sort()
#文字列にする
ans2 = ''.join(ans)
print(ans2)
Buggy python submission (verdict: Time Limit Exceeded):
x, y = [int(i) for i in input().split()]
xl = [int(i) for i in input().split()]
yl = [int(i) for i in input().split()]


s=0;
#xの左位置
for ix1 in range(x-1):
    #xの右位置
    for ix2 in range(ix1+1,x):
        wide = xl[ix2] - xl[ix1]
        #yの下位置
        for iy1 in range(y-1):
            #xの右位置
            for iy2 in range(iy1+1,y):
                height = yl[iy2] - yl[iy1]
                s += wide * height
                #print(str(wide)+' '+str(height)+' '+str(s)+';  '+str(yl[iy1])+' '++str(iy2))

ans = s % (10**9 + 7)
print(ans)


Fixed submission:
### D - 井井井 / ###　やりなおし
x, y = [int(i) for i in input().split()]
xl = [int(i) for i in input().split()]
yl = [int(i) for i in input().split()]

xx = sum(  [ i*xl[i] - (x-i-1)*xl[i] for i in range(len(xl)) ]  )
yy = sum(  [ i*yl[i] - (y-i-1)*yl[i] for i in range(len(yl)) ]  )
ans = (xx * yy) % (10**9 + 7)
print(ans)
Buggy python submission (verdict: Runtime Error):
[x, y] = map(int, raw_input().strip().split())
a = raw_input().strip()
b = raw_input().strip()
print "#" * (y + 2)
print "#" + a + "#"
print "#" * (y + 2)

Fixed submission:
[x, y] = map(int, raw_input().strip().split())
st = []
for i in range(x):
    st.append(raw_input().strip())
print "#" * (y + 2)
for i in range(x):
    print "#" + st[i] + "#"
print "#" * (y + 2)
Buggy python submission (verdict: Runtime Error):
size = input()
size = size.split()

print("#" * (int(size[1]) + 2))

for i in range(int(size[0])):
	row = input()
	print("#" + row + "#")

print("#" * (int(size[1]) + 2))


Fixed submission:
import numpy as np

data = input()
data = data.split()
x = int(data[0])
y = int(data[1])

vec_1 = []
vec_2 = []
group = [[1, 3, 5, 7, 8, 10, 12], [4, 6, 9, 11], [2]]


for i in range(3):
	if x in group[i]:
		vec_1.append(1)
	else:
		vec_1.append(0)

for i in range(3):
	if y in group[i]:
		vec_2.append(1)
	else:
		vec_2.append(0)

vec_1 = np.array(vec_1)
vec_2 = np.array(vec_2)


if sum(vec_1 * vec_2) == 1:
	print("Yes")
else:
	print("No")
Buggy python submission (verdict: Runtime Error):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
N = int(raw_input())
a = raw_input().split(" ")
output = 0

a.sort()

for i in a[N:2*N]:
    output = output + int(i)

print output

Fixed submission:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
N = int(raw_input())
a = raw_input().split(" ")
output = 0

b = []

for i in a:
    b.append(int(i))

b.sort(reverse=True)

for i in range(N):
    output = output + int(b[2*i+1])

print output
Buggy python submission (verdict: Time Limit Exceeded):

if __name__ == "__main__":
    H, W = map(int, input().split(" "))
    if (W % 3 == 0) or (H % 3 == 0):
        print("0")
        exit()
    else:
        Ans = H*W
        for x in range(1, W):
            for y in range(1, H):
                # |--
                S1 = H*x
                S2 = (W - x) * y
                S3 = H*W - (S1 + S2)
                Ans1 = max(S1, S2, S3) - min(S1, S2, S3)

                # ---
                #  |
                S1 = y*W
                S2 = (H - y) * x
                S3 = H*W - (S1 + S2)
                Ans2 = max(S1, S2, S3) - min(S1, S2, S3)


                # | |
                S1 = x*H
                S2 = (W - x) // 2 * H
                S3 = H*W - (S1 + S2)
                Ans3 = max(S1, S2, S3) - min(S1, S2, S3)

                # --
                # --
                S1 = y*W
                S2 = (H - y) // 2 * W
                S3 = H*W - (S1 + S2)
                Ans4 = max(S1, S2, S3) - min(S1, S2, S3)

                # 最小値を更新
                Ans = min(Ans, Ans1, Ans2, Ans3, Ans4)

                # print("debug:(x, y) => (", x, y, ")")
                # print(Ans)
        print(Ans)
        exit()


Fixed submission:

def getMinSDiff(H, W):
    Ans = H*W
    for x in range(1, W):
        # |--
        S1 = H*x
        S2 = (W - x) * (H // 2)
        S3 = H*W - (S1 + S2)
        Ans1 = max(S1, S2, S3) - min(S1, S2, S3)

        # | |
        S1 = x*H
        S2 = (W - x) // 2 * H
        S3 = H*W - (S1 + S2)
        Ans2 = max(S1, S2, S3) - min(S1, S2, S3)

        # 最小値を更新
        Ans = min(Ans, Ans1, Ans2)
    return Ans

if __name__ == "__main__":
    H, W = map(int, input().split(" "))
    if (W % 3 == 0) or (H % 3 == 0):
        print("0")
        exit()
    else:
        Ans = min(getMinSDiff(H, W), getMinSDiff(W, H))
        print(Ans)
        exit()
Buggy python submission (verdict: Runtime Error):
N = [int(input()) for i in range(3)]
if N[0] <= N[2] <= N[1]:
    print("Yes")
else:
    print("No")

Fixed submission:
a,b,c=map(int,input().split())
if a<=c and c<=b:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
N = [int(input()) for i in range(3)]
if N[2] > N[0] and N[2] < N[1]:
    print("Yes")
else:
    print("No")
    

Fixed submission:
a,b,c=map(int,input().split())
if a<=c and c<=b:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
N = int(input())
if N == 557 or N == 575 or N == 755:
    print("Yes")
else:
    print("No")

Fixed submission:
a, b, c = map(str, input().split())
N = a + b + c
if N == "557" or N == "575" or N == "755":
    print("YES")
else:
    print("NO")