Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n,k,q=map(int,input().split())
point=[k]*n
for _ in range(q):
  a=int(input())
  for i in range(n):
    if i==a-1:
      pass
    else:
      point[i]-=1
      
for i in point:
  if i<=0:
    print("No")
  else:
    print("Yes")

### FIXED CODE ###

n,k,q=map(int,input().split())
ls=[0]*n

for _ in range(q):
  a=int(input())
  ls[a-1]+=1
  
for i in ls:
  print("Yes"if k+i>q else "No")
### BUGGY CODE ###

# coding: utf-8
# Your code here!

import copy

string = [x for x in input()]

concat_string = copy.copy(string)
count = 0
while True:
    num_delete = 0
    flags_delete = [False] * len(string)
    
    i = 0
    while i < len(concat_string) - 1:
        if concat_string[i] != concat_string[i + 1]:
            flags_delete[i] = True
            flags_delete[i + 1] = True
            num_delete += 2
            i += 2
        else:
            i += 1
           
    if num_delete == 0:
        break
    
    count += num_delete
    concat_string = [concat_string[i] for i in range(len(concat_string)) if flags_delete[i] == False]

print(count)
        
        

### FIXED CODE ###

# coding: utf-8
# Your code here!

import copy

string = [x for x in input()]

concat_string = copy.copy(string)
num_delete = 0

i = 0
j = 1
not_delete_list = []
while True:
    if j >= len(concat_string) or i < 0:
        break
    if concat_string[i] != concat_string[j]:
        num_delete += 2
        
        if i == 0:
            i = j + 1
            j = i + 1
        else:
            if len(not_delete_list) > 0:
                i = not_delete_list.pop(-1)
                j = j + 1
            else:
                i = j + 1
                j = i + 1
    else:
        not_delete_list.append(i)
        i = j
        j = i + 1


print(num_delete)
### BUGGY CODE ###

import numpy as np
N = int(input())
A = list(map(int, input().split()))
se = 1
c = True
for n in range(N):
  se *= A[n]
  if A[n] == 0:
    se = 0
    break
if se >  10**18:
  print("-1")
  c = False
if c:
  print(se)

### FIXED CODE ###

import numpy as np
N = int(input())
A = list(map(int, input().split()))
se = 1
c = True
for n in range(N):
  se *= A[n]
  if se >  10**18:
    c = False
    break
for n in range(N):
  if A[n] == 0:
    se = 0
    c = True
if c:
  print(se)
else:
  print("-1")
### BUGGY CODE ###

import numpy as np

N = int(input())
A = []
B = []
for _ in range(N):
    s = input().split()
    A.append(int(s[0]))
    B.append(int(s[1]))

def set_list(es):
    es = es.tolist()
    return len(list(set(es))) == 1

ind = 0

A = np.array(A)
B = np.array(B)

a_happy = 0
b_happy = 0
A_flag = 0
B_flag = 0

if set_list(A):
    A_flag = 1

if set_list(B):
    B_flag = 1

for i in range(N):
    if i%2 == 0:
        if A_flag == 0:
            ind =np.argmax(A)
            a_happy += A[ind]
            A = np.delete(A, ind)
            B = np.delete(B, ind)
            if set_list(A):
                A_flag = 1
            if set_list(B):
                B_flag = 1
        elif A_flag == 1:
            ind =np.argmax(B)
            a_happy += A[ind]
            A = np.delete(A, ind)
            B = np.delete(B, ind)
    if i%2 == 1:
        if B_flag == 0:
            ind =np.argmax(B)
            b_happy += B[ind]
            A = np.delete(A, ind)
            B = np.delete(B, ind)
            if set_list(A):
                A_flag = 1
            if set_list(B):
                B_flag = 1
        elif B_flag == 1:
            ind =np.argmax(A)
            b_happy += B[ind]
            A = np.delete(A, ind)
            B = np.delete(B, ind)

print(a_happy - b_happy)


### FIXED CODE ###

import numpy as np

N = int(input())
C = []
for _ in range(N):
    a, b = map(int, input().split())
    C.append([a+b, a, b])

D = sorted(C, reverse=True)

ans = 0

for i in range(N):
    if i % 2 == 0:
        ans += D[i][1]
    elif i % 2 == 1:
        ans -= D[i][2]

print(ans)
### BUGGY CODE ###

N = int(input().strip())
A = [int(v) for v in input().strip().split(" ")]

A = sorted(A)

counter = 0
for i in range(N):
    count_flag = True
    for j in range(N):
        if i == j:
            continue
        if A[i] < A[j]:
            break
        if A[i] % A[j] == 0:
            count_flag = False
            break
    if count_flag:
        counter += 1

print(counter)

### FIXED CODE ###

N = int(input().strip())
A = [int(v) for v in input().strip().split(" ")]

exist_in_input = [0 for _ in range(10**6 + 1)]
if_can_divide = [0 for _ in range(10**6 + 1)]

for a in A:
    exist_in_input[a] += 1

counter = 0
for i in range(1, 10**6+1):
    if if_can_divide[i] == 1 or exist_in_input[i] == 0:
        continue

    if exist_in_input[i] == 1:
        counter += 1

    for j in range(0, 10**6+1, i):
        if_can_divide[j] = 1

print(counter)
### BUGGY CODE ###

n,m = map(int,input().split())
lst = [list(map(int,input().split())) for _ in range(n)]

lst.sort(key = lambda x:x[0],reverse = True)
lst.sort(key = lambda x:x[1],reverse = True)

done = [0 for _ in range(n)]
gain = 0

for i in reversed(range(1,m+1)): #i:残り日数
    for j in range(n): #j:候補から優先度順で探索
        if lst[j][0] <= i and done[j] == 0: #必要な日数>残り日数 かつ undone
            gain += lst[j][1]
            done[j] = 1 #undone:0,done:1として分類
            break #働いたら次の日へ

print(gain)

### FIXED CODE ###

import heapq
n,m = list(map(int,input().split()))
jobs = [[] for _ in range(m)]
for i in range(n):
    d,r = list(map(int,input().split()))
    if d-1 < m:
        jobs[d-1].append(-r)
rewords = 0
heap = []
for i in range(m):
    for reword in jobs[i]:
        heapq.heappush(heap,reword)
    if len(heap) > 0:
        reword = heapq.heappop(heap)
        rewords += -reword
print(rewords)
### BUGGY CODE ###

import math


n, a, b = map(int, input().split())
P = int(1e9+7)
ans = pow(2, n, P) - 1  # 1本以上の花束の種類


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


ans = (ans - combinations_count(n, a)) % P
ans = (ans - combinations_count(n, b)) % P
print(ans)


### FIXED CODE ###

from operator import mul
from functools import reduce


def combinations_count(n, r, P):
    r = min(r, n - r)
    inv_y = 1
    for i in range(1, r + 1):
        inv_y = (inv_y * i) % P
    inv_y = pow(inv_y, P - 2, P)
    x = 1
    for i in range(n - r + 1, n + 1):
        x = x * i % P
    return (x * inv_y) % P



n, a, b = map(int, input().split())
P = int(1e9+7)
ans = pow(2, n, P) - 1  # 1本以上の花束の種類


ans = (ans - combinations_count(n, a, P))
ans = (ans - combinations_count(n, b, P))
print(ans%P)
### BUGGY CODE ###

# ローリングハッシュ
class RollingHash() :
    def __init__(self, S, base=26, mod=2**61-1) :
        hash = [0]
        pow = [1]
        for s in S :
            hash.append((hash[-1] * base + ord(s)) % mod)
            pow.append(pow[-1] * base % mod)

        self.hash = hash
        self.pow = pow
        self.mod = mod
        
    def get(self, l, r) :
        return (self.hash[r+1] - self.hash[l] * self.pow[r+1-l]) % self.mod
        
N = int(input())
S = input()

RH = RollingHash(S)

def solve() :
    for k in range(N // 2, 0, -1) :
        for i in range(N - 2 * k + 1) :
            for j in range(i + k, N - k + 1) :
                if RH.get(i, i+k-1) == RH.get(j, j+k-1) :
                    return k
    return 0
print(solve())

### FIXED CODE ###

N = int(input())
S = input()

mod = 10 ** 9 + 7
hash = [0]
pow = [1]
for s in S :
    hash.append((hash[-1] * 26 + ord(s) - 97) % mod)
    pow.append(pow[-1] * 26 % mod)

M = 0
for i in range(N + 1) :
    for j in range(i + 1, N + 1) :
        for k in range(M + 1, N - j + 1) :
            if i + k > j :
                break
            if (hash[j+k] - hash[j] * (pow[k])) % mod == (hash[i+k] - hash[i] *  pow[k]) % mod :
                M += 1
            else :
                break
                
print(M)
### BUGGY CODE ###

N, M = map(int, input().split())
aLst = list(map(int, input().split()))
for i in range(M):
    B, C = map(int, input().split())
    for i in range(B):
        aLst.append(C)

aLst.sort(reverse=True)
ans = 0

for i in range(N):
    ans += aLst[i]

print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
aLst = list(map(int, input().split()))
aLst.sort()
cdict = {}
for i in range(M):
    B, C = map(int, input().split())
    if C in cdict.keys():
        cdict[C] = cdict[C] + B
    else:
        cdict[C] = B

for i in aLst:
    if i in cdict.keys():
        cdict[i] = cdict[i] + 1
    else:
        cdict[i] = 1

sordC = sorted(cdict.items(), key=lambda x:x[0], reverse=True)
ans = 0
tmp = 0
for i in range(N):
    for j in range(sordC[i][1]):
        if tmp < N:
            ans += sordC[i][0]
            tmp += 1
        else:
            break
    if tmp >= N:
        break
print(ans)
### BUGGY CODE ###

def main():
    s = input()
    k = int(input())
    l = set()
    ls = len(s)
    clist = sorted(list(set(list(s))))
    ladd = l.add
    for i in clist:
        x = []
        for j in range(ls):
            if i == s[j]:
                x.append(j)
        ladd(i)
        for j in range(len(x)):
            idx = x[j]
            xxx = s[idx]
            for t in range(idx+1,ls):
                xxx = xxx +s[t]
                ladd(xxx)
        if len(l) >= k:
            l = list(l)
            print(sorted(l)[k-1])
            break
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    s = input()
    k = int(input())
    l = set()
    ls = len(s)
    clist = sorted(list(set(list(s))))
    ladd = l.add
    for i in clist:
        x = []
        for j in range(ls):
            if i == s[j]:
                x.append(j)
        ladd(i)
        for j in range(len(x)):
            idx = x[j]
            xxx = s[idx]
            c = 0
            for t in range(idx+1,ls):
                xxx = xxx +s[t]
                ladd(xxx)
                c += 1
                if c > k:
                    break
        if len(l) >= k:
            l = list(l)
            print(sorted(l)[k-1])
            break
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

from collections import deque

H, W = map(int, input().split())

INF = 10**9
n_i = [-1, 0, 1, 0]
n_j = [0, -1, 0, 1]
a = [input() for i in range(H)]

dist_map = [[INF]*W for _ in range(H)]

# 黒マスの位置を記録
q = deque([])
for i in range(H):
    for j in range(W):
        if a[i][j] == "#":
            q.append([i, j, 0])

max_dist = 0

while len(q) > 0:
    current = q.popleft()
    current_h = current[0]
    current_w = current[1]
    dist = current[2]
    if dist_map[current_h][current_w] != INF:
        continue
    if max_dist < dist:
        max_dist = dist
    dist_map[current_h][current_w] = dist
    for dir in range(4):
        nh = current_h + n_i[dir]
        nw = current_w + n_j[dir]
        if nh < 0 or H <= nh or nw < 0 or W <= nw:
            continue
        if a[nh][nw] == "#":
            continue
        q.append((nh, nw, dist+1))


print(max_dist)


### FIXED CODE ###

from collections import deque
h,w = list(map(int,input().split()))
f = []
q = deque()
for i in range(h):
    a = list(input())
    for j in range(w):
        if a[j] == '#':
            q.append([0,i,j])
    f.append(a)
 
ans =0
dxy = [0,1,0,-1,0]
while(len(q)):
    c,y,x = q.popleft()
    for i in range(4):
        ny = y+dxy[i]
        nx = x+dxy[i+1]
        if nx >= w or ny >= h or nx <0 or ny <0:
            continue
        if f[ny][nx] == '.':
            f[ny][nx] = c+1
            q.append([c+1,ny,nx])
            ans = max(ans,c+1)
        elif f[ny][nx] != '#' and f[ny][nx] > c+1:
            f[ny][nx] = c+1
            q.append([c+1,ny,nx])
            ans = max(ans,c+1)
 
print(ans)
### BUGGY CODE ###

from collections import Counter
N = int(input())
A = list(map(int,input().split()))
MOD = 10 ** 9 + 7
ans = 0
bit_matrix = [[0] * 60 for _ in range(N)]
for i in range(len(A)):
    n = 0
    while 2 ** n <= A[i]:
        if A[i] >> n & 1:
            bit_matrix[i][n] = 1
        n += 1
#print(bit_matrix)
bit_matrix_T = []
for j in range(60):
    tmp = []
    for i in range(N):
        tmp.append(bit_matrix[i][j])
    bit_matrix_T.append(tmp)
#print(bit_matrix_T)
for i in range(len(bit_matrix_T)):
    tmp = Counter(bit_matrix_T[i])
    a = list(tmp.values())
    if len(a) == 2:
        ans += (2 ** i) * a[0] * a[1]
        ans %= MOD
print(ans)


### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int,input().split()))
MOD = 10 ** 9 + 7
ans = 0
bit_matrix = [[0] * N for _ in range(61)]
for i in range(len(A)):
    n = 0
    while 2 ** n <= A[i]:
        if A[i] >> n & 1:
            bit_matrix[n][i] = 1
        n += 1
#print(bit_matrix)
#bit_matrix_T = []
'''
for j in range(60):
    tmp = []
    for i in range(N):
        tmp.append(bit_matrix[i][j])
    bit_matrix_T.append(tmp)
'''
#print(bit_matrix_T)
for i in range(len(bit_matrix)):
    tmp = Counter(bit_matrix[i])
    a = list(tmp.values())
    if len(a) == 2:
        ans += (2 ** i) * a[0] * a[1]
        ans %= MOD
print(ans)
### BUGGY CODE ###

import itertools

def warshall_floyd(d):
  len_d = len(d)
  for k in range(len_d):
    for i in range(len_d):
      for j in range(len_d):
        d[i][j] = min(d[i][j],d[i][k] + d[k][j])
  return d

def main():
  n, m, r = map(int, input().split())
  list_r = list(map(int, input().split()))
  list_cand = list(itertools.permutations(list_r))

  dist = [[float("inf") if i != j else 0 for j in range(n)] for i in range(n)]
  for i in range(m):
    a, b, c = map(int, input().split())
    dist[a-1][b-1] = c
    dist[b-1][a-1] = c
  min_dist = warshall_floyd(dist)

  result = 10**100
  for one_cand in list_cand:
    temp = 0
    idx = 0
    while idx < r-1:
      temp += min_dist[one_cand[idx]-1][one_cand[idx+1]-1]
      idx += 1
    if temp < result:
      result = temp
  print(result)

if __name__ == "__main__":
  main()

### FIXED CODE ###

from itertools import permutations
import sys

def main():
    
    N, M, R = map(int, sys.stdin.readline().split())
    r = [i - 1 for i in map(int, sys.stdin.readline().split())]
    
    d = [[float('inf')] * N for _ in range(N)]
    
    for i in range(N):
        d[i][i] = 0
        
    for i in range(M):
        a, b, c = map(int,sys.stdin.readline().split())
        d[a-1][b-1] = c
        d[b-1][a-1] = c
        
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if d[i][j] > d[i][k] + d[k][j]:
                    d[i][j] = d[i][k] + d[k][j]
    
    ans = 10**12
    
    for each in permutations(r):
        t_dis = 0
        for i in range(R-1):
            t_dis += d[each[i]][each[i+1]]  
        
        ans = min(ans, t_dis)
    
    print(ans)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

class GCD:

    def culc(self, K):
        ret = 0
        self.numlist = dict()
        for i in range(1,K-1):
            for j in range(i+1, K):
                for k in range(j+1,K+1):
                    ret += self.gcd(i,j,k)*6
        
        for i in range(1,K+1):
            for j in range(1,K+1):
                if i != j:
                    ret += self.gcd(i,i,j) * 3
        for i in range(1, K+1):
            ret += self.gcd(i,i,i)

        return ret

    def gcd(self, a,b,c):
        l = [a,b,c]
        l.sort()
        l = tuple(l)
        if l in self.numlist:
            return self.numlist[l]
        else:
            temp_ = self.gcd_(l[0],l[1])
            temp_ = self.gcd_(temp_, l[2])
            self.numlist[l] = temp_
            return temp_

    def gcd_(self,a,b):
        mod = max(a,b) % min(a,b)
        if mod == 0:
            ret = min(a,b)
            return ret
        else:
            ret = self.gcd_(min(a,b), mod)
            return ret

K = int(input())
gcd = GCD()
ret = gcd.culc(K)
print(ret)

### FIXED CODE ###

class GCD:
    def __init__(self):
        self.numlist = dict()
    def culc(self, K):
        ret = 0
        
        for i in range(1,K):
            for j in range(i + 1,K+1):
                ret += self.gcd_(i,j) * 6

        for i in range(1,K-1):
            for j in range(i+1, K):
                for k in range(j+1,K+1):
                    ret += self.gcd(i,j,k)*6

        for i in range(1, K+1):
            ret += i

        return ret

    def gcd(self, a,b,c):
        #l = (a,b,c)
        #if l in self.numlist:
        #    return self.numlist[l]
        #else:
        temp_ = self.gcd_(a,b)
        temp_ = self.gcd_(temp_, c)
        
        return temp_

    def gcd_(self,a,b):
        l = (min(a,b), max(a,b))
        if l in self.numlist:
            return self.numlist[l]
        else:
            mod = max(a,b) % min(a,b)
            if mod == 0:
                ret = min(a,b)
                self.numlist[l] = ret
                return ret
            else:
                ret = self.gcd_(min(a,b), mod)
                self.numlist[l] = ret
                return ret

K = int(input())
gcd = GCD()
ret = gcd.culc(K)
print(ret)
### BUGGY CODE ###

N = int(input())
A = [int(input()) for n in range(N)]

for n in range(N):
  print(max(A[:n]+A[n+1:]))

### FIXED CODE ###

N = int(input())
A = [int(input()) for n in range(N)]
a1 = sorted(A)[-1]
a2 = sorted(A)[-2]

for a in A:
  if a == a1:
    print(a2)
  else:
    print(a1)
### BUGGY CODE ###

def main():
    N = int(input())
    sum = 0
    while True:
        amari = N % 10
        sum += amari
        N = N//10
        if N == 0:
            break

    if (sum%9) == 0:
        print('Yes')
    else:
        print('No')

main()


### FIXED CODE ###

def main():
    N = int(input())
    if (N%9) == 0:
        print('Yes')
    else:
        print('No')

main()
### BUGGY CODE ###

n=int(input())
a=list(list(map(int,input().split())))
ans=0
for i in range(n):
    if i+a[i]>n-1:
        continue
    else:
        for j in range(i+a[i],n):
            if j-i==a[i]+a[j]:
                ans+=1
print(ans)

### FIXED CODE ###

from collections import Counter
n=int(input())
a=list(list(map(int,input().split())))
ma=[i-a[i] for i in range(n)]
r=Counter(ma)
ans=0
for i in range(n):
    ans+=r[i+a[i]]
print(ans)
### BUGGY CODE ###

n = int(input())
A = list(map(int, input().split()))
num = [0]*n
for i in A:
  num[i-1] += 1
frac = [1]
for i in range(max(num)):
    frac.append(frac[i]*(i+1))
def comb(n, k):
    a=frac[n]
    b=frac[k]
    c=frac[n-k]
    return (a // (b * c))
ans_sub = 0
for i in num:
  if i < 2:
    pass
  else:
    ans_sub += comb(i, 2)
for i in A:
  if num[i-1] < 2:
    a = 0
  else:
    a = num[i-1]-1
  print(ans_sub-a)

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
num = [0]*n
for i in A:
  num[i-1] += 1
def comb(n):
    if n < 2:
      return 0
    else:
      return n * (n-1) // 2
ans_sub = 0
for i in num:
  ans_sub += comb(i)
for i in A:
  if num[i-1] < 2:
    a = 0
  else:
    a = num[i-1]-1
  print(ans_sub-a)
### BUGGY CODE ###

from math import sqrt
from collections import defaultdict


def sieve(x):
    """
    Sieve of Eratosthenes
    :param x: max value
    :return: list of primes
    """

    primes = []
    li = list(range(2, x + 1))

    while li[0] <= sqrt(x):
        p = li[0]
        primes.append(p)
        li = [e for e in li if e % p != 0]

    primes += li
    return primes


def prime_fact(x):
    for e in p:
        cnt = 0
        while x % e == 0:
            x //= e
            cnt += 1
        if cnt > 0:
            pf[e] = max(pf[e], cnt)


def prime_fact2(x):
    ret = defaultdict(int)
    for e in p:
        cnt = 0
        while x % e == 0:
            x //= e
            cnt += 1

        if cnt > 0:
            ret[e] = cnt

    return ret


n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
MAX = 10 ** 6 + 1

p = sieve(MAX)
pf = defaultdict(int)

for e in a:
    prime_fact(e)

ans = 0
for e in a:
    e_pf = prime_fact2(e)
    b = 1
    for k, v in pf.items():
        b *= pow(k, v - e_pf[k], mod)

    ans += b
    ans %= mod

print(ans)


### FIXED CODE ###

from fractions import gcd


def lcm(a, b):
    return a * b // gcd(a, b)


n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7

l = 1
for e in a:
    l = lcm(l, e)

l %= mod

ans = 0
for e in a:
    ans += l * pow(e, mod - 2, mod)
    ans %= mod

print(ans)
### BUGGY CODE ###

a=input()
b=a.split()

num=[]

for i in range(int(b[0])):
	num.append(1)

for i in range(int(b[1])):
	num.append(0)

for i in range(int(b[2])):
	num.append(-1)

k=int(b[3])
print(sum(num[0:k]))


### FIXED CODE ###

a=input()
b=a.split()

x1=int(b[0]) #1
x2=int(b[1]) #0
x3=int(b[2]) #-1
x4=int(b[3]) #k

if x4 <= x1:
	print(x4)

elif x4 <= x1+x2:
	print(x1)

else:
	print(x1-(x4-x1-x2))
### BUGGY CODE ###

n = int(input())
s = []
for i in range(n):
  s.append(''.join(sorted(input())))
a = []

while len(s) > 0:
  l = s[0]
  t = [ss for ss in s if ss != l]
  a.append(len(s)-len(t))
  s = t

ans = 0
for i in range(len(a)):
  ans += a[i]*(a[i]-1)//2
print(ans)

### FIXED CODE ###

n = int(input())
s = ['']*n
for i in range(n):
  s[i] = (''.join(sorted(input())))
s.sort()

i=0
c=1
ans = 0
while i < n-1:
  while i+c < n and s[i] == s[i+c]:
    c += 1
  else:
    ans += c*(c-1)//2
    i += c
    c = 1

print(ans)
### BUGGY CODE ###

n = int(input())
towns = [tuple(map(int, input().split())) for _ in range(n)]

INF = 10 ** 18
ans = [INF] * (n + 1)

for bit in range(1 << n):
    k = bin(bit).count('1')
    i = 0
    t = bit
    selected = []
    while t:
        if t & 1:
            selected.append(towns[i])
        t >>= 1
        i += 1

    for bit2 in range(1 << k):
        cost = 0
        for x, y, p in towns:
            town_dist = min(abs(x), abs(y))
            t = bit2
            for i in range(k):
                if t & 1:
                    town_dist = min(town_dist, abs(selected[i][1] - y))
                else:
                    town_dist = min(town_dist, abs(selected[i][0] - x))
                t >>= 1
            cost += town_dist * p
        kk = len(selected)
        ans[kk] = min(ans[kk], cost)

print('\n'.join(map(str, ans)))


### FIXED CODE ###

import os
import sys

import numpy as np


def solve(inp):
    n = inp[0]
    xxx = inp[1::3]
    yyy = inp[2::3]
    ppp = inp[3::3]

    ans = np.full(n + 1, 10 ** 18, dtype=np.int64)

    default_dist = np.zeros(n, dtype=np.int64)
    for i in range(n):
        default_dist[i] = min(abs(xxx[i]), abs(yyy[i]))

    for bit in range(1 << n):
        k = (bit & 0x5555) + (bit >> 1 & 0x5555)
        k = (k & 0x3333) + (k >> 2 & 0x3333)
        k = (k & 0x0f0f) + (k >> 4 & 0x0f0f)
        k = (k & 0x00ff) + (k >> 8 & 0x00ff)

        i = 0
        cur = 0
        t = bit
        selected = np.zeros(k, dtype=np.int64)
        is_selected = np.zeros(n, dtype=np.int8)
        while t:
            if t & 1:
                selected[cur] = i
                is_selected[i] = 1
                cur += 1
            t >>= 1
            i += 1

        for bit2 in range(1 << k):
            cost = 0
            for i in range(n):
                if is_selected[i]:
                    continue
                town_dist = default_dist[i]
                t = bit2
                for j in range(k):
                    if t & 1:
                        town_dist = min(town_dist, abs(yyy[selected[j]] - yyy[i]))
                    else:
                        town_dist = min(town_dist, abs(xxx[selected[j]] - xxx[i]))
                    t >>= 1
                cost += town_dist * ppp[i]
            kk = len(selected)
            ans[kk] = min(ans[kk], cost)

    return ans


if sys.argv[-1] == 'ONLINE_JUDGE':
    from numba.pycc import CC

    cc = CC('my_module')
    cc.export('solve', '(i8[:],)')(solve)
    cc.compile()
    exit()

if os.name == 'posix':
    # noinspection PyUnresolvedReferences
    from my_module import solve
else:
    from numba import njit

    solve = njit('(i8[:],)', cache=True)(solve)
    print('compiled', file=sys.stderr)

inp = np.fromstring(sys.stdin.read(), dtype=np.int64, sep=' ')
ans = solve(inp)
print('\n'.join(map(str, ans)))