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 = str(input())
l = list(map(str,(map(bin,range(2**(len(S)-1))))))
print(l)

ans = 0
for i in range(len(l)):
    ev = l[i][2:].zfill(len(S)-1)
    res = 0
    num_str = S[0]
    for j in range(1,len(S)):
        if(ev[j-1] == '0'):
            num_str = num_str + S[j]
        else:
            res += int(num_str)
            num_str = S[j]
    res += int(num_str)
    ans += res

print(ans)

Submission status: Wrong Answer

Solution code:
s = input()

a = 0
di = len(s) - 1
m = 2 ** di
for i in range(m):
  b = format(i, 'b').zfill(di)
  fs = ''
  for c, d in zip(s, b):
    fs += c
    if d == '1':
      fs += '+'
  fs += s[-1]
  a += eval(fs)

print(a)

Submission status: Wrong Answer

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

sum = int(S)

for i in range(1, N):
    for j in range(1, N - i + 1):
        f = S[0:i]
        for k in range(0, j):
            f += '+' + S[i + k:i + k + 1]
        f += S[i + k + 1:]
        sum += eval(f)
print(sum)

Submission status: Wrong Answer

Solution code:
S = input()
ls = len(S)
g = 0
for i in range(2**(ls-1)):
    w = ''
    for u,v in zip(format(i,'#0'+str(2+ls-1)+'b')[2:],S):
        if u=='1':w=w+v+'+'
        else:w=w+v
    else:w=w+S[-1]
    g += eval(w)
print(g)

Submission status: Wrong Answer

Solution code:
s = input()
a = []
for i in range(2**(len(s)-1)):
    p = format(i, "0"+str(len(s)-1)+"b")
    num = ""
    for j in range(len(p)):
        if p[j] == "1":
            num += s[j]
            a.append(int(num))
            num = ""
        else:
            num += s[j]
    num += s[-1]
    a.append(int(num))

print(sum(a))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
s = input()
len_s = len(s)

ret = 0
def calc_cumsum(idx,right_str):
    if idx == len(right_str):
        return int(right_str)
    _ifplus = int(right_str[0:idx])* (2**(len(right_str[idx:len_s]) -1 )) + calc_cumsum(1,right_str[idx:len_s])
    _ifnotplus = calc_cumsum(idx+1,right_str)
    print(_ifplus+_ifnotplus)
    return (_ifplus+_ifnotplus)
print(calc_cumsum(1,s))

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

# 10 -> n
def ten2n(a,n):
  x=a//n
  y=a%n
  if x:
    return ten2n(x,n)+str(y)
  return str(y)

def main():
  n=S()

  l=list(n)

  l2=[]
  for i in range(pow(2,len(n)-1)):
    l2.append(list(ten2n(i,2).zfill(len(n)-1)))

  sm=0
  for x in l2:
    s=''
    for i in range(len(x)):
      if x[i]=='0':
        s+=l[i]
      else:
        s+=l[i]+'+'
    s+=l[-1]
    sm+=eval(s)

  return sm


print(main())

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
digit  = len(S)-1
for i in range(2**digit):
    bit = format(i,"0"+str(digit)+"b")
    temp = []
    num = S[0]
    for j in range(digit):
        if j == digit - 1:
            if bit[j] == "1":
                temp.append(int(num))
                temp.append(int(S[j+1]))
            else:
                temp.append(int(num+S[j+1:]))
        else:
            if bit[j] == "1":
                temp.append(int(num))
                num = S[j+1]     
            else:
                num += S[j+1]
    ans += sum(temp)
print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
ans = 0
digit  = len(S)-1
for i in range(2**digit):
    bit = format(i,"0"+str(digit)+"b")
    temp = []
    num = S[0]
    for j in range(digit):
        if j == digit - 1:
            if bit[j] == "1":
                temp.append(int(num))
                temp.append(int(S[j+1]))
            else:
                temp.append(int(num+S[j+1:]))
        else:
            if bit[j] == "1":
                temp.append(int(num))
                num = S[j+1]     
            else:
                num += S[j+1]
    print(temp)
    ans += sum(temp)
print(ans)

Submission status: Wrong Answer

Solution code:
s = list(map(int,list(input())))
n = len(s)
m = 0
for i in range(n):
  for j in range(n-i):
    m += s[i]*2**max(n-j-2,0)*10**j
print(m)

Submission status: Wrong Answer

Solution code:
import itertools


def sum_strlong(strlong):
    ans = int(strlong)
    for i in range(1, len(strlong)):
        for comb in itertools.combinations(range(len(strlong)-1), i):
            integer = ''
            for j, digit in enumerate(strlong):
                integer += digit
                if j in comb:
                    integer += '+'
            ans += eval(integer)
    return ans


if __name__ == '__main__':
    print(sum_strlong('9'*10))

Submission status: Wrong Answer

Solution code:
s = input()
list = [[0]*(len(s)-1)]
def dfs(l,cnt):
    if cnt==len(s)-1:
        return 0
    ret = l.copy()
    ret[cnt] += 1
    if not l in list:
        list.append(l)
    list.append(ret)
    dfs(l,cnt+1)
    dfs(ret,cnt+1)
    return 0
dfs([0]*(len(s)-1),0)
ans = 0
for l_ in list:
    start = 0
    for i in range(len(l_)):
        if l_[i]==1:
            ans += int(s[start:i+1])
            start = i+1
        if i==len(l_)-1:
            ans += int(s[start:])

print(ans)

Submission status: Wrong Answer

Solution code:
n=input()
ans=0
def dfs(i,flag):
  global ans
  if i!=len(n)-1:
    dfs(i+1,flag)
    dfs(i+1,flag|2**i)
  else:
    num=[]
    start=0
    for i in range(len(n)):
      if flag&2**i>0:
        num.append(int(n[start:i+1]))
        start=i+1
    ans+=sum(num)
dfs(0,0)
print(ans)

Submission status: Wrong Answer

Solution code:
import itertools
s=input()
C=['+','']
X=list(itertools.product(C,repeat=len(s)-1))
print(X)
ans=0
for i in range(len(X)):
    res=''
    for j in range(len(s)-1):
        res+=s[j]+X[i][j]
    res+=s[len(s)-1]
    ans+=eval(res)

print(ans)

Submission status: Wrong Answer

Solution code:
S = input()
n = len(S)
import itertools as it
def sum_insert(x,S): 
    z = zip(S,x)
    L = []
    for x in z:
        L.append(x[0])
        if x[1] == '1':
            L.append('+')
    L.append(S[-1])
    s = ''.join(L)
    return eval(s)
ans = 0
variation = []
for i in range (2**(n-1)):
    variation.append(format(i,'b').zfill(n-1))

for x in variation:
    ans += sum_insert(x,S)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = list(map(int, list(input())))

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

m = len(s) - 1

n = 2 ** m

ans = 0
for i in range(n):
    d = list(map(int, list(str(bin(i)))[2:]))
    if len(d) < m:
        d = [0] * (m - len(d)) + d

    temp = s[0]
    for j in range(m):
        if d[j] == 0:
            ans += temp
            temp = s[j+1]
        else:
            temp *= 10
            temp += s[j+1]
    ans += temp
    #print(d, ans)

print(ans)

Submission status: Wrong Answer

Solution code:
s = list(map(int, list(input())))

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

m = len(s) - 1

n = 2 ** m

ans = 0
for i in range(n):
    d = list(map(int, list(str(bin(i)))[2:]))
    if len(d) < m:
        d = [0] * (m - len(d)) + d

    temp = s[0]
    for j in range(m):
        if d[j] == 0:
            ans += temp
            temp = s[j+1]
        else:
            temp *= 10
            temp += s[j+1]
    ans += temp
    #print(d, ans)

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
if s=='125':
  exit()
n=len(s)-1
if n==0:
  print(s)
else:
  l=[]
  a=len(bin(1<<n))-3
  for i in range(1<<n):
    l.append(str(bin(i))[2:].zfill(a))
  su=0
  for i in l:
    ind=0
    st=s[ind]
    for j in i:
      if j=='0':
        pass
      else:
        st+='+'
      ind+=1
      st+=s[ind]
    su+=eval(st)
  print(su)

Submission status: Wrong Answer

Solution code:
S = input()
cnt = 0
for i in range(len(S)):
  l, r = S[:i], S[i:]
  if(S[:i] == ''):
    l = 0
  cnt += int(l) + int(r)
print(cnt + sum(list(map(int,S))))

Submission status: Wrong Answer

Solution code:
def bit_all(a,n):
    ans = 0
    for i in range(2**n):
        mini_ans = 0
        now = 0
        for j in range(n):
            if i>>j & 1:
                mini_ans += int(a[now:j+1])
                now = j+1
            if j == n - 1:
                mini_ans += int(a[now:])
        ans += mini_ans
    print(ans)
                
                
a = input()
bit_all(a,len(a)-1)

Submission status: Wrong Answer

Solution code:
s = int(input())
n_li = []

for n in range(len(str(s))):
  if n == 0:
    div = 1
  else:
    div = 10**n
  ans1 = s//div
  ans2 = s%div
  sumn = ans1 + ans2
  n_li.append(sumn)

ansa = 0
for i in str(s):
  ansa += int(i)
ansb = 0
for j in n_li:
  ansb += j
print(ansa + ansb)

Submission status: Wrong Answer

Solution code:
s=input()
count=0
for i in range(2**(len(s)-1)):
    t=""
    for j in s:
        t+=j
        if i%2==1:
            t+="+"
        i//=2
    print(t)
    count+=eval(t)
print(count)

Submission status: Wrong Answer

Solution code:
s = input()
n = int(s)
r = 0

for bit in range(2**(len(s)-1)):
    e = s[0]
    for i in range(len(s)-1):
        if ((bit>>i)&1) == 1:
            e += '+'
        e += s[i+1]
        print(e)
    #r += sum(map(int, e.split('+')))
    r+= eval(e)
print(r)

Submission status: Wrong Answer

Solution code:
s = input()
n = len(s)
ans = 0
#数字の間を全探索
for i in range(2**(n-1)):
    f = ""
    for j in range(n):
        f += s[j]
        #iを右にj個削り、１桁目のビットが１かどうか
        if i>>j & 1 == 1:
            f += "+"
    print(f)
    ans += eval(f)
print(ans)

Submission status: Wrong Answer

Solution code:
s = input()
s_split = [s[i] for i in range(len(s))]
result = 0

for i in range(2**(len(s)-1)):
    b = bin(i)[2:]
    b = b.zfill(len(s)-1)
    tmp = s_split.copy()

    for j in range(len(b)-1, -1, -1):
        if b[j] == "1":
            print(b, j)
            tmp.insert(-j-1, "+")

    before = ""
    num = 0
    for x in range(len(tmp)):
        if tmp[x] == "+":
            num += int(before)
            before = ""
        else:
            before += tmp[x]
    if len(before) != 0:
        num += int(before)
    result += num
print(result)

Submission status: Wrong Answer

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

for i in range((N-1)**2):
    s = S[:]
    for j in range(N):
        if i & j:
            s[j] = '+' + s[j]
    ans += eval(''.join(s))

print(ans)

Submission status: Wrong Answer

Solution code:
s=input()
l=[]
for k in range(2**(len(s)-1)):
  l.append(format(k,'0'+str(len(s)-1)+'b'))
c=0
for i in range(2**(len(s)-1)):
  m=list(l[i])
  m.append('1')
  x=0;y=0
  for j in range(len(s)):
    if m[j]=='0':y+=1
    else:
      c+=int(s[x:x+y+1])
      x=j+1
      y=0
print(c)

Submission status: Wrong Answer

Solution code:
s = int(input())
s_list = list(str(s))
all_sum = 0

for n in range(len(s_list)):
    all_sum += s // 10**n + s % 10**n

for n in s_list:
    all_sum += int(n)

print('{0}'.format(all_sum), end='')

Submission status: Wrong Answer

Solution code:
s = int(input())
s_list = list(str(s))
all_sum = 0

for n in range(len(s_list)):
    all_sum += s // 10**n + s % 10**n

for n in s_list:
    all_sum += int(n)

print(all_sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
s = input()

ans = int(s)

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

for i in range(len(s)-1):
    l = int(s[0:i+1])
    r = int(s[i+1:])
    ans += l+r
print(ans)

Submission status: Wrong Answer

Solution code:
def ans():
    s = list(input())
    sl = len(s)
    ans = 0
    for i in range(1 << sl-1):
        tmp = s[0]
        for j in range(sl-1):
            if i&(1<<j):
                tmp += "+"
            tmp +=s[j+1]
        ans +=eval(tmp)
print(ans())

Submission status: Wrong Answer

Solution code:
def li(s):
    lis = [[] for i in range(2**(len(s)-1))]
    bi = []
    if len(s) == 1:
        return [[]]
    for i in range(2**(len(s)-1)):
        bi.append(bin(i)[2:])
        while len(bi[i]) != len(s)-1:
            bi[i] = "0"+bi[i]

    for i in range(len(bi)):
        v = 0
        for j in range(len(bi[i])):
            if bi[i][j] == "1":
                lis[i].append(int(s[v:j+1]))
                v = j+1
            if j == len(bi[i])-1:
                lis[i].append(int(s[v:]))
    return lis

s = input()
ans = 0
lis = li(s)

for i in lis:
    for j in i:
        ans += j
print(ans)

Submission status: Wrong Answer

Solution code:
def main():
    s = input()

    A = []
    for i in range(len(s)):
        A.append(int(s[i]))

    f = True
    for i in range(len(s)):
        if f:
            for j in range(i, len(s)):
                tmp1 = ""
                for k in range(i, j + 1):
                    tmp1 += s[k]
                else:
                    A.append(int(tmp1))
                    if(int(tmp1) == int(s)):
                        f = False
                        break
                if(f == False):
                    break
                tmp2 = ""
                if j < len(s) - 1:
                    for k in range(j + 1, len(s)):
                        tmp2 += s[k]
                    else:
                        A.append(int(tmp2))
                        if(int(tmp2) == int(s)):
                            f = False
                            break
                if f == False:
                    break
        else:
            break
    print(sum(A))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
def main():
    s = input()

    A = []
    for i in range(len(s)):
        for j in range(i, len(s)):
            tmp = ""
            for k in range(i, j + 1):
                tmp += s[k]
            else:
                A.append(int(tmp))
                tmp = ""
            for k in range(j + 1, len(s)):
                tmp += s[k]
            else:
                pass
                #A.append(int(tmp))
    print(sum(A) + int(s[0]) + int(s[-1]))

if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
s=input()
n=len(s)
sum=0
for i in range(1<<(n-1)):
    prev=0
    ans=""
    for j in range(n-1):
        if 1&j<<i:
            ans+=s[prev:j+1]
            prev=j+1
            ans+="+"
    ans+=s[prev:]
    sum+=eval(ans)
print(sum)

Submission status: Wrong Answer

Solution code:
def main():
    s=input()
    n=len(s)
    total=0
    for i in range(1<<(n-1)):
        num=0
        ans=""
        for j in range(n-1):
            if 1&j<<j:
                ans+=s[num:j+1]
                num=j+1
                ans+="+"
        ans+=s[num:]
        total+=eval(ans)
    print(total)
if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
class NumExpression:
    def __init__(self, input_value, rank):
        self.raw_value = input_value
        self.rank = rank

    @property
    def value(self):
        list = self.expression.split("+")
        sum = 0
        for num in list:
            sum += int(num)
        return sum

    @property
    def expression(self):
        #print("rank = {0}".format(self.rank))
        points = self.gen_points(self.rank, len(self.raw_value) - 1)
        #print("gen_points = {0}".format(points))
        expression = self.insert_plus(points)
        #print("expression = {0}".format(expression))
        return expression

    def gen_points(self, num, width):
        """
        num → 2進数に変換してリストで返す
        """
        points = [0] * width
        temp = num
        i = 1
        while True:
            p = temp % 2 
            if p == 1:
                points[width - i] = 1
            temp = temp >> 1
            if temp == 0:
                break
            i += 1

        return points

    def insert_plus(self, points):
        """
        point位置に"+"を挿入する
        """
        i = 0 #points[0]
        new_value = self.raw_value[0:i]
        for point in points:
            new_value += self.raw_value[i:i+1]
            if point == 1:
                new_value += "+"
            i += 1

        new_value += self.raw_value[i:]
        return new_value

class Calculator:
    def __init__(self, input_value):
        self.input_value = input_value
        self.expressions = self.make_expressions()

    def len(self):
        return len(self.input_value)

    def make_expressions(self):
        expressions = []
        for i in range(0, pow(2, self.len()-1)):
            expression = NumExpression(self.input_value, i)
            expressions.append(expression)
        return expressions

    def compute_sum(self):
        sum = 0
        for expression in self.expressions:
            sum += expression.value

        return sum

Submission status: Wrong Answer

Solution code:
import math

def func(n_str, ptr):
    print(n_str)
    if len(n_str)==ptr:
        return int(eval(n_str))
    return func(n_str, ptr+1) + func(n_str[:ptr]+"+"+n_str[ptr:], ptr+2)
s = input()    
print(func(s, 1))

Submission status: Wrong Answer

Solution code:
def SumIndicatedPoint(pcandid):
	point = list(str(pcandid))
	conNum = nums[0]
	count = 1
	sum = 0
	for p in point:
		if count <= len(nums)-1:
			if p == '0':
				conNum = conNum + nums[count]
			elif p == '1':
				sum = sum + int(conNum)
				conNum = nums[count]
			count = count + 1
	sum = sum + int(conNum)
	#print(str(sum))	
	return sum
	
if __name__ == '__main__':	
	nums = list(input())
	#nums.reverse()
	pcandidstr = '0' + str(len(nums) - 1) + 'b'
	pcandid = 0
	keta = 1
	if len(nums) > 1:
		keta = len(nums) - 1
	maxcandid = int('1' * keta,2)
	#add = format(1,pcandidstr)
	ALLSUM = 0
	while pcandid <= maxcandid:
		ALLSUM = ALLSUM + SumIndicatedPoint(format(pcandid,pcandidstr))
		pcandid = pcandid + 1
	print(str(ALLSUM))

Submission status: Wrong Answer

Solution code:
(lambda nums: (lambda index, itertools=__import__("itertools"): print(sum([eval("".join((lambda t: [[t.insert(j, "+") for j in reversed(i)], t][1])(list(nums)))) for i in itertools.chain(*[itertools.combinations(index, x) for x in range(len(index) + 1)])])))(range(1, len(nums))))("1234")

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import math

data = raw_input()
len_data = len(data)
split_point = []
split_start = 0
split_end = 0
result = []
sum = 0
tmp = 0
for i in xrange(len_data+1):
    split_point.append(format(i,"0"+str(int(math.log(len_data,2))+1)+"b"))
# print split_point
for spoint in split_point:
    for i in xrange(len(spoint)):
        if spoint[i] == "1":
            split_end = i+1
            result.append(data[split_start:split_end])
            split_start = split_end
    result.append(data[split_end:])
    for i in result:
        tmp = tmp + int(i)
    sum = sum + tmp
    split_start = 0
    result = []
    tmp = 0
print sum

Submission status: Wrong Answer

Solution code:
#coding:utf-8
import math

data = raw_input()
len_data = len(data)
split_point = []
split_start = 0
split_end = 0
result = []
sum = 0
tmp = 0
for i in xrange(len_data+1):
    split_point.append(format(i,"0"+str(int(math.log(len_data,2))+1)+"b"))
print split_point
for spoint in split_point:
    for i in xrange(len(spoint)):
        if spoint[i] == "1":
            split_end = i+1
            result.append(data[split_start:split_end])
            split_start = split_end
    result.append(data[split_end:])
    for i in result:
        tmp = tmp + int(i)
    sum = sum + tmp
    split_start = 0
    result = []
    tmp = 0
print sum

Submission status: Wrong Answer

Solution code:
import sys

s = list(raw_input())

if len(s) == 1:
	print str(s)
	sys.exit()

sequence = [x for x in range(2**( len(s) -1 ))]

total = 0
def get_binary(seq):
	r = ''
	while seq > 0:
		r = r + str(seq % 2)
		seq = seq / 2
	if (len(list(r)) < (len(s) - 1)):
		for _ in range(len(s) - 1 - len(list(r))):
			r = r + '0'
	return list(r)

for seq in sequence:
	subtotal = 0
	index = 1
	num = s[0]
	b = get_binary(seq)
	for x in b:
		if x == '0':
			num = num + s[index]
		else:
			subtotal = subtotal + int(num)
			num = s[index]
		index = index + 1
	total = total + subtotal + int(num)

print str(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
b=input()
sum([sum([int(b[n+1:]),int(b[:n+1])])for n in range(len([i for i in b])-1)]+[int(i) for i in b]) + int(b)

Submission status: Wrong Answer

Solution code:
memo = set([])
def f(a):
    global ans
    ans += eval('+'.join(a))
    if len(a) < 3 : return
    for i in range(len(a)-1):
        b = a[:i] + [a[i]+a[i+1]]
        if i != len(a)-2 : b += a[-(len(a)-2-i):]
        c = '+'.join(b)
        if not c in memo:
            memo.add(c)
            f(b)
s = input()
l = list(s)
ans = int(s)
f(l)
print(ans)

Submission status: Wrong Answer

Solution code:
s=raw_input()

def sum_by_step(l,step):
    res = 0
    count = 0
    while (count+step <= len(l)):
        res += int(l[count:count+step])
        count += step
    if count < len(l):
        res += int(l[count:])
    return res

result = int(s)
x = [int(n) for n in s]
'''
for i in xrange(len(s)-1):
    result += int(s[:i+1]) + int(s[i+1:])

for j in xrange(len(s)):
    result += int(s[j])

print result
'''

#result += sum(x)

for i in xrange(len(s)):
    step = 1

    while i+step < len(s):
        result += int(s[:i+1]) + sum_by_step(s[i+1:],step)
        step += 1

print result

Submission status: Wrong Answer

Solution code:
s=raw_input()
result = int(s)
for i in xrange(len(s)-1):
    result += int(s[:i+1]) + int(s[i+1:])

for j in xrange(len(s)):
    result += int(s[j])

print result

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Here your code !

S = input()
Slist = list(S)

def cut(l, i): #iは重複して追加される部分つまり1+25と1+2+5の1に当たる
    n = len(l)
    if n == 1:
        return int(l[0])+i #一桁になったらそれ以上分割しない
    else: #そのままでは返せない
        sum = int(''.join(l))+i #全く分割しないパターン
        sum2 = 0
        for jj in range(n-1):
            j=jj+1 #1~n-1
            #print(l[0:j])
            #print(l[j:n])
            #print(int(''.join(l[0:j])))
            sum = sum + cut(l[j:n], int(''.join(l[0:j]))) + i

        return int(sum)
print(cut(Slist, 0))

Submission status: Wrong Answer

Solution code:
s=raw_input()

def sum_by_step(l,step):
    res = 0
    count = 0
    while (count+step <= len(l)):
        res += int(l[count:count+step])
        count += step
    if count < len(l):
        for newstep in xrange(1,len(l)-count+1):
            res += sum_by_step(l[count:],newstep)
    return res

result = int(s)
x = [int(n) for n in s]
'''
for i in xrange(len(s)-1):
    result += int(s[:i+1]) + int(s[i+1:])

for j in xrange(len(s)):
    result += int(s[j])

print result
'''

#result += sum(x)

for i in xrange(len(s)):
    step = 1

    while i+step < len(s):
        result += int(s[:i+1]) + sum_by_step(s[i+1:],step)
        step += 1

print result

Submission status: Wrong Answer

Solution code:
xs = list(input())

n = len(xs)

ans = []
for i in range(n + n - 1):
  ans.append([])

for i in range(n):
  if i == n - 1:
    for k in range(n + n - 1):
      ans[k].append(xs[i])
  else:
    # FIXME
    for k in range(n + n - 1):
      if k % 2 == 0:
        ans[k].append(xs[i])
        ans[k].append('')
      else:
        ans[k].append(xs[i])
        ans[k].append('+')

sum = 0
for k in range(n + n - 1):
  sum += eval(''.join(ans[k]))

print(sum)

Submission status: Wrong Answer

Solution code:
import math
import pickle
s=list(input())
dp={}

def calc(s):
    if(pickle.dumps(s) in dp):
        return dp[pickle.dumps(s)]
    ret=0
    if(len(s)==0):
        return 0
    for i in range(1,len(s)+1):
        dp[pickle.dumps(s[i:])]=calc(s[i:])
        ret+=int("".join(s[:i]))*math.factorial(len(s[i:]))+dp[pickle.dumps(s[i:])]
    return ret

print(calc(s))

Submission status: Time Limit Exceeded

Solution code:
s = list(map(int,list(input())))

from collections import deque

cands=deque([[0],[1]])

while len(cands[0]) != len(s)-1:
    newcands = []
    for cand in cands:
        newcands.append(cand+[0])
        newcands.append(cand+[1])
    cands = newcands

memo = []
while cands:
    pos = cands.pop()
    siki = ''
    for i, p in enumerate(pos):
        siki += str(s[i])
        if p == 1:
            siki += '+'
    siki += str(s[-1])
    memo.append(eval(siki))

print(sum(memo))

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in input().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v


# Width First Search (+ Distance)
def wfs_d(D, N, K):
    """
    D: 隣接行列(距離付き)
    N: ノード数
    K: 始点ノード
    """

    dfk = [-1] * (N + 1)
    dfk[K] = 0

    cps = [(K, 0)]
    r = [False] * (N + 1)
    r[K] = True
    while len(cps) != 0:
        n_cps = []
        for cp, cd in cps:
            for i, dfcp in enumerate(D[cp]):
                if dfcp != -1 and not r[i]:
                    dfk[i] = cd + dfcp
                    n_cps.append((i, cd + dfcp))
                    r[i] = True

        cps = n_cps[:]

    return dfk


# Depth First Search (+Distance)
def dfs_d(v, pre, dist):
    """
    v:  現在のノード
    pre: １つ前のノード
    dist: 現在の距離

    以下は別途用意する
    D: 隣接リスト(行列ではない)
    D_dfs_d: dfs_d関数で用いる，始点ノードから見た距離リスト
    """

    global D
    global D_dfs_d

    D_dfs_d[v] = dist

    for next_v, d in D[v]:
        if next_v != pre:
            dfs_d(next_v, v, dist + d)

    return


def sigma(N):
    ans = 0
    for i in range(1, N + 1):
        ans += i
    return ans


def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    S = input()
    ans = 0

    for n in range(2**(len(S)-1)):
        B = to_bin(n)

        while len(B) != len(S) - 1:
            B = "0" + B

        expr = S[0]
        for b,s in zip(B, S[1:]):
            if b == "1":
                expr += "+"
            expr += s


        ans += eval(expr)

    print(ans)


main()

Submission status: Accepted

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

f = "0"+str(len(s)-1)+"b"

for i in range(2**(len(s)-1)):
    m = format(i, f)

    l = 0
    r = 0
    while r < len(m):
        if m[r] == "1":
            nums.append(s[l:r+1])
            l = r+1
        r += 1

    nums.append(s[l:r+1])

print(sum(map(int, nums)))

Submission status: Accepted

Solution code:
s = input()
n = len(s) - 1
res = 0
for i in range(1 << n):
    num_str = s[0]
    for j in range(n):
        if i >> j & 1 == 0:
            num_str += s[j + 1]
        else:
            res += int(num_str)
            num_str = s[j + 1]
    res += int(num_str)

print(res)

Submission status: Accepted

Solution code:
S=input()
N=len(S)
ans=0
for i in range(2**(N-1)):
    Bit = list(i+1 for i in range(N-1))
    for j in range(N-1):
        if (i >> j) & 1:
            Bit[j] = 0
    Bit=[b for b in Bit if b>0]
    L=0
    for b in Bit:
        ans+=int(S[L:b])
        L=b
    ans+=int(S[L:])
print(ans)

Submission status: Accepted

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

for bit in range(1 << (n-1)):#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: Accepted

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