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 <stdio.h>

void gcd(int x, int y, int c){
  if(y == 0){
    printf("%d %d\n", x, c);
    return;
  }
  gcd(y, x % y, c + 1);
}

int main(){
  int x, y;
  while(scanf("%d%d", &x, &y) && x && y){
    if(x < y){ x += y; y = x - y; x -= y;}
    gcd(x, y, 0);
  }
  return 0;
}

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

int main(){
	while(1){
		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<bits/stdc++.h>
using namespace std;


int main(){
  int a,b,X,Y,ans;

  while(true){
    ans = 0;
    cin >> a >> b;
    if( a + b == 0) break;

    X = max(a,b);
    Y = min(a,b);
    int work;
    while(true){
      X = X % Y;
      work = Y;
      Y = X;
      X = work;
      ++ans;
      if(Y == 0) break;
    }

    cout << X << " " << ans << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;
typedef pair<int,int> P;
double dat[100][100];
double dp[200][100];//動的計画法
int main(){
    int a,b,cnt,tmp;
    while(cin>>a>>b,a){
        cnt=0;
        while(b){
            a%=b;
            tmp=b;
            b=a;
            a=tmp;
            cnt++;
        }
        cout<<a<<" "<<cnt<<endl;
    }
}

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

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

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

using namespace std;

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

int main(void){
  int a,b;
  while(cin>>a>>b,a+b){
    step = 0;
    cout<<gcd(max(a,b),min(a,b));
    cout<<" "<<step<<endl;
  }
}

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

int main(){
	int a,b;
	while(1){
		cin>>a>>b;
		if(a==0 && b==0){break;}

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

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

C++: // clang-format off
#include <bits/stdc++.h>
#define int long long
#define main signed main()
// #define main int main()
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
#define stlice(from, to) substr(from, (to) - (from) + 1)
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
using namespace std;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<pii> vpii;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef vector<vpii> vvpii;
const int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
const int MOD = 1000000007;
const double PI = acos(-1);
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return !odd(n); }
template<typename V> typename V::value_type sum(const V &v) { return accumulate(all(v), 0); }
void solve();
main { solve(); return 0; }
// clang-format on

int gcd(int x, int y, int &t) {
  if (x < y) swap(x, y);
  while (y) x %= y, swap(x, y), t++;
  return x;
}

void solve() {
  int a, b;
  while (cin >> a >> b, a) {
    int t = 0;
    cout << gcd(a, b, t) << ' ' << t << endl;
  }
}

C++: #include <stdio.h>
int t;
void swap(int &a,int &b){
    int temp=a;
    a=b;
    b=temp;
    return ;
}
int gcd(int x, int y) {
    if(x == 0) return y;
    if(y == 0) return x;
    t++;
    if(x > y) return gcd(y, x % y);
    return gcd(x, y % x);
}
int main(){
    int a,b;
    while(true){
        scanf("%d%d",&a,&b);
        if(a==0&&b==0)return 0;
        t=0;
        //if(a<b)swap(a,b);
        printf("%d %d\n",gcd(a,b),t);
    }
}

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

int step;
int res;
int gcd(int a,int b){
  if(b==0){
   return a;
  }
  res = max(res,++step);
  return gcd(b,a%b);
}
int main(void){
  int a,b;
  while(cin>>a>>b,a+b){
    step = res = 0;
    cout<<gcd(a,b)<<" ";
    cout<<res<<endl;;
  }
}

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

int p = 0;

void gcd(int x,int y){
  p++;
  if(y == 0){
    cout<<x<<' '<<p-1<<endl;
    return;
  }

  gcd(y,x%y);
}

int main(){

while(1){
  int x,y;
  cin >> x >> y;
  if(x == 0 && y == 0)break;
  p = 0;
  gcd(x,y);
  //cout << x << " " << p-1 << endl;
  //int tmp =gcd(x,y,p);
  //cout <<  tmp << " " << p << endl;
}
  return 0;
}

C++: #include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(){
  int x;
  char s[100];

  while( scanf("%s", s) != EOF ){
    if ( s[0] == '+' ){

    } else if ( s[0] == '-' ){

    } else if ( s[0] == '*' ){

    } else {
      x = atoi(s);

    }
  }

  return 0;
}

C++: #include<iostream>

using namespace std;

typedef long long ll;

int ct=0;

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

int main(){
	ll x,y;
	while(1){
		cin >> x >> y;
		if(x==0 && y==0)break;
		if(x<y){
			ll tmp=x;
			x=y;
			y=tmp;
		}
		cout<<gcd(x,y)<<" "<<ct<<endl;
		ct=0;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
int counter;
int gcd(int a, int b)
{       if (b == 0) return a;
       counter++;
       return gcd(b, a%b);
   }
   
int main(void){
   int a, b, x;
    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)<<" ";
       cout<<counter<<endl;
    }
    return 0;
}

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

using namespace std;

pair<int, int> euc_gcd(int a, int b){

    int c, step = 0;

    if(a < b){
        swap(a, b);
    }

    while(b > 0){
		step++;
        c = a % b;
        a = b;
        b = c;
    }

    return make_pair(a, step);
}

int main(){

	int a, b;

	while(cin>>a>>b, (a||b)){
		
		pair<int, int> t = euc_gcd(a, b);
		cout << t.first << " " << t.second << endl;
	}

	return 0;
}

C++: #include <stdio.h>
int gcd(int a, int *b) {int d=0;while (*b) {int c=a%(*b);a=*b,*b=c,d++;} *b=d;return a;}
int main() {int a,b;while (scanf("%d %d",&a,&b)!=EOF && (a || b)) a=gcd(a,&b),printf("%d %d\n",a,b);return 0;}

C++: #include <stdio.h>
int X, Y, T;
int gcd(int x, int y) {
	if(x == 0) return y;
	if(y == 0) return x; T++;
	if(x > y) return gcd(y, x % y);
	return gcd(x, y % x);
}
int main() {
	while(true) {
		scanf("%d%d", &X, &Y); T = 0;
		if(X == 0 && Y == 0) break;
		printf("%d %d\n", gcd(X, Y), T);
	}
	return 0;
}