Buggy python submission (verdict: Time Limit Exceeded):
import sys

N = int(input())
XYP = [list(map(int, input().split())) for _ in range(N)]

bits = 1 << N

xmemo = [sys.maxsize]*(N*bits)
ymemo = [sys.maxsize]*(N*bits)

for b in range(bits):
  for i in range(N):
    xmemo[b*N+i] = min(XYP[i][2]*abs(XYP[i][0]), xmemo[b*N+i])
    ymemo[b*N+i] = min(XYP[i][2]*abs(XYP[i][1]), ymemo[b*N+i])
    if not (b & (1<<i)):
      continue
    for j in range(N):
      xmemo[b*N+j] = min(XYP[j][2]*abs(XYP[i][0]-XYP[j][0]), xmemo[b*N+j])
      ymemo[b*N+j] = min(XYP[j][2]*abs(XYP[i][1]-XYP[j][1]), ymemo[b*N+j])
      
ans = [sys.maxsize]*(N+1)

pos = 3**N
for t in range(pos):
  l = []
  for _ in range(N):
    l.append(t%3)
    t //= 3
  xi = 0
  yi = 0
  cnt = 0
  for i in range(N):
    if l[i] == 0:
      xi += 1 << i
      cnt += 1
    elif l[i] == 1:
      yi += 1 << i
      cnt += 1
  tmp = 0
  for i in range(N):
    tmp += min(xmemo[xi*N+i], ymemo[N*yi+i])
  ans[cnt] = min(ans[cnt], tmp)
  
  
for i in range(N+1):
  print(ans[i])

Fixed submission:
import sys

N = int(input())
XYP = [list(map(int, input().split())) for _ in range(N)]

bits = 1 << N

xmemo = [sys.maxsize]*(N*bits)
ymemo = [sys.maxsize]*(N*bits)

for b in range(bits):
  for i in range(N):
    xmemo[b*N+i] = min(XYP[i][2]*abs(XYP[i][0]), xmemo[b*N+i])
    ymemo[b*N+i] = min(XYP[i][2]*abs(XYP[i][1]), ymemo[b*N+i])
    if not (b & (1<<i)):
      continue
    for j in range(N):
      xmemo[b*N+j] = min(XYP[j][2]*abs(XYP[i][0]-XYP[j][0]), xmemo[b*N+j])
      ymemo[b*N+j] = min(XYP[j][2]*abs(XYP[i][1]-XYP[j][1]), ymemo[b*N+j])
      
ans = [sys.maxsize]*(N+1)

for b in range(bits):
  b_ = b
  cnt = bin(b_).count('1')
  while b_ >= 0:
    b_ &= b
    yi = b - b_
    tmp = 0
    for i in range(N):
      tmp += min(xmemo[b_*N+i], ymemo[yi*N+i])
    ans[cnt] = min(ans[cnt], tmp)
    b_ -= 1
  
for i in range(N+1):
  print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
import sys

N = int(input())
XYP = [list(map(int, input().split())) for _ in range(N)]

bits = 1 << N

xmemo = [[sys.maxsize]*N for _ in range(bits)]
ymemo = [[sys.maxsize]*N for _ in range(bits)]

for b in range(bits):
  for i in range(N):
    xmemo[b][i] = min(XYP[i][2]*abs(XYP[i][0]), xmemo[b][i])
    ymemo[b][i] = min(XYP[i][2]*abs(XYP[i][1]), ymemo[b][i])
    if not (b & (1<<i)):
      continue
    for j in range(N):
      xmemo[b][j] = min(XYP[j][2]*abs(XYP[i][0]-XYP[j][0]), xmemo[b][j])
      ymemo[b][j] = min(XYP[j][2]*abs(XYP[i][1]-XYP[j][1]), ymemo[b][j])
      
ans = [sys.maxsize]*(N+1)

for b in range(bits):
  b_ = b
  cnt = bin(b_).count('1')
  while b_ >= 0:
    b_ &= b
    yi = b - b_
    tmp = 0
    for i in range(N):
      tmp += min(xmemo[b_][i], ymemo[yi][i])
    ans[cnt] = min(ans[cnt], tmp)
    b_ -= 1
  
for i in range(N+1):
  print(ans[i])

Fixed submission:
import sys

N = int(input())
XYP = [list(map(int, input().split())) for _ in range(N)]

bits = 1 << N

xmemo = [sys.maxsize]*(N*bits)
ymemo = [sys.maxsize]*(N*bits)

for b in range(bits):
  for i in range(N):
    xmemo[b*N+i] = min(XYP[i][2]*abs(XYP[i][0]), xmemo[b*N+i])
    ymemo[b*N+i] = min(XYP[i][2]*abs(XYP[i][1]), ymemo[b*N+i])
    if not (b & (1<<i)):
      continue
    for j in range(N):
      xmemo[b*N+j] = min(XYP[j][2]*abs(XYP[i][0]-XYP[j][0]), xmemo[b*N+j])
      ymemo[b*N+j] = min(XYP[j][2]*abs(XYP[i][1]-XYP[j][1]), ymemo[b*N+j])
      
ans = [sys.maxsize]*(N+1)

for b in range(bits):
  b_ = b
  cnt = bin(b_).count('1')
  while b_ >= 0:
    b_ &= b
    yi = b - b_
    tmp = 0
    for i in range(N):
      tmp += min(xmemo[b_*N+i], ymemo[yi*N+i])
    ans[cnt] = min(ans[cnt], tmp)
    b_ -= 1
  
for i in range(N+1):
  print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
XYP = [list(map(int, input().split())) for _ in range(N)]

bits = 1 << N

xmemo = [[float('inf')]*N for _ in range(bits)]
ymemo = [[float('inf')]*N for _ in range(bits)]

for b in range(bits):
  for i in range(N):
    xmemo[b][i] = min(XYP[i][2]*abs(XYP[i][0]), xmemo[b][i])
    ymemo[b][i] = min(XYP[i][2]*abs(XYP[i][1]), ymemo[b][i])
    if not (b & (1<<i)):
      continue
    for j in range(N):
      xmemo[b][j] = min(XYP[j][2]*abs(XYP[i][0]-XYP[j][0]), xmemo[b][j])
      ymemo[b][j] = min(XYP[j][2]*abs(XYP[i][1]-XYP[j][1]), ymemo[b][j])
      
ans = [float('inf')]*(N+1)

for b in range(bits):
  b_ = b
  cnt = bin(b_).count('1')
  while b_ >= 0:
    b_ &= b
    yi = b - b_
    tmp = 0
    for i in range(N):
      tmp += min(xmemo[b_][i], ymemo[yi][i])
    ans[cnt] = min(ans[cnt], tmp)
    b_ -= 1
  
for i in range(N+1):
  print(ans[i])

Fixed submission:
import sys

N = int(input())
XYP = [list(map(int, input().split())) for _ in range(N)]

bits = 1 << N

xmemo = [sys.maxsize]*(N*bits)
ymemo = [sys.maxsize]*(N*bits)

for b in range(bits):
  for i in range(N):
    xmemo[b*N+i] = min(XYP[i][2]*abs(XYP[i][0]), xmemo[b*N+i])
    ymemo[b*N+i] = min(XYP[i][2]*abs(XYP[i][1]), ymemo[b*N+i])
    if not (b & (1<<i)):
      continue
    for j in range(N):
      xmemo[b*N+j] = min(XYP[j][2]*abs(XYP[i][0]-XYP[j][0]), xmemo[b*N+j])
      ymemo[b*N+j] = min(XYP[j][2]*abs(XYP[i][1]-XYP[j][1]), ymemo[b*N+j])
      
ans = [sys.maxsize]*(N+1)

for b in range(bits):
  b_ = b
  cnt = bin(b_).count('1')
  while b_ >= 0:
    b_ &= b
    yi = b - b_
    tmp = 0
    for i in range(N):
      tmp += min(xmemo[b_*N+i], ymemo[yi*N+i])
    ans[cnt] = min(ans[cnt], tmp)
    b_ -= 1
  
for i in range(N+1):
  print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
XYP = [list(map(int, input().split())) for _ in range(N)]

bits = 1 << N

xmemo = [[float('inf')]*N for _ in range(bits)]
ymemo = [[float('inf')]*N for _ in range(bits)]

for b in range(bits):
  for i in range(N):
    xmemo[b][i] = min(XYP[i][2]*abs(XYP[i][0]), xmemo[b][i])
    ymemo[b][i] = min(XYP[i][2]*abs(XYP[i][1]), ymemo[b][i])
    if not (b & (1<<i)):
      continue
    for j in range(N):
      xmemo[b][j] = min(XYP[j][2]*abs(XYP[i][0]-XYP[j][0]), xmemo[b][j])
      ymemo[b][j] = min(XYP[j][2]*abs(XYP[i][1]-XYP[j][1]), ymemo[b][j])
      
ans = [float('inf')]*(N+1)

pos = 3**N
for t in range(pos):
  l = []
  for _ in range(N):
    l.append(t%3)
    t //= 3
  xi = 0
  yi = 0
  cnt = 0
  for i in range(N):
    if l[i] == 0:
      xi += 1 << i
      cnt += 1
    elif l[i] == 1:
      yi += 1 << i
      cnt += 1
  tmp = 0
  for i in range(N):
    tmp += min(xmemo[xi][i], ymemo[yi][i])
  ans[cnt] = min(ans[cnt], tmp)
  
for i in range(N+1):
  print(ans[i])

Fixed submission:
import sys

N = int(input())
XYP = [list(map(int, input().split())) for _ in range(N)]

bits = 1 << N

xmemo = [sys.maxsize]*(N*bits)
ymemo = [sys.maxsize]*(N*bits)

for b in range(bits):
  for i in range(N):
    xmemo[b*N+i] = min(XYP[i][2]*abs(XYP[i][0]), xmemo[b*N+i])
    ymemo[b*N+i] = min(XYP[i][2]*abs(XYP[i][1]), ymemo[b*N+i])
    if not (b & (1<<i)):
      continue
    for j in range(N):
      xmemo[b*N+j] = min(XYP[j][2]*abs(XYP[i][0]-XYP[j][0]), xmemo[b*N+j])
      ymemo[b*N+j] = min(XYP[j][2]*abs(XYP[i][1]-XYP[j][1]), ymemo[b*N+j])
      
ans = [sys.maxsize]*(N+1)

for b in range(bits):
  b_ = b
  cnt = bin(b_).count('1')
  while b_ >= 0:
    b_ &= b
    yi = b - b_
    tmp = 0
    for i in range(N):
      tmp += min(xmemo[b_*N+i], ymemo[yi*N+i])
    ans[cnt] = min(ans[cnt], tmp)
    b_ -= 1
  
for i in range(N+1):
  print(ans[i])