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
print(S,len(S))
for i in range(2**(N-1)):
    f = S[0]
    for j in range(N-1):
        if ( i >> j ) & 1 :
            f += '+'
        f += S[j+1]
    print(f)
    ans += sum(map(int,f.split('+')))
print(ans)

Submission status: Wrong Answer

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

for i in range(2**num):
    mode = ['-']*num
    for j in range(num):
        if (i>>j)&1:
            mode[j] = '+'
    val = s[0]
    for k in range(num):
        if mode[k] == '+':
            if val != '':
                ans += int(val)
            val = s[k+1]
        else:
            val += s[k+1]
        if val != '' and k == num-1:
            ans += int(val)
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
n = len(S)
res = 0
for i in range(1 << n-1):
    subres = 0
    subst = S[0]
    for j in range(n-1):
        if i >> j & 1:
            subres += int(subst)
            subst = S[j+1]
        else:
            subst += S[j+1]
        if j == n - 2:
            subres += int(subst)
    res += subres
print(res)

Submission status: Wrong Answer

Solution code:
S = input()
n = len(S)
res = 0
for i in range(1 << n-1):
    subres = 0
    subst = S[0]
    for j in range(n-1):
        if i >> j & 1:
            subres += int(subst)
            subst = S[j+1]
        else:
            subst += S[j+1]
        if j == n - 2:
            subres += int(subst)
        print(bin(i),j,subst,subres)
    res += subres
print(res)

Submission status: Wrong Answer

Solution code:
s = input()

ans = int(s)
for i in range(1, len(s)):
  tmp = int(s[:i]) + int(s[i:])
  ans += tmp

l_s = [int(i) for i in str(s)]
ans += sum(l_s)

print(ans)

Submission status: Wrong Answer

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

res=0
for i in range(2**n):
    B=format(i,'b').zfill(n)+'1'
    left=0
    for j in range(n+1):
        if B[j]=='1':
            res+=int(s[left:j+1])
            left=j+1
        
print(res)

Submission status: Wrong Answer

Solution code:
S=int(input())
leng=len(str(S))

bin(2**leng-1)
ans=0
for i in range(2**(leng-1)):
    bid=bin(2**(leng-1)+i)
    start=0
    for j in range(3,len(str(bid))):
        if bid[j]=='1':
            ans+=int(str(S)[start:j-2])
            start=j-2
        if j==len(str(bid))-1:
            ans+=int(str(S)[start:j-1])
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    S = input()
    n = len(S) - 1
    ans = 0

    for i in range(2 ** n):
        plus_lst = [0] * n
        for j in range(n):
            if (i >> j) & 1 == 1:
                plus_lst[n - 1 - j] = 1  # 0: "", 1: "+"

        res = 0
        num = S[0]
        for j in range(n):
            if plus_lst[j] == 0:
                num += S[j + 1]

            if plus_lst[j] == 1:
                res += int(num)
                num = S[j + 1]

            if j == n - 1:
                res += int(num)

        ans += res

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
arr = str(input())

def many_formula(array):
  res = 0
  array_list = []
  for v in array:
    array_list.append(v)
    array_list.append("")
  #ここまでok
  
  bit_list = []
  for i in range(2**(len(array)-1)):
    num = bin(i)
    bit_list.append(str(num))
  #ここまでok
  
  cnt=[]
  array_list_list = [array_list]*(len(bit_list))
  
  for j,v in enumerate(bit_list):
    for i,k in enumerate(v[::-1]):
      if k == "1":
        cnt.append((j,i))
        array_list_list[j][2*i+1] = "+"
      else: continue
  for k in range(len(array_list_list)):
    res += eval("".join(array_list_list[k]))  
  return res
   
print(many_formula(arr))

Submission status: Wrong Answer

Solution code:
s = input()
res = 0
for i in range(2 ** (len(s) - 1)):
    _tmp = []
    for j in range(len(s) - 1):
        if ((i >> j) & 1):
            _tmp.append(j)
            
    print(_tmp)

    pre = 0
    
    for pos in _tmp:
        res += int(s[pre: pos + 1])
        pre = pos + 1

    res += int(s[pre:])
    
print(res)

Submission status: Wrong Answer

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

ans = 0

for bit in range(1 << (n - 1)):
    partial_sum = S[0]
    print(bit)
    for i in range(n-1):
        if bit & (1 << i):
            partial_sum += "+"
        partial_sum += S[i+1]
    ans += sum(map(int, partial_sum.split("+")))

print(ans)

Submission status: Wrong Answer

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

ans = 0

for bit in range(1 << n):
    partial_sum = S[0]
    for i in range(n-1):
        if bit & 1 << i:
            partial_sum += "+"
        partial_sum += S[i+1]
    ans += sum(map(int, partial_sum.split("+")))

print(ans)

Submission status: Wrong Answer

Solution code:
import sys
S = list(input())
T = [int(a) for a in S]
N = len(T)

if N == 1:
  print(T[0])
  
ans = 0
for i in range(2 ** (N-1)):
  i_ = i
  j = 1
  tmp = T[0]
  while j < N:
    #print(i,i_,j,N)
    if i_ % 2 == 0:
      tmp *= 10
      tmp += T[j]
    if i_ % 2 == 1:
      ans += tmp
      tmp = T[j]
    i_ = i_ >> 1
    j += 1
  ans += tmp
  #print(ans,i)
    
print(ans)

Submission status: Wrong Answer

Solution code:
# n=int(input())
# lst=[int(input()) for _ in range(n)]
# ans1=sum(lst)
# max1=max(lst)
# print(ans1)
# print(0 if max1<=ans1-max1 else max1-(ans1-max1))
s=input()
n=len(s)
l=n-1
lst_1=[]
for i in range(1<<l):
    lst=[]
    for j in range(l):
        if ((i>>j)&1):
            lst.append("+")
        else:lst.append("_")
    lst_1.append(lst)
# print(lst_1)
# print(len(lst_1))
ans=0
for i in range(1<<l):
    temp=s[0]
    for j in range(l):

        if lst_1[i][j]=="+":
            temp+="+"
        temp += s[j]
    # print(temp)
    ans+=sum(map(int,temp.split("+")))
print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
n=len(s)
def dfs(i,f):
    if i==n-1:#iがn-1になったら，全数字を区切って+を加えてint型に変換して合計する
        return sum(list(map(int,f.split("+"))))
    return dfs(i+1,f+s[i+1])+dfs(i+1,f+ "+"+s[i+1]) # 文字列で次の数字をそのまま連結するパターンと、+で区切るパターン
# 初期値でsの一文字目を入れておく
dfs(0,s[0])

Submission status: Wrong Answer

Solution code:
n=input()

Submission status: Wrong Answer

Solution code:
n=int(input())
print(1)

Submission status: Wrong Answer

Solution code:
def total(n):
    if n < 1:
        return 0

    return n + total(n - 1)

print(total(100))

Submission status: Wrong Answer

Solution code:
ans = 0

def dfs(S, start, end, sum):
    global ans
    num = 0
    if start==len(S):
        ans += sum
        return
    
    elif end==len(S):
        for i in range(end-start): 
            num += S[start+i]*pow(10, i)
        return 
    else: 
        for i in range(end-start): 
            num += S[start+i]*pow(10, i)
    
    dfs(S, start+1, end, sum+num)
    dfs(S, start, end+1, sum+num)


if __name__ == '__main__':
    S = list(map(int, list(input())))
    dfs(S[::-1], 0, 0, 0)
    num = 0
    for i, n in enumerate(S[::-1]):
        num += n*pow(10, i)
    print(ans+num)

Submission status: Wrong Answer

Solution code:
S = input()

res = [[S[0]]]

for c in S[1:]:
    buf = []
    for dp in res[-1]:
        buf.append(dp+c)
        buf.append(dp+'+'+c)
    res.append(buf)
sum_num = 0

print(res[-1])

for string in res[-1]:
    sum_num += sum(map(int, string.split('+')))
print(sum_num)

Submission status: Wrong Answer

Solution code:
def abc061_c():
    s = str(input())

    l = []
    def saiki(i,moji):
        if i == len(s)-1:
            print(moji)
            l.append(sum(list(map(int,moji.split("+")))))
            return

        #いれる
        saiki(i+1,moji+"+"+s[i+1])
        #いれない
        saiki(i+1,moji+s[i+1])

    saiki(0,s[0])

    print(sum(l))


abc061_c()

Submission status: Wrong Answer

Solution code:
s = input()

n = 2 ** (len(s) - 1)
print(n)
result = 0

for i in range(n):
  bin_n = bin(i)[2:]
  bin_n = '0' * ((len(s) - 1) - len(bin_n)) + bin_n
  print('bin:' + bin_n)
  current_address = 0
  for j in range(len(bin_n)):
    if bin_n[j] == '1':
      print(s[current_address:j+1])
      result += int(s[current_address:j+1])
      current_address = j+1

  print(s[current_address:])
  result += int(s[current_address:])

print(result)

Submission status: Wrong Answer

Solution code:
__DEUBG__ = 0

from itertools import combinations
num = input()
pattern = len(num) -1
total = 0
fmt = '0' + str(pattern) + 'd'
if __DEUBG__:
    print(fmt)
total = 0
for i in range(2**pattern):
    binary = format(int(bin(i)[2:]), fmt)
    if __DEUBG__:
        print('binary', binary)
    equation = ''
    for idx, sign in enumerate(binary):
        equation += num[idx] + ('+' if sign == '1' else '')
        if __DEUBG__:
            print(equation)

    equation += num[-1]
    if __DEUBG__:
        print(equation, eval(equation))
        print()
    total += eval(equation)

print(total)

Submission status: Wrong Answer

Solution code:
S=input()
S_seq=[]
for i in S:
    S_seq.append(i)

separate=[]
for i in range(len(S_seq)-1):
    a=[]
    if(i==0):
        a.append("*")
        a.append("_")
    else:
        for j in separate:
            a.append(j+"*")
            a.append(j+"_")
    separate=a

separated=[]
for i in separate:
    a=[]
    for j in i:
        a.append(j)
    separated.append(a)

pre_calculated=[]
for i in separated:
    a=[]
    for j in range(len(S_seq)-1):
        a.append(S_seq[j])
        if(i[j]=="*"):
            a.append("+")
        elif(i[j]=="_"):
            continue
    a.append(S_seq[-1])
    pre_calculated.append(a)

sumation=0
for i in pre_calculated:
    number=[]
    for j in range(len(i)):
        new_number=[]
        if(j==len(i)-1):
            for k in number:
                sumation+=k*10
            sumation+=int(i[j])
            

        elif(i[j]=="+"):
            for k in number:
                sumation+=k
            number=[]
        else:
            for k in number:
                new_number.append(k*10)
            new_number.append(int(i[j]))
        
        number=new_number
print(sumation)

Submission status: Wrong Answer

Solution code:
from itertools import product

a=list(input())
sum=0
text=""
for i in product(["","+"],repeat=len(a)-1):
    text=""
    for j in range(len(a)-1):
        text+=a[j]+i[j]
    text+=a[len(a)-1]
    sum+=eval(text)
    print(text)
print(sum)

Submission status: Wrong Answer

Solution code:
from sys import stdin
S = stdin.readline().rstrip()
n = len(S)
def dfs(i, f):
    if i == n-1:
        return sum(list(map(int, f.split('+'))))
    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)
n=(l-1)**2
total=0
for i in range(n):
    buf=s[0]
    for j in range(l-1):
        if ((i>>j)&1):
            total+=int(buf)
            buf=s[j+1]
        else:
            buf+=s[j+1]
    total+=int(buf)
print(total)

Submission status: Wrong Answer

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

#与えられる文字列の長さの最大が 10 と小さいので、それぞれの文字と文字の間に ‘+’ を入れるかどうかを全探索で試すことが出来ます。
#何番目の数字の後に ‘+’ を入れるかを全て決めたら、split 等の関数がある言語ならば、 実際に新しく ‘+’ を入れた文字列を作り、
#区切って計算することができます。そうでなく ても、前から順に見ていって、「数字があるたびに現在の値を 10 倍して今書いてある数字 だけ足す」
#「‘+(’ が出てきたら現在の値が ‘+(’ の直前の整数に等しいので、それを答え に足す」「最後は ‘+(’ が登場せずに数式が終わるので、そこは別に足す」とすると、
#新し く出来た式の値を求めることができます。

Submission status: Wrong Answer

Solution code:
n = input()
kumi = []
iti = 0

for x in range(2 ** (len(n) -1)):
    for m in range(len(n) -1):
        if (x >> m) & 1:
            kumi.append(n[iti:m+1])
            iti = m+1
        if m == len(n) -2:
            kumi.append(n[iti:m+2])
    iti = 0

kumi_int =[int(s) for s in kumi]
print(sum(kumi_int))

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s) - 1
answers = []
sl = [s[i] for i in range(len(s))]
for i in range(2 ** n):
    tmp = []
    for j in range(n):
        if ((i >> j) & 1):
            tmp.append(j)
    ll = ['*']*len(s)
    for k in tmp:
        ll[k] = '+'
    ans = []
    for k, _ in zip(sl, ll):
        ans.append(k)
        ans.append(_)
    ans = [_ for _ in ans if _ != '*']
    ans = ''.join(ans)
    ans = ans.split('+')
    ans = [int(_) for _ in ans if _ != '+']
    ans = sum(ans)
    answers.append(ans)
print(answers)
print(sum(answers))

Submission status: Wrong Answer

Solution code:
ss = input()
ans = []

def bfs(exp, x):
    # 探索終了
    if x == len(ss):
        return exp
    nxt = None
    # まだ使っていない数字を求める
    if exp[-1] == '+':
        nxt = ss[x]
        ret = bfs(exp+nxt, x+1)
        if ret:
            s_ = sum([int(i) for i in ret.split("+")])
            ans.append(s_)
    else:
        nxt = ss[x]
        ret = bfs(exp+nxt, x+1)
        if ret:
            s_ = sum([int(i) for i in ret.split("+")])
            ans.append(s_)
        ret = bfs(exp+'+', x)
        if ret:
            s_ = sum([int(i) for i in ret.split("+")])
            ans.append(s_)

bfs(ss[0],1)
print(sum(ans))

Submission status: Wrong Answer

Solution code:
s = input()
res_list = []

# 2^nはbit全探索が効果絶大！！
for i in range((len(s) - 1) ** 2):
    res = s[0]
    for j in range((len(s) - 1)):
        if (i >> j) & 1:
            res += '+'
        res += s[j + 1]
    res_list.append(eval(res))

print(sum(res_list))

Submission status: Wrong Answer

Solution code:
S = input()

def saiki(n, s=S[0]):
    _sum = 0
    
    if n==len(S)-1:
        print(s)
        return eval(s)
    
    _sum += saiki(n+1, s + "+" + S[n+1])
    _sum += saiki(n+1, s + S[n+1])
    
    return _sum
    
print(saiki(0))

Submission status: Wrong Answer

Solution code:
S=list(map(int,input()))
s=len(S)
s=s-1
t=pow(2,s)
l=len(list(format(t-1,'b')))
x=0
for i in range(t):
    k=list(format(i,'b'))
    L=[0]*l
    x+=S[-1]
    v=1
    for i in range(l):
        if i+1<=len(k):
            L[l-i-1]=k[-1-i]
        if int(L[l-i-1])==0:
            v=v*10
            x+=v*S[len(S)-2-i]
        else:
            v=1
            x+=S[len(S)-2-i]
print(x)

Submission status: Wrong Answer

Solution code:
S = input()
S_damy = S
sum_S = 0
plus = 2**(len(S)-1)
for i in range(plus):
    for j in range(len(S)-1):
        if i >> j & 0b1:
            sum_S += int(S_damy[len(S)-1-j:])
            if S_damy:
                S_damy = S_damy[:len(S)-1-j]

        if j == len(S)-2 and S_damy:
            sum_S += int(S_damy)
    S_damy = S

print(sum_S)

Submission status: Wrong Answer

Solution code:
S = input()
# 125
s = len(S)-1
ans=0
for bit in range(1 << s):
    a = S[0]
    for i in range(s):
        if bit & (1<<i):
            a += "+"
        a += S[i+1]
    print(a)
    ans += sum(map(int,a.split("+")))
print(ans)

Submission status: Wrong Answer

Solution code:
def func(i,x,s,count):
    if i==x:
        return int(s)+count
    
    return func(i-1,x,s[:i-x],count+int(s[-x:])) + func(i,x+1,s,count)

count=0
S=input()
print(func(len(S),1,S,count))

Submission status: Wrong Answer

Solution code:
S=input()
n=len(S)
ans=0
def dfs(i,f):
  if i==n-1:
    return sum(map(int,f.split("+")))
  return dfs(i+1,f)+dfs(i+1,f+"+"+S[i+1])


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

Submission status: Wrong Answer

Solution code:
S=input()
n=len(S)-1
ans=0
def dfs(i,f):
  if i==n:
    return sum(list(map(int,f.split("+"))))
  return dfs(i+1,f)+dfs(i+1,f+"+"+S[i+1])


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

Submission status: Wrong Answer

Solution code:
S=input()
n=len(S)-1
ans=0
def dfs(i,f):
  if i==n:
    return sum(map(int,f.split("+")))
  return dfs(i+1,f)+dfs(i+1,f+"+"+S[i+1])


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

Submission status: Wrong Answer

Solution code:
S=input()
n=len(S)-1
ans=0
def dfs(i,f):
  if i==n:
    return sum(map(int,f.split("+")))
  return dfs(i+1,f)+dfs(i+1,f+"+"+S[i+1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = input()

def div_plus(i, s):
    if i == len(S):
        s_list = [int(i) for i in s.split("+")]
        return sum(s_list)
    
    pos = i - len(S)
    # プラスを挿入しない場合
    d1 = div_plus(i+1, s)
    
    # プラスを挿入する場合
    d2 = div_plus(i+1, s[:pos]+"+"+s[pos:])
    return d1 + d2

div_plus(1, S)

Submission status: Wrong Answer

Solution code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, log2
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
S = list(input())

l = len(S)

anss = []
for i in range(1<<l-1):
	ans = []
	i = list("{:b}".format(i).zfill(l-1))
	print(i)
	S_ = S.copy()
	ans.append(S_.pop(0))
	while S_ != []:
		if i.pop(0) == "1":
			ans.append("+")
		ans.append(S_.pop(0))
		print(ans)
	anss.append(eval("".join(ans)))


print(anss)
print(sum(anss))

Submission status: Wrong Answer

Solution code:
def seven(s,i):
    if i==l-1:
        if eval(s)==7:
            print(s+"=7")
            exit()
        return
    seven(s+"+"+N[i+1],i+1)
    seven(s+"-"+N[i+1],i+1)
        
N = input()
l=len(N)
seven(N[0],0)

Submission status: Wrong Answer

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

ans = 0

for bit in range(2 ** 2 ** (n - 1)):
    f = s[0]

    for i in range(n - 1):
        if bit & (1 << i):
            f += "+"
        f += s[i + 1]

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

print(ans)

Submission status: Wrong Answer

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

ans = 0

for bit in range((n-1)**2):
    f = s[0]
    for i in range(n - 1):
        if (bit >> i) & 1:
            f += "+"
        f += s[i + 1]
    ans += sum(map(int, f.split("+")))

print(ans)

Submission status: Wrong Answer

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

ans = 0

for bit in range((n-1)**2):
    f = s[0]
    for i in range(n - 1):
        if (bit >> i) & 1:
            f += "+"
        f += s[i + 1]
    print(f)
    ans += sum(map(int, f.split("+")))

print(ans)

Submission status: Wrong Answer

Solution code:
S=list(map(int,input().split()))
def sums(a):
  n=len(a)
  if n==1:
    return a[0]
  else:
    s=0
    for i in range(n):
      s+=10**(n-i-1)*a[i]
    
    for i in range(n-1):
      t=0
      b=[a[i+1:]]
      c=[a[:i+1]]
      for j in range(i+1):
        t+=10**(i-j)*c[j]
      s+=t*sums(b)
      
    return s

Submission status: Wrong Answer

Solution code:
def tansaku(number,plus_point,sum_temp):
    print(number,plus_point,sum_temp)
    str_number = str(number)
    if len(str_number) -1 <= plus_point :
        return number + sum_temp
    else:
        next_number = int(str(number)[plus_point+1:])
        a1 = int(tansaku(next_number,0,sum_temp + int(str(number)[:plus_point+1])))
        print(a1)

        a2 = tansaku(number,plus_point+1,sum_temp)
        print(a2)


        return a1 + a2
 


if __name__ == "__main__":
    s = int(input())
    print(tansaku(s,0,0))

Submission status: Wrong Answer

Solution code:
def dfs(i,f):
  if i == n-1:
    return sum(list(map(int,f.split("+"))))
  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:
def dfs(i,f):
  if i == n-1:
    return sum(list(map(int,f.split("+"))))
  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 = str(input())

from collections import deque
bcal = []
que = deque()
que.append(S[0])
s = ''.join([S[0],'+'])
que.append(s)
while len(que)>0:
    a = que.popleft()
    pn = a.count('+')
    if len(a)-pn == len(S):
        if a[-1]=='+':
            b = a.strip(a[-1])
            bcal.append(b)
        else:
            bcal.append(a)
    else:
        if a[-1]=='+':
            ai = S.index(a[-2])
            an1 =''.join([a,S[ai+1]])
            an2 =''.join([a,S[ai+1],'+'])
            que.append(an1)
            que.append(an2)
        else:
            ai = S.index(a[-1])
            an1 =''.join([a,S[ai+1]])
            an2 =''.join([a,S[ai+1],'+'])
            que.append(an1)
            que.append(an2)
ans = 0
bcal= set(bcal)
for item in bcal:
    ee = item.split('+')
    for item2 in ee:
        ans += int(item2)

print(ans)

Submission status: Wrong Answer

Solution code:
S = str(input())
#kumiにブロックが入ってるこれを足してく
#それぞれの区切りで+を入れるかどうか見ればいい　それでも可能
#+を入れる個数を固定した後どこに入れるかを考える
"""解説：実際に+を入れたのを作ってく 文字列作って＋区切り文字にして足してけば良い
幅優先探索？"""
#文字列のままのやつのストック
from collections import deque
bcal = []
que = deque()
que.append(S[0])
s = ''.join([S[0],'+'])
que.append(s)
while len(que)>0:
    a = que.popleft()
    pn = a.count('+')
    if len(a)-pn == len(S):
        if a[-1]=='+':
            b = a.strip(a[-1])
            bcal.append(b)
        else:
            bcal.append(a)
    else:
        if a[-1]=='+':
            ai = S.index(a[-2])
            an1 =''.join([a,S[ai+1]])
            an2 =''.join([a,S[ai+1],'+'])
            que.append(an1)
            que.append(an2)
        else:
            ai = S.index(a[-1])
            an1 =''.join([a,S[ai+1]])
            an2 =''.join([a,S[ai+1],'+'])
            que.append(an1)
            que.append(an2)
ans = 0
bcal= set(bcal)
print(bcal)
for item in bcal:
    ee = item.split('+')
    for item2 in ee:
        ans += int(item2)

print(ans)

Submission status: Wrong Answer

Solution code:
S = str(input())
sl = [i for i in S]
#kumiにブロックが入ってるこれを足してく
#それぞれの区切りで+を入れるかどうか見ればいい　それでも可能
#+を入れる個数を固定した後どこに入れるかを考える
"""解説：実際に+を入れたのを作ってく 文字列作って＋区切り文字にして足してけば良い
幅優先探索？"""
#文字列のままのやつのストック
from collections import deque
bcal = []
que = deque()
que.append(S[0])
s = ''.join([S[0],'+'])
que.append(s)
while len(que)>0:
    a = que.popleft()
    pn = a.count('+')
    if len(a)-pn == len(S):
        if a[-1]=='+':
            b = a.strip(a[-1])
            bcal.append(b)
        else:
            bcal.append(a)
    else:
        if a[-1]=='+':
            ai = S.index(a[-2])
            an1 =''.join([a,S[ai+1]])
            an2 =''.join([a,S[ai+1],'+'])
            que.append(an1)
            que.append(an2)
        else:
            ai = S.index(a[-1])
            an1 =''.join([a,S[ai+1]])
            an2 =''.join([a,S[ai+1],'+'])
            que.append(an1)
            que.append(an2)
ans = 0
bcal= set(bcal)
for item in bcal:
    ecal = item.split('+')
    for item2 in ecal:
        ee = int(item2)
        ans += ee
print(ans)

Submission status: Wrong Answer

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

    for i in range(1<<n-1):
        temp = 0
        for j in range(n-1):
            if i & (i<<j):
                ans += int(''.join(s[temp:j+1]))
                temp = j+1
        ans += int(''.join(s[temp:]))

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
s = list(str(input()))
ans = 0
for i in range(2**(len(s)-1)):
  a = 0
  bin_str = format(i, 'b').zfill(len(s)-1)
  for num,j in enumerate(bin_str):
    if j == "1":
      ans += sum([int(k)*10**(num-a-l) for l,k in enumerate(s[a:num+1])]) 
      a = num+1
    if num == len(bin_str)-1:
      ans += sum([int(k)*10**(num-a+1-l) for l,k in enumerate(s[a:num+2])])
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools

def solve(S):
    '''
    数字の間に+を入れるパターンと入れないパターンを全てチェックする
    125であれば、 125, 1+25, 12+5, 1+2+5
    +が入る可能性のある場所は右の通り、 1  |ここ!| 2  |ここ!| 5
    よって、組み合わせは 2 ** (文字列数 - 1)
    '''
    count = 0
    bit_list = list(itertools.product([0, 1], repeat=len(S)-1))
    for pattern in bit_list:
        '''
        ビットの値が1の時に+が入ると考えて、0の時は入らない
        文字列を先頭から調べていき、次の文字との間に+が入る場合、そこまでの文字列をint型に変換して変数「count」に加算する
        '''
        start = 0
        for end in range(len(pattern)):
            if pattern[end] == 1:
                count += int(S[start:end+1])
                start = end + 1
                
            if end == len(pattern) - 1:
                count += int(S[start:])
                
    print(count)


if __name__ == '__main__':
    S = input()
    solve(S)

Submission status: Wrong Answer

Solution code:
s=input()
n=len(s)
l=[[] for _ in range(2**(n-1))]
for b in range(2**(n-1)):
    x=b
    for i in range(n-1):
        if x%2==1:
            l[b].append(1)
        else:
            l[b].append(0)
        x//=2
print(l)
indexes=[[] for _ in range(2**(n-1))]
for k in range(2**(n-1)):
    indexes[k]=[i for i, x in enumerate(l[k]) if x == 1]
#print(indexes)
SUM=0
for j in range(2**(n-1)):
    L=len(indexes[j])
    if L==0:
        SUM+=int(s)
        #print(SUM)
    else:
        SUM+=int(s[:indexes[j][0]+1])
        #print(SUM)
        SUM+=int(s[indexes[j][L-1]+1:])
        #print(SUM)
        if L>1:
            for h in range(L-1):
                SUM+=int(s[indexes[j][h]+1:indexes[j][h+1]+1])
                #print(SUM)
print(SUM)

Submission status: Wrong Answer

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

ans=0
for i in range(2**(l-1)):
  x=n[0]
  for j in range(l-1):
    if((i<<j)&1):
      x+="+"
    x+=n[j+1]
  ans+=eval(x)
  
print(ans)

Submission status: Wrong Answer

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

A = []
for i in range(2**(l-1)):
    B = []
    for j in range(l-1):
        if (i>>j) & 1:
            B.append(1)
        else:
            B.append(0)
    A.append(B)

ans = 0

for i in range(2**(l-1)):
    C = []
    a = S[0]
    for j in range(l-1):
        if j != l-2:
            if A[i][j] == 0:
                a += S[j+1]
            else:
                C.append(a)
                a = S[j+1]
        else:
            if A[i][j] == 0:
                a += S[j+1]
                C.append(a)
            else:
                C.append(a)
                C.append(S[j+1])
    for j in C:
        ans += int(j)

print(ans)

Submission status: Wrong Answer

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

for i in range(2**n):
    tmp=0
    for j in range(n):
        if ((i << j) & 2**(n-1)):  #上位からbit全探索
            tot+=int(s[tmp:j+1])
            tmp=j+1
        if j==n-1:
            tot+=int(s[tmp:])
print(tot)

Submission status: Wrong Answer

Solution code:
S = input()

x = len(S)-1

s = 0
for i in range(1 << x):
    t = 0
    for j in range(x):
        if (i & (1 << j) == 1):
            s += int(''.join(S[t:j+1]))
            t = j+1
    s += int(''.join(S[t:]))
print(s)

Submission status: Wrong Answer

Solution code:
S = input()

x = len(S)-1

s = 0
for i in range(1 << x):
    t = 0
    for j in range(x):
        if (i & 1 << j == 1):
            s += int(''.join(S[t:j+1]))
            t = j+1
    s += int(''.join(S[t:]))
print(s)

Submission status: Wrong Answer

Solution code:
S = input()
print(int(S))

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
sum = 0
for b in range(1 << n-1):
    t = 0
    for i in range(n-1):
        if b & (1 << i):
            sum += int(''.join(s[t:i+1]))
            t = i
print(sum)

Submission status: Wrong Answer

Solution code:
s = input()
lis = []
for i in range(2**((len(s))-1)):
    eq = ''
    for j in range(len(s)-1):
        eq += s[j]
        if (i >> j) & 1:
            eq += '+'
    eq += s[-1]
    if eval(eq) not in lis:
        lis.append(eval(eq))
print(sum(lis))

Submission status: Wrong Answer

Solution code:
S=input()
ans=0
if len(S)==1:
    print(S)
else:
    for i in range(2**(len(S)-1)):
        done=0
        b=bin(i)[2:].zfill(len(S)-1)
        for j in range(len(S)-1):
            if b[j]=="1":
                ans+=int(S[done:j+1])
                done=j+1
        ans+=int(S[done:])
print(ans)

Submission status: Wrong Answer

Solution code:
def resolve():
	s = input()
	k = 0
	for i in range(1 << len(s)-1):
		ts = s
		a = 1
		for j in range(len(s)):
			if ((i >> j) & 1):
				k += int(ts[:a] or 0)
				ts = ts[a:]
				a = 1
			else:
				a += 1
		k += int(ts or 0)
	print(k)

Submission status: Wrong Answer

Solution code:
import itertools

s = str(input())
length = len(s)

bins = []
for i in range(2**(length-1)):
    bins.append(list(str(format(i,'b')).zfill(length-1)))

ans = 0
for i in range(2**(length-1)):
    tmp_str=s[0]
    for j in range(length-1):
        if(bins[i][j]=='0'):
            tmp_str += s[j+1]
        else:
            print(tmp_str)
            ans += int(tmp_str)
            tmp_str = s[j+1]
    ans+=int(tmp_str)
print(ans)

Submission status: Wrong Answer

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

# create ptn
ptn = []
for bit in range(2**(N-1)):
    tmp = [False]*(N-1)
    for i in range(N-1):
        if ((bit>>i) & 1):
            tmp[i] = True
    ptn.append(tmp)

# calc sum
tot = []
for p in ptn:
    a = []
    for i, s in enumerate(S):
        if i==0:
            now = int(s)
            continue
        if p[i-1]==False:
            now *= 10
            now += int(s)
        else:
            a.append(now)
            now = int(s)
    a.append(now)
    tot.append(sum(a))
sum(tot)

Submission status: Wrong Answer

Solution code:
def insert_string_to_base(target_string, insert_point, insert_string):
    return target_string[:insert_point] + insert_string + target_string[insert_point:]

def main():
    N = str(input())
    l = len(N)-1

    result = 0
    for i in range(2 ** l):
        count = 1
        st = N
        for j in range(l):
            if ((i >> j) & 1):
                st = insert_string_to_base(st, j+count, "+")
                count+=1

        print(st)
        for v in st.split("+"):
            if(v != ''):
                result += int(v)
    print(result)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
s = input()
s = s[::-1]
l = len(s)

ans = int(s[0])*(2**(l-1))

for i in range(1,l):
    for k in range(1,i+1):
        num = (10**k) * int(s[i]) + int(s[i])
        num = num * (2 ** (l-i-1))
        ans += num

print(ans)

Submission status: Wrong Answer

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