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:
S = input()
n = len(S)
ans = 0
for i in range(n):
  a = int(S[i])
  for j in range(n-i):
    ans+=a * 10**j * 2**i * 2**(n-i-j-2)
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
n = len(S)
ans = 0
for i in range(n):
  for j in range(n-i):
    ans+=int(S[i]) * 10**j * 2**i * 2**(n-i-j-2)
print(ans)

Submission status: Wrong Answer

Solution code:
n = input()
l = len(n)
ans = 0
for i in range(l):
  for j in range(l-i):
    ans+=int(n[i]) * 10**j * 2**i * 2**(l-i-j-2)
print(ans)

Submission status: Wrong Answer

Solution code:
n = input()
l = len(n)
ans = 0
for i in range(l):
  for j in range(l-i):
    ans+=int(n[i])*(10**j)*(2**(l-1-j))
print(ans)

Submission status: Wrong Answer

Solution code:
n = input()
l = len(n)
ans = 0
for i in range(l):
  for j in range(l-1):
    ans+=int(n[i])*(10**j)*(2**(l-1-j-1))
print(ans)

Submission status: Wrong Answer

Solution code:
S=input()
N=len(S)

ans=2**(N-1)*int(S[-1])
for i in range(1<<(N-1)):
    res=1
    for j in range(N-1):
        if (i>>j)%2==1:
            res*=10
        else:
            res=1
        ans+=res*int(S[N-1-j])
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

if len(s) == 1:
    print(s)
    exit()

plusNum = len(s)-1


def getTotal(val):
    if len(val) == 1:
        return int(val)
    total = int(val)
    for i in range(1, len(val)):
        total += getTotal(val[:i]) + getTotal(val[i:])
    return int(total)


t = getTotal(s)
print(t)

Submission status: Wrong Answer

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

for paint in range((n-1)**2):
	temp_index=0

	for i in range(n-1):
		if (paint>>i)&1:
			ans+=int(S[temp_index: i+1])
			temp_index=i+1

	ans+=int(S[temp_index:])
print(ans)

Submission status: Wrong Answer

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

for paint in range((n-1)**2):
	temp_S=S[0]

	for i in range(n-1):
		if (paint>>i)&1==1:
			temp_S+="+"
		temp_S+=S[i+1]

	ans+=sum(map(int, temp_S.split("+")))
print(ans)

Submission status: Wrong Answer

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

for paint in range((n-1)**2):
	temp_S=S[0]

	for i in range(n-1):
		if (paint>>i)&1==1:
			temp_S+="+"
		temp_S+=S[i]

	ans+=sum(map(int, temp_S.split("+")))
print(ans)

Submission status: Wrong Answer

Solution code:
def get_sum(arr):
    ans = "".join(arr)
    
    ans2 = list(map(int, ans.split('+')))
    
    return sum(ans2)


def main():

    s = tuple(input())
    s = '+'.join(s)
    s = list(s)
    s2 = s[:]
    
    ans = get_sum(s)

    while '+' in s and '+' in s2:
        s.remove('+')
        s2.reverse()
        s2.remove('+')
        s2.reverse()
        ans += get_sum(s) + get_sum(s2)

    print(ans-int("".join(s)))

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n = list(input())
dp = [n[0]]

l = len(n)
for i in range(0, l-1):
    tmp = []
    for j in dp:
        tmp.append(j + str(n[i+1]))
        tmp.append(j + '+' + n[i+1])
    else:
        dp = tmp

result = 0
print(dp)
for i in dp:
    print(i.split('+'))
    result += sum([int(i) for i in i.split('+')])

print(result)

Submission status: Wrong Answer

Solution code:
s = input()
ans = 0
for i in range((len(s)-1)**2):
    t = s[0]
    for j in range(len(s)-1):
        if (i >> j)&1:
            t += "+"+s[j+1]
        else:
            t += s[min(j+1,len(s)-1)]
    ans += eval(t)
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import product
s = input()
n = len(s)
plus_list = list(product([0, 1], repeat=n-1))
ans = 0
for plus in plus_list:
    next = 0
    for i in range(n-1):
        if plus[i] == 1:
            if next == 0:
                temp = s[:i+1]
                #print(temp)
                ans += int(temp)
                next = i+1
            else:
                temp = s[next:i+1]
                #print(temp)
                ans += int(temp)
                next = i+1
        if i == n-2:
            temp = int(s[next:])
            #print(temp)
            ans += temp
print(ans)

Submission status: Wrong Answer

Solution code:
s = list(input())
n = len(s)-1
ans = 0
for i in range(n):
    s.insert(i*2+1, "#")
t = [s for i in range(2**n)]
for i in range(2**n):
    ti = t[i]
    #print(s)
    #print(ti)
    for j in range(n):
        #print(bool((i>>j)&1))
        if (i >> j) & 1:
            ti[j*2+1] = "+"
    #print(ti)
    ti = "".join(ti)
    #print(ti)
    ti = ti.replace("#", "")
    #print(ti)
    ti = ti.split("+")
    ans += sum(list(map(int, ti)))
print(ans)

Submission status: Wrong Answer

Solution code:
def abc045_c():
    S = list(input())
    for i in range(len(S)-1):
        i = i * 2 + 1
        S.insert(i,'+')
    abc045_c2(S)

def abc045_c2(S):
    cnt = 0
    for i in range(S.count('+')):
        cnt += eval(''.join(S))
        i = i + 1
        del S[i]
    print(cnt)
    
if __name__ == '__main__':
    abc045_c()

Submission status: Wrong Answer

Solution code:
s = "9999999999"
S=len(s)
ans = ''
for i in range(2**(S-1)):
    ans+=s[0]
    for j in range(0,S-1):
        if i>>j&1:
            ans+=""+s[j+1]
        else:
            ans+=" "+s[j+1]
    ans+=" "
 

print(sum(map(int,ans.split())))

Submission status: Wrong Answer

Solution code:
s = str(input())
n = len(s)
#print(s,n)
ans = 0
for bit in range(1 << (n-1)):
    f = s[0]
    for j in range(n-1):
        if bit & (1 << j):
            f += '+'
        f += s[j+1]
    ans += sum(map(int,f.split('+')))
    print(f)
print(ans)

Submission status: Wrong Answer

Solution code:
def Base_10_to_n(X, n):#10進数をbit_base進数に変換
    X_dumy = X
    out = ''
    while X_dumy>0:
        out = str(X_dumy%n)+out
        X_dumy = int(X_dumy/n)
    return out

def main():
  s = str(input())
  ans = 0
  for i in range(2**(len(s)-1)):
    bits = Base_10_to_n(i, 2)
    bits = bits.zfill(len(s)-1)
    now = 0
    for j, bit in enumerate(bits):
      if bit == '1':
        ans += int(s[now:j+1])
        now = j + 1
      if j == len(s)-2:
        ans += int(s[now:])
  print(ans)
  
if __name__ == "__main__":
  main()

Submission status: Wrong Answer

Solution code:
S = input()

sn = len(S)
ans = int(S)

for i in range(1, sn+1-1):
    ans += int(S[:i]) + int(S[i:])

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

sn = len(S)
ans = 0

for i in range(0, sn-1):
    ans += int(S[i]) + int(S[i+1:])

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()

sn = len(S)
ans = 0

for i in range(1, sn+1-1):
    ans += int(S[i]) + int(S[i:])

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
n=len(s)-1
ans=0
for i in range(2**n):
    k=0
    for j in range(n):
        if i>>j&1:
            ans+=int(s[k:j+1])
            k=j+1
        ans+=int(s[k:])
print(ans)

Submission status: Wrong Answer

Solution code:
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
#import bisect
s=input()
n=len(s)
ans=0
ans+=int(s)
for i in s:
    ans+=int(i)
l=[i for i in range(n-1)]
for i in range(1,n-1):
    c=itertools.combinations(l,i)
    for p in c:
        pulus=set(list(p))
        z=0
        for j in range(n):
            ans+=int(s[n-1-j])*10**z
            if j != n-1 and n-2-j not in pulus:
                z+=1
            else:
                z=0
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
l=len(s)

def dfs(i,f):
    if i==l-1:
        print(f)
        return eval(f)
    else:
        return dfs(i+1, f+s[i+1]) + dfs(i+1,f+'+'+s[i+1])

print(dfs(0,s[0]))

Submission status: Wrong Answer

Solution code:
s = input()
l = len(s)

ans = 0
for i in range(2 ** (l -1)):
    ans_sub = 0
    subst = s[0]
    for j in range(l-1):
        if(i>j)&1:
            ans_sub += int(subst)
            subst = s[j+1]
        else:
            subst += s[j+1]
        if j ==l-2:
            ans_sub += int(subst)
    ans += ans_sub
if l == 1:
    print(int(s))
else:
    print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
ans=[]
stack = []

def test(i,right):
    if len(right) > 1:
        for left in stack:
            ans.append(left)
        if i > 1 and stack:
            ans.append(right[0:1])
            stack.append(right[0:1])
            right = right[1::]
        else:
            ans.append(right[0:i])
            stack.append(right[0:i])
            right = right[i::]
        ans.append(right)
        if len(right) > 1:
            test(i,right)
    else:
        ans.append(right[::])

for i in range(1,len(s)):
    test(i,s)
    stack = []

print(sum(list(map(int,ans)))+int(s))

Submission status: Wrong Answer

Solution code:
import itertools

S = int(input())

ans = 0
cnt = 0

for i in itertools.product([0,1], repeat = len(str(S)) - 1):
    A = str(S)
    cnt = 0
    for x, sign in enumerate(i):
        if sign == 0:
            cnt += 1
            if x == len(str(S)) - 2:
                ans += int(A[0:cnt+1])
        else :
            ans += int(A[0:cnt+1])
            cnt = 0
            A = str(S)[x+1:]
            if x == len(str(S)) - 2:
                ans += int(A[-1])

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
total = list(s)
a = 0
for i in range(len(s)):
    total.append(s[:i])
    total.append(s[i:])
for j in total:
    if j == '':
        continue
    a = int(a) + int(j)

print(a)

Submission status: Wrong Answer

Solution code:
def dfs(i, f):
    if i == n - 1:
        return sum(list(map(int, f.split("+"))))

    # 式 f の末尾に "+" を追加するかしないかして次の数字を追加
    dfs(i + 1, f + s[i + 1])
    dfs(i + 1, f + "+" + s[i + 1])


s = input()
n = len(s)

print(dfs(0, s[0]))

Submission status: Wrong Answer

Solution code:
S=input()
N=len(S)
dp=[[0]*(N+1) for _ in range(2)]
#dp[0]は+入れる,dp[1]は+入れない
dp[0][1]=int(S[0])
dp[1][1]=int(S[0])

for i in range(2,N+1):
  dp[0][i]= dp[1][i-1] + int(S[i-1])
  a= dp[0][i-2]+int(S[i-2:i])
  b= int(str(dp[1][i-1])+str(S[i-1]))
  dp[1][i]= max(a,b)

print(dp) 
ans=max(dp[0][-1],dp[1][-1])
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

n = len(s)-1
s = int(s)
ans = 0

for i in range(1 << n):
    num = s
    c = 1
    for j in range(n):
        if i >> j & 1:
            ans += num % (10**c)
            num //= (10**c)
            cnt = 1
        else:
            c += 1
    ans += num


print(ans)

Submission status: Wrong Answer

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

for i in range(2**(n-1)):
    s_tmp = s
    nbin = str(bin(i))[2:]
    nbin = nbin.zfill(n-1)
    for j in range(len(nbin)-1, -1, -1):
        if nbin[j] == '1':
            s_tmp = s_tmp[:j+1] + '+' + s_tmp[j+1:]

    print(nbin, s_tmp)
    ans += eval(s_tmp)
print(ans)

Submission status: Wrong Answer

Solution code:
def calc(n):
    if n <= 1:
        return 1
    else:
        return 2 ** (n - 1)


def normailze(s, n):
    return (n - len(s)) * '0' + s


def solution(s):
    a = calc(len(s))
    cnt = 0
    n = len(s)
    if n ==1:
        return int(s)
    for i in range(a):
        binary = normailze(bin(i)[2:], n - 1)
        b = s[0]
        f = 1
        for j in binary:
            if int(j) == 1:
                cnt += int(b)
                b = s[f]
                f += 1
            else:
                b += s[f]
                f += 1
        cnt += int(b)
    return cnt
print(input())

Submission status: Wrong Answer

Solution code:
def calc(n):
    if n <= 1:
        return 1
    else:
        return 2 ** (n - 1)


def solution(s):
    n = len(s)
    dp = [None for i in range(len(s))]
    cnt = 0
    for i in range(n):
        a = s[:i]
        b = s[i:]
        cnt += calc(len(a)) * int(b)
        cnt2 = 0
        for j in range(len(a)):
            c = a[:j]
            d = a[j:]
            cnt2 += calc(len(c)) * int(d)
            if len(c) == 1:
                cnt2 += int(c)
            elif len(c) > 1:
                cnt2 += dp[i - 1]
        dp[i] = cnt2
        cnt += dp[i]
    print(cnt)


solution(input())

Submission status: Wrong Answer

Solution code:
s=input()
sl=len(s)

ans=0
for i in range(2**(sl-1)):
  l=['' for j in range(sl-1)]
  for k in range(sl-1):
    if (i>>k)&1:
      l[k]='+'

  t_ans=0
  t_s=s[0]

  for k in range(1,sl):
    if l[k-1]=='+':
      t_ans+=int(t_s)
      t_s=s[k]
    else:
      t_s+=s[k]

    if k==sl-1:
      t_ans+=int(t_s)

  ans+=t_ans

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
a=0
a+=sum([int(s[0:j])+int(s[j:])for j in range(1,len(s))])
a+=sum(list(map(int,list(s))))
print(a+int(s))

Submission status: Wrong Answer

Solution code:
S = input()
count = 0


def calculate(isPlus):
    #print(isPlus)
    ans = 0
    start = 0
    for i in range(len(isPlus)):
        if isPlus[i]:
            #print('i=', i, 'ans+=', S[start:i+1])
            ans += int(S[start:i+1])
            start = i+1
        if i == len(isPlus)-1:
            #print('i=', i, 'ans+=', S[start:])
            ans += int(S[start:])

    return ans


def recursion(depth, isPlus):
    global count
    if depth == len(S)-1:
        count += calculate(isPlus)
    else:
        recursion(depth=depth+1, isPlus=isPlus+[False])
        recursion(depth=depth+1, isPlus=isPlus+[True])


recursion(depth=0, isPlus=[])

print(count)

Submission status: Wrong Answer

Solution code:
S = input()
Sl = [s for s in S]

plusi = len(S) - 1

total = 0
for i in range(plusi**2):
    prej = 0
    for j in range(plusi):
        if (i >> j) & 1:
            total += int(S[prej:j+1])
            prej = j + 1
    total += int(S[prej:plusi+1])
print(total)

Submission status: Wrong Answer

Solution code:
s = input()
l = len(s)

patterns = []
for i in range(2**(l-1)):
    pattern = [''] * (l-1)
    for j in range(l-1):
        if (i >> j & 1):
            pattern[j] = '+'
    patterns.append(pattern)

print(patterns)

ans = 0
for pattern in patterns:
    a = s[0]
    for i in range(l-1):
        if (pattern[i] == ''):
            a += s[i+1]
        else:
            print(pattern, a)
            ans += int(a)
            a = s[i+1]
    else:
        print(pattern, a)
        ans += int(a)

print(ans)

Submission status: Wrong Answer

Solution code:
S=input()
N=len(S)-1
ans=0
for i in range(2**N):
    op=["-"]*N
    for j in range(N):
        if ((i>>j)&1):
            op[N-1-j]="+"
    #print(op)
    l=[]
    tmp=""
    for k in range(N):
        tmp=tmp+S[k]
        if k==(N-1):
            if op[k]=="+":
                l.append(tmp)
                l.append(S[-1])
            else:
                tmp=tmp+S[-1]
                l.append(tmp)
            break
        if op[k]=="+":
            l.append(tmp)
            tmp=""
        else:
            pass
    #print(l)
    for k in range(len(l)):
        val=int(l[k])
        ans+=val

print(ans)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 23 02:13:44 2020

@author: Kanaru Sato
"""

s = input()
n = len(s)

count = 0

for state in range(2**(n-1)):
    nums = s
    for i in range(n-1):
        if state and (1<<i):
            nums = nums[:n-1-i]+"+"+nums[n-1-i:]
    count += sum(map(int, nums.split("+")))

print(count)

Submission status: Wrong Answer

Solution code:
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    S=str(input())

    # bit全探索
    # https://qiita.com/gogotealove/items/11f9e83218926211083a#%E4%BE%8B%E9%A1%8C-1
    n = len(S)-1
    # 昇順での探索だよ
    ans=0
    for i in range(2 ** n):
        temp = n+1
        for j in range(n):  # このループが一番のポイント
            if ((i >> j) & 1):
                ans+=int(S[-j-1:temp])
                temp=-j-1
            if j==n-1:
                ans+=int(S[:temp])# 順に右にシフトさせ最下位bitのチェックを行う
    print(ans)


resolve()

Submission status: Wrong Answer

Solution code:
s = input()
l = len(s)
ans = 0
for i in range((l-1)**2):
    b = str(format(i, '0{}b'.format(l-1)))
    ns = ''
    for j in range(l):
        ns += s[j]
        if j!=l-1:
            if b[j]=='1':
                ns += '+'
    ans += eval(ns)
print(ans)

Submission status: Wrong Answer

Solution code:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)

""" n! mod m 階乗
mod = 1e9 + 7
N = 10000000
fac = [0] * N
def ini():
  fac[0] = 1 % mod
  for i in range(1,N):
    fac[i] = fac[i-1] * i % mod"""

"""mod = 1e9+7
N = 10000000
pw = [0] * N
def ini(c):
  pw[0] = 1 % mod
  for i in range(1,N):
    pw[i] = pw[i-1] * c % mod"""

"""
def YEILD():
  yield 'one'
  yield 'two'
  yield 'three'
generator = YEILD()
print(next(generator))
print(next(generator))
print(next(generator))
"""
"""def gcd_(a,b):
  if b == 0:#結局はc,0の最大公約数はcなのに
    return a
  return gcd_(a,a % b) # a = p * b + q"""
"""def extgcd(a,b,x,y):
  d = a
  if b!=0:
    d = extgcd(b,a%b,y,x)
    y -= (a//b) * x
    print(x,y)
  else:
    x = 1
    y = 0
  return d"""


def readInts():
  return list(map(int,input().split()))

def main():
  s = input()
  slen = len(s)
  ans = 0
  for i in range(2**(slen-1)):
    nya = [0]
    for j in range(slen-1):
      if i >> j & 1:
        nya.append(j+1)
    nya.append(slen)
    print(nya)
    for j in range(len(nya) - 1):
      ans += int(s[nya[j]:nya[j+1]])
  print(ans)
if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
import copy

S_origin = list(input())
S_first = eval("".join(S_origin))
l = len(S_origin)

list = []
list2 = []

def f(n):
  list.append(eval("".join(S)))
  list2.append("".join(S))
  if n < l-1:
    S[n] = S[n] + "+"
    f(n+1)
  
for i in range(l-1):
  S = copy.copy(S_origin)
  f(i)

#print(list)
#print(list2)

list3 = [s for s in list if s != S_first]
#print(list3)
result = sum(list3) + S_first
print(result)

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
ans = 0
for i in range(2**(n-1)):
  l = [0]
  for j in range(n-1):
    if i << j & 2**(n-2):
      l.append(j+1)
  l.append(n)
  print(l)
  for j in range(len(l)-1):
    ans += int(s[l[j]:l[j+1]])
print(ans)

Submission status: Wrong Answer

Solution code:
S=list(input())
n=len(S)
ans=0

for i in range(2**n):
    stack=""
    l=[]
    for j in range(n):
        stack=stack+S[j]
        if ((i >> j) & 1)or j==n-1:
            l.append(int(stack))
            stack=""
    ans+=sum(l)
    if len(l)==len(S):
        break
    print(l)
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
ans = 0
for i in range(2**(n-1)):
  plus = [0]
  for j in range(n-1):
    if (i >> j) & 1 == 1:
      plus += [j+1]
  for j in range(len(plus)-1):
    ans += int(s[plus[j]:plus[j+1]])
print(ans)

Submission status: Wrong Answer

Solution code:
S = [int(i) for i in input()]

N = len(S)

tens = [10**i for i in range(N)]

tens.reverse()

twos = [1]
twos.extend(2**i for i in range(N-1))

sums = 0
all_comb = sum(twos)
for i in range(N):
    tmp = [x*y for x, y in zip(tens[i:], twos)]
    exp = S[i] * sum(tmp) / sum(twos)
    sums = sums + exp
    del twos[-1]
print(sums * all_comb)

Submission status: Wrong Answer

Solution code:
S = [int(i) for i in input()]

N = len(S)

tens = [10**i for i in range(N)]

tens.reverse()

twos = [1]
twos.extend(2**i for i in range(N-1))

sums = 0
all_comb = sum(twos)
for i in range(N):
    tmp = [x*y for x, y in zip(tens[i:], twos)]
    exp = S[i] * sum(tmp) / sum(twos)
    print(exp)
    sums = sums + exp
    del twos[-1]
print(sums * all_comb)

Submission status: Wrong Answer

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

if n == 0:
    print(0)
elif n == 1:
    print(int(s))

ans = 0
for bit in range(1 << n - 1):
    formula = ""
    for i in range(n):
        formula += s[i]
        if i != n - 1:
            formula += "+" if (bit & 1 << i) else ""
    ans += eval(formula)

print(ans)

Submission status: Wrong Answer

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

ans = 0
for i in range(combination):
    # 2進数に直す
    bin_str = bin(i)[2:]

    # 上の桁分を埋める
    bin_str = '0' * (len(S) - len(bin_str) - 1) + bin_str

    formula = ''
    for i, s_char in enumerate(S):
        # 0の場合はなし、1の場合は'+'を入れて計算させる
        plus = ''
        if len(S) - 1 != i and bin_str[i] == '1':
            plus = '+'

        formula += s_char + plus

    # 文字列から計算する
    ans += eval(formula)

Submission status: Wrong Answer

Solution code:
s=input()
t=list(s)
l=len(s)

ans=0
for i in range(2**(l-1)):
    ans_sub=0
    subst=s[0]
    for j in range(l-1):
        if (i>>j)&1:
            ans_sub+=int(subst)
            subst=s[j+1]
        else:
            subst+=s[j+1]
        if j==l-2:
            ans_sub+=int(subst)
    ans+=ans_sub
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
n=len(s)-1
ans=0
for bit in range(1<<n):
    f=s[0]
    for i in range(n):
        if ((bit>>i)&1):
            f+="+"
        f+=s[i+1]
    for i in f.split("+"):
        ans+=int(i)
        print(i)
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

def dfs( i,  f ):
    if i == len( s ) - 1:
        return sum( list( map( int, f.split( "+" ))))
    return dfs( i + 1, f + s[ i  + 1 ] ) + dfs( i + 1, f +  "+" + s[  i   + 1 ])
dfs( 0, s[ 0 ])

Submission status: Wrong Answer

Solution code:
a = input()
sum = int(a)
for i in range(len(a)-1):
  if i==0:
    continue
  sum += int(a[:i])+int(a[i+1:])
print(sum)

Submission status: Wrong Answer

Solution code:
a = input()
sum = int(a)
for i in range(len(a)):
  if i==0:
    continue
  sum += int(a[:i])+int(a[i:])
print(sum)

Submission status: Wrong Answer

Solution code:
a = input()
sum = 0
for i in range(len(a)):
  if i==0:
    sum+=int(a)
    continue
  sum += int(a[:i])+int(a[i:])
print(sum)

Submission status: Wrong Answer

Solution code:
s = input()

n = len(s) - 1
ans = 0

for i in range(2 ** n):
    k = 0
    nm = []
    for j in range(n):
        if ((i >> j) & 1):
            nm.append(int(s[k:j + 1]))
            k = j + 1
        
        if j == n - 1:
            nm.append(int(s[k:n + 1]))
    
    ans += sum(nm)

print(ans)

Submission status: Wrong Answer

Solution code:
N_0 = input()
N = list(N_0)
m = len(N)
ans = 0


numbers = list(range(1,m))

n = len(numbers)
box = []

for i  in range(2 ** n):
    box_0 = []
    for j in range(n):
        if ((i >> j)&1):
            box_0.append(numbers[j])
            

    box.append(box_0)

box[0]=0

for j in range(len(box)):
    M = list(N_0)
    if j == 0:
        ans+=int(N_0)
    else:
        for k in range(len(box[j])):
            if k ==0:
                M.insert(box[j][k],"+")
            else:
                M.insert(box[j][k]+1,"+")
                
        ans += eval("".join(M))
            
print("{}".format(ans))

Submission status: Wrong Answer

Solution code:
import sys
import copy



S = input()
op_list = ["+"]*(len(S)-1)

sum = 0
for i in range(2**len(op_list)):

    for j in range(len(op_list)):

        if (i >> j) & 1:
            op_list[j] = ""
    s = ""
    for k in range(len(op_list)):
        s = s + S[k] + op_list[k]
    s = s + S[len(S)-1]
    sum = sum + eval(s)


print(sum)

Submission status: Wrong Answer

Solution code:
s = input()
c = 0
for i in range(2**(len(s)-1)):
  now = 0
  b = bin(i)[2:]
  b = "0"*(len(s)-len(b)-1) + b + "1"
  for j in range(len(s)):
    if b[j] == "1":
      c += int(s[now:j+1])
      now = j+1
print(c)

Submission status: Wrong Answer

Solution code:
# C - たくさんの数式 / Many Formulas
s = input()
n = len(s)-1
o = []

for i in range(2**n):
    op = [0]*n
    for j in range(n):
        if ((i>>j)&1):
            op[n-1-j]=1
    o.append(op)

ans = 0

for i,oo in enumerate(o):
    t = ''
    for j,ss in enumerate(s):
        if j==0:
            t += ss
            continue
        if o[i][j-1]:
            ans += int(t)
            t = ''
            t += ss
        else:
            t += ss
        if j==n:
            ans += int(t)

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
cnt=len(s)-1
for i in range(2**cnt):
    sum=s[0]
    for j in range(cnt):
        if ((i>>j)&1):
            sum+="+"
        else:
            pass
        sum+=s[j+1]
    print(eval(sum))

Submission status: Wrong Answer

Solution code:
s=input()
cnt=len(s)-1
for i in range(2**cnt):
    sum=s[0]
    for j in range(cnt):
        if ((i>>j)&1):
            sum+="+"
        sum+=s[j+1]
    print(eval(sum))

Submission status: Wrong Answer

Solution code:
s=input()
cnt=len(s)-1
for i in range(2**cnt):
    sum=s[0]
    for j in range(cnt):
        if ((i>>j)&1):
            sum+="+"
        else:
            sum+="-"
        sum+=s[j+1]
    print(eval(sum))

Submission status: Wrong Answer

Solution code:
import sys
import itertools

s = sys.stdin.readline().rstrip()
n = len(s)


ans = 0
for i in range(n):
    combs = list(map(list, itertools.combinations(range(1, n), i)))
    res2 = 0
    for c in combs:
        c.insert(0, 0); c.append(n)
        print(c)
        res1 = 0
        for j in range(1, i+2):
            res1 += int(s[c[j-1]:c[j]])
            print(int(s[c[j-1]:c[j]]))
        res2 += res1
    ans += res2

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
sum = 0

for i in range(len(s) - 1):
 num1, num2 = int(s[:i + 1]), int(s[i + 1:])
 print(num1, num2)
 sum += num1 + num2


for i in range(len(s)):
 sum += int(s[i])

print(sum + int(s))

Submission status: Wrong Answer

Solution code:
def dfs(i, formula):
    if i + 1 == num_digits:
        return sum(list(map(int, formula.split("+"))))

    return dfs(i + 1, formula + "+" + s[i + 1]) + dfs(i + 1, formula + s[i + 1])


s = input()
num_digits = len(s)

dfs(0, s[0])

Submission status: Wrong Answer

Solution code:
s=input()
l=len(s)
x=[0]*l
for i in range(l):
  for j in range(i,l):
    x[j]+=int(s[i])*(i+1)
a=0
for i in range(l):
  a+=x[i]*(10**(l-i-1))
print(a)

Submission status: Wrong Answer

Solution code:
s = input()

op_count = len(s) - 1
op_list = []
for i in range(2**op_count):
    op = [''] * op_count
    for j in range(op_count):
        if (i >> j) & 1:
            op[op_count - 1 - j] = '+'
    op_list.append(op)

ans = 0
for i in range(2 * op_count):
    cur = 1
    t = s
    for j in range(op_count):
        if op_list[i][j] == '+':
            t = t[:j + cur] + "+" + t[j + cur:]
            cur += 1
    ans += eval(t)
print(ans)

Submission status: Wrong Answer

Solution code:
s = list(str(input()))


s_tmp = s[:]
s_str = ""
ans = 0

if len(s)==1:
    print(s)
else:
    for i in range(pow(2,len(s_tmp)-1)):
        s_str = s.pop(0)
        j = 0
        while len(s) > 0:
            i_bin = list(format(i,"010b"))
            #print(*i_bin)
            if i_bin[len(i_bin)-j-1] == "1":
                s_str += "+"
            s_str += s.pop(0)
            j += 1
        #print(i,s_str)
        ans += eval(s_str)
        s = s_tmp[:]
        s_str = ""
    print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
s = input()
num_place = len(s) - 1
list_place_plus = list(itertools.product(range(2), repeat=num_place))

result = 0
for one_place in list_place_plus:
  start = 0
  for place, check in enumerate(one_place):
    if check == 1:
      result += int(s[start:place+1])
      start = place + 1
    if place + 1 == num_place:
      result += int(s[start:])

print(result)

Submission status: Wrong Answer

Solution code:
S=input()
result = 0

for i in range(1 << len(S)-1):
    #先頭文字
    hoge=S[0]
    for j in range( len(S)-1 ):
        print("i>>j",i>>j)
        if i>>j&1 :
            hoge+="+"
        hoge+=S[j+1]
    print(hoge)
    result += eval(hoge)
print(result)

Submission status: Wrong Answer

Solution code:
s = input()

ans = 0

#print(s[0],s[1],s[2])

for i in range(2**(len(s)-1)):
    tmp = i
    #print(tmp,tmp,tmp)
    temp = 0
    for j in range(len(s)-1):
        #print(ans)
        temp += int(s[j])
        #print(temp)
        if tmp % 2 == 0:
            temp = temp * 10
            #print(0)
            #if j == len(s)-2:
                #ans += temp + int(s[j+1])
        else:
            #ans += s[i]
            #print(1)
            ans += temp
            temp = 0
        if j == len(s)-2:
            ans += temp + int(s[j+1])
            #print(1)
        tmp = tmp // 2
        
print(ans)

Submission status: Wrong Answer

Solution code:
from itertools import product
s=list(input())
cnt=0
pl=list(product(['','+'],repeat=len(s)-1))
for j in pl:
	for _ in range(len(s)):
		l=[s[0]]
		for i in range(len(s)-1):
			l.append(j[i])
			l.append(s[i+1])
	print(l)
	a="".join(l)
	cnt+=eval(a)
print(cnt)

Submission status: Wrong Answer

Solution code:
import itertools
num = str(input())

olist = [int(i+1) for i in range(len(num)-1)]
comblist = []
for i, _ in enumerate(olist, 1):     
    for j in itertools.combinations(olist, r=i):
        comblist.append(j)

L = []
for i in range(len(comblist)):
  t = num
  for j in range(len(comblist[i])):
    t = t[0:comblist[i][j]+j] + "," + t[comblist[i][j]+j:]
  L.append(t)
print(L)

out = 0
for i in range(len(L)):
  t = L[i].split(",")
  for j in range(len(t)):
    out += int(t[j])
print(out+int(num))

Submission status: Wrong Answer

Solution code:
import itertools

S = input()
ans = 0
for s in itertools.product(range(2), repeat=len(S)-1):
    t = 0
    for i in range(len(S)-1):
        if s[i] == 1:
            ans += int(''.join(S[t:i+1]))
            t = i+1
        if len(S)-2 == i:
            ans += int(''.join(S[t:]))
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    memo = dict()

    def helper(S, i):
        # i is the starting index
        if i == len(S): return [0, 1]
        if i == len(S)-1: return [int(S[i]), 1]

        if i not in memo:
            memo[i] = [0, 0]
            for j in range(i+1, len(S)+1):
                if j not in memo:
                    memo[j] = helper(S, j)
                memo[i][0] += int(S[i:j])*memo[j][1] + memo[j][0]
                memo[i][1] += memo[j][1]
            print(memo)
        return memo[i]

    return helper(S, 0)[0]

if __name__ == '__main__':

    print(main())

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
for num in range(2*((len(S)-1))):
  before = 0
  nums = []
  for i in range(len(S)-1):
    if num>>i&1:
      nums.append(int(S[before:i+1]))
      before = i+1
  nums.append(int(S[before:]))
  ans += sum(nums)
print(ans)