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

n, y = (int(x) for x in input().split())

_10000, _5000, _1000 = 0, 0, 0

exist = False

for i in range(n + 1):

    # print("10000円札 : {0}枚".format(i))
    
    for j in range(n + 1 - i):

        # print("5000円札 : {0}枚".format(j))

        for k in range(n + 1 - i - j):

            # print("1000円札 : {0}枚".format(k))

            if i + j + k == n :

                # print("合計枚数がN枚")
                # print("合計金額 : {0}円".format((i * 10000) + (j * 5000) + (k * 1000)))

                if (i * 10000) + (j * 5000) + (k * 1000) == y :
                    # print("答えを発見!")
                    _10000, _5000, _1000 = i, j, k
                    exist = True

    if exist == True :
        break

if exist == True :
    print("{0} {1} {2}".format(_10000, _5000, _1000))
else :
    print('-1 -1 -1')





                



Fixed submission:

n, y = (int(x) for x in input().split())

_10000, _5000, _1000 = 0, 0, 0

exist = False

for i in range(n + 1):

    # print("10000円札 : {0}枚".format(i))
    
    for j in range(n + 1 - i):

        # print("5000円札 : {0}枚".format(j))

        # print("1000円札 : {0}枚".format(k))

        if (i * 10000) + (j * 5000) + ((n - i - j) * 1000) == y :
                # print("答えを発見!")
                _10000, _5000, _1000 = i, j, n - i - j
                exist = True

        # if i + j + (n - i - j) == n :

        #     # print("合計枚数がN枚")
        #     # print("合計金額 : {0}円".format((i * 10000) + (j * 5000) + (k * 1000)))

        #     if (i * 10000) + (j * 5000) + ((n - i - j) * 1000) == y :
        #         # print("答えを発見!")
        #         _10000, _5000, _1000 = i, j, n - i - j
        #         exist = True

    if exist == True :
        break

if exist == True :
    print("{0} {1} {2}".format(_10000, _5000, _1000))
else :
    print('-1 -1 -1')
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
a = list(map(int, input().split()))

point = 1
for i in range(n):
    if k > i:
        point *= a[i]
        continue
    now = point
    now //= a[i - k]
    now *= a[i]
    if now > point:
        print('Yes')
    else:
        print('No')
    point = now


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

point = 0
for i in range(n):
    if k > i:
        point += a[i]
        continue
    now = point
    now -= a[i - k]
    now += a[i]
    if now > point:
        print('Yes')
    else:
        print('No')
    point = now

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

point = 1
for i in range(k):
    point *= a[i]

for i in range(k, n):
    now = point
    now //= a[i - k]
    now *= a[i]
    if now > point:
        print('Yes')
    else:
        print('No')
    point = now

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

point = 0
for i in range(n):
    if k > i:
        point += a[i]
        continue
    now = point
    now -= a[i - k]
    now += a[i]
    if now > point:
        print('Yes')
    else:
        print('No')
    point = now
Buggy python submission (verdict: Runtime Error):
import math
x = input()
a = int(x[0])
b = float(x[1]) 

a *= 100
b *= 100
print(int(a * b // 10000))

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

a = int(a)
b = decimal.Decimal(b) * 100

print(a * b // 100)
Buggy python submission (verdict: Runtime Error):
s, t = map(input().split())
a, b = map(int, input().split())
u = input()

if s == u:
    print(a - 1, b)
else:
    print(a, b-1)


Fixed submission:
s, t = input().split()
a, b = map(int, input().split())
u = input()

if s == u:
    print(a - 1, b)
else:
    print(a, b-1)
Buggy python submission (verdict: Runtime Error):
import numpy as np

a, b = map(int, input().split())

print(np.lcm(a, b))


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


def gcd(x, y):
    while y:
        x, y = y, x % y
    return x


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


print(lcm(a, b))

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

a, b = map(int, input().split())


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


print(lcm(a, b))


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


def gcd(x, y):
    while y:
        x, y = y, x % y
    return x


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


print(lcm(a, b))

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

a, b = map(int, input().split())


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


print(lcm(a, b))


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


def gcd(x, y):
    while y:
        x, y = y, x % y
    return x


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


print(lcm(a, b))
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())

if 1 <= a <= 9 or 1 <= b <= 9:
    print(a * b)
else:
    print(-1)


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

if a >= 10 or b >= 10:
    print(-1)
    exit()
print(a * b)
Buggy python submission (verdict: Runtime Error):
a, b =map(int,input().split())
s = a-1
t =b -1
print((t+s-1)//2

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

t = b - 1
s = a - 1
ans = (t + s - 1) // s
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int(input()))

print(max(a + b, a - b, a * b))

Fixed submission:
a, b = map(int, input().split())
print(max(a + b, a - b, a * b))
Buggy python submission (verdict: Runtime Error):
r = int(input())
print(3 * (r ** 2)

Fixed submission:
r = int(input())
print(3 * r ** 2)
Buggy python submission (verdict: Runtime Error):
import math

a, b, c, d = map(int, input().split())

lcm =  (c * d) // math.gcd(c, d)

ans = b - a + 1
ans -= (b // c) - ((a - 1 )// c)
ans -= (b // d) - ((a - 1) // d)
ans += (b // lcm) - ((a - 1) // lcm)
print(ans)
    


Fixed submission:
from fractions import gcd

a, b, c, d = map(int, input().split())

lcm =  (c * d) // gcd(c, d)

ans = b - a + 1
ans -= (b // c) - ((a - 1 )// c)
ans -= (b // d) - ((a - 1) // d)
ans += (b // lcm) - ((a - 1) // lcm)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
A = list(map(int, input().split()))

a = []
tmp = 1
r = 0
for l in range(n):
    tmp *= A[l]
    if l >= k - 1:
        a.append(tmp)
        tmp //= A[r]
        r += 1

for i in range(1, len(a)):
    if a[i - 1] < a[i]:
        print('Yes')
    else:
        print('No')

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

# a = []
# tmp = 1
# r = 0
# for l in range(n):
#     tmp *= A[l]
#     if l >= k - 1:
#         a.append(tmp)
#         tmp //= A[r]
#         r += 1

for i in range(k, n):
    if A[i] > A[i - k]:
        print('Yes')
    else:
        print('No')

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

a = []
tmp = 1
r = 0
for l in range(n):
    tmp *= A[l]
    if l >= k - 1:
        a.append(tmp)
        tmp //= A[r]
        r += 1

for i in range(1, len(a)):
    if a[i - 1] < a[i]:
        print('Yes')
    else:
        print('No')

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

# a = []
# tmp = 1
# r = 0
# for l in range(n):
#     tmp *= A[l]
#     if l >= k - 1:
#         a.append(tmp)
#         tmp //= A[r]
#         r += 1

for i in range(k, n):
    if A[i] > A[i - k]:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Time Limit Exceeded):
#頭おかしくなりそうｗ
#大体考え方は合ってるはずだけどクラス分けするのめんどくさい
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [int(input()) for _ in range(D)]
M = int(input())
d = []
q = []
for i in range(M):
    a, b = map(int, input().split())
    d.append(a)
    q.append(b)

    
now = 1
score = 0

decrease = 0


for i,z in enumerate(t):
    score += s[i][z - 1]

def change():
    ret = 0
    contest = [0] * 26
    date = [D * (1 + D) // 2] * 26
    for i, z in enumerate(t):
        date[z - 1] -= (D - i) * (i -contest[z-1]+ 1)
        contest[z - 1] = i + 1
    for i, z in enumerate(date):
        ret += c[i] * z
    return ret


for i, z in zip(d, q):
    score -= s[i - 1][t[i - 1] - 1]
    score += s[i - 1][z - 1]
    t[i - 1] = z
    decrease = change()
    print(score-decrease)

Fixed submission:
#頭おかしくなりそうｗ
#大体考え方は合ってるはずだけどクラス分けするのめんどくさい
D = int(input())
c = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(D)]
t = [int(input()) for _ in range(D)]
M = int(input())
d = []
q = []
for i in range(M):
    a, b = map(int, input().split())
    d.append(a)
    q.append(b)

    
now = 1
score = 0

decrease = 0


for i,z in enumerate(t):
    score += s[i][z - 1]

def change():
    ret = 0
    contest = [0] * 26
    date = [D * (1 + D) // 2] * 26
    for i, z in enumerate(t):
        date[z - 1] -= (D - i) * (i -contest[z-1]+ 1)
        contest[z - 1] = i + 1
    for i, z in enumerate(date):
        ret += c[i] * z
    return ret


for i, z in zip(d, q):
    score -= s[i - 1][t[i - 1] - 1]
    score += s[i - 1][z - 1]
    t[i - 1] = z
    decrease = change()
    print(score-decrease)
Buggy python submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

from itertools import accumulate
A = [0] + list(accumulate(a))
B = [0] + list(accumulate(b))

ans = 0
j = m
for i in range(n + 1):
    if A[i] > k:
        break
    while B[j] > k - a[i]:
        j -= 1
    ans = max(ans, i + j)

print(ans)

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

from itertools import accumulate
A = [0] + list(accumulate(a))
B = [0] + list(accumulate(b))

ans = 0
j = m
for i in range(n + 1):
    if A[i] > k:
        break
    while B[j] > k - A[i]:
        j -= 1
    ans = max(ans, i + j)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
tmp=[]
for i in range(n):
    aa = a.copy()
    aa.pop(i)
    ans = aa[0]
    for j in range(1,len(aa)):
        ans ^= aa[j]
    tmp.append(ans)

print(*tmp)
  

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = []
tmp = 0
for i in range(n):
    tmp ^= a[i]

for i in range(n):
    ans.append(tmp ^ a[i])

print(*ans)
Buggy python submission (verdict: Runtime Error):
a,b=int(input())
print(a*b)

Fixed submission:
a, b = map(int,input().split())
print(a * b)
Buggy python submission (verdict: Runtime Error):
n, m, x = map(int, input().split())
C = [0] * n
A = [[] for i in range(n)]
for i in range(n):
    c = list(map(int, input().split()))
    C[i], A[i] = c[0], c[1:]

INF = 10 ** 9
ans = INF

for bit in range(0, 1 << n):
    cost = 0
    flag = True
    tmp = [0] * m
    for i in range(n):
        if bit & 1 << i:
            cost += C[i]
            for j in range(m):
                tmp[j] += A[i][j]
    for i in range(n):
        if tmp[i] < x:
            flag = False
    if flag:
        ans = min(ans, cost)

print(-1 if ans == INF else ans)

Fixed submission:
n, m, x = map(int, input().split())
C = [0] * n
A = [[] for i in range(n)]
for i in range(n):
    c = list(map(int, input().split()))
    C[i], A[i] = c[0], c[1:]

INF = 10 ** 9
ans = INF

for bit in range(0, 1 << n):
    cost = 0
    flag = True
    tmp = [0] * m
    for i in range(n):
        if bit & 1 << i:
            cost += C[i]
            for j in range(m):
                tmp[j] += A[i][j]
    for i in range(m):
        if tmp[i] < x:
            flag = False
    if flag:
        ans = min(ans, cost)

print(-1 if ans == INF else ans)
Buggy python submission (verdict: Time Limit Exceeded):
h, n = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())

dp = [[1e18] * (h + 1) for _ in range(n + 1)]
dp[0][0] = 0

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

print(dp[n][h])

Fixed submission:
h, n = map(int, input().split())
a = [0] * n
b = [0] * n
for i in range(n):
    a[i], b[i] = map(int, input().split())

dp = [[1e18] * (h + 1) for _ in range(n + 1)]
dp[0][0] = 0

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

print(dp[n][h])
Buggy python submission (verdict: Time Limit Exceeded):
name = set()
n = int(input())
s = input()

for x in range(n - 2):
    for y in range(x + 1, n - 1):
        for z in range(y + 1, n):
            name.add(int(s[x] + s[y] + s[z]))

print(len(name))


Fixed submission:
ans = 0
n = int(input())
s = input()

for x in range(10):
    if s.find(str(x)) > -1:
        tmp = s[s.find(str(x)) + 1:]
        for y in range(10):
            if tmp.find(str(y)) > -1:
                tmp2 = tmp[tmp.find(str(y)) + 1:]
                for z in range(10):
                    if tmp2.find(str(z)) > -1:
                        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
print((int(input()-1)//2)

Fixed submission:
print((int(input())-1)//2)
Buggy python submission (verdict: Time Limit Exceeded):
import sys;      from decimal import Decimal
import math;     from itertools import combinations, product
import bisect;   from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def lcm(a: int, b: int) -> int: return (a * b) // math.gcd(a, b)

def binary_search(n, a):
    right = max(a) + 10 ** 9
    left = min(a) - 10 ** 9

    def calc(b):
        score = 0
        for i in range(n):
            score += abs(a[i] - (b + i + 1))
        return score

    while right - left > 1:
        middle = (right + left) // 2
        if calc(middle) < calc(middle + 1):
            right = middle
        else:
            left = middle
    
    return calc(right)

def Main():
    n = read_int()
    a = read_int_list()
    
    print(binary_search(n, a))
    

if __name__ ==  '__main__':
    Main()

Fixed submission:
import sys;      from decimal import Decimal
import math;     from itertools import combinations, product
import bisect;   from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def lcm(a: int, b: int) -> int: return (a * b) // math.gcd(a, b)

import numpy as np
from numba import i8, njit

#AOTにするとさらに早くなる?
@njit(i8(i8, i8[:]), cache=True)
def binary_search(n, a):
    right = np.max(a) + 10 ** 9
    left = np.min(a) - 10 ** 9

    def calc(b):
        score = 0
        for i in range(n):
            score += abs(a[i] - (b + i + 1))
        return score

    while right - left > 1:
        middle = (right + left) // 2
        if calc(middle) < calc(middle+1):
            right = middle
        else:
            left = middle
    
    return calc(right)

def Main():
    n = read_int()
    a = np.array(read_int_list(), dtype=np.int64)
    
    print(binary_search(n, a))

if __name__ ==  '__main__':
    Main()
Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    if a % b == 0:
        return b
    return gcd(b, a % b)

def lcm(a, b):
    return a / gcd(a, b) * b

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(ans, t)

print(int(ans))

Fixed submission:
def gcd(a, b):
    if a % b == 0:
        return b
    return gcd(b, a % b)

def lcm(a, b):
    return a * b // gcd(a, b)

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(ans, t)

print(int(ans))

Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    if a % b == 0:
        return b
    return gcd(b, a % b)

def lcm(a, b):
    return a / gcd(a, b) * b

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(t,ans)

print(int(ans))

Fixed submission:
def gcd(a, b):
    if a % b == 0:
        return b
    return gcd(b, a % b)

def lcm(a, b):
    return a * b // gcd(a, b)

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(ans, t)

print(int(ans))

Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    if a % b == 0:
        return b
    return gcd(b, a % b)

def lcm(a, b):
    return a * b / gcd(a, b)

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(t,ans)

print(int(ans))

Fixed submission:
def gcd(a, b):
    if a % b == 0:
        return b
    return gcd(b, a % b)

def lcm(a, b):
    return a * b // gcd(a, b)

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(ans, t)

print(int(ans))

Buggy python submission (verdict: Runtime Error):
def gcd(a, b):
    if a % b == 0:
        return b
    return gcd(b, a % b)

def lcm(a, b):
    return a * b / gcd(a, b)

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(ans, t)

print(ans)

Fixed submission:
def gcd(a, b):
    if a % b == 0:
        return b
    return gcd(b, a % b)

def lcm(a, b):
    return a * b // gcd(a, b)

n = int(input())
ans = 1
for i in range(n):
    t = int(input())
    ans = lcm(ans, t)

print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!


n = input()

sum_n = 0
for i in n:
    sum_n += int(n)
    
if sum_n % 9 == 0:
    print("Yes")
else:
    print("No")

Fixed submission:
# coding: utf-8
# Your code here!


n = int(input())

if n % 9 == 0:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left as bl

N, Q = map(int, input().split())
ans = 0
q1 = []
q2 = []
query = []
for _ in range(Q):
    n, p = map(int, input().split())
    query.append((n, p))
    if n == 1:
        q1.append(p)
    else:
        q2.append(p)
q1.sort()
q2.sort()
board = [N - 2, N - 2]
for n, p in query:
    if n == 1:
        if p > board[1] + 1:
            continue
        index = bl(q1, p)
        ans += board[0] * (len(q1) - index)
        board[1] = p - 2
        q1 = q1[:index]
    else:
        if p > board[0] + 1:
            continue
        index = bl(q2, p)
        ans += board[1] * (len(q2) - index)
        board[0] = p - 2
        q2 = q2[:index]
print((N - 2) ** 2 - ans)

Fixed submission:
from bisect import bisect_left as bl

N, Q = map(int, input().split())
ans = 0
q1 = []
q2 = []
query = []
for _ in range(Q):
    n, p = map(int, input().split())
    query.append((n, p))
    if n == 1:
        q1.append(p)
    else:
        q2.append(p)
q1.sort()
q2.sort()
board = [N - 2, N - 2]
count1 = len(q1)
count2 = len(q2)
for n, p in query:
    if n == 1:
        if p > board[1] + 1:
            continue
        index = bl(q1, p)
        ans += board[0] * (count1 - index)
        board[1] = p - 2
        count1 = index
    else:
        if p > board[0] + 1:
            continue
        index = bl(q2, p)
        ans += board[1] * (count2 - index)
        board[0] = p - 2
        count2 = index
print((N - 2) ** 2 - ans)

Buggy python submission (verdict: Time Limit Exceeded):
from bisect import bisect_left as bl

N, Q = map(int, input().split())
ans = 0
q1 = []
q2 = []
query = []
for _ in range(Q):
    n, p = map(int, input().split())
    query.append((n, p))
    if n == 1:
        q1.append(p)
    else:
        q2.append(p)
q1s = sorted(q1)
q2s = sorted(q2)
board = [N - 2, N - 2]
for n, p in query:
    if n == 1:
        if p > board[1] + 1:
            continue
        index = bl(q1s, p)
        ans += board[0] * (len(q1s) - index)
        board[1] = p - 2
        q1s = q1s[:index]
    else:
        if p > board[0] + 1:
            continue
        index = bl(q2s, p)
        ans += board[1] * (len(q2s) - index)
        board[0] = p - 2
        q2s = q2s[:index]
print((N - 2) ** 2 - ans)

Fixed submission:
from bisect import bisect_left as bl

N, Q = map(int, input().split())
ans = 0
q1 = []
q2 = []
query = []
for _ in range(Q):
    n, p = map(int, input().split())
    query.append((n, p))
    if n == 1:
        q1.append(p)
    else:
        q2.append(p)
q1.sort()
q2.sort()
board = [N - 2, N - 2]
count1 = len(q1)
count2 = len(q2)
for n, p in query:
    if n == 1:
        if p > board[1] + 1:
            continue
        index = bl(q1, p)
        ans += board[0] * (count1 - index)
        board[1] = p - 2
        count1 = index
    else:
        if p > board[0] + 1:
            continue
        index = bl(q2, p)
        ans += board[1] * (count2 - index)
        board[0] = p - 2
        count2 = index
print((N - 2) ** 2 - ans)
Buggy python submission (verdict: Runtime Error):

MOD = 10**9 + 7
n, k = map(int, input().split())
a = list(map(int, input().split()))
plus,minus=[],[]
for i in a:
    if i<0:
        minus.append(i)
    else:
        plus.append(i)
plus.sort(reverse = True)
minus.sort()
plus.append(-10**10)
plus.append(10**10)
minus.append(10**10)
minus.append(-10**10)
ans = 1
if n == k:
    for i in range(n):
        ans *= a[i]
        ans %= MOD
    print(ans)
elif len(plus) == 2 and k % 2 == 1:
    for i in range(3, k + 3):
        ans *= minus[-i]
        ans %= MOD
    print(ans)
else:
    cplus = 0
    cminus = 0
    p = k // 2
    if k % 2 == 1:
        ans *= plus[0]
        cplus = 1
    else:
        for _ in range(p):
            if plus[cplus] * plus[cplus + 1] > minus[cminus] * minus[cminus + 1]:
                ans *= plus[cplus] * plus[cplus + 1]
                ans %= MOD
                cplus += 2
            else:
                ans *= minus[cminus] * minus[cminus + 1]
                ans %= MOD
                cminus += 2
    print(ans)

Fixed submission:
n = int(input())
print(-n % 1000)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
ans = 1
for i in range(N):
    ans *= a[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()
a.sort(reverse = True)
ans = 1
for i in range(N):
    ans *= a[i]
    if ans > 10**18:
        print('-1')
        break
else:
    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 math
K=int(input())
ans=0
for a in range(1,K+1):
	for b in range(a,K+1):
		for c in range(b,K+1):
			A=math.gcd(math.gcd(a,b),c)
			if a==b and b==c:
				ans+=A
			elif a==b or b==c:
				ans+=(A*3)
			else:
				ans+=(A*6)
print(ans)

Buggy python submission (verdict: Runtime Error):
import fractinons
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+=fractions.gcd(fractions.gcd(a,b),c)
print(ans)

Fixed submission:
import math
K=int(input())
ans=0
for a in range(1,K+1):
	for b in range(a,K+1):
		for c in range(b,K+1):
			A=math.gcd(math.gcd(a,b),c)
			if a==b and b==c:
				ans+=A
			elif a==b or b==c:
				ans+=(A*3)
			else:
				ans+=(A*6)
print(ans)