TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
s = input()
x = []
l = len(s)
for i in range(l):
    x.append(int(s[i]))

sum = 0
for n in range(2**(l-1)):
    bin_str = format(i,'0'+str(l-1)+'b')
    prev = 0
    flg = 0
    for i in range(l-1):
        if bin_str[i]==0:
            prev = prev*10 + x[i]
        else:
            sum += prev*10 + x[i]
            prev = 0
    sum += prev*10 + x[l-1]

print(sum)


s = input()

def manyformulas(s):
    print('s:{0}'.format(s))
    if len(s)==1:
        return 1,int(s[0])
    else:
        sum = int(s)
        count = 1
        for i in range(len(s)-1):
            c, recursive = manyformulas(s[(i+1):])
            sum += c*int(s[:(i+1)]) + recursive
            count += c

        return count, sum

print(manyformulas(s)[1])


s = input()
x = []
l = len(s)
for i in range(l):
    x.append(int(s[i]))

sum = 0
for n in range(2**(l-1)):
    bin_str = format(i,'0'+str(l-1)+'b')
    prev = 0
    flg = 0
    for i in range(l-1):
        if bin_str[i]==0:
            prev = prev*10 + x[i-1]
        else:
            sum += prev*10 + x[i-1]
            prev = 0
    sum += prev*10 + x[l-1]

print(sum)


S = list(input())

def bit_search(s):
    # print('s:',s,'len:',len(s))
    if len(s)==1:
        # print('len=1,s:',s,len(s), int(s[0]))
        return int(s[0]),1 
    else:
        # print('s[0],type:',s[0],type(s[0]))
        sum1, cases1 = bit_search(s[1:])
        tmp1 = int(s[0])*cases1+sum1
        tmp = [s[0]+s[1]]+s[2:]
        # print('tmp:',tmp)
        tmp2, cases2 = bit_search(tmp)
        return tmp1+tmp2, cases1+cases2

# print('initial S',S)
print(bit_search(S)[0])

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)    

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)    

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s = input()

for i in range(2**(len(s)-1)):
    plus = [""]*(len(s))
    fomula = ""
    for j in range(len(s)-1):
        if(i >> j & 1):
            plus[j] = "+"
    for k in range(len(s)):
        fomula += s[k] + plus[k]
    ans += eval(fomula)
print(ans)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)

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)

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+1]
    ans += eval(A)
    # print(A, 'ans: ', ans)

print(ans+int(S))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def f(a, b, le, tf):
    b[le] = tf
    if le == len(b)-1:
        t = ""
        s1 = 0
        for i in range(len(b)):
            t += a[i]
            if b[i] == 1:
                s1 += int(t)
                t = ""
        t += a[len(b)]
        s1 += int(t)
        return s1
    else:
        return f(a, b, le+1, 0) + f(a, b, le+1, 1)


aa = input()
bb = [0] * (len(aa)-1)
if len(a) == 1:
    print(a)
else:
    print(f(aa, bb, 0, 0) + f(aa, bb, 0, 1))

def clc(a, b, c, p, t):
    if c == 0:
        b = a[0]
        return clc(a, b, c + 1, True, t) + clc(a, b, c + 1, False, t)
    elif c == len(a)-1:
        if p:
            return t + int(b) + int(a[c])
        else:
            return t + int(b + a[c])
    else:
        if p:
            t += int(b)
            b = a[c]
        else:
            b += a[c]
        return clc(a, b, c + 1, True, t) + clc(a, b, c + 1, False, t)


s = input()
print(clc(s, "", 0, True, 0) if len(s) != 1 else s)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)

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

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

    print(ans)

if __name__ == '__main__':
    main()

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

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

if __name__ == '__main__':
    main()

Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
// https://atcoder.jp/contests/arc061/tasks/arc061_a
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;



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;
}


s = input()
n = len(s) - 1
ans = 0
for bit in range(1 << n):
    now = 0
    for i in range(bit):
        if bit & (1 << i):
            ans += int(s[now : i + 1])
            now = i + 1
    ans += int(s[now : len(s)])
print(ans)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
s = input()
space = len(s) - 1
total = 0
for i in range(2 ** space):
    pluses = []
    for j in range(space):
        if (i >> j) & 1:
            pluses.append(j)
    re = 0
    for p in pluses:
        re += int(s[p]) + int(s[p+1])
    total += re
print(total)

S = input()
N = len(S) - 1

ans = 0
for i in range(2 ** N):
    equation = S[0]
    for j in range(N):
        if (i >> j) & 1:
            equation += "+" + S[j + 1]
        else:
            equation += S[j + 1]
    ans += sum(list(map(int, equation.split("+"))))

print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n=input()
q=len(n)
ans=0
for i in range(1,q):
    ans+=int(n[:i])+int(n[i:])
print(ans)

n=input()
q=len(n)
ans=int(n)
for i in range(1,q):
    ans+=int(n[:i])+int(n[i:])
print(ans)

n=input()
q=len(n)-1
ans=0
for i in range(1,q):
    ans+=int(n[:i])+int(n[i:])
print(ans)
  

S=[int(i) for i in input()]
ans=0
for x in range(1<<len(S)-1):
    a=S[0]
    for n in range(len(S)-1):
        if x>>n & 1:
            ans+=a
            a=0
        a = a * 10 + S[n+1]
    ans += a
print(ans)
            

Verdicts: Wrong Answer

Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
S = intinput()
n = len(S)
ans = 0
for i in range(2**(n-1)):
    s = S[0]
    for j in range(n-1):
        if (i >> j) & 1:
            s += '+'
        s += S[j+1]
    ans += eval(s)
print(ans)


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)
            
        
        
    
    


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)):
    x = A[i]
    p = 0
    q = 0
    for j in range(len(x)):
        if x[j] == '+':
            q = j - 1
            m = x[p:q]
            s += int(m)
            p = j + 1
        elif j == len(x):
            q = len(x)
            m = x[p:q]
            s += int(m)
print(s)
            
        
        
    
    

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

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


Verdicts: Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
S = input()
total = 0
for p in (product((0, 1), repeat=len(S)-1)):
    ns = S[0]
    for i, pp in enumerate(p, 1):
        if pp == 0:
            ns += S[i]
        else:
            total += int(ns)
            ns = S[i]
    total += int(ns)
print(total)




import sys
import numpy as np
import math
import collections
import copy
from collections import deque 
from functools import reduce
from itertools import product

# input = sys.stdin.readline
S = input()
total = 0
for p in (product((0, 1), repeat=len(S)-1)):
    ns = S[0]
    for i, pp in enumerate(p, 1):
        if pp == 0:
            ns += S[i]
        else:
            total += int(ns)
            ns = S[i]
    total += int(ns)
print(total)





Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys
input=sys.stdin.readline

s=input()
ans=0

for i in range(2 ** (len(s)-1)):
  bin_i = bin(i)[2:].rjust(len(s)-1,"0")
  li=[]
  n=s[0]
  
  for ix,sign in enumerate(bin_i):
    if sign=="0":
      n+=s[ix+1]
    else:
      li.append(int(n))
      n=s[ix+1]
  li.append(int(n))
  ans+=sum(li)

print(ans)

s=input()
ans=0

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

for i in range(2 ** (len(s)-1)):
  bin_i = bin(i)[2:].rjust(len(s)-1,"0")
  li=[]
  n=s[0]
  for ix,sign in enumerate(bin_i):
    if sign=="0":
      n+=s[ix+1]
    else:
      li.append(int(n))
      n=s[ix+1]
  li.append(int(n))
  ans+=sum(li)

print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)  

S = input()
len_S = len(S)-1
ans = 0
for s in range(1<<len_S):
  now = ""  
  now += S[0]  
  for i in range(len_S):    
    if s & (1<<i): 
      now += "+"
    now += S[i+1]    
  ans += eval(now)
print(ans)  

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s = input().split("")
sum = 0
for i in range(2 ** (len(s)-1)) :
  st = str(s[0])
  for j in range(len(s)-1) : 
    if ((i >> j) & 1) :
      st = st + "+" + str(s[j+1])
    else :
      st = st + str(s[j+1])
  
  for item in st.split('+') :
    sum += int(item)
print(sum)

s = list(input())
sum = 0
for i in range(2 ** (len(s)-1)):
  st = str(s[0])
  for j in range(len(s)-1):
    if (i >> j) & 1:
      st = st + "+" + str(s[j+1])
    else:
      st = st + str(s[j+1])
      
  for item in st.split('+') :
    sum += int(item)
print(sum)

Verdicts: Runtime Error

Accepted
Problem: 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.

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


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







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



Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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
s = input()
n = len(s)

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


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]))


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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])

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]))

s = input()
n = len(s)

def dfs(i, f):
    if i == n - 1:
        return eval(f)

    return dfs(i+1, f + s[i+1]) + \
                dfs(i+1, f + '+' + s[i+1])
print(dfs(0,s[0]))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s = input()
n = len(s-1)
total=0
for i in range(2**n):
  pl=['']*n
  ans=''
  for j in range(n):
    if ((i>>j)&1):
      pl[n-1-j] = '+'
  for k in range(n):
    ans += s[k]+pl[k]
  ans+=s[-1]
  total += eval(ans)

print(total)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
#import itertools
list1=[k for k in input()]
print(list1)
num1=len(list1)
print(num1)
list00=[format(int(k), 'b') for k in range(2**(num1-1))]
print(list00)

list0=['','+']

list01=[]
for count1 in range(num1):
  x=list00[count1]
  list01.extend(x)
print(list01)
total=0

for step1 in range(2):
  for step2 in range(2):
    list2=[list0[step2],list0[step1]]
    num = min(len(list1), len(list2))
    result = [None]*(num*2)
    result[::2] = list1[:num]
    result[1::2] = list2[:num]
    result.extend(list1[num:])
    result.extend(list2[num:])
    result1 = ''.join(result)
    print(result1)
    total+=eval(result1)

print(total)
#176

n=input()
anslist=[]

def saiki(n,x,a,k):
    if k==len(n):
        anslist.append(eval(x))
        return
    else:
        for i in a:
            y=x
            x=x+i+n[k]
            saiki(n,x,a,k+1)
            x=y       

saiki(n,n[0],['','+'],1)
print(sum(anslist))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
s = input()
sum = 0
for i in range(2**(len(s)-1)):
    term = 0
    for j in range(len(s)-1):
        term *= 10
        if (i//(2**j))%2 == 0:
            sum += term + int(s[j])
            term = 0
            if j == len(s)-2:
                sum += int(s[-1])
        else:
            term += int(s[j])
            if j == len(s)-2:
                sum += term*10 + int(s[-1])
if len(s) = 1:
    sum = int(s)

print(sum)

S = input()
op_cnt = len(S)-1
sum = 0
for i in range(2**op_cnt):
    op = [""] * op_cnt
    for j in range(op_cnt):
        if ((i>>j) & 1):
            op[j] = "+"
    formula = ""
    for p_n, p_o in zip(S, op + [""]):
        formula += (p_n + p_o)
    sum += eval(formula)
#    print(formula)
print(sum)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from collections import Counter
h, w, num = map(int, input().split())
lis = []
for i in range(num):
    k, j = map(lambda x: int(x) - 1,input().split())
    for a in range(3):
        for b in range(3):
            cou1 = k - a
            cou2 = j - b 
            if cou1 < 0 or cou1 > h - 3:
                continue
            if cou2 < 0 or cou2 > w - 3:
                continue
            lis.append((cou1, cou2))

lis = Counter(Counter(lis).values())

print((h - 2) * (w - 2) - sum(lis.values()))
for i in range(1, 10):print(lis[i])

n = str(input())
ans = 0
if int(n) < 10:
  print(int(n))
  exit()
for i in range(2 ** (len(n) -1)):
  num = format(i,"b").zfill(len(n)-1)
  lis = ""
  for j in range(len(str(num))):
    if str(num[j]) == "1":
      lis += (str(n[j])+"+")
    else:
      lis += str(n[j])
  lis += n[-1]
  li = lis.split("+")
  for h in range(len(li)):
    li[h] = int(li[h])
  ans += sum(li)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
s = input()

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

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

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

print(result)
  

s = input()

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

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

  result += int(s[current_address:])

print(result)

Verdicts: Wrong Answer

Accepted
Problem: 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.

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

s = input()
n = len(s)
ans = 0
for i in range(2 ** (n-1)):
    tmp = []
    for k in range(n-1):
        tmp.append(s[k])
        if i>>k & 1:
            tmp.append("+")
    tmp.append(s[-1])
    ans += eval("".join(tmp))
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
import sys
grid = []
painted = []

height, width, n = sys.stdin.readline().strip().split()
height, width, n = int(height), int(width), int(n)

def checkGrid(x, y, grid):
    count = 0
    for col in range(x, x+3):
        for row in range(y, y+3):
            if grid[row][col] == 1:
                count += 1
    return count

inp = sys.stdin.readline().strip()
while inp:
    a, b = inp.split()
    grid.append([int(a) - 1, int(b) - 1])
    inp = sys.stdin.readline().strip()

# Build empty grid
for i in range(height):
    painted.append([])
    for j in range(width):
        if [i, j] in grid:
            painted[i].append(1)
        else:
            painted[i].append(0)

# Build painted cells
for cell in grid:
    painted[cell[0]][cell[1]] = 1

for i in range(0, 10):
    count = 0
    for col in range(width - 2):
        for row in range(height - 2):
            if checkGrid(col, row, painted) == i:
                count += 1
    print(count)


import sys
perm = sys.stdin.readline().strip()
total = 0

# Add n * '+' to inp
def addPlus(inp, n):
    total = 0
    possible = [inp]
    orig = inp

    for i in range(1, len(orig)):
        possible.append(orig[:i] + '+' + perm[i:])

    for i in range(1, n):
        curr = possible[:]
        for item in curr:
            for j in range(1, len(item)):
                processed = item[:j] + '+' + item[j:]
                if processed not in possible:
                    if '++' not in processed:
                        possible.append(processed)

    for item in possible:
        total += eval(item)

    return total


print(addPlus(perm, len(perm) - 1))


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
# -*- coding: utf-8 -*-

import types
#import copy

# Input
abcd = input()
n = len(abcd) - 1 
sum_ = 0

# Print
for i in range( 2**n ):
    op = n * ["+"]

    
    # example: ['', '+', '']
    for j in range(n):
        if ( i >> j ) & 1:
            op[n-1 -j] = ""
            
    formula = ""
    for p_n, p_o in zip(abcd, op+[""]):
        formula += (p_n + p_o)
    print(formula)

    sum_ += eval(formula)

print(sum_)


# -*- coding: utf-8 -*-

import types
#import copy

# Input
abcd = input()
n = len(abcd) - 1 
sum_ = 0

# Print
for i in range( 2**n ):
    op = n * ["+"]

    
    # example: ['', '+', '']
    for j in range(n):
        if ( i >> j ) & 1:
            op[n-1 -j] = ""
            
    formula = ""
    for p_n, p_o in zip(abcd, op+[""]):
        formula += (p_n + p_o)
    #print(formula)

    sum_ += eval(formula)

print(sum_)


Verdicts: Wrong Answer

Accepted
Problem: 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.

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

Sin=input()
S=[int(Sin[i]) for i in range(len(Sin))]
#print(S)
def sums(a):
  n=len(a)
  if n==1:
    return a[0]
  else:
    s=0
    for i in range(n):
      s+=10**(n-i-1)*a[i]
    
    for i in range(n-1):
      t=0
      b=a[i+1:]
      c=a[:i+1]
      for j in range(i+1):
        t+=(10**(i-j))*c[j]
      n2=len(b)-1
      s+=t*(2**n2)+sums(b)
      
    return s
  
print(sums(S))

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s=input()
def solve(decided, left, idx):
    if idx==len(s):
        return decided+left
    
    ret1 = solve(decided+left,int(s[idx]),idx+1)
    
    ret2 = solve(decided, left*10int(s[idx]), idx+1)
    return ret1+ret2
print(solve(0,int(s[0]),1))

s=input()
ret=0

for i in range(1<<(len(s)-1)):
    t=list(s)
    
    for j in reversed(range(1, len(s))):
        if i&(1<<(j-1)):
            t=t[:j]+["+"]+t[j:]
    ret+=eval("".join(t))
print(ret)

Verdicts: Runtime Error

Accepted
Problem: 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.

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

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

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

n = input()

sumP = 0

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

    middle_index = 0

    for pos in plus:
        sumP += int(n[middle_index:pos + 1])       
        middle_index = pos + 1
    sumP += int(n[middle_index:])                  

print(sumP)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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]))

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]))

S = input()
rt = 0
for l in range(1,len(S)+1):
  for i in range(len(S)-l+1):
    tmp = 1 if i == 0 or i+l==len(S) else 2
    tw = 2**(0 if len(S)-l-tmp<0 else len(S)-l-tmp)
    rt+=tw*int(S[i:i+l])

print(rt)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
result = 0
def BT(k, current, s):
    global result
    if k >= len(a)-1 :
        if current == 0 :
            result += s
        print(k,current,s,result)
    else :
        BT(k+1, int(a[k+1]), s+current)
        BT(k+1, current* 10 + int(a[k+1]), s)

a = input()+'0'
BT(0,int(a[0]),0)
print(result)


result = 0
def BT(k, current, s):
    global result
    if k == len(a) :
        if current == 0 :
            result += s
    else :
        BT(k+1, int(a[k]), s+current)
        BT(k+1, current* 10 + int(a[k]), s)

a = input()+'0'
BT(1,int(a[0]),0)
print(result)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
def dfs(splitted: "the list of integer", a: int, b: int, depth: int) -> int:
  if len(splitted) == depth:
    return a + b
  else:
    
    
    return dfs(splitted, a, b * 10, depth + 1) + dfs(s, a + b, splitted[i], depth + 1)

s = [int(x) for x in input()]
print(dfs(s, 0, 0, 0))

def dfs(splitted: "the list of integer", a: int, b: int, depth: int) -> int:
  if len(splitted) == depth:
    return a + b
  else:
    
    
    return dfs(splitted, a, b * 10, depth + 1) + dfs(s, a + b, splitted[i], depth + 1)

s = [int(x) for x in input()]
print(dfs(s, 0, 0, 0))

def dfs(splitted: "the list of integer", a: int, b: int, depth: int) -> int:
  if len(splitted) == depth:
    return a + b
  else:
    
    
    return dfs(splitted, a, b * 10, depth + 1) + dfs(splitted, a + b, splitted[i], depth + 1)

s = [int(x) for x in input()]
print(dfs(s, 0, 0, 0))

def dfs(splitted: "the list of integer", a: int, b: int, depth: int) -> int:
  if len(splitted) == depth:
    return a + b
  else:
    
    
    return dfs(splitted, a, b * 10, depth + 1) + dfs(splitted, a + b, splitted[depth], depth + 1)

s = [int(x) for x in input()]
print(dfs(s, 0, 0, 0))

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
s = input()

max_plus = len(s) - 1

numList = [int(c) for c in s]

sMax = (1 << max_plus) - 1

ans = 0

for plus_pos in range(sMax + 1):
    sum = 0

    num = numList[0]

    for i in range(max_plus):
        if ((plus_pos >> i) & 1) == 1:
            sum += num
            num = numList[i + 1]
        else:
            num = num * 10 + numList[i + 1]

    sum += num
    ans += sum

print(ans)s = input()

max_plus = len(s) - 1

numList = [int(c) for c in s]

sMax = (1 << max_plus) - 1

ans = 0

for plus_pos in range(sMax + 1):
    sum = 0

    num = numList[0]

    for i in range(max_plus):
        if ((plus_pos >> i) & 1) == 1:
            sum += num
            num = numList[i + 1]
        else:
            num = num * 10 + numList[i + 1]

    sum += num
    ans += sum

print(ans)

s = input()

max_plus = len(s) - 1

numList = [int(c) for c in s]

sMax = (1 << max_plus) - 1

ans = 0

for plus_pos in range(sMax + 1):
    sum = 0

    num = numList[0]

    for i in range(max_plus):
        if ((plus_pos >> i) & 1) == 1:
            sum += num
            num = numList[i + 1]
        else:
            num = num * 10 + numList[i + 1]

    sum += num
    ans += sum

print(ans)


Verdicts: Runtime Error

Accepted
Problem: 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.

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


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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
S = input()
power = len(S)-1
loop = 2**power

revS = list(reversed(S))
ans = 0

for i in range(loop):
    ans += int(revS[0])
    multi_ten = 10
    for j in range(power):
        digit = bin(i>>j)[-1]
        if digit == "0":
            ans += int(revS[j+1])*multi_ten
            multi_ten *= 10
        else:
            ans += int(revS[j+1])
            multi_ten = 10

S = input()
power = len(S)-1
loop = 2**power

revS = list(reversed(S))
ans = 0

for i in range(loop):
    ans += int(revS[0])
    multi_ten = 10
    for j in range(power):
        digit = bin(i>>j)[-1]
        if digit == "0":
            ans += int(revS[j+1])*multi_ten
            multi_ten *= 10
        else:
            ans += int(revS[j+1])
            multi_ten = 10
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
s = input()
n = len(s)


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

s = input()
n = len(s)


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

s = input()
n = len(s)

def dfs(i,t):
  if i == n-1:
    return sum(list(map(int,t.split(chr(43)))))
  return dfs(i+1,t+s[i+1]) + dfs(i+1,t+chr(43)+s[i+1])

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from collections import defaultdict
H, W, N = map(int, input().split())
poss = [list(map(int, input().split())) for _ in range(N)]
d = defaultdict(int)
for a, b in poss:
    for i, j in ((i, j) for i in range(a-1, a+2) for j in range(b-1, b+2)):
        if 1<i<H and 1<j<W:
            s = str(i)+":"+str(j)
            d[s] += 1
anss = [0] * 10
for x in d.values():
    anss[x] += 1
print((H-2)*(W-2) - sum(anss[1:]))
for ans in anss[1:]:
    print(ans)

s = input()
ans = 0
l = len(s)-1
for i in range(2**(len(s)-1)):
    bs = ("{0:0>"+str(l)+"b}").format(i)
    s1 = 0
    temp = s[:]
    j = 0
    for b in bs:
        j+=1
        if b == '1':
            s1 += int(temp[:j])
            temp = temp[j:]
            j = 0
    s1 += int(temp)
    ans += s1
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
def search(s):
    if len(s) <= 1:
        return eval(s[0])
    return search([s[0]+s[1]]+s[2:]) + search([s[0]+'+'+s[1]]+s[2:])
print(search(input()))

def pt(s: list):
    if len(s) = 1:
        return eval(s[0])
    return pt([s[0]+s[1]]+s[2:]) + pt([s[0]+'+'+s[1]]+s[2:])
print(pt(list((input()))))

def pt(s: list):
    if len(s) == 1:
        return eval(s[0])
    return pt([s[0]+s[1]]+s[2:]) + pt([s[0]+'+'+s[1]]+s[2:])
print(pt(list((input()))))

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from sys import stdin

a = stdin.readline().rstrip()
print(a.upper())
print(output)

input = input()
output = 0
print(output)

x = str(input())
ans = 0

for i in range(1 << len(x)-1):
  print(bin(i))
  tmp = 0
  for j in range(0, len(x)-1):
    if (i>>j&1 == 0):
      continue;
    else:
      ans += int(x[tmp:j+1])
      # print(x[tmp:j+1])
      tmp = j+1
  ans += int(x[tmp:])

print(ans)

x = input()
output = x
print(output)

x = input()
output = x
print(output)

x = str(input())
ans = 0

for i in range(1 << len(x)-1):
    print(bin(i))
    tmp = 0
    for j in range(0, len(x)-1):
        if (i>>j&1 == 0):
            continue;
        else:
            ans += int(x[tmp:j+1])
            tmp = j+1
    ans += int(x[tmp:])

print(ans)

x = str(input())
ans = 0

for i in range(2**len(x)-1):
  tmp = x[0]
  for j in range(0, len(x)-1):
    if (i>>j&1==0):
      tmp += x[j+1]
    else:
      ans += int(tmp)
      tmp = x[j+1]
  ans += int(tmp)

print(ans)


s = input()
n = 0
ans = 0
for n in range( 1 << len(s) -1):
    p = 0
    for i in range(len(s) - 1):
        if n & (1 << i):
            ans += int(s[p:i + 1])
            p = i + 1
    if p < len(s):
        ans += int(s[p:])
print(ans)

Verdicts: Runtime Error

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Wrong Answer

Accepted