Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	for {
		if sc.Scan() == false {
			break
		}
		str := sc.Text()
		cols := strings.Split(str, " ")
		n, _ := strconv.Atoi(cols[0])
		m, _ := strconv.Atoi(cols[1])
		var gcd int
		if n > m {
			gcd = getGcd(n, m)
		} else {
			gcd = getGcd(m, n)
		}
		fmt.Println(gcd)
	}
}

func getGcd(n int, m int) int {
	var mod int
	nn := n
	mm := m
	for {
		mod = nn % mm
		if mod == 0 {
			break
		}
		nn = mm
		mm = mod
	}
	return mm
}

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

#define loop(v, f, l) for(int v = (f), v##_ = (l); v < v##_; ++v)

using namespace std;

typedef long long int lint;
static inline int in(){ int x; scanf("%d", &x); return (x); }
static inline lint inl(){ lint x; scanf("%lld", &x); return (x); }

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

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

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

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


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

int main(void){
    for(int a, b; cin >> a >> b; cout << gcd(a, b) << endl);

    return 0;
}

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

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

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

int main(void){
  unsigned int a,b;
  while(scanf("%u %u",&a,&b)) cout<<euclid(a,b)<<endl;
  return 0;
}

C++: #include <iostream>
using namespace std;
int gcd(int a,int b)
{
	return(b==0?a:gcd(b,a%b));
}

int main(void)
{
	int a,b;
	while(cin >> a >> b){
		if(a>b) cout << gcd(a,b) << endl;
		else cout << gcd(b,a) << 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;
        m[a]++;
        m[b]++;

        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>
#include <algorithm>

using namespace std;

int main()
{
	int a, b;

	cin >> a >> b;

	cout << max(a, b) - min(a, b) << endl;

	return (0);
}

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

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

C++: #include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;

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

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

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