Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		buf := strings.Split(scanner.Text(), " ")
		a, _ := strconv.Atoi(buf[0])
		b, _ := strconv.Atoi(buf[1])
		if a == 0 && b == 0 {
			break
		}
		if a < b {
			a, b = b, a
		}
		cnt := 0
		for b != 0 {
			a = a%b
			a, b = b, a
			cnt++
		}
		fmt.Println(a, cnt)
	}
}

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

int main(){
	while(1){
		unsigned int a, b;
		cin >> a >> b;
		if(a == 0 && b == 0) break;
		if(a < b){
			int temp = a;
			a = b;
			b = temp;
		}
		int ans = 0;
		while(b != 0){
			int temp = a;
			a = b;
			b = temp % b;
			ans++;
		}
		cout << a << ' ' << ans << endl;
	}
	
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(void){
	int x,y,t;
	while(1){
		int i=0;
		cin >> x >> y;
		if(x == 0 && y == 0) break;
		else if(x < y){
			t = x;
			x = y;
			y = t;
		}while(y !=0){
			x %=y;
			t = x;
			x = y;
			y = t;
			i +=1;
		}cout << x << " " << i << endl;
		
	}
}

C++: #include<stdio.h>

int gcd(int x, int y);  // 最大公約数を求める関数
int lcm(int x, int y);  // 最小公倍数を求める関数

int main()
{
    int x, y;
    int lcm_num;
    printf("最小公倍数を求めます。\n");
    printf("自然数を2つ入力してください。\n");
    printf("1つ目の自然数を入力 -> ");
    scanf("%d", &x);
    printf("2つ目の自然数を入力 -> ");
    scanf("%d", &y);

    lcm_num = lcm(x, y);

    printf("%dと%dの最小公倍数は%dです。\n", x, y, lcm_num);
    printf("\n");

    return 0;
}

// 最大公約数を求める関数
int gcd(int x, int y)
{
    int r;

    if(x == 0 || y == 0)  // 引数チェック
    {
        fprintf(stderr, "引数エラーです。\n");
        return 0;
    }

    // ユーグリッドの互除法
    while((r = x % y) != 0) // yで割り切れるまでループ
    {
        x = y;
        y = r;
    }
    return y;
}

// 最大公約数を求める関数
int lcm(int x, int y)
{
    if(x == 0 || y == 0)  // 引数チェック
    {
        fprintf(stderr, "引数エラーです。\n");
        return 0;
    }

    return (x * y / gcd(x, y));
}

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

int main(void){
   int a, b, counter;
    while(cin>>a>>b){
    if(a < b){
           x = a;
           a = b;
           b = x;
       }
       if(a == 0 && b == 0)    return 0;
       counter = 0;
       cout<<gcd(a,b)<<" "<<counter<<endl;
    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>
using namespace std;
unsigned int a, b, temp, masatoy;
int main() {
	while (1) {
		cin >> a >> b;
		if (a == 0 && b == 0)return 0;
		while (b != 0) {
			a = a % b;
			temp = a;
			a = b;
			b = temp;
			masatoy++;
		}
		cout << a << " " << masatoy << endl;
		masatoy = 0;
	}
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main(void)
{
	int result[10000], step[10000];
	int suffix = 0;

	while (1) {
		long long x, y;

		scanf("%lld", &x);
		scanf("%lld", &y);

		if (x == 0 && y == 0) {
			break;
		}

		if (x < y) {
			int temp = x;
			x = y;
			y = temp;
		}


		long long value = 1;
		int count = 0;

		while (1) {
			count++;
			value = x % y;

			if (value == 0) {
				result[suffix] = y;
				step[suffix] = count;
				suffix++;
				break;
			}

			x = y;
			y = value;
		}
	}

	for (int i = 0; i < suffix; i++) {
		printf("%d %d\n", result[i], step[i]);
	}

	return 0;
}

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

int main(){
	int a,b;
	while(cin >> a >> b, a||b){

		int count=0;

		while(b!=0){
		a=a%b;
		swap(a,b);
		count++;

		}
	cout<<a<<" "<<count<<endl;
	}
	return 0;
}

C++: #include <iostream>
#include <utility>
using namespace std;
typedef pair<int,int> p;

int res=0;

int gcd(int x,int y) {
  if(y == 0) return x;
  else {
    res++;
    return gcd(y,x%y);
  }
}

int main() {
  int x,y;
  while(cin >> x >> y) {
    if(x==0&&y==0) break;
    cout << gcd(x,y) << " " << res << endl;
    res = 0;
  }
}

C++: #include<algorithm>
#include<iostream>
#include<utility>

typedef std::pair<int, int> P;

P gcd( int s, int a, int b )
{
	if( b == 0 )
		return P( a, s );

	return gcd( s + 1, b, a % b );
}

int main()
{
	int a, b;
	while( std::cin >> a >> b, a | b )
	{
		P p = gcd( 0, std::max( a, b ), std::min( a, b ) );
		std::cout << p.first << ' ' << p.second << std::endl;
	}

	return 0;
}

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

using namespace std;

int main()
{
  while(1) {
    int x, y, cnt = 0;
    cin >> x >> y;
    if(x == 0 && y == 0)
      break;
    if(x < y) swap(x, y);
    
    while(1) {
      cnt++;
      x %= y;
      swap(x, y);
      if(y == 0) break;
    }
    cout << x << ' ' << cnt <<endl;
  }
}

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

int main(){
	long long int a,b,x,y,z,st;
	
	while(cin >> a >> b,a,b){
		x=max(a,b);
		y=min(a,b);
		st=0;
		while(1){
			if(y==0) break;
			z=x%y;
			x=y;
			y=z;
			st++;
		}
		
		
		cout << x << ' ' << st << endl;
	}
	
	return 0;
}

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

int main(){
	while(1){
		unsigned int a, b;
		cin >> a >> b;
		if(a == 0 && b == 0) break;
		int ans = 0;
		while(b != 0){
			int temp = a;
			a = b;
			b = temp % b;
			ans++;
		}
		cout << a << ' ' << ans << endl;
	}
	
	return 0;
}

C++: #include<stdio.h>
int main(void)
{
    int x,y,w,c,i;
	scanf("%d %d",&x,&y);
	while(x!=0&&y!=0){
	    c=0;
	    while(y!=0){
			    x=x%y;
				w=x;
				x=y;
				y=w;
				c++;
		}
	printf("%d %d\n",x,c);
	scanf("%d %d",&x,&y);
	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
int cnt;
int main(){
	long long int a,b;
	cnt=0;
	while(1){
		cin>>a>>b;
		if(a<b)swap(a,b);
		while(1){
			a%=b;
			swap(a,b);
			cnt++;
			if(b==0)break;
		}
		cout<<a<<" "<<cnt<<endl;
	}
}

C++: #include <stdio.h>
int main(void) {
	long a1, a2, x, y, i;
	int amari;
	scanf("%ld %ld", &a1, &a2);	//1. 2number
	
	
	if(a1<a2){
		
		x = a2;
		y = a1;
	}	
	while(y =! 0){
		amari = x % y;
		x = y;
		y = amari;
	
	}
	
	printf("%d %d\n", x, i);
	
	return 0;
}

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

int stepCnt;
int gcd(int x,int y){stepCnt++;return y?gcd(y,x%y):x;}

int main(void){
  int a, b;
  
  while (cin >> a >> b){
    if (a==0 && b==0) break;
    if (a<b){
      stepCnt = a; a = b; b = stepCnt;
    }
    stepCnt = 0;
    cout << gcd(a,b) << " ";
    cout << (stepCnt-1) << endl;
  }
  return 0;
}

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

int main() {
    int X, Y;
    while (cin >> X >> Y, (X || Y)) {
        if (X < Y) swap(X, Y);
        int cnt = 0;
        while (Y != 0) {
            X = X % Y;
            swap(X, Y);
            cnt ++;
        }
        cout << X << " " << cnt << endl;
    }
    return 0;
}

C++: /*
 * src.cpp
 *
 *  Created on: 2016/07/27
 *      Author: joi
 */

#include <bits/stdc++.h>

using namespace std;

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

int main(){
	int x,y;
	do{
		cin>>x>>y;
		if (x || y){
			int ans=0;
			if (x<y) swap(x,y);
			while(y){
				x%=y;
				swap(x,y);
				ans++;
			}
			cout<<x<<" "<<ans<<endl;
		}
	}while (x || y);
	return 0;
}

C++: #include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int main(){
    int a,b;
    while(scanf("%d%d",&a,&b),a||b){
        if(a<b)swap(a,b);
        int cnt=0;
        while(b){
            cnt++;
            a%=b;
            swap(a,b);
        }
        printf("%d %d\n",a,cnt);
    }
    return 0;
}

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

int main(){
	long long int x,y,c;
	while(1){
		cin>>x>>y;
		if(x==0&&y==0) break;
		if(x<y) swap(x,y);
		c=0;
		int f=1;
		while(f){
			x%=y;
			swap(x,y);
			if(y==0) f=0;
			c++;
		}
		cout<<x<<" "<<c<<endl;
	}
	return 0;
}