Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
A,B,M = map(int,input().split(" "))
a = list(map(int,input().split(" ")))
b = list(map(int,input().split(" ")))
tmp = 1000000000
for i in range(M):
    c = int(input())
    sum1 = a[i]+b[i]-c
    ans = min(tmp,sum1)
print(ans)

Fixed submission:
A,B,M = map(int,input().split(" "))
a = list(map(int,input().split(" ")))
b = list(map(int,input().split(" ")))
ans = min(a) + min(b)
for i in range(M):
    x,y,c = map(int,input().split(" "))
    tmp = a[x-1]+b[y-1]-c
    ans = min(tmp,ans)
print(ans)

Buggy python submission (verdict: Runtime Error):
A,B,M = map(int,input().split(","))
a = list(map(int,input().split(",")))
b = list(map(int,input().split(",")))
tmp = 1000000000
for i in range(M):
    c = int(input())
    sum1 = a[i]+b[i]-c
    ans = min(tmp,sum1)
print(ans)

Fixed submission:
A,B,M = map(int,input().split(" "))
a = list(map(int,input().split(" ")))
b = list(map(int,input().split(" ")))
ans = min(a) + min(b)
for i in range(M):
    x,y,c = map(int,input().split(" "))
    tmp = a[x-1]+b[y-1]-c
    ans = min(tmp,ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
A11,A12,A13,A21,A22,A23,A31,A32,A33 = map(int,input().split(" "))
bingo = [A11,A12,A13,A21,A22,A23,A31,A32,A33]
bingo = ",".join(map(str,bingo))
N = int(input())
for i in range(N):
    b = input()
    if b in bingo:
        bingo.replace(b,True)
    else:
        pass
Bingo = bingo.split(",")
Flag = False
if Bingo[0] == Bingo[1] == Bingo[2]==True:
    Flag = True
if Bingo[3] == Bingo[4] == Bingo[6]==True:
    Flag = True
if Bingo[6] == Bingo[7] == Bingo[8]==True:
    Flag = True
if Bingo[0] == Bingo[3] == Bingo[6]==True:
    Flag = True
if Bingo[1] == Bingo[4] == Bingo[7]==True:
    Flag = True
if Bingo[2] == Bingo[5] == Bingo[8]==True:
    Flag = True
if Bingo[0] == Bingo[4] == Bingo[8]==True:
    Flag = True
if Bingo[2] == Bingo[4] == Bingo[6]==True:
    Flag = True
else:
    pass
if flag == True:
    print("Yes")
else:
    print("No")

Fixed submission:
N = int(input())
if N % 2 != 0:
    ans = (N//2)+1
if N % 2 == 0:
    ans = (N//2)
print(round(ans,N))
Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
H = sorted(H,reverse = True)
Flag = False
if len(H)<=(K):
        H.clear()
        Flag = True
        print("0")
        
if Flag == False:
    for i in range(K):
        H.remove(H[i])
    print(sum(H))

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

A.sort(reverse=True)
print(sum(A[K:]))

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
H = sorted(H,reverse = True)
for i in range(K):
    H.remove(H[i])
sum_ = sum(H)
pint(sum)

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

A.sort(reverse=True)
print(sum(A[K:]))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
k = int(input())
n = 0
for i in range(1,k+1):
  for j in range(1,k+1):
    for l in range(1,k+1):
      n += np.gcd.reduce([j, i, l])
print(n)


Fixed submission:
from math import gcd
k = int(input())+1
n = 0
for i in range(1,k):
  for j in range(i,k):
    for l in range(j, k):
      if i == j == l:
        n += gcd(i,gcd(j,l))
      elif i == j or j == l or l == i:
        n += gcd(i,gcd(j,l))*3
      else:
        n += gcd(i,gcd(j,l))*6
print(n)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
k, n = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.append(k)
a.reverse()
l = []
for i in range(n):
  l.append(a[i]-a[i+1])
k = []
for i in itertools.permutations(l, r=n-1):
  k.append(sum(i))
print(min(k))

Fixed submission:
K,N = map(int,input().split())	
A = list(map(int,input().split()))
D=[A[0]-A[-1]+K]
for i in range(N-1):
    D.append(A[i+1]-A[i])
print(K-max(D))
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = [int(i) for i in input().split()]
d = []
for i in range(min(x), max(x)):
  a = 0
  for j in x:
    a += (j - i)**2
#    print("({}-{})**2={}".format(j,i,(j - i)**2))
  d.append(a)
print(min(d))


Fixed submission:
n = int(input())
x = [int(i) for i in input().split()]
d = []
for i in range(min(x), max(x)+1):
  a = 0
  for j in x:
    a += (j - i)**2
#    print("({}-{})**2={}".format(j,i,(j - i)**2))
  d.append(a)
print(min(d))

Buggy python submission (verdict: Runtime Error):
n = int(input())
x = [int(i) for i in input().split()]
d = []

b = 0
for i in range(min(x), max(x)):
  a = 0
  for j in x:
    a += (i - j)**2
#    print("({}-{})**2={}".format(j,i,(j - i)**2))
  d.append(a)
print(min(d))


Fixed submission:
n = int(input())
x = [int(i) for i in input().split()]
d = []
for i in range(min(x), max(x)+1):
  a = 0
  for j in x:
    a += (j - i)**2
#    print("({}-{})**2={}".format(j,i,(j - i)**2))
  d.append(a)
print(min(d))

Buggy python submission (verdict: Runtime Error):
n = int(input())
x = [int(i) for i in input().split()]
d = {}

def m(x, p):
  a = (x - p)**2
  return a
for i in range(min(x), max(x)):
  b = 0
  for j in x:
    b += m(j,i)
  d[i]=[b]
print(min(d.values())[0])


Fixed submission:
n = int(input())
x = [int(i) for i in input().split()]
d = []
for i in range(min(x), max(x)+1):
  a = 0
  for j in x:
    a += (j - i)**2
#    print("({}-{})**2={}".format(j,i,(j - i)**2))
  d.append(a)
print(min(d))

Buggy python submission (verdict: Runtime Error):
n = int(input())
x = [int(i) for i in input().split()]
d = {}

def m(x, p):
  a = (x - p)**2
  return a
#d.setdefault(j, []).append([i, j, m(i,j)])
for i in range(min(x), max(x)):
  b = 0
  for j in x:
    b += m(j,i)
  d[i]=[b]
print(min(d.values())[0]

Fixed submission:
n = int(input())
x = [int(i) for i in input().split()]
d = []
for i in range(min(x), max(x)+1):
  a = 0
  for j in x:
    a += (j - i)**2
#    print("({}-{})**2={}".format(j,i,(j - i)**2))
  d.append(a)
print(min(d))
Buggy python submission (verdict: Runtime Error):
import math
a = [map(int, input().split())]
print(math.ceil(sum(a)))

Fixed submission:
import math
a = list(map(int, input().split()))
print(math.ceil(sum(a)/2))
Buggy python submission (verdict: Runtime Error):
# A
A, B, C = map(int,input().split())
print(C+" "+B+" "+A)

Fixed submission:
# A
A, B, C = map(int,input().split())
print(C, A, B)
Buggy python submission (verdict: Runtime Error):
S = input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
    print('Bad')
else:
    print('Good')

Fixed submission:
N = int(input())
if N % 2 == 0:
    print(int(N/2))
else:
    print(int(N//2) + 1 )
Buggy python submission (verdict: Runtime Error):
S = input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3] or S[3]==S[4]:
    print('Bad')
else:
    print('Good')

Fixed submission:
S = input()
if S[0]==S[1] or S[1]==S[2] or S[2]==S[3]:
    print('Bad')
else:
    print('Good')
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = str(input())
k = int(input())

s =list(s)

for i in range(n):
    if s[i] != s[k]:
        s[i] = '*'

print(''.join(s))

Fixed submission:
n = int(input())
s = str(input())
k = int(input())

s =list(s)

for i in range(n):
    if s[i] != s[k-1]:
        s[i] = '*'

print(''.join(s))
Buggy python submission (verdict: Runtime Error):
S = input()
listS = list(S)
N = []
dic = ['A', 'T', 'G', 'C']
count = 0
for i in range(len(listS)):
    if listS[i] in dic:
        count += 1
        N.append(count)
    else:
        count = 0

print(max(N))

Fixed submission:
S = input()
listS = list(S)
N = []
dic = ['A', 'T', 'G', 'C']
count = 0
for i in range(len(listS)):
    if listS[i] in dic:
        count += 1
        N.append(count)
    else:
        count = 0
        N.append(count)
print(max(N))
Buggy python submission (verdict: Runtime Error):
ab,bc,ca = map(str,input().split())

print(ab*bc/2)

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

print(int(a*b/2))
Buggy python submission (verdict: Runtime Error):
k = int(input())

print(int(k-1)/2**2))

Fixed submission:
k = int(input())

if k % 2 == 0:
    print(int((k/2)**2))
else:
    print(int((k-1)/2 * (k+1)/2))
Buggy python submission (verdict: Runtime Error):
n = 0
list = input().split()
for i in list:
    if list[i] == +:
        n += 1
    else:
        n -= 1
print(n)

Fixed submission:
n = 0
a,b,c,d = input()
for i in [a,b,c,d]:
    if i == "+":
        n += 1
    else:
        n -= 1
print(n)
Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())
if L < R:
    print('Right')
elif L == R:
    print('Balanced')
else:
    print('Left')

Fixed submission:
A, B, C, D = map(int, input().split())
if A+B < C+D :
    print('Right')
elif A+B == C+D:
    print('Balanced')
else:
    print('Left')
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print( sum(a,b,c) - max(a,b,c) )

Fixed submission:
a, b, c = map(int, input().split())
print( a+b+c - max(a,b,c) )
Buggy python submission (verdict: Runtime Error):
A, op, B = map(int, input().split())
if op == '+':
    print(A+B)
else:
    print(A-B)

Fixed submission:
# ABC50_A

a, op, b = map(str,input().split())
if op == '+':
    print(int(a)+int(b))
else:
    print(int(a)-int(b))

Buggy python submission (verdict: Runtime Error):
A, op, B = map(int, input().split())
if op == '+':
    print(A+B)
elif op == '-':
    print(A-B)

Fixed submission:
# ABC50_A

a, op, b = map(str,input().split())
if op == '+':
    print(int(a)+int(b))
else:
    print(int(a)-int(b))
Buggy python submission (verdict: Time Limit Exceeded):
import math

k = int(input())

total = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):

            if a == b == c:
                total += a
                continue

            if a == 1:
                total += a
                continue

            if b == 1:
                total += b
                continue

            if c == 1:
                total += c
                continue

            if a % b == 0:
                total += math.gcd(b,c)
                continue
            
            if b % a == 0:
                total += math.gcd(a,c)
                continue

            total += math.gcd(math.gcd(a,b),c)

print(total)

Fixed submission:
import math

k = int(input())
k_arr = range(1,k+1)

a_arr = list()
b_arr = list()

for k in k_arr:
    for a in k_arr:
        a_arr.append(a)

for b in k_arr:
    for k in k_arr:
        b_arr.append(b)

gcds = list(map(math.gcd,a_arr,b_arr))

total = 0
for c in k_arr:
    c_arr = [c] * k * k
    total += sum(map(math.gcd,gcds,c_arr))

print(total)
Buggy python submission (verdict: Time Limit Exceeded):
string = input()
n = int(string.split()[0])
k = int(string.split()[1])

while n > k:
    n = n - k

if n == k:
    print(0)
    exit()

print(min(n,k-n))

Fixed submission:
string = input()
n = int(string.split()[0])
k = int(string.split()[1])

diff = n - k
n = n - (diff // k) * k

while n > k:
    n = n - k

if n == k:
    print(0)
    exit()

print(min(n,k-n))
Buggy python submission (verdict: Time Limit Exceeded):
# K回前と現在の問いが同じだったら0点

str1 = input().split(" ")
str2 = input().split(" ")
t = input()

n = int(str1[0])
k = int(str1[1])

r = int(str2[0])
s = int(str2[1])
p = int(str2[2])

skill = {"r":p,"s":r,"p":s}

result = 0
hoge = 0
douchilist = []
for i in range(0,n):
    if i < k:
        continue
    if t[i] == t[i-k] and i-k not in douchilist:
        hoge += skill[t[i]]
        douchilist.append(i)
        continue

pres = p * t.count("r")
rres = r * t.count("s")
sres = s * t.count("p")


print(pres + rres + sres - hoge)

Fixed submission:
# K回前と現在の問いが同じだったら0点

str1 = input().split(" ")
str2 = input().split(" ")
t = list(input())

n = int(str1[0])
k = int(str1[1])

r = int(str2[0])
s = int(str2[1])
p = int(str2[2])

result = 0
hoge = 0
for i in range(0,n):
    if i < k:
        continue

    j = i-k
    if t[i] == t[j]:
        t[i] = "_"

pres = p * t.count("r")
rres = r * t.count("s")
sres = s * t.count("p")

print(pres + rres + sres)

Buggy python submission (verdict: Time Limit Exceeded):
# K回前と現在の問いが同じだったら0点

str1 = input().split(" ")
str2 = input().split(" ")
t = input()

n = int(str1[0])
k = int(str1[1])

r = int(str2[0])
s = int(str2[1])
p = int(str2[2])

skill = {"r":p,"s":r,"p":s}

result = 0
douchilist = []
for i in range(0,n):
    if i >= k:
        if t[i] == t[i-k] and i-k not in douchilist:
            result += 0
            douchilist.append(i)
            continue

    result += skill[t[i]]
    continue


print(result)

Fixed submission:
# K回前と現在の問いが同じだったら0点

str1 = input().split(" ")
str2 = input().split(" ")
t = list(input())

n = int(str1[0])
k = int(str1[1])

r = int(str2[0])
s = int(str2[1])
p = int(str2[2])

result = 0
hoge = 0
for i in range(0,n):
    if i < k:
        continue

    j = i-k
    if t[i] == t[j]:
        t[i] = "_"

pres = p * t.count("r")
rres = r * t.count("s")
sres = s * t.count("p")

print(pres + rres + sres)

Buggy python submission (verdict: Time Limit Exceeded):
# K回前と現在の問いが同じだったら0点

str1 = input().split(" ")
str2 = input().split(" ")
t = input()

n = int(str1[0])
k = int(str1[1])

r = int(str2[0])
s = int(str2[1])
p = int(str2[2])

result = 0
douchilist = []
for i in range(0,n):
    if i >= k:
        if t[i] == t[i-k] and i-k not in douchilist:
            result += 0
            douchilist.append(i)
            continue

    if t[i] == "r":
        result += p
        continue

    if t[i] == "s":
        result += r
        continue

    if t[i] == "p":
        result += s
        continue


print(result)

Fixed submission:
# K回前と現在の問いが同じだったら0点

str1 = input().split(" ")
str2 = input().split(" ")
t = list(input())

n = int(str1[0])
k = int(str1[1])

r = int(str2[0])
s = int(str2[1])
p = int(str2[2])

result = 0
hoge = 0
for i in range(0,n):
    if i < k:
        continue

    j = i-k
    if t[i] == t[j]:
        t[i] = "_"

pres = p * t.count("r")
rres = r * t.count("s")
sres = s * t.count("p")

print(pres + rres + sres)
Buggy python submission (verdict: Runtime Error):
n = input()
str = input()
sl = list(str.split(" ")[0])
tl = list(str.split(" ")[1])

for i in range(0,n-1):
    print(sl[i],end="")
    print(tl[i],end="")



Fixed submission:
n = input()
str = input()
sl = list(str.split(" ")[0])
tl = list(str.split(" ")[1])

for i in range(0,int(n)):
    print(sl[i],end="")
    print(tl[i],end="")
Buggy python submission (verdict: Runtime Error):
a = input()
b = input()

for i in range(len(b)):
  if a[i] != b[i]:
    print("No")
    break
  if i == len(b) - 1:
    print("Yes")

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

for i in range(len(a)):
  if a[i] != b[i]:
    print("No")
    break
  if i == len(a) - 1:
    print("Yes")
Buggy python submission (verdict: Runtime Error):
N,K = [int(i) for i in input().split()]
d = []
A = []
person = []
for i in range(K):
    a = int(input())
    d.append(a)
    b = [int(i) for i in input().split()]
    A.append(b)

for i in range(N):
    person.append(i)

for i in d:
    for j in range(i):
        for k in A[j]:
            if k in person:
                person.remove(k)

print(len(person)-1)


Fixed submission:
N,K = [int(i) for i in input().split()]
d = []
A = []
person = []
for i in range(K):
    a = int(input())
    d.append(a)
    b = [int(i) for i in input().split()]
    A.append(b)

for i in range(N):
    person.append(i+1)

for i in range(K):
    for j in range(d[i]):
            if A[i][j] in person:
                person.remove(A[i][j])

print(len(person))

Buggy python submission (verdict: Runtime Error):
N,K = [int(i) for i in input().split()]
d = []
A = []
person = []
for i in range(K):
    a = int(input())
    d.append(a)
    b = [int(i) for i in input().split()]
    A.append(b)

for i in range(N):
    person.append(i+1)

for i in d:
    for j in range(i):
        for k in A[j]:
            if k in person:
                person.remove(k)

print(len(person))


Fixed submission:
N,K = [int(i) for i in input().split()]
d = []
A = []
person = []
for i in range(K):
    a = int(input())
    d.append(a)
    b = [int(i) for i in input().split()]
    A.append(b)

for i in range(N):
    person.append(i+1)

for i in range(K):
    for j in range(d[i]):
            if A[i][j] in person:
                person.remove(A[i][j])

print(len(person))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = []

for i in range(N):
    for j in range(N):
        if i * j == N:
            A.append((i+j))

print(min(A)-2)


Fixed submission:
import math

N = int(input())
ans = []
for i in range(1,int(math.sqrt(N))+1):
    if N % i == 0:
        ans.append(i + N // i - 2)

print(min(ans))
Buggy python submission (verdict: Runtime Error):
N,K = [int(i) for i input().split()]
h = [int(i) for i input().split()]

count = 0
for i in range(N):
  if h[i] >= K:
    count += 1

print(count)

Fixed submission:
N,K = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]
 
count = 0
for i in range(N):
  if h[i] >= K:
    count += 1
 
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
h = [int(i) for i in input().split()]
DP = [0]
DP.append(abs(h[0] - h[1]))

for i in range(2,len(h)):
    if DP[i-1] + abs(h[i-1] - h[i]) > DP[i-2] + abs(h[i-2] - h[i]):
        DP.append(DP[i-2] + abs(h[i-2] - h[i]))
    else:
        DP.append(DP[i-1] + abs(h[i-1] - h[i]))

print(DP[len(N)-1])


Fixed submission:
N = int(input())
h = [int(i) for i in input().split()]
DP = [0]
DP.append(abs(h[0] - h[1]))

for i in range(2,len(h)):
    if DP[i-1] + abs(h[i-1] - h[i]) > DP[i-2] + abs(h[i-2] - h[i]):
        DP.append(DP[i-2] + abs(h[i-2] - h[i]))
    else:
        DP.append(DP[i-1] + abs(h[i-1] - h[i]))

print(DP[N-1])
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
list = {}


for i in a:
    if 1 <= i <= 399:
        list[0] = 1
    elif 400 <= i <= 799:
        list[1] = 1
    elif 800 <= i <= 1199:
        list[2] = 1
    elif 1200 <= i <= 1599:
        list[3] = 1
    elif 1600 <= i <= 1999:
        list[4] = 1
    elif 2000 <= i <= 2399:
        list[5] = 1
    elif 2400 <= i <= 2799:
        list[6] = 1
    elif 2800 <= i <= 3199:
        list[7] = 1
    else:
        list[8] += 1

min = len(list)


if list[8] > 0:
    max = len(list) + chin
else:
    max = len(list)

print(min,max)


Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
list = {}
list[8] = 0

for i in a:
    if 1 <= i <= 399:
        list[0] = 1
    elif 400 <= i <= 799:
        list[1] = 1
    elif 800 <= i <= 1199:
        list[2] = 1
    elif 1200 <= i <= 1599:
        list[3] = 1
    elif 1600 <= i <= 1999:
        list[4] = 1
    elif 2000 <= i <= 2399:
        list[5] = 1
    elif 2400 <= i <= 2799:
        list[6] = 1
    elif 2800 <= i <= 3199:
        list[7] = 1
    else:
        list[8] += 1

if len(list) == 1:
    min = 1
else:
    min = len(list) - 1

if list[8] > 0:
    max = len(list) + list[8] - 1
else:
    max = len(list) - 1

print(min,max)
Buggy python submission (verdict: Runtime Error):
N = int(input())
score = []


for i in range(N):
    x = int(input())
    score.append(x)

pai = sum(score)
score.sort()

i = 0

while pai % 10 == 0:
    pai -= score[i]
    i += 1

print(pai)


Fixed submission:
N = int(input())
chin = []
sum = 0

for i in range(N):

    x = int(input())
    sum += x

    if x % 10 != 0:
        chin.append(x)

chin.sort()
i = 0

while chin != [] and i < len(chin) and sum % 10 == 0:
    sum -= chin[i]
    i += 1

if sum % 10 == 0:
    print(0)
else:
    print(sum)
Buggy python submission (verdict: Runtime Error):
def answer(H,W,ans):
    for x in range(1,W):
        y1 = H // 2
        Sa1 = H * x
        Sb1 = (W - x) * y1
        Sc1 = (W - x) * (H - y1)
        M = max(Sa1,Sb1,Sc1)
        m = min(Sa1,Sb1,Sc1)

        y2 = (W - x) // 2
        Sa2 = H * x
        Sb2 = H * y2
        Sc2 = H * (W - x - y2)
        M2 = max(Sa2,Sb2,Sc2)
        m2 = min(Sa2,Sb2,Sc2)

        if ans > min(M-m,M2-m2):
            ans = min(M-m,M2-m2)

        return ans

if __name__ == '__main__':
    H,W = [int(i) for i in input().split()]
    ans = H * W
    ans = answer(H,W)
    
    H,W = W,H

    if answer(H,W) < ans:
        ans = answer(H,W)

    print(ans)


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

for x in range(1,W):
    y1 = H // 2
    Sa1 = H * x
    Sb1 = (W - x) * y1
    Sc1 = (W - x) * (H - y1)
    M = max(Sa1,Sb1,Sc1)
    m = min(Sa1,Sb1,Sc1)

    y2 = (W - x) // 2
    Sa2 = H * x
    Sb2 = H * y2
    Sc2 = H * (W - x - y2)
    M2 = max(Sa2,Sb2,Sc2)
    m2 = min(Sa2,Sb2,Sc2)

    if ans > min(M-m,M2-m2):
        ans = min(M-m,M2-m2)

H,W = W,H
for x in range(1,W):
    y = H // 2
    Sa1 = H * x
    Sb1 = (W - x) * y
    Sc1 = (W - x) * (H - y)
    M = max(Sa1,Sb1,Sc1)
    m = min(Sa1,Sb1,Sc1)

    y2 = (W - x) // 2
    Sa2 = H * x
    Sb2 = H * y2
    Sc2 = H * (W - x - y2)
    M2 = max(Sa2,Sb2,Sc2)
    m2 = min(Sa2,Sb2,Sc2)

    if ans > min(M-m,M2-m2):
        ans = min(M-m,M2-m2)

print(ans)

Buggy python submission (verdict: Runtime Error):
H,W = [int(i) for i in input().split()]
ans = 0

for x in range(1,W):
    y = H // 2
    Sa1 = H * x
    Sb1 = (W - x) * y
    Sc1 = (W - x) * (H - y)
    M = max(Sa1,Sb1,Sc1)
    m = min(Sa1,Sb1,Sc1)

    Sa2 = H * x
    Sb2 = H * y
    Sb2 = H * (W - x - y)
    M2 = max(Sa2,Sb2,Sc2)
    m2 = min(Sa2,Sb2,Sc2)

    if ans > min(M-m,M2-m2):
        ans = min(M-m,M2-m2)

print(ans)


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

for x in range(1,W):
    y1 = H // 2
    Sa1 = H * x
    Sb1 = (W - x) * y1
    Sc1 = (W - x) * (H - y1)
    M = max(Sa1,Sb1,Sc1)
    m = min(Sa1,Sb1,Sc1)

    y2 = (W - x) // 2
    Sa2 = H * x
    Sb2 = H * y2
    Sc2 = H * (W - x - y2)
    M2 = max(Sa2,Sb2,Sc2)
    m2 = min(Sa2,Sb2,Sc2)

    if ans > min(M-m,M2-m2):
        ans = min(M-m,M2-m2)

H,W = W,H
for x in range(1,W):
    y = H // 2
    Sa1 = H * x
    Sb1 = (W - x) * y
    Sc1 = (W - x) * (H - y)
    M = max(Sa1,Sb1,Sc1)
    m = min(Sa1,Sb1,Sc1)

    y2 = (W - x) // 2
    Sa2 = H * x
    Sb2 = H * y2
    Sc2 = H * (W - x - y2)
    M2 = max(Sa2,Sb2,Sc2)
    m2 = min(Sa2,Sb2,Sc2)

    if ans > min(M-m,M2-m2):
        ans = min(M-m,M2-m2)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = [int(i) for i in input().split()]
list = []

for i in range(N):
    a,b = [int(i) for i in input().split()]
    for _ in range(b):
        list.append(a)

list.sort()
print(list[K-1])


Fixed submission:
N,K = [int(i) for i in input().split()]
dic = {}
sum = 0

for i in range(N):
    a,b = [int(i) for i in input().split()]
    if a in dic:
        dic[a] += b
    else:
        dic[a] = b

dic = sorted(dic.items())

for i in range(len(dic)):
    sum += dic[i][1]
    if K <= sum:
        print(dic[i][0])
        break
Buggy python submission (verdict: Runtime Error):
A,B = [for(i) for i in input().split()]
if A + B > 24:
  print(A + B -24)
else:
  print(A+B)

Fixed submission:
A,B = [int(i) for i in input().split()]
if A + B >= 24:
  print(A + B -24)
else:
  print(A+B)
Buggy python submission (verdict: Runtime Error):
W,a,b = [int(i) for i input().split()]
if a <= b and b <= a + W:
  print(0)
else:
  print(min(b+W-a,b-a-W))

Fixed submission:
W,a,b = [int(i) for i in input().split()]
if a <= b and b <= a + W:
  print(0)
else:
  print(abs(a-b)-W)