Harryxun/stf_run huggingface dataset:
def dfs(v,d,p):
    memo[v] = d
    flag = False
    for i in graph[v]:
        if memo[i[0]] != -1:continue
        dfs(i[0],d+i[1],v)
    sub_tree[v].append(v)
    for j in graph[v]:
        if j[0] == p:continue
        sub_tree[v] += sub_tree[j[0]]
    if p == k-1:arr.append(sub_tree[v])
n = int(input())
graph = [[] for _ in range(n)]
memo = [-1]*n

for i in range(n-1):
    x,y,z = map(int,input().split())
    graph[x-1].append([y-1,z])
    graph[y-1].append([x-1,z])
q,k = map(int,input().split())
sub_tree = [[] for _ in range(n)]
arr = []
ary = [list(map(int,input().split())) for _ in range(q)]
dfs(k-1,0,0)
arr.pop()
a = [0,0]
for i in range(q):
    for j in range(len(arr)):
        if ary[i][0] in arr[j]:
            a[0] = j
        if ary[i][1] in arr[j]:
            a[1] = j
    if a[0] == a[1]:
        print(memo[ary[i][0]-1]+memo[ary[i][1]-1])
    else:
        print(memo[ary[i][0]-1]+memo[ary[i][1]-1])


### FIXED CODE ###

import sys
sys.setrecursionlimit(500000)

def dfs(v,d):
    memo[v] = d
    for i in graph[v]:
        if memo[i[0]] != -1:continue
        dfs(i[0],d+i[1])
        
n = int(input())
graph = [[] for _ in range(n)]
memo = [-1]*n
for i in range(n-1):
    x,y,z = map(int,input().split())
    graph[x-1].append([y-1,z])
    graph[y-1].append([x-1,z])
q,k = map(int,input().split())
ary = [list(map(int,input().split())) for _ in range(q)]
dfs(k-1,0)
print(*[memo[x-1]+memo[y-1] for x,y in ary],sep="\n")
ort fractions
n,m = map(int,input().split())
l = input().split()
lcm = 1
sum = 0
for i in range(len(l)):
    lcm = (int(l[i]) * lcm) // fractions.gcd(int(l[i]), lcm)
for i in range(len(l)):
    if (lcm // int(l[i])) % 2 == 1:
        sum += 1
if sum == len(l):
    x = m // (int(lcm) / 2)
    y = m // lcm
    print(int(x - y))
else:
    print(0)

### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
 
def div_ceil(x, y): return (x + y - 1) // y
 
N, M = map(int, input().split())
*A, = map(int, input().split())
A = list(set([a // 2 for a in A]))
L = A[0]
for a in A[1:]:
    L *= a // gcd(L, a)
for a in A:
    if (L // a) % 2 == 0:
        ans = 0
        break
else:
    ans = div_ceil(M // L, 2)
print(ans)
N, M = map(int, input().split())


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


mod = 10**9 + 7


def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod//i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)


primes = factorization(M)
# 何箇所に分けるか（cnt以下）,その中でどう分けるか（しきりをどこにおくか（振り分けられないものが出ると選べれないのとおなじになるので、cnt - 選んだ数））

if N == 1:
    print(1)
ans = 1
for p, cnt in primes:
    tmp = 0
    for i in range(1, min(cnt, N)+1):
        tmp += cmb(N, i, mod) * cmb(cnt-1, i-1, mod)
        #print(tmp, p, cnt, i)
        tmp %= mod
    ans *= tmp
    ans %= mod

print(ans)


### FIXED CODE ###

N, M = map(int, input().split())


def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])

    if arr == []:
        arr.append([n, 1])

    return arr


mod = 10**9 + 7


def cmb(n, r, mod):
    if (r < 0 or r > n):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod


g1 = [1, 1]  # 元テーブル
g2 = [1, 1]  # 逆元テーブル
inverse = [0, 1]  # 逆元テーブル計算用テーブル

for i in range(2, N + 1):
    g1.append((g1[-1] * i) % mod)
    inverse.append((-inverse[mod % i] * (mod//i)) % mod)
    g2.append((g2[-1] * inverse[-1]) % mod)


primes = factorization(M)
# 何箇所に分けるか（cnt以下）,その中でどう分けるか（しきりをどこにおくか（振り分けられないものが出ると選べれないのとおなじになるので、cnt - 選んだ数））

if N == 1 or M == 1:
    print(1)
    exit(0)
ans = 1
for p, cnt in primes:
    tmp = 0
    for i in range(1, min(cnt, N)+1):
        tmp += cmb(N, i, mod) * cmb(cnt-1, i-1, mod)
        #print(tmp, p, cnt, i)
        tmp %= mod
    ans *= tmp
    ans %= mod

print(ans)
from collections import deque

h, w = map(int, input().split())
field = []
for i in range(h):
    field.append(list(input()))

out = 0
for i in range(h):
    for j in range(w):
        if field[i][j] == '.':
            seen = [[0 for m in range(w)] for n in range(h)]
            seen[i][j] = 1
            q = deque([])
            q.append((i, j, 0))

            while q:
                y, x, cnt = q.popleft()
                # print(y, x, cnt)
                for ny, nx in [(y, x + 1), (y, x - 1), (y + 1, x), (y - 1, x)]:
                    if 0 <= ny < h and 0 <= nx < w and not seen[ny][nx]:
                        if field[ny][nx] == '.':
                            q.append((ny, nx, cnt + 1))
                            seen[y][x] = 1
        out = max(out, cnt)
print(out)


### FIXED CODE ###

from collections import deque

h, w = map(int, input().split())
field = []

for i in range(h):
    field.append(list(input()))

out = 0
for i in range(h):
    for j in range(w):
        if field[i][j] == '.':
            seen = [[0 for m in range(w)] for n in range(h)]
            seen[i][j] = 1
            q = deque([])
            q.append((i, j, 0))
            while q:
                (y, x, cnt) = q.popleft()
                # print(y,x)
                # print(seen)
                for ny, nx in (y, x + 1), (y, x - 1), (y + 1, x), (y - 1, x):
                    if ny < 0 or ny >= h or nx < 0 or nx >= w:
                        pass
                    elif field[ny][nx] == '.' and seen[ny][nx] == 0:
                        q.append((ny, nx, cnt + 1))
                        seen[ny][nx] = 1

            out = max(out, cnt)
print(out)
import math
s = list(str(input()))
lis = ""
li = ""
num = 0
cou = [0 for i in range(26)]
for i in range(len(s)):
  if s[i] != "x":
    lis += s[i]
    li = s[i] + li
  else:
    num += 1
if lis != li:
  print(-1)
  exit()
point = lis[len(lis)//2]
ss = ["1"]
tt = ["1"]
nu = 0
while s[nu] != point:
  ss.append(s[nu])
  nu += 1
nu = 0
while s[-1-nu] != point:
  tt.append(s[-1-nu])
  nu += 1
ans = 0
for i in range(max(len(ss),len(tt))):
  try:
    if ss[i] != tt[i]:
      ans += 1
  except:
    ans += 1
print(ans,ss,tt)

### FIXED CODE ###

import math
s = str(input())
cou = 0
co = 0
ans = 0
while cou + co +2 <= len(s):
  if s[cou] == "x":
    if s[-1-co] == "x":
      cou += 1
      co += 1
    else:
      cou += 1
      ans += 1
  else:
    if s[-1-co] == "x":
      co += 1
      ans += 1
    else:
      if s[cou] == s[-1-co]:
        cou += 1
        co += 1
      else:
        print(-1)
        exit()
print(ans)
# 方針　union findで解く
n, m = map(int, input().split())  # 入力の受け取り
par = [i for i in range(1, n + 1)]  # 親のリストを作成


# find関数を作成。自分の値とリスト番号を比べ、親ならば返し、子ならば親を探す
# par[x-1]としているのは、例えばpar[0]=1になっているため
def find(x):
    if par[x - 1] == x:
        return x
    else:
        par[x - 1] = find(par[x - 1])
        return par[x - 1]


# union関数を作成。2つの引数の親を比べ、違う場合は一方の親を一方の子にする
def union(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return 0
    par[x - 1] = y


# 入力すべてでunionする
for j in range(m):
    a, b = map(int, input().split())
    union(a, b)


# n人の親を探して、リストsに入れ、それぞれ親の数をカウントし、最頻値をグループ数とする。
s = [find(i) for i in range(1, n + 1)]
print(1)
#import collections
#c = collections.Counter(s)
#print(max(c.values()))


### FIXED CODE ###

import collections
n, m = map(int, input().split())
par = list(range(2 * n))

# print(par)


# union find(parには0も入れているので、par[1]=1になる)
def find(x):

    while par[x] != x:
        tmp = par[x]
        par[x] = par[par[x]]
        x = par[x]

    return x


def union(x, y):
    x1 = find(x)
    y1 = find(y)
    if x1 != y1:
        par[x1] = y1


# 各要素をunionする
for j in range(m):
    a, b = map(int, input().split())
    union(a - 1, b - 1)

s = [0 for i in range(n + 5)]

# 1～nの親を探してsに入れていき、一番多い親を答えにする
for k in range(n):
    s[find(k)] += 1

print(max(s))
n, m, c = map(int, input().split())
bl = [int(i) for i in input().split()]
ans = 0
for i in range(n):
  al = [int(j) for j in input().split()]
  ans += sum([bl[j] * al[j] for j in range(m)) + c > 0
print(ans)

### FIXED CODE ###

n, m, c = map(int, input().split())
bl = [int(i) for i in input().split()]
ans = 0
for i in range(n):
  al = [int(j) for j in input().split()]
  ans += sum([bl[j] * al[j] for j in range(m)]) + c > 0
print(ans)
s = input()

ichi = 0
cnt = 0
l = len(s)

while True:
    s_dreamer = s.find ("dreamer",ichi,l)
    s_eraser = s.find ("eraser",ichi,l)
    s_dream = s.find ("dream",ichi,l)
    s_erase = s.find ("erase",ichi,l)


    if s_dream == ichi:
        ichi = s_dreamer + 7
        cnt += 7 

    elif s_eras == ichi:
        ichi = s_eraser + 6
        cnt += 6  

    elif s_dreamer == ichi:
        ichi = s_dream + 5
        cnt += 5  

    elif s_eraser == ichi:
        ichi = s_erase + 5
        cnt += 5

    elif cnt == l:
        print("YES")
        break

    else:
        print("NO")
        break

### FIXED CODE ###

s = input()

ichi = 0
l = len(s)
cnt = l

while True:
    s_dreamer = s.rfind ("dreamer",ichi,l)
    s_eraser = s.rfind ("eraser",ichi,l)
    s_dream = s.rfind ("dream",ichi,l)
    s_erase = s.rfind ("erase",ichi,l)

    if s_dreamer == l - 7 and 0 <= l - 7:
        l = s_dreamer
        cnt -= 7 

    elif s_eraser == l - 6 and 0 <= l - 6:
        l = s_eraser
        cnt -= 6  

    elif s_dream == l - 5 and 0 <= l - 5:
        l = s_dream
        cnt -= 5  

    elif s_erase == l - 5 and 0 <= l - 5:
        l = s_erase
        cnt -= 5

    elif cnt == 0:
        print("YES")
        break

    else:
        print("NO")
        break
r=int(input())
print(3.1416*r*2)


### FIXED CODE ###

from math import pi
r = float(input())
a = pi*r*r
b = 2*pi*r
print(a,b)
data = input().split()
print(data.sort()[2]+data.sort()[1])

### FIXED CODE ###

data = input().split()
print(int(sorted(data)[2] + sorted(data)[1]) + int(sorted(data)[0]))
s = input()
x = [s[j] for j in range(0,len(s10))]
x.insert(0,'2')
count = 0
for j in range(1,len(x)):
    if x[j] == '0' and x[j] == x[j-1]:
        x[j] = '1'
        count = count + 1
    elif x[j] == '1' and x[j] == x[j-1]:
        x[j] = '0' 
        count = count + 1
print(count)


### FIXED CODE ###

s = input()
x = [s[j] for j in range(0,len(s))]
x.insert(0,'2')
count = 0
for j in range(1,len(x)):
    if x[j] == '0' and x[j] == x[j-1]:
        x[j] = '1'
        count = count + 1
    elif x[j] == '1' and x[j] == x[j-1]:
        x[j] = '0' 
        count = count + 1
print(count)
s = input()
t = input()
count = 0

for i in range(len(s) - len(t) + 1):
  for j in range(len(t)):
    if s[i+j] == t[j]:
      count += 1
      if count != 0:
      	temp = count
    else:
      count = 0
if temp == len(t):
  temp = 0
print(temp)
   

### FIXED CODE ###

s = input()
t = input()

res = 0
for i in range(len(s) - len(t) + 1):
  count = 0
  for j in range(len(t)):
    if s[i+j] == t[j]:
      count += 1
  res = max(res,count)

print(len(t)- res)
# D - Various Sushi

import sys

N, K = map(int, sys.stdin.buffer.readline().split())
td = []
for _ in range(N):
    tmp1, tmp2 = map(int, sys.stdin.buffer.readline().split())
    td.append([tmp1-1, tmp2, -1])

td = sorted(td, key = lambda x: x[1], reverse = True)
t_counter = [0]*N
for idx in range(N):
    t_counter[td[idx][0]] += 1
    td[idx][2] = t_counter[td[idx][0]]

t_set = set([td[idx][0] for idx in range(K)])
ans_list = []
ans = sum([td[idx][1] for idx in range(K)]) + len(t_set)**2
ans_list.append(ans)

a = 0
b = 0
for add_kind in range(1, len([x for x in t_counter if x > 0]) - len(t_set) + 1):
    while 1:
        if td[K - 1 - a][2] >= 2:
            ans -= td[K - 1 - a][1]
            a += 1
            break
        a += 1
    while 1:
        if td[K + b][0] not in t_set:
            ans -= len(t_set)**2
            t_set.add(td[K + b][0])
            ans += td[K + b][1] + len(t_set)**2
            b += 1
            break
        b += 1
    ans_list.append(ans)

print(max(ans_list))

### FIXED CODE ###

# D - Various Sushi

import sys

N, K = map(int, sys.stdin.buffer.readline().split())
td = []
for _ in range(N):
    tmp1, tmp2 = map(int, sys.stdin.buffer.readline().split())
    td.append([tmp1-1, tmp2, -1])

td = sorted(td, key = lambda x: x[1], reverse = True)
t_counter = [0]*N
for idx in range(N):
    t_counter[td[idx][0]] += 1
    td[idx][2] = t_counter[td[idx][0]]

t_set = set([td[idx][0] for idx in range(K)])
ans_list = []
ans = sum([td[idx][1] for idx in range(K)]) + len(t_set)**2
ans_list.append(ans)

a = 0
b = 0
while 1:
    while K - 1 - a >= 0:
        if td[K - 1 - a][2] >= 2:
            ans -= td[K - 1 - a][1]
            a += 1
            break
        a += 1
    if K-1-a < 0:
        break
    while K + b <= N-1:
        if td[K + b][0] not in t_set:
            ans -= len(t_set)**2
            t_set.add(td[K + b][0])
            ans += td[K + b][1] + len(t_set)**2
            b += 1
            break
        b += 1
    ans_list.append(ans)
    if K+b == N:
        break

print(max(ans_list))
X = int(input())
li = [i**5 for i in range(0,65,1)]
for A in li:
    if A-X in li:#Bが自然数
        B = li.index(A-X)
        break
    elif A-X < 0:#Bが負の実数
        if abs(A-X) in li:
            B = (li.index((A-X)*(-1))) * (-1)
            break

print(li.index(A),B)

### FIXED CODE ###

X = int(input())
li = [i**5 for i in range(0,10000,1)]
for A in li:
    if A-X in li:#Bが自然数
        B = li.index(A-X)
        break
    elif A-X < 0:#Bが負の実数
        if abs(A-X) in li:
            B = (li.index((A-X)*(-1))) * (-1)
            break

print(li.index(A),B)
x = input().split()
A, B = x[0], x[1]
n = 1
t = 0
while n <= B:
  n += A - 1
  t += 1
print(t)

### FIXED CODE ###

x = input().split()
A, B = int(x[0]), int(x[1])
n = 1
t = 0
while n < B:
  n += A - 1
  t += 1
print(t)
# 漸化式的に解く
# 一般性を失わない範囲をちゃんと考える
# 2種類以上あるものは、同じ種類のものとして差し支えない

from collections import defaultdict
N, K = map(int,input().split())
dd = defaultdict(list)
pairs = [list(map(int,input().split())) for _ in range(N)]

# 美味しい順にソート
pairs = sorted(pairs,reverse=True, key=lambda x: x[1])
kinds = [0] * (N+1)

cnt = 0
oisii = []
for t,d in pairs[:K]: #K個上から順番に取ってみる
    kinds[t] += 1
    cnt += d
    # print(t,d)
    oisii.append([t,d])

point = sum([d for t,d in oisii]) + sum([1 for kind in kinds if kind!=0])**2
ans = point
for t,d in pairs[K:]:
    """
    置き換えようとしていたけど
    その必要はなく、
    ほしいのはmax値だけなので、配列そのものを更新し続ける必要はない
    """
    # if kinds[t] == 1:
    #     continue
    # else:
    #     index = K
    #     while True:
    #         t_min, d_min = oisii[index-1]
    #         # 2個以上ある種類のなかで最小値を求める
    #         if kinds[t_min] >= 2:
    #             break
    #         index -= 1
    #         if index == 0:
    #             break
    # if index == 0:
    #     break
    if kinds[t] >= 1:
        continue
    # とりあえず最小だったoisiiを置き換えていく
    t_min, d_min = oisii.pop()
    n = sum([1 for kind in kinds if kind!=0])
    # とりあえず種類を追加
    kinds[t] += 1
    kinds[t_min] -= 1
    point = point - (d_min + n**2)  + (d + (n+1)**2)
    # print(point)
    ans = max(point,ans)
# 集計
print(ans)


### FIXED CODE ###

"""
漸化式的に解く
一般性を失わない範囲をちゃんと考える。
"置き換え可能"というのをどの部分で持たせられるかを考える
今回の場合は、リスト作りの際に作ったので十分
"""

from collections import defaultdict
N, K = map(int,input().split())
# dd = defaultdict(list)
pairs = [list(map(int,input().split())) for _ in range(N)]
# 美味しい順にソート
pairs = sorted(pairs,reverse=True, key=lambda x: x[1])
kinds = set()
change = [] #変更できるもの(2個以上あるもの)



cnt = 0
for t,d in pairs[:K]: #K個上から順番に取ってみる
    if t in kinds:
        change.append(d) 
    kinds.add(t)
    cnt += d

n = len(kinds)
cnt += len(kinds)**2
ans = cnt

"""
K+1以降
Kまでに大きい順に加えたもので、2個以上あるものから順に置き換えていく。
1個のものはそのままで良い。
また、K+1以降で、2回同じものを追加する可能性はない。
なぜなら新規の追加ではないので、その場合はchangeに入ってある美味しさdiよりも
K+1以降のものは必ず低い美味しさの値になっているからである。
"""
for t,d in pairs[K:]:
    # 交換できるものがなくなったら終わり
    if len(change) == 0:
        break
    # 同じものは交換しない
    if t in kinds:
        continue
    d_min = change.pop()
    cnt = cnt - (d_min + n**2)  + (d + (n+1)**2)
    kinds.add(t)
    n += 1
    ans = max(cnt,ans)
# 集計
print(ans)
def get_data():
    array = []
    for i in range(8):
        array.append(input())
        
    return array
def judge():
    array = get_data()
    count = [[0 for i in range(8)] for i in range(8)]
    for i in range(8):
        x = 0
        for j in array[i]:
            if int(j) == 1:
                count[i][x] += 1
            x += 1

    a = 0
    p = []
    for i in range(8):
        for j in range(8):
            if count[i][j] != 0:
                p.append(a)
            a += 1

    if p[0]+1 != p[1]:
        if p[0] + 8*3 == p[3]:
            print('B')
        else:
            if p[0] + 8*2 + 1 == p[3]:
                print('F')
            else:
                print('D')
    else:
        if p[0]+1 == p[1] and p[1]+1 == p[2]:
            print('C')
        else:
            if p[0] + 8 == p[2] and p[1] + 8 == p[3]:
                print('A')
            else:
                if p[0]+8*2 == p[2]:
                    print('G')
                else:
                    print('E')
while True:
    try:
        judge()
    except EOFError:
        break

### FIXED CODE ###

def judge(array):
    count = [[0 for i in range(8)] for i in range(8)]
    for i in range(8):
        x = 0
        for j in array[i]:
            if int(j) == 1:
                count[i][x] += 1
            x += 1

    a = 0
    p = []
    for i in range(8):
        for j in range(8):
            if count[i][j] != 0:
                p.append(a)
            a += 1

    if p[0]+1 != p[1]:
        if p[0] + 8*3 == p[3]:
            print('B')
        else:
            if p[0] + 8*2 + 1 == p[3]:
                print('F')
            else:
                print('D')
    else:
        if p[0]+1 == p[1] and p[1]+1 == p[2]:
            print('C')
        else:
            if p[0] + 8 == p[2] and p[1] + 8 == p[3]:
                print('A')
            else:
                if p[0]+8 == p[3]:
                    print('G')
                else:
                    print('E')
                    
while True:
    try:
        array = []
        for i in range(8):
            array.append(input())
        judge(array)
        input()
    except:
        break
import math

R = int(input())
a = 2*R*pi.math

print(a)

### FIXED CODE ###

import math
R = int(input())

num = 2*R*math.pi
print(f'{num:.3f}')
# -*- coding: utf-8 -*-
# 入力
A, op, B = input().split()
if op == '+':
    print(A + B)
else:
    print(A - B)

### FIXED CODE ###

# -*- coding: utf-8 -*-
# 入力
A, op, B = input().split()
if op == '+':
    print(int(A) + int(B))
else:
    print(int(A) - int(B))
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    H,W = inputMap()
    C = []
    for i in range(H):
        c = inputList()
        C.append(c)
        
    for i in C:
        tmp = "".join(i)
        print(tmp)
        print(tmp)
    
if __name__ == "__main__":
	main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    H,W = inputMap()
    C = []
    for i in range(H):
        c = input()
        C.append(c)
        
    for i in C:
        print(i)
        print(i)
    
if __name__ == "__main__":
	main()
n,m,x=map(int,input().split())
l=[0]*n
for i in range(n):
    long=list(map(int,input().split()))
    l[i]=long

ans=10**9
for i in range(1,1<<n):
    money=0
    a=[0]*n
    for j in range(n):
        if (i>>j)%2==1:
            money+=l[j][0]
            for k in range(m):
                a[k]+=l[j][k+1]
    cnt=0
    for p in a:
        if p>=x:
            cnt+=1
            if cnt==m:
                ans=min(ans,money)
if ans==10**9:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

n, m, X = map(int, input().split())

A = [[] for _ in range(n)]
c = [0] * n

for i in range(n):
    c_as = list(map(int, input().split()))
    c[i], A[i] = c_as[0], c_as[1:]

INF = 10**9
ans = INF
    
for s in range(0, 1 << n):
    smart = [0] * m
    cost_sum = 0
    for i in range(n):
        if (s >> i) % 2 == 0:continue
        cost_sum += c[i]
        for j in range(m):
            smart[j] += A[i][j]
    ok = True
    for j in range(m):
        if smart[j] < X:
            ok = False
    if ok:
        ans = min(ans, cost_sum)

if ans == INF:
    ans = -1

print(ans)
x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if (x in a and y in a):
    ptint("yes")
elif   (x in b and y in b):
    print("Yes")
elif   (x in c and y in c):
    print("Yes")
else:
    print("No")


### FIXED CODE ###

x,y=map(int,input().split())
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=[2]
if x in a and y in a:
    print("Yes")
elif x in b and y in b:
    print("Yes")
elif x in c and y in c:
    print("Yes")
else:
    print("No")
n=int(input())
A=list(int,input(),split())
print("YES" if len(list(set(A)))==len(A) else "NO")


### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
print("YES" if len(set(A))==len(A) else "NO")