Go: package main

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

func getInputAsInt(in string) (int, int) {
	inArr := strings.Split(in, " ")
	// Atoi(s string) (i int, err error) のerrは捨てる
	val1, _ := strconv.Atoi(inArr[0])
	val2, _ := strconv.Atoi(inArr[1])
	return val1, val2
}

func euclidean(val1, val2 int) (int) {
	surp := 1
	for  {
		surp = val1 % val2
		if surp != 0 {
			val1 = val2
			val2 = surp
		} else {
			break
		}
	}
	return val2
}

func calcLCM(val1, val2, gcd int) (int) {
	return val1/gcd*val2
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	
	for scanner.Scan() {
		val1, val2 := getInputAsInt(scanner.Text())
		gcd := euclidean(val1, val2)
		lcm := calcLCM(val1, val2, gcd)
		fmt.Println(gcd, lcm)
	}
}

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

long GCD(long a,long b);

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


long GCD(long a,long b){
    if(min(a,b)==0){return max(a,b);}
    return GCD(min(a,b),max(a,b)%min(a,b));
}

C++: 
#include <string>
#include <iostream>
#include <sstream>

long long unsigned int __gcd(long long unsigned int a, long long unsigned int b)
{
//    std::cout << "in __gcd\n";
//    std::cout << "a: " << a << "\nb: " << b << '\n';
    if (b % a == 0) {
//        std::cout << "returning " << a << '\n';
        return a;
    } else {
        return __gcd(b % a ,a);
    }
}

long long unsigned int gcd(long long unsigned int a, long long unsigned int b)
{
    if (a > b)
        return __gcd(b, a);
    return __gcd(a, b);
}

long long unsigned int lcm(long long unsigned int a, long long unsigned int b)
{
    return a * b / gcd(a, b);
}

int main(void)
{
    int a, b;
    std::string str;

    while (getline(std::cin, str)) {
        std::istringstream str_s(str);
        str_s >> a >> b;

        std::cout << gcd(a, b) << ' ' << lcm(a, b) << std::endl;
    }
    
    return 0;
}

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

int main(){
  int a,b,ky,kb,t,k;

  for(int n=0;n<50;n++){
    cin>>a;
    cin>>b;
    t=1;
    for(int i=1;i<20000;i++){
      if(a%i==0&&b%i==0){
        a=a/i;
        b=b/i;
        t=i*t;
      }
    }
    k=t*a*b;
    cout<<t<<" "<<k;
  }
  return 0;
}

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

int main(){
	int a, b;
	while(cin >> a >> b){
		cin >> a >> b;
		//find gcd
		int gcd = 0;
		for(int i = 1; i <= max(a, b); i++){
			if(a % i == 0 and b % i == 0) gcd = max(gcd, i);
		}
		//find lcm
		int idx = 0;
		int lcm = 0;
		while(!lcm){
			idx++;
			if(idx % a == 0 and idx % b == 0) lcm = idx;
		}
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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

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

int main() {
    int a, b;
    while (scanf("%d%d", &a, & b) != EOF) {
        int p = gcd(a, b);
        printf("%d %d\n", p, a / p * b);
    }
}

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

using namespace std;

int gcd(int x, int y){ return y == 0 ? x : gcd(y, x % y); }
int lcm(int x, int y){ return x / gcd(x, y) * y; }

int main()
{
	int x, y;
	while (~scanf("%d%d", &x, &y)){
		printf("%d %d\n", gcd(x, y), lcm(x, y));
	}
}

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

int main()
{
	long int a,b,i,k;

	while(cin>>a>>b){
		long int x=1, y=0;	//x最大公約数 y最小公倍数
		long int large ,small;

		//最小公倍数を求める処理
		if(a<b){small=a; large=b;}
		else{small=b; large=a;}
		for(i=large ;y==0 ;i+=large){
			if(i%small==0) y=i;
		}
		
		//最大公約数を求める処理
		long int ans[1000];
		i=2; k=0;
		while(a>i && b>i){
			if(a%i==0 && b%i==0){
				ans[k]=i;
				a/=i; b/=i;
				k++;
			}else{
				i++;
			}
		}
		for(i=0 ;i<k ;i++) x*=ans[i];

		cout<<x<<" "<<y<<endl;
	}
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int main()
{
	lld a,b;
	while(cin >> a >> b)
	{
		lld n = min(a,b);
		lld m = max(a,b);
		lld gcd = 1;
		for(int i = 1; i <= n; i++)
		{
			if (n % i == 0 && m % i == 0)
			{
				gcd = i;
			}
		}
		cout << gcd << endl;
		cout << n * m / gcd << endl;
	}


	return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <queue>
#include <set>
#include <numeric>
#include <cmath>

using namespace std;

typedef long long int lld;

const lld mod = 1e9+7;
const lld INF = 1e9;
//const lld MAXN = 1e9;

int main()
{
	lld a,b;
	while(cin >> a >> b;)
	{
		lld n = min(a,b);
		lld m = max(a,b);
		lld gcd = 1;
		for(int i = 1; i <= n; i++)
		{
			if (n % i == 0 && m % i == 0)
			{
				gcd = i;
			}
		}
		cout << gcd << endl;
		cout << n * m / gcd << endl;
	}


	return 0;
}

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

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

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

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

int main(){
	while(true){
		int a,b;
		cin>a>>b;
		
		if(cin.eof())
			break;
			
		int g=gcd(a,b);
		cout<<g<<' '<<a/g*b<<endl;
	}
	return 0;
}

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

unsigned int yaku( unsigned int x, unsigned int y ){
	while( x != y ){
		if( x > y )			x -= y;
		else if( x < y )	y -= x;
	}
	return x;
}

unsigned int bai( unsigned int x, unsigned int y ){
	unsigned int x0=x, y0=y;
	while( x != y ){
		if( x > y )			y += y0;
		else if( x < y )	x += x0;
	}
	return x;
}

int main(){
	unsigned int a, b;
	string line;
	while(1){
		getline( cin, line );
		sscanf( line.c_str(), "%d %d", &a, &b );
		if( line.size() == 0 ){
			break;
		}

		unsigned int max = yaku( a, b );
		unsigned int min = bai( a, b );
		cout << max << " " << min << endl;
	}
}

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

int main(){
	while(true)
	{
	long long int m,n;
	cin >> m;
	if(cin.eof()) break;
	cin >> n;
	long long int l1 = m, l2 = n;
	while(l1 != l2)
	{
		if(l1 > l2) l1-=l2;
		else l2-=l1;
	}
	long long int gcd = m*n/l1;
	cout << l1 << " " << gcd << endl;
	}
	return 0;
}

C++: #include <cstdio>

using namespace std;

long long int gcd(long long int m,long long int n){
	if(n == 0) return m;
	return gcd(n,m % n);
}

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

C++: #include<cstdio>
#include<iostream>
using namespace std;
long long GCD(long long a,long long b)
{
    if(a==0&&b==0)
        return 0;
    if(a==0) return 1;
    if(b==0) return a;
    else return GCD(b,a%b);
}
int main()
{
    long long x,y;
    while(cin>>x>>y)
    {
        long long ans1=GCD(x,y);
        long long ans2=(x*y)/ans1;
        cout<<ans1<<" "<<ans2<<"\n";
    }
	return 0;
}

C++: gcd(a,b){b==0?a:gcd(b,a%b);}c;main(a,b){while(~scanf("%d%d",&a,&b),c=gcd(a,b))printf("%d %d",c,a/c*b);exit(0);}