Buggy python submission (verdict: Runtime Error):
import copy
n,m = map(int,input().split())

#取得
scores = list()
for i in range(n):
    score = list(map(int,input().split()))
    scores.append(score)

smax=None
for p in range(8):
    x=math.floor((p/4)%2)
    y=math.floor((p/2)%2)
    z=math.floor((p/1)%2)
    
    scores_=copy.deepcopy(scores)
    sumlist=list()

    for i in range(n):
        scores_[i][0] = pow(-1,x)*scores[i][0]
        scores_[i][1] = pow(-1,y)*scores[i][1]
        scores_[i][2] = pow(-1,z)*scores[i][2]
        sumlist.append(sum(scores_[i]))
    sumlist.sort()
    
    tmp=0
    for eat in range(m):
        tmp+=sumlist[-1]
        sumlist.pop()
    if smax==None or tmp>smax:
        smax=tmp
print(smax)

Fixed submission:
import copy
n,m = map(int,input().split())

#取得
scores = list()
for i in range(n):
    score = list(map(int,input().split()))
    scores.append(score)

smax=None
for x in range(2):
    scores_=copy.deepcopy(scores)
    
    for i in range(n):
        scores_[i][0] = pow(-1,x)*scores[i][0]
    for y in range(2):
        for i in range(n):
            scores_[i][1] = pow(-1,y)*scores[i][1]
        for z in range(2):
            for i in range(n):
                scores_[i][2] = pow(-1,z)*scores[i][2]
        
            sumlist=list()
            for i in range(n):
                sumlist.append(sum(scores_[i]))
            sumlist.sort()
            
            tmp=0
            for eat in range(m):
                tmp+=sumlist[-1]
                sumlist.pop()
            if smax==None or tmp>smax:
                smax=tmp
print(smax)

Buggy python submission (verdict: Runtime Error):
n=5
m=3
scores=[[1, -2, 3],
[-4, 5, -6],
[7, -8, -9],
[-10, 11, -12],
[13, -14, 15]]

smax=None
for x in range(2):
    scores_=copy.deepcopy(scores)
    
    for i in range(n):
        scores_[i][0] = pow(-1,x)*scores[i][0]
    for y in range(2):
        for i in range(n):
            scores_[i][1] = pow(-1,y)*scores[i][1]
        for z in range(2):
            for i in range(n):
                scores_[i][2] = pow(-1,z)*scores[i][2]
        
            sumlist=list()
            for i in range(n):
                sumlist.append(sum(scores_[i]))
            sumlist.sort()
            
            tmp=0
            for eat in range(m):
                tmp+=sumlist[-1]
                sumlist.pop()
            if smax==None or tmp>smax:
                smax=tmp
print(smax)

Fixed submission:
import copy
n,m = map(int,input().split())

#取得
scores = list()
for i in range(n):
    score = list(map(int,input().split()))
    scores.append(score)

smax=None
for x in range(2):
    scores_=copy.deepcopy(scores)
    
    for i in range(n):
        scores_[i][0] = pow(-1,x)*scores[i][0]
    for y in range(2):
        for i in range(n):
            scores_[i][1] = pow(-1,y)*scores[i][1]
        for z in range(2):
            for i in range(n):
                scores_[i][2] = pow(-1,z)*scores[i][2]
        
            sumlist=list()
            for i in range(n):
                sumlist.append(sum(scores_[i]))
            sumlist.sort()
            
            tmp=0
            for eat in range(m):
                tmp+=sumlist[-1]
                sumlist.pop()
            if smax==None or tmp>smax:
                smax=tmp
print(smax)

Buggy python submission (verdict: Time Limit Exceeded):
import copy
n,m = map(int,input().split())

scores = list()
for i in range(n):
    score = list(map(int,input().split()))
    scores.append(score)

smax=None
for i in range(n):
    scores_ = copy.deepcopy(scores)
    for j in range(len(scores[i])):    
        if scores[i][j]<0:
            for k in range(n):
                scores_[k][j] = -scores[k][j]
        else:
            for k in range(n):
                scores_[k][j] = scores[k][j]
    ssum=list()
    for j in range(n):
        ssum.append(sum(scores_[j]))
    ssum.sort()
    tmp=0
    for j in range(m):
        tmp+=ssum[-1]
        ssum.pop()
    if smax==None or tmp>smax:
        smax=tmp

print(smax)

Fixed submission:
import copy
n,m = map(int,input().split())

#取得
scores = list()
for i in range(n):
    score = list(map(int,input().split()))
    scores.append(score)

smax=None
for x in range(2):
    scores_=copy.deepcopy(scores)
    
    for i in range(n):
        scores_[i][0] = pow(-1,x)*scores[i][0]
    for y in range(2):
        for i in range(n):
            scores_[i][1] = pow(-1,y)*scores[i][1]
        for z in range(2):
            for i in range(n):
                scores_[i][2] = pow(-1,z)*scores[i][2]
        
            sumlist=list()
            for i in range(n):
                sumlist.append(sum(scores_[i]))
            sumlist.sort()
            
            tmp=0
            for eat in range(m):
                tmp+=sumlist[-1]
                sumlist.pop()
            if smax==None or tmp>smax:
                smax=tmp
print(smax)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())

scores = list()
for i in range(n):
    score = list(map(int,input().split()))
    scores.append(score)

smax=None
for i in range(n):
    scores_=list()
    for j in range(len(scores[i])):    
        if scores[i][j]<0:
            for k in range(n):
                scores_[k][j] = -scores[k][j]
        else:
            for k in range(n):
                scores_[k][j] = scores[k][j]
    ssum=list()
    for j in range(n):
        ssum.append(sum(scores_[j]))
    ssum.sort()
    
    for j in range(m):
        tmp+=ssum[-1]
        ssum.pop()
    if smax==None or tmp>smax:
        smax=tmp
print(smax)

Fixed submission:
import copy
n,m = map(int,input().split())

#取得
scores = list()
for i in range(n):
    score = list(map(int,input().split()))
    scores.append(score)

smax=None
for x in range(2):
    scores_=copy.deepcopy(scores)
    
    for i in range(n):
        scores_[i][0] = pow(-1,x)*scores[i][0]
    for y in range(2):
        for i in range(n):
            scores_[i][1] = pow(-1,y)*scores[i][1]
        for z in range(2):
            for i in range(n):
                scores_[i][2] = pow(-1,z)*scores[i][2]
        
            sumlist=list()
            for i in range(n):
                sumlist.append(sum(scores_[i]))
            sumlist.sort()
            
            tmp=0
            for eat in range(m):
                tmp+=sumlist[-1]
                sumlist.pop()
            if smax==None or tmp>smax:
                smax=tmp
print(smax)