Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math

A, B = map(int, input().split())
 
priceA1 = A / 0.08
priceA2 = (A+1) / 0.08
priceB1 = B / 0.10
priceB2 = (B+1) / 0.10

if priceA1 <= math.ceil(priceB1) <= math.floor(priceA2):
    print(math.ceil(priceB1,0))
elif priceB1 <= math.ceil(priceA1) <= math.floor(priceB2):
    print(math.ceil(priceA1))
else:
    print(-1)

Fixed submission:
import math

A, B = map(int, input().split())

priceA1 = math.ceil(A / 0.08)
priceA2 = (A+1) / 0.08
priceB1 = math.ceil(B / 0.10)
priceB2 = (B+1) / 0.10

if math.floor(priceA2) < priceA2:
    priceA2 = math.floor(priceA2)
else:
    priceA2 = math.floor(priceA2) - 1


if math.floor(priceB2) < priceB2:
    priceB2 = math.floor(priceB2)
else:
    priceB2 = math.floor(priceB2) - 1

if priceA1 <= priceB1 <= priceA2:
    print(math.ceil(priceB1))
elif math.ceil(priceB1) < math.ceil(priceA1) < priceB2:
    print(math.ceil(priceA1))
elif math.ceil(priceA1) == math.ceil(priceB1):
    print(math.ceil(priceA1))
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
import math

A, B = map(int, input().split())
 
priceA1 = A / 0.08
priceA2 = (A+1) / 0.08
priceB1 = B / 0.10
priceB2 = (B+1) / 0.10

if priceA1 < math.ceil(priceB1) <= math.floor(priceA2):
    print(math.floor(priceB1,0))
elif priceB1 <= math.ceil(priceA1) <= math.floor(priceB2):
    print(int(priceA1))
else:
    print(-1)

Fixed submission:
import math

A, B = map(int, input().split())

priceA1 = math.ceil(A / 0.08)
priceA2 = (A+1) / 0.08
priceB1 = math.ceil(B / 0.10)
priceB2 = (B+1) / 0.10

if math.floor(priceA2) < priceA2:
    priceA2 = math.floor(priceA2)
else:
    priceA2 = math.floor(priceA2) - 1


if math.floor(priceB2) < priceB2:
    priceB2 = math.floor(priceB2)
else:
    priceB2 = math.floor(priceB2) - 1

if priceA1 <= priceB1 <= priceA2:
    print(math.ceil(priceB1))
elif math.ceil(priceB1) < math.ceil(priceA1) < priceB2:
    print(math.ceil(priceA1))
elif math.ceil(priceA1) == math.ceil(priceB1):
    print(math.ceil(priceA1))
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
 
priceA1 = A / 0.08
priceA2 = (A+1) / 0.08
priceB1 = B / 0.10
priceB2 = (B+1) / 0.10

if priceA1 <= priceB1 < priceA2:
    print(int(priceB))
elif priceB1 <= priceA1 < priceB2:
    print(int(priceA))
else:
    print(-1)

Fixed submission:
import math

A, B = map(int, input().split())

priceA1 = math.ceil(A / 0.08)
priceA2 = (A+1) / 0.08
priceB1 = math.ceil(B / 0.10)
priceB2 = (B+1) / 0.10

if math.floor(priceA2) < priceA2:
    priceA2 = math.floor(priceA2)
else:
    priceA2 = math.floor(priceA2) - 1


if math.floor(priceB2) < priceB2:
    priceB2 = math.floor(priceB2)
else:
    priceB2 = math.floor(priceB2) - 1

if priceA1 <= priceB1 <= priceA2:
    print(math.ceil(priceB1))
elif math.ceil(priceB1) < math.ceil(priceA1) < priceB2:
    print(math.ceil(priceA1))
elif math.ceil(priceA1) == math.ceil(priceB1):
    print(math.ceil(priceA1))
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
import numpy as np

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

max_a = max(np_ab[:, 0])
dp = [0] * (h + max_a)

for i in range(1, h + max_a):
    dp[i] = min(dp[i - a] + b for a, b in ab)

print(dp[h])


Fixed submission:
import sys

H, N = map(int, input().split())
A = [0] * N
B = [0] * N

for i in range(N):
    a, b = map(int, sys.stdin.readline().rstrip().split())
    A[i] = a
    B[i] = b

max_A = max(A)
INF = 10**18
dp = [INF] * (H + max_A)
dp[0] = 0

for i in range(H):
    for j in range(N):
        dp[i + A[j]] = min(dp[i] + B[j], dp[i + A[j]])

print(min(dp[H:H + max_A]))

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

H, N = map(int, input().split())
A = [0] * N
B = [0] * N

for i in range(N):
    a, b = map(int, sys.stdin.readline().rstrip().split())
    A[i] = a
    B[i] = b

max_A = max(A)
INF = 10**18
dp = [INF] * (H + max_A)
dp[0] = 0

for i in range(0, H):
    for j in range(N):
        dp[i + A[j]] = min(dp[i] + B[j], dp[i + A[j]])

print(min(dp[H:H + max_A]))


Fixed submission:
import sys

H, N = map(int, input().split())
A = [0] * N
B = [0] * N

for i in range(N):
    a, b = map(int, sys.stdin.readline().rstrip().split())
    A[i] = a
    B[i] = b

max_A = max(A)
INF = 10**18
dp = [INF] * (H + max_A)
dp[0] = 0

for i in range(H):
    for j in range(N):
        dp[i + A[j]] = min(dp[i] + B[j], dp[i + A[j]])

print(min(dp[H:H + max_A]))

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

H, N = map(int, input().split())
A = [0] * N
B = [0] * N

for i in range(N):
    a, b = map(int, sys.stdin.readline().rstrip().split())
    A[i] = a
    B[i] = b

max_A = max(A)
INF = 10**18
dp = [INF] * (H + max_A)
dp[0] = 0

for i in range(1, H + max_A):
    for j in range(N):
        if i >= A[j]:
            dp[i] = min(dp[i], dp[i - A[j]] + B[j])

print(min(dp[H:H + max_A]))


Fixed submission:
import sys

H, N = map(int, input().split())
A = [0] * N
B = [0] * N

for i in range(N):
    a, b = map(int, sys.stdin.readline().rstrip().split())
    A[i] = a
    B[i] = b

max_A = max(A)
INF = 10**18
dp = [INF] * (H + max_A)
dp[0] = 0

for i in range(H):
    for j in range(N):
        dp[i + A[j]] = min(dp[i] + B[j], dp[i + A[j]])

print(min(dp[H:H + max_A]))
Buggy python submission (verdict: Runtime Error):
import sys

# 価値 x 以上の握手を全て行うとする
# 握手回数が決まる。左手ごとに集計できる。

import numpy as np

N, M = map(int, sys.stdin.readline().rstrip().split())
A = np.array(int(x) for x in sys.stdin.readline().rstrip().split())

A.sort()  # A を昇順に並び替える


# x より価値が高くなる握手の総数
#  -> a に対して、相手は x - a が必要
#   -> A = [a0, a1, a2, ...] に対して、[x-a0の開始位置, x-a1の開始位置, x-a2の開始位置,...] を探す
def shake_cnt(x):
    # x 以上の握手を全て行うとして、握手の回数を数える行わない握手を数える
    X = np.searchsorted(A, x - A)  # ソートされたリストA に対して、x - A が挿入される位置を返す
    return N * N - X.sum()  # index の和は「小さい方」を指しているので、引く


# 二分探索  握手の回数が
left = 0  # 握手の回数がM以上
right = 10 ** 6  # 握手の回数がM未満 <- まだ足りない側
while 1 < right - left:  # left と right が隣り合ったら終了
    x = (left + right) // 2
    if shake_cnt(x) >= M:
        left = x
    else:
        right = x

# M回には届かないけれど、M回に限りなく近くなる価値 x = right
X = np.searchsorted(A, right - A)  # 各a in A が握手を行わない人数のArray
shake = N * N - X.sum()  # ここまでの握手回数

Acum = np.zeros(N + 1, np.int64)  # 人数 -> 累積和
# Acum = [a0, a0+a1, a0+a1+a2, ....] を計算して、ai さんが k番目以降と握手をすれば
Acum[1:] = np.cumsum(A)  # cumsum [1,2,3,4,5,6,...] -> [1,3,6,10,15,21,...]

# 右手の幸福度は ai * ((a0+a1+...a(n-1)) - (a(k-1)+...+a(n-1))) を得られる
# 左手の幸福度は 回数だけで決まる（何人と握手とするか）
happy = (Acum[-1] - Acum[X]).sum() + (A * (N - X)).sum()

happy += (M - shake) * left  # 不足分。1回の価値は M とわかっている

print(happy)


Fixed submission:
import sys
import numpy as np

# 価値 x 以上の握手を全て行うとする
# 握手回数が決まる。左手ごとに集計できる。

N, M = map(int, sys.stdin.readline().rstrip().split())
A = np.array(sys.stdin.readline().rstrip().split(), np.int64)

A.sort()  # A を昇順に並び替える

# x より価値が高くなる握手の総数
#  -> a に対して、相手は x - a が必要
#   -> A = [a0, a1, a2, ...] に対して、[x-a0の開始位置, x-a1の開始位置, x-a2の開始位置,...] を探す
def shake_cnt(x):
    # x 以上の握手を全て行うとして、握手の回数を数える行わない握手を数える
    X = np.searchsorted(A, x - A)  # ソートされたリストA に対して、x - A が挿入される位置を返す
    return N * N - X.sum()  # index の和は「小さい方」を指しているので、引く


# 二分探索  握手の回数が
left = 0  # 握手の回数がM以上
right = 10 ** 6  # 握手の回数がM未満 <- まだ足りない側
while 1 < right - left:  # left と right が隣り合ったら終了
    x = (left + right) // 2
    if shake_cnt(x) >= M:
        left = x
    else:
        right = x

# M回には届かないけれど、M回に限りなく近くなる価値 x = right
X = np.searchsorted(A, right - A)  # 各a in A が握手を行わない人数のArray
shake = N * N - X.sum()  # ここまでの握手回数

Acum = np.zeros(N + 1, np.int64)  # 人数 -> 累積和
# Acum = [a0, a0+a1, a0+a1+a2, ....] を計算して、ai さんが k番目以降と握手をすれば
Acum[1:] = np.cumsum(A)  # cumsum [1,2,3,4,5,6,...] -> [1,3,6,10,15,21,...]

# 右手の幸福度は ai * ((a0+a1+...a(n-1)) - (a(k-1)+...+a(n-1))) を得られる
# 左手の幸福度は 回数だけで決まる（何人と握手とするか）
happy = (Acum[-1] - Acum[X]).sum() + (A * (N - X)).sum()

happy += (M - shake) * left  # 不足分。1回の価値は M とわかっている

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

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

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

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

a_sum = sum(a)
ans = 0
for i in range(n):
    a_sum -= a[i]
    ans += a[i] * a_sum

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

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

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

p = list(itertools.combinations(range(n), 2))

ans = 0
for i in p:
    ans += a[i[0]] * a[i[1]]

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

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

a_sum = sum(a)
ans = 0
for i in range(n):
    a_sum -= a[i]
    ans += a[i] * a_sum

ans = int(ans % (10**9+7))
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

ans = 1
for i in a:
    ans *= i

if ans > 10**18:
    print(-1)
else:
    print(ans)

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

if 0 in a:
    print(0)
    exit()

ans = 1
for i in a:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit()
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, m = tuple(map(int, input().split()))
h = list(map(int, input().split()))
ans = list(range(1, n+1))

for _ in range(m):
    a, b = tuple(map(int, input().split()))
    if h[a-1] > h[b-1]:
        if (b) in ans:
            ans.remove(b)
    elif h[a-1] < h[b-1]:
        if (a) in ans:
            ans.remove(a)
    else:
        if (a) in ans:
            ans.remove(a)
        if (b) in ans:
            ans.remove(b)

print(len(ans))


Fixed submission:
n, m = tuple(map(int, input().split()))
h = list(map(int, input().split()))
ans = set([])

for _ in range(m):
    a, b = tuple(map(int, input().split()))
    if h[a-1] > h[b-1]:
        ans.add(b)
    elif h[a-1] < h[b-1]:
        ans.add(a)
    else:
        ans.add(a)
        ans.add(b)

print(n-len(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import math

k = int(input())

l = list(itertools.product(list(range(1, k+1)), repeat=3))
ans = 0

for i in l:
    a, b, c = i
    ans += math.gcd(math.gcd(a, b), c)

print(ans)


Fixed submission:
import itertools
import math

k = int(input())

l = list(itertools.combinations_with_replacement(list(range(1, k+1)), 3))
ans = 0

for i in l:
    a, b, c = i
    if a == b == c:
        ans += math.gcd(math.gcd(a, b), c)
    elif (a == b) or (b == c):
        ans += 3 * (math.gcd(math.gcd(a, b), c))
    else:
        ans += 6 * (math.gcd(math.gcd(a, b), c))

print(ans)

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

k = int(input())

ans = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            ans += math.gcd(math.gcd(a, b), c)

print(ans)


Fixed submission:
import itertools
import math

k = int(input())

l = list(itertools.combinations_with_replacement(list(range(1, k+1)), 3))
ans = 0

for i in l:
    a, b, c = i
    if a == b == c:
        ans += math.gcd(math.gcd(a, b), c)
    elif (a == b) or (b == c):
        ans += 3 * (math.gcd(math.gcd(a, b), c))
    else:
        ans += 6 * (math.gcd(math.gcd(a, b), c))

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

res = 1
for i in range(1, n):
    if min(p[:i]) < p[i]:
        continue
    else:
        res += 1

print(res)

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

res = 1
m = p[0]
for i in range(1, n):
    if m < p[i]:
        continue
    else:
        res += 1
        m = p[i]

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
INF = 10**9
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
dp = [[INF for _ in range(51)] for _ in range(1<<N)]
dp[0][0] = 0
for S in range(1 << N):
  j = bin(S).count("1")
  c = 0
  for i in range(N):
    if not (S & 1<<i):
      if (i - j) % 2 == 0:
        k = A[i]
      else:
        k = B[i]
      for l in range(k+1):
        dp[S|1<<i][k] = min(dp[S|1<<i][k],dp[S][l]+c)
      c += 1
ans = min(dp[-1])
print(-1 if ans == INF else ans)



Fixed submission:
INF = 10**9
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
dp = [[INF for _ in range(51)] for _ in range(1<<N)]
dp[0][0] = 0
for S in range(1 << N):
  j = bin(S).count("1")
  c = 0
  for i in range(N):
    if not (S & 1<<i):
      if (i - j) % 2 == 0:
        k = A[i]
      else:
        k = B[i]
      for l in range(k+1):
        dp[S|1<<i][k] = min(dp[S|1<<i][k],dp[S][l]+c)
      c += 1
ans = min(dp[-1])
print(-1 if ans == INF else ans)
Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
a = sorted(list(map(int,input().split())))
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7
N = 10**4
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 )
ans = 0
for i in range(n-k+1):
  ans += (a[n-1-i]-a[i])*cmb(n-1-i,k-1,mod)
  ans %=  mod
print(ans)

Fixed submission:
n, k = map(int,input().split())
a = sorted(list(map(int,input().split())))
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7
N = 10**5
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 )
ans = 0
for i in range(n-k+1):
  ans += (a[n-1-i]-a[i])*cmb(n-1-i,k-1,mod)
  ans %=  mod
print(ans)

Buggy python submission (verdict: Runtime Error):
n, k = map(int,input().split())
a = sorted(list(map(int,input().split())))
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7
N = 10**4
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 )
ans = 0
for i in range(N-K+1):
  ans += (a[n-1-i]-a[i])*cmb(n-1-i,k-1,mod)
  ans %=  mod
print(ans)

Fixed submission:
n, k = map(int,input().split())
a = sorted(list(map(int,input().split())))
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7
N = 10**5
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 )
ans = 0
for i in range(n-k+1):
  ans += (a[n-1-i]-a[i])*cmb(n-1-i,k-1,mod)
  ans %=  mod
print(ans)
Buggy python submission (verdict: Runtime Error):
print(10-int(input)//200)

Fixed submission:
print(10-int(input())//200)
Buggy python submission (verdict: Runtime Error):
a=list(map,input().split())
k=int(input())
while a[0]>=a[1]:
  k-=1
  a[1]*=2
while a[1]>=a[2]:
  k-=1
  a[2]*=2
if k>=0:
  print("Yes")
else:
  print("No")


Fixed submission:
a=list(map(int,input().split()))
k=int(input())
while a[0]>=a[1]:
  k-=1
  a[1]*=2
while a[1]>=a[2]:
  k-=1
  a[2]*=2
if k>=0:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
a=list(map,input().split())
k=int(input())
while a[0]>=a[1]:
  k--
  a[1]*=2
while a[1]>=a[2]:
  k--
  a[2]*=2
if k>=0:
  print("Yes")
else:
  print("No")

Fixed submission:
a=list(map(int,input().split()))
k=int(input())
while a[0]>=a[1]:
  k-=1
  a[1]*=2
while a[1]>=a[2]:
  k-=1
  a[2]*=2
if k>=0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
v = list(map(int, input().split()))
ans = 1
for i in range(n):
    ans *= v[i]
if (ans > 10**18):
    print(-1)
else:
    print(ans)


Fixed submission:
n = int(input())
v = list(map(int, input().split()))
if 0 in v:
    print(0)
    exit()
ans = 1
for i in range(n):
    ans *= v[i]
    if (ans > 10**18):
        print(-1)
        exit()
print(ans)
Buggy python submission (verdict: Runtime Error):
import fractions


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


n, m = map(int, input().split())
v = list(map(int, input().split()))
num = 0
# print(v[0])
while (v[0] % 2 == 0):
    v[0] //= 2
    num += 1
# print(v[0])
ans = v[0]
for i in range(n - 1):
    v[i+1] //= 2**num
    ans = lcm(ans, v[i + 1])
# print(ans)
if (ans % 2 == 0):
    print(0)
    exit(0)
ans *= 2**num
print(m//ans)


Fixed submission:
import fractions


def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)


n, m = map(int, input().split())
v = list(map(int, input().split()))
num = 0
# print(v[0])
while (v[0] % 2 == 0):
    v[0] //= 2
    num += 1
# print(v[0])
ans = v[0]
for i in range(n - 1):
    if (v[i + 1] % (2 ** num) != 0 or v[i + 1] % (2 ** (num + 1)) == 0):
        ans = 2
        break
    # print(v[i+1])
    v[i+1] //= 2**num
    # print(v[i+1])
    ans = lcm(ans, v[i + 1])
# print(ans)
if (ans % 2 == 0):
    print(0)
    exit(0)
ans *= 2**(num-1)
print(((m//ans)+1)//2)
Buggy python submission (verdict: Runtime Error):
s=input()
if (len(s)==3):
	s=reverse(s)
print(s)


Fixed submission:
s=input()
if (len(s)==3):
	s=s[::-1]
print(s)
Buggy python submission (verdict: Runtime Error):
n=int(input())
l=[int(input()) for _ in range(n)]
ans=0
if l[0]!=0:
  print(-1)
  exit()
for i in range(n-1):
  if l[i+1]-l[i]>1:
    print(-1)
    exit()
  elif (l[i]+1==l[i+1]):
    ans+=1
  else:
	ans+=l[i+1]
print(ans)


Fixed submission:
n=int(input())
l=[int(input()) for _ in range(n)]
ans=0
if l[0]!=0:
  print(-1)
  exit()
for i in range(n-1):
  if l[i+1]-l[i]>1:
    print(-1)
    exit()
  elif (l[i]+1==l[i+1]):
    ans+=1
  else:
    ans+=l[i+1]
print(ans)
Buggy python submission (verdict: Runtime Error):
l=list(map(int,input().split()))
ans=min(l[1],l[3])-max(l[0],l[2])
print(ans if ans>0 else 0)

Fixed submission:
i=input()
print("Yes" if i[0]==i[2] else "No")
Buggy python submission (verdict: Runtime Error):
i=input()
l=map(int,input().split())
ans=min(l[1],l[3])-max(l[0],l[2])
print(ans if ans>0 else 0)

Fixed submission:
l=list(map(int,input().split()))
ans=min(l[1],l[3])-max(l[0],l[2])
print(ans if ans>0 else 0)
Buggy python submission (verdict: Time Limit Exceeded):
import math

def f(l):
    mx=max(l)
    flg=True
    for i in range(len(l)):
        if (mx==l[i] and flg==True):
            flg=False
            l[i]-=50
            l[i]=max(0,l[i])
        else:
            l[i]+=1
    return l


k=int(input())
N=50
a=math.ceil((k+1)/N)
a=int(a)
l=[a+i for i in range(50)]
mod=N-k%N
for i in range(mod):
    l=f(l)
print(50)
for i in range(50):
    print(str(l[i])+" ",end="")
print("")
ret=0
while (max(l)>=50):
    l=f(l)
    ret+=1
##if (ret!=k):
##    print(k)
    #assert(ret==k and "{}".format(k))

Fixed submission:
import math

def f(l):
    mx=max(l)
    flg=True
    for i in range(len(l)):
        if (mx==l[i] and flg==True):
            flg=False
            l[i]-=50
            l[i]=max(0,l[i])
        else:
            l[i]+=1
    return l


def solve(k):
    #k=int(input())
    N=50
    a=k//N+1
    if (k%N==0) :
        a-=1
    l=[a+i for i in range(50)]
    mod=(N-(k%N))%N
    for i in range(mod):
        l=f(l)
    l=sorted(l,reverse=True)
    print(50)
    for i in range(50):
        print(str(l[i])+" ",end="")
    print("")
    ret=0
solve(int(input()))

Buggy python submission (verdict: Runtime Error):
k=int(input())
m=k//2
if (k%2==0):
    print(2)
    print"{} {}".format(m,m+1)
else:
    print(2)
    print"{} {}".format(m,m+2)


Fixed submission:
import math

def f(l):
    mx=max(l)
    flg=True
    for i in range(len(l)):
        if (mx==l[i] and flg==True):
            flg=False
            l[i]-=50
            l[i]=max(0,l[i])
        else:
            l[i]+=1
    return l


def solve(k):
    #k=int(input())
    N=50
    a=k//N+1
    if (k%N==0) :
        a-=1
    l=[a+i for i in range(50)]
    mod=(N-(k%N))%N
    for i in range(mod):
        l=f(l)
    l=sorted(l,reverse=True)
    print(50)
    for i in range(50):
        print(str(l[i])+" ",end="")
    print("")
    ret=0
solve(int(input()))
Buggy python submission (verdict: Runtime Error):
s="CODEFESTIVAL2016"
t=input()
ans=0
for c1,c2 in zip(s,t):
  if c1!=c2 : ns+=1
print(ans)

Fixed submission:
s="CODEFESTIVAL2016"
t=input()
ans=0
for c1,c2 in zip(s,t):
  if c1!=c2 : ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = 0
pre_a = 0
i = 1
for a in A:
    if pre_a > a:
        ans += pre_a - a
    else:
        ans += 0
    pre_a = max(A[: i])
    i += 1

print(ans)


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

ans = 0
max_a = 0
for a in A:
    if max_a < a:
        max_a = a
    else:
        ans += max_a - a

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

ans = 1
for a in A:
    ans *= a

if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)


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

ans = 1
for a in A:
    ans *= a
    if  ans > 1000000000000000000:
        break

if 0 in A:
    print(0)
elif ans > 1000000000000000000:
    print(-1)
else:
    print(ans)

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

ans = 1
for a in A:
    ans *= a

if ans > 1000000000000000000:
    print(-1)
else:
    print(ans)


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

ans = 1
for a in A:
    ans *= a
    if  ans > 1000000000000000000:
        break

if 0 in A:
    print(0)
elif ans > 1000000000000000000:
    print(-1)
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
X, Y, A, B, C = map(int, input().split())
p_list = list(map(int, input().split()))
q_list = list(map(int, input().split()))
r_list = list(map(int, input().split()))

eat = []
for i in range(X):
  p_max = max(p_list)
  r_max = max(r_list)
  if p_max >= r_max or len(r_list) == 0:
    eat.append(p_max)
    p_list.remove(p_max)
  else:
    eat.append(r_max)
    r_list.remove(r_max)
for i in range(Y):
  q_max = max(q_list)
  r_max = max(r_list)
  if q_max >= r_max or len(r_list) == 0:
    eat.append(q_max)
    q_list.remove(q_max)
  else:
    eat.append(r_max)
    r_list.remove(r_max)
print(sum(eat))

Fixed submission:
X, Y, A, B, C = map(int, input().split())
p = sorted(list(map(int, input().split())), reverse = True)[: X]
q = sorted(list(map(int, input().split())), reverse = True)[: Y]
r = list(map(int, input().split()))

all_apple = sorted(p + q + r, reverse = True)
print(sum(all_apple[: X + Y]))