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: Wrong Answer

Solution code:
k=0
ind=0
l=[]
i=int(input())
l.append(i)
def guusuu():
    k=l[ind]/2
    return int(k)
    
def kisuu():
    k=l[ind]*3+1
    return int(k)

while ind<1000:
    if l[ind]%2==0:
        l.append(guusuu())
    else:
        l.append(kisuu())
    ind+=1       

print((l.index(4))+4)

Submission status: Wrong Answer

Solution code:
k=0
ind=0
l=[]
i=int(input())
l.append(i)
def guusuu():
    k=l[ind]/2
    return int(k)
    
def kisuu():
    k=l[ind]*3+1
    return int(k)

while ind<150:
    if l[ind]%2==0:
        l.append(guusuu())
    else:
        l.append(kisuu())
    ind+=1       

print((l.index(4))+4)

Submission status: Wrong Answer

Solution code:
import sys
s=int(input())
L=[]
ans = 1
while s>0:
    if s%2==0:
        ans += 1
        s=s//2
        if s in L:
            print(ans)
            sys.exit()
        else:
            L.append(s)
    else:
        ans += 1
        s=3*s+1
        if s in L:
            print(ans)
            sys.exit()
        else:
            L.append(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = [int(input())]
def fc(n):
    if n%2:
        p = 3*n+1
    else:
        p = n//2
    return p

for i in range(1000000):
    f = fc(a[i])
    if f in a:
        m = i+2
        break
    else:
        a.append(f)
        print(a)
print(m)

Submission status: Wrong Answer

Solution code:
def test():
    s = int(input())
    a = [s]
    b = []
    while 1:
        if s % 2 == 0:
            s = int(s / 2)
            a.append(s)
        elif s % 2 == 1:
            s = 3*s + 1
            a.append(s)
        if a.count(4) == 2:
            b = [i+1 for i,x in enumerate(a) if x == 4]
            break

    print(max(b))


if __name__ == "__main__":
    test()

Submission status: Wrong Answer

Solution code:
s = int(input())
l = []
while s not in l:
  l.append(s)
  if s%2 == 0:
    s = s//2
  else:
    s = 3*s + 1
print(len(l))

Submission status: Wrong Answer

Solution code:
s = int(input())
s_ = s
x = []
counter = 0
#while s != 1:

for _ in range(1000000):
  if s%2 ==0:
    s = s/2
    x.append(s)
  else:
      s = 3*s+1
      x.append(s)
#  counter +=1

if s_ == 4 or s_ == 2 or s_ == 1:
  print(4)
else:
  print(x.index(4)+3)
#print(x)

Submission status: Wrong Answer

Solution code:
s = int(input())
counter = 0
b = 0
while b != 1:
  if s%2 ==0 :
    s = s/2
    b = s
  else:
    s = 3*s+1
    b = s
  counter +=1

print(counter+2)

Submission status: Wrong Answer

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

print(counter+2)

Submission status: Wrong Answer

Solution code:
N = int(input())
C = 0
while(True):
  if N%2 == 0:
    N /= 2
  else:
    N == 3*N + 1
  C += 1
  if N == 1:
    break
print(C+3)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=int(input())
l=[s]
if s!=1:
        for i in range(10**6):
                if l[i]%2==0:
                        l.append(int(l[i]/2))
                else:
                        l.append(int(3*l[i]+1))
                if l[i+1]==1:
                        break
        print(i+3)
else:
        print(4)

Submission status: Wrong Answer

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

print(4 if i < 4 else i+3)

Submission status: Wrong Answer

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

print(max(i+3,4))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())
s_list = []
if s != 1:
    while s != 1:
        if s % 2 == 0:
            s = s / 2
        else:
            s = 3 * s + 1
        s_list.append(s)
    print(len(s_list)+2)
else:
    print(4)

Submission status: Wrong Answer

Solution code:
s = int(input())
s_list = []
while s != 1:
    if s % 2 == 0:
        s = s / 2
    else:
        s = 3 * s + 1
    s_list.append(s)
print(len(s_list)+2)

Submission status: Wrong Answer

Solution code:
s=int(input())
an=[0]*10000000
tmp=[False]*10000000
an[0] = s
m=1
for i in range(1, 1000000):
    if an[i-1] % 2 == 0:
        an[i] = an[i-1]//2
    else:
        an[i] = 3*an[i-1] + 1
    if not tmp[an[i]]:
        tmp[an[i]] = True
    else:
        m=i+1
        break
print(m)

Submission status: Wrong Answer

Solution code:
s=int(input())
an=[0]*10000000
tmp=[False]*10000000
an[0] = s

for i in range(1, 1000000):
    if an[i-1] % 2 == 0:
        an[i] = int(an[i-1]/2)
    else:
        an[i] = 3*an[i-1] + 1
    if not tmp[an[i]]:
        tmp[an[i]] = True
    else:
        print(i+1)
        exit()

Submission status: Wrong Answer

Solution code:
s=int(input())
an=[0]*1000000
tmp=[False]*1000000
an[0] = s
for i in range(1, 1000000):
    if an[i-1] % 2 == 0:
        an[i] = int(an[i-1]/2)
    else:
        an[i] = 3*an[i-1] + 1
    if not tmp[an[i]]:
        tmp[an[i]] = True
    else:
        print(i+1)
        exit()

Submission status: Wrong Answer

Solution code:
s = int(input())

ans = []
count = 1
while True:
    count += 1
    if s % 2 == 0:
        s = s // 2
    else:
        s = 3*s + 1
    if s in ans:
        print(count)
        break
    else:
        ans.append(s)

Submission status: Wrong Answer

Solution code:
s = int(input())
a = s
b = set()
m = 1
while m <= 10**6:
    if a%2 == 1:
        if 3*a+1 in b:
            m += 1
            print(m)
            break
        else:
            b.add(3*a+1)
            a = 3*a+1
            m += 1
    else:
        if a//2 in b:
            m += 1
            print(m)
            break
        else:
            b.add(a//2)
            a = a//2
            m += 1

Submission status: Wrong Answer

Solution code:
s = int(input())
a = []
a.append(s)
i = 0

while True:

    if a[i] % 2 == 0:
        a.append(a[i]/2)
    else:
        a.append(a[i]*3+1)
    if a[i] == 4:
        print(i+4)
        exit()

    i += 1

print(a)

Submission status: Wrong Answer

Solution code:
s = int(input())
ansli = [s]
flg = True
cnt = 2
def f(n):
    if n%2 == 0:
        return int(n/2)
    else:
        return (3*n)-1
while flg:
    cur = f(cnt)
    if cur in ansli:
        print(cnt)
        flg = False
    else:
        ansli.append(cur)
        cnt += 1

Submission status: Wrong Answer

Solution code:
s = int(input())
d={str(s):1}
for i in range(2,1000000):
    s = 3*s+1 if s%2==1 else s/2
    if str(s) in d:
        d[str(s)] = i
        break
    else:
        d[str(s)] = i
print(d[str(s)])

Submission status: Wrong Answer

Solution code:
n = int(input())
count = 0
idx = 1

while count != 2:
    if n == 4:
        count += 1
        if count == 2:
            break
        idx += 1
        n //= 2
        continue

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

print(idx)

Submission status: Wrong Answer

Solution code:
ans = [False] * 200000

def collatz(n, i):
    next_val = n//2 if n % 2 == 0 else 3*n+1
    if ans[next_val]: return i+1
    ans[next_val] = True
    return collatz(next_val, i+1)

def solve():
    s = int(input())
    print(collatz(s, 1))
    
solve()

Submission status: Wrong Answer

Solution code:
ans = [False] * 1000001

def collatz(n, i):
    next_val = n//2 if n % 2 == 0 else 3*n+1
    if ans[next_val]: return i+1
    ans[next_val] = True
    return collatz(next_val, i+1)

def solve():
    s = int(input())
    print(collatz(s, 1))
    
solve()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())

a = []

n = 2
ai = s
while True:
    if ai % 2 == 0:
        ai = ai / 2
    else:
        ai = 3 * ai + 1
    if ai in a:
        break
    a.append(ai)
    n += 1

print(n)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

def even(n):
    return n/2
def odd(n):
    return 3*n+1
a = []
i =0
while True:
    if n%2 ==0:
        n = even(n)
        a.append(n)
    else:
        n = odd(n)
        a.append(n)
    if a.count(n) == 2:
        break
print(len(a)+ 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())

f = [s]

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

Submission status: Wrong Answer

Solution code:
s = int(input())

sets = set([])
count = 1
a = s
while 1:
    count += 1
    if a % 2==0:
        a = a // 2
    else:
        a = a*3 + 1

    if a in sets:
        print(count)
        break
    else:
        sets.add(a)

Submission status: Wrong Answer

Solution code:
def main():
    s = int(input())

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

    a = s
    cnt = 1
    memo = set()
    while True:
        a = f(a)
        cnt += 1
        if a in memo:
            break
        memo.add(a)
    print(cnt)


main()

Submission status: Wrong Answer

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

n=0
while s !=4:
    
    if li[n]%2 ==0:
        li.append(li[n]//2)
        s = li[n]//2
        n+=1
    elif li[n]%2 == 1:
        li.append(3*li[n]+1) 
        s = 3*li[n]+1
        n+=1

print(len(li)+3)

Submission status: Wrong Answer

Solution code:
s=int(input())
c=0
while s>1:
	if s%2==0:
		s//=2
	else:
		s=3*s+1
	c+=1
print(c)

Submission status: Wrong Answer

Solution code:
s=int(input())
c=0
while s>1:
	s=s//2 if s%2==0 else 3*s+1
	c+=1
print(c)

Submission status: Wrong Answer

Solution code:
s=int(input())
c=0
while s>1:
    s=s//2 if s%2==0 else 3*s+1
    c+=1
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())

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

result = []
x = 0
c = 0
i = 0
while True:
  if s == 1:
    ans = [s]
    break
  elif i == 0:
    i += 1
    x = s
  elif c == 2:
    ans = [y for y, z in enumerate(result) if z == result[1]]
    break
  elif int(x) == 1:
    i = 1
    c += 1
    x = result[i]
    continue
  else:
    x = collatz(result[i-1])
    i += 1
  result.append(int(x))

print(sum(ans))

Submission status: Wrong Answer

Solution code:
s = int(input())

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

result = []
x = 0
c = 0
i = 0
while True:
  if s == 1:
    ans = [s]
    break
  elif i == 0:
    i += 1
    x = s
  elif c == 2:
    ans = [y for y, z in enumerate(result) if z == result[1]]
    break
  elif int(x) == 1:
    i = 1
    c += 1
    x = result[i]
    continue
  else:
    x = collatz(result[i-1])
    i += 1
  result.append(int(x))

print(result)

Submission status: Wrong Answer

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 s == 1:
    ans = [s]
    break
  elif i == 0:
    i += 1
    x = s
  elif c == 2:
    ans = [y for y, z in enumerate(result) if z == result[1]]
    break
  elif int(x) == 1:
    i = 1
    c += 1
    x = result[i]
    continue
  else:
    x = collatz(s)
    i += 1
  result.append(int(x))

print(sum(ans))

Submission status: Wrong Answer

Solution code:
s = int(input())
result = 1
while s > 1:
  if s % 2 == 0:
    x = s/2
  elif s % 2 > 0:
    x = (3*s) + 1
  s = x
  result += 1
if result == 1:
  print(result)
else:
  print(result+1)

Submission status: Wrong Answer

Solution code:
s = int(input())
result = 1
tmp = s
while True:
  if tmp == 1:
    break
  elif tmp%2 == 0:
    x = tmp/2
  elif tmp%2 > 0:
    x = (3*tmp) + 1
  tmp = x
  result+=1
print(result+1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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

if x[0]==8:
    print(4)
else:
    for i in range(1,1000000):
        if x[-1]==8:
            print(i+4)
            exit()
    
        elif x[i-1]%2==0:
            x.append(int(x[i-1]/2))
        else: 
            x.append(int(x[i-1]*3+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(i + 3)

Submission status: Wrong Answer

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

s = int(input())

c = 1

l = []

while f(s) not in l:
    l.append(f(s))
    c += 1

print(c+1)

Submission status: Wrong Answer

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

s = int(input())

c = 1

l = []

while f(s) not in l:
    s = f(s)
    l.append(s)
    c += 1

print(c+1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())
a = []
a.append(s)
while a[0] != s:
  if s % 2 ==0:
    s = s//2
    a.append(s)
  else:
    s = 3*s +1
    a.append(s)
print(len(a))

Submission status: Wrong Answer

Solution code:
s = int(input())
a = []
a.append(s)
s += 1
while a[0] != s:
  if s % 2 ==0:
    s = s //2
    a.append(s)
  else:
    s = 3*s +1
    a.append(s)
print(len(a))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

s=int(input())
l=[s]
ans=0
while l[ans]!=4:
    l.append(f(l[ans]))
    ans+=1
print(ans+4)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N=int(input())
s=0
if N==1:
    s=1
else:
    while N>1:
        if N%2==0:
            N//=2
        else:
            N=3*N+1
        s+=1
print(s+2)

Submission status: Wrong Answer

Solution code:
N=int(input())
s=0
while N>1:
    if N%2==0:
        N//=2
    else:
        N=3*N+1
    s+=1
print(s+2)

Submission status: Wrong Answer

Solution code:
s = int(input())
l = [s]
ans = 0
next = 0

for i in range(1000000):
    if len(l) != len(set(l)):
        ans = l[i]
        break

    if l[i] % 2 == 0:
        next = s//2
        l.append(next)
    else:
        next = 3 * s + 1
        l.append(next)

print(ans)

Submission status: Wrong Answer

Solution code:
s = int(input())
res = [s]
idx = 1

while True:
  if s % 2 == 0:
    s = s / 2
  else:
    s = 3 * s + 1
  
  if s in res:
    print(idx)
    break
   
  res.append(s)
  idx += 1

Submission status: Wrong Answer

Solution code:
s = int(input())
res = [s]
idx = 1

while True:
  if s % 2 == 0:
    s = s / 2
  else:
    s = 3 * s + 1
   
  res.append(s)
  
  if s in res:
    print(idx)
    break
    
  idx += 1

Submission status: Wrong Answer

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

for i in range(1,10**6+1):
    if len(set(ans)) != len(ans):
        print(i)
        break
    if s % 2 != 0:
        s = 3 * s + 1
        ans.append(s)
    else:
        s = s // 2
        ans.append(s)
    print(ans)

Submission status: Wrong Answer

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

for i in range(1,10**6):
    if len(set(ans[1:])) != len(ans[1:]):
        print(i)
        break
    if s % 2 != 0:
        s = 3 * s + 1
        ans.append(s)
    else:
        s = s // 2
        ans.append(s)

Submission status: Wrong Answer

Solution code:
s = int(input())
a = []
i = 0
while i <= 100:

    if i == 0:
        a.append(s)
    elif i > 0:
        if a[i - 1] % 2 == 0:
            a.append(a[i - 1] / 2)
        elif a[i - 1] % 2 == 1:
            a.append(3 * a[i - 1] + 1)
        if a[i] in a[:i]:
            print(i + 1)
            exit()
    i += 1

Submission status: Wrong Answer

Solution code:

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


s = int(input())
a = [0]*1000001
a[0] = s

for i in range(1,1000000+1):
    a[i]=func(a[i-1])
print(int(a.index(4))+4)

Submission status: Wrong Answer

Solution code:

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


s = int(input())
a = [0]*1000
a[0] = s

for i in range(1,1000):
    a[i]=func(a[i-1])
print(int(a.index(4))+4)

Submission status: Wrong Answer

Solution code:
a = int(input())
t = [0]*1000000
t[a] = 1
for i in range(2,1000001):
    if a % 2 == 0:
        a //= 2
    else:
        a = 3*a + 1
    print(a)
    if t[a]:
        break
    t[a] = 1
print(i)

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque

input = sys.stdin.readline

s = int(input())
a = deque()
a.append(s)
counter = 0

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

print(counter + 4)

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque

input = sys.stdin.readline

s = int(input())
a = deque()
a.append(s)
counter = 0
for i in range(1000000):
    if a[i] == 4:
        break
    counter += 1
    if a[i] % 2 == 0:
        a.append(int(a[i]/2))
    else:
        a.append(3*a[i] + 1)

print(counter + 4)

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque

input = sys.stdin.readline

s = int(input())
a = deque()
a.append(s)
counter = 0
for i in range(1000000):
    if a[i] == 4:
        break
    counter += 1
    if a[i] % 2 == 0:
        a.append(a[i]/2)
    else:
        a.append(3*a[i] + 1)
    if a[i+1] == 4:
        break

print(counter + 4)

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque

input = sys.stdin.readline

s = int(input())
a = deque()
a.append(s)
counter = 0
for i in range(1000000):
    counter += 1
    if a[i] % 2 == 0:
        a.append(a[i]/2)
    else:
        a.append(3*a[i] + 1)
    if a[i+1] == 4:
        break

print(counter + 4)

Submission status: Wrong Answer

Solution code:
s = int(input())

if s == 1 or s == 2:
    print(4)
else:
    a = [s]
    for i in range(10**9):
        if a[i] % 2 == 0:
            a.append(a[i] // 2)
        else:
            a.append(3*a[i] +1)
            
        if a[i+1] == 4:
            print(i+5)
            break

Submission status: Wrong Answer

Solution code:
s = int(input())

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

Submission status: Wrong Answer

Solution code:
def resolve():
	s=int(input())
	n=2
	cnt=1
	while True:
		cnt+=1
		if s%2==0:
			s//=2
		else:
			s=3*s+1
		if s==4:
			n-=1
			if n==0:
				break
	print(cnt)
resolve()

Submission status: Wrong Answer

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

s = int(input())
cnt = 1
while s>1:
    s = f(s)
    cnt += 1
print(cnt+1)

Submission status: Wrong Answer

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

s = int(input())
cnt = 1
while s!=4:
    s = f(s)
    cnt += 1
print(cnt+3)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())

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

Submission status: Wrong Answer

Solution code:
s = int(input())

cnt = 1
while True:
  if s % 2  == 0:
    s = int(s/2)
  else:
    s = 3*s + 1
  if s == 4:
    break
  else:
    cnt += 1
print(cnt+4)

Submission status: Wrong Answer

Solution code:
N=int(input())
i=1
L=[N]
M=N
while i< 10:
  i+=1
  if M%2==0:
    M=M/2
    L.append(int(M))
  else:
    M=3*M+1
    L.append(int(M))
  if L.count(M) ==2:
    print(i)
    break

Submission status: Wrong Answer

Solution code:
import collections
import copy
s = int(input())
same = 0
List = []
while same == 0:
    if s % 2 == 0:
        s = s / 2
        List.append(s)
        unique = set(copy.copy(List))
        _List = collections.Counter(List)
        for v in unique:
            if _List[v] == 2:
                same += 1
    else :
        s = 3 * s + 1
        List.append(s)
        _List = collections.Counter(List)
        unique = set(copy.copy(List))
        for v in unique:
            if _List[v] == 2:
                same += 1
print(len(List) + 1)

Submission status: Wrong Answer

Solution code:
s=int(input())
v_to_i = {}
cnt = 1
while 1:
    s = (s // 2) if s % 2 == 0 else (s*3+1)
    cnt += 1
    if s in v_to_i:
        break
    v_to_i[s] = cnt

print(cnt)

Submission status: Wrong Answer

Solution code:
s=int(input())
v_to_i = {}
cnt = 1
while 1:
    s = (s // 2) if s % 2 == 0 else s*3 +1
    cnt += 1
    if s in v_to_i:
        break
    v_to_i[s] = cnt

print(cnt)

Submission status: Wrong Answer

Solution code:
s=int(input())
v_to_i = {}
cnt = 1
while 1:
    s = s // 2 if s % 2 == 0 else s*3 +1
    cnt += 1
    if s in v_to_i:
        break
    v_to_i[s] = cnt

print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())
f = lambda n: (n/2) if n%2==0 else (3*n + 1)
prevval = s
history = []
c = 2
while True:
    newval = f(prevval)
    if newval in history:
        break
    history.append(newval)
    c += 1
    prevval = newval
print(c)

Submission status: Wrong Answer

Solution code:
s = int(input())
a = [s]
while 1:
    if a[-1] % 2:
        tmp = 3*a[-1] + 1
    else:
        tmp = a[-1]//2
    if tmp == 4:
        print(len(a)+4)
        break
    else:
        a.append(tmp)

Submission status: Wrong Answer

Solution code:
s = int(input())
l = [-1] * 300
l[1] = s
for i in range(2,200):
    if i % 2 == 0:
        l[i] = l[i - 1] / 2
    else:
        l[i] = 3*l[i - 1] + 1

    print(str(i)+":"+str(l[i]))

    if l[i] in l[:i]:
        print(i)
        break

Submission status: Wrong Answer

Solution code:
s=int(input())
l=[s]*(10**6)
for i in range(10**6):
    if l[i]%2==0:
        l[i+1]=l[i]//2
    else:
        l[i+1]=3*l[i]+1
    if l[i+1]==4:
        print(i+5)
        exit()

Submission status: Wrong Answer

Solution code:
def odd(a):
    return a/2

def even(b):
    return 3*b+1

num = int(input())
box = [num]
cnt = 0
answer = 0
while(True):
    if(num%2 == 0):
        num = odd(num)
    else:
        num = even(num)
    box.append(num)
    for i in range(len(box)-1):
        if(box[i] == num):
            answer = i
    if(answer != 0):
        print(str(i+2))
        break

Submission status: Wrong Answer

Solution code:
num = int(input())
count = 1
ls = []
while True:
    if num % 2 == 0: num = num / 2
    else: num = (3 * num) + 1
    count += 1
    if num in ls: break
    else: ls.append(num)

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())
min = 1000000
arr = [s]
count = 0
count_No1 = 0
n = 0
flg_exit = 0

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

while (not flg_exit) or (min == 1000000):
    temp = func(arr[count])
    if temp == 1:
        count_No1 = count_No1 + 1
        flg_exit = 1 if count_No1 == 2 else flg_exit
    if (temp in arr) and (count_No1 != 1):
        min = count if count < min else min
    else:
        arr.append(int(temp))
        count = count + 1

count = 4 if s == 1 else count

print(count)

Submission status: Wrong Answer

Solution code:
s = int(input())
min = 1000000
arr = [s]
count = 0
count_No1 = 0
n = 0
flg_exit = 0

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

while (not flg_exit) or (min == 1000000):
    temp = func(arr[count])
    if temp == 1:
        count_No1 = count_No1 + 1
        flg_exit = 1 if count_No1 == 2 else flg_exit
    if (temp in arr) and (count_No1 != 1):
        min = count if count < min else min
    else:
        arr.append(int(temp))
        count = count + 1

print(count)

Submission status: Wrong Answer

Solution code:
s = int(input())

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

Submission status: Wrong Answer

Solution code:
import sys
import bisect
input = sys.stdin.readline

N = int(input())

p = N
s = set()
c = 1

while True:
    if p % 2 == 0:
        p = p // 2
    else:
        p = p * 3 + 1
    c += 1
    
    if p in s:
        print(c)
        break
    else:
        s.add(p)

Submission status: Wrong Answer

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

while len(lis) == len(set(lis)):
  if s % 2 == 0:
    lis.append(s / 2)
  else:
    lis.append(3 * s + 1)
    
print(len(lis))

Submission status: Wrong Answer

Solution code:
# coding: utf-8

n = int(input())

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

print(i+3)