Problem:


GCD and LCM

Write a program which computes the greatest common divisor (GCD) and the least common multiple (LCM) of given a and b. 

Input

Input consists of several data sets. Each data set contains a and b separated by a single space in a line. The input terminates with EOF.

Constraints

 0 < a, b ≤ 2,000,000,000

 LCM(a, b) ≤ 2,000,000,000

 The number of data sets ≤ 50

Output

For each data set, print GCD and LCM separated by a single space in a line.

Sample Input

8 6
50000000 30000000

Output for the Sample Input

2 24
10000000 150000000



Sample input:
8 6
50000000 30000000


Sample output:
2 24
10000000 150000000

Submission status: Accepted

Solution code:
###
### atcorder test program
###

import sys

### math class
class math:
    ### pi
    pi = 3.14159265358979323846264338

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

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

math = math()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#A, B, C = [x for x in input().split()]
#inlist = [int(w) for w in input().split()]
#R = float(input())
#A = [int(x) for x in input().split()]
#for line in sys.stdin.readlines():
#    a, b = map(int, line.split())

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

for line in sys.stdin.readlines():
    x, y = [int(temp) for temp in line.split()]
    print("{} {}".format(math.gcd(x,y), math.lcm(x,y)))

Submission status: Accepted

Solution code:
import math
while True:
    try:
        x, y = map(int, input().split())
        print(str(math.gcd(x,y)) + " " + str((x * y) // math.gcd(x, y)))
    except EOFError:
        break

Submission status: Accepted

Solution code:
import sys

def euclid(x, y):
	if y == 0: return x
	elif x < y: return euclid(y, x)
	else: return euclid(y, x%y)

for line in sys.stdin:
	a, b = map(int, line.split())
	gcd = euclid(a, b)
	lcm = a*b/gcd
	print str(gcd)+' '+str(lcm)

Submission status: Accepted

Solution code:
import math
while True:
    try:
        a,b=map(int,input().split())
        gcd=math.gcd(a,b)
        lcm=int(a*b/gcd)
        print(gcd, lcm)
    except:break

Submission status: Accepted

Solution code:
import math

while True:
	try:
		a,b=list(map(int,input().split()))
		x=math.gcd(a,b)
		y=int(a*b/x)
		print("%d %d"%(x,y))
	except:
		break

Submission status: Accepted

Solution code:
while True:
  try:
    m,n = map(int, input().split())
  except EOFError:
    break
  LCM = m * n
  if m < n:
    m,n = n,m

  # calculating GCD
  while True:
    if m % n == 0:
      GCD = n
      break
    else:
      m, n = n, m % n

  # calculating LCM
  LCM = LCM // GCD

  print(GCD,LCM)

Submission status: Accepted

Solution code:
def GCD(x, y):
  # 最大公約数
    if x < y:
        x, y = y, x
    while True:
        r = x % y
        if r == 0:
            return y
        x, y = y, r


def calc_DCD_LCM(x, y):
  # 最大公約数
    gcd = GCD(x, y)
  # 最小公倍数
    lcm = int(x*y/gcd)
    return(gcd, lcm)


while True:
    try:
        x, y = list(map(int, input().split()))
        gcd, lcm = calc_DCD_LCM(x, y)
        print('{0} {1}'.format(gcd, lcm))
    except:
        exit(0)

Submission status: Accepted

Solution code:
def GCD(a,b):
    S=[a,b]
    S.sort(reverse=True)
    while S[1]>0:
        S2=[S[1],S[0]%S[1]]
        S=S2
    return S[0]
    
try:
    while True:
        a,b=[int(i) for i in input().split(" ")]
        G=GCD(a,b)
        L=int(a*b/G)
        print("%d %d"%(G,L))
except EOFError:
    pass

Submission status: Accepted

Solution code:
import math

while True:
  try:
    a, b = map(int, input().split())
    print(math.gcd(a, b), a * b // math.gcd(a, b))
  except:
    break

Submission status: Accepted

Solution code:
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
    
if __name__ == '__main__':
    while True:
        try:
            a, b = map(int, input().split())
            print('{0} {1}'.format(math.gcd(a, b), lcm(a, b)))
        except EOFError:
            break

Submission status: Accepted

Solution code:
def gcd(x,y):
    while y:
        x, y = y, x % y
    return x


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


while True:
    try:
        a = list(map(int,input().split()))
        print(gcd(a[0],a[1]),lcm(a[0],a[1]))
    except:
        break

Submission status: Accepted

Solution code:
while True:
	try:
		n=list(map(int, input().split()))#ファイルの読み込み --.py <--.txt
	except EOFError:
		break
	if n[0]>n[1]:#なくてもいいなあ
		l=n[0]
		s=n[1]
	else:
		l=n[1]
		s=n[0]
	a=l
	b=s
	r=a%b
	while r!=0:
		a=b
		b=r
		r=a%b
	GCD=int(b)
	LCM=int(l*s/b)
	print(GCD, LCM)

Submission status: Accepted

Solution code:
def GCD(a, b):
	while b!=0:
		tmp=b
		b=a%b
		a=tmp
	return a
while True:
	try:
		a, b = map(int, input().split())
	except EOFError:
		break
	a, b = (a, b) if a>=b else (b, a)
	gcd=GCD(a,b)
	print(gcd, a*b//gcd)

Submission status: Accepted

Solution code:
import sys

def findGCD(a, b):
  if b == 0:
    return a
  return findGCD(b, a%b)

if __name__ == "__main__":
  for line in sys.stdin:
    a, b = [int(i) for i in line.strip().split(" ")]
    GCD = findGCD(a,b)
    LCM = a*b//GCD
    print(GCD, LCM)

Submission status: Accepted

Solution code:
import sys
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
for line in sys.stdin:
    a, b = [int(x) for x in line.split()]
    c = math.gcd(a, b)
    d = lcm(a, b)
    print("%d %d" % (c, d) )

Submission status: Accepted

Solution code:
while True:
    try:
        a, b = [int(x) for x in input().split()]
        n, m = [min(a, b), max(a, b)]
        while n != 0:
            n, m = m % n, n
        print(m, a * b // m)
    except EOFError:
        break

Submission status: Accepted

Solution code:
while(1):
    try:
        a, b = map(int, input().split())
    except:
        break

    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
        else:
            gcd = z

    lcm = a * b // gcd

    print(gcd, lcm)

Submission status: Accepted

Solution code:
def gcd(x,y):
    q = max(x,y)  %  min(x,y)
    if q == 0 :
        return min(x,y)
    return round(gcd(min(x,y),q))

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

while True:
    try:
        a, b = map(int,input().split())
        print(gcd(a,b),lcm(a,b))
    except EOFError:
        break

Submission status: Accepted

Solution code:
import math

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

while True:
    try:
        a, b = map(int, input().split())
        print('{} {}'.format(math.gcd(a, b), lcm(a, b)))
    except:
        break

Submission status: Accepted

Solution code:
while True:
    try:
        a,b = map(int, input().split())
        nlist = sorted([a,b])
        while True:
            c = nlist[1]%nlist[0]
            nlist = [c, nlist[0]]
            if (c == 0):
                break
        ss = nlist[1]
        print(ss, int(a*b/ss))
    
    except EOFError:
        break

Submission status: Accepted

Solution code:
import math

while True:
    try:
        a, b = map(int, input().split(" "))
        print(math.gcd(max(a, b), min(a, b)), int(max(a, b) * min(a, b) / math.gcd(max(a, b), min(a, b))))

    except:
        break

Submission status: Accepted

Solution code:
import math
while(True):
    try:
        a,b = map(int, input().split())
        c = math.gcd(a,b)
        print(c, int(a*b/c))
    except:
        break

Submission status: Accepted

Solution code:
# coding:utf-8
import sys

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

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

for s in sys.stdin:
  a, b = map(int,s.split())
  gcd_num = gcd(a, b)
  lcm_num = lcm(a, b)
  print "%d %d"%(gcd_num, lcm_num)

Submission status: Accepted

Solution code:
ans = []

def gcd(a, b) :
    if a % b == 0 :
        return b
    else :
        return gcd(b, a % b)
        
def lcm(a, b) :
    return a * b // gcd(a, b)

while True :
    try :
        s = input()
        a, b = map(int, s.split())  
        m_gcd, m_lcm = gcd(a, b), lcm(a, b)
        ans.append([m_gcd, m_lcm])
    except :
        for a in ans :
            print(a[0], a[1])
        break

Submission status: Accepted

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


def run():
    while True:
        try:
            x, y = map(int, input().split())
            g = gcd(x, y)
            l = x * y // g
            print(g, l)
        except:
            break

if __name__ == '__main__':
    run()

Submission status: Accepted

Solution code:
from fractions import gcd

while True:
  try:
    a, b = map(int, input().split())
    left = gcd(a,b)
    print( left, a*b//(left))
  except:
    break

Submission status: Accepted

Solution code:
import sys,math
for e in sys.stdin:
 a,b=map(int, e.split())
 d=a*b
 a = math.gcd(a,b)
 print(a, d//a)

Submission status: Accepted

Solution code:
def gcd(a, b):
    if a == 0:
        return b
    else:
        return gcd(b%a, a)
def lcm(a, b):
    return a*b//gcd(a, b)
while 1:
    try:
        a,b = map(int, input().split(" "))
        print(gcd(a, b),lcm(a, b))
    except:
        break

Submission status: Accepted

Solution code:
def gcd(a,b):
	if b < 1: return a
	a,b = b,a % b
	return gcd(a,b)
ss = input().split()
while ss:
	a,b = map(int,ss)
	g = gcd(a,b)
	l = int(a*b/g)
	print(g,l)
	try: ss = input().split()
	except EOFError: break

Submission status: Accepted

Solution code:
while True:
	try:
		data = map(int, raw_input().split())
		[a, b] = data
		m = a
		n = b
		
		while m % n != 0:
			hoge = m % n
			m = n
			n = hoge

		gcm = n
		lcm = a * b / gcm

		print gcm, lcm
	
	except EOFError:
		break

Submission status: Runtime Error

Solution code:
#include <stdio.h>
using namespace std;

int gcd(unsigned long num1,unsigned long num2) {
	if (num2 == 0) {
		return num1;
	}return gcd(num2, num1 % num2);
}

int lcm(unsigned long n1, unsigned long n2) {
	return n1 * n2 / gcd(n1, n2);
}

int main() {
	unsigned long a, b;
	while (~scanf("%d %d",&a,&b)) {
		printf("%d %d\n", gcd(a, b),lcm(a,b));
	}
}

Submission status: Runtime Error

Solution code:

while True:
  try:
    m,n = map(int,input().split())
    if m<n:
        a = n
        b = m
    else:
        a = m
        b = n

    c = a % b
    while c != 0:
        temp = c
        if b % c == 0:
            break
        c = b % c
        b = temp

    d = m * n / c

    print(str(c) + " " + str(int(d)))

  except EOFError:
    break

Submission status: Runtime Error

Solution code:
import sys

# 入力が終わるまで読み込む
while 1:
    line = sys.stdin.readline()
    if (not line):
        break
    # 2つの変数に読み込み
    x, y = map(int, line.split())
    # ユークリッドの互除法
    if (x > y):
        gcd = x
        t = y
    else :
        gcd = y
        t = x
    while (t > 0) :
        tmp = gcd % t
        gcd = t
        t = tmp
    # 最小公倍数を求める A * B = GCD * LCM
    lcm = x * y / gcd
    print str(gcd) + " " + str(lcm)

Submission status: Runtime Error

Solution code:
import sys

#最大公約数
def gcd(x, y):
    s = x / y
    r = x % y
    if r == 0:
        return y
    else:
        return gcd(y, r)

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

def main():
    #print ("a")
    tmp = sys.stdin.readline().split(" ")
    #print ("b")
    while 1:
        a = int(tmp[0])
        b = int(tmp[1])
        #print ("a="+str(a))
        #print ("b="+str(b))
        #b = sys.stdin.readline()
        #print ("d")
        if a > b:
            c = a
            d = b
        else:
            c = b
            d = a

        print (str(gcd(c, d)) + " " + str(int(lcm(c,d))))

        tmp = sys.stdin.readline()
        if len(tmp) == 1:
            break
        else:
            tmp = tmp.split(" ")

    #print ("exit")
     
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sys

#最大公約数
def gcd(x, y):
    s = x / y
    r = x % y
    if r == 0:
        return y
    else:
        return gcd(y, r)

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

def main():
    #print ("a")
    tmp = sys.stdin.readline().split(" ")
    #print ("b")
    while 1:
        a = long(tmp[0])
        b = long(tmp[1])
        #print ("a="+str(a))
        #print ("b="+str(b))
        #b = sys.stdin.readline()
        #print ("d")
        if a > b:
            c = a
            d = b
        else:
            c = b
            d = a

        print (str(gcd(c, d)) + " " + str(long(lcm(c,d))))

        tmp = sys.stdin.readline()
        if len(tmp) == 1:
            break
        else:
            tmp = tmp.split(" ")

    #print ("exit")
     
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sys
def main():
    tmp = sys.stdin.readline().split(" ")
    a = long(tmp[0])
    b = long(tmp[1])
    print ("Hello World")
 
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sys
def main():
    tmp = sys.stdin.readline().split(" ")
    while 1:
        if a > b:
            c = a
            d = b
        else:
            c = b
            d = a

        

        tmp = sys.stdin.readline()
        if len(tmp) == 1:
            break
        
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sys
def main():
    tmp = sys.stdin.readline()
    while tmp:
        tmp = sys.stdin.readline().split("")
        if a > b:
            c = a
            d = b
        else:
            c = b
            d = a

        

        tmp = sys.stdin.readline()

        
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sys
def main():
    tmp = sys.stdin.readline()
    while tmp:
        tmp = sys.stdin.readline().split("")
        if a > b:
            c = a
            d = b
        else:
            c = b
            d = a

        

        tmp = sys.stdin.readline()
        break

        
if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
import sys
def main():
    tmp = sys.stdin.readline()
    while tmp:
        tmp = sys.stdin.readline().split("")
        a = 1
        b = 2
        if a > b:
            c = a
            d = b
        else:
            c = b
            d = a

        

        tmp = sys.stdin.readline()
        break

        
if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

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

while True:
    try:
        a,b = map(int, raw_input().split())
        print gcd(a,b) + " " + lcm(a,b)
    except EOFError:
        break

Submission status: Runtime Error

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

while(True):
	try:
		a, b=map(int, input().split())
		
		gcd=0
		for i in range(a):
			if(a%i==0 and b%i==0):
				gcd=i
		lcm=a*b/gcd

		print("{0} {1}".format(gcd, lcm))

	except EOFError:
		break

Submission status: Runtime Error

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

while(True):
	try:
		a, b=map(int, input().split())
	except EOFError:
		break

	gcd=0
	for i in range(a):
		if(a%i==0 and b%i==0):
			gcd=i
	lcm=a*b/gcd
	print("{0} {1}".format(gcd, lcm))

Submission status: Runtime Error

Solution code:
import sys

def main():
    for input_line in sys.stdin:
        num1 = int(input_line.split(' ')[0])
        num2 = int(input_line.split(' ')[1])
        
        if num1 <= num2:
            dividend(num1, num2, num1)
        elif num1 > num2:
            dividend(num1, num2, num2)
            
        result.sort(reverse=True)
        greatest_common_divisor = result[0]
        least_common_multiple = num1 * num2 / greatest_common_divisor
        
        print('%s %s' % (greatest_common_divisor, least_common_multiple))
        
def dividend(num1, num2, num):
    for i in range(num).sort(reverse=True):
        divisor = i+1
        if num1 % divisor == 0 and num2 % divisor == 0:
            result.append(divisor)
            break
        
if __name__ == '__main__':
    result = []
    main()

Submission status: Runtime Error

Solution code:
import sys


def gcd(a, b):
    ret = None
    if a <= b:
        large = b
    else:
        large = a
    for i in xrange(large, 0, -1):
        if a % i == 0 and b % i == 0:
            ret = i
            break
    return ret


def lcm(a, b):
    ret = None
    lst = [a, b]
    while True:
        if a == b:
            ret = a
            break
        if a > b:
            b += lst[1]
        else:
            a += lst[0]
    return ret


def main():
    #for line in sys.stdin.readlines():
    for line in open('test.txt'):
        a, b = [int(n) for n in line.split()]
        print "{0} {1}".format(gcd(a, b), lcm(a, b))


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
import sys
list = sys.stdin.readlines()

e=0
GCD = 0
def Euclide(a, b):
    if b == 0:
        return a
    if a < b:
        tmp = a
        a = b
        b = tmp
    e = a%b
    return Euclide(b, e)
    
def LCM(a, b, c):
    return int(a/c*b)

for i in list:
    a = i[0]
    b = i[1]
    GCD = Euclide(a, b)
    print(str(GCD)+" "+str(LCM(a, b, GCD)))

Submission status: Runtime Error

Solution code:
import sys

def gcd(a,b):
    if a == b:
        return a
    else:
        return gcd(b, abs(a-b))

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

if __name__ == "__main__":
    for i in sys.stdin:
        a,b = map(int, i.split())
        print gcd(a,b),lcm(a,b,gcd(a,b))

Submission status: Runtime Error

Solution code:
#encoding=utf-8
import sys

printf = sys.stdout.write
ans = []
def gcd(a,b):
    if a == b:
        return a
    else:
        return gcd(b, abs(a-b))

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

if __name__ == "__main__":
    for i in sys.stdin:
        a,b = map(int, i.split())
        ans.append(gcd(a,b))
        ans.append(lcm(a,b,gcd(a,b)))
        
    for i in xrange(0,len(ans)  - 2,2):
        printf(str(ans[i]) + " " + str(ans[i + 1]) + "\n")
        
    printf(str(ans[len(ans) - 2]) + " " + str(ans[len(ans) - 1]))

Submission status: Runtime Error

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

import sys

def gcd(a, b):
    global gcd
    if b == 0:
        gcd = a:
    else:
        gcd = gcd(b, a%b)

for line in sys.stdin:
    gcd = 1
    lcm = 1
    a, b = map(int, line.split())
    gcd(a, b)
    lcm = a*b/gcd/gcd
    print "%d %d" %(gcd, lcm)

Submission status: Runtime Error

Solution code:
import math
import sys

for line in sys.stdin:
	x,y = [int(s) for s in line.split(' ')]
	g = math.gcd(x,y)

	a = set()
	b = set()
	i = 1
	while not a & b:
		a = a | {x*i}
		b = b | {y*i}
		i += 1

	ab = a & b
	print(g,*ab)

Submission status: Runtime Error

Solution code:
import math
import sys

for line in sys.stdin:
	x,y = [int(s) for s in line.split(' ')]
	G = math.gcd(x,y)
	L = int(x*y/G)
	print(G,L)

Submission status: Runtime Error

Solution code:
mport sys

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num1=inl[0]
    check=1
    list=[]
    while check<=math.sqrt(num1):
        if num1%check==0:
            list.append(check)
        check+=1
    list.sort()
    list.reverse()
    num2=inl[1]
    for i in list:
        if num2%i==0:
            gud=i
            break
    lcm==num1*num2/gud
    print gud,lcm

Submission status: Runtime Error

Solution code:
mport sys

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num1=int(inl[0])
    check=1
    list=[]
    while check<=math.sqrt(num1):
        if num1%check==0:
            list.append(check)
        check+=1
    list.sort()
    list.reverse()
    num2=int(inl[1])
    for i in list:
        if num2%i==0:
            gud=i
            break
    lcm==num1*num2/gud
    print gud,lcm

Submission status: Runtime Error

Solution code:
mport sys

a = []
for line in sys.stdin:
    a.append(line)

for n in a:
    inl=n.split()
    num1=int(inl[0])
    check=1
    list=[]
    while check<=math.sqrt(num1):
        if num1%check==0:
            list.append(check)
        check+=1
    list.sort()
    list.reverse()
    num2=int(inl[1])
    for i in list:
        if num2%i==0:
            gud=i
            break
    lcm=num1*num2/gud
    print gud,lcm

Submission status: Runtime Error

Solution code:
print 1 2

Submission status: Runtime Error

Solution code:
import sys,math
for i in sys.stdin:x,y=map(int,i.split());g=math.gcd(x,y);print(g,x/g*y/g*g)

Submission status: Runtime Error

Solution code:
import sys,math
for i in sys.stdin:
	x,y=map(int,i.split())
	g=math.gcd(x,y)
	print(g,x/g*y/g*g)

Submission status: Runtime Error

Solution code:
import sys
import math
for i in sys.stdin:
	x,y=map(int,i.split())
	g=math.gcd(x,y)
	print(g,x*y/g)

Submission status: Runtime Error

Solution code:
def gcd(li):
    a=max(li)
    b=min(li)
    while b>0:
        a,b=b,a%b
    return a

def lcm(li):
    return li[0]*li[1]/gcd(li)

while True:
    li=[int(i) for i in input().split(" ")]
    print("%i %i"%(gcd(li),lcm(li)))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def euclidean_algorithm(a,b):
  if a == b: return(a)
  if a >  b: return(euclidean_algorithm(a-b,b))
  if a  < b: return(euclidean_algorithm(b-a,a))

inputs=[]
while True:
  try:
    inputs.append( list( map(int,input().split()) ) )
  except EOFError:
    break

for i in inputs:
  gcd = euclidean_algorithm(i[0],i[1])
  lcm = int(i[0]*i[1]/gcd)
  print("{0} {1}".format(gcd,lcm))

Submission status: Runtime Error

Solution code:
def euclidean_algorithm(a,b):
  if a == b: return(a)
  if a >  b: return(euclidean_algorithm(a-b,b))
  if a  < b: return(euclidean_algorithm(b-a,a))
  return 0

inputs=[]
while True:
  try:
    inputs.append( list( map(int,input().split()) ) )
  except EOFError:
    break

for i in inputs:
  gcd = euclidean_algorithm(i[0],i[1])
  lcm = int(i[0]*i[1]/gcd)
  print("{0} {1}".format(gcd,lcm))

Submission status: Runtime Error

Solution code:
import sys, math
[[print("{} {}".format(math.gcd(t[0], t[1]), t[0] * t[1] // math.gcd(t[0], t[1]))) for t in [[int(y) for y in x.split()]]] for x in sys.stdin]

Submission status: Runtime Error

Solution code:
import sys, math
[[print("{} {}".format(math.gcd(t[0], t[1]), t[0] * t[1] / math.gcd(t[0], t[1]))) for t in [[int(y) for y in x.split()]]] for x in sys.stdin]

Submission status: Runtime Error

Solution code:
import sys
from math import gcd
[print("{}{}".format(gcd(k[0], k[1]), k[0] * k[1] // gcd(k[0], k[1]))) for i in sys.stdin for k in [[int(j) for j in i.split()]]]

Submission status: Runtime Error

Solution code:
import sys
from fractions import gcd
[print("{}{}".format(gcd(k[0], k[1]), k[0] * k[1] // gcd(k[0], k[1]))) for i in sys.stdin for k in [[int(j) for j in i.split()]]]

Submission status: Runtime Error

Solution code:

import sys
# from fractions import gcd
from math import gcd
[print("{} {}".format(gcd(k[0], k[1]), (k[0] * k[1]) // gcd(k[0], k[1]))) for i in sys.stdin for k in [[int(j) for j in i.split()]]]

Submission status: Runtime Error

Solution code:
#coding: utf-8

import sys

for line in sys.stdin:
    l = (map(int,line.split()))
    l.sort()
    a = l[0]
    b = l[1]
    for i in range(2,b+1):
        if a%i == 0 and b%i == 0:
            ans = i:
    print a*b/ans,ans

Submission status: Runtime Error

Solution code:
import math
while True:
    try:
        a,b = map(int,input().split())
        gcd = math.gcd(a,b)
        lcm = a*b /gcd
        print(gcd,int(lcm))
    except EOFError:
        break

Submission status: Runtime Error

Solution code:
import math
while True:
    try:
        a,b = map(int,input().split())
        gcd = math.gcd(a,b)
        lcm = a*b /gcd
        print(gcd,int(lcm))
    except (EOFError,ValueError):
        break

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from math import gcd
g=9.8
while True:
    try:
        a,b=map(int,input().split())
    except:
        break
    print(gcd(a,b),a*b//gcd(a,b))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys


def g(a,b):
    return g(abs(a-b),a) if a%abs(a-b)!=0 else abs(a-b)

for line in sys.stdin.readlines():
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, a*b//c)

Submission status: Runtime Error

Solution code:
import sys


def g(a,b):
    return g(abs(a-b),a) if a%abs(a-b)!=0 else abs(a-b)
sets = sys.stdin.readlines()
for line in sets:
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, a*b//c)

Submission status: Runtime Error

Solution code:
import sys


def g(a, b):
    d = abs(a - b)
    return g(d, a) if a % d != 0 else d


sets = sys.stdin.readlines()
for line in sets:
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, a * b // c)

Submission status: Runtime Error

Solution code:
import sys


def g(a, b):
    d = abs(a - b)
    return g(d, a) if a % d != 0 else d


def lcm(inta, intb, intgcd):
    return (inta * intb // intgcd)


sets = sys.stdin.readlines()
for line in sets:
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, lcm(a,b,c))

Submission status: Runtime Error

Solution code:
import sys


def g(inta, intb):
    d = abs(a - b)
    return g(d, a) if a % d != 0 else d


def lcm(inta, intb, intgcd):
    return (inta * intb // intgcd)


sets = sys.stdin.readlines()
for line in sets:
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, lcm(a,b,c))

Submission status: Runtime Error

Solution code:
import sys


def g(inta, intb):
    d = abs(a - b)
    return g(d, a) if a % d != 0 else d


def lcm(inta, intb, intgcd):
    return inta * intb // intgcd


sets = sys.stdin.readlines()
for line in sets:
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, lcm(a,b,c))

Submission status: Runtime Error

Solution code:
import sys


def g(inta, intb):
    d = abs(a - b)
    return g(d, a) if a % d != 0 else d


def lcm(inta, intb, intgcd):
    return inta * intb // intgcd


sets = sys.stdin.readlines()
for line in sets:
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, lcm(a, b, c))

Submission status: Runtime Error

Solution code:
import sys


def g(inta, intb):
    d = abs(a - b)
    return g(d, a) if a % d != 0 else d


def lcm(inta, intb, intgcd):
    return inta * intb // intgcd


for line in sys.stdin:
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, lcm(a,b,c))

Submission status: Runtime Error

Solution code:
import sys


def g(a, b):
    d = abs(a - b)
    return g(d, a) if a % d != 0 else d


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


for line in sys.stdin:
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, lcm(a, b, c))

Submission status: Runtime Error

Solution code:
import sys


def g(a, b):
    d = abs(a - b)
    return g(d, a) if a % d != 0 else d


for line in sys.stdin:
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, a * b // gcd)

Submission status: Runtime Error

Solution code:
import sys


def g(a, b):
    d = abs(a - b)
    return g(d, a) if a % d != 0 else d


for line in sys.stdin():
    a, b = map(int, line.split())
    c = g(a, b)
    print(c, a * b // gcd)

Submission status: Runtime Error

Solution code:
import sys

nums = []


for line in sys.stdin:
    nums.append(line)

for i in range(len(nums)):
    input_line = nums[i].split(" ")
    a = long(input_line[0])
    b = long(input_line[1])


    #??¬?´???°?????????
    common_div = []

    #?????§??¬?´???°
    if a < b:
        last_num = a
    else:
        last_num = b

    for j in range(1,last_num-1):
        if a%j == 0 and b%j == 0:
            #a???b???j??§???????????¨???
            common_div.append(j)
    
    max_common_div = common_div[len(common_div)-1]
    min_common_mpl = int((a * b)/max_common_div)

    print(str(max_common_div) + " " + str(min_common_mpl))

Submission status: Runtime Error

Solution code:
import sys

nums = []


for line in sys.stdin:
    nums.append(line)

for i in range(len(nums)):
    input_line = nums[i].split(" ")
    a = long(input_line[0])
    b = long(input_line[1])


    #??¬?´???°?????????
    common_div = []

    #?????§??¬?´???°
    if a < b:
        last_num = a
    else:
        last_num = b

    for j in range(1,last_num-1):
        if a%j == 0 and b%j == 0:
            #a???b???j??§???????????¨???
            common_div.append(j)
    
    max_common_div = common_div[len(common_div)-1]
    min_common_mpl = long((a * b)/max_common_div)

    print(str(max_common_div) + " " + str(min_common_mpl))

Submission status: Runtime Error

Solution code:
import sys

nums = []


for line in sys.stdin:
    nums.append(line)

for i in range(len(nums)):
    input_line = nums[i].split(" ")
    a = int(input_line[0])
    b = int(input_line[1])


    #??¬?´???°?????????
    common_div = []

    #?????§??¬?´???°
    if a < b:
        last_num = a
    else:
        last_num = b

    for j in range(1,last_num-1):
        if a%j == 0 and b%j == 0:
            #a???b???j??§???????????¨???
            common_div.append(j)
    
    max_common_div = common_div[len(common_div)-1]
    min_common_mpl = int((a * b)/max_common_div)

    print(str(max_common_div) + " " + str(min_common_mpl))

Submission status: Runtime Error

Solution code:
import sys
import math

for line in sys.stdin:
    a,b = map(int, line.split())
    gc = math.gcd(a,b)
    print("{} {}".format(gc, a*b//gc))

Submission status: Runtime Error

Solution code:
import sys
import math

for line in sys.stdin:
    a,b = map(int, line.split())
    gc = math.gcd(a,b)
    print("{0} {1}".format(gc, a*b//gc))

Submission status: Runtime Error

Solution code:
import sys

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

lines = sys.stdin.readlines()
for line in lines:
    a, b = map(int, line.split())
    m = max(a, b)
    n = min(a, b)
    print(gcd(m, n) m * n // gcd(m, n))

Submission status: Runtime Error

Solution code:
import sys
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)
for line in sys.stdin:
    a,b=line.split()
    print(gcd(a,b),lcm(a,b))

Submission status: Runtime Error

Solution code:
import sys
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)
for line in sys.stdin:
    a,b=line.split(" ")
    print(gcd(a,b),lcm(a,b))

Submission status: Runtime Error

Solution code:
for j in range(50)
    n=input().split()
    num=[int(n[i]) for i in range(len(n))]
    max=1
    num=sorted(num)
    for i in range(1,num[0]+1):
        if num[0]%i==0:
            if num[1]%i==0:
                max=i
    print(max,int(num[0]*num[1]/max))