TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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).

Submission attempts (in order):
s = int(input())

ar = []
flag = 0
count = 0

while flag == 0:
	count = count +1
	if s % 2 == 0:
		s = s//2
	else:
		s = 3* s +1
	if s in ar:
		flag = 1
	else:
		ar.append(s)
		print(s)

print(count+1)

s = int(input())

ar = []
flag = 0
count = 0

while flag == 0:
	count = count +1
	if s % 2 == 0:
		s = s//2
	else:
		s = 3* s +1
	if s in ar:
		flag = 1
	else:
		ar.append(s)
#		print(s)

print(count)

s = int(input())

ar = []
ar.append(s)
flag = 0
count = 0

while flag == 0:
	count = count +1
	if s % 2 == 0:
		s = s//2
	else:
		s = 3* s +1
	if s in ar:
		flag = 1
	else:
		ar.append(s)
#		print(s)

print(count+1)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
S=int(input())
l=[0]*1000000
l[0]=0
l[1]=S
for i in range(2,1000000):
    if l[i-1]%2==0:
       l[i]=l[i-1]//2
    else:
        l[i]=3*l[i-1]+1
    print(l[i])
    for j in range(1,i-1):
        if l[i]==l[j]:
            print(i)
            exit()


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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())
cnt = 0
while s != 1:
  cnt += 1
  if s%2:
    s = 3*s + 1
  else:
    s//= 2
print(cnt)

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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())

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

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

print(result)


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

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

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
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
        for i in range(count):
            if ans[i] == ans[count]:
                print(k+1)
                exit()
resolve()

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()

def resolve():
    s = int(input())
    ans = [s]
    count = 0
    while s != 4:
        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]
    print(count+4)
resolve()

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
        for i in range(count):
            if ans[i] == ans[count]:
                print(k+1)
                exit()
resolve()

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
        for i in range(count):
            if ans[i] == ans[count]:
                print(count+1)
                exit()
resolve()

Verdicts: Runtime Error

Wrong Answer

Time Limit Exceeded

Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
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))

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)+1)


Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
 s = int(input())
a = [s]

for i in range(1, 1000000):
    if a[i-1]%2 == 0:
        tmp = (a[i-1]//2)
    else:
        tmp = (3*a[i-1] + 1)
    
    if a.count(tmp):
        ans = i+1
        break
    else:
        a.append(tmp)
        
print(ans)

s = int(input())
a = [s]

for i in range(1, 1000000):
    if a[i-1]%2 == 0:
        tmp = (a[i-1]//2)
    else:
        tmp = (3*a[i-1] + 1)
    
    if a.count(tmp):
        ans = i+1
        break
    else:
        a.append(tmp)
        
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
def func(long n):
    if n % 2 == 0:
        return n / 2
    else:
        return 3*n + 1

s = int(input())

data = set(s)

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


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

s = int(input())

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


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

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


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
import sys

s = int(sys.stdin.readline().strip())
a = s
a_all = []
a_all.append(a)

def fnc_odd(n):
    return 3*n+1
    
def fnc_even(n):
    return int(n/2)
    
i = 2

while (i<120):
    if(a%2==0):
        a = fnc_even(a)
        a_all.append(a)
    else:
        a = fnc_odd(a)
        print("now i,a:",i,a)
        a_all.append(a)
    if(i>3 and a_all[(i-3)-1]==a):
        break
    i += 1
        
print(i)

import sys

s = int(sys.stdin.readline().strip())
a = s
a_all = []
a_all.append(a)

def fnc_odd(n):
    return 3*n+1
    
def fnc_even(n):
    return int(n/2)
    
i = 2

while (i<120):
    if(a%2==0):
        a = fnc_even(a)
        a_all.append(a)
    else:
        a = fnc_odd(a)
        a_all.append(a)
    if(i>3 and a_all[(i-3)-1]==a):
        break
    i += 1
        
print(i)

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
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

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

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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).

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

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

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())
array = [s]
 
m = 2
while m < 100000:
  if (s % 2 == 0):
    s = s / 2
  else:
    s = 3 * s + 1
  
  if s in array:
    print(m)
    break
  else:
    array.append(m)
    m += 1

s = int(input())
array = [s]

m = 1
while m < 100000:
  if (s % 2 == 0):
    s = s / 2
  else:
    s = 3 * s + 1
  
  if s in array:
    print(m)
    break
  else:
    array.append(m)
    m += 1

s = int(input())
array = [s]
 
m = 2
while m < 100000:
  if (s % 2 == 0):
    s = s / 2
  else:
    s = 3 * s + 1
  
  if s in array:
    print(m)
    break
  else:
    array.append(s)
    m += 1

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())
s_ = s
x = []
counter = 0


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

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

s = int(input())
s_ = s
counter = 0

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


Verdicts: Wrong Answer

Accepted
Problem: 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).

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

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)

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)

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))

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))

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)

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)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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).

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



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



Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
S = int(input())

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

S = int(input())

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


S = int(input())

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


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
def f(a):
    if a % 2 == 0:
        return a // 2
    elif a % 2 == 1:
        return 3 * a + 1

s = int(input())
a = [s]
done = False
while not done:
    for i in range(len(a)):
        if a[i] != f(a[-1]):
            a.append(f(a[-1]))

        else:
            print(i)
            done = True
            break


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

s = int(input())
a = [s]
done = False
while not done:
    for i in range(len(a)):
        if a[i] != f(a[-1]):
            a.append(f(a[-1]))

        else:
            print(i)
            done = True
            break


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


s = int(input())
a = [s]
done = False
while not done:
    if f(a[-1]) in a:
        print(len(a) + 1)
        done = True
        break
    else:
        a.append(f(a[-1]))
        


Verdicts: Time Limit Exceeded

Runtime Error

Accepted
Problem: 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).

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


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


Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())
lis = [s]

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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).

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

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

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input)

A = []

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


s = int(input)

A = []

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


s = int(input())
A = []

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


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())
l = [s]
ans = 0
next = 0

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

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

print(ans)

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

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

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

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())
s_list = []
if s != 1 or s != 2:
    while s != 1:
        if s % 2 == 0:
            s = s / 2
        else:
            s = 3 * s + 1
        s_list.append(s)
    print(max(len(s_list)+2), 4)
else:
    print(4)

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

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
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)

s = int(input())
lst = [s]

for i in range(1,1000001):

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

    if lst.count(lst[i])==2:
        break

print(i+1)

Verdicts: Wrong Answer

Accepted
Problem: 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).

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

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

X = [s]
m = 1
next = s

while True:
  m += 1
  next = f(next)
  if next in X:
    break
  else:
    X.append(next)
    
print(m)


Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())

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

if s in (1, 2):
    print(4)
else:
    ai = s
    cnt = 1
    while ai != 4:
        print(ai)
        ai = f(ai)
        cnt += 1

    print(cnt + 3)



s = int(input())

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

if s in (1, 2):
    res = 4
else:
    ai = s
    cnt = 1
    while ai != 4:
        ai = f(ai)
        cnt += 1

    res = cnt + 3

print(res)



Verdicts: Wrong Answer

Accepted
Problem: 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).

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

s = int(input())
a = [0] * 1
a[0] = s
ans = 0

for i in a:
    b = f(i)
    ans += 1
    if b in a:
        break
    a.append(b)
print(ans)

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

s = int(input())
a = [0] * 1
a[0] = s
ans = 1

for i in a:
    b = f(i)
    ans += 1
    if b in a:
        break
    a.append(b)
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())
l = [s]
chk = 0
for i in range(10**6):
	if(s % 2 == 0):
		s = s/2
	else:
		s = 3*s+1
	s = int(s)
	print("{}, {}".format(l,s))
	for j in range(0,len(l)):
		if(l[j] == s):
			chk = 1
			break
	if(chk == 1):
		break
	l.append(s)
print(i+2)

s = int(input())
l = [s]
chk = 0
for i in range(10**6):
	if(s % 2 == 0):
		s = s/2
	else:
		s = 3*s+1
	s = int(s)
	for j in range(0,len(l)):
		if(l[j] == s):
			chk = 1
			break
	if(chk == 1):
		break
	l.append(s)
print(i+2)

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())
a = [0 for i in range(1000001)]
a[s] = 1
ai = s
i = 2
while True:
  if ai % 2 == 0:
    ai /= 2
  else:
    ai = 3 * ai + 1
  if a[ai] > 0:
    print(i)
    break
  else:
    a[ai] = 1
    i += 1


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


s = int(input())
a = [0 for i in range(1000001)]
a[s] = 1
ai = s
i = 2
while True:
  if ai % 2 == 0:
    ai //= 2
  else:
    ai = 3 * ai + 1
  if a[ai] > 0:
    print(i)
    break
  else:
    a[ai] = 1
    i += 1


Verdicts: Runtime Error

Time Limit Exceeded

Accepted
Problem: 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).

Submission attempts (in order):
N = int(input())
C = 0
while(True):
  if N%2 == 0:
    N /= 2
  else:
    N == 3*N + 1
  C += 1
  if N == 1:
    break
print(C+3)

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

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)
      if N == 4:
        print(i+5)
        break

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())
a = []

while s not in a:
    print("xxx")
    a.append(s)
    if s % 2 == 0:
        s = s / 2
    else:
        s = s * 3 + 1

print(len(a) + 1)


s = int(input())
a = []

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

print(len(a) + 1)


Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):

s = int(input())
temp = []
temp.append(s)
former = s
idx = 1

while True:
    idx += 1
    if former % 2 == 0:
        later = former / 2
    else:
        later = former * 3 + 1

    if later in temp:
        print(idx)
        break



s = int(input())
temp = []
temp.append(s)
former = s
idx = 1

while True:
    idx += 1
    later = former / 2 if former % 2 == 0 else former * 3 + 1

    if later in temp:
        print(idx)
        break
    temp.append(later)
    former = later


Verdicts: Time Limit Exceeded

Accepted
Problem: 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).

Submission attempts (in order):
n = input()
ans = 1
while (n != 4 and n != 2 and n != 1):
  ans += 1
  if n % 2 == 0:
    n = n / 2
  else:
    n = 3 * n + 1

print(ans + 3)

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

print(ans + 3)

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())

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

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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
a=[int(input())]
i=0
while True:
  i+=1
  if a[-1]%2==1:
    if a[-1]*3+1 in a:
      break
    a.append(a[-1]*3+1)
  else:
    if a[-1]/2 in a:
      break
    a.append(a[-1]/2)
print(i)

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

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())
a = [s]
ans = -1
for i in range(1000000):
    if ans != -1:
        if a[-1] % 2 == 0:
            a.append(a[-1]/2)
        else:
            a.append(3*a[-1]+1)    

        for j in range(len(a)-1):
            if a[-1] == a[j]:
                ans = len(a)
                break
    else:
        print(ans)
        break

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

        for j in range(len(a)-1):
            if a[-1] == a[j]:
                ans = len(a)
                break
    else:
        print(ans)
        break

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())
x = 0
if s ==1 or s == 1:
    print(4)
    exit()

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

s = int(input())
x = 0
 
if s == 1 or s == 2:
    print(4)
else:
     while not s == 4:
         if s % 2 == 0:
             s = 3 * s + 1
             x = x + 1
        
         else:
             s = s // 2
             x = x + 1
print(x + 3)

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

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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).

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


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


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


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


Verdicts: Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
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


s = int(input())
rec = {}


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


s = int(input())
rec = set()


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


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


Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
a = int(input())
als = [0]*(100000)
for i in range(0,10**6+2):
    als[a] = 1
    if a%2 == 0:
        a = a//2
    else:
        a = 3*a+1
    if als[a] == 1:
        print(i+2)
        exit()
    print(a)

a = int(input())
als = [0]*(30000)
for i in range(0,10**6+2):
    als[a] = 1
    if a%2 == 0:
        a = a//2
    else:
        a = 3*a+1
    if als[a] == 1:
        print(i+2)
        exit()

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())
array = []
cnt = 1
array.append(s)
while True:
    s = cal(s)
    array.append(s)
    if array[cnt] in array[:cnt]:
        print(cnt +1)
        break
    cnt += 1

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


s = int(input())
array = []
cnt = 1
array.append(s)
while True:
    s = cal(s)
    array.append(s)
    if array[cnt] in array[:cnt]:
        print(cnt +1)
        break
    cnt += 1


Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
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)

s = int(input())
a_i = s
v = set([a_i])
for i in range(2, 1000000):
    if a_i % 2 == 0:
        a_i = int(a_i // 2)
    else:
        a_i = a_i * 3 + 1
    if a_i in v:
        print(i)
        break
    v.add(a_i)
    # print(f"i:{i} a_i:{a_i}", file=sys.stderr)

Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
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)


s = int(input())

sequence = [s]
ans = 1
while True:
    if s%2 == 0:
        s //= 2
    else:
        s = 3*s+1

    ans += 1

    if s in sequence:
        break

    sequence.append(s)

print(ans)


Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
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


url = "https://atcoder.jp//contests/abc116/tasks/abc116_b"

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



if __name__ == '__main__':
    main()


Verdicts: Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
def next_num(n):
  if n%2:
    return 3*n+1
  else:
    return n/2

s = int(input())

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


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

s = int(input())

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

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

s = int(input())

n = s
for i in range(1000000):
  if n == 4:
    print(i+4)
    break
  n = next_num(n)


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

s = int(input())

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


Verdicts: Runtime Error

Runtime Error

Wrong Answer

Accepted
Problem: 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).

Submission attempts (in order):
def f(s):
	cnt = 0
	st = set()
	cnt += 1
	st.add(s)
  
	while True:
		cnt += 1
    	if s % 2 == 0:
      		tmp = s / 2
    	else:
      		tmp = 3 * s + 1
    	if tmp in st:
      		break
    
    	st.add(tmp)
    	s = tmp
	return cnt
  
s = int(input())
ans = f(s)
print(ans)

def f(s):
	cnt = 0
	st = set()
	cnt += 1
	st.add(s)
  
	while True:
		cnt += 1
		if s % 2 == 0:
			tmp = s / 2
		else:
			tmp = 3 * s + 1
		if tmp in st:
			break
    
		st.add(tmp)
		s = tmp
	return cnt
  
s = int(input())
ans = f(s)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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).

Submission attempts (in order):
s = int(input())
check = [s]
count = 0
for i in range(2,1000001):
  if s%2==0:
    s = int(s/2)
    if s in check==True:
      print(i)
      exit()
    else:
      check.append(s)
  else:
    s = 3*s+1
    if s in check==True:
      print(i)
      exit()
    else:
      check.append(s)

s = int(input())
check = [s]
count = 1

while True:
  count+=1
  if s%2==0:
    s = int(s/2)
  else:
    s = 3*s+1
  if s in check:
    print(count)
    exit()
  else:
    check.append(s)

Verdicts: Wrong Answer

Accepted