Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
import math
# stdin = open("sample.txt")

def keta(kazu):
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

K = int(stdin.readline().rstrip())
a = list(range(1,10))
b = []
attack = 100000
while attack > 0:
    go = a.pop(0)
    ue = go*10
    shimo = go%10
    b.append(go)
    if shimo == 0:
        a.append(ue)
        a.append(ue+1)
    elif shimo == 9:
        a.append(ue+shimo-1)
        a.append(ue+shimo)
    else:
        a.append(ue+shimo-1)
        a.append(ue+shimo)
        a.append(ue+shimo+1)
    attack -= 1

print(b[K-1])

Fixed submission:
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
import math
# stdin = open("sample.txt")

a, b, c = [int(x) for x in stdin.readline().rstrip().split()]

print(c,a,b)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
import math
# stdin = open("sample.txt")

def keta(kazu):
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

K = int(stdin.readline().rstrip())
a = list(range(1,10))
b = []
attack = 100000
while attack > 0:
    go = a.pop(0)
    ue = go*10
    shimo = go%10
    b.append(go)
    if shimo == 0:
        a.append(ue)
        a.append(ue+1)
    elif shimo == 9:
        a.append(ue+shimo-1)
        a.append(ue+shimo)
    else:
        a.append(ue+shimo-1)
        a.append(ue+shimo)
        a.append(ue+shimo+1)
    attack -= 1

print(b[K-1])

Fixed submission:
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
import math
# stdin = open("sample.txt")

N,K = [int(x) for x in stdin.readline().rstrip().split()]
ans1 = N % K
ans2 = (ans1 - K) * -1
# print(ans1,ans2)
print(min(ans1,ans2))
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter

# stdin = open("sample.txt")

h, w = [int(x) for x in stdin.readline().rstrip().split()]

if h == 1 or w == 1:
    print(1)
else:
    if h*w % 2 == 0:
        print(h*w // 2)
    else:
        print((h*w + 1) // 2)

Fixed submission:
from sys import stdin
# stdin = open("sample.txt")

a = int(stdin.readline().rstrip())

b = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(b[a-1])

Buggy python submission (verdict: Runtime Error):
stdin = open("sample.txt")

a = int(stdin.readline().rstrip())

b = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(b[a-1])

Fixed submission:
from sys import stdin
# stdin = open("sample.txt")

a = int(stdin.readline().rstrip())

b = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(b[a-1])

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter

stdin = open("sample.txt")

a = int(stdin.readline().rstrip())

b = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(b[a-1])

Fixed submission:
from sys import stdin
# stdin = open("sample.txt")

a = int(stdin.readline().rstrip())

b = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(b[a-1])
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter

stdin = open("sample.txt")

h, w = [int(x) for x in stdin.readline().rstrip().split()]

if h == 1 or w == 1:
    print(0)
else:
    if h*w % 2 == 0:
        print(h*w // 2)
    else:
        print((h*w + 1) // 2)

Fixed submission:
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter

# stdin = open("sample.txt")

h, w = [int(x) for x in stdin.readline().rstrip().split()]

if h == 1 or w == 1:
    print(1)
else:
    if h*w % 2 == 0:
        print(h*w // 2)
    else:
        print((h*w + 1) // 2)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
from sys import stdin

def reversi(s,a):
    if s == a:
        return "end"
    if s[-1] == a:
        return reversi(s[:-1],a)
    else:
        return s
    
s = stdin.readline().rstrip()
ans = 0

while True:
    if len(list(set(s))) == 1:
        break
    else:
        s = reversi(s,s[-1])
        ans += 1
print(ans)

Fixed submission:
# -*- coding: utf-8 -*-
from sys import stdin

s = stdin.readline().rstrip()
ans = 0

for i in range(1,len(s)):
    if s[i] != s[i-1]:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
from sys import stdin
stdin = open("sample.txt")

A = stdin.readline().rstrip()
B = stdin.readline().rstrip()
C = stdin.readline().rstrip()
turn = "a"

for i in range(300):
    if turn == "a":
        if A != "":
            turn = A[0]
            A = A[1:]
        else:
            print("A")
            exit()
    elif turn == "b":
        if B != "":
            turn = B[0]
            B = B[1:]
        else:
            print("B")
            exit()
    elif turn == "c":
        if C != "":
            turn = C[0]
            C = C[1:]
        else:
            print("C")
            exit()

Fixed submission:
# -*- coding: utf-8 -*-
from sys import stdin

A = stdin.readline().rstrip()
B = stdin.readline().rstrip()
C = stdin.readline().rstrip()
turn = "a"

for i in range(300):
    if turn == "a":
        if A != "":
            turn = A[0]
            A = A[1:]
        else:
            print("A")
            exit()
    elif turn == "b":
        if B != "":
            turn = B[0]
            B = B[1:]
        else:
            print("B")
            exit()
    elif turn == "c":
        if C != "":
            turn = C[0]
            C = C[1:]
        else:
            print("C")
            exit()
Buggy python submission (verdict: Time Limit Exceeded):
A, B, C = map(int, input().split())
K = int(input())

while K > 0:
    if A >= B:
        B *= 2
        K -= 1
    elif B >= C:
        C *= 2
        K -= 1
if C > B and B > A:
    print("Yes")
else:
    print("No")


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

while K > 0:
    if A >= B:
        B *= 2
        K -= 1
    elif B >= C:
        C *= 2
        K -= 1
    if C > B and B > A:
        break
if C > B and B > A:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
T = input()
# T ="PD?D??P"

for i in range(len(T)):
    if T[i] == "?":
        if i == 0:
            T = "D" + T[1:len(T)]
        if i == len(T) - 1:
            T = T[:len(T)-1] + "D"
        else:
            T = T[0:i] + "D" + T[i+1:len(T)]
print(T)


#
# P = 0
# D = 0
# Q = 0
# for i in range(len(T)):
#     if T[i] == "P":
#         P += 1
#     elif T[i] == "D":
#         D += 1
#     else:
#         Q += 1
# while Q >= 1:
#     if P >= D:
#         D += 1
#         Q -= 1
#     else:
#         P += 1
#         Q -= 1
#
# if P == D:
#     while P >= 1:
#         print("PD", end='')
#         P -= 1
#         D -= 1
#     print("")
# elif P > D:
#     while D >= 1:
#         print("PD", end="")
#         P -= 1
#         D -= 1
#     while P >= 1:
#         print("P", end="")
#         P -= 1
#     print("")
# elif P < D:
#     while P >= 1:
#         print("PD", end="")
#         P -= 1
#         D -= 1
#     while D >= 1:
#         print("D", end="")
#         D -= 1
#     print("")
#
#
# # print(P)
# # print(D)
# # print(Q)


Fixed submission:
T = input()
# T ="PD?D??P"
L = len(T)
ans = ""

for i in range(L):
    if T[i] == "?" or T[i] == "D":
        ans += "D"
    else:
        ans += "P"

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

if B < N:
    Max = int(A*(B-1)/B)
    for x in range(B,1+N):
        fx = int(A*x/B) - A * int(x/B)
        Max = max(Max,fx)
elif B == N:
    Max = int(A*(B-1)/B)
else:
    Max = int(A*N/B)
print(Max)


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


if B < N:
    Max = int(A*(B-1)/B)
    X = int(N/B)
    fx = int(A*(B*X-1)/B) - A * int((B*X-1)/B)
    # Max = max(fx,Max)
    # for x in range(1,X):
    #     fx = int(A*x/B) - A * int(x/B)
    #     Max = max(Max,fx)
elif B == N:
    Max = int(A*(B-1)/B)
else:
    Max = int(A*N/B)
print(Max)

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

Max = 0

for x in range(1,1+N):
    fx = int(A*x/B) - A * int(x/B)
    Max = max(Max,fx)
print(Max)


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


if B < N:
    Max = int(A*(B-1)/B)
    X = int(N/B)
    fx = int(A*(B*X-1)/B) - A * int((B*X-1)/B)
    # Max = max(fx,Max)
    # for x in range(1,X):
    #     fx = int(A*x/B) - A * int(x/B)
    #     Max = max(Max,fx)
elif B == N:
    Max = int(A*(B-1)/B)
else:
    Max = int(A*N/B)
print(Max)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Word_list = []
ans = 0

for i in range(N):
    Gift = input()
    Word_list.append(Gift)
    Word_list.sort()

Before_Word = ""

for i in range(N):
    if Word_list[i] != Before_Word:
        ans += 1
        Before_Word = Word_list[i]

print(ans)

# 
# for i in range(N):
#     Gift = input()
#     CHECK = "Nothing"
#     for i in Word_list:
#         if i == Gift:
#             CHECK = "Exist"
#             break
#     if CHECK == "Nothing":
#         Word_list.append(Gift)
#         ans += 1
# # print(Word_list)
# print(ans)


Fixed submission:
N = int(input())
Word_list = []
ans = 0

for i in range(N):
    Gift = input()
    Word_list.append(Gift)
Word_list.sort()

Before_Word = ""

for i in range(N):
    if Word_list[i] != Before_Word:
        ans += 1
        Before_Word = Word_list[i]

print(ans)

#
# for i in range(N):
#     Gift = input()
#     CHECK = "Nothing"
#     for i in Word_list:
#         if i == Gift:
#             CHECK = "Exist"
#             break
#     if CHECK == "Nothing":
#         Word_list.append(Gift)
#         ans += 1
# # print(Word_list)
# print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
Word_list = []
ans = 0
for i in range(N):
    Gift = input()
    CHECK = "Nothing"
    for i in Word_list:
        if i == Gift:
            CHECK = "Exist"
            break
    if CHECK == "Nothing":
        Word_list.append(Gift)
        ans += 1
# print(Word_list)
print(ans)


Fixed submission:
N = int(input())
Word_list = []
ans = 0

for i in range(N):
    Gift = input()
    Word_list.append(Gift)
Word_list.sort()

Before_Word = ""

for i in range(N):
    if Word_list[i] != Before_Word:
        ans += 1
        Before_Word = Word_list[i]

print(ans)

#
# for i in range(N):
#     Gift = input()
#     CHECK = "Nothing"
#     for i in Word_list:
#         if i == Gift:
#             CHECK = "Exist"
#             break
#     if CHECK == "Nothing":
#         Word_list.append(Gift)
#         ans += 1
# # print(Word_list)
# print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split())

ans = 0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x + y + z == S:
                ans += 1
print(ans)


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

ans = 0
for x in range(K+1):
    for y in range(K+1):
        if S - x - y <= K and S - x - y >= 0:
            ans += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
n = input()
data = map(int, sys.stdin.readline().split())

ans = 1

over=False
zero=False
for num in data:
    ans*=num
    if(ans>1000000000000000000):
        over=True
    if(num == 0):
        zero=True

if ans>1000000000000000000:
    over=True

if zero:
    print("0")
elif over:
    print("-1")
else:
    print(ans)

Fixed submission:
import sys
n = input()
data = list(map(int, sys.stdin.readline().split()))

ans = 1

over=False
zero=False

if 0 in data:
    zero=True

for num in data:
    ans*=num
    if(ans>1000000000000000000):
        over=True
        break

if ans>1000000000000000000:
    over=True

if zero:
    print("0")
elif over:
    print("-1")
else:
    print(ans)

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

ans = 1

over=False
zero=False
for num in data:
    ans*=num
    if(ans>1000000000000000000):
        over=True
    if(num == 0):
        zero=True

if ans>1000000000000000000:
    over=True

if zero:
    print("0")
elif over:
    print("-1")
else:
    print(ans)

Fixed submission:
import sys
n = input()
data = list(map(int, sys.stdin.readline().split()))

ans = 1

over=False
zero=False

if 0 in data:
    zero=True

for num in data:
    ans*=num
    if(ans>1000000000000000000):
        over=True
        break

if ans>1000000000000000000:
    over=True

if zero:
    print("0")
elif over:
    print("-1")
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])

Fixed submission:
N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))

ans = 1
check = 10 ** 18

for i in range(N):
    ans *= A[i]

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

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort()
if A[0] == 0:
    print(0)
    exit()

ans = 1
check = 10 ** 18

for i in range(N-1,-1,-1):
    ans *= A[i]
    if ans > check:
        print(-1)
        exit()

print(ans)

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

ans = 1
check = 10 ** 18

for i in range(N):
    ans *= A[i]

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

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
A.sort()
if A[0] == 0:
    print(0)
    exit()

ans = 1
check = 10 ** 18

for i in range(N-1,-1,-1):
    ans *= A[i]
    if ans > check:
        print(-1)
        exit()

print(ans)
Buggy python submission (verdict: Runtime Error):
A,B = input().split()
A = int(A)
B = replace(".","")

B = int(B) * 100

print(A*B/100)

Fixed submission:
import math
A,B = input().split()
A = int(A)
B = B.replace(".","")
 
B = int(B)
print(math.floor(A*B//100))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque  
d = deque()

S = input()
Q = int(input())
Query = [input() for i in range(Q)]

#最初の文字列をdに追加
for i in range(len(S)):
    d.append(S[i])

# 先頭から読むか，末尾から読むかを判定する
# 偶数 -> 先頭から，奇数 -> 末尾から
isReadOrientation = 0

for i in range(Q):
    if len(Query[i]) == 1:
        isReadOrientation += 1
    else:
        #先頭に追加
        if Query[i][2] == "1":
            #先頭に追加
            if isReadOrientation % 2 == 0:
                d.appendleft(Query[i][4])
            #末尾に追加
            else:
                d.append(Query[i][4])
        #末尾に追加
        else:
            #末尾に追加
            if isReadOrientation % 2 == 0:
                d.append(Query[i][4])
            #先頭に追加
            else:
                d.appendleft(Query[i][4])

ans = ""
#先頭から文字列に記録
if isReadOrientation % 2 == 0:
    for i in range(len(d)):
        ans += d[i]
#末尾から文字列に記録
else:
    for i in range(len(d)-1,-1,-1):
        ans += d[i]
print(ans)

Fixed submission:
from collections import deque  
d = deque(input())
Q = int(input())
Query = [input() for i in range(Q)]

# 先頭から読むか，末尾から読むかを判定する
# 偶数 -> 先頭から，奇数 -> 末尾から
isReadOrientation = 0

for i in range(Q):
    if len(Query[i]) == 1:
        isReadOrientation += 1
    else:
        #先頭に追加
        if Query[i][2] == "1":
            #先頭に追加
            if isReadOrientation % 2 == 0:
                d.appendleft(Query[i][4])
            #末尾に追加
            else:
                d.append(Query[i][4])
        #末尾に追加
        else:
            #末尾に追加
            if isReadOrientation % 2 == 0:
                d.append(Query[i][4])
            #先頭に追加
            else:
                d.appendleft(Query[i][4])

#先頭から文字列に記録
if isReadOrientation % 2 != 0:
    d.reverse()
print("".join(d))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
cnt = [0]* (max(A)+1)
for i in range(N):
    if cnt[A[i]] == 0:
        cnt[A[i]] = 1
    else:
        print("NO")
        exit()
print("YES")

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
dic = {}
for i in range(N):
    if (A[i] in dic) == True:
        print("NO")
        exit()
    dic[A[i]] = "exist"
print("YES")
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
p = list(map(int,input().split()))

max_total = 0
index_first = 0
index_end = 0
for i in range(N - K + 1):
    if max_total < sum(p[i:i+K]):
        max_total = sum(p[i:i+K])
        index_first = i
        index_end = i+K

ans = 0
for i in range(index_first,index_end):
    ans += ((p[i] * (p[i] + 1)) /2) * (1/p[i])
print(ans)

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


def cal_expect(value):
    return ((value*(value+1))/2)*(1/value)

expect_value = [0]*N
expect_value[0] = cal_expect(p[0])

for i in range(1,K):
    expect_value[i] += expect_value[i-1] + cal_expect(p[i])

for i in range(K,N):
    expect_value[i] = expect_value[i-1] + cal_expect(p[i]) - cal_expect(p[i - K])

print(max(expect_value))

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

expect_value = [0]*N

for i in range(N):
    expect_value[i] = ((p[i] * (p[i]+1))/2) * (1/p[i])

ans = [0] * (N - K + 1)
for i in range(N - K + 1):
    ans[i] = sum(expect_value[i:i+K])
print(max(ans))

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


def cal_expect(value):
    return ((value*(value+1))/2)*(1/value)

expect_value = [0]*N
expect_value[0] = cal_expect(p[0])

for i in range(1,K):
    expect_value[i] += expect_value[i-1] + cal_expect(p[i])

for i in range(K,N):
    expect_value[i] = expect_value[i-1] + cal_expect(p[i]) - cal_expect(p[i - K])

print(max(expect_value))

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
p = list(map(int,input().split()))

expect_value = [0]*N

for i in range(N):
    expect_value[i] = ((p[i] * (p[i]+1))/2) * (1/p[i])

ans = [0] * (N - K + 1))
for i in range(N - K + 1):
    ans[i] = sum(expect_value[i:i+K])
print(max(ans)

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


def cal_expect(value):
    return ((value*(value+1))/2)*(1/value)

expect_value = [0]*N
expect_value[0] = cal_expect(p[0])

for i in range(1,K):
    expect_value[i] += expect_value[i-1] + cal_expect(p[i])

for i in range(K,N):
    expect_value[i] = expect_value[i-1] + cal_expect(p[i]) - cal_expect(p[i - K])

print(max(expect_value))

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

expect_value = [0]*N

for i in range(N):
    expect_value[i] = ((p[i] * (p[i]+1))/2) * (1/p[i])

ans = 0
for i in range(N - K + 1):
    if ans < sum(expect_value[i:i+K]):
        ans = sum(expect_value[i:i+K])
print(ans)

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


def cal_expect(value):
    return ((value*(value+1))/2)*(1/value)

expect_value = [0]*N
expect_value[0] = cal_expect(p[0])

for i in range(1,K):
    expect_value[i] += expect_value[i-1] + cal_expect(p[i])

for i in range(K,N):
    expect_value[i] = expect_value[i-1] + cal_expect(p[i]) - cal_expect(p[i - K])

print(max(expect_value))
Buggy python submission (verdict: Runtime Error):
N = int(input())
S = input()
cnt = 0
ans = 0
for i in range(N):
    if S[i] == "A":
        if cnt == 0:
            cnt += 1
        else:
            cnt = 1
    if S[i] == "B":
        if cnt == 1:
            cnt += 1
        else:
            cnt = 0
    if S[i] == "C":
        if cnt == 2:
            ans += 1
            cnt = 0
        else:
            cnt = 0

print(ans)

Fixed submission:
K, X = map(int,input().split())
if 500 * K >= X:
    print("Yes")
else:
    print("No")
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:
import math
import fractions
a,b = map(int,input().split())

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

print(lcm(a, b))
Buggy python submission (verdict: Runtime Error):
import math
N = int(input())
N_sqrt = int(math.sqrt(N))

for i in range(1,N_sqrt):
    if N % i == 0:
        x = i
        y = int(N/i)

print(x+y-2)

Fixed submission:
import math
N = int(input())
N_sqrt = int(math.sqrt(N))

for i in range(1,N_sqrt+1):
    if N % i == 0:
        x = i
        y = int(N/i)

print(x+y-2)
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

def heapsort(iterable):
    h = []
    for value in iterable:
        heapq.heappush(h, value)
    return [heapq.heappop(h) for i in range(len(h))]

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

for i in range(M):
    A = heapsort(A)
    A[N-1] //= 2

print(sum(A))

Fixed submission:
import heapq
import math

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

# 各要素に1掛ける
A = list(map(lambda x: x * -1, A))
heapq.heapify(A)

for _ in range(M):
    heapq.heappush(A, ((-1*heapq.heappop(A))//2)*-1 )

print(sum(A) * -1)

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
A = list(map(int,input().split()))
for i in range(M):
    A[A.index(max(A))] //= 2
print(sum(A))

Fixed submission:
import heapq
import math

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

# 各要素に1掛ける
A = list(map(lambda x: x * -1, A))
heapq.heapify(A)

for _ in range(M):
    heapq.heappush(A, ((-1*heapq.heappop(A))//2)*-1 )

print(sum(A) * -1)