Problem p03545 (python)

Fixed submission:
import sys
S=input()
a,b,c,d=S[0],S[1],S[2],S[3]
lst=['+','-']
for i in lst:
  for j in lst:
    for k in lst:
      if eval(a+i+b+j+c+k+d+'==7'):
        print(a+i+b+j+c+k+d+'=7')
        sys.exit()

Buggy submission (verdict: Runtime Error):
import sys
s=input()
a,b,c,d=int(s[0]),int(s[1]),int(s[2]),int(s[3])
if a+b+c+d==7:
  a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'+'+b+'+'+c'+'+d+'=7')
  sys.exit()
if a+b+c-d==7:
  a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'+'+b+'+'+c'-'+d+'=7')
  sys.exit()
if a+b-c+d==7:
   a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'+'+b+'-'+c'+'+d+'=7')
  sys.exit()
if a-b+c+d==7:
  a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'-'+b+'+'+c'+'+d+'=7')
  sys.exit()
if a+b-c-d==7:
  a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'+'+b+'-'+c'-'+d+'=7')
  sys.exit()
if a-b-c+d==7:
  a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'-'+b+'-'+c'+'+d+'=7')
  sys.exit()
if a-b+c-d==7:
  a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'-'+b+'+'+c'-'+d+'=7')
  sys.exit()
if a-b-c-d==7:
  a,b,c,d=str(a),str(b),str(c),str(d)
  print(a+'-'+b+'-'+c'-'+d+'=7')
  sys.exit()

Buggy submission (verdict: Runtime Error):
import sys
s=input()
a,b,c,d=s[0],s[1],s[2],s[3]
if a+b+c+d==7:
  print('a+b+c+d=7')
  sys.exit()
if a+b+c-d==7:
  print('a+b+c-d=7')
  sys.exit()
if a+b-c+d==7:
  print('a+b-c+d=7')
  sys.exit()      
if a-b+c+d==7:
  print('a-b+c+d=7')
  sys.exit()
if a+b-c-d==7:
  print('a+b-c-d=7')
  sys.exit()
if a-b-c+d==7:
  print('a-b-c+d=7')
  sys.exit()
if a-b+c-d==7:
  print('a-b+c-d=7')
  sys.exit()
if a-b-c-d==7:
  print('a-b-c-d=7')
  sys.exit()

Buggy submission (verdict: Runtime Error):
import sys
a,b,c,d=map(int,input().split())
if a+b+c+d==7:
  print('a+b+c+d=7')
  sys.exit()
if a+b+c-d==7:
  print('a+b+c-d=7')
  sys.exit()
if a+b-c+d==7:
  print('a+b-c+d=7')
  sys.exit()      
if a-b+c+d==7:
  print('a-b+c+d=7')
  sys.exit()
if a+b-c-d==7:
  print('a+b-c-d=7')
  sys.exit()
if a-b-c+d==7:
  print('a-b-c+d=7')
  sys.exit()
if a-b+c-d==7:
  print('a-b+c-d=7')
  sys.exit()
if a-b-c-d==7:
  print('a-b-c-d=7')
  sys.exit()

Buggy submission (verdict: Runtime Error):
import sys
a,b,c,d=int,input().split()
if a+b+c+d==7:
  print('a+b+c+d=7')
  sys.exit()
if a+b+c-d==7:
  print('a+b+c-d=7')
  sys.exit()
if a+b-c+d==7:
  print('a+b-c+d=7')
  sys.exit()      
if a-b+c+d==7:
  print('a-b+c+d=7')
  sys.exit()
if a+b-c-d==7:
  print('a+b-c-d=7')
  sys.exit()
if a-b-c+d==7:
  print('a-b-c+d=7')
  sys.exit()
if a-b+c-d==7:
  print('a-b+c-d=7')
  sys.exit()
if a-b-c-d==7:
  print('a-b-c-d=7')
  sys.exit()

Buggy submission (verdict: Runtime Error):
s=input()

for i in range(4):
  s[i]=int(s[i])

if s[0]+s[1]+s[2]+s[3]==7:
  print('s[0]+s[1]+s[2]+s[3]=7')
if s[0]+s[1]+s[2]-s[3]==7:
  print('s[0]+s[1]+s[2]-s[3]=7')
if s[0]+s[1]-s[2]+s[3]==7:
  print('s[0]+s[1]-s[2]+s[3]=7')
if s[0]-s[1]+s[2]+s[3]==7:
  print('s[0]-s[1]+s[2]+s[3]=7')
if s[0]-s[1]+s[2]-s[3]==7:
  print('s[0]-s[1]+s[2]-s[3]=7')
if s[0]-s[1]-s[2]+s[3]==7:
  print('s[0]-s[1]-s[2]+s[3]=7')
if s[0]+s[1]-s[2]-s[3]==7:
  print('s[0]+s[1]-s[2]-s[3]=7')
if s[0]-s[1]-s[2]-s[3]==7:
  print('s[0]-s[1]-s[2]-s[3]=7')

Buggy submission (verdict: Runtime Error):
s=list(input())
for i in range(4):
  s[i]=int(s[i])

if s[0]+s[1]+s[2]+s[3]==7:
  print(s[0]+s[1]+s[2]+s[3]=7)
if s[0]+s[1]+s[2]-s[3]==7:
  print(s[0]+s[1]+s[2]-s[3]=7)
if s[0]+s[1]-s[2]+s[3]==7:
  print(s[0]+s[1]-s[2]+s[3]=7)
if s[0]-s[1]+s[2]+s[3]==7:
  print(s[0]-s[1]+s[2]+s[3]=7)
if s[0]-s[1]+s[2]-s[3]==7:
  print(s[0]-s[1]+s[2]-s[3]=7)
if s[0]-s[1]-s[2]+s[3]==7:
  print(s[0]-s[1]-s[2]+s[3]=7)
if s[0]+s[1]-s[2]-s[3]==7:
  print(s[0]+s[1]-s[2]-s[3]=7)
if s[0]-s[1]-s[2]-s[3]==7:
  print(s[0]-s[1]-s[2]-s[3]=7)

Buggy submission (verdict: Runtime Error):
s=list(input())
for i in s:
  i=int(i)

if s[0]+s[1]+s[2]+s[3]==7:
  print('s[0]+s[1]+s[2]+s[3]=7')
if s[0]+s[1]+s[2]-s[3]==7:
  print('s[0]+s[1]+s[2]-s[3]=7')
if s[0]+s[1]-s[2]+s[3]==7:
  print('s[0]+s[1]-s[2]+s[3]=7')
if s[0]-s[1]+s[2]+s[3]==7:
  print('s[0]-s[1]+s[2]+s[3]=7')
if s[0]-s[1]+s[2]-s[3]==7:
  print('s[0]-s[1]+s[2]-s[3]=7')
if s[0]-s[1]-s[2]+s[3]==7:
  print('s[0]-s[1]-s[2]+s[3]=7')
if s[0]+s[1]-s[2]-s[3]==7:
  print('s[0]+s[1]-s[2]-s[3]=7')
if s[0]-s[1]-s[2]-s[3]==7:
  print('s[0]-s[1]-s[2]-s[3]=7')

Buggy submission (verdict: Runtime Error):
n=input().split()
a=int(n[0][0])
b=int(n[0][1])
c=int(n[0][2])
d=int(n[0][3])
if a+b+c+d==7:
  print(a+b+c+d=7)
if a+b+c-d==7:
  print(a+b+c-d=7)
if a+b-c+d==7:
  print(a+b-c+d=7)
if a-b+c+d==7:
  print(a-b+c+d=7)
if a+b-c-d==7:
  print(a+b-c-d=7)
if a-b+c-d==7:
  print(a-b+c-d=7)
if a-b-c+d==7:
  print(a-b-c+d=7)
if a-b-c-d==7:
  print(a-b-c-d=7)

Buggy submission (verdict: Runtime Error):
n=input().split()
a=int(n[0])
b=int(n[1])
c=int(n[2])
d=int(n[3])
if a+b+c+d==7:
  print('a+b+c+d=7')
if a+b+c-d==7:
  print('a+b+c-d=7')
if a+b-c+d==7:
  print('a+b-c+d=7')
if a-b+c+d==7:
  print('a-b+c+d=7')
if a+b-c-d==7:
  print('a+b-c-d=7')
if a-b+c-d==7:
  print('a-b+c-d=7')
if a-b-c+d==7:
  print('a-b-c+d=7')
if a-b-c-d==7:
  print('a-b-c-d=7')

Buggy submission (verdict: Runtime Error):
n=input()
a=int(n[0])
b=int(n[1])
c=int(n[2])
d=int(n[3])
if a+b+c+d==7:
  print(a+b+c+d=7)
if a+b+c-d==7:
  print(a+b+c-d)
if a+b-c+d==7:
  print(a+b-c+d)
if a-b+c+d==7:
  print(a-b+c+d)
if a+b-c-d==7:
  print(a+b-c-d)
if a-b+c-d==7:
  print(a-b+c-d)
if a-b-c+d==7:
  print(a-b-c+d)
if a-b-c-d==7:
  print(a-b-c-d)

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
if a+b+c+d==7:
  print(a+b+c+d=7)
if a+b+c-d==7:
  print(a+b+c-d)
if a+b-c+d==7:
  print(a+b-c+d)
if a-b+c+d==7:
  print(a-b+c+d)
if a+b-c-d==7:
  print(a+b-c-d)
if a-b+c-d==7:
  print(a-b+c-d)
if a-b-c+d==7:
  print(a-b-c+d)
if a-b-c-d==7:
  print(a-b-c-d)