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 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>

int gcd(int a, int b){
    if(a == b)
        return a;
    else if(a > b)
        a -= b;
    else if(a < b)
        b -= a;
    return gcd(a, b);
}

int lcm(int a, int b){

    return (a / gcd(a, b)) * (b / gcd(a, b)) * gcd(a, b);
}

int main(){
    int a, b;
    scanf("%d%d", &a, &b);
    printf("%d\n%d\n128", gcd(a, b), lcm(a, b));
    return 0;
}

C++: #include <iostream>
#include <stack>
#include <map>
#include <queue>
#include <algorithm>

typedef long long int lli;
#define PI 3.1415926535897932
#define MAX(a,b) ((a>b)?(a):(b)) // ?????§????????????
#define MIN(a,b) ((a<b)?(a):(b)) // ????°?????????????
#define INRANGE(a,b,c) ((a<=b&&b<=c)?(1):(0)) // a<=b<=c??????????????????????????????

int zeller(int y,int m,int d){ // ?????§??????
	if(m<3){y--; m+=12;}
	return (y+y/4-y/100+y/400+(13*m+8)/5+d)%7;
}

lli gcd(lli a,lli b){	// ?????§??¬?´???°
	if(b==0) return a;
	return gcd(b,a%b);
}

lli lcm(lli a,lli b){	// ????°???¬?????°
	return a*b/gcd(a,b);
}

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

C++: #include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
#define pi acos(-1)
#define inf 0x3f3f3f3f
#define lson l,mid,rt<<1
#define rson mid+1,r,rt<<1|1
#define rep(i,x,n) for(int i=x;i<n;i++)
#define per(i,n,x) for(int i=n;i>=x;i--)
using namespace std;
typedef pair<int,int>P;
const int MAXN=100010;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
bool book[1000];
int main()
{
	string s, t;
	cin >> s;
	for(int i = 0; i < s.size(); i++)
	{
		book[s[i]] = 1;
	}
	cin >> s;
	int n;
	cin >> n;
	while(n--)
	{
		cin >> t;
		int i, j;
		bool ok = 1;
		for(i = 0, j = 0; i < t.size() && j < s.size(); i++, j++)
		{
			if(s[j] == t[i]) continue;
			if(s[j] == '?')
			{
				if(book[t[i]])
				continue;
				else
				{
					ok = 0;
					break;
				}
			}
			if(s[j] == '*')
			{
				while(i < t.size() && !book[t[i]] && t.size() - i < s.size() - j) i++;
				i--;
			}
			else
			ok = 0;
		}
		if(j < s.size() || i < t.size() || (j == s.size() - 1 && s[s.size() - 1] == '*'))
		ok = 0;
		if(ok)
		cout << "YES\n";
		else
		cout << "NO\n";
	}
 	return 0;
}

C++: /*
C++ ???????????????????????????????????¬??????
??????AOJ-ITP1??????????????????
*/
#define _USE_MATH_DEFINES

#include <iostream> // ?¨??????\??????
#include <fstream>  // ??????????????\??????
#include <string>   // ???????????¢???
#include <vector>   // ???????????????
#include <cmath>    // ??°??????
#include <iomanip>  // stream???????????¢???
#include <algorithm>// max??¢??°??????

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;        // ????´???°????????????????????????
using std::fixed;         // ???????????????????¨???????????????????????????????
using std::setprecision;  // ?????°????°???°?????\???????????°????????????????????¨????????\???

int main() {
	long long a[2];
	long long tmp;
	long long GCD = 1;
	long long LCM = 1;
	while (cin >> a[0] >> a[1])
	{
		// ????????????????????????
		if (a[0] < a[1]) {
			tmp = a[0];
			a[0] = a[1];
			a[1] = tmp;
		}
		else {}
		// ?????§??¬?´???°????¨????
		for (size_t i = 1; i < a[0]; i++)
		{
			if (a[0] % i == 0 && a[1] % i == 0)
			{
				GCD = i;
			}
		}

		// ????°???¬?????°????¨????
		LCM = a[0] * a[1] / GCD;

		// ??????
		cout << GCD << " " << LCM << endl;
	}
	return 0;
}

C++: 
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <stack>
#include <cctype>
#include <complex>
#include <vector>
#include <algorithm>

using namespace std;


bool solve(){
	int a,b;
	while(cin>>a>>b){
		int lcm, gcd;
		
		for(int i=1; i<=min(a,b); i++){
			if(!(a%i) && !(b%i)) gcd = i;
		}
		lcm = a * (b / gcd);		//()必要。intの範囲のため
		
		cout<< gcd<< " "<< lcm<< endl;
	}

	return true;
}

int main(){
	cout.setf(ios::fixed);
	cout.precision(10);
	solve();

	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int data[2][50];
int answer[2][50];

int gcd(int a,int b){
    int c;
    if(a<b){
        a+=b;
        b=a-b;
        a-=b;
    }
    while(b!=0){
        c=a%b;
        a=b;
        b=c;
    }
    return(a);
}

int main(){
    for(int i=0;i<50;i++){
        cin>>data[0][i]>>data[1][i];
    }
    for(int i=0;i<50;i++){
        answer[0][i]=gcd(data[0][i],data[1][i]);
        answer[1][i]=data[0][i]*data[1][i]/answer[0][i];
    }
    for(int i=0;i<50;i++){
        cout<<answer[0][i]<<answer[1][i];
    }
    cout<<endl;
}

C++: #include <iostream>
using namespace std;
int main(){
int a,b,gcd,lcm,tmp,r;
while(cin>>a>>b){

if(a<b){
tmp = a;
a = b;
b = tmp;
}
r=a%b;
while(r!=0){
a = b;
b = r;
r = a % b;
}
gcd = b;
lcm = (a*b)/gcd;
cout<<gcd<<" "<<lcm<<endl;
}
return 0;
}

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

int main(){
int i = 0;int a = 0;int b = 0;int aa = 0;int bb = 0;
while(!cin.eof()){
cin >> a >> b;
if(a >= b){
aa = b;bb = a;
}
else{
aa = a;bb = b;
}
while(bb != 1){
int c = 0;
c = aa;
aa = bb;
bb = c;
bb = bb%aa;
}
cout << aa << " " << a * b / aa << endl;

}
    return 0;
}

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

unsigned int getGCD(unsigned int a, unsigned int b) { return b ? getGCD(b, a%b) : a; }
int main() {
	unsigned int a, b, gcd;
	while (cin >> a >> b) {
		gcd = getGCD(a, b);
		cout << gcd << " " << a*b/gcd << endl;
	}
	return 0;
}

C++: #include<iostream>

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

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

int main(){
    int a,b;
    while(std::cin >> a >> b){
        if(a == -1 or b == -1)  break;
        std::cin >> a >> b;
        std::cout << gcd(a, b) << " " << lcm(a, b)<< std::endl;
    }
    return 0;
}

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

long gcd(long a,long b){
	while(a!=b){
		if(a>b){
			a-=b;
		}else{
			b-=a;
		}
	}
	return a;
}

int main(){

	long a,b,c;

	while(cin >> a){
		cin >> b;
		c = gcd(a,b);
		printf("%d %d\n",c,a/c*b);
	}
	return 0;
}

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

int main() {
	ios :: sync_with_stdio(false);
	int x, y;
	while(cin >> x >> y) {
		cout << __gcd(x, y) << ' ';
		cout << x / __gcd(x, y) * y << '\n';
	}
	return 0;
}

C++: #include <iostream>

#define MAX(x,y) ((x>y)?x:y)
#define MIN(x,y) ((x>y)?y:x)
int main(void)
{
	while(true)
	{
		int x=0,y=0,product;
		std::cin >> x >> y;
		if(std::cin.eof())
			break;
		product = x*y;
		//ユークリッドの何とか
		while(x && y){
			std::cout << x << y << std::endl;
			if(x>y)
				x = x % y;
			else
				y = y % x;
		}
		std::cout << (int)x << " " << (int)(product/x) << std::endl;//確かGCD*LCMと元の積は等しいはず。
	}
	return 0;
}

C++: #include<stdio.h>

int min(int a,int b){
  int t=a;
  if(t>b) t=b;
  return t;
}

int main(void){
  int a,b,g,l;
  int m;
  char line[100];

  fgets(line,sizeof(line),stdin);
  sscanf(line,"%d %d",&a,&b);

  m=min(a,b);
  int i=m;
  for(i;i>=1;i--){
    if(a%i==0 && b%i==0){
      g=i;
      i=0;
    }
  }

  l=a*b/g;

  printf("%d %d",g,l);
  return 0;
}