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 <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
typedef long long ll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
int cnt(int x,int y)
{
	if(x < y) swap(x,y);
	if(y == 0) return 0;
	return cnt(y,x%y)+1;
}
int main()
{
	while(1)
	{
		int x,y;
		cin >> x >> y;
		if(x == 0 && y == 0) return 0;
		cout << __gcd(x,y) << " " << cnt(x,y) << endl;
	}
}

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define INF 1000000000;
using namespace std;
int main() {
  long long A, B;
  while (cin >> A >> B) {
    int step = 0;
    if (A == 0 && B == 0)
      break;
    if (A < B)
      swap(A, B);
    for (int i = 0; B > 0; i++) {
      A = A % B;
      swap(A, B);
      step++;
    }
    cout << A << ' ' << step << endl;
  }
  return 0;
}

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

int main() {
	int x,y,y1,z,s;
	while(cin >> x >> y) {
		if (x==0 && y==0) break;
		if (x<y) { z=x; x=y; y=z;}
		s=y1=0; 
		while(y!=0){ z=x % y; y1=y; x=y; y=z; s++;}
		cout << y1 << ' ' << s << endl;
	}
	return 0;
}

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

int main()
{
  int x, y;
  int c, i;

  while (cin >> x >> y && x != 0){
    if (x < y){
      c = x;
      x = y;
      y = c;
    }

    for (i = 0; y != 0; i++){
      x = x % y;
      c = x;
      x = y;
      y = c;
    }

    cout << x << " " << i << endl;
  }
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int x,y,num;
    while(cin>>x>>y&&(x!=0||y!=0)){
        for(int i=1;;i++){
            num=x%y;
            x=y;
            y=num;
            if(num==0){
                cout<<x<<" "<<i<<endl;
                break;
            }
        }
    }
}

C++: #include<iostream>

using namespace std;

int ct=0;

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

int main(){
	int x,y;
	cin>>x>>y;
	cout<<gcd(x,y)<<" "<<ct<<endl;
	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(){
	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<iostream>
using namespace std;
int s,a,b;
int gcd(int x,int y){
	return y?s++,gcd(y,x%y):x;
}
int main(){
	while(cin>>a>>b,a){
		s=0;
		cout<<gcd(a,b)<<" ";
		cout<<s<<endl;
	}
	return 0;
}

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

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

int main()
{
  int x, y;
  while (cin >> x >> y, x + y){
    int cnt = 0;
    while (y != 0){
      int tmp = y;
      y = x % y;
      x = tmp;
      cnt++;
    }
    cout << x << " " << cnt << endl;
  }
}

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

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

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

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

C++: #include<stdio.h>
long step;
long enclidean(long a, long b){
                step++;
                long c;
                c = a%b;
                if(c)return enclidean(b,c);
                else return b;
}
int main(){
        long a,b,c;

        while(scanf("%ld %ld",&a,&b), a+b != 0L){
                step = 0;
                if (a > b)
                        c = enclidean(a,b);
                else
                        c = enclidean(b,a);
                printf("%d %d\n",c,step);
        }
        return 0;
}

C++: #include "bits/stdc++.h"

using namespace std;

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

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back


int main(){
    
    int a,b;
    int t1,t2;
    while( cin>>a>>b ){
        if(a==0&&b==0)break;
        int c=0;
        while(1){
            c++;
            t1=b;
            t2=a%b;
            a=t1,b=t2;
            if(b==0){
                cout<<a<<" "<<c<<endl;
                break;
            }
        }
    }
}

C++: #include <algorithm>
#include <bitset>
#include <cstdio>
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;

typedef long long LL;
typedef pair<int, int> P;
typedef pair<LL, LL> PLL;

bool solve() {
    int a, b;
    cin >> a >> b;
    if (a == 0 && b == 0) { return false; }
    if (a < b) { swap (a, b); }

    int step = 0;
    while (b > 0) {
        ++step;
        int t = a % b;
        a = b;
        b = t;
    }
    cout << a << ' ' << step << endl;
    return true;
}

int main() {
    while(solve());
    return 0;
}

C++: #include <cstdio>
#include <algorithm>
int ans = 0;
int GCD(int a, int b){
	if(b==0)return a;
	ans++;
	return GCD(b, a%b);
}

int main(){
	int x, y;
	while(scanf("%d %d",&x, &y), x+y){
		ans = 0;
		if(x < y)std::swap(x,y);
		int gcd = GCD(x, y);
		printf("%d %d\n", gcd, ans);
	}
}

C++: #include <iostream>
using namespace std;
int main()
{
	int x, y, c;
	while (cin >> x >> y && x && y)
	{
		if (x < y) swap(x, y);
		c = 0;
		while (y > 0)
		{
			x %= y;
			swap(x, y);
			c++;
		}
		cout << x << " " << c << endl;
	}
}

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;
		if (a<b) {
			temp = b;
			b = a;
			a = temp;
		}
		while (b != 0) {
			a = a % b;
			temp = a;
			a = b;
			b = temp;
			masatoy++;
		}
		cout << a << " " << masatoy << endl;
		masatoy = 0;
	}
}

C++: #include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
  while(1){
    long long x,y,cnt=0;
    cin>>x>>y;
    if(x+y==0)break;
    if(x<y)swap(x,y);
    while(1){
      cnt++;
      x%=y;
      swap(x,y);
      if(y==0)break;
    }
    printf("%lld %lld\n",x,cnt);
  }
  return 0;
}

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