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())
l=[s]
i=0
ans="False"
while ans=="True":
	if l[i]%2==0:
		l.append(l[i]//2)
		i+=1
		if l[i] in l[:i-1]:
			ans="True"
	else:
		l.append(l[i]*3+1)
		i+=1
		if l[i] in l[:i-1]:
			ans="True"
print(len(l))

Submission status: Wrong Answer

Solution code:
s = int(input())
d = {}
def func(n,i):
    tmp = 0
    if n%2 == 0:
        tmp = n//2
    else:
        tmp = 3*n + 1
    if tmp in d:
        return i+1
    else:
        d[tmp] = 1
        return func(tmp,i+1)
print(func(s,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())
p_a = s
M = 1000000
d = {}
for i in range(1,M):
    tmp = func(p_a)
    if tmp in d:
        print(i+1)
        break
    else:
        d[tmp] = 1
        p_a = tmp

Submission status: Wrong Answer

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

while s not in lst:
  lst.append(s)
  if lst[-1] % 2 == 0:
    s = lst[-1] // 2
  else:
    s = 3 * lst[-1] + 1
print(len(lst) + 2)

Submission status: Wrong Answer

Solution code:
s = int(input())
rec = set()


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


c = 0
while True:
    if s in rec:
        print(c)
        exit()
    rec.add(s)
    s = f(s)
    c += 1

Submission status: Wrong Answer

Solution code:
s = int(input())

a = []

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())
ans = 1
flg = False

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

Submission status: Wrong Answer

Solution code:
s = int(input())
check = ""
count = 1
result = []
while check != "OK":
    if s % 2 == 0:
        s = s/2
    else:
        s = 3*s + 1
    count += 1
    result.append(s)
    for i in range(len(result)-1):
        if result[i] == s:
            check = "OK"
        else:
            pass
        
print(count)

Submission status: Wrong Answer

Solution code:
import sys
s = int(input())
flg=0
A = []
A.append(s)

index = 0
if s==4 or s==2 or s==1:
    print(index+4)
    sys.exit()
while flg!=1:
    if A[index]%2==0:
        f = (A[index]//2)
    else:
        f = 3*A[index]+1
    print(index)
    A.append(f)
    index = index + 1

    if f==4 or f==2 or f==1:
        flg=1
        break

#1,4,2,1,4

print(index+4)

Submission status: Wrong Answer

Solution code:
s = int(input())
flg=0
A = []
A.append(s)

index = 1
while flg!=1:
    if A[index-1]%2==0:
        f = (A[index-1]//2)
    else:
        f = 3*A[index-1]+1
    index = index + 1
    
    if f==4:
        flg=1
        break
    A.append(f)

print(index+3)

Submission status: Wrong Answer

Solution code:
N = int(input())

i = 1
f = lambda x : (x//2) if x%2 == 0 else x*3+1
l = []
val = N

while True:
    val = f(val)
    if val in l:
        print(i+1   )
        break
    else:
        l.append(val)    
        i+=1

Submission status: Wrong Answer

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

for i in range(1,1000001):

    if lst[i-1]%2 == 0:
        lst.append(lst[i-1]//2)

        for j in range(i):
            if lst[i]==lst[j]:
                break

        print(i+1)

    else:
        lst.append(lst[i-1])

        for j in range(i):
            if lst[i]==lst[j]:
                break

        print(i+1)

Submission status: Wrong Answer

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

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

s = int(input())

if s == 0 or s == 2:
    print(4)
    exit()
ans = 2
while s > 1:
    s = f(s)
    ans += 1

print(ans)

Submission status: Wrong Answer

Solution code:
def solve():
    s = int(input())
    
    ans, an = 1, s
    while 1:
        if an == 4:
            ans += 3
            break
        if an % 2 == 0:
            an //= 2
        else:
            an = 3 * an + 1
        ans += 1
    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Wrong Answer

Solution code:
s=int(input())

l=[]
ans=1
a=s
while a != 4:
    if a % 2 == 0:
        a=a//2
    else:
        a=3*a+1
    ans+=1
    l.append(a)

print(ans+3)

Submission status: Wrong Answer

Solution code:
s = int(input())
alist = [s]
aset=set()
for i in range(1000000):
  n = alist[-1]
  if n in aset:
    print(len(alist))
    break
  aset.add(n)
  if n%2 ==0:
    x = n//2
  else:
    x = 3*n+1
  alist.append(x)
print(alist)

Submission status: Wrong Answer

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

j = 1
while 1:
        if j  > 1000000:
                break
        if s % 2 == 0:
                s = s // 2
        else:
                s = 3 * s + 1
        for i in ans:
                if s == i:
                        print(j+1)
                        exit()
        ans.add(s)
        j += 1

Submission status: Wrong Answer

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

ans = set([])

j = 1
while 1:
        if j  > 1000000:
                break
        if s % 2 == 0:
                s = s // 2
        else:
                s = 3 * s + 1
        for i in ans:
                if s == i:
                        print(j+1)
                        exit()
        ans.add(s)
        j += 1

Submission status: Wrong Answer

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

count = 4
while (s != 4):
    s = f(s)
    count += 1
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
s = int(input())

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

count=0
exist=[]
while True:

	count+=1
	#print(s,count,exist)
	tmp = f(s)
	if tmp in exist:
		print(count+1)
		sys.exit(0)
	
	exist.append(tmp)
	s=tmp

Submission status: Wrong Answer

Solution code:
s = int(input())
ai=[s]
for i in range(1000000):
    if s%2:
        s =3*s+1
        ai.append(s)
    else:
        s = s//2
        ai.append(s)
    print(ai)
    if len(ai) != len(set(ai)):
        c=0
        for j in range(len(ai)):
            if ai.count(ai[j])==2:
                c +=1
                if c ==2:
                    print(j+1)
                    break
        exit()

Submission status: Wrong Answer

Solution code:
s = int(input())
ai=[s]
for i in range(1000000):
    if s%2:
        s =3*s+1
        ai.append(s)
    else:
        s = s//2
        ai.append(s)
    print(ai)
    if len(ai) != len(set(ai)):
        c=0
        for j in range(len(ai)):
            if ai.count(ai[j])==2:
                c +=1
                if c ==2:
                    print(j+1)
                    exit()

Submission status: Wrong Answer

Solution code:
s = int(input())
ai=[s]
for i in range(1000000):
    if s%2:
        s =3*s+1
        ai.append(s)
    else:
        s = s//2
        ai.append(s)
    if len(ai) != len(set(ai)):
        for i in ai:
            if ai.count(i)==2:
                print(i+1)
                exit()

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
import numpy as np
s = int(input())
L = []
n = 1
while True:
    n += 1
    if s % 2 == 0:
        s //= 2
        if s in L:
            print(n)
            sys.exit()
        L.append(s)
    else:
        s = 3 * s + 1
        if s in L:
            print(n)
            sys.exit()
        L.append(s)

Submission status: Wrong Answer

Solution code:
s=int(input())
t=set()
count=1

while(s not in t):
    t.add(s)
    count+=1
    s=s//2 if s%2==0 else 3*s+1
    print(t)

print(count)

Submission status: Wrong Answer

Solution code:
s = int(input())

visited = set()
count = 1
if s % 2 == 0:
    next_s = s / 2
else:
    next_s = 3 * s + 1

while next_s not in visited:
    visited.add(int(next_s))

    count += 1
    if next_s % 2 == 0:
        next_s = next_s / 2
    else:
        next_s = 3 * next_s + 1
print(count + 1)

Submission status: Wrong Answer

Solution code:
s = int(input())

visited = set()
count = 1
if s % 2 == 0:
    next_s = s / 2
else:
    next_s = 3 * s + 1

while next_s not in visited:
    visited.add(next_s)

    count += 1
    if next_s % 2 == 0:
        next_s = next_s / 2
    else:
        next_s = 3 * next_s + 1
print(count + 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())

list_aaa = []

for i in range(1,100+1):
    if i ==1:
        list_aaa.append(s)
    elif s%2 ==0:
        s= s//2
        list_aaa.append(s)
    elif s%2 ==1:
        s= (3*s)+1
        list_aaa.append(s)
#print(list_aaa)

for i in list_aaa:
    index_num = [n for n, v in enumerate(list_aaa) if v == i]
    if len(index_num) >=2:
        print(index_num[1]+1)
        break

Submission status: Wrong Answer

Solution code:
s = int(input())

list_aaa = []

for i in range(1,100+1):
    if i ==1:
        list_aaa.append(s)
    elif s%2 ==0:
        s= s//2
        list_aaa.append(s)
    elif s%2 ==1:
        s= (3*s)+1
        list_aaa.append(s)
print(list_aaa)

for i in list_aaa:
    index_num = [n for n, v in enumerate(list_aaa) if v == i]
    if len(index_num) >=2:
        print(index_num[1]+1)
        break

Submission status: Wrong Answer

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

s = int(input())
nextn = d(s)
nums = set()
nums.add(nextn)
res = 3

while(1):
    nextn = d(nextn)
    if(nextn in nums):break
    else: 
        res += 1
        nums.add(nextn)
print(res)

Submission status: Wrong Answer

Solution code:
s = int(input())

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

if s == 1 or s == 2 or s == 4:
  print(4)
else:
  count = 1
  while s != 4:
    s = calc(s)
    count += 1
    print(count + 3)

Submission status: Wrong Answer

Solution code:
s = int(input())

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

count = 1
while s != 4:
  s = calc(s)
  count += 1

print(count + 3)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
s = int(input())
dp = [0] * (10 ** 6 + 1)
dp[0] = s
x = 0
for i in range(10 ** 6):
  if dp[i] % 2: dp[i + 1] = 3 * dp[i] + 1
  else: dp[i + 1] = dp[i] // 2
  if dp[i + 1] == 4:
    if x == 0:
      x = i + 2
    else:
      x = i + 2
      break
print(x)

Submission status: Wrong Answer

Solution code:
n = int(input())

li = []
for i in range(200):
    if n%2 == 0:
        n//=2
        li.append(n)
        if len(li) != len(set(li)):
            print(len(li))
            exit()
    else:
        n = 3*n+1
        li.append(n)
        if len(li) != len(set(li)):
            print(len(li))
            exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())
a = s
l = set()
cnt = 1
for i in range(1,1000000):
    if a%2 ==0:
        a=a/2
    else:
        a=3*a+1
    cnt += 1
    if a in l:
        break
    l.add(int(a))
    i += 1

print(int(cnt))

Submission status: Wrong Answer

Solution code:
s = int(input())

a = s
l = set()
cnt = 1
for i in range(1, 1000000):
  if a%2 == 0:
    a = a//2
  else:
    a = 3*a + 1
  cnt += 1
  if a in l:
    break
  l.add(int(a))
  i += 1

print(int(cnt))

Submission status: Wrong Answer

Solution code:
s = int(input())

a = s
l = set()
cnt = 1
for i in range(1, 1000000):
  if a%2 == 0:
    a = a/2
  else:
    a = 3*a + 1
  cnt += 1
  if a in l:
    break
  l.add(int(a))
  i += 1

print(int(cnt))

Submission status: Wrong Answer

Solution code:
s = int(input())

a = s
i = 0
l = set()
cnt = 1
while i<1:
  if a%2 == 0:
    a = a/2
  else:
    a = 3*a + 1
  cnt += 1
  if a in l:
    i = 1
  l.add(int(a))

print(int(cnt))

Submission status: Wrong Answer

Solution code:
s = int(input())

a = s
i = 0
l = set()
cnt = 1
while i<1:
  if a%2 == 0:
    a = a/2
  else:
    a = 3*a + 1
  cnt += 1
  if a in l:
    i = 1
  l.add(a)

print(int(cnt))

Submission status: Wrong Answer

Solution code:
s = str(input())

for i in range(1, len(s)):
  if s[i-1] == s[i]:
    print('Bad')
    exit()
else:
  print('Good')

Submission status: Wrong Answer

Solution code:
s=int(input())
flag=False
d=[]
count=1
while flag!=True:
  if s%2:
    s=3*s+1
    if s in d:
      flag=True
    d.append(s)
    count+=1
  else:
    s/=2
    if s in d:
      flag=True
    d.append(s)
    count+=1
print(count)

Submission status: Wrong Answer

Solution code:
import os, sys, re, math

s = int(input())

a = s
ans = []

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())

an = s
check = False
if an == 4:
    check = True

for i in range(2, 1000000):
    if an % 2 == 0:
        an /= 2
    else:
        an = 3*an + 1


    if an == 4:
        if check:
            print(i)
            exit()
        else:
            check = True

Submission status: Wrong Answer

Solution code:
import sys
import math as mp
a =int(input())
li=[]
ad=[]
for i in range(a,a*a):
    if (a% 2 == 0):
        li.append(a)
        a=a // 2
    else:
        li.append(a)
        a=3*a+1
for i in range(1,len(li)):
    for j in range(i+1,len(li)):
        if li[i-1]==li[j-1]:
            ad.append(j)
            break
    if len(ad)>0:
        break

print(*ad)

Submission status: Wrong Answer

Solution code:
s = int(input())

t = [False] * 1000001

while True:
  if s <= 1000000 and t[s] == True:
    break
  t[s] = True
  if s % 2 == 0:
    s = s // 2
  else:
    s = 3 * s + 1

print(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = int(input())

INF = 10 ** 9 

list = [S]

con = 0

for i in range(INF):
	if S % 2 == 0:
		S = int(S / 2)
		list.append(S)
		con += 1
		print(S)
	else:
		S = (3 * S) + 1
		list.append(S)
		con += 1
		print(S)
	print(list)
	if S in list[:i]:
		break



print(con + 1)

Submission status: Wrong Answer

Solution code:
S = int(input())

INF = 10 ** 9 

list = [S]

con = 0

for i in range(INF):
	if S % 2 == 0:
		S = int(S / 2)
		list.append(S)
		con += 1

	else:
		S = (3 * S) + 1
		list.append(S)
		con += 1


	if S in list[:i]:
		break



print(con)

Submission status: Wrong Answer

Solution code:
S = int(input())

INF = 10 ** 9 

list = [S]

con = 0

for i in range(INF):
	if S % 2 == 0:
		S = int(S / 2)
		list.append(S)
		con += 1
		print(S)
	else:
		S = (3 * S) + 1
		list.append(S)
		con += 1
		print(S)
	print(list)
	if S in list[:i]:
		break



print(con)

Submission status: Wrong Answer

Solution code:
S = int(input())

INF = 10 ** 9 

list = []

con = 0

for i in range(INF):
	if S % 2 == 0:
		S = int(S / 2)
		list.append(S)
		con += 1
	else:
		S = (3 * S) + 1
		list.append(S)
		con += 1
	if S in list[:i]:
		break


print(con+1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=int(input())
a=[s]
v=s
for i in range(1000):
    if v%2==0:
        if int(v/2) in a:
            print(i+1)
            break
        a.append(int(v/2))
        v=v/2
    elif v%2==1:
        if int(3*v+1) in a:
            print(i+2)
            break
        a.append(int(3*v+1))
        v=3*v+1

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

a = int(input())
if a == 1:
    print(2)
    quit()

i = 0
while a >= 4:
    a = func(a)
    i += 1

print(i+3)

Submission status: Wrong Answer

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

a = int(input())
if a == 1:
    print(2)
    quit()

i = 0
while a >= 4:
    print(a)
    a = func(a)
    i += 1

print(i+3)

Submission status: Wrong Answer

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

a = int(input())
i = 0
while a >= 4:
    a = func(a)
    i += 1
print(i+3)

Submission status: Wrong Answer

Solution code:
s = int(input())

c=1

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

Submission status: Wrong Answer

Solution code:
s = int(input())

c=1

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

Submission status: Wrong Answer

Solution code:
s = int(input())

c=1

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

print(c+3)

Submission status: Wrong Answer

Solution code:
import math


def func():
    n = int(input())
    if n == 2:
        print(2)
        exit(0)
    if n == 1:
        print(1)
        exit(0)
    count = 0
    while n > 1:
        if n % 2 == 0:
            n /= 2
        else:
            n = (3 * n) + 1
        count += 1

    print(count + 2)


if __name__ == "__main__":
    func()

Submission status: Wrong Answer

Solution code:
import math


def func():
    n = int(input())
    count = 0
    while n > 1:
        if n % 2 == 0:
            n /= 2
        else:
            n = (3 * n) + 1
        count += 1

    print(count + 2)


if __name__ == "__main__":
    func()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())

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

a = [s]
for x in range(1000000):
    i = a[-1]
    a.append(f(i))
    
print(a.index(4)+4)

Submission status: Wrong Answer

Solution code:
s = int(input())

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

a = [s]
for x in range(1000):
    i = a[-1]
    a.append(f(i))
    
print(a.index(4)+4)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

print(res+3)

Submission status: Wrong Answer

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

  if s in a:
    print(index)
    exit()
  else:
    index += 1
    a.add(s)

Submission status: Wrong Answer

Solution code:
s = f = int(input())
ss = []
for i in range(10**8):
    if f%2 == 0:
        f //= 2
    else:
        f = 3*f+1
    ss.append(f)
    if len(set(ss)) != i+1:
        print(i+2)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
ct = 1

if n in (4,2,1):
    print(3)
else:
    while n != 4:
        if n%2 == 0:
            n /= 2
        else:
            n = 3*n+1
        ct += 1
    
    print(ct+3)

Submission status: Wrong Answer

Solution code:
n = int(input())
ct = 1

while n != 4:
    if n%2 == 0:
        n /= 2
    else:
        n = 3*n+1
    ct += 1

print(ct+3)

Submission status: Wrong Answer

Solution code:
s=int(input())
m=2
f=True
arr=[]
while(f):
    if s%2==0:
        if s/2 in arr:
            print(m)
            f=False
        else:
            s=s/2
            arr.append(s)
            m+=1
    else:
        if s*3+1 in arr:
            print(m)
            f=False
        else:
            s=s*3+1
            arr.append(s)
            m+=1

Submission status: Wrong Answer

Solution code:
s = int(input())

log = set()
for i in range(1001000):
    if s%2==0:
        s //=2
    else:
        s = 3*s+1

    if s in log:
        print(i+2)
        break

    log.add(s)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())
tmp = s
number = []
output = 1

while True:
    if tmp % 2 == 0:
        tmp //= 2
        output += 1

    else:
        tmp = tmp * 3 + 1
        output += 1

    if not tmp in number:
        number.append(tmp)

    elif tmp in number:
        print(output)
        break

Submission status: Wrong Answer

Solution code:
s = int(input())
tmp = s
number = []
output = 1

while True:
    if tmp % 2 == 0:
        tmp /= 2
        output += 1

    else:
        tmp = tmp * 3 + 1
        output += 1

    if not tmp in number:
        number.append(tmp)

    elif tmp in number:
        print(output)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# ABC116b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

s = int(input())


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


a = [0, s]

for i in range(2, 10**6):
    num = f(a[i-1])
    a.append(num)
    idx = a.index(num)
    print(a)
    if(idx+1 < i):
        print(i)
        exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def f(a):
  if a%2==0:
    a = a//2
  else:
    a = a*3+1
  return a
s = int(input())
cnt = [0]*1000001
ans = 0
while 1:
  s = f(s)
  if cnt[s]==0:
    ans += 1
    cnt[s]=1
  elif cnt[s]==1:
    ans += 1
    print(ans+1)
    exit()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())


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

N = s
if N == 1 or N == 2 or N == 4:
    print(4)
else:
    for i in range(1000000):
      N = f(N)
      print(N)
      if N == 4:
        print(i+5)
        break

Submission status: Wrong Answer

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

def f(m):
  if m%2 == 0:
    return m//2
  else:
    return 3*m + 1
  
for i in range(1,10*6+1):
  a = f(lis[i-1])
  if a in lis:
    print(i+1)
    break
  else:
    lis.append(a)

Submission status: Wrong Answer

Solution code:
s = int(input())

count = 1
while s > 1:
    count += 1
    if s % 2 == 0:
        s //= 2
    else:
        s = 3 * s + 1
print(count + 1)

Submission status: Wrong Answer

Solution code:
s = int(input())

ls = [False for _ in range(1000000)]

count = 1
while s > 1:
    count += 1
    if ls[s]:
        break
    ls[s] = True
    if s % 2 == 0:
        s //= 2
    else:
        s = 3 * s + 1
print(count + 1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = int(input())
M = 1000000
m = 1

while m <= M:
    if a in (1, 2, 41):
        m += 3
        break
    if a % 2 == 0:
        a //= 2
    else:
        a = 3 * a + 1
    m += 1

print(m)

Submission status: Wrong Answer

Solution code:
a = int(input())
M = 1000000
m = 1

while m <= M:
    if a == 4:
        m += 3
        break
    if a % 2 == 0:
        a //= 2
    else:
        a = 3 * a + 1
    m += 1

print(m)

Submission status: Wrong Answer

Solution code:
a = int(input())
M = 1000000
m = 1

while m < M:
    if a == 4:
        m += 3
        break
    if a % 2 == 0:
        a //= 2
    else:
        a = 3 * a + 1
    m += 1

print(m)

Submission status: Wrong Answer

Solution code:
a = int(input())
M = 1000000
m = 1

while m < M:
    if a % 2 == 0:
        a //= 2
    else:
        a = 3 * a + 1
    m += 1
    if a == 4:
        m += 3
        break

print(m)