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 <bits/stdc++.h>
#ifdef dbg
#include "./printer.hpp"
#else
#define dump(x) void(0)
#endif

#define MOD 1000000007
using namespace std;
#define ll long long
inline long  toInt(string s) {long  v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

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

}

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

using namespace std;


int main(int argc, char *argv[]) {
  int x, y;

  while (cin >> x >> y) {
    int tmp;

    if (x < y) {
      tmp = y;
      y = x;
      x = tmp;
    }
    while (x % y != 0) {
      tmp = x % y;
      x = y;
      y = tmp;
    }
    cout << y << endl;
  }
  return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
  int a,b;
  cin>>a>>b;
  if(a>b)swap(a,b);
  while(1){if(!(b%a))break;a--;}
  cout<<a<<endl;
}

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++: #include<stdio.h>
int min(int a,int b){
	if(a<b)return a;
	else return b;
}
int main(){
	int a,b;
	while(~scanf("%d%d",&a,&b)){
		int ans=1;
		for(int i=1;i<=min(a,b);i++){
			if(a%i==0&&b%i==0)ans=i;
		}
		printf("%d\n",ans);
	}
}

C++: #include<stdio.h>

int calc(int x,int y)
{
	if(y<1)
		return x;
	else
		return calc(y,x%y);
}

int main()
{
	int a,b;

	while(scanf("%d",&a)!=EOF)
	{
		scanf("%d",&b);
		printf("%d\n",		calc(a,b));
	}
}

C++: #include <iostream>

using namespace std;

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

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

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) << "\n";
    }
    return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<iomanip>
#include<vector>
#include<cmath>

using std::cin;
using std::cout; using std::endl;

#define rep(X,Y) for(int (X)=0;(X)<(Y);++(X))
#define rept(X,Y,Z) for(int (X)=(Y);(X)<(Z);++(X))
#define repr(X,Y) for(int (X)=(Y);(X)>=0;--(X))
const double pi=3.141592653589793283462;

int main(){
	int n, m;
	int a;
	while(cin>>n>>m){
		for(int i=1;i<=n;i++){
			       if(n%i==0  && m%i==0)
					   a=i;
			}
		cout<<a<<endl;
	}
	return 0;
	}

C++: #include <iostream>
using namespace std;
ing main()
{
long int a, b, i, maks;
cin >> a >> b;
if (a > b) maks = a;
else maks = b;
for (i=2;i<=maks;i++)
if (maks % a == 0 && maks % b == 0)
{
cout << i << endl;
break;
}
return 0;
}

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

C++: #include<iostream>

int main ()
{
    int a,b,c;

while(scanf("%d %d", &a, &b)){
    fflush(stdin);
if(a<b){
  c=a;
  a=b;
  b=c;
}

do{
      c=a%b;
if(c==0){
        continue;
}else
a=b;
b=c;continue;
}while(c>10);
     printf("%d\n", b);
}
getchar();
return 0;
}

C++: #include <stdio.h>

int main(){
	int a, b;
	int ans[100]={};
	int tmp;
	int i=0;
	while(scanf("%d", &a)!=EOF){
		scanf("%d", &b);
		if(b>a){
			tmp=b;
			b=a;
			a=tmp;
		}
		while(1){
			if(a-b==0){
				ans[i]=b;
				i++;
				break;
			}
			a-=b;
			if(b>a){
				tmp=b;
				b=a;
				a=tmp;
			}
		}
	}
	int n=i;
	for(i=0;i<n;i++){
		printf("%d\n", ans[i]);
	}
	return 0;
}

C++: #include <iostream>

int gcd(int a,int b) {
	if (a == 0 || b == 0) {
		return 0;
	}
	int r;
	while ((r = a%b) != 0) {
		a = b;
		b = r;
	}
	return b;
}

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

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

using namespace std;

int main()
{
    int a,b;
    while(cin>>a>>b)
    {
        int div=0;
        int diff=abs(a-b);
        for(int i=diff/2;div==0;i++)
            {
                if(a%i==0 && b%i==0)
                div=i;
            }

            cout<<div<<endl;
    }
}

C++: #include <stdio.h>
#include <cmath>
#include <vector>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
using namespace std;

int main(void) {
	vector<long int> r;
	int n=0,m=0;
	while (scanf("%d %d",&n,&m) != EOF)
	{
		int a=0,b=0,re=0;
		if (n>m){
			a=n;b=m;
		} else {
			a=m;b=n;
		}
		while (a%b != 0)
		{
			re=a%b;
			a=b;
			b=re;
		}
		r.push_back(b);
	}
	for(int i=0; i<r.size(); i++)
	{
		cout << r[i] << endl;
	}
	return 0;
}

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

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

int main()
{
  int x, y;
  while (cin >> x >> y){
    while (y != 0){
      x = x % y;
      swap(x, y);
    }
    cout << x << endl;
  }
}

C++: #include<iostream>
#include<iomanip>
#include<algorithm>
#include<array>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<numeric>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<unordered_map>
#include<queue>
#include<vector>
using namespace std;

//#define int long long
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define dump(o) {cerr<<#o<<" "<<o<<endl;}
#define dumpc(o) {cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
const int MOD = 1e9 + 7;

//?????§??¬?´???°
int gcd(int x, int y) {
	return y ? gcd(y, x%y) : x;
}

signed main() {
	for (int x, y; cin >> x >> y;) {
		cout << gcd(x, y) << endl;
	}
	return 0;
}

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

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

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long int ll;

long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n,m;
	while(cin >> n){
		cin >> m;
		cout << GCD(n,m) << endl;
	}
}