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: Runtime Error

Solution code:
import operator
import functools

import math


A, B = input().split()

A = int(A)
B = int(B)


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

print(lcm(A, B))

Submission status: Runtime Error

Solution code:
import operator
import functools

import math


A, B = input().split()

A = int(A)
B = int(B)

"""

value = []

count = 0

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

primeA = prime_factorize(A)

primeB = prime_factorize(B)

if len(primeA) < len(primeB):
    for i in range(len(primeA)):
        for j in range(len(primeB)):
            if primeA[i] == primeB[j]:
                value.append(primeA[i])
                primeA[i] = 1
                primeB[j] = 1
                print(primeA)
                print(primeB)
                break
            else:
                continue

else:
    for i in range(len(primeB)):
        for j in range(len(primeA)):
            if primeB[i] == primeA[j]:
                value.append(primeB[i])
                primeA[j] = 1
                primeB[i] = 1
                print(primeA)
                print(primeB)
                break
            else:
                continue

value = value + primeA + primeB

result = functools.reduce(operator.mul, value)

print(result)
"""

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

print(lcm(A, B))

Submission status: Runtime Error

Solution code:
A,B = (int(i) for i in input().split())

import math

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

print(lcm(A,B))

Submission status: Runtime Error

Solution code:
A,B = (int(i) for i in input().split())

import math

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


print(lcm(A,B))

Submission status: Runtime Error

Solution code:
A,B = (int(i) for i in input().split())

import math

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


print(lcm(A,B))

Submission status: Runtime Error

Solution code:
A,B = (int(i) for i in input().split())
import math
print(A * B // math.gcd (A, B))

Submission status: Runtime Error

Solution code:
A,B = (int(i) for i in input().split())

import math

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

print(lcm(A,B))

Submission status: Runtime Error

Solution code:
A,B = (int(i) for i in input().split())

import math

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

print(lcm(A,B))

Submission status: Runtime Error

Solution code:
A,B = (int(i) for i in input().split())

import math

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


print(lcm(A,B))

Submission status: Runtime Error

Solution code:
A,B = (int(i) for i in input().split())

import math

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


print(lcm(A,B))

Submission status: Runtime Error

Solution code:
A,B = (int(i) for i in input().split())

import math

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

print(lcm(A,B))

Submission status: Runtime Error

Solution code:
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
ll gcd(ll p,ll q)
{
  if(q==0) 
  return p;
  return gcd(q,p%q);
}
int main(){
 ll a,b,c;
  cin>>a>>b;
  ll c=gcd(a,b);
  ll d=(a*b)/c;
  cout<<d<<endl;
  
}

Submission status: Runtime Error

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

import math

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

Submission status: Runtime Error

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

import math

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

Submission status: Runtime Error

Solution code:
import math
def lcm(a,b):
    return (a * b) // math.gcd(a , b)

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

Submission status: Runtime Error

Solution code:
import math
def lcm(a,b):
    return (a * b) // math.gcd(a , b)

participant = list(map(int,input().split()))
A = participant[0]
B = participant[1]
if 1 <= A <= 10**5 and 1 <= B <= 10**5 and A != B:
    print(lcm(A,B))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def lcm(a,b):
    m = a*b
    while a != 0 and b != 0:
        if a > b:
            a %= b
        else:
            b %= a
    return m // (a+b)

print(lcm(int(input()), int(input())))

Submission status: Runtime Error

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: Runtime Error

Solution code:
def lcm(x, y):
    if x > y:
      greater = x
    else:
      greater = y
    while(True):
      if((greater % x == 0) and (greater % y == 0)):
        lcm = greater
        break
      greater += 1
    return lcm
n,m=mpa(int,input().split())
print(lcm(n,m))

Submission status: Runtime Error

Solution code:
import math
#N = int(input())
a,b= map(int,input().split())
#v =list(map(int,input().split()))
# [list(map(int,input().split())) for i in range(N)]

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

Submission status: Runtime Error

Solution code:
from math import gcd

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import math
A,B = (int(i) for i in input().split())
g = math.gcd(A,B)
print(A*B//g)

Submission status: Runtime Error

Solution code:
import math
A,B = (int(i) for i in input().split())
g = math.gcd(A,B)
print(A*B/g)

Submission status: Runtime Error

Solution code:
import math

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

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

Submission status: Runtime Error

Solution code:
import math

def main():
    a, b = map(int, input().split())

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

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import math


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


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


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
a,b = map(int, input())
ans = 1
while True:
    if (ans%a + ans%b) == 0:
        print(ans)
        break
    ans += 1

Submission status: Runtime Error

Solution code:
import math

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

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

Submission status: Runtime Error

Solution code:
import math

data = list(map(int, input().split()))
A, B = data[0], data[1]
g = math.gcd(A, B)
lcd = int(A*B/g)
print(lcd)

Submission status: Runtime Error

Solution code:
import math

data = list(map(int, input().split()))
A, B = data[0], data[1]
gcd = math.gcd(A, B)
lcd = A*B//gcd
print(lcd)

Submission status: Runtime Error

Solution code:
import math

data = list(map(int, input().split()))
A, B = data[0], data[1]
gcd = math.gcd(A, B)
print(A*B//gcd)

Submission status: Runtime Error

Solution code:
import math

data = list(map(int, input().split()))
A, B = data[0], data[1]
gcd = math.gcd(A, B)
print(int(A*B/gcd))

Submission status: Runtime Error

Solution code:
#https://note.nkmk.me/python-gcd-lcm/
#lcm(a, b) = a * b / gcd(a, b)
import math

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

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

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

Submission status: Runtime Error

Solution code:
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
A,B = map(int, input().split())
print(lcm(A, B))

Submission status: Runtime Error

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

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

print(lcm(a,b))

Submission status: Runtime Error

Solution code:
import math

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

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

print(lcm(a,b))

Submission status: Runtime Error

Solution code:
import math

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

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

print(lcm(a,b))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

gcd = math.gcd(a, b)

print(a*b//gcd)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
a,b=map(int,input().split())
print(gcd(a,b))

Submission status: Runtime Error

Solution code:
import math


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

print((A * B) // gcd)

Submission status: Runtime Error

Solution code:
import fractions

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

print((x * y) // fractions.gcd(x, y))

Submission status: Runtime Error

Solution code:
import math

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

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

print(lcm(A, B))

Submission status: Runtime Error

Solution code:
A, B = map(int,input().split))
def euclid(x,y):
  while(y != 0):
    x = y
  	y = x % y
    return y
print(euclid(A,B))

Submission status: Runtime Error

Solution code:
A, B = map(int,input().split))
snacks = 1
def larger(x, y):
  if x >= y:
    return x
  else:
    return y
arrayA = [0] * larger(A, B)
arrayB = [0] * larger(A, B)

for i in range(2, A):
  while ( A%i != 0):
    A = A/i
    arrayA[i] += 1
for i in range(2, B):
  while ( B%i != 0):
    B = B/i
    arrayB[i] += 1

#全部でかいほうをかける！
for i in range(larger(arrayA,arrayB)):
      snacks = snacks * (i ** larger(arrayA[i], arrayB[i]))
print(snacks)

Submission status: Runtime Error

Solution code:
A, B = map(int,input().split))
snacks = 1
arrayA = [0] * larger(A, B)
arrayB = [0] * larger(A, B)
def larger(x, y):
  if x >= y:
    return x
  else:
    return y
for i in range(2, A):
  while ( A%i != 0):
    A = A/i
    arrayA[i] += 1
for i in range(2, B):
  while ( B%i != 0):
    B = B/i
    arrayB[i] += 1

#全部でかいほうをかける！
for i in range(larger(arrayA,arrayB)):
      snacks = snacks * (i ** larger(arrayA[i], arrayB[i]))
print(snacks)

Submission status: Runtime Error

Solution code:
import math
A, B = [int(i) for i in input().split()]

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

print(func_ABC148(A, B))

Submission status: Runtime Error

Solution code:
from math import gcd
A, B = [int(i) for i in input().split()]

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

print(func_ABC148(A, B))

Submission status: Runtime Error

Solution code:
import math

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

Submission status: Runtime Error

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


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


print(lcm(a,b))

Submission status: Runtime Error

Solution code:
from math import ceil
from math import factorial
from collections import Counter
from operator import itemgetter
from math import gcd
import bisect
ii = lambda: int(input())
iia = lambda: list(map(int,input().split()))
isa = lambda: list(input().split())

a,b = iia()

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
from math import ceil
from math import factorial
from collections import Counter
from operator import itemgetter
from math import gcd
import bisect
ii = lambda: int(input())
iia = lambda: list(map(int,input().split()))
isa = lambda: list(input().split())

a,b = iia()

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
a=input().split()
print(math.lcm(int(a[0]), int(a[1])))

Submission status: Runtime Error

Solution code:
import math
a=input().split()
print(math.lcm(a[0], a[1]))

Submission status: Runtime Error

Solution code:
import math
a=input().split()
print(math.gcd(a[0], a[1]))

Submission status: Runtime Error

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

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

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

print(lcm(a,b))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
s = input()
s = s.split()
x, y = int(s[0]), int(s[1])
print((x * y) // math.gcd(x, y))

Submission status: Runtime Error

Solution code:
import math
s = input()
s = s.split()
x, y = int(s[0]), int(s[1])
print((x * y) // math.gcd(x, y))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
s = input()
s = s.split()
a, b = s[0], s[1]
print(lcm(a, b))

Submission status: Runtime Error

Solution code:
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
s = input()
s = s.split()
a, b = s[0],s[1]
print(lcm(a, b))

Submission status: Runtime Error

Solution code:
s = input()
s = s.split
x, y = s[0], s[1]
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

print(lcm(a, b))

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
if a>=b:
    c=a
    d=b
else:
    c=b
    d=a
for i in range(1,d+1):
    e=c*i
    if e%d==0:
        print(e)
        break
    else:
        continue

Submission status: Runtime Error

Solution code:
a=int(input())
b=int(input())
if a>=b:
	c=a
    d=b
else:
    c=b
    d=a
for i in range(1,d+1):
    e=c*i
    if e%d==0:
        print(e)
        break
    else:
        continue

Submission status: Runtime Error

Solution code:
def lmc(a,b):
  i = 1
  while(1):
    c = a*i
	if c % b == 0:
      return c
	i += 1

print("a= ",end="")
a= int(input())
print("b= ",end="")
b= int(input())
print(lmc(a,b))

Submission status: Runtime Error

Solution code:
def lmc(a,b):
	i = 1
	while(1):
		c = a*i
		if c % b == 0:
			return c
		i += 1

print("a= ",end="")
a= int(input())
print("b= ",end="")
b= int(input())
print(lmc(a,b))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
A, B= input().split(" ")
a = int(A)
b = int(B)
list = []
for x in range (1,a):
  if a%x == 0 and b%x == 0 : list.append(x)
maxDiv = max(list)
c = a/maxDiv
print(int(c*b))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
def cal_lcm(a, b):
     return a * b / math.gcd(a, b)
A, B = map(int, input().split())
C = cal_lcm(A, B)
print(int(C))

Submission status: Runtime Error

Solution code:
import math
nums=[int(i) for i in input().split()]
print(nums[0]*nums[1]//math.gcd(nums[0],nums[1]))

Submission status: Runtime Error

Solution code:
import math
nums=[int(i) for i in input().split()]
print(int(nums[0]*nums[1]/math.gcd(nums[0],nums[1])))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math

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

def main():

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

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import math

def lcm(a,b):
    print((a * b) // math.gcd(a,b))

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

lcm(a,b)

Submission status: Runtime Error

Solution code:
import math
A,B =[int(i) for i in input().split()]
result = (A*B) // math.gcd(A, B)
print(result)

Submission status: Runtime Error

Solution code:
import math

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

line = input()
arr =  [int(n) for n in line.split(' ')]

print(lcm(*arr))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import math
A = list(map(int, input().split()))
a = A[0]
b = A[1]

ans = a*b/math.gcd(a,b)
print(ans)

Submission status: Runtime Error

Solution code:
n = (input())
a = int(n.split(" ")[0])
b = int(n.split(" ")[1])
lcm = int((a * b / math.gcd(a, b)))
print(lcm)

Submission status: Runtime Error

Solution code:
import math

n = (input())
a = int(n.split(" ")[0])
b = int(n.split(" ")[1])
lcm = int((a * b / math.gcd(a, b)))
print(lcm)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(1,min(a,b)):
    if a%i==0 and b%i==0:
        ans=i

print(a*b//ans)

Submission status: Runtime Error

Solution code:
import numpy as np

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

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

print(lcm(a,b))

Submission status: Runtime Error

Solution code:
import math

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

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

print(lcm(a,b))

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())  
# 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 
print(lcm(a, b))

Submission status: Runtime Error

Solution code:
a=list(map(int,input().split()))
def cud(a,b):
  if a%b==0:
    return a/b
  else:
    cud(b,a%b)
print(a*b/cud(a[0],a[1]))