Problem:


Score : 300 points

Problem Statement

Takahashi is organizing a party.

At the party, each guest will receive one or more snack pieces.

Takahashi predicts that the number of guests at this party will be A or B.

Find the minimum number of pieces that can be evenly distributed to the guests in both of the cases predicted.

We assume that a piece cannot be divided and distributed to multiple guests.

Constraints

1 \leq A, B \leq 10^5

A \neq B

All values in input are integers.

Input

Input is given from Standard Input in the following format:

A B

Output

Print the minimum number of pieces that can be evenly distributed to the guests in both of the cases with A guests and B guests.

Sample Input 1

2 3

Sample Output 1

6

When we have six snack pieces, each guest can take three pieces if we have two guests, and each guest can take two if we have three guests.

Sample Input 2

123 456

Sample Output 2

18696

Sample Input 3

100000 99999

Sample Output 3

9999900000



Sample input:
2 3


Sample output:
6

Submission status: Accepted

Solution code:
import fractions
s,t = map(int,input().split())
d = s*t // fractions.gcd(s, t)
print(d)

Submission status: Accepted

Solution code:
import math
A, B = map(int, input().split())



def func(a, b):
#     print(a, b)
    if a < b:
        return func(b, a)
    if a % b == 0:
        return b
    else:
        return func(b, a % b)

# print(func(4, 6))
print(A*B//func(A,B))

Submission status: Accepted

Solution code:
import fractions
A,B = map(int,raw_input().split())
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

print (lcm(A, B))

Submission status: Accepted

Solution code:
def gcd(a, b):
    if a < b:
        a, b = b, a
    while b != 0:
        a, b = b, a % b
    return a


a, b = map(int, input().split())
print(a * b // gcd(a, b))

Submission status: Accepted

Solution code:
def gcd(a,b):
    if a==0:
        return b
    else:
        return gcd(b%a,a)
#x=int(input())
a,b=map(int,input().split())
c=gcd(a,b)
print((a*b)//c)

Submission status: Accepted

Solution code:
a,b =list(map(int,input().split()))
def gcd(x,y):
	if max(x,y)%min(x,y)==0:return min(x,y)
	else:return  gcd(min(x,y),max(x,y)%min(x,y))
print(a*b//gcd(a,b))

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

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

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

print(lcm(a, b))

Submission status: Accepted

Solution code:
import fractions
a,b=map(int,input().split())
S=a*b//fractions.gcd(a,b)
print(S)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

from fractions import gcd

c,d = [int(i) for i in readline().split()]

print(c*d//gcd(c,d))

Submission status: Accepted

Solution code:
def gcd(a,b):
    if(a==0):
        return b
    return gcd(b%a,a)


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

Submission status: Accepted

Solution code:
from fractions import gcd

a, b = map(int, input().split())
print(int((a*b)/gcd(a,b)))

Submission status: Accepted

Solution code:
A,B = input().split()
A=int(A)
B =int(B)
if A<B:
  for i in range(1,B+1):
    if A*i%B ==0:
      print(A*i)
      break
else:
  for i in range(1,A+1):
    if B*i%A ==0:
      print(B*i)
      break

Submission status: Accepted

Solution code:
from fractions import gcd
a,b = map(int,raw_input().split())
print a*b/gcd(a,b)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
li = []
for i in range(1, 10**5+1):
  if a%i==0 and b%i==0:
    li.append(i)
print(int((a*b)/li[-1]))

Submission status: Accepted

Solution code:
import fractions
import collections
import itertools
import sys
import bisect
from heapq import heappop,heappush,heapify
sys.setrecursionlimit(10**6)
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

a,b = MAP()

print(a*b//fractions.gcd(a,b))

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
input = sys.stdin.readline

# code here
a, b = sorted(map(int, input().strip().split()))
c = 1
while True:
    d, r = divmod(b * c, a)

    if r == 0:
        print(b * c)
        break
    else:
        c += 1

Submission status: Accepted

Solution code:
from fractions import gcd;a,b = map(int,input().split());print(int(a*b/gcd(a,b)))

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin
ns = lambda: stdin.readline().rstrip()
na = lambda: list(map(int, stdin.readline().split()))
ni = lambda: int(ns())

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


(a,b)=na()

print(a // gcd(a,b) * b)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


def main():
    A, B = [int(_) for _ in input().split()]

    product = A * B
    for divisor in range(min([A, B]) // 2, 2, -1):
        if A % divisor == 0 and B % divisor == 0:
            A = A // divisor
            B = B // divisor
            product = product // divisor

    print(product)


def correct_1():
    A, B = [int(_) for _ in input().split()]

    for i in range(1, B + 1):
        if A * i % B == 0:
            print(A * i)
            break


def correct_2():
    A, B = [int(_) for _ in input().split()]

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

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

    print(lcm(A, B))


if __name__ == "__main__":
    correct_1()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


def main():
    A, B = [int(_) for _ in input().split()]

    product = A * B
    for divisor in range(min([A, B]) // 2, 2, -1):
        if A % divisor == 0 and B % divisor == 0:
            A = A // divisor
            B = B // divisor
            product = product // divisor

    print(product)


def correct_1():
    A, B = [int(_) for _ in input().split()]

    for i in range(1, B + 1):
        if A * i % B == 0:
            print(A * i)
            break


def correct_2():
    A, B = [int(_) for _ in input().split()]

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

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

    print(lcm(A, B))


if __name__ == "__main__":
    correct_2()

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in sys.stdin.readline().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v

def comb(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

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    A, B = list(map(int, input().split()))
    print(lcm(A, B))


main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
a,b = map(int,input().split())

def gcd(a,b):
    x = max(a,b)
    y = min(a,b)
    if x % y == 0:
        return y
    else:
        while True:
            if x % y != 0:
                z = x % y
                x = y
                y = z
            else:
                break
        return z


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

ans = lcm(a,b)
print(ans)

Submission status: Accepted

Solution code:
import fractions

def solve():
    a, b = map(int, input().split())
    ans = a * b / fractions.gcd(a, b)
    print(int(ans))

if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:
a,b=map(int,input().split())

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

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

print(lcm(a,b))

Submission status: Accepted

Solution code:
a,b = map(int,input().split())
if b%a == 0:
    print(max(a,b))
else:
    x = a
    y = 0
    while x!=y:
        y = y+b
        while x < y:
            x = x+a
    print(x)

Submission status: Accepted

Solution code:
a,b=map(int,input().split())

def gcd(x,y):
	return x if y==0 else gcd(y,x%y)

print(a*b//gcd(a,b))

Submission status: Accepted

Solution code:
def gcd(x,y):
  a = max(x,y)
  b = min(x,y)
  if a%b==0:
    return b
  else:
    while a%b!=0:
      c = a%b
      a = b
      b = c
    else:
      return c

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

k,l = list(map(int, input().split()))
print(lcm(k,l))

Submission status: Accepted

Solution code:
#LCM 出せばいい？
a, b = [ int(_) for _ in input().split() ]

for i in range(1, b+1):
  if a*i % b == 0:
    lcm = i
    break
    
print(a*i)

Submission status: Accepted

Solution code:
from fractions import*
a,b=map(int,input().split())
print(a*b//gcd(a,b))

Submission status: Accepted

Solution code:
import fractions

a, b = map(int, input().split())
c = fractions.gcd(a, b)
print(a*b//c)

Submission status: Accepted

Solution code:
from fractions import gcd
A,B = map(int,input().split())
g = gcd(A,B)
print(A*B//g)

Submission status: Accepted

Solution code:
import fractions

A, B = map(int, input().split())
print(A * B // fractions.gcd(A, B))

Submission status: Accepted

Solution code:
import fractions
a,b=map(int, input().split())
print((a*b)//fractions.gcd(a,b))

Submission status: Accepted

Solution code:
from sys import stdin
import fractions





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

f=fractions.gcd(a,b)
f2=a*b//f
print(f2)

Submission status: Accepted

Solution code:

def gcd(m, n):
    while(m % n != 0):
        tmp = n
        n = m % n
        m = tmp
    return n

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

print(int(a * b/ gcd(a, b)))

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

gcd = -1
for i in range(max(a,b), 0, -1):
    if a % i == 0 and b % i == 0:
        gcd = i
        break

print(a*b//gcd)

Submission status: Accepted

Solution code:
from fractions import gcd
a, b = map(int, input().split())
g = gcd(a, b)
print(a * b // g)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a
def lcm(a, b):
    return a * b // gcd(a, b)
print(lcm(a, b))

Submission status: Accepted

Solution code:
import fractions

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

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

print(lcm(A, B))

Submission status: Accepted

Solution code:
import fractions
a, b = map(int,input().split())
print(a * b //fractions.gcd(a, b))

Submission status: Accepted

Solution code:
import fractions
a = list(map(int, input().split()))
print(a[0]*a[1] // fractions.gcd(a[0], a[1]))

Submission status: Accepted

Solution code:
import fractions

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

print(a*b//fractions.gcd(a,b))

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
"""a,bの最大公約数"""
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a

"""a,bの最小公倍数"""
def lcm(a,b):
    return a*b//gcd(a,b)
print(lcm(a,b))

Submission status: Accepted

Solution code:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

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

fb = factorization(B)

ans = A
for b, n in fb:
  c = 0
  for i in range(1, n+1):
    if ans % (b**i) == 0:
      c = i
    else:
      break
    
  ans *= (b**(n-c))
  
  
print(ans)

Submission status: Accepted

Solution code:
guests = raw_input().split()
max = int(max(guests))
min = int(min(guests))
snack = 1
while (max * snack) % min != 0:
  snack = snack + 1
print max * snack

Submission status: Accepted

Solution code:
A,B=map(int,input().split())

def gcd(a,b):
  if b>a:
    a,b=b,a
  while a%b!=0:
    a,b=b,a%b
  return b

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

print(lcd(A,B))

Submission status: Accepted

Solution code:
from fractions import gcd

A, B = map(int, input().split())
g = gcd(A, B)
print(A * B // g)

Submission status: Accepted

Solution code:
A, B  = map(int, input().split())

X = A * B

if A < B:
    tmp = A
    A = B
    B = tmp

R = A % B
while R!=0:
    A = B
    B = R
    R = A % B

print(X//B)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
m,n=max(a,b),min(a,b)
for i in range(1,m+1):
    k,l=max(n*i,m),min(n*i,m)
    if k%l==0:
        print(k)
        break

Submission status: Accepted

Solution code:
#c
a, b = map(int ,input().split())
from fractions import gcd
print(a*b//gcd(a, b))

Submission status: Accepted

Solution code:
def gcd(x, y):
    for i in range(min(x, y), 1, -1):
        if x % i == 0 and y % i == 0:
            return i


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


i = list(map(int, input().split()))
g = gcd(i[0],i[1])
if g != None:
    print(int(lcm(i[0],i[1])))
else :
    print(i[0] * i[1])

Submission status: Accepted

Solution code:
import fractions
A,B=map(int,input().split())
a=fractions.gcd(A,B)
print((A * B) // a)

Submission status: Accepted

Solution code:
import fractions
n,m = map(int,input().split())
print(n*m//fractions.gcd(n,m))

Submission status: Accepted

Solution code:
def gcd(a, b):
	if a < b:
		a, b = b, a
	while b != 0:
		a, b = b, a % b
	return(a)

x, y = [int(a) for a in input().split()]

print(int(x*y / gcd(x, y)))

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

a, b = A, B
while b > 0:
    a, b = b, a % b

print(A * B // a)

Submission status: Accepted

Solution code:
import fractions 

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

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

Submission status: Accepted

Solution code:
def gcd(a,b):
  if b==0:
    return a
  else:
    return gcd(b,a%b)
a,b=map(int,input().split())
if a<b:
  a,b=b,a
print(a*b//gcd(a,b))

Submission status: Accepted

Solution code:
import fractions
a,b = [int(i) for i in input().split()]
print( a * b // fractions.gcd(a,b))

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
a, b = A, B
while b != 0:
  a, b = b, a % b
l, m = A // a, B // a
print(a * l * m)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10000000)
INF = 1<<32

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

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

def solve(A: int, B: int):
    print(lcm(A,B))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n,m =map(int,input().split())
n2=max(n,m)
m2=min(n,m)
while m2!=0:
    tmp=n2
    n2=m2
    m2=tmp%m2
print(int(n*m/n2))

Submission status: Accepted

Solution code:
from fractions import gcd
A,B = map(int,input().split())
print((A*B) // gcd(A,B))

Submission status: Accepted

Solution code:
a,b=map(int,input().split())
aa=a
bb=b

if a<b:
    c=a
    a=b
    b=c

while b>0:
    c=a
    a=b
    b=c%b

print(aa*bb//a)

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
if A<B:
    for k in range(1,A+1):
        if (B*k)%A==0:
            print(B*k)
            break
else:
    for k in range(1,B+1):
        if (A*k)%B==0:
            print(A*k)
            break

Submission status: Accepted

Solution code:
import fractions

a,b = [int(i) for i in input().split()]

print( a * b // fractions.gcd(a,b))

Submission status: Accepted

Solution code:
import fractions
A, B = map(int, input().split())

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

print(lcm(A, B))

Submission status: Accepted

Solution code:
A, B = map(int, input().split())

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
  
def lcm(a, b):
    return a * b // gcd (a, b)
  
  
print(lcm(A, B))

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
C = A * B
      
    
for i in range(1, 10**5):
    if (A * i) % B == 0:
        print(A * i)
        break

Submission status: Accepted

Solution code:
def gcd(a, b) : 
    if b == 0 : 
    	return a 
    else : 
    	return gcd(b, a%b) 

def lcm(a, b) :
	return a * b // gcd(a,b)
  
a, b = map(int, input().split())
print(lcm(a,b))

Submission status: Accepted

Solution code:
S = input().split()
A = int(S[0])
B = int(S[1])
C = 0
D = 0



for i in range(1,100000,1):
  if A > B:
  	C = A * i
  else:
    C = B *i
  
  if A > B:
  	D = B
  else:
    D = A
    
  if C % D == 0:
    print(C)
    break

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys


def solve(A: int, B: int):
    def lcm(x, y):
        return (x * y) // gcd(x, y)

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

    print(lcm(A,B))
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    solve(A, B)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
def gcd(A,B):
    while B!=0:
        A,B=B,A%B
    return A
print(int(A*B/gcd(A,B)))

Submission status: Accepted

Solution code:
A,B = map(int,input().split())

p = 1


if A > B:
    for y in range(100000000):
        e = (A * p) % B
        o = (A * p)
        if e == 0:
            print(int(o))
            break
        else:
            p += 1
else:
    for r in range(100000000):
        e = (B * p) % A
        o = (B * p)
        if  e == 0:
            print(int(o))
            break
        else:
            p += 1

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)
print(lcm(a,b))

Submission status: Accepted

Solution code:
def lcm(a, b):
    old_old_a = a
    old_old_b = b
    while b != 0:
        old_a = a
        a = b
        old_b = b
        b = old_a % b
    g = old_b
    return old_old_a / g * old_old_b


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

Submission status: Accepted

Solution code:
A,B=map(int,input().split())
C=1
D=A
E=B
if A<=B:
    if B%A==0:
        print(B)
    else:
        for k in range(2,int(B**(1/2)+2)):
            if A%k==0 and B%k==0:
                A=A/k
                B=B/k
                C=int(A*E)
                while True:
                    if A%k==0 and B%k==0:
                        A=A/k
                        B=B/k
                        C=int(A*E)
                    else:
                        break
        if C==1:
            C=int(A*B)
        print(C)
else:
    if A%B==0:
        print(A)
    else:
        for k in range(2,int(A**(1/2)+2)):
            if A%k==0 and B%k==0:
                A=A/k
                B=B/k
                C=int(D*B)
                while True:
                    if A%k==0 and B%k==0:
                        A=A/k
                        B=B/k
                        C=int(D*B)
                    else:
                        break
        if C==1:
            C=int(A*B)
        print(C)

Submission status: Accepted

Solution code:
import fractions
a,b= map(int,input().split())

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

print(lcm(a, b))

Submission status: Accepted

Solution code:
def gcd(a, b):
    return b if a == 0 else gcd(b%a, a)
num = [int(x) for x in input().split(" ")]
print(int(num[0]*num[1]/gcd(num[0], num[1])))

Submission status: Accepted

Solution code:
A, B = map(int, input().split())
maxim = max(A, B)
mini = min(A, B)
l = maxim
for i in range(0, 10**5):
  if l % mini == 0:
    print(l)
    break
  else:
    l += maxim

Submission status: Accepted

Solution code:
import fractions
A,B = input().split()
 
lcm = int(A) * int(B)/ fractions.gcd(int(A),int(B))
print(int(lcm))

Submission status: Accepted

Solution code:
from fractions import gcd
A,B=map(int,input().split())
x=(A*B)//(gcd(A,B))

print(x)

Submission status: Accepted

Solution code:

def gcd(m, n):
    x = max(m, n)
    y = min(m, n)
    if 0==x%y:
        return y
    else:
        while not 0==x%y:
            z = x%y
            x = y
            y = z
        return z

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

A, B = [int(i) for i in input().split(" ")]

print(lcm(A, B))

Submission status: Accepted

Solution code:
from fractions import gcd
import math
def lcm(x, y):
    return (x * y) // gcd(x, y)

x,y = map(int,input().split())
print(lcm(x,y))

Submission status: Accepted

Solution code:
joukyuukokuminndomo=input().split(' ')
joukyuukokuminn2=int(joukyuukokuminndomo[0])
simojimo2=int(joukyuukokuminndomo[1])
joukyuukokuminn=joukyuukokuminn2
simojimo=simojimo2

while joukyuukokuminn%simojimo!=0:
  if joukyuukokuminn>simojimo:
    joukyuukokuminn=joukyuukokuminn-simojimo
  elif joukyuukokuminn<simojimo:
    simojimo=simojimo-joukyuukokuminn

if joukyuukokuminn>=simojimo:
  print(int(joukyuukokuminn2*simojimo2/simojimo))
elif joukyuukokuminn<simojimo:
  print(int(joukyuukokuminn2*simojimo2/joukyuukokuminn))

Submission status: Accepted

Solution code:
def gcd(a,b):
  if(a==0):
    return b
  return gcd(b%a,a)
def lcm(a,b):
  return int((a*b)/gcd(a,b))
a,b=(int(i) for i in input().split())
print(lcm(max(a,b),min(a,b)))

Submission status: Accepted

Solution code:
import fractions

a = list(map(int , input().split()))
A = a[0]
B = a[1]

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

print(int(lcm(A, B)))

Submission status: Accepted

Solution code:
from fractions import gcd
a,b = list(map(int,input().split()))

print((a * b) // gcd(a, b))

Submission status: Accepted

Solution code:
N,S = map(int, input().split())
tmp = 1
a = 1
while True:
  if N // 2 < a and S // 2 < a:
    break
  if N % a == 0 and S % a == 0:
    N,S = N // a, S // a
    tmp *= a
    a = 1
  a += 1

print(tmp * S * N)

Submission status: Accepted

Solution code:
import fractions
a=input().split()
A=int(a[0])
B=int(a[1])
def lcm(x,y):
  return(x*y)//fractions.gcd(x,y)
print(lcm(A,B))

Submission status: Accepted

Solution code:
a,b = input().split()
a = int(a)
b = int(b)

def gcd(x,y):
  r = 1
  while r!=0:
    #x = max(x,y)
    #y = min(x,y)
    r = x % y
    x=y
    y=r
  return (x)

print (int(a*b/gcd(max(a,b),min(a,b))))

Submission status: Accepted

Solution code:
import math
a ,b = map(int,input().split())

def gcd(a,b):
    while b!=0:
        a,b=b,a%b
    return a
ans = a * b / gcd(a,b)
print(int(ans))

Submission status: Accepted

Solution code:

value = input().split()
value_1 = [int(n) for n in value]

sea = value_1[0]
mou = value_1[1]

while sea != mou:
    if sea<mou:
        sea = sea+value_1[0]
    else:
        mou = mou+value_1[1]

print(sea)

Submission status: Accepted

Solution code:
import fractions


def main():
    A, B = map(int, input().split())

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
a, b = [int(i) for i in input().split()]
m = min(a, b)
for i in range(m, 0, -1):
    if a%i == 0 and b%i ==0:
        break
print(int(a * b/i))

Submission status: Accepted

Solution code:
def gcd(x, y):
# choose the smaller number
    if x > y:
        smaller = y
    else:
        smaller = x
    for i in range(1, smaller+1):
        if((x % i == 0) and (y % i == 0)):
            hcf = i 
    return hcf
a,b=input().strip().split(" ")
a,b=[int(a),int(b)]
c=gcd(a,b)
d=a*b
ans=d//c
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
	
def lcm(x, y):
    return (x * y) // gcd(x, y)

print(lcm(a, b))

Submission status: Accepted

Solution code:
import fractions

if __name__ == "__main__":
    A, B = input().split()
    A = int(A)
    B = int(B)
    ret = (A * B) // fractions.gcd(A, B)
    print(ret)

Submission status: Accepted

Solution code:
# Python program to find LCM of two numbers 

# Recursive function to return gcd of a and b 
def gcd(a,b): 
	if a == 0: 
		return b 
	return gcd(b % a, a) 

# Function to return LCM of two numbers 
def lcm(a,b): 
	return (a*b) / gcd(a,b) 

# Driver program to test above function 
l=list(map(int, input().strip().split(' ')))
a = l[0]
b = l[1]
print(int(lcm(a, b))) 

# This code is contributed by Danish Raza

Submission status: Accepted

Solution code:
num_list = input().split() 

number=0

for i in range(1,1000000):
  if (int(num_list[0]) * i) % int(num_list[1]) == 0:
    number = int(num_list[0]) * i
    break

print(number)

Submission status: Accepted

Solution code:
import fractions
A, B = map(int, input().split())
F = fractions.gcd(A, B)
F2 = A * B // F
print(F2)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

i = 1
while(True):
    c = a * i
    if c % b == 0:
        break
    
    i += 1
    
print(c)

Submission status: Accepted

Solution code:
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))

AB=list(map(int, input().split()))

print(lcm(AB[0],AB[1]))

Submission status: Accepted

Solution code:
A,B = (int(x) for x in input().split())
if A%2==0:
  a=A//2
else:
  a=(A+1)//2  

d=1
s=0
d=int(d)
for i in range(a): 
  if A%d==0 and B%d==0:
    s=d
  d+=1
if s==1 :
  print(int(A*B))
elif B%A==0:
  print(B)
elif A%B==0:
  print(A)

else:
  print(int(A*(B/s)))

Submission status: Accepted

Solution code:
a = list(map(int,input().split()))
b = max(a)

for i in range(b, 10**10, b):
  if i % min(a) == 0:
    print(i)
    break

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
gcd = 0

x = max(a, b)
y = min(a, b)
if x % y == 0:
    gcd = y
else:
    while x % y != 0:
        z = x % y
        x = y
        y = z
    gcd = z

ans = a * b / gcd

print(int(ans))

Submission status: Accepted

Solution code:
from fractions import gcd
X = input().split(" ")
A = int(X[0])
B = int(X[1])
C = A * B
D = gcd(A,B)
print(C // D)

Submission status: Accepted

Solution code:
a ,b = list(map(int,input().split()))

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
apri = prime_factorize(a)
bpri = prime_factorize(b)
ans_lis = []
for i in range(len(apri)):
    if bpri.count(apri[i]) > 0:
        bpri.remove(apri[i])
    ans_lis.append(apri[i])
ans_lis.extend(bpri)
ans = 1
for i in range(len(ans_lis)):
    ans = ans * ans_lis[i]
print(ans)

Submission status: Accepted

Solution code:
a, b = map(int, input().split())

l = a if a<b else b
x = a*b

for i in range(l, 0, -1):
    if a%i == 0 and b%i == 0:
        print(int(x / i))
        exit()

Submission status: Accepted

Solution code:
from fractions import gcd
a,b=map(int,input().split())
ans=(a*b)//gcd(a,b)
print(ans)

Submission status: Accepted

Solution code:
def gcd(a, b):
    if a > b:
        a, b = (b, a)
    while b:
        a, b = b, a % b
    return a


def main():
    a, b = map(int, input().split())
    ans = round(a * b / gcd(a, b))
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import fractions

a, b = map(int, input().split())
print(a * b // fractions.gcd(a, b))

Submission status: Accepted

Solution code:
A, B=map(int, input().split())

import fractions
gcd=fractions.gcd(A, B)
lcm=A*B//gcd
print(lcm)

Submission status: Accepted

Solution code:
def gcd(a,b): 
    if a == 0: 
        return b 
    return gcd(b % a, a) 

def lcm(a,b): 
    return (a*b) / gcd(a,b) 
a,b = list(map(int,input().split()))
print(int(lcm(a,b)))

Submission status: Accepted

Solution code:
import math
import fractions
A, B = map(int, input().split())
print(A * B // fractions.gcd(A, B))

Submission status: Accepted

Solution code:
# import math
import fractions

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


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


print(lcm(a, b))

Submission status: Accepted

Solution code:
a, b = map(int, input().split())
c = 1

for i in range(2, a):
  while a % i ==0:
    if b % i ==0:
      c = c*i
      a = a/i
      b = b/i
    else:
      c = c*i
      a = a/i

c = int(a*b*c)
print(c)

Submission status: Accepted

Solution code:
# coding: utf-8

import fractions

a,b = map(int,input().split())
print((a * b) // fractions.gcd(a, b))

Submission status: Accepted

Solution code:
A , B = map( int , input().split() )

import fractions

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

Submission status: Accepted

Solution code:
l =input().split()

a=int(l[0])
b=int(l[1])

# 最大公約数
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a

# 最小公倍数
def lcm(a, b):
  return a*b/gcd(a, b)

print(int(lcm(a,b)))

Submission status: Accepted

Solution code:
import fractions
a, b = list(map(int,input().split()))

f=fractions.gcd(a,b)
f2=a*b//f
print(f2)

Submission status: Accepted

Solution code:
import math
from fractions import gcd

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

(a, b) = [int(e) for e in input().split(" ")[:2]]
print(int(lcm(a, b)))