Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def poll(arr):
    ans_h = {}
    for ele in arr:
        if ele in ans_h.keys():
            ans_h[ele] += 1
        else:
            ans_h[ele] = 0
    for ele in sorted([kv for kv in ans_h.items() if kv[1] == max(ans_h.values())]):
        print(ele[0])

if __name__ == "__main__":
    n = int(input())
    arr = [input() for _ in range(0, n)]
    poll(arr)

Fixed submission:
def poll(arr):
    ans_h = {}
    for ele in arr:
        if ele in ans_h.keys():
            ans_h[ele] += 1
        else:
            ans_h[ele] = 0
    max_v = max(ans_h.values())
    mkv = [kv for kv in ans_h.items() if kv[1] == max_v]
    for ele in sorted(mkv):
        print(ele[0])

if __name__ == "__main__":
    n = int(input())
    arr = [input() for _ in range(0, n)]
    poll(arr)

Buggy python submission (verdict: Time Limit Exceeded):
def poll(arr):
    ans_h = {}
    for ele in arr:
        if ele in ans_h.keys():
            ans_h[ele] += 1
        else:
            ans_h[ele] = 0
    max_kv_list = sorted([kv for kv in ans_h.items() if kv[1] == max(ans_h.values())])
    for ele in max_kv_list:
        print(ele[0])

if __name__ == "__main__":
    n = int(input())
    arr = [input() for _ in range(0, n)]
    poll(arr)

Fixed submission:
def poll(arr):
    ans_h = {}
    for ele in arr:
        if ele in ans_h.keys():
            ans_h[ele] += 1
        else:
            ans_h[ele] = 0
    max_v = max(ans_h.values())
    mkv = [kv for kv in ans_h.items() if kv[1] == max_v]
    for ele in sorted(mkv):
        print(ele[0])

if __name__ == "__main__":
    n = int(input())
    arr = [input() for _ in range(0, n)]
    poll(arr)
Buggy python submission (verdict: Time Limit Exceeded):
def attack(h, k, arr):
    for _ in range(k):
        if len(arr) == 0:
            return 0
        arr.remove(max(arr))
    return sum(arr)

if __name__ == "__main__":
    h, k = map(int, input().split())
    arr = list(map(int,input().split()))
    print(attack(h, k, arr))

Fixed submission:
def attack(h, k, arr):
    arr.sort()
    if h - k > 0:
        return sum(arr[0:h-k])
    else:
        return 0

if __name__ == "__main__":
    h, k = map(int, input().split())
    arr = list(map(int,input().split()))
    print(attack(h, k, arr))
Buggy python submission (verdict: Time Limit Exceeded):
def handstand(n):
    count = 0
    for i in range(1, n + 1):
        A_str = str(i)
        A_first_int = A_str[0]
        A_last_int = A_str[len(A_str) - 1]
        for j in range(1, n + 1):
            B_str = str(j)
            B_first_int = B_str[0]
            B_last_int = B_str[len(B_str) - 1]
            if A_last_int == B_first_int and A_first_int == B_last_int:
                count += 1
    return count

if __name__ == "__main__":
    n = int(input())
    print(handstand(n))

Fixed submission:
N = int(input())
d = dict()
ans = 0
for i in range(1, N + 1):
    if not (str(i)[0], str(i)[-1]) in d:
        d[(str(i)[0], str(i)[-1])] = 1
    else:
        d[(str(i)[0], str(i)[-1])] += 1
for j in d:
    if (j[-1], j[0]) in d:
        ans += d[j] * d[(j[-1], j[0])]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n, k, q = map(int, input().split())
arr = [k for _ in range(n)]

for _ in range(q):
    winner_id = int(input()) - 1
    arr = [ele - 1 for ele in arr]
    arr[winner_id] += 1

for ele in arr:
    if ele > 0:
        print("Yes")
    else:
        print("No")


Fixed submission:
n, k, q = map(int, input().split())
arr = [k - q] * n

for _ in range(q):
    winner_id = int(input()) - 1
    arr[winner_id] += 1

for ele in arr:
    if ele > 0:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
input_arr = [input() for i in range(2)]
N = input_arr[0]
p_arr = input_arr[1].split(' ')

k = 0
for i in range(len(p_arr)):
    if int(p_arr[i]) == i + 1:
        pass
    else:
        k += 1
if k < 2:
    print("YES")
else:
    print("NO")

Fixed submission:
input_arr = input().split(" ")
A = int(input_arr[0])
B = int(input_arr[1])

# AとBの偶奇が一致する場合 存在する
# AとBの偶奇が一致しない場合 存在しない

if (A % 2 != B % 2):
    print("IMPOSSIBLE")
else:
    k = int((A + B) / 2)
    print(k)

Buggy python submission (verdict: Runtime Error):
input_arr = [input() for i in range(2)]
N = input_arr[0]
p_arr = input_arr[1].split(' ')

for i in range(len(p_arr)):
    k = 0
    if int(p_arr[i]) == i + 1:
        pass
    else:
        k += 1
print(k)
if k < 2:
    print("YES")
else:
    print("NO")

Fixed submission:
input_arr = input().split(" ")
A = int(input_arr[0])
B = int(input_arr[1])

# AとBの偶奇が一致する場合 存在する
# AとBの偶奇が一致しない場合 存在しない

if (A % 2 != B % 2):
    print("IMPOSSIBLE")
else:
    k = int((A + B) / 2)
    print(k)

Buggy python submission (verdict: Runtime Error):
A, B = int(input()), int(input())

# AとBの偶奇が一致する場合 存在する
# AとBの偶奇が一致しない場合 存在しない

if (A % 2 != B % 2):
    print("IMPOSSIBLE")
else:
    k = int((A + B) / 2)
    print(k)

Fixed submission:
input_arr = input().split(" ")
A = int(input_arr[0])
B = int(input_arr[1])

# AとBの偶奇が一致する場合 存在する
# AとBの偶奇が一致しない場合 存在しない

if (A % 2 != B % 2):
    print("IMPOSSIBLE")
else:
    k = int((A + B) / 2)
    print(k)
Buggy python submission (verdict: Runtime Error):
sn = int(input())
arr = [int(input()) for _ in range(n)]
arr.sort()
mx = arr[-1]
sc = arr[-2]

for ele in arr:
    if ele == mx:
        print(sc)
    else:
        print(mx)


Fixed submission:
n = int(input())
arr = [int(input()) for _ in range(n)]
ar = sorted(arr)
mx = ar[-1]
sc = ar[-2]

for ele in arr:
    if ele == mx:
        print(sc)
    else:
        print(mx)

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

n = int(input())
arr = [int(input()) for _ in range(n)]
ans = []

for ele in arr:
    tmp = copy.copy(arr)
    tmp.remove(ele)
    print(max(tmp))


Fixed submission:
n = int(input())
arr = [int(input()) for _ in range(n)]
ar = sorted(arr)
mx = ar[-1]
sc = ar[-2]

for ele in arr:
    if ele == mx:
        print(sc)
    else:
        print(mx)

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

n = int(input())
arr = [int(input()) for _ in range(n)]
ans = []

for ele in arr:
    tmp = copy.copy(arr)
    tmp.remove(ele)
    ans.append(max(tmp))

for ele in ans:
    print(ele)


Fixed submission:
n = int(input())
arr = [int(input()) for _ in range(n)]
ar = sorted(arr)
mx = ar[-1]
sc = ar[-2]

for ele in arr:
    if ele == mx:
        print(sc)
    else:
        print(mx)
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
ans = [i for i in range(1, n + 1)]

for _ in range(m):
    x, y = map(int, input().split())
    tmp = [i for i in range(x, y + 1)]
    for ele in tmp:
        ans.remove(ele)
print(n - len(ans))

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

l_max = 0
r_min = n

for _ in range(m):
    x, y = map(int, input().split())
    l_max = max(l_max, x)
    r_min = min(r_min, y)

print(len([i for i in range(l_max, r_min + 1)]))

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
arr = []
for _ in range(m):
    x, y = map(int, input().split())
    arr.append([i for i in range(x, y + 1)])
ans = arr[0]
for ar in arr:
    tmp = []
    for ele in ar:
        if ele in ans:
            tmp.append(ele)
    ans = tmp
print(len(ans))

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

l_max = 0
r_min = n

for _ in range(m):
    x, y = map(int, input().split())
    l_max = max(l_max, x)
    r_min = min(r_min, y)

print(len([i for i in range(l_max, r_min + 1)]))
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())

ans = 1
for i in range(a, b + 1):
    ans *= i

if ans > 0:
    print("Positive")
elif ans < 0:
    print("Negative")
elif ans == 0:
    print("Zero")
else:
    pass


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

if a > 0 and b > 0:
    print("Positive")
elif a < 0 and b > 0:
    print("Zero")
else:
    if (b - a + 1) % 2 == 0:
        print("Positive")
    else:
        print("Negative")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

ans = 0

while N > 0:
    ans += N % 10
    # ans = ans % 9
    N = N // 10
ans = ans % 9
if ans == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
N = input()

ans = 0

for i in range(len(N)):
    ans += int(N[i])

ans = ans % 9
if ans == 0:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

ans = 0

while N > 0:
    ans += N % 10
    ans = ans % 9
    N = N // 10

if ans == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
N = input()

ans = 0

for i in range(len(N)):
    ans += int(N[i])

ans = ans % 9
if ans == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N = int(input())
M = 'abcdefghijklmnopqrstuvwxyz'
L = []
res = ''

while(N>=26):
    N -= 1
    m = N % 26
    N = N // 26
    L = [m] + L

L = [N-1] + L

for m in L:
    res += M[m]
print(res)

Fixed submission:
import re

t = input()

pattern = r'[a-z]'

repattern = re.compile(pattern)

result = repattern.match(t)

if result:
    print('a')
else:
    print('A')
Buggy python submission (verdict: Time Limit Exceeded):
A = int(input())
L = map(int,input().split())

res = 1

for n in L:
    res *= n

if res > 10**18:
    res = -1
print(res)

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

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

res = 1

for n in L:
    res *= n
    if res > 10**18:
        print(-1)
        exit()
    
print(res)
Buggy python submission (verdict: Runtime Error):
import copy

N,M,X = map(int,input().split())

res = 10**8

C = [0] * N
A = [0] * N

for i in range(N):
    L = list(map(int,input().split()))
    C[i] = L[0]
    A[i] = L[1:]

def sum_l(a,b):
    for i in range(len(a)):
        a[i] += b[i]
    return a

def check_x(a):
    for i in range(len(a)):
        if a[i] < X:
            return False
    return True

# n…2^12(12bit)の整数
def calc_money_under(n):
    understand = [0] * M
    money = 0
    for s in range(N):
        if (n >> s) == 1:
            money += C[s]
            #tmp = copy.copy(understand)
            understand = copy.copy([x + y for (x,y) in zip(understand, A[s])])
            print(understand)
    
    if check_x(understand):
        res = min(sum(money), res)
    return

for n in range(2**N):
    calc_money_under(n)

if res == 10**8:
    print(-1)
else:
    print(res)



Fixed submission:
import copy
 
N,M,X = map(int,input().split())
 
res = 10**8
 
C = [0] * N
A = [0] * N
 
for i in range(N):
    L = list(map(int,input().split()))
    C[i] = L[0]
    A[i] = L[1:]
 
def check_x(a):
    for i in range(len(a)):
        if a[i] < X:
            return False
    return True
 
# n…2^12(12bit)の整数
def calc_money_under(n):
    global res

    understand = [0] * M
    money = 0
    for s in range(N):
        if (n >> s) & 1:
            money += C[s]
            for j in range(M):
                understand[j] += A[s][j]
            #print(understand)
    
    if check_x(understand):
        res = min(money, res)
    return
 
for n in range(2**N):
    calc_money_under(n)
 
if res == 10**8:
    print(-1)
else:
    print(res)
Buggy python submission (verdict: Runtime Error):
4
5 7

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

flag = False
for i in range(A,B+1):
    if i % K == 0:
        flag = True
        break

if flag:
    print('OK')
else:
    print('NG')
Buggy python submission (verdict: Time Limit Exceeded):
S = input()

modList = [0] * 2019 # あまりは0～2018の2019個

ans = 0

modList[0] = 1 # 解答でいうT(n)=0 の場合

# 最大20万回ループ、時間かかるならＤＰする？
# ↓ではTLEになった
# for i in range(len(S)):
#     m = int(S[i:]) % 2019
#     modList[m] += 1
T = 0
for i in range(1,len(S)+1):
    # T += int(S[-i]) * 10**i
    T += int(S[-i]) * ((10**i) % 2019)
    modList[T % 2019] +=1


#print(modList)

for j in modList:
    if j <= 1:
        continue
    else:
        ans += j*(j-1)/2

print(int(ans))


Fixed submission:
S = input()

modList = [0] * 2019 # あまりは0～2018の2019個

ans = 0

modList[0] = 1 # 解答でいうT(n)=0 の場合

# 最大20万回ループ、時間かかるならＤＰする？
# ↓ではTLEになった
# for i in range(len(S)):
#     m = int(S[i:]) % 2019
#     modList[m] += 1

# ↓　これでもTLEになった
# T = 0
# for i in range(1,len(S)+1):
#     # T += int(S[-i]) * 10**i
#     T += int(S[-i]) * ((10**i) % 2019)
#     modList[T % 2019] +=1

T = 0
a = 1
for s in S[::-1]:
    T = T+int(s) * a
    modList[T%2019]+=1
    a*=10
    a%=2019
#print(modList)

for j in modList:
    if j <= 1:
        continue
    else:
        ans += j*(j-1)/2

print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()

modList = [0] * 2019 # あまりは0～2018の2019個

ans = 0

modList[0] = 1 # 解答でいうT(n)=0 の場合

# 最大20万回ループ、時間かかるならＤＰする？
# ↓ではTLEになった
# for i in range(len(S)):
#     m = int(S[i:]) % 2019
#     modList[m] += 1
T = 0
for i in range(1,len(S)+1):
    T += int(S[-i]) * 10**i
    modList[T % 2019] += 1


#print(modList)

for j in modList:
    if j <= 1:
        continue
    else:
        ans += j*(j-1)/2

print(int(ans))


Fixed submission:
S = input()

modList = [0] * 2019 # あまりは0～2018の2019個

ans = 0

modList[0] = 1 # 解答でいうT(n)=0 の場合

# 最大20万回ループ、時間かかるならＤＰする？
# ↓ではTLEになった
# for i in range(len(S)):
#     m = int(S[i:]) % 2019
#     modList[m] += 1

# ↓　これでもTLEになった
# T = 0
# for i in range(1,len(S)+1):
#     # T += int(S[-i]) * 10**i
#     T += int(S[-i]) * ((10**i) % 2019)
#     modList[T % 2019] +=1

T = 0
a = 1
for s in S[::-1]:
    T = T+int(s) * a
    modList[T%2019]+=1
    a*=10
    a%=2019
#print(modList)

for j in modList:
    if j <= 1:
        continue
    else:
        ans += j*(j-1)/2

print(int(ans))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()

modList = [0] * 2019 # あまりは0～2018の2019個

ans = 0

modList[0] = 1 # 解答でいうT(n)=0 の場合

# 最大20万回ループ、時間かかるならＤＰする？
for i in range(len(S)):
    m = int(S[i:]) % 2019
    modList[m] += 1

#print(modList)

for j in modList:
    if j <= 1:
        continue
    else:
        ans += j*(j-1)/2

print(int(ans))

Fixed submission:
S = input()

modList = [0] * 2019 # あまりは0～2018の2019個

ans = 0

modList[0] = 1 # 解答でいうT(n)=0 の場合

# 最大20万回ループ、時間かかるならＤＰする？
# ↓ではTLEになった
# for i in range(len(S)):
#     m = int(S[i:]) % 2019
#     modList[m] += 1

# ↓　これでもTLEになった
# T = 0
# for i in range(1,len(S)+1):
#     # T += int(S[-i]) * 10**i
#     T += int(S[-i]) * ((10**i) % 2019)
#     modList[T % 2019] +=1

T = 0
a = 1
for s in S[::-1]:
    T = T+int(s) * a
    modList[T%2019]+=1
    a*=10
    a%=2019
#print(modList)

for j in modList:
    if j <= 1:
        continue
    else:
        ans += j*(j-1)/2

print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

# メモ用
memo = np.zeros((201,201,201))
K = int(input())

count = 0

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def gcd3(a,b,c):
    # 〇順に並べる
    # L = [a,b,c]
    # L.sort()
    # a,b,c = L[0],L[1],L[2]
    

    if memo[a,b,c] != 0:
        return memo[a,b,c]
    else:
        t = gcd(a,b)
        memo[a,b,c] = gcd(t,c) 
        return memo[a,b,c]


for i in range(1,K+1):
    for j in range(1,K+1):
        for k in range(1,K+1):
            count += gcd3(i,j,k)

print(int(count))

Fixed submission:
from math import gcd

K = int(input())

ans = 0

# ３つの数の最大公約数
# ⇒まず２つの数の最大公約数をとり
# その数とのこり１つの数の最大公約数をとる
# for a in range(1,K+1):
#     for b in range(1, K+1):
#         g = gcd(a, b)
#         for c in range(1, K+1):
#             ans += gcd(g, c)

# これでは３重ループとなり200**3 = 8000000 ではLTEとなる

#　そこで、一番内側のループをなくすために、
# gcd(g,1) + gcd(g,2) + ・・・　+gcd(g,K) を先に計算しておく
L = [0] * 201

for g in range(1, K+1):
    for c in range(1, K+1):
        L[g] += gcd(g, c)


for a in range(1, K+1):
    for b in range(1, K+1):
        g = gcd(a, b)
        ans += L[g]

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# 時間がかかりすぎる

import numpy as np

K = int(input())

def runrun(n):
    if n < 10:
        return True
    
    ns = str(n)

    for i in range(len(ns)-1):
        if abs(int(ns[i]) - int(ns[i+1])) > 1:
            return False

    return True

R = 0
while K > 0:
    R += 1
    if runrun(R):
        K -= 1

print(R)

Fixed submission:
from collections import deque
k = int(input())
q = deque(list(range(1, 10)))

for _ in range(k-1):
    d = q.popleft()

    if d%10 > 0:
        q.append(d*10 + d%10 - 1)

    q.append(d*10 + d%10)
    
    if d%10 < 9:
        q.append(d*10 + d%10 + 1)

print(q.popleft())
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N = int(input())
L = list( map(int,input().split()) )

D = np.zeros(2*(10**5)+1,dtype=int)


for i in L:
    D[i] += 1

Dcopy = D

D = np.where(D>1,(D-1)*D/2,0)
temp = int(D.sum())

for j in range(len(L)):
    if Dcopy[L[j]] > 1:
        print(temp - Dcopy[L[j]] + 1)
    else:
        print(temp)

Fixed submission:
import numpy as np

N = int(input())
L = list( map(int,input().split()) )

D = np.zeros(2*(10**5)+1,dtype=int)


for i in L:
    D[i] += 1

Dcopy = D

# D = np.where(D>1,(D-1)*D/2,0)
D = D*(D-1)/2
temp = int(D.sum())

for j in range(len(L)):
    if Dcopy[L[j]] > 1:
        print(temp - Dcopy[L[j]] + 1)
    else:
        print(temp)
Buggy python submission (verdict: Runtime Error):
s = input()
q = int(input())
query = []
lead = ''
end = ''
inversion_flg = False
 
for j in range(q):
    i = input().split()
    if i[0] == "1":
        if inversion_flg:
            inversion_flg = False 
        else:
            inversion_flg = True
    else:
        if inversion_flg:
            if i[1] == "1":
                i[1] = "2"
            else:
                i[1] = "1"
        if i[1] == "1":
            lead+=i[2]
        else:
            end+=i[2]
 
lead = lead[::-1]
s = lead+s+end
if inversion_flg:
    s = s[::-1]
print(s)

Fixed submission:
S = input()

if (S[0] == S[1]) and (S[1] == S[2]):
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
import sys
MAX_INT = sys.maxsize # 大きい値

H,N = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(N)]

# print(AB)
dp = [ [MAX_INT]*(H+1) for _ in range(N+1) ]

for i in range(N):
    for j in range(H+1):
        if AB[i][0] > j:
            dp[i+1][j] = min(dp[i][j],AB[i][1])
        else:
            dp[i+1][j] = min(dp[i][j],dp[i+1][j-AB[i][0]] + AB[i][1])

print(dp[N][H-1])

Fixed submission:
import numpy as np
H,N = map(int,input().split())

a = np.empty(N,dtype='int')
b = np.empty(N,dtype='int')

# dp[i] ヒットポイントiの魔物を倒すのに必要な最小の魔力
dp = np.array([float('inf')]*(H+1))
dp[0] = 0

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

# hがヒットポイント
for h in range(1,H+1):
    t = h - a
    t[t<0] = 0
    dp[h] = np.min(dp[t] + b)

print(int(dp[H]))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
N,M = map(int,input().split())

a = np.array( list(map(int,input().split())) )

count = 0

for c in range(1,M+1):
    b = c - a*0.5
    b = b % a
    if sum(b) == 0:
        count += 1

print(count)


Fixed submission:
# 最大公約数を返す
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
 
# 最小公倍数を返す
def lcm(a, b):
    return a * b // gcd(a, b)

N,M = map(int,input().split())
L = list(map(int,input().split()))

# ループを回しながら最小公倍数を計算していく
# 与えられたN個の偶数はすべて２で割っていく
leastCommonMultiple = L[0] // 2
for i in range(N):
    L[i] //= 2
    leastCommonMultiple = lcm(leastCommonMultiple, L[i])

# フラグ
c = 0

# Lに格納されているＮ個の数に含まれる素因数２の数が同じかどうかチェックする
while True:

    for i in range(N):
        # ２で割り切れない場合
        # L[i]に含まれている数すべてが２で割り切れないならＯＫ
        if L[i] % 2 == 1:
            c += 1
        # ２で割り切れるなら、２で割った数で上書き
        else:
            L[i] //= 2

    if not c == 0:
        break


if c == N:
    print( ((M // leastCommonMultiple) + 1) // 2 )
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
# import numpy as np
# A,B = map(int,input().split())
# print(np.lcm(A,B))
# numpyのlcm関数は新しく追加された関数であり、AtCoderでは使用不可
import math

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

def lcm(A,B):
    return A * B // math.gcd(A,B)

print(lcm(A,B))

Fixed submission:
# import math
import fractions # Python 3.4ではこちらにgcdがある

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

def lcm(A,B):
    return A * B // fractions.gcd(A,B)

print(lcm(A,B))

Buggy python submission (verdict: Runtime Error):
import numpy as np

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

print(np.lcm(A,B))

Fixed submission:
# import math
import fractions # Python 3.4ではこちらにgcdがある

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

def lcm(A,B):
    return A * B // fractions.gcd(A,B)

print(lcm(A,B))
Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = np.array([int(i) for i in input().split()])
mod = 10 ** 9 + 7
s = 0

for i in range(60):
    c1 = np.count_nonzero(arr & 1)
    s += 2 ** i * c1 * (n - c1)
    arr = arr >> 1

print(s % mod)

Fixed submission:
import numpy as np

n = int(input())
arr = np.array([int(i) for i in input().split()])
mod = 10 ** 9 + 7
s = 0

for i in range(60):
    c1 = np.count_nonzero(arr & 1)
    s += 2 ** i * c1 * (n - c1)
    arr = arr >> 1

print(s % mod)
Buggy python submission (verdict: Time Limit Exceeded):
X,Y = map(int,input().split())

mod = 10**9 + 7 

if (X+Y)%3 != 0:
    print(0)
    exit(0)

a = (2*X-Y)//3
b = (2*Y-X)//3

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**6+1
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 )
    g2.append( pow(g1[-1],mod-2,mod) )


print(cmb(a+b,a,mod))

Fixed submission:
X,Y = map(int,input().split())

mod = 10**9 + 7 

if (X+Y)%3 != 0:
    print(0)
    exit(0)

a = (2*X-Y)//3
b = (2*Y-X)//3

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**6+1
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(a+b,a,mod))
Buggy python submission (verdict: Time Limit Exceeded):
L,R = map(int,(input().split()))

A = []

ans = 2019

for i in range(L,R+1):
    A.append(i % 2019)

a = min(A)
b = max(A)

for j in range(a+1,b+1):
        for k in range(a,j):
            ans = min(ans,(j*k)%2019)
print(ans)

Fixed submission:
L,R = map(int,(input().split()))

A = []

ans = 2019

if (R-L) >= 2018:
    print(0)
else:
    for i in range(L,R+1):
        A.append(i % 2019)
    a = min(A)
    b = max(A)
    for j in range(a+1,b+1):
            for k in range(a,j):
                ans = min(ans,(j*k)%2019)
    print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
C = list(map(int,input().split()))

A = np.zeros((N,N),dtype = int)

for i in range(N-1):
    A[i][i] = 1
    A[i][i+1] = 1
A[N-1][0] = 1
A[N-1][N-1] = 1

B = np.array(C)

def calc_double(n):
    return n * 2

X = np.linalg.solve(A,B)
Y = map(calc_double,X.tolist())
Z = map(str,map(int,Y))

print(' '.join(Z))




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

X = []
temp = 0

for i in range(1,N,2):
    temp += C[i]
X.append( sum(C) - 2 * temp)

for j in range(N-1):
    X.append( 2 * C[j] - X[-1] )

Y = map(str,X)

print(' '.join(Y))

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
C = list(map(int,input().split()))

A = np.zeros((N,N),dtype = int)

for i in range(N-1):
    A[i][i] = 1
    A[i][i+1] = 1
A[N-1][0] = 1
A[N-1][N-1] = 1

B = np.array(C)

X = np.linalg.solve(A,B)
Y = X.tolist()

for j in range(N):
    print(str(int(Y[j]*2)),end=' ')



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

X = []
temp = 0

for i in range(1,N,2):
    temp += C[i]
X.append( sum(C) - 2 * temp)

for j in range(N-1):
    X.append( 2 * C[j] - X[-1] )

Y = map(str,X)

print(' '.join(Y))