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 gcd(int a, int b) {
	int c;
	for (int i = 1; i < 10000000; i++) {
		if (a%i == 0 && b%i == 0) {
			c = i;
		}
	}
	return c;
}

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

C++: #include <iostream>

using namespace std;

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

void solve()
{
	int a, b;
	while(cin >> a >> b)
	{
		if(a < b)
		{
			int temp = a;
			a = b;
			b = temp;
		}
		cout << gcd(a, b) << endl;
	}
}

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

C++: #include<cstdio>
#include<algorithm>
using namespace std;
int main(){

  int a,b;

  while(scanf("%d",&a) != EOF){
    scanf("%d",&b);
    while(1){
      if(a<b){
	swap(a,b);
      }
      if(a%b == 0){
	printf("%d\n",b);
	break;
      } else {
	swap(a,b);
	b = b%a;
      }
    }
  }
  return (0);
}

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

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

int l, r;

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

void solve() {
  int a = max(l,r), b = min(l,r);
  cout<<gcd(a,b)<<endl;
}

int main (int argc, char const* argv[]) {
  while (cin>>l>>r) {
    solve();
  }
  return 0;
}

C++: #include <iostream>

using namespace std;

int main(){

int x,y;

cin >> x >> y;

while(x != y){
if(x > y)x = x - y;
if(y > x)y = y - x;
}
cout << x;
}

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

using namespace std;

int GCD(int a, int b){
	int large, small, surplus;
	large = max(a, b);
	small = min(a, b);
	surplus = large % small;
	if(surplus == 0){
		return small;
	}else{
		return GCD(small, surplus);
	}
}

int main(){
	
	int a, b;
	
	while(scanf("%d %d", &a, &b) != EOF){
		int ans;
		ans = GCD(a, b);
		printf("%d\n", ans);
	}
	
	return 0;
}

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

int gcd(int m, int n)
{
	return (m%n==0)?n:gcd(n,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 euclid(int a, int b){
	int l = max(a, b);
	int r = min(a, b);
	int buf;
	if(a==0 || b==0) return 0;

	while(r!=0){
		buf = r;
		r = l%r;
		l = buf;
	}
	return l;
}
int main(){
	int a,b,ret;
	while(cin>>a>>b, !cin.eof()){
		ret = 0;
		cout<<euclid(a,b)<<endl;
	}
}

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

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){

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


    return 0;
}

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

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

C++: int gcd(a,b){return b?gcd(b,a%b):a;}
main(a,b){while(~scanf("%d%d",&a,&b))printf("%d\n",gcd(a,b));}

C++: #include<iostream>
#include<stdio.h>
#include<cmath>
#define INF 9999999
using namespace std;
int a,b,c;
int main(){
	while(cin>>a>>b){
		while(b!=0){
			c=a%b;
			a=b;
			b=c;
		}
		cout<<a<<endl;
	}
	return 0

C++: #include <iostream>

using namespace std;

int main(){

int x,y,z;

cin >> x >> y;

while(true){
if(x > y){
z = x % y;
x = x - z;
}
if(y > x){
z = y % x;
y = y - z;
}
if(x == 0 || y == 0)break;
}

cout << z;

}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#include<numeric>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int a,b;
    while(cin>>a>>b){
        for(int i=1000000;i>=0;i--)
            if(a>=i&&b>=i&&a%i==0&&b%i==0)
            {cout<<i<<endl; break;}
    }
}

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

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

int main(){

  long long int n,m,a,b,c;

  while(cin >> n >> m){
    a = max(n,m);
    b = min(n,m);
    c = a % b;
    a = b;
    b = c;
    while(a % b != 0){
      c = a % b;
      a = b;
      b = c;
    }

    cout << b << endl;
  }
}

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

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

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

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

int main(){
    int a,b,c;
    while(cin >> a >> b){
        while(1){
            if(a < b){
                c = b % a;
            }
            else if(a > b){
                c = a % b;
            }
            else {
                cout << b << endl;
                break;
            }
            if(c != 0){
                a = b;
                b = c;
            }
            else {
                cout << b << endl;
                break;
            }
        }
    }
}

C++: 
#include <iostream>

int gcd(int m, int n);


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

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

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

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

int main(){
    int a, b;
    while( scanf("%d %d", &a, &b) != EOF ){
        cout<<gcd(a,b)<<endl;
    }
    return 0;
}

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

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

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