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 main() {
  int n,m,t,c;
  while(cin>>n>>m, n|m) {
    c = 0;
    if(m>n) swap(n,m);

    while(m>0) {
      n %= m;
      swap(n,m);
      c++;
    }
    cout<<n<<" "<<c<<endl;
  }
}

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

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

C++: #include<iostream>
#include<algorithm>
using namespace std;
int main(){
  int x,y;
  while(cin >> x >> y,x){
    int count=0;
    while(y){
      x=x%y;
      swap(x,y);
      count++;
    }
    cout << x << ' ' << count << endl;
  }
}

C++: #include <iostream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <complex>
#include <cstdio>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

int a,b;

void gcd(int a,int b,int c){
	if(!b)cout<<a<<" "<<c<<endl;
	else gcd(b,a%b,++c);
}

int main(){
	while(cin>>a>>b){
		if(!a)return 0;
		gcd(a,b,0);
	}
}

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

int main(){
	int a,b;
	while(cin >> a >> b, a||b){

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

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

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;
    if( a < b ) swap(a, b);
    
    long long g = gcd(a, b);
    cout << g << " " << cnt << endl;
  }
}

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

int main(){

	int x, y;
	while (cin >> x >> y && x != 0 && y != 0){

		if (y > x) swap(x, y);
		int count = 0;
		while (y != 0){
			count++;
			x = x % y;
			swap(x, y);
		}

		cout << x << ' ' << count << endl;
	}
}

C++: #include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
int main(){
  while(true){
    ll a,b;
    cin >> a >> b;
    if(a == 0 && b == 0)return 0;
    ll A = max(a,b),B = min(a,b);
    int cnt = 0;
    while(A % B != 0){
      A = (A % B);
      swap(A,B);
      cnt++;
    }
    cout << B << " " << cnt + 1 << endl;
  }
  return 0;
}

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

void swap(int* a, int* b);

void swap(int* a, int* b){
    int tmp;
    tmp = *a;
    *a = *b;
    *b = tmp;
}

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

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

unsigned int c;

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

int main(){
	unsigned int x, y;
	while(true){
		c = 0;
		std:: cin >> x >> y;
		if(x == 0 && y==0)
			return 0;
		std:: cout << gcd(std::max(x, y), std::min(x, y)) << ' ' << c << std::endl;
	}
}

C++: #include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
    long long a, b, idx;
    for (; ;) {
        scanf("%lld %lld", &a, &b);
        if (a == 0 && b == 0) break;
        if (b > a) swap(a, b);
        idx = 1;
        while (a % b!= 0) {
            long long tmp = b;
            b = a % b;
            a = tmp;
            idx++;
        }
        printf("%lld %lld\n", b, idx);
    }
    return 0;
}

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

int gcd(int a, int b) {
    int r;
    while(r = (a % b) != 0) 
    {
        a = b;
        b = r;
    }
    return b;
}

int main(void){
    int a, b;
    while(cin >> a >> b) {
      int lcm = b * gcd(a,b);
      cout << gcd(a,b) << " " << lcm << endl;
    }
    return 0;
}

C++: #include<iostream>

int main(){
	unsigned int x, y, c, tmp;
	while(true){
		std:: cin >> x >> y;
		if(x == 0 && y == 0)
			return 0;
		if(y>x)
			tmp = x, x= y, y = tmp;
		c = 0;
		while(true){
			if(y == 0)
				break;
			x = x%y;
			tmp = x;
			x = y;
			y = tmp;
			c++;
		}
		std:: cout << x << ' ' << c << std::endl;
	}
}

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

C++: #include<iostream>
using namespace std;
int main(){
  int x,y;

  while(cin >> x >> y){
    int count=0, temp;
    if(x==0 && y==0) break;
    while(y!=0){
      count++;
      x = x % y;
      temp = x;
      x = y;
      y = temp;
    }
    cout << x  << ' ' << count << endl;
  }
  return 0;
}

C++: #include <cstdio>
int ans = 0;
int GCD(int a, int b){
	if(b==0)return a;
	ans++;
	return GCD(b, a%b);
}

int main(){
	int x,y;
	while(scanf("%d %d",&x, &y), x+y){
		ans=0;
		if(x<y)swap(x,y);
		int gcd = GCD(x,y);
		printf("%d %d\n",gcd, ans);
	}
}

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

	int x,y;

	while(true){
		int z=0;
		int c=0;

		cin >> x >> y;
		if(x==0 && y==0)
			break;

		while(true){
			x = x % y;
			z = x;
			x = y;
			y = z;

			c++;			

			if(y==0)
				break;
		}

		cout << x << ' ' << c << endl;
	}
	return 0;
}

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

using namespace std;

int main(){

  int X,Y,c=0;

  while(true){
    cin>>X>>Y;
    if(X+Y==0) break;
    c=0;
    while(true){
      X %= Y;
      swap(X,Y);
      ++c;
      if(Y==0){
	cout << X << " " << c << endl;
	break;
      }
    }
  }

  
  return 0;
}

C++: #include<iostream>
#include<algorithm>
#include<stdio.h>
using namespace std;
int main(){
    int a,b,i,j,x=0,y,count={0},memo;
    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 <iostream>
#include <algorithm>
using namespace std;

int res=0;

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

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

C++: #include<iostream>

using namespace std;

typedef long long ll;

int ct=0;

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

int main(){
	ll x,y;
	while(cin>>x>>y){
		if(x==0 && y==0)break;
		if(x<y){
			ll tmp=x;
			x=y;
			y=tmp;
		}
		cout<<gcd(x,y)<<" "<<ct<<endl;
		ct=0;
	}
	return 0;
}