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 <bits/stdc++.h>
using namespace std;

//define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second

//template
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << p.first << " " << p.second;return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if (it != v.begin())os << " ";os << *it;
  }return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void print(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void print(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}

//typedef
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

P gcd(int x, int y){
	if(x < y)swap(x, y);
	int ans = 0;
	while(y != 0){
		x = x%y;swap(x, y);
		ans++;
	}
	return P(x, ans);
}

signed main(){
	while(1){
		int a, b;
		scanf("%lld%lld", &a, &b);
		if(a == 0 and b == 0)break;
		cout << gcd(a, b) << 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(m==0 && n==0)break;
	
	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>
using namespace std;
int main() 
{
	int a, b, tmp, count;
    while (1) {
    	cin >> a >> b;
        if (a == 0 && b == 0) {
            break;
        }
        if(a < b) { 
                    tmp = b; 
                    b = a; 
                    a = tmp; 
                    } 
        count = 0; 
        do {
            a = a % b;
            tmp = b;
            b = a;
            a = tmp;
            count++;
        } while (b != 0);
        cout << a << " " << count << 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 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(){
    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<iostream>

using namespace std;

int ct=0;

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<iostream>
using namespace std;
int main(){
  long long int x,y,a,b;
  while(1){
    cin>>x>>y;
    if(x==0 && y==0)break;
    b=0;
    if(x<y){
      a=x;
      x=y;
      y=a;
    }
    while(1){
      a=x%y;
      x=y;
      y=a;
      b++;
      if(y==0)break;
    }
    cout<<x<<" "<<b<<endl;
  }
  return 0;
}

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

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

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

C++: #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 temp = x;
            x = y;
            y = temp;
        }
        int count = 0;
        while (y > 0) {
            int temp = x % y;
            x = y;
            y = temp;
            count++;
        }
        cout << x << " " << count << endl;
    }
}

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

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

C++: #include<stdio.h>
#include<string.h>
#include<math.h>
int main(void)
{
	int a,s,d,f,g,h,j,i,k;
	while(1){
		scanf("%d %d",&a,&s);
		if(a==0&&s==0) break;
		f=0;
		g=a;
		h=s;
		if(a<s){
			g=s;
			h=a;
		}
		while(1){
			d=g%h;
			g=d;
			d=h;
			h=g;
			g=d;
			f++;
			if(h==0) break;
		}
		printf("%d %d\n",g,f);
	}
	return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cout << #x << " = " << (x) << endl;
#define forauto(i, a) for(auto i : a)cout << i << " "; puts("");
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

PII solve(int x, int y) {
	int a1, a2 = 0;
	if (x < y)swap(x, y);

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

	return mp(a1, a2);
}

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

		PII a = solve(x, y);
		Cout2(a.first, a.second);
	}
}

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

int main(){
	while(1){
	int a,b,c;
	cin>>a>>b;
	if(a==0 && b==0){break;}

	int count=0;
	while(b!=0){
	count++;
	a=a%b;
	swap(a,b);

	}
	cout<<a<<" "<<count<<endl;
	}
}

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

using namespace std;

int step;

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

int main()
{
	int a, b;
	
	while (scanf("%d %d", &a, &b) && a){
		step = 0;
		int ans = gcd(a, b);
		printf("%d %d\n", ans, step);
	}
	return (0);
}