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
|
---|---|---|---|---|---|---|---|---|---|---|
p04001 | u183657342 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["s = str(input())\nans = 0\n\nfor i in 2**(len(s)-1):\n x = s[0]\n\n for j in range(len(s)-1):\n if (i>>j) & 1:\n x += '+'\n x += s[j+1]\n \n ans += sum(map(int,x.split('+')))\nprint(ans)", "s = str(input())\nans = 0\n\nfor i in range(2**(len(s)-1)):\n x = s[0]\n\n for j in range(len(s)-1):\n if (i>>j) & 1:\n x += '+'\n x += s[j+1]\n \n ans += sum(map(int,x.split('+')))\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s534885835', 's791132015'] | [3060.0, 3060.0] | [17.0, 20.0] | [215, 222] |
p04001 | u192165179 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['from sys import stdin\ninput = stdin.readline\n\nS = input()\nn = len(S)\n\ntot = 0\n\nfor i in range(2**(n-1)):\n f = S[0]\n for j in range(n-1):\n if ((i >> j) & 1):\n f += " "\n f += S[j+1]\n \n tot += sum(map(int, f.split(" ")))\n\nprint(tot)', 'S = input()\nn = len(S)\n\ntot = 0\n\nfor i in range(2**(n-1)):\n f = S[0]\n for j in range(n-1):\n if ((i >> j) & 1):\n f += " "\n f += S[j+1]\n \n tot += sum(map(int, f.split(" ")))\n\nprint(tot)'] | ['Runtime Error', 'Accepted'] | ['s532178637', 's804677068'] | [9100.0, 8952.0] | [29.0, 34.0] | [252, 206] |
p04001 | u193019328 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['S = input()\nn = len(S)\nans = 0\nfor bit in range(1 << (n-1)):\n f = S[0]\n for i in range(n-1):\n if bit & (1 << (n-1)):\n f += "+"\n f += S[i+1]\n ans += sum(map(int,f.split("+")\nprint(ans) ', 'a = input()\nsum = int(a)\nfor i in range(len(a)-1):\n sum += int(a[:i]) + int(a[i+1:])\nprint(int(sum))', 's = input()\nn = len(s)\nans = 0\nfor bit in range( 1 << (n-1)):\n f = s[0]\n for i in range(n-1):\n if bit & (1 << i):\n f += "+"\n f += s[i+1]\n ans += sum(map(int, f.split("+")))\nprint(ans) '] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s633352290', 's674017588', 's567969696'] | [2940.0, 2940.0, 3064.0] | [17.0, 17.0, 20.0] | [212, 101, 200] |
p04001 | u201856486 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['import sys\n\n# import math\n# import itertools\n# import numpy as np\n# import collections\n\n"""Template"""\n\n\nclass IP:\n \n\n def __init__(self):\n self.input = sys.stdin.readline\n\n def I(self):\n \n return int(self.input())\n\n def S(self):\n \n return self.input()\n\n def IL(self):\n \n return list(map(int, self.input().split()))\n\n def SL(self):\n \n return list(map(str, self.input().split()))\n\n def ILS(self, n):\n \n return [int(self.input()) for _ in range(n)]\n\n def SLS(self, n):\n \n return [self.input() for _ in range(n)]\n\n def SILS(self, n):\n \n return [self.IL() for _ in range(n)]\n\n def SSLS(self, n):\n \n return [self.SL() for _ in range(n)]\n\n\nclass Idea:\n def __init__(self):\n pass\n\n def HF(self, p):\n \n return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))\n\n def Bfs2(self, a):\n \n \n # https://blog.rossywhite.com/2018/08/06/bit-search/\n \n value = []\n for i in range(1 << len(a)):\n output = []\n\n for j in range(len(a)):\n if self.bit_o(i, j):\n \n # output.append(a[j])\n output.append(a[j])\n value.append([format(i, \'b\').zfill(16), sum(output)])\n\n value.sort(key=lambda x: x[1])\n bin = [value[k][0] for k in range(len(value))]\n val = [value[k][1] for k in range(len(value))]\n return bin, val\n\n def S(self, s, r=0, m=-1):\n \n r = bool(r)\n if m == -1:\n s.sort(reverse=r)\n else:\n s.sort(reverse=r, key=lambda x: x[m])\n\n def bit_n(self, a, b):\n \n return bool((a >> b & 1) > 0)\n\n def bit_o(self, a, b):\n \n return bool(((a >> b) & 1) == 1)\n\n def ceil(self, x, y):\n \n return -(-x // y)\n\n def ave(self, a):\n \n return sum(a) / len(a)\n\n def gcd(self, x, y):\n if y == 0:\n return x\n else:\n return self.gcd(y, x % y)\n\n\n\n\n\ndef main():\n \n r, e, p = range, enumerate, print\n ip = IP()\n id = Idea()\n mod = 10 ** 9 + 7\n\n \n s = ip.S()\n ans = 0\n for i in r(1 << len(s)):\n output = 0\n res = 0\n for j in r(len(s)):\n if (i >> j) & 1:\n output += int(s[res:j + 1])\n res += j + 1\n output += int(s[res:])\n ans += output\n p(ans)\n\n\nmain()\n', '# coding: utf-8\nimport sys\n\n# import math\n# import numpy as np\n\n\n"""Template"""\n\n\nclass IP:\n \n def __init__(self):\n self.input = sys.stdin.readline\n\n def I(self):\n \n return int(self.input())\n\n def IL(self):\n \n return list(map(int, self.input().split()))\n\n def SL(self):\n \n return list(map(str, self.input().split()))\n\n def ILS(self, n):\n \n return [int(self.input()) for _ in range(n)]\n\n def SLS(self, n):\n \n return [self.input() for _ in range(n)]\n\n\nclass Idea:\n def __init__(self):\n pass\n\n def HF(self, p):\n \n return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))\n\n def Bfs2(self, a):\n \n \n # https://blog.rossywhite.com/2018/08/06/bit-search/\n \n value = []\n for i in range(1 << len(a)):\n output = []\n\n for j in range(len(a)):\n if ((i >> j) & 1) == 1:\n \n # output.append(a[j])\n output.append(a[j])\n value.append([format(i, \'b\').zfill(16), sum(output)])\n\n value.sort(key=lambda x: x[1])\n bin = [value[k][0] for k in range(len(value))]\n val = [value[k][1] for k in range(len(value))]\n return bin, val\n\n\n\n\n\ndef main():\n \n r, e = range, enumerate\n ip = IP()\n id = Idea()\n\n \n s = str(ip.I())\n ans = 0\n \n n = len(s) - 1\n\n \n for i in r(1 << n):\n \n p = ""\n for j, d in e(s):\n p += d\n if (i >> j & 1) > 0:\n p += "+"\n if i == n:\n break\n p += s[-1]\n ans += eval(p)\n print(ans)\n\n\nmain()\n', '# coding: utf-8\nimport sys\n\n# import math\n# import numpy as np\n\n\n"""Template"""\n\n\nclass IP:\n \n def __init__(self):\n self.input = sys.stdin.readline\n\n def I(self):\n \n return int(self.input())\n\n def IL(self):\n \n return list(map(int, self.input().split()))\n\n def SL(self):\n \n return list(map(str, self.input().split()))\n\n def ILS(self, n):\n \n return [int(self.input()) for _ in range(n)]\n\n def SLS(self, n):\n \n return [self.input() for _ in range(n)]\n\n\nclass Idea:\n def __init__(self):\n pass\n\n def HF(self, p):\n \n return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))\n\n def Bfs2(self, a):\n \n \n # https://blog.rossywhite.com/2018/08/06/bit-search/\n \n value = []\n for i in range(1 << len(a)):\n output = []\n\n for j in range(len(a)):\n if ((i >> j) & 1) == 1:\n \n # output.append(a[j])\n output.append(a[j])\n value.append([format(i, \'b\').zfill(16), sum(output)])\n\n value.sort(key=lambda x: x[1])\n bin = [value[k][0] for k in range(len(value))]\n val = [value[k][1] for k in range(len(value))]\n return bin, val\n\n\n\n\n\ndef main():\n \n r, e = range, enumerate\n ip = IP()\n id = Idea()\n\n \n s = str(ip.I())\n ans = 0\n \n n = len(s) - 1\n\n \n for i in r(n):\n \n p = ""\n for j in r(n):\n p += s[j]\n if (i >> j & 1) > 0:\n p += "+"\n p += s[-1]\n ans += eval(p)\n print(ans)\n\n\nmain()\n', 'import sys\n\n# import math\n# import itertools\n# import numpy as np\n# import collections\n\n"""Template"""\n\n\nclass IP:\n \n\n def __init__(self):\n self.input = sys.stdin.readline\n\n def I(self):\n \n return int(self.input())\n\n def S(self):\n \n return self.input()\n\n def IL(self):\n \n return list(map(int, self.input().split()))\n\n def SL(self):\n \n return list(map(str, self.input().split()))\n\n def ILS(self, n):\n \n return [int(self.input()) for _ in range(n)]\n\n def SLS(self, n):\n \n return [self.input() for _ in range(n)]\n\n def SILS(self, n):\n \n return [self.IL() for _ in range(n)]\n\n def SSLS(self, n):\n \n return [self.SL() for _ in range(n)]\n\n\nclass Idea:\n def __init__(self):\n pass\n\n def HF(self, p):\n \n return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))\n\n def Bfs2(self, a):\n \n \n # https://blog.rossywhite.com/2018/08/06/bit-search/\n \n value = []\n for i in range(1 << len(a)):\n output = []\n\n for j in range(len(a)):\n if self.bit_o(i, j):\n \n # output.append(a[j])\n output.append(a[j])\n value.append([format(i, \'b\').zfill(16), sum(output)])\n\n value.sort(key=lambda x: x[1])\n bin = [value[k][0] for k in range(len(value))]\n val = [value[k][1] for k in range(len(value))]\n return bin, val\n\n def S(self, s, r=0, m=-1):\n \n r = bool(r)\n if m == -1:\n s.sort(reverse=r)\n else:\n s.sort(reverse=r, key=lambda x: x[m])\n\n def bit_n(self, a, b):\n \n return bool((a >> b & 1) > 0)\n\n def bit_o(self, a, b):\n \n return bool(((a >> b) & 1) == 1)\n\n def ceil(self, x, y):\n \n return -(-x // y)\n\n def ave(self, a):\n \n return sum(a) / len(a)\n\n def gcd(self, x, y):\n if y == 0:\n return x\n else:\n return self.gcd(y, x % y)\n\n\n\n\n\ndef main():\n \n r, e, p = range, enumerate, print\n ip = IP()\n id = Idea()\n mod = 10 ** 9 + 7\n\n \n s = str(ip.I())\n ans = 0\n for i in r(1 << len(s) - 1):\n output = 0\n res = 0\n for j in r(len(s) - 1):\n if (i >> j) & 1:\n output += int(s[res:j + 1])\n res = j + 1\n output += int(s[res:len(s)])\n ans += output\n p(ans)\n\n\nmain()\n'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s066854928', 's193682000', 's875872911', 's449432987'] | [3192.0, 3192.0, 3192.0, 3192.0] | [19.0, 28.0, 19.0, 20.0] | [4952, 3097, 3047, 4970] |
p04001 | u209620426 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['def search(i,s):\n\tif i == n-1:\n\t\tli = []\n\t\ts = "".join(s)\n\t\tli = list(map(int,s.split("+")))\n\t\ttotal.append(sum(li))\n\t\treturn\n\n\telse:\n\t\tsearch(i+1,s)\n\n\t\t_s = s[:-(n-i)+1] + ["+"] + s[-(n-i)+1:]\n\t\tsearch(i+1,_s)\n\nsearch(0,s)\nprint(sum(total))', 's = list(input())\ntotal = []\nn = len(s)\n\ndef search(i,s):\n\tif i == n-1:\n\t\tli = []\n\t\ts = "".join(s)\n\t\tli = list(map(int,s.split("+")))\n\t\ttotal.append(sum(li))\n\t\treturn\n\n\telse:\n\t\tsearch(i+1,s)\n\n\t\t_s = s[:-(n-i)+1] + ["+"] + s[-(n-i)+1:]\n\t\tsearch(i+1,_s)\n\nsearch(0,s)\nprint(sum(total))'] | ['Runtime Error', 'Accepted'] | ['s188029785', 's007235456'] | [3060.0, 3064.0] | [17.0, 20.0] | [241, 282] |
p04001 | u235783479 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s = input()\n# print(s)\n\nscore = 0\nfor blocksize in range(1,len(s)+1):\n for startpoint in range(len(s)):\n \n if startpoint+blocksize >= (len(s)+1): continue\n block = s[startpoint:startpoint+blocksize]\n ss = int(block) * math.factorial(startpoint) * math.factorial(len(s) - (startpoint+blocksize))\n \n score += ss\nprint(score)\nexit()', 'def f(n):\n if n <= -1:\n return 1\n return 2**(n-1)\n\ns = input()\n\nscore = 0\nfor blocksize in range(1,len(s)+1):\n for startpoint in range(len(s)):\n if startpoint+blocksize >= (len(s)+1): continue\n block = s[startpoint:startpoint+blocksize] \n ss = int(block) * f(startpoint-1) * f(len(s) - (startpoint+blocksize))\n score += ss\nprint(score)\nexit()\n', 'def f(n):\n if n <= 0:\n return 1\n return 2**(n-1)\n\ns = input()\n\nscore = 0\nfor blocksize in range(1,len(s)+1):\n for startpoint in range(len(s)):\n if startpoint+blocksize >= (len(s)+1): continue\n block = s[startpoint:startpoint+blocksize] \n ss = int(block) * f(startpoint) * f(len(s) - (startpoint+blocksize))\n \n score += ss\nprint(score)\nexit()'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s616971222', 's957929333', 's595646934'] | [3060.0, 3060.0, 3060.0] | [17.0, 17.0, 18.0] | [500, 389, 484] |
p04001 | u254086528 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['sr = input()\nn = len(sr)\n\nblist = []\nfor i in range(2**(n-1)):\n blist.append(list(map(int,list(bin(i)[2::].zfill(n-1)))))\nprint(blist)\n\nssum = 0\nfor k,num in enumerate(blist):\n bi = 0\n bsum = 0\n print(num)\n for i,j in enumerate(num):\n if j == 1:\n bsum += int(sr[bi:i+1])\n bi = i+1\n if i == (len(num)-1):\n bsum += int(sr[bi:])\n ssum += bsum\nprint(ssum)', 'sr = input()\nn = len(sr)\n\nblist = []\nfor i in range(2**(n-1)):\n blist.append(list(map(int,list(bin(i)[2::].zfill(n-1)))))\n\nssum = 0\nfor k,num in enumerate(blist):\n bi = 0\n bsum = 0\n print(num)\n for i,j in enumerate(num):\n if j == 1:\n bsum += int(sr[bi:i+1])\n bi = i+1\n if i == (len(num)-1):\n bsum += int(sr[bi:])\n ssum += bsum\nprint(ssum)', 'sr = input()\nn = len(sr)\n\nblist = []\nfor i in range(2**(n-1)):\n blist.append(list(map(int,list(bin(i)[2::].zfill(n-1)))))\n\nssum = 0\nfor k,num in enumerate(blist):\n bi = 0\n bsum = 0\n for i,j in enumerate(num):\n if j == 1:\n bsum += int(sr[bi:i+1])\n bi = i+1\n if i == (len(num)-1):\n bsum += int(sr[bi:])\n ssum += bsum\nprint(ssum)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s733069483', 's898079701', 's384100971'] | [3188.0, 3188.0, 3064.0] | [22.0, 22.0, 21.0] | [416, 403, 388] |
p04001 | u255382385 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["s = input()\nn = len(s) - 1\nsum = 0\n\nif n == 0:\n print(s)\n return\n\nfor bit in range(1 << n):\n eval_str = ''\n for i in range(n):\n eval_str += s[i]\n if bit & (1 << i):\n eval_str += '+'\n eval_str += s[i + 1]\n sum += eval(eval_str)\n\nprint(sum)", "s = input()\nn = len(s) - 1\nsum = 0\n\nfor bit in range(1 << n):\n eval_str = ''\n eval_str += s[0]\n for i in range(n):\n if bit & (1 << i):\n eval_str += '+'\n eval_str += s[i + 1]\n sum += eval(eval_str)\n\nprint(sum)"] | ['Runtime Error', 'Accepted'] | ['s380064310', 's663423700'] | [3064.0, 3060.0] | [17.0, 26.0] | [281, 245] |
p04001 | u263753244 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['print(l)\nindexes=[[] for _ in range(2**(n-1))]\nfor k in range(2**(n-1)):\n indexes[k]=[i for i, x in enumerate(l[k]) if x == 1]\n#print(indexes)\nSUM=0\nfor j in range(2**(n-1)):\n L=len(indexes[j])\n if L==0:\n SUM+=int(s)\n #print(SUM)\n else:\n SUM+=int(s[:indexes[j][0]+1])\n #print(SUM)\n SUM+=int(s[indexes[j][L-1]+1:])\n #print(SUM)\n if L>1:\n for h in range(L-1):\n SUM+=int(s[indexes[j][h]+1:indexes[j][h+1]+1])\n #print(SUM)\nprint(SUM)', 's=input()\nn=len(s)\nl=[[] for _ in range(2**(n-1))]\nfor b in range(2**(n-1)):\n x=b\n for i in range(n-1):\n if x%2==1:\n l[b].append(1)\n else:\n l[b].append(0)\n x//=2\nprint(l)\nindexes=[[] for _ in range(2**(n-1))]\nfor k in range(2**(n-1)):\n indexes[k]=[i for i, x in enumerate(l[k]) if x == 1]\n#print(indexes)\nSUM=0\nfor j in range(2**(n-1)):\n L=len(indexes[j])\n if L==0:\n SUM+=int(s)\n #print(SUM)\n else:\n SUM+=int(s[:indexes[j][0]+1])\n #print(SUM)\n SUM+=int(s[indexes[j][L-1]+1:])\n #print(SUM)\n if L>1:\n for h in range(L-1):\n SUM+=int(s[indexes[j][h]+1:indexes[j][h+1]+1])\n #print(SUM)\nprint(SUM)', 's=input()\nn=len(s)\nl=[[] for _ in range(2**(n-1))]\nfor b in range(2**(n-1)):\n x=b\n for i in range(n-1):\n if x%2==1:\n l[b].append(1)\n else:\n l[b].append(0)\n x//=2\n#print(l)\nindexes=[[] for _ in range(2**(n-1))]\nfor k in range(2**(n-1)):\n indexes[k]=[i for i, x in enumerate(l[k]) if x == 1]\n#print(indexes)\nSUM=0\nfor j in range(2**(n-1)):\n L=len(indexes[j])\n if L==0:\n SUM+=int(s)\n #print(SUM)\n else:\n SUM+=int(s[:indexes[j][0]+1])\n #print(SUM)\n SUM+=int(s[indexes[j][L-1]+1:])\n #print(SUM)\n if L>1:\n for h in range(L-1):\n SUM+=int(s[indexes[j][h]+1:indexes[j][h+1]+1])\n #print(SUM)\nprint(SUM)'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s379777195', 's758721736', 's307853353'] | [3064.0, 3188.0, 3188.0] | [17.0, 22.0, 21.0] | [531, 742, 743] |
p04001 | u276144769 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['dp=["","+"]\ns=input()\nsu=0\nfor i in range(2**(len(s)-1)):\n val=""\n for j in range(len(s)-1):\n val+=s[j]\n val+=dp[int(bin(i)[j+2])]\n val+=s[len(s)-1]\n su+=eval(val)\nprint(su)\n', 'dp=["","+"]\ns=input()\nsu=0\nfor i in range(2**(len(s)-1)):\n val=""\n for j in range(len(s)-1):\n val+=s[j]+dp[bin(i)[j+2]]\n val+=s[len(s)-1]\n su+=eval(val)\nprint(su)', 'dp=["","+"]\ns=input()\nsu=0\nfor i in range(2**(len(s)-1)):\n val=""\n for j in range(len(s)-1):\n val+=s[j]\n val+=dp[bin(i)[j+2]]\n val+=s[len(s)-1]\n su+=eval(val)\nprint(su)', 'dp=["","+"]\ns=input()\nsu=0\nfor i in range(2**(len(s)-1)):\n val=""\n b=bin(i)[2:].zfill(len(s)-1)\n for j in range(len(s)-1):\n val+=s[j]+dp[int(b[j])]\n val+=s[len(s)-1]\n su+=eval(val)\nprint(su)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s057033465', 's208269809', 's392828628', 's027146916'] | [3064.0, 3064.0, 3064.0, 3064.0] | [23.0, 22.0, 22.0, 33.0] | [200, 181, 194, 212] |
p04001 | u319612498 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s=list(map(int,list(input())))\nn=len(s)\nans=0\nfor i in range(1<<(n-1)):\n\n S=s[0]\n for j in range(n-1):\n if i & (1<<j): \n S+="+"+s[j+1]\n else: \n S+=s[j+1]\n ans+=eval(S)\nprint(ans)', 's=list(input())\nn=len(s)\nans=0\nfor i in range(1<<(n-1)):\n\n \n\n S=s[0]\n for j in range(n-1):\n if i & (1<<j): \n S+="+"+s[j+1]\n else: \n S+=s[j+1]\n ans+=eval(S)\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s222574298', 's920691982'] | [2940.0, 3060.0] | [17.0, 27.0] | [502, 509] |
p04001 | u322229918 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s = input()\n\nitem = np.arange(len(s) - 1) + 1\nn = len(item)\ncount = 0\nfor i in range(2 ** n):\n sidx = 0\n for j in range(n): \n if ((i >> j) & 1): \n eidx = item[j]\n count += int(s[sidx:eidx])\n sidx = eidx\n count += int(s[sidx:])\nprint(count)', 'import numpy as np\ns = input()\n\nn = len(s)\niters = 2 ** (n - 1)\ncount = 0\nfor i in range(iters):\n buf = s[0]\n for j in range(n - 1):\n if i & (2**j):\n count += int(buf)\n buf = s[j + 1]\n else:\n buf += s[j + 1]\n count += int(buf)\nprint(count)'] | ['Runtime Error', 'Accepted'] | ['s601130087', 's319370331'] | [3060.0, 12664.0] | [17.0, 151.0] | [396, 295] |
p04001 | u322568242 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s=input()\n\nans=0\nfor i in range(1<<(len(s)-1)):\n sum=0\n temp=int(s[0])\n for j in range(len(s)-1):\n if i>>j&1:\n temp=temp*10+int(s[j+1])\n else :\n sum+=temp\n temp=int(s[j+1])\n sum+=temp\n print(sum)\n ans+=sum\nprint(ans)', 's=input()\n\nans=0\nfor i in range(1<<(len(s)-1)):\n sum=0\n temp=int(s[0])\n for j in range(len(s)-1):\n if i>>j&1:\n temp=temp*10+int(s[j+1])\n else :\n sum+=temp\n temp=int(s[j+1])\n sum+=temp\n ans+=sum\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s749417129', 's338218535'] | [3064.0, 3060.0] | [21.0, 21.0] | [281, 266] |
p04001 | u329399746 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s = input()\nans = 0\nmemo = []\nfor i in range(1 << len(s) -1):\n print(bin(i))\n tmp = s[0]\n for j in range(len(s)-1):\n if ((i >> j) & 1):\n tmp+="+"\n tmp += s[j+1]\n if tmp not in memo:\n ans+=eval(tmp)\n memo.append(tmp)\nprint(ans)', 's = input()\nans = 0\nmemo = []\nfor i in range(1 << len(s) -1):\n tmp = s[0]\n for j in range(len(s)-1):\n if ((i >> j) & 1):\n tmp+="+"\n tmp += s[j+1]\n if tmp not in memo:\n ans+=eval(tmp)\n memo.append(tmp)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s552450873', 's687164081'] | [3064.0, 3060.0] | [30.0, 30.0] | [277, 259] |
p04001 | u342042786 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['S = str(input())\np = ["+",""]\ntotal = 0\n\nfor i in range(2**(len(S)-1)):\n t = S[0]\n for j in range(len(S)-1):\n t = t + p[i>>j&1] + S[j+1]\n print(t)\n total += eval(t)\nprint(total)', 'S = str(input())\np = ["+",""]\ntotal = 0\n\nfor i in range(2**(len(S)-1)):\n t = S[0]\n for j in range(len(S)-1):\n t = t + p[i>>j&1] + S[j+1]\n total += eval(t)\nprint(total)'] | ['Wrong Answer', 'Accepted'] | ['s531520847', 's433565291'] | [3060.0, 3060.0] | [28.0, 26.0] | [196, 183] |
p04001 | u345621867 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['S = input()\nn = len(S)\nres = 0\nfor i in range(1 << n-1):\n subres = 0\n subst = S[0]\n for j in range(n-1):\n if i >> j & 1:\n subres += int(subst)\n subst = S[j+1]\n else:\n subst += S[j+1]\n if j == n - 2:\n subres += int(subst)\n print(bin(i),j,subst,subres)\n res += subres\nprint(res)\n\n\n', 'S = input()\nn = len(S)\nres = 0\nfor i in range(1 << n-1):\n subres = 0\n subst = S[0]\n for j in range(n-1):\n if i >> j & 1:\n subres += int(subst)\n subst = S[j+1]\n else:\n subst += S[j+1]\n if j == n - 2:\n subres += int(subst)\n res += subres\nif n == 1:\n print(int(S))\nelse:\n print(res)\n\n\n'] | ['Wrong Answer', 'Accepted'] | ['s548667676', 's379123654'] | [9180.0, 9052.0] | [39.0, 27.0] | [363, 365] |
p04001 | u366133198 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["#!/usr/bin/python3 \n\nimport itertools\n\ndef all_comb(n):\n comb = []\n for i in range(0, n+1):\n comb.extend(list(itertools.combinations(range(n), i)))\n return comb\n\nif __name__=='__main__':\n str = input()\n comb = all_comb(len(str)-1)\n tail = 0\n sum = 0\n for plus_positions in comb:\n head = 0\n for plus_position in plus_positions:\n num = int(str[head:plus_position+1])\n sum += num\n head = plus_position + 1\n num = int(str[head:])\n\tsum += num\n print(sum)\n", "#!/usr/bin/python3 \n\nimport itertools\n\ndef all_comb(n):\n comb = []\n for i in range(0, n+1):\n comb.extend(list(itertools.combinations(range(n), i)))\n return comb\n\nif __name__=='__main__':\n str = input()\n comb = all_comb(len(str)-1)\n tail = 0\n sum = 0\n for plus_positions in comb:\n head = 0\n for plus_position in plus_positions:\n num = int(str[head:plus_position+1])\n sum += num\n head = plus_position + 1\n num = int(str[head:])\n sum += num\n print(sum)\n"] | ['Runtime Error', 'Accepted'] | ['s018643908', 's439796595'] | [2940.0, 3064.0] | [21.0, 19.0] | [723, 730] |
p04001 | u370429695 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['def dfs(i, sum):\n if i == len(s) - 1:\n return sum(list(map(int,sum.split("+"))))\n\n return dfs(i+1, sum + s[i+1]) + dfs(i+1, sum + "+" + s[i+1])\n\ns = input()\nprint(dfs(0,s[0]))', 'def dfs(i, f):\n if i == len(s) - 1:\n return sum(list(map(int,f.split("+"))))\n\n return dfs(i+1, f + s[i+1]) + dfs(i+1, f + "+" + s[i+1])\n\ns = input()\nprint(dfs(0,s[0]))'] | ['Runtime Error', 'Accepted'] | ['s333587549', 's802333698'] | [3060.0, 3060.0] | [18.0, 18.0] | [188, 180] |
p04001 | u374051158 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["S = input()\nans = 0\nfor p in itertools.product(['', '+'], repeat = len(S) - 1):\n cmd = ''.join([s + t for s, t in zip(S, p)]) + S[-1]\n ans += eval(cmd)\nprint(ans)", "import itertools\nS = input()\nans = 0\nfor p in itertools.product(['', '+'], repeat = len(S) - 1):\n cmd = ''.join([s + t for s, t in zip(S, p)]) + S[-1]\n ans += eval(cmd)\nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s972042868', 's755452348'] | [2940.0, 3060.0] | [17.0, 26.0] | [168, 185] |
p04001 | u375616706 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['H, W, N = map(int, input().split())\nmat = [[0]*W for _ in range(H)]\n\nfor _ in range(N):\n a, b = map(int, input().split())\n mat[a-1][b-1] = 1\n\n\ndp = [[0]*W for _ in range(H)]\nfor h in range(H):\n cnt = 0\n if mat[h][0] == 1:\n dp[h][0] = 1\n for w in range(1, W):\n if mat[h][w] == 1:\n dp[h][w] += 1\n dp[h][w] += dp[h][w-1]\n\n\nans = [0]*10\nfor i in range(10):\n tmp = 0\n for h in range(H-3):\n for w in range(W-3):\n s = 0\n for k in range(3):\n s += dp[h+k][w+2]-dp[h+k][w]\n if s == i:\n tmp += 1\n ans[i] = tmp\n\nfor i in ans:\n print(i)\n', "s = input()\nnums = [int(v) for v in s]\n\nl = len(s)\n\nans = 0\nfor i in range(1 << (l-1)):\n tmp = s[0]\n for j in range(l-1):\n if i & 1 << j:\n tmp += '+'+s[j+1]\n else:\n tmp += s[j+1]\n ans += eval(tmp)\nprint(ans)\n"] | ['Runtime Error', 'Accepted'] | ['s405848051', 's284018253'] | [3188.0, 3060.0] | [19.0, 27.0] | [653, 253] |
p04001 | u381246791 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['#coding:utf-8\nS=input()\nn=len(S)-1\nanswer=0\nfor i in range(2**n):\n formula=list(S)\n for j in range(n):\n if ((i<<j)&1):\n formula=S.insart("+",j+1)\n for i,elem in enumerate(formula):\n num=""\n if elem=="+" or i==len(formula)-1:\n answer+=int(num)\n num=0\n else:\n num+=elem\nprint(answer)\n \n', '#coding:utf-8\nS=str(input())\nn=len(S)-1\nanswer=0\nfor i in range(2**(n)):\n formula=S[0]\n for j in range(n):\n if ((i>>j)&1):\n formula+="+"\n formula+=S[j+1]\n answer+=sum(map(int,formula.split("+")))\nprint(answer)'] | ['Runtime Error', 'Accepted'] | ['s572044718', 's316324728'] | [3060.0, 3060.0] | [17.0, 20.0] | [322, 223] |
p04001 | u386170566 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['\ns = list(str(input()))\nl = len(s)\ndef dfs(i,f):\n if i == l-1:\n return sum(list(map(int,f.split("+"))))\n return dfs(i + 1, f + s[i+1]) + \\ \n dfs(i + 1, f + "+" +s[i + 1])\nprint(dfs(0,s[0]))', '\ns = list(str(input()))\nl = len(s)\ndef dfs(i,f):\n if i == l-1:\n return sum(list(map(int,f.split("+"))))\n \n return dfs(i + 1, f + s[i+1]) + \\\n dfs(i + 1, f + "+" +s[i + 1])\nprint(dfs(0,s[0]))'] | ['Runtime Error', 'Accepted'] | ['s627344345', 's310415687'] | [2940.0, 3060.0] | [17.0, 19.0] | [304, 308] |
p04001 | u392029857 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["s = input()\nop = ['','+']\nif len(s) == 1:\n print(s)\nelse:\n s = s + 'X'*(10 -len(s))\n ans = []\n for a in op:\n for b in op:\n for c in op:\n for d in op:\n for e in op:\n for f in op:\n for g in op:\n for h in op:\n for i in op:\n \u3000\u3000\u3000ans.append(s[0]+a+s[1]+b+s[2]+c+s[3]+d+s[4]+e+s[5]+f+s[6]+g+s[7]+h+s[8]+i+s[9])\n for i in range(len(ans)):\n for j in range(len(ans[i])):\n if ans[i][j] == 'X':\n if ans[i][j-1] == '+':\n ans[i] = ans[i][:j-1]\n else:\n ans[i] = ans[i][:j]\n break\n sums = 0\n for i in set(ans):\n sums += eval(i)\n print(sums)\n", "s = input()\nop_cnt = len(s) - 1\nans = []\nfor i in range(2**op_cnt):\n op = ['']*op_cnt\n for j in range(op_cnt):\n if ((i >> j) & 1):\n op[op_cnt - 1 - j] = '+'\n f = s[0]\n for p, q in zip(op, s[1:]):\n f += p + q\n ans.append(f)\nsums = 0\nfor i in ans:\n sums += eval(i)\nprint(sums)\n"] | ['Runtime Error', 'Accepted'] | ['s977021170', 's847136515'] | [3064.0, 3064.0] | [18.0, 27.0] | [870, 318] |
p04001 | u408620326 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["import sys\ninput = sys.stdin.readline\ns = input()\nn = len(s)\nans = 0\nfor i in range(1<<(n-1)):\n t = ''\n for j in range(n-1):\n t += s[j]\n if (i >> j) & 1:\n t += '+'\n else:\n t += s[n-1]\n ans += eval(t)\nprint(ans)\n", "import sys\ninput = sys.stdin.readline\ns = input().strip()\nn = len(s)\nans = 0\nfor i in range(1<<(n-1)):\n t = ''\n for j in range(n-1):\n t += s[j]\n if (i >> j) & 1:\n t += '+'\n else:\n t += s[n-1]\n ans += eval(t)\nprint(ans)\n"] | ['Runtime Error', 'Accepted'] | ['s060328042', 's392820556'] | [3060.0, 3060.0] | [26.0, 26.0] | [255, 263] |
p04001 | u411858517 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["import itertools\n\ndef solve(S):\n \n count = 0\n bit_list = list(itertools.product([0, 1], repeat=len(S)-1))\n for pattern in bit_list:\n \n start = 0\n for end in range(len(pattern)):\n if pattern[end] == 1:\n count += int(S[start:end+1])\n start = end + 1\n \n if end == len(bit) - 1:\n count += int(S[start:])\n \n print(count)\n\n\nif __name__ == '__main__':\n S = input()\n solve(S)", "import itertools\n\ndef solve(S):\n \n \n if len(S) == 1:\n print(int(S))\n else:\n count = 0\n bit_list = list(itertools.product([0, 1], repeat=len(S)-1))\n for pattern in bit_list:\n \n start = 0\n for end in range(len(pattern)):\n if pattern[end] == 1:\n count += int(S[start:end+1])\n start = end + 1\n \n count += int(S[start:])\n\n print(count)\n\n\nif __name__ == '__main__':\n S = input()\n solve(S)"] | ['Runtime Error', 'Accepted'] | ['s840134770', 's677641381'] | [2940.0, 3064.0] | [17.0, 19.0] | [1108, 1200] |
p04001 | u412255932 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['S = int(input())\n\ndef dfs(res, depth, path, S):\n res.append(path)\n if depth == len(S) - 1:\n return\n for i in range(depth + 1, len(S)):\n dfs(res, i, int(S[depth:i+1]), S)\n\nres = []\n\ndfs(res, -1, [], S)\nprint(sum(res))\n', 'S = input()\n\ndef dfs(res, depth, path, S):\n res.append(path)\n if depth == len(S):\n return\n for i in range(depth + 1, len(S)+1):\n dfs(res, i, int(S[depth:i]), S)\n\nres = []\n\ndfs(res, 0, 0, S)\nprint(sum(res))\n', "from functools import reduce\nS = input()\n\ndef dfs(res, depth, path, S):\n if len(''.join(path)) == len(S):\n res.append(path)\n for i in range(depth + 1, len(S) + 1):\n dfs(res, i, path + [S[depth:i]], S)\n\nres = []\n\ndfs(res, 0, [], S)\n\nprint(sum(int(num) for nums in res for num in nums))\n"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s012193765', 's413470582', 's189136578'] | [3060.0, 2940.0, 3572.0] | [20.0, 18.0, 24.0] | [240, 229, 305] |
p04001 | u433195318 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['#include <stdio.h>\n#include <stdlib.h>\n\n#include <iomanip>\n\n#include <string.h>\n#include <string>\n#include <map>\n#include <stack>\n\n#include <deque>\n#include <set>\n#include <math.h>\n#include <algorithm>\n#include <numeric>\n\nusing namespace std;\n\n// マクロ&定数 ============================================================\ntypedef unsigned int uint;\ntypedef long long ll;\n//typedef pair<int, int> P;\n\ntypedef vector<int> vint;\ntypedef vector<ll> vll;\ntypedef vector<double> vdouble;\ntypedef vector<bool> vbool;\ntypedef vector<string> vstring;\n\ntypedef vector<pair<int, int>> vpint;\ntypedef vector<pair<ll, ll>> vpll;\ntypedef vector<pair<double, double>> vpdouble;\n\ntypedef vector<vector<int>> vvint;\ntypedef vector<vector<ll>> vvll;\ntypedef vector<vector<double>> vvdouble;\ntypedef vector<vector<bool>> vvbool;\n\nconst int c_YET = -1;\nconst int INF = 1e9 + 1;\nconst ll LLINF = 1e17 + 1;\nconst int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;4近傍\nconst int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:8近傍 9:(0,0)を含む\nconst ll MOD = 1e9 + 7; //10^9 + 7\nconst ll MAX = 1e9;\nconst double PI = 3.14159265358979323846264338327950288;\n//========================================================================\n\n\n\nint main() {\n\n\t//==================================\n\tcin.tie(nullptr);\n\tios_base::sync_with_stdio(false);\n\tcout << fixed << setprecision(30);\n\t//==================================\n\n\n\tstring S;\n\tcin >> S;\n\n\tll ans = 0;\n\n\tll size = S.length();\n\t\n\tvll N(size);\n\t\n\tfor (ll i = 0; i < size; i++) {\n\t\tN[i] = ll(S[i]) - 48;\n\t}\n\n\tll time = 0;\n\n\tfor (ll bit = 0; bit < (1<<size-1) ; bit++) {\n\n\t\tll local = 0;\n\t\tfor (ll i = 0; i < size-1; i++) {\n\n\t\t\tlocal *= 10;\n\t\t\tlocal += N[i];\n\n\t\t\tif ((bit >> (size - 2 - i)) & 1) {\n\t\t\t\tans += local;\n\t\t\t\tlocal = 0;\n\n\t\t\t\tif (i == size - 2) {\n\n\t\t\t\t\tans += local + N[i + 1];\n\t\t\t\t\tlocal = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tif (i == size - 2) {\n\t\t\t\t\tlocal *= 10;\n\t\t\t\t\tans += local + N[i + 1];\n\t\t\t\t\tlocal = 0;\n\t\t\t\t}\n\t\t\t}\n\n\n\n\t\t}\n\t\ttime++;\n\t}\n\n\tif (size == 1) {\n\t\tcout << S;\n\t\treturn 0;\n\t}\n\n\tcout << ans << endl;\n\n\n\n\n\n}\n\n', 'import sys\nimport math\nimport fractions\nimport bisect\nimport queue\nimport heapq\nimport collections\nimport itertools\nsys.setrecursionlimit(4100000)\n\nMOD = int(1e9+7)\nPI = 3.14159265358979323846264338327950288\nINF = 1e18\n\n\n\n\n\nS = input()\n\nS = S[::-1]\n\n\n\nans = int(S[0]) * (2**(len(S)-1))\nfor i in range(1, len(S)):\n final = 0 \n for keta in range(0, i+1):\n if keta == i:\n final = 1\n ans += int(S[i]) * (10**keta) * (2**int(len(S)-2-keta+final))\n #print(S[i], keta, int(S[i]) * (10**keta) * (2**int(len(S)-2-keta+final)))\nprint(ans)\n\n\n\n\n\n'] | ['Runtime Error', 'Accepted'] | ['s853749744', 's829670247'] | [3064.0, 5088.0] | [17.0, 37.0] | [2110, 1744] |
p04001 | u435281580 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["import numpy as np\n\nN, M = map(int, input().split())\nroutes = np.array([list(map(int, input().split())) for _ in range(M)], 'i')\n#print(routes)\n\n\ndp = [{} for _ in range(N + 1)]\ndp[1][0] = 0\n\nfor i in range(2, N + 1):\n for (f, t, m) in routes:\n if t != i:\n continue\n\n if m in dp[f]:\n dp[t][m] = dp[f][m]\n else:\n values = []\n for k, v in dp[f].items():\n if k != m: values.append(v)\n if len(values) > 0:\n dp[t][m] = min(values) + 1\n\nif len(dp[N].values()) > 0:\n print(min(dp[N].values()))\nelse:\n print(-1)", "import numpy as np\n\ndef many_fomulas(digits):\n mat = np.zeros((len(digits), len(digits)), 'i')\n\n for i, _ in enumerate(digits):\n if i >= 0:\n mat[i, :i] = 2 ** (i - 1)\n mat[i, i] = 2 ** i\n\n total = 0\n for i, _ in enumerate(digits):\n for j, v in enumerate(digits):\n total += 10 ** (len(digits) - i - 1) * int(mat[i, j]) * v\n\n print(total)\n\n#many_fomulas([1, 2, 5])\n#many_fomulas([9, 9, 9, 9, 9, 9, 9, 9, 9, 9])\nmany_fomulas([int(d) for d in input()])\n"] | ['Runtime Error', 'Accepted'] | ['s931153026', 's295361819'] | [12516.0, 12448.0] | [155.0, 152.0] | [703, 507] |
p04001 | u441191580 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["# coding: utf-8\n# Your code here!\n\n# coding: utf-8\n# Your code here!\n\ns = input()\nsList = list(s)\nsList = [int(i) for i in s]\nsCount = len(sList)\n#print(sCount)\n\naaa = 0\n\nfor i in range(2**(sCount-1)):\n\n binaryNumber = format(i,'b')\n binaryNumber = binaryNumber.zfill(sCount-1)\n binaryNumber = list(binaryNumber)\n binaryNumber = [int(i) for i in binaryNumber]\n \n \n for i in range(sCount-1):\n if binaryNumber[i] == 1 :\n binaryNumber[i] = '+'\n \n #print(sList)\n #print(binaryNumber)\n \n result = [None]*(len(sList)+len(binaryNumber))\n result[::2] = sList\n result[1::2] = binaryNumber\n \n while 0 in result:\n result.remove(0)\n \n #print(result) \n result = map(str, result)\n resultStr = ''.join(result)\n \n aaa = aaa + eval(resultStr)\n \n print(aaa)\n \n \n \n ", "# coding: utf-8\n# Your code here!\n\n# coding: utf-8\n# Your code here!\n\ns = input()\nsList = list(s)\nsList = [int(i) for i in s]\nsCount = len(sList)\n#print(sCount)\n\naaa = 0\n\nfor i in range(2**(sCount-1)):\n\n binaryNumber = format(i,'b')\n binaryNumber = binaryNumber.zfill(sCount-1)\n binaryNumber = list(binaryNumber)\n binaryNumber = [int(i) for i in binaryNumber]\n \n \n for i in range(sCount-1):\n if binaryNumber[i] == 1 :\n binaryNumber[i] = '+'\n \n #print(sList)\n #print(binaryNumber)\n \n result = [None]*(len(sList)+len(binaryNumber))\n result[::2] = sList\n result[1::2] = binaryNumber\n \n while 0 in result:\n result.remove(0)\n \n #print(result) \n result = map(str, result)\n resultStr = ''.join(result)\n \n aaa = aaa + eval(resultStr)\n \nprint(aaa)\n \n \n \n "] | ['Wrong Answer', 'Accepted'] | ['s981036944', 's788927878'] | [3188.0, 3064.0] | [33.0, 33.0] | [863, 859] |
p04001 | u446371873 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["s = input()\nl = len(s)\nans = 0\nfor i in range(2**(l-1)):\n eval = ''\n for j in range(l):\n if ((i >> j) & 1):\n eval += s[j] + '+'\n else:\n eval += s[j]\n ans += eval(eval)", 's = input()\nans = 0\nfor i in range(s):\n ans += int(s[0:i]) + int(s[i:len(s)])\nans += int(s)\nprint(ans)', 's = input()\nl = len(s)\nans = 0\nfor i in range(2**(l-1)):\n e = ""\n for j in range(l):\n if ((i >> j) & 1):\n e += s[j] + "+"\n else:\n e += s[j]\n ans += eval(e)\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s735265750', 's846215152', 's704811675'] | [3060.0, 2940.0, 3060.0] | [18.0, 18.0, 27.0] | [212, 103, 211] |
p04001 | u454899755 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['S = input()\n\ndef dfs(res, depth, path, S):\n res[0] += int(path)\n for i in range(depth + 1, len(S) + 1):\n dfs(res, i, S[depth:i], S)\n\nres = [0]\n\ndfs(res, 0, 0, S)\nprint(res[0])\n', 'S = input()\n\ndef dfs(start, S, curSum, res):\n\tif start >= len(S):\n\t\tres[0] += curSum\n\t\treturn\n\n # put a plus on each space until last\n\tfor i in range(start+1, len(S) + 1):\n\t\tdfs(i, S, curSum+int(S[start:i]), res)\n\n\t\nres = [0]\n\ndfs(0, S, 0, res)\nprint(res[0])'] | ['Wrong Answer', 'Accepted'] | ['s190385763', 's589330546'] | [2940.0, 3060.0] | [18.0, 18.0] | [189, 261] |
p04001 | u455957433 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['def insert_string_to_base(target_string, insert_point, insert_string):\n return target_string[:insert_point] + insert_string + target_string[insert_point:]\n\ndef main():\n N = str(input())\n l = len(N)-1\n\n result = 0\n for i in range(2 ** l):\n count = 1\n st = N\n for j in range(l):\n if ((i >> j) & 1):\n st = insert_string_to_base(st, j+count, "+")\n count+=1\n\n print(st)\n for v in st.split("+"):\n if(v != \'\'):\n result += int(v)\n print(result)\n\n\nif __name__ == "__main__":\n main()\n\n', 'def insert_string_to_base(target_string, insert_point, insert_string):\n return target_string[:insert_point] + insert_string + target_string[insert_point:]\n\ndef main():\n N = str(input())\n l = len(N)-1\n\n result = 0\n for i in range(2 ** l):\n count = 1\n st = N\n for j in range(l):\n if ((i >> j) & 1):\n st = insert_string_to_base(st, j+count, "+")\n count+=1\n\n for v in st.split("+"):\n if(v != \'\'):\n result += int(v)\n print(result)\n\n\nif __name__ == "__main__":\n main()\n\n'] | ['Wrong Answer', 'Accepted'] | ['s306423878', 's869306580'] | [3064.0, 3060.0] | [21.0, 20.0] | [598, 580] |
p04001 | u477320129 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['from itertools import product\nH, W, N = list(map(int, input().split()))\nA = [tuple(map(int, input().split())) for _ in range(N)]\ncount = {}\nfor x, y in A:\n for xx, yy in product(range(x-1, x+2), range(y-1, y+2)):\n if not(2 <= xx <= H-1 and 2 <= yy <= W-1):\n continue\n count[(xx, yy)] = count.get((xx, yy), 0) + 1\nans = [0] * 10\nfor k, v in count.items():\n ans[v] += 1\nans[0] = (H - 2) * (W - 2) - sum(ans)\nprint(*ans, sep="\\n")\n', 'from itertools import product\n\nS = tuple(input())\nN = len(S)\nres = 0\nfor ops in product(["+", ""], repeat=N-1):\n exp = "".join([n + op for n, op in zip(S, ops+("",))]).strip("+")\n res += eval(exp)\nprint(res)\n'] | ['Runtime Error', 'Accepted'] | ['s629776672', 's450682937'] | [3064.0, 3064.0] | [39.0, 52.0] | [459, 214] |
p04001 | u487594898 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['S = input()\nans=0\nfor i in range(1<<len(S)):\n f =S[0]\n for j in range(len(S)-1):\n if i &(1<<j):\n f +="+"\n f +=S[j+1]\n ans += sum(map(int, f.split("+")))\nprint(ans)\n', 'S = input()\nans=0\nfor i in range(1<<len(S)-1):\n f =S[0]\n for j in range(len(S)-1):\n if i &(1<<j):\n f +="+"\n f +=S[j+1]\n ans += sum(map(int, f.split("+")))\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s749391151', 's380261305'] | [2940.0, 3060.0] | [24.0, 20.0] | [198, 200] |
p04001 | u489762173 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['import sys\nimport copy\n\ndef main():\n sum=0\n S = list(map(str, input()))\n hoge = tmp = []\n print(S)\n\n op_cnt = len(S) - 1\n\n for i in range(2 ** op_cnt):\n op = [""] * op_cnt\n for j in range(op_cnt):\n if ((i >> j) & 1):\n op[op_cnt -1 -j] = "+"\n\n print(i,op)\n\n S_tmp = copy.deepcopy(S)\n for k in range(len(op)):\n S_tmp.insert(1+k*2,op[k])\n print("".join(S_tmp))\n sum+=(eval("".join(S_tmp)))\n print(sum)\n print(sum)\n\nmain()', 'import sys\nimport copy\n\ndef main():\n sum=0\n S = list(map(str, input()))\n hoge = tmp = []\n\n op_cnt = len(S) - 1\n\n for i in range(2 ** op_cnt):\n op = [""] * op_cnt\n for j in range(op_cnt):\n if ((i >> j) & 1):\n op[op_cnt -1 -j] = "+"\n\n S_tmp = copy.deepcopy(S)\n for k in range(len(op)):\n S_tmp.insert(1+k*2,op[k])\n sum+=(eval("".join(S_tmp)))\n print(sum)\n\nmain()'] | ['Wrong Answer', 'Accepted'] | ['s846282192', 's278633927'] | [3572.0, 3444.0] | [43.0, 38.0] | [532, 449] |
p04001 | u492447501 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['import sys\n\nS = input()\n\nN = len(S)-1\nsum = 0\n\nfor i in range(2**N):\n\n op = [""]*(N)\n for j in range(N):\n if (i>>j)&1:\n op[j] = "+"\n s = ""\n for j in range(N):\n s = s + S[j] + op[j]\n s = s + S[j]\n sum = sum + eval(s)\nprint(sum)', 'import sys\n\nS = input()\n\nN = len(S)-1\nsum = 0\n\nfor i in range(2**N):\n\n op = [""]*(N)\n for j in range(N):\n if (i>>j)&1:\n op[j] = "+"\n s = ""\n for j in range(N):\n s = s + S[j] + op[j]\n s = s + S[len(S)-1]\n sum = sum + eval(s)\nprint(sum)'] | ['Runtime Error', 'Accepted'] | ['s383414696', 's942033555'] | [3064.0, 3064.0] | [27.0, 27.0] | [270, 277] |
p04001 | u494037809 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['S = input()\n\ndef saiki(n, s=S[0]):\n _sum = 0\n \n if n==len(S)-1:\n print(s)\n return eval(s)\n \n _sum += saiki(n+1, s + "+" + S[n+1])\n _sum += saiki(n+1, s + S[n+1])\n \n return _sum\n \nprint(saiki(0))', 'S = input()\n\ndef saiki(n, s=S[0]):\n _sum = 0\n \n if n==len(S)-1:\n# print(s)\n return eval(s)\n \n _sum += saiki(n+1, s + "+" + S[n+1])\n _sum += saiki(n+1, s + S[n+1])\n \n return _sum\n \nprint(saiki(0))'] | ['Wrong Answer', 'Accepted'] | ['s980241846', 's531648809'] | [3060.0, 3060.0] | [26.0, 25.0] | [235, 237] |
p04001 | u494058663 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["S = list(input())\nN = len(S)\nList = []\nfor i in range(2**(N-1)):\n tmp = ''\n for j in range(N-1):\n if ((i>>j) & 1):\n tmp += '1'\n else:\n tmp += '0'\n List.append(list(tmp))\nans = 0\nfor i in range(len(List)):\n start = 0\n tmp = ''\n for j in range(len(List[i])):\n if List[i][j] == '0':\n tmp += S[j]\n if List[i][j] == '1':\n tmp += S[j]\n ans += int(tmp)\n tmp = ''\n tmp += S[-1]\n ans += int(tmp)\nprint(ans)\n\n \nprint(ans)\n", "S = list(input())\nN = len(S)\nList = []\nfor i in range(2**(N-1)):\n tmp = ''\n for j in range(N-1):\n if ((i>>j) & 1):\n tmp += '1'\n else:\n tmp += '0'\n List.append(list(tmp))\nans = 0\nfor i in range(len(List)):\n start = 0\n tmp = ''\n for j in range(len(List[i])):\n if List[i][j] == '0':\n tmp += S[j]\n if List[i][j] == '1':\n tmp += S[j]\n ans += int(tmp)\n tmp = ''\n tmp += S[-1]\n ans += int(tmp)\n\n \nprint(ans)"] | ['Wrong Answer', 'Accepted'] | ['s105206594', 's275404274'] | [3064.0, 3064.0] | [22.0, 22.0] | [541, 529] |
p04001 | u497596438 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['from collections import deque\nS=input()\nqueue=deque()\nlst=[]\nlst.append([0,0])\nfor i in range(0,len(S)):\n l=len(lst)\n for _ in range(l):\n x,y=lst.pop(0)\n lst.append([x,y*10+int(S[i])])\n lst.append([x+y*10+int(S[i]),0])\nl=len(lst)\nfor _ in range(l):\n x,y=lst.pop(0)\n lst.append(x+y)\nprint(sum(lst)/2)\n', 'from collections import deque\nS=input()\nqueue=deque()\nlst=[]\nlst.append([0,0])\nfor i in range(0,len(S)):\n l=len(lst)\n for _ in range(l):\n x,y=lst.pop(0)\n lst.append([x,y*10+int(S[i])])\n lst.append([x+y*10+int(S[i]),0])\nl=len(lst)\nfor _ in range(l):\n x,y=lst.pop(0)\n lst.append(x+y)\nprint(int(sum(lst)/2))\n'] | ['Wrong Answer', 'Accepted'] | ['s697387732', 's568131627'] | [3444.0, 3444.0] | [24.0, 23.0] | [338, 343] |
p04001 | u501451051 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["S = input()\nans = 0\n\nfor i in range(2**(len(S)-1):\n\ttemp = S\n\tfor j in range(len(S)-1):\n\t\tif(i >> j) & 1:\n temp = temp[:j - len(S) + 1]+'+'+temp[j-len(S)+1:]\n ans += eval(temp)\n\nprint(ans)\n ", "S = input()\nans = 0\n \nfor i in range(2**(len(S)-1)):\n temp = S\n for j in range(len(S)-1):\n if(i >> j) & 1:\n temp = temp[:j - len(S) + 1]+'+'+temp[j-len(S)+1:]\n ans += eval(temp)\n \nprint(ans)"] | ['Runtime Error', 'Accepted'] | ['s824812852', 's233727404'] | [2940.0, 3060.0] | [17.0, 27.0] | [221, 201] |
p04001 | u506689504 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["s = input()\nx = []\nl = len(s)\nfor i in range(l):\n x.append(int(s[i]))\n\nsum = 0\nfor n in range(2**(l-1)):\n bin_str = format(i,'0'+str(l-1)+'b')\n prev = 0\n flg = 0\n for i in range(l-1):\n if bin_str[i]==0:\n prev = prev*10 + x[i]\n else:\n sum += prev*10 + x[i]\n prev = 0\n sum += prev*10 + x[l-1]\n\nprint(sum)\n", "s = input()\n\ndef manyformulas(s):\n print('s:{0}'.format(s))\n if len(s)==1:\n return 1,int(s[0])\n else:\n sum = int(s)\n count = 1\n for i in range(len(s)-1):\n c, recursive = manyformulas(s[(i+1):])\n sum += c*int(s[:(i+1)]) + recursive\n count += c\n\n return count, sum\n\nprint(manyformulas(s)[1])\n", "s = input()\nx = []\nl = len(s)\nfor i in range(l):\n x.append(int(s[i]))\n\nsum = 0\nfor n in range(2**(l-1)):\n bin_str = format(i,'0'+str(l-1)+'b')\n prev = 0\n flg = 0\n for i in range(l-1):\n if bin_str[i]==0:\n prev = prev*10 + x[i-1]\n else:\n sum += prev*10 + x[i-1]\n prev = 0\n sum += prev*10 + x[l-1]\n\nprint(sum)\n", "S = list(input())\n\ndef bit_search(s):\n # print('s:',s,'len:',len(s))\n if len(s)==1:\n # print('len=1,s:',s,len(s), int(s[0]))\n return int(s[0]),1 \n else:\n # print('s[0],type:',s[0],type(s[0]))\n sum1, cases1 = bit_search(s[1:])\n tmp1 = int(s[0])*cases1+sum1\n tmp = [s[0]+s[1]]+s[2:]\n # print('tmp:',tmp)\n tmp2, cases2 = bit_search(tmp)\n return tmp1+tmp2, cases1+cases2\n\n# print('initial S',S)\nprint(bit_search(S)[0])"] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s206547350', 's373143211', 's983561417', 's981781317'] | [3064.0, 3060.0, 3064.0, 3064.0] | [21.0, 18.0, 19.0, 19.0] | [368, 367, 372, 518] |
p04001 | u520276780 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s = input()\nl = len(s)\nfin_ans = 0\nprint(s)\nfor i in range(2**(l-1)):###*\n ans = 0\n left = 0\n right = 1\n for j in range(l):\n if (i>>j) & 1 == 0 and right<l:\n right += 1\n elif right<l:\n ans += int(s[left:right])\n left = right\n right += 1\n ans += int(s[left:right])\n fin_ans += ans\n #print(bin(i),ans,fin_ans)\nprint(fin_ans) ', 's = input()\nl = len(s)\nfin_ans = 0\n#print(s)\nfor i in range(2**(l-1)):###*\n ans = 0\n left = 0\n right = 1\n for j in range(l):\n if (i>>j) & 1 == 0 and right<l:\n right += 1\n elif right<l:\n ans += int(s[left:right])\n left = right\n right += 1\n ans += int(s[left:right])\n fin_ans += ans\n #print(bin(i),ans,fin_ans)\nprint(fin_ans) '] | ['Wrong Answer', 'Accepted'] | ['s129927201', 's434681219'] | [3064.0, 3064.0] | [20.0, 21.0] | [405, 406] |
p04001 | u521271655 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s = input()\n\nfor i in range(2**(len(s)-1)):\n plus = [""]*(len(s))\n fomula = ""\n for j in range(len(s)-1):\n if(i >> j & 1):\n plus[j] = "+"\n for k in range(len(s)):\n fomula += s[k] + plus[k]\n ans += eval(fomula)\nprint(ans)', 's = input()\nans = 0\nfor i in range(2**(len(s)-1)):\n plus = [""]*(len(s))\n fomula = ""\n for j in range(len(s)-1):\n if(i >> j & 1):\n plus[j] = "+"\n for k in range(len(s)):\n fomula += s[k] + plus[k]\n ans += eval(fomula)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s584466912', 's963233331'] | [8924.0, 8856.0] | [21.0, 29.0] | [260, 267] |
p04001 | u521866787 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["S = input()\nN = len(S)\nans = 0\n\nfor i in range(1,2**(N-1)):\n A = S[0]\n for j in range(N-1):\n if 1 << j & i:\n A += '+'\n A += S[j]\n ans += eval(A)\n print(A)\n\nprint(ans)", "S = input()\nN = len(S)\nans = 0\n\nfor i in range(1,2**(N-1)):\n A = S[0]\n for j in range(N-1):\n if 1 << j & i:\n A += '+'\n A += S[j]\n ans += eval(A)\n\nprint(ans)", "S = input()\nN = len(S)\nans = 0\n\nfor i in range(1,2**(N-1)):\n A = S[0]\n for j in range(N-1):\n if 1 << j & i:\n A += '+'\n A += S[j+1]\n ans += eval(A)\n # print(A, 'ans: ', ans)\n\nprint(ans+int(S))"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s736423516', 's932570877', 's025789385'] | [3060.0, 3060.0, 3060.0] | [28.0, 26.0, 27.0] | [203, 190, 228] |
p04001 | u537782349 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['def f(a, b, le, tf):\n b[le] = tf\n if le == len(b)-1:\n t = ""\n s1 = 0\n for i in range(len(b)):\n t += a[i]\n if b[i] == 1:\n s1 += int(t)\n t = ""\n t += a[len(b)]\n s1 += int(t)\n return s1\n else:\n return f(a, b, le+1, 0) + f(a, b, le+1, 1)\n\n\naa = input()\nbb = [0] * (len(aa)-1)\nif len(a) == 1:\n print(a)\nelse:\n print(f(aa, bb, 0, 0) + f(aa, bb, 0, 1))', 'def clc(a, b, c, p, t):\n if c == 0:\n b = a[0]\n return clc(a, b, c + 1, True, t) + clc(a, b, c + 1, False, t)\n elif c == len(a)-1:\n if p:\n return t + int(b) + int(a[c])\n else:\n return t + int(b + a[c])\n else:\n if p:\n t += int(b)\n b = a[c]\n else:\n b += a[c]\n return clc(a, b, c + 1, True, t) + clc(a, b, c + 1, False, t)\n\n\ns = input()\nprint(clc(s, "", 0, True, 0) if len(s) != 1 else s)\n'] | ['Runtime Error', 'Accepted'] | ['s978627464', 's947995854'] | [3064.0, 3064.0] | [17.0, 18.0] | [461, 498] |
p04001 | u540698208 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['import itertools\n\ns = input()\nn = [i for i in s]\nans = 0\n\nfor i in range(len(n)):\n for j in itertools.combinations(range(len(n)-1, i)):\n temp = [i for i in s]\n for k in j[::-1]:\n temp.insert(k+1, "+")\n temp = "".join(temp)\n temp = temp.split("+")\n temp = map(int, temp)\n ans += sum(temp)\n\nprint(ans)', "def main():\n s = input()\n n = len(s)\n ans = 0\n\n for i in range(1<<n-1):\n temp = 0\n for j in range(n-1):\n if i & (i<<j):\n ans += int(''.join(s[temp:j+1]))\n temp = j+1\n ans += int(''.join(s[temp:]))\n\n print(ans)\n\nif __name__ == '__main__':\n main()", "def main():\n s = input()\n n = len(s)\n ans = 0\n\n for i in range(1 << n-1):\n temp = 0\n for j in range(n-1):\n if i & (1 << j):\n ans += int(''.join(s[temp:j+1]))\n temp = j+1\n ans += int(''.join(s[temp:]))\n print(ans)\n\nif __name__ == '__main__':\n main()"] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s031232088', 's781784861', 's357541862'] | [3064.0, 3060.0, 3060.0] | [18.0, 21.0, 20.0] | [323, 325, 328] |
p04001 | u541017633 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["// https://atcoder.jp/contests/arc061/tasks/arc061_a\n#include <bits/stdc++.h>\nusing namespace std;\ntypedef long long ll;\n\n\n\nint main() {\n string S;\n cin >> S;\n\n ll ans = 0;\n int m = S.size() - 1;\n\n rep(bit, 1 << m) {\n ll cur = S[0] - '0';\n rep(i, m) {\n if (bit & (1 << i)) {\n ans += cur;\n cur = 0;\n }\n cur = cur * 10 + S[i + 1] - '0';\n }\n ans += cur;\n }\n cout << ans << endl;\n return 0;\n}\n", 's = input()\nn = len(s) - 1\nans = 0\nfor bit in range(1 << n):\n now = 0\n for i in range(bit):\n if bit & (1 << i):\n ans += int(s[now : i + 1])\n now = i + 1\n ans += int(s[now : len(s)])\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s053714000', 's736477398'] | [2940.0, 2940.0] | [17.0, 38.0] | [490, 231] |
p04001 | u548545174 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s = input()\nspace = len(s) - 1\ntotal = 0\nfor i in range(2 ** space):\n pluses = []\n for j in range(space):\n if (i >> j) & 1:\n pluses.append(j)\n re = 0\n for p in pluses:\n re += int(s[p]) + int(s[p+1])\n total += re\nprint(total)', 'S = input()\nN = len(S) - 1\n\nans = 0\nfor i in range(2 ** N):\n equation = S[0]\n for j in range(N):\n if (i >> j) & 1:\n equation += "+" + S[j + 1]\n else:\n equation += S[j + 1]\n ans += sum(list(map(int, equation.split("+"))))\n\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s699595579', 's501344652'] | [3060.0, 9032.0] | [20.0, 25.0] | [264, 277] |
p04001 | u552209394 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['n=input()\nq=len(n)\nans=0\nfor i in range(1,q):\n ans+=int(n[:i])+int(n[i:])\nprint(ans)', 'n=input()\nq=len(n)\nans=int(n)\nfor i in range(1,q):\n ans+=int(n[:i])+int(n[i:])\nprint(ans)', 'n=input()\nq=len(n)-1\nans=0\nfor i in range(1,q):\n ans+=int(n[:i])+int(n[i:])\nprint(ans)\n ', 'S=[int(i) for i in input()]\nans=0\nfor x in range(1<<len(S)-1):\n a=S[0]\n for n in range(len(S)-1):\n if x>>n & 1:\n ans+=a\n a=0\n a = a * 10 + S[n+1]\n ans += a\nprint(ans)\n '] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s383028954', 's406072398', 's684835156', 's497763690'] | [2940.0, 2940.0, 2940.0, 3060.0] | [17.0, 17.0, 18.0, 19.0] | [87, 92, 92, 224] |
p04001 | u557494880 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["S = intinput()\nn = len(S)\nans = 0\nfor i in range(2**(n-1)):\n s = S[0]\n for j in range(n-1):\n if (i >> j) & 1:\n s += '+'\n s += S[j+1]\n ans += eval(s)\nprint(ans)\n", "S = str(input())\n\ndef plus(a,b,c):\n x = a[0:b+1] + c + a[b+1:len(a)]\n return(x)\nA = [S]\nwhile len(A) != 2**(len(S)):\n for i in range(len(S)-1):\n for j in range(len(A)):\n x = A[j]\n y = plus(x,i,'+')\n A.append(y)\ns = 0\nfor i in range(len(A)):\n s += eval(A[i])\nprint(s)\n \n \n \n \n \n", "S = str(input())\n\ndef plus(a,b,c):\n x = a[0:b+1] + c + a[b+1:len(a)]\n return(x)\nA = [S]\nwhile len(A) != 2**(len(S)):\n for i in range(len(S)-1):\n for j in range(len(A)):\n x = A[j]\n y = plus(x,i,'+')\n A.append(y)\ns = 0\nfor i in range(len(A)):\n x = A[i]\n p = 0\n q = 0\n for j in range(len(x)):\n if x[j] == '+':\n q = j - 1\n m = x[p:q]\n s += int(m)\n p = j + 1\n elif j == len(x):\n q = len(x)\n m = x[p:q]\n s += int(m)\nprint(s)\n \n \n \n \n ", "S = int(input())\nn = len(S)\nans = 0\nfor i in range(2**(n-1)):\n s = S[0]\n for j in range(n-1):\n if (i >> j) & 1:\n s += '+'\n s += S[j+1]\n ans += eval(s)\nprint(ans)", "S = input()\nn = len(S)\nans = 0\nfor i in range(2**(n-1)):\n s = S[0]\n for j in range(n-1):\n if (i >> j) & 1:\n s += '+'\n s += S[j+1]\n ans += eval(s)\nprint(ans)\n"] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s250306601', 's589779097', 's771992693', 's970170521', 's377394214'] | [2940.0, 249992.0, 254488.0, 3060.0, 3060.0] | [17.0, 2120.0, 2120.0, 17.0, 27.0] | [194, 360, 611, 195, 191] |
p04001 | u557792847 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['S = input()\ntotal = 0\nfor p in (product((0, 1), repeat=len(S)-1)):\n ns = S[0]\n for i, pp in enumerate(p, 1):\n if pp == 0:\n ns += S[i]\n else:\n total += int(ns)\n ns = S[i]\n total += int(ns)\nprint(total)\n\n\n', 'import sys\nimport numpy as np\nimport math\nimport collections\nimport copy\nfrom collections import deque \nfrom functools import reduce\nfrom itertools import product\n\n# input = sys.stdin.readline\nS = input()\ntotal = 0\nfor p in (product((0, 1), repeat=len(S)-1)):\n ns = S[0]\n for i, pp in enumerate(p, 1):\n if pp == 0:\n ns += S[i]\n else:\n total += int(ns)\n ns = S[i]\n total += int(ns)\nprint(total)\n\n\n\n'] | ['Runtime Error', 'Accepted'] | ['s514796426', 's056447097'] | [9060.0, 27092.0] | [25.0, 114.0] | [259, 453] |
p04001 | u573970531 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['import sys\ninput=sys.stdin.readline\n\ns=input()\nans=0\n\nfor i in range(2 ** (len(s)-1)):\n bin_i = bin(i)[2:].rjust(len(s)-1,"0")\n li=[]\n n=s[0]\n \n for ix,sign in enumerate(bin_i):\n if sign=="0":\n n+=s[ix+1]\n else:\n li.append(int(n))\n n=s[ix+1]\n li.append(int(n))\n ans+=sum(li)\n\nprint(ans)', 's=input()\nans=0\n\nif len(s)==1:\n print(s)\n exit()\n\nfor i in range(2 ** (len(s)-1)):\n bin_i = bin(i)[2:].rjust(len(s)-1,"0")\n li=[]\n n=s[0]\n for ix,sign in enumerate(bin_i):\n if sign=="0":\n n+=s[ix+1]\n else:\n li.append(int(n))\n n=s[ix+1]\n li.append(int(n))\n ans+=sum(li)\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s039627399', 's679667293'] | [3064.0, 3064.0] | [17.0, 20.0] | [333, 309] |
p04001 | u581187895 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['S = input()\nlen_S = len(S)-1\nans = 0\nfor s in range(1<<len_S):\n now = "" \n now += S[0]\n print(s)\n for i in range(len_S): \n if s & (1<<i): \n now += "+"\n now += S[i+1] \n ans += eval(now)\nprint(ans) ', 'S = input()\nlen_S = len(S)-1\nans = 0\nfor s in range(1<<len_S):\n now = "" \n now += S[0] \n for i in range(len_S): \n if s & (1<<i): \n now += "+"\n now += S[i+1] \n ans += eval(now)\nprint(ans) '] | ['Wrong Answer', 'Accepted'] | ['s990645439', 's230291858'] | [3060.0, 3060.0] | [28.0, 26.0] | [243, 234] |
p04001 | u582165344 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s = input().split("")\nsum = 0\nfor i in range(2 ** (len(s)-1)) :\n st = str(s[0])\n for j in range(len(s)-1) : \n if ((i >> j) & 1) :\n st = st + "+" + str(s[j+1])\n else :\n st = st + str(s[j+1])\n \n for item in st.split(\'+\') :\n sum += int(item)\nprint(sum)', 's = list(input())\nsum = 0\nfor i in range(2 ** (len(s)-1)):\n st = str(s[0])\n for j in range(len(s)-1):\n if (i >> j) & 1:\n st = st + "+" + str(s[j+1])\n else:\n st = st + str(s[j+1])\n \n for item in st.split(\'+\') :\n sum += int(item)\nprint(sum)'] | ['Runtime Error', 'Accepted'] | ['s638437609', 's937861731'] | [3060.0, 3064.0] | [20.0, 21.0] | [272, 265] |
p04001 | u582614471 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['aqqn = list(input())\nans = 0\nfor i in range(2**(len(n)-1)):\n plus = [""]*(len(n))\n fomula = ""\n for j in range(len(n)-1):\n if(i>>j & 1):\n plus[j] = "+"\n for i in range(len(n)):\n fomula += n[i] + plus[i]\n ans += eval(fomula)\nprint(ans)\n', 'n = list(input())\nans = 0\nfor i in range(2**(len(n)-1)):\n plus = [""]*(len(n))\n fomula = ""\n for j in range(len(n)-1):\n if(i>j & 1):\n plus[j] = "+"\n for i in range(len(n)):\n fomula += n[i] + plus[i]\n ans += eval(fomula)\nprint(ans)\n\n\n\n\n\n', 'n = list(input())\nans = 0\nfor i in range(2**(len(n)-1)):\n plus = [""]*(len(n))\n fomula = ""\n for j in range(len(n)-1):\n if(i>>j & 1):\n plus[j] = "+"\n for i in range(len(n)):\n fomula += n[i] + plus[i]\n ans += eval(fomula)\nprint(ans)\n\n'] | ['Runtime Error', 'Wrong Answer', 'Accepted'] | ['s333317695', 's594947751', 's699089182'] | [3064.0, 3188.0, 3060.0] | [19.0, 30.0, 27.0] | [275, 1142, 273] |
p04001 | u589047182 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['def dfs(i, f):\n if i == n - 1:\n return sum(list(map(int, f.split("+"))))\n return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + "+" + s[i + 1])s\ns = input()\nn = len(s)\n\nprint(dfs(0, s[0]))\n', 'def dfs(i, f):\n if i == n - 1:\n return sum(list(map(int, f.split("+"))))\n\n return dfs(i + 1, f + s[i + 1]) + dfs(i + 1, f + "+" + s[i + 1])\n\n\ns = input()\nn = len(s)\n\nprint(dfs(0, s[0]))\n'] | ['Runtime Error', 'Accepted'] | ['s895114031', 's339735929'] | [2940.0, 3060.0] | [17.0, 19.0] | [197, 200] |
p04001 | u593567568 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['from collections import deque\n\ndef dfs(xs):\n x = xs.popleft()\n\n if len(xs) == 0:\n return x\n\n # not +\n xs2 = xs.copy()\n y = xs2.popleft()\n xy = int(str(x)+str(y))\n xs2.appendleft(xy)\n b = dfs(xs2)\n\n # has +\n a = x * 2 + dfs(xs)\n\n\n return a+b\n\n\ns = str(input())\nxs = list(map(int,s))\nxs = deque(xs)\n\nprint(dfs(xs))', 'from collections import deque\n\ndef dfs(xs):\n print("xs",xs)\n x = xs.popleft()\n\n if len(xs) == 0:\n return x\n\n # not +\n xs2 = xs.copy()\n y = xs2.popleft()\n xy = int(str(x)+str(y))\n xs2.appendleft(xy)\n b = dfs(xs2)\n\n # has +\n a = x * 2 + dfs(xs)\n\n\n return a+b\n\n\ns = str(input())\nxs = list(map(int,s))\nxs = deque(xs)\n\nprint(dfs(xs))', 'from collections import deque\n\ndef dfs(xs):\n\n x = xs.popleft()\n\n if len(xs) == 0:\n return x\n\n # not +\n xs2 = xs.copy()\n y = xs2.popleft()\n xy = int(str(x)+str(y))\n xs2.appendleft(xy)\n b = dfs(xs2)\n\n # has +\n a = x + dfs(xs)\n\n\n return a+b\n\n\ns = str(input())\nxs = list(map(int,s))\nxs = deque(xs)\n\nprint(dfs(xs))', 'import sys\nfrom collections import deque\n\nsys.setrecursionlimit(1000000000)\n\ndef dfs(xs):\n x = xs.popleft()\n\n if len(xs) == 0:\n return x\n\n # not +\n xs2 = xs.copy()\n y = xs2.popleft()\n xy = int(str(x)+str(y))\n xs2.appendleft(xy)\n b = dfs(xs2)\n\n # has +\n a = x + x + dfs(xs)\n\n\n return a+b\n\n\ns = str(input())\nxs = list(map(int,s))\nxs = deque(xs)\n\nprint(sum(xs))', 'import sys\nfrom collections import deque\n\nsys.setrecursionlimit(1000000000)\n\ndef dfs(xs):\n x = xs.popleft()\n\n if len(xs) == 0:\n return x\n\n # not +\n xs2 = xs.copy()\n y = xs2.popleft()\n xy = int(str(x)+str(y))\n xs2.appendleft(xy)\n b = dfs(xs2)\n\n # has +\n a = x + x + dfs(xs)\n\n\n return a+b\n\n\ns = str(input())\nxs = list(map(int,s))\nxs = deque(xs)\n\nprint(dfs(xs))', 'from collections import deque\n\ndef dfs(xs):\n x = xs.popleft()\n\n if len(xs) == 0:\n return x\n\n # not +\n xs2 = xs.copy()\n y = xs2.popleft()\n xy = int(str(x)+str(y))\n xs2.appendleft(xy)\n b = dfs(xs2)\n\n # has +\n a = x + x + dfs(xs)\n\n\n return a+b\n\n\ns = str(input())\nxs = list(map(int,s))\nxs = deque(xs)\n\nprint(sum(xs))', 'import sys\nimport copy\nfrom collections import deque\n\nsys.setrecursionlimit(1000000000)\n\ndef dfs(xs,q):\n if len(xs) == 0:\n return sum(int(i) for i in q)\n\n x = xs.popleft()\n\n if len(q) == 0:\n q.append(x)\n return dfs(xs,q)\n\n\n a1 = copy.copy(xs)\n a2 = copy.copy(xs)\n\n q1 = copy.copy(q)\n q2 = copy.copy(q)\n\n q1.append(x)\n\n y = q2.pop()\n yx = y + x\n q2.append(yx)\n\n return dfs(a1,q1) + dfs(a2,q2)\n\n\ns = str(input())\nxs = deque(list(s))\n\nprint(dfs(xs,deque([])))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted'] | ['s059692996', 's134219537', 's200235593', 's322004436', 's421316065', 's555611618', 's340315812'] | [3316.0, 3316.0, 3316.0, 3316.0, 3316.0, 3316.0, 3444.0] | [21.0, 21.0, 21.0, 21.0, 21.0, 21.0, 27.0] | [356, 375, 353, 402, 402, 356, 515] |
p04001 | u606146341 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["import itertools\ns = str(input())\n\nlst = [i for i in itertools.product([0,1],repeat = len(s) - 1)]\ns2 = list(s)\n\nlst = [i for i in itertools.product([0,1],repeat = len(s) - 1)]\ns4 = []\nfor l in lst:\n s3 = list(s)\n h = 0\n for i in range(0, len(s)-1):\n if l[i] == 1:\n s3.insert(i+h+1,'+')\n h += 1\n s4.append(s3)\nsum([eval(''.join(i)) for i in s4])", "s = input()\nn = len(s)\n\ndef dfs(i, f):\n if i == n - 1:\n return eval(f)\n \n print(dfs(i+1, f + s[i+1]), dfs(i+1, f + '+' + s[i+1]))\n return dfs(i+1, f + s[i+1]) + \\\n dfs(i+1, f + '+' + s[i+1])\nprint(dfs(0,s[0]))", "s = input()\nn = len(s)\n\ndef dfs(i, f):\n if i == n - 1:\n return eval(f)\n\n return dfs(i+1, f + s[i+1]) + \\\n dfs(i+1, f + '+' + s[i+1])\nprint(dfs(0,s[0]))"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s583551405', 's642393134', 's198644294'] | [3316.0, 3904.0, 3060.0] | [27.0, 2104.0, 24.0] | [387, 243, 179] |
p04001 | u611090896 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["s = input()\nn = len(s-1)\ntotal=0\nfor i in range(2**n):\n pl=['']*n\n ans=''\n for j in range(n):\n if ((i>>j)&1):\n pl[n-1-j] = '+'\n for k in range(n):\n ans += s[k]+pl[k]\n ans+=s[-1]\n total += eval(ans)\n\nprint(total)", "s = input()\nn = len(s)-1\ntotal=0\nfor i in range(2**n):\n pl=['']*n\n ans=''\n for j in range(n):\n if ((i>>j)&1):\n pl[n-1-j] = '+'\n for k in range(n):\n ans += s[k]+pl[k]\n ans+=s[-1]\n total += eval(ans)\n \nprint(total)"] | ['Runtime Error', 'Accepted'] | ['s728454734', 's941339888'] | [8936.0, 9064.0] | [24.0, 34.0] | [228, 229] |
p04001 | u620945921 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["#import itertools\nlist1=[k for k in input()]\nprint(list1)\nnum1=len(list1)\nprint(num1)\nlist00=[format(int(k), 'b') for k in range(2**(num1-1))]\nprint(list00)\n\nlist0=['','+']\n\nlist01=[]\nfor count1 in range(num1):\n x=list00[count1]\n list01.extend(x)\nprint(list01)\ntotal=0\n\nfor step1 in range(2):\n for step2 in range(2):\n list2=[list0[step2],list0[step1]]\n num = min(len(list1), len(list2))\n result = [None]*(num*2)\n result[::2] = list1[:num]\n result[1::2] = list2[:num]\n result.extend(list1[num:])\n result.extend(list2[num:])\n result1 = ''.join(result)\n print(result1)\n total+=eval(result1)\n\nprint(total)\n#176", "n=input()\nanslist=[]\n\ndef saiki(n,x,a,k):\n if k==len(n):\n anslist.append(eval(x))\n return\n else:\n for i in a:\n y=x\n x=x+i+n[k]\n saiki(n,x,a,k+1)\n x=y \n\nsaiki(n,n[0],['','+'],1)\nprint(sum(anslist))"] | ['Runtime Error', 'Accepted'] | ['s176757702', 's953986808'] | [3064.0, 3060.0] | [18.0, 24.0] | [639, 273] |
p04001 | u638320267 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s = input()\nsum = 0\nfor i in range(2**(len(s)-1)):\n term = 0\n for j in range(len(s)-1):\n term *= 10\n if (i//(2**j))%2 == 0:\n sum += term + int(s[j])\n term = 0\n if j == len(s)-2:\n sum += int(s[-1])\n else:\n term += int(s[j])\n if j == len(s)-2:\n sum += term*10 + int(s[-1])\nif len(s) = 1:\n sum = int(s)\n\nprint(sum)', 'S = input()\nop_cnt = len(S)-1\nsum = 0\nfor i in range(2**op_cnt):\n op = [""] * op_cnt\n for j in range(op_cnt):\n if ((i>>j) & 1):\n op[j] = "+"\n formula = ""\n for p_n, p_o in zip(S, op + [""]):\n formula += (p_n + p_o)\n sum += eval(formula)\n# print(formula)\nprint(sum)\n'] | ['Runtime Error', 'Accepted'] | ['s772757338', 's137261379'] | [3064.0, 3060.0] | [17.0, 27.0] | [426, 308] |
p04001 | u667024514 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['from collections import Counter\nh, w, num = map(int, input().split())\nlis = []\nfor i in range(num):\n k, j = map(lambda x: int(x) - 1,input().split())\n for a in range(3):\n for b in range(3):\n cou1 = k - a\n cou2 = j - b \n if cou1 < 0 or cou1 > h - 3:\n continue\n if cou2 < 0 or cou2 > w - 3:\n continue\n lis.append((cou1, cou2))\n\nlis = Counter(Counter(lis).values())\n\nprint((h - 2) * (w - 2) - sum(lis.values()))\nfor i in range(1, 10):print(lis[i])', 'n = str(input())\nans = 0\nif int(n) < 10:\n print(int(n))\n exit()\nfor i in range(2 ** (len(n) -1)):\n num = format(i,"b").zfill(len(n)-1)\n lis = ""\n for j in range(len(str(num))):\n if str(num[j]) == "1":\n lis += (str(n[j])+"+")\n else:\n lis += str(n[j])\n lis += n[-1]\n li = lis.split("+")\n for h in range(len(li)):\n li[h] = int(li[h])\n ans += sum(li)\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s196549244', 's969498714'] | [3316.0, 3064.0] | [20.0, 22.0] | [542, 385] |
p04001 | u667458133 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["s = input()\n\nn = 2 ** (len(s) - 1)\nprint(n)\nresult = 0\n\nfor i in range(n):\n bin_n = bin(i)[2:]\n bin_n = '0' * ((len(s) - 1) - len(bin_n)) + bin_n\n print('bin:' + bin_n)\n current_address = 0\n for j in range(len(bin_n)):\n if bin_n[j] == '1':\n print(s[current_address:j+1])\n result += int(s[current_address:j+1])\n current_address = j+1\n\n print(s[current_address:])\n result += int(s[current_address:])\n\nprint(result)\n ", "s = input()\n\nn = 2 ** (len(s) - 1)\nresult = 0\n\nfor i in range(n):\n bin_n = bin(i)[2:]\n bin_n = '0' * ((len(s) - 1) - len(bin_n)) + bin_n\n current_address = 0\n for j in range(len(bin_n)):\n if bin_n[j] == '1':\n result += int(s[current_address:j+1])\n current_address = j+1\n\n result += int(s[current_address:])\n\nprint(result)"] | ['Wrong Answer', 'Accepted'] | ['s406964066', 's928559150'] | [9224.0, 9156.0] | [34.0, 29.0] | [440, 339] |
p04001 | u673173160 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["s = input()\nn = len(s) - 1\nanswers = []\nsl = [s[i] for i in range(len(s))]\nfor i in range(2 ** n):\n tmp = []\n for j in range(n):\n if ((i >> j) & 1):\n tmp.append(j)\n ll = ['*']*len(s)\n for k in tmp:\n ll[k] = '+'\n ans = []\n for k, _ in zip(sl, ll):\n ans.append(k)\n ans.append(_)\n ans = [_ for _ in ans if _ != '*']\n ans = ''.join(ans)\n ans = ans.split('+')\n ans = [int(_) for _ in ans if _ != '+']\n ans = sum(ans)\n answers.append(ans)\nprint(answers)\nprint(sum(answers))", 's = input()\nn = len(s)\nans = 0\nfor i in range(2 ** (n-1)):\n tmp = []\n for k in range(n-1):\n tmp.append(s[k])\n if i>>k & 1:\n tmp.append("+")\n tmp.append(s[-1])\n ans += eval("".join(tmp))\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s898201797', 's456271327'] | [3064.0, 3060.0] | [23.0, 27.0] | [542, 233] |
p04001 | u674959776 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s=int(input())\nn=len(s)\nsum=0\nfor i in range(1<<n-1):\n t=0\n for j in range(n-1):\n if i & (1<<j):\n sum += int("".join(s[t:j+1]))\n t = j+1 \nprint(sum)', 's=input()\nn=len(s)\nsum=0\nfor i in range(1<<n-1):\n t=0\n for j in range(n-1):\n if i & (1<<j):\n sum += int("".join(s[t:j+1]))\n t = j+1 \n sum += int(\'\'.join(s[t:]))\nprint(sum)'] | ['Runtime Error', 'Accepted'] | ['s830196095', 's243303516'] | [3060.0, 3060.0] | [17.0, 21.0] | [163, 187] |
p04001 | u680619771 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['import sys\ngrid = []\npainted = []\n\nheight, width, n = sys.stdin.readline().strip().split()\nheight, width, n = int(height), int(width), int(n)\n\ndef checkGrid(x, y, grid):\n count = 0\n for col in range(x, x+3):\n for row in range(y, y+3):\n if grid[row][col] == 1:\n count += 1\n return count\n\ninp = sys.stdin.readline().strip()\nwhile inp:\n a, b = inp.split()\n grid.append([int(a) - 1, int(b) - 1])\n inp = sys.stdin.readline().strip()\n\n# Build empty grid\nfor i in range(height):\n painted.append([])\n for j in range(width):\n if [i, j] in grid:\n painted[i].append(1)\n else:\n painted[i].append(0)\n\n# Build painted cells\nfor cell in grid:\n painted[cell[0]][cell[1]] = 1\n\nfor i in range(0, 10):\n count = 0\n for col in range(width - 2):\n for row in range(height - 2):\n if checkGrid(col, row, painted) == i:\n count += 1\n print(count)\n', "import sys\nperm = sys.stdin.readline().strip()\ntotal = 0\n\n# Add n * '+' to inp\ndef addPlus(inp, n):\n total = 0\n possible = [inp]\n orig = inp\n\n for i in range(1, len(orig)):\n possible.append(orig[:i] + '+' + perm[i:])\n\n for i in range(1, n):\n curr = possible[:]\n for item in curr:\n for j in range(1, len(item)):\n processed = item[:j] + '+' + item[j:]\n if processed not in possible:\n if '++' not in processed:\n possible.append(processed)\n\n for item in possible:\n total += eval(item)\n\n return total\n\n\nprint(addPlus(perm, len(perm) - 1))\n"] | ['Runtime Error', 'Accepted'] | ['s713686428', 's136755982'] | [3064.0, 3064.0] | [38.0, 338.0] | [958, 666] |
p04001 | u688762199 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['# -*- coding: utf-8 -*-\n\nimport types\n#import copy\n\n# Input\nabcd = input()\nn = len(abcd) - 1 \nsum_ = 0\n\n# Print\nfor i in range( 2**n ):\n op = n * ["+"]\n\n \n # example: [\'\', \'+\', \'\']\n for j in range(n):\n if ( i >> j ) & 1:\n op[n-1 -j] = ""\n \n formula = ""\n for p_n, p_o in zip(abcd, op+[""]):\n formula += (p_n + p_o)\n print(formula)\n\n sum_ += eval(formula)\n\nprint(sum_)\n', '# -*- coding: utf-8 -*-\n\nimport types\n#import copy\n\n# Input\nabcd = input()\nn = len(abcd) - 1 \nsum_ = 0\n\n# Print\nfor i in range( 2**n ):\n op = n * ["+"]\n\n \n # example: [\'\', \'+\', \'\']\n for j in range(n):\n if ( i >> j ) & 1:\n op[n-1 -j] = ""\n \n formula = ""\n for p_n, p_o in zip(abcd, op+[""]):\n formula += (p_n + p_o)\n #print(formula)\n\n sum_ += eval(formula)\n\nprint(sum_)\n'] | ['Wrong Answer', 'Accepted'] | ['s923138615', 's721721370'] | [3064.0, 3064.0] | [29.0, 28.0] | [511, 512] |
p04001 | u692311686 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['S=list(map(int,input().split()))\ndef sums(a):\n n=len(a)\n if n==1:\n return a[0]\n else:\n s=0\n for i in range(n):\n s+=10**(n-i-1)*a[i]\n \n for i in range(n-1):\n t=0\n b=[a[i+1:]]\n c=[a[:i+1]]\n for j in range(i+1):\n t+=10**(i-j)*c[j]\n s+=t*sums(b)\n \n return s\n ', 'Sin=input()\nS=[int(Sin[i]) for i in range(len(Sin))]\n#print(S)\ndef sums(a):\n n=len(a)\n if n==1:\n return a[0]\n else:\n s=0\n for i in range(n):\n s+=10**(n-i-1)*a[i]\n \n for i in range(n-1):\n t=0\n b=a[i+1:]\n c=a[:i+1]\n for j in range(i+1):\n t+=(10**(i-j))*c[j]\n n2=len(b)-1\n s+=t*(2**n2)+sums(b)\n \n return s\n \nprint(sums(S))'] | ['Wrong Answer', 'Accepted'] | ['s967916202', 's871434272'] | [3064.0, 3064.0] | [17.0, 19.0] | [319, 388] |
p04001 | u694433776 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s=input()\ndef solve(decided, left, idx):\n if idx==len(s):\n return decided+left\n \n ret1 = solve(decided+left,int(s[idx]),idx+1)\n \n ret2 = solve(decided, left*10int(s[idx]), idx+1)\n return ret1+ret2\nprint(solve(0,int(s[0]),1))', 's=input()\nret=0\n\nfor i in range(1<<(len(s)-1)):\n t=list(s)\n \n for j in reversed(range(1, len(s))):\n if i&(1<<(j-1)):\n t=t[:j]+["+"]+t[j:]\n ret+=eval("".join(t))\nprint(ret)'] | ['Runtime Error', 'Accepted'] | ['s110922021', 's019555328'] | [2940.0, 3060.0] | [22.0, 28.0] | [287, 357] |
p04001 | u698756732 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s = input()\nres = 0\nfor i in range(2 ** (len(s) - 1)):\n _tmp = []\n for j in range(len(s) - 1):\n if ((i >> j) & 1):\n _tmp.append(j)\n \n print(_tmp)\n\n pre = 0\n \n for pos in _tmp:\n res += int(s[pre: pos + 1])\n pre = pos + 1\n\n res += int(s[pre:])\n \nprint(res)', 'n = input()\n\nsumP = 0\n\nfor i in range(2 ** (len(n)- 1)): \n plus=[] \n for j in range(len(n) - 1): \n if i >> j & 1 : \n plus.append(j) \n\n middle_index = 0\n\n for pos in plus:\n sumP += int(n[middle_index:pos + 1]) \n middle_index = pos + 1\n sumP += int(n[middle_index:]) \n\nprint(sumP)'] | ['Wrong Answer', 'Accepted'] | ['s242382908', 's512164162'] | [8976.0, 9120.0] | [32.0, 32.0] | [321, 643] |
p04001 | u699522269 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['a=input()\ndef strs(st):\n print(st)\n if len(st)>1:\n return int(st)+strs(st[1:])+strs(st[:-1])\n else:\n return int(st)\n\nprint(strs(a)+int(a[0])+int(a[-1])-int(a[len(a)//2]))', 'a=input()\ndef strs(st):\n if len(st)>1:\n return int(st)+strs(st[1:])+strs(st[:-1])+int(st[0])+int(st[-1])\n else:\n return int(st)\nprint(strs(a)+int(a[0])+int(a[-1])-int(a[len(a)//2]))', 'S = input()\nrt = 0\nfor l in range(1,len(S)+1):\n for i in range(len(S)-l+1):\n tmp = 1 if i == 0 or i+l==len(S) else 2\n tw = 2**(0 if len(S)-l-tmp<0 else len(S)-l-tmp)\n rt+=tw*int(S[i:i+l])\n\nprint(rt)'] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s060420530', 's925186755', 's950179188'] | [3188.0, 3060.0, 9060.0] | [19.0, 18.0, 26.0] | [179, 189, 208] |
p04001 | u699994820 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["result = 0\ndef BT(k, current, s):\n global result\n if k >= len(a)-1 :\n if current == 0 :\n result += s\n print(k,current,s,result)\n else :\n BT(k+1, int(a[k+1]), s+current)\n BT(k+1, current* 10 + int(a[k+1]), s)\n\na = input()+'0'\nBT(0,int(a[0]),0)\nprint(result)\n", "result = 0\ndef BT(k, current, s):\n global result\n if k == len(a) :\n if current == 0 :\n result += s\n else :\n BT(k+1, int(a[k]), s+current)\n BT(k+1, current* 10 + int(a[k]), s)\n\na = input()+'0'\nBT(1,int(a[0]),0)\nprint(result)"] | ['Wrong Answer', 'Accepted'] | ['s459011591', 's107400267'] | [3444.0, 3064.0] | [47.0, 44.0] | [305, 264] |
p04001 | u708378905 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['def dfs(splitted: "the list of integer", a: int, b: int, depth: int) -> int:\n if len(splitted) == depth:\n return a + b\n else:\n \n \n return dfs(splitted, a, b * 10, depth + 1) + dfs(s, a + b, splitted[i], depth + 1)\n\ns = [int(x) for x in input()]\nprint(dfs(s, 0, 0, 0))', 'def dfs(splitted: "the list of integer", a: int, b: int, depth: int) -> int:\n if len(splitted) == depth:\n return a + b\n else:\n \n \n return dfs(splitted, a, b * 10, depth + 1) + dfs(s, a + b, splitted[i], depth + 1)\n\ns = [int(x) for x in input()]\nprint(dfs(s, 0, 0, 0))', 'def dfs(splitted: "the list of integer", a: int, b: int, depth: int) -> int:\n if len(splitted) == depth:\n return a + b\n else:\n \n \n return dfs(splitted, a, b * 10, depth + 1) + dfs(splitted, a + b, splitted[i], depth + 1)\n\ns = [int(x) for x in input()]\nprint(dfs(s, 0, 0, 0))', 'def dfs(splitted: "the list of integer", a: int, b: int, depth: int) -> int:\n if len(splitted) == depth:\n return a + b\n else:\n \n \n return dfs(splitted, a, b * 10, depth + 1) + dfs(splitted, a + b, splitted[depth], depth + 1)\n\ns = [int(x) for x in input()]\nprint(dfs(s, 0, 0, 0))'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s067808359', 's188802883', 's520278214', 's395820383'] | [3060.0, 3060.0, 3060.0, 3060.0] | [18.0, 18.0, 18.0, 18.0] | [394, 394, 401, 405] |
p04001 | u736524428 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s = input()\n\nmax_plus = len(s) - 1\n\nnumList = [int(c) for c in s]\n\nsMax = (1 << max_plus) - 1\n\nans = 0\n\nfor plus_pos in range(sMax + 1):\n sum = 0\n\n num = numList[0]\n\n for i in range(max_plus):\n if ((plus_pos >> i) & 1) == 1:\n sum += num\n num = numList[i + 1]\n else:\n num = num * 10 + numList[i + 1]\n\n sum += num\n ans += sum\n\nprint(ans)s = input()\n\nmax_plus = len(s) - 1\n\nnumList = [int(c) for c in s]\n\nsMax = (1 << max_plus) - 1\n\nans = 0\n\nfor plus_pos in range(sMax + 1):\n sum = 0\n\n num = numList[0]\n\n for i in range(max_plus):\n if ((plus_pos >> i) & 1) == 1:\n sum += num\n num = numList[i + 1]\n else:\n num = num * 10 + numList[i + 1]\n\n sum += num\n ans += sum\n\nprint(ans)', 's = input()\n\nmax_plus = len(s) - 1\n\nnumList = [int(c) for c in s]\n\nsMax = (1 << max_plus) - 1\n\nans = 0\n\nfor plus_pos in range(sMax + 1):\n sum = 0\n\n num = numList[0]\n\n for i in range(max_plus):\n if ((plus_pos >> i) & 1) == 1:\n sum += num\n num = numList[i + 1]\n else:\n num = num * 10 + numList[i + 1]\n\n sum += num\n ans += sum\n\nprint(ans)\n'] | ['Runtime Error', 'Accepted'] | ['s128293605', 's815823123'] | [3060.0, 3064.0] | [17.0, 19.0] | [794, 398] |
p04001 | u750058957 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['S = input()\n# 125\ns = len(S)-1\nans=0\nfor bit in range(1 << s):\n a = S[0]\n for i in range(s):\n if bit & (1<<i):\n a += "+"\n a += S[i+1]\n print(a)\n ans += sum(map(int,a.split("+")))\nprint(ans)\n', 'S = input()\n# 125\ns = len(S)-1\nans=0\nfor bit in range(1 << s):\n a = S[0]\n for i in range(s):\n if bit & (1<<i):\n a += "+"\n a += S[i+1]\n ans += sum(map(int,a.split("+")))\nprint(ans)\n'] | ['Wrong Answer', 'Accepted'] | ['s817675969', 's762957884'] | [3060.0, 3060.0] | [22.0, 20.0] | [227, 214] |
p04001 | u752767312 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['S = input()\npower = len(S)-1\nloop = 2**power\n\nrevS = list(reversed(S))\nans = 0\n\nfor i in range(loop):\n ans += int(revS[0])\n multi_ten = 10\n for j in range(power):\n digit = bin(i>>j)[-1]\n if digit == "0":\n ans += int(revS[j+1])*multi_ten\n multi_ten *= 10\n else:\n ans += int(revS[j+1])\n multi_ten = 10', 'S = input()\npower = len(S)-1\nloop = 2**power\n\nrevS = list(reversed(S))\nans = 0\n\nfor i in range(loop):\n ans += int(revS[0])\n multi_ten = 10\n for j in range(power):\n digit = bin(i>>j)[-1]\n if digit == "0":\n ans += int(revS[j+1])*multi_ten\n multi_ten *= 10\n else:\n ans += int(revS[j+1])\n multi_ten = 10\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s989323845', 's145016480'] | [3064.0, 3064.0] | [22.0, 22.0] | [373, 384] |
p04001 | u752907966 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s = input()\nn = len(s)\n\n\ndef dfs(i,f):\n if i == n-1:\n return sum(list(map(int,f.split("+"))))\n return dfs(i+1,f+s[i+1]) + dfs(i+2,f+"+"+s[i+1])\n \nprint(dfs(0,s[0]))', 's = input()\nn = len(s)\n\n\ndef dfs(i,f):\n if i == n-1:\n return sum(list(map(int,f.split("+"))))\n return dfs(i+1,f+s[i+1]) + dfs(i+2,f+"+"+s[i+1])\n \nprint(dfs(0,s[0])', 's = input()\nn = len(s)\n\ndef dfs(i,t):\n if i == n-1:\n return sum(list(map(int,t.split(chr(43)))))\n return dfs(i+1,t+s[i+1]) + dfs(i+1,t+chr(43)+s[i+1])\n\nprint(dfs(0,s[0]))'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s606437836', 's773194913', 's953893518'] | [3060.0, 2940.0, 3060.0] | [18.0, 17.0, 18.0] | [444, 443, 175] |
p04001 | u765237551 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['from collections import defaultdict\nH, W, N = map(int, input().split())\nposs = [list(map(int, input().split())) for _ in range(N)]\nd = defaultdict(int)\nfor a, b in poss:\n for i, j in ((i, j) for i in range(a-1, a+2) for j in range(b-1, b+2)):\n if 1<i<H and 1<j<W:\n s = str(i)+":"+str(j)\n d[s] += 1\nanss = [0] * 10\nfor x in d.values():\n anss[x] += 1\nprint((H-2)*(W-2) - sum(anss[1:]))\nfor ans in anss[1:]:\n print(ans)', 's = input()\nans = 0\nl = len(s)-1\nfor i in range(2**(len(s)-1)):\n bs = ("{0:0>"+str(l)+"b}").format(i)\n s1 = 0\n temp = s[:]\n j = 0\n for b in bs:\n j+=1\n if b == \'1\':\n s1 += int(temp[:j])\n temp = temp[j:]\n j = 0\n s1 += int(temp)\n ans += s1\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s204489414', 's874538603'] | [3444.0, 3188.0] | [220.0, 44.0] | [454, 315] |
p04001 | u766407523 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["def search(s):\n if len(s) <= 1:\n return eval(s[0])\n return search([s[0]+s[1]]+s[2:]) + search([s[0]+'+'+s[1]]+s[2:])\nprint(search(input()))", "def pt(s: list):\n if len(s) = 1:\n return eval(s[0])\n return pt([s[0]+s[1]]+s[2:]) + pt([s[0]+'+'+s[1]]+s[2:])\nprint(pt(list((input()))))", "def pt(s: list):\n if len(s) == 1:\n return eval(s[0])\n return pt([s[0]+s[1]]+s[2:]) + pt([s[0]+'+'+s[1]]+s[2:])\nprint(pt(list((input()))))"] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s306038049', 's640815495', 's320884812'] | [3060.0, 2940.0, 3060.0] | [17.0, 17.0, 25.0] | [152, 149, 150] |
p04001 | u772614554 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['from sys import stdin\n\na = stdin.readline().rstrip()\nprint(a.upper())\nprint(output)', 'input = input()\noutput = 0\nprint(output)', 'x = str(input())\nans = 0\n\nfor i in range(1 << len(x)-1):\n print(bin(i))\n tmp = 0\n for j in range(0, len(x)-1):\n if (i>>j&1 == 0):\n continue;\n else:\n ans += int(x[tmp:j+1])\n # print(x[tmp:j+1])\n tmp = j+1\n ans += int(x[tmp:])\n\nprint(ans)', 'x = input()\noutput = x\nprint(output)', 'x = input()\noutput = x\nprint(output)', 'x = str(input())\nans = 0\n\nfor i in range(1 << len(x)-1):\n print(bin(i))\n tmp = 0\n for j in range(0, len(x)-1):\n if (i>>j&1 == 0):\n continue;\n else:\n ans += int(x[tmp:j+1])\n tmp = j+1\n ans += int(x[tmp:])\n\nprint(ans)', 'x = str(input())\nans = 0\n\nfor i in range(2**len(x)-1):\n tmp = x[0]\n for j in range(0, len(x)-1):\n if (i>>j&1==0):\n tmp += x[j+1]\n else:\n ans += int(tmp)\n tmp = x[j+1]\n ans += int(tmp)\n\nprint(ans)\n', 's = input()\nn = 0\nans = 0\nfor n in range( 1 << len(s) -1):\n p = 0\n for i in range(len(s) - 1):\n if n & (1 << i):\n ans += int(s[p:i + 1])\n p = i + 1\n if p < len(s):\n ans += int(s[p:])\nprint(ans)'] | ['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s088719497', 's282551552', 's546373952', 's786017070', 's892320582', 's897917022', 's954033486', 's472913759'] | [2940.0, 2940.0, 3060.0, 2940.0, 2940.0, 3060.0, 3060.0, 3060.0] | [17.0, 17.0, 21.0, 17.0, 17.0, 21.0, 23.0, 20.0] | [83, 40, 266, 36, 36, 274, 220, 238] |
p04001 | u773265208 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s = input()\n\nn = len(s)\n\nans = 0\nfor i in range(2**n):\n\tl = []\n\top = [""]*n\n\tfor j in range(n):\n\t\tif i & (1 << j):\n\t\t\top[j] = \'+\'\n\tprint(op)\n\tres = ""\n\tfor a,b in zip(op+[""],s):\n\t\tres += a+b\n\n\tans += eval(res)\n\nprint(ans//2)\n', 's = input()\n\nn = len(s)\n\nans = 0\nfor i in range(2**n):\n\tl = []\n\top = [""]*n\n\tfor j in range(n):\n\t\tif i & (1 << j):\n\t\t\top[j] = \'+\'\n\t#print(op)\n\tres = ""\n\tfor a,b in zip(op+[""],s):\n\t\tres += a+b\n\n\tans += eval(res)\n\nprint(ans//2)\n'] | ['Wrong Answer', 'Accepted'] | ['s739941473', 's420155298'] | [3060.0, 3060.0] | [42.0, 39.0] | [226, 227] |
p04001 | u780475861 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['def powerset(iterable):\n s = list(iterable)\n return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))\n\n\ndef s_to_num(s):\n numlst = list(map(int, s))\n res = 0\n for i in numlst:\n res *= 10\n res += i\n return res\n\n\ns = input()\nlength = len(s)\nres = 0\nfor i in powerset(range(1, length)):\n if not i:\n res += int(s)\n else:\n jlst = [0] + list(i) + [length]\n for j in range(len(jlst) - 1):\n res += s_to_num(s[jlst[j]:jlst[j + 1]])\nprint(res)', 'from itertools import chain, combinations\n\n\ndef powerset(iterable):\n s = list(iterable)\n return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))\n\n\ndef s_to_num(s):\n numlst = list(map(int, s))\n res = 0\n for i in numlst:\n res *= 10\n res += i\n return res\n\n\ns = input()\nlength = len(s)\nres = 0\nfor i in powerset(range(1, length)):\n if not i:\n res += int(s)\n else:\n jlst = [0] + list(i) + [length]\n for j in range(len(jlst) - 1):\n res += s_to_num(s[jlst[j]:jlst[j + 1]])\nprint(res)\n'] | ['Runtime Error', 'Accepted'] | ['s890846939', 's042670847'] | [3064.0, 3064.0] | [17.0, 22.0] | [520, 565] |
p04001 | u790487011 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['import sys\n\ns = tuple(sys.stdin.readline().rstrip())\n\nl = len(s)\n\nprint(l)\n\ndef op(n):\n if n == "0":\n return ""\n else:\n return "+"\n\n\nres = []\nfor i in range(2**(l-1)):\n \n ops = [op(x) for x in tuple(format(i*2, \'b\').zfill(l))]\n \n # print(s)\n # print(ops)\n\n eq = \'\'\n for num, j in zip(s, ops):\n eq = eq + num + j\n \n res.append(eval(eq))\n\nprint(sum(res))', 'import sys\n\ns = tuple(sys.stdin.readline().rstrip())\n\nl = len(s)\n\n# print(l)\n\ndef op(n):\n if n == "0":\n return ""\n else:\n return "+"\n\n\nres = []\nfor i in range(2**(l-1)):\n \n ops = [op(x) for x in tuple(format(i*2, \'b\').zfill(l))]\n \n # print(s)\n # print(ops)\n\n eq = \'\'\n for num, j in zip(s, ops):\n eq = eq + num + j\n \n res.append(eval(eq))\n\nprint(sum(res))'] | ['Wrong Answer', 'Accepted'] | ['s313460391', 's122115805'] | [3064.0, 3064.0] | [28.0, 28.0] | [372, 374] |
p04001 | u799428010 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['n=input()', 's=input()\nn=len(s)\ndef dfs(i,f):\n if i==n-1:\n return sum(list(map(int,f.split("+"))))\n return dfs(i+1,f+s[i+1])+dfs(i+1,f+ "+"+s[i+1]) \n\ndfs(0,s[0])', 'n=int(input())\nprint(1)', 'def total(n):\n if n < 1:\n return 0\n\n return n + total(n - 1)\n\nprint(total(100))', 's=input()\nn=len(s)\ndef dfs(i,f):\n if i==n-1:\n return sum(list(map(int,f.split("+"))))\n return dfs(i+1,f+s[i+1])+dfs(i+1,f+ "+"+s[i+1]) \n\nprint(dfs(0,s[0]))'] | ['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s015551352', 's365521215', 's567624722', 's646977322', 's135600207'] | [8984.0, 9108.0, 9012.0, 9016.0, 9032.0] | [27.0, 28.0, 29.0, 29.0, 27.0] | [9, 401, 23, 92, 408] |
p04001 | u825116851 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["\ndef solve(S):\n a = _iter(S, '')\n return a\n\n\ndef _iter(s, t):\n if s == '':\n if t.endswith('+'):\n return 0\n print(t)\n return eval(t)\n a = s[0]\n b = s[1:]\n return _iter(b, t+a) + _iter(b, t+a+'+')\n\n\nif __name__ == '__main__':\n S = input()\n print(solve)", "\ndef solve(S):\n a = _iter(S, '')\n return a\n\n\ndef _iter(s, t):\n if s == '':\n if t.endswith('+'):\n return 0\n return eval(t)\n a = s[0]\n b = s[1:]\n return _iter(b, t+a) + _iter(b, t+a+'+')\n\n\nif __name__ == '__main__':\n S = input()\n print(solve)\n\n", "\ndef solve(S):\n a = _iter(S, '')\n return a\n\n\ndef _iter(s, t):\n if s == '':\n if t.endswith('+'):\n return 0\n return eval(t)\n a = s[0]\n b = s[1:]\n return _iter(b, t+a) + _iter(b, t+a+'+')\n\n\nif __name__ == '__main__':\n S = input()\n print(solve(S))\n"] | ['Wrong Answer', 'Wrong Answer', 'Accepted'] | ['s225252105', 's263649038', 's078743966'] | [3060.0, 2940.0, 3064.0] | [17.0, 17.0, 25.0] | [357, 342, 344] |
p04001 | u825842302 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s = input()\nn = (len(s) - 1)\n\nans_lst = []\nfor i in range(2**n):\nop = ["+"] * n \n for j in range(n):\n if ((i >> j) & 1):\n op[n-j-1] = ""\n for num,opp in zip(s, op + [""]):\n formula += (num + opp)\n ans_lst = ans_lst + [eval(formula)]\n\nprint(sum(ans_lst))', 's = input()\nn = (len(s) - 1)\n\nans_lst = []\nfor i in range(2**n):\n op = ["+"] * n \n for j in range(n):\n if ((i >> j) & 1):\n op[n-j-1] = ""\n formula = ""\n for num,opp in zip(s, op + [""]):\n formula += (num + opp)\n ans_lst = ans_lst + [eval(formula)]\n\nprint(sum(ans_lst))'] | ['Runtime Error', 'Accepted'] | ['s400893401', 's300867046'] | [2940.0, 3064.0] | [17.0, 29.0] | [287, 308] |
p04001 | u829269490 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['S = input()\n\nfrom itertools import combinations\n\ns = int(S)\nfor l in range(1, len(S)):\n print(l)\n for c in combinations(range(1, len(S)), l):\n c = sorted(c)\n n = [int(S[lower:upper]) for lower, upper in zip([0] + c, c + [len(S)])]\n s += sum(n)\n\nprint(s)\n', 'S = input()\n\nfrom itertools import combinations\n\ns = int(S)\nfor l in range(1, len(S)):\n for c in combinations(range(1, len(S)), l):\n c = sorted(c)\n n = [int(S[lower:upper]) for lower, upper in zip([0] + c, c + [len(S)])]\n s += sum(n)\n\nprint(s)\n'] | ['Wrong Answer', 'Accepted'] | ['s699107661', 's527462688'] | [3060.0, 3060.0] | [19.0, 19.0] | [281, 268] |
p04001 | u829895669 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['S = input()\nans = 0\nfor i in range(1 << (len(S)-1)):\n eq = S\n for j in range(len(S)-1):\n if i & (1 << j):\n eq = eq[:j+1] + "," + eq[j+1:]\n else:\n pass\n eq = eq.split(",")\n ans += sum(eq)\nprint(ans)', 'S = input()\nans = 0\nfor i in range(1 << (len(S)-1)):\n eq = S\n for j in range(len(S)-1):\n if i & (1 << j):\n eq = eq[:j+1] + "," + eq[j+1:]\n else:\n pass\n eq = eq.split(",")\n eq = list(map(int,eq))\n ans += sum(eq)\nprint(ans)', 'S = input()\nans = 0\nfor i in range(1 << (len(S)-1)):\n eq = S\n k = 0\n for j in range(len(S)-1):\n if i & (1 << j):\n eq = eq[:j+1+k] + "," + eq[j+1+k:]\n k +=1\n else:\n pass\n eq = eq.split(",")\n eq = list(map(int,eq))\n ans += sum(eq)\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s013979946', 's215243534', 's949151603'] | [3060.0, 3060.0, 3064.0] | [17.0, 17.0, 21.0] | [245, 272, 304] |
p04001 | u835482198 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['def rec(s, start, d):\n if d == 0:\n return [s[start:]]\n\n cand = []\n for i in range(start + 1, len(s)):\n c = rec(s, i, d - 1)\n for cc in c:\n cand.append(s[start:i] + \'+\' + cc)\n return cand\n\n\ns = input()\n\n\n\nN = len(s)\ncnt = 0\nfor i in range(N):\n eqs = rec(s, 0, i)\n for eq in eqs:\n if len(eq.replace(\'+\', "")) != N:\n cnt += eval(eq)\n # cnt += sum([eval(eq) for eq in eqs])\nprint(cnt)\n', '\ndef rec(s, start, d):\n if d == 0:\n return [s[start:]]\n\n cand = []\n for i in range(start + 1, len(s)):\n c = rec(s, i, d - 1)\n for cc in c:\n cand.append(s[start:i] + \'+\' + cc)\n return cand\n\n\ns = input()\n\n\n\nN = len(s)\ncnt = 0\nfor i in range(N):\n eqs = rec(s, 0, i)\n for eq in eqs:\n if len(eq.replace(\'+\', "")) == N:\n cnt += eval(eq)\n # cnt += sum([eval(eq) for eq in eqs])\nprint(cnt)'] | ['Wrong Answer', 'Accepted'] | ['s638609072', 's031039966'] | [3060.0, 3064.0] | [19.0, 26.0] | [481, 481] |
p04001 | u836939578 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s=input()\n\nop_n=len(s) - 1\n\nans=0\n\nfor i in range(1 << len(s)):\n sign = [""] * op_n\n for j in range(op_n):\n if ((i>>j)==1):\n sign[j] = "+"\n formula = ""\n for k in range(op_n):\n formula += s[k] + sign[k]\n formula += s[op-n] \n ans += eval(formula)\nprint(ans) \n \n \n ', 's=input()\n\nop_n=len(s) - 1\n\nans=0\n\nfor i in range(1 << len(s)):\n sign = [""] * op_n\n for j in range(op_n):\n if ((i>>j) and 1)==1:\n sign[j] = "+"\n formula = ""\n for k in range(op_n):\n formula += s[k] + sign[k]\n formula += s[op-n] \n ans += eval(formula)\nprint(ans) \n \n \n ', 's = input()\n\nop_n = len(s) - 1\n\nans = 0\n\nfor i in range(1 << op_n):\n sign = [""] * op_n\n for j in range(op_n):\n if ((i>>j)&1):\n sign[j] = "+"\n formula = ""\n for k in range(op_n):\n formula += s[k] + sign[k]\n formula += s[op-n] \n ans += eval(formula)\nprint(ans) \n \n \n ', 's=input()\n\nop_n=len(s) - 1\n\nans=0\n\nfor i in range(1 << op_n):\n sign = [""] * op_n\n for j in range(op_n):\n if ((i>>j)&1)==1:\n sign[j] = "+"\n formula = ""\n for k in range(op_n):\n formula += s[k] + sign[k]\n formula += s[op-n] \n ans += eval(formula)\nprint(ans) \n \n \n ', 's=input()\n\nop_n=len(s) - 1\n\nans=0\n\nfor i in range(1 << len(s)):\n sign = [""] * op_n\n for j in range(op_n):\n if ((i>>j)&1)==1:\n sign[j] = "+"\n formula = ""\n for k in range(op_n):\n formula += s[k] + sign[k]\n formula += s[op-n] \n ans += eval(formula)\nprint(ans) \n \n \n ', 's=input()\n\nop_n=len(s) - 1\n\nans=0\n\nfor i in range(1 << len(s)):\n sign = [""] * op_n\n for j in range(op_n):\n if ((i>>j)==1):\n sign[j] = "+"\n formula = ""\n for k in range(op_n):\n formula += s[k] + sign[k]\n formula += s[op-n] \n ans = eval(formula)\nprint(ans) \n \n \n ', 's = input()\n\nop_n = len(s) - 1\n\nans = 0\n\nfor i in range(1 << op_n):\n sign = [""] * op_n\n for j in range(op_n):\n if ((i>>j)&1):\n sign[j] = "+"\n formula = ""\n for k in range(op_n):\n formula += s[k] + sign[k]\n formula += s[op_n] \n ans += eval(formula)\nprint(ans) \n \n \n '] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s039193208', 's050608083', 's086095887', 's260196335', 's584974429', 's605514735', 's760799827'] | [3060.0, 3064.0, 3060.0, 3060.0, 3060.0, 3060.0, 3060.0] | [18.0, 18.0, 17.0, 17.0, 17.0, 17.0, 27.0] | [295, 301, 298, 295, 297, 294, 298] |
p04001 | u840974625 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s = input()\nn = len(s)\n\nres = 0\n\ndef part_sum(cur, i):\n if i != n:\n res += part_sum(cur+s[i], i+1)\n res += part_sum(cur+s[i]+"+", i+1)\n else:\n cur += s[i]\n return sum(list(map(int, cur.split("+")))) \n \npart_sum("", 0)\nprint(res)', 's = input()\nn = len(s)\n\n\ndef part_sum(cur, i, s, res):\n if i < n-1:\n part_sum(cur+s[i], i+1, s, res)\n part_sum(cur+s[i]+"+", i+1, s, res)\n else:\n cur += s[i]\n res.append(sum(list(map(int, cur.split("+")))) )\n print(cur)\n print(res)\n return res\n \nres = part_sum("", 0, s, [])\nprint(sum(res))', 's = input()\nn = len(s)\n\nres = 0\n\ndef part_sum(cur, i):\n if i != n:\n part_sum(cur+s[i], i+1)\n part_sum(cur+"+"+s[i], i+1)\n else:\n cur += s[i]\n res += sum(list(map(int, res.split("+")))) \n \npart_sum([], 0)\nprint(res)', 's = input()\nn = len(s)\n\nres = 0\n\ndef part_sum(cur, i):\n if i != n:\n part_sum(cur+s[i], i+1)\n part_sum(cur+s[i]+"+", i+1)\n else:\n cur += s[i]\n res += sum(list(map(int, cur.split("+")))) \n \npart_sum("", 0)\nprint(res)', 's = input()\nn = len(s)\n\nres = 0\n\ndef part_sum(cur, i):\n if i != n:\n part_sum(cur+s[i], i+1)\n part_sum(cur+s[i]+"+", i+1)\n else:\n cur += s[i]\n res += sum(list(map(int, cur.split("+")))) \n \npart_sum([], 0)\nprint(res)', 's = input()\nn = len(s)\n\ndef part_sum(cur, i, res):\n if i < n-1:\n part_sum(cur+s[i], i+1, res)\n part_sum(cur+s[i]+"+", i+1, res)\n else:\n cur += s[i]\n res.append(sum(list(map(int, cur.split("+")))) )\n return res\n \nres = part_sum("", 0, [])\nprint(sum(res))'] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s229654685', 's271259775', 's275949815', 's338178140', 's965140916', 's062689736'] | [3060.0, 3956.0, 3060.0, 3060.0, 3064.0, 3064.0] | [17.0, 31.0, 17.0, 18.0, 17.0, 18.0] | [243, 342, 229, 229, 229, 291] |
p04001 | u841621946 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s = input()\ndef calc(s,op):\n ans = 0\n tmp = 0\n for i in range(len(s)):\n tmp += int(s[i])\n if i == len(s) - 1:\n ans += tmp\n break\n if op[i] == 0:\n tmp = tmp * 10\n else:\n ans += tmp\n tmp = 0\n return ans \ni_max = 2**(len(s)-1)\nans = 0\nfor i in range(i_max):\n op = [0]*(len(s) - 1)\n for j in range(len(op)):\n op[j] = i % 2\n i = i // 2\n ans += calc(s,op)', 's = input()\ndef calc(s,op):\n ans = 0\n tmp = 0\n for i in range(len(s)):\n tmp += int(s[i])\n if i == len(s) - 1:\n ans += tmp\n break\n if op[i] == 0:\n tmp = tmp * 10\n else:\n ans += tmp\n tmp = 0\n return ans \ni_max = 2**(len(s)-1)\nans = 0\nfor i in range(i_max):\n op = [0]*(len(s) - 1)\n for j in range(len(op)):\n op[j] = i % 2\n i = i // 2\n ans += calc(s,op)\nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s800684369', 's561952534'] | [3064.0, 3064.0] | [21.0, 22.0] | [467, 478] |
p04001 | u853952087 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["s=int(input())\nS=str(s)\nw=len(str(s))-1\nl=[]\nL=[]\nfor i in range(2**w):\n l.append(format(i, '0{}b'.format(w)))\nfor e in l:\n q=[]\n x=int(S[0])\n for i in range(len(e)):\n if e[i]=='0':\n x=x*10+int(S[i+1])\n else:\n q.append(x)\n x=int(S[i+1])\n q.append(x)\n L.append(sum(q))\nprint(sum(L)", "S=input()\nw=len(S)-1\nl=[]\nL=[]\n\nif w==0:\n print(int(S))\nelse:\n for i in range(2**w):\n \n l.append(format(i, '0{}b'.format(w)))\n \n for e in l:\n q=[]\n x=int(S[0])\n for i in range(len(e)):\n if e[i]=='0':\n x=x*10+int(S[i+1])\n else:\n q.append(x)\n x=int(S[i+1])\n q.append(x)\n L.append(sum(q))\n print(sum(L))"] | ['Runtime Error', 'Accepted'] | ['s055830081', 's547957035'] | [3064.0, 3064.0] | [18.0, 21.0] | [345, 592] |
p04001 | u866769581 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['\ns = input() \nS = [_ for _ in s]\nN = len(S)-1\nans_lis = []\npra_lis = []\ncalis = []\nfor x in range(2**N):\n lis = [\'\'] * (N)\n for y in range(N):\n if((x >> y) & 1):\n lis[N-1-y] = "+"\n pra_lis.append(lis)\nfor z in pra_lis:\n z.append(\'\')\n for x in range(len(S)):\n calis.append(S[x])\n calis.append(z[x])\n print(\'calis\',calis)\n calis = []\n ans_lis.append(calis)\nans = 0\nfor l in ans_lis:\n ans_num = \'0\'\n for r in l:\n if r == \'\':\n pass\n elif r == \'+\':\n ans += int(ans_num)\n print(ans_num)\n ans_num = \'0\'\n else:\n ans_num += r\n print(ans_num)\n ans += int(ans_num)\nprint(\'ans\',ans + int(s))', '\ns = input() \nS = [_ for _ in s]\nN = len(S)-1\nans_lis = []\npra_lis = []\ncalis = []\nfor x in range(2**N):\n lis = [\'\'] * (N)\n for y in range(N):\n if((x >> y) & 1):\n lis[N-1-y] = "+"\n pra_lis.append(lis)\nfor z in pra_lis:\n z.append(\'\')\n for x in range(len(S)):\n calis.append(S[x])\n calis.append(z[x])\n # print(\'calis\',calis)\n calis = []\n ans_lis.append(calis)\nans = 0\nfor l in ans_lis:\n ans_num = \'0\'\n for r in l:\n if r == \'\':\n pass\n elif r == \'+\':\n ans += int(ans_num)\n # print(ans_num)\n ans_num = \'0\'\n else:\n ans_num += r\n #print(ans_num)\n ans += int(ans_num)\nprint(ans + int(s))'] | ['Wrong Answer', 'Accepted'] | ['s238819842', 's625827300'] | [3880.0, 3188.0] | [32.0, 23.0] | [742, 739] |
p04001 | u868982936 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['from itertools import *\nA = list(map(int, list(input()))\n\nans = 0\nN = len(A)-1\nfor p in product([0,1], repeat = N):\n\tnow = A[0]\n for i in range(N):\n if p[i] == 0:\n now = now*10 + A[i+1]\n else:\n ans += now\n now = A[i+1]\n\tans += now\nprint(ans) \n', 'from itertools import *\nA = list(map(int, list(input()))\n\nans = 0\nN = len(A)-1\nfor p in product([0,1], repeat = N):\n\tnow = A[0]\n for i in range(N):\n if p[i] == 0:\n now = now*10 + A[i+1]\n else:\n ans += now\n now = A[i+1]\n\tans += now\nprint(ans) ', 'import itertools\nA = list(map(int, list(input()))\n\nans = 0\nN = len(A)-1\nfor p in product([0,1], repeat = N):\n\tnow = A[0]\n for i in range(N):\n if p[i] == 0:\n now = now*10 + A[i+1]\n else:\n ans += now\n now = A[i+1]\n\tans += now\nprint(ans) \n', 'from itertools import *\nA = list(map(int, list(input()))\n\nans = 0\nN = len(A)-1\nfor p in product([0,1], repeat = N):\n\tnow = A[0]\n\tfor i in range(N):\n if p[i] == 0:\n now = now*10 + A[i+1]\n else:\n ans += now\n now = A[i+1]\n\tans += now\nprint(ans) \n', 'A = list(map(int, list(input())))\n \nans = 0\nfrom itertools import *\nN = len(A)-1\nfor p in product([0,1],repeat=N):\n now = A[0]\n for i in range(N):\n if p[i] == 0:\n now = now*10+A[i+1]\n else:\n ans += now\n now = A[i+1]\n ans += now\nprint(ans)'] | ['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted'] | ['s167356373', 's235664174', 's289765373', 's693084327', 's870942044'] | [2940.0, 2940.0, 2940.0, 2940.0, 3060.0] | [17.0, 17.0, 17.0, 17.0, 19.0] | [280, 279, 273, 277, 294] |
p04001 | u872887731 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['from itertools import product\nS = input()\nans = 0\n\nfor string in product(["","+"],repeat=len(S) - 1):\n string = list(string)\n string.append("")\n sum_ = [a + b for a,b in zip(S,string)]\n ans += sum_\n\nprint(ans)', 'from itertools import product\nS = input()\nans = 0\n\nfor string in product(["","+"],repeat=len(S) - 1):\n string = list(string)\n string.append("")\n sum_ = [a + b for a,b in zip(S,string)]\n ans += eval("".join(sum_))\n\nprint(ans)'] | ['Runtime Error', 'Accepted'] | ['s507392584', 's640415772'] | [3060.0, 3060.0] | [18.0, 26.0] | [221, 236] |
p04001 | u875449556 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ["S = input()\n\nx = len(S)-1\n\ns = 0\nfor i in range(1 << x):\n t = 0\n for j in range(x):\n if ((i >> j) & 1 == 1):\n s += int(''.join(s[t:j+1]))\n t = j+1\n s = int(''.join(s[t:]))\nprint(s)", "S = input()\n\nx = len(S)-1\n\ns = 0\nfor i in range(1 << x):\n t = 0\n for j in range(x):\n if (i & (1 << j) == 1):\n s += int(''.join(S[t:j+1]))\n t = j+1\n s += int(''.join(S[t:]))\nprint(s)", 'S = input()\n\nn = len(S)\ne = ""\ns = 0\n\nfor i in range(2**(n-1)):\n for j in range(n-1):\n e += S[j]\n if (i << j & 1):\n e += "+"\n s += sum(map(int, e.split("+")))\n \nprint(s)\n ', 'S = input()\n\nx = len(S)-1\n\na = 0\nb = 0\ns = 0\nfor i in range(1 << x):\n for j in range(x):\n if ((i >> j) & 1 == 1):\n b = j\n s += int(S[a:b])\n a = j\n\nprint(s)', "S = input()\n\nx = len(S)-1\n\ns = 0\nfor i in range(1 << x):\n t = 0\n for j in range(x):\n if (i & 1 << j == 1):\n s += int(''.join(S[t:j+1]))\n t = j+1\n s += int(''.join(S[t:]))\nprint(s)", "S = input()\n\nx = len(S)-1\n\ns = 0\nfor i in range(1 << x):\n t = 0\n for j in range(x):\n if ((i >> j) & 1 == 1):\n s += int(''.join(s[t:j+1]))\n t = j+1\n s += int(''.join(s[t:]))\nprint(s)", "S = input()\n\nx = len(S)-1\n\ns = 0\nfor i in range(1 << x):\n t = 0\n for j in range(x):\n if (i >> j) & 1:\n s += int(''.join(S[t:j+1]))\n t = j+1\n s += int(''.join(S[t:]))\nprint(s)\n"] | ['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted'] | ['s229170412', 's276633425', 's358215653', 's384895029', 's827297323', 's888010542', 's191172788'] | [3060.0, 3060.0, 3060.0, 2940.0, 3060.0, 3060.0, 2940.0] | [17.0, 19.0, 35.0, 17.0, 19.0, 17.0, 21.0] | [218, 219, 216, 198, 217, 219, 213] |
p04001 | u884323674 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['S = input()\n\ndef div_plus(i, s):\n if i == len(S):\n s_list = [int(i) for i in s.split("+")]\n return sum(s_list)\n \n pos = i - len(S)\n \n d1 = div_plus(i+1, s)\n \n \n d2 = div_plus(i+1, s[:pos]+"+"+s[pos:])\n return d1 + d2\n\ndiv_plus(1, S)', 'S = input()\n\ndef rec(n, s):\n if n == 1:\n ans = 0\n for i in s.split("+"):\n ans += int(i)\n return ans\n \n \n return rec(n-1, s) + rec(n-1, s[:-n+1]+"+"+s[-n+1:])\n\nprint(rec(len(S), S))'] | ['Wrong Answer', 'Accepted'] | ['s680946602', 's704874177'] | [3060.0, 3060.0] | [19.0, 17.0] | [340, 284] |
p04001 | u884601206 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['s=input()\nt=len(s)-1\nsl=[s[i] for i in range(len(s))]\nanswers=[]\n\nfor i in range(2**t):\n tmp=[]\n for j in range(t):\n if (i>>j)&1:\n tmp.append(j)\n ll=[\'*\'] * len(s)\n for k in tmp:\n ll[k]="+"\n ans=[]\n \n for k,_in zip(sl,ll):\n ans.append(k)\n ans.append(_)\n ans=[_ for _ in ans if _ != "*"]\n ans=\'\'.join(ans)\n ans=ans.split(\'+\')\n ans=[int(k) for k in ans if k != \'+\']\n ans=sum(ans)\n answers.append(ans)\n \nprint(sum(answers))\n\n \n \n ', 's=str(input())\nt=len(s)-1\nsl=[s[i] for i in range(len(S))]\nanswers=[]\n\nfor i in range(2**t):\n tmp=[]\n for j in range(t):\n if (i>>j)&1:\n tmp.append(j)\n ll=[\'*\'] * len(s)\n for k in tmp:\n ll[k]="+"\n ans=[]\n \n for k,_in zip(sl,ll):\n ans.append(k)\n ans.append(_)\n ans=[_ for _ in ans if _ != "*"]\n ans=\'\'.join(ans)\n ans=ans.split(\'+\')\n ans=[int(k) for k in ans if k != \'+\']\n ans=sum(ans)\n answers.append(ans)\n \nprint(sum(answers))\n\n \n \n ', 's=input()\nt=len(s)-1\nsl=[s[i] for i in range(len(s))]\nanswers=[]\n\nfor i in range(2**t):\n tmp=[]\n for j in range(t):\n if (i>>j)&1:\n tmp.append(j)\n ll=[\'*\'] * len(s)\n for k in tmp:\n ll[k]="+"\n ans=[]\n \n for k,_ in zip(sl,ll):\n ans.append(k)\n ans.append(_)\n ans=[_ for _ in ans if _ != "*"]\n ans=\'\'.join(ans)\n ans=ans.split(\'+\')\n ans=[int(k) for k in ans if k != \'+\']\n ans=sum(ans)\n answers.append(ans)\n \nprint(sum(answers))\n\n \n \n '] | ['Runtime Error', 'Runtime Error', 'Accepted'] | ['s776511816', 's988880783', 's381414814'] | [2940.0, 2940.0, 3064.0] | [17.0, 17.0, 23.0] | [465, 470, 466] |
p04001 | u886730634 | 2,000 | 262,144 | You are given a string S consisting of digits between `1` and `9`, inclusive. You can insert the letter `+` into some of the positions (possibly none) between two letters in this string. Here, `+` must not occur consecutively after insertion. All strings that can be obtained in this way can be evaluated as formulas. Evaluate all possible formulas, and print the sum of the results. | ['n=input()\nl=len(n)\n\nans=0\nfor i in range(2**(l-1)):\n x=n[0]\n for j in range(l-1):\n if((i<<j)&1):\n x+="+"\n x+=n[j+1]\n ans+=eval(x)\n \nprint(ans)', 'n=input()\nl=len(n)\n\nans=0\nfor i in range(2**(l-1)):\n x=n[0]\n for j in range(l-1):\n if((i>>j)&1):\n x+="+"\n x+=n[j+1]\n ans+=eval(x)\n \nprint(ans)'] | ['Wrong Answer', 'Accepted'] | ['s470305022', 's981329058'] | [3060.0, 3060.0] | [23.0, 27.0] | [157, 157] |