ZhenlongDai/ACPR huggingface dataset:
Problem: p02836
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from math import modf
word=input()
word=list(set(word))
n=len(word)/2
decimal,integer=modf(n)
integer=int(integer)
count=0
for i in range(integer):
  if word[i]!=word[-i-1]:
    word[-i-1]=word[i]
    count+=1
print(count)

Failing test case input:
rfbrbddo

Expected output:
4


Actual output:
2


Fixed submission (verdict: Accepted):
from math import modf
word=input()
word=list(word)
n=len(word)/2
decimal,integer=modf(n)
integer=int(integer)
count=0
for i in range(integer):
  if word[i]!=word[-i-1]:
    word[-i-1]=word[i]
    count+=1
print(count)

Problem: p02836
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = input()
index = 0
count = 0

while True:
    if len(n) / 2 < index:
        break
    if n[index] != n[(index*-1) - 1]:
        count += 1
    index += 1
print(count)

Failing test case input:
rfcqobad

Expected output:
4


Actual output:
5


Fixed submission (verdict: Accepted):
n = input()
index = 0
count = 0

while True:
    if len(n) / 2 <= index:
        break
    if n[index] != n[(index*-1) - 1]:
        count += 1
    index += 1
print(count)

Problem: p02836
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import math
S = input()
s = list(S) 
count=0
N=int(math.ceil(len(s)/2))

for i in range(N):
 if not s[i]==s[N-i-1]:
  count+=1

print(count)


Failing test case input:
bcba`cc

Expected output:
2


Actual output:
4


Fixed submission (verdict: Accepted):

import math
S = input()
s = list(S) 
count=0
N=int(math.ceil(len(s)/2))

for i in range(N):
 if not s[i]==s[len(s)-i-1]:
  count+=1

print(count)
Problem: p01101
Buggy submission (Python3, verdict: Wrong Answer):
while(True):
    max=0
    b=list(map(int,input().split()))
    n=b[0]
    m=b[1]
    if(n == 0 and m == 0):
        break
    a=list(map(int,input().split()))
    for i in range(n):
        for j in range(i+1,n):
            sum=a[i]+a[j]
            if(sum>max and sum<m):
                max=sum
    if m==0:
        print("NONE")
    else:
        print(max)





Failing test case input:
3 45
1 20 30
6 10
1 2 8 8 9 32
7 100
11 34 63 47 14 35 70
4 000
80 70 60 50
4 20
10 9 10 16
0 0

Expected output:
31
10
98
NONE
20


Actual output:
31
9
98
NONE
19


Fixed submission (verdict: Accepted):
maxs=[]
while(True):
    max=-1
    
    b=list(map(int,input().split()))
    n=b[0]
    m=b[1]
    if(n == 0 and m == 0):
        break
    a=list(map(int,input().split()))
    for i in range(n):
        for j in range(i+1,n):
            sum=a[i]+a[j]
            if(sum>max and sum<=m):
                max=sum
    maxs.append(max)

for i in maxs:
    if i==-1:
        print("NONE")
    else:
        print(i)

Problem: p01101
Buggy submission (Python3, verdict: Wrong Answer):
import sys
while(True):
    items=[]
    max=0
    n, m = map(int, input().split())
    if (n == 0 & m == 0):exit()
    items = list(map(int, input().split()))
    for i in range(n):
        for j in range(n):
            sum = items[i] + items[j]
            if (i != j and sum < m and sum > max):
                max = sum
    if (max == 0):
        print("NONE")
    else:
        print(max)



Failing test case input:
3 45
17 20 30
6 10
1 2 5 8 4 6
7 100
11 34 2 47 115 45 70
4 100
80 29 62 50
4 20
10 5 10 16
0 0

Expected output:
37
10
92
91
20


Actual output:
37
9
92
91
15


Fixed submission (verdict: Accepted):
import sys
while(True):
    items=[]
    max=0
    n, m = map(int, input().split())
    if (n == 0 & m == 0):exit()
    items = list(map(int, input().split()))
    for i in range(n):
        for j in range(n):
            sum = items[i] + items[j]
            if (i != j and sum <= m and sum > max):
                max = sum
    if (max == 0):
        print("NONE")
    else:
        print(max)
Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
121

Expected output:
97


Actual output:
96


Fixed submission (verdict: Accepted):
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 + 1)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
colatz=[1,2,4]
colatz.append(int(input()))
b=3
while colatz[b]!=colatz[b-3]:
    if colatz[b]%2==0:
        colatz.append(colatz[b]/2)
    else: colatz.append(3*colatz[b]+1)
    b=b+1
print(b+1)

Failing test case input:
409

Expected output:
42


Actual output:
45


Fixed submission (verdict: Accepted):
colatz=[1,2,4]
colatz.append(int(input()))
if colatz[3]==1 or colatz[3]==2 or colatz[3]==4:
    print(4)
else:
    b=3
    while colatz[b]!=4:
        if colatz[b]%2==0:
            colatz.append(colatz[b]/2)
        else: colatz.append(3*colatz[b]+1)
        b=b+1
    print(b+1)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
res = [s]
idx = 1

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

Failing test case input:
107

Expected output:
102


Actual output:
1


Fixed submission (verdict: Accepted):
s = int(input())
a = [s]

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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())

f = [s]

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


Failing test case input:
297

Expected output:
75


Actual output:
73


Fixed submission (verdict: Accepted):
s = int(input())

f = [s]

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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):



s = int(input())

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

print(len(ls))



Failing test case input:
206

Expected output:
90


Actual output:
89


Fixed submission (verdict: Accepted):



s = int(input())

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

print(len(ls)+1)
Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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

Failing test case input:
159

Expected output:
56


Actual output:
39


Fixed submission (verdict: Accepted):
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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
ansli = [s]
flg = True
cnt = 2
def f(n):
    if n%2 == 0:
        return int(n/2)
    else:
        return (3*n)-1
while flg:
    cur = f(cnt)
    if cur in ansli:
        print(cnt)
        flg = False
    else:
        ansli.append(cur)
        cnt += 1

Failing test case input:
388

Expected output:
122


Actual output:
16


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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())

a_list = []
a_list.append(s)
while True:
    if s%2 ==0:
        if s/2 in a_list:
            print(len(a_list)+1)
            break
        else: 
            a_list.append(s/2)
            s = s/2
    elif s%2 !=0:
        if (3*s)+1 in a_list:
            print(len(a_list)+1)
            break
        else:
            a_list.append((3*s)+1)
            n = (3*s)+1

Failing test case input:
1171

Expected output:
59


Actual output:
3


Fixed submission (verdict: Accepted):
s = int(input())

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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())

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

a = []
a.append(s)
for i in range(100):
    tmp = collatz(a[i])
    if tmp in a:
        print(len(a)+1)
        exit()
    a.append(tmp)

Failing test case input:
588

Expected output:
120


Actual output:

Fixed submission (verdict: Accepted):
s = int(input())

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

a = []
a.append(s)
for i in range(1000001):
    tmp = collatz(a[i])
    if tmp in a:
        print(len(a)+1)
        exit()
    a.append(tmp)
Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
a_prev = s
a_old = {}
for i in range(2,101):
    if a_prev % 2:
        a = 3 * a_prev + 1
    else:
        a = a_prev / 2
    if a in a_old:
        print(int(i))
        break
    else:
        a_old[a] = 1
        a_prev = a

Failing test case input:
129

Expected output:
123


Actual output:

Fixed submission (verdict: Accepted):
s = int(input())
a_prev = s
a_old = {s:1}
for i in range(2,1000001):
    if a_prev % 2:
        a = int(3 * a_prev + 1)
    else:
        a = int(a_prev / 2)
    if a in a_old:
        print(int(i))
        break
    else:
        a_old[a] = 1
        a_prev = a

Problem: p03146
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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
  


Failing test case input:
306

Expected output:
39


Actual output:

Fixed submission (verdict: Accepted):
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
  else:
    l.append (s)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
res = [s]
idx = 1

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

Failing test case input:
556

Expected output:
45


Actual output:
44


Fixed submission (verdict: Accepted):
s = int(input())
a = [s]

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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=int(input())
a=[]
while True:
  if s not in a:
    a.append(s)
  else:
    break
  if s%2==0:
    s/=2
  else:
    s=3*s+1
print(len(a))

Failing test case input:
108

Expected output:
115


Actual output:
114


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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=int(input())
list=[s]
num=2
while num<=1000000:
  if num%2==0:
    if list[num-2]/2 in list:
      break
    else:
      list.append(list[num-2]/2)
    num+=1
  else:
    if 3*list[num-2]+1 in list:
      break
    else:
      list.append(list[num-2]*3+1)
    num+=1
print(num)

Failing test case input:
933

Expected output:
87


Actual output:
3470


Fixed submission (verdict: Accepted):
s=int(input())
list=[s]
num=2
while num<=1000000:
  if list[num-2]%2==0:
    list.append(list[num-2]/2)
  else:
    list.append(list[num-2]*3+1)
  if list[num-1] in list[:num-1]:
    break
  num+=1
print(num)
Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)


Failing test case input:
107

Expected output:
102


Actual output:
104


Fixed submission (verdict: Accepted):
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:
            print(4)
elif an.index(2) == 0:
            print(4)
else:
    print(an.index(4) + 4)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
count = 0
while s!=1:
  if s%2==0:
    s /= 2
  else:
    s = s*3+1
  count += 1
if s == 1:
  print(4)
elif s == 2:
  print(2)
else:
  print(count+2)


Failing test case input:
211

Expected output:
41


Actual output:
4


Fixed submission (verdict: Accepted):
s = int(input())
moto = s
count = 0
while s!=1:
  if s%2==0:
    s /= 2
  else:
    s = s*3+1
  count += 1
if moto == 1:
  print(4)
elif moto == 2:
  print(4)
else:
  print(count+2)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
129

Expected output:
123


Actual output:
122


Fixed submission (verdict: Accepted):
s = int(input())
a = set()
a.add(s)
index = 2
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)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
A = []

A.append(s)
a = s
for i in range(100):
    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


Failing test case input:
220

Expected output:
116


Actual output:

Fixed submission (verdict: Accepted):
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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=int(input())
count=0
for i in range(1000):
    if s%2==1:
        s=s*3+1
    else:
        s=s
    if s==4:
        count+=1
    if count==2:
        print(i+2)
        break

Failing test case input:
323

Expected output:
101


Actual output:

Fixed submission (verdict: Accepted):
s=int(input())
a=[-12345]*100000
for i in range(100000):
    
    a[i]=s
    if s%2==1:
        s=s*3+1
    else:
        s=s/2

    if s in a:
        print(i+2)
        break
Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
i = 0
def collatz(x):
  if x%2 == 0:
    return int(x/2)
  else:
    return int(3*x+1)

while s!=4:
  s = collatz(s)
  i += 1

print(str(i+3))

Failing test case input:
865

Expected output:
149


Actual output:
148


Fixed submission (verdict: Accepted):
s = int(input())
i = 1
def collatz(x):
	if x%2 == 0:
		return int(x/2)
	else:
		return int(3*x+1)

while True:
	if s in [1,2,4]:
		break
	else:
		s = collatz(s)
		i += 1

print(str(i+3))

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
s=int(input())
a=[0]*100
for i in range(100):
    if i==0:
        a[0]=s
    else:
        if a[i-1]%2==0:
            a[i]=a[i-1]/2
        else:
            a[i]=3*a[i-1]+1

for i in range(100):
    for j in range(i+1,100):
        if a[i]==a[j]:
            print(j+1)
            sys.exit(0)


Failing test case input:
388

Expected output:
122


Actual output:

Fixed submission (verdict: Accepted):
import sys
s=int(input())
a=[0]*1000
for i in range(1000):
    if i==0:
        a[0]=s
    else:
        if a[i-1]%2==0:
            a[i]=a[i-1]/2
        else:
            a[i]=3*a[i-1]+1

for i in range(1000):
    for j in range(i+1,1000):
        if a[i]==a[j]:
            print(j+1)
            sys.exit(0)

Problem: p03146
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def calc(n):
    if n % 2 == 0:
        return n 
    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

Failing test case input:
556

Expected output:
45


Actual output:

Fixed submission (verdict: Accepted):

url = "https:

def calc(n):
    if n % 2 == 0:
        return n 
    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()

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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))

Failing test case input:
105

Expected output:
40


Actual output:
39


Fixed submission (verdict: Accepted):
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)
Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
progression = []
n = s
count = 1
while True:
    count += 1
    if n % 2 == 0:
        n = n
    else:
        n = 3 * n + 1

    if n in progression:
        break
    else:
        progression.append(n)

print(count)

Failing test case input:
129

Expected output:
123


Actual output:
3


Fixed submission (verdict: Accepted):
s = int(input())
progression = [s]
n = s
count = 1
while True:
    count += 1
    if n % 2 == 0:
        n = n/2
    else:
        n = 3 * n + 1

    if n in progression:
        break
    else:
        progression.append(n)

print(count)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
li = []
li.append(s)

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

Failing test case input:
494

Expected output:
50


Actual output:
50
[494, 247, 742, 371, 1114, 557, 1672, 836, 418, 209, 628, 314, 157, 472, 236, 118, 59, 178, 89, 268, 134, 67, 202, 101, 304, 152, 76, 38, 19, 58, 29, 88, 44, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1]


Fixed submission (verdict: Accepted):
s = int(input())
li = []
li.append(s)

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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=int(input())
list=[s]
num=2
while num<=1000000:
  if num%2==0:
    list.append(list[num-2]/2)
    if len(list)>len(set(list)):
      break
    num+=1
  else:
    list.append(3*list[num-2]+1)
    if len(list)>len(set(list)):
      break
    num+=1
print(num)

Failing test case input:
199

Expected output:
121


Actual output:
3478


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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
l = list()
l.append(int(input()))
s = set(l)

while(1):
    if(int(l[-1] / 2)):
        l.append(l[-1]/2)
    else:
        l.append(l[-1]*3 + 1)
    s = set(l)
    if(len(s) != len(l)):
        print(len(l))
        break

Failing test case input:
105

Expected output:
40


Actual output:
371


Fixed submission (verdict: Accepted):
l = list()
l.append(int(input()))
s = set(l)

while(1):
    if(int(l[-1] % 2) == 0):
        l.append(int(l[-1]/2))
    else:
        l.append(int(l[-1]*3 + 1))
    s = set(l)
    if(len(s) != len(l)):
        print(len(l))
        break
Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=int(input())
nums=[]
nums.append(s)
i=2
while(1):
  if i%2==0:
    new=int(i/2)
    if new in nums:
      print(i)
      break
    nums.append(new)
  else:
    new=3*i+1
    if new in nums:
      print(i)
      break
    nums.append(new)
  i+=1
  

Failing test case input:
139

Expected output:
43


Actual output:
20


Fixed submission (verdict: Accepted):
s=int(input())
nums=[]
nums.append(s)
i=2
while(1):
  if nums[i-2]%2==0:
    new=int(nums[i-2]/2)
    if new in nums:
      print(i)
      break
    nums.append(new)
  else:
    new=3*nums[i-2]+1
    if new in nums:
      print(i)
      break
    nums.append(new)
  i+=1

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
121

Expected output:
97


Actual output:
[121, 364, 182.0, 91.0, 274.0, 137.0, 412.0, 206.0, 103.0, 310.0, 155.0, 466.0, 233.0, 700.0, 350.0, 175.0, 526.0, 263.0, 790.0, 395.0, 1186.0, 593.0, 1780.0, 890.0, 445.0, 1336.0, 668.0, 334.0, 167.0, 502.0, 251.0, 754.0, 377.0, 1132.0, 566.0, 283.0, 850.0, 425.0, 1276.0, 638.0, 319.0, 958.0, 479.0, 1438.0, 719.0, 2158.0, 1079.0, 3238.0, 1619.0, 4858.0, 2429.0, 7288.0, 3644.0, 1822.0, 911.0, 2734.0, 1367.0, 4102.0, 2051.0, 6154.0, 3077.0, 9232.0, 4616.0, 2308.0, 1154.0, 577.0, 1732.0, 866.0, 433.0, 1300.0, 650.0, 325.0, 976.0, 488.0, 244.0, 122.0, 61.0, 184.0, 92.0, 46.0, 23.0, 70.0, 35.0, 106.0, 53.0, 160.0, 80.0, 40.0, 20.0, 10.0, 5.0, 16.0, 8.0, 4.0, 2.0, 1.0] 97


Fixed submission (verdict: Accepted):
s=int(input())
tmp=[s]
for m in range(2,1000000):
  if tmp[-1]%2 == 0:
    if tmp[-1]/2 in tmp:
      print(m)
      exit()
    else:
      tmp.append(tmp[-1]/2)
  else:
    if 3*tmp[-1]+1 in tmp:
      print(m)
      exit()
    else:
      tmp.append(3*tmp[-1]+1)
Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
k = input().split()
a = int(k[0])

def b(n):
    return int(n/2)
def c(n):
    return int((3*n)+1)

Counter = 0

flag = True
IntSet = set()
IntSet.add(a)
Buffer = int(a)
for i in range(1,1000000+1):
    if Buffer%2 == 0:
        Buffer = b(Buffer)
        Counter+=1
    else:
        Buffer = c(Buffer)
        Counter+=1
    print(Buffer)
    if Buffer in IntSet:
        print(Counter+1)
        break
    else:
        IntSet.add(Buffer)

Failing test case input:
447

Expected output:
99


Actual output:
1342
671
2014
1007
3022
1511
4534
2267
6802
3401
10204
5102
2551
7654
3827
11482
5741
17224
8612
4306
2153
6460
3230
1615
4846
2423
7270
3635
10906
5453
16360
8180
4090
2045
6136
3068
1534
767
2302
1151
3454
1727
5182
2591
7774
3887
11662
5831
17494
8747
26242
13121
39364
19682
9841
29524
14762
7381
22144
11072
5536
2768
1384
692
346
173
520
260
130
65
196
98
49
148
74
37
112
56
28
14
7
22
11
34
17
52
26
13
40
20
10
5
16
8
4
2
1
4
99


Fixed submission (verdict: Accepted):
k = input().split()
a = int(k[0])

def b(n):
    return int(n/2)
def c(n):
    return int((3*n)+1)

Counter = 0

flag = True
IntSet = set()
IntSet.add(a)
Buffer = int(a)
for i in range(1,1000000+1):
    if Buffer%2 == 0:
        Buffer = b(Buffer)
        Counter+=1
    else:
        Buffer = c(Buffer)
        Counter+=1
    if Buffer in IntSet:
        print(Counter+1)
        break
    else:
        IntSet.add(Buffer)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N=int(input())
i=1
L=[N]
M=N
while i< 10:
  i+=1
  if M%2==0:
    M=M/2
    L.append(int(M))
  else:
    M=3*M+1
    L.append(int(M))
  if L.count(M) ==2:
    print(i)
    break

Failing test case input:
171

Expected output:
126


Actual output:

Fixed submission (verdict: Accepted):
N=int(input())
i=1
L=[N]
M=N
while i< 1000000:
  i+=1
  if M%2==0:
    M=M/2
    L.append(int(M))
  else:
    M=3*M+1
    L.append(int(M))
  if L.count(M) ==2:
    print(i)
    break

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a=[int(input())]
for i in range(1000000):
    n=a[i]
    if n%2==0:
        a.append(n/2)
    else:
        a.append(3*n+1)
    if a[i+1]==4:
        print(i+5)
        break
print(a)

Failing test case input:
494

Expected output:
50


Actual output:
50
[494, 247.0, 742.0, 371.0, 1114.0, 557.0, 1672.0, 836.0, 418.0, 209.0, 628.0, 314.0, 157.0, 472.0, 236.0, 118.0, 59.0, 178.0, 89.0, 268.0, 134.0, 67.0, 202.0, 101.0, 304.0, 152.0, 76.0, 38.0, 19.0, 58.0, 29.0, 88.0, 44.0, 22.0, 11.0, 34.0, 17.0, 52.0, 26.0, 13.0, 40.0, 20.0, 10.0, 5.0, 16.0, 8.0, 4.0]


Fixed submission (verdict: Accepted):
a=[int(input())]
for i in range(1000000):
    n=a[i]
    if n%2==0:
        a.append(int(n/2))
    else:
        a.append(3*n+1)

for i in range(1000000):
    if a[i-3]==a[i]:
        print(i+1)
        break
Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

s =int(input())
lists=[]
lists.append(s)
for i in range(2,100):
    if lists[-1]%2==0:
        tmp=int(lists[-1]/2)
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()
    else:
        tmp=(3*lists[-1])+1
        lists.append(tmp)
        if lists.count(tmp)==2:
            print(i)
            exit()

Failing test case input:
220

Expected output:
116


Actual output:

Fixed submission (verdict: Accepted):

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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=int(input())
l=[]
l.append(s)
ans=[]
c=1
for i in range(10000000000):
    if l[c-1]%2==0:
        l.append(int(l[c-1]/2))
    else:
        l.append(int(l[c-1]*3+1))
    for v in range(len(l)):
        ans.append(l.count(l[v]))
    if 2 in ans:
        break
    c+=1
print(c)

Failing test case input:
123

Expected output:
48


Actual output:
47


Fixed submission (verdict: Accepted):
s=int(input())
l=[]
l.append(s)
ans=[]
c=1
for i in range(10000000000):
    if l[c-1]%2==0:
        l.append(int(l[c-1]/2))
    else:
        l.append(int(l[c-1]*3+1))
    for v in range(len(l)):
        ans.append(l.count(l[v]))
    if 2 in ans:
        break
    c+=1
print(c+1)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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

Failing test case input:
643

Expected output:
27


Actual output:
3


Fixed submission (verdict: Accepted):
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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=int(input())
a=[s]
k=1
while k>0:
    if s%2==0:
        x=int(s/2)
        s=x
        a.append(x)
    else:
        x=int(3*s+1)
        s=x
        a.append(int(3*s+1))
    for i in range(len(a)-1):
        if a[len(a)-1]==a[i]:
            print(len(a)-1)
            k=0       




Failing test case input:
156

Expected output:
38


Actual output:
37


Fixed submission (verdict: Accepted):
s=int(input())
a=[s]
k=1
while k>0:
    if s%2==0:
        x=int(s/2)
        s=x
        a.append(x)
    else:
        x=int(3*s+1)
        s=x
        a.append(x)
    for i in range(len(a)-1):
        if a[len(a)-1]==a[i]:
            print(len(a))
            k=0
Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
colatz=[1,2,4]
colatz.append(int(input()))
if colatz[3]==2 or colatz[3]==4:
    print(4)
else:
    b=3
    while colatz[b]!=colatz[b-3]:
        if colatz[b]%2==0:
            colatz.append(colatz[b]/2)
        else: colatz.append(3*colatz[b]+1)
        b=b+1
    print(b+1)

Failing test case input:
220

Expected output:
116


Actual output:
119


Fixed submission (verdict: Accepted):
colatz=[1,2,4]
colatz.append(int(input()))
if colatz[3]==1 or colatz[3]==2 or colatz[3]==4:
    print(4)
else:
    b=3
    while colatz[b]!=4:
        if colatz[b]%2==0:
            colatz.append(colatz[b]/2)
        else: colatz.append(3*colatz[b]+1)
        b=b+1
    print(b+1)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
progression = []
n = s
count = 1
while True:
    if n % 2 == 0:
        n = n
    else:
        n = 3 * n +1
    
    count += 1

    if n in progression:
        print(count)
        break
    else:
        progression.append(n)

Failing test case input:
146

Expected output:
118


Actual output:
3


Fixed submission (verdict: Accepted):
s = int(input())
progression = [s]
n = s
count = 1
while True:
    count += 1
    if n % 2 == 0:
        n = n/2
    else:
        n = 3 * n + 1

    if n in progression:
        break
    else:
        progression.append(n)

print(count)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

s = int(input())

dp = [s]

i=2
a_1=s
while(True):
    if a_1 % 2==0:
        index = a_1 /2
    else:
        index = 3 * a_1 + 1
    print(int(index))
    if int(index) in dp:
        break
    else:
        dp.append(int(index))
        a_1 = int(index)
        i+=1

print(i)

Failing test case input:
123

Expected output:
48


Actual output:
370
185
556
278
139
418
209
628
314
157
472
236
118
59
178
89
268
134
67
202
101
304
152
76
38
19
58
29
88
44
22
11
34
17
52
26
13
40
20
10
5
16
8
4
2
1
4
48


Fixed submission (verdict: Accepted):

s = int(input())

dp = [s]

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

print(i)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
523

Expected output:
125


Actual output:
124


Fixed submission (verdict: Accepted):
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)
Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)


Failing test case input:
159

Expected output:
56


Actual output:
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
xxx
56


Fixed submission (verdict: Accepted):
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)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=int(input())


def add(x):
    y=int(x/2)
    return y

def even(x):
    y=3*x+1
    return y

cnt=0
flag=0
for i in range(120):
    if flag==0:
        if s%2==0:
            s=add(s)
            cnt+=1
            if s==4:
                flag=1
        else:
            s=even(s)
            cnt+=1
            if s==4:
                flag=1

print(cnt+4)




Failing test case input:
523

Expected output:
125


Actual output:
124


Fixed submission (verdict: Accepted):
s=int(input())
ss=s


def add(x):
    y=int(x/2)
    return y

def even(x):
    y=3*x+1
    return y

cnt=0
flag=0
for i in range(1000000):
    if flag==0:
        if s%2==0:
            s=add(s)
            cnt+=1
            if s==4:
                flag=1
        else:
            s=even(s)
            cnt+=1
            if s==4:
                flag=1

if ss==1 or ss==2 or ss==4:
  print(4)
else:
  print(cnt+4)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n = int(input())
a = [n]
count = 0
while 1:
    if n % 2 == 0:
        a.append(int(n/2))
        n = n/2
    else:
        a.append(int(3*n + 1))
        n = 3*n + 1
    if a[count-1] == 1 and a[count] == 4:
        break
    count += 1
if n==1 or n==2:
    print(4)
else:
    print(count+1)

Failing test case input:
306

Expected output:
39


Actual output:
4


Fixed submission (verdict: Accepted):
n = int(input())
a = []
count = 0
while 1:
    if a.count(n):
        print(count+1)
        break
    else:
        a.append(n)
        count += 1
    if n % 2 == 0:
        n = n/2
    else:
        n = 3*n + 1

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
235

Expected output:
129


Actual output:
4


Fixed submission (verdict: Accepted):
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)
Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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()

Failing test case input:
143

Expected output:
105


Actual output:
104


Fixed submission (verdict: Accepted):
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()

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
l=[s]
i=1
def func(a):
  if a%2==0:
    return(a/2)
  else:
    return(3*a+1)

while (len(l)==len(set(l))):
  i+=1
  l.append(func(s))
print(i)


Failing test case input:
1171

Expected output:
59


Actual output:
3


Fixed submission (verdict: Accepted):
s = int(input())
l=[s]
i=1
def func(a):
  if a%2==0:
    return(a/2)
  else:
    return(3*a+1)

while (len(l)==len(set(l))):
  i+=1
  s = func(s)
  l.append(s)
print(i)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=int(input())
list=[s]
num=2
while num<=1000000:
  if num%2==0:
    list.append(list[num-2]/2)
  else:
    list.append(list[num-2]*3+1)
  if list[num-1] in list[:num-1]:
    break
  num+=1
print(num)

Failing test case input:
159

Expected output:
56


Actual output:
3480


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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
vals = []
vals += [s]
n=1
while True:
    if vals[n-1]%2==0:
        val = vals[n-1]/2
    else:
        val = vals[n-1]*3+1
        
    if val in vals:
        print(val)
        break
    else:
        vals += [val]
        n += 1

Failing test case input:
297

Expected output:
75


Actual output:
4.0


Fixed submission (verdict: Accepted):
s = int(input())
vals = []
vals += [s]
n=1
while True:
    if vals[n-1]%2==0:
        val = vals[n-1]/2
    else:
        val = vals[n-1]*3+1
        
    if val in vals:
        print(len(vals)+1)
        break
    else:
        vals += [val]
        n += 1
Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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

Failing test case input:
265

Expected output:
124


Actual output:
122


Fixed submission (verdict: Accepted):
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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=int(input())
count=0
a=[0]*1000000
for i in range(1000000):
    if s%2==1:
        s=s*3+1
    else:
        s=s
    if s in a:
        print(i+2)
        break
    a[i]=s

Failing test case input:
643

Expected output:
27


Actual output:
3


Fixed submission (verdict: Accepted):
s=int(input())
a=[-12345]*100000
for i in range(100000):
    
    a[i]=s
    if s%2==1:
        s=s*3+1
    else:
        s=s/2

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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
count=1
memoL=[]

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

Failing test case input:
292

Expected output:
119


Actual output:
3


Fixed submission (verdict: Accepted):
s = int(input())
count=1
memoL=[s]

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

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
a = []
i = 0
while i <= 100:

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


Failing test case input:
235

Expected output:
129


Actual output:

Fixed submission (verdict: Accepted):
s = int(input())
a = []
i = 0
while 1:

    if i == 0:
        a.append(s)
    elif i > 0:
        if a[i - 1] % 2 == 0:
            a.append(a[i - 1] / 2)
        elif a[i - 1] % 2 == 1:
            a.append(3 * a[i - 1] + 1)
        if a[i] in a[:i]:
            print(i + 1)
            exit()
    i += 1
Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
ss = set()
ss.add(s)
k = 1
while True:
    if s%2 == 0:
        s = s/2
    else:
        s = 3*s + 1
    s = int(s)
    if s in ss:

        break
    ss.add(s)

    k+=1
    print(s)
print(k+1)

Failing test case input:
274

Expected output:
93


Actual output:
137
412
206
103
310
155
466
233
700
350
175
526
263
790
395
1186
593
1780
890
445
1336
668
334
167
502
251
754
377
1132
566
283
850
425
1276
638
319
958
479
1438
719
2158
1079
3238
1619
4858
2429
7288
3644
1822
911
2734
1367
4102
2051
6154
3077
9232
4616
2308
1154
577
1732
866
433
1300
650
325
976
488
244
122
61
184
92
46
23
70
35
106
53
160
80
40
20
10
5
16
8
4
2
1
93


Fixed submission (verdict: Accepted):
s = int(input())
ss = set()
ss.add(s)
k = 1
while True:
    if s%2 == 0:
        s = s/2
    else:
        s = 3*s + 1
    s = int(s)
    if s in ss:

        break
    ss.add(s)

    k+=1

print(k+1)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = int(input())
b = [a]
c = 0
while True:
  c += 1
  if a % 2 == 0:
    a /= 2
    if a in b:
      print(c)
      exit()
    else:
      b.append(a)
  else:
    a = a * 3 + 1
    if a in b:
      print(c)
      exit()
    else:
      b.append(a)


Failing test case input:
295

Expected output:
57


Actual output:
56


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

Problem: p03146
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)

Failing test case input:
588

Expected output:
120


Actual output:
4


Fixed submission (verdict: Accepted):
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 l[0]==1:
    print(4)
elif l[0]==2:
    print(4)
else:
    print(len(l)+1)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = int(input())
a = [s]
for i in range(1000000):
    ai = (a[i - 1] / 2) * (a[i - 1] % 2 == 0) + (3 * a[i - 1] + 1) * (a[i - 1] % 2 != 0)
    a.append(ai)
    if a[i] == a[i - 1]:
        print(i)
        break


Failing test case input:
588

Expected output:
120


Actual output:
2


Fixed submission (verdict: Accepted):
s = int(input())
a = [s]
for i in range(1, 1000001):
    ai = (a[i - 1] / 2) * (a[i - 1] % 2 == 0) + (3 * a[i - 1] + 1) * (a[i - 1] % 2 == 1)
    a.append(ai)
    
    if ai in a[:-1]:
        print(i+1)
        break
Problem: p03146
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)

Failing test case input:
601

Expected output:
58


Actual output:
2


Fixed submission (verdict: Accepted):
s=int(input())
G =[]
while (s not in G):
  G.append(s)
  if s % 2==0:
    s = int(s
  else:
    s = int(3*s+1)
print(len(G)+1)

Problem: p03146
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
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)

Failing test case input:
159

Expected output:
56


Actual output:
[159, 478, 239, 718, 359, 1078, 539, 1618, 809, 2428, 1214, 607, 1822, 911, 2734, 1367, 4102, 2051, 6154, 3077, 9232, 4616, 2308, 1154, 577, 1732, 866, 433, 1300, 650, 325, 976, 488, 244, 122, 61, 184, 92, 46, 23, 70, 35, 106, 53, 160, 80, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2]
56


Fixed submission (verdict: Accepted):
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(i)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def f(i):
    if i%2 == 0:
        return int(i/2)
    else:
        return 3*i+1


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


Failing test case input:
103

Expected output:
89


Actual output:

Fixed submission (verdict: Accepted):
def f(i):
    if i%2 == 0:
        return int(i/2)
    else:
        return 3*i+1


s = int(input())
a = [s]
ans = 0
for i in range(1,1000000):
    ai = f(a[i -1])
    if a.count(ai) == 1:
        ans = i + 1
        break
    a.append(ai)
print(ans)

Problem: p03146
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def func(x):
  if(x % 2 == 0):
    return x / 2
  else:
    return 3 * x + 1

s = int(input())
cnt = 0
while(s != 1):
  s = func(s)
  cnt += 1
print(cnt + 1)


Failing test case input:
933

Expected output:
87


Actual output:
86


Fixed submission (verdict: Accepted):
def func(x):
  if(x % 2 == 0):
    return x / 2
  else:
    return 3 * x + 1

s = int(input())
if((s == 1) or (s == 2)):
  print(4)
  exit()
  
cnt = 1
while(s != 1):
  s = func(s)
  cnt += 1
print(cnt + 1)