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:
s = int(input())

def f(n):
    if n%2 == 0:
        return n/2
    else:
        return 3*n+1
    
memo = {i: 0 for i in range(1, 999999)}

a = s
i = 1

while(True):
    if memo[f(a)]:
        i += 1
        break

    a = f(a)
    memo[a] = 1
    i += 1
    
print(i)

Submission status: Wrong Answer

Solution code:
s = int(input())
num = [0]*1000006
a = []
a.append(s)
for i in range(1, 1000001):
    if a[i-1] % 2 == 0:
        tmp = a[i-1] // 2
    else:
        tmp = 3 * a[i-1] + 1
    a.append(tmp)
    
    if num[a[i]] == 1:
        print(i + 1)
        exit()
    
    num[a[i]] = 1

Submission status: Wrong Answer

Solution code:
s = int(input())
a = s
lis = list()

while True:
    if (s % 2) == 0:
        s = s / 2
        if s in lis:
            break
        lis.append(int(s))
    else:
        s = 3*s + 1
        if s in lis:
            break
        lis.append(int(s))
if (a ==1) or (a == 2) or (a == 4):
    print(3)
else:
    print(len(lis)+2)

Submission status: Wrong Answer

Solution code:
s = int(input())
a = s
lis = list()

while True:
    if (s % 2) == 0:
        s = s / 2
        if s in lis:
            break
        lis.append(int(s))
    else:
        s = 3*s + 1
        if s in lis:
            break
        lis.append(int(s))
if a ==1 or a == 2 or a == 4:
    print(a+3)
else:
    print(len(lis)+2)

Submission status: Wrong Answer

Solution code:
s = int(input())

lis = list()

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

print(len(lis)+2)

Submission status: Wrong Answer

Solution code:
s = int(input())

i = 1
while True:
    if s == 4:
        print(i+3)
        exit(0)
    if s % 2 == 0:
        s /= 2
    else:
        s = 3 * s + 1
    i += 1

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
def collatz(number):
    if number % 2 == 0:
        return number // 2  # 整数の商
    else:  # elseで良い
        return 3 * number + 1  # // intは不要では？


number = int(input())
a = [number]
while True:
    number = collatz(number)
    a += [number]

    if number == 1:
        break
if 4 in a:
    print(a.index(4)+4)
elif 2 in a:
    print(a.index(2)+4)
else:
    print(a.index(1)+4)

Submission status: Wrong Answer

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

l=l[x+1:]
y=l.index(4)

print(y+x+2)

Submission status: Wrong Answer

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

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

m = 1
c = 1
while f(m) not in a:
    a.append(f(m))
    m = f(m)
    c += 1

print(c)

Submission status: Wrong Answer

Solution code:
def resolve():
    s = int(input())
    ans = [s]
    count = 0
    while True:
        if ans[count]%2 == 0:
            ans.append(ans[count]//2)
        else:
            ans.append(ans[count]*3+1)
        if ans[count] == 4:
            print(count+4)
            exit()
        else:
          count += 1
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    s = int(input())
    ans = [s]
    count = 0
    while True:
        if ans[count]%2 == 0:
            ans.append(ans[count]/2)
        else:
            ans.append(ans[count]*3+1)
        count += 1
        if ans[count] == 4:
            print(count+4)
            exit()
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    s = int(input())
    ans = [s]
    count = 0
    while True:
        if ans[count]%2 == 0:
            ans.append(ans[count]/2)
        else:
            ans.append(ans[count]*3+1)
        if ans[count] == 4:
            print(count+4)
            exit()
        else:
          count += 1
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    s = int(input())
    ans = [s]
    count = 0
    while True:
        if ans[count]%2 == 0:
            ans.append(ans[count]/2)
        else:
            ans.append(ans[count]*3+1)
        count += 1
        if ans[count] < 1:
            ans[count] = ans[count-1]
        if ans[count] == 4:
            print(count+3)
            exit()
resolve()

Submission status: Wrong Answer

Solution code:
def resolve():
    s = int(input())
    ans = [s]
    count = 0
    while True:
        if ans[count]%2 == 0:
            ans.append(ans[count]/2)
        else:
            ans.append(ans[count]+3)
        count += 1
        if ans[count] < 1:
            ans[count] = ans[count-1]
        if ans[count] == 4:
            print(count+4)
            exit()
resolve()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
s = int(input())

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3

S = int(input())

e = S
cnt = 0
while True:
    if e % 2 == 0:
        v = e//2
    else:
        v = 3*e+1
    e = v
    cnt += 1
    if v == 4:
        print(cnt+4)
        exit()

Submission status: Wrong Answer

Solution code:
import sys
import math
from collections import Counter
import itertools
import fractions
import datetime
from decimal import Decimal
#from functools import reduce

# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SR(): return sys.stdin.readline().rstrip()

ascii_lowercase = 'abcdefghijklmnopqrstuvwxyz'
ascii_uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
ascii_uppercase2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ'

# リストを改行区切りで出力する
p2D = lambda x: print(*x, sep="\n")
p2E = lambda x: print(''.join(x))
p2S = lambda x: print(*x, sep=" ")

# ###########################################

s=II()
se = set()
cnt = 1
while True:
    if s%2==0:
        s/=2
    else:
        s = 3*s+1
    cnt += 1
    if s in se:
        print(cnt)
        exit()
    else:
        se.add(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def resolve():
    N = int(input())
    ans = 1
    for i in range(100):
        if N == 1 or N == 2 or N == 4:
            break
        elif N % 2 == 0 :
            N = N//2
            ans = ans + 1
        else:
            N = 3*N+1
            ans = ans+1 
    print(ans + 3)
resolve()

Submission status: Wrong Answer

Solution code:
def collatz(x):
  ret=[]
  while(x>1):
    if(x%2):
      x=3*x+1
    else:
      x/=2
    ret.append(x)
  return ret

print(len(collatz(int(input())))+2)

Submission status: Wrong Answer

Solution code:
s = int(input())
count_4 = 0
num_list = [0,0]
while True:
  num_list.append(s)
  length_num_list = len(num_list)
  if num_list[length_num_list - 3] == 4 and num_list[length_num_list - 2] == 2 and num_list[length_num_list - 1] == 1:
    break

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

print(len(num_list) - 1 )

Submission status: Wrong Answer

Solution code:
s = int(input())
i = 2
al = set()
while(True):
    if s%2 == 0:
        s /= 2
    else:
        s = s*3 +1
    
    if s in al: break
    else:
        i += 1
        al.add(s)


print(i)

Submission status: Wrong Answer

Solution code:
s = int(input())
count_4 = 0
num_list = []
while not count_4 > 1:
  num_list.append(s)
  if s == 4:
    count_4 += 1

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

print(len(num_list))

Submission status: Wrong Answer

Solution code:
s = int(input())
count = 0

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

print(count + 2)

Submission status: Wrong Answer

Solution code:
s = int(input())
cnt = 0
cnt4 = 0

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

Submission status: Wrong Answer

Solution code:
s = int(input())
a_i = s
v = set()
for i in range(2, 1000000):
    if (i - 1) % 2 == 0:
        a_i = int((a_i - 1) // 2)
    else:
        a_i = (a_i - 1) * 3 + 1
    if a_i in v:
        print(i)
    v.add(a_i)

Submission status: Wrong Answer

Solution code:
s = int(input())
a = [0]*3
an = s
cnt = -2

for i in range(10**5):
	if  i > 3 and a[i] == a[i-3]:
		cnt += 1
		break
	else:
		if an%2 == 0:
			cnt += 1
			an //=2
			a.append(an)
		else:
			cnt += 1
			an = 3*an+1
			a.append(an)
print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

while True:
    if s % 2 == 0:
        s = s/2
        a.append(s)
        if s ==4:
            print(len(a)+4)
            break
        else:
            True
    else:
        s = 3*s+1
        a.append(s)
        if s == 4:
            print(len(a) + 4)
            break
        else:
            True

Submission status: Wrong Answer

Solution code:
s=int(input())

def collatz(n):
    if n%2==0:
        return int(n/2)

    else:
        return 3*n + 1

d={}
for i in range(10000001):
    d[i]=0

now =s
num =1
while True:

    now = collatz(now)
    num +=1

    if d[now]!=0:
        print(num)
        exit(0)
    else:
        d[now]+=1

Submission status: Wrong Answer

Solution code:
s=int(input())

def collatz(n):
    if n%2==0:
        return int(n/2)

    else:
        return 3*n + 1

d={}
for i in range(1000001):
    d[i]=0


now =s
num =1
while True:

    now = collatz(now)
    num +=1

    if d[now]==1:
        print(num)
        exit(0)
    else:
        d[now]=1

Submission status: Wrong Answer

Solution code:
s=int(input())

dic=[]

ans=1
while 1:
    ans+=1
    if s%2==0:
        s/=2
    else:
        s=3*s+1
    
    if s in dic:
        print(ans)
        exit()
    else:
        dic.append(s)

Submission status: Wrong Answer

Solution code:
# input
s = int(input())

# check
lim = 1000001
fn = [-1] * lim 
fn[1] = s
for m in range(2, lim):
    if m % 2 == 0:
        fn[m] = fn[m - 1] // 2
    else:
        fn[m] = 3 * fn[m - 1] + 1

    if fn[m] in fn[1:m]:
        print(fn[1:m].index(fn[m]))
        break

Submission status: Wrong Answer

Solution code:
# input
s = int(input())

# check
fn = [s] + ([-1] * 999999)
lim = 1000001
fs = None
for m in range(2, lim):
    if m % 2 == 0:
        fn[m] = fn[m - 1] // 2
    else:
        fn[m] = 3 * fn[m - 1] + 1

    if not fs and m == s:
        fs = fn[m]

    if fs in (fn[:s] + fn[s + 1:m]):
        print((fn[:s] + fn[s + 1:m]).index(fs))
        break

Submission status: Wrong Answer

Solution code:
# input
s = int(input())

# check
fn = [s] + ([-1] * 999999)
lim = 1000001
fs = None
for m in range(2, lim):
    if m % 2 == 0:
        fn[m] = fn[m - 1] // 2
    else:
        fn[m] = 3 * fn[m - 1] + 1

    print(m, fn[m])

    if not fs and m == s:
        fs = fn[m]

    if fs in (fn[:s] + fn[s + 1:m]):
        print((fn[:s] + fn[s + 1:m]).index(fs))
        break

Submission status: Wrong Answer

Solution code:
# input
s = int(input())

# check
fn = {1: s}
lim = 1000001
for m in range(2, lim):
    if m - 1 % 2 == 0:
        fn[m] = fn[m - 1] // 2
    else:
        fn[m] = 3 * fn[m - 1] + 1
    
    if s not in fn.keys():
        continue
    else:
        if fn[m] == fn[s]:
            print(m)
            break

Submission status: Wrong Answer

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

print(ans + 3)

Submission status: Wrong Answer

Solution code:
s = int(input())
def f(n):
  if n%2==0:
    return n/2
  else:
    return 3*n+1
counter = 4
while s!=4:
  s = f(s)
  counter+=1
print(counter)

Submission status: Wrong Answer

Solution code:
s = int(input())
a = [s]
z = set()
idx = 1
for i in range(10**8):
    idx += 1
    if a[i] % 2 == 0:
        ai = a[i] // 2
    else:
        ai = 3 * a[i] + 1
    if ai in z:
        print(idx)
        exit()
    a.append(ai)
    z.add(ai)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for x in a:
    if a.index(x)!=0:
        if x in a[:-1]:
            print(len(a))
            break
        else:
            if x%2==0:
                a.append(x//2)
            else:
                a.append(3*x+1)
    else:
        if x%2==0:
            a.append(x//2)
        else:
            a.append(3*x+1)

Submission status: Wrong Answer

Solution code:
from collections import Counter
def collatz(n):
    if n%2:
        return n*3 + 1
    else:
        return n//2
    
i = int(input())
dic = dict()
cur = i
for n in range(1,10000):
    cur = collatz(cur)
    if cur in dic:
        print(n+1)
        break
    else:
        dic[cur] = 1

Submission status: Wrong Answer

Solution code:
s=int(input())
l=[]
while (s not in l):
    l.append(s)
    if s%2==0:
        s//=2
    else:
        s=3*s+1
print(l)
print(len(l)+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())
l = []
for i in range(1000000):
    a = func(s)
    if a not in l:
        l.append(a)
        s = a
    else :
        print(i+2)
        break

Submission status: Wrong Answer

Solution code:
s = int(input())
l = [8]
cnt = 1

while 10000 >cnt:
    if s%2==0:
        s=s//2
        l.append(s)
    else:
        s=3*s+1
        l.append(s)
    if l.count(s)==2:
        cnt+=1
        break
    cnt+=1

print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


s = int(input())

a = []
b = s
count = 0
for i in range(10**6 + 1):
    a.append(b)
    b = fn(b)
    if b == 1:
        count += 1
        if count == 3:
            break

for i in range(len(a)):
    for j in range(i+1, len(a)):
        if a[i] == a[j]:
            result = j
            break
print(j)

Submission status: Wrong Answer

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


s = int(input())

a = []
b = s
count = 0
for i in range(10**6 + 1):
    a.append(b)
    b = fn(b)
    if b == 1:
        count += 1
        if count == 2:
            break

for i in range(len(a)):
    for j in range(i+1, len(a)):
        if a[i] == a[j]:
            result = j
            break
print(j)

Submission status: Wrong Answer

Solution code:
s = int(input())

def fn(n):

    if n % 2 == 0:
        return n // 2
    else:
        return 3 * n + 1
        
for i in range(1, 10**8):
    if i == 1:
        a = s
    else:
        a = fn(a)
    if a == 4:
        print(i+3)
        break

Submission status: Wrong Answer

Solution code:
#S= str(input())
#T= str(input())
#N,M,X = map(int,input().split())
N = int(input())
#A = list(map(int,input().split()))

a=[0]*10**7
c=1
b=[]
for i in range(10**6+100):
    #print(b)
    c+=1
    if N%2==0:
        N=N//2
        b.append(N)
        if a[N]==0:
            a[N]+=1
        else:
            print(c)
            exit()
    else:
        N=3*N+1
        b.append(N)
        if a[N]==0:
            a[N]+=1
        else:
            print(c)
            exit()

Submission status: Wrong Answer

Solution code:
#S= str(input())
#T= str(input())
#N,M,X = map(int,input().split())
N = int(input())
#A = list(map(int,input().split()))

a=[0]*10**6
c=1
for i in range(10**6):
    c+=1
    if N%2==0:
        N=N//2
        if a[N]==0:
            a[N]+=1
        else:
            print(c)
            exit()
    else:
        N=3*N+1
        if a[N]==0:
            a[N]+=1
        else:
            print(c)
            exit()

Submission status: Wrong Answer

Solution code:
def f(n):
    if n%2==0:
        return n//2
    else:
        return (3*n)+1
s = int(input())
a = {str(s):1}
ans = 1
while(True):
    x = f(s)
    ans+=1
    if x in a:
        break
    else:
        a[x]=True
    s=x
print(ans)

Submission status: Wrong Answer

Solution code:
number = int(input())
count = 2

if number < 3:
    count = number + 3
else:
    while number != 1:
        count += 1
        if number % 2 == 0:
            number = number / 2
        else:
            number = number * 3 + 1

print(count)

Submission status: Wrong Answer

Solution code:
number = int(input())
count = 2

while number != 1:
    count += 1
    if number % 2 == 0:
        number = number / 2
    else:
        number = number * 3 + 1

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())
cou = 1
tmp = 0
flag = 0
List = []
while(flag == 0):
  if(cou == 1):
    if(s % 2 == 0):
      tmp = s / 2
      List.append(tmp)
    else:
      tmp = 3 * s + 1
      List.append(tmp)
    cou += 1
  else:
    if(List.count(tmp) == 2):
      print(str(cou))
      break
    if(tmp % 2 == 0):
      tmp = tmp / 2
      List.append(tmp)
    else:
      tmp = 3 * tmp + 1
      List.append(tmp)
    cou += 1

Submission status: Wrong Answer

Solution code:
s = int(input())
cou = 1
tmp = 0
flag = 0
List = []
while(flag == 0):
  if(cou == 1):
    if(s % 2 == 0):
      tmp = s / 2
      List.append(tmp)
    else:
      tmp = 3 * s + 1
      List.append(tmp)
    cou += 1
  else:
    if(List.count(tmp) == 2):
      print(str(cou))
      break
    if(tmp % 2 == 0):
      tmp = tmp / 2
      List.append(tmp)
    else:
      tmp = 3 * tmp + 1
      List.append(tmp)
    cou += 1
    cou += 1

Submission status: Wrong Answer

Solution code:
import itertools
import math
s =int(input())
a = s
count = 0
if a <= 2:
    print(4)
    quit()
if a == 3:
    print(8)
    quit()
while a >=4:
    if a % 2 == 0:
        a /= 2
    else:
        a = 3 * a + 1
    count += 1

print(count+3)

Submission status: Wrong Answer

Solution code:
import itertools
import math
s =int(input())
a = s
count = 0
while a >=4:
    if a % 2 == 0:
        a /= 2
    else:
        a = 3 * a + 1
    count += 1

print(count+3)

Submission status: Wrong Answer

Solution code:
s = int(input())

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

Submission status: Wrong Answer

Solution code:
s = int(input())

a = []
f={}
a.append(s)

cnt =0

while True:
    n=0
    cnt += 1
    
    if a[cnt-1]%2==0:
        a.append(a[cnt-1]/2)
        n= a[cnt-1]/2
    else:
        a.append(3*a[cnt-1]+1)
        n =  3*a[cnt-1]+1
        
    
    if n in f:
        print(len(a))
        break
    else:
        f[n]=1

Submission status: Wrong Answer

Solution code:
s = int(input())

a = []
f={}
a.append(s)

cnt =0

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

Submission status: Wrong Answer

Solution code:
s = int(input())

a = []
f={}
a.append(s)

cnt =1

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

Submission status: Wrong Answer

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

print(ans+1)

Submission status: Wrong Answer

Solution code:
s = int(input())

a = 0
res_list = [s]
if s % 2 == 0:
    a = int(s / 2)
    count = 2
else:
    a = int(3 * s + 1)
    count = 2
    res_list.append(a)

roop_c = 0
while roop_c == 0:
    if a % 2 == 0:
        a = int(a / 2)
        count += 1
        if res_list[0] == a:
            break
    else:
        a = int(3 * a + 1)
        res_list.append(a)
        count += 1
        for i in range(0, len(res_list)-1):
            if res_list[i] == a or a == 4:
                roop_c = 1
                break

print(count)

Submission status: Wrong Answer

Solution code:
s = int(input())

a = 0
res_list = [s]
if s % 2 == 0:
    a = int(s / 2)
    count = 2
else:
    a = int(3 * s + 1)
    count = 2
    res_list.append(a)

roop_c = 0
while roop_c == 0:
    if a % 2 == 0:
        a = int(a / 2)
        count += 1
        if res_list[0] == a:
            break
    else:
        a = int(3 * a + 1)
        res_list.append(a)
        count += 1
        for i in range(0, len(res_list)):
            if res_list[i] == a:
                roop_c = 1
                break

print(count)

Submission status: Wrong Answer

Solution code:
s = int(input())

a = 0
if s == 4:
    a = 4
    count = 1
elif s % 2 == 0:
    a = int(s / 2)
    count = 2
else:
    a = int(3 * s + 1)
    count = 2

while not a == 4:
    if a % 2 == 0:
        a = int(a / 2)
    else:
        a = int(3 * a + 1)
    count += 1

print(count + 3)

Submission status: Wrong Answer

Solution code:
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [str(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))
def f(n):
    print(l)
    if n%2 == 0:
        return n//2
    else:
        return 3*n + 1
if __name__ == "__main__":
    n = i()
    c = 0
    cnt = 1
    l = [n]
    #if n != 2 or n != 1 or n != 4:l = [n]
    while c < 2:
        n = f(n)
        cnt += 1
        if n in l:
            print(cnt)
            break
        l.append(n)

Submission status: Wrong Answer

Solution code:
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [str(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))
def f(n):
    #print(l)
    if n%2 == 0:
        return n//2
    else:
        return 3*n + 1
if __name__ == "__main__":
    n = i()
    c = 0
    cnt = 1
    l = []
    while c < 2:
        n = f(n)
        cnt += 1
        if n in l:
            print(cnt)
            break
        l.append(n)

Submission status: Wrong Answer

Solution code:
import sys
import math
def i():return int(sys.stdin.readline().replace("\n",""))
def i2():return map(int,sys.stdin.readline().replace("\n","").split())
def s():return str(sys.stdin.readline().replace("\n",""))
def l():return list(sys.stdin.readline().replace("\n",""))
def intl():return [str(k) for k in sys.stdin.readline().replace("\n","").split()]
def lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\n","").split()))
def t():return tuple(map(int,sys.stdin.readline().replace("\n","").split()))
def f(n):
    #print(l)
    if n%2 == 0:
        l.append(n//2)
        return n//2
    else:
        l.append(3*n + 1)
        return 3*n + 1
if __name__ == "__main__":
    n = i()
    c = 0
    l = [n]
    while c < 2:
        n = f(n)
        if n == 4:
            c += 1
    result = [i for i,x in enumerate(l) if x == 4]
    print(result[-1]+1)

Submission status: Wrong Answer

Solution code:
# ABC116B

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())
seen = {s}
i = 1
while s>1:
    if s%2==0:
        s //= 2
    else:
        s = 3*s+1
    i += 1
    if s in seen:
        print(i)
        break
    seen.add(s)
else:
    print(i+1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=int(input())
list=[s]
num=2
while num<=1000000:
  if num%2==0:
    list.append(list[num-2]/2)
    if len(list)>len(set(list)):
      break
    num+=1
  else:
    list.append(3*list[num-2]+1)
    if len(list)>len(set(list)):
      break
    num+=1
print(num)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil
from operator import itemgetter
from copy import deepcopy
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
inf = 10**17
mod = 10**9 + 7
#s=input().rstrip()

va=I()
for i in range(1,10**6+10):
    if va%2==0:
        va=va//2
    else:
        va=3*va+1
    if va==4:
        print(i+4)
        sys.exit()

Submission status: Wrong Answer

Solution code:
s = int(input())

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

i = 1
hist = {s:i}
while 1:
  s = f(s)
  if s in hist:
    print(i)
    break
  else:
    hist[s]= i
  i+=1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = []
a.append(int(input()))
cnt_4 = 0
for i in range(10**6):
    if a[i] == 4:
        cnt_4 += 1
    if cnt_4 == 2:
        break

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-

s=int(input())

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