Go: package main

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

var sc = bufio.NewScanner(os.Stdin)

//Sliceconvtoi ...
func Sliceconvtoi() []int {
	strs := strings.Split(sc.Text(), " ")

	var ints []int
	var x int

	for _, s := range strs {
		x, _ = strconv.Atoi(s)
		ints = append(ints, x)
	}

	return ints
}

//Min .
func Min(a, b int) int {
	switch a < b {
	case true:
		return a
	default:
		return b
	}
}

//GCDandLCM .
func GCDandLCM(i []int) (int, int) {
	a := i[0]
	b := i[1]

	for {
		if a == b {
			break
		} else {
			a, b = Min(a, b), int(math.Abs(float64(a-b)))
		}
	}

	return a, i[0] * i[1] / a
}

func main() {
	for sc.Scan() {
		i := Sliceconvtoi()
		g, _ := GCDandLCM(i)
		fmt.Println(g)
	}

}

C++: 
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int DX[] = {0, 1, 0, -1};
const int DY[] = {-1, 0, 1, 0};


//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(int argc, char const *argv[])
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int a, b;
	while(!cin.eof() && cin >> a >> b){
		if(b > a){
			int temp = b;
			b = a;
			a = temp;
		}
		while(b > 0){
			int z  = a % b;
			a = b;
			b = z;
		}
		cout << a << endl;
	}
	
	return 0;
}

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

int main()
{
	int m,n;
	
	while (scanf("%d %d", &m, &n) != EOF){
		
		if(m < n) swap(m,n);
	
		while(n != 0){
			int t=n;
			n = m%n;
			m = t;
		}
	
		printf("%d\n", m);
	}
	return (0);
}

C++: #include<stdio.h>
int main(){
  int x,y;
  for(;scanf("%d%d",&x,&y)>0;){
    for(;y!=0;){
      int r=x%y;x=y;y=r;
    }
    printf("%d\n",x);
  }
}

C++: package com.practice.takuya._1009;

import java.io.BufferedReader;
import java.io.InputStreamReader;




public class Main {
	public static void main(String[] args) {
		try {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String line = br.readLine();
			
			System.out.println(getGreatestCommonDivisor(line));
			
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private static int getGreatestCommonDivisor(String line) {
		
		String[] splitedArray = line.split(" ", 0);
		int x = Integer.valueOf(splitedArray[0]).intValue();
		int y = Integer.valueOf(splitedArray[1]).intValue();
		
		if(x < y) {
			swap(x, y);
		}
		
		if(y == 0) {
			return 0;
		}
		
		while(x % y != 0) {
			int temp = x % y;
			x = y;
			y = temp;
		}
		
		return y;
	}

	private static void swap(int x, int y) {
		int temp = x;
		y = x;
		x = temp;
	}
}

C++: #include <iostream>
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 (cin >> a >> b) {
        cout << gcd(a, b) << endl;
    }
    return 0;
}

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

int gcd(int a, int b) {

    if(a < b)   swap(a, b);
    if(b == 0)  return a; 

    return gcd(a % b, b);
}

int main() {

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

        cout << gcd(a, b) << endl;
    }
    return 0;
}

C++: #include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define pb(a) push_back(a)
#define all(a) (a).begin(), (a).end()
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int gcd( int m, int n ) {
    if ( ( 0 == m ) || ( 0 == n ) ) return 0;

    while( m != n ) {
        if ( m > n ) m = m - n;
        else         n = n - m;
    }
    return m;
}

int lcm( int m, int n ) {
    if ( ( 0 == m ) || ( 0 == n ) ) return 0;
    return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}

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

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
    int a,b;
    while(cin>>a>>b)
        cout<<__gcd(a,b)<<endl;
}

C++: #include <iostream>
#include<math.h>
#include<iomanip>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;

int main()
{
    int a=0;b=0;
    while(cin >> a >> b){
    int c=0;

    if(a<b){
        swap(a,b);
    }
    while(b>0){
        c = a%b;
        a=b;
        b=c;
    }
    cout << a;
    cout << endl;
    }
}

C++: int gcd( int m, int n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd

int main(int argc, const char * argv[])
{
    int n;
    while(cin >> n){
        //std::cout << n << "," << m << "\n";
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	long long x,y,i,j,k,c,s,d,gcd=0;
	while(cin>>x>>y){
		if(x==0&&y==0)
			cout<<"0"<<endl;
		if(x>y){
			for(j=1;j<=x;j++){
				k=x%j;
				c=y%j;
				if(k==0&&c==0){
					gcd=j;
				}
				if(j==x){
					cout<<gcd<<endl;
				}
			}
		}else{
			for(j=1;j<=y;j++){
				s=x%j;
				d=y%j;
				if(s==0&&d==0){
					gcd=j;
				}
				if(j==y){
					cout<<gcd<<endl;
				}
			}
		}

	}
	return 0;
}

C++: #include <stdio.h>
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){
printf("%d\n",gcd(a,b));
}
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define vint vector<int>

int gcd(int a, int b){return b ? gcd(b,a%b):a;}

int main(){
    int a,b;
    while(~scanf("%d%d",&a,&b)) {
        cout << gcd(a,b) << endl;
    }

    return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
	int a, b;
	while (cin >> a >> b) {
		if (a > b) swap(a, b);
		while (b != 0) {
			int c = a%b;
			a = b;
			b = c;
		}
		cout << a << endl;
	}
}