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()
l=len(s)
sum=0
for i in range(l):
  tmp=0
  for j in range(0,l-i+1):
    r=max(2**(max(j-1,0)),2**(max(l-j-i-1,0)))
    #print(j,l-j-i,s[j:j+i],r)
    if not (s[j:j+i]==''):
    	tmp=int(s[j:j+i])*r
    sum+=tmp
print(sum+int(s))

Submission status: Wrong Answer

Solution code:
_ = '_'


def solve(s, acc):
    if _ in s:
        a = solve(s.replace(_, "+", 1), acc)
        b = solve(s.replace(_, "", 1), acc)
        if a or b is not None:
            acc.append(a)
            acc.append(b)
    else:
        # print(s)
        return eval(s)


s = _.join(list(input()))
ans = []
solve(s, ans)
# print(ans)
print(sum(ans))

Submission status: Wrong Answer

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

s = input()

score = 0
for blocksize in range(1,len(s)+1):
    for startpoint in range(len(s)):
        if startpoint+blocksize >= (len(s)+1): continue
        block = s[startpoint:startpoint+blocksize]   
        ss = int(block) * f(startpoint-1) * f(len(s) - (startpoint+blocksize))
        score += ss
print(score)
exit()

Submission status: Wrong Answer

Solution code:
import math
s = input()
# print(s)

score = 0
for blocksize in range(1,len(s)+1):
    for startpoint in range(len(s)):
        # print("hi", startpoint+blocksize)
        if startpoint+blocksize >= (len(s)+1): continue
        block = s[startpoint:startpoint+blocksize]
        ss = int(block) * math.factorial(startpoint) * math.factorial(len(s) - (startpoint+blocksize))
        # print("{} ({}, {}): {}".format(block, startpoint, len(s) - (startpoint + blocksize), ss))
        score += ss
print(score)
exit()

Submission status: Wrong Answer

Solution code:
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------
    s = input()
    n = len(s)-2
    ans = []
    anslist = []
    sublist = [-1]*n
    for i in range(1 << n):
        for j in range(n):
            if (i>>j)&1:
                sublist[j] = "+"
        anslist.append(s[0])
        for j in range(n):
            if sublist[j] == "+":
                anslist.append("+")
                anslist.append(s[j+1])
            else:
                anslist.append(s[j+1])
        print(anslist)
        ans.append(eval("".join(anslist)))
        anslist = []
        sublist = [-1]*n
    print(sum(ans))
if __name__ == "__main__":
    main() 
    
#endline===============================================

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
ans = 0
for i in range(1 << n - 1):
    c = ""
    b = format(i, "b").zfill(n - 1)

    for j in range(len(b)):
        c += s[j]
        if b[j] == "1":
            c += "+"
    c += s[-1]
    total = sum(map(int, c.split("+")))
    ans += total
print(ans)

Submission status: Wrong Answer

Solution code:
try:
  S = input()
  l = []
  for i in range(len(S)):
      l.append(S[i:])
      if S[:i] == '':
          l.append(0)
      else:
          l.append(S[:i])
  l_ = [int(i) for i in l]
  print(l_)
  s_ = sum(list(map(int, S)))
  if len(S)%2 != 0:
      print(sum(l_) + s_)
  else:
      print(sum(l_))
except EOFError:
  pass

Submission status: Wrong Answer

Solution code:
a=input()
def strs(st):
  if len(st)>1:
    return int(st)+strs(st[1:])+strs(st[:-1])+int(st[0])+int(st[-1])
  else:
    return int(st)
print(strs(a)+int(a[0])+int(a[-1])-int(a[len(a)//2]))

Submission status: Wrong Answer

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


def part_sum(cur, i, s, res):
    if i < n-1:
        part_sum(cur+s[i], i+1, s, res)
        part_sum(cur+s[i]+"+", i+1, s, res)
    else:
        cur += s[i]
        res.append(sum(list(map(int, cur.split("+")))) )
        print(cur)
        print(res)
    return res
  
res = part_sum("", 0, s, [])
print(sum(res))

Submission status: Wrong Answer

Solution code:
a=input()
def strs(st):
  print(st)
  if len(st)>1:
    return int(st)+strs(st[1:])+strs(st[:-1])
  else:
    return int(st)

print(strs(a)+int(a[0])+int(a[-1])-int(a[len(a)//2]))

Submission status: Wrong Answer

Solution code:
S=input()
l=len(S)-1

s=0
for i in range(l**2):
    t=format(i,"b")
    t=t.zfill(l)
    k=S[0]
    for j in range(l):
        if(t[j]=="0"):
            k=k+S[j+1]
        else:
            s+=int(k)
            k=S[j+1]
    s+=int(k)
 
print(s)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

S = input()[:-1]  # 改行をなくす
n = len(S) - 1  # +を入れる事ができる場所の数

# bit全探索
P = []
for bit in range(0, 1<<n):  # 00 ~ 11
    plus = [""] * n
    for j in range(n):
        if bit>>j & 1:
            plus[j] = "+"
    P.append(plus)



ans = 0
for plus in P:
    nums = []
    tmp = S
    pre = 0
    for i in range(n):
        if plus[i] == "+":
            nums.append(int(tmp[pre:i+1]))
            pre = i+1
        if i == n-1:
            nums.append(int(tmp[pre:]))
    ans += sum(nums)
print(ans)

Submission status: Wrong Answer

Solution code:
# arc 061 Many Formulas
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

S = read().rstrip().decode('utf-8')

def F(S):
    total = 0
    for i in range(2 ** (len(S) - 1)):
        operator_list = format(i, 'b').zfill(len(S)) # 最大桁は必ず0
        sum_ = 0
        num = 0
        for j, operator in zip(S, operator_list):
            if operator == "0":
                num = num * 10 + int(j)
            else:
                sum_ += num
                num = int(j)
        sum_ += num

        total += sum_

ans = F(S)
print(ans)

Submission status: Wrong Answer

Solution code:
# arc 061 Many Formulas
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

S = read().rstrip().decode('utf-8')

def F(S):
    total = 0
    for i in range(2 ** (len(S) - 1)):
        operator_list = format(i, 'b').zfill(len(S)) # 最大桁は必ず0
        sum_ = 0
        num = 0
        for j, operator in zip(S, operator_list):
            if operator == "0":
                num = num * 10 + int(j)
            else:
                sum_ += num
                num = int(j)
        sum_ += num

        total += sum_
    print(total)

ans = F(S)
print(ans)

Submission status: Wrong Answer

Solution code:
import sys

n = input()
last = 0
result = []

if len(n) == 1:
    print(int(n))
    sys.exit()

for i in range(len(n)-1):
    # print('i',i)
    s1 = n[:i+1]
    s2 = n[i+1:]
    # print('s1 s2',s1,s2)
    # print('sum ',int(s1)+int(s2))
    result.append(int(s1)+int(s2))

for i in range(len(n)):
    # print('i n[i]',i,n[i])
    last += int(n[i])

result.append(last)
result.append(int(n))
# print(result)
print(sum(result))

Submission status: Wrong Answer

Solution code:
n = input()
last = 0
result = []

for i in range(len(n)-1):
    # print('i',i)
    s1 = n[:i+1]
    s2 = n[i+1:]
    # print('s1 s2',s1,s2)
    # print('sum ',int(s1)+int(s2))
    result.append(int(s1)+int(s2))

for i in range(len(n)):
    # print('i n[i]',i,n[i])
    last += int(n[i])

result.append(last)
result.append(int(n))
# print(result)
print(sum(result))

Submission status: Wrong Answer

Solution code:
S = list(input())
F = [0] * (len(S)-1)

ans = 0
def rec(i):
    global ans
    if i == len(F):
        string = S[0]
        tmp = []
        for i in range(len(F)):
            if F[i] == 0:
                string += S[i+1]
            else:
                tmp.append(string)
                string = S[i+1]
        
            if i == len(F) - 1:
                tmp.append(string)
        
        tmp = list(map(int, tmp))
        ans = ans + sum(tmp)
        return
        
    rec(i+1)
    F[i] = 1
    rec(i+1)
    F[i] = 0

rec(0)
print(ans)

Submission status: Wrong Answer

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

for i in range(n):
    t = ""
    a = str(bin(i))[2:].zfill(len(s)-1)
    for j in range(len(a)):
        if a[j] == "1":
            t += s[j] + "+"
        else:
            t += s[j]
    t += s[-1]
    ans += eval(t)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque

sys.setrecursionlimit(1000000000)

def dfs(xs):
    x = xs.popleft()

    if len(xs) == 0:
        return x

    # not +
    xs2 = xs.copy()
    y   = xs2.popleft()
    xy  = int(str(x)+str(y))
    xs2.appendleft(xy)
    b = dfs(xs2)

    # has +
    a = x + x + dfs(xs)


    return a+b


s  = str(input())
xs = list(map(int,s))
xs = deque(xs)

print(sum(xs))

Submission status: Wrong Answer

Solution code:
from collections import deque

def dfs(xs):
    x = xs.popleft()

    if len(xs) == 0:
        return x

    # not +
    xs2 = xs.copy()
    y   = xs2.popleft()
    xy  = int(str(x)+str(y))
    xs2.appendleft(xy)
    b = dfs(xs2)

    # has +
    a = x + x + dfs(xs)


    return a+b


s  = str(input())
xs = list(map(int,s))
xs = deque(xs)

print(sum(xs))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

    return dfs(formula + "+" + S[index], index + 1) + dfs(formula + S[index], index + 1)


S = input()
max_index = len(S)
dfs(S[0], 0)

Submission status: Wrong Answer

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

    else:
        return dfs(formula + '+' + S[index + 1], index + 1) + dfs(formula + S[index + 1], index + 1)


S = input()
max_index = len(S)

print(dfs(S, 0))

Submission status: Wrong Answer

Solution code:
import copy
n = list(map(int,list(input())))
su=0
for i in range(( len(n)-1 )**2):
  pls = []
  for j in range(len(n)-1):
    if (i>>j) & 1:
      pls.append("+")
    else:
      pls.append(" ")
  n0 = copy.copy(n)
  tmp = []
  #print(n0)
  #print(pls)
  for k in range(len(n)-1):
    if pls[k] == " ":
      n0[k+1]=int(str(n0[k])+str(n0[k+1]))
      n0[k]=0
  #print(n0) 
  su += sum(n0)
print(su)

Submission status: Wrong Answer

Solution code:
# coding: utf-8


def solve(*args: str) -> str:
    S, = args
    n_sep = len(S)-1
    b_max = 2**n_sep
    print(S)

    ret = 0
    for b in range(b_max):
        p = 0
        for i in range(n_sep):
            if b >> i & 1:
                ret += int(S[p:i+1])
                p = i+1
        ret += int(S[p:])

    return str(ret)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Submission status: Wrong Answer

Solution code:
s = input()

n = len(s)

ans = 0
for i in range(2**n):
	l = []
	op = [""]*n
	for j in range(n):
		if i & (1 << j):
			op[j] = '+'
	print(op)
	res = ""
	for a,b in zip(op+[""],s):
		res += a+b

	ans += eval(res)

print(ans//2)

Submission status: Wrong Answer

Solution code:
S = input()
n = len(S) - 1
ans = 0
for i in range(2**n):
    bits = [(i>>j)&1 for j in range(n)]
    bits.append("")
    expr = ""
    for s, b in zip(S, bits):
        expr += s
        if b == 1:
            expr += "+"
    ans += sum([int(s) for s in expr if s != "+"])
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
import copy

def main():
    sum=0
    S = list(map(str, input()))
    hoge = tmp = []
    print(S)

    op_cnt = len(S) - 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(i,op)

        S_tmp = copy.deepcopy(S)
        for k in range(len(op)):
            S_tmp.insert(1+k*2,op[k])
        print("".join(S_tmp))
        sum+=(eval("".join(S_tmp)))
        print(sum)
    print(sum)

main()

Submission status: Wrong Answer

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

for i in range(2 ** (n - 1)) :
    k = int(s[0])
    for j in range(n - 1):
        if (i >> j) & 1 :
            ans += k
            print(k , "if")
            k = 0
        k *= 10
        k += int(s[j + 1])
    ans += k
    print(k)

print(ans)

Submission status: Wrong Answer

Solution code:
S = list(input())
ans = int("".join(S))
for i in range(len(S) - 1, 0, -1):  # +の数
    for plus_index in range(1, i + 1):
        S.insert(plus_index, "+")
        ans += eval("".join(S))
        S.pop(plus_index)
    S.insert(plus_index, "+")
    # print(S)
print(ans)

Submission status: Wrong Answer

Solution code:
S = list(input())
ans = int("".join(S))
for i in range(len(S) - 1, 0, -1):  # +の数
    for plus_index in range(1, i + 1):
        S.insert(plus_index, "+")
        ans += eval("".join(S))
        S.pop(plus_index)
    S.insert(plus_index, "+")
    print(S)
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
if "\n" in S:
  print()
else:
  exit()

Submission status: Wrong Answer

Solution code:
n = list(input())
gaps = len(n) - 1
import copy
ans = 0
for i in range(gaps ** 2):
    formula = copy.deepcopy(n)
    ops = [""] * gaps
    for j in range(gaps):
        if (i >> j) & 1:
            ops[gaps-j-1] = "+"
    formula1 = ""
    for f,op in zip(formula,ops + [""]):
        formula1 += (str(f) + op)
    ans += eval(formula1)
print(ans)

Submission status: Wrong Answer

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

for i in range(2**(n-1)):#+入るかどうか2**n-1通りある
    #文字列としてevalで処理する
    e = ""
    for j in range(n-1):
        if (i >> j)& 1 == 1:
            e += s[j] + '+'
        else:
            e += s[j]
    e += s[-1]
    print(e)
    ans += eval(e)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
S = str(input())

def plus(a,b,c):
    x = a[0:b+1] + c + a[b+1:len(a)]
    return(x)
A = [S]
while len(A) != 2**(len(S)):
    for i in range(len(S)-1):
        for j in range(len(A)):
            x = A[j]
            y = plus(x,i,'+')
            A.append(y)
s = 0
for i in range(len(A)):
    s += eval(A[i])
print(s)

Submission status: Wrong Answer

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

bitlist = []
def allbit(string, n):
    if n ==0:
        bitlist.append(string)
        return
    allbit(string + "0", n-1);
    allbit(string + "1", n-1);
    
allbit("", sl-1)

ans = 0
for bit in bitlist:
    print("bit", bit)
    before_idx = 0
    for idx, b in enumerate(bit):
        if b == "1":
            if s[before_idx:idx+1] != "":
                ans += int(s[before_idx:idx+1])
                before_idx = idx+1
    if int(s[before_idx:]) != "":
        ans += int(s[before_idx:])
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0

for i in range((len(S)-1)**2):
    plus = ''
    for j in range(len(S)-1):
        plus += S[j]
        if (i>>j) & 1:
             plus += '+'
    plus += S[-1]
    ans += eval(plus)

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
len_S = len(S)-1
ans = 0
for s in range(1<<len_S):
  now = ""  
  now += S[0]
  print(s)
  for i in range(len_S):    
    if s & (1<<i): # 間に"+"を入れる
      now += "+"
    now += S[i+1]    
  ans += eval(now)
print(ans)

Submission status: Wrong Answer

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

N = len(S)
ans = 0
for i in range(N):
    left = i
    right = N - i - 1
    score = 1
    for k in range(0, right + 1):
        if right - k > 0:
            ans += S[i] * score * (1 << left) * (1 << (right - k - 1))
        else:
            ans += S[i] * score * (1 << left)
        score *= 10

print(ans)

Submission status: Wrong Answer

Solution code:

def main():
    s = input()
    num = 2**(len(s)-1)
    bit_len = len(bin(num))

    def func(ｎ):
        n = bin(n)
        n_len = len(n)
        n = "0"*( bit_len - n_len - 1 ) + n[-len(n)+2:]
        indexes = [i+1 for i, x in enumerate(ｎ) if x == "1"]
        ans = 0
        temp = 0
        for i in indexes:
            ans += int(s[temp:i])
            temp = i
            print(i, ans)
        else:
            if temp != bit_len-2:
                ans += int(s[temp:])
                print(ans)

        return ans

    ans = 0
    for i in range(num):
        ans += func(i)
        print("ans : " + str(ans))
    print(ans)

main()

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s) - 1  # スキマの数
sum_ = 0
keep = 0
for i in range(2**n):  # +かつなげるか
    p_or_no = ["no"] * n
    for j in range(n):
        if ((i >> j) & 1) == 1:
            p_or_no[n-1-j] = "+"

    for k in range(n):
        if p_or_no[k] == "+":
            sum_ += int(s[k]) + keep
            keep = 0
        else:
            keep = int(s[k]) * 10 + keep * 10
        if k == n-1:
            sum_ += int(s[-1]) + keep
            keep = 0
print(sum_)

Submission status: Wrong Answer

Solution code:
s = input()
def calc(s,op):
    ans = 0
    tmp = 0
    for i in range(len(s)):
        tmp += int(s[i])
        if i == len(s) - 1:
            ans += tmp
            break
        if op[i] == 0:
            tmp = tmp * 10
        else:
            ans += tmp
            tmp = 0
    return ans 
i_max = 2**(len(s)-1)
ans = 0
for i in range(i_max):
    op = [0]*(len(s) - 1)
    for j in range(len(op)):
        op[j] = i % 2
        i = i // 2
    ans += calc(s,op)

Submission status: Wrong Answer

Solution code:
import sys
def input():
    return sys.stdin.readline()[:-1]
 
s = input()
n = len(s) - 1
total = 0
for i in range(2 ** n):
    indice = []
    sumup = 0
    for j in range(n):
        if (i >> j) & 1:
            indice.append(j)
    if indice == []:
        sumup += int(s)

Submission status: Wrong Answer

Solution code:
S = input()
ans  = [int(n) for n in S]
ans.append(int(S))
for sp in range(1, len(S)):
    ans += [int(n) for n in [S[0:sp], S[sp:]]]
print(sum(ans))

Submission status: Wrong Answer

Solution code:
s = input()
N = len(s)
value = []
for i in range((N - 1) ** 2):
    x = []
    so = s
    cnt = 1
    for j in range(N - 1):
        if i >> j &  1:
            x.append(j)
    if len(x) > 0:
        val = 0 
        ind = 0
        for k in (x):
            val += int(s[ind:k+1])
            ind = k+1
        val += int(s[k+1:])
        value.append(val)
    else:
        value.append(int(s))
print(sum(value))

Submission status: Wrong Answer

Solution code:
s = input()
l = len(s)
fin_ans = 0
print(s)
for i in range(2**(l-1)):###*
    ans = 0
    left = 0
    right = 1
    for j in range(l):
        if (i>>j) & 1 == 0 and right<l:
            right += 1
        elif right<l:
            ans += int(s[left:right])
            left = right
            right += 1
    ans += int(s[left:right])
    fin_ans += ans
    #print(bin(i),ans,fin_ans)
print(fin_ans)

Submission status: Wrong Answer

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

def dfs(i, f):
    if i == n - 1:
        return eval(f)
    
    print(dfs(i+1, f + s[i+1]), dfs(i+1, f + '+' + s[i+1]))
    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 = list(input())
N = len(S)
List = []
for i in range(2**(N-1)):
    tmp = ''
    for j in range(N-1):
        if ((i>>j) & 1):
            tmp += '1'
        else:
            tmp += '0'
    List.append(list(tmp))
ans = 0
for i in range(len(List)):
    start = 0
    tmp = ''
    for j in range(len(List[i])):
        if List[i][j] == '0':
            tmp += S[j]
        if List[i][j] == '1':
            tmp += S[j]
            ans += int(tmp)
            tmp = ''
    tmp += S[-1]
    ans += int(tmp)
print(ans)

            
print(ans)

Submission status: Wrong Answer

Solution code:
n = [int(x) for x in input()]
sp_cnt = len(n) - 1  # すき間の個数
ans=0

for i in range(2 ** sp_cnt):
  clc=["+"]*sp_cnt
  for j in range(sp_cnt):
    if ((i >> j) & 1):
      clc[sp_cnt - 1 - j] = ""
  for p_n, p_o in zip(n, clc + [""]):
    print(p_n ,p_o)

Submission status: Wrong Answer

Solution code:
import sys
import  math
import bisect
from statistics import *
from collections import *
from operator import itemgetter
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

s = input()
li = [int(x) for x in s]
l = len(s)
ans = 0
for i in range(1 << (l - 1)):
    k = li[0]
    ct = 0
    for j in range(l - 1):
        if i>>j&1:
            ct += k
            k = li[j + 1]
        else:
            k = k * 10 + li[j + 1]
        if j == l - 2:
            ct += k
            ans += ct
print(ans)

Submission status: Wrong Answer

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

lst = [i for i in itertools.product([0,1],repeat = len(s) - 1)]
s2 = list(s)

lst = [i for i in itertools.product([0,1],repeat = len(s) - 1)]
s4  = []
for l in lst:
    s3 = list(s)
    h = 0
    for i in range(0, len(s)-1):
        if l[i] == 1:
            s3.insert(i+h+1,'+')
            h += 1
    s4.append(s3)
sum([eval(''.join(i)) for i in s4])

Submission status: Wrong Answer

Solution code:
S = input()
num = len(S) - 1
sum = 0

for i in range(2**num):
  k = 0
  for j in range(num):
    if ((i >> j) & 1):
      sum += int(S[k:j+1])
      k = j + 1
    if j == num - 1:
      sum += int(S[k:])

print(sum)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!

# coding: utf-8
# Your code here!

s = input()
sList = list(s)
sList = [int(i) for i in s]
sCount = len(sList)
#print(sCount)

aaa = 0

for i in range(2**(sCount-1)):

    binaryNumber = format(i,'b')
    binaryNumber = binaryNumber.zfill(sCount-1)
    binaryNumber = list(binaryNumber)
    binaryNumber = [int(i) for i in binaryNumber]
    
    
    for i in range(sCount-1):
        if binaryNumber[i] == 1 :
            binaryNumber[i] = '+'
    
    #print(sList)
    #print(binaryNumber)
    
    result = [None]*(len(sList)+len(binaryNumber))
    result[::2] = sList
    result[1::2] = binaryNumber
    
    while 0 in result:
        result.remove(0)
    
    #print(result)    
    result = map(str, result)
    resultStr = ''.join(result)
    
    aaa = aaa + eval(resultStr)
    
    print(aaa)

Submission status: Wrong Answer

Solution code:
S = str(input())
# print(S)
S_size = len(S)


def calc(s, plist):
    nlist = [0]*S_size
    nlistcount = 0
    start = 0
    end = 1
    plist = list(map(int, list(plist)))
    for i in range(S_size-1):
        if plist[i] == 1:
            nlist[nlistcount] = int(S[start:end])
            start = end
            end += 1
            nlistcount += 1
        else:
            end += 1
        if end == S_size:
            nlist[nlistcount] = int(S[start:end])
            nlistcount += 1
    return sum(nlist)



# pi: +を入れるか判定した回数，
# plist: +を入れるかどうかの01str
def dfs(pi, plist):
    # print(pi, plist,type(plist))
    if pi == S_size - 1:
        # print(plist, calc(S, plist))
        return calc(S, plist)
    return dfs(pi + 1, plist+"0") + dfs(pi + 1, plist+"1")


print(dfs(0,""))

Submission status: Wrong Answer

Solution code:
S = input()

def dfs(res, depth, path, S):
    res[0] += int(path)
    for i in range(depth + 1, len(S) + 1):
        dfs(res, i, S[depth:i], S)

res = [0]

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

Submission status: Wrong Answer

Solution code:
S = input()

def dfs(res, depth, path, S):
    res.append(path)
    if depth == len(S):
        return
    for i in range(depth + 1, len(S)+1):
        dfs(res, i, int(S[depth:i]), S)

res = []

dfs(res, 0, 0, S)
print(sum(res))

Submission status: Wrong Answer

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

for i in range(1,2**(N-1)):
    A = S[0]
    for j in range(N-1):
        if 1 << j & i:
            A += '+'
        A += S[j]
    ans += eval(A)

print(ans)

Submission status: Wrong Answer

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

for i in range(1,2**(N-1)):
    A = S[0]
    for j in range(N-1):
        if 1 << j & i:
            A += '+'
        A += S[j]
    ans += eval(A)
    print(A)

print(ans)

Submission status: Wrong Answer

Solution code:
M=input()
N=len(M)
S=[]
B=[]
for i in range(0,N):
    S.append(M[i])
    B.append(M[i])
T=2**(N-1)
A=0
for i in range(0,T):
    t=[]
    k=i
    for j in range(0,N-1):
        if k>=2**(N-2-j):
            t.append(1)
            k=k-2**(N-2-j)
        else:
            t.append(0)
    n=0
    for j in range(0,N):
        S[j]=B[j]
    for j in range(0,N-1):
        if j<N-2:
            if t[j]==1:
                n=n+int(S[j])
            else:
                S[j+1]=S[j]+S[j+1]
        else:
            if t[j]==1:
                n=n+int(S[j])+int(S[j+1])
            else:
                S[j+1]=S[j]+S[j+1]
                n=n+int(S[j+1])
    A=A+n
print(A)

Submission status: Wrong Answer

Solution code:
S = input()

from itertools import combinations

s = int(S)
for l in range(1, len(S)):
    print(l)
    for c in combinations(range(1, len(S)), l):
        c = sorted(c)
        n = [int(S[lower:upper]) for lower, upper in zip([0] + c, c + [len(S)])]
        s += sum(n)

print(s)

Submission status: Wrong Answer

Solution code:
S = input()
#llen(S)-1までの長さのバイナリを入れる、0をそのまま、１を＋とみなす。
#再帰関数にして、引数に前のls-1を入れればいい
def sumall(ls = 0):
    bls = bin(ls)
    if len(S) <= len(bls)-2:
        return 0
    else:
        count = 0
        pi = 0
        for ib,b in enumerate(bls[::-1]):
            if b == 'b':
                count += int(S[pi:])
                break
            elif b == '1':
                count += int(S[pi:ib+1])
                pi = ib+1
        #print(count)
        return count + sumall(ls+1)
print(sumall(0))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
S=input()  
ans=0

def count(S,binnumber,i):
    if i-1==0:
        if binnumber[i-1]=="1":
            return int(S[0])+int(S[1:])
        return int(S)
    elif binnumber[i-1]=="1":
            temp=int(S[i:])
            S=S[:i]
            return temp+count(S,binnumber,i-1)
    return count(S,binnumber,i-1)

for i in range(2*(len(S)-1)):
    binnumber=str(format(i,"b").zfill(len(S)-1))
    j=len(binnumber)
    ans=ans+count(S,binnumber,j)
    
print(ans)

Submission status: Wrong Answer

Solution code:
S = "125"
n = len(S)
sum = 0
for i in range(2**(n-1)):
    B = [""] * (n-1)
    f = ""
    for j in range(n-1):
        if((i>>j)&1):
            B[j] = "+"
            
    for a,b in zip(S, B+[""]):
        
        f += a
        f += b
        
    sum += eval(f)

print(sum)

Submission status: Wrong Answer

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

ans = 0
for i in range(2 ** n):
    calc = [0 for i in range(n)]
    for j in range(n):
        if ((i >> j) & 1):
            calc[- 1 - j] = 1
    str_num = s[0]
    for k in range(n):
        if calc[k] == 0:
            str_num += s[k+1]
        elif calc[k] == 1:
            ans += int(str_num)
            str_num = s[k+1]
        if k == n-1:
            ans += int(str_num)

print(ans)

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/arc061/tasks/arc061_a
def solve(S):
    a = _iter(S, '')
    return a


def _iter(s, t):
    if s == '':
        if t.endswith('+'):
            return 0
        return eval(t)
    a = s[0]
    b = s[1:]
    return _iter(b, t+a) + _iter(b, t+a+'+')


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

Submission status: Wrong Answer

Solution code:
# https://atcoder.jp/contests/arc061/tasks/arc061_a
def solve(S):
    a = _iter(S, '')
    return a


def _iter(s, t):
    if s == '':
        if t.endswith('+'):
            return 0
        print(t)
        return eval(t)
    a = s[0]
    b = s[1:]
    return _iter(b, t+a) + _iter(b, t+a+'+')


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

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)
    
    # + 入れる場合
    const += int(left_str[:1 + skip_cnt])
    res_p = calc_adding(left_str[1 + skip_cnt:], 0, const)

    return res_np + res_p
    
calc_adding(input_num, 0, 0)