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 main(){
	long long int a,b,c;
	while(cin >> a >> b){
		while(1){
			if(a<b){
				c = b%a;
			}
			else {
				c = a%b;
			}
			if(c!=0){
				a = b;
				b = c;
			}
			else {
				break;
			}
		}
		cout << 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( scanf("%d %d", &a, &b) != EOF ){
        cout<<gcd(a,b)<<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 ){
		cout << gcd(a,b) << endl;
	}
}

C++: #include <stdio.h>
int main(){
    int n,m;
    while(scanf("%d %d",&n,&m)!=EOF){
        while(1){
            if(n>m){
                int t=m;
                m=n;
                n=t;
            }
            m%=n;
            if(m==0){
                printf("%d\n",n);
                break;
            }
        }
    }
    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[100000], b[100000],i=0,x;
    while( scanf("%d %d", &a[i++], &b[i++]) != EOF ){
    }
	x=i;
	i=0;
	while(i<x)
	cout<<gcd(a[i++],b[i++])<<endl;
    return 0;
}

C++: #include <bits/stdc++.h>

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 <algorithm>
using namespace std;
int main( void )
{
	int x, y;
	while ( cin >> x >> y )
	{
		if ( x > y )
			swap( x, y );

		while ( x != 0 && y != 0 )
		{
			y = y % x;
			if ( x > y )
				swap( x, y );
		}

		cout << y << endl;

	}
}

C++: #include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

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

C++: #include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>

#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define repi(i,a,b) for(int i = (a); i < (b); i++)

using namespace std;

typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;

const int INF=1<<29;
const double EPS=1e-9;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

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

C++: #include <iostream>
#include <limits.h>
#include <queue>
#include <algorithm>
#include <string>

using namespace std;

typedef pair<int,int> P;

const int INF=INT_MAX/3;
//const int V_MAX=10000,E_MAX=10000;
//int V,E;
const int N=10000;

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>

int eucgcd(int m, int n)
{
	int p = m%n;
	
	while( p > 0 )
	{
		m = n;
		n = p;
		p = m%n;
	}
	
	return n;
}


int main()
{
	int m,n;
	
	while( std::cin >> m >> n, (m||n) )
	{
		if( m >= n )
			std::cout << eucgcd(m, n) << std::endl;
		else
			std::cout << eucgcd(n, m) << std::endl;
	}
	
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
	int x,y,i,j,k,c,s,d,gcd=0;
	for(i=0;i<49;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 <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

vector<ll> divisor(ll n) {
    vector<ll> res;
    for(ll i = 2; i*i <= n; i++) {
        if(n % i == 0) {
            res.push_back(i);
            if(i != n/i) res.push_back(n/i);
        }
    }
    return res;
}

int main() {
    int a,b;
    while(cin >> a >> b) {
        map<int,int> m;
        vector<ll> v = divisor(a);
        rep(i,v.size()) {
            m[v[i]]++;
        }

        v = divisor(b);
        rep(i,v.size()) {
            m[v[i]]++;
        }

        int ans = 1;
        map<int,int>::iterator ite;
        for(ite = m.begin(); ite != m.end(); ite++) {
            if(ite->second == 2) {
                ans = max(ans, ite->first);
            }
        }

        cout << ans << endl;
    }

    return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
	int *a, *b, s, t, c;
	int p, q;
	a = &p;
	b = &q;
	while(cin >> p >> q){
		s = *a;
		t = *b;
		c = 1;
		for(int tmp = (*a > *b)? *b : *a, i = 2; i <= tmp; i++){
			while(s%i == 0 && t%i == 0){
				s /= i;
				t /= i;
				tmp /= i;
				c *= i;
			}
		}
		cout << c << " " << endl;
}
	return 0;
}

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

using namespace std;

int main(int argc, char **argv)
{
	int *a, *b, s, t, c;
	int p, q;
	a = &p;
	b = &q;
	while(cin >> p >> q){
		s = *a;
		t = *b;
		c = 1;
		for(int tmp = (*a > *b)? *b : *a, i = 2; i <= tmp; i++){
			while(s%i == 0 && t%i == 0){
				s /= i;
				t /= i;
				tmp /= i;
				c *= i;
			}
		}
		cout << c << endl;
}
	return 0;
}

C++: #include <stdio.h>

int gcd(int x, int y){
	return x<y?gcd(y, x):y?gcd(y, x-y):x;
}

int main(void){
	int x, y;
	
	while (scanf("%d", &x), x!=EOF){
		scanf("%d", &y);
		printf("%d\n", gcd(x, y));
	}
	
	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>0;i--){
            if(b%i==0&&a%i==0){
                cout<<i<<endl;
                break;
            }
        }
    }
}