Harryxun/stf_run huggingface dataset:
# ABC042B - 文字列大好きいろはちゃんイージー / Iroha Loves Strings (ABC Edition)
def main():
    N, L, A = map(int, open(0).read().split())
    A.sort()
    print("".join(A))


if __name__ == "__main__":
    main()

### FIXED CODE ###

# ABC042B - 文字列大好きいろはちゃんイージー / Iroha Loves Strings (ABC Edition)
n, l = list(map(int, input().rstrip().split()))
lst = sorted([input().rstrip() for _ in range(n)])
for i in lst:
    print(i, end="")
x, a, b = map(int, input().split())
if abs(x - a) < abs(x - b):
  print(A)
else:
  print(B)

### FIXED CODE ###

x, a, b = map(int, input().split())
if abs(x - a) < abs(x - b):
  print('A')
else:
  print('B')
n = int(input())
w = [input().rsprit() for i in range(n)]
use = [w[0]]
for i in range(1,n):
  if w[i][0] == w[i-1][-1] and w[i] not in use:
    use.append(w[i])
  else:
    print('No')
    exit()
print('Yes')

### FIXED CODE ###

n = int(input())
data = [input().rstrip() for _ in range(n)]
used = [data[0]]
 
for i in range(1, n):
    if data[i][0] == data[i - 1][-1] and data[i] not in used:
        used.append(data[i])
    else:
        print("No")
        exit()
print('Yes')
def lcs_better(X, Y):
    costs = [0]
    for c in Y:
        for i in range(len(costs) - 1, -1, -1):
            tmp = X.find(c, costs[i])
            if tmp + 1:
                if i + 1 < len(costs):
                    costs[i + 1] = min(costs[i + 1], tmp + 1)
                else:
                    costs.append(tmp + 1)
    return len(costs) - 1


def answer(X, Y):
    m, n = len(X), len(Y)
    C = [[0] * (n + 1) for _ in range(m + 1)]
    for i in range(1, m + 1):
        for j in range(1, n + 1):
            if X[i - 1] == Y[j - 1]:
                C[i][j] = C[i-1][j-1] + 1
            else:
                C[i][j] = max(C[i][j -1], C[i -1][j])
    return C[m][n]


if __name__ == '__main__':
    q = int(input())
    for _ in range(q):
        X = list(input())
        Y = list(input())
        print(lcs_better(X, Y))

### FIXED CODE ###

def lcs_better(X, Y):
    costs = [0]
    for c in Y:
        for i in range(len(costs) - 1, -1, -1):
            tmp = X.find(c, costs[i])
            if tmp + 1:
                if i + 1 < len(costs):
                    costs[i + 1] = min(costs[i + 1], tmp + 1)
                else:
                    costs.append(tmp + 1)
    return len(costs) - 1


def answer(X, Y):
    m, n = len(X), len(Y)
    C = [[0] * (n + 1) for _ in range(m + 1)]
    for i in range(1, m + 1):
        for j in range(1, n + 1):
            if X[i - 1] == Y[j - 1]:
                C[i][j] = C[i-1][j-1] + 1
            else:
                C[i][j] = max(C[i][j -1], C[i -1][j])
    return C[m][n]


if __name__ == '__main__':
    q = int(input())
    for _ in range(q):
        X = input()
        Y = input()
        print(lcs_better(X, Y))
s=list(map(int,input().split("/")))
 
if s[0]<=2018:
  print(Heisei)
elif s[0]=2019 and s[1]<5:
  print(Heisei)
else:
  print(TBD)

### FIXED CODE ###

s=list(map(int,input().split("/")))
 
if s[0]<=2018:
  print("Heisei")
elif s[0]==2019 and s[1]<5:
  print("Heisei")
else:
  print("TBD")
a,b=map(int,input().split())
def gcd(a, b):
  while b:
    a, b = b, a % b
  return a
def cf(x1,x2):
    cf=[]
    for i in range(2,min(x1,x2)+1):
        if x1 % i == 0 and x2 % i == 0:
            cf.append(i)
    return cf

ans = cf(a,b)
i = len(ans)
j = len(ans)
cnt = 0
while cnt != len(ans)-2:
  if ans[i-1] % ans[j-2] == 0:
    ans[i-1]=0
    i -= 1
    j = i-1
    cnt += 1
    continue
  j-=1
  if j < 0:
    i -= 1
    j = i - 1
    cnt += 1
    continue

print(len(ans)+1)

### FIXED CODE ###

a,b=map(int,input().split())
def gcd(a, b):
  return a if b == 0 else gcd(b, a%b)

def factorize(n):
  a = []
  while n % 2 == 0:
    a.append(2)
    n /= 2
  f = 3
  while f * f <= n:
    if n % f == 0:
      a.append(f)
      n /= f
    else:
      f += 2
  if n != 1: a.append(n)
  return a

print(len(set(factorize(gcd(a,b))))+1)
s=sorted(str(input()))
t=sorted(str(input(),reverse=True))
if s<=t:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a,b = map(int, input().split())
print(int((a+b+2-1)/2))
n, x = map(int,input().split())
xl = list(map(int,input().split()))

xl.append(x)
xl.sort()
sa = []
onesam = 2000000000
for i in range(len(xl)-1):
    one_sa = xl[i+1] - xl[i]
    if one_sa % onesam == 0:
        continue
        
    if onesam > one_sa:
        onesam = one_sa
        
    
sa.sort()
samin = min(sa)

flag = 0
while flag == 0:
    amari = 0
    for i in sa:
        amari += i % samin
        if amari != 0:
            break
            
    if amari == 0:
        flag = 1
        break
    else:
        for j in range(1,samin+1):
            if samin % j == 0:
                samin = samin // j
                break
print(samin)
        

### FIXED CODE ###

n, x = map(int,input().split())
xl = list(map(int,input().split()))

xl.append(x)
xl.sort()

onesam = 0

if len(xl) == 1:
    print(abs(xl[0] - x))
    exit()

for i in range(len(xl)-1):
    one_sa = xl[i+1] - xl[i]
    if onesam == 0:
        onesam = abs(one_sa)
    else:
        short,big = min(onesam,one_sa),max(onesam,one_sa)
        if big % short == 0:
            onesam = short
            continue
        else:
            while big % short != 0:
                short = short -1
#                 for k in range(2,short+1):
#                     if short % k == 0:
#                         short = short // k
#                         break
            onesam = short
            
print(onesam)
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
# def LIST(): return list(map(str, input().split()))
# def LIST(): return list(input())

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
A = [INT() for _ in range(M)]

b = [0] * (N + 2)
# 壊れているところが1
for i in A:
    b[i] = 1

dp = [0] * (N + 2)
# for i in range():

dp[0] = 1

if b[1] == 1:
    # あなあいてるのでそのルートは考えられない
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2, N + 1):
    if b[i] == 1:
        dp[i] = 0
    else:
        dp[i] = dp[i-1] + dp[i-2]

ans = dp[i] % mod
print(ans)


### FIXED CODE ###


import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
# def LIST(): return list(map(str, input().split()))
# def LIST(): return list(input())

sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N, M = MAP()
A = [INT() for _ in range(M)]

b = [0] * (N + 2)
# 壊れているところが1
for i in A:
    b[i] = 1

dp = [0] * (N + 2)
# for i in range():

dp[0] = 1

if b[1] == 1:
    # あなあいてるのでそのルートは考えられない
    dp[1] = 0
else:
    dp[1] = 1

for i in range(2, N + 1):
    if b[i] == 1:
        dp[i] = 0
    else:
        dp[i] = dp[i-1] + dp[i-2]

ans = dp[N] % mod
print(ans)
n,k=map(int, input().split()) 
p=list(map(int, input().split()))

new_p = [(1+i)/2 for i in p]
box=[]
sec_box=[]
s=0
for i in range(n):
    s = sum(new_p[:i])
    box.append(s)
    if i>k:
        sec_box.append(box[i]-box[i-k])
print(max(sec_box))
    

### FIXED CODE ###

n,k=map(int, input().split()) 
p=list(map(int, input().split()))
E = []
for e in p:
    E.append( (1+e)/2 )

s=0
for i in range(k):
    s += E[i]
    
box=[]
box.append(s)
for i in range(k,n):
    s += E[i] - E[i-k]
    box.append(s)
    
print(max(box))
N, M = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)

cost = [0,2,5,5,4,5,6,3,7,6]

dp = [0 for _ in range(N + 1)] #dp[i] i本のマッチを使って作れる最大の桁数

for i in range(1, N + 1):
    for a in A:
        if i - cost[a] >= 0:
            dp[i] = max(dp[i], dp[i - cost[a]] + 1)

ans = ''

i = N
for k in range(dp[N]):
    for a in A:
        if dp[i - cost[a]] == dp[i] - 1:
            if k == dp[N] - 1 and i != cost[a]:
                continue
            ans += str(a)
            i -= cost[a]
            break

print(ans)

### FIXED CODE ###

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

A.sort(reverse=True)

cost = [0,2,5,5,4,5,6,3,7,6]

dp = [-1 for _ in range(N + 1)] #dp[i] i本のマッチを使って作れる最大の桁数
dp[0] = 0

for i in range(1, N + 1):
    for a in A:
        if i - cost[a] >= 0:
            dp[i] = max(dp[i], dp[i - cost[a]] + 1)

ans = ''

i = N
for k in range(dp[N]):
    for a in A:
        if i - cost[a] >= 0 and dp[i - cost[a]] != -1 and dp[i - cost[a]] == dp[i] - 1:
            ans += str(a)
            i -= cost[a]
            break

print(ans)
n,k=map(int,input().split())
h=sorted([int(input()) for _ in range(n)])
x=10**9
for i in range(n-k+1):
  x=min(x,h[i+k]-h[i])
print(x)

### FIXED CODE ###

n,k=map(int,input().split())
h=sorted([int(input()) for _ in range(n)])
x=10**9
for i in range(n-k+1):
  x=min(x,h[i+k-1]-h[i])
print(x)
N = int(input())
n = len(str(N))

def count_753(n):
    if n == 3:
        return (6, 18, 3)
    else:
        num_753 = count_753(n-1)[0] * 3 + count_753(n-1)[1]
        num_75 = count_753(n-1)[1] * 2 + count_753(n-1)[2] * 2
        return (num_753, num_75, 3)

if n <= 2:
    print(0)
else:
    count = 0
    for i in range(3, n+1):
        count += count_753(i)[0]
    #print('count :', count)

    for i in itertools.product(['7', '5', '3'], repeat=n):
        if len(set(i)) <= 2:
            continue
        s = 0
        for j,k in zip(range(n), reversed(range(n))):
            s += int(i[j]) * (10**k)
        if s > N:
            count -= 1
    
    print(count)

### FIXED CODE ###

import itertools

N = int(input())
n = len(str(N))

def count_753(n):
    if n == 3:
        return (6, 18, 3)
    else:
        num_753 = count_753(n-1)[0] * 3 + count_753(n-1)[1]
        num_75 = count_753(n-1)[1] * 2 + count_753(n-1)[2] * 2
        return (num_753, num_75, 3)

if n <= 2:
    print(0)
else:
    count = 0
    for i in range(3, n+1):
        count += count_753(i)[0]
    #print('count :', count)

    for i in itertools.product(['7', '5', '3'], repeat=n):
        if len(set(i)) <= 2:
            continue
        s = 0
        for j,k in zip(range(n), reversed(range(n))):
            s += int(i[j]) * (10**k)
        if s > N:
            count -= 1
    
    print(count)
A, B = list(map(int, input()))

x = -1
for i in range(10100):
  if (int(i*0.08) == A) and (int(i*0.1) == B):
    x = i
    break
  
print(x)

### FIXED CODE ###

A, B = list(map(int, input().split()))

x = -1
for i in range(10100):
  if (int(i*0.08) == A) and (int(i*0.1) == B):
    x = i
    break
  
print(x)
a, b = map(int, input().split())
print(str(a * b) + " " + str((a + b) * 2))

### FIXED CODE ###

a, b = map(int, raw_input().split())
print(str(a * b) + " " + str((a + b) * 2))
import java.util.Scanner;

class Main {

  static boolean RS(String S, int n) {
    
    if (n%2 == 1) return false;
      
    for(int i = 0; i < n/2; i++)
      if(S.charAt(i)) != S.charAt(i+n/2))
        return false;
      
    return true;
  }
  
  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    
    int n = stdIn.next();
    String S = stdIn.next();
     
    switch(RS(S, n)) {
     case true: System.out.println("Yes"); break;
     case false: System.out.println("No"); break;
    }
  }
}


### FIXED CODE ###

n = int(input())
S = input()
b = 0
if n % 2 == 0:
  h = int(n/2)
  b = 1
  for i in range(h):
    if S[i] != S[i+h]:
      b = 0
print("Yes" if b == 1 else "No")
n,m=list(map(int,input().split()))
t=np.zeros(m)
for i in range(n):
  tmp=list(map(int,input().split()))  
  for j in range(tmp[0]):
    t[tmp[j+1]-1] += 1
  
maxIndex = [i for i, x in enumerate(t) if x == max(t)]
print(len(maxIndex)

### FIXED CODE ###

import numpy as np

n,m=list(map(int,input().split()))
t=np.zeros(m)
for i in range(n):
  tmp=list(map(int,input().split()))  
  for j in range(tmp[0]):
    t[tmp[j+1]-1] += 1
  
maxIndex = [i for i, x in enumerate(t) if x == n]
print(len(maxIndex))
import sys

class Card:
    def __init__(self, num, kind):
        self.kind = kind
        self.num = num

def list_to_string(array):
    s = ""
    for n in array:
        s += str(n) + " "
    return s.strip()
    
def swap(array, i, j):
    tmp = array[i]
    array[i] = array[j]
    array[j] = tmp

def is_stable(array1, array2):
    if reduce(lambda x, y: x and y, map(lambda x: x[0] == x[1], zip(array1, array2))):
        return "Stable"
    else:
        return "Not stable"

def bubble_sort(array):
    for i in range(0, len(array)):
        for j in reversed(range(i+1, len(array))):
            if array[j].num < array[j-1].num:
                swap(array, j, j-1)
        
def selection_sort(array):
    for i in range(0, len(array)):
        min_index = i
        for j in range(i, len(array)):
            if array[min_index] > array[j]:
                min_index = j
        swap(array, i, min_index)

def main():
    num = int(sys.stdin.readline().strip())
    array = map(lambda x: int(x), sys.stdin.readline().strip().split(" "))

    a = list(array)
    b = list(array)

    print list_to_string(bubble_sort(a))
    print is_stable(a, array)
    print list_to_string(selection_sort(b))
    print is_stable(b, array)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys

class Card:
    def __init__(self, kind, num):
        self.kind = kind
        self.num = num
    def __eq__(self, other):
        return (self.kind == other.kind) and (self.num == other.num)
    def __ne__(self, other):
        return not ((self.kind == other.kind) and (self.num == other.num))
    def __str__(self):
        return self.kind + self.num

def list_to_string(array):
    s = ""
    for n in array:
        s += str(n) + " "
    return s.strip()
    
def swap(array, i, j):
    tmp = array[i]
    array[i] = array[j]
    array[j] = tmp

def is_stable(array1, array2):
    if reduce(lambda x, y: x and y, map(lambda x: x[0] == x[1], zip(array1, array2))):
        return "Stable"
    else:
        return "Not stable"

def bubble_sort(array):
    for i in range(0, len(array)):
        for j in reversed(range(i+1, len(array))):
            if array[j].num < array[j-1].num:
                swap(array, j, j-1)
    return array
        
def selection_sort(array):
    for i in range(0, len(array)):
        min_index = i
        for j in range(i, len(array)):
            if array[min_index].num > array[j].num:
                min_index = j
        swap(array, i, min_index)
    return array

def main():
    num = int(sys.stdin.readline().strip())
    array = map(lambda x: Card(x[0], x[1]), sys.stdin.readline().strip().split(" "))

    a = list(array)
    b = list(array)

    print list_to_string(bubble_sort(a))
    print "Stable"
    print list_to_string(selection_sort(b))
    print is_stable(a, b)

if __name__ == "__main__":
    main()
arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = input()
print(arr[int(n)+1])

### FIXED CODE ###

arr = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
n = input()
print(arr[int(n)-1])
#!/usr/bin/env python
a = input()
b = input()
c = input()
d = input()
e = input()
k = input()

if int(e) - int(a) > k:
    print(":(")
else:
    print("Yay!")

### FIXED CODE ###

#!/usr/bin/env python
a = input()
b = input()
c = input()
d = input()
e = input()
k = input()

if int(e) - int(a) > int(k):
    print(":(")
else:
    print("Yay!")
n = int(input())
s = input()
t = 0
for i in range(len(s)-1):
  a = {s[:i]} 
  b = {s[i+1:]}
  c = a & b
  print(c)
  if c > t:
    t = c

print(c)


  
  
  

### FIXED CODE ###

n = int(input())
s = input()
ans = 0
for i in range(1,n):
  a = set([j for j in s[:i]])
  b = set([k for k in s[i:]])
  c = a & b
  d = len(c)
  if d > ans:
    ans = d    
print(ans)
N, Q = map(int, input().split())
V = [[] for _ in range(N)]
X = [0 for _ in range(N)]

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

for _ in range(Q):
    p, x = map(int, input().split())
    p -= 1
    X[p] += x
# p親、n現在、s合計
def dfs(p, n, s):
    X[n] += s
    for i in V[n]:
        if i == p:
            continue
        else:
            dfs(n, i, X[n])
dfs(-1,0,0)
for i in range(N):
    print(X[i], end=" ")
        

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
def input():
    return sys.stdin.readline()[:-1]
 
n , q = map(int,input().split())
point = [0] * n
edge = [[] for i in range(n)]
 
for i in range(n-1):
    a,b = map(int, input().split())
    a -= 1
    b -= 1
    edge[a].append(b)
    edge[b].append(a)
 
for _ in range(q):
    a , b = map(int,input().split())
    point[a-1] += b
 
def dfs(now, last=-1):
    for nxt in edge[now]:
        if nxt==last: continue
        point[nxt] += point[now]
        dfs(nxt, now)
dfs(0)
print(*point)
import itertools
K, N = map(int, input().split())
A = list(map(int, input().split()))

A_list = list(itertools.permutations(l, N))
ans = 10**8
for i in A_list:
    tmp = 0
    
    if i[0] == min(A) and i[2] == max(A):
        pass
    else:
        for j in range(N-1):
            if abs((i[j+1]) - (i[j])) <= abs(K-i[j+1]):
                tmp = tmp +  abs((i[j+1]) - (i[j]))
            else:
                tmp = tmp + abs(K-i[j+1])
        
        if tmp <= ans:
            ans = tmp
print(ans)

### FIXED CODE ###

K,N = map(int, input().split())
A = [int(a) for a in input().split()]

ans = A[-1]-A[0]
for i in range(N-1):
    ans = min(ans, K-A[i+1]+A[i])
print(ans)
s = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
    n = int(input())
    for i in range(n):
        b, f, r, v = map(int, raw_input().split())
        s[b-1][f-1][r-1] += v
 
    for b in range(4):
        for f in range(3):
            print(" " + " ".join(map(str, s[b][f])))
        if b != 3:
            print("#"*20)

### FIXED CODE ###

n = int(raw_input())
ans = ""

room = [[[0 for i in range(10)] for j in range(3)] for k in range(4)]
for i in range(n):
    b, f, r, v = map(int, raw_input().split())
    room[b-1][f-1][r-1] += v
    
for i in range(4):
    for j in range(3):
        for k in range(10):
            ans += " %d" % (room[i][j][k])
        print ans
        ans = ""
    if i != 3:
        print "#"*20
import math 
A, B, H, M = map(int, input().split())
 
pai = math.pi
 
#HとMを正規化する事で、針間の角度を算出している
angle = 2*pai*((H+M/60)/12 - M/60)
 
#余弦定理
distance = np.sqrt(A**2+B**2-2*A*B*math.cos(angle))
print(distance)

### FIXED CODE ###

import math
 
A,B,H,M = map(int,input().split())
 
radH = 2*math.pi*H/12 + 30/180*math.pi*M/60
radM = 2*math.pi*M/60
 
L = math.sqrt(A**2+B**2-2*A*B*math.cos(radH-radM))
 
print(L)
a = input()
b = input()

a_len = len(a)
b_len = len(b)

huku = []

for i in range(a_len):
    if a_len != b_len & i==a_len:
        break
    else:
        huku.append(a[i])
        huku.append(b[i])
for i in range(len(huku)):
    print(huku[i],end="")

### FIXED CODE ###

a = input()
b = input()

a_len = len(a)
b_len = len(b)

huku = []

for i in range(a_len):
    if a_len != b_len and i==a_len-1:
        huku.append(a[i])
        break
    else:
        huku.append(a[i])
        huku.append(b[i])
for i in range(len(huku)):
    print(huku[i],end="")
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N=int(input())
K=int(input())
X=int(input())
Y=int(input())

	
print(N*X-(max((N-K),0)*(X-Y))


### FIXED CODE ###

import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
N=int(input())
K=int(input())
X=int(input())
Y=int(input())

	
print(N*X-(max((N-K),0)*(X-Y)))
n=int(input())
x=list(map(int, input().split()))
a=list(range(1,n+1))
b=list(range(n,0,-1))
for i,j in enumerate(b):
    b[j-1]+=i
print(*a)
print(*b)

### FIXED CODE ###

n=int(input())
c=list(map(int, input().split()))
a=list(range(n,n**2+1,n))
b=list(range(n**2,0,-n))
for i in range(n):
    b[c[i]-1]+=i
    
for i in a:
    print(i,end=' ')
print()
for i in b:
    print(i,end=' ')
print()
import itertools
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, m, x = map(int, readline().split())
c = [list(map(int, readline().split())) for _ in range(n)]

ans = 10 ** 9 + 7
for l in list(itertools.product([0, 1], repeat=n)):
    cart = [0] * (m + 1)
    for i, a in enumerate(l):
        if a == 1:
        array = c[i]
        cart = list(map(lambda x,y: x+y, cart, array))
    if min(cart[1::]) >= x:
        ans = min(ans, cart[0])
print(ans if ans != 10 ** 9 + 7 else '-1')

### FIXED CODE ###

import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n, m, x = map(int, readline().split())
c = [list(map(int, readline().split())) for _ in range(n)]

ans = float('inf')
# bit全探索
for i in range(2 ** n):
    bag = np.empty(m+1)
    total = 0
    for j in range(n):
        if ((i >> j) & 1):
            bag += np.array(c[j])
        if np.amin(bag[1::]) >= x:
            ans = min(ans, bag[0])
            
print('-1'if ans == float('inf') else int(ans))
import sys
import math
#import numpy as np

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

N = ri()
X = rl()
MOD = 10 ** 9 + 7
limit = math.factorial(N-1)
last = X[-1]
X = [last - x for x in X] #最後までの距離
answer = 0
for i in range(1, N):
    answer += (X[i-1] * limit / i)%MOD
    answer %= MOD

print(answer)



### FIXED CODE ###

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

def cumprod(arr, MOD):
    L = len(arr); Lsq = int(L**.5+1)
    arr = np.resize(arr, Lsq**2).reshape(Lsq, Lsq)
    for n in range(1, Lsq):
        arr[:, n] *= arr[:, n-1]; arr[:, n] %= MOD
    for n in range(1, Lsq):
        arr[n] *= arr[n-1, -1]; arr[n] %= MOD
    return arr.ravel()[:L]

def make_fact(U, MOD):
    x = np.arange(U, dtype=np.int64); x[0] = 1
    fact = cumprod(x, MOD)
    x = np.arange(U, 0, -1, dtype=np.int64); x[0] = pow(int(fact[-1]), MOD-2, MOD)
    fact_inv = cumprod(x, MOD)[::-1]
    return fact, fact_inv

MOD = 10 ** 9 + 7
U = 10 ** 5 + 10 # 階乗テーブルの上限
fact, fact_inv = make_fact(U, MOD)
N = ir()
X = np.array(lr())

inv = np.zeros(U, np.int64)
inv[1:] = fact_inv[1:] * fact[:-1] % MOD
coef = inv[1:N].cumsum() % MOD
answer = (np.diff(X) * coef % MOD).sum() % MOD
answer *= fact[N-1]
print(answer % MOD)
# 35
s = input()

a = x

print('a' * len(s))

### FIXED CODE ###

s = input()
print('x' * len(s))
import math
def main():
	N = int(input())
	P = int(math.log(N,5))
	ans = 0
	if N%2 == 1:
		print(0)
	else:
		ans = [int((N/2)/int(pow(5,p))) for p in range(1,P)]
		print(sum(ans)+1)

if __name__ == '__main__':
	main()

### FIXED CODE ###

import math
def main():
	N = int(input())
	if N%2 == 1 or N==0:
		print(0)
	else:
		N = N//2
		P = int(math.log(N,5))
		ans = [ N//(5**p) for p in range(1,P+1)]
		print(sum(ans))

if __name__ == '__main__':
	main()
a=int(input())

print(a*π)

### FIXED CODE ###

a=int(input())

print(a*2*3.14)