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 <iostream>
using namespace std;

int solve(int a, int b){
    int r;
    r = a % b;

    if(r == 0){
        return b;
    }else{
        return solve(b, r);
    }
}

int main(){
    int a, b;
    int gcd, lcm;

    while(cin >> a >> b){
        gcd = solve(a, b);

        cout << gcd << endl;
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

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

void solve()
{
	int m, n;
	while(cin >> m >> n)
	{
		if(m < n)
		{
			swap(m, n);
		}
		cout << gcd(m, n) << endl;;
	}
}

int main()
{
	solve();
	return(0);
}

C++: #include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
#include <functional>
#include <cctype>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)n; ++i)

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

int main()
{
	int A, B;
	while(cin >> A >> B)
		cout << gcd(A, B) << endl;

	return 0;
}

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

int main(){
  int a, b;
  while( scanf("%d %d", &a, &b ) == 2 ){
    while( a != b ){
      if( a > b )
	a -= b;
      else
	b -= a;
    }
    printf("%d\n", a);
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int x,y,i,j,k,c,s,d,gcd=0;
	for(i=1;i<50;i++){
		cin>>x>>y;
		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 <iostream>
#include <algorithm>

using namespace std;

int main()
{
	int a, b, r;
	
	while (cin >> a >> b){
		r = 1;
		if (a < b)	swap(a, b);
		while (1){
			r = a % b;
			if (r == 0)	break;
			b = r;
		}
		cout << b << endl;
	}
	return (0);
}

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

using namespace std;


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

int main(){

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

	return 0;
}

C++: #include <iostream>
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 main(int argc, const char * argv[])
{
    int n, m;
    while(cin >> n >> m){
        cout << gcd(m, n) << "\n";
    }
    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
long a,b,r,t;
while(cin>>a>>b){
if(a<b){t=a;a=b;b=t;}
while(t=a%b){
a=b;b=t;
}
cout<<b<<endl;
}
return 0;
}

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

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;} //&&c<='9'
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

int main() {
	for (int a, b; scan(a, b);)
		outl(__gcd(a, b));
}

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

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

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

using namespace std;

int main(){
  for(int h,l;cin>>h>>l;){
    if(h<l){
      swap(h,l);
    }
    while(h%l){
      h%=l;
      swap(h,l);
    }
    cout<<l<<endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
main(){int a,b;while(~scanf("%d%d",&a,&b)){printf("%d\n",std::__gcd(a,b));}}

C++: #include <cstdio>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

long long gcd(long long a, long long b){ // Ååöñ
    while(b != 0){
        long long tmp = a % b;
        a = b;
        b = tmp;
    }
    return a;
}

int main()
{
    for(;;){
        int a, b;
        if(!(cin >> a >> b))
            return 0;

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

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

int main()
{
  int n, m;
  int k;
  while (cin >> n >> m)
  {
    if (n<m) swap(n,m);
    while (m>0)
    {
      k=n; n=m; m=k % m;
    }
    cout << n << endl;
  }
  return 0;
}

C++: #include <iostream>
using namespace std;
int gcd(int a,int b);
int main (){
    int a,b,c;
    while(cin >> a >>b){
        if(a<b){
            int tmp;
            tmp = a;
            a = b;
            b = tmp;
        }
        cout << gcd(a,b) << endl;
    }
}

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

C++: #include<bits/stdc++.h>
main(){int a,b;while(~scanf("%d%d",&a,&b)){printf("%d\n",std::__gcd(a,b));}}

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

int gcd(int x, int y){
    if( x < y ){
        int t = x;
        x = y;
        y = t;
    }
    while( x%y ){
        int t = x%y;
        x = y;
        y = t;
    }
    return y;
}

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

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

int gcd(int m, int n);

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

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