Problem:


Score : 300 points

Problem Statement

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.

Constraints

1 \leq |S| \leq 10

All letters in S are digits between 1 and 9, inclusive.

Input

The input is given from Standard Input in the following format:

S

Output

Print the sum of the evaluated value over all possible formulas.

Sample Input 1

125

Sample Output 1

176

There are 4 formulas that can be obtained: 125, 1+25, 12+5 and 1+2+5. When each formula is evaluated,

125

1+25=26

12+5=17

1+2+5=8

Thus, the sum is 125+26+17+8=176.

Sample Input 2

9999999999

Sample Output 2

12656242944



Sample input:
125


Sample output:
176

Submission status: Wrong Answer

Solution code:
input_num = str(input())

def calc_adding(left_str, skip_cnt, const):
    # 1桁まで来たら、+ を挟めない
    if len(left_str) <= 1 + skip_cnt:
        return int(left_str) + const
    
    # + の有無で分岐を増やす
    # + を入れない場合
    res_np = calc_adding(left_str, skip_cnt + 1, const)
    
    # + 入れる場合
    res_p = calc_adding(left_str[1 + skip_cnt:], 0, int(left_str[:1 + skip_cnt]))

    return res_np + res_p + const

calc_adding(input_num, 0, 0)

Submission status: Wrong Answer

Solution code:
S = input()
 
cnt = len(S) - 1 #数字の間の数
 
ans = 0
 
for i in range(2 ** cnt):
  sign = [""] * cnt
  for j in range(cnt):
    if ((i>>j)&1):
      sign[j] = "+"
            
  formula = ""      
  for k in range(cnt):
    formula += S[k] + sign[k]
    print(sign)
  formula += S[cnt]
  print(formula,i)       
  ans += eval(formula)
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import product
s = input()

n = len(s) - 1
ans = 0

plus = list(product(["","+"], repeat=n))

for p in plus:
    e = s[0]
    for i in range(n):
        e += p[i]+s[i+1]
    print(e)
    ans += eval(e)
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)
nums = []
for i in range(2**(N-1)):
    bi = bin(i)[2:].zfill(N-1)
    bi = '1' + bi + '1'
    l = 0
    for r in range(1,N+1):
        if bi[r] == '1':
            nums.append(int(S[l:r]))
            l = r
print(sum(nums))

Submission status: Wrong Answer

Solution code:
import sys

s = tuple(sys.stdin.readline().rstrip())

l = len(s)

print(l)

def op(n):
  if n == "0":
    return ""
  else:
    return "+"


res = []
for i in range(2**(l-1)):
  
  ops = [op(x) for x in tuple(format(i*2, 'b').zfill(l))]
  
  # print(s)
  # print(ops)

  eq = ''
  for num, j in zip(s, ops):
    eq = eq + num + j
  
  res.append(eval(eq))

print(sum(res))

Submission status: Wrong Answer

Solution code:
def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    nums = list(map(lambda x: int(x), inputs[0]))
    opr_num = len(nums) - 1
    opr_pattern = opr_num ** 2
    opr_digit_len = len(str(bin(opr_num))) - 2

    total = 0
    for opr_digit in range(opr_pattern):
        oprs = []
        tmp_opr_digit = opr_digit
        for _ in range(0, opr_num):
            # print(tmp_opr_digit)
            if tmp_opr_digit & 1 == 1:
                oprs.append("+")
            else:
                oprs.append("")
            tmp_opr_digit = tmp_opr_digit >> 1
        oprs.reverse()

        formula = ""
        for i, v in enumerate(oprs):
            formula += str(nums[i]) + str(oprs[i])
        formula += str(nums[-1])
        total += eval(formula)

    return total


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)

Submission status: Wrong Answer

Solution code:
s = list(input())

op_cnt = len(s)-1
sum = 0
for i in range(op_cnt**2):
    op = ['']*op_cnt
    for j in range(op_cnt):
        if (i>>j) & 1:
            op[j] = '+'

    fomula = s[0]
    for j in range(op_cnt):
        fomula += op[j]
        fomula += s[j+1]
    
    sum += eval(fomula)

print(sum)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
C - たくさんの数式 / Many Formulas
"""
import types
#import copy

# Input
abcd = input()
n = len(abcd) - 1 # 閾の数
sum_ = 0

# Print
for i in range( 2**n ):
    op = n * ["+"]

    # Create operation list
    # example: ['', '+', '']
    for j in range(n):
        if ( i >> j ) & 1:
            op[n-1 -j] = ""
            
    formula = ""
    for p_n, p_o in zip(abcd, op+[""]):
        formula += (p_n + p_o)
    print(formula)

    sum_ += eval(formula)

print(sum_)

Submission status: Wrong Answer

Solution code:
s=input()
sl=[]
ans=0
if len(s)==1:
  print(int(s))
else:
  for iii in range(2**(len(s)-1)):
    sind='{:0'+str(len(s)-1)+'b}'
    astr=sind.format(iii)
    astr=astr.replace("1","+")
    astr=astr.replace("0","x")
    lans=s[0]
    for jjj in range(len(astr)):
      lans+=astr[jjj]+s[jjj+1]
    lans=lans.replace("x","")
    ans+=int(eval(lans))
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
sum = 0
for i in range(2**(len(s)-1)):
    term = 0
    for j in range(len(s)-1):
        term *= 10
        if (i//(2**j))%2 == 0:
            sum += term + int(s[j])
            term = 0
            if j == len(s)-2:
                sum += int(s[-1])
        else:
            term += int(s[j])
            if j == len(s)-2:
                sum += term*10 + int(s[-1])

print(sum)

Submission status: Wrong Answer

Solution code:
n = [int(x) for x in input()]
op_cnt = len(n) - 1
for i in range(2 ** op_cnt):
  op = ["-"] * op_cnt
  for j in range(op_cnt):
    if((i >> j) & 1):
      op[op_cnt - 1 - j] = "+"
    print(op)

Submission status: Wrong Answer

Solution code:
S = input()

r = []
ret = 0
for i in range((len(S)-1)**2):
    s = ""
    for j in range(len(S)):
        s += S[j]
        if (i >> j) & 1 and j < len(S)-1:
            s += "+"
    ret += eval(s)
    r.append(s)
print(ret)

Submission status: Wrong Answer

Solution code:
from itertools import product
S = input()
ans = 0

# '+'と''の直積集合
# '+'を加える場合と加えない場合ですべての式を表せる
for s in product(["", "+"], repeat=len(S) - 1):
  s = list(s)
  print(s)
  s.append("")
  ans += eval("".join(a+b for a,b in zip(S,s)))
  print(ans)
  
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
for i in range(2**(len(S)-1)):
    binary =list(bin(i)[2:].zfill(len(S)-1))
    S_divide = []
    index = 0
    for j in range(len(S)-1):
        if binary[j] == "1":
            S_divide.append(S[index:j+1])
            index = j+1
        if j == len(S)-2:
            S_divide.append(S[index:])
#    print(S_divide)
    for k in range(len(S_divide)):
        ans += int(S_divide[k])
print(ans)

Submission status: Wrong Answer

Solution code:
A = input()
sum = 0

def makenum(ar):
    s = 0
    for i in range(len(ar)):
        s += ar[i] * (10 ** (len(ar) - i - 1))
    return s

for i in range(1 << len(A)):
    output = []
    for j in range(len(A)):
        if((i >> j) & 1) == 1:
            output.append(int(A[j]))
    sum += makenum(output)
print(sum)

Submission status: Wrong Answer

Solution code:
n=input()
q=len(n)
ans=int(n)
for i in range(1,q):
    ans+=int(n[:i])+int(n[i:])
print(ans)

Submission status: Wrong Answer

Solution code:
n=input()
q=len(n)
ans=0
for i in range(1,q):
    ans+=int(n[:i])+int(n[i:])
print(ans)

Submission status: Wrong Answer

Solution code:
n=input()
q=len(n)-1
ans=0
for i in range(1,q):
    ans+=int(n[:i])+int(n[i:])
print(ans)

Submission status: Wrong Answer

Solution code:
S=list(input())
S.reverse()
l=len(S)

def ss(S,m,n):
    if n==l-1:
        return int(S[n])*10**m
    if n==l-2:
        s1=ss(S,m+1,n+1)+int(S[n])*10**m

        s2=ss(S,0,n+1)+int(S[n])*10**m
    else:
        s1=ss(S,m+1,n+1)+2*int(S[n])*10**m

        s2=ss(S,0,n+1)+2*int(S[n])*10**m       

    return s1+s2

print(ss(S,0,0))

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
memo = []
for i in range(1 << len(s) -1):
    print(bin(i))
    tmp = s[0]
    for j in range(len(s)-1):
        if ((i >> j) & 1):
            tmp+="+"
        tmp += s[j+1]
    if tmp not in memo:
        ans+=eval(tmp)
        memo.append(tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
memo = []
for i in range(len(s)**2 -1):
    tmp = s[0]
    for j in range(len(s)-1):
        if ((i >> j) & 1):
            tmp+="+"
        tmp += s[j+1]
    if tmp not in memo:
        ans+=eval(tmp)
        memo.append(tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
def DepthFirst_search(S,pre) :
    global out
    #print(pre)
    #print(out)
    if len(S) == 1 :
        for i in range(len(pre)) :
            if i == len(pre)-1 :
                out += pre[i]*10 + int(S[0]) + pre[i] + int(S[0])
            else :
                out += 2*pre[i]
        return False

    pre.append(int(S[0]))
    if DepthFirst_search(S[1:len(S):],pre) :
        return False
    pre.pop()
    if len(pre) != 0:
        pre.append(pre.pop()*10 + int(S[0]))
        if DepthFirst_search(S[1:len(S):],pre):
            return False

    return False

out = 0
pre = []
S = input()
DepthFirst_search(S,pre)

print(out)

Submission status: Wrong Answer

Solution code:
def DepthFirst_search(S,pre) :
    global out
    #print(pre)
    #print(out)
    if len(S) == 1 :
        for i in range(len(pre)) :
            if i == len(pre)-1 :
                out += pre[i]*10 + int(S[0]) + pre[i] + int(S[0])
            else :
                out += 2*pre[i]
        return False

    pre.append(int(S[0]))
    if DepthFirst_search(S[1:len(S):],pre) :
        return False
    pre.pop()
    if len(pre) != 0:
        pre.append(pre.pop()*10 + int(S[0]))
    if DepthFirst_search(S[1:len(S):],pre):
        return False

    return True

out = 0
pre = []
S = input()
DepthFirst_search(S,pre)

print(out)

Submission status: Wrong Answer

Solution code:
x = str(input())
ans = 0

for i in range(1 << len(x)-1):
    print(bin(i))
    tmp = 0
    for j in range(0, len(x)-1):
        if (i>>j&1 == 0):
            continue;
        else:
            ans += int(x[tmp:j+1])
            tmp = j+1
            ans += int(x[tmp:])

print(ans)

Submission status: Wrong Answer

Solution code:
x = str(input())
ans = 0

for i in range(1 << len(x)-1):
    print(bin(i))
    tmp = 0
    for j in range(0, len(x)-1):
        if (i>>j&1 == 0):
            continue;
        else:
            ans += int(x[tmp:j+1])
            tmp = j+1
    ans += int(x[tmp:])

print(ans)

Submission status: Wrong Answer

Solution code:
x = str(input())
ans = 0

for i in range(1 << len(x)-1):
  print(bin(i))
  tmp = 0
  for j in range(0, len(x)-1):
    if (i>>j&1 == 0):
      continue;
    else:
      ans += int(x[tmp:j+1])
      # print(x[tmp:j+1])
      tmp = j+1
  ans += int(x[tmp:])

print(ans)

Submission status: Wrong Answer

Solution code:
x = str(input())
ans = 0

for i in range(2**len(x)-1):
  tmp = x[0]
  for j in range(0, len(x)-1):
    if (i>>j&1==0):
      tmp += x[j+1]
    else:
      ans += int(tmp)
      tmp = x[j+1]
  ans += int(tmp)

print(ans)

Submission status: Wrong Answer

Solution code:
#[全部作る]
s = input() 
S = [_ for _ in s]
N = len(S)-1
ans_lis = []
pra_lis = []
calis = []
for x in range(2**N):
    lis = [''] * (N)
    for y in range(N):
        if((x >> y) & 1):
            lis[N-1-y] = "+"
    pra_lis.append(lis)
for z in pra_lis:
    z.append('')
    for x in range(len(S)):
        calis.append(S[x])
        calis.append(z[x])
    print('calis',calis)
    calis = []
    ans_lis.append(calis)
ans = 0
for l in ans_lis:
    ans_num = '0'
    for r in l:
        if r == '':
            pass
        elif r == '+':
            ans += int(ans_num)
            print(ans_num)
            ans_num = '0'
        else:
            ans_num += r
        print(ans_num)
    ans += int(ans_num)
print('ans',ans + int(s))

Submission status: Wrong Answer

Solution code:
x = input()
output = x
print(output)

Submission status: Wrong Answer

Solution code:
input = input()
output = 0
print(output)

Submission status: Wrong Answer

Solution code:
from collections import deque
S=input()
queue=deque()
lst=[]
lst.append([0,0])
for i in range(0,len(S)):
    l=len(lst)
    for _ in range(l):
        x,y=lst.pop(0)
        lst.append([x,y*10+int(S[i])])#plus
        lst.append([x+y*10+int(S[i]),0])
l=len(lst)
for _ in range(l):
    x,y=lst.pop(0)
    lst.append(x+y)
print(sum(lst)/2)

Submission status: Wrong Answer

Solution code:
s = input()
space = len(s) - 1
total = []
for i in range(2 ** space):
    pluses = [''] * space
    for j in range(space):
        if (i >> j) & 1:
            pluses[j] = '+'
    re = ''
    for a, b in zip(s, pluses + ['']):
        re += (a + b)
    total.append(eval(re))
ans = sum(set(total))
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
space = len(s) - 1
total = 0
for i in range(2 ** space):
    pluses = []
    for j in range(space):
        if (i >> j) & 1:
            pluses.append(j)
    re = 0
    for p in pluses:
        re += int(s[p]) + int(s[p+1])
    total += re
print(total)

Submission status: Wrong Answer

Solution code:
s = list(input())
n = len(s) - 1
total = 0
for i in range(n ** 2):
    op = [""] * n
    for j in range(n):
        if ((i >> j) & 1):
            op[j] = "+"
    formula = ""
    for p, q in zip(s, op + [""]):
        formula += p + q
    total += eval(formula)
print(total)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/abc045/tasks/arc061_a
s = input()
o = []
sum = 0
for i in range(1 << len(s) - 1):
    bit = format(i, "0" + str(len(s) - 1) + "b")
    o.append(bit.replace("1", "+").replace("0", " "))
for t in o:
    r = ""
    for s1, s2 in zip(s, t):
        r += (s1 + s2)
    r += s[-1]
    r = r.replace(" ", "")
    sum += eval(r)
print(sum)

Submission status: Wrong Answer

Solution code:
S = str(input())
p = ["+",""]
total = 0

for i in range(2**(len(S)-1)):
    t = S[0]
    for j in range(len(S)-1):
        t = t + p[i>>j&1] + S[j+1]
    print(t)
    total += eval(t)
print(total)

Submission status: Wrong Answer

Solution code:
s=input()
ans=0
n=len(s)

def dfs(string,cur):
  if cur==n:
    global ans
    ans+=eval(string)
    return
  ret0=dfs(string+"+"+s[cur],cur+1)
  ret1=dfs(string+s[cur],cur+1)
  return ans
print(dfs(s[0],1))

Submission status: Wrong Answer

Solution code:
s=input()
ans=0
n=len(s)

def dfs(string,cur):
  global ans
  if cur==n:
    ans+=eval(string)
    return
  ret0=dfs(string+"+"+s[cur],cur+1)
  ret1=dfs(string+s[cur],cur+1)
  return ans
print(dfs(s[0],1))

Submission status: Wrong Answer

Solution code:
s=list(input())
ans=0
n=len(s)-1

def dfs(string,cur,index):
  global ans
  if cur==n:
    ans+=eval("".join(string))
    return
  ret0=dfs(string[:index+1]+["+"]+string[index+1:],cur+1,index+2)
  ret1=dfs(string,cur+1,index+1)
  return ans

print(dfs(s,0,0))

Submission status: Wrong Answer

Solution code:
"""
＋を挟むか挟まないかは2**N通り。(Nはlen(s))
二進数で表してi番目のビットが0ならi番目の数字の右に＋を挟む。1なら挟まないという方針
"""
s=input()
l=list(s)
print(l)
#lst=[]
lst_2=0
'''
bi=[bin(2**i) for i in range(0,len(s))]
print(bi)
'''
for i in range(1<<(len(s)-1)):#2**(len(s)-1)と同じ
    st=l[0]#l[0]の左に＋が来ることはない
    for j in range(len(s)-1):#sを二進数で表示した時に数字の間にプラスを挟むかどうかを決めるループ
        if (i>>j)&1:#iのj+1番目のビットが1だったら+を挟まない。
            st+=l[j+1]
        else:#iのj+1番目のビットが0だったら＋を挟む
            st+='+'+l[j+1]
    #lst.append(eval(st))
    lst_2+=eval(st)
    #print(lst)
    #print(lst_2)
#print(sum(lst))
print(lst_2)

Submission status: Wrong Answer

Solution code:
s = input()

answer = 0
for canditate in range(1 << len(s)-1):
    combi = s[0]
    for n_digit in range(len(s) - 1):
        if (canditate >> n_digit) & 1:
            combi += '+'
        combi += s[n_digit+1]  # 足される数's[0]'を除いた数値部分を取り出す
    print(combi)
    answer += eval(combi)

print(answer)

Submission status: Wrong Answer

Solution code:
s = input()
n = 0
ans = 0
for n in range( 1 << len(s)):
    p = 0
    for i in range(len(s)):
        if n & (1 << i):
            ans += int(s[p:i + 1])
            p = i + 1
    if p < len(s):
        ans += int(s[p:])
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
ans=0
for i in range(len(s)):
  for j in range(i,len(s)):
    ans+=int(s[i:j+1])  
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
power = len(S)-1
loop = 2**power

revS = list(reversed(S))
ans = 0

for i in range(loop):
    ans += int(revS[0])
    multi_ten = 10
    for j in range(power):
        digit = bin(i>>j)[-1]
        if digit == "0":
            ans += int(revS[j+1])*multi_ten
            multi_ten *= 10
        else:
            ans += int(revS[j+1])
            multi_ten = 10

Submission status: Wrong Answer

Solution code:
s=input()

ans=0
for i in range(1<<(len(s)-1)):
    sum=0
    temp=int(s[0])
    for j in range(len(s)-1):
        if i>>j&1:
            temp=temp*10+int(s[j+1])
        else :
            sum+=temp
            temp=int(s[j+1])
    sum+=temp
    print(sum)
    ans+=sum
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import sys
# import bisect
# import math
# import numpy as np


"""Template"""


class IP:
    """
    入力を取得するクラス
    """
    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: 数
        """
        return int(self.input())

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        # 参考
        # https://blog.rossywhite.com/2018/08/06/bit-search/
        # https://atcoder.jp/contests/abc105/submissions/4088632
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if ((i >> j) & 1) == 1:
                    """右からj+1番目のiが1かどうか判定"""
                    # output.append(a[j])
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val


"""ここからメインコード"""


def main():
    # 1文字に省略
    r, e = range, enumerate
    ip = IP()
    id = Idea()

    """この下から書いてね"""
    s = str(ip.I())
    ans = 0
    # 最後に+は付けられない
    n = len(s) - 1

    # bit全探索
    for i in r(1 << n):
        # sの中に+を入れて計算する
        p = ""
        for j, d in e(s):
            p += d
            if (i >> j & 1) > 0:
                p += "+"
            if i == n:
                break
        p += s[-1]
        ans += eval(p)
    print(ans)


main()

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import sys
# import bisect
# import math
# import numpy as np


"""Template"""


class IP:
    """
    入力を取得するクラス
    """
    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: 数
        """
        return int(self.input())

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        # 参考
        # https://blog.rossywhite.com/2018/08/06/bit-search/
        # https://atcoder.jp/contests/abc105/submissions/4088632
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if ((i >> j) & 1) == 1:
                    """右からj+1番目のiが1かどうか判定"""
                    # output.append(a[j])
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val


"""ここからメインコード"""


def main():
    # 1文字に省略
    r, e = range, enumerate
    ip = IP()
    id = Idea()

    """この下から書いてね"""
    s = str(ip.I())
    ans = 0
    # 最後に+は付けられない
    n = len(s) - 1

    # bit全探索
    for i in r(n):
        # sの中に+を入れて計算する
        p = ""
        for j in r(n):
            p += s[j]
            if (i >> j & 1) > 0:
                p += "+"
        p += s[-1]
        ans += eval(p)
    print(ans)


main()

Submission status: Wrong Answer

Solution code:
s = list(input())
l = len(s)
t = [0] * l 
k = 2**(l-1)
for i in range(l):
    if i == 0:
        t[l-1] = k 
    else:
        t[l-1-i] = t[l-i] * 5 + k // 2
ret = 0 
for i in range(l):
    top = int(s[i])
    ret += top * t[i]
print(t)
print(ret)

Submission status: Wrong Answer

Solution code:
S = list(input())
l = []
for i in range(2*len(S) - 1):
    if i % 2 == 0:
        l.append(S[int(i/2)])
    elif i % 2 == 1:
        l.append("")
L_1 = []
L_2 = []
L_1.append(l)
def saiki(list_1,list_2,t): # 1 <= t = 2k-1 <= len(S) - 2
    for e in list_1:
        for b in [0,1]:
            if b == 0:
                list_2.append(e)
            elif t > len(e) - 1:
                print("error: t = {}, len(e) - 1 = {}".format(t,len(e) - 1))
            elif b == 1:
                e_copy = e[:]
                e_copy[t] = "+"
                list_2.append(e_copy)
    list_1.clear()
    if t < len(l) - 2:
        return saiki(list_2,list_1,t+2)
    else:
        return list_2
result = saiki(L_1,L_2,1)    
ans = 0
for e in result:
    ans += eval("".join(e))
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

def manyformulas(s):
    print('s:{0}'.format(s))
    if len(s)==1:
        return 1,int(s[0])
    else:
        sum = int(s)
        count = 1
        for i in range(len(s)-1):
            c, recursive = manyformulas(s[(i+1):])
            sum += c*int(s[:(i+1)]) + recursive
            count += c

        return count, sum

print(manyformulas(s)[1])

Submission status: Wrong Answer

Solution code:
s = input()
x = []
l = len(s)
for i in range(l):
    x.append(int(s[i]))

sum = 0
for n in range(2**(l-1)):
    bin_str = format(i,'0'+str(l-1)+'b')
    prev = 0
    flg = 0
    for i in range(l-1):
        if bin_str[i]==0:
            prev = prev*10 + x[i]
        else:
            sum += prev*10 + x[i]
            prev = 0
    sum += prev*10 + x[l-1]

print(sum)

Submission status: Wrong Answer

Solution code:
s = input()
x = []
l = len(s)
for i in range(l):
    x.append(int(s[i]))

sum = 0
for n in range(2**(l-1)):
    bin_str = format(i,'0'+str(l-1)+'b')
    prev = 0
    flg = 0
    for i in range(l-1):
        if bin_str[i]==0:
            prev = prev*10 + x[i-1]
        else:
            sum += prev*10 + x[i-1]
            prev = 0
    sum += prev*10 + x[l-1]

print(sum)

Submission status: Wrong Answer

Solution code:
# abc 045 c

s = input()

sum_num = 0
for i in range(0, 2**(len(s)-1)):
	sings = bin(i)[2:].zfill(len(s)-1).replace("1", "+").replace("0", " ")
	formula = ("".join("".join(t) for t in zip(s, sings)) + s[-1]).replace(" ", "")
	sum_num += eval(formula)

print(sum_num)

Submission status: Wrong Answer

Solution code:
import itertools

number = input()
answer = int(number)
length = len(number)

empty = [""] * length
plus = ["+"] * length

results = []
for i in range(2**(length - 1)):
    calc = ""
    for j in range(length - 1):
        calc += number[j]
        if i and 1:
            calc += "+"
        i >>= 1
    f = calc + number[-1]
    results.append(eval(f))
print(sum(results))

Submission status: Wrong Answer

Solution code:
sr = input()
n = len(sr)

blist = []
for i in range(2**(n-1)):
    blist.append(list(map(int,list(bin(i)[2::].zfill(n-1)))))

ssum = 0
for k,num in enumerate(blist):
    bi = 0
    bsum = 0
    print(num)
    for i,j in enumerate(num):
        if j == 1:
            bsum += int(sr[bi:i+1])
            bi = i+1
        if i == (len(num)-1):
            bsum += int(sr[bi:])
    ssum += bsum
print(ssum)

Submission status: Wrong Answer

Solution code:
sr = input()
n = len(sr)

blist = []
for i in range(2**(n-1)):
    blist.append(list(map(int,list(bin(i)[2::].zfill(n-1)))))
print(blist)

ssum = 0
for k,num in enumerate(blist):
    bi = 0
    bsum = 0
    print(num)
    for i,j in enumerate(num):
        if j == 1:
            bsum += int(sr[bi:i+1])
            bi = i+1
        if i == (len(num)-1):
            bsum += int(sr[bi:])
    ssum += bsum
print(ssum)

Submission status: Wrong Answer

Solution code:
S = input()
N = len(S)-1
B = []
ans = 0

#長さからビット列を作る
for i in range(2**(len(S)-1)):
    B.append(bin(i)[2:].zfill(len(S)-1))
             
for b in B:
    t = ""
    for i, plus in enumerate(b):
        t += S[i]
        if plus == "1":
            t += "+"

    t += S[-1]
    ans += sum([int(x) for x in t.split("+")])
    
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
tmp = 0
ans = 0
for i in range(2**(len(S)-1)):
    form = ''
    for j, x in enumerate(format(i ^ 0, '0'+str(len(S)-1)+'b')):
        form += S[j]
        if x == '0':
            continue
        form += '+'
    form += S[-1]
    ans += eval(form)

print(ans)

Submission status: Wrong Answer

Solution code:
n = raw_input()
l = len(n)

ans = 0

t = 2**(l-1)

for i in range(t):
	bit = (bin(i)[2:]).zfill(l-1)
	formula = ''

	p = 0
	b = 0

	while b < len(bit):
		formula += n[p]
		formula += "+" if bit[b] == "1" else ""
		p += 1
		b += 1

	formula += n[-1]
	ans += eval(formula)

print ans

Submission status: Wrong Answer

Solution code:
N=int(input())
m=list(map(int,str(N)))[::-1]
p=0
n=len(str(N))
for i in range(2*(n-1)):
    s=(["0"]*8+list(bin(i)[2:]))[::-1]
    s=s[:n-1]
    p+=m[0]
    q=0
    for i in range(n-1):
        if s[i]=="0":
            q+=1
            p+=(10**q)*(m[i+1])
        else:
            q=0
            p+=m[i+1]   
print(p)

Submission status: Wrong Answer

Solution code:
# 問題文
# 1 以上 9 以下の数字のみからなる文字列 S が与えられます。 この文字列の中で、あなたはこれら文字と文字の間のうち、いくつかの場所に + を入れることができます。 一つも入れなくてもかまいません。 ただし、+ が連続してはいけません。
# このようにして出来る全ての文字列を数式とみなし、和を計算することができます。
# ありうる全ての数式の値を計算し、その合計を出力してください。

# キーワード
# 2n2n 通りを調べる全探索 (bit 全探索)

# メモ化再帰が使えそう

# 方向性
# 普通に計算すると、+ のありなし　* n で2:2 3:4 4:8 2^n-1の通り数がある
# 1234
# input = 123

# 間に入れれる通り数をもとめる
input = input()
num_list = list(str(input))
binary_length = len(num_list) - 1

lists = []

# 間に入れれる数分の配列を作る
for i in range(2**binary_length):
    bi_array = []
    
    # 2進数の数字を求める
    num = i
    while num >= 1:
        bi_array.insert(0,int(num % 2) ) 
        num = num // 2 
    tmp_list = []
    for j in range(binary_length):
        if len(bi_array) > j:
            tmp_list.insert(0,bi_array[-j-1])
        else:
            tmp_list.insert(0,0)

    lists.append(tmp_list)

result_list = []
# 0なら数字をjoin,1ならjoinしない
for bi_list in lists:

    num_list = list(str(input))
    current_num = int(num_list[0])
    concat_num_list = []

    for i,binary in enumerate(bi_list):
        if binary == 0:
            current_num = current_num * 10 + int(num_list[i+1])
        else:
            concat_num_list.append(current_num)
            current_num = int(num_list[i+1])

        if i+1 == len(bi_list):
            concat_num_list.append(current_num)
    result_list.append(sum(concat_num_list))


# リストの中身をすべて合算する
result = sum(result_list)
print(result)

Submission status: Wrong Answer

Solution code:
S = input()
formula_list = []
total_sum = 0

def calcformula(s) :
    return sum(list(map(int, s.split("+"))))

def stackformula(s, i) :
    
    if i >= len(s) :
        return 
    
    formula_y = s[:i] + "+" + s[i:]
    formula_n = s
    
    formula_list.append(formula_y)
    stackformula(formula_y, i + 2)
        
    formula_list.append(formula_n)
    stackformula(formula_n, i + 1)


stackformula(S, 1)
# calculate sum for each formula
for f in set(formula_list) :
    total_sum += calcformula(f)

print(total_sum)

Submission status: Wrong Answer

Solution code:
S = input()
list_formula = []

total_sum = 0

def doplus(s, i) :
    if i > len(S) + 2:
        return
    
    tmp_str_y = s[:i] + "+" + s[i:]
    tmp_str_n = s[:i] + s[i:]
    
    list_formula.append(tmp_str_y)
    list_formula.append(tmp_str_n)
    
    doplus(tmp_str_y, i + 2)
    doplus(tmp_str_n, i + 1)
    
def calcStr(s) :
    return sum(map(int, s.split("+")))

doplus(S, 1)

for f in set(list_formula) :
    # ignore last plus
    if f[len(f) - 1] != "+" :
        total_sum += calcStr(f)
        
# print(set(list_formula))
print(total_sum)

Submission status: Wrong Answer

Solution code:
S = input()
list_formula = []

total_sum = 0

def doplus(s, i) :
    if i > len(S):
        return
    
    tmp_str_y = s[:i] + "+" + s[i:]
    tmp_str_n = s[:i] + s[i:]
    
    list_formula.append(tmp_str_y)
    list_formula.append(tmp_str_n)
    
    doplus(tmp_str_y, i + 2)
    doplus(tmp_str_n, i + 1)
    
def calcStr(s) :
    return sum(map(int, s.split("+")))

doplus(S, 1)

for f in set(list_formula) :
    # ignore last plus
    if f[len(f) - 1] != "+" :
        total_sum += calcStr(f)
        

print(total_sum)

Submission status: Wrong Answer

Solution code:
a = input()
n = len(a)
S = [int(a[i:i+1]) for i in range(n)]
array = []
answer = 0

for i in range(n-1):
    array.append(2**(n-2))

array.append(2*(n-1))

for i in range(n):
    for j in range(n):
        answer += S[j]* array[j] * (10**i)

    array = [ar/2 for ar in array]
    array.pop(0)
    array.append(0)

print(int(answer))

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
ans = 0

for i in range(2**(n-1)):
    l = list(s)
    for j in range(1, n): 
        if (1<<(j-1)) & i > 0:
            l = l[:j] + ['+'] + l[j:] # strにインサートはない
    ans += eval(''.join(l))

print(ans)