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:
# ABC116
# B Collatz Problem
s = int(input())
S = [str(s)]
i = 1
while True:
    if s % 2 == 0:
        i += 1
        s = s//2
        S.append(str(s))
        if S.count(str(s)) == 2:
            print(i)
            print(S)
            exit()
    else:
        i += 1
        s = 3 * s + 1
        S.append(str(s))
        if S.count(str(s)) == 2:
            print(i)
            print(S)
            exit()
pass

Submission status: Wrong Answer

Solution code:
# ABC116
# B Collatz Problem
s = int(input())
S = [str(s)]
i = 1
while True:
    if s % 2 == 0:
        i += 1
        s = s/2
        S.append(str(s))
        if S.count(str(s)) == 2:
            print(i)
            exit()
    else:
        i += 1
        s = 3 * s + 1
        S.append(str(s))
        if S.count(str(s)) == 2:
            print(i)
            exit()
pass

Submission status: Wrong Answer

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

for i in range(10**6):
	if a % 2 == 0:
		# print("Process for even.")
		a = a//2
	else:
		# print("Process for odd.")
		a = 3*a + 1
	if a not in s:
		s.add(a)
	else:
		print(i+2)
		break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())

if s == 1 or s == 2:
    print(4)
    exit()

def function(n):
    if n % 2 == 0:
        return int(n/2)
    else:
        return int(n*3+1)
i = 0
count = 0
a = []
a.append(s)
while count < 2:
    a.append(function(a[i]))
    if a[i] == 4:
        count += 1
    i += 1
print(a)
print(i)

Submission status: Wrong Answer

Solution code:
s = int(input())

def function(n):
    if n % 2 == 0:
        return int(n/2)
    else:
        return int(n*3+1)
i = 0
count = 0
a = []
a.append(s)
while count < 2:
    a.append(function(a[i]))
    if a[i] == 4:
        count += 1
    i += 1
print(i)

Submission status: Wrong Answer

Solution code:
s = int(input())

def function(n):
    if n % 2 == 0:
        return int(n/2)
    else:
        return int(n*3+1)
i = 0
count = 0
a = []
a.append(s)
while count < 2:
    a.append(function(a[i]))
    if a[i+1] == 4:
        count += 1
    i += 1
print(i+1)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    def f(n):
        return 3 * n + 1 if n % 2 else n // 2
    s = int(input())
    a = [s]
    for i in range(1, 11**6):
        x = f(a[i-1])
        if x in a:
            return len(a) + 1, a; exit()
        a.append(x)
    

print(main())

Submission status: Wrong Answer

Solution code:
s = int(input())

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

print(ans + 3)

Submission status: Wrong Answer

Solution code:
s=int(input())

cnt=0

while s!=4:
  if s%2!=0:
    s=3*s+1
    cnt+=1
  elif s%2==0:
    s=s//2
    cnt+=1

if s==4:
  print(cnt+4)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

while TMP[-1]!=1:
    if TMP[-1] % 2 == 0:
        TMP.append(TMP[-1]//2)
    elif TMP[-1] % 2 != 0:
        TMP.append(3 * TMP[-1] + 1)

print(len(TMP)+1)

Submission status: Wrong Answer

Solution code:
S = int(input())
s, c = S, 1
result = []
while True:
    if s % 2 == 0:
        s = s // 2
    elif s % 2 == 1:
        s = s * 3 + 1

    flg = s in result
    result.append(s)
    c += 1
    if flg == True and s < S:
        break

print(c)

Submission status: Wrong Answer

Solution code:
s = int(input())

max_ = 1000000
chk = [0]*max_
a = s
i = 1
while i <= max_:
    i += 1
    if a%2 == 0:
        a = int(a/2)
    else:
        a = 3*a + 1
    if chk[a] == 0:
        chk[a] += 1
    else:
        print(i)
        exit()

Submission status: Wrong Answer

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

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

def main():
    s = int(input())
    dp=[s]
    counter=0

    while counter < 1000001:
        n=dp.pop()
        tmp = func(n)
        dp.append(n)
        dp.append(tmp)
        counter+=1
        if tmp==4:
            print(dp.index(tmp)+4)
            break

if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
s = int(input())

def f(x):
    if x%2 == 0:
        return int(x/2)
    else:
        return 3*x + 1
i = 1
m_max = 1000000
b_s = s
b = set()
while i <= m_max:
    i += 1
    a = f(b_s)
    if a in b:
        break
    b.add(a)
    b_s = a
print(i)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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


def main():
    s = int(input())
    ans = [s]
    while True:
        tmp = calc(ans[-1])
        ans.append(tmp)
        if ans.index(tmp) != len(ans)-1:
            print(len(ans))
            break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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_i = s
cnt = 1
while True:
    if a_i == 4:
        break
    cnt += 1
    a_i = f(a_i)
print(cnt+3)

Submission status: Wrong Answer

Solution code:
s = int(input())

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

Submission status: Wrong Answer

Solution code:
s = int(input())
if s == 1:
  print(4)
  exit(0)

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=int(input())
G =[s]
while all(G[i]!=G[-1] for i in range(len(G))):
  if G[-1] % 2==0:
    G.append(int(x/2))
  else:
    G.append(int(3*x+1))
print(len(G)+1)

Submission status: Wrong Answer

Solution code:
s=int(input())
G =[s]
while all(G[i]!=G[-1] for i in range(len(G))):
  if G[-1] % 2==0:
    G.append(int(x/2))
  else:
    G.append(int(3*x+1))
print(len(G))

Submission status: Wrong Answer

Solution code:
n=int(input())
mylist=[n]

for i in range(1000000):
    if mylist[i]==1:
        print(i+2)
        exit()
    if n%2==0:
        mylist.append(n//2)
        n=n//2
    else:
        mylist.append(3*n+1)
        n=3*n+1

Submission status: Wrong Answer

Solution code:
n=int(input())
mylist=[n]

for i in range(10):
    if mylist[i]==1:
        print(i+2)
        exit()
    if n%2==0:
        mylist.append(n//2)
        n=n//2
    else:
        mylist.append(3*n+1)
        n=3*n+1

Submission status: Wrong Answer

Solution code:
lis=[int(input())]
for i in range(1000):
    if lis[i]%2==0:
        a=lis[i]//2
        lis.append(a)
        def has_duplicates(x):
            return len(x) != len(set(x))
        if has_duplicates(lis)==True:
            break
    else:
        a=lis[i]*3+1
        lis.append(a)
        def has_duplicates(x):
            return len(x) != len(set(x))
        if has_duplicates(lis)==True:
            break
print(lis)
print(len(lis))

Submission status: Wrong Answer

Solution code:
lis=[int(input())]
for i in range(1000):
    if lis[i]%2==0:
        a=lis[i]//2
        lis.append(a)
        if a==lis[0]:
            break
    else:
        a=lis[i]*3+1
        lis.append(a)
        if a==lis[0]:
            break
            def has_duplicates(x):
                return len(x) != len(set(x))
            if has_duplicates(lis)==True:
                break
print(len(lis))

Submission status: Wrong Answer

Solution code:
lis=[int(input())]
for i in range(1000):
    if lis[i]%2==0:
        a=lis[i]//2
        lis.append(a)
    else:
        a=lis[i]*3+1
        lis.append(a)
        def has_duplicates(seq):
            return len(seq) != len(set(seq))
        if has_duplicates(lis)==True:
            break
print(len(lis))

Submission status: Wrong Answer

Solution code:
s = int(input())

numbers = []

for i in range(10000001):
    if i == 0:
        numbers.append(s)
    else:
        if numbers[i-1] % 2 == 0:
            numbers.append(numbers[i-1] // 2)
        else:
            numbers.append(3*numbers[i-1]+1)
    if numbers.count(4) == 2:
        break

print(len(numbers))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a=int(input())
result=[a]
n=a
while True:
    if n%2==0:
        n=n/2
        if n in result and n!=a:
            result.append(n)
            break
        result.append(n)
    else:
        n=3*n+1
        if n in result and n!=a:
            result.append(n)
            break
        result.append(n)

print(len(result))

Submission status: Wrong Answer

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

def main(s):
    temp = []
    count = 0
    ans = 0
    for i in range(s, 100000000):
        if i == s:
            a = i
        else:
            a = f(temp[count-1])
        
        temp.append(a)
        count += 1

        if a == 4:
            ans = count + 3
            break
    # print(temp)
    print(ans)


if __name__ == "__main__":
    s = int(input())

    main(s)

Submission status: Wrong Answer

Solution code:
s = int(input())

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

temp = []
count = 0
ans = 0
for i in range(s, 100000000):
    if i == s:
        a = i
    else:
        a = f(temp[count-1])
    
    temp.append(a)
    count += 1

    if a == 4:
        ans = i - s + 4
        break

print(ans)

Submission status: Wrong Answer

Solution code:
s = int(input())

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

temp = []
count = 0
ans = 0
for i in range(s, 1000000):
    if i == s:
        a = i
    else:
        a = f(temp[count-1])
    
    temp.append(a)
    count += 1

    if a == 4:
        ans = i - s + 4
        break

print(ans)

Submission status: Wrong Answer

Solution code:
s = int(input())

a = [s]
used = [0] * (10**6+1)
for i in range(2, 10**6+2):
    if a[-1] % 2 == 0:
        a.append(val := a[-1]//2)
    else:
        a.append(val := 3*a[-1]+1)

    if used[val]:
        print(i)
        break
    else:
        used[val] = 1

Submission status: Wrong Answer

Solution code:
s = int(input())
if s == 1:
    print(4)
    exit(0)
cnt = 1
while(1):
    cnt += 1
    #print(s)
    if s == 1:
        break
    elif s % 2 == 0:
        s = s // 2
    else:
        s = 3 * s + 1
print(cnt)

Submission status: Wrong Answer

Solution code:
s = int(input())

l = [0]*1000001
check = [0]*5000000

l[1] = s
ans = 0

for i in range(2, 1000000):
    if l[i-1] % 2 == 0:
        l[i] = round(l[i-1]/2)
        if check[l[i]] == 0:
            check[l[i]] += 1
        else:
            ans = i
            break
    else:
        l[i] = 3*l[i-1]+1
        if check[l[i]] == 0:
            check[l[i]] += 1
        else:
            ans = i
            break

print(ans)

Submission status: Wrong Answer

Solution code:
s=int(input())

l=[0]*1000001
check=[0]*5000000

l[1]=s
ans=0

for i in range(2,1000000):
    if l[i-1]%2==0:
        l[i]=int(l[i-1]/2)
        if check[l[i]]==0:
            check[l[i]]+=1
        else:
            ans=i
            break
    else:
        l[i]=3*l[i-1]+1
        if check[l[i]] == 0:
            check[l[i]] += 1
        else:
            ans = i
            break

print(ans)

Submission status: Wrong Answer

Solution code:
s=int(input())
A=[s]
while s!=1:
    if s%2==0:
        s=s//2
        A.append(s)
    else:
        s=(3*s)+1
        A.append(s)
AA=A+[4,2,1]
for m in range(len(AA)):
    for n in range(len(AA)):
        if AA[m]==AA[n] and m>n:
            M=m
            break
print(M-1)

Submission status: Wrong Answer

Solution code:
s = int(input())

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

a=[f(s)]
for i in range(10000000):
    a_last = f(a[i])
    if a_last in a:
        print(i+3)
        break
    a.append(a_last)

Submission status: Wrong Answer

Solution code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


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


s = int(readline())
n = fanc(s)
i = 2
while n > 4:
    n = fanc(n)
    i += 1

print(i+3)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())

a = s
ar = []
for i in range(1, 100000000):
    if(a % 2 == 0):
        a = a/2
    else:
        a = 3*a + 1
    if(ar.count(a) == 1):
        print(i+1)
        break
    # print(a)
    ar.append(a)

Submission status: Wrong Answer

Solution code:
a=[0]*10**7
a[1]=int(input())
cnt=dict()

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

for i in range(2,10**7+1):
  a[i] = f(a[i-1])
  if a[i] in cnt:
    print(i)
    break
  else:
    cnt[a[i]]=0

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    s=ii()
    X = [s]
    seen = set()
    for i in range(10**6+10):
        x = X[-1]
        if x % 2 == 0:
            y = x//2
        else:
            y = 3*x+1
        
        X.append(y)
        if y in seen:
            print(i+2)
            exit()

        seen.add(y)
    




        





if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

s = inint()

a = [s]
al = []


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

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict


def input():
    return sys.stdin.readline().rstrip()


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

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

    ss = set()


    for i in range(10 ** 8):
        s = f(s)
        if s in ss:
            print(i+2)
            exit()
        ss.add(s)



if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

main()

Submission status: Wrong Answer

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

    if ins not in an:
        an.append(ins)
    else:
        print(i+1)
        exit()

Submission status: Wrong Answer

Solution code:
s = int(input())

tmp = s
MAX_m = 1000001
ans = [0] * MAX_m
for i in range(1, MAX_m):
    if tmp % 2 == 0:
        tmp = tmp//2
    else:
        tmp = 3*tmp + 1

    if tmp in ans:
        print(tmp)
        exit()
    else:
        ans[i] = tmp

Submission status: Wrong Answer

Solution code:
s = int(input())

tmp = s
MAX_m = 1000001
ans = [0] * MAX_m
for i in range(1, MAX_m):
    if tmp % 2 == 0:
        tmp /= 2
    else:
        tmp = 3*tmp + 1
    
    if tmp in ans:
        print(i+1)
        exit()
    else:
        ans[i] = tmp

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
l, count = [], 0
s = int(input())
l.append(s)
while(True):
    count += 1
    if (s%2):
        s = 3*s+1
    else:
        s//=2
    l.append(s)
    if count>100000:
        break
for i in range(1,len(l)):
    if l[i] in l[i+1:]:
        loc = l[i+1:].index(l[i])+1
        print(loc+i+1)
        break

Submission status: Wrong Answer

Solution code:
l, count = [], 0
s = int(input())
l.append(s)
while(True):
    count += 1
    if (s%2):
        s = 3*s+1
    else:
        s//=2
    l.append(s)
    if count>10000:
        break
for i in range(1,len(l)):
    if l[i] in l[i+1:]:
        loc = l[i+1:].index(l[i])+1
        print(loc+i+1)
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
s=int(input())
dp=[0]*1000001
dp[1]=s
cnt=1
for i in range(1000001):
  if s%2==1:
    s=3*s+1
  else:
    s//=2
  cnt+=1
  if dp[s]==1:
    print(cnt)
    sys.exit()
  else:
    dp[s]=1

Submission status: Wrong Answer

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

s = int(input())

log = set([])

cnt = 1

while True:
    if fnc(s) in log:
        cnt += 1
        print(cnt)
        break
    else:
        s = fnc(s)
        log.add(s)
        cnt += 1

Submission status: Wrong Answer

Solution code:
import sys
from collections import defaultdict

sys.setrecursionlimit(10**7)
input = sys.stdin.readline

s = int(input())
dic = defaultdict(int)
cnt = 1
while True:
    if s % 2 == 0:
        s //= 2
    else:
        s = 3 * s + 1
    cnt += 1
    dic[s] += 1
    if dic[s] > 1:
        print(cnt)
        exit()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

s = int(input())
arr = [0] * 1000100
cnt = 0
while True:
    if s % 2 == 0:
        s //= 2
    else:
        s = 3 * s + 1
    cnt += 1
    arr[s] += 1
    if arr[s] > 1:
        print(cnt + 1)
        exit()

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

s = int(input())
arr = [0] * 1000000
cnt = 0
while True:
    if s % 2 == 0:
        s //= 2
    else:
        s = 3 * s + 1
    cnt += 1
    arr[s] += 1
    if arr[s] > 1:
        print(cnt + 1)
        exit()

Submission status: Wrong Answer

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

s = int(input())
ans = 1

while s != 4:
    s = judge(s)
    ans += 1

print(ans+3)

Submission status: Wrong Answer

Solution code:
ans = 1
l = set()

s = int(input())

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

Submission status: Wrong Answer

Solution code:
#20
import sys
s = int(input())
a = []

for i in range(2,100):
    if s %2 == 0:
        a.append(s)
        s = int(s/2)
    else:
        a.append(s)
        s = 3*s+1
    for j in a:
        if s == j:
            print(i)
            sys.exit()

Submission status: Wrong Answer

Solution code:
s=int(input())

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

print(cnt+2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
s = int(input())
if not ( 1 <= s <= 100 ): sys.exit()
array = [s]

for I in range(1,10 ** 6 + 1):
    if array[ I - 1 ] % 2 == 0:
        if array[I - 1]//2 in array:
            print(I)
            sys.exit()
        array.append(array[(I - 1)]//2)     
    else:
        if (3 * array[I - 1]) + 1 in array:
            print(I)
            sys.exit()
        array.append((3 * array[(I - 1)]) + 1)

Submission status: Wrong Answer

Solution code:
import sys
s = int(input())
if not ( 1 <= s <= 100 ): sys.exit()
array = [s]

for I in range(1,10 ** 6 + 1):
    print(array)
    if array[ I - 1 ] % 2 == 0:
        if array[I - 1]//2 in array:
            print(I)
            sys.exit()
        array.append(array[(I - 1)]//2)     
    else:
        if (3 * array[I - 1]) + 1 in array:
            print(I)
            sys.exit()
        array.append((3 * array[(I - 1)]) + 1)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
s = int(input())
if not ( 1 <= s <= 100 ): sys.exit()
array = [s]

for I in range(1,10 ** 6):
    if array[ I - 1 ] % 2 == 0:
        if array[I - 1]//2 in array:
            print(I)
            sys.exit()
        array.append(array[(I - 1)]//2)     
    else:
        array.append((3 * array[(I - 1)]) + 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
cnt = 0
m = 1
S = -1
while True:
	s = f(s)
	m = m+1
	if cnt == 0 and s in [4,2,1]:
		S = s
		cnt=1
		continue
	if s == S:
		print(m)
	else:
		continue
	break

Submission status: Wrong Answer

Solution code:
s=int(input())

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

Submission status: Wrong Answer

Solution code:
s=int(input())

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = int(input())

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

print(idx)

Submission status: Wrong Answer

Solution code:
def resolve():
    '''
    code here
    '''
    s = int(input())
    is_not_found = True
    cnt = 0
    while is_not_found:
        cnt += 1
        if s == 4:
            is_not_found = False
        else:
            if s % 2 == 0:
                s //= 2
            else:
                s = 3*s + 1
        
    print(cnt+3)


if __name__ == "__main__":
    resolve()

Submission status: Wrong Answer

Solution code:
s = int(raw_input())
seen= set()
i = 0
while(s not in seen):
	seen.add(s)
	i +=1
	if s % 2:
		s = 3 * s + 1
	else:
		s /= 2
print i

Submission status: Wrong Answer

Solution code:
s = int(input())

ans = 0

while s not in [1,2,4]:
    ans+=1
    if s%2:
        s = 3*s+1
    else:
        s//=2

ans+4

Submission status: Wrong Answer

Solution code:
s = int(input())

check = [0]*(10**6+1)

counter = 1
while 1:
    counter +=1
    s = s//2 if s%2 ==0 else 3*s+1
    if check[s]==1:
        print(counter)
        break
    check[s]=1

Submission status: Wrong Answer

Solution code:
s=int(input())

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

l=[s]
while s!=1:
    s=collatz(s)
    l.append(s)

if s==1:
    print(4)
elif s==2:
    print(4)
else:
    print(len(l)+1)

Submission status: Wrong Answer

Solution code:
s=int(input())

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

l=[]
while s!=1:
    s=collatz(s)
    l.append(s)
    
print(len(l)+2)

Submission status: Wrong Answer

Solution code:
s=int(input())

K=1
while s!=1:
    if s%2:
        s=3*s+1
    else:
        s//=2
    K+=1
print(K+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

a = []
for i in range(1, 1000001):
    if i == 1:
        a.append(s)
    else:
        n = a[i-2]
        a.append(f(n))

print(a.index(4)+4)

Submission status: Wrong Answer

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

s = int(input())
ans = 0
u = s
i = 1
t = [0]*1000010
t[0] = s
while 1:
    i += 1
    u = f(u)
    if t[u]!=0:
        ans = i
        break
    else:
        t[u] = 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

s = int(input())
res = []
idx = 0
for i in range(2, 10 ** 6 + 1):
    s = func(s)
    if s in res:
        idx = i
        break
    res.append(s)
print(idx)

Submission status: Wrong Answer

Solution code:
S = int(input())

A = []

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

print(len(A)+2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s=int(input())
if 1==s or 2==s or 4==s:
  print(4)
x=0
for i in range(1,10**9):
  if 1==i:
    x=s
  if 1<i:
    if x%2!=0:
      x=3*x+1
    else:
      x/=2
  if x==4:
    print(i+3)
    break