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

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

def floor_t(A,B,y):
    return math.floor(A*y/B) - A*math.floor(y/B)

total = 0

# if A==B:
#     if A-1<=N:
#         print(floor_t(A,B,A-1))
#         exit(0)
#     else:
#         print(floor_t(A,B,N))
#         exit(0)

for x in range(N+1):
    if x%B==0:
        continue
    else:
        total = max(total,floor_t(A,B,x))

print(total)



Fixed submission:
import math

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

def floor_t(A,B,y):
    return math.floor(A*y/B) - A*math.floor(y/B)

#関数の挙動を調べる
# for x in range(1,10*B+1):
#     print('x={} : floor(AX/B)={}'.format(x,math.floor(A*x/B)))

# for x in range(1,10*B+1):
#     print('x={} : floor(X/B)={}'.format(x,A*math.floor(x/B)))

# for i in range(1,10*B+1):
#     print('x={}:f(x)={}'.format(i,floor_t(A,B,i)))

X=min(N,B-1)

print(floor_t(A,B,X))
Buggy python submission (verdict: Runtime Error):
N=int(input())
IDs =list(map(int,input().split()))

for i in range(1,N+1):
    print(IDs.count(i))

Fixed submission:
R=int(input())

import math

print(math.pi*R*2)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
IDs =list(map(int,input().split()))

for i in range(1,N+1):
    print(IDs.count(i))

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

from collections import Counter

c=Counter(IDs)

for i in range(1,N+1):
    print(c[i])

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

for i in range(1,N+1):
    print(IDs.count(i))

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

from collections import Counter

c=Counter(IDs)

for i in range(1,N+1):
    print(c[i])

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

for i in range(1,N+1):
    array = [x for x in IDs if x==i]
    print(len(array))

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

from collections import Counter

c=Counter(IDs)

for i in range(1,N+1):
    print(c[i])

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

for i in range(1,N+1):
    array = [x for x in IDs if x==i]
    print(len(array))

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

from collections import Counter

c=Counter(IDs)

for i in range(1,N+1):
    print(c[i])
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()

L=['R','G','B']
L_b=['R','G','B']
cnt=0
for i in range(N-2):
    for j in range(i+1,N-1):
        if S[i]!=S[j]:
            L_b=['R','G','B']
            L_b.remove(S[i])
            L_b.remove(S[j])
            index = S.rfind(L_b[0])
            for k in range(j+1,index+1):
                if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]  and j-i!=k-j:
                    cnt+=1

print(cnt)


Fixed submission:
N=int(input())
S=input()

r=S.count('R')
g=S.count('G')
b=S.count('B')

cnt=0
for i in range(N):
    for j in range(i+1,N):
        k=j+j-i
        if k>=N:
            break
        if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
            cnt+=1

print((r*g*b)-cnt)

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

cnt=0
for i in range(N-2):
    for j in range(i+1,N-1):
        if S[i]!=S[j]:
            for k in range(j+1,N):
                if k==2*j-i:
                    continue             
                if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]  and j-i!=k-j:
                    cnt+=1

print(cnt)


Fixed submission:
N=int(input())
S=input()

r=S.count('R')
g=S.count('G')
b=S.count('B')

cnt=0
for i in range(N):
    for j in range(i+1,N):
        k=j+j-i
        if k>=N:
            break
        if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
            cnt+=1

print((r*g*b)-cnt)

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


cnt=0
for i in range(N-2):
    for j in range(i+1,N-1):
        if S[i]!=S[j]:
            for k in range(j+1,N):
                if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]  and j-i!=k-j:
                    cnt+=1

print(cnt)


Fixed submission:
N=int(input())
S=input()

r=S.count('R')
g=S.count('G')
b=S.count('B')

cnt=0
for i in range(N):
    for j in range(i+1,N):
        k=j+j-i
        if k>=N:
            break
        if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
            cnt+=1

print((r*g*b)-cnt)

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

cnt=0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]  and j-i!=k-j:
                cnt+=1

print(cnt)


Fixed submission:
N=int(input())
S=input()

r=S.count('R')
g=S.count('G')
b=S.count('B')

cnt=0
for i in range(N):
    for j in range(i+1,N):
        k=j+j-i
        if k>=N:
            break
        if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
            cnt+=1

print((r*g*b)-cnt)

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

cnt=0
for i in range(N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if S[i]!=S[j] and S[i]!=S[k] and S[j]!=S[k]  and j-i!=k-j:
                cnt+=1

print(cnt)


Fixed submission:
N=int(input())
S=input()

r=S.count('R')
g=S.count('G')
b=S.count('B')

cnt=0
for i in range(N):
    for j in range(i+1,N):
        k=j+j-i
        if k>=N:
            break
        if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
            cnt+=1

print((r*g*b)-cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
if K!=1:
    while True:
        N=abs(N-K)
        tmp=N
        if abs(N-K)>tmp:
            print(tmp)
            exit(0)
else:
    print(0)

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

div =N//K
N=N-div*K

if K!=1:
    while True:
        N=abs(N-K)
        tmp=N
        if abs(N-K)>tmp:
            print(tmp)
            exit(0)
else:
    print(0)
Buggy python submission (verdict: Runtime Error):
x,y,a,b,c=map(int,input().split())

p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))

p=sorted(p,reverse=True)
q=sorted(q,reverse=True)
r=sorted(r)

cntx=0
cnty=0

ans=0


for i in range(a):
    if p[i]>=r[-1]:
        ans+=p[i]
    else:
        ans+=r.pop()

    cntx+=1    

    if cntx==x:
        break

for j in range(b):
    if q[j]>=r[-1]:
        ans+=q[j]
    else:
        ans+=r.pop()

    cnty+=1

    if cnty==y:
        break

print(ans)

Fixed submission:
x,y,a,b,c=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))

p=sorted(p,reverse=True)
q=sorted(q,reverse=True)
r=sorted(r)
p=p[:x]
q=q[:y]

import heapq
from collections import deque

heapq.heapify(p)
heapq.heapify(q)
r=deque(r)

for i in range(c):
    v_p=heapq.heappop(p)
    v_q=heapq.heappop(q)

    v_r=r.pop()
    if v_p<=v_q:
        heapq.heappush(q,v_q)
        if v_p<v_r:
            heapq.heappush(p,v_r)
        else:
            heapq.heappush(p,v_p)
    else:
        heapq.heappush(p,v_p)
        if v_q<v_r:
            heapq.heappush(q,v_r)
        else:
            heapq.heappush(q,v_q)

ans=sum(p)+sum(q)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
# input処理を高速化する
input = sys.stdin.readline

L=int(input())
div =0.001
ranges =np.arange(0.001,L+1,0.001)

V=0
for x in ranges:
    z=L-2*x
    V=max(V,x*x*z)

print(V)


# for x in np.arange(1,10+1,0.1):
#     for y in np.arange(1,10+1-x,0.1):
#         print(x,y)

Fixed submission:
import sys
import numpy as np
# input処理を高速化する
input = sys.stdin.readline

L=int(input())

#forループではない
# div =0.001
# ranges =np.arange(0.001,L+1,0.01)
# V=0
# for x in ranges:
#     z=L-2*x
#     V=max(V,x*x*z)

# print(V)
#相加相乗平均を用いる
print((L/3)**3)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
# input処理を高速化する
input = sys.stdin.readline

L=int(input())
div =0.001
V=0
for x in np.arange(div,L+1,div):
    z=L-2*x
    V=max(V,x*x*z)

print(V)


# for x in np.arange(1,10+1,0.1):
#     for y in np.arange(1,10+1-x,0.1):
#         print(x,y)

Fixed submission:
import sys
import numpy as np
# input処理を高速化する
input = sys.stdin.readline

L=int(input())

#forループではない
# div =0.001
# ranges =np.arange(0.001,L+1,0.01)
# V=0
# for x in ranges:
#     z=L-2*x
#     V=max(V,x*x*z)

# print(V)
#相加相乗平均を用いる
print((L/3)**3)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
# input処理を高速化する
input = sys.stdin.readline

L=int(input())
div =0.001
V=0
for x in np.arange(div,L+1,div):
    y=x
    z=L-x-y
    V=max(V,x*y*z)

print(V)


# for x in np.arange(1,10+1,0.1):
#     for y in np.arange(1,10+1-x,0.1):
#         print(x,y)

Fixed submission:
import sys
import numpy as np
# input処理を高速化する
input = sys.stdin.readline

L=int(input())

#forループではない
# div =0.001
# ranges =np.arange(0.001,L+1,0.01)
# V=0
# for x in ranges:
#     z=L-2*x
#     V=max(V,x*x*z)

# print(V)
#相加相乗平均を用いる
print((L/3)**3)
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
Q=int(input())

from collections import deque

S=deque(list(S))


for i in range(Q):

    Query = list(input().split())
    
    if len(Query)==1:
        S=deque(reversed(S))
    else:
        F_i ,C_i = int(Query[1]),Query[2]
        
        if F_i==1:
        
            S.appendleft(C_i)
        
        elif F_i==2:
        
            S.append(C_i)    

print(''.join(S))


Fixed submission:
S=input()
Q=int(input())

from collections import deque

S=deque(list(S))

flg=0

for i in range(Q):

    Query = list(input().split())
    
    if len(Query)!=1:
        F_i ,C_i = int(Query[1]),Query[2]
        
        if F_i==1 and flg==0:
            S.appendleft(C_i)
        
        elif F_i==2 and flg==0:
            S.append(C_i)   
        
        elif F_i==1 and flg==1:
            S.append(C_i)
        else:
            S.appendleft(C_i)
    else:
        if flg ==0:
            flg=1
        else:
            flg=0 

if flg ==1:
    S=reversed(S)

print(''.join(S))

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

from collections import deque

S=deque(list(S))


for i in range(Q):

    Query = list(input().split())
    
    if len(Query)==1:
        S=deque(reversed(S))
    else:
        F_i ,C_i = int(Query[1]),Query[2]
        
        if F_i==1:
        
            S.appendleft(C_i)
        
        elif F_i==2:
        
            S.append(C_i)    

print(''.join(S))


Fixed submission:
S=input()
Q=int(input())

from collections import deque

S=deque(list(S))

flg=0

for i in range(Q):

    Query = list(input().split())
    
    if len(Query)!=1:
        F_i ,C_i = int(Query[1]),Query[2]
        
        if F_i==1 and flg==0:
            S.appendleft(C_i)
        
        elif F_i==2 and flg==0:
            S.append(C_i)   
        
        elif F_i==1 and flg==1:
            S.append(C_i)
        else:
            S.appendleft(C_i)
    else:
        if flg ==0:
            flg=1
        else:
            flg=0 

if flg ==1:
    S=reversed(S)

print(''.join(S))
Buggy python submission (verdict: Runtime Error):
n,m,k=map(int,input().split())
edge=[[] for _ in range(n)]
for _ in range(m):
    a,b=map(int,input().split())
    a,b=a-1,b-1
    edge[a].append(b)
    edge[b].append(a)


from collections import deque
label=[-1]*n

i=0
for start in range(n):
    if label[start]!=-1:
        continue
    else:
        i+=1
        label[start]=i    
    dist_friends=[-1]*n
    dist_friends[start]=0
    f=deque([start])

    while f:
        v=f.popleft()        

        for e in edge[v]:
            if dist_friends[e]==-1 and label[e]==-1:
                dist_friends[e]=dist_friends[v]+1
                label[e]=i
                f.append(e)   

Renketsu=[0]*(n+1)

for i in label:
    Renketsu[i]+=1

Block=[0]*n
for _ in range(k):
    c,d=map(int,input().split())
    c,d=c-1,d-1
    if label[c]==label[d]:
        Block[c]+=1
        Block[d]+=1

ans=[]
for k in range(n):
    ans.append(Renketsu[label[k]]-1 - len(edge[k]) - Block[k])
print(*ans)

Fixed submission:
import sys
import math
# input処理を高速化する
input = sys.stdin.readline

N=int(input())

q,mod = divmod(N,2)

print(q+mod)
Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())

d={}

condi = []

string = ['0']*N

flg=0
for _ in range(M):
    s,c = map(int,input().split())

    condi.append([s,c])

    if s not in d:
        d[s]=c
    elif s in d :
        if d[s]!=c:
            flg+=1

if flg!=0:
    print(-1)
    exit(0)

if d[1]==0:
    print(-1)
    exit(0)



for i in range(N):
    if i==0 and 1 not in d :
        string[0] = '1'
    else:
        if i+1 in d:
            string[i] = str(d[i+1])

str_num = ''.join(string)
print(str_num)



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

d={}

condi = []

string = ['0']*N

flg=0
for _ in range(M):
    s,c = map(int,input().split())

    condi.append([s,c])

    if s not in d:
        d[s]=c
    elif s in d :
        if d[s]!=c:
            flg+=1

if flg!=0:
    print(-1)
    exit(0)

if 1 in d:
    if d[1]==0 and N!=1:
        print(-1)
        exit(0)

if N==1 and M==0:
    print(0)
    exit(0)

for i in range(N):
    if i==0 and 1 not in d :
        string[0] = '1'
    else:
        if i+1 in d:
            string[i] = str(d[i+1])

str_num = ''.join(string)
print(str_num)

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

d={}

condi = []

string = ['0']*N

flg=0
for _ in range(M):
    s,c = map(int,input().split())

    condi.append([s,c])

    if s not in d:
        d[s]=c
    elif s in d and d[s]!=c:
        flg+=1

if flg!=0:
    print(-1)
    exit(0)

if d[1]==0:
    print(-1)
    exit(0)



for i in range(N):
    if i==0 and 1 not in d :
        string[0] = '1'
    else:
        if i+1 in d:
            string[i] = str(d[i+1])

str_num = ''.join(string)
print(str_num)


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

d={}

condi = []

string = ['0']*N

flg=0
for _ in range(M):
    s,c = map(int,input().split())

    condi.append([s,c])

    if s not in d:
        d[s]=c
    elif s in d :
        if d[s]!=c:
            flg+=1

if flg!=0:
    print(-1)
    exit(0)

if 1 in d:
    if d[1]==0 and N!=1:
        print(-1)
        exit(0)

if N==1 and M==0:
    print(0)
    exit(0)

for i in range(N):
    if i==0 and 1 not in d :
        string[0] = '1'
    else:
        if i+1 in d:
            string[i] = str(d[i+1])

str_num = ''.join(string)
print(str_num)
Buggy python submission (verdict: Time Limit Exceeded):
def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod


n,a,b =map(int,input().split())
mod = 10**9 +7

total = 2**n -1

total-=comb(n,a,mod)
total-=comb(n,b,mod)


print(total%mod)

Fixed submission:
n,a,b =map(int,input().split())
mod =pow(10,9) +7

def comb(n,x):
    numerator = 1
    for i in range(n-x+1,n+1):
        numerator=  numerator * i  % mod
    
    denominator = 1
    for j in range(1,x+1):
        denominator = denominator * j % mod
    
    d = pow(denominator,mod-2,mod)

    return numerator * d

a = comb(n,a)
b =  comb(n,b)

print( (pow(2,n,mod) - 1  - a - b) %mod)

Buggy python submission (verdict: Time Limit Exceeded):
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

n,a,b =map(int,input().split())
mod = 10**9 +7

total = 2**n -1

total-=cmb(n,a)
total-=cmb(n,b)


print(total%mod)

Fixed submission:
n,a,b =map(int,input().split())
mod =pow(10,9) +7

def comb(n,x):
    numerator = 1
    for i in range(n-x+1,n+1):
        numerator=  numerator * i  % mod
    
    denominator = 1
    for j in range(1,x+1):
        denominator = denominator * j % mod
    
    d = pow(denominator,mod-2,mod)

    return numerator * d

a = comb(n,a)
b =  comb(n,b)

print( (pow(2,n,mod) - 1  - a - b) %mod)

Buggy python submission (verdict: Time Limit Exceeded):
from operator import mul
from functools import reduce

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


def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

total = 0
for i in range(1,n+1):
    if i!=a and i!=b:
        total += cmb(n,i)

print(total)

Fixed submission:
n,a,b =map(int,input().split())
mod =pow(10,9) +7

def comb(n,x):
    numerator = 1
    for i in range(n-x+1,n+1):
        numerator=  numerator * i  % mod
    
    denominator = 1
    for j in range(1,x+1):
        denominator = denominator * j % mod
    
    d = pow(denominator,mod-2,mod)

    return numerator * d

a = comb(n,a)
b =  comb(n,b)

print( (pow(2,n,mod) - 1  - a - b) %mod)
Buggy python submission (verdict: Time Limit Exceeded):
H,N=map(int,input().split())

#dp配列
# dp=[[float('inf')]*(H+1) for _ in range(N+1)]
# for j in range(H+1):
#     dp[0][j] =0

# for i in range(N):
#     A_i,B_i = map(int,input().split())
#     for a in range(H+1):
#         if A_i<=a:
#             dp[i+1][a] = min(dp[i][a-A_i] + B_i , dp[i][a])
#         else:
#             dp[i+1][a] = dp[i][a]

# print(*dp,sep="\n")

# print(dp[N][H])
dp = [float('inf')]*(H+1)
dp[0] = 0

for i in range(N):
    A_i,B_i = map(int,input().split())
    for j in range(H+1):
        nj = min(j+A_i,H)
        dp[nj] = min(dp[nj],dp[j] + B_i)
# print(*dp,sep="\n")
print(dp[H])

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

#dp配列
# dp=[[float('inf')]*(H+1) for _ in range(N+1)]
# for j in range(H+1):
#     dp[0][j] =0

# for i in range(N):
#     A_i,B_i = map(int,input().split())
#     for a in range(H+1):
#         if A_i<=a:
#             dp[i+1][a] = min(dp[i][a-A_i] + B_i , dp[i][a])
#         else:
#             dp[i+1][a] = dp[i][a]

# print(*dp,sep="\n")

# print(dp[N][H])
dp = [float('inf')]*(H+1)
dp[0] = 0

for i in range(N):
    A_i,B_i = map(int,input().split())
    for j in range(H+1):
        nj = min(j+A_i,H)
        dp[nj] = min(dp[nj],dp[j] + B_i)
# print(*dp,sep="\n")
print(dp[H])
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
Nums = list(map(int,input().split()))

M=[]

for i in range(1,N+1):
    tmp_list = Nums[:i]
    M_i = min(tmp_list)

    M.append(M_i)

cnt=0
for j in range(N):
    if Nums[j] ==M[j]:
        cnt+=1

print(cnt)

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

min_value=Nums[0]

cnt=0

for i in range(N):
    min_value = min(min_value,Nums[i])
    
    if Nums[i]<=min_value:
        cnt+=1
    
    

print(cnt)

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

M=[]

for i in range(1,N+1):
    tmp_list = Nums[:i]
    M_i = min(tmp_list)

    M.append(M_i)

cnt=0
for j in range(N):
    if Nums[j] ==M[j]:
        cnt+=1

print(cnt)

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

min_value=Nums[0]

cnt=0

for i in range(N):
    min_value = min(min_value,Nums[i])
    
    if Nums[i]<=min_value:
        cnt+=1
    
    

print(cnt)

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

import numpy as np
Nums.reverse()
cnt =0
d= np.array(Nums)

for i in range(N):
    P_i = d[0]
    d= np.delete(d,0)
    if (d>=P_i).prod() ==1:
        cnt +=1
    elif (d>=P_i).size ==0:
        cnt +=1

print(cnt)

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

min_value=Nums[0]

cnt=0

for i in range(N):
    min_value = min(min_value,Nums[i])
    
    if Nums[i]<=min_value:
        cnt+=1
    
    

print(cnt)
Buggy python submission (verdict: Runtime Error):
import math
A,B=map(int,input().split())

print((A * B) // math.gcd(A, B))

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

print((A * B) // fractions.gcd(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:
import fractions
A,B=map(int,input().split())

print((A * B) // fractions.gcd(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:
import fractions
A,B=map(int,input().split())

print((A * B) // fractions.gcd(A, B))

Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
import math

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

print(lcm(A,B))

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

print((A * B) // fractions.gcd(A, B))
Buggy python submission (verdict: Runtime Error):
N=int(input())

A=[]
test = []
for i in range(N):
    A_i= int(input())
    A.append(A_i)
    testimony_i=[]
    for j in range(A_i):
        x,y= map(int,input().split())

        testimony_i.append([x,y])
    
    test.append(testimony_i)
    
total=0
for i in range(2**N):

    member = format(i,'0{}b'.format(N))

    flg = 0

    for j in range(N):
        if member[j]== '1':

            syogen = test[j]

            for s in syogen:
                if member[s[0]-1]==str(s[1]):
                    continue
                else:
                    flg+=1

    if flg ==0:
        total = max(total , member.count('1')) 

print(total)

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

if A>=22:
    print('bust')
else:
    print('win')
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))

hat = [0,0,0]

mod = 10**9 + 7

ans=1
def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]

for i in range(n):
    arr=my_index_multi(hat,a[i])

    ans = (ans*len(arr))%mod

    hat[arr[0]]+=1

print(ans)



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

hat = [0,0,0]

mod = 10**9 + 7

ans=1

for i in range(n):
    tmp=0
    index=0
    for j,k in enumerate(hat):
        if k==a[i]:
            tmp+=1
            index=j

    ans = (ans*tmp)%mod

    hat[index]+=1

print(ans)

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

hat = [0,0,0]

mod = 10**9 + 7
ans=1

def my_index_multi(l, x):
    return [i for i, _x in enumerate(l) if _x == x]

for i in range(n):
    arr=my_index_multi(hat,a[i])

    ans = ans*len(arr)%mod

    hat[arr[0]]+=1

print(ans)



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

hat = [0,0,0]

mod = 10**9 + 7

ans=1

for i in range(n):
    tmp=0
    index=0
    for j,k in enumerate(hat):
        if k==a[i]:
            tmp+=1
            index=j

    ans = (ans*tmp)%mod

    hat[index]+=1

print(ans)