Problem p03326 (python)

Fixed submission:
N,M=map(int,input().split())
cakes=[]
for i in range(N):
  x,y,z=map(int,input().split())
  cakes.append([x,y,z])
if M==0:
  print(0)
  quit()
score=[0]*8
score[0]=sum(sorted(map(lambda c: c[0]+c[1]+c[2], cakes))[-M:])
score[1]=sum(sorted(map(lambda c: c[0]+c[1]-c[2], cakes))[-M:])
score[2]=sum(sorted(map(lambda c: c[0]-c[1]+c[2], cakes))[-M:])
score[3]=sum(sorted(map(lambda c: c[0]-c[1]-c[2], cakes))[-M:])
score[4]=sum(sorted(map(lambda c:-c[0]+c[1]+c[2], cakes))[-M:])
score[5]=sum(sorted(map(lambda c:-c[0]+c[1]-c[2], cakes))[-M:])
score[6]=sum(sorted(map(lambda c:-c[0]-c[1]+c[2], cakes))[-M:])
score[7]=sum(sorted(map(lambda c:-c[0]-c[1]-c[2], cakes))[-M:])
print(max(score))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
cakes=[]
for i in range(N):
  x,y,z=map(int,input().split())
  cakes.append([x,y,z])
score=[0]*8
c=sorted(map(lambda c: [ c[0]+c[1]+c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[0]=sum(list(map(abs,map(sum,zip(*c))))[1:])
c=sorted(map(lambda c: [ c[0]+c[1]-c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[1]=sum(list(map(abs,map(sum,zip(*c))))[1:])
c=sorted(map(lambda c: [ c[0]-c[1]+c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[2]=sum(list(map(abs,map(sum,zip(*c))))[1:])
c=sorted(map(lambda c: [ c[0]-c[1]-c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[3]=sum(list(map(abs,map(sum,zip(*c))))[1:])
c=sorted(map(lambda c: [-c[0]+c[1]+c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[4]=sum(list(map(abs,map(sum,zip(*c))))[1:])
c=sorted(map(lambda c: [-c[0]+c[1]-c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[5]=sum(list(map(abs,map(sum,zip(*c))))[1:])
c=sorted(map(lambda c: [-c[0]-c[1]+c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[6]=sum(list(map(abs,map(sum,zip(*c))))[1:])
c=sorted(map(lambda c: [-c[0]-c[1]-c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[7]=sum(list(map(abs,map(sum,zip(*c))))[1:])
print(max(score))

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
cakes=[]
for i in range(N):
  x,y,z=map(int,input().split())
  cakes.append([x,y,z])
score=[0]*8
c=sorted(map(lambda c: [ c[0]+c[1]+c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[0]=sum(list(map(abs,map(sum,zip(*c))))[1:])
c=sorted(map(lambda c: [ c[0]+c[1]-c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[1]=sum(list(map(abs,map(sum,zip(*c))))[1:])
c=sorted(map(lambda c: [ c[0]-c[1]+c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[2]=sum(list(map(abs,map(sum,zip(*c))))[1:])
c=sorted(map(lambda c: [ c[0]-c[1]-c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[3]=sum(list(map(abs,map(sum,zip(*c))))[1:])
c=sorted(map(lambda c: [-c[0]+c[1]+c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[4]=sum(list(map(abs,map(sum,zip(*c))))[1:])
c=sorted(map(lambda c: [-c[0]+c[1]-c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[5]=sum(list(map(abs,map(sum,zip(*c))))[1:])
c=sorted(map(lambda c: [-c[0]-c[1]+c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[6]=sum(list(map(abs,map(sum,zip(*c))))[1:])
c=sorted(map(lambda c: [-c[0]-c[1]-c[2],*c], cakes),key=lambda c: c[0])[-M:]
score[7]=sum(list(map(abs,map(sum,zip(*c))))[1:])
#print(list(map(sum,zip(*c))))
#print(list(map(sum,zip(*c)))[1:])
print(max(score))