Go: package main
import (
	"os"
	"fmt"
	"strconv"
	"bufio"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main(){
	sc.Split(bufio.ScanLines)
	defer out.Flush()

	for sc.Scan(){
		a, b := nextInts()
		x, y := gcd(a, b), lcm(a, b)
		fmt.Fprintf(out, "%d %d\n", x, y)
	}

}

func nextInts()(a, b int){
	s := strings.Split(sc.Text(), " ")
	ra, _ := strconv.Atoi(s[0])
	rb, _ := strconv.Atoi(s[1])
	a = ra
	b = rb
	return
}

func gcd(x, y int) int{
	if x<y{
		gcd(y, x)
	}
	for 0<y{
		r := x%y
		x, y = y, r
	}
	return x
}

func lcm(x, y int)int{
	return (x*y)/gcd(x, y)
}

C++: #include<iostream>

using namespace std;

int main(){
    long a, b;
    cin>> a >> b;
    long A=a, B=b;
    while (a!=b)
    {
        if (a > b){
            a = a - b;
        }
        else{
            b = b - a;
        }
    }
    long gcd = A / a*B;
    cout << a << " " << gcd;

    return 0;
}

C++: #include <iostream>

int gcd(int a, int b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

int main(void) {
    int a;
    int b;
    int g;
    while (std::cin >> a >> b) {
        g = gcd(a, b); 
        std::cout << g << " "; 
        std::cout << (int)((double)a / (double) g * (double)b) << std::endl;
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
using namespace std;

int gcd(long long a, long long b){
  if(max(a, b) % min(a,b) == 0) return min(a,b);
  return gcd(min(a,b), max(a,b)%min(a,b));
}


int main() {
    ios::sync_with_stdio(false);
    long long a, b, g, l;
    while(cin >> a >> b){
      g = gcd(a, b);
      l = (a*b)/g;
      cout << g << " " << l << endl;
    }
    return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <queue>
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
#define LL long long
const int N = 50005;
LL x,y;
LL gcd(LL a, LL b){
    return (b==0?a:gcd(b,a%b));
}
void init(){
}
void solve(){
}
int main(){
    while(cin>>x>>y){
        LL g = gcd(x,y);
        cout<<g<<" "<<x/g*y<<endl;
    }
    return 0;
}

C++: #include <iostream>
int Gcd(int a, int b) // Greatest Common Divisor
{
    if (!a || !b) {
        return 0;
    }
    while (a != b) {
        if (a > b) {
            a -= b;
        } else {
            b -= a;
        }
    }
    return a;
}
int Lcm(int a, int b, int gcd) // Least Common Multiple
{
    if (!a || !b) {
        return 0;
    }
    return (a * b)/gcd;
}
int main()
{
    int a, b, gcd;
    while (std::cin >> a >> b) {
        gcd = Gcd(a, b);
        std::cout << gcd << " " << Lcm(a, b, gcd) << "\n";
    }
}

C++: #include <iostream>
#include <cmath>
using namespace std;

int main() {
	// your code goes here
	long long int a,b;
	long long int miner,maxer;
	while(cin >> a >> b){
		int a2=a,b2=b;
		while(max(a2,b2)%min(a2,b2)!=0){
			if(a2>b2)
			a2=a2-b2;
			else
			b2=b2-a2;
		}
		miner =min(a2,b2);
		cout << miner << " " ;
		cout << a/miner*b << endl;
	}
	return 0;
}

C++: #include <stdio.h>
int gcd(int a, int b);
int main()
{
    long long a, b,g, lcd;
    while(scanf("%lld %lld",&a, &b)==2)
    {
    g =gcd(a,b);
    lcd= (a*b)/g;
    printf("%lld %lld\n", g, lcd);
    }
    return 0;
}
int gcd(int x, int y)
{
    int r;
    while(x!=0)
    {
        r=y%x;
        y=x;
        x=r;
        gcd(x,y);
    }


    return y;
}

C++: #include<cstdio>

using namespace std;

int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a-(a/b)*b);
}

int main(){
	int a,b;
	int g,l;
	int tmp;
	if ( ! (scanf("%d %d",&a,&b) == EOF) ){
		g = gcd(a,b);
		l = a/g*b;
		printf("%d %d",g,l);
	}
}

C++: #include <iostream>
using namespace std;

int gcd(int a, int b){
  return (b>0)? gcd(b,a%b) : a ;
}
int lcm(int a, int b){
  return (a/gcd(a, b)*b);
}

int main(){
  int a, b;
	
  while(cin>>a>>b){
    cout<<gcd(a,b)<<" "<<lcm(a,b)<<endl;
  }
}

C++: #include <iostream>
#include <string>
using namespace std;

int main(){
	int a = 0;
	int b = 0;
	int max = 0;
	int min = 0;
	int d = 1;
	int a_bk = 0;
	int b_bk = 0;

	while (cin >> a >> b) {
		if (a > b) {
			max = b;
			min = a;
		}
		else {
			max = a;
			min = b;
		}

		a_bk = a;
		b_bk = b;
		d = 1;

		for (int c = 2; c <= max ; c++) {
			while(a%c == 0 && b%c == 0) {
				a /= c;
				b /= c;
				d *= c;
				
			}
		}
		cout << d << "\n";

		a = a_bk;
		b = b_bk;

		for (min; min <= 2000000000; min++) {
			if (min%a == 0 && min%b == 0) {
				cout << min << "\n";
				break;
			}
		}
	}


	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
int main(){
	int n = 45000;
	int p[n];
	for(int i=0;i<n;i++) p[i] = 0;
	for(int i=2;i<n;i++){
		if(p[i]==0) for(int j=2;j<n/i;j++) p[i*j] = 1;
	}
	int q[n];
	int c = -1;
	for(int i=2;i<n;i++){
		if(p[i]==0){
			c++;
			q[c] = i;
		}
	}
	long a,b;
	while(cin >> a >> b){
		int t[c],s[c];
		for(int i=0;i<c;i++) t[i] = 0;
		for(int i=0;i<c;i++) s[i] = 0;
		int as = a;
		while(1){
			int temp = as;
			for(int i=0;i<c;i++){
				if(as%q[i]==0){
					s[i]++;
					as = as/q[i];
				}
			}
			if(temp==as) break;
		}
		int at = b;
		while(1){
			int temp = at;
			for(int i=0;i<c;i++){
				if(at%q[i]==0){
					t[i]++;
					at = at/q[i];
				}
			}
			if(temp==at) break;
		}
		long z = 1;
		if(at==as) z = at;
		long y = z;
		cout << z << " " << y << endl;
		for(int i=0;i<c;i++){
			y *= pow(q[i],max(s[i],t[i]));
			z *= pow(q[i],min(s[i],t[i]));
		}
		cout << z << " " << y << endl;
	}
}

C++: #include<cstdio>
#define LL long long
LL gcd(LL a,LL b)
{
	if(!b) return a;
	return gcd(b,a%b);
}
int main()
{
	LL a,b,g;
	while(~scanf("%lld%lld",&a,&b))
	{
		g=gcd(a,b);
		a*=b;
		printf("%lld %lld\n",g,a/g);
	}
}

C++: 

#include<stdio.h>

//----- ユークリッドの互除法を行う関数 -----//

int f_kouyakusuu(int , int , int *);

//----- 最小公倍数を求める関数 -----//

int f_koubaisuu(int , int , int *);


//*****----- main -----*****//

int main(void)
{
	//入力変数2つ
	int x = 0 , y = 0;
	//公約数と公倍数は保存しておかなければならない
	int kouyakusuu = 0 , koubaisuu = 0;

	while (scanf("%d %d" , &x , &y) != EOF)
	{
		koubaisuu = f_koubaisuu(x , y , &kouyakusuu);
		printf("%d %d\n" , kouyakusuu , koubaisuu);
	}

	return 0;
}




//*****----- ユークリッドの互除法を利用する関数 -----*****//

int f_kouyakusuu(int x , int y , int *kouyakusuu)	//最初ｘ＜ｙでもforによって入れ替えられる
{
	//保存変数
	int hozon = 0;

	//割って0になるまで
	while ((hozon = x % y) != 0)
	{
		x = y;
		y = hozon;
	}

	//公約数を保存する
	*kouyakusuu = y;
	//最後に割ったｘを返す
	return y;
}



//*****----- 最小公倍数を求めるプログラム *****-----//

int f_koubaisuu(int x , int y , int *kouyakusuu)
{
	//最初に計算して値を小さくする
	int modoriti = f_kouyakusuu(x , y , kouyakusuu);
	//値がでかいので工夫
	unsigned long long int hozon = x * y;
	hozon = x / modoriti;
	//計算して値を返す
	return hozon * y;
}

C++: #include<iostream>

int gcd(int a, int b){
    while((int remainder = (a % b)) != 0) {
        a = b;
        b = remainder;
    }
    return b;
}

int lcm(int a, int b){
    return ((a / gcd(a, b)) * b);
}

int main(){
    int a,b;
    while(std::cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cmath>
#include<stdio.h>
using namespace std;

int main(){
	long long a, b, c;
	long long x, y;

	while (cin >> a >> b){
		if (a > b){
			x = a;
			y = b;
		}
		else{
			x = b;
			y = a;
		}
		while (x % y != 0){
			y = x % y;
		}

		cout << y << " " << (a * b / y) << endl;
	}
}

C++: #include <iostream>
using namespace std;

int main() {
	int a, b, gcd, lcm;
	while (cin >> a >> b) {
		for (gcd = a;a%gcd != 0 || b%gcd != 0;gcd--);
		lcm = (a / gcd)*(b / gcd)*gcd;
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;

typedef long long int LL;

LL gcd(LL a, LL b) {
  return b != 0 ? gcd(b, a % b) : a;
}
LL lcm(LL a, LL b) {
  return a * b / gcd(a, b);
}

int main(){
	LL a, b;
	while(cin>>a>>b){
		cout<<gcd(a, b)<<" "<<lcm(a, b)<<endl;
	}
	return 0;
}