Go: package main

import "fmt"

func main() {
	var gcdArr, lcmArr [50]int
	var count int
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		if count == 51 {
			break
		}
		if x < y {
			rep := x
			x, y = y, rep
		}
		gcd := x % y
		lcm := x * y
		for gcd != 0 {
			x, y, gcd = y, gcd, x%y
		}
		gcdArr[count] = y
		lcmArr[count] = lcm / y
		count++
	}
	for i := 0; i < count; i++ {
		fmt.Printf("%d %d\n", gcdArr[i], lcmArr[i])
	}
}

C++: #include <bits/stdc++.h>
using namespace std;

int main(void){
    long long int a,b,tmp;
    while (cin>>a>>b) {
        long long int A=a;
        long long int B=b;
        if (b>a) {
            tmp=b;
            b=a;
            a=tmp;
        }
        while (a%b!=0) {
            tmp=b;
            b=a%b;
            a=tmp;
        }
        cout<<b<<" "<<(A*B/b)<<endl;
    }
}

C++: #include<stdio.h>
int main(){

	long long int a,b,x,y;
	while(~scanf("%lld%lld",&a,&b))
	{
	x=a;
	y=b;
	while(a!=b){
		if(a>b){
			a-=b;
		}
		else{
			b-=a;
		}
	}
	printf("%lld %lld",a,x/a*y);
	return 0;
	}}

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

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

void main(){
	long a,b;
	while(!cin.eof()){
		cin >> a >> b;
		long g = gcd(a,b);
		cout << g << " " << a*(b/g);
	}
}

C++: #include <iostream>

using namespace std;

int gcd(int x, int y)
{
	for(;x;)
	{
		int r = y % x;
		y = x;
		x = r;
	}
	return y;
}

int main()
{
	while(!cin.eof())
	{
		int a, b;
		cin>>a>>b;

		int g = gcd(a, b);
		cout << g << " " << a / g * b << endl;
	}
	return 0;
}

C++: #define _USE_MATH_DEFINES
#include <iostream> 
#include <numeric>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std; 
int main(){
#define int long long
	int a, b, r, x, temp;
	cin >> a >> b;
	x = a*b;
	if (a<b)
	{
	temp = a;
	a = b;
	b = temp;
	}
	r = a%b;
	while (r!=0)
	{
	a = b;
	b = r;
	r = a%b;
	}
	cout << b << " " << x/b << endl;
	return 0;
}

C++: #include<iostream>
using namespace std;
long long gcd(long long x,long long y)
{
    if(y==0)
        return x;
    return gcd(y,x%y);
}
int main()
{
    long long a,b;
    while(cin>>a>>b)
    {
        long long d=gcd(a,b);
        a/=d;
        b/=d;
        long long l=a*b*d;
        cout<<d<<" "<<l<<endl;
    }
}

C++: #include <iostream>

int get_GCD(u_int a, u_int b)
{
    while(a != 0 && b != 0){
        if(a >= b)
            a %= b;
        else
            b %= a;
    }
    return a != 0 ? a : b ;
}

inline int get_LCM(const u_int a, const u_int b, const u_int GCD)
{
    return a * (b / GCD);
}

int main()
{
    u_int a, b, GCD;
    while(std::cin >> a >> b){
            GCD = get_GCD(a, b);
            std::cout << GCD << " " << get_LCM(a, b, GCD) << std::endl;
    }    

    return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<double, int>;

int main() {
    int a, b;
    while(cin >> a >> b) {
        int g = __gcd(a, b);
        cout << g << ' ' << a / g * b << endl;
    }
}

C++: #include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
using namespace std;
static const double EPS = 1e-5;

int GetGCD(int m, int n){
	if(n == 0){
		return m;
	}

	return GetGCD(n, m%n);
}

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

int main(){
	int a, b;
	int g, l;

	while(cin >> a >> b){

		if(a > b){
			g = GetGCD(a, b);
		}else{
			g = GetGCD(b, a);
		}

		l = GetLCM(a, b, g);
		cout << g << ' ' << l << endl;
	}

	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int a, int b) {
	if (b == 0) { return a; }
	return gcd(b, a%b);
}
int main() {
	long long a, b, c,d,e,A,B,C;
	c = 9;
	d = 9;
	e = 9;
	C = 9;
	while (cin >> a >> b) {
		if (a < b) { swap(a, b); }
		A=gcd(a, b);
		C = a*b / A;
		cout << A << ' ' << C << endl;
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main()
{
	long i,g,j,ti,tj;
while(cin>>i>>j)
{
	g=-1;ti=i;tj=j;
	while(g==-1)
	{
	if(i<j){j=j-i;}
else if(i>j){i=i-j;}
else if(i=j){g=i;}
else if (i==0){g=j;}
else if(j=0){g=i;}
	}
cout<<g<<" ";
cout<<ti/g*tj<<endl;
}


return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{int a, b, c = 0;while (cin >> a, cin >> b){for (int i = 1; i <= a, i <= b; i++){if (a % i == 0 && b % i == 0){c = i;}}cout << c << " " << a*b / c << endl;}return 0;}

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

int main()
{
	long a,b;
	while(cin>>a>>b)
	{
		long numerator=min(a,b);
		long denominator=max(a,b);
		long remainder = a % b;
		while(remainder !=0)
		{
			 numerator   = denominator;
			denominator = remainder;
			remainder   = numerator % denominator;
		}
		long gcd = denominator;
		long long lcm = a * (b / gcd);
		cout<<gcd<<" "<<lcm<<endl;
	
	}
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;

ll gcd(ll a, ll b) { return (b ? gcd(b, a % b) : a); }
ll lcm(ll a, ll 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>
using namespace std;
int Gcd(int a,int b){
    int r=-1;
    int temp;
    if(a<b){
        temp = a;
        a = b;
        b = temp;
    }
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}

int main(){
    int a,b;
    int gcd;


    while(cin>>a>>b){
        gcd = Gcd(a,b);
        a=a/gcd;
        b=b/gcd;

        printf("%d %d\n",gcd,gcd*a*b);
    }

    return 0;
}

C++: #include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int gcd(int x, int y) {
    if(y == 0) return x;
    return gcd(y, x%y);
}

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

int main(){
    int a, b, g, l;

    while (cin >> a >> b) {
        g = a > b ? gcd(a, b) : gcd(b, a);
        l = a > b ? lcm(a,b,g) : lcm(b,a,g);

        cout << g << " " << l << endl;
    }

    return 0;
}

C++: #include <iostream>
using namespace std;
int main()
{int a, b, c = 0;while (cin >> a, cin >> b){for (int i = 1; i <= a, i <= b; i++){if (a % i == 0 && b % i == 0){c = i;}}cout << c << " " << a*b / c << endl;}return 0;}

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

int main(){
	int a, b;
	int multi;

	while(cin >> a >> b){
		multi = a*b;

		if(a<b){
			swap(a, b);
		}

		for(; b != 0;){
			int t;
			t = b;
			b = a % b;
			a = t;
		}

		cout << a << ' ' << multi/a << endl;
	}

	return 0;
}

C++: #include <iostream>
using namespace std;
int main() {
	int a,b,e,f;
	while(cin>>a>>b){
		int l=0;
		e=a;
		f=b;
		if(e>f){
			e=e%f;
		}
	    if(f>e){
	    	f=f%e;
	    }
	    if(f==e){
	    	l=e;
	    }
	    if(f==e) break;
		cout<<l<<" "<<(a*b)/l<<endl;
	    }
	return 0;
}

C++: #include <iostream>

using namespace std;

typedef long long llong;

int GCD(const llong& a, const llong& b) {
	llong g_a = a;
	llong g_b = b;
	if (a == 0 || b == 0)
		return 0;
	while (a != b)
	{
		if (a > b) 
			g_a -= g_b;
		else 
			g_b -= g_a;
	}
	return g_a;
}

int LCM(const llong& a, const llong& b) {
	llong l_a = a;
	llong l_b = b;
	if (a == 0 || b == 0)
		return 0;
	return ((l_a / GCD(l_a, l_b)) * l_b);
}

int main() {
	llong a, b;
	while (cin >> a >> b) {
		cout << GCD(a, b) << " " << LCM(a, b) << endl;
	}
	return 0;
}

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

int main(void){
  int x,y,g,l,t;
  while(cin >> x >> y){
    if(x<y)
      swap(x,y);
    g=__gcd(x,y);
    l=x*y/g;
    cout << g << " " << l <<endl;
  }
  return 0;
}