problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p03146
u553070631
2,000
1,048,576
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).
['a=[int(input())]\nfor i in range(1000000):\n n=a[i]\n if n%2==0:\n a.append(n/2)\n else:\n a.append(3*n+1)\n if a[i+1]==4:\n print(i+5)\n break\nprint(a)', 'a=[int(input())]\nfor i in range(1000000):\n n=a[i]\n if n%2==0:\n a.append(int(n/2))\n else:\n a.append(3*n+1)\n\nfor i in range(1000000):\n if a[i-3]==a[i]:\n print(i+1)\n break']
['Wrong Answer', 'Accepted']
['s459139940', 's198627367']
[2940.0, 10900.0]
[17.0, 425.0]
[183, 208]
p03146
u557494880
2,000
1,048,576
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).
['def f(n):\n if n % 2 == 0:\n return n // 2\n else:\n return 3*n + 1\ns = int(input())\na = [0]\na.append(s)\nfor i in range(1,10**8):\n x = a[-1]\n y = f(x)\n if y in a:\n print(i)\n break\n a.append(y)', 'def f(n):\n if n % 2 == 0:\n return n // 2\n else:\n return 3*n + 1\ns = int(input())\na = [0]\na.append(s)\nfor i in range(2,10**7+1):\n x = a[-1]\n y = f(x)\n if y in a:\n print(i)\n break\n a.append(y)']
['Wrong Answer', 'Accepted']
['s180901955', 's928437688']
[3060.0, 3060.0]
[17.0, 17.0]
[234, 236]
p03146
u558242240
2,000
1,048,576
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).
['s = int(input())\na = [s]\nz = set(s)\nidx = 1\nfor i in range(10**8):\n idx += 1\n if a[i] % 2 == 0:\n ai = a[i] // 2\n else:\n ai = 3 * a[i] + 1\n if ai in z:\n print(idx)\n exit()\n a.append(ai)\n z.add(ai)\n', 's = int(input())\na = [s]\nz = set([s])\nidx = 1\nfor i in range(10**8):\n idx += 1\n if a[i] % 2 == 0:\n ai = a[i] // 2\n else:\n ai = 3 * a[i] + 1\n if ai in z:\n print(idx)\n exit()\n a.append(ai)\n z.add(ai)\n']
['Runtime Error', 'Accepted']
['s047431119', 's215575557']
[3060.0, 3060.0]
[17.0, 17.0]
[242, 244]
p03146
u560889512
2,000
1,048,576
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).
['n=int(input().split())\ndic=set()\ndic|={1}\ni=1\nwhile True:\n if n%2==0:\n n=n//2\n else:\n n=3*n+1\n i+=1\n if n in dic:\n print(i)\n break\n else:\n dic|={i}\n', 'n=int(input().split())\ndic={n:1}\ni=1\nwhile True:\n if n%2==0:\n n=n//2\n else:\n n=3*n+1\n i+=1\n if n in dic:\n print(i)\n break\n else:\n dic[n]=i', 'n=int(input().split())\ndic=set()\ndic|={n}\ni=1\nwhile True:\n if n%2==0:\n n=n//2\n else:\n n=3*n+1\n if n in dic:\n print(i+1)\n break\n else:\n dic|={n}\n i+=1\n', 'n=int(input().split())\ndic=set()\ndic|={n}\ni=1\nwhile True:\n if n%2==0:\n n=n//2\n else:\n n=3*n+1\n i+=1\n if n in dic:\n print(i)\n break\n else:\n dic|={n}\n', 'n=int(input().split())\ndic={n:1}\ni=1\nwhile True:\n if n%2==0:\n n=n//2\n else:\n n=3*n+1\n i+=1\n if n in dic:\n print(dic[n])\n break\n else:\n dic[n]=i', 'n=int(input())\ndic=set()\ndic|={n}\ni=1\nwhile True:\n if n%2==0:\n n=n//2\n else:\n n=3*n+1\n if n in dic:\n print(i+1)\n break\n else:\n dic|={n}\n i+=1\n']
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s243982223', 's311168950', 's462201347', 's896763814', 's968368224', 's927678957']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0, 17.0, 17.0, 18.0]
[168, 158, 172, 168, 163, 164]
p03146
u561339958
2,000
1,048,576
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).
['s = int(input())\nl = [s]\ntmp = 0\nans = 0\nfor i in range(1,1000000):\n if l[-1] % 2 == 0:\n tmp = l[-1]/2\n l.append(tmp)\n if l.count(tmp) == 2:\n ans = len(l)-1\n break\n else:\n tmp = 3*l[-1]+1\n l.append(tmp)\n if l.count(tmp) == 2:\n ans = len(l)-1\n break\nprint(ans)\n\n', 's = int(input())\nl = [s]\ni = 0\ndef calc(n):\n if n % 2 == 0:\n return n // 2\n else:\n return 3 * n + 1\nwhile True:\n l.append(calc(l[i]))\n if l.count(calc(l[i])) == 2:\n break\n i += 1\n#print(l)\nprint(i+2)']
['Wrong Answer', 'Accepted']
['s742758036', 's470278460']
[3060.0, 3060.0]
[19.0, 18.0]
[301, 213]
p03146
u564906058
2,000
1,048,576
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).
['s = int(input())\na = [s]\n\nwhile len(a) - len(set(a)) != 0:\n for i in range(1000000):\n m = i+1\n if a[i] % 2 == 0:\n a.append(int(a[i]/2))\n else:\n a.append(3*a[i] + 1)\n \nprint(m)', 's = int(input())\ndef f(n):\n if n % 2 == 0:\n return int(n/2)\n else:\n return 3*n + 1\n\ndef a(i):\n if i == 1:\n return s\n else:\n return f(a(i-1))\n\nlist = []\nfor i in range(1,1000000):\n list.append(a(i))\n if len(list) != len(set(list)):\n print(i)\n break']
['Runtime Error', 'Accepted']
['s303338829', 's466353672']
[3060.0, 3060.0]
[17.0, 20.0]
[200, 307]
p03146
u565204025
2,000
1,048,576
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).
['# -*- coding: utf-8 -*-\n\nINF = 1000000\n\ns = int(input())\na = [s] * (INF + 1)\n\nanswer = 0\n\nfor i in range(INF):\n if a[i] % 2 == 0:\n a[i+1] = int(a[i] / 2)\n else:\n a[i+1] = 3 * a[i] + 1\n for j in range(0,i):\n if a[i] == a[j]:\n answer = i+1\n break\n if answer != 0:\n break\n\nprint(a)\nprint(answer)\n', '# -*- coding: utf-8 -*-\n\nINF = 1000000\n\ns = int(input())\na = [s] * (INF + 1)\n\nanswer = 0\n\nfor i in range(INF):\n if a[i] % 2 == 0:\n a[i+1] = int(a[i] / 2)\n else:\n a[i+1] = 3 * a[i] + 1\n for j in range(0,i):\n if a[i] == a[j]:\n answer = i+1\n break\n if answer != 0:\n break\n\nprint(answer)\n']
['Wrong Answer', 'Accepted']
['s537930138', 's312499189']
[25456.0, 10868.0]
[101.0, 27.0]
[355, 346]
p03146
u565380863
2,000
1,048,576
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).
['import sys\n\nsys.setrecursionlimit(200000)\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\ndef ii(t: type = int):\n return t(input())\n\n\ndef il(t: type = int):\n return list(map(t, input().split()))\n\n\ndef imi(N: int, t: type = int):\n return [ii(t) for _ in range(N)]\n\n\ndef iml(N: int, t: type = int):\n return [il(t) for _ in range(N)]\n\n\nmemo = []\n\n\ndef f(n):\n if n % 2 == 0:\n return n // 2\n else:\n return 3 * n + 1\n\n\ndef solve():\n s = ii()\n d = {}\n for i in range(1, 10000000):\n s = f(s)\n if d.get(s) is None:\n d[s] = i + 1\n else:\n return d[s]\n\n\nif __name__ == "__main__":\n print(solve())\n', 'import sys\n\nsys.setrecursionlimit(200000)\n\n\ndef input():\n return sys.stdin.readline()[:-1]\n\n\ndef ii(t: type = int):\n return t(input())\n\n\ndef il(t: type = int):\n return list(map(t, input().split()))\n\n\ndef imi(N: int, t: type = int):\n return [ii(t) for _ in range(N)]\n\n\ndef iml(N: int, t: type = int):\n return [il(t) for _ in range(N)]\n\n\ndef f(n):\n if n % 2 == 0:\n return n // 2\n else:\n return 3 * n + 1\n\n\ndef solve():\n s = ii()\n d = {s: 0}\n for i in range(1, 1000000000):\n s = f(s)\n if d.get(s) is None:\n d[s] = 0\n else:\n return i + 1\n\n\nif __name__ == "__main__":\n print(solve())\n']
['Wrong Answer', 'Accepted']
['s729597070', 's998128800']
[3064.0, 3064.0]
[17.0, 17.0]
[678, 669]
p03146
u571445182
2,000
1,048,576
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).
['N = int(input())\nFlag = 0\nnList = []\nnList.append(N)\ni = 2\nwhile Flag==0:\n Tmp = N % 2\n if Tmp == 0:\n TmpN /= 2\n else:\n TmpN = 3 * N + 1\n \n if TmpN in nList:\n Flag = 1\n break\n else:\n nList.append(TmpN)\n N = TmpN\n i += 1\n\nprint(i)\n\n\n\n', 'N = int(input())\nFlag = 0\nnList = []\nnList.append(N)\ni = 2\nwhile Flag==0:\n Tmp = N % 2\n TmpN = N\n if Tmp == 0:\n TmpN /= 2\n else:\n TmpN = 3 * N + 1\n \n if TmpN in nList:\n Flag = 1\n break\n else:\n nList.append(TmpN)\n N = TmpN\n i += 1\n\nprint(i)\n']
['Runtime Error', 'Accepted']
['s169921048', 's338986935']
[3060.0, 3060.0]
[17.0, 18.0]
[260, 268]
p03146
u572271833
2,000
1,048,576
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).
['s=int(input())\n\nline=[]\ncount=1\n\nwhile s not in line:\n line.append(s)\n count+=1\n if s%2==0:\n s=s//2\n else:\n s=3*s +1\n\nprint(s)', 's=int(input())\n\nline=[]\ncount=1\n\nwhile s not in line:\n line.append(s)\n count+=1\n if s%2==0:\n s=s//2\n else:\n s=3*s +1\n\nprint(count)\n']
['Wrong Answer', 'Accepted']
['s589567694', 's779905864']
[2940.0, 2940.0]
[17.0, 17.0]
[153, 158]
p03146
u580093517
2,000
1,048,576
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).
['a = [int(input())]\ns = a[0]\nwhile 1:\n if s%2 == 0: a.append(s//2)\n else:a.append(3*s+1)\n s = a[len(a)-1]\n print(a)\n if s in a[0:len(a)-1]:\n print("saa",a[0:len(a)-1])\n break\nprint(len(a))', 's = int(input())\nl = []\nwhile s not in l:\n l.append(s)\n if s%2 == 0:s = s/2\n else:s = 3*s+1\nprint(len(l)+1)']
['Wrong Answer', 'Accepted']
['s959828501', 's253810335']
[3064.0, 3060.0]
[19.0, 20.0]
[216, 116]
p03146
u580362735
2,000
1,048,576
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).
['s = int(input())\nf = []\ni = 0\nn = s\nwhile(i<1000000):\n if n % 2 == 0:\n f.append(n/2)\n else:\n f.append(3*n+1)\n n = f[i]\n i = i + 1\nf_ = list(dict.fromkeys(f))\nf.pop(f.index(f_[0]))\nprint(f.index(f_[0])+1)', 's = int(input())\nf = [s]\ni = 1\nn = s\nwhile(i<=1000001):\n if n % 2 == 0:\n f.append(int(n/2))\n else:\n f.append(3*n+1)\n n = f[i]\n i = i + 1\nf_ = list(dict.fromkeys(f))\nf.pop(f.index(f_[0]))\nprint(f.index(f_[0]))', 's = int(input())\nf = []\nn = s\nwhile(1):\n f.append(n)\n if n % 2 == 0:\n n = int(n/2)\n else:\n n = 3*n+1\n \n if n in f:\n break\n \nprint(len(f)+1)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s790942337', 's967932481', 's545391692']
[36760.0, 10900.0, 3064.0]
[659.0, 506.0, 18.0]
[213, 218, 157]
p03146
u580873239
2,000
1,048,576
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).
['s = int(input())\nList = [s]\nn = s\na = 0\nwhile a==0 :\n if n%2==0:\n n = n//2\n else:\n n = 3*n+1\n if n in List:\n print(len(List)+1)\n print(List)\n a += 1\n else:\n List.append(n)', 's = int(input())\nList = [s]\nn = s\na = 0\nwhile a==0 :\n if n%2==0:\n n = n//2\n else:\n n = 3*n+1\n if n in List:\n print(len(List)+1)\n a += 1\n else:\n List.append(n)']
['Wrong Answer', 'Accepted']
['s931266973', 's704297929']
[3060.0, 3060.0]
[17.0, 18.0]
[225, 205]
p03146
u587589241
2,000
1,048,576
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).
['def f(a):\n cnt=0\n st=set()\n while True:\n if n%2!=0:\n tmp=a/2\n else:\n tmp=3*a+1\n if tmp in st:\n break\n st.add(tmp)\n a=tmp\n return cnt\na=int(input()) \nans= f(s)\nprint(ans)', 'def f(a):\n cnt=0\n st=set()\n cnt+=1\n st.add(a)\n while True:\n if n%2!=0:\n tmp=a/2\n else:\n tmp=3*a+1\n if tmp in st:\n break\n st.add(tmp)\n a=tmp\n return cnt\na=int(input()) \nans= f(s)\nprint(ans)', 'def f(s):\n cnt = 0\n st = set()\n\n cnt += 1\n st.add(s)\n\n while True:\n cnt += 1\n\n if s % 2 == 0:\n tmp = s / 2\n else:\n tmp = 3 * s + 1\n\n if tmp in st:\n break\n\n st.add(tmp)\n s = tmp\n return cnt\n\n\ns = int(input())\nans = f(s)\nprint(ans)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s114135664', 's601901640', 's976976192']
[3060.0, 3060.0, 3064.0]
[18.0, 18.0, 17.0]
[253, 278, 322]
p03146
u593567568
2,000
1,048,576
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).
['from collections import defaultdict\na = int(input())\nidxs = defaultdict(int)\nidxs[a] = 1\ni = 1\nans = None\nwhile True:\n i += 1\n if a % 2 == 0:\n a //= 2\n else:\n a = 3 * a + 1\n \n if not idxs[a]:\n idxs[a] = i\n else:\n ans = i\n\nprint(ans)\n \n \n\n', 'from collections import defaultdict\na = int(input())\nidxs = defaultdict(int)\nidxs[a] = 1\ni = 1\nans = None\nwhile True:\n i += 1\n if a % 2 == 0:\n a //= 2\n else:\n a = 3 * a + 1\n \n if not idxs[a]:\n idxs[a] = i\n else:\n ans = i\n break\n\nprint(ans)\n \n \n\n']
['Time Limit Exceeded', 'Accepted']
['s561433012', 's357355811']
[3316.0, 3316.0]
[2104.0, 20.0]
[264, 274]
p03146
u596297663
2,000
1,048,576
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).
['s = int(input())\n\nar = []\nflag = 0\ncount = 0\n\nwhile flag == 0:\n\tcount = count +1\n\tif s % 2 == 0:\n\t\ts = s//2\n\telse:\n\t\ts = 3* s +1\n\tif s in ar:\n\t\tflag = 1\n\telse:\n\t\tar.append(s)\n\t\tprint(s)\n\nprint(count+1)', 's = int(input())\n\nar = []\nflag = 0\ncount = 0\n\nwhile flag == 0:\n\tcount = count +1\n\tif s % 2 == 0:\n\t\ts = s//2\n\telse:\n\t\ts = 3* s +1\n\tif s in ar:\n\t\tflag = 1\n\telse:\n\t\tar.append(s)\n#\t\tprint(s)\n\nprint(count)', 's = int(input())\n\nar = []\nar.append(s)\nflag = 0\ncount = 0\n\nwhile flag == 0:\n\tcount = count +1\n\tif s % 2 == 0:\n\t\ts = s//2\n\telse:\n\t\ts = 3* s +1\n\tif s in ar:\n\t\tflag = 1\n\telse:\n\t\tar.append(s)\n#\t\tprint(s)\n\nprint(count+1)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s049578542', 's213949546', 's604995756']
[3060.0, 3060.0, 3060.0]
[17.0, 17.0, 17.0]
[201, 200, 215]
p03146
u597374218
2,000
1,048,576
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).
['S=int(input())\nl=[0]*1000000\nl[0]=0\nl[1]=S\nfor i in range(2,1000000):\n if l[i-1]%2==0:\n l[i]=l[i-1]//2\n else:\n l[i]=3*l[i-1]+1\n print(l[i])\n for j in range(1,i-1):\n if l[i]==l[j]:\n print(i)\n exit()\n', 's=int(input())\na=[]\nwhile (s not in a):\n a.append(s)\n if s%2==0:\n s//=2\n else:\n s=3*s+1\nprint(len(a)+1)']
['Wrong Answer', 'Accepted']
['s501555968', 's338921453']
[10868.0, 9056.0]
[32.0, 25.0]
[252, 126]
p03146
u597455618
2,000
1,048,576
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).
['s = int(input())\ncnt = 0\nwhile s != 1:\n cnt += 1\n if s%2:\n s = 3*s + 1\n else:\n s//= 2\nprint(cnt)', 's = int(input())\nl = []\nwhile (s not in l):\n l.append(s)\n if s%2 == 0:\n s //= 2\n else:\n s = 3*s+1\nprint(len(l)+1)']
['Wrong Answer', 'Accepted']
['s873826810', 's109918502']
[2940.0, 2940.0]
[17.0, 18.0]
[105, 132]
p03146
u599925824
2,000
1,048,576
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).
['s = int(input())\n\ndef collatz(s):\n if s % 2 == 0:\n x = s/2\n elif s % 2 > 0:\n x = (3*int(s)) + 1\n return x\n\nresult = []\nx = 0\nc = 0\ni = 0\nwhile True:\n if s == 1:\n ans = [s]\n break\n elif i == 0:\n i += 1\n x = s\n elif c == 2:\n ans = [y for y, z in enumerate(result) if z == result[1]]\n break\n elif int(x) == 1:\n i = 1\n c += 1\n x = result[i]\n continue\n else:\n x = collatz(result[i-1])\n i += 1\n result.append(int(x))\n\nprint(result)\n', 's = int(input())\nresult = [s]\ntmp = s\nwhile True:\n if tmp == 1:\n break\n elif tmp%2 == 0:\n x = tmp/2\n else:\n x = (3*tmp) + 1\n tmp = x\n result.append(int(x))\nprint(len(result+1))', 'import collections\ns = int(input())\nresult = [s]\ntmp = s\nwhile True:\n if collections.Counter(result).most_common()[0][1] == 2:\n break\n elif tmp%2 == 0:\n x = tmp/2\n elif tmp%2 > 0:\n x = (3*tmp) + 1\n tmp = x\n result.append(int(x))\nprint(len(result))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s212075192', 's425121302', 's176909029']
[3064.0, 3316.0, 3316.0]
[18.0, 21.0, 23.0]
[477, 190, 261]
p03146
u600261652
2,000
1,048,576
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).
['def resolve():\n s = int(input())\n ans = [s]\n count = 0\n while True:\n if ans[count]%2 == 0:\n ans.append(ans[count]//2)\n else:\n ans.append(ans[count]*3+1)\n count += 1\n for i in range(count):\n if ans[i] == ans[count]:\n print(k+1)\n exit()\nresolve()', 'def resolve():\n s = int(input())\n ans = [s]\n count = 0\n while True:\n if ans[count]%2 == 0:\n ans.append(ans[count]/2)\n else:\n ans.append(ans[count]*3+1)\n count += 1\n if ans[count] < 1:\n ans[count] = ans[count-1]\n if ans[count] == 4:\n print(count+3)\n exit()\nresolve()', 'def resolve():\n s = int(input())\n ans = [s]\n count = 0\n while s != 4:\n if ans[count]%2 == 0:\n ans.append(ans[count]/2)\n else:\n ans.append(ans[count]+3)\n count += 1\n if ans[count] < 1:\n ans[count] = ans[count-1]\n print(count+4)\nresolve()', 'def resolve():\n s = int(input())\n ans = [s]\n count = 0\n while True:\n if ans[count]%2 == 0:\n ans.append(ans[count]/2)\n else:\n ans.append(ans[count]*3+1)\n count += 1\n for i in range(count):\n if ans[i] == ans[count]:\n print(k+1)\n exit()\nresolve()', 'def resolve():\n s = int(input())\n ans = [s]\n count = 0\n while True:\n if ans[count]%2 == 0:\n ans.append(ans[count]//2)\n else:\n ans.append(ans[count]*3+1)\n count += 1\n for i in range(count):\n if ans[i] == ans[count]:\n print(count+1)\n exit()\nresolve()']
['Runtime Error', 'Wrong Answer', 'Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s118934192', 's247322394', 's530438957', 's965478171', 's395446304']
[3060.0, 3064.0, 130836.0, 3060.0, 3060.0]
[18.0, 17.0, 2112.0, 18.0, 18.0]
[347, 367, 312, 346, 351]
p03146
u600717568
2,000
1,048,576
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).
['s=int(input())\nList=[]\nwhile s not in List:\n List.append(s)\n if s%2==0:\n s=s/2\n else:\n s=3*s+1\nprint(len(List))', 's=int(input())\nList=[]\nwhile s not in List:\n List.append(s)\n if s%2==0:\n s=s/2\n else:\n s=3*s+1\nprint(len(List)+1)\n']
['Wrong Answer', 'Accepted']
['s531908570', 's878139120']
[2940.0, 2940.0]
[17.0, 17.0]
[120, 123]
p03146
u600935366
2,000
1,048,576
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).
[' s = int(input())\na = [s]\n\nfor i in range(1, 1000000):\n if a[i-1]%2 == 0:\n tmp = (a[i-1]//2)\n else:\n tmp = (3*a[i-1] + 1)\n \n if a.count(tmp):\n ans = i+1\n break\n else:\n a.append(tmp)\n \nprint(ans)', 's = int(input())\na = [s]\n\nfor i in range(1, 1000000):\n if a[i-1]%2 == 0:\n tmp = (a[i-1]//2)\n else:\n tmp = (3*a[i-1] + 1)\n \n if a.count(tmp):\n ans = i+1\n break\n else:\n a.append(tmp)\n \nprint(ans)']
['Runtime Error', 'Accepted']
['s922406126', 's601284904']
[2940.0, 3060.0]
[17.0, 18.0]
[251, 250]
p03146
u604341914
2,000
1,048,576
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).
['def func(long n):\n if n % 2 == 0:\n return n / 2\n else:\n return 3*n + 1\n\ns = int(input())\n\ndata = set(s)\n\nfor i in range(1000010):\n l = len(data)\n val = func(s)\n data.add(val)\n if l == len(data):\n print(i+2)\n break\n s = val\n', 'def func(long n):\n if n % 2 == 0:\n return n / 2\n else:\n return 3*n + 1\n\ns = int(input())\n\ndata = set()\ndata.add(s)\nfor i in range(1000010):\n l = len(data)\n val = func(s)\n data.add(val)\n if l == len(data):\n print(i+2)\n break\n s = val\n', 'def func(n):\n if n % 2 == 0:\n return n / 2\n else:\n return 3*n + 1\n\ns = int(input())\ndata = set()\ndata.add(s)\nfor i in range(1000010):\n l = len(data)\n val = func(s)\n data.add(val)\n if l == len(data):\n print(i+2)\n break\n s = val\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s233943064', 's881142562', 's195922156']
[2940.0, 2940.0, 3060.0]
[17.0, 17.0, 18.0]
[272, 282, 276]
p03146
u613401788
2,000
1,048,576
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).
['import sys\n\ns = int(sys.stdin.readline().strip())\na = s\na_all = []\na_all.append(a)\n\ndef fnc_odd(n):\n return 3*n+1\n \ndef fnc_even(n):\n return int(n/2)\n \ni = 2\n\nwhile (i<120):\n if(a%2==0):\n a = fnc_even(a)\n a_all.append(a)\n else:\n a = fnc_odd(a)\n print("now i,a:",i,a)\n a_all.append(a)\n if(i>3 and a_all[(i-3)-1]==a):\n break\n i += 1\n \nprint(i)', 'import sys\n\ns = int(sys.stdin.readline().strip())\na = s\na_all = []\na_all.append(a)\n\ndef fnc_odd(n):\n return 3*n+1\n \ndef fnc_even(n):\n return int(n/2)\n \ni = 2\n\nwhile (i<120):\n if(a%2==0):\n a = fnc_even(a)\n a_all.append(a)\n else:\n a = fnc_odd(a)\n a_all.append(a)\n if(i>3 and a_all[(i-3)-1]==a):\n break\n i += 1\n \nprint(i)']
['Wrong Answer', 'Accepted']
['s380350798', 's933155455']
[3316.0, 3064.0]
[21.0, 18.0]
[414, 384]
p03146
u614181788
2,000
1,048,576
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).
['s = int(input())\ncount = 0\nwhile(True):\n if s%2 == 0:\n s = int(s/2)\n else:\n s = 3*s +1\n count += 1\n if s == 1 or 2 or 4:\n print(count+2)\n break\n else:\n pass', 's = int(input())\ncount = 0\nwhile(True):\n if s%2 == 0:\n s = int(s/2)\n else:\n s = 3*s +1\n count += 1\n if s == 1 or s == 2 or s == 4:\n print(count+2)\n break\n else:\n pass', 's = int(input())\ncount = 0\nif s == 1 or s == 2 or s == 4:\n print(4)\nelse:\n while(True):\n if s%2 == 0:\n s = int(s/2)\n else:\n s = 3*s +1\n count += 1\n if s == 4:\n print(count+4)\n break\n else:\n pass']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s147846544', 's786785876', 's893264824']
[2940.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0]
[206, 216, 290]
p03146
u617203831
2,000
1,048,576
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).
['S=int(input())\nl=[]\nwhile(S not in l):\n l.append(S)\n if S%2==0:S//=2\n else:S=3*S+1\nprint(len(s)+1)', 'S=int(input())\nl=[]\nwhile(S not in l):\n l.append(S)\n if S%2==0:S/=2\n else:S=3*S+1\nprint(len(l)+1)']
['Runtime Error', 'Accepted']
['s232608697', 's363070108']
[2940.0, 2940.0]
[17.0, 17.0]
[107, 106]
p03146
u619458041
2,000
1,048,576
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).
['s = int(input())\narray = [s]\n \nm = 2\nwhile m < 100000:\n if (s % 2 == 0):\n s = s / 2\n else:\n s = 3 * s + 1\n \n if s in array:\n print(m)\n break\n else:\n array.append(m)\n m += 1', 's = int(input())\narray = [s]\n\nm = 1\nwhile m < 100000:\n if (s % 2 == 0):\n s = s / 2\n else:\n s = 3 * s + 1\n \n if s in array:\n print(m)\n break\n else:\n array.append(m)\n m += 1', 's = int(input())\narray = [s]\n \nm = 2\nwhile m < 100000:\n if (s % 2 == 0):\n s = s / 2\n else:\n s = 3 * s + 1\n \n if s in array:\n print(m)\n break\n else:\n array.append(s)\n m += 1']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s835596747', 's904390862', 's037091203']
[2940.0, 3060.0, 2940.0]
[18.0, 18.0, 18.0]
[195, 194, 195]
p03146
u619785253
2,000
1,048,576
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).
['s = int(input())\ns_ = s\nx = []\ncounter = 0\n\n\nfor _ in range(1000000):\n if s%2 ==0:\n s = s/2\n x.append(s)\n else:\n s = 3*s+1\n x.append(s)\n# counter +=1\n\nif s_ == 4 or s_ == 2 or s_ == 1:\n print(4)\nelse:\n print(x.index(4)+3)\n#print(x) ', 's = int(input())\ns_ = s\ncounter = 0\n\nif s == 4 or s == 2 or s ==1:\n print(counter+4)\nelse: \n while s!=4:\n if s%2 ==0:\n s = s//2\n counter +=1\n else:\n s = 3*s+1\n counter +=1\n else:\n print(counter+4)\n \n']
['Wrong Answer', 'Accepted']
['s579891221', 's588873648']
[34712.0, 2940.0]
[489.0, 20.0]
[268, 235]
p03146
u620846115
2,000
1,048,576
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).
['s=int(input())\nG =[s]\nwhile all(G[i]!=G[-1] for i in range(len(G)-1)):\n if G[-1] % 2==0:\n G.append(int(x/2))\n else:\n G.append(int(3*x+1))\nprint(len(G))', 's=int(input())\nG =[s]\nwhile all(G[i]!=G[-1] for i in range(len(G))):\n if G[-1] % 2==0:\n G.append(int(x/2))\n else:\n G.append(int(3*x+1))\nprint(len(G)+1)', 's=int(input())\nG =[]\nwhile (s not in G):\n G.append(s)\n if s % 2==0:\n s == int(s//2)\n else:\n s == int(3*s+1)\nprint(len(G)+1)', 's=int(input())\nG =[s]\nwhile all(G[i]!=G[-1] for i in range(len(G))):\n if G[-1] % 2==0:\n G.append(int(x/2))\n else:\n G.append(int(3*x+1))\nprint(len(G))', 's=int(input())\nG =[s]\nwhile all(G[i]!=G[-1] for i in range(len(G))):\n if G[-1] % 2==0:\n s == int(s/2)\n G.append(s)\n else:\n s == int(3*s+1)\n G.append(s)\nprint(len(G))', 's=int(input())\nG =[]\nwhile all(i!=s for i in G):\n G.append(s)\n if s % 2==0:\n s == int(s/2)\n else:\n s == int(3*s+1)\nprint(len(G)+1)', 's=int(input())\nG =[]\nwhile (s not in G):\n G.append(s)\n if s % 2==0:\n s = int(s//2)\n else:\n s = int(3*s+1)\nprint(len(G)+1)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s150170870', 's380694945', 's382870414', 's647694069', 's892998607', 's952841372', 's156510957']
[9136.0, 9168.0, 9148.0, 9124.0, 9184.0, 9064.0, 9144.0]
[27.0, 25.0, 25.0, 30.0, 28.0, 30.0, 32.0]
[159, 159, 132, 157, 179, 139, 130]
p03146
u623687794
2,000
1,048,576
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).
['s = int(input())\nn = 0\nif s==1 or s == 2:\n print("4")\nelif s==3:\n print("9")\nif s >=4:\n while s % 2 == 0:\n s = s/2\n n += 1\n if s!=1 and s%2 == 1:\n s = 3*s+1\n n+=1\n if s == 1:\n print(n+2)\n break\n\n', 's = int(input())\nn = 0\nif s==1 or s == 2:\n print("4")\nelif s==3:\n print("9")\nif s >=4:\n s = 2*s\n while s % 2 == 0:\n s = s/2\n n += 1\n if s!=1 and s%2 == 1:\n s = 3*s+1\n n+=1\n if s == 1:\n print(n+1)\n break\n\n']
['Runtime Error', 'Accepted']
['s921270411', 's655430551']
[2940.0, 3188.0]
[17.0, 18.0]
[214, 240]
p03146
u626337957
2,000
1,048,576
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).
['S = int(input())\n\nA = [S]\nidx = 0\nwhile True\n if A[idx] % 2 == 0:\n A.append(idx//2)\n else:\n A.append(idx*3+1)\n if A[idx+1] in A[:idx+1]:\n print(idx+1)\n break\n idx += 1\n ', 'S = int(input())\n\nA = [S]\nidx = 0\nwhile True\n if A[idx] % 2 == 0:\n A.append(A[idx]//2)\n else:\n A.append(A[idx]*3+1)\n if A[idx+1] in A[:idx+1]:\n print(idx+1)\n break\n idx += 1\n', 'S = int(input())\n\nA = [S]\nidx = 0\nwhile True:\n if A[idx] % 2 == 0:\n A.append(A[idx]//2)\n else:\n A.append(A[idx]*3+1)\n if A[idx+1] in A[:idx+1]:\n print(idx+2)\n break\n idx += 1\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s386092836', 's825492480', 's831887314']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[190, 190, 191]
p03146
u635182517
2,000
1,048,576
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).
['def f(a):\n if a % 2 == 0:\n return a // 2\n elif a % 2 == 1:\n return 3 * a + 1\n\ns = int(input())\na = [s]\ndone = False\nwhile not done:\n for i in range(len(a)):\n if a[i] != f(a[-1]):\n a.append(f(a[-1]))\n\n else:\n print(i)\n done = True\n break\n', 'def f(a):\n if a // 2 == 0:\n return a // 2\n if a // 2 == 1:\n return 3 * a + 1\n\ns = int(input())\na = [s]\ndone = False\nwhile not done:\n for i in range(len(a)):\n if a[i] != f(a[-1]):\n a.append(f(a[-1]))\n\n else:\n print(i)\n done = True\n break\n', 'def f(n):\n if n % 2 == 0:\n return n // 2\n elif n % 2 == 1:\n return 3 * n + 1\n\n\ns = int(input())\na = [s]\ndone = False\nwhile not done:\n if f(a[-1]) in a:\n print(len(a) + 1)\n done = True\n break\n else:\n a.append(f(a[-1]))\n \n']
['Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s189437072', 's732820877', 's111844709']
[32532.0, 3056.0, 2940.0]
[2109.0, 17.0, 17.0]
[318, 318, 281]
p03146
u636162168
2,000
1,048,576
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).
['s=int(input())\na=[s]\ni=0\nwhile True: \n i+=1\n if s%2==0:\n s=s//2\n else:\n s=3*s+1\n if s in a:\n print(i)\n break\n else:\n a.append(s)\n', 's=int(input())\na=[]\ni=0\nwhile True: \n i+=1\n if s in a:\n print(i)\n break\n else:\n a.append(s)\n if s%2==0:\n s=s//2\n else:\n s=3*s+1\n']
['Wrong Answer', 'Accepted']
['s449362442', 's491159521']
[2940.0, 2940.0]
[18.0, 18.0]
[179, 178]
p03146
u637593381
2,000
1,048,576
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).
['s = int(input())\nlis = [s]\n\nwhile len(lis) == len(set(lis)):\n if s % 2 == 0:\n lis.append(s / 2)\n else:\n lis.append(3 * s + 1)\n \nprint(len(lis))', 's = int(input())\nlis = [s]\n \nwhile len(lis) == len(set(lis)):\n if lis[-1] % 2 == 0:\n lis.append(lis[-1] / 2)\n else:\n lis.append(3 * lis[-1] + 1)\n \nprint(len(lis))']
['Wrong Answer', 'Accepted']
['s584499416', 's648196247']
[2940.0, 3064.0]
[17.0, 17.0]
[154, 173]
p03146
u657913472
2,000
1,048,576
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).
['s=int(input())\ni=4\nwhile s>4or3==s:s=[s//2,s*3+1][s%2];i+=1\nprint(i)', 's=int(input())\ni=4\nwhile s>4or 3==s:s=[s//2,s*3+1][s%2];i+=1\nprint(i)']
['Runtime Error', 'Accepted']
['s031352665', 's716059608']
[2940.0, 2940.0]
[18.0, 18.0]
[68, 69]
p03146
u661576386
2,000
1,048,576
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).
['s = int(input)\n\nA = []\n\nA.append(s)\na = s\nfor i in range(10000):\n if a % 2 == 0:\n a = int(a/2)\n A.append(a)\n else:\n a = 3*a+1\n A.append(a)\n if A.count(a) == 2:\n print(len(A))\n break\n', 's = int(input)\n\nA = []\n\nA.append(s)\na = s\nfor i in range(10000):\n if a % 2 == 0:\n a = int(a/2)\n A.append(a)\n else:\n a = 3*a+1\n A.append(a)\n if A.count(a) == 2:\n print(a)\n break\n', 's = int(input())\nA = []\n\nA.append(s)\na = s\nfor i in range(10000):\n if a % 2 == 0:\n a = int(a/2)\n A.append(a)\n else:\n a = 3*a+1\n A.append(a)\n if A.count(a) == 2:\n print(len(A))\n break\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s636709484', 's831988102', 's521039059']
[2940.0, 2940.0, 2940.0]
[18.0, 18.0, 18.0]
[233, 228, 234]
p03146
u663014688
2,000
1,048,576
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).
['s = int(input())\nl = [s]\nans = 0\nnext = 0\n\nfor i in range(1000000):\n if len(l) != len(set(l)):\n ans = l[i]\n break\n\n if l[i] % 2 == 0:\n next = s//2\n l.append(next)\n else:\n next = 3 * s + 1\n l.append(next)\n\nprint(ans)', 's = int(input())\nl = [s]\nans = 0\nnext = 0\n\nfor i in range(1000000):\n if len(l) != len(set(l)):\n ans = len(l)\n break\n\n if l[i] % 2 == 0:\n next = l[i]//2\n l.append(next)\n else:\n next = 3 * l[i] + 1\n l.append(next)\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s244562696', 's533922706']
[3060.0, 3060.0]
[17.0, 17.0]
[266, 275]
p03146
u665038048
2,000
1,048,576
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).
['s = int(input())\ns_list = []\nif s != 1 or s != 2:\n while s != 1:\n if s % 2 == 0:\n s = s / 2\n else:\n s = 3 * s + 1\n s_list.append(s)\n print(max(len(s_list)+2), 4)\nelse:\n print(4)', 's = int(input())\ns_list = []\nif s != 1 or s != 2:\n while s != 1:\n if s % 2 == 0:\n s = s / 2\n else:\n s = 3 * s + 1\n s_list.append(s)\n print(max(len(s_list)+2, 4))\nelse:\n print(4)']
['Runtime Error', 'Accepted']
['s130149624', 's173387492']
[2940.0, 3060.0]
[17.0, 17.0]
[229, 229]
p03146
u672316981
2,000
1,048,576
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).
['s = int(input())\nlst = [s]\n\nfor i in range(1,1000001):\n\n if lst[i-1]%2 == 0:\n lst.append(lst[i-1]//2)\n\n for j in range(i):\n if lst[i]==lst[j]:\n break\n\n print(i+1)\n\n else:\n lst.append(lst[i-1])\n\n for j in range(i):\n if lst[i]==lst[j]:\n break\n\n print(i+1)', 's = int(input())\nlst = [s]\n\nfor i in range(1,1000001):\n\n if lst[i-1]%2 == 0:\n lst.append(lst[i-1]//2)\n else:\n lst.append(lst[i-1]*3+1)\n\n if lst.count(lst[i])==2:\n break\n\nprint(i+1)']
['Wrong Answer', 'Accepted']
['s608844295', 's548271409']
[17812.0, 3060.0]
[2104.0, 17.0]
[353, 210]
p03146
u685662874
2,000
1,048,576
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).
['s=int(input())\nan=[0]*1000000\ntmp=[False]*300\nan[0] = s\nfor i in range(1, 1000000):\n if an[i-1] % 2 == 0:\n an[i] = an[i-1]/2\n else:\n an[i] = 3*an[i-1] + 1\n if not tmp[an[i]]:\n tmp[an[i]] = True\n else:\n print(i)\n exit()\n ', 's = int(input())\ndef f(x):\n if x % 2 == 0:\n return x/2\n else:\n return 3 * x + 1\n\nX = [s]\nm = 1\nnext = s\n\nwhile True:\n m += 1\n next = f(next)\n if next in X:\n break\n else:\n X.append(next)\n \nprint(m)\n']
['Runtime Error', 'Accepted']
['s942361511', 's474401485']
[10868.0, 2940.0]
[28.0, 18.0]
[274, 218]
p03146
u688713387
2,000
1,048,576
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).
['s = int(input())\n\ndef f(i):\n if i % 2 == 0:\n v = i // 2\n else:\n v = 3 * i + 1\n return v\n\nif s in (1, 2):\n print(4)\nelse:\n ai = s\n cnt = 1\n while ai != 4:\n print(ai)\n ai = f(ai)\n cnt += 1\n\n print(cnt + 3)\n\n', 's = int(input())\n\ndef f(i):\n if i % 2 == 0:\n v = i // 2\n else:\n v = 3 * i + 1\n return v\n\nif s in (1, 2):\n res = 4\nelse:\n ai = s\n cnt = 1\n while ai != 4:\n ai = f(ai)\n cnt += 1\n\n res = cnt + 3\n\nprint(res)\n\n']
['Wrong Answer', 'Accepted']
['s428970587', 's924611051']
[3060.0, 2940.0]
[18.0, 18.0]
[264, 256]
p03146
u691018832
2,000
1,048,576
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).
['def f(n):\n if n%2 ==0:\n return n/2\n else:\n return 3*n+1\n\ns = int(input())\na = [0] * 1\na[0] = s\nans = 0\n\nfor i in a:\n b = f(i)\n ans += 1\n if b in a:\n break\n a.append(b)\nprint(ans)', 'def f(n):\n if n%2 ==0:\n return n/2\n else:\n return 3*n+1\n\ns = int(input())\na = [0] * 1\na[0] = s\nans = 1\n\nfor i in a:\n b = f(i)\n ans += 1\n if b in a:\n break\n a.append(b)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s273083619', 's190857709']
[3064.0, 3064.0]
[17.0, 18.0]
[217, 217]
p03146
u693933222
2,000
1,048,576
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).
['s = int(input())\nl = [s]\nchk = 0\nfor i in range(10**6):\n\tif(s % 2 == 0):\n\t\ts = s/2\n\telse:\n\t\ts = 3*s+1\n\ts = int(s)\n\tprint("{}, {}".format(l,s))\n\tfor j in range(0,len(l)):\n\t\tif(l[j] == s):\n\t\t\tchk = 1\n\t\t\tbreak\n\tif(chk == 1):\n\t\tbreak\n\tl.append(s)\nprint(i+2)', 's = int(input())\nl = [s]\nchk = 0\nfor i in range(10**6):\n\tif(s % 2 == 0):\n\t\ts = s/2\n\telse:\n\t\ts = 3*s+1\n\ts = int(s)\n\tfor j in range(0,len(l)):\n\t\tif(l[j] == s):\n\t\t\tchk = 1\n\t\t\tbreak\n\tif(chk == 1):\n\t\tbreak\n\tl.append(s)\nprint(i+2)']
['Wrong Answer', 'Accepted']
['s927094854', 's157862775']
[3064.0, 3064.0]
[19.0, 19.0]
[253, 224]
p03146
u697658632
2,000
1,048,576
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).
['s = int(input())\na = [0 for i in range(1000001)]\na[s] = 1\nai = s\ni = 2\nwhile True:\n if ai % 2 == 0:\n ai /= 2\n else:\n ai = 3 * ai + 1\n if a[ai] > 0:\n print(i)\n break\n else:\n a[ai] = 1\n i += 1\n', 's = int(input())\na = {s}\nai = s\ni = 2\nwhile True:\n if ai % 2 == 0:\n ai /= 2\n else:\n ai = 3 * ai + 1\n if ai in a:\n print(i)\n break\n else:\n i += 1\n', 's = int(input())\na = [0 for i in range(1000001)]\na[s] = 1\nai = s\ni = 2\nwhile True:\n if ai % 2 == 0:\n ai //= 2\n else:\n ai = 3 * ai + 1\n if a[ai] > 0:\n print(i)\n break\n else:\n a[ai] = 1\n i += 1\n']
['Runtime Error', 'Time Limit Exceeded', 'Accepted']
['s455373073', 's535895175', 's942040349']
[10952.0, 2940.0, 10952.0]
[60.0, 2103.0, 60.0]
[213, 164, 214]
p03146
u703890795
2,000
1,048,576
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).
['N = int(input())\nC = 0\nwhile(True):\n if N%2 == 0:\n N /= 2\n else:\n N == 3*N + 1\n C += 1\n if N == 1:\n break\nprint(C+3)', 's = int(input())\n\n\ndef f(N):\n if N%2==0:\n return N//2\n return 3*N+1\n\nN = s\nif N == 1 or N == 2 or N == 4:\n print(4)\nelse:\n for i in range(1000000):\n N = f(N)\n print(N)\n if N == 4:\n print(i+5)\n break', 's = int(input())\n\n\ndef f(N):\n if N%2==0:\n return N//2\n return 3*N+1\n\nN = s\nif N == 1 or N == 2 or N == 4:\n print(4)\nelse:\n for i in range(1000000):\n N = f(N)\n if N == 4:\n print(i+5)\n break']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s191782901', 's778616885', 's136485984']
[2940.0, 3060.0, 2940.0]
[2104.0, 17.0, 17.0]
[129, 238, 223]
p03146
u705621008
2,000
1,048,576
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).
['s = int(input())\na = []\n\nwhile s not in a:\n print("xxx")\n a.append(s)\n if s % 2 == 0:\n s = s / 2\n else:\n s = s * 3 + 1\n\nprint(len(a) + 1)\n', 's = int(input())\na = []\n\nwhile s not in a:\n a.append(s)\n if s % 2 == 0:\n s = s / 2\n else:\n s = s * 3 + 1\n\nprint(len(a) + 1)\n']
['Wrong Answer', 'Accepted']
['s711654284', 's707948684']
[3060.0, 2940.0]
[17.0, 17.0]
[164, 147]
p03146
u708615801
2,000
1,048,576
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).
['\ns = int(input())\ntemp = []\ntemp.append(s)\nformer = s\nidx = 1\n\nwhile True:\n idx += 1\n if former % 2 == 0:\n later = former / 2\n else:\n later = former * 3 + 1\n\n if later in temp:\n print(idx)\n break\n', '\ns = int(input())\ntemp = []\ntemp.append(s)\nformer = s\nidx = 1\n\nwhile True:\n idx += 1\n later = former / 2 if former % 2 == 0 else former * 3 + 1\n\n if later in temp:\n print(idx)\n break\n temp.append(later)\n former = later\n']
['Time Limit Exceeded', 'Accepted']
['s516370317', 's135736705']
[2940.0, 3064.0]
[2104.0, 17.0]
[236, 248]
p03146
u709746636
2,000
1,048,576
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).
['n = input()\nans = 1\nwhile (n != 4 and n != 2 and n != 1):\n ans += 1\n if n % 2 == 0:\n n = n / 2\n else:\n n = 3 * n + 1\n\nprint(ans + 3)', 'n = int(input())\nans = 1\nwhile (n != 4 and n != 2 and n != 1):\n ans += 1\n if n%2 == 0:\n n = n / 2\n else:\n n = 3 * n + 1\n\nprint(ans + 3)']
['Runtime Error', 'Accepted']
['s388842437', 's778914296']
[2940.0, 3060.0]
[17.0, 17.0]
[141, 144]
p03146
u717993780
2,000
1,048,576
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).
['s = int(input())\n\nif s == 1 or 2 or 4:\n print(4)\nelse: \n cnt = 1\n while True:\n if s % 2 == 0:\n s = int(s/2)\n else:\n s = 3*s + 1\n if s == 4:\n break\n else:\n cnt += 1\n print(cnt+4)', 's = int(input())\n \nif s == 1 or s == 2 or s == 4:\n print(4)\nelse: \n cnt = 1\n while True:\n if s % 2 == 0:\n s = int(s/2)\n else:\n s = 3*s + 1\n if s == 4:\n break\n else:\n cnt += 1\n print(cnt+4)']
['Wrong Answer', 'Accepted']
['s837969993', 's556181201']
[3316.0, 3316.0]
[20.0, 21.0]
[215, 226]
p03146
u720483676
2,000
1,048,576
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).
['a=[int(input())]\ni=0\nwhile True:\n i+=1\n if a[-1]%2==1:\n if a[-1]*3+1 in a:\n break\n a.append(a[-1]*3+1)\n else:\n if a[-1]/2 in a:\n break\n a.append(a[-1]/2)\nprint(i)', 'a=[int(input())]\ni=1\nwhile True:\n i+=1\n if a[-1]%2==1:\n if a[-1]*3+1 in a:\n break\n a.append(a[-1]*3+1)\n else:\n if a[-1]/2 in a:\n break\n a.append(a[-1]/2)\nprint(i)']
['Wrong Answer', 'Accepted']
['s032033196', 's918752478']
[2940.0, 3060.0]
[20.0, 18.0]
[187, 187]
p03146
u722189950
2,000
1,048,576
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).
['s = int(input())\na = [s]\nans = -1\nfor i in range(1000000):\n if ans != -1:\n if a[-1] % 2 == 0:\n a.append(a[-1]/2)\n else:\n a.append(3*a[-1]+1) \n\n for j in range(len(a)-1):\n if a[-1] == a[j]:\n ans = len(a)\n break\n else:\n print(ans)\n break', 's = int(input())\na = [s]\nans = -1\nfor i in range(1000000):\n if ans == -1:\n if a[-1] % 2 == 0:\n a.append(a[-1]/2)\n else:\n a.append(3*a[-1]+1) \n\n for j in range(len(a)-1):\n if a[-1] == a[j]:\n ans = len(a)\n break\n else:\n print(ans)\n break']
['Wrong Answer', 'Accepted']
['s077440238', 's415156622']
[3060.0, 3060.0]
[17.0, 20.0]
[342, 342]
p03146
u730318873
2,000
1,048,576
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).
['s = int(input())\nx = 0\nif s ==1 or s == 1:\n print(4)\n exit()\n\n \nwhile not s == 4:\n if s % 2 == 0:\n s = 3 * s + 1\n x = x + 1\n \n else:\n s = s // 2\n x = x + 1\n \nprint(x + 3)', 's = int(input())\nx = 0\n \nif s == 1 or s == 2:\n print(4)\nelse:\n while not s == 4:\n if s % 2 == 0:\n s = 3 * s + 1\n x = x + 1\n \n else:\n s = s // 2\n x = x + 1\nprint(x + 3)', 's = int(input())\nx = 1\nif s == 1 or s == 2 or s == 4:\n print(4)\nelse:\n while not s == 4:\n if s % 2 != 0:\n s = 3 * s + 1\n x = x + 1\n \n else:\n s = s // 2\n x = x + 1\n \nif x != 1:\n print(x + 3)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s003087774', 's820377023', 's309707595']
[2940.0, 2940.0, 2940.0]
[2104.0, 2104.0, 18.0]
[227, 245, 277]
p03146
u733774002
2,000
1,048,576
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).
['s = int(input())\nan = []\nan.append(s)\nn = s\nwhile an.count(1 or 2 or 4) != 2:\n if n % 2 == 0:\n n /= 2\n an.append(int(n))\n else:\n n = 3 * n + 1\n an.append(int(n))\nprint(an.index(1 or 2 or 4) + 4)\n', 's = int(input())\nan = []\nan.append(s)\nn = s\nif an.index(1 or 2) == 0:\n print(4)\nwhile an.count(4) != 2:\n if n % 2 == 0:\n n /= 2\n an.append(int(n))\n else:\n n = 3 * n + 1\n an.append(int(n))\nprint(an.index(4) + 4)\n', 's = int(input())\nan = []\nan.append(s)\nn = s\nwhile an.count(4) != 2:\n if n % 2 == 0:\n n /= 2\n an.append(int(n))\n else:\n n = 3 * n + 1\n an.append(int(n))\nif an.index(1) or an.index(2) == 0:\n print(4)\nelse:\n print(an.index(4) + 4)\n', 's = int(input())\nan = []\nan.append(s)\nn = s\nwhile an.count(4) != 2:\n if n % 2 == 0:\n n /= 2\n an.append(int(n))\n else:\n n = 3 * n + 1\n an.append(int(n))\nif an.index(1) == 0 or an.index(2) == 0:\n print(4)\nelse:\n print(an.index(4) + 4)\n']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s563392944', 's842061170', 's860482318', 's088013166']
[2940.0, 3060.0, 3060.0, 3060.0]
[18.0, 18.0, 18.0, 18.0]
[229, 248, 268, 273]
p03146
u735008991
2,000
1,048,576
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).
['s = int(input())\nrec = set()\n\n\ndef f(x):\n if x % 2 == 0:\n return x//2\n else:\n return 3*x + 1\n\n\nc = 0\nwhile True:\n if s in rec:\n print(c)\n exit()\n rec.add(s)\n s = f(s)\n c += 1\n', 's = int(input())\nrec = {}\n\n\ndef f(x):\n if x % 2 == 0:\n return x//2\n else:\n return 3*x + 1\n\n\nc = 0\nwhile True:\n if s in rec:\n print(c)\n exit()\n rec.add(s)\n s = f(s)\n c += 1\n', 's = int(input())\nrec = set()\n\n\ndef f(x):\n if x % 2 == 0:\n return x//2\n else:\n return 3*x + 1\n\n\nc = 1\nwhile True:\n if s in rec:\n print(c)\n exit()\n rec.add(s)\n s = f(s)\n c += 1\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s151101910', 's567563070', 's081640016']
[2940.0, 2940.0, 2940.0]
[18.0, 17.0, 18.0]
[221, 218, 221]
p03146
u738898077
2,000
1,048,576
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).
['a = int(input())\nals = [0]*(100000)\nfor i in range(0,10**6+2):\n als[a] = 1\n if a%2 == 0:\n a = a//2\n else:\n a = 3*a+1\n if als[a] == 1:\n print(i+2)\n exit()\n print(a)', 'a = int(input())\nals = [0]*(30000)\nfor i in range(0,10**6+2):\n als[a] = 1\n if a%2 == 0:\n a = a//2\n else:\n a = 3*a+1\n if als[a] == 1:\n print(i+2)\n exit()']
['Wrong Answer', 'Accepted']
['s506854529', 's031701080']
[3828.0, 3188.0]
[19.0, 18.0]
[206, 192]
p03146
u740767776
2,000
1,048,576
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).
['s = int(input())\narray = []\ncnt = 1\narray.append(s)\nwhile True:\n s = cal(s)\n array.append(s)\n if array[cnt] in array[:cnt]:\n print(cnt +1)\n break\n cnt += 1', 'def cal(s):\n if s % 2 == 0:\n return int(s/2)\n else:\n return s * 3 + 1\n\n\ns = int(input())\narray = []\ncnt = 1\narray.append(s)\nwhile True:\n s = cal(s)\n array.append(s)\n if array[cnt] in array[:cnt]:\n print(cnt +1)\n break\n cnt += 1\n']
['Runtime Error', 'Accepted']
['s933021311', 's789577267']
[2940.0, 3060.0]
[17.0, 18.0]
[181, 274]
p03146
u742899538
2,000
1,048,576
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).
['s = int(input())\na_i = s\nv = set()\nfor i in range(2, 1000000):\n if (i - 1) % 2 == 0:\n a_i = int((a_i - 1) // 2)\n else:\n a_i = (a_i - 1) * 3 + 1\n if a_i in v:\n print(i)\n v.add(a_i)', 's = int(input())\na_i = s\nv = set([a_i])\nfor i in range(2, 1000000):\n if a_i % 2 == 0:\n a_i = int(a_i // 2)\n else:\n a_i = a_i * 3 + 1\n if a_i in v:\n print(i)\n break\n v.add(a_i)\n # print(f"i:{i} a_i:{a_i}", file=sys.stderr)']
['Wrong Answer', 'Accepted']
['s808267808', 's879766189']
[582620.0, 3060.0]
[2139.0, 17.0]
[212, 264]
p03146
u746419473
2,000
1,048,576
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).
['def func(a: int) -> int:\n return int(a/2) if a%2 == 0 else 3*a + 1\n\na = int(input())\nif a == 1:\n print(2)\n quit()\n\ni = 0\nwhile a >= 4:\n print(a)\n a = func(a)\n i += 1\n\nprint(i+3)\n', 's = int(input())\n\nsequence = [s]\nans = 1\nwhile True:\n if s%2 == 0:\n s //= 2\n else:\n s = 3*s+1\n\n ans += 1\n\n if s in sequence:\n break\n\n sequence.append(s)\n\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s560686404', 's188156601']
[3060.0, 3064.0]
[17.0, 17.0]
[196, 201]
p03146
u755180064
2,000
1,048,576
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).
['def calc(n):\n if n % 2 == 0:\n return n // 2\n else:\n return 3 * n + 1\n\n\ndef main():\n s = int(input())\n ans = [s]\n while True:\n tmp = calc(ans[-1])\n ans.append(tmp)\n if ans.index(tmp) != len(ans)-1:\n print(len(ans))\n break', '\nurl = "https://atcoder.jp//contests/abc116/tasks/abc116_b"\n\ndef calc(n):\n if n % 2 == 0:\n return n // 2\n else:\n return 3 * n + 1\n\n\ndef main():\n s = int(input())\n ans = [s]\n while True:\n tmp = calc(ans[-1])\n ans.append(tmp)\n if ans.index(tmp) != len(ans)-1:\n print(len(ans))\n break\n\n\n\nif __name__ == \'__main__\':\n main()\n']
['Wrong Answer', 'Accepted']
['s960321666', 's875781495']
[8956.0, 9160.0]
[24.0, 28.0]
[292, 395]
p03146
u764956288
2,000
1,048,576
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).
['def next_num(n):\n if n%2:\n return 3*n+1\n else:\n return n/2\n\ns = int(input())\n\nn = s\nfor i in range(1000000):\n ind = [1,2,4].index(n)\n if n >= 0:\n print(ind+i+2)\n break\n n = next_num(n)\n', 'def next_num(n):\n if n%2:\n return 3*n+1\n else:\n return n/2\n\ns = int(input())\n\nn = s\nfor i in range(1000000):\n if n in [1,2,4]:\n print(i+4)\n break\n except:\n n = next_num(n)', 'def next_num(n):\n if n%2:\n return n/2\n else:\n return 3*n+1\n\ns = int(input())\n\nn = s\nfor i in range(1000000):\n if n == 4:\n print(i+4)\n break\n n = next_num(n)\n', 'def next_num(n):\n if n%2:\n return 3*n+1\n else:\n return n/2\n\ns = int(input())\n\nn = s\nfor i in range(1000000):\n if n in [1,2,4]:\n print(i+4)\n break\n n = next_num(n)\n']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s385937074', 's611698634', 's818310362', 's269410458']
[2940.0, 2940.0, 2940.0, 2940.0]
[19.0, 18.0, 443.0, 19.0]
[202, 190, 173, 179]
p03146
u767995501
2,000
1,048,576
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).
['def f(s):\n\tcnt = 0\n\tst = set()\n\tcnt += 1\n\tst.add(s)\n \n\twhile True:\n\t\tcnt += 1\n \tif s % 2 == 0:\n \t\ttmp = s / 2\n \telse:\n \t\ttmp = 3 * s + 1\n \tif tmp in st:\n \t\tbreak\n \n \tst.add(tmp)\n \ts = tmp\n\treturn cnt\n \ns = int(input())\nans = f(s)\nprint(ans)', 'def f(s):\n\tcnt = 0\n\tst = set()\n\tcnt += 1\n\tst.add(s)\n \n\twhile True:\n\t\tcnt += 1\n\t\tif s % 2 == 0:\n\t\t\ttmp = s / 2\n\t\telse:\n\t\t\ttmp = 3 * s + 1\n\t\tif tmp in st:\n\t\t\tbreak\n \n\t\tst.add(tmp)\n\t\ts = tmp\n\treturn cnt\n \ns = int(input())\nans = f(s)\nprint(ans)']
['Runtime Error', 'Accepted']
['s956194400', 's360566566']
[2940.0, 3064.0]
[17.0, 18.0]
[275, 245]
p03146
u777207626
2,000
1,048,576
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).
['s = int(input())\ncheck = [s]\ncount = 0\nfor i in range(2,1000001):\n if s%2==0:\n s = int(s/2)\n if s in check==True:\n print(i)\n exit()\n else:\n check.append(s)\n else:\n s = 3*s+1\n if s in check==True:\n print(i)\n exit()\n else:\n check.append(s)', 's = int(input())\ncheck = [s]\ncount = 1\n\nwhile True:\n count+=1\n if s%2==0:\n s = int(s/2)\n else:\n s = 3*s+1\n if s in check:\n print(count)\n exit()\n else:\n check.append(s)']
['Wrong Answer', 'Accepted']
['s962583106', 's005344971']
[10900.0, 2940.0]
[1873.0, 18.0]
[287, 187]
p03146
u777283665
2,000
1,048,576
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).
['def f(n):\n if n % 2 == 0:\n return n // 2\n else:\n return 3 * n + 1\n\ns = int(input())\n\nc = 1\n\nl = []\n\nwhile f(s) not in l:\n l.append(f(s))\n c += 1\n\nprint(c+1)', 'def f(n):\n if n % 2 == 0:\n return n // 2\n else:\n return 3 * n + 1\n\ns = int(input())\n\nl = []\nl.append(s)\n\nc = 1\n\nwhile f(s) not in l:\n s = f(s)\n l.append(s)\n c+=1\n\nprint(c+1)']
['Wrong Answer', 'Accepted']
['s948535784', 's300781781']
[3060.0, 3060.0]
[17.0, 17.0]
[182, 202]
p03146
u782654209
2,000
1,048,576
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).
['s = int(input())\ni = 0\ndef collatz(x):\n if x%2 == 0:\n return int(x/2)\n else:\n return int(3*x+1)\n\nwhile s!=4:\n s = collatz(s)\n i += 1\n\nprint(str(i+3))', 's = int(input())\ni = 1\ndef collatz(x):\n\tif x%2 == 0:\n\t\treturn int(x/2)\n\telse:\n\t\treturn int(3*x+1)\n\nwhile True:\n\tif s in [1,2,4]:\n\t\tbreak\n\telse:\n\t\ts = collatz(s)\n\t\ti += 1\n\nprint(str(i+3))']
['Wrong Answer', 'Accepted']
['s126438333', 's974414205']
[2940.0, 2940.0]
[18.0, 17.0]
[159, 186]
p03146
u784341473
2,000
1,048,576
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).
['a=input()\ncnt=1\nwhile a!=1\n if(a%2==0):\n a//=2\n cnt+=1\n else:\n a=3a+1\n cnt+=1\nprint(cnt=+3)', 's=[int(input())]\nwhile len(s)==len(set(s)):\n if(s[-1]%2==0):\n s.append(s[-1]//2)\n else:\n s.append(3*s[-1]+1)\nprint(len(s))']
['Runtime Error', 'Accepted']
['s385388853', 's079855428']
[2940.0, 3060.0]
[17.0, 17.0]
[105, 130]
p03146
u798260206
2,000
1,048,576
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).
['s = int(input())\n\nans = [s]\n \nwhile True:\n if s%2 ==0:\n s = s//2\n else:\n s = 3s + 1\n \n if s in ans:\n break\n else:\n ans.append(s)', 's = int(input())\na = list(map(int,input().split()))\nans = [s]\n\nwhile True:\n if s%2 ==0:\n s = s//2\n else:\n s = 3s + 1\n\n if s in ans:\n break\n else:\n ans.append(s)\n \nprint(len(ans)+1)', 's = int(input())\nans = [s]\n \nwhile True:\n if s%2 ==0:\n s = s//2\n else:\n s = 3*s + 1\n \n if s in ans:\n break\n else:\n ans.append(s)\n \nprint(len(ans)+1)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s818298626', 's874055288', 's402406376']
[2940.0, 2940.0, 3064.0]
[18.0, 17.0, 17.0]
[152, 209, 177]
p03146
u802772880
2,000
1,048,576
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).
['s=int(input())\na=[s]\ndef f(s):\n if s%2==0:\n return s//2\n else:\n return 3*s+1\nfor i in range(1000001):\n if f(a[i]) in a:\n print(i+2)\n break\n else:\n a.append(f(a[i]))\nprint(a)', 's=int(input())\na=[s]\ndef f(s):\n if s%2==0:\n return s//2\n else:\n return 3*s+1\nfor i in range(1000001):\n if f(a[i]) in a:\n print(i+2)\n break\n else:\n a.append(f(a[i]))']
['Wrong Answer', 'Accepted']
['s135125001', 's171221098']
[2940.0, 3060.0]
[17.0, 17.0]
[220, 211]
p03146
u802963389
2,000
1,048,576
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).
['N = int(input())\nxy = [list(map(int, input().split())) for _ in range(N)]\n \nimport itertools\nhoges = {}\nfor i in itertools.combinations(xy, 2):\n if i[0][0] - i[1][0] >= 0:\n hoge = (i[0][0] - i[1][0], i[0][1] - i[1][1])\n else:\n hoge = (i[1][0] - i[0][0], i[1][1] - i[0][1])\n hoges.setdefault(hoge, 0)\n hoges[hoge] += 1\n# print(hoges)\nmax_v = max(hoges.values())\nprint(N - max_v)', 'def fn(n):\n if n % 2 == 0:\n return n/2\n else:\n return 3*n + 1\n\ns = int(input())\n \nal = []\nal.append(s)\ncnum = s\nfor i in range(2,1000000):\n cnum = fn(cnum)\n if cnum in al[:-1]:\n print(i)\n exit()\n else:\n al.append(cnum)\n\n']
['Runtime Error', 'Accepted']
['s358515562', 's941747982']
[3064.0, 3060.0]
[17.0, 18.0]
[403, 241]
p03146
u811967730
2,000
1,048,576
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).
['a = int(input())\nM = 1000000\nm = 1\n\nwhile m <= M:\n if a in (1, 2, 41):\n m += 3\n break\n if a % 2 == 0:\n a //= 2\n else:\n a = 3 * a + 1\n m += 1\n\nprint(m)\n', 'a = int(input())\nM = 1000000\nm = 1\n\nwhile m <= M:\n if a in (1, 2, 4):\n m += 3\n break\n if a % 2 == 0:\n a //= 2\n else:\n a = 3 * a + 1\n m += 1\n\nprint(m)\n']
['Wrong Answer', 'Accepted']
['s197362900', 's067674218']
[2940.0, 2940.0]
[17.0, 18.0]
[191, 190]
p03146
u812803774
2,000
1,048,576
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).
['s = int(input())\na = [s]\n\ncounter = 2\nwhile True:\n if a[-1] % 2 == 0:\n temp = int(3 * a[-1] + 1)\n else:\n temp = int(a[-1] / 2)\n \n print(temp)\n \n if temp in a:\n break\n \n counter += 1\n a.append(temp)\n \nprint(counter)', 's = int(input())\na = [s]\n\ncounter = 2\nwhile True:\n if a[-1] % 2 == 0:\n temp = int(a[-1] / 2)\n else:\n temp = int(3 * a[-1] + 1)\n \n print(temp)\n \n if temp in a:\n break\n \n counter += 1\n a.append(temp)\n \nprint(counter)', 'a, b, _ = map(int, input().split())\nprint(a * b / 2)', 's = int(input())\na = [s]\n\ncounter = 2\nwhile True:\n if a[-1] % 2 == 0:\n temp = int(a[-1] / 2)\n else:\n temp = int(3 * a[-1] + 1)\n \n if temp in a:\n break\n \n counter += 1\n a.append(temp)\n \nprint(counter)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s226191012', 's670247527', 's759517878', 's237006852']
[3060.0, 3060.0, 2940.0, 3060.0]
[17.0, 17.0, 17.0, 17.0]
[273, 273, 52, 248]
p03146
u814781830
2,000
1,048,576
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).
["s = int(input())\ndef functionF(n):\n result = n/2 if n % 2 == 0 else 3 * n + 1\n return int(result)\ndef calc(s):\n array = []\n for i in range(1,1000000):\n if i == 1:\n array.append(s)\n elif i > 1:\n array.append(functionF(array[i - 2]))\n return array\ndef result(s):\n result = calc(s)\n for i in range(1, 1000000):\n# print('i',i)\n for k in range(i):\n# print('k',k)\n# print(result[i], result[k])\n if result[i] == result[k]:\n print(i - 1)\n return", 's = int(input())\ndef functionF(n):\n result = n/2 if n % 2 == 0 else 3 * n + 1\n return int(result)\n\ndef calc(s):\n array = []\n for i in range(1,1000000):\n if i == 1:\n array.append(s)\n elif i > 1:\n array.append(functionF(array[i - 2]))\n for k in range(1, i):\n# print(i, k)\n# print(array[i-1], array[k-1])\n if array[i-1] == array[k-1]:\n print(i)\n return\ncalc(s)']
['Runtime Error', 'Accepted']
['s460049007', 's413452746']
[2940.0, 3060.0]
[18.0, 19.0]
[558, 501]
p03146
u814986259
2,000
1,048,576
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).
['import collections\ns=int(input())\ncount=1\nans=s\nprev=0\ncounter = collections.defaultdict(int)\ncounter[ans]=1\nwhile(1):\n count+=1\n if ans % 2 == 0:\n ans = ans / 2\n else:\n ans = 3*n+1\n \n if ans not in counter.keys:\n counter[ans]=count\n else:\n print(counter[ans])\n break', 'import collections\ns=int(input())\ncount=1\nans=s\nprev=0\ncounter = collections.defaultdict(int)\ncounter[ans]=1\nwhile(1):\n count+=1\n if ans % 2 == 0:\n ans = ans / 2\n else:\n ans = 3*ans+1\n \n if ans not in counter.keys():\n counter[ans]=count\n else:\n print(count)\n break']
['Runtime Error', 'Accepted']
['s759393756', 's731364667']
[3316.0, 3444.0]
[20.0, 21.0]
[290, 287]
p03146
u817703856
2,000
1,048,576
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).
['k = input().split()\na = int(k[0])\n\ndef b(n):\n return int(n/2)\ndef c(n):\n return int((3*n)+1)\n\nCounter = 0\n\nflag = True\nIntSet = set()\nIntSet.add(a)\nBuffer = int(a)\nfor i in range(1,1000000+1):\n if Buffer%2 == 0:\n Buffer = b(Buffer)\n Counter+=1\n else:\n Buffer = c(Buffer)\n Counter+=1\n print(Buffer)\n if Buffer in IntSet:\n print(Counter+1)\n break\n else:\n IntSet.add(Buffer)', 'k = input().split()\na = int(k[0])\n\ndef b(n):\n return int(n/2)\ndef c(n):\n return int((3*n)+1)\n\nCounter = 0\n\nflag = True\nIntSet = set()\nIntSet.add(a)\nBuffer = int(a)\nfor i in range(1,1000000+1):\n if Buffer%2 == 0:\n Buffer = b(Buffer)\n Counter+=1\n else:\n Buffer = c(Buffer)\n Counter+=1\n if Buffer in IntSet:\n print(Counter+1)\n break\n else:\n IntSet.add(Buffer)']
['Wrong Answer', 'Accepted']
['s823398079', 's470737440']
[3064.0, 3064.0]
[17.0, 17.0]
[441, 423]
p03146
u820560680
2,000
1,048,576
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).
['def func(x):\n if(x % 2 == 0):\n return x / 2\n else:\n return 3 * x + 1\n\ns = int(input())\ncnt = 0\nwhile(s != 1):\n s = func(s)\n cnt += 1\nprint(cnt + 1)\n', 'def func(x):\n if(x % 2 == 0):\n return x / 2\n else:\n return 3 * x + 1\n\ns = int(input())\nif(s == 1 || s == 2):\n print(4)\n exit()\n \ncnt = 1\nwhile(s != 1):\n s = func(s)\n cnt += 1\nprint(cnt + 1)\n', 'def func(x):\n if(x % 2 == 0):\n return x / 2\n else:\n return 3 * x + 1\n\ns = int(input())\nif((s == 1) or (s == 2)):\n print(4)\n exit()\n \ncnt = 1\nwhile(s != 1):\n s = func(s)\n cnt += 1\nprint(cnt + 1)\n\n']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s446696372', 's634431207', 's578873173']
[2940.0, 2940.0, 2940.0]
[19.0, 18.0, 20.0]
[158, 203, 208]
p03146
u821251381
2,000
1,048,576
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).
['import collections\n\ns = int(input())\nA = [s]\nfor i in range(1000000+1):\n A.append(i//2 if i%2==0 else 3*n+1)\n c = collections.Counter(A)\n if c.most_common()[0][1] ==2:\n print(i)\n break', 'import collections\n\ns = int(input())\nA = [s]\nfor i in range(1000000+1):\n A.append(A[i]//2 if A[i]%2==0 else 3*A[i]+1)\n c = collections.Counter(A)\n if c.most_common()[0][1] == 2:\n print(len(A))\n break']
['Runtime Error', 'Accepted']
['s969056639', 's538291186']
[3316.0, 3316.0]
[21.0, 22.0]
[193, 208]
p03146
u826557401
2,000
1,048,576
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).
['s = int(input())\nprogression = []\nn = s\ncount = 1\nwhile n not in progression:\n count += 1\n if n % 2 == 0:\n n = n/2\n else:\n n = 3 * n + 1\n \nprint(count)', 's = int(input())\nprogression = [s]\nn = s\ncount = 1\nwhile True:\n count += 1\n if n % 2 == 0:\n n = n/2\n else:\n n = 3 * n + 1\n\n if n in progression:\n break\n else:\n progression.append(n)\n\nprint(count)']
['Time Limit Exceeded', 'Accepted']
['s080202180', 's689337458']
[2940.0, 3060.0]
[2104.0, 17.0]
[181, 238]
p03146
u832871520
2,000
1,048,576
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).
['import sys\nimport math\nfrom collections import Counter\nimport itertools\nimport fractions\nimport datetime\nfrom decimal import Decimal\n#from functools import reduce\n\n\ndef II(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef SR(): return sys.stdin.readline().rstrip()\n\nascii_lowercase = \'abcdefghijklmnopqrstuvwxyz\'\nascii_uppercase = \'ABCDEFGHIJKLMNOPQRSTUVWXYZ\'\nascii_uppercase2 = \'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ\'\n\n\np2D = lambda x: print(*x, sep="\\n")\np2E = lambda x: print(\'\'.join(x))\np2S = lambda x: print(*x, sep=" ")\n\n# ###########################################\n\ns=II()\nl=[s]\ncnt = 1\nwhile True:\n cnt += 1\n if s%2==0:\n s/=2\n else:\n s = 3*s+1\n if s in se:\n print(cnt)\n exit()\n else:\n l.append(s)', 'import sys\nimport math\nfrom collections import Counter\nimport itertools\nimport fractions\nimport datetime\nfrom decimal import Decimal\n#from functools import reduce\n\n\ndef II(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\n\ndef LI(): return list(map(int, sys.stdin.readline().split()))\n\ndef LLI(rows_number): return [LI() for _ in range(rows_number)]\ndef SR(): return sys.stdin.readline().rstrip()\n\nascii_lowercase = \'abcdefghijklmnopqrstuvwxyz\'\nascii_uppercase = \'ABCDEFGHIJKLMNOPQRSTUVWXYZ\'\nascii_uppercase2 = \'ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ\'\n\n\np2D = lambda x: print(*x, sep="\\n")\np2E = lambda x: print(\'\'.join(x))\np2S = lambda x: print(*x, sep=" ")\n\n# ###########################################\n\ns=II()\nl=[s]\ncnt = 1\nwhile True:\n cnt += 1\n if s%2==0:\n s/=2\n else:\n s = 3*s+1\n if s in l:\n print(cnt)\n exit()\n else:\n l.append(s)']
['Runtime Error', 'Accepted']
['s052080568', 's278706382']
[5304.0, 5432.0]
[38.0, 38.0]
[1178, 1177]
p03146
u836737505
2,000
1,048,576
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).
['s = int(input())\nai=[s]\nfor i in range(1000000):\n if s%2:\n s =3*s+1\n ai.append(s)\n else:\n s = s//2\n ai.append(s)\n print(ai)\n if len(ai) != len(set(ai)):\n c=0\n for j in range(len(ai)):\n if ai.count(ai[j])==2:\n c +=1\n if c ==2:\n print(j+1)\n exit()', 'ai=[s]\nfor i in range(1000000):\n if s%2:\n s =3*s+1\n ai.append(s)\n else:\n s = s//2\n ai.append(s)\n print(ai)\n if len(ai) != len(set(ai)):\n c=0\n for j in range(len(ai)):\n if ai.count(ai[j])==2:\n c +=1\n if c ==2:\n print(j+1)\n break\n exit()', 's = int(input())\nai=[s]\nfor i in range(1000000):\n if s%2:\n s =3*s+1\n ai.append(s)\n else:\n s = s//2\n ai.append(s)\n print(ai)\n if len(ai) != len(set(ai)):\n c=0\n for j in range(len(ai)):\n if ai.count(ai[j])==2:\n c +=1\n if c ==2:\n print(j+1)\n break\n exit()', 'n = int(input())\nans = 1\nwhile(n != 4 and n != 2 and n != 1):\n ans += 1\n if n%2 == 0:\n n = n//2\n else:\n n = 3*n+1\nprint(ans+3)']
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s095947620', 's148172953', 's335047167', 's448545745']
[3064.0, 3060.0, 3064.0, 2940.0]
[19.0, 17.0, 18.0, 17.0]
[378, 375, 392, 149]
p03146
u842747358
2,000
1,048,576
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).
['def fn(n):\n if n % 2 == 0:\n return n/2\n else:\n return 3*n + 1\n\n\ns = int(input())\n\na = []\nb = s\ncount = 0\nfor i in range(10**6 + 1):\n a.append(b)\n b = fn(b)\n if b == 1:\n count += 1\n if count == 3:\n break\n\nfor i in range(len(a)):\n for j in range(i+1, len(a)):\n if a[i] == a[j]:\n result = j\n break\nprint(j)\n', 'def fn(n):\n if n % 2 == 0:\n return n//2\n else:\n return 3*n + 1\n\n\ns = int(input())\n\na = []\nb = s\nfor i in range(10**6 + 1):\n if b not in a:\n a.append(b)\n b = fn(b)\n else:\n a.append(b)\n break\nprint(len(a))\n']
['Wrong Answer', 'Accepted']
['s592648000', 's299089768']
[3064.0, 2940.0]
[19.0, 18.0]
[390, 258]
p03146
u843318346
2,000
1,048,576
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).
['s = int(input())\ncount = 0\nwhile s!=1:\n if s%2==0:\n s /= 2\n else:\n s = s*3+1\n count += 1\nif s == 1:\n print(4)\nelif s == 2:\n print(2)\nelse:\n print(count+2)\n', 's = int(input())\nmoto = s\ncount = 0\nwhile s!=1:\n if s%2==0:\n s /= 2\n else:\n s = s*3+1\n count += 1\nif moto == 1:\n print(4)\nelif moto == 2:\n print(4)\nelse:\n print(count+2)\n']
['Wrong Answer', 'Accepted']
['s588123917', 's487549254']
[2940.0, 3060.0]
[17.0, 17.0]
[167, 182]
p03146
u843932857
2,000
1,048,576
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).
['s=int(input())\na=[s]\nwhile(True):\n i=0\n n=0\n if a[i]%2==0:\n n=a[i]//2\n else:\n n=a[i]*3+1\n if n in a:\n print(a.index(n)+1)\n break\n i+=1\n a.append(n)', 's=int(input())\na=[s]\ni=0\nwhile(True):\n n=0\n if a[i]%2==0:\n n=a[i]//2\n else:\n n=a[i]*3+1\n if n in a:\n print(len(a)+1)\n break\n i+=1\n a.append(n)\n']
['Wrong Answer', 'Accepted']
['s942682756', 's001437647']
[3060.0, 2940.0]
[17.0, 17.0]
[166, 161]
p03146
u846150137
2,000
1,048,576
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).
['a=int(input())\ns=set(a)\ni=1\nwhile True:\n if a % 2==1:\n a = a * 3 + 1\n else:\n a = a//2\n \n if a in s:\n break\n s|={a}\n i+=1\nprint(i)', 'a=int(input())\ns=set(a)\ni=1\nwhile True:\n if a % 2==1:\n a = a * 3 + 1\n else:\n a = a//2\n \n if a in s:\n break\n s|={a}\n i+=1\nprint(i)', 'a=int(input())\ns={a}\ni=1\nwhile True:\n i+=1\n if a % 2==1:\n a = a * 3 + 1\n else:\n a = a//2\n \n if a in s:\n break\n s|={a}\nprint(i)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s771972363', 's961044038', 's932610443']
[2940.0, 3064.0, 2940.0]
[20.0, 20.0, 20.0]
[146, 150, 144]
p03146
u846226907
2,000
1,048,576
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).
['\nimport numpy as np\nimport sys\n\ninput = sys.stdin.readline\n\ns = int(input())\n\nans = 1\n\nwhile s != 4:\n if s%2 == 0 :\n s = s/2\n else:\n s = 3*s + 1\n \n ans+=1\n print(s)\n if ans == 10:\n break\n\n\nprint(ans+3)\n', '\nimport numpy as np\nimport sys\n\ninput = sys.stdin.readline\n\ns = int(input())\n\nans = 1\n\nwhile s != 4:\n if s%2 :\n s = s/2\n else:\n s = 3*s + 1\n \n ans+=1\n\n\nprint(ans+3)\n', '\nimport numpy as np\nimport sys\n\ninput = sys.stdin.readline\n\ns = int(input())\n\nif s == 1 :\n n = 2\nelif s == 2:\n n = 1\nelse:\n n = 3\n\nans = 1\n\nwhile s != 4:\n if s%2 == 0 :\n s = s/2\n else:\n s = 3*s + 1\n \n \n ans+=1\n\n\nprint(ans+n)\n']
['Wrong Answer', 'Time Limit Exceeded', 'Accepted']
['s754748516', 's862243980', 's857006098']
[12488.0, 14392.0, 14420.0]
[148.0, 2108.0, 149.0]
[241, 191, 263]
p03146
u851704997
2,000
1,048,576
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).
['s = int(input())\ncou = 1\ntmp = 0\nflag = 0\nList = []\nwhile(flag == 0):\n if(cou == 1):\n if(s % 2 == 0):\n tmp = s / 2\n List.append(tmp)\n else:\n tmp = 3 * s + 1\n List.append(tmp)\n cou += 1\n else:\n if(List.count(tmp) == 2):\n print(str(cou))\n break\n if(tmp % 2 == 0):\n tmp = tmp / 2\n List.append(tmp)\n else:\n tmp = 3 * tmp + 1\n List.append(tmp)\n cou += 1\n cou += 1', 's = int(input())\ncou = 1\ntmp = 0\nflag = 0\nList = [s]\nwhile(flag == 0):\n if(cou == 1):\n if(s % 2 == 0):\n tmp = s / 2\n List.append(tmp)\n else:\n tmp = 3 * s + 1\n List.append(tmp)\n cou += 1\n else:\n if(List.count(tmp) == 2):\n print(str(cou))\n break\n if(tmp % 2 == 0):\n tmp = tmp / 2\n List.append(tmp)\n else:\n tmp = 3 * tmp + 1\n List.append(tmp)\n cou += 1']
['Wrong Answer', 'Accepted']
['s583160872', 's844949688']
[3064.0, 3064.0]
[17.0, 17.0]
[434, 422]
p03146
u853900545
2,000
1,048,576
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).
['def f(n):\n if n%2==0:\n n//2\n else:\n 3*n+1\ns=int(input())\na=list()\ni=1\nwhile 1:\n if f(s) in a:\n break\n a.append(f(s))\n s=f(s)\n i+=1\nprint(i)', 'def f(n):\n if n%2==0:\n return n//2\n else:\n return 3*n+1\ns=int(input())\na=list()\ni=1\nwhile 1:\n if f(s) in a:\n break\n a.append(f(s))\n s=f(s)\n i+=1\nprint(i)\n', 'def f(n):\n if n%2==0:\n return n//2\n else:\n return 3*n+1\ns=int(input())\na=list()\ni=1\nwhile 1:\n if s in a:\n break\n a.append(s)\n s=f(s)\n i+=1\nprint(i)\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s437713779', 's489342444', 's462098737']
[2940.0, 2940.0, 2940.0]
[18.0, 18.0, 19.0]
[178, 193, 187]
p03146
u854093727
2,000
1,048,576
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).
['def f(i):\n if i%2 == 0:\n return int(i/2)\n else:\n return 3*i+1\n\n\ns = int(input())\na = [s]\nans = 0\nfor i in range(1,1000000):\n ai = f(a[i -1])\n if a.count(ai) == 1:\n ans = i + 1\n break\n a.append(ai)\n', 'def f(i):\n if i%2 == 0:\n return int(i/2)\n else:\n return 3*i+1\n\n\ns = int(input())\na = [s]\nans = 0\nfor i in range(1,1000000):\n ai = f(a[i -1])\n if a.count(ai) == 1:\n ans = i + 1\n break\n a.append(ai)\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s348104730', 's741502394']
[2940.0, 3060.0]
[18.0, 18.0]
[240, 251]
p03146
u854685063
2,000
1,048,576
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).
['import sys\nimport math\ndef i():return int(sys.stdin.readline().replace("\\n",""))\ndef i2():return map(int,sys.stdin.readline().replace("\\n","").split())\ndef s():return str(sys.stdin.readline().replace("\\n",""))\ndef l():return list(sys.stdin.readline().replace("\\n",""))\ndef intl():return [str(k) for k in sys.stdin.readline().replace("\\n","").split()]\ndef lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\\n","").split()))\ndef t():return tuple(map(int,sys.stdin.readline().replace("\\n","").split()))\ndef f(n):\n print(l)\n if n%2 == 0:\n return n//2\n else:\n return 3*n + 1\nif __name__ == "__main__":\n n = i()\n c = 0\n cnt = 1\n l = [n]\n #if n != 2 or n != 1 or n != 4:l = [n]\n while c < 2:\n n = f(n)\n cnt += 1\n if n in l:\n print(cnt)\n break\n l.append(n)', 'import sys\nimport math\ndef i():return int(sys.stdin.readline().replace("\\n",""))\ndef i2():return map(int,sys.stdin.readline().replace("\\n","").split())\ndef s():return str(sys.stdin.readline().replace("\\n",""))\ndef l():return list(sys.stdin.readline().replace("\\n",""))\ndef intl():return [str(k) for k in sys.stdin.readline().replace("\\n","").split()]\ndef lx(k):return list(map(lambda x:int(x)*-k,sys.stdin.readline().replace("\\n","").split()))\ndef t():return tuple(map(int,sys.stdin.readline().replace("\\n","").split()))\ndef f(n):\n #print(l)\n if n%2 == 0:\n return n//2\n else:\n return 3*n + 1\nif __name__ == "__main__":\n n = i()\n c = 0\n cnt = 1\n l = [n]\n #if n != 2 or n != 1 or n != 4:l = [n]\n while c < 2:\n n = f(n)\n cnt += 1\n if n in l:\n print(cnt)\n break\n l.append(n)']
['Wrong Answer', 'Accepted']
['s265562032', 's947492183']
[3064.0, 3064.0]
[18.0, 18.0]
[860, 861]
p03146
u857070771
2,000
1,048,576
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).
['s=int(input())\ndef f(n):\n\tif n % 2 ==0:\n\t\treturn int(n/2)\n\telse:\n\t\treturn int(3*n+1)\na=[s]\nwhile len(set(a)) == len(a):\n\t\ta.append(f(a[-1]))\n\t\tprint(a)\nprint(len(a))', 's=int(input())\ndef f(n):\n\tif n % 2 ==0:\n\t\treturn int(n/2)\n\telse:\n\t\treturn int(3*n+1)\na=[s]\nwhile len(set(a)) == len(a):\n\t\ta.append(f(a[-1]))\nprint(len(a))']
['Wrong Answer', 'Accepted']
['s023296813', 's085274687']
[3060.0, 3060.0]
[18.0, 17.0]
[165, 154]
p03146
u859897687
2,000
1,048,576
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).
['s=[int(input())]\ni=0\nwhile 1>0:\n if i%2>0:\n b=3*s[i]+1\n else:\n b=s[i]//2\n if b in s:\n print(i+1)\n break\n', 's=[int(input())]\ni=0\nwhile 1>0:\n if i%2>0:\n b=3*s[i]+1\n else:\n b=s[i]//2\n if b in s:\n print(i+1)\n break\n i+=1\n', 's=[int(input())]\ni=0\nwhile 1>0:\n if s[i]%2>0:\n b=3*s[i]+1\n else:\n b=s[i]//2\n if b in s:\n print(i+2)\n break\n i+=1\n s+=[b]']
['Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s015651174', 's616190463', 's790725870']
[2940.0, 2940.0, 2940.0]
[2104.0, 18.0, 17.0]
[119, 126, 137]
p03146
u888610038
2,000
1,048,576
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).
['s=int(input())\ncount=0\nif s==1:\n print(4)\nelif s==2:\n print(4)\nelse:\n for i in range(1000000):\n if s%2==0:\n s=s//2\n count+=1\n if s==4:\n break\n else:\n s=s*3+1\n count+=1\n print(count+4)\n', 's = int(input())\ncnt = 1\nbox = set()\nwhile not s in box:\n\tbox.add(s)\n\tif s % 2 == 0:\n\t\ts = s / 2\n\telse:\n\t\ts = 3 * s + 1\n\tcnt += 1\n\t\nprint(cnt)\n']
['Runtime Error', 'Accepted']
['s980160951', 's943559714']
[2940.0, 2940.0]
[17.0, 18.0]
[210, 143]
p03146
u895536055
2,000
1,048,576
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).
['#include <bits/stdc++.h>\n\n#define mod 1000000007\n\n#define rep(i, n) for(int i=1; i<=n; ++i)\n\nusing namespace std;\ntypedef long long ll; \n \nint main(void){\n\t\n\tint a[100000];\n\t\n\tcin >> a[0];\n\t\n\trep(i, 100000){\n\t\tif(a[i-1] % 2 == 0)\n\t\t\ta[i] = a[i-1] / 2;\n\t\telse\n\t\t\ta[i] = 3 * a[i-1] + 1;\n\t\trep(j, i){\n\t\t\tif(a[j] == a[i]){\n\t\t\t\tcout << i;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\t}\n}', 's = int(input())\na = []\n\nwhile(s not in a):\n a.append(s)\n if s % 2 == 0:\n s //= 2\n else:\n s = 3 * s + 1\n\nprint(len(a) + 1)\n']
['Runtime Error', 'Accepted']
['s623627535', 's426265375']
[2940.0, 2940.0]
[17.0, 17.0]
[361, 146]
p03146
u902973687
2,000
1,048,576
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).
['def f(n):\n if n % 2 == 0:\n return n//2\n else:\n return 3*n + 1\n\n\ns = int(input())\na = [s]\ni = 0\nwhile True:\n s = f(a[i])\n if a in s:\n print(i)\n break\n else:\n a.append(s)\n i += 1\n', 'def f(n):\n if n % 2 == 0:\n return n//2\n else:\n return 3*n + 1\n\n\ns = int(input())\na = [s]\ni = 0\nwhile True:\n s = f(a[i])\n if a in s:\n print(i)\n break\n else:\n a.ppend(s)\n i += 1', 's = int(input())\n\n\ndef f(n):\n if n % 2 == 0:\n return n // 2\n else:\n return 3 * n + 1\n\n\ni = 0\na = [0]\nwhile True:\n if i == 0:\n a[0] = s\n else:\n a.append(f(a[i-1]))\n if a[i] in a[:i]:\n break\n i += 1\nprint(i + 1)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s020083785', 's271939117', 's895865341']
[2940.0, 3060.0, 2940.0]
[18.0, 18.0, 17.0]
[200, 198, 263]
p03146
u903948194
2,000
1,048,576
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).
['s = int(input())\n\ndef func(n):\n if n%2 == 0:\n return int(n / 2)\n else:\n return 3 * n + 1\n\na = [s]\ni = 0\nflg = 1\n\nwhile(flg):\n a.append(func(a[i]))\n #print(a)\n for k in range(len(a)):\n for l in range(1, len(a)-k): \n if a[k] == a[k+l]:\n print(k+l+1)\n break\n else:\n continue\n break \n \n i += 1\n \n \n', 'while(flg):\n a.append(func(a[i]))\n #print(a)\n for k in range(len(a)):\n for l in range(1, len(a)-k): \n if a[k] == a[k+l]:\n print(k+l+1)\n break\n else:\n continue\n break \n \n i += 1', 's = int(input())\n\ndef func(n):\n if n%2 == 0:\n return int(n / 2)\n else:\n return 3 * n + 1\n\ndef check(a, k): \n for l in range(1, len(a)-k): \n if a[k] == a[k+l]:\n print(k+l+1)\n return False\n return True\n\na = [s]\ni = 0\nflg = 1\n\nwhile(flg):\n a.append(func(a[i]))\n #print(a)\n for k in range(len(a)):\n if not check(a, k):\n flg = 0\n break\n i += 1']
['Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s364220925', 's814224637', 's108571798']
[11760.0, 3060.0, 3064.0]
[2104.0, 18.0, 41.0]
[422, 270, 437]
p03146
u904943473
2,000
1,048,576
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).
['s = int(input())\nlst = []\ncnt = 0\nWhile True:\n cnt += 1\n if (s % 2 == 0):\n s = int(s / 2)\n else:\n s = int(3*s + 1)\n lst.append(s)\n if (s in lst):\n break\nprint(cnt)\n \n ', 's = int(input())\nlst = []\nlst.append(s)\ncnt = 1\nwhile (True):\n cnt += 1\n if (s % 2 == 0):\n s = int(s / 2)\n else:\n s = int(3*s + 1)\n if (s not in lst):\n lst.append(s)\n else:\n break\nprint(cnt)\n']
['Runtime Error', 'Accepted']
['s594246114', 's495954959']
[2940.0, 2940.0]
[17.0, 17.0]
[187, 208]
p03146
u918714262
2,000
1,048,576
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).
['s = int(input())\na = [0]*1000010\n\ni = 1\na[s] = 1\nwhile True:\n\ts = s//2 if s%2 == 0 else 3*s+1\n\tif a[s] == 0:\n\t\ti += 1\n\t\ta[s] = i\n\telse:\n\t\tprint(i)\n\t\tbreak', 's = int(input())\na = [0]*1000010\n\ni = 1\na[s] = 1\nwhile True:\n\ti += 1\n\ts = s//2 if s%2 == 0 else 3*s+1\n\tif a[s] == 0:\n\t\ta[s] = i\n\telse:\n\t\tprint(i)\n\t\tbreak']
['Wrong Answer', 'Accepted']
['s329036638', 's224975954']
[10868.0, 10868.0]
[27.0, 27.0]
[154, 153]
p03146
u921249617
2,000
1,048,576
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).
['s = int(input())\na = [s]\ni = 1\n\nf = lambda n: n // 2 if n % 2 == 0 else 3 * n + 1\n\nwhile true:\n a.append(f(a[i-1]))\n i += 1\n\n if a[-1] in a[:-1]:\n break\n\nprint(i)\n', 's = int(input())\na = [s]\ni = 1\n\nf = lambda n: n // 2 if n % 2 == 0 else 3 * n + 1\n\nwhile True:\n a.append(f(a[i-1]))\n i += 1\n\n if a[-1] in a[:-1]:\n break\n\nprint(i)\n']
['Runtime Error', 'Accepted']
['s406045744', 's992557990']
[2940.0, 2940.0]
[18.0, 18.0]
[179, 179]
p03146
u923504061
2,000
1,048,576
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).
['s = input()\n\ntag = 0\ni = 1\nnum = [0]*1000000\n\nwhile tag == 0:\n if int(s)%2 == 0:\n s = int(s)/2\n else:\n s = 3*int(s) + 1\n i += 1\n for j in range(i):\n if s == num[j]:\n tag = 1\n break\n else:\n continue\n\nprint (i)\n\n', 's = input()\n\ntag = 0\ni = 1\nnum = []\n\nwhile tag == 0:\n if i > 1000000:\n break\n num.append(int(s))\n if int(s)%2 == 0:\n s = int(s)/2\n else:\n s = 3*int(s) + 1\n i += 1\n for j in range(int(i)-1):\n if int(s) == int(num[j]):\n tag = 1\n print (i)\n break\n else:\n continue\n\n']
['Time Limit Exceeded', 'Accepted']
['s011730389', 's510592031']
[10868.0, 3060.0]
[2104.0, 19.0]
[283, 359]
p03146
u930011203
2,000
1,048,576
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).
['def f(x):\n if x % 2 == 0:\n return x//2\n else:\n return 3*x+1\n \ns = int(input())\na = [s]\nm = 1\nwhile True:\n\tt = f(s)\n m += 1\n\tif t not in a:\n a.append(t)\n s = t\n else:\n break\nprint(m)', 'def f(x):\n\tif x % 2 == 0:\n \treturn x//2\n\telse:\n\t\treturn 3*x+1\n\ns = int(input())\na = [s]\nm = 1\nwhile True:\n\tt = f(s)\n m += 1\n if t not in a:\n \ta.append(t)\n s = t\n\telse:\n \tbreak\nprint(m)', 'def f(x):\n\tif x % 2 == 0:\n\t\treturn x//2\n\telse:\n\t\treturn 3*x+1\n \ns = int(input())\na = [s]\nm = 1\nwhile True:\n\tt = f(s)\n\tm += 1\n\tif t not in a:\n\t\ta.append(t)\n\t\ts = t\n\telse:\n\t\tbreak\nprint(m)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s262253418', 's932228766', 's164322784']
[2940.0, 2940.0, 3188.0]
[18.0, 18.0, 21.0]
[211, 206, 186]
p03146
u932868243
2,000
1,048,576
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).
['s=int(input())\nlist=[s]\nnum=2\nwhile num<=1000000:\n if num%2==0:\n list.append(list[num-2]/2)\n if len(list)>len(set(list)):\n break\n num+=1\n else:\n list.append(3*list[num-2]+1)\n if len(list)>len(set(list)):\n break\n num+=1\nprint(num)', 's=int(input())\nlist=[s]\nnum=2\nwhile num<=1000000:\n if num%2==0:\n if list[num-2]/2 in list:\n break\n else:\n list.append(list[num-2]/2)\n num+=1\n else:\n if 3*list[num-2]+1 in list:\n break\n else:\n list.append(list[num-2]*3+1)\n num+=1\nprint(num)', 'int(input())\nlist=[s]\nnum=2\nwhile num<=1000000:\n if num%2==0:\n list.append(list[num-2]/2)\n else:\n list.append(list[num-2]*3+1)\n if list[num-1] in list[:num-1]:\n print(num)\n break\n num+=1', 's=int(input())\nlist=[s]\nnum=2\nwhile num<=1000000:\n if num%2==0:\n list.append(list[num-2]/2)\n else:\n list.append(list[num-2]*3+1)\n if list[num-1] in list[:num-1]:\n break\n num+=1\nprint(num)', 'int(input())\nlist=[s]\nnum=2\nwhile num<=1000000:\n if num%2==0:\n list.append(list[num-2]/2)\n else:\n list.append(list[num-2]*3+1)\n if list[num-1] in list[:num-1]:\n break\n num+=1\nprint(num)', 's=int(input())\nlist=[s]\nnum=2\nwhile num<=1000000:\n if num%2==0:\n list.append(list[num-2]/2)\n if list[num-2]/2 in list:\n break\n num+=1\n else:\n list.append(3*list[num-2]+1)\n if 3*list[num-2]+1 in list:\n break\n num+=1\nprint(num)', 's=int(input())\nlist=[s]\nnum=2\nwhile num<=1000000:\n if list[num-2]%2==0:\n list.append(list[num-2]/2)\n else:\n list.append(list[num-2]*3+1)\n if list[num-1] in list[:num-1]:\n break\n num+=1\nprint(num)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s048474268', 's409766977', 's670782759', 's723224985', 's830787987', 's844431181', 's257476384']
[3296.0, 3060.0, 3064.0, 3060.0, 3060.0, 3060.0, 3060.0]
[440.0, 131.0, 18.0, 146.0, 17.0, 17.0, 17.0]
[259, 279, 202, 200, 198, 255, 208]
p03146
u934788990
2,000
1,048,576
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).
['s = int(input())\nresult = []\nans = []\nfor i in range(1000000):\n if i == 0:\n result.append(s)\n elif result[i-1] % 2 == 0:\n aim = result[i - 1] // 2\n result.append(aim)\n else:\n aim = result[i - 1] * 3 + 1\n result.append(aim)\nfor j in range(len(result)):\n for k in range(len(result)):\n if result[j] == result[k] and j > k:\n ans.append(j)\n \nprint(ans[0] + 1)\n ', 's = int(input())\na = []\nwhile s not in a:\n a.append(s)\n if s%2 == 0:\n s = s/2\n else:\n s = 3*s+1\nprint(len(a)+1)']
['Time Limit Exceeded', 'Accepted']
['s700273249', 's233000070']
[10904.0, 2940.0]
[2104.0, 17.0]
[443, 134]