Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())

for i in range(1, n + 1):
  cnt = 0
  for s in range(int(math.sqrt(n)) + 1 + 1):
    for x in range(1, s + 1):
      for y in range(1, s - x + 1):
        z = s - x - y
        if 1 <= z:
          if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == i:
            cnt += 1
  print(cnt)


Fixed submission:
import math

n = int(input())

cnts = [0] * (n + 1)
sn = int(math.sqrt(n)) + 1
for x in range(1, sn + 1):
  for y in range(1, sn + 1):
    for z in range(1, sn + 1):
      g = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
      if 1 <= g <= n:
        cnts[g] += 1

for i in range(1, n + 1):
  print(cnts[i])

Buggy python submission (verdict: Time Limit Exceeded):
import math

n = int(input())

for i in range(1, n + 1):
  cnt = 0
  for s in range(int(math.sqrt(n)) + 1 + 1):
    for x in range(1, s + 1):
      for y in range(1, s - x + 1):
        z = s - x - y
        if 1 <= z:
          if x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x == i:
            cnt += 1
  print(cnt)


Fixed submission:
import math

n = int(input())

cnts = [0] * (n + 1)
sn = int(math.sqrt(n)) + 1
for x in range(1, sn + 1):
  for y in range(1, sn + 1):
    for z in range(1, sn + 1):
      g = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
      if 1 <= g <= n:
        cnts[g] += 1

for i in range(1, n + 1):
  print(cnts[i])
Buggy python submission (verdict: Runtime Error):
a=int(input())
print(round((a*(a-(-1+math.sqrt(3)*(1j))/2)*(a-(-1-math.sqrt(3)*(1j))/2)).real))

Fixed submission:
a=int(input())
print(a+a**2+a**3)
Buggy python submission (verdict: Time Limit Exceeded):
n, m, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))

sb = [0] * (m + 1)
for j in range(m):
  sb[j + 1] = sb[j] + b[j]

sa = 0
anses = []
for i in range(n + 1):
  for j in range(m + 1):
    # print(sa,sb[j])
    if sa + sb[j] <= k:
      anses.append(i + j)
  if i == n:
    break
  sa += a[i]

print(max(anses))


Fixed submission:
import bisect

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


sa = [0] * (n + 1)
for i in range(n):
  sa[i + 1] = sa[i] + a[i]

sb = [0] * (m + 1)
for j in range(m):
  sb[j + 1] = sb[j] + b[j]

anses = [0]
for i in range(n + 1):
  if sa[i] > k:
    continue
  anses.append(i + bisect.bisect(sb, k - sa[i]) - 1)

print(max(anses))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]

import collections

buk = [0] * (10**5 + 1)
for e in a:
  buk[e] += 1


# dprint(buk)

for b, c in bc:
  sum = 0
  for k in range(10 ** 5 + 1):
    if buk[k] == 0:
      continue
    if k == b:
      # dprint(b, c)
      buk[c] += buk[b]
      buk[b] = 0
      # dprint(buk)
      sum += c * buk[c]
    else:
      if k != c:
        sum += k * buk[k]
    # dprint('sum', '=', sum)
  print(sum)


Fixed submission:
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc = [list(map(int, input().split())) for _ in range(q)]

import collections

buk = [0] * (10**5 + 1)
for e in a:
  buk[e] += 1

s = sum(a)

for b, c in bc:
  s += (c - b) * buk[b]
  buk[c] += buk[b]
  buk[b] = 0
  print(s)
Buggy python submission (verdict: Runtime Error):
x, n = list(map(int, input().split()))
p = list(map(int, input().split()))


for i in range(x, 0, -1):
  if not i in p:
    a1 = i
    break

for i in range(x, 100 + 2):
  if not i in p:
    a2 = i
    break

if x - a1 <= a2 - x:
  print(a1)
else:
  print(a2)


Fixed submission:
x, n = list(map(int, input().split()))
p = list(map(int, input().split()))

q = set(range(-1, 100 + 2)) - set(p)

f = []

for e in q:
  f.append((abs(e - x), e - x))

print(x + min(f)[1])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = 1
for e in a:
  ans *= e
if ans > 10 ** 18:
  print('-1')
  exit()

print(ans)


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

a.sort()

ans = 1
for e in a:
  ans *= e
  if ans > 10 ** 18:
    print('-1')
    exit()


print(ans)
Buggy python submission (verdict: Runtime Error):
n, m, q = list(map(int, input().split()))
abcd = [list(map(int, input().split())) for _ in range(q)]

import itertools
anses = []
# for A in itertools.product(sum(([i]*n for i in range(1,m+1)),[]), repeat=n):

# for A in itertools.product(range(1, m + 1), repeat=n):


def f(i, A):
  for ai in range(A[-1], m + 1):
    if len(A) < m:
      f(ai, A + [ai])
    else:
      p = 0
      for a, b, c, d in abcd:
        a -= 1
        b -= 1
        if A[b] - A[a] == c:
          p += d
      anses.append(p)


f(0, [1])
print(max(anses))


Fixed submission:
n, m, q = list(map(int, input().split()))
abcd = [list(map(int, input().split())) for _ in range(q)]

import itertools
anses = []
# for A in itertools.product(sum(([i]*n for i in range(1,m+1)),[]), repeat=n):
# for A in itertools.product(range(1, m + 1), repeat=n):

def f(A):
  for ai in range(A[-1], m + 1):
    if len(A) < n:
      f(A + [ai])
    else:
      p = 0
      for a, b, c, d in abcd:
        a -= 1
        b -= 1
        if A[b] - A[a] == c:
          p += d
      anses.append(p)

f([1])
print(max(anses))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

import collections
for i in range(1, n + 1):
  print(collections.Counter(a)[i])


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

# import collections
# for i in range(1, n + 1):
#   print(collections.Counter(a)[i])

b = [0] * (n + 1)

for e in a:
  b[e] += 1

for i in range(1, n + 1):
  print(b[i])

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

import collections
for i in range(1, n + 1):
  print(collections.Counter(a)[i])


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

# import collections
# for i in range(1, n + 1):
#   print(collections.Counter(a)[i])

b = [0] * (n + 1)

for e in a:
  b[e] += 1

for i in range(1, n + 1):
  print(b[i])
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n = int(input())
s = input()

rs, gs, bs = [], [], []
for l, c in enumerate(s):
  if c == 'R':
    rs.append(l)
  if c == 'G':
    gs.append(l)
  if c == 'B':
    bs.append(l)
sbs = set(bs)

ans = 0
for r in rs:
  for g in gs:
    m = min(r, g)
    M = max(r, g)
    notbs = [m - (M - m), M + (M - m)]
    if (M + m) % 2 == 0:
      notbs.append((M + m) // 2)
    dprint(m, M, notbs, bs)
    a = len(sbs - set(notbs))
    if a > 0:
      ans += a


print(ans)


Fixed submission:
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n = int(input())
s = input()

rs, gs, bs = [], [], []
for l, c in enumerate(s):
  if c == 'R':
    rs.append(l)
  if c == 'G':
    gs.append(l)
  if c == 'B':
    bs.append(l)
sbs = set(bs)

ans = 0
for r in rs:
  for g in gs:
    m = min(r, g)
    M = max(r, g)
    notbs = [m - (M - m), M + (M - m)]
    if (M + m) % 2 == 0:
      notbs.append((M + m) // 2)
    
    dprint(m, M, notbs, sbs)
    
    # a = len(sbs - set(notbs))

    a = len(sbs)
    for notb in notbs:
      if notb in sbs:
        a -= 1
    if a > 0:
      ans += a


print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n = int(input())
s = input()

rs, gs, bs = [], [], []
for l, c in enumerate(s):
  if c == 'R':
    rs.append(l)
  if c == 'G':
    gs.append(l)
  if c == 'B':
    bs.append(l)
sbs = set(bs)

ans = 0
for r in rs:
  for g in gs:
    m = min(r, g)
    M = max(r, g)
    notbs = [m - (M - m), M + (M - m)]
    if (M + m) % 2 == 0:
      notbs.append((M + m) // 2)
    dprint(m, M, notbs, bs)
    a = len(sbs - set(notbs))
    if a > 0:
      ans += a


print(ans)


Fixed submission:
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n = int(input())
s = input()

rs, gs, bs = [], [], []
for l, c in enumerate(s):
  if c == 'R':
    rs.append(l)
  if c == 'G':
    gs.append(l)
  if c == 'B':
    bs.append(l)
sbs = set(bs)

ans = 0
for r in rs:
  for g in gs:
    m = min(r, g)
    M = max(r, g)
    notbs = [m - (M - m), M + (M - m)]
    if (M + m) % 2 == 0:
      notbs.append((M + m) // 2)
    
    dprint(m, M, notbs, sbs)
    
    # a = len(sbs - set(notbs))

    a = len(sbs)
    for notb in notbs:
      if notb in sbs:
        a -= 1
    if a > 0:
      ans += a


print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

if '7' in str(n):
  print('Yes')
else:
  print('NO')


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

x,y=y,x
x,z=z,x

print(x,y,z)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))

anses = []
for i in range(n - k + 1):
  ans = 0
  for e in p[i:i + k]:
    ans += (e + 1) / 2
  anses.append(ans)
print(max(anses))


Fixed submission:
n, k = list(map(int, input().split()))
p = list(map(int, input().split()))

ans = 0
for e in p[0:k]:
  ans += (e + 1) / 2
anses = [ans]

for i in range(n - k):
  ans -= (p[i] + 1) / 2
  ans += (p[k + i] + 1) / 2
  anses.append(ans)

print(max(anses))
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10**9 + 7  # 出力の制限

r1, c1, r2, c2 = list(map(int, input().split()))


# https://qiita.cmb/derodero24/items/91b6468e66923a87f39f
def cmb(n, r):
  if (r < 0 or r > n):
    return 0
  r = min(r, n - r)
  return g1[n] * g2[r] * g2[n - r] % MOD


N = 10**7
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
  g1.append((g1[-1] * i) % MOD)
  inverse.append((-inverse[MOD % i] * (MOD // i)) % MOD)
  g2.append((g2[-1] * inverse[-1]) % MOD)

print(cmb(c1 + r1, r1) - cmb(1 + c2 + r1, r1) -
      cmb(1 + c1 + r2, 1 + r2) + cmb(2 + c2 + r2, 1 + r2))


Fixed submission:
MOD = 10**9 + 7  # 出力の制限

r1, c1, r2, c2 = list(map(int, input().split()))


# https://qiita.cmb/derodero24/items/91b6468e66923a87f39f
def cmb(n, r):
  if (r < 0 or r > n):
    return 0
  r = min(r, n - r)
  return g1[n] * g2[r] * g2[n - r] % MOD


N = 2 * 10**6 + 3
g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
  g1.append((g1[-1] * i) % MOD)
  inverse.append((-inverse[MOD % i] * (MOD // i)) % MOD)
  g2.append((g2[-1] * inverse[-1]) % MOD)

# Sum[Sum[Binomial[i + j, i], {i, r1, r2}], {j, c1, c2}]
# Binomial[c1 + r1, r1] - Binomial[1 + c2 + r1, r1] -  Binomial[1 + c1 + r2, 1 + r2] + Binomial[2 + c2 + r2, 1 + r2]

print((cmb(c1 + r1, r1) - cmb(1 + c2 + r1, r1) -
       cmb(1 + c1 + r2, 1 + r2) + cmb(2 + c2 + r2, 1 + r2)) % MOD)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


h, n = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]

INF = 2 ** 64
dprint(INF)
dp = [INF] * (h + 10 ** 4)
dp[0] = 0

for j in range(h):
  for a, b in ab:
    dp[j + a] = min(dp[j + a], dp[j] + b)

dprint(dp[:10])
print(min(dp[h:]))


Fixed submission:
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


h, n = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]

INF = 2 ** 64
dprint(INF)
dp = [INF] * (h + 10 ** 4)
dp[0] = 0

for j in range(h):
  for a, b in ab:
    dp[j + a] = min(dp[j + a], dp[j] + b)

dprint(dp[:10])
print(min(dp[h:]))

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


h, n = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]

import math
dp = [math.inf] * (h + 10 ** 4)
dp[0] = 0

for j in range(h):
  for a, b in ab:
    dp[j + a] = min(dp[j + a], dp[j] + b)

dprint(dp[:10])
print(min(dp[h:]))


Fixed submission:
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


h, n = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(n)]

INF = 2 ** 64
dprint(INF)
dp = [INF] * (h + 10 ** 4)
dp[0] = 0

for j in range(h):
  for a, b in ab:
    dp[j + a] = min(dp[j + a], dp[j] + b)

dprint(dp[:10])
print(min(dp[h:]))
Buggy python submission (verdict: Time Limit Exceeded):
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

a.sort()

a2 = []
for i, x in enumerate(a):
  a2.append((x, i))

from math import factorial


def c(n, r):
  if n - r < 0:
    return 0
  return factorial(n) // factorial(r) // factorial(n - r)


ma = 0
mi = 0
for i in range(n):
  ma += a[i] * c(i, k - 1)
  mi += a[i] * c(n - i - 1, k - 1)

MOD = 10**9 + 7
print((ma - mi) % MOD)


Fixed submission:
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

a.sort()

a2 = []
for i, x in enumerate(a):
  a2.append((x, i))

from math import factorial


def c(n, r):
  if n - r < 0:
    return 0
  return factorial(n) // factorial(r) // factorial(n - r)


MOD = 10**9 + 7  # 出力の制限

# https://qiita.com/derodero24/items/91b6468e66923a87f39f


def cmb(n, r):
  if (r < 0 or r > n):
    return 0
  r = min(r, n - r)
  return g1[n] * g2[r] * g2[n - r] % MOD


g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, n + 1):
  g1.append((g1[-1] * i) % MOD)
  inverse.append((-inverse[MOD % i] * (MOD // i)) % MOD)
  g2.append((g2[-1] * inverse[-1]) % MOD)


ma = 0
mi = 0
for i in range(n):
  ma += a[i] * cmb(i, k - 1)
  mi += a[i] * cmb(n - i - 1, k - 1)

print((ma - mi) % MOD)
Buggy python submission (verdict: Runtime Error):
n = int(input())
xy = [list(map(int,input().split())) for _ in range(n)]

import math
if n == 2:
  (x1, y1), (x2, y2) = xy
  print(math.sqrt((x2-x1)**2+(y2-y1)**2)/2)

rs=[]
import itertools
for com in itertools.combinations(xy, 3):
  (x1, y1), (x2, y2),(x3,y3)= com
  a=x1*(y2-y3)-y1*(x2-x3)+x2*y3-x3*y2
  b=(x1**2+y1**2)*(y3-y2)+(x2**2+y2**2)*(y1-y3)+(x3**2+y3**2)*(y2-y1)
  c=(x1**2+y1**2)*(x2-x3)+(x2**2+y2**2)*(x3-x1)+(x3**2+y3**2)*(x1-x2)
  d = (x1 ** 2 + y1 ** 2) * (x3 * y2 - x2 * y3) + (x2 ** 2 + y2 ** 2) * (x1 * y3 - x3 * y1) + (x3 ** 2 + y3 ** 2) * (x2 * y1 - x1 * y2)
  if a == 0:
    continue
  x=-b/(2*a)
  y=-c/(2*a)
  r = math.sqrt((b ** 2 + c ** 2 - 4 * a * d) / (4 * a ** 2))
  
  rs.append(r)

print(max(rs))


Fixed submission:
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]


import math
import itertools


def distanse(x1, y1, x2, y2):
  return math.sqrt((x1 - x2)**2 + (y1 - y2)**2)


def isValid(ox, oy, r):
  # global ox, oy, r
  global xy
  for x, y in xy:
    if distanse(x, y, ox, oy) - r > 1e-6:
      return False
  return True


rs = []
for (x1, y1), (x2, y2) in itertools.combinations(xy, r=2):
  dprint(x1, y1, x2, y2)
  r = distanse(x1, y1, x2, y2) / 2
  ox = (x1 + x2) / 2
  oy = (y1 + y2) / 2
  dprint(ox, oy, r)
  if isValid(ox, oy, r):
    rs.append(r)
# for c1, c2 in itertools.combinations(xy, r=2):
#   dprint(c1, c2)
#   r = distanse(c1, c2)
#   o=(c1+c2)/2

for (x1, y1), (x2, y2), (x3, y3) in itertools.combinations(xy, r=3):
  # http://www.ambrsoft.com/TrigoCalc/Circle3D.htm
  a = x1 * (y2 - y3) - y1 * (x2 - x3) + x2 * y3 - x3 * y2
  b = (x1**2 + y1**2) * (y3 - y2) + (x2**2 + y2**2) * \
      (y1 - y3) + (x3**2 + y3**2) * (y2 - y1)
  c = (x1**2 + y1**2) * (x2 - x3) + (x2**2 + y2**2) * \
      (x3 - x1) + (x3**2 + y3**2) * (x1 - x2)
  d = (x1 ** 2 + y1 ** 2) * (x3 * y2 - x2 * y3) + (x2 ** 2 + y2 ** 2) * \
      (x1 * y3 - x3 * y1) + (x3 ** 2 + y3 ** 2) * (x2 * y1 - x1 * y2)
  if a == 0:
    continue
  ox = -b / (2 * a)
  oy = -c / (2 * a)
  r = math.sqrt((b ** 2 + c ** 2 - 4 * a * d) / (4 * a ** 2))
  if isValid(ox, oy, r):
    rs.append(r)

dprint(rs)
print('{:.18f}'.format(min(rs)))
Buggy python submission (verdict: Time Limit Exceeded):
LOCAL = True   and False


def dprint(*args):
  if LOCAL:
    print(*args)


n = int(input())
a = []
xy = []
# x = []
# y = []
for _ in range(n):
  a.append(int(input()))
  # for _ in range(a[-1]):
  # xy = list(map(int, input().split()))
  # x[i].append(xy[0])
  # y[i].append(xy[1])
  xy.append([list(map(int, input().split())) for _ in range(a[-1])])

anses = []

for x in range(2 ** n):
  flag = True
  cnt = 0
  dprint('x', x)
  for i in range(n):
    if x & (1 << i) != 0:
      dprint('i', i)
      cnt += 1
      for j in range(a[i]):
        dprint(int(x & (1 << (xy[i][j][0] - 1)) != 0) != xy[i][j][1])
        if int(x & (1 << (xy[i][j][0] - 1)) != 0) != xy[i][j][1]:
          flag = False
  if flag:
    anses.append(cnt)

dprint(anses)
print(max(anses))


Fixed submission:
LOCAL = True   and False


def dprint(*args):
  if LOCAL:
    print(*args)


n = int(input())
a = []
xy = []
# x = []
# y = []
for _ in range(n):
  a.append(int(input()))
  # for _ in range(a[-1]):
  # xy = list(map(int, input().split()))
  # x[i].append(xy[0])
  # y[i].append(xy[1])
  xy.append([list(map(int, input().split())) for _ in range(a[-1])])

anses = []

for x in range(2 ** n):
  flag = True
  cnt = 0
  dprint('x', x)
  for i in range(n):
    if x & (1 << i) != 0:
      dprint('i', i)
      cnt += 1
      for j in range(a[i]):
        dprint(int(x & (1 << (xy[i][j][0] - 1)) != 0) != xy[i][j][1])
        if int(x & (1 << (xy[i][j][0] - 1)) != 0) != xy[i][j][1]:
          flag = False
  if flag:
    anses.append(cnt)

dprint(anses)
print(max(anses))
Buggy python submission (verdict: Runtime Error):
n=int(input())

print(r**2)


Fixed submission:
r=int(input())

print(r**2)
Buggy python submission (verdict: Runtime Error):
n=int(input())

print(n**2)


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

if a<=9 and b<=9:
  print(a*b)
else:
  print('-1')
Buggy python submission (verdict: Runtime Error):
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))

print(sum([x>=k for x in h])


Fixed submission:
n, k = list(map(int, input().split()))
h = list(map(int, input().split()))

print([x>=k for x in h].count(True))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))

max_z = 0
for i in range(2**n):
  #print("i:",i)
  x = 0
  y = 0
  for j in range(n):
    if i&(1<<j)!=0:
      #print('j:',j)
      x+=v[j]
      y+=c[j]
  z=x-y
  #print(z)
  max_z = max(max_z,z)
print(max_z)
  


Fixed submission:
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))

max_z = 0
for i in range(2**n):
  #print("i:",i)
  x = 0
  y = 0
  for j in range(n):
    if i&(1<<j)!=0:
      #print('j:',j)
      x+=v[j]
      y+=c[j]
  z=x-y
  #print(z)
  max_z = max(max_z,z)
print(max_z)
Buggy python submission (verdict: Runtime Error):
#124a
a, b = list(map(int, input().split()))
ans=0
if a > b:
  ans += a
  a -= 1
else:
  ans += b
  b -= 1
ans+=max(a,b)
  
print(ans６)


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

print(max(a+a-1,b+b-1,a+b))
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
prev = '2'
while True:
  s = s.replace('01', '')
  s = s.replace('10', '')
  if prev == s:
    break
  prev = s
print(n - len(s))


Fixed submission:
s = input()

print(2*min(s.count('0'),s.count('1')))

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
n = len(s)
while '01' in s or '10' in s:
  s = s.replace('01', '')
  s = s.replace('10', '')
print(n - len(s))


Fixed submission:
s = input()

print(2*min(s.count('0'),s.count('1')))
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

import math
g = 0
for x in a:
  g = math.gcd(g, x)
print(g)


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

import fractions
g = 0
for x in a:
  g = fractions.gcd(g,x)
print(g)

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

import math
g=0
for x in a:
  g=math.gcd(g,x)
print(g)


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

import fractions
g = 0
for x in a:
  g = fractions.gcd(g,x)
print(g)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n, k = list(map(int, input().split()))
x = list(map(int, input().split()))

k -= x.count(0)

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

n = [0]
for e in reversed(x):
  if e < 0:
    n.append(-e)

p = [0]
for e in x:
  if e > 0:
    p.append(e)


dprint(n, p)

anses = []

for i in range(k + 1):
  j = k - i
  if i == 0:
    pass
  elif 0 <= i < len(p) and 0 <= j < len(n):
    anses.append(p[i] * 2 + n[j])
    anses.append(p[i] + n[j] * 2)

dprint(anses)

print(min(anses))


Fixed submission:
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n, k = list(map(int, input().split()))
x = list(map(int, input().split()))

k -= x.count(0)

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

n = [0]
for e in reversed(x):
  if e < 0:
    n.append(-e)

p = [0]
for e in x:
  if e > 0:
    p.append(e)


dprint(n, p)

anses = []

for i in range(k + 1):
  j = k - i
  if 0 <= i < len(p) and 0 <= j < len(n):
    anses.append(p[i] * 2 + n[j])
    anses.append(p[i] + n[j] * 2)

dprint(anses)

print(min(anses))

Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n, k = list(map(int, input().split()))
x = list(map(int, input().split()))

k -= x.count(0)

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

n = [0]
for e in reversed(x):
  if e < 0:
    n.append(-e)

p = [0]
for e in x:
  if e > 0:
    p.append(e)


dprint(n, p)

anses = []

for i in range(k + 1):
  j = k - i
  if i == 0:
    pass
  elif 0 <= i < len(p) and 0 <= j < len(n):
    anses.append(p[i] * 2 + n[j])
    anses.append(p[i] + n[j] * 2)

dprint(anses)

print(min(anses))


Fixed submission:
import sys
input = sys.stdin.readline
LOCAL = len(sys.argv) > 1 and sys.argv[1] == 'LOCAL'


def dprint(*args):
  if LOCAL:
    print(*args)


n, k = list(map(int, input().split()))
x = list(map(int, input().split()))

k -= x.count(0)

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

n = [0]
for e in reversed(x):
  if e < 0:
    n.append(-e)

p = [0]
for e in x:
  if e > 0:
    p.append(e)


dprint(n, p)

anses = []

for i in range(k + 1):
  j = k - i
  if 0 <= i < len(p) and 0 <= j < len(n):
    anses.append(p[i] * 2 + n[j])
    anses.append(p[i] + n[j] * 2)

dprint(anses)

print(min(anses))