Problem p03545 (python)

Fixed submission:
def dfs(i, Str, res):
    if i==3:
        if res==7:
            print(Str+"=7")
            exit()
        return
    
    dfs(i+1,Str+"+"+s[i+1],res+int(s[i+1]))
    dfs(i+1,Str+"-"+s[i+1],res-int(s[i+1]))

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

Buggy submission (verdict: Runtime Error):
def a(t,i):
    if i==l:
        if eval(t)==7:
            print(t+'=7')
            exit()
    a(t+'+'+s[i+1],i+1)
    a(t+'-'+s[i+1],i+1)

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

Buggy submission (verdict: Runtime Error):
def a(t,i):
    if i==l and eval(t)==7:
        print(t+'=7')
        exit()
    a(t+'+'+s[i+1],i+1)
    a(t+'-'+s[i+1],i+1)

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

Buggy submission (verdict: Runtime Error):
def a(t,i):
    if i==l and eval(t)==7:
        print(t+'=7')
        exit()
    a(t+'+'+s[i+1],i+1)
    a(t+'-'+s[i+1],i+1)

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

Buggy submission (verdict: Runtime Error):
#変数: S, num, formula
    
S = input()
num = len(S) - 1

for i in range(2**num):
    op=["-"]*num
    for j in range(num):
        if (i>>j)&1:
            op[num-j-1]="+"
            
    formula=""
    for op_S,op_num in zip(S,num+[""]):
        formula += op_S + op_num

    if eval(formula)==7:
        print(formula+"=7")
        break

Buggy submission (verdict: Runtime Error):
S = input()
num = len(S) - 1

for i in range(2**num):
    op=["-"]
    for j in range(num):
        if (i>>j)&1:
            op[num-j-1]="+"
            
    formula=""
    for op_S,op_num in zip(S,num+[""]):
        formula += op_S + op_num

    if eval(formula)==7:
        print(formula+"=7")
        break

Buggy submission (verdict: Runtime Error):
def a(t,i):
    if i = l - 1:
        if eval(t)==7:
            print(t+"=7")
            exit()
        return
    a(t+"+"+N[i+1],i+1)
    a(t+"-"+N[i+1],i+1)

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

Buggy submission (verdict: Runtime Error):
def a(t,i):
    if i = l - 1:
        if eval(t==7):
            print(t+"=7")
            exit()
        return
    a(t+"+"+N[i+1],i+1)
    a(t+"-"+N[i+1],i+1)

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

Buggy submission (verdict: Runtime Error):
n = input()
l = len(n)

for i in range(2**l):
    op=["-"]*l
    for j in range(l):
        if (i>>j)&1:
            op[l - j - 1] = "+" #なぜ i - j - 1 ではなく、l - j - 1なのか、決まっている数から引いたものが知りたい
    formula = ""
    for op1,op2 in zip(n,op+[""]): #式の文字列を作るループ
        formula += op1 + op2
    if eval(formula)==7:
        print(formula + "=7")
        break

Buggy submission (verdict: Runtime Error):
n = input()
l = len(n)

for i in range(2**l):
    op=["-"]*l
    for j in range(l):
        if (i>>j)&1:
            op[l - j - 1] = "+" #なぜ i - j - 1 ではなく、l - j - 1なのか、決まっている数から引いたものが知りたい
    formula = ""
    for op1,op2 in zip(n,op): #式の文字列を作るループ
        formula += op1 + op2
    if eval(formula)==7:
        print(formula + "=7")
        break

Buggy submission (verdict: Runtime Error):
n = input()
l = len(n)-1

for i in range(2**l):
    op = ["-"]*l
    for j in range(l):
        if (i>>j) &1:
            op[i-j-1]="+"

    formula = ""
    for op_num,op_l in zip(n,op+[""]):
        formula += op_num + op_l
    if eval(formula)==7:
        print(formula+"=7")
        break

Buggy submission (verdict: Runtime Error):

n = input()
l = len(n)-1

for i in range(2**l):
    op = ["-"]*l
    for j in range(l):
        if (i>>j) &1:
            op[i-j-1]="+"
    formula = ""
    for op_num,op_l in zip(n,op+[""]):
        formula += op_num+op_l
    if eval(formula)==7:
       print(formula+"=7")
       break

Buggy submission (verdict: Runtime Error):

n = input()
l = len(n)-1

for i in range(2**l):
    op = ["-"]*l
    for j in range(l):
        if (i>>j) &1:
            op[i-j-1]="+"
    formula = ""
    for op_num,op_l in zip(n,op+[""]):
        formula += op_num+op_l
        if eval(formula)==7:
            print(formula+"=7")
            break

Buggy submission (verdict: Runtime Error):

n = input()
l = len(n)-1

for i in range(2**l):
    op = ["-"]*l
    for j in range(l):
        if (i>>j) &1:
            op[i-j-1]="+"
    formula = ""
    for op_num,op_l in zip(n,op+""):
        formula += op_num + op_l
        if eval(formula)==7:
            print(formula+"=7")
            break

Buggy submission (verdict: Runtime Error):

n = input()
l = len(n)-1

for i in range(2**l):
    op = ["-"]*l
    for j in range(l):
        if (i>>j) &1:
            op[i-j-1]="+"
    formula = ""
    for op_num,op_l in zip(n,op):
        formula += op_num+op_l
        if eval(formula)==7:
            print(formula+"=7")
            break

Buggy submission (verdict: Runtime Error):

n = input()
l = len(n)-1

for i in range(2**l):
    op = ["-"]*l
    for j in range(l):
        if (i>>j) &1:
            op[i-j-1]="+"
    formula = ""
    for op_num,op_l in zip(n,op):
        formula = op_num+op_l
        if eval(formula)==7:
            print(formula+"=7")
            break

Buggy submission (verdict: Runtime Error):

def a(s,i):
    if i = l-1:
        if eval(s)==7:
            print(s+"=7")
            exit()
        return
    a(s+"+"+N[i+1],i+1)
    a(s+"-"+N[i+1],i+1)

N = input()
l = len(N)

a(N[0],0)

Buggy submission (verdict: Runtime Error):
def a(s,i):
    if i = l-1:
        if eval(s)==7:
            return s+"=7"
        return
    a(s+"+"+N[i+1],i+1)
    a(s+"-"+N[i+1],i+1)

N = input()
l = len(N)

print(a(N[0],0))

Buggy submission (verdict: Runtime Error):

def a(s,i):
    if i = l-1:
        if eval(s)==7:
            print(s+"=7")
            exit()
        return
    a(s+"+"+N[i],i+1)
    a(s+"-"+N[i],i+1)

N = input()
l = len(N)

a(N[0],0)

Buggy submission (verdict: Runtime Error):

def a(s,i):
    if i = l-1:
        if eval(s)==7:
            return s+"=7"
        return
    a(s+"+"+N[i],i+1)
    a(s+"-"+N[i],i+1)

N = input()
l = len(N)


print(a(N[0],0)

Buggy submission (verdict: Runtime Error):

def a(s,i):
    if i = l-1:
        if eval(s)==7:
            return s
    return a(s+"+"+N[i],i+1) + a(s+"-"+N[i],i+1)

N = input()
l = len(N)

print(a(N[0],0) + "=7")

Buggy submission (verdict: Runtime Error):

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

for i in range(2**num):
    l = ['-']*num
    for j in range(num):
        if(i>>j)&1:
            l[num-j-1] = ['+']

    formula=""
    for l_num,l_m in zip(S,l+[""]):
        formula = l_num+l_m

    if eval(formula)==7:
        print(formula+'=7')
        break

Buggy submission (verdict: Runtime Error):
def dfs(i,Str,res):
    if i==num-1:
        if res==7:
            print(Str+"=7")
            exit()
        return
    dfs(i+1,Str+"+"+S[i+1],res+int(S[i+1]))
    dfs(i+1,Str+"-"+S[i+1],res-int(S[i+1]))    

S=input()
num=len(n)
dfs(0,S[0],int(S[0]))

Buggy submission (verdict: Runtime Error):
n=input()
num=len(n)-1

for i in range(2**num):
    l=['-']*num
    for j in range(num):
        if (i >> j) & 1:
            l[num-1-j]='+'

    formula=""
    for l_num, l_m in zip(n,l+[""]):
        formula += l_num + l_m
    
    if eval(formula)==7:
        print(formula"=7")
        break

Buggy submission (verdict: Runtime Error):
n=input()
num=len(n)-1

for i in range(2**num):
    l=['-']*num
    for j in range(num):
        if (i >> j) & 1:
            l[num-1-j]='+'

    formula=""
    for l_num, l_m in zip(n,l+""):
        formula += l_num + l_m
    
    if eval(formula)==7:
        print(formula"=7")
        break

Buggy submission (verdict: Runtime Error):
n=input()
num=len(n)-1

for i in range(2**num):
    l=['-']*num
    for j in range(num):
        if (i >> j) & 1:
            l[num-1-j]='+'

    formula=""
    for l_num, l_m in zip(n,l+""):
        formula += l_num + l_m
    
    if eval(formula)==7
        print(formula"=7")
        break

Buggy submission (verdict: Runtime Error):
def dfs(i,s,res):
    if i==3:
        if res == 7:
            print(s+"=7")
          	exit()
        return
    dfs(i+1,s+'+'+S[i+1],res+int(S[i+1]))
    dfs(i+1,s+'-'+S[i+1],res-int(S[i+1]))

S=input()
dfs(0,S[0],int(S[0]))

Buggy submission (verdict: Runtime Error):
def dfs(i,s,res):
    if i==3:
        if res == 7:
            print(s+"=7")
          	exit()
        return
    dfs(i+1,s+'+'+S[i+1],res+int(S[i+1]))
    dfs(i+1,s+'-'+S[i+1],res-int(S[i+1]))

S=input()
dfs(0,S[0],int(S[0]))

Buggy submission (verdict: Runtime Error):
def dfs(i,s,res):
    if i==3:
        if res == 7:
            return s
        elif:
            exit()
    dfs(i+1,s+'+'+S[i+1],res+int(S[i+1]))
    dfs(i+1,s+'-'+S[i+1],res-int(S[i+1]))

S=input()
print(dfs(0,S[0],int(S[0]))+"=7")

Buggy submission (verdict: Runtime Error):
def dfs(i,s,res):
    if i==3:
        if res == 7:
            print(s+"=7")
     		return
          	exit()
         
    dfs(i+1,s+'+'+S[i+1],res+int(S[i+1]))
    dfs(i+1,s+'-'+S[i+1],res-int(S[i+1]))

S=input()
dfs(0,S[0],int(S[0]))

Buggy submission (verdict: Runtime Error):
def dfs(i,s,res):
    if i==3:
        if res == 7:
            return s
    dfs(i+1,s+'+'+S[i+1],res+int(S[i+1]))
    dfs(i+1,s+'-'+S[i+1],res-int(S[i+1]))

S=input()
print(dfs(0,S[0],int(S[0]))+"=7")

Buggy submission (verdict: Runtime Error):
def dfs(i,s,res):
    if i==2:
        if res == 7:
            return s
    dfs(i+1,s+'+'+S[i+1],res+int(S[i+1]))
    dfs(i+1,s+'-'+S[i+1],res-int(S[i+1]))

S=input()
print(dfs(0,S[0],int(S[0]))+"=7")

Buggy submission (verdict: Runtime Error):
def dfs(i,s,res):
    if i==2:
        if res == 7:
            return s
    dfs(i+1,s+'+'+S[i+1],res+int(S[i+1]))
    dfs(i+1,s+'-'+S[i+1],res-int(S[i+1]))

S=input()
print(dfs(0,S[0],int(S[0])))

Buggy submission (verdict: Runtime Error):
n = [int(x) for x in input()]
op_cnt = len(n) - 1
for i in range(2 ** op_cnt):
    op = ["-"] * op_cnt
    for j in range(op_cnt):
        if((i >> j) & 1):
            op[op_cnt - 1 - j] = "+"

    formula=""
    for p_n, p_o in zip(n, op + [""]):
        formula += (p_n + p_o)

    if eval(formula)==7:
        print(formula+"=7")
        break