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 a, b, r;
	while(1){
		int count=1;
		cin >> a >> b;
		if(a == 0 && b == 0) break;
		if(a<b){
			int tmp = a;
			a = b;
			b = tmp;
		}
		r = a%b;
		while(r != 0){
			a = b;
			b = r;
			r = a%b;
			count++;
		}
		cout << b << ' ' << count << endl;
	}
	return 0;
}

C++: #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<math.h>
#include<vector>
#include<iomanip>

using namespace std;


int yuku(int x,int y){
	int t=x%y;
	x=y;
	y=t;
	if(y==0)return x;
	else yuku(x,y);


};
int yu(int x,int y,int sum){
	int t=x%y;
	x=y;
	y=t;
	sum++;
	if(y==0)return sum;
	else yu(x,y,sum);


};
 
int main(){

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

cout<<R<<" "<<sum<<endl;
}
return 0;
}

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

int count;

int gcd(int m,int n)
{
	if(m < n){
		int t = m;
		m = n;
		n = t;
	}
	if(n == 0)
		return m;
	count++;
	int tmp = m%n;
	return gcd(n,tmp);
}

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

C++: #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main(void)
{
	int result[10000], step[10000];
	int suffix = 0;

	while (1) {
		long long x, y;

		scanf("%lld", &x);
		scanf("%lld", &y);

		if (x == 0 && y == 0) {
			break;
		}

		if (x < y) {
			int temp = x;
			x = y;
			y = temp;
		}


		long long value = 1;
		int count = 0;

		while (1) {
			count++;
			value = x % y;

			if (value == 0) {
				result[suffix] = y;
				step[suffix] = count;
				suffix++;
				break;
			}

			x = y;
			y = value;
		}
	}

	for (int i = 0; i < suffix - 1; i++) {
		printf("%d %d\n", result[i], step[i]);
	}

	printf("%d %d", result[suffix - 1], step[suffix - 1]);

	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)<<" "<<counter<<endl;
   }
   return 0;
}

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

int main()
{
  int X, Y;
  while (cin >> X >> Y) {
    if ((X|Y) == 0)
      break;

    int cnt = 0;
    if (X < Y)
      swap(X, Y);

    do {
      X = X % Y;
      swap(X, Y);
      ++cnt;
    } while (Y != 0);

    cout << X << " " << cnt << endl;
  }
  return 0;
}

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

using namespace std;

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

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





int main(){
  int 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 main() {
	int a, b;
	while (cin >> a >> b,a,b) {
		int s = 0;

		if (a < b) { swap(a, b); }
		while (b!=0) {
				int c = a%b;
				a = b;
				b = c;
				s++;			
		}
		cout << a << ' ' << s << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
	for (int i = 0; i < 1000; i++){
		int a,b;
		cin >> a >> b;

		if (a == 0)
			if (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>
#include<algorithm>
using namespace std;
int main(){
  unsigned long long 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>
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>
using namespace std;
int main(){
	int X,Y,s,c=0;
	while(cin>>X>>Y){
		while(Y!=0){
			s = X % Y;
			X = s;
			swap(X,Y);
			c++;
		}
	cout<<X<<" "<<c<<endl;
	c=0;
	}
}

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

int X, Y;

pair<int, int> gcd_cnt(int x, int y){
    int cnt = 0;
    while(y > 0){
        cnt++;
        x %= y;
        swap(x, y);
    }
    return make_pair(x, cnt);
}

int main(){
    while(cin >> X >> Y){
        if(X == 0 && Y == 0){
            return 0;
        }
        pair<int, int> ret = gcd_cnt(X, Y);
        cout << ret.first << " " << ret.second << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <iomanip>
#include <cmath>
#include <string>
#include <algorithm>
using namespace std;
int main(){
	long long a,b;
	while(cin>>a>>b){
		if(a==0&&b==0)break;
		long long cnt=0;
		while(b!=0){
			a=a%b;
			swap(a,b);
			cnt++;
		}
		cout<<a<<" "<<cnt<<endl;
	}
	return 0;
}

C++: #include <stdio.h>
int X, Y, T, R;
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() {
	while(true) {
		scanf("%d%d", &X, &Y); T = 0;
		if(X == 0 && Y == 0) break;
		R = gcd(X, Y);
		printf("%d %d\n", R, T);
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
	int a,b;
	while(cin>>a>>b){
		if(!a&&!b)break;
		int x=(a>=b)?a:b,y=(a>=b)?b:a,step=0,tmp;
		while(y!=0){
			x=x%y;
			tmp=x;
			x=y;
			y=tmp;
			++step;
		}
		cout<<x<<" "<<step<<"\n";
	}
	return 0;
}

C++: #include<iostream>
using namespace std;
int main(void){
	int x,y,t;
	while(1){
		int i=0;
		cin >> x >> y;
		if(x == 0 && y == 0) break;
		else if(x < y){
			t = x;
			x = y;
			y = t;
		}while(y !=0){
			x %=y;
			t = x;
			x = y;
			y = t;
			i +=1;
		}cout << x << " " << i << endl;
		
	}
}

C++: #include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<25;
const double pi=acos(-1);
const double eps=1e-8;
const vi emp;

int x,y;

int gcd(int a,int b,int& t){
	t++;
	if(!b) return a;
	return gcd(b,a%b,t);
}

int main(){
	while(1){
		cin>>x>>y;
		if(!x&&!y) break;
		int t=0;
		if(x<y) swap(x,y);
		cout<<gcd(x,y,t)<<' ';
		cout<<t-1<<endl;
	}
}

C++: #include <iostream>
using namespace std;
int main(void){
   int x, y, temp;
   if (x < y){
       temp = x;
       x = y;
       y = temp;
   }
   
   while (y != 0){
       temp = y;
        y = x % y;
        x = temp;
   }
   return 0;
}