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 <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<iostream>
#include<map>
using namespace std;
int gcd(int x, int y);
int euc(int x, int y, int f);
int main(){
  int n,m;
  while(cin >>n>>m,n||m){
    if(n<m){int c = n; n = m; m = c;}
    cout <<gcd(n,m)<<" "<<euc(n,m,0)<<endl;
  }
  return 0;
}
int gcd(int x, int y){
  if(y == 0){return x;}
  return gcd(y,x%y);
}
int euc(int x, int y, int f){
  if(y == 0){return f;}
  f++;
  return euc(y,x%y,f);
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

pii gcd(int a, int b, int c = 0) {
  return b == 0 ? pii(a, c) : gcd(b, a % b, c + 1);
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int a, b;
  while (cin >> a >> b, a) {
    if (a < b) swap(a, b);
    pii g = gcd(a, b);
    cout << g.first << " " << g.second << endl;
  }

  return 0;
}

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

int gcd(int a, int b, int step);

int main()
{
	int a, b;

	while (cin >> a >> b, a){
		int step = 0;
		gcd(a, b, step);
	}

	return (0);
}

int gcd(int a, int b, int step)
{
	if (b == 0){
		cout << a << " " << step << endl;
	}
	else if (a < b){
		return (gcd(a, b % a, step + 1));
	}
	else {
		return (gcd(b, a % b, step + 1));
	}
}

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

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




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

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

int main(){
	int x, y, tmp, count;
	while(cin>>x>>y, x&&y){
		if(x<y){
			tmp=x;
			x=y;
			y=tmp;
		}
		count=0;
		while(y!=0){
			x %= y;
			tmp=x;
			x=y;
			y=tmp;
			count++;
		}
		printf("%d %d\n", x, count);
	}
	return 0;
}

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


int main(void)
{
  int a, b, x, y, z, i=0;

  while(scanf("%d %d", &a, &b) != EOF)
  {

   i = 0;

  if(a != 0 || b != 0)
  {
    if(a >= b)
    {
      x = a;
      y = b;
    }

    else
    {
      x = b;
      y = a;
    }

  do{
      x = x%y;
      z = x;
      x = y;
      y = z;
      i++;
     }while(y!=0);

  printf("%d %d\n", x, i);
  }
  }

  return 0;
}

C++: #include<iostream>
using namespace std;
int main() {
	int a, b,r, kouyaku[1001], kazu[1001],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<iostream>
#include<algorithm>
using namespace std;

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

C++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;

int gcd(int a, int b, int & step){
    return b ? step++, gcd(b, a%b, step) : a;
}

int main(int argc, char ** argv) {
    int a, b;
    while (scanf("%d%d", &a, &b), a != 0){
        if (a < b) swap(a, b);
        int g, k = 0;
        g = gcd(a, b, k);
        printf("%d %d\n", g, k);
    }
}

C++: #include <iostream>
#include <algorithm>
using namespace std;
 
int main(){
    long long int a,b,x,y,z,st;
     
    while(cin >> a >> b,a,b){
        x=max(a,b);
        y=min(a,b);
        st=0;
        while(1){
            if(y==0) break;
            z=x%y;
            x=y;
            y=z;
            st++;
        }
        cout << x << ' ' << st << endl;
    }
     
    return 0;
}

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

int bin_search(int x[],int size,int key)
{
	int low = 0,high = size;
	int count=1;
	while(low < high){
		int mid = (low+high)/2;
		if(x[mid] == key)
			return count;
		else if(x[mid] > key)
			high = mid-1;
		else
			low = mid+1;
		count++;
	}
	return count;
}
int main()
{
	int size;
	int key;
	int x[101];
	while(cin >> size){
		if(size == 0)
			break;
		for(int i=0;i<size;i++){
			cin >> x[i];
		}
		cin >> key;
		cout << bin_search(x,size,key) << endl;
	}
	return 0;
}