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;

int SKB(double x, double y, double w){
	double n = (x*y)/w;
	return (int)n;
}

int YUK(int x, int y){
	int c;
		c = x%y;
		if(c == 0){
			return y;
		}else{
			return YUK(y,c);
		}
}

int main(){
	int a, b;

	while( cin >> a >> b ){
		int d;
		if(a >= b){
			d = YUK(a,b);
			cout << d << '\n' << SKB(a,b,d);

		}else{
			d = YUK(b,a);
			cout << d << '\n' << SKB(a,b,d);
		}
		cout << '\n';
	}

	return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;
#define ull unsigned long long

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

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

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

C++: #include<iostream>
using namespace std;
typedef long long llong;
llong gcd( llong x, llong y ){
  //int r;
  llong r;
  
  if ( x < y ) swap( x, y );

  while ( y > 0 ){
    r = x % y;
    x = y;
    y = r;
  }

  return x;
}

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

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

using namespace std;

int main()
{
	long long a,b;
	long long GCD=0,LCM=0;
	long long tmp=0;

	
	while (cin >> a >> b)
	{
		tmp = a%b;
		while (tmp!=0) {
			a = b;
			b = tmp;
			tmp = a%b;
		}
		GCD = b;

		LCM = a*b / GCD;

		cout << GCD <<" "<<LCM<<endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

int a,b;

int gcd(int x,int y);
int lcm(int x,int y);

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

int gcd(int x,int y){
	if(x==0&&y==0)return 0;
	while(x!=y){
		if(x>y)x=x-y;
		else y=y-x;
	}
	return x;
} 

int lcm(int x,int y){
	if(x==0&&y==0)return 0;
	return (x/gcd(x,y))*y;
}

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

int main(){
  int a, b;
  while(cin >> a >> b){

    int max = max(a,b);
    int min = min(a,b);

    int gcd = 0, lcm = 0;

    for(int i = 0; i < min; i++){
        if(max % i == 0) 
          gcd = i;
    }
    
    int j = 1;

    while(1){
      if((max * j) % min == 0){ 
        lcm = max * j; break;
      }
      else{ 
        i++;
      }
    }
    
    cout << gcd << " " << lcm << endl;
  }
}

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

using namespace std;

int a,b;

void search(int t)
{
	int r;
	
	if(r==0)
		return;
	
	if(t==1)
	{
		r=a%b;
		a=r;
		search(t=0);
	}
	else
	{
		r=b%a;
		b=r;
		search(t=1);
	}
	
}
int main()
{
	int a2,b2;
	
	for(;cin >> a;)
	{
		cin >> b;
		a2=a;
		b2=b;
		
		a=max(a2,b2);
		b=min(a2,b2);
		
		search(1);
		
		a=max(a,b);
		
		cout << a << " " << a2*(b2/a) << endl;
	}
}

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

int main(){
	int a,b;
	int gcd,lcm,hoge;
	while(cin >> a >> b){
		if (a > b) {
			hoge = a;
			a = b;
			b = hoge;
		}
		for (int i=1;i < a;i++){
			if (a%i==0 && b%i==0){
				gcd = i;
			}
		}
		for (int j=a;1;j++){
			if (j%a==0 && j%b==0){
				lcm = j;
				break;
			}
		}
		cout << gcd << " " << lcm << endl;
	}
	return 0;
}

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