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

int count;

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

int main() {
    while (true) {
        int a, b;
        cin >> a >> b;
        if (!a && !b) return 0;
        count = 0;
        int g = gcd(a, b);
        cout << g << " " << count << endl;
    }
}

C++: #include<iostream>
#include<string>
using namespace std;
int main(){
	int a,b;
	while(true){
	cin>>a>>b;
	if(a==0&&b==0)
		break;
	int ans=0;
	int x,y;
	x=max(a,b),y=min(a,b);
	while(true){
		if(y==0)
			break;
		ans++;
		x%=y;
		a=x,b=y;
		x=max(a,b),y=min(a,b);
	}
	cout<<x<<" "<<ans<<endl;
	}
	return 0;
}

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





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

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


    while(y != 0){
      x = x%y;
      swap(x, y);
      s++;
    }

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

  
  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) {
    cnt = 0;
    cout<<euclid(a, b)<<" "<<cnt<<endl;
  }
  return 0;
}

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

C++: #include<iostream>
main(){for(int a,b,t,c;std::cin>>a>>b;printf("%d %d\n",a,c)){if(a<b){a^=b;b^=a;a^=b;}for(c=0;t=b;a=t,c++)b=a%b;}}

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;
     while(cin>>a>>b){
        if(a == 0 && b == 0) return 0;
        counter = 0;
        cout<<gcd(a,b)<<" "<<counter<<endl;
     }
     return 0;
}

C++: #include<stdio.h>
#include<math.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
using namespace std;

int search(int n,int m,int& count){
    count++;
    if(n%m==0){
        return m;
    }
    return search(m,n%m,count);
}





int main(){
    while(1){
    int n,m;
    int count=0;
    cin>>n>>m;
        if(n==0 && m==0){break;}
    if(m>n){swap(n,m);}
    int ans=search(n,m,count);
    cout<<ans<<" "<<count<<endl;
    
    }
    
    return 0;
}

C++: #include <iostream>
typedef long long int llint;

llint step = 0;
llint getgcd(llint a, llint b){
  if(b==0)return a;
  step++;
  return getgcd(b, a%b);
}

int main(){
  llint a, b;
  while(std::cin >> a >> b, a && b){
    llint gcd = 0;
    step = 0;
    if(a > b)gcd = getgcd(a, b);
    else gcd = getgcd(b, a);
    std::cout << gcd << " " << step << std::endl;
  }
}

C++: #include<stdio.h>
int main(void)
{
    int n,m,i,a;
	while(1){
	    scanf("%d %d",&n,&m);
		if(n==0&&m==0) break;
		a=0;
		while(1){
		    i=n%m;
			n=m;
			m=i;
			a++;
			if(m==0) break;
		}
		printf("%d %d\n",n,a);
	}
	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 <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);
    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 <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pll> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-9;

int main() {
	int a, b;
	while (cin >> a >> b, a || b) {
		if (a < b) swap(a, b);
		
		int ans = 0;
		while (b != 0) {
			a = a % b;
			swap(a, b);
			ans++;
		}
		printf("%d %d\n", a, ans);
	}
	return 0;
}

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

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

int main() {
	int x, y;
	while(cin >> x >> y && (x || y)){
		N = 0;
		int ans = gcd(x, y);
		
		cout << ans << " " << N << endl;
	}
	return 0;
}

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;
	}
}

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

int main(){
	while(1){
	int a,b,c,t;
	cin>>a>>b;
	if(a==0&&b==0){break;}
	c=0;
	t=0;
	int count=0;
	while(b!=0){
	c=a%b;
	a=c;
	t=a;
	a=b;
	b=t;
	count++;
	}
	cout<<a<<" "<<count<<endl;
	}
}

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

C++: #include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <set>
#include <cstdio>
#include <cmath>
#define rep(i,l,n) for(lint i=l;i<n;i++)
#define rer(i,l,n) for(lint i=l;i<=n;i++)
#define all(a) a.begin(),a.end()
#define o(a) cout<<a<<endl
#define pb(a) push_back(a)
#define mk(a,b) make_pair(a,b)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef vector<int> vi;
typedef vector<lint> vli;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main(){
	while(1){
		int a,b,g,ans=0;
		cin>>a>>b;
		if(a+b==0) break;
		if(a<b) swap(a,b);
		while(1){
			a=a%b;
			swap(a,b);
			ans++;
			if(b==0) break;
		}
		o(a<<" "<<ans);
	}
}