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: Wrong Answer

Solution code:
import sys
for i in sys.stdin :
	m,n = map(int , i.split())
	t1,t2=m,n
	while 1 : 
		if m % n == 0 : 
			break
		m , n = n , m % n
		
		a = n
		b = (t1 / a ) * t2
		
		print "%d %d" % (a,b)

Submission status: Wrong Answer

Solution code:
import sys
for line in sys.stdin:
    a, b = map(int, line.split())
    A, B = min(a, b), max(a, b)

    while True:
        mod = B % A
        if mod == 0:
            gcd = B / A
            break
        else:
            A, B = mod, A
    lcm = gcd * (a / gcd) * (b / gcd)

    print '%d %d' % (gcd, lcm)

Submission status: Wrong Answer

Solution code:
while True:
	try:
		i=list(map(int,input().split()))
		i.sort()
		x=i[:]
		while True:
			if i[1]%i[0]!=0:
				i[0],i[1] = i[1]%i[0],i[1]
			else:
				print(i[0],int(x[0]*x[1]/i[0]))
				break;
	except:
		break;

Submission status: Wrong Answer

Solution code:
import sys
def main():
    a = sys.stdin.readline()
    print ("Hello World")
 
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
def main():
    tmp = sys.stdin.readline().split(" ")
    print ("Hello World")
 
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
def main():
    tmp = sys.stdin.readline().split(" ")
    print (tmp[0])
 
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
def main():
    tmp = sys.stdin.readline().split(" ")
    print (str(int(tmp[0])))
    print (str(int(tmp[1])))
 
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys
def main():
    for line in iter(sys.stdin.readline, ""):
        print (line)

        
if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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")
    for line in iter(sys.stdin.readline, ""):
        print (line)
        #tmp = sys.stdin.readline().split(" ")
        #print ("b")
        tmp = line.split(" ")
    
        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: Wrong Answer

Solution code:
while True:
    try:
        spam=map(int, input().split(' '))
        spam = [i for i in spam]
        spam.sort()
        cola = spam[0] * spam[1]
        while True:
            if spam[0] == 0:
                print(spam[1])
                print(int(cola/spam[1]))
                break
            pre = spam[0]
            spam[0] = spam[1] % spam[0]
            spam[1] = pre
    except:
        break

Submission status: Wrong Answer

Solution code:
import sys

def dividend(num, Q):
    a = Q
    b = (num / Q) * Q
    Q = num - (num / Q) * Q
    if num  == b:
        aaa(a)
    dividend(num, Q)
    
def aaa(greatest_common_divisor):
    least_common_multiple = num1 * num2 / greatest_common_divisor
    print('%s %s' % (greatest_common_divisor, least_common_multiple))
    sys.exit()

for input_line in sys.stdin:
    num1 = int(input_line.split(' ')[0])
    num2 = int(input_line.split(' ')[1])
    
    if num1 <= num2:
        dividend(num2, num1)
    elif num1 > num2:
        dividend(num1, num2)

Submission status: Wrong Answer

Solution code:
import sys

def dividend(num, Q):
    a = Q
    b = (num / Q) * Q
    Q = num - (num / Q) * Q
    if num  == b:
        return aaa(a)
    dividend(num, Q)
    
def aaa(greatest_common_divisor):
    least_common_multiple = num1 * num2 / greatest_common_divisor
    print('%s %s' % (greatest_common_divisor, least_common_multiple))
    return

for input_line in sys.stdin:
    num1 = int(input_line.split(' ')[0])
    num2 = int(input_line.split(' ')[1])
    
    if num1 <= num2:
        dividend(num2, num1)
    elif num1 > num2:
        dividend(num1, num2)

Submission status: Wrong Answer

Solution code:
import sys

def dividend(num, Q):
    a = Q
    b = (num / Q) * Q
    Q = num - (num / Q) * Q
    if num  == b:
        aaa(a)
        return
    dividend(num, Q)
    
def aaa(greatest_common_divisor):
    least_common_multiple = num1 * num2 / greatest_common_divisor
    print('%s %s' % (greatest_common_divisor, least_common_multiple))
    return

for input_line in sys.stdin:
    num1 = int(input_line.split(' ')[0])
    num2 = int(input_line.split(' ')[1])
    
    if num1 <= num2:
        dividend(num2, num1)
    elif num1 > num2:
        dividend(num1, num2)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
import sys
for line in sys.stdin:
    a, b = map(int, line.split())
    c = a * b
    while b:
        a, b = b, a % b
    print(str(a) + ' ' + str(c / a))

Submission status: Wrong Answer

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

a,b = map(int,raw_input().split())
print "%d %d"%(gcd(a,b),lcm(a,b))

Submission status: Wrong Answer

Solution code:
#GCD and LCM

while True:
    try:
        a, b = (int(i) for i in input(). split())
        x = a * b
        while True:
            c = a % b
            a = b
            b = c
            if a % b == 0:
                break
        x = x / a
        print("%d %d" % (b, x))
    except:
        break

Submission status: Wrong Answer

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

list = map(int, raw_input().split())
list.sort()

print gcd(list[1],list[0]), list[0]*list[1]/gcd(list[1],list[0])

Submission status: Wrong Answer

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)

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

Submission status: Wrong Answer

Solution code:
def get_input():
    while True:
        try:
            yield ''.join(raw_input())
        except EOFError:
            break

if __name__ == '__main__':
    a = list(get_input())

for n in a:
    inl=n.split()
    num=inl[0]+inl[1]
    l=list(num)
    time=0
    for i in l:
        time+=1
    print time

Submission status: Wrong Answer

Solution code:
import sys

for l in sys.stdin:
    a,b = map(int, l.split())
    ab = a*b

    while True:
        ba,bb = a,b
        b = a % b
        if b==0:
            break
        a = ba

    print "%d %d" % (bb, ab/bb)

Submission status: Wrong Answer

Solution code:
print "1 2"

Submission status: Wrong Answer

Solution code:
import sys

for l in sys.stdin:
    l = l.split()
    print " ".join(l)

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a,b = map(int, raw_input().split())
        ab = a*b

        while True:
            ba,bb = a,b
            b = a % b
            if b==0:
                break
            a = ba

        print "%d %d" % (bb, ab/bb)
    except (EOFError):
        break

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a,b = map(int, raw_input().split())
        ab = a*b
        a, b = (a,b) if a > b else (b,a)
        while True:
            ba,bb = a,b
            b = a % b
            if b==0:
                break
            a = ba

        print "%d %d" % (bb, ab/bb)
    except (EOFError):
        break

Submission status: Wrong Answer

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

while True:
 try:
  a,b=[int(i) for i in input().split()]
 except EOFError:
  break

Submission status: Wrong Answer

Solution code:
def GCD(x, y):
	while x > 0:
		z = x
		x = y % x
		y = z
	return y

def LCM(x, y):
	X = x / GCD(x, y)
	Y = y / GCD(x, y)
	return X * Y * GCD(x, y)

import sys
L = sys.stdin.readlines()
for line in L:
	x, y = list(map(int, line.split()))
	print(GCD(x, y), LCM(x, y))

Submission status: Wrong Answer

Solution code:
def GCD(a, b):
	if b > a:
		return GCD(b, a)
	elif a % b == 0:
		return b
	return GCD(b, a % b)
		
def LCM(a, b):
	return a * b / GCD(a, b)

import sys
L = sys.stdin.readlines()
for line in L:
	x, y = list(map(int, line.split()))
	print(GCD(x, y), LCM(x, y))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
#coding: utf-8

import sys

def gojo(a,b):
    print a,b
    if b % a == 0:
        return a
    else:
        return gojo(b % a, a)

for line in sys.stdin:
    l = map(int,line.split())
    l.sort()
    a = l[0]
    b = l[1]
    print gojo(a,b),a*b/gojo(a,b)

Submission status: Wrong Answer

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:
        break

Submission status: Wrong Answer

Solution code:

import math

while 1:
    try:
        a, b = map(int, input().split())

        print(math.gcd(a,b), a * b // math.gcd(a,b))
    except:
        break

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

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

a = k[0]
b = k[1]

r = a % b
while r != 0:
    a = b
    b = r
    r = a % b
else:
    ans1 = b


a = k[0]
b = k[1]

v = a % b
index = 2
while v != 0:
    aa = a * index
    v = aa % b
    index = index + 1
else:
    ans2 = aa

print(ans1, ans2)

Submission status: Wrong Answer

Solution code:
data_set = []
while True:
    try:
        k = list(map(int, input().split()))
        data_set.append(k)
    except:
        for k in data_set:
            a = k[0]
            b = k[1]
            
            r = a % b
            while r != 0:
                a = b
                b = r
                r = a % b
            else:
                ans1 = b
            
            
            a = k[0]
            b = k[1]
            
            v = a % b
            index = 2
            while v != 0:
                aa = a * index
                v = aa % b
                index = index + 1
            else:
                ans2 = aa
            
            print(ans1, ans2)
        break

Submission status: Wrong Answer

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

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

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

print(gcd(a,b), acd(a,b))

Submission status: Wrong Answer

Solution code:
def get_gcd(_a, _b):
    if _a % _b == 0:
        return _b
    return get_gcd(_b, _a % _b)


if __name__ == '__main__':
    a, b = list(map(int, input().split()))
    gcd = get_gcd(a, b)
    lcm = a * b / gcd
    print(str(gcd) + " " + str(int(lcm)))

Submission status: Wrong Answer

Solution code:
import sys
import fractions

lines = []
for line in sys.stdin:
    num = line.split(" ")
    a, b = int(num[0]), int(num[1])
    gcd = fractions.gcd(a, b)
    print("{0} {1}".format(gcd, (a*b)/gcd))

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
for i in range(1,a+1):
    f=(b*i)%a
    lcm=(b*i)
    if f==0:
        break
for j in range(1,a+1):
    if a%j==0 and b%j==0 and j*lcm==a*b:
        print(j,lcm)

Submission status: Wrong Answer

Solution code:
def main():
	import sys

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

		while a % b != 0:
			a, b = b, a%b

		print(b, c*b)

if __name__ == '__main__':
	main()

Submission status: Wrong Answer

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: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

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: Wrong Answer

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: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

Solution code:
import math

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

Submission status: Wrong Answer

Solution code:
try:
    GCD = 0
    LCM = 0
    while True:
        lists = list(map(int, input().split()))
        l = sorted(lists)
        num = l[0] * l[1]
        while l[0] < l[1]:
            GCD = l[1] - l[0]
            l[1] = GCD
            l = sorted(l)
            LCM = int(num / GCD)
        print(str(GCD) + " " + str(LCM))
 
        
except EOFError:
    pass

Submission status: Wrong Answer

Solution code:
try:
    GCD = 0
    LCM = 0
    while True:
        lists = list(map(int, input().split()))
        l = sorted(lists)
        num = l[0] * l[1]
        while l[0] < l[1]:
            GCD = l[1] - l[0]
            l[1] = GCD
            l = sorted(l)
            LCM = int(num / GCD)
        print(GCD, LCM)
 
        
except EOFError:
    pass

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
d = a * b
if a < b:
    tmp = a
    a = b
    b = tmp

c = a % b
while(c != 0):
    a = b
    b = c
    c = a % b

g = b
l = d / g

print(str(g)+" "+str(l))

Submission status: Wrong Answer

Solution code:
# This program computes GCD and LCM
# -*- coding: utf-8
import sys


def gcd(a, b):
    while True:
        tmpb = b
        b = a % b
        a = tmpb
        if(b == 0):
            break
    return int(a)


def lcm(a, b):
    for i in range(max([a, b]), a*b + 1):
        if(i % a == 0 and i % b == 0):
            return i
    return a*b


for i in sys.stdin:
    try:
        line = [int(k) for k in i.split(" ")]
        g = gcd(max(line), min(line))
        print(str(g) + " " + str(line[0]*line[1]/g))  # + str(lcm(line[0], line[1]))
    except:
        raise
        exit()

Submission status: Wrong Answer

Solution code:
# This program computes GCD and LCM
# -*- coding: utf-8
import sys


def gcd(a, b):
    while True:
        tmpb = b
        b = a % b
        a = tmpb
        if(b == 0 or b == 1):
            break
    return int(a)


def lcm(a, b):
    for i in range(max([a, b]), a*b + 1):
        if(i % a == 0 and i % b == 0):
            return i
    return a*b


for i in sys.stdin:
    try:
        line = [int(k) for k in i.split(" ")]
        g = gcd(max(line), min(line))
        print(str(g) + " " + str(line[0]*line[1]/g))  # + str(lcm(line[0], line[1]))
    except:
        raise
        exit()

Submission status: Wrong Answer

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


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

    except EOFError:
        break

Submission status: Wrong Answer

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

def gcd(x,y):
    while y > 0:
        x,y = y,x%y
    return x

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

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

Submission status: Wrong Answer

Solution code:
t = 0
while t == 0:	
	try:
		x,y=[int(i) for i in input().split()]
	except:
		break
	else:
		a = x * y
		if x < y:
			x,y =y,x
		while y > 0:
			r = x % y
			x = y
			y = r
		print(str(x) + " " + str(a/x))

Submission status: Wrong Answer

Solution code:
t = 0
while t == 0:	
	try:
		x,y=[int(i) for i in input().split()]
	except:
		break
	else:
		a = x * y
		if x < y:
			x,y =y,x
		while y > 0:
			r = x % y
			x = y
			y = r
		print(str(a/x) + " " + str(x))

Submission status: Wrong Answer

Solution code:
t = 0
while t == 0:	
	try:
		x,y=[int(i) for i in input().split()]
	except:
		break
	else:
		a = x * y
		if x < y:
			x,y =y,x
		while y > 0:
			r = x % y
			x = y
			y = r
	print(str(x) + " " + str(a / x))

Submission status: Wrong Answer

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

import fileinput

def main():
    for line in fileinput.input():
        tokens = list(map(int, line.strip().split()))
        a, b = tokens[0], tokens[1]

        if a < b:
            a, b = b, a

        ansGCD = GreatestCommonDivisor(a, b)
        ansLCM = LeastCommonMultiple(a, b)

        print('{0} {1}'.format(ansGCD, ansLCM))

def GreatestCommonDivisor(a, b):
    while b:
        a, b = b, a%b

    return a

def LeastCommonMultiple(a, b):
    return (a*b) / GreatestCommonDivisor(a, b)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

while 1:
    try:
        a,b = [int(x) for x in input().split()]
        gcd = gcd(a,b)
        lcm = lcm(a,b,gcd)
        print('{} {}'.format(gcd,lcm))
    except:
        break

Submission status: Wrong Answer

Solution code:
def GCD(a,b):
    while (a % b) != 0:
        a,b = b, a%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:
        break

Submission status: Wrong Answer

Solution code:
import sys 
for e in sys.stdin:
    a, b = map(int, e.split())
    p = a * b
    while b:
        a, b = b, a%b
        pass
    print (str(a)+' '+str(p/a))

Submission status: Wrong Answer

Solution code:
import sys 
for e in sys.stdin:
    a, b = map(int, e.split())
    p = a * b
    while b:
        a, b = b, a%b
        pass
    print (a,p/a)

Submission status: Wrong Answer

Solution code:
while True:
    try:
        a,b,c,d,e,f = [int(x) for x in input().split()]
        x = (c*e-b*f)/(a*e-b*d)
        y = (c*d-a*f)/(b*d-a*e)
        print('{:>.3f},{:>.3f}'.format(x,y))
    except:
        break

Submission status: Wrong Answer

Solution code:
import math
a, b = map(int, input().split())
# 最小公倍数
def lcm(a, b):
    return (a*b) // math.gcd(a ,b)
# 出力　
print(math.gcd(a, b))
print(lcm(a, b))

Submission status: Wrong Answer

Solution code:
import math
a, b = map(int, input().split())
# 最小公倍数
def lcm(a, b):
    return (a*b) // math.gcd(a ,b)
# 出力　

print("{} {}".format(math.gcd(a, b), lcm(a, b)))

Submission status: Wrong Answer

Solution code:
import math
import sys

for line in sys.stdin.readlines():
    a, b = map(int, line.split())
    print(a, b)
# 最小公倍数
def lcm(a, b):
    return (a*b) // math.gcd(a ,b)
# 出力　
print("{} {}".format(math.gcd(a, b), lcm(a, b)))

Submission status: Wrong Answer

Solution code:
import math
import sys

while True:
    try:
        a, b = map(int, input().split())
    except EOFError:
        break
# 最小公倍数
def lcm(a, b):
    return (a*b) // math.gcd(a ,b)
# 出力　
print("{} {}".format(math.gcd(a, b), lcm(a, b)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
while 1:
    try:
        a = list(map(int, input().split()))
        a.sort()
        while a[1]%a[0] != 0:
            a[1] %= a[0]
            a.sort()
        print(a[0])
    except:
        break

Submission status: Wrong Answer

Solution code:
while 1:
    try:
        a = list(map(int, input().split()))
        a.sort()
        while a[1]%a[0] != 0:
            a[1] %= a[0]
            a.sort()
        print(str(a[0]))
    except:
        break

Submission status: Wrong Answer

Solution code:
# Vol0005.
import sys


def intinput():
    a = input().split()
    for i in range(len(a)):
        a[i] = int(a[i])
    return a

def get_gcd(x, y):
    if x < y: return get_gcd(y, x)
    # x >= yのときはx % yを計算してyとx % yの話にする。
    # ここでx % yのところが0ならばyが求める答えとなる。
    if y == 0: return x
    return get_gcd(y, x % y)

def main():
    data = []
    lines = sys.stdin.readlines()
    for line in lines:
        data.append(line.split())

    N = len(data)
    for i in range(N):
        a = int(data[i][0]); b = int(data[i][1])
        gcd = get_gcd(a, b)
        lcm = (a // gcd) * b
        print('%d %d' % (a, b))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    a,b=(int(x) for x in input().split())
    a1=a
    b1=b
    while b!=0:
        c=a%b
        a=b
        b=c
    print(a," ",a1*b1/a)

main()

Submission status: Wrong Answer

Solution code:
def main():
    a,b=(int(x) for x in input().split())
    a1=a
    b1=b
    while b!=0:
        c=a%b
        a=b
        b=c
    print(a," ",a1*b1//a)

main()

Submission status: Wrong Answer

Solution code:
def main():
    a,b=(int(x) for x in input().split())
    a1=a
    b1=b
    while b!=0:
        c=a%b
        a=b
        b=c
    print(a,a1*b1//a)

main()

Submission status: Wrong Answer

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

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

def lcm2(q,w):
  return (q*w)//math.gcd(A,B)

print(math.gcd(a,b),lcm(a,b))
print(math.gcd(A,B),lcm2(A,B))

Submission status: Wrong Answer

Solution code:
# AOJ 0005 GCD and LCM
# Python3 2018.6.9 bal4u

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

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

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

Submission status: Wrong Answer

Solution code:
A , B = map(int,raw_input().split())
a , b = A , B
while a != b:
        if a < b:
                b = b-a
        elif b < a:
                a = a-b
b = A*B/a
print(a,b)

Submission status: Wrong Answer

Solution code:
A , B = map(int,raw_input().split())
a , b = A , B
while a != b:
        if a < b:
                b = b-a
        elif b < a:
                a = a-b
b = A*B/a
print a,b

Submission status: Wrong Answer

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

import sys

def isprime(n):
    for i in xrange(2, int(n ** 0.5)+1 ):
        if n % i == 0: return False
    return True


outList = []
for line in sys.stdin.readlines():
    List = map(int, line.strip().split())

    [a, b] = List

    # LCM
    LCM = 1
    for i in xrange(2, max(a, b)):
        if isprime(i): continue
        if isprime(a) or isprime(b): break
        while(a % i == 0 and b % i == 0):
            LCM *= i
            a /= i
            b /= i

    # GCD
    GCD = List[0] * b

    print LCM, GCD

Submission status: Wrong Answer

Solution code:
import sys
from decimal import *

def readint():
    for line in sys.stdin:
        yield map(int,line.split())

def gcd(x,y):
    [x,y] = [max(x,y),min(x,y)]
    z = x % y
    while z > 0:
        [x,y,z] = [y,z,x % z]
    return y

for [x,y] in readint():
    GCD = gcd(x,y)
    LCM = Decimal(x)*Decimal(y)/GCD
    print "%d %d" % (GCD, LCM)

Submission status: Wrong Answer

Solution code:
import sys

def readint():
    for line in sys.stdin:
        yield map(int,line.split())

def gcd(x,y):
    [x,y] = [max(x,y),min(x,y)]
    z = x % y
    while z > 0:
        [x,y,z] = [y,z,x % z]
    return y

for [x,y] in readint():
    GCD = gcd(x,y)
    mx = x/GCD
    print GCD,mx*y

Submission status: Wrong Answer

Solution code:
import sys

def readint():
    for line in sys.stdin:
        yield map(int,line.split())

def gcd(x,y):
    [x,y] = [max(x,y),min(x,y)]
    z = x % y
    while z > 0:
        [x,y,z] = [y,z,x % y]
    return y

for [x,y] in readint():
    GCD = gcd(x,y)
    mx = x/GCD
    print GCD,mx*y

Submission status: Wrong Answer

Solution code:
import sys

def readint():
    for line in sys.stdin:
        yield map(int,line.split())

def gcd(x,y):
    [x,y] = [max(x,y),min(x,y)]
    while 1:
        z = x % y
        print x,y,z
        if z == 0:
            break
        [x,y,z] = [y,z,x]
    return y

for [x,y] in readint():
    GCD = gcd(x,y)
    mx = x/GCD
    print GCD,mx*y

Submission status: Wrong Answer

Solution code:
def digits(n):
    if n < 10: return 1
    c = 0
    while n > 0:
        c += 1
        n = n // 10

    return c

while 1:
    try:
        inp = input()
    except EOFError:
        break
    else:
        n, m = inp.split(' ')
        n = int(n)
        m = int(m)
        print(digits(n + m))

Submission status: Time Limit Exceeded

Solution code:
import sys
for ab in sys.stdin:
    a,b=map(int,ab.split(" "))
    if a>=b:
        for g in xrange(b,0,-1):
            if a%g==0 and b%g==0:
                gcd = g
                break
        for l in xrange(1,b+1):
            if (a*l)%b == 0:
                lcm = a*l
                break
    else:
        for g in xrange(a,0,-1):
            if a%g==0 and b%g==0:
                gcd = g
                break
        for l in xrange(1,a+1):
            if (b*l)%a == 0:
                lcm = b*l
                break
    print gcd,lcm

Submission status: Time Limit Exceeded

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

while(True):
	try:
		a,b=map(int, input().split())
	except EOFError:
		break
	gcd=1
	for i in range(1, a):
		if(a%i==0 and b%i==0):
			gcd=i
	lcm=int(a*b/gcd)
	print("{0} {1}".format(gcd, lcm))

Submission status: Time Limit Exceeded

Solution code:
import sys


def gcd(a, b, large):
    ret = None
    for i in xrange(large, 0, -1):
        if i == 0 or i == 1:
            continue
        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():
        a, b = [int(n) for n in line.split()]
        if a <= b:
            large = b
        else:
            large = a
        g = gcd(a, b, large)
        l = lcm(a, b)
        print "{0} {1}".format(g, l)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
import sys


def gcd(a, b, large):
    ret = None
    for i in xrange(large, 0, -1):
        if i == 0 or i == 1:
            continue
        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():
        a, b = [int(n) for n in line.split()]
        if a <= b:
            large = b
        else:
            large = a
        print "{0} {1}".format(gcd(a, b, large), lcm(a, b))


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

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 i == 0 or i == 1:
            continue
        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():
        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: Time Limit Exceeded

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():
        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: Time Limit Exceeded

Solution code:
import sys


def gcd(a, b):
    r = None
    if a > b:
        small = a
    else:
        small = b
    for i in xrange(small, 0, -1):
        if a % i == 0 and b % i == 0:
            r = i
    return r


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():
        a, b = [int(n) for n in line.split()]
        print "{0} {1}".format(gcd(a, b), lcm(a, b))


if __name__ == '__main__':
    main()