Go: package main

import "fmt"

func main() {
	for {
		var x, y int
		fmt.Scanf("%d %d", &x, &y)
		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
		}
		fmt.Printf("%d %d\n", y, lcm/y)
	}
}

C++: #include<iostream>
using namespace std;
int GCD(int n,int m){
  if(n<m){
    int t;
    t = m;
    m = n;
    n = t;
  }
  int i;
  while(n%m != 0){
    i = n%m;
    n = m;
    m = i;
  }
  return m;
    
}
int main(){
  int n,m,i=0,a[50],b[50];
  while(cin >> n >> m){
    a[i] = GCD(n,m);
    b[i] = n*m/GCD(n,m);
    i++;
    n = 0;
    m = 0;
  }
  for(n=0;n<i+1;n++) cout << a[n] << " " << b[n] << endl;
  return 0;
}

C++: #include<iostream>

using namespace std;

//Euclidean algorithm
int gcd(long m, long n)
{
	long t;
	while (m != 0) {
		t = m, m = n % m, n = t;
	}
	return n;
}

//gcd(a, b) * lcm(a, b) = a * b
int lcm(long n, long m) {
	return n * m / gcd(n, m); 
}



int main(){
	long n, m;
	
	while(cin >> n >> m) {
		cout << gcd(n, m) << " " << lcm(n, m);
	}

	return 0;
}

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

unsigned GCD(unsigned a, unsigned b)
{
	unsigned small = (a<b)?a:b;
	unsigned gcd=1;
	for(unsigned i=2; i<=small; ++i)
	{
		if(a%i==0 && b%i==0)
		{
			gcd = i;
		}
	}
	return gcd;
}

unsigned LCM(unsigned a, unsigned b)
{
	unsigned large = (a<b)?b:a;
	for(unsigned i=large; i<2000000000; ++i)
	{
		if(i%a==0 && i%b==0)
		{
			return i;
		}
	}
}

int main()
{
	double a,b;
	while(cin>>a>>b)
	{
		cout << GCD(a,b) << ' ' << LCM(a,b) << '\n';
	}
}

C++: #include<iostream>

int main(){
	long int a, b, r;
	
	while(std::cin >> a >> b){
		long int product = a*b;
		
		// GCD
		if(a < b){
			long int temp = a;
			a = b;
			b = temp;
		}
		while((r = a%b) != 0){
			a = b;
			b = r;
		}
		
		// LCM
		long int lcm = product / b;
		
		// show
		std::cout << b << lcm << std::endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define iREP(i,Itr) for(auto (i)=(Itr).begin();(i)!=(Itr).end();(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define PB_VEC(Itr1,Itr2) (Itr1).insert((Itr1).end(),(Itr2).begin(),(Itr2).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

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(){
    
    ll a,b;
    while(cin>>a>>b){
        cout<<gcd(a,b)<<lcm(a,b)<<endl;
    }
    
    return 0;
}

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

int main() {
	
	int a,b,M,m,g;
	
	while(cin>>a>>b){
		if(a>b){M=a;m=b;} else{M=b;m=a;}
		for(int i=1;i<=M;i++){
			if(M%i==0&&m%(M/i)==0){g=M/i;break;}
			}
		cout<<g<<" "<<a/g*b<<endl;
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int gcd(int x, int y);  // ?????§??¬?´???°????±?????????¢??°
int lcm(int x, int y);  // ????°???¬?????°????±?????????¢??°

int main()
{
	int x, y;
	while (cin >> x >> y){
	cout << gcd(x, y) << " " << lcm(x, y) << endl;
	}

	return 0;
}

// ?????§??¬?´???°????±?????????¢??°
int gcd(int x, int y)
{
	int r;

	if (x == 0 || y == 0)  // ?????°?????§??????
	{
		fprintf(stderr, "?????°??¨????????§??????\n");
		return 0;
	}

	// ????????°?????????????????????
	while ((r = x % y) != 0) // y??§????????????????????§?????????
	{
		x = y;
		y = r;
	}
	return y;
}

// ?????§??¬?´???°????±?????????¢??°
int lcm(int x, int y)
{
	if (x == 0 || y == 0)  // ?????°?????§??????
	{
		fprintf(stderr, "?????°??¨????????§??????\n");
		return 0;
	}

	return (x * y / gcd(x, y));
}

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

int main(){
	long a, b, dmy, t, gcd, lcm;
	while( scanf("%d%d",&a,&b)!=EOF ){
		t=a*b;
		while(a!=b){
			while(a>b) a-=b;
			while(a<b) b-=a;
		}
		gcd=a;

		lcm=t/gcd;
		printf("%d %d\n",gcd, lcm);
	}
 return 0;
}

C++: /* -*- coding:utf-8 -*- */

#include <iostream>

using namespace std;

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

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

int main()
{
  long a, b;
  while(cin >> a >> b, !cin.eof()) 
    cout << gcd(a,b) << ' ' << lcm(a,b) << endl;
  
  return 0;
}

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

long long GCD (long long a, long long b)
{
    /*long long t;
    if (a>b) swap(a,b);
    while (1)
    {
        t=b%a;
        if (t==0) break;
        b=a;
        a=t;
    }
    return a;*/
    if (a%b==0) return b;
    else if (b%a==0) return a;
    else if (a>b) return GCD(a%b,b);
    else return GCD(b%a,a);
}

int main()
{
    long long a,b,gcd[50],lcm[50],c=0;
    while (cin>>a>>b)
    {
        gcd[c]=GCD(a,b);
        lcm[c]=a*b/gcd[c];
        c++;
    }
    for (int i=0; i<c; i++) cout<<gcd[i]<<" "<<lcm[i]<<'\n';
    return 0;
}

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

int gcd(int a, int b){

int p,q,r;

if(a<b){p=b;b=a;a=p;

}

   while((r=b%a)!=0){
  q=b/a;
  b=a;
  a=r;
  }
  return a;
  
}

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

C++: #include<bits/stdc++.h>
#include<vector>
#include<list>
#include<stack>
#include<queue>
#include<algorithm>
using namespace std;

//typedef int kz;
//typedef long kz;
typedef long long kz;

kz gcd(kz a,kz b) { if(b==0) return a; else gcd(b,a%b); }
kz lcm(kz a,kz b) { return a*b/gcd(a,b); }

/**
 * vector<int>ar(3);
 * for(auto&e:ar){
 *     scanf("%d",&e);
 * }
 * sort(ar.begin(),ar.end())
 * int sum=accumulate(ar.begin(),ar.end(),0);
 **/


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

C++: #include<iostream>
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"
using namespace std;

char a[20][20];

int main()
{
	int w,h;
	int b,c;
	
	int z=0;
	while(1)
	{
		int i,j;
		cin>>w>>h;
		if(w==0&&h==0)break;
		for(i=0;i<w;i++)
			for(j=0;j<h;j++)
			{
				cin>>a[i][j];
				if(a[i][j]=='@')
				{
					b=i;
					c=j;
				}
			}
			for(i=b;i<w;i++)
				for(j=c;j<h;j++)
				{
					if(a[i][j]!='@'&&a[i][j]!='#'&&(a[i-1][j]=='@'||a[i][j-1]=='@'))
					{
						a[i][j]='@';
						z++;
						
					}
				}
				for(i=b;i<w;i++)
					for(j=c;j>=0;j--)
					{
						if(a[i][j]!='@'&&a[i][j]!='#'&&(a[i-1][j]=='@'||a[i][j+1]=='@'))
						{
							a[i][j]='@';
							z++;
						}
					}
				for(i=b;i>=0;i--)
					for(j=c;j>=0;j--)
					{
						if(a[i][j]!='@'&&a[i][j]!='#'&&(a[i+1][j]=='@'||a[i][j+1]=='@'))
						{
							a[i][j]='@';
						    z++;
						}
					}
				for(i=b;i>=0;i--)
					for(j=c;j<h;j++)
					{
						if(a[i][j]!='@'&&a[i][j]!='#'&&(a[i][j-1]=='@'||a[i+1][j]=='@'))
						{
							a[i][j]='@';
							z++;
						}
					}
					
					cout<<z<<endl;
    
	}
	return 0;
}