Problem:


Score : 200 points

Problem Statement

A sequence a=\{a_1,a_2,a_3,......\} is determined as follows:

The first term s is given as input.

Let f(n) be the following function: f(n) = n/2 if n is even, and f(n) = 3n+1 if n is odd.

a_i = s when i = 1, and a_i = f(a_{i-1}) when i > 1.

Find the minimum integer m that satisfies the following condition:

There exists an integer n such that a_m = a_n (m > n).

Constraints

1 \leq s \leq 100

All values in input are integers.

It is guaranteed that all elements in a and the minimum m that satisfies the condition are at most 1000000.

Input

Input is given from Standard Input in the following format:

s

Output

Print the minimum integer m that satisfies the condition.

Sample Input 1

8

Sample Output 1

5

a=\{8,4,2,1,4,2,1,4,2,1,......\}. As a_5=a_2, the answer is 5.

Sample Input 2

7

Sample Output 2

18

a=\{7,22,11,34,17,52,26,13,40,20,10,5,16,8,4,2,1,4,2,1,......\}.

Sample Input 3

54

Sample Output 3

114



Sample input:
8


Sample output:
5

Submission status: Runtime Error

Solution code:
S = int(input())

A = [S]
idx = 0
while True
  if A[idx] % 2 == 0:
    A.append(A[idx]//2)
  else:
    A.append(A[idx]*3+1)
  if A[idx+1] in A[:idx+1]:
    print(idx+1)
    break
  idx += 1

Submission status: Runtime Error

Solution code:
S = int(input())

A = [S]
idx = 0
while True
  if A[idx] % 2 == 0:
    A.append(idx//2)
  else:
    A.append(idx*3+1)
  if A[idx+1] in A[:idx+1]:
    print(idx+1)
    break
  idx += 1

Submission status: Runtime Error

Solution code:
s = int(input())

def collatz(s):
  if result[i-1] % 2 == 0:
    x = result[i-1]/2
  elif result[i-1] % 2 > 0:
    x = (3*int(result[i-1])) + 1
  return x

result = []
x = 0
c = 0
i = 0
tmp = []
while True:
  if i == 0:
    i += 1
    x = s
  elif c == 2:
    break
  elif int(x) == 1:
    i = 1
    c += 1
    x = result[i]
    continue
  else:
    x = collatz(s)
    i += 1
  result.append(int(x))
list_hoge = [i for i, x in enumerate(result) if x == result[1]]
print(sum(list_hoge))

Submission status: Runtime Error

Solution code:
s = int(input())
result = [s]
tmp = s
while True:
  if tmp == 1:
    break
  elif tmp%2 == 0:
    x = tmp/2
  else:
    x = (3*tmp) + 1
  tmp = x
  result.append(int(x))
print(len(result+1))

Submission status: Runtime Error

Solution code:
a = int(input())
b = [a]
c = 0
while:
  c += 1
  if a % 2 == 0:
    a /= 2
    if b.contain(a):
      print(c)
      exit()
    else:
      b.append(a)
  else:
    a = a * 3 + 1
    if b.contain(a):
      print(c)
      exit()
    else:
      b.append(a)

Submission status: Runtime Error

Solution code:
s = int(input())
lst = []
cnt = 0
While True:
  cnt += 1
  if (s % 2 == 0):
    s = int(s / 2)
  else:
    s = int(3*s + 1)
  lst.append(s)
  if (s in lst):
    break
print(cnt)

Submission status: Runtime Error

Solution code:
N = int(input())
xy = [list(map(int, input().split())) for _ in range(N)]
 
import itertools
hoges = {}
for i in itertools.combinations(xy, 2):
    if i[0][0] - i[1][0] >= 0:
        hoge = (i[0][0] - i[1][0], i[0][1] - i[1][1])
    else:
        hoge = (i[1][0] - i[0][0], i[1][1] - i[0][1])
    hoges.setdefault(hoge, 0)
    hoges[hoge] += 1
# print(hoges)
max_v = max(hoges.values())
print(N - max_v)

Submission status: Runtime Error

Solution code:
def col(a):
  if a % 2 == 0:
    return a//2
  else:
    return a*3 + 1

s = int(input())

an = [a]
i = 1
while True:
  i += 1
  an_1 = col(an[-1])
  if an_1 in an:
    break
  an.append(an_1)

print(i)

Submission status: Runtime Error

Solution code:
def col(a):
  if a % 2 == 0:
    return a//2
  else:
    return a*3 + 1

s = int(input())

an = [a]
i = 1
while True:
  i += 1
  an_1 = col(a)
  if an_1 in an:
    break
  an.append(an_1)

print(i)

Submission status: Runtime Error

Solution code:
s = int(input())
a = [s]

for i in range(2, 1000001):
  if s % 2 == 0:
    s = s / 2
  else:
    s = 3 * s + 1
  
  if s in a:
    print(i)
    break
   
  s.append(s)

Submission status: Runtime Error

Solution code:
def f(i):
  if i%2==0:
    return i//2
  else:
    return i*3+1

a=int(input())
i=1
while True:
  b=f(a[-1])
  i+=1
  if b in a:
    print(i)
    break
  a.append(b)

Submission status: Runtime Error

Solution code:
s = int(input())
memo = [-1]
memo.append(s)
def a(n):
    if memo[n-1] % 2 == 0:
        pre = memo[n-1]/2
        for i in memo:
            if i == pre:
                return n
            else:
                memo.append(pre)
                return a(n+1)
    else:
        pre = 3 * memo[n-1] + 1
        for i in memo:
            if i == pre:
                return n
            else:
                memo.append(pre)
                return a(n+1)

print(a(2))

Submission status: Runtime Error

Solution code:
S=int(input())
count=0
for i in range(1000000):
  if S%2==0:
    S=S/2
  else:
    S=3S+1
  if S==4:
    count+=1
  if count==2:
    break
    
print(i+2)

Submission status: Runtime Error

Solution code:
s = int(input())
a = [s]

while len(a) - len(set(a)) != 0:
  for i in range(1000000):
    m = i+1
    if a[i] % 2 == 0:
      a.append(int(a[i]/2))
    else:
      a.append(3*a[i] + 1)
      
print(m)

Submission status: Runtime Error

Solution code:
n = int(input())
stpo = 0
num_list = []
while stop == 0:
  if n in num_list:
    stop = 1
    print(num_list.index(n)+1)
  else:
    num_list.append(n)
    if n % 2 == 0:
      n //= 2
    else:
      n = 3 * n + 1

Submission status: Runtime Error

Solution code:
s = []
s.append(int(input()))
for i in range(1, 1000000):
	if s %2:
		s.append(3*s+1)
	else:
		s.append(s/2)
	for j in range(i):
		if s[j] == s[i]:
			print(i)

Submission status: Runtime Error

Solution code:
s = input()
l = []

while flag=False:
  if tmp in l:
    flag = True
  else:
    if s % 2 == 0:
      tmp = s / 2
      l.append(tmp)
      s = tmp
    else:
      tmp = 3*s +1
      l.append(tmp)
      s = tmp
      
l.sort()
print(l[-2])

Submission status: Runtime Error

Solution code:
s = int(input())
n = 0
if s==1 or s == 2:
  print("4")
elif s==3:
  print("9")
if s >=4:
  while s % 2 == 0:
  s = s/2
  n += 1
  if s!=1 and s%2 == 1:
    s = 3*s+1
    n+=1
  if s == 1:
    print(n+2)
    break

Submission status: Runtime Error

Solution code:
s=int(input())
if s==1 or s==4 or s==2:
    print(4)
else:
    count=1
    while s!=4:
        if s%2==0:
            s=s/2
            count+=1
        else:
            s=3*s+1
            count+=1
print(count+3)

Submission status: Runtime Error

Solution code:
# coding: utf-8

s = int(input())

i = 0
while n > 0:
    if n % 2 == 0:
        n = n / 2
    else:
        n = 3n+1
    if n == 4:
        break
    else:
        i += 1

print(i+4)

Submission status: Runtime Error

Solution code:
# coding: utf-8

s = int(input())

i = 0
while n > 0:
    if n % 2 = 0:
        n = n / 2
    else:
        n = 3n+1
    if n == 4:
        break
    else:
        i += 1

print(i+4)

Submission status: Runtime Error

Solution code:
s = int(input)

A = []

A.append(s)
a = s
for i in range(10000):
    if a % 2 == 0:
        a = int(a/2)
        A.append(a)
    else:
        a = 3*a+1
        A.append(a)
    if A.count(a) == 2:
        print(len(A))
        break

Submission status: Runtime Error

Solution code:
s = int(input)

A = []

A.append(s)
a = s
for i in range(10000):
    if a % 2 == 0:
        a = int(a/2)
        A.append(a)
    else:
        a = 3*a+1
        A.append(a)
    if A.count(a) == 2:
        print(a)
        break

Submission status: Runtime Error

Solution code:
s=int(input())
a=[s]
for i in range(500):
    if a[i]%2==0:
        a.append(a[i]//2)
    else:
        a.append(a[i]*3+1)
        ans=a.index(4)+4
if s==1 or s==2:
    print(4)
else:
    print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
l = [int(i) for i in input().split()]
if 2 * max(l) - sum(l) < 0:
    print("Yes")
else:
    print("No")

Submission status: Runtime Error

Solution code:
s = int(input())
k=[s]
i = 1
while 1:
	if k[-1]%2 == 0:
  		x = int(k[-1]/2)
	else:
  		x = 3*k[-1]+1
    if x in k:
        print(i+1)
        break
    else:
        k.append(x)
        i+=1

Submission status: Runtime Error

Solution code:
s = int(input())
k=[s]
i = 1
while 1:
	if k[-1]%2 == 0:
  		x = int(k[-1]/2)
	else:
  		x = 3*k[-1]+1
    if x in k:
      print(i+1)
      break
    else:
      k.append(x)
      i+=1

Submission status: Runtime Error

Solution code:
s = int(input())
k=[s]
i = 1
while 1:
	if k[-1]%2 == 0:
  		x = int(k[-1]/2)
	else:
  		x = int(3*k[-1]+1)
    if x in k:
      print(i+1)
      break
    else:
      k.append(x)
      i+=1

Submission status: Runtime Error

Solution code:
s = int(input())
k=[]
k.append(s)
i = 1
while 1:
	if k[-1]%2 == 0:
  		x = k[-1]/2
	else:
  		x = 3*k[-1]+1
    if x in k:
      print(i+1)
      break
    else:
      k.append(x)
      i+=1

Submission status: Runtime Error

Solution code:
s = int(input())

if s == 1 or s == 2:
    print(4)
elif:
    for i in range(1000000):
        if s == 4:
            print(i + 4)
            break

            
        if s % 2 == 0:
            s = s / 2
        else:
            s = 3 * s + 1

Submission status: Runtime Error

Solution code:
s = int(input())

if s == 1 || s == 2:
    print(4)
elif:
    for i in range(1000000):
        if s == 4:
            print(i + 4)
            break

            
        if s % 2 == 0:
            s = s / 2
        else:
            s = 3 * s + 1

Submission status: Runtime Error

Solution code:
a = [int(input())]

for i in range(100000):
  if a[i] % 2 == 0:
    a.append(a[i]//2)
    else:
      a.append(3*a[i] + 1)
    
    if a[i+1] in a[:i]:
      print(i+2)
      break

Submission status: Runtime Error

Solution code:
a = [int(input())]

for i in range(100000):
  if a[i] % 2 == 0:
    a.append(a[i]//2)
    else:
      a.append(3*a[i] + 1)
    
    if a[i+1] in a[:i]
      print(i+2)
      break

Submission status: Runtime Error

Solution code:
lists=[]
lists.append(s)
for i in range(2,1000000):
    print("A",i)
    if lists[-1]%2==0:
        tmp=int(lists[-1]/2)
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()
    else:
        tmp=(3*lists[-1])+1
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()

Submission status: Runtime Error

Solution code:
lists=[]
lists.append(s)
for i in range(2,1000000000000000):
    print("A",i)
    if lists[-1]%2==0:
        tmp=int(lists[-1]/2)
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()
    else:
        tmp=(3*lists[-1])+1
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()

Submission status: Runtime Error

Solution code:
n=int(input().split())
dic=set()
dic|={n}
i=1
while True:
  if n%2==0:
    n=n//2
  else:
    n=3*n+1
  if n in dic:
    print(i+1)
    break
  else:
    dic|={n}
    i+=1

Submission status: Runtime Error

Solution code:
n=int(input().split())
dic=set()
dic|={n}
i=1
while True:
  if n%2==0:
    n=n//2
  else:
    n=3*n+1
  i+=1
  if n in dic:
    print(i)
    break
  else:
    dic|={n}

Submission status: Runtime Error

Solution code:
n=int(input().split())
dic=set()
dic|={1}
i=1
while True:
  if n%2==0:
    n=n//2
  else:
    n=3*n+1
  i+=1
  if n in dic:
    print(i)
    break
  else:
    dic|={i}

Submission status: Runtime Error

Solution code:
n=int(input().split())
dic={n:1}
i=1
while True:
  if n%2==0:
    n=n//2
  else:
    n=3*n+1
  i+=1
  if n in dic:
    print(i)
    break
  else:
    dic[n]=i

Submission status: Runtime Error

Solution code:
n=int(input().split())
dic={n:1}
i=1
while True:
  if n%2==0:
    n=n//2
  else:
    n=3*n+1
  i+=1
  if n in dic:
    print(dic[n])
    break
  else:
    dic[n]=i

Submission status: Runtime Error

Solution code:
def func(a):
    if a % 2 == 0:
        return a//2
    else:
        return 3*a + 1

tab = [False]*1000_001
now = int(input())
ind = 1
while not tab[now]:
    tab[now] = True
    now = func(now)
    ind += 1

print(ind)

Submission status: Runtime Error

Solution code:
s=int(input())
arr=[s]
tmp=0
for i in range(m):
  if arr[i]%2==0:
    tmp=int(arr[i]/2)
  else:
    tmp=arr[i]*3+1
  if tmp in arr:
    print(i+1)
    break
  arr.append(tmp)

Submission status: Runtime Error

Solution code:
lists = input().split()
a = int(lists[0])
b = int(lists[1])
x = int(lists[2]) * 2
answer  = []
next = 0
for num in range(0, x):
    answer.append(a)
    answer.append(b)
    if (len(answer) >= x):
        break
    a += 1
    b -= 1
    if(a == b):
        if(a + num < b - num):
            for b_num in range(b, a):
                answer.append(b_num)
                if (len(answer) >= x):
                    break
        elif(a + num > b - num):
            for a_num in range(a, b):
                answer.append(a_num)
                if (len(answer) >= x):
                    break
        break
answer.sort()
for a in answer:
    print(a)

Submission status: Runtime Error

Solution code:
s=int(input())
A=set([])
while S not in A:
    if S%2==0:
        S//=2
    else :
        S=S*3+1

print(len(A)+1)

Submission status: Runtime Error

Solution code:
an = int(input())

numbers = [an]
while True:
	if an%2 == 1:
		an = 3*an+1
	else:
		an = an//2
	if an in numbers:
		print(len(numbers)+1)
        break
    else:
		numbers.append(an)

Submission status: Runtime Error

Solution code:
an = int(input())

numbers = []
while True:
	if an%2 == 1:
		an = 3*an+1
	else:
		an = an//2
	if an in numbers:
		print(len(numbers)+1)
        break
    else:
		numbers.append(an)

Submission status: Runtime Error

Solution code:
s = int(input())

def func(n):
  if n % 2 == 0:
    return (n/2)
  else:
    return (3n+1)

a = list()
a.append(s)
for i in range(1000):
  a.append(func(a[i]))
for j in range(1001):
  for k in range(1001):
    if (j != k and a[j] == a[k]):
      print(k)
      exit()

Submission status: Runtime Error

Solution code:
s=int(input())
count=0
if s==1:
  print(4)
elif s==2:
  print(4)
else:
  for i in range(1000000):
  if s%2==0:
    s=s//2
    count+=1
    if s==4:
      break
  else:
    s=s*3+1
    count+=1
  print(count+4)

Submission status: Runtime Error

Solution code:
s = int(input())

i = 0
a = []
a.append(s)
b = [0] * 1000

while True:
    if a[i] % 2 == 0:
        a.append(a[i] // 2)
    else:
        a.append(a[i] * 3 + 1)
    b[a[i]] += 1
    if b[a[i]] == 2:
        break
    i += 1

print(i + 1)

Submission status: Runtime Error

Solution code:
s = int(input())

i = 0
a = []
a.append(s)
b = [0] * 300

while True:
    if a[i] % 2 == 0:
        a.append(a[i] // 2)
    else:
        a.append(a[i] * 3 + 1)
    b[a[i]] += 1
    if b[a[i]] == 2:
        break
    i += 1

print(i + 1)

Submission status: Runtime Error

Solution code:
import sys

s = int(input())

i = 0
a = []
a.append(s)
b = [0] * 300

while True:
    if a[i] % 2 == 0:
        a.append(a[i] // 2)
    else:
        a.append(a[i] * 3 + 1)
    b[a[i]] += 1
    i += 1
    for j in range(300):
        if b[j] == 2:
            print(i)
            sys.exit()

Submission status: Runtime Error

Solution code:
s=[int(input())]
i=0
while 1>0:
  if i%2>0:
    b=3*s[i]+1
  else:
    b=s[i]//2
  if b in s:
    print(i+1)
    break
  i+=1

Submission status: Runtime Error

Solution code:
s = int(input())
def func(n):
  if n%2 == 1:
    return 3n+1
  else:
    return n//2
def prog(N):
  if N == 1:
    return s
  else:
    a=s
    for i in range(1,N):
      a = func(a)
    return a

b=[]
for i in range(1,1000001):
  tmp = prog(i)
  if tmp in b:
    print(i)
    break
  else:
    b.append(tmp)

Submission status: Runtime Error

Solution code:
s = int(input())
def func(n):
  if n%2 == 1:
    return 3n+1
  else:
    return n//2
def prog(N):
  if N == 1:
    return s
  else:
    a=s
    for i in range(1,N):
      a = func(a)
    return a

b=[]
for i in range(1,10000):
  tmp = prog(i)
  if tmp in b:
    print(i)
    break
  else:
    b.append(tmp)

Submission status: Runtime Error

Solution code:
s = int(input())
def func(n):
  if n%2 == 1:
    return 3n+1
  else:
    return n/2
def prog(N):
  if N == 1:
    return s
  else:
    a=s
    for i in range(1,N):
      a = func(a)
    return a


while prog(k)==prog(j):

Submission status: Runtime Error

Solution code:
s = int(input())

ans = 0

if (s == 1 || s == 2 || s == 4):
  print(4)

while (s != 4):
  if (s % 2 == 0):
    s /= 2
  else:
    s = 3*s + 1
  ans += 1

print(ans+4)

Submission status: Runtime Error

Solution code:
    i = int(input())
    seen = set()
    seen.add(i)
    temp = i
    for x in range(0,1000000):
      if(temp%2 == 0):
        temp = temp/2
      else:
        temp = 3*temp+1
      if(temp in seen):
        print(x)
        break
      else:
        seen.add(temp)

Submission status: Runtime Error

Solution code:
i = int(input())
seen = set()
seen.add(i)
temp = i
for x in range(0,1000000):
  if(temp%2 == 0):
    temp = temp/2
  else:
    temp = 3temp+1
  if(temp in seen):
    print(x)
    break
  else:
    seen.add(temp)

Submission status: Runtime Error

Solution code:
i = int(input())
seen = set()
seen.add(i)
temp = i
for x in rannge(0,1000000):
  if(temp%2 == 0):
    temp = temp/2
  else:
    temp = 3temp+1
  if(temp in seen):
    print(x)
    break
  else:
    seen.add(temp)

Submission status: Runtime Error

Solution code:
i = int(input())
seen = set()
seen.add(i)
temp = i
for x in rannge(0,1000000):
  if(temp%2 == 0):
    temp = temp/2
  else:
    temp = 3temp+1
  if(temp in seen):
    print(x)
    break

Submission status: Runtime Error

Solution code:
def func(x):
  if(x % 2 == 0):
    return x / 2
  else:
    return 3 * x + 1

s = int(input())
if(s == 1 || s == 2):
  print(4)
  exit()
  
cnt = 1
while(s != 1):
  s = func(s)
  cnt += 1
print(cnt + 1)

Submission status: Runtime Error

Solution code:
s = int(input())
 
ans=0
 
def f(n):
  if (n % 2 == 0):
    return n / 2
  else:
    return 3*n + 1
  
while (True):
  a_n = [s]
  for i in len(a_n):
    if (a_n.count(4) != 2):
      a_i = f(a_n.pop(-1))
      a_n.append(a_i)
    else:
      index = a_n.index(4)
      ans = a_n[index+3]
      break
    
print(ans)

Submission status: Runtime Error

Solution code:
s = int(input())

ans=0

def f(n):
  if (n % 2 == 0):
    return f(n /2)
  else:
    return f(3*n + 1)
  
while (True):
  a_n = [s]
  if (a_n.count(4) != 2):
    a_n.append(f(s))
  else:
    index = a_n.index(4)
    ans = a_n[index+3]
    break
    
print(ans)

Submission status: Runtime Error

Solution code:
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

s = int(input())

ls =[s]
while True:
    if ls[-1] % 2 ==0:
        a = ls[-1]/2
    else:
        a = ls[-1]*3 + 1
    if a in ls:
        break
    else:
        ls.append(a)

print(lsn(ls))

Submission status: Runtime Error

Solution code:
a=int(input())
s=set(a)
i=1
while True:
  if a % 2==1:
    a = a * 3 + 1
  else:
    a = a//2
    
  if a in s:
    break
  s|={a}
  i+=1
print(i)

Submission status: Runtime Error

Solution code:
a=int(input())
s=set(a)
i=1
while True:
  if a % 2==1:
    a = a * 3 + 1
  else:
    a = a//2
    
  if a in s:
    break
  s|=｛a｝
  i+=1
print(i)

Submission status: Runtime Error

Solution code:
l = []
l.append(int(input()))
i = 0
while True:
  if s&2:
    l.append(3*l[i]+1)
  else:
    l.append(l[i]/2)
  i += 1
  for j in range(j,i):
    if l[j] == l[i]:
      break
print(i)

Submission status: Runtime Error

Solution code:
def collatz(a):
    if a%2 == 0:
        return int(a/2)
    else:
        return int(a*3+1)

x = [int(input())]

for i in range(1, 1000001):
    a = collatz(x[i-1])
    if a in x:
        print(i+1)
    else:
        x.append(a)

Submission status: Runtime Error

Solution code:
s = int(input())
lst = []
lst.append(s)
i = 2
while true:
  if i % 2 == 0:
    a = i / 2
  else:
    a = 3 * i + 1
  if a in lst:
    print(i)
    break
  lst.append(a)

Submission status: Runtime Error

Solution code:
def next_num(n):
  if n%2:
    return 3*n+1
  else:
    return n/2

s = int(input())

n = s
for i in range(1000000):
  if n in [1,2,4]:
    print(i+4)
    break
  except:
    n = next_num(n)

Submission status: Runtime Error

Solution code:
def next_num(n):
  if n%2:
    return 3*n+1
  else:
    return n/2

s = int(input())

n = s
for i in range(1000000):
  ind = [1,2,4].index(n)
  if n >= 0:
    print(ind+i+2)
    break
  n = next_num(n)

Submission status: Runtime Error

Solution code:
def func(long n):
    if n % 2 == 0:
        return n / 2
    else:
        return 3*n + 1

s = int(input())

data = set()
data.add(s)
for i in range(1000010):
    l = len(data)
    val = func(s)
    data.add(val)
    if l == len(data):
        print(i+2)
        break
    s = val

Submission status: Runtime Error

Solution code:
def func(long n):
    if n % 2 == 0:
        return n / 2
    else:
        return 3*n + 1

s = int(input())

data = set(s)

for i in range(1000010):
    l = len(data)
    val = func(s)
    data.add(val)
    if l == len(data):
        print(i+2)
        break
    s = val

Submission status: Runtime Error

Solution code:
s = input()
def f(n):
  if n%2 == 0:
    return n/2
  else:
    return 3*n+1
a = []
a.append(s)
for i in range(1,1000001):
  if f(a[i-1]) in a:
    print(i)
    break
  else:
    a.append(f(a[i-1]))

Submission status: Runtime Error

Solution code:
s = int(input())
an = []
an.append(s)
n = s
if an.index(1 or 2) == 0:
    print(4)
while an.count(4) != 2:
    if n % 2 == 0:
        n /= 2
        an.append(int(n))
    else:
        n = 3 * n + 1
        an.append(int(n))
print(an.index(4) + 4)

Submission status: Runtime Error

Solution code:
n=int(input())
cnt=[0]*300
cnt[n-1]=1
i=1
while True:
    if n%2==0:
        n//=2
    else:
        n=3*n+1
    i+=1
    if cnt[n-1]==1:
        print(i)
        exit()
    cnt[n-1]=1

Submission status: Runtime Error

Solution code:
s = int(input())

a = [s]
def f(n):
    if n % 2 == 0:
        return(n//2)
    else:
        return(3*n+1)

for i in range(1000001):
    if f(a[i]) in a:
        print(i+1)
        break
    a.append(f(a[i])

Submission status: Runtime Error

Solution code:
s = int(input())

a = [s]
def f(n):
    if n % 2 == 0:
        return(n//2)
    else:
        return(3*n+1)

for i in range(1000001):
    if f(a[i]) in a:
        print(i+1)
        break
    a.append(f(a[i])

Submission status: Runtime Error

Solution code:
s = input()
a = [s]
def f(n):
    if n % 2 == 0:
        return(n//2)
    else:
        return(3*n+1)
i = 0
while True:
    if f(a[i]) in a:
        print(i+1)
        break
    a.append(f(a[i])
    i += 1

Submission status: Runtime Error

Solution code:
from collections import Counter

s = int(input())
a = [s]
def f_even(n):
    return n//2
def f_odd(n):
    return 3*n + 1
for i in range(100):
    if a[i]%2 == 0:
        a.append(f_even(a[i]))
    else:
        a.append(f_odd(a[i]))
    tmp = Counter(a).most_common()[0]
    if tmp[1] > 1:
        print(i+2)
        return

Submission status: Runtime Error

Solution code:
#n = map(int,input().split())
mlist = list(map(int,input().split()))

i=0
while(True):
    i=i+1
    if mlist[i] % 2 == 0:
        mlist.append(mlist[i]/2)
    else:
        mlist.append(3*mlist[i]+1)
    for item in range(1,i):
        if mlist[0]==item:
            break
print(i)

Submission status: Runtime Error

Solution code:
n = map(int,input().split())
#xlist = list(map(int,input().split()))

mlist=[n]
i=0
while(True):
    i=i+1
    if n % 2 == 0:
        mlist.append(n/2)
    else:
        mlist.append(3*n+1)
    for item in mlist:
        if mlist[0]==item:
            break

print(i)

Submission status: Runtime Error

Solution code:
s = int(input())
a = [s]
i = 1

f = lambda n: n // 2 if n % 2 == 0 else 3 * n + 1

while true:
    a.append(f(a[i-1]))
    i += 1

    if a[-1] in a[:-1]:
        break

print(i)

Submission status: Runtime Error

Solution code:
def f(n):
  if n % 2 == 0:
    return n//2
  else:
    return 3*n + 1


s = int(input())
a = [s]
i = 0
while True:
  s = f(a[i])
  if a in s:
    print(i)
    break
  else:
    a.append(s)
    i += 1

Submission status: Runtime Error

Solution code:
def f(n):
  if n % 2 == 0:
    return n//2
  else:
    return 3*n + 1


s = int(input())
a = [s]
i = 0
while True:
  s = f(a[i])
  if a in s:
    print(i)
    break
  else:
    a.ppend(s)
    i += 1

Submission status: Runtime Error

Solution code:
colatz=1,2,4
colatz.append(list(map(int,input().split())))
b=3
while colatz[b]!=colatz[b-3]:
    if colatz[b]%2==0:
        colatz.append(colatz[b]/2)
    else: colatz.append(3*colatz[b]+1)
    b=b+1
print(b)

Submission status: Runtime Error

Solution code:
def odd(n):
    return 3 * n + 1

def even(n):
    return n / 2

s = input("s=")

a_n = [int(s)]

for i in range(100):
    if a_n[i] % 2 == 0:
        a_n.append(even(a_n[i]))
    else :
        a_n.append(odd(a_n[i]))

flag = False

for i in range(len(a_n)):
    for k in range(100):
        if a_n[i] == a_n[i+k+1]:
            print(i + k + 1)
            flag = True
            break
    if flag:
        break

Submission status: Runtime Error

Solution code:
def f(x):
	if x % 2 == 0:
    	return x//2
	else:
		return 3*x+1

s = int(input())
a = [s]
m = 1
while True:
	t = f(s)
    m += 1
    if t not in a:
    	a.append(t)
        s = t
	else:
    	break
print(m)

Submission status: Runtime Error

Solution code:
def f(x):
  if x % 2 == 0:
    return x//2
  else:
    return 3*x+1
  
s = int(input())
a = [s]
m = 1
while True:
	t = f(s)
    m += 1
	if t not in a:
      a.append(t)
      s = t
    else:
      break
print(m)

Submission status: Runtime Error

Solution code:
n = int(input())
cnt = 1
if n>=3:
    cnt = cnt + 1
elif n=2:
    cnt = cnt + 2
else:
    cnt = cnt + 3
while n != 1:
    if n % 2 == 0:
        n /= 2
    else:
        n = 3*n+1
    cnt += 1
print(cnt)

Submission status: Runtime Error

Solution code:
s = int(input())
def functionF(n):
    result = n/2 if n % 2 == 0 else 3 * n + 1
    return int(result)
def calc(s):
  array = []
  for i in range(1,1000000):
    if i == 1:
      array.append(s)
      elif i > 1:
        array.append(functionF(array[i - 2]))
        return array
def result(s):
    result = calc(s)
    for i in range(1, 1000000):
#         print('i',i)
        for k in range(i):
#             print('k',k)
#             print(result[i], result[k])
            if result[i] == result[k]:
                print(i - 1)
                return

Submission status: Runtime Error

Solution code:
while(flg):
    a.append(func(a[i]))
    #print(a)
    for k in range(len(a)):
        for l in range(1, len(a)-k): 
            if a[k] == a[k+l]:
                print(k+l+1)
                break
        else:
            continue
        break   
        
    i += 1

Submission status: Runtime Error

Solution code:
n = int(input())
x = set(n)
cnt = 1

while True:
    
    cnt += 1
    
    if n%2 == 0:
        n //=2
        
    else:
        n = n * 3 + 1

    if n in x:
        print(cnt)
        break
    else:
        x.add(n)

Submission status: Runtime Error

Solution code:
n = int(input())
x = set(n)
cnt = 1

while True:
    
    cnt += 1
    
    if n%2 == 0:
        n //=2
        
    else:
        n = n * 3 + 1

    if n in x:
        print(cnt)
        exit()
    else:
        x.add(n)

Submission status: Runtime Error

Solution code:
s=int(input())
m = 0
for i in range(1000000)
	if s == 1 or s == 2 or s == 4:
    	m = i+4
        break
    elif s%2 == 0:
        s = int(s/2)
    else:
        s = 3*s+1
        
print(m)

Submission status: Runtime Error

Solution code:
#include "bits/stdc++.h"

using namespace std;
#ifdef _DEBUG
#define _GLIBCXX_DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

#define int long long
#define ll long long
#define ll1 1ll
#define ONE 1ll
#define DBG 1
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define loop(n) rep(loop, (0), (n))
#define all(c) begin(c), end(c)
const int INF =
sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
using pii = pair<int, int>;
// template<class T> ostream &operator<<(ostream &os,T &t){dump(t);return os;}
template <typename T, typename S>
istream &operator>>(istream &is, pair<T, S> &p) {
	is >> p.first >> p.second;
	return is;
}
template <typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> &p) {
	os << p.first << " " << p.second;
	return os;
}

template <typename T> void printvv(const vector<vector<T>> &v) {
	cerr << endl;
	rep(i, 0, v.size()) rep(j, 0, v[i].size()) {
		if (typeid(v[i][j]).name() == typeid(INF).name() and v[i][j] == INF) {
			cerr << "INF";
		}
		else
			cerr << v[i][j];
		cerr << (j == v[i].size() - 1 ? '\n' : ' ');
	}
	cerr << endl;
}
/*
typedef __int128_t Int;
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
std::ostream::sentry s(dest);
  if (s) {
	__uint128_t tmp = value < 0 ? -value : value;
	char buffer[128];
	char *d = std::end(buffer);
	do {
	  --d;
	  *d = "0123456789"[tmp % 10];
	  tmp /= 10;
	} while (tmp != 0);
	if (value < 0) {
	  --d;
	  *d = '-';
	}
	int len = std::end(buffer) - d;
	if (dest.rdbuf()->sputn(d, len) != len) {
	  dest.setstate(std::ios_base::badbit);
	}
  }
  return dest;
}

__int128 parse(string &s) {
  __int128 ret = 0;
  for (int i = 0; i < s.length(); i++)
	if ('0' <= s[i] && s[i] <= '9')
	  ret = 10 * ret + s[i] - '0';
  return ret;
}
*/

#ifndef _DEBUG
#define printvv(...)
#endif
void YES(bool f) { cout << (f ? "YES" : "NO") << endl; }
void Yes(bool f) { cout << (f ? "Yes" : "No") << endl; }
template <class T> bool chmax(T &a, const T &b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template <class T> bool chmin(T &a, const T &b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

signed main(signed argc, char *argv[]) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(12);

	int s; cin >> s;
	set<int>st;
	st.insert(s);
	auto f = [&](int n) {
		if (n % 2 == 0)return n / 2;
		else return 3 * n + 1;
	};
	int i = 2;
	for (;; i++) {
		s = f(s);
		if (st.count(s))break;
		st.insert(s);
	}
	cout << i  << endl;

	return 0;
}

Submission status: Runtime Error

Solution code:
s=int(input())
i=4
while s>4or3==s:s=[s//2,s*3+1][s%2];i+=1
print(i)

Submission status: Runtime Error

Solution code:
def f(n):
    if n%2==0:
        n//2
    else:
        3*n+1
s=int(input())
a=list()
i=1
while 1:
    if f(s) in a:
        break
    a.append(f(s))
    s=f(s)
    i+=1
print(i)

Submission status: Runtime Error

Solution code:
def f(n):
  if N%2 == 0:
    return n //2
  return 3*n+1

s = int(input())
ans = 1
used = set()
while True:
  if s in used:
    break
  used.add(s)
  ans += 1
  s = f(s)
print(ans)

Submission status: Runtime Error

Solution code:
n=input()
A=[]
A.append(n)
for i in range(2,10**6):
  if n%2==0:
    n/=2
  else:
    n=3*n+1
  if n in A:
    print(i)
    exit()
  else:
    A.append(n)

Submission status: Runtime Error

Solution code:
s = map(int,input().split())
i = 1
r = [s]
while True:
  i += 1
  s = s // 2 if s % 2 == 0 else 3 * s + 1
  if s in r:
    print(i)
    break
  r += [s]

Submission status: Runtime Error

Solution code:
s = int(input())
if s == 1 or s == 2:
    print(4)
    res = 1
else:
    while True:
        if s == 4:
            break
        else:
            if s % 2 == 0:
                s = s // 2
            else:
                s = 3 * s + 1
            res += 1

    print(res+3)