Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"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() {
		x, y := nextInts()
		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
		}
		fmt.Fprintf(out, "%d %d\n", y, lcm/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
}

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

int gcd(int x, int y)
{
	if (x == 0 | y == 0) return 0;
	
	while (x != y) {
		if (x > y) x -= y;
		else y -= x;
	}
	
	return x;
}

int lcm(int x, int y)
{
	if (x == 0 | y == 0) return 0;
	
	return x / gcd(x, y) * y;
}

int main()
{	
	int x, y;
	
	while(cin >> x >> y) 
		cout << gcd(x, y) << " " << lcm(x, y) << endl;
	
	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int gcd(int a, int b)
{ 
    int r;  
    while((r = a % b) != 0)  
    {      
        a = b;    
        b = r;
        }  
return b
;}
int main(void)
{  
    int a, b, tmp;  
    if (a < b){     
        tmp = b;
        b = a;
        a = tmp;   
        } 
        while(cin >> a >> b) {  
            int lcm = b / gcd(a,b)*a;   
            cout << gcd(a,b) << " " << lcm << endl;    
            
        }   
return 0;
    
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cassert>
#include <vector>
#include <string>
#include <cmath>
#include <map> 
#include <sstream>
#include <cstdio>
#include <complex>
#include <cstring>
using namespace std;
 
const int MAX= 10000100;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()
#define ll long long int
#define gcd(a,b) __gcd(a,b)
#define pb(a) push_back(a)
int GCD(int a, int b) {if(!b) return a; return gcd(b, a%b);}
int lcm(int a, int b) {return a*b / gcd(a, b);}

int main(void){
  unsigned long long int a,b;
  while(cin>>a>>b)
  cout<<__gcd(a,b)<<" "<<(a*b)/__gcd(a,b)<<endl;
}

C++: #include<iostream>
#include<stdio.h>

using namespace std;

int max(int x, int y){
        int r;

        while((r = x % y) != 0){
                x = y;
                y = r;
        }
        return y;
}

long long int small(int x, int y, int r){
        if(x * y % r  == 0)
                return x * y / r;
        else
                return (long long int)x * y;
}       

int main(){
        int x,y,r;

        while((scanf("%ld %ld",&x,&y)) != EOF){
                if(x < y){
                        int num = y;
                        y = x;
                        x = num;
                } 
                cout << max(x,y) << " " << small(x,y,max(x,y)) << endl;
        }
}

C++: #include <iostream>
#include <cstdio>
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<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define rp(a) while(a--)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
bool h[1000010]={false};
int main(){
	ll a,b;
	while(cin>>a>>b){
		cout<<__gcd(a,b)<<" "<<a*b/__gcd(a,b)<<endl;
	}
}

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

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

    }
}

C++: 













































File Edit Options Buffers Tools C++ Help
const int MAX = (int)1e5 + 5;

template<typename T>
T gcd(T a, T b)
{
        T c;
        while (a != 0) {
                c = a; a = b%a;  b = c;
        }
        return b;
}

template<typename T>
T lcm(T m, T n)
{
        return ((m / gcd(m, n)) * n);
}

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

C++: #include <iostream>

using namespace std;

int gcd(int a, int b){
	if((0 == a) || ( 0 == b)) return 0;
	
	while( a != b){
		if( a > b) a = a - b;
		else       b = b - a;
	}
	return a;
}

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

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

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int a, b, s, t, c;
	while(cin >> a >> b){
		s = a;
		t = b;
		c = 1;
		for(int tmp = (a > b)? b : a, i = 2; i <= tmp; i++){
			while(s%i == 0 && t%i == 0){
				s /= i;
				t /= i;
				tmp /= i;
				c *= i;
			}
		}
		cout << c << " " << (a/c*b) << endl;
	}
	
	return 0;
}

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

int main()
{
	int a, b, temp;
	int a0, b0;
	int a1, b1;
	int gcd, lcm;
	
	while (cin >> a >> b) {
		if (a > b) {
			temp = a;
			a = b;
			b = temp;
		}
		a0 = a;
		b0 = b;
		while (a0) {
			temp = b0 % a0;
			b0 = a0;
			a0 = temp;
		}
		gcd = b0;
		a1 = a;
		b1 = b;
		while (a1 != b1) {
			if (a1 < b1)
				a1 += a;
			else if (a1 > b1)
				b1 += b;
		}
		lcm = a1;
		cout << gcd << " " << lcm << "\n";
	}
	return 0;
}

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

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)

int gcd(int a,int b)//O(log max(a,b)) 
{
    if(b == 0) return a;
    return gcd(b, a%b);
}

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

}

C++: #include <bits/stdc++.h>
#ifdef dbg
#include "./printer.hpp"
#else
#define dump(x) void(0)
#endif

#define MOD 1000000007
using namespace std;
#define ll long long
inline long  toInt(string s) {long  v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

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

C++: #include <iostream>
#include <algorithm>

using namespace std;

typedef long long int llongi;

int GCD(const int& a, const int& b) {
	if (b == 0) {
		return a;
	}
	GCD(b, a%b);
}

int main() {
	int a, b;
	int gcd;
	while (cin >> a >> b) {
		a = max(a, b);
		b = min(a, b);
		gcd = GCD(a, b);
		cout << gcd << " " << a * b / gcd << endl;
	}
	return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>

int main()
{
  log long int num1,num2,num;
  while(scanf("%lld %lld",num1,&num2)!=EOF){
  num=num1*num2;
  while(num1 !=num2)
  if(num1>num2)
  num1=num1-num2;
  else
  num2=num2-num1;
  }
  printf("%lld %dll\n",num1,num/num1);
  return 0;
}