Go: package main

import (
  "fmt"
)

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

func main() {
  var a,b,c int
  for _, err := fmt.Scan(&a, &b); err == nil; _, err = fmt.Scan(&a, &b) {
    c = gcd(a,b)
    fmt.Println(c, a*b/c)
  }
}

C++: #include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
typedef int long long ll;

using namespace std;
int main(){
    ll a,b;
    while(cin>>a){
        cin>>b;
        if(b>a)swap(b,a);
        ll aa=a,bb=b;
        ll o,p,q;
        while(bb!=0){
            o=bb;
            p=aa%bb;
            aa=bb;bb=p;
        }
        ll i=1;
        while(true){
            i++;
            ll ao=a*i;
            if(ao%b==0){
                q=ao;
                break;
            }
        }
        cout<<o<<" "<<q<<endl;
    }
   
    
    
    
return 0;
}

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

void swap(int& a, int& b) {
	int tmp = a;
	a = b;
	b = tmp;
}

void calcGCD(int& gcd, const int a_, const int b_) {
	int a = a_;
	int b = b_;
	int r = a % b;
	if(r == 0) {
		gcd = b;
	} else {
		a = r;
		if(a < b) {
			// swap to set a >= b
			swap(a, b);
		}
		calcGCD(gcd, a, b);
	}
}

void calcLCM(int& lcm, const int gcd, const int a, const int b) {
	lcm = (int)((double)a * b / gcd);
}

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

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

int gcd(int a,int b){
	while(a != b){
		if(a > b) a -= b;
		else b -= a;
	}
	return a;
}
int lcm (int a,int b){
	return ((a / gcd(a,b)) * b);
}
int main(){
	int x,y;
	while(cin >> x >> y){
		cout << gcd(x,y) << " " << lcm(x,y) << endl;
	}
	return 0;
}

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

using namespace std;

int gcd(int h,int l){
  if(h<l){
    swap(h,l);
  }
  while(h%l){
    h%=l;
    swap(h,l);
  }
  return l;
}

int main(){
  for(int a,b;cin>>a>>b;){
    cout<<gcd(a,b)<<' '<<a/gcd(a,b)*b<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <map>
#include <fstream>
#include <array>
#include <utility>
#include <functional>

using namespace std;
typedef long long Int;
#define REP(i , x) for(int i = 0 ; i < x ; ++i)

typedef pair<int, int> P;

struct gg{ Int v, a, b; };

gg dp[1100][1100];
Int a[1100];
Int b[1100];

Int gcd(Int x, Int y){
	return x%y ? gcd(y, x%y) : y;
}

int main()
{

	Int x, y;
	while (cin >> x >> y){
		Int a = gcd(x, y);
		cout << a << " " << x*y / a << endl;
	}
}

C++: #include "bits/stdc++.h"
using namespace std;
 
long long int gcd(long long int l, long long int r) {
    assert(l > 0 && r > 0);
    if (l > r)return gcd(r, l);
    else {
        const long long int num = r%l;
        if (num) {
            return gcd(l, num);
        }
        else {
            return l;
        }
    }
}
long long int lca(long long int l, long long int r) {
    return l / gcd(l, r)*r;
}
int main() {
    long long int a, b;
    while (cin >> a >> b) {
        cout << gcd(a, b) << " " << lca(a, b) << endl;
    }
    return 0;
}

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

using namespace std;

int main()
{
    long long int num1 , num2, gcd , res, lcm;
    while(scanf("%lld%lld",&num1,&num2)!=EOF){

        res = num1 * num2 ;
        while(num1 != num2){
            if(num1 > num2)
                num1 = num1 - num2 ;
            else
                num2 = num2 - num1 ;
        }
        gcd = num1 ;
        lcm = res / gcd ;
         printf("%lld %lld\n", gcd, lcm);
    }
    return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <list>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cfloat>
#include <climits>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <numeric>
#include <functional>
#include <utility>
#include <iomanip>
#include <iterator>
#include <stack>
#include <limits>
#include <sstream>
#include <fstream>
#include <ostream>
#include <bitset>
#include <queue>
#include <ctime>
#include <utility>

#define ms(a,n) (memset(a,n,sizeof(a)))
#define msv(a,v,n) for(int _a;_a<=n;_a++) a[_a]=v;
#define all(res) res.begin(),res.end()
#define mp(a,b) (make_pair(a,b))
#define pb(n) push_back(n)
#define mod 1000000007

using namespace std;

template<class T1> void deb(T1 e){cout<<e<<'\n';}
template<class T1,class T2> void deb(T1 e1,T2 e2){cout<<e1<<" "<<e2<<'\n';}
template<class T1,class T2,class T3> void deb(T1 e1,T2 e2,T3 e3){cout<<e1<<" "<<e2<<" "<<e3<<'\n';}
template<class T1,class T2,class T3,class T4> void deb(T1 e1,T2 e2,T3 e3,T4 e4){cout<<e1<<" "<<e2<<" "<<e3<<" "<<e4<<'\n';}
template<class T> inline T gcd(T a,T b) {if(a<0)return gcd(-a,b);if(b<0)return gcd(a,-b);return (b==0)?a:gcd(b,a%b);}
template<class T> inline T lcm(T a,T b) {if(a<0)return lcm(-a,b);if(b<0)return lcm(a,-b);return a*(b/gcd(a,b));}

typedef long long ll;
typedef pair< int, int> PII;
typedef vector< int> VI;
typedef vector< vector<int> > VVI;
typedef map< string, int> MSI;

ostream_iterator<int> screen(cout," ");
//copy(all(res),screen);

const int  sz=2*1000*100+10;
const int inf=INT_MAX>>1;
const ll big=(1LL<<62);
const double pi =acos(-1.0);
int dx[]={0,0,1,-1,1,1,-1,-1},dy[]={1,-1,0,0,1,-1,1,-1};
VI res;

ll powermod(ll n,ll p)
{
    ll x=1,y=n%mod;
    while(p)
    {
        if(p&1LL)
            x=(y*x)%mod;
        y=(y*y)%mod;
        p=p>>1LL;
    }
    return x;
}

int main()
{
    //std::ios_base::sync_with_stdio(false);
    ll n,m;
    while(cin>>n>>m)
    {
        cout<<gcd(n,m)<<' '<<lcm(n,m)<<endl;
    }
    return 0;
}

C++: #include <iostream>

int main()
{
    long a, b;
    while (std::cin >> a >> b) {
        if (b > a) {
            long tmp = a;
            a = b;
            b = tmp;
        }

        long m = a;
        long n = b;

        while (n != 0) {
            long tmp = n;
            n = m % n;
            m = tmp;
        }
        std::cout << m << " " << (a * b / m) << std::endl;
    }

    return 0;
}

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

int gcd(int a, int b){
    if(b == 0) return a;
    else return gcd(b, a%b);
}
int main(void){
    int a, b;
    while(cin >> a >> b){
        int s = gcd(a, b);
        cout << s << " " << a*b/s << endl;
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<cstring>
#include<cmath>
#include<vector>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<climits>
#include<algorithm>
#include<functional>
#include<iomanip>
#define LL long long
using namespace std;

int a,b;

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

int main(void){
    while(scanf("%d %d",&a,&b)!=EOF){
        int g=gcd(a,b);
        LL l=(LL)a*b/g;
        printf("%d %lld\n",g,l);
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
 
long long gcd(long long a, long long b)
{
	if (b == 0)return a;
	return gcd(b, a%b);
}
 
long long lcm(long long a, long long b)
{
	return a * b / gcd(a, b);
}
 
 
int main(int argc, char *argv[])
{
	long long a, b;
	while (cin >> a >> b)
	{
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}
 
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
	unsigned long long a,b,c,d,e,f,maxx=0,data,minn=0,o;
	while (scanf("%llu %llu",&a,&b)!=-1){
		data=max(a,b);
		while(maxx==0){
			if (a%data==0 && b%data==0) maxx=data;
			data-=1;
		}
		minn=a*b/maxx;
		cout<<maxx<<" "<<minn<<endl;
		maxx=0;
		minn=0;
	}
	return 0;
}