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 <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
using namespace std;

int main(){
	long a,b,c,ab;
	while(cin >> a >> b){
		ab=a*b;
		while(b!=0){
			a=a%b;
			c=b;b=a;a=c;
		}
		cout << a <<" " <<ab/a<<"\n";
	}
return 0;
}

C++: int gcd(int x,int y){
	if(y==0)return x;
	else return gcd(y,x%y);
}
int main(){
	for(int i=0;i<5;i++){
		int a,b;
		std::cin>>a>>b;
		std::cout<<gcd(a,b)<<" "<<a/gcd(a,b)*b<<std::endl;
		
	}
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <stdint.h>
using namespace std;

template <class T>
T gcd(const T &a, const T &b)
{
  if (b == 0) return a;
  return gcd(b, a % b);
}

template <class T>
T lcm(const T &a, const T &b)
{
  T g = gcd(a, b);
  return a / g * b;
}

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

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

int main(){
   int a, b, tmp, m=0, s=0, ai, bi;
   while(cin >> a >> b){
      ai=a; bi=b;
      while(1){
         if(a<b){
            tmp=a;
            a=b;
            b=tmp;
         }
         if(a%b==0){
            m=b;
            break;
         }else a=a%b;
         
      }
      s=ai*bi/m;
      cout<< m << " " << s << endl;
   }
   return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
int a,b,g,x,y,L,i=0;
while(cin>>a>>b){
x=a;y=b;
while(1){
  if(x<y){y=y-x;}
  else if(x>y){x=x-y;}
  else if(x==y){g=x;break;}
}
L=(a*b)/g;
cout<<g<<" "<<L<<endl;
x=0;y=0;
  ++i;
  if(i==49){break;}
}
  return 0;
}

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

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

int main(){
    int a, b, GCD;
    while(std::cin >> a >> b){
        if(a < b)
            std::swap(a, b);
        GCD = getGCD(a, b);
        std::cout << GCD << " " << (a/GCD) * b <<std::endl;
    }
}

C++: #include <iostream> 
#include<string.h>
#include<stdio.h>
using namespace std;
long long cc( long  long  q, long long  p)
{

	if(q%p==0)
	{
		return p;
	}
	else
	return cc(p,q%p);
}
main()
{
	long long x,y,a[1000],b[1000];
	int i=0;
	while(scanf("%lld%lld",&x,&y)!=EOF)
	{
	  
		 a[i]=cc(x,y);
		 b[i]=x*y/a[i];
	     i++;	
	     
	    
	}
	for(int j=0;j<i;j++)
	{
		printf("%lld %lld\n",a[i],b[i]);
	}
}

C++: 
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <math.h>
#include <utility>
#include <set>
#include <map>
#define INF 100000
using namespace std;
typedef long long int ll;

ll gcd(ll n, ll m){
    if (n>=m) {
        if(n%m>0){
            return gcd(m,n%m);
        }else{
            return m;
        }
    }else{
        return gcd(m,n);
    }
}

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

C++: #include <iostream>

using namespace std;

int gcd(int i, int j);

int main()
{
	
	int i,j;
	while(cin >> i >> j){
		int tmp;
		if(i>j){
			tmp = i;
			i = j;
			j = tmp;
		}
		int ret_gcd, ret_lcm;
		ret_gcd = gcd(i,j);
		ret_lcm = (i*j)/ret_gcd;
		
		cout << ret_gcd << ' ' << ret_lcm <<endl;
		
	}
	return 0;
}

int gcd(int i, int j)
{
	
	if(j == 0){
		return i;
	}else{
		return gcd(j, i%j);
	}
	
}

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++: // B.cpp

#include <iostream>
#include <cmath>

using namespace std;

int gcd(int, int);
int lcm(int, int);

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

	return 0;
}

int gcd(int a, int b) {
	int max, min, res;
	
	res = 1;
	
	if(a > b){
		max = a, min = b;
	}
	if(a < b){
		max = b, min = a;
	}
	while(res) {
		res = max % min;
		max = min;
		min = res;
	}
	return max;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}

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

int gcd(int u, int v)
{
  int r, z;

    if(v > u)
    {
      z = u;
      u = v;
      v = z;
    }

  while((r = u%v) != 0)
  {
    u = v;
    v = r;
  }    
  return v;  
}


int main(void)
{
  int a, b;

  while(scanf("%d %d", &a, &b))
  {      
    printf("%d %d\n", gcd(a,b), b/gcd(a,b)*a);
  }

  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){
    int n, m, a, b, i, j, g;
    
    while(cin >> n >> m){
        a=n;b=m;i=2;j=2;
        while(a!=b){
            if(a<b) a=n*i++;
            else b=m*j++;
        }
        g = n*((float)m/a);
        cout << g << " " << a << endl;
    }
    return 0;
}

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

long int mygcd(long int a, long int b)
{
    if (b == 0) return a;
    if (a < b) return mygcd(b,a);
    return mygcd(a-b,b);
}

int main(void)
{
    long int a,b;

    while(cin >> a)
    {
        cin >> b;
        long int gcd = mygcd(a,b);
        long int lcm = a*b/gcd;

        cout << gcd << " " << lcm << endl;
    }
    return 0;
}

C++: #include <stdio.h>


int main(){

	unsigned long a=0, b=0,i=0,m=0,n=0,B=0;

	while(scanf("%d%d", &a, &b)!=EOF){

		if (a < b){
			i = a;
			a = b;
			b = i;
		}
		B = b;

		while (1){

			if (b == 0){
				printf("0 ");
				break;
			}

			n = a%b;
			if (n == 0){
				printf("%d ", b);
				break;
			}
			m = n;
			n = b%m;
			b = m;
		}
		if (b == 0){
			printf("%d\n", a);
		}
		else{

			m = a / b;/*/公倍数*/
			m = m*B;
			printf("%d\n", m);
		}
	}

	return 0;
}

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

int main()
{
    int a,b,c,d,tmp=0;
    
    while(cin >> a >> b){
        if (a<b) {
            swap(a,b);
        }
        c = a;
        d = b;
        
        while (b) {
            tmp = b;
            b = a % b;
            a = tmp;
        }
        
        cout << a << " " << c*d/a << endl;
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
long long a,b;
void yakusuu (int i,int j){
	while(i>=0){
	     while(i<j){
		       j=j-i;
	      }
	     while(j<i){
		       i=i-j;
	     }
         if(i==j){
		    cout<<i<<" " ;
		    break;
	     }
    }
}
void baisuu (int i,int j){
	for(int m=1;m<=20000000000;m++){
		if(m%i==0&&m%j==0){
			cout<<m<<endl;
			break;
		}
	}
}
int main(){
	while(cin>>a>>b){
	    yakusuu(a,b);
	    baisuu(a,b);
    }
	 
}

C++: //http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0005

#include <iostream>
using namespace std;
#define ll long long
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }


int main() {
	cin.tie(0); ios::sync_with_stdio(false);
	ll a, b;
	while (cin >> a >> b) {
		cout << gcd(a, b) << " " << lcm(a, b) << endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long int ll;

long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }

int main(){
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF){
		cout << GCD(a,b) << " " << a/GCD(a,b)*b << endl;
	}
}