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>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)


using namespace std;

int cnt;

int lcd(int a, int b){
	if (a < b) swap(a, b);
	int c;
	cnt=0;

	while (b != 0){
		c = a%b;
		a = b;
		b = c;
		cnt++;
	}
	return a;
}



int main(){

	int a, b;
	while (cin >> a >> b && a != 0 && b != 0){
		int res = lcd(a,b);
		cout << res << " " << 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;
    if(xtemp>ytemp){
      xbox[size] = xtemp;
      ybox[size] = ytemp;
    }else{
      xbox[size] = ytemp;
      ybox[size] = xtemp;
    }
    size++;
  }
  for(int i=0; i<size; i++){
    step = 0;
    x = xbox[i];
    y = ybox[i];
    while(true){
      step++;
      mod = x%y;
      x = mod;
      swap = x;
      x = y;
      y = swap;
      if(y==0)break;
    }
    printf("%ld %ld\n", x,step);
  }
}

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

void swap(unsigned int *a, unsigned int *b){
	if(*a != *b){
		*a ^= *b;
		*b ^= *a;
		*a ^= *b;
	}
}

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

C++: #include <iostream>
using namespace std;
int main(void){
    int a,b;
	while(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>
using namespace std;

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

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

using namespace std;

int ret;

int gcd(int n, int m){
	if(n < m) swap(n,m);
	if(m == 0) return n;
	ret++;
	return gcd(m,n%m);
}

int main(void){
	int n,m;
	while(cin >> n >> m){
		if((n|m) == 0) break;
		ret = 0;
		cout << gcd(n,m) << " ";
		cout << ret << endl; 
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int x,y,num;
    while(cin>>x>>y&&x!=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 main()
{
  int a, b, t, cnt;
  while (cin>>a>>b, a||b) {
    if (a < b) {
      a ^= b;
      b ^= a;
      a ^= b;
    }
    cnt = 0;
    while (b > 0) {
      t = a;
      a = b;
      b = t%b;
      cnt++;
    }
    cout<<a<<" "<<cnt<<endl;
  }
  return 0;
}

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

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

int main()
{
    int x, y;
    while(cin >> x >> y && x)
    {
        int ans = 0;
        if(x<y) swap(x,y);

        while(y)
        {
            x = x % y;
            swap(x,y);
            ans += 1;
        }
        cout << x << " " << ans << endl;

    }
    return 0;
}

C++: #include<stdio.h>
int main()
{
	int x,y,z,c;
	while(scanf("%d%d",&x,&y),x)
	{
		for(c=(x<y?0:1);z=x%y;++c)x=y,y=z;
		printf("%d %d\n",y,c);
	}
	return 0;
}

C++: #include <stdio.h>
int t;
void swap(int &a,int &b){
    int temp=a;
    a=b;
    b=temp;
    return ;
}
int gcd(int a,int b){
    if(b==0)return a;
    t++;
    a%=b;
    swap(a,b);
    if(b==0)return a;
    return gcd(a,b);
}
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<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;
		}
		if(a % b == 0) n = b;
		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 <bits/stdc++.h>
using namespace std;


int count = 0;

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

int main(){

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

  cout << gcd(x,y) << " " << 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\n", x, count);

	}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(){
while(1){
int a,b,count=0;
cin>>a>>b;
if(a==0 && b==0) break;
int x,y;

if(a >= b) x = a,y = b;
else x = b, y = a;
while(1){
x = x % y; 
swap(x,y); count++;
if(y == 0 ) break;
}cout<<x<<" "<<count<<endl;
}
return 0;
}

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

C++: #include <bits/stdc++.h>

using namespace std;

int main(){

  int X,Y,c=0;
  vector<int> x,C;
  while(true){
    cin>>X>>Y;
    if(X+Y==0) break;
    c=0;
    while(true){
      X %= Y;
      swap(X,Y);
      ++c;
      //cout << "/////////  "<< X<<" "<<Y<<" "<< c << endl;
      if(Y==0){
	//cout << X << " " << c << endl;
	x.push_back(X);
	C.push_back(c);
	break;
      }
    }
  }

  for(int i=0; i<x.size(); ++i){
    cout<<x[i]<<" "<<C[i]<<endl;
  }

  
  return 0;
}

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

using namespace std;

int step = -1;
int result = 0;

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

int main() {
    while (true) {
       int X = 0, Y = 0;
       
       scanf("%d %d", &X, &Y);
       
       if(X == 0 && Y == 0) break;
       
       if (X < Y) {
           X = Y;
       }
       
       result = gcd(X, Y);
             
       printf("%d %d", result, step);
    }
    
    
    
    return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    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;
            }
        }
    }
}