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 <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);}

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

using namespace std;
int main()
{
	int  a, b,a1,b1,c,c1,g,l;
	cin >> a>>b;
	
	a1 = a;
	b1 = b;
	
	while (1)
	{
		c1 =c ;
		c = abs(a - b);
		if (c==0)
		{
			break;
		}
		
		if (a > b)
		{
			a = c;
			
			c1 = b + c;
		}
		else if (a<b)
		{
			
			b = c;
			
		}
	}
	g = c1;
	l = a1*b1 / g;
	cout << l << " " << g;

	
}

C++: #include<stdio.h>

template <typename T>
T gcd(T a,T b) {
   if(b == 0) return a;
  return gcd(b,a%b); 
}
template <typename T>
T lcm(T a,T b) {
    return a/gcd(a,b)*b;
}


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

    return 0;

}