Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
h,w,a,b = map(int, input().split())

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def comb(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

ans=0
for i in range(h-a):
    pre=comb(i+b-1,i)
    post=comb(h+w-b-2-i,h-i-1)
    ans+=pre*post
    ans%=10**9+7
print(ans)

Fixed submission:
h,w,a,b = map(int, input().split())
def find_power(n,mod=10**9+7):
    powlist=[0]*(n+1)
    powlist[0]=1
    powlist[1]=1
    for i in range(2,n+1):
        powlist[i]=powlist[i-1]*i%(mod)
    return powlist
def find_inv_power(n):
    powlist=find_power(n)
    check=powlist[-1]
    first=1
    uselist=[0]*(n+1)
    secondlist=[0]*30
    secondlist[0]=check
    secondlist[1]=check**2
    for i in range(28):
        secondlist[i+2]=(secondlist[i+1]**2)%(10**9+7)
    a=format(10**9+5,"b")
    for j in range(30):
        if a[29-j]=="1":
            first=(first*secondlist[j])%(10**9+7)
    uselist[n]=first
    for i in range(n,0,-1):
        uselist[i-1]=(uselist[i]*i)%(10**9+7)
    return uselist
mod = 10**9+7
p_lis=find_power(4*10**5+100,mod)
ip_lis=find_inv_power(4*10**5+100)

def comb(n,r,mod=10**9+7):
    if n<r:
        return 0
    elif n>=r:
        return (p_lis[n]*ip_lis[r]*ip_lis[n-r])%(mod)
ans=0
for i in range(h-a):
    pre=comb(i+b-1,i)
    post=comb(h+w-b-2-i,h-i-1)
    ans+=pre*post
    ans%=10**9+7
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int, input().split())
link = [[] for _ in range(n)]
ln = []
for i in range(n-1):
    a,b = list(map(int,input().split()))
    link[a-1].append(b-1)
    link[b-1].append(a-1)
    ln.append([a-1,b-1])

if k==1:
    print(n-2)
    exit()

from collections import deque
def get_v(node,dist):
    Q = deque()
    Q.append([node,0])
    visited=[-1]*n
    visited[node]=1
    while Q:
        now,cnt = Q.popleft()
        if cnt > dist:
            break
        for nxt in link[now]:
            if visited[nxt]!=-1:
                continue
            visited[nxt]=cnt+1
            Q.append([nxt,cnt+1])
    for i in range(n):
        if visited[i] == -1:
            ret = 0
        elif visited[i] <= dist:
            ret = 1
        else:
            ret = 0
        visited[i] = ret
    return visited

import numpy as np
ans=float("inf")
if k%2==0:
    for i in range(n):
        ret = n - sum(get_v(i,k//2))
        ans=min(ret,ans)
else:
    for tmp in ln:
        n1,n2=tmp
        c1=np.array(get_v(n1,k//2))
        c2=np.array(get_v(n2,k//2))
        ret = n- sum(c1 | c2)
        ans=min(ret,ans)

print(ans)

Fixed submission:
n,k = map(int, input().split())
link = [[] for _ in range(n)]
ln = []
for i in range(n-1):
    a,b = list(map(int,input().split()))
    link[a-1].append(b-1)
    link[b-1].append(a-1)
    ln.append([a-1,b-1])

if k==1:
    print(n-2)
    exit()

from collections import deque
def get_v(node,dist):
    Q = deque()
    Q.append([node,0])
    visited=[-1]*n
    visited[node]=1
    while Q:
        now,cnt = Q.popleft()
        if cnt > dist:
            break
        for nxt in link[now]:
            if visited[nxt]!=-1:
                continue
            visited[nxt]=cnt+1
            Q.append([nxt,cnt+1])
    for i in range(n):
        if visited[i] == -1:
            ret = 0
        elif visited[i] <= dist:
            ret = 1
        else:
            ret = 0
        visited[i] = ret
    return visited
def borsm(l1,l2):
    sm=0
    for b1,b2 in zip(l1,l2):
        sm+=(b1 | b2)
    return sm
ans=float("inf")
if k%2==0:
    for i in range(n):
        ret = n - sum(get_v(i,k//2))
        ans=min(ret,ans)
else:
    for tmp in ln:
        n1,n2=tmp
        c1=get_v(n1,k//2)
        c2=get_v(n2,k//2)
        ret = n- borsm(c1,c2)
        ans=min(ret,ans)
print(ans)
Buggy python submission (verdict: Runtime Error):
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m=map(int,input().split())
uf=UnionFind(n)
for i in range(m):
  a,b=map(int,input().split())
  uf.union(a,b)
print(uf.group_count()-1)

Fixed submission:
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

n,m=map(int,input().split())
uf=UnionFind(n)
for i in range(m):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  uf.union(a,b)
print(uf.group_count()-1)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=[int(x) for x in input().rstrip().split()]
ruiseki=[a[0]]
for i in range(1,n):
    if k<=i:
        ruiseki.append((a[i]*ruiseki[i-1])//(a[i-k]))
    else:
        ruiseki.append((a[i]*ruiseki[i-1]))

for i in range(k,n):
    if ruiseki[i-1]<ruiseki[i]:
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k=map(int,input().split())
a=[int(x) for x in input().rstrip().split()]

ruiseki=[a[0]]
for i in range(k,n):
    if a[i-k]<a[i]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n,m,k=[int(x) for x in input().rstrip().split()]
a=[int(x) for x in input().rstrip().split()]
b=[int(x) for x in input().rstrip().split()]

A=[0]
B=[0]

for i in range(n):
  A.append(A[i]+a[i])

for i in range(m):
  B.append(B[i]+b[i])

ans=0
j=m

for i in range(n+1):
  j=m
  if A[i]>k:
    break
  nokori=k-A[i]

  while(nokori<B[j] and 0<=j):
    j-=1

    
  ans=max(ans,i+j)
print(ans)


Fixed submission:
n,m,k=[int(x) for x in input().rstrip().split()]
a=[int(x) for x in input().rstrip().split()]
b=[int(x) for x in input().rstrip().split()]

A=[0]
B=[0]

for i in range(n):
  A.append(A[i]+a[i])

for i in range(m):
  B.append(B[i]+b[i])

ans=0
j=m

for i in range(n+1):
  # j=m
  if A[i]>k:
    break
  nokori=k-A[i]

  while(nokori<B[j] and 0<=j):
    j-=1

    
  ans=max(ans,i+j)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,m,k=[int(x) for x in input().rstrip().split()]
a=[int(x) for x in input().rstrip().split()]
b=[int(x) for x in input().rstrip().split()]

A=[0]
B=[0]

for i in range(n):
  A.append(A[i]+a[i])

for i in range(m):
  B.append(B[i]+b[i])

ans=0
j=0

for i in range(n+1):
  j=0
  if A[i]>k:
    break
  nokori=k-A[i]

  while(B[j]<=nokori and j<m):
    j+=1

  if nokori<B[j]:
    j-=1
    
  ans=max(ans,i+j)
print(ans)


Fixed submission:
n,m,k=[int(x) for x in input().rstrip().split()]
a=[int(x) for x in input().rstrip().split()]
b=[int(x) for x in input().rstrip().split()]

A=[0]
B=[0]

for i in range(n):
  A.append(A[i]+a[i])

for i in range(m):
  B.append(B[i]+b[i])

ans=0
j=m

for i in range(n+1):
  # j=m
  if A[i]>k:
    break
  nokori=k-A[i]

  while(nokori<B[j] and 0<=j):
    j-=1

    
  ans=max(ans,i+j)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=[0]*(n+1)
ans=0
for i in range(1,n+1):
  j=i
  while(j<=n):
    l[j]+=1
    j+=i
  
  ans+=i*l[i]
print(ans)



Fixed submission:
n=int(input())
ans = 0
for i in range(1, n+1):
    a = n//i
    ans += a*(a+1)//2*i
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect

n=int(input())
a=[int(x) for x in input().rstrip().split()]
q=int(input())
a.sort()
for i in range(q):
  b,c=map(int,input().split())
  b_l=bisect.bisect_left(a,b)
  b_r=bisect.bisect_right(a,b)
  a=a[:b_l]+[c]*(b_r-b_l)+a[b_r:]
  print(sum(a))

Fixed submission:
import bisect

n=int(input())
a=[int(x) for x in input().rstrip().split()]
dp=[0 for i in range(10**5)]
q=int(input())

for i in a:
  dp[i-1]+=1

ans=sum(a)
for i in range(q):
  b,c=map(int,input().split())
  ans=ans-(dp[b-1]*b)+(c*dp[b-1])
  dp[c-1]+=dp[b-1]
  dp[b-1]=0
  print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
X,n=[int(x) for x in input().rstrip().split()]
p=[int(x) for x in input().rstrip().split()]

nai=[]
if n==0:
  print(X)
  sys.exit()
else:
  if X not in p:
    print(X)
    sys.exit()
  else:
    for i in range(-100,101):
      if i not in p:
        nai.append(i)
    nai.append(X)
    nai.sort()

    for i in range(len(nai)):
      if nai[i]==X:
        if abs(nai[i-1]-X)<=abs(nai[i+1]-X):
          print(nai[i-1])
        else:
          print(nai[i+1])
          sys.exit()



Fixed submission:
import sys
X,n=[int(x) for x in input().rstrip().split()]
p=[int(x) for x in input().rstrip().split()]

nai=[]
if n==0:
  print(X)
  sys.exit()
else:
  if X not in p:
    print(X)
    sys.exit()
  else:
    for i in range(-200,301):
      if i not in p:
        nai.append(i)
    nai.append(X)
    nai.sort()

    ind=nai.index(X)
    
    if abs(nai[ind-1]-X)<=abs(nai[ind+1]-X):
      print(nai[ind-1])
      sys.exit()
    else:
      print(nai[ind+1])
      sys.exit()
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(x) for x in input().rstrip().split()]
done=[False for i in range(n)]
if n%2==0:
  for i in range(n//2):
    if done[i]==True:
      continue
    for j in range(i+1,n):
      if done[j]==True:
        continue
      if a[i]%a[j]==0:
        done[i]=True

      if a[j]%a[i]==0:
        done[j]=True

  for i in range(n//2,n):
    if done[i]==True:
      continue
    for j in range(i+1,n):
      if done[j]==True:
        continue
      if a[i]%a[j]==0:
        done[i]=True

      if a[j]%a[i]==0:
        done[j]=True
else:
  for i in range(n//2):
    if done[i]==True:
      continue
    for j in range(i+1,n):
      if done[j]==True:
        continue
      if a[i]%a[j]==0:
        done[i]=True

      if a[j]%a[i]==0:
        done[j]=True
    
  for i in range(n//2,n):
    if done[i]==True:
      continue
    for j in range(i+1,n):
      if done[j]==True:
        continue
      if a[i]%a[j]==0:
        done[i]=True

      if a[j]%a[i]==0:
        done[j]=True
    
  
print(done.count(False))



Fixed submission:
import sys

n=int(input())
a=[int(x) for x in input().rstrip().split()]
a.sort()
max_val=max(a)
dp=[True for i in range(max_val)]
done=[0 for i in range(max_val)]
cnt=0
ans=0

for i in a:

  if 1<=done[i-1]:
    done[i-1]+=1
    continue

  done[i-1]+=1
  cnt=1
  while(i*cnt<=max_val):
    cnt+=1
    if cnt*i<=max_val:
      done[cnt*i-1]+=1

for i in a:
  if done[i-1]==1:
      ans+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(x) for x in input().rstrip().split()]
done=[False for i in range(n)]

for i in range(n):
  if done[i]==True:
    continue
  for j in range(i+1,n):
    if done[j]==True:
      continue
    if a[i]%a[j]==0:
      done[i]=True

    if a[j]%a[i]==0:
      done[j]=True

print(done.count(False))



Fixed submission:
import sys

n=int(input())
a=[int(x) for x in input().rstrip().split()]
a.sort()
max_val=max(a)
dp=[True for i in range(max_val)]
done=[0 for i in range(max_val)]
cnt=0
ans=0

for i in a:

  if 1<=done[i-1]:
    done[i-1]+=1
    continue

  done[i-1]+=1
  cnt=1
  while(i*cnt<=max_val):
    cnt+=1
    if cnt*i<=max_val:
      done[cnt*i-1]+=1

for i in a:
  if done[i-1]==1:
      ans+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(x) for x in input().rstrip().split()]
done=[False for i in range(n)]

for i in range(n):
  if done[i]==True:
    continue
  for j in range(i+1,n):
    if done[j]==True:
      continue
    if a[i]%a[j]==0:
      done[i]=True

    if a[j]%a[i]==0:
      done[j]=True

print(done.count(False))



Fixed submission:
import sys

n=int(input())
a=[int(x) for x in input().rstrip().split()]
a.sort()
max_val=max(a)
dp=[True for i in range(max_val)]
done=[0 for i in range(max_val)]
cnt=0
ans=0

for i in a:

  if 1<=done[i-1]:
    done[i-1]+=1
    continue

  done[i-1]+=1
  cnt=1
  while(i*cnt<=max_val):
    cnt+=1
    if cnt*i<=max_val:
      done[cnt*i-1]+=1

for i in a:
  if done[i-1]==1:
      ans+=1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(x) for x in input().rstrip().split()]
ans=1
for i in a:
  ans*=i
  
if 10**18<ans:
  print(-1)
else:
  print(ans)


Fixed submission:
import sys
n=int(input())
a=[int(x) for x in input().rstrip().split()]
a.sort()
if a[0]==0:
  print(0)
else:
  ans=1
  for i in a:
    ans*=i
    if 10**18<ans:
      print(-1)
      sys.exit()
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
t=input()
ans=""
for i in t:
  if i=="?":
    ans+="D"
  else:
    ans+=i
print(ans)



Fixed submission:
t=input()
ans=""
for i in range(len(t)):
  if t[i]=="?":
    ans+="D"
  else:
    ans+=t[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
N,K=[int(x) for x in input().rstrip().split()]
A=[int(x) for x in input().rstrip().split()]
stack=[]
done=[0 for i in range(N)]
done[0]=0
now=1
amari=[]
cnt=0
for i in range(10**5):
  done[now-1]+=1
  if done[now-1]==2:
    cnt+=1

  if done[now-1]==3:
    break
  
  stack.append(now)
  now=A[now-1]

ans=K%cnt
print(stack[ans])

Fixed submission:
N,K=[int(x) for x in input().rstrip().split()]
A=[int(x) for x in input().rstrip().split()]

stack=[]
done=[0 for i in range(2*(10**5))]
done[0]=0
now=0
dou=[]

while(done[now]<2):
  
  if done[now]==0:
    stack.append(now)
  else:
    dou.append(now)
  done[now]+=1
  now=A[now]-1

if K<len(stack):
  print(stack[K]+1)
else:
  print(dou[(K-len(stack)-len(dou))%len(dou)]+1)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,N=[int(x) for x in input().rstrip().split()]
ans=0
now=0
aa=0

cnt=0
while(True):
  if 0<int(cnt/B):
    break
  else:
    cnt+=1
cnt=cnt-1

if N<B:
  print(int(A*N/B)-A*int(N/B))
else:
  print(int(A*cnt/B)-A*int(cnt/B))


Fixed submission:
A,B,N=[int(x) for x in input().rstrip().split()]
ans=0
now=0
aa=0

cnt=0

if N<B:
  print(int(A*N/B)-A*int(N/B))
else:
  print(int(A*(B-1)/B)-A*int((B-1)/B))

Buggy python submission (verdict: Time Limit Exceeded):
A,B,N=[int(x) for x in input().rstrip().split()]
ans=0
now=0
aa=0
for i in range(N+1):
  now=int(A*i/B)-A*int(i/B)
  if ans<now:
    aa=i
    ans=now
print(ans)


Fixed submission:
A,B,N=[int(x) for x in input().rstrip().split()]
ans=0
now=0
aa=0

cnt=0

if N<B:
  print(int(A*N/B)-A*int(N/B))
else:
  print(int(A*(B-1)/B)-A*int((B-1)/B))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=[int(x) for x in input().rstrip().split()]
for i in range(1,N+1):
  print(A.count(i))

Fixed submission:
N=int(input())
A=[int(x) for x in input().rstrip().split()]
ans=[0 for i in range(N)]

for i in A:
  ans[i-1]+=1

for i in ans:
  print(i)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
ans=S.count("R")*S.count("G")*S.count("B")
 
for i in range(N):
  for j in range(i+1,N):
    for k in range(j+1,N):
      if j-i==k-j and S[j]!=S[i] and S[j]!=S[k] and S[k]!=S[i]:
        ans-=1
        
print(ans)

Fixed submission:
N=int(input())
S=input()
ans=S.count("R")*S.count("G")*S.count("B")

for i in range(N):
  for j in range(i+1,N):
    k=j+(j-i)
    if k<=N-1:
      if S[j]!=S[i] and S[j]!=S[k] and S[k]!=S[i]:
          ans-=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
R=S.count("R")
G=S.count("G")

ans=R*G*(N-(R+G))

for i in range(N):
  for j in range(i+1,N):
    k=j+(j-i)
    if k<=N-1:
      if S[j]!=S[i] and S[j]!=S[k] and S[k]!=S[i]:
          ans-=1
print(ans)

Fixed submission:
N=int(input())
S=input()
ans=S.count("R")*S.count("G")*S.count("B")

for i in range(N):
  for j in range(i+1,N):
    k=j+(j-i)
    if k<=N-1:
      if S[j]!=S[i] and S[j]!=S[k] and S[k]!=S[i]:
          ans-=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
ans=S.count("R")*S.count("G")*S.count("B")

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

Fixed submission:
N=int(input())
S=input()
ans=S.count("R")*S.count("G")*S.count("B")

for i in range(N):
  for j in range(i+1,N):
    k=j+(j-i)
    if k<=N-1:
      if S[j]!=S[i] and S[j]!=S[k] and S[k]!=S[i]:
          ans-=1
print(ans)
Buggy python submission (verdict: Runtime Error):
import math
n,a,b = [int(x) for x in input().rstrip().split()]
n1=1
st=1
ans=0
for i in range(1,n+1):
    n1=n1*(n-i+1)
    st=st*i
    if i==a or i==b:
        continue
    else:
        ans+=(n1//st)%(10**9+7)
 
print(ans)

Fixed submission:
N,R = [int(x) for x in input().rstrip().split()]
if N<10:
    print(R+100*(10-N))
else:
    print(R)

Buggy python submission (verdict: Runtime Error):
import math
n,a,b = [int(x) for x in input().rstrip().split()]
l=[]
n1=1
st=1
ans=0
for i in range(1,n+1):
    n1=n1*(n-i+1)
    st=st*i
    ans1 = (n1//st)
    if i==a or i==b:
        l.append(n1//st)
        continue
    else:
        if n<(i/2):
            ans+=l[n-i]
        else:
            ans+=ans1
            l.append(ans1)

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

Fixed submission:
N,R = [int(x) for x in input().rstrip().split()]
if N<10:
    print(R+100*(10-N))
else:
    print(R)
Buggy python submission (verdict: Runtime Error):
N=int(input())
l=[int(x) for x in input().rstrip().split()]

for i in l:
  if i%2==0:
    if (i%5==0 or i%3==0):
      flag=1
    else:
      flag=0
      break
if flag==1:
  print("APPROVED")
else:
  print("DENIED")
    

Fixed submission:
n=int(input())
l=[int(x) for x in input().rstrip().split() if int(x)%2==0]

cnt = 0
for i in l:
    if i%3 == 0 or i%5==0:
        cnt += 1
    else:
        break

if cnt == len(l):
    print("APPROVED")
else:
    print("DENIED")
Buggy python submission (verdict: Runtime Error):
l=[int(x) for x in input().rstrip().split()]
l.sort(reverse = True)

ans=0

del l[0:a]
ans = a
print(sum(l))

Fixed submission:
h,a = [int(x) for x in input().rstrip().split()]
l=[int(x) for x in input().rstrip().split()]
l.sort(reverse = True)

ans=0

del l[0:a]
ans = a
print(sum(l))
Buggy python submission (verdict: Runtime Error):

import math

A,B=[int(x) for x in input().rstrip().split()]

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

Fixed submission:
a,b=[int(x) for x in input().rstrip().split()]

def gcd(m,n):
    x=max(m,n)
    y=min(m,n)

    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z
def lcm(m,n):
    return int(m*n/gcd(m,n))
print(lcm(a,b))

Buggy python submission (verdict: Runtime Error):

import fractions

A,B=[int(x) for x in input().rstrip().split()]

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

Fixed submission:
a,b=[int(x) for x in input().rstrip().split()]

def gcd(m,n):
    x=max(m,n)
    y=min(m,n)

    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z
def lcm(m,n):
    return int(m*n/gcd(m,n))
print(lcm(a,b))

Buggy python submission (verdict: Runtime Error):

from math import gcd
A,B=[int(x) for x in input().rstrip().split()]

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

Fixed submission:
a,b=[int(x) for x in input().rstrip().split()]

def gcd(m,n):
    x=max(m,n)
    y=min(m,n)

    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z
def lcm(m,n):
    return int(m*n/gcd(m,n))
print(lcm(a,b))

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

a,b=[int(x) for x in input().rstrip().split()]
print(int(a * b / math.gcd(a, b)))

Fixed submission:
a,b=[int(x) for x in input().rstrip().split()]

def gcd(m,n):
    x=max(m,n)
    y=min(m,n)

    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z
def lcm(m,n):
    return int(m*n/gcd(m,n))
print(lcm(a,b))

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

a,b=[int(x) for x in input().rstrip().split()]
print(int(a * b / math.gcd(a, b)))

Fixed submission:
a,b=[int(x) for x in input().rstrip().split()]

def gcd(m,n):
    x=max(m,n)
    y=min(m,n)

    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z
def lcm(m,n):
    return int(m*n/gcd(m,n))
print(lcm(a,b))
Buggy python submission (verdict: Runtime Error):
k=int(input())
l=[int(x) for x in input().rstrip().split()]
a=[]
 
for i in l:
    for j in l:
        if i<j:
            a.append([i,j])
 
A_1=0
A_2=0
SUM=0
ans=""
ANS=[]
for i in range(len(a)):
    A_1=format(a[i][0],'b')
    A_2=format(a[i][1],'b')
    if len(A_1)<len(A_2):
        A_1='0'*(len(A_2)-len(A_1))+A_1
    elif len(A_2)<len(A_1):
        A_2='0'*(len(A_1)-len(A_2))+A_2
 
 
    for j in range(len(A_1)):
        if A_1[j]==A_2[j]:
            ans=ans+'0'
        else:
            ans=ans+'1'
    ANS.append(ans)
    SUM+=int(ans,2)
    ans=''
SUM=SUM%(10**9+7)
print(SUM)

Fixed submission:
a=[int(x) for x in input().rstrip().split()]
if 22<=sum(a):
    print("bust")
else:
    print("win")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=[str(i) for i in input()]
l=[]
for i in range(10):
  for j in range(10):
    for k in range(10):
      l.append(str(i)+str(j)+str(k))

ans=0
for i in range(len(l)):
  now=l[i]
  j=0
  s=0
  while(True):
    if S[s]==now[j]:
      s+=1
      j+=1
    else:
      s+=1

    if j==3:
      ans+=1
      break

    if N<=s:
      break
      
print(ans)

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

for i in range(10):
  x=S.find(str(i),0)
  if x!=-1:
    for j in range(10):
      y=S.find(str(j),x+1)
      if y!=-1:
        for k in range(10):
          z=S.find(str(k),y+1)
          if z!=-1:
            ans+=1

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=[str(i) for i in input()]
l=[]
for i in range(10):
  for j in range(10):
    for k in range(10):
      l.append(str(i)+str(j)+str(k))

ans=0
for i in range(len(l)):
  now=l[i]
  j=0
  for s in range(N):
    if S[s]==now[j]:
      j+=1

    if j==3:
      ans+=1
      break
print(ans)

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

for i in range(10):
  x=S.find(str(i),0)
  if x!=-1:
    for j in range(10):
      y=S.find(str(j),x+1)
      if y!=-1:
        for k in range(10):
          z=S.find(str(k),y+1)
          if z!=-1:
            ans+=1

print(ans)