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 | u075303794 | 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 = 1\nwhile True:\n dic = {s:1}\n if s % 2 == 0:\n s //= 2\n else:\n s = 3 * s + 1\n count += 1\n if s in dic.keys():\n dic[s] += 1\n print(count)\n break\n else:\n dic[s] = 1\n ', 's = int(input())\ndic = {s:1}\ncount = 1\nwhile True:\n if s % 2 == 0:\n s //= 2\n else:\n s = 3 * s + 1\n count += 1\n if s in dic.keys():\n dic[s] += 1\n print(count)\n break\n else:\n dic[s] = 1'] | ['Time Limit Exceeded', 'Accepted'] | ['s085380117', 's352469672'] | [2940.0, 3060.0] | [2104.0, 18.0] | [213, 206] |
p03146 | u076996519 | 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 = []\ns.append(int(input()))\nfor i in range(1, 1000000):\n\tif s %2:\n\t\ts.append(3*s+1)\n\telse:\n\t\ts.append(s/2)\n\tfor j in range(i):\n\t\tif s[j] == s[i]:\n\t\t\tprint(i)', 's = [int(input())]\nfor i in range(1000000):\n\tif s[i]%2==0:\n\t\t\n\t\t# print(s)\n\t\tif s[i]/2 in s:\n\t\t\tprint(i+2)\n\t\t\tbreak\n\t\ts.append(s[i]/2)\n\telse:\n\t\t\n\t\tif 3*s[i]+1 in s:\n\t\t\tprint(i+2)\n\t\t\tbreak\n\t\ts.append(3*s[i]+1)\n\t# print(s)\n'] | ['Runtime Error', 'Accepted'] | ['s848268343', 's499783861'] | [2940.0, 3060.0] | [18.0, 17.0] | [159, 221] |
p03146 | u087917227 | 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 Counter\n\ns = int(input())\na = [s]\ndef f_even(n):\n return n//2\ndef f_odd(n):\n return 3*n + 1\nfor i in range(100):\n if a[i]%2 == 0:\n a.append(f_even(a[i]))\n else:\n a.append(f_odd(a[i]))\n tmp = Counter(a).most_common()[0]\n if tmp[1] > 1:\n print(i+2)\n return', 's = int(input())\nlst = []\n\nwhile s not in lst:\n lst.append(s)\n s = s/2 if s%2==0 else 3*s + 1\n \nprint(len(lst) + 1)'] | ['Runtime Error', 'Accepted'] | ['s007109705', 's641638031'] | [3060.0, 2940.0] | [18.0, 18.0] | [324, 124] |
p03146 | u094191970 | 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_list = [s]\nINF = 10 ** 5\nfor i in range(INF):\n value = a_list[-1]\n if value % 2 == 0:\n next_value = value / 2\n if next_value in a_list:\n print(a_list)\n print(i + 2)\n break\n else:\n a_list.append(int(next_value))\n else:\n next_value = (3 * value) + 1\n if next_value in a_list:\n print(a_list)\n print(i + 2)\n break\n else:\n a_list.append(int(next_value))', 's = int(input())\na_list = [s]\nINF = 10 ** 5\nfor i in range(INF):\n value = a_list[-1]\n if value % 2 == 0:\n next_value = value / 2\n if next_value in a_list:\n print(i + 2)\n break\n else:\n a_list.append(int(next_value))\n else:\n next_value = (3 * value) + 1\n if next_value in a_list:\n print(i + 2)\n break\n else:\n a_list.append(int(next_value))'] | ['Wrong Answer', 'Accepted'] | ['s845062659', 's078108051'] | [3064.0, 3064.0] | [18.0, 18.0] | [506, 454] |
p03146 | u095756391 | 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=0\n \ndef f(n):\n if (n % 2 == 0):\n return n / 2\n else:\n return 3*n + 1\n \nwhile (True):\n a_n = [s]\n for i in range(len(a_n)):\n a_i = f(a_n.pop(-1))\n a_n.append(a_i)\n \nprint(ans)', 's = int(input())\n\nans = 0\n\nif (s == 1 || s == 2 || s == 4):\n print(4)\n\nwhile (s != 4):\n if (s % 2 == 0):\n s /= 2\n else:\n s = 3*s + 1\n ans += 1\n\nprint(ans+4)\n\n\n ', 's = int(input())\n \nans=0\n \ndef f(n):\n if (n % 2 == 0):\n return n / 2\n else:\n return 3*n + 1\n \nwhile (True):\n a_n = [s]\n for i in len(a_n):\n if (a_n.count(4) != 2):\n a_i = f(a_n.pop(-1))\n a_n.append(a_i)\n else:\n index = a_n.index(4)\n ans = a_n[index+3]\n break\n \nprint(ans)', 's = int(input())\n\nans=0\n\ndef f(n):\n if (n % 2 == 0):\n return f(n /2)\n else:\n return f(3*n + 1)\n \nwhile (True):\n a_n = [s]\n if (a_n.count(4) != 2):\n a_n.append(f(s))\n else:\n index = a_n.index(4)\n ans = a_n[index+3]\n break\n \nprint(ans)\n \n \n \n\n', 's = int(input())\n \nans=0\n \ndef f(n):\n if (n % 2 == 0):\n return n / 2\n else:\n return 3*n + 1\n \nwhile (True):\n a_n = [s]\n for i in range(len(a_n)):\n if (a_n.count(4) != 2):\n a_i = f(a_n.pop(-1))\n a_n.append(a_i)\n else:\n index = a_n.index(4)\n ans = a_n[index+3]\n break\n \nprint(ans)', 's = int(input())\n \nans = 0\n \nif (s == 1 or s == 2 or s == 4):\n print(4)\nelse:\n while (s != 4):\n if (s % 2 == 0):\n s = int(s/2)\n else:\n s = 3*s + 1\n ans += 1\n \n \n print(ans+4)\n'] | ['Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Time Limit Exceeded', 'Accepted'] | ['s134026382', 's141815118', 's259577809', 's383647150', 's901872210', 's052798299'] | [3060.0, 2940.0, 3060.0, 3892.0, 3060.0, 2940.0] | [2104.0, 18.0, 20.0, 75.0, 2104.0, 17.0] | [218, 171, 316, 271, 323, 200] |
p03146 | u103902792 | 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(n):\n if n%2:\n return n*3+1\n else:\n return n//2\n\ni = 1\nhist = {s:i}\nwhile 1:\n s = f(s)\n if s in hist:\n print(i)\n break\n else:\n hist[s]= i\n i+=1', 's = int(input())\n\ndef f(n):\n if n%2:\n return n*3+1\n else:\n return n//2\n\ni = 1\nhist = {s:i}\nwhile 1:\n s = f(s)\n i+=1\n if s in hist:\n print(i)\n break\n else:\n hist[s]= i'] | ['Wrong Answer', 'Accepted'] | ['s302295000', 's537191710'] | [2940.0, 3060.0] | [17.0, 17.0] | [187, 187] |
p03146 | u107091170 | 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={}\nfor i in range(1000000):\n if a in m:\n break\n m[a] = i\n if a %2==0:\n a //=2\n else:\n a = 3*a+1\nprint(m[a])\n', 'a=int(input())\nm={}\nfor i in range(1000000):\n if a in m:\n print(i+1)\n break\n m[a] = i\n if a %2==0:\n a //=2\n else:\n a = 3*a+1\n'] | ['Wrong Answer', 'Accepted'] | ['s084373861', 's121066314'] | [2940.0, 2940.0] | [17.0, 19.0] | [138, 141] |
p03146 | u107737169 | 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). | ['colatz=[1,2,4]\ncolatz.append(int(input()))\nif colatz[3]==2 or colatz[3]==4:\n print(4)\nelse:\n b=3\n while colatz[b]!=colatz[b-3]:\n if colatz[b]%2==0:\n colatz.append(colatz[b]/2)\n else: colatz.append(3*colatz[b]+1)\n b=b+1\n print(b+1)', 'colatz=[1,2,4]\ncolatz.append(int(input()))\nb=3\nwhile colatz[b]!=colatz[b-3]:\n if colatz[b]%2==0:\n colatz.append(colatz[b]/2)\n else: colatz.append(3*colatz[b]+1)\n b=b+1\nprint(b+1)', 'colatz=1,2,4\ncolatz.append(list(map(int,input().split())))\nb=3\nwhile colatz[b]!=colatz[b-3]:\n if colatz[b]%2==0:\n colatz.append(colatz[b]/2)\n else: colatz.append(3*colatz[b]+1)\n b=b+1\nprint(b)', 'colatz=[1,2,4]\ncolatz.append(int(input()))\nif colatz[3]==1 or 2 or 4:\n print(4)\nelse:\n b=3\n while colatz[b]!=4:\n if colatz[b]%2==0:\n colatz.append(colatz[b]/2)\n else: colatz.append(3*colatz[b]+1)\n b=b+1\n print(b+1)', 'colatz=[1,2,4]\ncolatz.append(int(input()))\nb=3\nwhile colatz[b]!=colatz[b-3]:\n if colatz[b]%2==0:\n colatz.append(colatz[b]/2)\n else: colatz.append(3*colatz[b]+1)\n b=b+1\nprint(b)', 'colatz=[1,2,4]\ncolatz.append(int(input()))\nif colatz[3]==1 or colatz[3]==2 or colatz[3]==4:\n print(4)\nelse:\n b=3\n while colatz[b]!=4:\n if colatz[b]%2==0:\n colatz.append(colatz[b]/2)\n else: colatz.append(3*colatz[b]+1)\n b=b+1\n print(b+1)'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s108306715', 's467805622', 's479928683', 's487376998', 's574593822', 's705625198'] | [3060.0, 3060.0, 2940.0, 3060.0, 2940.0, 3060.0] | [17.0, 17.0, 18.0, 17.0, 18.0, 18.0] | [274, 194, 208, 258, 192, 280] |
p03146 | u113971909 | 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())\nalist = [s]\naset=set()\nfor i in range(1000000):\n n = alist[-1]\n if n in aset:\n print(len(alist))\n break\n aset.add(n)\n if n%2 ==0:\n x = n//2\n else:\n x = 3*n+1\n alist.append(x)\nprint(alist)', 's = int(input())\nalist = [s]\naset=set()\nfor i in range(1000000):\n n = alist[-1]\n if n in aset:\n print(len(alist))\n break\n aset.add(n)\n if n%2 ==0:\n x = n//2\n else:\n x = 3*n+1\n alist.append(x)'] | ['Wrong Answer', 'Accepted'] | ['s067698150', 's986985648'] | [3060.0, 3060.0] | [17.0, 17.0] | [222, 209] |
p03146 | u114954806 | 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\na=[]\ndef f(n):\n a.append(n)\n print(a)\n if a[-3:]==[4,2,1]:\n print(len(a)+1)\n exit()\n if n%2==0:\n n=n//2\n f(n)\n else:\n n=3*n+1\n f(n)\nf(s)', 'def f(n):\n if n%2==0:\n return n//2\n else:\n return 3*n+1\n\ns=int(input())\na=[s]\nfor i in range(2,10**10):\n s=f(s)\n if s in a:\n print(i)\n exit()\n a.append(s)\n'] | ['Wrong Answer', 'Accepted'] | ['s928668286', 's352046556'] | [3060.0, 2940.0] | [17.0, 17.0] | [212, 198] |
p03146 | u119983020 | 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()\ndef f(n):\n if n%2 == 0:\n return n/2\n else:\n return 3*n+1\na = []\na.append(s)\nfor i in range(1,1000001):\n if f(a[i-1]) in a:\n print(i)\n break\n else:\n a.append(f(a[i-1]))\n ', 's = int(input())\ndef f(n):\n if n%2 == 0:\n return n/2\n else:\n return 3*n+1\na = []\na.append(s)\nfor i in range(1,1000001):\n if f(a[i-1]) in a:\n print(i)\n break\n else:\n a.append(f(a[i-1]))\n ', 's = int(input())\ndef f(n):\n if n%2 == 0:\n return n/2\n else:\n return 3*n+1\na = []\na.append(s)\nfor i in range(1,1000001):\n if f(a[i-1]) in a:\n print(i+1)\n break\n else:\n a.append(f(a[i-1]))\n '] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s675863939', 's922202847', 's212504350'] | [2940.0, 2940.0, 2940.0] | [17.0, 18.0, 18.0] | [201, 206, 208] |
p03146 | u135197221 | 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 main():\n def f(n):\n return 3 * n + 1 if n % 2 else n // 2\n s = int(input())\n a = [s]\n for i in range(1, 11**6):\n x = f(a[i-1])\n if x in a:\n return len(a) + 1, a; exit()\n a.append(x)\n \n\nprint(main())', 'def main():\n def f(n):\n return 3 * n + 1 if n % 2 else n // 2\n s = int(input())\n a = [s]\n for i in range(1, 11**6):\n x = f(a[i-1])\n if x in a:\n return len(a) + 1; exit()\n a.append(x)\n\n\nprint(main())'] | ['Wrong Answer', 'Accepted'] | ['s507473128', 's515320573'] | [9132.0, 9180.0] | [30.0, 26.0] | [256, 249] |
p03146 | u145600939 | 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 = set([s])\np = s\nn = 0\ncnt = 0\nwhile True:\n if n in a:\n print(cnt)\n exit()\n if p&1:\n n = 3*p +1\n else:\n n = p//2\n cnt += 1\n a.add(n)\n p = n\n', 's = int(input())\na = set(s)\np = s\nn = 0\ncnt = 0\nwhile True:\n if n in a:\n print(cnt)\n exit()\n if p&1:\n n = 3*p +1\n else:\n n = p//2\n cnt += 1\n set.add(n)\n p = n\n', 's = int(input())\na = set([s])\np = s\nn = 0\ncnt = 1\nwhile True:\n if n in a:\n print(cnt)\n exit()\n if p&1:\n n = 3*p +1\n else:\n n = p//2\n cnt += 1\n a.add(n)\n p = n\n', 's = int(input())\na = set(s)\np = s\nn = 0\ncnt = 0\nwhile True:\n if n in a:\n print(cnt)\n exit()\n if p&1:\n n = 3*p +1\n else:\n n = p//2\n cnt += 1\n a.add(n)\n p = n\n', 's = int(input())\na = set([s])\np = s\nn = 0\ncnt = 1\nwhile True:\n if n in a:\n print(cnt)\n exit()\n a.add(n)\n if p&1:\n n = 3*p +1\n else:\n n = p//2\n cnt += 1\n p = n\n'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s072884152', 's232405827', 's960491677', 's965123004', 's736299237'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 18.0, 18.0, 17.0, 17.0] | [177, 177, 177, 175, 177] |
p03146 | u148079233 | 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 \n if n % 2 == 0:\n return int(n / 2)\n else:\n return 3 * n + 1\n \nif __name__ == "__main__":\n s = int(input())\n\n for m in range(0, 1000000): \n if s == 4:\n print(m + 3)\n break\n s = f(s)', 'def f(n):\n \n if n % 2 == 0:\n return int(n / 2)\n else:\n return 3 * n + 1\n \nif __name__ == "__main__":\n s = int(input())\n if s == 2 or s == 1:\n print(4)\n exit()\n for m in range(1, 1000000): \n if s == 4:\n print(m + 3)\n break\n s = f(s)'] | ['Wrong Answer', 'Accepted'] | ['s772090668', 's168149163'] | [2940.0, 3060.0] | [18.0, 18.0] | [302, 358] |
p03146 | u151625340 | 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]\ndef f(n):\n if n % 2 == 0:\n return(n//2)\n else:\n return(3*n+1)\n\nfor i in range(1000001):\n if f(a[i]) in a:\n print(i+1)\n break\n a.append(f(a[i])', 's = int(input())\n\na = [s]\ndef f(n):\n if n % 2 == 0:\n return(n//2)\n else:\n return(3*n+1)\n\nfor i in range(1000001):\n if f(a[i]) in a:\n print(i+1)\n break\n a.append(f(a[i])\n \n', 's = input()\na = [s]\ndef f(n):\n if n % 2 == 0:\n return(n//2)\n else:\n return(3*n+1)\ni = 0\nwhile True:\n if f(a[i]) in a:\n print(i+1)\n break\n a.append(f(a[i])\n i += 1\n', 's = int(input())\n\na = [s]\ndef f(n):\n if n % 2 == 0:\n return(n//2)\n else:\n return(3*n+1)\n\nfor i in range(1000001):\n if f(a[i]) in a:\n print(i+1)\n break\n a.append(f(a[i]))', 's = int(input())\n\na = [s]\ndef f(n):\n if n % 2 == 0:\n return(n//2)\n else:\n return(3*n+1)\n\nfor i in range(1000001):\n if f(a[i]) in a:\n print(i+2)\n break\n a.append(f(a[i]))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s136662214', 's544236479', 's731696742', 's962418567', 's792177179'] | [2940.0, 2940.0, 2940.0, 3060.0, 3060.0] | [18.0, 19.0, 17.0, 17.0, 17.0] | [208, 214, 206, 209, 209] |
p03146 | u158126367 | 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())\nk=[s]\ni = 1\nwhile 1:\n\tif k[-1]%2 == 0:\n \t\tx = int(k[-1]/2)\n\telse:\n \t\tx = 3*k[-1]+1\n if x in k:\n print(i+1)\n break\n else:\n k.append(x)\n i+=1', 's = int(input())\nk=[s]\ni = 1\nwhile 1:\n\tif k[-1]%2 == 0:\n \t\tx = int(k[-1]/2)\n\telse:\n \t\tx = 3*k[-1]+1\n if x in k:\n print(i+1)\n break\n else:\n k.append(x)\n i+=1', 's = int(input())\nk=[]\nk.append(s)\ni = 1\nwhile 1:\n\tif k[-1]%2 == 0:\n \t\tx = k[-1]/2\n\telse:\n \t\tx = 3*k[-1]+1\n if x in k:\n print(i+1)\n break\n else:\n k.append(x)\n i+=1', 's = int(input())\nk=[s]\ni = 1\nwhile 1:\n\tif k[-1]%2 == 0:\n \t\tx = int(k[-1]/2)\n\telse:\n \t\tx = int(3*k[-1]+1)\n if x in k:\n print(i+1)\n break\n else:\n k.append(x)\n i+=1', 's = int(input())\nans_list = [s]\ni = 1\nwhile 1:\n if ans_list[-1]%2 == 0:\n a = int(ans_list[-1]/2)\n else:\n a = 3 * ans_list[-1] + 1\n if a in ans_list:\n print(i+1)\n break\n else:\n ans_list.append(a)\n i += 1'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s371063796', 's541523140', 's683778736', 's978894824', 's532930238'] | [2940.0, 2940.0, 2940.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0, 17.0, 18.0] | [184, 192, 190, 189, 256] |
p03146 | u159335277 | 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())\ns = set()\ns.append(n)\ni = 1\nwhile True:\n i += 1\n if n % 2 == 0:\n n = n / 2\n else:\n n = 3 * n + 1\n if n in s:\n print(i)\n s.add(n)', 'n = int(input())\ns = set()\ns.add(n)\ni = 1\nwhile True:\n i += 1\n if n % 2 == 0:\n n = n / 2\n else:\n n = 3 * n + 1\n if n in s:\n print(i)\n break\n s.add(n)\n'] | ['Runtime Error', 'Accepted'] | ['s621881667', 's138795310'] | [2940.0, 2940.0] | [17.0, 17.0] | [159, 167] |
p03146 | u161201983 | 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())\nvals = []\nvals += [s]\nn=1\nwhile True:\n if vals[n-1]%2==0:\n val = vals[n-1]/2\n else:\n val = vals[n-1]*3+1\n \n if val in vals:\n print(val)\n break\n else:\n vals += [val]\n n += 1', 's = int(input())\nvals = []\nvals += [s]\nn=1\nwhile True:\n if vals[n-1]%2==0:\n val = vals[n-1]/2\n else:\n val = vals[n-1]*3+1\n \n if val in vals:\n print(len(vals)+1)\n break\n else:\n vals += [val]\n n += 1'] | ['Wrong Answer', 'Accepted'] | ['s830553801', 's470825153'] | [3060.0, 3060.0] | [18.0, 18.0] | [250, 258] |
p03146 | u163320134 | 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())\narr=[s]\ntmp=0\nfor i in range(m):\n if arr[i]%2==0:\n tmp=int(arr[i]/2)\n else:\n tmp=arr[i]*3+1\n if tmp in arr:\n print(i+1)\n break\n arr.append(tmp)\n ', 's=int(input())\narr=[s]\ntmp=0\nfor i in range(10**6+1):\n if arr[i]%2==0:\n tmp=int(arr[i]/2)\n else:\n tmp=arr[i]*3+1\n if tmp in arr:\n print(i+2)\n break\n arr.append(tmp)'] | ['Runtime Error', 'Accepted'] | ['s077384577', 's925039319'] | [2940.0, 3060.0] | [17.0, 17.0] | [177, 180] |
p03146 | u174386515 | 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 return 3*n+1\n\ns = int(input())\nans = 1\nused = set()\nwhile True:\n if s in used:\n break\n used.add(s)\n ans += 1\n s = f(s)\nprint(ans)', 'def f(n):\n if n%2 == 0:\n return n //2\n return 3*n+1\n\ns = int(input())\nans = 1\nused = set()\n\nwhile True:\n if s in used:\n break\n used.add(s)\n ans += 1\n s = f(s)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s368695545', 's303471635'] | [3056.0, 3060.0] | [18.0, 18.0] | [180, 251] |
p03146 | u180908266 | 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\nd = defaultdict(int)\na = int(input())\nd[a] += 1\n\nfor i in range(10**6):\n a = a//2 if (a%2 == 0) else a*3+1\n d[a] += 1\n if (d[a] > 1):\n print(i+2)\n print(d)\n break\n\n', 'from collections import defaultdict\nd = defaultdict(int)\na = int(input())\nd[a] += 1\n\nfor i in range(10**6):\n a = a//2 if (a%2 == 0) else a*3+1\n d[a] += 1\n if (d[a] > 1):\n print(i+2)\n break\n\n'] | ['Wrong Answer', 'Accepted'] | ['s206956276', 's989542333'] | [3316.0, 3316.0] | [20.0, 20.0] | [230, 213] |
p03146 | u183509493 | 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 = map(int,input().split())\ni = 1\nr = [s]\nwhile True:\n i += 1\n s = s // 2 if s % 2 == 0 else 3 * s + 1\n if s in r:\n print(i)\n break\n r += [s]', 's = int(input())\ni = 1\nr = [s]\nwhile True:\n i += 1\n s = s // 2 if s % 2 == 0 else 3 * s + 1\n if s in r:\n print(i)\n break\n r += [s]\n'] | ['Runtime Error', 'Accepted'] | ['s646030826', 's282082678'] | [3060.0, 2940.0] | [18.0, 18.0] | [152, 141] |
p03146 | u186838327 | 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 = str(input())\n\nfor i in range(1, len(s)):\n if s[i-1] == s[i]:\n print('Bad')\n exit()\nelse:\n print('Good')\n\n ", 's = int(input())\na = s\ni = 1\ns_ = set()\ns_.add(a)\nwhile True:\n i += 1\n if a%2 == 0:\n a = a//2\n else:\n a = 3*a+1\n if a in s_:\n print(i)\n exit()\n else:\n s_.add(a)'] | ['Wrong Answer', 'Accepted'] | ['s875541028', 's823280446'] | [2940.0, 3060.0] | [18.0, 18.0] | [118, 180] |
p03146 | u190178779 | 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\ns = int(input())\nif not ( 1 <= s <= 100 ): sys.exit()\narray = [s]\n\nfor I in range(1,10 ** 6 + 1):\n if array[ I - 1 ] % 2 == 0:\n if array[I - 1]//2 in array:\n print(I)\n sys.exit()\n array.append(array[(I - 1)]//2) \n else:\n if (3 * array[I - 1]) + 1 in array:\n print(I)\n sys.exit()\n array.append((3 * array[(I - 1)]) + 1)\n', 'import sys\ns = int(input())\nif not ( 1 <= s <= 100 ): sys.exit()\narray = [s]\n\nfor I in range(1,10 ** 6 + 1):\n print(array)\n if array[ I - 1 ] % 2 == 0:\n if array[I - 1]//2 in array:\n print(I)\n sys.exit()\n array.append(array[(I - 1)]//2) \n else:\n if (3 * array[I - 1]) + 1 in array:\n print(I)\n sys.exit()\n array.append((3 * array[(I - 1)]) + 1)\n', 'import sys\ns = int(input())\nif not ( 1 <= s <= 100 ): sys.exit()\narray = [s]\n\nfor I in range(1,10 ** 6 + 1):\n if array[ I - 1 ] % 2 == 0:\n if array[I - 1]//2 in array:\n print(I + 1)\n sys.exit()\n array.append(array[(I - 1)]//2) \n else:\n if (3 * array[I - 1]) + 1 in array:\n print(I + 1)\n sys.exit()\n array.append((3 * array[(I - 1)]) + 1)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s447053305', 's795867883', 's380713414'] | [9200.0, 9176.0, 9204.0] | [22.0, 28.0, 24.0] | [412, 429, 420] |
p03146 | u204616996 | 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\nd = defaultdict(int)\nimport sys\nsys.setrecursionlimit(10**8)\ndef f(n,i):\n d[n]+=1\n if d[n]==2:\n return i\n if n%2==0:\n x=n//2\n else:\n x=3*n+1\n return f(x,i+1)\nprint(f(int(input()),0))', 'from collections import defaultdict\nd = defaultdict(int)\nimport sys\nsys.setrecursionlimit(10**8)\ndef f(n,i):\n if n%2==0:\n x=n//2\n else:\n x=3*n+1\n d[x]+=1\n if d[x]==2:\n return i+1\n f(x,i+1)\nprint(f(int(input()),0))', 'from collections import defaultdict\nd = defaultdict(int)\nimport sys\nsys.setrecursionlimit(10**8)\ndef f(n,i):\n d[n]+=1\n if d[n]==2:\n return i\n if n%2==0:\n x=n//2\n else:\n x=3*n+1\n return f(x,i+1)\nprint(f(int(input()),1))\n\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s306786556', 's964639064', 's178616510'] | [3316.0, 3316.0, 3316.0] | [20.0, 20.0, 20.0] | [232, 227, 234] |
p03146 | u207747871 | 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())\nx = set(n)\ncnt = 1\n\nwhile True:\n \n cnt += 1\n \n if n%2 == 0:\n n //=2\n \n else:\n n = n * 3 + 1\n\n if n in x:\n print(cnt)\n break\n else:\n x.add(n)', 'n = int(input())\nx = set(n)\ncnt = 1\n\nwhile True:\n \n cnt += 1\n \n if n%2 == 0:\n n //=2\n \n else:\n n = n * 3 + 1\n\n if n in x:\n print(cnt)\n exit()\n else:\n x.add(n)', 'n = int(input())\nx = set()\ncnt = 1\nx.add(n)\n\nwhile True:\n \n cnt += 1\n \n if n%2 == 0:\n n /=2\n \n else:\n n = n * 3 + 1\n\n if n in x:\n print(cnt)\n break\n else:\n x.add(n)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s193475704', 's950452815', 's375013639'] | [2940.0, 2940.0, 2940.0] | [18.0, 18.0, 17.0] | [220, 221, 227] |
p03146 | u209619667 | 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())\np = A\ncount = 0\nif A = 1:\n count == 0\nelse:\n count =2\nwhile A != 1:\n if A % 2 == 0:\n A = A // 2\n count = count + 1\n else:\n A = A * 3 + 1\n count = count + 1\nprint(count)', 'A = int(input())\ncount = 1\nwhile A != 1:\n if A % 2 == 0:\n A = A // 2\n count = count + 1\n else:\n A = A * 3 + 1\nprint(count)', 'A = int(input())\np = A\nC = []\nwhile A not in C:\n C.append(A)\n if A % 2 == 0:\n A = A//2\n else:\n A = A*3+1\nprint(len(C)+1)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s543668029', 's979919505', 's938685033'] | [2940.0, 2940.0, 2940.0] | [16.0, 17.0, 17.0] | [201, 133, 129] |
p03146 | u220345792 | 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()\nl = []\n\nwhile flag=False:\n if tmp in l:\n flag = True\n else:\n if s % 2 == 0:\n tmp = s / 2\n l.append(tmp)\n s = tmp\n else:\n tmp = 3*s +1\n l.append(tmp)\n s = tmp\n \nl.sort()\nprint(l[-2])', 's = int(input())\nl = []\nflag = False\ncnt = 0\ntmp = 0\nwhile flag==False:\n if tmp in l:\n cnt += 1\n flag = True\n else:\n if s % 2 == 0:\n tmp = s / 2\n l.append(s)\n s = tmp\n cnt += 1\n else:\n tmp = 3*s +1\n l.append(s)\n s = tmp\n cnt += 1\n \nprint(cnt)\n\n'] | ['Runtime Error', 'Accepted'] | ['s179078929', 's302613691'] | [2940.0, 3060.0] | [17.0, 18.0] | [239, 303] |
p03146 | u224554402 | 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())\na_list = [a]\nb = 0\nfor i in range(1000001):\n print(a_list)\n \n if a_list[i] % 2== 0:\n b = int((a_list[i])/2)\n if b in a_list:\n print(i+2)\n break\n else:\n a_list.append(b)\n else:\n b = 3 * a_list[i] + 1\n if b in a_list:\n print(i+2)\n break\n else:\n a_list.append(b)', 'a = int(input())\na_list = [a]\nb = 0\nfor i in range(1000001):\n \n \n if a_list[i] % 2== 0:\n b = int((a_list[i])/2)\n if b in a_list:\n print(i+2)\n break\n else:\n a_list.append(b)\n else:\n b = 3 * a_list[i] + 1\n if b in a_list:\n print(i+2)\n break\n else:\n a_list.append(b)'] | ['Wrong Answer', 'Accepted'] | ['s272687349', 's907675911'] | [3064.0, 3060.0] | [18.0, 18.0] | [396, 383] |
p03146 | u227082700 | 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());ans=1\nwhile s==4:\n ans+=1\n if s%2==0:s//=2\n else:s=s*3+1\nprint(ans+3)', 'n=int(input())\ni=1\ns=set()\nwhile n not in s:\n s.add(n)\n i+=1\n if n%2:n=3*n+1\n else:n//=2\nprint(i)'] | ['Wrong Answer', 'Accepted'] | ['s392141042', 's294331496'] | [2940.0, 2940.0] | [18.0, 17.0] | [87, 101] |
p03146 | u227170240 | 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())\nmemo = [-1]\nmemo.append(s)\ndef a(n):\n if memo[n-1] % 2 == 0:\n pre = memo[n-1]/2\n for i in memo:\n if i == pre:\n return n\n else:\n memo.append(pre)\n return a(n+1)\n else:\n pre = 3 * memo[n-1] + 1\n for i in memo:\n if i == pre:\n return n\n else:\n memo.append(pre)\n return a(n+1)\n\nprint(a(2))', 's = int(input())\nmemo = [-1]\nmemo.append(s)\ndef a(n):\n if memo[n-1] % 2 == 0:\n pre = memo[n-1]/2\n for i in memo:\n if i == pre:\n return n\n memo.append(pre)\n return a(n+1)\n else:\n pre = 3 * memo[n-1] + 1\n for i in memo:\n if i == pre:\n return n\n memo.append(pre)\n return a(n+1)\n\nprint(a(2))'] | ['Runtime Error', 'Accepted'] | ['s747727439', 's756322545'] | [3980.0, 3060.0] | [77.0, 18.0] | [469, 401] |
p03146 | u230621983 | 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())\ntmp=[s]\nfor m in range(2,1000000):\n if tmp[-1]%2 == 0:\n if tmp[-1]/2 in tmp:\n print(tmp, m)\n exit()\n else:\n tmp.append(tmp[-1]/2)\n else:\n if 3*tmp[-1]+1 in tmp:\n print(tmp, m)\n exit()\n else:\n tmp.append(3*tmp[-1]+1)', 's=int(input())\ntmp=[s]\nfor m in range(2,1000000):\n if tmp[-1]%2 == 0:\n if tmp[-1]/2 in tmp:\n print(m)\n exit()\n else:\n tmp.append(tmp[-1]/2)\n else:\n if 3*tmp[-1]+1 in tmp:\n print(m)\n exit()\n else:\n tmp.append(3*tmp[-1]+1)'] | ['Wrong Answer', 'Accepted'] | ['s514169771', 's053390033'] | [3188.0, 3060.0] | [19.0, 17.0] | [274, 264] |
p03146 | u234189749 | 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\nwhile True:\n ans = +1\n s = (s/2 if s%2==0 else 3*s+1)\n if s in A:\n break\n A.append(s)\n\nprint(ans+1)', 's = int(input())\nA = [s]\nans = 1\nwhile True:\n ans +=1\n s = (s/2 if s%2==0 else 3*s+1)\n if s in A:\n break\n A.append(s)\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s319659100', 's715422027'] | [2940.0, 2940.0] | [18.0, 17.0] | [151, 148] |
p03146 | u238948075 | 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\nf = [s]\n\nfor i in range(100000):\n if f[i] % 2 == 0:\n s /= 2\n else:\n s = 3 * s + 1\n if s in f:\n print(i)\n break\n else:\n f.append(s)\n', 's = int(input())\n\nf = [s]\n\nfor i in range(100000):\n if f[i] % 2 == 0:\n s /= 2\n else:\n s = 3 * s + 1\n if s in f:\n print(i + 2)\n break\n else:\n f.append(s)\n'] | ['Wrong Answer', 'Accepted'] | ['s635694931', 's114203253'] | [2940.0, 2940.0] | [17.0, 17.0] | [196, 200] |
p03146 | u242196904 | 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())\nss = set()\nss.add(s)\nk = 1\nwhile True:\n if s%2 == 0:\n s = s/2\n else:\n s = 3*s + 1\n s = int(s)\n if s in ss:\n# print(s,s)\n break\n ss.add(s)\n# print(s)\n k+=1\n print(s)\nprint(k+1)', 's = int(input())\nss = set()\nss.add(s)\nk = 1\nwhile True:\n if s%2 == 0:\n s = s/2\n else:\n s = 3*s + 1\n s = int(s)\n if s in ss:\n# print(s,s)\n break\n ss.add(s)\n# print(s)\n k+=1\n# print(s)\nprint(k+1)'] | ['Wrong Answer', 'Accepted'] | ['s818983264', 's606175310'] | [3060.0, 3060.0] | [17.0, 17.0] | [246, 248] |
p03146 | u243572357 | 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). | ['lst = []\ns = int(input())\n\nwhile s not in lst:\n lst.append(s)\n if lst[-1] % 2 == 0:\n s = lst[-1] // 2\n else:\n s = 3 * lst[-1] + 1\nprint(len(lst) + 2)', 's = int(input())\nl = []\nwhile s not in l:\n l.append(s)\n if s%2 == 0:\n s = s//2\n else:\n s = 3*s + 1\nprint(len(l))', 'lst = []\ns = int(input())\n\nwhile s not in lst:\n lst.append(s)\n if lst[-1] % 2 == 0:\n s = lst[-1] // 2\n else:\n s = 3 * lst[-1] + 1\nprint(len(lst) + 1)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s524907180', 's729164550', 's463355197'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [158, 121, 159] |
p03146 | u248670337 | 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 1):\n l.append(s)\n if s%2==0:s//=2\n else:s=s*3+1\nprint(len(l)+1)', 's=int(input())\nl=[]\nwhile(S not in 1):\n l.append(s)\n if s%2==0:s//=2\n else: s=s*3+1\nprint(len(l)+1)', 's=int(input())\nl=[]\nwhile(s not in 1):\n l.append(s)\n if s%2==0:s//=2\n else:s=s*3+1\nprint(len(l)+1)', 's=int(input())\nl=[]\nwhile(S not in 1):\n l.append(s)\n if s%2==0:s//=2\n else s=s*3+1\nprint(len(l)+1)', 's=int(input())\nl=[]\nwhile(s not in l):\n l.append(s)\n if s%2==0:s//=2\n else:s=s*3+1\nprint(len(l)+1)\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s234121216', 's292989937', 's301570844', 's824819872', 's519188221'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0, 17.0] | [101, 102, 101, 101, 102] |
p03146 | u252828980 | 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())\n\nli = []\nfor i in range(200):\n if n%2 == 0:\n n//=2\n li.append(n)\n if len(li) != len(set(li)):\n print(len(li))\n exit()\n else:\n n = 3*n+1\n li.append(n)\n if len(li) != len(set(li)):\n print(len(li))\n exit()', 'n = int(input())\ncnt = 0\nif n == 1:\n print(4)\n exit()\nif n == 2:\n print(4)\n exit()\nif n == 4:\n print(4)\n exit()\nwhile n != 4:\n if n%2 == 0:\n n = n//2\n cnt += 1\n else:\n n = 3*n+1\n cnt += 1\nprint(cnt+4)'] | ['Wrong Answer', 'Accepted'] | ['s360832227', 's984920650'] | [3316.0, 3064.0] | [24.0, 18.0] | [311, 252] |
p03146 | u253952966 | 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 col(a):\n if a % 2 == 0:\n return a//2\n else:\n return a*3 + 1\n\ns = int(input())\n\nan = [a]\ni = 1\nwhile True:\n i += 1\n an_1 = col(an[-1])\n if an_1 in an:\n break\n an.append(an_1)\n\nprint(i)', 'def col(a):\n if a % 2 == 0:\n return a//2\n else:\n return a*3 + 1\n\ns = int(input())\n\nan = [a]\ni = 1\nwhile True:\n i += 1\n an_1 = col(a)\n if an_1 in an:\n break\n an.append(an_1)\n\nprint(i)', 'def col(a):\n if a % 2 == 0:\n return a//2\n else:\n return a*3 + 1\n\ns = int(input())\n\nan = [s]\ni = 1\nwhile True:\n i += 1\n an_1 = col(an[-1])\n if an_1 in an:\n break\n else:\n an.append(an_1)\n\nprint(i)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s125535719', 's469602762', 's150653214'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [202, 197, 212] |
p03146 | u262084284 | 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\ns = int(input())\n\ni = 0\nwhile n > 0:\n if n % 2 = 0:\n n = n / 2\n else:\n n = 3n+1\n if n == 4:\n break\n else:\n i += 1\n\nprint(i+4)', '# coding: utf-8\n\ns = int(input())\n\ni = 0\nwhile n > 0:\n if n % 2 == 0:\n n = n / 2\n else:\n n = 3n+1\n if n == 4:\n break\n else:\n i += 1\n\nprint(i+4)', '# coding: utf-8\n\nn = int(input())\n\ni = 1\nwhile n > 0:\n if n == 4 or n == 2 or n == 1:\n break\n i += 1\n if n % 2 == 0:\n n = n / 2\n else:\n n = n*3+1\n\nprint(i+3)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s186083785', 's497456434', 's327811552'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [182, 183, 190] |
p03146 | u262801165 | 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 || s == 2:\n print(4)\nelif:\n for i in range(1000000):\n if s == 4:\n print(i + 4)\n break\n\n \n if s % 2 == 0:\n s = s / 2\n else:\n s = 3 * s + 1\n \n \n\n\n\n\n\n\n\n \n\n', 's = int(input())\n\nif s == 1 or s == 2:\n print(4)\nelif:\n for i in range(1000000):\n if s == 4:\n print(i + 4)\n break\n\n \n if s % 2 == 0:\n s = s / 2\n else:\n s = 3 * s + 1\n \n \n\n\n\n\n\n\n\n \n\n', 's = int(input())\n\nif s == 1 or s == 2:\n print(4)\nelse:\n for i in range(1000000):\n if s == 4:\n print(i + 4)\n break\n\n \n if s % 2 == 0:\n s = s / 2\n else:\n s = 3 * s + 1\n \n \n\n\n\n\n\n\n\n \n\n'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s679080222', 's896886822', 's055305669'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [279, 279, 279] |
p03146 | u266171694 | 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())\nres = [s]\nidx = 1\n\nwhile True:\n if s % 2 == 0:\n s = s / 2\n else:\n s = 3 * s + 1\n \n res.append(s)\n \n if s in res:\n print(idx)\n break\n \n idx += 1', 's = int(input())\nres = [s]\nidx = 1\n\nwhile True:\n if s % 2 == 0:\n s = s / 2\n else:\n s = 3 * s + 1\n \n if s in res:\n print(idx)\n break\n \n res.append(s)\n idx += 1', 's = int(input())\na = [s]\n\nfor i in range(2, 1000001):\n if s % 2 == 0:\n s = s / 2\n else:\n s = 3 * s + 1\n \n if s in a:\n print(i)\n break\n \n s.append(s)', 's = int(input())\na = [s]\n\nfor i in range(2, 1000001):\n if s % 2 == 0:\n s = s / 2\n else:\n s = 3 * s + 1\n \n if s in a:\n print(i)\n break\n \n a.append(s)'] | ['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s200782470', 's384422163', 's867849311', 's771307937'] | [2940.0, 3060.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 18.0] | [183, 178, 167, 167] |
p03146 | u278356323 | 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). | ['# ABC116b\nimport sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**6)\n\ns = 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\na = [0, s]\n\nfor i in range(2, 10**6):\n num = f(a[i-1])\n a.append(num)\n idx = a.index(num)\n print(a)\n if(idx+1 < i):\n print(i)\n exit()', '# ABC116b\nimport sys\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**6)\n\ns = 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\na = [0, s]\n\nfor i in range(2, 10**6):\n num = f(a[i-1])\n a.append(num)\n idx = a.index(num)\n #print(a)\n if(idx+1 < i):\n print(i)\n exit()'] | ['Wrong Answer', 'Accepted'] | ['s200642665', 's396473484'] | [3064.0, 3064.0] | [18.0, 18.0] | [342, 343] |
p03146 | u278670845 | 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())\na = n\nb = 0\ni = 1\nwhile True:\n if a%2==0:\n b = n//2\n else:\n b = 3*n+1\n i+=1\n a = b\n if b ==4:\n break\nprint(i)', 'n = int(input())\na = n\nb = 0\ni = 1\nwhile True:\n if a%2==0:\n b = a//2\n else:\n b = 3*a+1\n i+=1\n a = b\n if b ==4:\n break\nprint(i)', 'import sys\nn = int(input())\nif n==4:\n print(4)\n sys.exit()\nelif n==2:\n print(4)\n sys.exit()\nelif n==1:\n print(4)\n sys.exit()\na = n\nb = 0\ni = 1\nwhile True:\n if a%2==0:\n b = a//2\n else:\n b = 3*a+1\n i+=1\n a = b\n # print(a)\n if b ==4:\n break\nprint(i+3)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s137342106', 's710001587', 's661014558'] | [2940.0, 2940.0, 3064.0] | [2104.0, 17.0, 17.0] | [140, 140, 305] |
p03146 | u278886389 | 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\n\ns = int(input())\n\nA = defaultdict(int)\n\nn = 1\nwhile True:\n if A[s]:\n print(A[s])\n exit()\n A[s] = n\n if s % 2:\n s = 3 * s + 1\n else:\n s //= 2\n n += 1\n ', 'from collections import defaultdict\n\ns = int(input())\n\nA = defaultdict(int)\n\nn = 1\nwhile True:\n if A[s]:\n print(n)\n exit()\n A[s] = n\n if s % 2:\n s = 3 * s + 1\n else:\n s //= 2\n n += 1\n '] | ['Wrong Answer', 'Accepted'] | ['s944048543', 's259891243'] | [3316.0, 3316.0] | [21.0, 21.0] | [205, 202] |
p03146 | u284363684 | 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). | ['# input\ns = int(input())\n\n\nfn = {1: s}\nlim = 1000001\nfor m in range(2, lim):\n if m - 1 % 2 == 0:\n fn[m] = fn[m - 1] // 2\n else:\n fn[m] = 3 * fn[m - 1] + 1\n \n if s not in fn.keys():\n continue\n else:\n if fn[m] == fn[s]:\n print(m)\n break', '# input\ns = int(input())\n\n\nfn = {1: s}\nlim = 1000001\nfs = None\nfor m in range(2, lim):\n if m % 2 == 0:\n fn[m] = fn[m - 1] // 2\n else:\n fn[m] = 3 * fn[m - 1] + 1\n\n print(m, fn[m])\n\n if not fs and m == s: \n fs = fn[m]\n \n if fs in [fn[k] for k in fn.keys() if k != s]:\n print(m)\n break', '# input\ns = int(input())\n\n\nfn = [s] + ([-1] * 999999)\nlim = 1000001\nfs = None\nfor m in range(2, lim):\n if m % 2 == 0:\n fn[m] = fn[m - 1] // 2\n else:\n fn[m] = 3 * fn[m - 1] + 1\n\n print(m, fn[m])\n\n if not fs and m == s:\n fs = fn[m]\n\n if fs in (fn[:s] + fn[s + 1:m]):\n print((fn[:s] + fn[s + 1:m]).index(fs))\n break', '# input\ns = int(input())\n\n\nfn = [s] + ([-1] * 999999)\nlim = 1000001\nfs = None\nfor m in range(2, lim):\n if m % 2 == 0:\n fn[m] = fn[m - 1] // 2\n else:\n fn[m] = 3 * fn[m - 1] + 1\n\n if not fs and m == s:\n fs = fn[m]\n\n if fs in (fn[:s] + fn[s + 1:m]):\n print((fn[:s] + fn[s + 1:m]).index(fs))\n break', '# input\ns = int(input())\n\n\nlim = 1000001\nfn = [-1] * lim \nfn[1] = s\nfor m in range(2, lim):\n if m % 2 == 0:\n fn[m] = fn[m - 1] // 2\n else:\n fn[m] = 3 * fn[m - 1] + 1\n\n if fn[m] in fn[1:m]:\n print(fn[1:m].index(fn[m]))\n break', '# input\ns = int(input())\n\n\nlim = 1000001\n\n\n\nif s == 1 or s == 2:\n print(4)\nelse:\n\n c4 = 0\n c = 1\n for m in range(2, lim):\n \n if s == 4:\n c4 += 1\n\n \n if c4 == 2:\n print(c)\n exit()\n\n \n if s % 2 == 0:\n s //= 2\n else:\n s = 3 * s + 1\n\n \n c += 1'] | ['Wrong Answer', 'Time Limit Exceeded', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s042368539', 's264627663', 's276013837', 's330368421', 's365389230', 's838575150'] | [2053524.0, 6888.0, 18676.0, 18676.0, 15348.0, 3060.0] | [2252.0, 2104.0, 2104.0, 2104.0, 2104.0, 17.0] | [306, 342, 369, 348, 268, 591] |
p03146 | u299869545 | 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())\nans = 1\nnums = set()\nwhile s not in nums:\n ans += 1\n if s % 2 == 0: s // = 2\n else: s = s * 3 + 1\n nums.add(s)\nprint(ans)\n', 's = int(input())\nans = 1\nnums = set()\nwhile s not in nums:\n ans += 1\n nums.add(s)\n if s % 2 == 0: s //= 2\n else: s = s * 3 + 1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s316036992', 's861399300'] | [2940.0, 2940.0] | [17.0, 17.0] | [143, 149] |
p03146 | u302292660 | 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())]\ndef fc(n):\n if n%2:\n p = 3*n+1\n else:\n p = n//2\n return p\n\nfor i in range(1000000):\n f = fc(a[i])\n if f in a:\n m = i+2\n break\n else:\n a.append(f)\n print(a)\nprint(m)', 'a = [int(input())]\ndef fc(n):\n if n%2:\n p = 3*n+1\n else:\n p = n//2\n return p\n\nfor i in range(1000000):\n f = fc(a[i])\n if f in a:\n m = i+2\n break\n else:\n a.append(f)\nprint(m)'] | ['Wrong Answer', 'Accepted'] | ['s508344672', 's416515418'] | [3060.0, 2940.0] | [18.0, 17.0] | [243, 226] |
p03146 | u305965165 | 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())\n\nnum_list = [a]\ninit_flag = True\nwhile True:\n\tnum = num_list[-1]\n\tif num%2 == 0:\n\t\tnew_num = int(num/2)\n\telse:\n\t\tnew_num = int(3*num+1)\n\n\tif not init_flag and new_num in num_list:\n\t\tprint(num_list.index(num))\n\t\tbreak\n\tnum_list.append(new_num)\n\tinit_flag = False\n\tprint(num_list)', 'a = int(input())\n\nnum_list = [a]\ninit_flag = True\nresult = 1\nwhile True:\n\tresult += 1\n\tnum = num_list[-1]\n\tif num%2 == 0:\n\t\tnew_num = int(num/2)\n\telse:\n\t\tnew_num = int(3*num+1)\n\n\tif not init_flag and new_num in num_list:\n\t\t#print(num_list.index(num))\n\t\tprint(result)\n\t\tbreak\n\tnum_list.append(new_num)\n\tinit_flag = False\n\t'] | ['Wrong Answer', 'Accepted'] | ['s620822457', 's876484365'] | [3060.0, 3060.0] | [18.0, 18.0] | [295, 321] |
p03146 | u306070611 | 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())\nansli = [s]\nflg = True\ncnt = 2\ndef f(n):\n if n%2 == 0:\n return int(n/2)\n else:\n return (3*n)-1\nwhile flg:\n cur = f(cnt)\n if cur in ansli:\n print(cnt)\n flg = False\n else:\n ansli.append(cur)\n cnt += 1', 's = int(input())\nansli = [s]\nflg = True\ncnt = 2\ndef f(n):\n if n%2 == 0:\n return int(n/2)\n else:\n return (3*n)+1\ncnt = 2\ncur = s\nwhile flg:\n cur = f(cur)\n if cur in ansli:\n print(cnt)\n flg = False\n else:\n ansli.append(cur)\n cnt += 1'] | ['Wrong Answer', 'Accepted'] | ['s782668277', 's995483890'] | [3060.0, 3064.0] | [17.0, 17.0] | [272, 288] |
p03146 | u309018392 | 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())\nans = 1\nfor i in range(10**6):\n ans += 1\n if s%2==0:\n s = s/2\n else:\n s = 3*s+1\n \n if s == 1:\n break\nif s==1 or s==2:\n print(ans)\nelse:\n print(ans+1)', 's = int(input())\nans = 1\nl = []\nfor i in range(10**6):\n ans += 1\n l.append(s)\n \n if s%2==0:\n s = s/2\n else:\n s = 3*s+1\n \n if s in l:\n break\n \nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s055647274', 's896565239'] | [2940.0, 2940.0] | [17.0, 18.0] | [212, 202] |
p03146 | u310549140 | 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())\nif s==1:\n print(4)\nelif s==2:\n print(4)\nelse:\n print(func(s))', 'def func(n):\n count = 1\n while(n!=4):\n if n%2==0:\n n = n // 2\n else:\n n = 3*n + 1\n count += 1\n return count + 3\n\n\ns = int(input())\nif s==1:\n print(4)\nelif s==2:\n print(4)\nelse:\n print(func(s))'] | ['Runtime Error', 'Accepted'] | ['s859436307', 's675748787'] | [2940.0, 3060.0] | [17.0, 17.0] | [87, 253] |
p03146 | u313498252 | 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 copy\n\nn = int(input())\nh = []\nfor i in range(n):\n h.append(int(input()))\n\nh = h.sort()\n\ncnt = 1\nnow = copy.deepcopy(h[0])\nh.pop(0)\n\nwhile not len(h) == 0:\n if h[0] != now:\n cnt += 1\n now = copy.deepcopy(h[0])\n h.pop(0)', 's = int(input())\n\ndef func(n):\n if n % 2 == 0:\n return n / 2\n else:\n return 3 * n + 1\n\na = {}\na[1] = s\n\ni = 2\nwhile True:\n tmp = func(a[i-1])\n if tmp in a.values():\n print(i)\n break\n else:\n a[i] = tmp\n i += 1'] | ['Runtime Error', 'Accepted'] | ['s566333519', 's717134027'] | [3444.0, 3060.0] | [26.0, 17.0] | [248, 265] |
p03146 | u316603606 | 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 = []\na = 0\nl.append (s)\nfor i in range (1000000):\n a += 1\n if s%2 == 0:\n s = round(s/2)\n else:\n s = s*3+1\n if l.count (s) != 0:\n print (a+1)\n break\n \n', 's = int (input ())\nl = []\na = 0\nl.append (s)\nwhile True:\n a += 1\n if s%2 == 0:\n s = round(s/2)\n else:\n s = s*3+1\n if l.count (s) != 0:\n print (a+1)\n break\n ', 's = int (input ())\nl = []\na = 0\nl.append (s)\nfor i in range (1000000):\n a += 1\n if s%2 == 0:\n s = round(s/2)\n else:\n s = s*3+1\n if l.count (s) != 0:\n print (a+1)\n break\n else:\n l.append (s)'] | ['Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s044957575', 's174381795', 's329430090'] | [8928.0, 9024.0, 9092.0] | [339.0, 2206.0, 28.0] | [188, 173, 209] |
p03146 | u318127926 | 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 = 1\nwhile s>1:\n if s%2==0:\n s //= 2\n else:\n s = 3*s+1\n i += 1\nif s>2:\n print(i+1)\nelse:\n print(4)', 's = int(input())\nif s<=2:\n print(4)\nelse:\n i = 1\n while s>1:\n if s%2==0:\n s //= 2\n else:\n s = 3*s+1\n i += 1\n print(i+1)'] | ['Wrong Answer', 'Accepted'] | ['s975472078', 's133214461'] | [2940.0, 2940.0] | [17.0, 17.0] | [145, 174] |
p03146 | u330314953 | 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())\nl = [int(i) for i in input().split()]\nif 2 * max(l) - sum(l) < 0:\n print("Yes")\nelse:\n print("No")', 's = int(input())\na = [s]\ni = 1\nwhile True :\n if a[i-1] % 2 == 0:\n t = int((a[i-1])/2)\n else:\n t = int((a[i-1])*3+1)\n \n i +=1 \n \n if t in a:\n print(i)\n break \n a.append(t)'] | ['Runtime Error', 'Accepted'] | ['s044120129', 's938979168'] | [2940.0, 3060.0] | [18.0, 18.0] | [121, 224] |
p03146 | u332793228 | 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:\n s//=2\n else:\n s=3*s+1\nprint(l)\nprint(len(l)+1)', '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'] | ['s394857280', 's623814652'] | [2940.0, 2940.0] | [17.0, 17.0] | [135, 126] |
p03146 | u339550873 | 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). | ['#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\n\ns = int(input())\n\nls =[s]\nwhile True:\n if ls[-1] % 2 ==0:\n a = ls[-1]/2\n else:\n a = ls[-1]*3 + 1\n if a in ls:\n break\n else:\n ls.append(a)\n\nprint(lsn(ls))\n\n', '#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\n\ns = int(input())\n\nls =[s]\nwhile True:\n if ls[-1] % 2 ==0:\n a = int(ls[-1]/2)\n else:\n a = int(ls[-1]*3 + 1)\n \n if a in ls:\n break\n else:\n ls.append(a)\n\nprint(len(ls))\n\n', '#! /usr/bin/env python3\n# -*- coding: utf-8 -*-\n\ns = int(input())\n\nls =[s]\nwhile True:\n if ls[-1] % 2 ==0:\n a = int(ls[-1]/2)\n else:\n a = int(ls[-1]*3 + 1)\n \n if a in ls:\n break\n else:\n ls.append(a)\n\nprint(len(ls)+1)\n\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s262779834', 's550651098', 's698213029'] | [2940.0, 2940.0, 2940.0] | [18.0, 18.0, 18.0] | [244, 259, 261] |
p03146 | u353652911 | 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). | ['x=[int(input())]\n\nif x[0]==8:\n print(4)\nelse:\n for i in range(1,1000000):\n if x[-1]==8:\n print(i+4)\n exit()\n \n elif x[i-1]%2==0:\n x.append(int(x[i-1]/2))\n else: \n x.append(int(x[i-1]*3+1))', 's=int(input())\nl=[s]\nfor i in range(1000001):\n if s%2==0:\n s=s//2\n else:\n s=3*s+1\n if s in l:\n print(i+2)\n break\n l.append(s) '] | ['Wrong Answer', 'Accepted'] | ['s298323160', 's710487073'] | [10900.0, 2940.0] | [556.0, 17.0] | [262, 169] |
p03146 | u357630630 | 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())\na = [n]\ncount = 0\nwhile 1:\n if n % 2 == 0:\n a.append(int(n/2))\n n = n/2\n else:\n a.append(int(3*n + 1))\n n = 3*n + 1\n if a[count-1] == 1 and a[count] == 4:\n break\n count += 1\nif n==1 or n==2:\n print(4)\nelse:\n print(count+1)', 'n = int(input())\na = []\ncount = 0\nwhile 1:\n if a.count(n):\n print(count+1)\n break\n else:\n a.append(n)\n count += 1\n if n % 2 == 0:\n n = n/2\n else:\n n = 3*n + 1\n'] | ['Wrong Answer', 'Accepted'] | ['s141225794', 's654686785'] | [3060.0, 2940.0] | [17.0, 18.0] | [292, 213] |
p03146 | u362563655 | 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=[]\ncount = 2\n\nwhile s not in l:\n l.append(s)\n count+=1\n if s % 2 == 0:\n s = s//2\n else:\n s = 3*s+1\n\nprint(count)', 's = int(input())\n\nif s == 2:\n print(4)\nelif s == 4:\n print(4)\nelif s == 1:\n print(4)\nelse:\n count = 2\n while s > 1:\n \tcount+=1\n \tif s % 2 == 0:\n \ts = s//2\n \telse:\n \ts = 3*s+1\n print(count)', 's = int(input())\nl=[]\ncount = 1\n\nwhile s not in l:\n l.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', 'Runtime Error', 'Accepted'] | ['s079267581', 's153794400', 's354730626'] | [2940.0, 2940.0, 2940.0] | [18.0, 17.0, 17.0] | [141, 203, 142] |
p03146 | u368796742 | 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 = []\nl.append(s)\ncount = 1\nwhile True:\n if count%2 == 1:\n a = l[-1]*3+1\n else:\n a = l[-1]//2\n \n count += 1\n if a in l:\n print(count)\n exit()\n else:\n l.append(a)', 's = int(input())\nl = []\nl.append(s)\ncount = 1\nwhile True:\n if l[-1]%2 == 1:\n a = l[-1]*3+1\n else:\n a = l[-1]//2\n \n count += 1\n if a in l:\n print(count)\n exit()\n else:\n l.append(a)\n'] | ['Time Limit Exceeded', 'Accepted'] | ['s531201390', 's827437216'] | [9332.0, 2940.0] | [2108.0, 17.0] | [202, 203] |
p03146 | u371467115 | 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\nwhile len(a)==len(set(a)):\n if a[i-1]%2=0:\n a.append(a[i-1]//2)\n else:\n a.append(a[i-1]*3+1)\n i+=1\nprint(i)', 's=int(input())\na=[s]\ni=1\nwhile len(a)==len(set(a)):\n if a[i-1]%2==0:\n a.append(a[i-1]//2)\n else:\n a.append(a[i-1]*3+1)\n i+=1\nprint(i)'] | ['Runtime Error', 'Accepted'] | ['s279695410', 's647596165'] | [2940.0, 3060.0] | [18.0, 17.0] | [141, 142] |
p03146 | u372923276 | 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 = map(int,input().split())\nmlist = list(map(int,input().split()))\n\ni=0\nwhile(True):\n i=i+1\n if mlist[i] % 2 == 0:\n mlist.append(mlist[i]/2)\n else:\n mlist.append(3*mlist[i]+1)\n for item in range(1,i):\n if mlist[0]==item:\n break\nprint(i)\n', 'n = map(int,input().split())\n#xlist = list(map(int,input().split()))\n\nmlist=[n]\ni=0\nwhile(True):\n i=i+1\n if n % 2 == 0:\n mlist.append(n/2)\n else:\n mlist.append(3*n+1)\n for item in mlist:\n if mlist[0]==item:\n break\n\nprint(i)\n', '#n = map(int,input().split())\nmlist = list(map(int,input().split()))\n\ni=0\nwhile(True):\n\n if mlist[i] % 2 == 0:\n mlist.append(mlist[i]/2)\n else:\n mlist.append(3*mlist[i]+1)\n print(mlist[i+1])\n i=i+1\n \n if int(mlist[0])==int(mlist[i]):\n break\n \nprint(i)\n', '#n = map(int,input().split())\nmlist = list(map(int,input().split()))\n\ni=0\nwhile(True):\n if mlist[i] % 2 == 0:\n mlist.append(mlist[i]/2)\n else:\n mlist.append(3*mlist[i]+1)\n \n breakFlg = False\n for num in range(0,i):\n if int(mlist[num])==int(mlist[i]):\n if num!=i:\n breakFlg = True\n i=i+1\n if(breakFlg):\n break\nprint(i)\n'] | ['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s108579336', 's183484438', 's269414444', 's882093692'] | [2940.0, 2940.0, 39752.0, 3060.0] | [18.0, 18.0, 2107.0, 20.0] | [283, 268, 294, 393] |
p03146 | u375616706 | 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 = []\na.append(s)\ncount = 0\nwhile True:\n count+=1\n if s %2 == 0:\n s=s//2\n else:\n s= 3*s+1\n if s in a:\n print(count)\n break\n a.append(s)\nprint(a)\n\n\n', 's = int(input())\n\na = []\na.append(s)\ncount = 1\nwhile True:\n count+=1\n if s %2 == 0:\n s=s//2\n else:\n s= 3*s+1\n if s in a:\n print(count)\n break\n a.append(s)\nprint(a)\n\n\n', 's = int(input())\n\na = []\na.append(s)\ncount = 0\nwhile True:\n count+=1\n if s %2 == 0:\n s=s//2\n else:\n s= 3*s+1\n if s in a:\n print(count)\n break\n a.append(s)\n\n', 's = int(input())\n\na = []\na.append(s)\ncount = 1\nwhile True:\n count+=1\n if s %2 == 0:\n s=s//2\n else:\n s= 3*s+1\n if s in a:\n print(count)\n break\n a.append(s)'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s061209955', 's398939767', 's776362809', 's325105315'] | [2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 17.0] | [183, 183, 173, 171] |
p03146 | u393512980 | 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 = []\nlst.append(s)\ni = 2\nwhile true:\n if i % 2 == 0:\n a = i / 2\n else:\n a = 3 * i + 1\n if a in lst:\n print(i)\n break\n lst.append(a)', 's = int(input())\nlst = []\nlst.append(s)\na = s\ni = 2\nwhile True:\n if a % 2 == 0:\n b = int(a / 2)\n else:\n b = 3 * a + 1\n if b in lst:\n print(i)\n break\n lst.append(b)\n a = b\n i += 1'] | ['Runtime Error', 'Accepted'] | ['s387408821', 's884296136'] | [2940.0, 3064.0] | [17.0, 17.0] | [168, 196] |
p03146 | u399721252 | 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())\nstpo = 0\nnum_list = []\nwhile stop == 0:\n if n in num_list:\n stop = 1\n print(num_list.index(n)+1)\n else:\n num_list.append(n)\n if n % 2 == 0:\n n //= 2\n else:\n n = 3 * n + 1', 'n = int(input())\nstop = 0\nnum_list = []\nwhile stop == 0:\n\tif n in num_list:\n\t\tstop = 1\n\t\tprint(num_list.index(n)+4)\n\telse:\n\t\tnum_list.append(n)\n\t\tif n % 2 == 0:\n\t\t\tn //= 2\n\t\telse:\n\t\t\tn = 3 * n + 1'] | ['Runtime Error', 'Accepted'] | ['s591814921', 's206337917'] | [2940.0, 2940.0] | [17.0, 17.0] | [214, 196] |
p03146 | u400221789 | 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=[]\nwhile True:\n if s not in a:\n a.append(s)\n else:\n break\n if s%2==0:\n s/=2\n else:\n s=3*s+1\nprint(len(a))', 's=int(input())\na=[]\nwhile True:\n if s not in a:\n a.append(s)\n else:\n break\n if s%2==0:\n s/=2\n else:\n s=3*s+1\nprint(len(a)+1)'] | ['Wrong Answer', 'Accepted'] | ['s044992838', 's813730311'] | [2940.0, 2940.0] | [17.0, 17.0] | [138, 140] |
p03146 | u405256066 | 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 sys import stdin\nN=int(stdin.readline().rstrip())\na=[N]+[0]*10000000\nfor i in range(10000000):\n if i !=0:\n if a[i-1]%2==0:\n a[i]=int((a[i-1]/2))\n else:\n a[i]=int((3*a[i-1]+1))\ncnt=1\ntmp=[]\nfor j in a:\n if str(j) in tmp:\n break\n else:\n tmp.append(str(j))\n cnt+=1\nprint(cnt)', 'from sys import stdin\nN=int(stdin.readline().rstrip())\na=[N]+[0]*10000\nfor i in range(10000):\n if i !=0:\n if a[i-1]%2==0:\n a[i]=int((a[i-1]/2))\n else:\n a[i]=int((3*a[i-1]+1))\ncnt=1\ntmp=[]\nfor j in a:\n if str(j) in tmp:\n break\n else:\n tmp.append(str(j))\n cnt+=1\nprint(cnt)'] | ['Time Limit Exceeded', 'Accepted'] | ['s372681100', 's850332843'] | [159220.0, 3188.0] | [2104.0, 22.0] | [343, 337] |
p03146 | u410118019 | 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 i//2\n else:\n return i*3+1\n\na=int(input())\ni=1\nwhile True:\n b=f(a[-1])\n i+=1\n if b in a:\n print(i)\n break\n a.append(b)', 'def f(i):\n if i%2==0:\n return i//2\n else:\n return i*3+1\n\na=[]\na.append(int(input()))\ni=1\nwhile True:\n b=f(a[-1])\n i+=1\n if b in a:\n print(i)\n break\n a.append(b)\n'] | ['Runtime Error', 'Accepted'] | ['s752723758', 's835948733'] | [3064.0, 2940.0] | [17.0, 17.0] | [165, 179] |
p03146 | u411544692 | 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). | ['an = int(input())\n\nnumbers = []\nwhile True:\n\tif an%2 == 1:\n\t\tan = 3*an+1\n\telse:\n\t\tan = an//2\n\tif an in numbers:\n\t\tprint(len(numbers)+1)\n break\n else:\n\t\tnumbers.append(an)', 'an = int(input())\n\nnumbers = [an]\nwhile True:\n\tif an%2 == 1:\n\t\tan = 3*an+1\n\telse:\n\t\tan = an//2\n\tif an in numbers:\n\t\tprint(len(numbers)+1)\n break\n else:\n\t\tnumbers.append(an)', 'an = int(input())\n\nnumbers = [an]\nwhile True:\n if an%2 == 1:\n an = 3*an+1\n else:\n an = an*2\n if an in numbers:\n print(len(numbers)+1)\n break\n else:\n numbers.append(an)', 'an = int(input())\n\nnumbers = [an]\nwhile True:\n if an%2 == 1:\n an = 3*an+1\n else:\n an = an//2\n if an in numbers:\n print(len(numbers)+1)\n break\n else:\n numbers.append(an)'] | ['Runtime Error', 'Runtime Error', 'Time Limit Exceeded', 'Accepted'] | ['s151321153', 's337103543', 's779433986', 's772158162'] | [2940.0, 2940.0, 21104.0, 2940.0] | [17.0, 18.0, 2105.0, 17.0] | [180, 182, 186, 187] |
p03146 | u415325136 | 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 (n/2)\n else:\n return (3*n+1)\n\na = list()\na.append(s)\nfor i in range(1000):\n a.append(func(a[i]))\nfor j in range(1001):\n for k in range(1001):\n if (j != k and a[j] == a[k]):\n print(k)\n exit()\n \n', 's = int(input())\n\ndef func(n):\n if n % 2 == 0:\n return (n/2)\n else:\n return (3n+1)\n\na = list()\na.append(s)\nfor i in range(1000):\n a.append(func(a[i]))\nfor j in range(1001):\n for k in range(1001):\n if (j != k and a[j] == a[k]):\n print(k)\n exit()\n ', 'def collatz(n):\n if n%2 == 0:\n return n/2\n else:\n return 3*n+1\n\ns=int(input())\nnlist =[]\ntmp_in = collatz(s)\nnlist.append(s)\nnlist.append(tmp_in)\ncnt = 1\nwhile True:\n cnt += 1\n tmp_out = collatz(tmp_in)\n\n if tmp_out in nlist:\n print(len(nlist)+1)\n #print(nlist)\n break\n nlist.append(tmp_out)\n tmp_in = tmp_out\n'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s757946692', 's777560221', 's897496641'] | [3060.0, 3064.0, 3060.0] | [40.0, 18.0, 17.0] | [276, 274, 366] |
p03146 | u416758623 | 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())\nans = [s]\n\nfor i in range(1,10**6+1):\n if len(set(ans)) != len(ans):\n print(i)\n break\n if s % 2 != 0:\n s = 3 * s + 1\n ans.append(s)\n else:\n s = s // 2\n ans.append(s)\n print(ans)', 's = int(input())\nans = [s]\n\nfor i in range(1,10**6+1):\n if len(set(ans)) != len(ans):\n print(i)\n break\n if s % 2 != 0:\n s = 3 * s + 1\n ans.append(s)\n else:\n s = s // 2\n ans.append(s)'] | ['Wrong Answer', 'Accepted'] | ['s941611191', 's783293802'] | [3060.0, 3188.0] | [18.0, 17.0] | [248, 233] |
p03146 | u425177436 | 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())\nt = [0]*1000000\nt[a] = 1\nfor i in range(2,1000001):\n if a % 2 == 0:\n a //= 2\n else:\n a = 3*a + 1\n print(a)\n if t[a]:\n break\n t[a] = 1\nprint(i)', 'a = int(input())\nt = set()\nt.add(a)\nfor i in range(2,1000001):\n if a % 2 == 0:\n a //= 2\n else:\n a = 3*a + 1\n if a in t:\n break\n t.add(a)\nprint(i)'] | ['Wrong Answer', 'Accepted'] | ['s559447905', 's258314416'] | [10868.0, 2940.0] | [29.0, 17.0] | [195, 178] |
p03146 | u432333240 | 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]\ni=1\ndef func(a):\n if a%2==0:\n return(a/2)\n else:\n return(3*a+1)\n\nwhile (len(l)==len(set(l))):\n i+=1\n s = func(s)\n l.append(func(s))\nprint(i+1)', 's = map(int, input().split())\nl=[s]\ni=1\ndef func(a):\n if a%2==0:\n return a/2\n else:\n return 3s+1\n\ndef Collatz(s):\n i+=1\n\tl.append(func(s))\n\tif not len(l) == len(set(l)):\n print(i)\n break\n else:\n continue\nCollatz(s)', 's = map(int, input().split())\nl=[s]\ni=1\ndef func(a):\n if a%2==0:\n return(a/2)\n else:\n return(3*a+1)\n\ndef Collatz(s):\n i+=1\n l.append(func(s))\n if not len(l) == len(set(l)):\n print(i)\n break\n else:\n continue\n\nCollatz(s)', 's = map(int, input().split()\nl=[s]\ni=1\ndef func(a):\n if a%2==0:\n return a/2\n else:\n return 3s+1\n\ndef Collatz(s):\n i+=1\n\tl.append(func(s))\n\tif not len(l) == len(set(l)):\n print(i)\n break\n else:\n continue', 's = int(input())\nl=[s]\ni=1\ndef func(a):\n if a%2==0:\n return(a/2)\n else:\n return(3*a+1)\n\nwhile (len(l)==len(set(l))):\n i+=1\n l.append(func(s))\nprint(i)\n', 's = int(input())\nl=[s]\ni=1\ndef func(a):\n if a%2==0:\n return(a/2)\n else:\n return(3*a+1)\n\ndef Collatz(s):\n i+=1\n l.append(func(s))\n if not len(l) == len(set(l)):\n print(i)\n break\n else:\n continue\n\nCollatz(s)', 's = int(input())\nl=[s]\ni=1\ndef func(a):\n if a%2==0:\n return(a/2)\n else:\n return(3*a+1)\n\nwhile (len(l)==len(set(l))):\n i+=1\n s = func(s)\n l.append(s)\nprint(i)'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s008959825', 's220090371', 's350255774', 's417107374', 's565548754', 's973979017', 's263654946'] | [3060.0, 2940.0, 3060.0, 2940.0, 2940.0, 3060.0, 2940.0] | [17.0, 18.0, 17.0, 17.0, 17.0, 17.0, 18.0] | [176, 249, 239, 237, 161, 226, 168] |
p03146 | u440478998 | 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 = list(int(input()))\nfor i in range(1000001):\n if s[i] % 2 == 0:\n s.append(s[i]/2)\n else:\n s.append(3 * s[i] + 1)\n if s[i] in s[:i]:\n print(i+1)\n break', 's = [int(input())]\nfor i in range(1000001):\n if s[i] % 2 == 0:\n s.append(s[i]/2)\n else:\n s.append(3 * s[i] + 1)\n if s[i] in s[:i]:\n print(i+1)\n break'] | ['Runtime Error', 'Accepted'] | ['s875597328', 's909200538'] | [9112.0, 9180.0] | [24.0, 28.0] | [190, 186] |
p03146 | u445511055 | 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\n\ndef fn(n):\n if n % 2 == 0:\n return n // 2\n else:\n return 3*n + 1\n\n\ndef main():\n """Function."""\n s = int(input())\n\n check_dic = {}\n check = set()\n\n old = s\n counter = 1\n\n while old not in check:\n print(old,counter)\n check.add(old)\n check_dic[old] = counter\n\n counter += 1\n old = fn(old)\n\n print("!!!!!!!!!!!")\n print(counter)\n\n\nif __name__ == "__main__":\n main()', '# -*- coding: utf-8 -*-\n\n\ndef fn(n):\n if n % 2 == 0:\n return n // 2\n else:\n return 3*n + 1\n\n\ndef main():\n """Function."""\n s = int(input())\n\n check_dic = {}\n check = set()\n\n old = s\n counter = 1\n\n while old not in check:\n # print(old,counter)\n check.add(old)\n check_dic[old] = counter\n\n counter += 1\n old = fn(old)\n\n # print("!!!!!!!!!!!")\n print(counter)\n\n\nif __name__ == "__main__":\n main()\n'] | ['Wrong Answer', 'Accepted'] | ['s434809084', 's757763332'] | [3064.0, 3060.0] | [18.0, 18.0] | [473, 478] |
p03146 | u448655578 | 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 = []\na.append(s)\nwhile a[0] != s:\n if s % 2 ==0:\n s = s//2\n a.append(s)\n else:\n s = 3*s +1\n a.append(s)\nprint(len(a))\n \n', 's = int(input())\na = []\na.append(s)\ns += 1\nwhile a[0] != s:\n if s % 2 ==0:\n s = s //2\n a.append(s)\n else:\n s = 3*s +1\n a.append(s)\nprint(len(a))\n \n', 's = int(input())\na = []\nwhile s not in a:\n a.append(s)\n if s % 2 ==0:\n s = s//2\n a.append(s)\n else:\n s = 3*s +1\n a.append(s)\nprint(len(a))\n \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))\n \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)\n \n'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s179889266', 's478915280', 's695661231', 's785250073', 's090765181'] | [2940.0, 62616.0, 2940.0, 2940.0, 2940.0] | [17.0, 2106.0, 18.0, 17.0, 17.0] | [154, 162, 157, 125, 127] |
p03146 | u450904670 | 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\nN = int(input())\n \ntest = set(N)\nbefore = N\nfor i in range(1, 10**6 + 1):\n current = f(before)\n if(current in test):\n print(i+1)\n exit()\n before = current\n test.add(current)\n', 'def f(n):\n if(n % 2 == 0):\n return n // 2\n else:\n return (3 * n) + 1\nN = int(input())\n \ntest = set([N])\nbefore = N\nfor i in range(1, 10**6 + 1):\n current = f(before)\n if(current in test):\n print(i+1)\n exit()\n before = current\n test.add(before)\n'] | ['Runtime Error', 'Accepted'] | ['s494723040', 's074491927'] | [2940.0, 2940.0] | [17.0, 17.0] | [261, 262] |
p03146 | u453630968 | 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 s == 2:\n print(4)\n exit()\n\ndef function(n):\n if n % 2 == 0:\n return int(n/2)\n else:\n return int(n*3+1)\ni = 0\ncount = 0\na = []\na.append(s)\nwhile count < 2:\n a.append(function(a[i]))\n if a[i] == 4:\n count += 1\n i += 1\nprint(a)\nprint(i)', 's = int(input())\n\nif s == 1 or s == 2:\n print(4)\n exit()\n\ndef function(n):\n if n % 2 == 0:\n return int(n/2)\n else:\n return int(n*3+1)\ni = 0\ncount = 0\na = []\na.append(s)\nwhile count < 2:\n a.append(function(a[i]))\n if a[i] == 4:\n count += 1\n i += 1\nprint(i)'] | ['Wrong Answer', 'Accepted'] | ['s227876023', 's623634639'] | [9080.0, 9164.0] | [28.0, 26.0] | [306, 297] |
p03146 | u464912173 | 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())\nc = 0\na = [s]\nwhile c < 100000:\n if s % 2 == 0:\n s = s//2\n c += 1\n else:\n s = 3*s+1\n c += 1\n a += [s]\n for i in range(c):\n if a[i] in a[:i]:\n print(i+1)\n exit()', 's = int(input())\nc = 0\na = [s]\nwhile c < 100000:\n\tif s % 2 == 0:\n\t\ts = s//2\n\t\tc += 1\n\telse:\n\t\ts = 3*s+1\n\t\tc += 1\n\t\ta += [s]\nfor i in range(c):\n\tif a[i] in a[:i]:\n\t\tprint(i+1)\n\t\texit()', '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)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s398475225', 's649313803', 's682634736'] | [3060.0, 3572.0, 2940.0] | [17.0, 54.0, 17.0] | [208, 183, 120] |
p03146 | u468972478 | 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\nwhile True:\n if s % 2 == 0:\n s = s // 2\n else:\n s = 3 * s + 1\n if s in a:\n print(len(a) + 1)\n a.append(s)', 's = int(input())\na = [s]\nwhile True:\n if s % 2 == 0:\n s = s // 2\n else:\n s = 3 * s + 1\n if s in a:\n print(s)\n break\n s.append(s)', 's = int(input())\na = [s]\nwhile True:\n if s % 2 == 0:\n s = s // 2\n else:\n s = 3 * s + 1\n if s in a:\n print(s)\n break\n a.append(s)', 's = int(input())\na = [s]\ni = 1\nwhile True:\n if s % 2 == 0:\n s = s // 2\n else:\n s = 3 * s + 1\n if s in a:\n print(len(a) + 1)\n break\n a.append(s)'] | ['Time Limit Exceeded', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s328389928', 's365823780', 's461428695', 's741571005'] | [68268.0, 9120.0, 9168.0, 9152.0] | [2242.0, 27.0, 27.0, 25.0] | [149, 144, 144, 159] |
p03146 | u469953228 | 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\nfor i in range(1000000):\n if s%2 == 0:\n s /=2\n else:\n s = 3*x+1\n \n if s==4:\n print(count+4)\n count +=1', 's = int(input())\nptn = []\ncount = 0\nwhile True:\n ptn.append(s)\n if s%2 == 0:\n s /=2\n else:\n s = 3*x+1\n if s in ptn:\n print(count+1)\n break\n count +=1\n', 's = int(input())\ncount = 0\nfor i in range(1000000):\n if x%2 == 0:\n x /=2\n else:\n x = 3*x+1\n \n if x==4:\n print(count+4)\n count +=1', 's = int(input())\nptn = []\ncount = 1\nwhile True:\n ptn.append(s)\n if s%2 == 0:\n s /=2\n else:\n s = 3*s+1\n if s in ptn:\n print(count+1)\n exit()\n count +=1\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s036062338', 's043803073', 's887542049', 's229325341'] | [3060.0, 2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0, 18.0] | [143, 167, 143, 168] |
p03146 | u470735879 | 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())\narr = []\nwhile s not in arr:\n if s % 2 == 0:\n s //= 2\n else:\n s = 3 * s + 1\n arr.append(s)\nprint(len(arr) + 3)', 's = int(input())\narr = [s]\nfor _ in range(1000000):\n if s % 2 == 0:\n s //= 2\n else:\n s = 3 * s + 1\n if s in arr:\n break\n arr.append(s)\nprint(len(arr) + 1)'] | ['Wrong Answer', 'Accepted'] | ['s480966411', 's080562674'] | [2940.0, 2940.0] | [17.0, 17.0] | [150, 187] |
p03146 | u474514603 | 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: return a/2\n else: return 3*a + 1\n\ndef sol(a):\n dp = [a]\n #print(dp)\n for i in range(1, 1000000+1):\n x = dp[i-1]\n ans = f(x)\n if ans in dp:\n #print(i, ans, dp)\n return i+1\n else:\n dp.append(ans)\n return None\n', 'from collections import defaultdict\nimport sys\n\nimport math\n\ndef f(a):\n if a % 2 == 0: return a/2\n else: return 3*a + 1\n\ndef sol(a):\n dp = [a]\n #print(dp)\n for i in range(1, 1000000+1):\n x = dp[i-1]\n ans = f(x)\n if ans in dp:\n #print(i, ans, dp)\n return i+1\n else:\n dp.append(ans)\n return None\n\n\n\n\ndo_submit = True\n\ndef input_parse(input_str):\n lines = [x.strip() for x in input_str.split("\\n") if x.strip()]\n parsed_lines = [list(map(int, line.split())) for line in lines]\n a = parsed_lines[0]\n return a[0]\n\n\nif not do_submit:\n a= input_parse("""\n 54\n """)\n print(sol(a))\nelse:\n # a, b, c = list(map(int, input().split()))\n # print(sol(a, b, c))\n a = list(map(int, input().split()))\n print(sol(a[0]))'] | ['Wrong Answer', 'Accepted'] | ['s372772089', 's430670339'] | [2940.0, 3316.0] | [17.0, 21.0] | [313, 835] |
p03146 | u479977918 | 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 -*-\ns = int(input())\n\ndp = [s]\n\ni=2\na_1=s\nwhile(True):\n if a_1 % 2==0:\n index = a_1 /2\n else:\n index = 3 * a_1 + 1\n print(int(index))\n if int(index) in dp:\n break\n else:\n dp.append(int(index))\n a_1 = int(index)\n i+=1\n\nprint(i)', '# -*- coding: utf-8 -*-\ns = int(input())\n\ndp = [s]\n\ni=2\na_1=s\nwhile(True):\n if a_1 % 2==0:\n index = a_1 /2\n else:\n index = 3 * a_1 + 1\n if int(index) in dp:\n break\n else:\n dp.append(int(index))\n a_1 = int(index)\n i+=1\n\nprint(i)'] | ['Wrong Answer', 'Accepted'] | ['s307873116', 's392269887'] | [3060.0, 2940.0] | [18.0, 18.0] | [303, 281] |
p03146 | u482090956 | 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())\n\nval = s\nmp = {}\ni= 0\nwhile True:\n i+=1\n if val%2==0:\n val = val//2\n else:\n val = 2*val+1\n \n if val in mp:\n print(i)\n break\n else:\n mp[val] = 1', '\ns = int(input())\n\nval = s\nmp = {}\ni= 0\nwhile True:\n i+=1\n if val%2==0:\n val = val//2\n else:\n val = 3*val+1\n \n if val in mp:\n print(i)\n break\n else:\n mp[val] = 1', '\ns = int(input())\n\nval = s\nmp = {s:1}\ni= 1\nwhile True:\n i+=1\n if val%2==0:\n val = val//2\n else:\n val = 3*val+1\n \n if val in mp:\n print(i)\n break\n else:\n mp[val] = 1'] | ['Time Limit Exceeded', 'Wrong Answer', 'Accepted'] | ['s151956496', 's520489014', 's829191645'] | [126832.0, 3060.0, 3060.0] | [2115.0, 18.0, 18.0] | [182, 182, 185] |
p03146 | u485566817 | 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\nfor i in range(1000000):\n if s % 2:\n s = 3*s +1\n else:\n s = s//2\n if s in a:\n print(i+1)\n break\n a.append(s)', 's = int(input())\n\na = [s]\n\nfor i in range(1000000):\n if s % 2:\n s = 3*s +1\n else:\n s = s//2\n if s in a:\n print(i+2)\n break\n a.append(s)'] | ['Wrong Answer', 'Accepted'] | ['s718355059', 's535693163'] | [2940.0, 2940.0] | [18.0, 17.0] | [174, 175] |
p03146 | u488178971 | 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). | ['lists=[]\nlists.append(s)\nfor i in range(2,1000000):\n print("A",i)\n if lists[-1]%2==0:\n tmp=int(lists[-1]/2)\n lists.append(tmp)\n if lists.count(tmp)==2:\n print(i)\n exit()\n else:\n tmp=(3*lists[-1])+1\n lists.append(tmp)\n if lists.count(tmp)==2:\n print(i)\n exit()', 'lists=[]\nlists.append(s)\nfor i in range(2,1000000000000000):\n print("A",i)\n if lists[-1]%2==0:\n tmp=int(lists[-1]/2)\n lists.append(tmp)\n if lists.count(tmp)==2:\n print(i)\n exit()\n else:\n tmp=(3*lists[-1])+1\n lists.append(tmp)\n if lists.count(tmp)==2:\n print(i)\n exit()', '#116 B\ns =int(input())\nlists=[]\nlists.append(s)\nfor i in range(2,1000001):\n if lists[-1]%2==0:\n tmp=int(lists[-1]/2)\n lists.append(tmp)\n if lists.count(tmp)==2:\n print(i)\n exit()\n else:\n tmp=(3*lists[-1])+1\n lists.append(tmp)\n if lists.count(tmp)==2:\n print(i)\n exit()'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s509387165', 's982997934', 's105313344'] | [3060.0, 3060.0, 3064.0] | [19.0, 17.0, 17.0] | [354, 363, 360] |
p03146 | u492447501 | 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\ns = int(input())\nflg=0\nA = []\nA.append(s)\n\nindex = 0\nif s==4 or s==2 or s==1:\n print(index+4)\n sys.exit()\nwhile flg!=1:\n if A[index]%2==0:\n f = (A[index]//2)\n else:\n f = 3*A[index]+1\n print(index)\n A.append(f)\n index = index + 1\n\n if f==4 or f==2 or f==1:\n flg=1\n break\n\n#1,4,2,1,4\n\nprint(index+4)', 'import sys\ns = int(input())\nflg=0\nA = []\nA.append(s)\n\nindex = 0\nif s==4 or s==2 or s==1:\n print(index+4)\n sys.exit()\nwhile flg!=1:\n if A[index]%2==0:\n f = (A[index]//2)\n else:\n f = 3*A[index]+1\n\n A.append(f)\n index = index + 1\n\n if f==4 or f==2 or f==1:\n flg=1\n break\n\n#1,4,2,1,4\n\nprint(index+4)'] | ['Wrong Answer', 'Accepted'] | ['s535026682', 's733915649'] | [3064.0, 3064.0] | [17.0, 17.0] | [360, 344] |
p03146 | u497952650 | 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 collaz(n):\n if n%2 == 0:\n return n//2\n else:\n return 3*n+1\n\ns = int(input())\n\nbox = [-1]*(int(1e10))\n\ni = 1\n\nwhile 1:\n if box[collaz(s)] == 1:\n print(i+1)\n break\n else:\n box[collaz(s)] = 1\n s = collaz(s)\n i += 1\n ', 'def collaz(n):\n if n%2 == 0:\n return n//2\n else:\n return int(3*n+1)\n\ns = int(input())\n\nbox = [-1]*(int(1e6+1))\n\nbox[s] = 1\n\ni = 1\n\nwhile 1:\n if box[collaz(s)] == 1:\n print(i+1)\n break\n else:\n box[collaz(s)] = 1\n s = collaz(s)\n i += 1\n '] | ['Runtime Error', 'Accepted'] | ['s958891669', 's397859901'] | [3064.0, 10868.0] | [17.0, 32.0] | [281, 299] |
p03146 | u518042385 | 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())\nl=[a]\nb=True\ni=1\nwhile b==True:\n if a%2==0:\n a=a//2\n else:\n a=3*a+1\n if a in l:\n b==False\n print(i+1)\n exit\n else:\n l.append(a)\n i+=1\n \n \n ', 'a=int(input())\nl=[a]\nb=True\ni=1\nwhile b==True:\n if a%2==0:\n a=a//2\n else:\n a=3*a+1\n if a in l:\n b=False\n print(i+1)\n exit\n else:\n l.append(a)\n i+=1'] | ['Time Limit Exceeded', 'Accepted'] | ['s534055655', 's116038461'] | [8776.0, 2940.0] | [2104.0, 18.0] | [185, 172] |
p03146 | u525227429 | 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(num):\n if num % 2 == 0:\n return int(num / 2)\n else:\n return num * 3 + 1\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 = a.index(ai)\n break\n a.append(ai)\nprint(ans)', 'def f(num):\n if num % 2 == 0:\n return int(num / 2)\n else:\n return num * 3 + 1\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)'] | ['Wrong Answer', 'Accepted'] | ['s186925003', 's279084258'] | [3060.0, 3060.0] | [17.0, 17.0] | [247, 241] |
p03146 | u527261492 | 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 func(n):\n if n%2 == 1:\n return 3n+1\n else:\n return n//2\ndef prog(N):\n if N == 1:\n return s\n else:\n a=s\n for i in range(1,N):\n a = func(a)\n return a\n\nb=[]\nfor i in range(1,1000001):\n tmp = prog(i)\n if tmp in b:\n print(i)\n break\n else:\n b.append(tmp)\n \n\n', 's = int(input())\ndef func(n):\n if n%2 == 1:\n return 3n+1\n else:\n return n/2\ndef prog(N):\n if N == 1:\n return s\n else:\n a=s\n for i in range(1,N):\n a = func(a)\n return a\n\n\nwhile prog(k)==prog(j):\n \n\n', 's = int(input())\ndef func(n):\n if n%2 == 1:\n return 3n+1\n else:\n return n//2\ndef prog(N):\n if N == 1:\n return s\n else:\n a=s\n for i in range(1,N):\n a = func(a)\n return a\n\nb=[]\nfor i in range(1,10000):\n tmp = prog(i)\n if tmp in b:\n print(i)\n break\n else:\n b.append(tmp)\n \n\n', 's = int(input())\ndef func(n):\n if n%2 == 1:\n return 3*n+1\n else:\n return n//2\ndef prog(N):\n if N == 1:\n return s\n else:\n a=s\n for i in range(1,N):\n a = func(a)\n return a\n\nb=[]\nfor i in range(1,1000000):\n tmp = prog(i)\n if tmp in b:\n print(i)\n break\n else:\n b.append(tmp)\n \n\n'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s198567907', 's398493319', 's682425044', 's803209337'] | [2940.0, 2940.0, 2940.0, 3060.0] | [17.0, 18.0, 18.0, 19.0] | [313, 225, 311, 314] |
p03146 | u529012223 | 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 = []\nflag = 0\ni = 0\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\n i += 1\nprint(i)', 's = int(input())\na = []\nflag = 0\ni = 0\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\n i += 1\nprint(i)', 's = int(input())\na = []\nflag = 0\ni = 1\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\n i += 1\nprint(i)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s769910868', 's970475453', 's912386342'] | [2940.0, 2940.0, 2940.0] | [17.0, 19.0, 17.0] | [159, 160, 160] |
p03146 | u537782349 | 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())\nb = [a]\nc = 0\nwhile:\n c += 1\n if a % 2 == 0:\n a /= 2\n if b.contain(a):\n print(c)\n exit()\n else:\n b.append(a)\n else:\n a = a * 3 + 1\n if b.contain(a):\n print(c)\n exit()\n else:\n b.append(a)\n', 'a = int(input())\nb = [a]\nc = 0\nwhile True:\n c += 1\n if a % 2 == 0:\n a /= 2\n if a in b:\n print(c)\n exit()\n else:\n b.append(a)\n else:\n a = a * 3 + 1\n if a in b:\n print(c)\n exit()\n else:\n b.append(a)\n', 'a = int(input())\nb = [a]\nd = 1\nwhile True:\n c = b[len(b)-1]\n d += 1\n if c % 2 == 0:\n c = c // 2\n else:\n c = c * 3 + 1\n if c not in b:\n b.append(c)\n else:\n print(d)\n exit()\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s258220578', 's415250675', 's925033453'] | [2940.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0] | [255, 248, 225] |
p03146 | u545411641 | 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 calc_next(x):\n if x % 2 == 0:\n return x // 2\n else:\n return 3 * x + 1\n\na = [s]\nn = 1\n\nwhile True:\n a.append(calc_next(a[n-1]))\n for i in range(n):\n if a[k] == a[n]:\n print(n+1)\n exit(0)\n n += 1', 's = int(input())\n\ndef calc_next(x):\n if x % 2 == 0:\n return x // 2\n else:\n return 3 * x + 1\n\na = [s]\nn = 1\n\nwhile True:\n a.append(calc_next(a[n-1]))\n for i in range(n):\n if a[i] == a[n]:\n print(n+1)\n exit(0)\n n += 1\n'] | ['Runtime Error', 'Accepted'] | ['s916608076', 's486524341'] | [2940.0, 3060.0] | [17.0, 18.0] | [239, 240] |
p03146 | u546853743 | 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=[]\nna=[]\na.append(s)\nfor i in range(1,10**6):\n if a[i-1]%2==0:\n a.append(a[i-1]/2)\n else:\n a.append(a[i-1]*3+1)\n na=set(a)\n if len(na)!=i+1:\n print(a[i])\n exit()', 's=int(input())\na=[]\nna=[]\na.append(s)\nfor i in range(1,10**6):\n if a[i-1]%2==0:\n a.append(a[i-1]/2)\n else:\n a.append(a[i-1]*3+1)\n na=set(a)\n if len(na)!=i+1:\n print(i+1)\n exit()'] | ['Wrong Answer', 'Accepted'] | ['s279912565', 's696865201'] | [9096.0, 9164.0] | [25.0, 28.0] | [218, 217] |
p03146 | u548545174 | 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]\nfor i in range(1000000):\n ai = (a[i - 1] / 2) * (a[i - 1] % 2 == 0) + (3 * a[i - 1] + 1) * (a[i - 1] % 2 != 0)\n a.append(ai)\n if a[i] == a[i - 1]:\n print(i)\n break\n', 's = int(input())\na = [s]\nfor i in range(1, 1000001):\n ai = (a[i - 1] / 2) * (a[i - 1] % 2 == 0) + (3 * a[i - 1] + 1) * (a[i - 1] % 2 == 1)\n a.append(ai)\n #print(a)\n if ai in a[:-1]:\n print(i+1)\n break'] | ['Wrong Answer', 'Accepted'] | ['s147650892', 's984158211'] | [2940.0, 3064.0] | [17.0, 18.0] | [212, 226] |
p03146 | u549497563 | 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())\ncnt = 1\nif n>=3:\n cnt = cnt + 1\nelif n=2:\n cnt = cnt + 2\nelse:\n cnt = cnt + 3\nwhile n != 1:\n if n % 2 == 0:\n n /= 2\n else:\n n = 3*n+1\n cnt += 1\nprint(cnt)', 'n = int(input())\ncnt = 1\nif n>=3:\n cnt = cnt + 1\nelif n==2:\n cnt = cnt + 2\nelse:\n cnt = cnt + 3\nwhile n != 1:\n if n % 2 == 0:\n n /= 2\n else:\n n = 3*n+1\n cnt += 1\nprint(cnt)'] | ['Runtime Error', 'Accepted'] | ['s477704878', 's569673049'] | [2940.0, 3060.0] | [18.0, 19.0] | [203, 204] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.