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>
#include <algorithm>
using namespace std;

int res;

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;
    if(x < y) {
      swap(x,y);
    }
    res = 0;
    cout << gcd(x,y) << " " << res << endl;
  }
}

C++: # include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <utility>
# include <stack>
# include <queue>
# include <list>
using namespace std;
using LL = long long;
constexpr int MOD = 1000000000 + 7;
constexpr int INF = 2000000000;
const double PI = acos(-1);

int main() {
	int a, b;
	while (cin >> a >> b &&a&&b) {
		if (a < b)swap(a, b);
		int count = 0;
		while (b){
			count++;
			int num = a;
			a = b;
			b = num%b;
		}
		cout << a << " " << count << endl;
	}
}

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

int main(){

  int a,b,c,r,count;

  while(cin >> a >> b, a, b){
    count = 0;

    while(b!=0){

      c = a/b;
      r = a%b;
      a = b;
      b = r;

      count++;

    }

    cout << a << ' ' << count << endl;

  }
}

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

typedef long long ll;

int ct=0;

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

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

C++: #define _USE_MATH_DEFINES
#include<cstdio>
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<cmath>
#include<climits>
using namespace std;

int cnt;

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

int main(){
	int X, Y;
	while(cin >> X >> Y, X || Y){
		if(X < Y) swap(X, Y);
		cnt = 0;
		int ans = gcd(X, Y);
		printf("%d %d\n", ans, cnt);
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

typedef long long ll;

int ct=0;

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

int main(){
	ll x,y;
	while(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>
using namespace std;

int cnt;

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

int main()
{
  int a, b;
  while (cin>>a>>b, a||b) {
    if (a < b) {
      a ^= b;
      b ^= a;
      a ^= b;
    }
    cnt = 0;
    cout<<euclid(a, b)<<" "<<cnt<<endl;
  }
  return 0;
}

C++: #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, a, b );
		std::cout << p.first << ' ' << p.second << std::endl;
	}

	return 0;
}

C++: #include<iostream>

unsigned int c;

unsigned int gcd(unsigned int X, unsigned int Y){
	unsigned x, y;
	if(Y > X)
		x = Y, y = X;
	else
		x = X, y = Y;
	if(y==0)
		return x;
	c++;
	return gcd(y, x%y);
}

int main(){
	unsigned int x, y;
	while(true){
		c = 0;
		std:: cin >> x >> y;
		if(x == 0 && y==0)
			return 0;
		std:: cout << gcd(x, y) << ' ' << c << std::endl;
	}
}

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

C++: #include <bits/stdc++.h>
using namespace std;
int main(){

  for(;;){
    int n,m;
    cin>>n>>m;
    if(n==0) break;

    if(n<m) swap(n,m);

    int c,r=0;
    for(;m;){
      c=n%m;
      n=m;
      m=c;
      r++;
    }
    cout<<n<<" "<<r<<endl;
  }

  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(a1<a2){
		
		x = a2;
		y = a1;
	}	
	while(amari =! 0){
		amari = x % y;
		x = y;
		y = amari;
                i++;
	
	}
	
	printf("%ld %ld\n", x, i);
	
	return 0;
}

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

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 <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	long long a,b;
	while(cin>>a>>b&&a!=0&&b!=0){
		int cnt=0;
		while(b!=0){
			a=a%b;
			swap(a,b);
			cnt++;
		}
		cout<<a<<" "<<cnt<<endl;
	}
	return 0;
}

C++: #include<stdio.h>
 
int main(){
	unsigned long long int a, b, n, step = 1;
	while(scanf("%lld %lld", &a, &b) != EOF){
		if(a <= b){
			n = a;
			a = b;
			b = n;
		}
		while(a % b != 0){
			step++;
			if(a % b == 0){
				n = b;
				break;
			}
			a = a % b;
			n = a;
			a = b;
			b = n;
		}
		printf("%lld %lld\n", n, step);
		step = 1;
	}
	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 <bits/stdc++.h>

using namespace std;;

int main(){
  long xbox[1000];
  long ybox[1000];
  int size=0;
  long xtemp,ytemp;
  long x,y,swap,mod;
  int step;
  
  while(true){
    scanf("%ld %ld", &xtemp,&ytemp);
    if(xtemp == 0 && ytemp == 0) break;
    xbox[size] = xtemp;
    ybox[size] = ytemp;
    //printf("%d %d\n", xbox[size],ybox[size]);
    size++;
    }
  //size=1;
  //xbox[0] = 1071;
  //ybox[0] = 1029;
  for(int i=0; i<size; i++){
    step = 0;
    x = xbox[i];
    y = ybox[i];
    while(y!=0){
      mod = x%y;
      //printf("mod %d\n",mod);
      x = mod;
      swap = x;
      x = y;
      y = swap;
      step++;
    }
    printf("%ld %d\n", x,step);
  }
}

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


int main(void)
{
  int a, b, x, y, z, i=0;

  scanf("%d %d", &a, &b);

  if(a != 0 || b != 0)
  {
    if(a >= b)
    {
      x = a;
      y = b;
    }

    else
    {
      x = b;
      y = a;
    }

  do{
      x = x%y;
      z = x;
      x = y;
      y = z;
      i++;
     }while(y!=0);

  printf("%d %d\n", x, i);
  }

  return 0;
}

C++: #include<vector>
#include<list>
#include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
  unsigned int c,x,y;
  for(;;){
    cin>>x>>y;
    if(x+y==0)
      break;
    if(x<y)
      swap(x,y);
    for(c=0;y;c++){
      x%=y;
      swap(x,y);
    }
    cout<<x<<" "<<c<<endl;
  }
  return 0;
}