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 <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define INF (1<<21)

bool cmp(const pair<int,char> &a,const pair<int,char> &b){
	return a.first > b.first;
}
int main(){
	int x,y;
	while(cin >> x >> y , x){
		int ans = 0;
		if(y>x)swap(x,y);
		while(y){
			x = x%y;
			swap(x,y);
			ans++;
		}
		cout << x << " " << ans << endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(void){
  	int a,b;

	for (int i = 0; i < 1000; i++){
		cin >> a >> b;

		if (a == 0 && b == 0)
			break;

		int r,COUNT = 1;

		while((r = a % b) != 0)
			{ a = b; b = r; COUNT++;}

		cout << b << " " <<COUNT << endl;
	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
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>

using namespace std;

int main(void){

  int x,y;

  while( cin >> x >> y , x || y ){

    int count = 0;
    while(y){
      int s = x % y;   
      int temp = y;
      y = s;
      x = temp;
      count++;
    }
    cout << x << " " << count << endl;
  }
  return 0;
}

C++: #include <stdio.h>
int X, Y, T, R;
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;
		R = gcd(X, Y);
		printf("%d %d\n", R, T);
	}
	return 0;
}

C++: // 2011/07/07 Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int X, Y;
		cin >> X >> Y;
		if(X==0&&Y==0)
			break;

		if(X<Y){
			int tmp = X;
			X = Y;
			Y = tmp;
		}

		int cnt = 0;
		do{
			X = X%Y;

			int tmp = X;
			X = Y;
			Y = tmp;

			cnt++;
		}while(Y!=0);

		cout << X << ' ' << cnt << endl;
	}

	return 0;
}

C++: #include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
long long a,b;
int ans;
int gcd(long long x,long long y){
  ans+=1;
  if(x%y==0){
    return y;
  }else{
    gcd(y,x%y);
  }
}
int main()
{
  while(cin>>a>>b,a||b){
    ans = 0;
    if(a>=b){
      cout<< gcd(a,b)<<" ";
      cout <<ans<<endl;
    }else{
      cout<<gcd(b,a)<<" ";
      cout <<ans<<endl;
    }
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int a, b, r, kouyaku[1001], kazu[1001], kaisuu, s;
	kaisuu = 0;
	while (1) {
		cin >> a >> b;
		if (a == 0 && b == 0) {
			goto a;
		}
		kaisuu = kaisuu + 1;
		s = 0;

	a:;
		for (int i = 1; i <= kaisuu; i++) {
			cout << kouyaku[i] << " " << kazu[i] << endl;
		}
	}
}

C++: //#include<bits/stdc++.h>
#include<iostream>
#include <vector>
#include <cstdio>
#include<algorithm>
#include <utility>
#define SIZE 1001;
using namespace std;
int main() {
	long long count=0, x, y;
	while (1) {
		cin >> x >> y;
		if (x == 0 && y == 0) {
			break;
		}
		if (y > x) {
			swap(x, y);
		}
		while (1) {
			if (y == 0) {
				break;
			}
			count++;
			x %= y;
			swap(x, y);
		}
		cout << x <<" "<<count<<  endl;
		count = 0;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int ct;

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

int main(){
	int x,y;
	while(cin>>x>>y,x*y){
		cout<<gcd(x,y)<<" "<<ct<<endl;
		ct=0;
	}
	return 0;
}

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





int main(){
  int x, y, s, amari;

  while(1){
    s = 0;
    cin>>x>>y;
    if(x == 0 && y == 0) break;


    while(1){
      x = x%y;
      swap(x, y);
      s++;
      if(y == 0)break;
    }

    cout<<x<<" "<<s<<endl;
    
  }

  
  return 0;
}

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

  long long int res;

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

int main() {
  long long 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;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int p;
int gcd(int a,int b){
  if(b==0)return a;
  p++;
  return gcd(b,a%b);
}
int main(){
  int a,b;
  while(cin>>a>>b,a){
    p=0;
    if(a<b)swap(a,b);
    cout<<gcd(a,b)<<' ';
    cout<<p<<endl;
  }
}

C++: #include<iostream>
#include<algorithm>
using namespace std;
int x,y,z;
int swap(){
  z = x;
  x = y;
  y = z;
  return 0;
}

int main(){
  while(true){
    cin>>x>>y;
    if(!x&&!y)break;
    int step = 0;
    if(y>x)swap();
    while(y!=0){
      x = x%y;
      swap();
      step++;
    }
    cout<<x<<" "<<step<<endl;
  }
  return 0;
}

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

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

C++: #include <iostream>

using namespace std;

void GCD(int x, int y, int c)
{
	if(y == 0)
	{
		cout << x << " " << c << endl;
		return;
	}
	GCD(y, x % y, c + 1);
}

void solve()
{
	int x, y;
	while(cin >> x >> y, x || y)
	{
		if(x >= y)
		{
			GCD(x, y, 0);
		}
		else
		{
			GCD(y, x, 0);
		}
	}
}

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

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;
  gcd(x,y);
  int p = 0;
  //cout << x << " " << p-1 << endl;
  //int tmp =gcd(x,y,p);
  //cout <<  tmp << " " << p << endl;
}
  return 0;
}