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: Runtime Error

Solution code:
// https://atcoder.jp/contests/arc061/tasks/arc061_a
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  string S;
  cin >> S;

  ll ans = 0;
  int m = S.size() - 1;

  rep(bit, 1 << m) {
    ll cur = S[0] - '0';
    rep(i, m) {
      if (bit & (1 << i)) {
        ans += cur;
        cur = 0;
      }
      cur = cur * 10 + S[i + 1] - '0';
    }
    ans += cur;
  }
  cout << ans << endl;
  return 0;
}

Submission status: Runtime Error

Solution code:
from itertools import *
A = list(map(int, list(input()))

ans = 0
N = len(A)-1
for p in product([0,1], repeat = N):
	now = A[0]
    for i in range(N):
      if p[i] == 0:
        now = now*10 + A[i+1]
      else:
        ans += now
        now = A[i+1]
	ans += now
print(ans)

Submission status: Runtime Error

Solution code:
from itertools import *
A = list(map(int, list(input()))

ans = 0
N = len(A)-1
for p in product([0,1], repeat = N):
	now = A[0]
	for i in range(N):
      if p[i] == 0:
        now = now*10 + A[i+1]
      else:
        ans += now
        now = A[i+1]
	ans += now
print(ans)

Submission status: Runtime Error

Solution code:
import itertools
A = list(map(int, list(input()))

ans = 0
N = len(A)-1
for p in product([0,1], repeat = N):
	now = A[0]
    for i in range(N):
      if p[i] == 0:
        now = now*10 + A[i+1]
      else:
        ans += now
        now = A[i+1]
	ans += now
print(ans)

Submission status: Runtime Error

Solution code:
from itertools import *
A = list(map(int, list(input()))

ans = 0
N = len(A)-1
for p in product([0,1], repeat = N):
	now = A[0]
    for i in range(N):
      if p[i] == 0:
        now = now*10 + A[i+1]
      else:
        ans += now
        now = A[i+1]
	ans += now
print(ans)

Submission status: Runtime Error

Solution code:
import sys
S = sys.stdin.readline()
number = [i for i in S]
N = len(number)

ans = 0
for bit in range(1<<(N-1)):
    f = str(number[0])
    for i in range(N-1):
        if (bit&(1<<i)):
            f = f+'+'+str(number[i+1])
        else:
            f = f+str(number[i+1])
    ans = ans + eval(f)

print(ans)

Submission status: Runtime Error

Solution code:
import sys
S = sys.stdin.readline()
number = [i for i in S]
N = len(number)

ans = 0
for bit in range(1<<(N-1)):
    f = number[0]
    for i in range(N-1):
        if (bit&(1<<i)):
            f = f+'+'+number[i+1]
        else:
            f = f+number[i+1]
    ans = ans + eval(f)

print(ans)

Submission status: Runtime Error

Solution code:
import sys
S = sys.stdin.readline()
number = [i for i in S]
N = len(number)

ans = 0
for bit in range(1<<(N-1)):
    f = number[0]
    for i in range(N-1):
        if bit&(1<<i):
            f = f+'+'+number[i+1]
        else:
            f = f+number[i+1]
    ans = ans + eval(f)

print(ans)

Submission status: Runtime Error

Solution code:
import sys
S = sys.stdin.readline()
number = [i for i in S]
N = len(number)

ans = 0
for bit in range(1<<(N-1)):
    f = number[0]
    for i in range(N-1):
        if bit&(1<<i):
            f = f+'+'+number[i+1]
        else:
            f = f+number[i+1]
    ans = ans + eval(f)

print(ans)

Submission status: Runtime Error

Solution code:
S = int(input())
N = len(S)
for i in range(2**(N-1)):
  list = []
  for j in range(N):
    if ((i >> j) & 1):
      list.attend(S[j:])
      list.attend(S[:j])
  print(sum(list))

Submission status: Runtime Error

Solution code:
S = int(input())
N = len(S)
for i in range(2**(N-1)):
  list = []
  for j in range(N):
    if ((i >> j) & 1):
      list.attend(item[j][0])
  print(sum(list))

Submission status: Runtime Error

Solution code:
S = int(input())
N = len(S)
for i in range(2**(N-1)):
  list = []
  for j in range(N):
    if ((i >> j) & 1):
      list.attend(item[j][0])
print(sum(list))

Submission status: Runtime Error

Solution code:
s = input()
n = len(s)-1
ans = 0
for i in range(2**n):
    data = []
    for j in range(n):
        if((i >> j) & 1):
            data.append(1)
        else:
            data.append(0)
    num = s[0]
    x = []
    for i in range(n-1):
        if data[i] == 1:
            x.append(int(num))
            num = s[i+1]
        else:
            num += s[i+1]
    if data[-1] == 0:
        num += s[-1]
        x.append(int(num))
    else:
        x.append(int(num))
        x.append(int(s[-1]))
    ans += sum(x)
print(ans)

Submission status: Runtime Error

Solution code:
def powerset(iterable):
    s = list(iterable)
    return chain.from_iterable(combinations(s, r) for r in range(len(s) + 1))


def s_to_num(s):
    numlst = list(map(int, s))
    res = 0
    for i in numlst:
        res *= 10
        res += i
    return res


s = input()
length = len(s)
res = 0
for i in powerset(range(1, length)):
    if not i:
        res += int(s)
    else:
        jlst = [0] + list(i) + [length]
        for j in range(len(jlst) - 1):
            res += s_to_num(s[jlst[j]:jlst[j + 1]])
print(res)

Submission status: Runtime Error

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: Runtime Error

Solution code:
S=input()
n=len(S)-1
ans=0
dfs 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(def(0,S[0])

Submission status: Runtime Error

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(def(0,S[0])

Submission status: Runtime Error

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: Runtime Error

Solution code:
S=input()
n=len(S)-1
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: Runtime Error

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

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

Submission status: Runtime Error

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

ans = 0
for x in list(product(["", "+"], repeat=n)):
    x = list(x)
    x.append("")
    
    strs = [i+j for i, j in zip(s, x)]
    ans += eval("".join(strs))
print(ans)

Submission status: Runtime Error

Solution code:
s = input()

sum = 0

l = ["+"] * (len(s) - 1)

n = 2 ** (len(s) - 1)

for i in range(n):
    l = ["+"] * (len(s) - 1)
    for j in range(len(l)):
        ls = list(s)
        if (i >> j) & 1:
            l[j] = ""
        for x in range(len(l)):
            
            ls.insert(2*x+1,l[x])
   
    

    maped_list = map(str, ls) 
    mojiretu = ''.join(maped_list)

    sum = sum + eval(mojiretu)

print(sum)

Submission status: Runtime Error

Solution code:
S = input()

def dfs(a,s,n): #a:今まで計算した分、s:数字(文字)、n:左から何番目の位置に+を入れるか入れないか
    if(len(s) == n+1):
        return int(s[len(s)-1]) + int(s[:len(s)-1]) + int(s) + 2*a
    else:
        return dfs(a,s,n+1) + dfs(a+int(s[:n]),s[n:],1)

print(dfs(0,S,1))

Submission status: Runtime Error

Solution code:
def a(t,i):
    if i==l-1:
        return sum(map(int,t.split('+'))))
    return a(t+s[i+1],i+1)+a(t+'+'+s(i+1),i+1)
s=input()
l = len(s)
print(a(s[0],0))

Submission status: Runtime Error

Solution code:

def a(t,i):
    if i==l-1:
        print(sum(map(int,t.split('+'))))
        exit()
    return a(t+s[i+1],i+1)+a(t+'+'+s(i+1),i+1)

s=input()
a(s[0],0)
l = len(s)

Submission status: Runtime Error

Solution code:

def a(t,i):
    if i==l-1:
        print(sum(map(int,t.split('+'))))
        exit()
    return a(t+s[i+1],i+1)+a(t+'+'+s(i+1),i+1)

s=input()
a(s[0],0)
l = s.len()

Submission status: Runtime Error

Solution code:

def a(t,i):
    if i==l-1:
        print(sum(map(int,t.split('+'))))
        exit()
    a(t+s[i+1])+a(t+'+'+s(i+1))

s=input()
a(s[0],0)
l = s.len()

Submission status: Runtime Error

Solution code:


def a(t,i):
    if i==l-1:
        print(sum(int(t.split('+'))))
        exit()
    a(t+s[i+1])+a(t+'+'+s(i+1))

s=input()
a(s[0],0)
l = s.len()

Submission status: Runtime Error

Solution code:
def a(t,i):
    if i=l-1:
        print(sum(int(t.split('+'))))
        exit()
    a(t+s[i+1])+a(t+'+'+s(i+1))

s=input()
a(s[0],0)
l = s.len()

Submission status: Runtime Error

Solution code:
from collection import deque
import copy
def main():
  s = deque(list(input()))
  s2 = copy.deepcopy(s)
  n = len(s)
  ans = 0
  
  for i in range(2**n):
    op = [None]*n-1
    for j in range(n):
      tmp_str = ''
      if ((i<<j)&0):
        tmp_str += s.popleft
      else:
        ans += int(tmp_str)
        tmp_str = ''
  
  
if __name__ == '__main__':
  main()

Submission status: Runtime Error

Solution code:
import sys

S = list(map(int, sys.stdin.readline()))
len_S = len(S)
ans = 0
for i in range(2 ** (len_S - 1)):
  sum_ = S[len_S - 1]
  cursor = len_S - 1
  power = 0
  pattern = i
  while cursor > 0:
    cursor -= 1 
    if pattern % 2 == 1:
      power += 1
    else:
      power = 0
    sum_ += S[cursor] * (10 ** power)
    pattern = pattern // 2
  ans += sum_
print(ans)

Submission status: Runtime Error

Solution code:
import sys

S = list(map(int, sys.stdin.readline()))
len_S = len(S)
ans = 0
for i in range(2 ** (len_S - 1)):
  sum_ = S[len_S - 1]
  cursor = len_S - 1
  power = 0
  pattern = i
  while cursor > 0:
    cursor -= 1 
    if pattern % 2 == 1:
      power += 1
    else:
      power = 0
    sum_ += S[cursor] * (10 ** power)
    pattern //= 2
  ans += sum_
print(ans)

Submission status: Runtime Error

Solution code:
import sys

S = list(map(int, sys.stdin.readline()))
len_S = len(S)
ans = 0
for i in range(2 ** (len_S - 1)):
  sum_ = S[len_S - 1]
  cursor = len_S - 1
  power = 0
  pattern = i
  while cursor > 0:
    cursor -= 1 
    if pattern % 2 == 1:
      power += 1
    else:
      power = 0
    sum_ += S[cursor] * (10 ** power)
    pattern >>= 1
  ans += sum_
print(ans)

Submission status: Runtime Error

Solution code:
import sys

S = list(map(int, list(sys.stdin.readline())))
len_S = len(S)
ans = 0
for i in range(2 ** (len_S - 1)):
  sum_ = S[len_S - 1]
  cursor = len_S - 1
  power = 0
  while cursor > 0:
    cursor -= 1 
    if i % 2 == 1:
      power += 1
    else:
      power = 0
    sum_ += S[cursor] * (10 ** power)
    i >>= 1
  ans += sum_
      
print(ans)

Submission status: Runtime Error

Solution code:
import sys

S = list(map(int, sys.stdin.readline()))
len_S = len(S)
ans = 0
for i in range(2 ** (len_S - 1)):
  sum_ = S[len_S - 1]
  cursor = len_S - 1
  power = 0
  while cursor > 0:
    cursor -= 1 
    if i % 2 == 1:
      power += 1
    else:
      power = 0
    sum_ += S[cursor] * (10 ** power)
    i >>= 1
  ans += sum_
      
print(ans)

Submission status: Runtime Error

Solution code:
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])
  
s= input()
n=len(s)
print(dfs(0,s[0]))

Submission status: Runtime Error

Solution code:
S = input()
N = len(S)
plus_flag = [0] * (N - 1)


def calc(flags):
    val = 0
    num_begin_index = 0
    num_end_index = None
    for flag_index in range(len(flags)):
        if flags[flag_index] == 0:
            continue
        num_end_index = flag_index + 1
        val += int(S[num_begin_index:num_end_index])
        num_begin_index = num_end_index
    num_end_index = len(flags) + 1
    val += int(S[num_begin_index:num_end_index])
    return val


def calc_sum(index, flag):
    plus_flag[index] = flag
    if index == len(plus_flag) - 1:
        return calc(plus_flag)
    return calc_sum(index + 1, 0) + calc_sum(index + 1, 1)


print(calc_sum(0, 0) + calc_sum(0, 1))

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import itertools
import math
n=str(input())
s=list(n)
#print(s)
data=[i for i in range(len(n)-1)]
print(data)

combi=list(itertools.product(data, repeat=2))
#print(combi)
#print(type(combi))

data_r = ["+" if i == 1 else i for i in data]
data_r2 = ["" if i == 0  else i for i in data_r]
#print(data_r2)

combi_r2=list(itertools.product(data_r2, repeat=2))
#print(combi_r2)
#print(type(combi_r2))
gokei=0
for i in range(len(combi_r2)):
    sushiki=""
    for j in range(len(list(n))-1):
        sushiki=sushiki+s[j]+combi_r2[i][j]
        #print(s[j])
    sushiki=sushiki+s[-1]
    #print(sushiki)
    #print("_",combi_r2[i][0],"_",combi_r2[i][1],"_")   
    bun=sushiki.split("+")
    bun_int = [int(n) for n in bun]
    ans=sum(bun_int)
    #print(bun_int)
    #print(ans)
    gokei=gokei+ans
    #print("============")
print(gokei)

Submission status: Runtime Error

Solution code:

def fun(s):
    n = len(s)
    ans = 0
    for bit in range(1 << (n-1)):
        f = s[0]
        for i in range(n-1):
            if bit & (1 << i):
                print(1 << i)
                f += "+"
            f += s[i+1]
        ans += sum(map(int, f.split('+')))

    return ans

print(fun(s))

Submission status: Runtime Error

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(bit) - 1:
                count += int(S[start:])
                
    print(count)


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

Submission status: Runtime Error

Solution code:
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: Runtime Error

Solution code:
s=input()
t=len(s)-1
sl=[s[i] for i in range(len(s))]
answers=[]

for i in range(2**t):
  tmp=[]
  for j in range(t):
    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(k) for k in ans if k != '+']
  ans=sum(ans)
  answers.append(ans)
  
print(sum(answers))

Submission status: Runtime Error

Solution code:
s=str(input())
t=len(s)-1
sl=[s[i] for i in range(len(S))]
answers=[]

for i in range(2**t):
  tmp=[]
  for j in range(t):
    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(k) for k in ans if k != '+']
  ans=sum(ans)
  answers.append(ans)
  
print(sum(answers))

Submission status: Runtime Error

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 >> j) & 1 == 1):
            s += int(''.join(s[t:j+1]))
            t = j+1
    s += int(''.join(s[t:]))
print(s)

Submission status: Runtime Error

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 >> j) & 1 == 1):
            s += int(''.join(s[t:j+1]))
            t = j+1
    s = int(''.join(s[t:]))
print(s)

Submission status: Runtime Error

Solution code:
S = input()

x = len(S)-1

a = 0
b = 0
s = 0
for i in range(1 << x):
    for j in range(x):
        if ((i >> j) & 1 == 1):
            b = j
            s += int(S[a:b])
            a = j

print(s)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
S = input()
N = len(S)
ans = 0
for i in range(2 ** (N - 1)):
    signs = bin(i)[2:].zfill(N - 1).replace('0', '+').replace('1', ' ')

    tmp_s = S[0]
    for j, sign in enumerate(signs):
        tmp_s += sign + S[j + 1]

    ans += eval(tmp_s.replace(' ', ''))

print(ans)

Submission status: Runtime Error

Solution code:
S = input()

n = len(S)
S_list = [int(S[0]), int(S[1]), int(S[2]), int(S[3])]

#1... -  0...+
def bit_to_notation(bit):
  bitlist = [0 for i in range(n-1)] 
  for i in range(n-1):
    if ((bit >> i) == 1):
      bitlist[n-2-i] = "-"
    else:
      bitlist[n-2-i] = "+"
  return bitlist

notation = 2 ** (n-1)
for bit in range(notation):
  sum4 = 0
  for j in range(n):
    if((bit >> j) & 1):
      sum4 -= S_list[n-1-j]
    else:
      sum4 += S_list[n-1-j]
      
  if(sum4 == 7):
    
    bitlist = bit_to_notation(bit)
    print(str(S_list[0]) + bitlist[0] + str(S_list[1]) + bitlist[1] 
          + str(S_list[2]) + bitlist[2]  + str(S_list[3]) + "=7)
    break

Submission status: Runtime Error

Solution code:
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

S_int = int(readline())
S_str = str(S_int)

pattern = []
fmt = '0' + str(len(S_str)-1) + 'b'
for i in range(2**(len(S_str)-1)):
    pattern.append(format(i, fmt))

answer = 0
for plus_flags in pattern:
    tmp = []
    tmp_str = S_str[0]
    for i, is_plus in enumerate(plus_flags, start=1):
        if is_plus == "1":
            tmp.append(int(tmp_str))
            tmp_str = ""
        tmp_str += S_str[i]
    if tmp_str:
        tmp.append(int(tmp_str))
    answer += sum(tmp)
print(answer)

Submission status: Runtime Error

Solution code:
    total = 0

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(10000)

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

def rec(plus):
  if len(plus) == n:
    global ans
    si = s[0]
    for i in range(n):
      if plus[i] == '-':
        si += s[i+1]
      else:
        ans = ans + int(si)
        si = s[i+1]
    ans = ans + int(si)
  else:
    rec(plus+'-')
    rec(plus+'+')

rec('-')
rec('+')
print(ans)

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(2000)

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

def rec(plus):
  if len(plus) == n:
    global ans
    si = s[0]
    for i in range(n):
      if plus[i] == '-':
        si += s[i+1]
      else:
        ans = ans + int(si)
        si = s[i+1]
    ans = ans + int(si)
  else:
    rec(plus+'-')
    rec(plus+'+')

rec('-')
rec('+')
print(ans)

Submission status: Runtime Error

Solution code:
target=input()
n = len(target)-1
bit_list = [list(f"{i:0{n}b}") for i in range(2**n)]
answer = 0

for bits in bit_list:
    one_number_indexes=[i for i, x in enumerate(bits) if x == '1']
    # ここで1がある場所を取得
    start=0    
    # 街灯の箇所で文字を区切る関数を実装
    for index in one_number_indexes:
        answer=answer+int(target[start:index+1])
        start=index+1
    answer=answer+int(target[start:n+1])

print(answer)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!
target=input()
n = len(target)-1
bit_list = [list(f"{i:0{n}b}") for i in range(2**n)]
answer = 0

for bits in bit_list:
    one_number_indexes=[i for i, x in enumerate(bits) if x == '1']
    # ここで1がある場所を取得
    start=0    
    # 街灯の箇所で文字を区切る関数を実装
    for index in one_number_indexes:
        answer=answer+int(target[start:index+1])
        start=index+1
    answer=answer+int(target[start:n+1])

print(answer)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;
 
int *dec2bin(int decimal, int *binary, size_t size){
  for(i=0; decimal>0; i++){
    binary[i] = decimal % 2 * pow(10, i);
    decimal = decimal / 2;
  }
  return binary;
}

int main() {
  string S;
  cin >> S;
  int sum = 0;
  int num_cases = pow(2, S.size()-1);
  vector<int> binary(num_cases);
  dec2bin(18, binary, 6);
  
  
  /*
  for(int i=0; i<num_cases; i++){
    string str_bin = to_string(dec2bin(i));
    for(int j=0; j<S.size(); j++){
      
    }
  }*/
  cout << "Hello, world!" << endl;
}

Submission status: Runtime Error

Solution code:
_ = "_"

def solve(s):
    if _ in s:#in関数
        return solve(s.replace(_,"+",1))+solve(s,replace(_,"",1))
    else:
        return eval(s)

s=_.join(list(input()))
print(solve(s))

Submission status: Runtime Error

Solution code:
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <string.h>
#include <string>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <math.h>
#include <algorithm>
#include <numeric>

using namespace std;

// マクロ&定数 ============================================================
typedef unsigned int uint;
typedef long long ll;
//typedef pair<int, int> P;

typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<bool> vbool;
typedef vector<string> vstring;

typedef vector<pair<int, int>> vpint;
typedef vector<pair<ll, ll>> vpll;
typedef vector<pair<double, double>> vpdouble;

typedef vector<vector<int>> vvint;
typedef vector<vector<ll>> vvll;
typedef vector<vector<double>> vvdouble;
typedef vector<vector<bool>> vvbool;

const int c_YET = -1;
const int INF = 1e9 + 1;
const ll LLINF = 1e17 + 1;
const int DX[9] = { 0,0,1,-1, 1, 1, -1, -1, 0 }; // 4;４近傍
const int DY[9] = { 1,-1,0,0, 1, -1, 1, -1, 0 }; // 8:８近傍 9:(0,0)を含む
const ll MOD = 1e9 + 7; //10^9 + 7
const ll MAX = 1e9;
const double PI = 3.14159265358979323846264338327950288;
//========================================================================



int main() {

	//==================================
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(30);
	//==================================


	string S;
	cin >> S;

	ll ans = 0;

	ll size = S.length();
	
	vll N(size);
	
	for (ll i = 0; i < size; i++) {
		N[i] = ll(S[i]) - 48;
	}

	ll time = 0;

	for (ll bit = 0; bit < (1<<size-1) ; bit++) {

		ll local = 0;
		for (ll i = 0; i < size-1; i++) {

			local *= 10;
			local += N[i];

			if ((bit >> (size - 2 - i)) & 1) {
				ans += local;
				local = 0;

				if (i == size - 2) {

					ans += local + N[i + 1];
					local = 0;
				}
			}
			else {
				if (i == size - 2) {
					local *= 10;
					ans += local + N[i + 1];
					local = 0;
				}
			}



		}
		time++;
	}

	if (size == 1) {
		cout << S;
		return 0;
	}

	cout << ans << endl;





}

Submission status: Runtime Error

Solution code:
import sys

S = input()

N = len(S)-1
sum = 0

for i in range(2**N):

    op = [""]*(N)
    for j in range(N):
        if (i>>j)&1:
            op[j] = "+"
    s = ""
    for j in range(N):
        s = s + S[j] + op[j]
    s = s + S[j]
    sum = sum + eval(s)
print(sum)

Submission status: Runtime Error

Solution code:
def main():
    #import sys
    #input = sys.stdin.readline
    S = input()
    S_list = list(S)
    dig = len(S) - 1
    insert_plus = format(0,"0"+str(dig)+"b")
    insert_plus_max = "1"*len(insert_plus)
    s = 0
    for i in range(int(insert_plus_max,2)+1):
        before = 0
        num_list = []
        now = format(i,"0"+str(dig)+"b")
        for j in range(len(now)):
            if now[j] == "1":
                num_list.append("".join(S_list[before:int(j)+1]))
                before = j+1
            if j == len(now)-1:
                num_list.append("".join(S_list[before:]))
        for num in num_list:
            s += int(num)
    print(s)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
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: Runtime Error

Solution code:
import itertools

s = input()
n = [i for i in s]
ans = 0

for i in range(len(n)):
  for j in itertools.combinations(range(len(n)-1, i)):
    temp = [i for i in s]
    for k in j[::-1]:
      temp.insert(k+1, "+")
    temp = "".join(temp)
    temp = temp.split("+")
    temp = map(int, temp)
    ans += sum(temp)

print(ans)

Submission status: Runtime Error

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

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

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

Submission status: Runtime Error

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()
    sl = [i for i in s]
    n = len(s)-1
    ans = []
    anslist = []
    sublist = [-1]*n
    for i in range(1 << n):
        for j in range(n):
            if (i>>j)&1:
                sublist[j] = "+"
        anslist.append(sl[0])
        for j in range(n):
            if sublist[j] == "+":
                anslist.append("+")
                anslist.append(sl[j+1])
            else:
                anslist.append(sl[j+1])
        ans.append(eval("".join(anslist)))
        anslist = []
        sublist = [-1]*n
    print(sum(ans))
if __name__ == "__main__":
    main() 
    
#endline===============================================

Submission status: Runtime Error

Solution code:
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue
#import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys

sys.setrecursionlimit(100000) 
  
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()
    sl = [i for i in s]
    n = len(s)-1
    sublist = [-1]*n
    anslist = []
    ans = []
    for i in range(1<<n):
        for j in range(n):
            if (i>>j)&1:
                sublist[j] = "+"
        anslist.append(sl[0])
        for j in range(n):
            if sublist[j] == "+":
                anslist.append(sublist[j])
                anslist.append(sl[j+1])
            else:
                anslist.append(sl[j+1])
        ans.append(eval("".join(anslist)))
        anslist = []
        sublist = []
    print(sum(ans))
if __name__ == "__main__":
    main() #endline===============================================

Submission status: Runtime Error

Solution code:
S = input()

[s1, s2] = S.split("+")
[s1, s2] = list(map(int, [s1, s2]))