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 )
{
	if (a > b ){
		swap (a, b );
	} // end if
	while (b % a != 0 ){
		b = b % a;
		if (a > b ){
			swap (a, b );
		} // end if
	} // end while

	return a;
}

int main()
{
	int n, m;

	while (cin >> n >> m ){
		int res = gcd (n, m );
		cout << res << endl;
	} // end loop
		
	return 0;
}

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

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

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

int GCD( int a, int b )
{
    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>
#include <algorithm>
using namespace std;

int main(){

  int n,m;
  while(cin >> n >> m) {

    if(n > m) swap(n,m);

    while(n != 0) {
      int t = n;
      n = m % n;
      m = t;
    }
    cout << m <<endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
typedef pair<int,string> P;
typedef long long int lld;
#define INF (1<<20)

int gcd(int x,int y) {
  int t;
  while(y!=0) {
    t = x % y;
    x = y;
    y = t;
  }
  return x;
}

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

C++:  #include<iostream>
 #include<stdio.h>
 #include<string>
 #include<math.h>
 #include<iomanip>
 #include<algorithm>
 #include<string.h>
 #include<cctype>
 #include<map>
 #include<set>
 #include<vector>
 #include<sstream>
 #include<stack>
 #include<queue>
 
 using namespace std;
 
 int gcd(int m,int n)
 {
    return n==0 ? m: gcd(n,m%n);    
 }
 
 int main()
 {
   int m,n;
   while(cin>>m>>n)
   {
     int result=gcd(m,n);
     cout<<result<<endl;                  
   }
   //while(1);
   return 0;
 }

C++: // AOJ 1009
#include <iostream>
#include <cstdio>

using namespace std;

int GCD(int a, int b)
{
	while (1){
		a %= b;
		if (a == 0) return b;
		b %= a;
		if (b == 0) return a;
	}
}

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

C++: #include <stdio.h>
int gcd(int a, int b) {while (b) {int c=a%b;a=b,b=c;} return 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<algorithm>
using namespace std;
int main() {
	int a, b;
	while (cin >> a >> b) {
		for (int i = min(a,b); i > 0; i--)
		{
			if (a%i == 0 && b%i == 0)
			{
				cout << i << endl;
				goto Cpp;
			}
		}
		Cpp:
		for (int i = 0; i < 1; i++)
		{

		}
	}
}

C++: #include <iostream>
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>
using namespace std;

int main(){
    int x,y,q,r;
    while(cin >> x >> y){
        while(1){
            q = x/y;
            r = x - q*y;
            if(r == 0) break;
            x = y;
            y = r;
        }
        cout << y << endl;
    }
}

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

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

  int a,b;

  scanf("%d %d",&a,&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 <functional>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <iomanip>
#include <utility>
#include <cstdlib>
#include <sstream>
#include <bitset>
#include <vector>
#include <cstdio>
#include <ctime>
#include <queue>
#include <deque>
#include <cmath>
#include <stack>
#include <list>
#include <map>
#include <set>

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define dump(x)  cerr << #x << " = " << (x) << endl
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define sz size()

const double EPS = 1e-10;
const int INF = 100000000;



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

    
    return 0;
}

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>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;

int main() {
	vector<int>a(2);
	while (cin>>a[0]>>a[1]) {
		while (1) {
			sort(a.begin(), a.end());
			if (a[1] % a[0] == 0) { cout << a[0] << endl; break; }
			int d = a[1];
			a[1] = a[1] % a[0];
			a[0] = d;
		}
	}
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
    int t,s;
    vector<int>v;
    while(cin>>t>>s)
    {
        if(t==0)cout<<s<<endl;continue;

        for(int i=1;i<t;i++)
        {
           if(s%i==0&&t%i==0)v.push_back(i);
        }
        int n=v.size();
        sort(v.begin(),v.end());
        cout<<v[n-1];
        cout<<endl;
        v.clear();
    }
    return 0;

}

C++: #include <iostream>
using namespace std;
int gcd(int m, int n)
{
	int t;
	if (m < n) swap(m, n);
	while (n != 0)
		t = n, n = m % n, m = t;
	return m;
}
int main()
{
	int a, b;
	while (cin >> a)
	{
		if (cin.eof()) break;
		cin >> b;
		cout << gcd(a, b) << 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 <bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  while(cin>>a>>b){
  c=a<b?a:b;
  while(1){if(b%c==0&&a%c==0)break;c--;}
  cout<<c<<endl;}
}

C++: #include <stdio.h>

int main(){
int x,y;

while(cin >> x >> y){

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

}

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


void tmp(int* n,int* m)
{
	int t = *n;
	*n = *m;
	*m = t;
	return;
}

int gcd(int n,int m)//n>mªð
{
	if(n<m)
		tmp(&n,&m);
	if(m==0)
		return 0;
	if(n%m==0)
		return m;
	else
		gcd(m,n%m);
}

int main()
{
	int n,m;
	while(cin>>n && cin>>m)
		cout << gcd(n,m) << 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%d", &x, &y)!=EOF){
		printf("%d\n", gcd(x, y));
	}
	
	return 0;
}

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

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