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;

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

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 & b){
		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>
#include<cstdio>
#include <cstring>
#include<map>
#include<string>
#include<stack>
using namespace std;

void gcd(int max , int *min, int *count){
int amari;
while(1)
{
*count+=1;
amari=max%*min;
if(amari==0) break;
max=*min;
*min=amari;
}}


int main(){
	int n,m,count=0;
	int a,b;
	while(cin>>n>>m)
	{
		if(n==0 && m==0) break;
		a = max(m,n);
		b = min(m,n);
		gcd( a , &b , &count);
		cout<< b<<' '<<count<<endl;
		count=0;
	}
}

C++: #include <iostream>

using namespace std;

int counter;

int gcd(int a, int b){
       if (b == 0) return a;
       counter++;
       else 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 <stack>
#include <math.h>

using namespace std;

long long calc(long long x,long long y,long long int& count){

	int tmp_count = 0,tmp;

	while(y != 0){
		tmp = y;
		y = x%y;
		x = tmp;
		tmp_count++;
	}

	count = tmp_count;
	return x;
}

int main(){

	long long a,b,count,number;

	while(true){
		scanf("%lld %lld",&a,&b);
		if(a == 0 && b == 0)break;

		if(a > b){
			number = calc(a,b,count);
		}else{
			number = calc(b,a,count);
		}

		printf("%lld %lld\n",number,count);

	}

    return 0;
}