Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func gcd(num1, num2 int) int {
	if num2 == 0 {
		return num1
	}
	num3 := num1 % num2
	return gcd(num2, num3)
}

func lcm(num1, num2 int) int {
	if num1%num2 != 0 {
		num3 := gcd(num1, num2)
		for i := 1; ; i++ {
			check := num3 * i
			if check%num1 == 0 && check%num2 == 0 {
				return check
			}
		}
	} else {
		return num1
	}
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		row := strings.Fields(scanner.Text())
		nums := []int{}

		for _, v := range row {
			num, _ := strconv.Atoi(v)
			nums = append(nums, num)
		}
		fmt.Println(gcd(nums[0], nums[1]), lcm(nums[0], nums[1]))
	}
}

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

using namespace std;


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

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

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

C++: #include<iostream>
using namespace std;
int main(){
  long long  a,b;
  while(cin>>a>>b){
    //Eucledean algorithm                                                                                                     
    long long c,d,r,GCD,LCM;
    c=a;d=b;
    do{
      r=c%d;
      c=d;d=r;
    }while(r);
    GCD=c;
    LCM=a*b/GCD;
    cout << GCD << ' ' << LCM <<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    long long a,b,i,f,j;
    while(cin>>a>>b){
    for(i=20000000;i>0;i--){
        if(a>=2000000000||b>=2000000000||a<1||b<1){
            break;
        }
        if(a%i==0&&b%i==0){
            f=a*b/i;
            cout<<i<<" "<<f<<endl;
                break;
        }
    }
    }
    return 0;
}

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

#define iota(i,n,b,s) for(int i=int(b);i!=int((b)+(s)*(n));i+=(s))
#define range(i,n,m) iota(i,(((n)>(m))?((n)-(m)+1):((m)-(n)+1)),(n),((n)>(m)?-1:1))
#define rep(i,n) iota(i,(n),0,1)

#define INF (1e9)
#define EPS (1e-9)
#define cons(a,b) (make_pair(a,b))
#define car(a) (a.first)
#define cdr(a) (a.second)
#define cadr(a) (car(cdr(a)))
#define cddr(a) (cdr(cdr(a)))
#define all(a) a.begin(), a.end()
#define trace(var) cerr<<">>> "<<#var<<" = "<<var<<endl;

typedef long long Integer;
typedef double Real;

template<class S, class T>
ostream& operator<<(ostream& os, pair<S,T> p) {
  os << '(' << car(p) << ", " << cdr(p) << ')';
  return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> v) {
  os << v[0];
  for (int i=1, len=v.size(); i<len; ++i) os << ' ' << v[i];
  return os;
}

int dx[] = { -1, 0, 1, 0 };
int dy[] = {  0, -1, 0, 1 };

int main() {

  for (Integer a, b; cin >> a >> b, cin; ) {
    Integer x = max(a,b);
    Integer y = min(a,b);
    while (y > 0) {
      x %= y;
      Integer t = x;
      x = y;
      y = t;
    }
    //cerr << cons(a,b) << ' ' << cons(x, y) << endl;
    cout << x << ' ' << (a / x * b) << endl;
  }

  return 0;
}

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

int main(){
  bool is_prime[1000000];

  is_prime[0]=is_prime[1]=false;
  for(int i=2; i<1000000; i++){
    is_prime[i]=true;
  }

  for(int i=2; i*i<1000000; i++){
    if(is_prime[i]){
      for(int j=i*i; j<1000000; j+=i){
        is_prime[j]=false;
      }
    }
  }

  int n_prime[1000000];
  int cnt=0;

  for(int i=0; i<1000000; i++){
    if(is_prime[i]){
      cnt++;
    }
    n_prime[i]=cnt;
  }

  while(true){
    int n;
    cin >> n;

    if(cin.eof())
      break;

    cout << n_prime[n] << endl;
  }

  return 0;
}

C++: #include <iostream>

using namespace std;

typedef unsigned long long ull;

int main()
{
	ull a, b, t;
	while(!cin.eof())
	{
		cin >> a >> b;
		ull M = max(a, b);
		ull m = min(a, b);
		while(m != 0)
		{
			t = M % m;
			M = m;
			m = t;
		}

		printf("%llu %llu\n", M, a * b / M);
	}
}

C++: #include<stdio.h>
main(a,b){while(scanf("%d%d",&a,&b))printf("%d %d\n",__gcd(a,b),__gcd(a,b)*b);
}

C++: #include <iostream>
int gcd(int a, int b)
{
  while (1) {
    if (b == 0) {
      return a;
    }
    int temp = b;
    b = a % b;
    a = temp;
  }
}

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

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

C++: #include<stdio.h>



//公約数
long long int kouyakusuu_f(const long long int *a,const long long int *b)
{
	long long int hozon1 = *a,hozon2 = *b;
	//怖いからここでiを宣言
	long long int i = 0;

	//お互いを割って０なら小さいほうを返す(6と１２　高速道路)
	if (hozon1 % hozon2 == 0)
	{
		return hozon2;
	}
	if (hozon2 % hozon1 == 0)
	{
		return hozon1;
	}
	//それでも駄目なら小さいほうを２で割る
	if (hozon1 < hozon2)
	{
		i = hozon1 / 2;
	}
	else
	{
		i = hozon2 / 2;
	}


	while (1)
	{
		if (hozon1 % i == 0 && hozon2 % i == 0)
		{
			return i;
		}
		//２個ずつ減らす
		i -= 2;
	}

}





//公倍数
long long int koubaisuu(const long long int *a,const long long int *b)
{
	long long int hozon1 = *a,hozon2 = *b;
	long long int cnt1 = 1,cnt2 = 1;

	//保存１を保存２で割ると０のとき
	if (hozon1 % hozon2 == 0)
	{
		return hozon1;
	}
	//保存２を保存１で割ると０のとき
	if (hozon2 % hozon1 == 0)
	{
		return hozon2;
	}
	
	//合うまで回す
	while (1)
	{
		if (hozon1 == hozon2)
		{
			return hozon1;
		}
		while (hozon1 < hozon2)
		{
			cnt1++;
			hozon1 = *a * cnt1;
		}
		while (hozon1 > hozon2)
		{
			cnt2++;
			hozon2 = *b * cnt2;
		}
	}

	return hozon1;
}




int main(void)
{
	//入力変数
	long long int a = 0,b = 0;
	//出力変数
	long long int ans1 = 0, ans2 = 0;

	//回す
	while (scanf("%lld %lld",&a,&b) != EOF)
	{
		//計算してもらう(公約数)
		ans1 = kouyakusuu_f(&a,&b);
		//次は公倍数
		ans2 = koubaisuu(&a,&b);
	
		//表示
		printf("%lld %lld\n",ans1,ans2);
	}


	return 0;
}

C++: #include<stdio.h>
long long  GCD(long long m,long long n)
{
    long long t,r;
    if(n>m)
   {
   	t=m;
   	m=n;
	n=t;
	}
	while(n!=0)
	{
		r=m%n;
		m=n;
		n=r;
	}
	return m;
}
long long LCM(long long m,long long n)
{
    long long num;
    num=(n*m)/GCD(m,n);
    return num;
}
int main()
{
    long long n,m;
    while(scanf("%d%d",&n,&m)!=EOF)
    {
        printf("%d %d\n",GCD(m,n),LCM(m,n));
    }
    return 0;

}

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

typedef long long ll;

ll gcd(ll a, ll b){
return a != 0 ? gcd(b % a, a) : b;
}

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

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

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

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


int main()
{
	int a, b;
	while(cin>>a>>b)
	{
		int i = a;
		while (a%i != 0 || b % i != 0)
			i--;
		int j = a;
		while (j%a != 0 || j % b != 0)
			j++;
		cout << i << " " << j << endl;
	}
    return 0;
}

C++: #include <stdio.h>

int main(){

    int buf1[50],buf[50];

    int k = 0;
    while( scanf( "%d %d",&buf1[k],&buf2[k] ) != EOF ) k++;

    for( int i = 0;i < k;i++ ){
        int b1 = buf1[i],b2 = buf2[i];
        int m,n;
        if( b 1< b2 ){
            m = b2,n = b1;
        } else if( b1 > b2 ){
            m =  b1,n = b2;
        } else printf( "%d ",b2 );

        while( true ){
            int buf = n;
            n = m % n;
            m = buf;
            if( n == 0 ){
                printf( "%d\n",m );
                break;
        }
        while( b1 != b2 ){
            if( b1 < b2 ) b1 += buf1[i];
            else             b2 += buf2[i];
        }
        printf( "%d\n",b1 );
    }
    reutrn 0;
}