Go: // AOJ Collatz's Problem :http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0158

package main

import (
	"fmt"
)

func main() {
	for {
		var n int

		fmt.Scanf("%d", &n)

		if n == 0 {
			break
		}

		count := 0
		for n != 1 {
			if n%2 == 0 {
				n /= 2
			} else {
				n = n*3 + 1
			}
			count++
		}
		fmt.Println(count)
	}
}

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

int main()
{
  int n;
  while (cin >> n, n){
    int cnt = 0;
    while (n != 0){
      if (n % 2 == 0) n /= 2;
      else n = n * 3 + 1;
      cnt++;
    }
    cout << cnt << endl;
  }
  return (0);
}

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

int main(){

	int n, cnt;
	
	while(cin >> n){
		if(n == 0) break;
		cnt = 0;
		
		while(1){
			if(n % 2 == 0) n /= 2;
			else n = 3 * n + 1;
			cnt++;
			if(n == 1) break;
		}
		
		cout << cnt << endl;
	}

	return 0;

}

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

int main(void){

	int n;
	while(cin >> n, n){
		int cnt = 0;
		while(n != 1){
			cnt++;
			if(n % 2 == 1){
				n = n * 3 + 1;
			}else{
				n /= 2;
			}
		}
		cout << cnt << endl;
	}

}

C++: #include<bits/stdc++.h>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
  int n;
  while(1){
    cin>>n;
    if(n==0)break;
    int cnt=0;
    while(n!=1){
      if(n%2==0)n/=2;
      else n=3*n+1;
      cnt++;
    }
    cout<<cnt<<endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){
	while(1){
        int n,i;
        cin>>n;
        if(n==0)break;
        for(i=0;n!=1;i++){
            if(n%2==0)n/=2;
            else if(n%2==1)n=n*3+1;
            //cout<<n<<endl;
        }
        cout<<i<<endl;


	}
	return 0;
}

C++: #include <bits/stdc++.h>
#define r(i,n) for(int i=1;i<n;i++)
using namespace std;
int main(){
  long long n,p,a,b;
  while(cin>>n,n){
    long int s=0;
    while(n!=1){
      if(!(n%2))n/=2;
      else n=n*3+1;
      s++;
    }
    cout<<s<<endl;
  }
}

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

using namespace std;

int main(void) {
	long n;
	int cnt;

	while (cin >> n, n) {
		cnt = 0;
		while(n != 1) {
			if (n % 2 == 0) {
				n /= 2;
			}
			else {
				n = n * 3 + 1;
			}
			cnt++;
		}
		cout << cnt << endl;
	}

	return 0;
}

C++: #include"bits/stdc++.h"
using namespace std;
int num=0;
void check(int n){
  if(n==1)
    return;
  if(n%2==0){
    check(n/2);
    num++;
  }else{
    check((n*3)+1);
    num++;
  }
}
int main(){
  int n;
  while(cin>>n,n!=0){
    num=0;
    check(n);
    cout<<num<<endl;
  }
  return 0;
}

C++: #include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define pb push_back

using namespace std;

int main() {
	//freopen("0158.inp", "r", stdin);
	int n = 1;
	while (n != 0) {
		cin >> n;
		if (!n) break;
		int count = 0;
		while (n != 1) {
			if (n % 2 == 0) n /= 2;
			else n = 3 * n + 1;
			count++;
		}
		cout << count << endl;
	}
}

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

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int n;
  while (cin >> n, n) {
    int ans = 0;
    while (n != 1) {
      if (n & 1) n = 3 * n + 1;
      else n >>= 1;
      ans++;
    }
    cout << ans << endl;
  }

  return 0;
}

C++: #include <iostream>
#include <fstream>
#include <typeinfo>
#include <vector>
#include <cmath>
#include <map>
#include <string>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <iomanip>
#include <cctype>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
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<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);
const double eps=1e-8;

int n;

int main(){
	while(1){
		cin>>n;
		if(!n) break;
		int ans=0;
		while(n!=1){
			if(n%2) n=n*3+1;
			else n/=2;
			ans++;
		}
		cout<<ans<<endl;
	}
}

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

int main(void){
	int in, ct=0;
	cin >> in;
	while (true){
		if (in % 2 == 0){
			in = in / 2;
			ct++;
		}
		else {
			in = in * 3 + 1;
			ct++;
		}
		if (in == 1){
			break;
		}
	}
	cout << ct << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
int main(void){
    int n,count;
    count=0;
    while (cin>>n) {
        if (n==0) {
            break;
        } else {
            while (n>1) {
                if (n%2==0) {
                    n=n/2;
                    count++;
                } else {
                    n=n*3+1;
                    count++;
                }
            }
        }
        cout<<count<<endl;
        count=0;
    }
}

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

int main(){
        int a,b;
        while(1){
                scanf("%d",&a);
                if(!a)
                        break;
                b=0;
                for(;;){
                        if(a==1){
                                printf("%d\n",b);
                                break;
                        } else if(a%2){
                                a=a*3+1;
                                b++;
                        }else{
                                a/=2;
                                b++;
                        }
                }
        }
        return 0;
}

C++: #include <iostream>

using namespace std;

int main(void){
    int i,j,k,l;
    int data;
    
    while(true){
        cin>>data;
        if(data==0)break;
        
        k=0;
        while(data!=1){
            if(data%2==0){
                data=data/2;
            }
            else{
                data=data*3+1;
            }
            k++;
        }
        cout<<k<<endl;
    }
    return(0);
}

C++: #include<bits/stdc++.h>
using namespace std;
void serch(int n,int now)
{
    if(n==1)cout<<now<<endl;
    else if(n%2==0)serch(n/2,now+1);
    else serch(n*3+1,now+1);
}
int main()
{
    int n;
    while(cin>>n,n)serch(n,0);
}

C++: // Tazoe

#include <iostream>
using namespace std;

int main()
{
	while(true){
		int n;
		cin >> n;

		if(n==0)
			break;

		int cnt = 0;

		while(n!=1){
			if(n%2==0){
				n = n/2;
			}
			else{
				n = n*3+1;
			}

			cnt++;
		}

		cout << cnt << endl;
	}

	return 0;
}

C++: #include<iostream>
//#include<algorithm>
//#include<cmath>
//#include<string>
//#include<cctype>
#include <vector>
using namespace std;
int main() {
	int n;
	while (cin >> n) {
		if (n == 0)break;
		int c = 0;
		while (n != 1)
			n = n % 2 ? n * 3 + 1 : n / 2, c++;
		cout << c << endl;
	}
	return 0;
}

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

#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define all(c) (c).begin(), (c).end()
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

int main() {
  long long n;
  while(cin >> n, n) {
    int cnt = 0;
    while(n != 1) {
      if(n%2 == 0) n /= 2;
      else n = 3*n + 1;
      cnt++;
    }
    cout << cnt << endl;
  }
}