Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from math import gcd
mod = 10**9+7
n = int(input())
dicn = {}
dicp = {}
dicz = {'a': 0, 'b': 0, 'z': 0}
for i in range(n):
  a, b = map(int, input().split())
  if a == 0 and b == 0:
    dicz['z'] += 1
  else:
    g = gcd(a,b)
    a //= g
    b //= g
    if a < 0:
      a *= -1
      b *= -1
    elif a == 0 and b < 0:
      b *= -1
    if a * b > 0:
      if a in dicp:
        if b in dicp[a]:
          dicp[a][b] += 1
        else:
          dicp[a][b] = 1
      else:
        dicp[a] = {b: 1}
    elif a * b < 0:
      if b in dicn:
        if a in dicn[b]:
          dicn[b][a] += 1
        else:
          dicn[b][a] = 1
      else:
        dicn[b] = {a: 1}
    else:
      if a == 0:
        dicz['a'] += 1
      else:
        dicz['b'] += 1

ans = 1

for a in dicp:
  for b in dicp[a]:
    if -a in dicn:
      if b in dicn[-a]:
        ans *= (pow(2, dicp[a][b], mod) + pow(2, dicn[-a][b], mod) - 1)
        dicn[-a][b] = 0
      else:
        ans *= pow(2, dicp[a][b], mod)
    else:
      ans *= pow(2, dicp[a][b], mod)
    ans %= mod

for b in dicn:
  for a in dicn[b]:
    ans *= pow(2, dicn[b][a], mod)
    ans %= mod
    
if dicz['a'] > 0 and dicz['b'] > 0:
  ans *= pow(2,dicz['a'],mod) + pow(2,dicz['b'],mod) - 1
elif dicz['a'] > 0:
  ans *= pow(2,dicz['a'],mod)
elif dicz['b'] > 0:
  ans *= pow(2,dicz['b'],mod)
  
ans += dicz['z']
print((ans-1)%mod)


Fixed submission:
x = int(input()[-1])
if x in [2,4,5,7,9]:
  print('hon')
elif x == 3:
  print('bon')
else:
  print('pon')

Buggy python submission (verdict: Runtime Error):
from math import gcd
mod = 10**9+7
n = int(input())
dicn = {}
dicp = {}
dicz = {'a': 0, 'b': 0, 'z': 0}
for i in range(n):
  a, b = map(int, input().split())
  if a == 0 and b == 0:
    dicz['z'] += 1
  else:
    g = gcd(a,b)
    a //= g
    b //= g
    if a < 0:
      a *= -1
      b *= -1
    elif a == 0 and b < 0:
      b *= -1
    if a * b > 0:
      if a in dicp:
        if b in dicp[a]:
          dicp[a][b] += 1
        else:
          dicp[a][b] = 1
      else:
        dicp[a] = {b: 1}
    elif a * b < 0:
      if b in dicn:
        if a in dicn[b]:
          dicn[b][a] += 1
        else:
          dicn[b][a] = 1
      else:
        dicn[b] = {a: 1}
    else:
      if a == 0:
        dicz['a'] += 1
      else:
        dicz['b'] += 1

ans = 1

for a in dicp:
  for b in dicp[a]:
    if -a in dicn:
      if b in dicn[-a]:
        ans *= (pow(2, dicp[a][b], mod) + pow(2, dicn[-a][b], mod) - 1)
        dicn[-a][b] = 0
      else:
        ans *= pow(2, dicp[a][b], mod)
    else:
      ans *= pow(2, dicp[a][b], mod)
    ans %= mod

for b in dicn:
  for a in dicn[b]:
    ans *= pow(2, dicn[b][a], mod)
    ans %= mod
    
if dicz['a'] > 0 and dicz['b'] > 0:
  ans *= pow(2,dicz['a'],mod) + pow(2,dicz['b'],mod) - 1
elif dicz['a'] > 0:
  ans *= pow(2,dicz['a'],mod)
elif dicz['b'] > 0:
  ans *= pow(2,dicz['b'],mod)
  
ans += pow(2,dicz['z'],mod)
print((ans-1)%mod)


Fixed submission:
x = int(input()[-1])
if x in [2,4,5,7,9]:
  print('hon')
elif x == 3:
  print('bon')
else:
  print('pon')
Buggy python submission (verdict: Time Limit Exceeded):
n, m, k = map(int, input().split())
mod = 998244353

ans = 0
t = 1
b = 1
for i in range(k+1):
  ans += t * pow(m-1, n-1-i, mod) * pow(b, mod-2, mod)
  ans %= mod
  #n-1Ci * (m-1)**i
  t *= (n-1-i)
  b *= (i+1)
print(ans*m%mod)

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

ans = 0
t = 1
b = 1
for i in range(k+1):
  ans += t * pow(m-1, n-1-i, mod) * pow(b, mod-2, mod)
  ans %= mod
  #n-1Ci * (m-1)**i
  t *= (n-1-i)
  t %= mod
  b *= (i+1)
  b %= mod
print(ans*m%mod)
Buggy python submission (verdict: Runtime Error):
def kai(s):
  n = len(s)
  for i in range(n):
    if s[i]!=s[n-i-1]:
      return False
  else:
    return True
  
s = input()
n = len(s)
if kai(s) and kai(s[:(n-1)//2]) and kai(s[(n+3)//2]):
  print('Yes')
else:
  print('No')

Fixed submission:
def kai(s):
  n = len(s)
  for i in range(n):
    if s[i]!=s[n-i-1]:
      return False
  else:
    return True
  
s = input()
n = len(s)
if kai(s) and kai(s[:(n-1)//2]) and kai(s[(n+1)//2]):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
s = []
c = []
for i in range(m):
  _s, _c = map(int, input().split())
  s.append(_s)
  c.append(_c)

s = [0, 0, 10, 100]
g = [10, 10, 100, 1000]
for i in range(s[n], g[n]):
  i_str = str(i)
  for j in range(m):
    if i_str[s[j]-1] != str(c[j]):
      break
  else:
    print(i)
    break
else:
  print(-1)

Fixed submission:
n, m = map(int, input().split())
s = []
c = []
for i in range(m):
  _s, _c = map(int, input().split())
  s.append(_s)
  c.append(_c)

st = [0, 0, 10, 100]
go = [10, 10, 100, 1000]
for i in range(st[n], go[n]):
  i_str = str(i)
  for j in range(m):
    if i_str[s[j]-1] != str(c[j]):
      break
  else:
    print(i)
    break
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
dic = {}
m = 0
for i in range(n):
  s = input()
  if s in dic:
    dic[s] += 1
    m = max(m, dic[s])
  else:
    dic[s] = 1
    m = max(m, dic[s])
ans = []
for s in dic:
  if dic[s] == m:
    ans.append(s)
print('\n'.join(ans.sort()))

Fixed submission:
print('Yes' if len(set(input().split()))==2 else 'No')
Buggy python submission (verdict: Runtime Error):
n = int(input().split())
for a in list(map(int, input().split())):
  if a % 2 == 0:
    if a % 3 != 0 and a % 5 != 0:
      print('DENIED')
      break
else:
  print('APPROVED')

Fixed submission:
n = int(input())
for a in list(map(int, input().split())):
  if a % 2 == 0:
    if a % 3 != 0 and a % 5 != 0:
      print('DENIED')
      break
else:
  print('APPROVED')
Buggy python submission (verdict: Runtime Error):
n = int(input())
dic = {}
m = 0
for i in range(n):
  s = input()
  if s in dic:
    dic[s] += 1
    m = max(m, dic[s])
  else:
    dic[s] = 1
    m = max(m, dic[s])
ans = []
for s in dic:
  if dic[s] == m:
    ans.append(s)
print('\n'.join(ans.sort()))

Fixed submission:
n = int(input())
dic = {}
m = 0
for i in range(n):
  s = input()
  if s in dic:
    dic[s] += 1
    m = max(m, dic[s])
  else:
    dic[s] = 1
    m = max(m, dic[s])
ans = []
for s in dic:
  if dic[s] == m:
    ans.append(s)
print('\n'.join(sorted(ans)))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
l = [0 for _ in range(max(a)+1)]
for i in range(n):
  if l[a[i]] == 0:
    l[a[i]] += 1
  else:
    print('NO')
    break
else:
  print('YES')

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
if len(a) != len(set(a)):
  print('NO')
else:
  print('YES')
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.buffer.readline
n = int(input())
a = list(map(int, input().split()))
from fractions import gcd
def lcm(x,y):
  return (x*y)//gcd(x,y)
l = 1
mod = 10**9+7
for i in range(n):
  l = lcm(l, a[i])
ans = 0
for i in range(n):
  ans += l // a[i]
print(ans%mod)


Fixed submission:
if eval(input().replace(' ','==')):
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.buffer.readline
n = int(input())
a = list(map(int, input().split()))
from fractions import gcd
def lcm(x,y):
  return (x*y)//gcd(x,y)
l = 1
mod = 10**9+7
for i in range(n):
  l = lcm(l, a[i])
ans = 0
for i in range(n):
  ans += l // a[i]
  ans %= mod
print(ans)


Fixed submission:
if eval(input().replace(' ','==')):
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.buffer.readline
n = int(input())
a = list(map(int, input().split()))
from fractions import gcd
def lcm(x,y):
  return (x*y)//gcd(x,y)
l = 1
mod = 10**9+7
for i in range(n):
  l = lcm(l, a[i])
l %= mod
ans = 0
for i in range(n):
  ans += l // a[i]
  ans %= mod
print(ans)

Fixed submission:
if eval(input().replace(' ','==')):
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.buffer.readline
n = int(input())
a = list(map(int, input().split()))
from fractions import gcd
def lcm(x,y):
  return (x*y)//gcd(x,y)
l = 1
mod = 10**9+7
for i in range(n):
  l = lcm(l, a) % mod
ans = 0
for i in range(n):
  ans += l // a[i]
  ans %= mod
print(ans)


Fixed submission:
if eval(input().replace(' ','==')):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
if a >= k:
  print('{} {}'.format(a-k.b))
elif a+b >= k:
  print('0 {}'.format(b-(k-a)))
else:
  print('0 0')

Fixed submission:
st = input().split()
print(st[1]+st[0])
Buggy python submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
if a >= k:
  print('{} {}'.format(a-k.b))
elif a+b >= k:
  print('0 {}'.format(b-(k-a)))
else:
  print('0 0')


Fixed submission:
a, b, k = map(int, input().split())
if a >= k:
  print('{} {}'.format(a-k,b))
elif a+b >= k:
  print('0 {}'.format(b-(k-a)))
else:
  print('0 0')
Buggy python submission (verdict: Runtime Error):
n, m, v, p = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
ans = p
c = [0]
cnt = 0
for i in range(n):
  # 累積和
  cnt += a[i]
  c.append(cnt)
for i in range(p,n):
  h = a[i]+m
  free = v - (p-1) - (n-i)
  d = h * (i-p+1) - (c[i]-c[p-1]) # 余裕
  if d >= free*m:
    ans += 1
print(ans)

Fixed submission:
n, a, b = map(int, input().split())
if abs(a-b)%2==0:
  print(abs(a-b)//2)
else:
  m = min(a,b)
  M = max(a,b)
  if M - m == 1:
    if m-1 < n-M:
      print((M-1))
    else:
      print((n-m))
  else:
    if m-1 < n-M:
      print((m-1)+1+(M-m-1)//2)
    else:
      print((n-M)+1+(M-m-1)//2)
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())
if n % 2 == 0:
  m = math.ceil(math.log(n, 5))

  ans = 0
  for i in range(1, m+1):
    ans += n // (2*5**i)
  print(ans)
else:
  print(0)

Fixed submission:
import math

n = int(input())
if n == 0:
  print(0)
elif n % 2 == 0:
  m = math.ceil(math.log(n, 5))
  ans = 0
  for i in range(1, m+1):
    ans += n // (2*5**i)
  print(ans)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
m, d = map(int, input().split())
print(1 if input().split()[1]-d!=1 else 0)

Fixed submission:
m, d = map(int, input().split())
print(1 if int(input().split()[1])-d!=1 else 0)
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = []
y = []
for i in range(n):
  _x, _y = map(int, input().split())
  x.append(_x)
  y.append(_y)
#それぞれの組み合わせに対して2*(n-1)!回ずつ合計に加算される→平均への寄与は2/n倍
def d(x1, y1, x2, y2):
  return ((x1-x2)**2 + (y1-y2)**2)**0.5

ans = 0
for i in range(n):
  for j in range(i+1, n):
    ans += d(x[i], y[i], x[j], y[j])
print(ans*2/n)


Fixed submission:
print((int(input()))**2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
d = list(map(int, input()))
s = sum(d)

print(sum(list(map(lambda x:(s-x)*x, d))))

Fixed submission:
n = int(input())
d = list(map(int, input().split()))
s = sum(d)

print(sum(list(map(lambda x:(s-x)*x, d)))//2)
Buggy python submission (verdict: Runtime Error):
n = int(input())
_ = list(map(int, input()))
a = []
for i in range(1,n+1):
  a.append(_[i-1], i)
  
ans = []
a_sort = (sorted(a, key=lambda x: x[0]))
for i in range(n):
  ans.append(a_sort[i][1])
  
print(' '.join(list(map(str, ans))))

Fixed submission:
n = int(input())
_ = list(map(int, input().split()))
a = []
for i in range(1,n+1):
  a.append([_[i-1], i])
  
ans = []
a_sort = (sorted(a, key=lambda x: x[0]))
for i in range(n):
  ans.append(a_sort[i][1])
  
print(' '.join(list(map(str, ans))))
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

ans = 0
for i in range(n):
  for j in range(i, n):
    if s[i:j+1] in s[j+1:]:
      ans = max(ans, j-i+1)
    else:
      break
print(ans)


Fixed submission:
s = input()
if s == 'Sunny':
  print('Cloudy')
elif s == 'Cloudy':
  print('Rainy')
else:
  print('Sunny')
Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
value = sum(a)
used = []
import math
for i in range(m):
  if value == 0:
    break
  
  if used != []:
    if a != []:
      if max(used) < a[-1]:
        value -= math.ceil(a[-1]/2)
        used.append(math.floor(a[-1]/2))
        a = a[:-1]
      else:
        use = max(used)
        value -= math.ceil(use/2)
        used[used.index(use)] //= 2
    else:
      use = max(used)
      value -= math.ceil(use/2)
      used[used.index(use)] //= 2
  else:
    value -= math.ceil(a[-1]/2)
    used.append(math.floor(a[-1]/2))
    a = a[:-1]
print(value)

Fixed submission:
n, m = map(int, input().split())
a = list(map(lambda x: -int(x), input().split()))
import heapq
import math
value = -sum(a)
heapq.heapify(a)

for i in range(m):
  use = heapq.heappop(a)
  value += math.floor(use/2)
  heapq.heappush(a, math.ceil(use/2))
  
print(value)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
value = sum(a)
used = []
import math
for i in range(m):
  if used != []:
    if a != []:
      if max(used) < a[-1]:
        value -= math.ceil(a[-1]/2)
        used.append(math.floor(a[-1]/2))
        a = a[:-1]
      else:
        use = max(used)
        value -= math.ceil(use/2)
        used[used.index(use)] //= 2
    else:
      use = max(used)
      value -= math.ceil(use/2)
      used[used.index(use)] //= 2
  else:
    value -= math.ceil(a[-1]/2)
    used.append(math.floor(a[-1]/2))
    a = a[:-1]
print(value)

Fixed submission:
n, m = map(int, input().split())
a = list(map(lambda x: -int(x), input().split()))
import heapq
import math
value = -sum(a)
heapq.heapify(a)

for i in range(m):
  use = heapq.heappop(a)
  value += math.floor(use/2)
  heapq.heappush(a, math.ceil(use/2))
  
print(value)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = 0
for i in range(n-1):
  s += i + 1
print(s)

Fixed submission:
n = int(input())
print(n * (n - 1) // 2)
Buggy python submission (verdict: Runtime Error):
l, r = map(int, input().split())
import math

ans = 0
inf = math.ceil(math.log(l, 2))
sup = math.floor(math.log(r+1, 2)) - 1
for i in range(inf, sup+1):
  ans += 3 ** i

for i in range(l, 2 ** inf):
  n = bin(i).count('0') - 1
  ans += 2 ** n

for i in range(2 ** (sup + 1), r + 1):
  n = bin(i).count('1') - 1
  ans += 2 ** n
print(ans % int(10**9+7))

Fixed submission:
a = int(input())
s = input()

if a >= 3200:
  print(s)
else:
  print('red')
Buggy python submission (verdict: Runtime Error):
s = input()
t = input()

for i in range(len(t)):
  if not t[i] in s:
    print(-1)
    break
else:
  j = 0
  for i in rane(len(t)):
    j = s[j:].find(t[i])
    if j == -1:
      counter += 1
      j = s.find(t[i])
  print(counter * len(s) + j + 1)

Fixed submission:
s = input()
t = input()

for i in range(len(t)):
  if not t[i] in s:
    print(-1)
    break
else:
  j = -1
  counter = 0
  for i in range(len(t)):
    if t[i] in s[j+1:]:
      j = s[j+1:].find(t[i]) + j + 1
    else:
      counter += 1
      j = s.find(t[i])
  print(counter * len(s) + j + 1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
_a = input().split()

a = []

x = []

for i in range(n):
  a.append(2*int(_a[i]))
  x.append(0)
  
for i in range(1, n):
  a[i] -= a[i-1]

x[n-1] = a[n-1] // 2

for i in range(n-2, -1, -1):
  if i%2==0:
    x[i] = a[i] - x[n-1]
  else:
    x[i] = a[i] + x[n-1]
    
ans = str(x[n-1]) + ' '
for i in range(n-1):
  ans += str(x[i]) + ' '
  

print(ans[:-1])


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

n = int(nab[0])
a = int(nab[1])
b = int(nab[2])

print(min(a*n, b))
Buggy python submission (verdict: Runtime Error):
lr = input().split()
l = int(lr[0])
r = int(lr[1])

mini = 2020
for i in range(l, r+1):
  j = i+1
  while j>i and j<=r:
    q = (i*j)%2019
    j = j + (2018-q)//i
    mini = min(mini, q)
    
print(mini)


Fixed submission:
lr = input().split()
l = int(lr[0])
r = int(lr[1])

mini = 2018

for i in range(l, r+1):
  for j in range(i+1, r+1):
    mini = min(mini, (i*j)%2019)

    if mini==0:
      break
  if mini==0:
    break
print(mini)

Buggy python submission (verdict: Time Limit Exceeded):
lr = input().split()
l = int(lr[0])
r = int(lr[1])

mini = 2020
for i in range(l, r+1):
  for j in range(i+1, r+1):
    mini = min(mini, (i*j)%2019)
    
print(mini)

Fixed submission:
lr = input().split()
l = int(lr[0])
r = int(lr[1])

mini = 2018

for i in range(l, r+1):
  for j in range(i+1, r+1):
    mini = min(mini, (i*j)%2019)

    if mini==0:
      break
  if mini==0:
    break
print(mini)
Buggy python submission (verdict: Runtime Error):
n = int(input())
_a = input().split()

a = []

x = []

for i in range(n):
  a.append(2*int(_a[i]))
  x.append(0)
  
for i in range(1, n):
  a[i] = a[i-1]

x[n] = a[n]

for i in range(n-1, 0, -1):
  if i%2==0:
    x[i] = a[i] + x[n]
  else:
    x[i] = a[i] - x[n]
    
ans = ''
for i in range(n):
  ans += str(x[i]) + ' '
  
print(ans[:-1])


Fixed submission:
n = int(input())
_a = input().split()

a = []

x = []

for i in range(n):
  a.append(2*int(_a[i]))
  x.append(0)
  
for i in range(1, n):
  a[i] -= a[i-1]

x[n-1] = a[n-1] // 2

for i in range(n-2, -1, -1):
  if i%2==0:
    x[i] = a[i] - x[n-1]
  else:
    x[i] = a[i] + x[n-1]
    
ans = str(x[n-1]) + ' '
for i in range(n-1):
  ans += str(x[i]) + ' '
  

print(ans[:-1])
Buggy python submission (verdict: Runtime Error):
s = input()

letters = []
for i in range(n):
  if not s[0] in letters:
    letters.append(s[0])
  
if len(letters)==2 and letters.count(s[0])==2:
  print('Yes')
else:
  print('No')

Fixed submission:
s = input()

letters = []
for i in range(4):
  if not s[i] in letters:
    letters.append(s[i])
  
if len(letters)==2 and s.count(s[0])==2:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n = input()
p = input().split()

s = 0
for i in range(n-2):
  if max(int(p[i]), int(p[i+1]), int(p[i+2])) != int(p[i+1]) and min(int(p[i]), int(p[i+1]), int(p[i+2])) != int(p[i+1]):
    s += 1

print(s)

Fixed submission:
n = int(input())
p = input().split()

s = 0
for i in range(n-2):
  if max(int(p[i]), int(p[i+1]), int(p[i+2])) != int(p[i+1]) and min(int(p[i]), int(p[i+1]), int(p[i+2])) != int(p[i+1]):
    s += 1

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))

ans = 0
for i in range(n):
  g = 0
  for j in range(n):
    if i != j:
      g = gcd(g, a[j])
  ans = max(ans, g)
print(ans)

Fixed submission:
from fractions import gcd

n = int(input())
a = list(map(int, input().split()))

l = []
g = 0
for i in range(n):
  tmp = gcd(g, a[i])
  if tmp < g or g == 0:
    l.append(i)
  g = tmp

ans = 0
for i in l:
  g = 0
  for j in range(n):
    if i != j:
      g = gcd(g, a[j])
  ans = max(ans, g)
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())
print(max(a+b, 2*a-1, 2*b-1))

Fixed submission:
a, b = map(int, input().split())
print(max(a+b, 2*a-1, 2*b-1))
Buggy python submission (verdict: Time Limit Exceeded):
x, y, z, k = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)

p = []
for i in range(x):
  for j in range(y):
    for l in range(z):
      if (i+1) * (j+1) * (l+1) <= k:
        p.append(a[i]+b[j]+c[l])

p.sort(reverse=True)

for i in range(k):
  print(p[i])

Fixed submission:
x, y, z, k = map(int, input().split())
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)

p = []
for i in range(x):
  if i <= k:
    for j in range(y):
      if (i+1) * (j+1) <= k:
        for l in range(z):
          if (i+1) * (j+1) * (l+1) <= k:
            p.append(a[i]+b[j]+c[l])
          else:
            break
      else:
        break
  else:
    break

p.sort(reverse=True)

for i in range(k):
  print(p[i])
Buggy python submission (verdict: Runtime Error):
print(eval('min('+input()[::-1].replace(' ',',',1).replace(' ','//')+')'))

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

Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input(9.split()))
print(max(b//a, c))

Fixed submission:
a, b, c = map(int, input().split())
print(min(b//a, c))
Buggy python submission (verdict: Runtime Error):
import bisect
a, b, q = map(int, input().split())
inf = 10**18
s = [-inf] + [int(input()) for i in range(a)] + [inf]
t = [-inf] + [int(input()) for i in range(b)] + [inf]

for i in range(q):
  x = int(input())
  b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
  res = inf
  for S in [s[b-1], s[b]]:
    for T in [t[d-1], t[d]]:
      d1, d2 = abs(S-x) + abs(T-S), abs(T-x) + abs(S-T)
      res = min(d1, d2, res)
  print(res)


Fixed submission:
print('Heisei' if int(input().replace('/',''))<=20190430 else 'TBD')
Buggy python submission (verdict: Runtime Error):
import bisect
a, b, q = map(int, input().split())
inf = 10**18
s = [-inf] + [int(input()) for i in range(a)] + [inf]
t = [-inf] + [int(input()) for i in range(b)] + [inf]

for i in range(q):
  x = int(input())
  b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
  res = inf
  for S in [s[b-1], s[b]]:
    for T in [t[b-1], t[b]]:
      d1, d2 = abs(S-x) + abs(T-S), abs(T-x) + abs(S-T)
      res = min(d1, d2, res)
  print(res)


Fixed submission:
import bisect
a, b, q = map(int, input().split())
inf = 10**18
s = [-inf] + [int(input()) for i in range(a)] + [inf]
t = [-inf] + [int(input()) for i in range(b)] + [inf]

for i in range(q):
  x = int(input())
  b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
  res = inf
  for S in [s[b-1], s[b]]:
    for T in [t[d-1], t[d]]:
      d1, d2 = abs(S-x) + abs(T-S), abs(T-x) + abs(S-T)
      res = min(d1, d2, res)
  print(res)

Buggy python submission (verdict: Runtime Error):
import bisect
a, b, q = map(int, input().split())
inf = 10**18
s = [-inf] + [int(input()) for i in range(a)] + [inf]
t = [-inf] + [int(input()) for i in range(b)] + [inf]

for i in range(q):
  x = int(input())
  b, d = bisect.bisect_right(s, x), bisect_right(t, x)
  res = inf
  for S in [s[b-1], s[b]]:
    for T in [t[b-1], t[b]]:
      d1, d2 = abs(S-x) + abs(T-S), abs(T-x) + abs(S-T)
      res = min(d1, d2, res)
  print(res)

Fixed submission:
import bisect
a, b, q = map(int, input().split())
inf = 10**18
s = [-inf] + [int(input()) for i in range(a)] + [inf]
t = [-inf] + [int(input()) for i in range(b)] + [inf]

for i in range(q):
  x = int(input())
  b, d = bisect.bisect_right(s, x), bisect.bisect_right(t, x)
  res = inf
  for S in [s[b-1], s[b]]:
    for T in [t[d-1], t[d]]:
      d1, d2 = abs(S-x) + abs(T-S), abs(T-x) + abs(S-T)
      res = min(d1, d2, res)
  print(res)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input())
a = list(map(int, input().split()))[1:]
for i in range(n - 1):
  foods = list(map(int, input().split()))[1:]
  for food in a:
    if not food in foods:
      a.remove(food)
print(len(a))

Fixed submission:
n, m = map(int, input().split())
likes = [0 for i in range(m + 1)]

for i in range(n):
  for food in list(map(int, input().split()))[1:]:
    likes[food] += 1
print(len(list(filter(lambda x: x==n, likes))))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
if n >= m:
  print(0)
else:
  x = sorted(list(map(int, input().split())))

  y = []
  for i in range(m-1):
    y.append(h[i+1] - h[i])

  y_sorted = sorted(y, reverse=True)

  ans = 0
  for _y in y[n:]:
    ans += _y
  print(ans)

Fixed submission:
n, m = map(int, input().split())
if n >= m:
  print(0)
else:
  x = sorted(list(map(int, input().split())))

  y = []
  for i in range(m-1):
    y.append(x[i+1] - x[i])

  y_sorted = sorted(y, reverse=True)

  ans = 0
  for _y in y_sorted[n-1:]:
    ans += _y
  print(ans)
Buggy python submission (verdict: Runtime Error):
a=sorted(list(map(int,input().split())))
print(a*b//2)

Fixed submission:
a=sorted(list(map(int,input().split())))
print(a[0]*a[1]//2)