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<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    int a,b,i,x=0,y=0,count={0};
    cin>>a>>b;
    if(a<=b){
        x=b;y=a;
    }else if(a>=b){
        x=a;y=b;
    }
    for(i=0;i<1000;i++){
        x=x%y;
        swap(x,y);
        count++;
        if(y==0){
            break;
        }
    }
    cout<<x<<" "<<count<<endl;
    return 0;
}

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

int main()
{
	int x = 0, y = 0;
	int temp;
	int count;
	while (scanf("%d %d", &x, &y) != EOF) {
		if (x == 0 && y == 0) {
			break;
		}

		temp = 0;

		if (x < y) {
			temp = x;
			x = y;
			y = temp;
		}

		for (count = 0; y != 0; count++) {
			x = x % y;
			temp = x;
			x = y;
			y = temp;
		}

		printf("%d %d", x, count);

	}
	return 0;
}

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

int gcd(int x,int y){
	return y ? gcd(y,x%y)+1 : 0;
}
int main(){
	int x,y;
	while(cin >> x >> y && (x||y)){
		if( x < y ) swap(x,y);
		cout << __gcd(x,y) << " " << gcd(x,y) << endl;	
	}
}

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

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

int main() {
  for(long long a, b; cin >> a >> b, (a || b); ) {
    cnt = 0;
    long long g = gcd(a, b);
    cout << g << " " << cnt << 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;
  long 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 %ld\n", x,step);
  }
}