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>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



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

ll a, b;

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

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

    while(b != 0 && a % b != 0){
      c = a % b;
      a = b;
      b = c;
    }

    cout << b << endl;
  }
}

C++: #include <cstdio>
int solve(int a, int b) {
	if (a%b==0) return a;
	return solve(b,a%b);
}
int main() {
	int a,b;
	while(scanf("%d %d",&a,&b)!=EOF) {int res=solve(a,b); printf("%d\n",res);}
}

C++: #include <iostream>

using namespace std;

int main(){

int x,y;

cin >> x >> y;

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

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

using namespace std;

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

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

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

using namespace std;

template<typename Integer>
Integer GCD(Integer a, Integer b){
  if(!b)return a;
  else return GCD(b,a%b);
}

int main(){
while(true){
int a,b;
cin>>a>>b;
if(cin.eof())break;
cout<<GCD(a,b)<<endl;
}
return 0;
}

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

int gcd(int a, int b) {
	if (a < b) {
		int c = a;
		a = b;
		b = c;
	}
	if (a % b == 0)
		return b;
	return 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){
        //std::cout << n << "," << m << "\n";
        cout << gcd(m, n);
    }
    return 0;
}

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

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

C++: 
#include <stdio.h>
#include <iostream>
#include <map>
#include <set>
using namespace std;

typedef long long int ll;

ll solve(ll p, ll q);

int main(void) {

	ll p, q;
	while(true) {
		if( cin.eof() ) { break; }
		cin >> p >> q;
		cout << solve( p, q ) << endl;
	}

	return 0;
}

ll solve( ll p, ll q ) {
	if( q == 0 ) return p;
	return solve( q, p%q );
}

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

int main() {
  int a, b;
  while(cin >> a >> b) {
    int t;
    if(a > b) t = b;
    else      t = a;

    for(; t >0; t--) {
      if(a % t == 0 && b % t == 0) break;
    }
    cout << t << endl;
  }
  return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) (r).begin(),(r).end()
#define gsort(st,en) sort((st),(en),greater<int>())
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init));

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using dict = map<string,int>;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

const int mod = 1000000007;
constexpr int imax = ((1<<30)-1)*2+1 ;
constexpr int inf = 100000000;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

template<typename T>
void Unique(vector<T> &v){
  sort(all(v));
  v.erase(unique(all(v)),v.end());
}

template<typename T>
T ston(string& str, T n){
  istringstream sin(str) ;
  T num ;
  sin >> num ;
  return num ;
}

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

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b;
  while(cin >> a >> b){
    cout << gcd(a,b)<<endl;
  }
  return 0;
}

C++: #include <algorithm>
#include <iostream>
using namespace std;
int main()
{
	long long n, m;
	while (cin >> n >> m) cout << __gcd(n, m) << endl;
	return 0;
}

C++: #include<stdio.h>

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