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 |
|---|---|---|---|---|---|---|---|---|---|---|
p02786 | u157874153 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\nstep = 0\nwhile H == 1:\n H = H // 2\n step += 1\nans = 0\nfor i in range(step+1):\n ans += 2**step\nprint(ans)\n ', 'import math\ndef f(x):\n if x == 1:\n return 1\n else:\n return 2*f(math.floor(x/2))+1\n\nh = int(input())\nprint(f(h))'] | ['Wrong Answer', 'Accepted'] | ['s037215913', 's054980682'] | [3064.0, 3060.0] | [17.0, 17.0] | [127, 119] |
p02786 | u179169725 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H=int(input())\nans=1\nnum=1\nwhile H>0:\n ans+=num\n num*=2\n H//=2\nprint(ans)', 'H=int(input())\nans=0\nnum=1\nwhile H>0:\n ans+=num\n num*=2\n H//=2\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s203789535', 's324939071'] | [2940.0, 2940.0] | [17.0, 23.0] | [76, 76] |
p02786 | u184882264 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['print(2**(len(bin(int(nput()))) - 2) - 1)', 'print(2**(len(bin(int(input()))) - 2) - 1)'] | ['Runtime Error', 'Accepted'] | ['s024793434', 's008817013'] | [2940.0, 2940.0] | [17.0, 17.0] | [41, 42] |
p02786 | u195210605 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ["h = int(input())\n\nlog = {'1': 1 , '2': 3, '3': 3, '4': 7 }\n\ni = 1\nwhile i <= h:\n if str(i) in log:\n # print(log[str(i)])\n else:\n n = i // 2\n log.setdefault(str(i), log[str(n)]*2+1)\n # print(log[str(i)])\n i=i+1\nprint(log[h])\n\n", 'def input_int():\n return int(input())\n\ndef suss(num):\n result = 2\n while num > 1:\n num = num // 2\n result = result * 2\n return result - 1\n\nh = input_int()\nprint(suss(h)) \n'] | ['Runtime Error', 'Accepted'] | ['s715066949', 's630193016'] | [2940.0, 2940.0] | [17.0, 17.0] | [240, 183] |
p02786 | u213800869 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['n = int(input())\n\ncount = 1\n\nwhile True:\n if n > 1:\n n = -(-n//2)\n count += 1\n else:\n break\n\nprint(count)\nvalue = 0\nfactional = 0.5\nfor i in range(count):\n factional = factional * 2\n print(factional)\n value += factional\n\nprint(int(value))', 'n = int(input())\n\ncount = 1\n\nwhile True:\n if n > 1:\n n = n//2\n count += 1\n else:\n break\n\nprint(count)\nvalue = 0\nfactional = 0.5\nfor i in range(count):\n factional = factional * 2\n print(factional)\n value += factional\n\nprint(int(value))', 'n = int(input())\n\ncount = 1\n\nwhile True:\n if n > 1:\n n = n//2\n count += 1\n else:\n break\n\nvalue = 0\nfactional = 0.5\nfor i in range(count):\n factional = factional * 2\n value += factional\n\nprint(int(value))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s293817637', 's592258406', 's033201247'] | [3060.0, 3060.0, 3060.0] | [18.0, 17.0, 17.0] | [274, 270, 236] |
p02786 | u217530935 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\n\ncnt = 0\nresult = 0\n\n\ndef gener():\n now = 3\n while True:\n yield now\n now = now*2+1\n\n\nif H == 1:\n print(1)\nelse:\n while True:\n if H <= 1:\n break\n cnt += 1\n H = int(H / 2)\n\n \n gen = gener()\n gen.__next__()\n\n for i in range(int(cnt)):\n if i == cnt-2:\n result = gen.__next__()\n print(result)\n else:\n gen.__next__()', 'ans = 1\nn = int(input())\n\nwhile (ans <= n):\n ans *= 2\nprint(ans-1)'] | ['Wrong Answer', 'Accepted'] | ['s715568262', 's948681031'] | [3064.0, 2940.0] | [17.0, 19.0] | [376, 69] |
p02786 | u218071226 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = input()\nscore = 0\nfak = 1\nwhile h>1:\n\tscore += fak\n\th = int(h/2)\n\tfak *= 2\nprint(score+1)', 'h = input()\nscore = 0\nfak = 1\nwhile h>1:\n\tscore += fak\n\th //= 2\n\tfak *= 2\nprint(score+1)', 'h = int(input())\nscore = 0\nfak = 1\nwhile h>1:\n\tscore += fak\n\th = int(h/2)\n\tfak *= 2\nprint(score+fak)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s299216135', 's388810245', 's475314354'] | [2940.0, 2940.0, 2940.0] | [17.0, 18.0, 17.0] | [93, 88, 100] |
p02786 | u222643068 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['val=int(input())\nans=0\nwhile val>1:\n val/=2\n ans+=1\nans=2**ans-1\nprint(ans)', 'val=int(input())\nans=0\nwhile val>=1:\n val/=2\n ans+=1\nans=2**ans-1\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s611209705', 's184961641'] | [2940.0, 2940.0] | [17.0, 17.0] | [77, 78] |
p02786 | u223904637 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h=int(input())\nm=0\nwhile 2**m<=h:\n m+=1\nm=m-1\nprint(2**m-1)\n', 'h=int(input())\nm=0\nwhile 2**m<=h:\n m+=1\nprint(2**m-1)\n'] | ['Wrong Answer', 'Accepted'] | ['s772881049', 's476434445'] | [2940.0, 2940.0] | [17.0, 17.0] | [63, 57] |
p02786 | u225388820 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h=int(input())\ni=1\nwhile h>0:\n h//=2\n i+=1\nprint((1<<i)-1)\n', 'print(2**bit_length(int(input())-1)', 'print(2**int(input()).bit_length()-1)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s174529336', 's852506984', 's500809380'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [65, 35, 37] |
p02786 | u232652798 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['\ndef fibonaci(h):\n if h == 0:\n return 0\n if h <2:\n return 1\n else:\n return (2*fibonaci(h/2) + 1)\n\n\nprint(fibonaci(0))', 'a = 0\n\ndef fibonaci(h):\n if h <2:\n return 1\n else:\n return (2*fibonaci(h/2) + 1)\n\na += fibonaci(10000000000)\nprint(a)', '\ndef fibonaci(h):\n if h <2:\n return 1\n else:\n return (2*fibonaci(h/2) + 1)\n\n\nprint(fibonaci(1000000000000))', 'a = int(input())\ndef fibonaci(h):\n if h < 2:\n if h == 0:\n return 0\n return 1\n else:\n return (2*fibonaci(h/2) + 1)\n\n\nprint(fibonaci(a))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s641651935', 's668219168', 's807647849', 's797936995'] | [2940.0, 2940.0, 3060.0, 2940.0] | [17.0, 17.0, 19.0, 18.0] | [147, 137, 127, 172] |
p02786 | u239528020 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['# D\ndef touhi(a,r,n):\n return a*(pow(r, n) - 1)//(r-1)\n \nH = int(input()) \nn = math.floor(math.log2(H))+1\nprint(touhi(a=1, r=2, n=n))', 'import math\ndef touhi(a,r,n):\n return a*(pow(r, n) - 1)//(r-1)\nH = int(input()) \nn = math.floor(math.log2(H))+1\nprint(touhi(a=1, r=2, n=n))'] | ['Runtime Error', 'Accepted'] | ['s444222895', 's748016726'] | [3060.0, 3444.0] | [17.0, 22.0] | [137, 142] |
p02786 | u250061066 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\nAns = 0\nn = 1\nwhile True:\n if H != 1:\n H = H//2\n Ans += 2**n\n n += 1\n else:\n break\nprint(Ans)', 'H = int(input())\nAns = 0\nn = 0\nwhile True:\n if H != 1:\n H = H//2\n Ans += 2**n\n n += 1\n else:\n Ans += 2**n\n break\nprint(Ans)'] | ['Wrong Answer', 'Accepted'] | ['s676555815', 's050320123'] | [9140.0, 9144.0] | [28.0, 30.0] | [144, 164] |
p02786 | u250828304 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import math\nH = int(input())\n\na = int(math.log(H,2))\n\nprint((2**a)-2 + (2**a))', 'import math\nH = int(input())\n\na = int(math.log(H,2))\n\nprint((2**(a+1))-1)\n'] | ['Wrong Answer', 'Accepted'] | ['s764169333', 's079677461'] | [2940.0, 3060.0] | [17.0, 19.0] | [78, 74] |
p02786 | u264867962 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['n = int(log2(int(input())))\n\nprint(2 ** (n + 1) - 1)', 'from math import log2\n\nn = int(log2(int(input())))\n\nprint(2 ** (n + 1) - 1)'] | ['Runtime Error', 'Accepted'] | ['s489816625', 's757044332'] | [8868.0, 9168.0] | [31.0, 30.0] | [52, 75] |
p02786 | u267267582 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H=int(input())\nimport math\nH=int(math.log1())\nprint(2**(H+1))', 'H=int(input())\nimport math\nH=int(math.log2())\nprint(2**(H+1))', 'H=int(input())\nimport math\nH=int(math.log2(H))\nprint(2**(H+1)-1)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s101570080', 's548718383', 's418136088'] | [2940.0, 2940.0, 3188.0] | [17.0, 19.0, 18.0] | [61, 61, 64] |
p02786 | u272682534 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ["import math\nLogT={1:1}\ndef div2(X):\n if X in LogT:\n return LogT[X]\n else:\n v = 1+div2(math.floor(X/2))*2\n LogT[X]=v\n return v\n\nif __name__=='__main__':\n H=int(input())", "import math\nLogT={1:1}\ndef div2(X):\n if X in LogT:\n return LogT[X]\n else:\n v = 1+div2(math.floor(X/2))*2\n LogT[X]=v\n return v\n\nif __name__=='__main__':\n H=int(input())\n print (div2(H))"] | ['Wrong Answer', 'Accepted'] | ['s591120487', 's986096753'] | [3060.0, 3060.0] | [17.0, 17.0] | [205, 225] |
p02786 | u278142467 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = int(input())\nfor i in range(1, 41):\n x = 2 ** i -1\n if h <= x:\n print(x)', 'h = int(input())\nfor i in range(1, 41):\n x = 2 ** i -1\n if h <= x:\n print(x)\n break', 'h = int(input())\nfor i in range(1, 41):\n x = 2 ** i -1\n if h <= x:\n print(x)\n break'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s723041992', 's728947680', 's596282694'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [81, 89, 91] |
p02786 | u281494025 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ["H = int(input())\n\ndef calc(H):\n a = int(H/2)\n return a*2 + 1\n\n\ndef main(H):\n if H == 1:\n return 1\n else:\n return calc(H)\n\nif __name__=='__main__':\n main()\n", "H = int(input())\n \n \ndef main(H):\n if H == 1:\n return 1\n else:\n return main(H//2)*2 + 1\n \nif __name__=='__main__':\n print(main(H))"] | ['Runtime Error', 'Accepted'] | ['s895872651', 's442200546'] | [2940.0, 2940.0] | [17.0, 17.0] | [166, 139] |
p02786 | u281796054 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['def f(n):\n if n=1:\n return(1)\n else:\n f(n)=2f(n-1)+1\n return f(n)\nn=int(input())\nprint(f(n))', 'def f(n):\n if n==1:\n return(1)\n else:\n return(2*f(n//2)+1)\nn=int(input())\nprint(f(n))\n'] | ['Runtime Error', 'Accepted'] | ['s064056219', 's998739712'] | [3064.0, 2940.0] | [18.0, 17.0] | [103, 94] |
p02786 | u282813849 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\n\nif H == 1:\n print(1)\n exit(0)\n\nimport math as m\nn = m.ceil(m.log2(H))\nans = (2**n) - 1\n\nprint(ans)\n\n', 'H = int(input())\n\nif H == 1:\n print(1)\n exit(0)\n\nimport math as m\nn = m.floor(m.log2(H))+1\nans = (2**n) - 1\n\nprint(ans)\n\n'] | ['Wrong Answer', 'Accepted'] | ['s735457436', 's852966714'] | [9208.0, 9268.0] | [27.0, 29.0] | [120, 123] |
p02786 | u290279680 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\nK = 0\nfor ii in range(40):\n if (H>=2**ii) & (H<=2**(ii+1)):\n K= ii\n break\nprint(2**(K+1)-1)', 'import numpy as np\nH = int(input())\nprint(2**(int(np.log2(H))+1)-1)'] | ['Wrong Answer', 'Accepted'] | ['s119107192', 's465980770'] | [3064.0, 12512.0] | [18.0, 155.0] | [115, 67] |
p02786 | u290886932 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\nif H == 1:\n ret = 1\nelse:\n count = 0\n while True:\n\tH = H // 2\n count += 1\n if H == 0:\n break\n ret = 2 **( count + 1) - 1', 'H = int(input())\nif H == 1:\n ret = 1\nelse:\n count = 0\n while True:\n H = H // 2\n count += 1\n if H == 1:\n break\n ret = 2 ** (count + 1) + 1\n \nprint(ret)\n', 'H = int(input())\nif H == 1:\n ret = 1\nelse:\n count = 0\n while True:\n H = H // 2\n count += 1\n if H == 0:\n break\n ret = 2 **( count ) - 1\nprint(ret)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s224789989', 's961129887', 's121031919'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [152, 170, 163] |
p02786 | u291028869 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['from math import floor:\nh = int(input())\n\nc = 0\n\ndef attack(h):\n if h == 1:\n c += 1\n return c\n else:\n return attack(floor(2/h)) + attack(floor(2/h))\n \nprint(attack(h))', 'from math import floor,log2\nh = int(input())\nd = floor(log2(h))\nc = 1\nfor i in range(0,d):\n c += 2 ** (d-i)\n\nprint(c)'] | ['Runtime Error', 'Accepted'] | ['s967697720', 's183632308'] | [2940.0, 2940.0] | [17.0, 18.0] | [179, 118] |
p02786 | u291988695 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['i=int(input())\nnest=1\na=0\np=i\nwhile True:\n nest+=1\n p=p//2\n if p==1:\n break\nfor k in range(nest):\n a+=2^k\nprint(a)', 'i=int(input())\nnest=1\na=0\np=i\nif p==1:\n print(1)\nelse:\n for k in range(50):\n nest+=1\n p=p//2\n if p==1:\n break\n a=(2**nest)-1\n print(a)\n'] | ['Wrong Answer', 'Accepted'] | ['s209198240', 's166724057'] | [2940.0, 2940.0] | [2104.0, 17.0] | [121, 153] |
p02786 | u309120194 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\n\n\n\n# f(H)=2*f(floor(H/2)+1) (H>1)\n# f(H)=1 (H=1)\n\ndef attack_num(x):\n if x == 1: return 1\n else: return 2*f(x // 2) + 1\n \nprint(attack_num(H))', 'H = int(input())\n \n\n\n# f(H)=2*f(floor(H/2)+1) (H>1)\n# f(H)=1 (H=1)\n\n\ndef attack_num(x):\n if x == 1: return 1\n else: return 2*attack_num(x // 2) + 1\n \nprint(attack_num(H))'] | ['Runtime Error', 'Accepted'] | ['s992825697', 's891248134'] | [9084.0, 9064.0] | [22.0, 29.0] | [311, 400] |
p02786 | u310937700 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['mport numpy as np\nimport math\n\nH = input()\nH_bar=int(H)\ncounter=0\nbunki=0\n\nwhile H_bar!=1:\n H_bar=math.floor(H_bar/2)\n bunki=bunki+2**counter\n counter=counter+1\n \nSum=bunki+2**counter\nprint(Sum)', 'import numpy as np\nimport math\n\nH = input()\nH_bar=int(H)\ncounter=0\nbunki=0\n\nwhile H_bar!=1:\n H_bar=math.floor(H_bar/2)\n bunki=bunki+2**counter\n counter=counter+1\n \nSum=bunki+2**counter\nprint(Sum)'] | ['Runtime Error', 'Accepted'] | ['s622201329', 's963078802'] | [2940.0, 12508.0] | [17.0, 150.0] | [195, 196] |
p02786 | u322297639 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = int(input())\nwhile 2 ** i <= h:\n i += 1\nprint(2 ** i - 1)', 'i = 0\nh = int(input())\nwhile 2 ** i <= h:\n i += 1\nprint(2 ** i - 1)'] | ['Runtime Error', 'Accepted'] | ['s226799790', 's580770748'] | [2940.0, 2940.0] | [17.0, 20.0] | [64, 70] |
p02786 | u331997680 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\nI = len(bin(H)-3)\nSn = 2**(I+1)-1\nprint(Sn)', 'H = int(input())\nI = len(bin(H))-3\nSn = 2**(I+1)-1\nprint(Sn)'] | ['Runtime Error', 'Accepted'] | ['s605038792', 's063855045'] | [2940.0, 2940.0] | [17.0, 17.0] | [60, 60] |
p02786 | u344959886 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h=int(input())\n\ndef aaa(i):\n if i == 1:\n return(1)\n else:\n return 2*aaa(i//2)+1\naaa(h)', 'h=int(input())\n\ndef aaa(i,a):\n if i == 0:\n print(a)\n else:\n a+=1\n aaa(i//2,a)\naaa(h,0)\n\n', 'h=int(input())\n\ndef aaa(i):\n if i == 1:\n return(1)\n else:\n return 2*aaa(i//2)+1\nprint(aaa(h))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s229595077', 's855726158', 's714383037'] | [2940.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0] | [106, 115, 113] |
p02786 | u347452770 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = int(input())\ncounter = 0\nwhile h > 1:\n counter += 1\n h = h // 2\n \nprint(counter)', 'h = int(input())\ncounter = 0\nwhile h > 1:\n counter += 1\n h = h // 2\n\nn = counter + 1\nprint(2**n - 1)'] | ['Wrong Answer', 'Accepted'] | ['s336155866', 's738055949'] | [2940.0, 2940.0] | [17.0, 17.0] | [87, 102] |
p02786 | u353548710 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import math\nH = int(input())\nt = 1\nc = 1\nwhile H > 1:\n H = math.floor( H // 2)\n c = 2 * c\n t = t + c\nt += c * 2\nprint(t)\n', 'import math\nH = int(input())\nt = 1\nc = 1\nwhile H > 1:\n H = math.floor( H // 2)\n c = 2 * c\n t = t + c\n print(H, t)\nt += c * 2\nprint(t)\n', 'import math\nH = int(input())\n\ndef f(x):\n if x == 1:\n return 1\n else:\n return 2 * f(x // 2) + 1\nprint(f(H))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s543686157', 's945426434', 's796416176'] | [9084.0, 9136.0, 9132.0] | [28.0, 28.0, 29.0] | [124, 138, 114] |
p02786 | u357230322 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import.math\nh=int(input())\ni=int(math.log(2,h))\nprint(2**(i+1)-1)', 'import math\nh=int(input())\ni=int(math.log(h,2))\nprint((2**(i+1))-1)'] | ['Runtime Error', 'Accepted'] | ['s129898602', 's664504098'] | [3064.0, 3188.0] | [18.0, 18.0] | [65, 67] |
p02786 | u359048838 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['a,b = map(int,input().split())\nN = list(map(int,input().split()))\nN.sort()\nfor i in range(b):\n if N:\n N.pop()\nprint(sum(N))', 'h = int(input())\n\nresult = 0\ni = 1\nwhile h > 0:\n h = h // 2\n result = result + i\n i *= 2\n\nprint(result)'] | ['Runtime Error', 'Accepted'] | ['s154057023', 's631825640'] | [2940.0, 2940.0] | [18.0, 17.0] | [133, 112] |
p02786 | u364651911 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import math\nh = int(input())\ncnt=0\nwhile True:\n cnt+=1\n h=math.floor(h/2)\n if (h/2) < 1:\n cnt+=1\n break\nsum=0\nfor i in range(cnt):\n sum=sum + (2**i)\nif h == 1:\n print(1)\nelse:\n print(sum)', 'import math\nh = int(input())\nif h == 1:\n print(1)\nelse:\n cnt=0\n while True:\n cnt+=1\n h=math.floor(h/2)\n if (h/2) < 1:\n cnt+=1\n break\n sum=0\n for i in range(cnt):\n sum=sum + (2**i)\n print(sum)'] | ['Wrong Answer', 'Accepted'] | ['s267379214', 's877896875'] | [3060.0, 3060.0] | [17.0, 19.0] | [189, 199] |
p02786 | u370721525 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = input()\n\ni = 0\nwhile 2 ** i <= H:\n i += 1\nprint(2 ** i - 1)', 'H = input()\n\ni = 0\nwhile 2 ** i <= int(H):\n i += 1\nprint(2 ** i - 1)\n'] | ['Runtime Error', 'Accepted'] | ['s963855008', 's403648290'] | [2940.0, 2940.0] | [17.0, 18.0] | [64, 70] |
p02786 | u375616706 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['N,K=map(int,input().split())\nL=list(map(int,input().split()))\nL=sorted(L)\nif K==0:\n print(sum(L))\nelse:\n\tprint(sum(L[:-K]))\n', 'N,K=map(int,input().split())\nL=list(map(int,input().split()))\nL=sorted(L)\nsum(L[:K])\n', 'N,K=map(int,input().split())\nL=list(map(int,input().split()))\nsum(list(sorted(L))[:K])\n', 'N,K=map(int,input().split())\nL=list(map(int,input().split()))\nL=sorted(L)\nprint(sum(L[:K]))\n', 'N=int(input())\ncnt=0\nwhile N>0:\n N//=2\n cnt=cnt*2+1\nprint(cnt)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s582701392', 's643320720', 's701353996', 's947047723', 's514769060'] | [2940.0, 2940.0, 2940.0, 3188.0, 2940.0] | [17.0, 17.0, 17.0, 18.0, 17.0] | [125, 85, 87, 92, 64] |
p02786 | u376380063 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import math\n\ndef main():\n print(mama(1000000000000,0,0))\n\ndef mama(hp,num,sum):\n sum = sum + 2**num\n num = num + 1\n if hp <= 1:\n return sum\n\n hp = hp//2\n return mama(hp,num,sum)\n\n\nif __name__ == "__main__":\n main()', 'import math\n\ndef main():\n a = int(input())\n print(mama(a,0,0))\n\ndef mama(hp,num,sum):\n sum = sum + 2**num\n num = num + 1\n if hp <= 1:\n return sum\n\n hp = hp//2\n return mama(hp,num,sum)\n\n\nif __name__ == "__main__":\n main()'] | ['Wrong Answer', 'Accepted'] | ['s360931341', 's194676065'] | [3060.0, 3060.0] | [17.0, 17.0] | [242, 251] |
p02786 | u381585104 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['n = int(input())\nans = 1\nwhile ans < n:\n ans *= 2\nprint(ans -1)', 'n = int(input())\nans = 1\nwhile ans <= n:\n ans *= 2\nprint(ans -1)'] | ['Wrong Answer', 'Accepted'] | ['s506098215', 's302376625'] | [9140.0, 9084.0] | [30.0, 30.0] | [64, 65] |
p02786 | u386170566 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['#D\nimport math\ni = int(input())\nlow = 0\nhigh = 45\nfor _ in range(100):\n l = 2**low\n h = 2**high\n m = 2**((low+high)/2)\n if i < m:\n high = (low+high)/2\n else:\n low = (low+high)/2\nprint(low,high)\ntmp = math.floor(high) + 1\nprint((2**tmp)-1)', '#D\nimport math\ni = int(input())\nlow = 0\nhigh = 45\nfor _ in range(100):\n l = 2**low\n h = 2**high\n m = 2**((low+high)/2)\n if i < m:\n high = (low+high)/2\n else:\n low = (low+high)/2\n#print(low,high)\ntmp = math.floor(high) + 1\nprint((2**tmp)-1)'] | ['Wrong Answer', 'Accepted'] | ['s706201925', 's219572322'] | [3188.0, 3188.0] | [20.0, 20.0] | [267, 268] |
p02786 | u387147192 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = input()\ncnt = 0\nwhile h > 0:\n\th = h // 2\n\tcnt = cnt + 1\n\nprint(pow(2, cnt) - 1)', 'h = int(input())\ncnt = 0\nwhile h > 0:\n h = h // 2\n cnt = cnt + 1\n \nprint(int(pow(2, cnt) - 1))'] | ['Runtime Error', 'Accepted'] | ['s723438127', 's668943507'] | [2940.0, 2940.0] | [17.0, 18.0] | [83, 100] |
p02786 | u389151317 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import math\n\nH, N = map(int, input().split())\nuse_mp = 0\nuse_mp_list = list()\nmag = list()\nfor i in range(N):\n temp = [int(j) for j in input().split()]\n mag.append([temp[0] / temp[1], temp[0], temp[1]])\t\t\t#(ap, mp, dpm)\nmag.sort(reverse=True)\n\nfor i in range(N):\n if H == 0:\n break\n t = H // mag[i][1]\n if t > 0:\n H = H - mag[i][1] * t\n use_mp += mag[i][2] * t\n if H == 0:\n abc = 0\n else:\n abc = (mag[i][2] * math.ceil(H / mag[i][1]))\n #print(mag)\n print(use_mp + abc, mag[i][1], mag[i][2], H, use_mp)\n use_mp_list.append(use_mp + abc)\nprint(min(use_mp_list))', 'import math\n\nH, N = map(int, input().split())\nuse_mp = 0\nuse_mp_list = list()\nmag = list()\nfor i in range(N):\n temp = [int(j) for j in input().split()]\n mag.append([temp[0] / temp[1], temp[0], temp[1]])\t\t\t#(ap, mp, dpm)\nmag.sort(reverse=True)\n\nfor i in range(N):\n if H == 0:\n break\n t = H // mag[i][1]\n if t > 0:\n H = H - mag[i][1] * t\n use_mp += mag[i][2] * t\n if H == 0:\n abc = 0\n else:\n abc = (mag[i][2] * math.ceil(H / mag[i][1]))\n #print(mag)\n use_mp_list.append(use_mp + abc)\nprint(min(use_mp_list))', 'def calc(a):\n if a > 1:\n return 2 * calc(a // 2) + 1\n else:\n return 1\n\na = int(input())\ni = 0\nprint(calc(a))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s286345439', 's529672601', 's904114030'] | [3064.0, 3064.0, 2940.0] | [18.0, 18.0, 20.0] | [585, 530, 116] |
p02786 | u392058721 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = int(input())\nans, i = 0, 1\nwhile h >= i:\n ans += 1\n i *= 2\nprint(ans)', 'h = int(input())\nans, i = 0, 1\nwhile h >= i:\n ans += i\n i *= 2\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s141877730', 's078092971'] | [3060.0, 2940.0] | [19.0, 17.0] | [79, 79] |
p02786 | u392552629 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = int(input())\nprint(h * 0.9094947017737555)', 'h = int(input())\n\n\ndef f(x):\n if x < 1:\n return x\n return 2 * f(x // 2) + 1\n\n\nprint(f(h))\n'] | ['Wrong Answer', 'Accepted'] | ['s737357133', 's402305111'] | [2940.0, 3064.0] | [17.0, 17.0] | [46, 103] |
p02786 | u427093056 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import math\nh=int(input())\nn=math.floor(math.log2(h))\nx=0\nfor i in range(n+1):\n x+=2**i // 2^i\nprint(x)', 'import math\nh=int(input())\nn=math.floor(math.log2(h))\nx=0\nfor i in range(n+1):\n x+=2**i\nprint(x)'] | ['Wrong Answer', 'Accepted'] | ['s137543755', 's207725868'] | [2940.0, 2940.0] | [18.0, 18.0] | [104, 97] |
p02786 | u430160646 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ["a = int(input())\ns = '1' + '0' * (a-1)\nprint(int(s, 2) -1)\n", 'a = int(input())\n\ndef f(n):\n sum = 0\n if (n == 1):\n return 1\n else:\n sum += f(int(n/2)) * 2 + 1\n return sum\n\nprint(f(a))\n'] | ['Runtime Error', 'Accepted'] | ['s198350149', 's989668652'] | [4828.0, 2940.0] | [937.0, 17.0] | [59, 151] |
p02786 | u436611990 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = map(int, input().split())\n\nnum = 1\nres = 1\n\nif H > 1:\n while (num * 2) <= H:\n num = num * 2\n res = num * 2 - 1\n\nprint(res)', 'H = int(input())\n\nnum = 1\nres = 1\n\nif H > 1:\n while (num * 2) <= H:\n num = num * 2\n res = num * 2 - 1\n\nprint(res)'] | ['Runtime Error', 'Accepted'] | ['s337617757', 's959859597'] | [2940.0, 3064.0] | [18.0, 17.0] | [143, 130] |
p02786 | u437215432 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['def f(h):\n return 0 if h==0 else 1 + 2*f(int(h/2))\n\nh = int(input())\nf(h)\n', 'def f(h):\n return 0 if h==0 else 1 + 2*f(int(h/2))\n\nh = int(input())\nprint(f(h))\n'] | ['Wrong Answer', 'Accepted'] | ['s018603431', 's657739430'] | [2940.0, 9144.0] | [17.0, 23.0] | [77, 84] |
p02786 | u437860615 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = int(input())\nmem = [0] * 1000\ncnt = 0\n\ndef atk(k):\n if k == 1:\n return 1\n else:\n j = int(k // 2)\n l = 0\n while k / ( 2 ** l) >1:\n l += 1\n\n if mem[l] == 0:\n mem[l] = atk(j) * 2 + 1\n return mem[l]\n else: \n return mem[l]\nmem[1] = 1\natk(h)\nmem.sort(reverse = True)\nprint(mem[0])\n', 'h = int(input())\nmem = [0] * 100\ncnt = 0\n \ndef atk(k):\n if k == 1:\n mem[1] = 1\n return 1\n else:\n j = int(k // 2)\n l = 0\n while k / ( 2 ** l) >1:\n l += 1\n \n if mem[l] == 0:\n mem[l] = atk(j) * 2 + 1\n return mem[l]\n else: \n return mem[l]\n\natk(h)\nmem.sort(reverse = True)\nprint(mem[0])'] | ['Wrong Answer', 'Accepted'] | ['s058777404', 's928956443'] | [3064.0, 3064.0] | [17.0, 17.0] | [378, 387] |
p02786 | u440161695 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import math\nprint(2**(math.ceil(math.log(float(input()),2)))-1)', 'import math\nprint(2**(math.ceil(log(input(H),2)))-1)', 'import math\nprint(2**(math.ceil(input(H),2))-1)', 'import math\nH=int(input())+1\nprint(2**(math.celi(math.log(H,2)))-1)\n', 'import math\nprint(2**(math.ceil(math.log2(float(input())+1)))-1)'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s005509097', 's492167217', 's669658433', 's768575704', 's399485397'] | [2940.0, 2940.0, 2940.0, 2940.0, 3060.0] | [18.0, 17.0, 17.0, 18.0, 19.0] | [63, 52, 47, 139, 64] |
p02786 | u442877951 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\nene = 0\ncount = 0\nwhile H >= 1:\n H //= 2\n count += ene\nprint(count)', 'H = map(int, input().split())\nenemy = 1\ncount = 0\nwhile H >= 1:\n count += enemy\n enemy *= 2\n H //= 2\nprint(count)', 'H = int(input())\nene = 0\ncount = 0\nwhile H >= 1:\n H //= 2\n count += ene\n ene *= 2\nprint(count)', 'H = int(input())\ncount = 0\nenemy = 1\nwhile H >= 1:\n count += enemy\n H //= 2\nprint(count)', 'H = int(input())\nans = 1\nwhile H >= 1:\n H //= 2\n ans *= 2\nprint(ans-1)'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s310762097', 's375807301', 's517494349', 's924269246', 's427124028'] | [2940.0, 2940.0, 2940.0, 2940.0, 2940.0] | [17.0, 19.0, 17.0, 17.0, 17.0] | [86, 116, 97, 90, 72] |
p02786 | u447068988 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['def pascal_monsters(n):\n return 1 if n <= 1 else n + pascal_monsters(n // 2)', ' = int(input())\n\nresult = 0\ni = 1\nwhile h > 0:\n h = h // 2\n result = result + i\n i *= 2\n\nprint(result)', 'h = int(input())\n\nresult = 0\ni = 1\nwhile h > 0:\n h = h // 2\n result = result + i\n i *= 2\n\nprint(result)'] | ['Wrong Answer', 'Runtime Error', 'Accepted'] | ['s024862275', 's367404335', 's128465356'] | [2940.0, 3064.0, 2940.0] | [17.0, 17.0, 17.0] | [79, 111, 112] |
p02786 | u447679353 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\nnow = 1\nfor i in range(1,100):\n if H< now:\n print(2**i-1)\n break\n else:\n now *= 2\n', 'H = int(input())\nnow = 1\nfor i in range(1,100):\n if now <= H <= now*2-1:\n print(2**i-1)\n break\n else:\n now *= 2\n'] | ['Wrong Answer', 'Accepted'] | ['s267800698', 's288868519'] | [9112.0, 9112.0] | [30.0, 29.0] | [110, 123] |
p02786 | u452885705 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = int(input())\ntem = 1\nwhile h/2 > 1:\n tem+=1\n h = h/2\nresult = 1\nprint("tem"+str(tem))\nfor i in range(1,tem+1):\n result += 2**i\nprint(result)', 'h = int(input())\ntem = 1\nwhile h/2 > 1:\n tem+=1\n h = h/2\nresult = 1\nif h==2:\n for i in range(1,tem+1):\n result += 2**i\nelse:\n for i in range(1,tem):\n result += 2**i\nprint(result)\n'] | ['Wrong Answer', 'Accepted'] | ['s645777095', 's022842271'] | [3060.0, 3064.0] | [19.0, 17.0] | [153, 205] |
p02786 | u459150945 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\n\ncnt = 0\nwhile H > 3:\n H = H//2\n cnt += 1\nprint(H)\nprint(cnt)\nans = 0\nfor i in range(cnt):\n ans += 2**i\nprint(int(((2**cnt)*3)+ans))\n', 'H = int(input())\n\n\ndef f(H):\n if H == 1:\n return 1\n else:\n return f(H//2) * 2 + 1\n\nprint(f(H))\n'] | ['Wrong Answer', 'Accepted'] | ['s913390089', 's598948586'] | [2940.0, 2940.0] | [17.0, 17.0] | [159, 115] |
p02786 | u460375306 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['"""\nif a monster is not attacked, it doesn\'t do anything, so we can\ndeal with each living monster as a separate problem that takes\na certain number of moves to kill it and all of its offspring.\nwhen x is not 1,\nnum(x) = 2*num(floor(x/2))+1\n(because it took one move to kill it, and there will be two offspring)\nand when x is 2 or 3,\nnum(x) = 3\nso we can do some recursion, or memoization, or tabulation\n"""\n\nfrom math import floor\n\n\ndef get_num_attacks(H):\n if H>3:\n return 2*get_num_attacks(floor(H/2))+1\n if H==2 or H==3:\n return 3\n if H==1\n return 1\n\n\nif __name__ == "__main__":\n H = int(input())\n print(get_num_attacks(H))', '"""\nif a monster is not attacked, it doesn\'t do anything, so we can\ndeal with each living monster as a separate problem that takes\na certain number of moves to kill it and all of its offspring.\nwhen x is not 1,\nnum(x) = 2*num(floor(x/2))+1\n(because it took one move to kill it, and there will be two offspring)\nand when x is 2 or 3,\nnum(x) = 3\nso we can do some recursion, or memoization, or tabulation\n"""\n\nfrom math import floor\n\n\ndef get_num_attacks(H):\n if H>3:\n return 2*get_num_attacks(floor(H/2))+1\n if H==2 or H==3:\n return 3\n if H==1:\n return 1\n\n\nif __name__ == "__main__":\n H = int(input())\n print(get_num_attacks(H))'] | ['Runtime Error', 'Accepted'] | ['s303120791', 's978319568'] | [2940.0, 3064.0] | [18.0, 18.0] | [640, 641] |
p02786 | u461833298 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['def attack(num, cnt):\n cnt+=1\n if num==1:\n return cnt\n else:\n return attack(num//2, cnt)\n\n \nH = int(input())\ncnt=0\ncnt = attack(H, cnt)\ntmp = [2**x for x in range(cnt)]\nsum(tmp)', 'def attack(num, cnt):\n cnt+=1\n if num==1:\n return cnt\n else:\n return attack(num//2, cnt)\n\n \nH = int(input())\ncnt=0\ncnt = attack(H, cnt)\ntmp = [2**x for x in range(cnt)]\nprint(sum(tmp))'] | ['Wrong Answer', 'Accepted'] | ['s292149911', 's659701614'] | [2940.0, 2940.0] | [17.0, 17.0] | [203, 210] |
p02786 | u487594898 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['a=int(input())\nn = str(bin (a))\nprint(n,2**(len(n)-2)-1)', 'a=int(input())\nn = str(bin (a))\nprint(2**(len(n)-2)-1)\n'] | ['Wrong Answer', 'Accepted'] | ['s598662693', 's439687175'] | [2940.0, 2940.0] | [18.0, 17.0] | [56, 55] |
p02786 | u496009935 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import math\nh=int(input())\n\ncnt=0\nprint(h//2)\nwhile h>1:\n h=math.ceil(h/2)\n cnt+=1\n \nprint(2**(cnt)+-1)', 'import math, copy\nh=int(input())\n\ncnt=0\na=copy.copy(h)\nwhile a>1:\n a=math.ceil(a/2)\n cnt+=1\n\nif h==2**(cnt):\n print(2**(cnt+1)+-1)\nelse:\n print(2**(cnt)+-1)'] | ['Wrong Answer', 'Accepted'] | ['s094586830', 's689371270'] | [9152.0, 9296.0] | [29.0, 33.0] | [112, 168] |
p02786 | u499106786 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import math\nH = 4\n\nl = 1\nnum = 0\n\nwhile(H>=1):\n num+=l\n H = H//2\n l*=2\n\nprint(num)', 'import math\nH = int(input())\n\nprint(math.floor(math.log(H, 2)))', 'import math\nH = int(input())\n\nl = 1\nnum = 0\n\nwhile(H>=1):\n num+=l\n H = H//2\n l*=2\n\nprint(num)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s273418996', 's770728499', 's493737966'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 20.0] | [103, 63, 115] |
p02786 | u501451051 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['hp = int(input())\n\ncount = 0\n\nwhile hp > 0:\n if hp == 1:\n hp -= 1\n else:\n hp = hp // 2\n \na = 2 ** hp -1\nprint(a)', 'hp = int(input())\n\ncount = 0\n\nwhile hp > 0:\n count += 1\n if hp == 1:\n hp -= 1\n else:\n hp = hp // 2\n \na = 2 ** count -1\nprint(a)'] | ['Wrong Answer', 'Accepted'] | ['s537785671', 's564745022'] | [2940.0, 2940.0] | [18.0, 17.0] | [124, 140] |
p02786 | u507621996 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['# coding utf-8\nimport math\nH = int(input())\n\nmax_h = 10**12\nn = 1\n\nwhile H > 1:\n H //= 2\n n += 1\n print(H)\n\nprint((2**(n-1))-1)\n', '# coding utf-8\nimport math\nH = int(input())\n\nmax_h = 10**12\nn = 1\n\nwhile H > 1:\n H //= 2\n n += 1\n print(H)\n\nprint((2**n)-1)\n', '# coding utf-8\nimport math\nH = int(input())\n\nmax_h = 10**12\nn = 1\n\nwhile H > 1:\n H //= 2\n n += 1\n\nprint((2**n)-1)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s137335398', 's487662364', 's713626109'] | [2940.0, 3064.0, 2940.0] | [17.0, 17.0, 17.0] | [138, 134, 121] |
p02786 | u513844316 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h=int(input())\n\nout=0\nc=0\n\nwhile h>1:\n h=h//2 if h%2==0 else (h+1)//2\n out+=2**c\n c+=1\n\nout+=2**c if h!=1 else 0\n\nprint(out)\n', 'h=int(input())\n\nout=0\nc=0\n\nwhile h>1:\n h=h//2 if h%2==0 else (h+1)//2\n print(h)\n out+=2**c\n c+=1\n\nout+=2**c if h!=1 else 0\n\nprint(out)\n', 'h=int(input())\n\nout=1\nc=0\n\nwhile h>1:\n h=h//2\n c+=1\n out+=2**c\n\nprint(out)\n'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s233593729', 's576576183', 's327162080'] | [2940.0, 3064.0, 2940.0] | [17.0, 18.0, 17.0] | [134, 147, 84] |
p02786 | u514118270 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['N,K = list(map(int,input().split()))\nHa = list(map(int,input().split()))\nHb = sorted(Ha,reverse=True)\ndel Hb[:K]\nprint(sum(Hb))', 'H = int(input())\nans = 0\nnum = 1\nA = [1]\nfor i in range(100):\n if H / 2 < 1:\n ans += 1\n break\n else:\n H = H / 2\n ans += 1\nfor j in range(ans-1):\n A.append(num*2)\n num = num*2\nprint(sum(A))'] | ['Runtime Error', 'Accepted'] | ['s278731838', 's171340921'] | [2940.0, 3060.0] | [17.0, 17.0] | [127, 204] |
p02786 | u516927307 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = int(input())\ndef Count(a):\n if a==1:\n return 1\n return 1+2*Count(a//2)\nprint(Count(a))', 'h = int(input())\ndef Count(a):\n if a==1:\n return 1\n return 1+2*count(a//2)\nprint(Count(a))', 'h = int(input())\ndef Count(a):\n if a==1:\n return 1\n return 1+2*Count(a//2)\nprint(Count(h))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s353034962', 's953434136', 's667367369'] | [2940.0, 2940.0, 2940.0] | [17.0, 17.0, 17.0] | [95, 95, 95] |
p02786 | u517447467 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['n = int(input())\nx = 0\nwhile n > 1:\n n = (n + 1) // 2\n x += 1\nprint(2**x - 1)', 'n = int(input())\nx = 0\nwhile n > (2**x):\n x += 1\nif n == (2**x):\n x += 1\nprint(2**x - 1)'] | ['Wrong Answer', 'Accepted'] | ['s997764328', 's260711859'] | [2940.0, 2940.0] | [17.0, 17.0] | [79, 90] |
p02786 | u527977536 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import math\n\nH = int(input())\nn = math.ceil(math.log2(H))\nprint(2**(n)-1)\n\n', 'import math\n\nH = int(input())\nn = math.ceil(math.log2(H))\n\nif H <= 1024:\n if H==1:\n print(1)\n else:\n \tprint(2**(n)-1)\nelse:\n print(2**(n)-1)\n\n', 'def battle(h):\n if h==1:\n return 1\n else:\n return 2*battle(h//2)+1\n\n\nimport math\n\nH = int(input())\nprint(battle(H))'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s346062408', 's425055097', 's182208131'] | [2940.0, 2940.0, 3060.0] | [17.0, 18.0, 17.0] | [75, 149, 123] |
p02786 | u530786533 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = int(input())\n\ncount = 0\nn = 1\nwhile (h > 1):\n h = int(h / 2)\n count += 1\n n += 2 ** count\nprint(n)\nprint(h)\n', 'h = int(input())\n\ncount = 0\nn = 1\nwhile (h > 1):\n h = int(h / 2)\n count += 1\n n += 2 ** count\nprint(n)\n'] | ['Wrong Answer', 'Accepted'] | ['s934699609', 's313611151'] | [2940.0, 2940.0] | [17.0, 17.0] | [118, 109] |
p02786 | u539874256 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\nprint(H)\ndef ref(H,d):\n d = d+1\n if 1 < H:\n \tH, d = ref(H/2,d*2)\n return H, d\n\n_, d = ref(H,0)\n\nprint(d)', 'H = int(input())\n\ndef ref(H,d):\n d = d+1\n if 1 < H:\n \tH, d = ref(H//2,d*2)\n return H, d\n\n_, d = ref(H,0)\n\nprint(d)'] | ['Wrong Answer', 'Accepted'] | ['s097861005', 's040201395'] | [2940.0, 3064.0] | [17.0, 18.0] | [125, 118] |
p02786 | u540409459 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = int(input())\n\nattack = 1\nwhile h > 0 :\n h = h // 2\n print(h)\n attack *= 2\n\nprint(attack - 1)', 'h = int(input())\n\nattack = 1\nwhile h > 0 :\n h = h // 2\n attack *= 2\n\nprint(attack - 1)'] | ['Wrong Answer', 'Accepted'] | ['s739722485', 's775056486'] | [2940.0, 2940.0] | [18.0, 18.0] | [105, 92] |
p02786 | u543000780 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\nls = [-1]*(H+1)\nls[0] = 0\nls[1] = 1\ndef battle(h):\n if ls[h] != -1:\n return ls[h]\n else:\n tmp = 2*battle(h//2)\n ls[h] = tmp\n return ls[h]\nprint(battle(H))', 'H = int(input())\n\ndef battle(h):\n if h == 1:\n return 1\n else:\n return 2*battle(h//2)+1\nprint(battle(H))\n\n'] | ['Runtime Error', 'Accepted'] | ['s222864198', 's347379563'] | [15016.0, 9040.0] | [38.0, 28.0] | [185, 113] |
p02786 | u547167033 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import math\nh=int(input())\nm=int(math.log(h,2))\nprint(int(2**(h+1)-1))', 'h=int(input())\nm=int(math.long(h,2))\nprint(2**(h+1)-1)', 'import math\nh=int(input())\nm=math.ceil(math.log2(h))\nprint(2**m-1)', 'import math\nh=int(input())\nm=int(math.long(h,2))\nprint(2**(h+1)-1)\n', 'import math\nh=int(input())\nm=math.floor(math.log2(h))\nprint(2**(m+1)-1)'] | ['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s437959993', 's607245739', 's620627624', 's625111294', 's800669259'] | [206192.0, 2940.0, 2940.0, 3064.0, 3060.0] | [2106.0, 17.0, 18.0, 17.0, 18.0] | [70, 54, 66, 67, 71] |
p02786 | u549383771 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['n =int(input())\nans = 1\nfor i in range(int(np.log2(n))):\n ans += 2**(i+1)\n \nprint(ans)', 'import numpy as np\nn =int(input())\nans = 1\nfor i in range(int(np.log2(n))):\n ans += 2**(i+1)\n \nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s930746019', 's441415489'] | [2940.0, 12488.0] | [17.0, 149.0] | [92, 111] |
p02786 | u552176911 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = int(input())\n\ns = 0\nc = 1\nwhile h >= 0:\n s += c\n c *= 2\n h //= 2\nprint(s)', 'h = int(input())\n\ns = 0\nc = 1\nwhile h != 0:\n s += c\n c *= 2\n h //= 2\nprint(s)\n'] | ['Time Limit Exceeded', 'Accepted'] | ['s269070291', 's885363256'] | [3060.0, 2940.0] | [2104.0, 18.0] | [80, 81] |
p02786 | u553070631 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h=int(input())\nfor i in range(41):\n if h<pow(2,i):\n print(pow(2,i)-1)', 'h=int(input())\nfor i in range(41):\n if h<pow(2,i):\n print(pow(2,i)-1)\n break'] | ['Wrong Answer', 'Accepted'] | ['s036006709', 's967141776'] | [2940.0, 3316.0] | [17.0, 32.0] | [73, 84] |
p02786 | u556589653 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\n\ns = 1\ncount = 0\nwhile H > 0:\n\tcount += n\n\tH //= 2\n\ts *= 2\n\nprint(count)\n', 'H = int(input())\n\ns = 1\ncount = 0\nwhile H > 0:\n\tcount += s\n\tH //= 2\n\ts *= 2\n\nprint(count)\n'] | ['Runtime Error', 'Accepted'] | ['s322097172', 's098399511'] | [2940.0, 2940.0] | [17.0, 17.0] | [90, 90] |
p02786 | u558494840 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h_ = int(input())\nh = h_\nans = 0\ncount = 1\nfor i in range(h):\n if h <= 1:\n print(count)\n break\n count += 1\n h = h//2\n\nprint((2 ** count)-1)\n\n\n\n', 'h_ = int(input())\nh = h_\nans = 0\ncount = 1\nfor i in range(h):\n if h <= 1:\n break\n count += 1\n h = h//2\n\nprint((2 ** count)-1)\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s023525650', 's933538184'] | [3060.0, 2940.0] | [17.0, 17.0] | [333, 134] |
p02786 | u564589929 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['from math import floor\t\nh = int(input())\n\ni = 1\nwhile True:\n if 2**i < h < 2**(i+1):\n print(2**(i+1)-1)\n break\n else:\n i += 1', 'from math import floor\t\nh = int(input())\ncnt = 0\ndef attack(hp):\n if hp == 1:\n global cnt\n cnt += 1\n return\n else:\n hp = floor(hp/2)\n attack(hp)\n attack(hp)\n\nattack(h)\nprint(cnt)', 'from math import floor\t\nh = int(input())\ncnt = 0\ndef attack(hp):\n if hp == 1:\n global cnt\n cnt += 1\n return\n else:\n hp = floor(hp/2)\n global cnt\n cnt += 1\n attack(hp)\n attack(hp)\n\nattack(h)\nprint(cnt)', 'h = int(input())\nh_bi = bin(h)[2:]\nprint(2**len(h_bi)-1)'] | ['Time Limit Exceeded', 'Wrong Answer', 'Time Limit Exceeded', 'Accepted'] | ['s153697252', 's670357879', 's786484586', 's839566834'] | [3060.0, 3060.0, 3056.0, 2940.0] | [2104.0, 2104.0, 2104.0, 17.0] | [150, 212, 240, 56] |
p02786 | u569776981 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\nans = 0\nwhile H > 0:\n if H == 1:\n ans += 1\n else:\n e = H // 2\n ans += e\n H -= 1\nprint(ans)\n', 'H = int(input())\nc = 0\nans = 0\nwhile H > 1:\n H = H // 2\n c += 1\nfor i in range(c + 1):\n ans += 2 ** i\nprint(ans)'] | ['Time Limit Exceeded', 'Accepted'] | ['s653154913', 's942742205'] | [8996.0, 9104.0] | [2205.0, 27.0] | [142, 121] |
p02786 | u571444155 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = int(input())\n\ncount = 0\n\ndef cal(h):\n if h = 1:\n count = count + 1\n return 0\n \n return count + cal(int(h/2))) + 1\n\nprint(cal(h))', 'h = int(input())\n \n\ndef cal(h):\n if h == 1:\n return 1\n \n return 2*cal(int(h/2)) + 1\n \nprint(cal(h))'] | ['Runtime Error', 'Accepted'] | ['s010033093', 's412799832'] | [2940.0, 2940.0] | [17.0, 17.0] | [141, 105] |
p02786 | u573754721 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h=int(input())\n\na=1\nb=1\nans=0s\nfor i in range(1,h+1):\n if i==b:\n ans+=b\n b=b*2\n \nprint(ans)', 'h=int(input())\n\nans=1\np=1\nwhile h>1:\n h=h//2\n p=p*2\n ans+=p\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s227126037', 's558623570'] | [2940.0, 3060.0] | [17.0, 21.0] | [136, 79] |
p02786 | u580316619 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h=int(input())\na=0\nb=0\nif h%2 != 0:\n\th=h-1\nc=h\nwhile h > 1:\n\th=int(h/2)\n\ta+=1\nprint(a)\nfor i in range(a):\n\tb+=2**i\nprint(2**a+b)', 'h=int(input())\na=0\nb=0\nif h%2 != 0:\n\th=h-1\nc=h\nwhile h > 1:\n\th=int(h/2)\n\ta+=1\n\nfor i in range(a):\n\tb+=2**i\nprint(2**a+b)'] | ['Wrong Answer', 'Accepted'] | ['s530230020', 's757995602'] | [3060.0, 3060.0] | [17.0, 18.0] | [128, 120] |
p02786 | u582632397 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['n = int(input())\nn = int(log2(n))+1\nprint(2**n-1)', 'import math\nn = int(input())\nn = int(math.log2(n))+1\nprint(2**n-1)'] | ['Runtime Error', 'Accepted'] | ['s678157010', 's068931455'] | [2940.0, 3188.0] | [19.0, 18.0] | [49, 66] |
p02786 | u588749694 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input()) \natCount = 0 \n\nnthPow = H\nn = 0\n\nwhile nthPow > 1:\n nthPow = int(nthPow / 2)\n n = n + 1\nprint(n)\nprint(2 ** (n + 1) - 1)', 'H = int(input()) \natCount = 0 \nn = 0 \n\n\nwhile H > 1:\n H = int(H / 2)\n n = n + 1\n\nprint(2 ** (n + 1) - 1)'] | ['Wrong Answer', 'Accepted'] | ['s929099783', 's799611572'] | [3060.0, 2940.0] | [17.0, 17.0] | [203, 219] |
p02786 | u589578850 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import math\nh = int(input())\nprint(2**math.ceil(math.log(h,2))-1)', 'import math\nh = int(input())\nprint(2**(math.floor(math.log(h,2))+1)-1)'] | ['Wrong Answer', 'Accepted'] | ['s346884276', 's373243157'] | [2940.0, 3188.0] | [17.0, 18.0] | [65, 70] |
p02786 | u589969467 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['memo = [0] * 1000000000000\nmemo[1] = 1\n\ndef saiki(n):\n global memo\n tmp = 0\n if n <= 1:\n return memo[1]\n else:\n tmp = int(n/2)\n if memo[tmp] == 0:\n memo[tmp] = saiki(tmp)\n return memo[tmp]+memo[tmp]+1\n \nh = int(input())\nprint(saiki(h))\n', '\n#memo[1] = 1\n\ndef saiki(n):\n# global memo\n tmp = 0\n if n <= 1:\n return 1\n# return memo[1]\n else:\n tmp = int(n/2)\n return saiki(tmp) * 2 + 1\n# if memo[tmp] == 0:\n\n# return memo[tmp]+memo[tmp]+1\n \nh = int(input())\nprint(saiki(h))\n'] | ['Runtime Error', 'Accepted'] | ['s371205070', 's938141432'] | [9000.0, 9044.0] | [22.0, 26.0] | [290, 344] |
p02786 | u595981869 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import math\n\nH = input()\nm = math.ceil(math.log2(int(H)))\nn = int(math.pow(2, m) - 1)\nprint(n)', 'import math\n\nH = input()\nm = math.ceil(math.log2(int(H) + 1))\nn = int(math.pow(2, m) - 1)\nprint(n)'] | ['Wrong Answer', 'Accepted'] | ['s324610369', 's082170093'] | [2940.0, 2940.0] | [17.0, 19.0] | [94, 98] |
p02786 | u598378638 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = map(int, input().split())\nmonster = list(h)\n\nattack_count = 0\nfin_flag = 0\n\nprint(monster)\n\nwhile(fin_flag == 0):\n\n for i in range(len(monster)) :\n attack_count = attack_count + 1\n if(monster[i] == 1):\n if(i == 0 and monster[0] == 1):\n fin_flag = 1\n break\n monster.pop(i)\n else:\n monster.append(monster[i]//2)\n monster.append(monster[i]//2)\n monster.pop(i)\n\nprint(attack_count+1)', "h = input()\n\ndef myfunc(hp: 'int') -> 'int':\n if(hp == 1):\n return 1\n elif(hp > 1):\n return int(myfunc(hp/2)) * 2 + 1\n return hp\n\n\nif __name__ == '__main__':\n ans = myfunc(int(h))\n print(ans)"] | ['Runtime Error', 'Accepted'] | ['s592443183', 's292105657'] | [8600.0, 3060.0] | [2104.0, 17.0] | [492, 220] |
p02786 | u601384736 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['from math import ceil\n\nh = int(input())\n\nans = 1\ni = 0\nwhile h > 1:\n i += 1\n h = ceil(h/2)\nprint(i)\nfor k in range(1, i+1):\n ans += 2**k\n\nprint(ans)\n', 'from math import floor\n\nh = int(input())\n\nans = 1\ni = 0\nwhile h != 1:\n i += 1\n h = floor(h/2)\n ans += 2**i\n\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s952705669', 's103852795'] | [3060.0, 2940.0] | [17.0, 17.0] | [158, 128] |
p02786 | u602158689 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import math\n\nh = float(input())\n\ncount = 1\nwhile(h > 1) {\n h = round(h / 2)\n count+=1\n}\nprint(count)\n', 'import math\n\nh = int(input())\n\ncount = 0\nwhile h > 1:\n h = math.floor(h/2)\n count += 1\n\nprint(2**count*2-1)'] | ['Runtime Error', 'Accepted'] | ['s768005102', 's349628257'] | [2940.0, 3060.0] | [17.0, 17.0] | [103, 109] |
p02786 | u602267597 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = input()\ncount = 0\ncount_1 = 1\ncount_2 = 1\nwhile True:\n if h == 1:\n print(count_2)\n break\n else:\n h = h // 2\n count_1 = count_1 * 2\n count_2 += count_1', 'h = int(input())\ncount = 0\ncount_1 = 1\ncount_2 = 1\nwhile True:\n if h == 1:\n print(count_2)\n break\n else:\n h = h // 2\n count_1 = count_1 * 2\n count_2 += count_1'] | ['Runtime Error', 'Accepted'] | ['s554485002', 's704015218'] | [2940.0, 2940.0] | [17.0, 18.0] | [195, 200] |
p02786 | u613922299 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['a = int(input())\n\ndef Rec(a):\n if a == 1: \n print("1になった")\n return 1\n print("今から再帰関数呼ぶ:{}".format(a))\n return 1 + Rec(a//2)*2\n\nprint(Rec(a))\n', 'a = int(input())\n\ndef Rec(a):\n if a == 1: \n return 1\n return 1 + Rec(a//2)*2\n\nprint(Rec(a))\n'] | ['Wrong Answer', 'Accepted'] | ['s023632686', 's978539170'] | [2940.0, 2940.0] | [17.0, 17.0] | [176, 97] |
p02786 | u625255205 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = int(input())\n#a,b = map(int,input().split())\n#a_L = list(map(int,input().split()))\n\nans_L = [0] * (10**12 + 1)\n\ni = 0\nans_L = [1]\nwhile h!=1:\n h = h//2\n i += 1\n ans_L.append(2**i)\n\nprint(sum(ans_L)) ', 'h = int(input())\n#a,b = map(int,input().split())\n#a_L = list(map(int,input().split()))\n\n#ans_L = [0] * (10**12 + 1)\n\ni = 0\nans_L = [1]\nwhile h!=1:\n h = h//2\n i += 1\n ans_L.append(2**i)\n\nprint(sum(ans_L)) '] | ['Runtime Error', 'Accepted'] | ['s483217908', 's563692610'] | [3060.0, 2940.0] | [17.0, 17.0] | [212, 213] |
p02786 | u655048024 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = int(input())\nans = 0\ni = 0\nwhile True:\n if(i>=h):\n break\n i+=1\nif(i == 0):\n print(1)\nelse:\n print(2**(i+1)-1)\n', 'h = int(input())\nans = 0\ni = 0\nwhile True:\n if(i>=h):\n break\n break\nif(i = 0):\n print(1)\nelse:\n print(2**(i+1)-1)', 'h = int(input())\nans = 0\ni = 0\nwhile True:\n if(i>=h):\n break\n i+=\nif(i = 0):\n print(1)\nelse:\n print(2**(i+1)-1)\n', 'h = int(input())\nans = 0\ni = 0\nwhile True:\n if(2**i>=h):\n break\n i+=1\nif(i == 0):\n print(1)\nelif(2**i==h):\n print(2**(i+1)-1)\nelse:\n print(2**i-1)\n'] | ['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s086638251', 's765805828', 's824963611', 's376606767'] | [9616.0, 9024.0, 8956.0, 9172.0] | [2205.0, 24.0, 24.0, 30.0] | [121, 120, 119, 155] |
p02786 | u655110382 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H, ans, n = int(input()), 0, 1\nwhile H == 0:\n ans, n, H = ans + n, n ** 2, H // 2\nprint(ans)\n', 'H, ans, n = int(input()), 0, 1\nwhile H != 0:\n ans, n, H = ans + n, n * 2, H // 2\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s616906312', 's808097447'] | [2940.0, 2940.0] | [18.0, 17.0] | [96, 95] |
p02786 | u674588203 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['# H=int(input())\nH=1000000000000\nm=1\na=0\n\nwhile H>1:\n a=m\n H=H//2\n _m=2*m\n m=_m\n\nprint(2*m-1)', 'H=int(input())\nm=1\na=0\n\nwhile H>1:\n a=m\n H=H//2\n _m=2*m\n m=_m\n\nprint(2*m-1)'] | ['Wrong Answer', 'Accepted'] | ['s978505306', 's155895892'] | [2940.0, 3060.0] | [17.0, 20.0] | [105, 87] |
p02786 | u674951726 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['H = int(input())\nx = 2\nfor i in range(40):\n if x < H and x*2 > H:\n ans = x*2 - 1\n break\n x = x*2\n \nprint(ans)', 'H = int(input())\nx = 2\nfor i in range(40):\n if x < H and x*2 >= H:\n ans = x*2 - 1\n break\n x = x*2\n\nprint(ans)', 'H = int(input())\nx = 2\nfor i in range(41):\n if x <= H and x*2 > H:\n ans = x*2 - 1\n break\n x = x*2\n \nif H == 1:\n ans = 1\n\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s637063975', 's832982519', 's918200561'] | [2940.0, 3064.0, 3064.0] | [17.0, 17.0, 18.0] | [120, 117, 141] |
p02786 | u686230543 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['h = int(input().split())\nprint(2 ** (len(bin(h)) - 2) - 1)', 'h = int(input())\nprint(2 ** (len(bin(h)) - 2) - 1)'] | ['Runtime Error', 'Accepted'] | ['s173872887', 's192364352'] | [2940.0, 2940.0] | [17.0, 17.0] | [58, 50] |
p02786 | u691018832 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10 ** 7)\n\nh = int(readline())\ncnt = 0\nfor i in range(h):\n if h < 2 ** i:\n print(cnt)\n exit()\n else:\n cnt += 2 ** i\n', 'import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nsys.setrecursionlimit(10 ** 7)\n\nh = int(readline())\ncnt = 0\nif h == 1:\n print(1)\nelif h == 2:\n print(3)\nelse:\n for i in range(h):\n if h < 2 ** i:\n print(cnt)\n exit()\n else:\n cnt += 2 ** i\n'] | ['Wrong Answer', 'Accepted'] | ['s986411005', 's685706232'] | [2940.0, 2940.0] | [17.0, 17.0] | [280, 360] |
p02786 | u692453235 | 2,000 | 1,048,576 | Caracal is fighting with a monster. The _health_ of the monster is H. Caracal can attack by choosing one monster. When a monster is attacked, depending on that monster's health, the following happens: * If the monster's health is 1, it drops to 0. * If the monster's health, X, is greater than 1, that monster disappears. Then, two new monsters appear, each with the health of \lfloor X/2 \rfloor. (\lfloor r \rfloor denotes the greatest integer not exceeding r.) Caracal wins when the healths of all existing monsters become 0 or below. Find the minimum number of attacks Caracal needs to make before winning. | ['import math\nH = int(input())\n\np = math.ceil(math.log2(H))\nprint(2**p - 1)', 'import math\nH = int(input())\n\np = math.floor(math.log2(H) + 1)\nprint(2**p - 1)'] | ['Wrong Answer', 'Accepted'] | ['s036405653', 's591753327'] | [2940.0, 3060.0] | [17.0, 18.0] | [73, 78] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.