Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func gcd(x, y int) (int, int) {
	nSteps := 0
	for {
		if x < y {
			tmp := x
			x = y
			y = tmp
		}
		nSteps++
		if x%y == 0 {
			return nSteps, y
		}
		x = x % y
	}
}

func main() {
	scanner.Split(bufio.ScanWords)

	for {
		a, _ := nextInt()
		b, _ := nextInt()

		if a == 0 && b == 0 {
			break
		}

		nSteps, p := gcd(a, b)
		fmt.Println(p, nSteps)
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
pair< int, int > rec(int X, int Y, int Step){
  if(Y == 0) return(make_pair(X, Step));
  else return(rec(Y, X % Y, Step + 1));
}
int main(){
  int X, Y;
  while(cin >> X >> Y, X|Y) {
    pair< int, int > ret = rec(max(X, Y), min(X, Y), 0);
    cout << ret.first << " " << ret.second << endl;
  }
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#include<set>
#include<complex>
#include<map>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
int main(){
    ll a,b,c,d;
    while(cin>>a>>b,a+b){
        c=max(a,b); d=min(a,b);
        ll hoge=0;
        while(d){
            c=c%d;swap(c,d);hoge++;
        }
        cout<<c<<" "<<hoge<<endl;
    }
}

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==0&&b==0)break;
		if(a<b)swap(a,b);
		while(1){
			a%=b;
			swap(a,b);
			cnt++;
			if(b==0)break;
		}
		cout<<a<<" "<<cnt<<endl;
	}
}

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

int mygcd ( int a, int b, int &S ) {

    if ( b == 0 ) {
        return ( a );
    }
    S++;

    return ( mygcd ( b, a % b, S ) );

}
int main()
{
    int A, B;

    while ( cin >> A >> B, A || B ) {

        int S = 0;
        int div;

        if ( A < B ) {
            swap ( A, B );
        }

        div = mygcd(A, B, S);
        cout << div << " " << S << 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;
		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;
	}
}