Harryxun/stf_run huggingface dataset:
s = input()
K = int(input())
sub = {}
for d in range(1,6):
    for i in range(len(s)-d+1):
        sub |= {s[i:i+d]}
print(sorted(sub)[K-1])

### FIXED CODE ###

s = input()
K = int(input())
sub = {s}
for d in range(1,6):
    for i in range(len(s)-d+1):
        sub |= {s[i:i+d]}
sub = list(sub)
n = len(sub)
for i in range(K):
    for j in range(n-i):
        a, b = sub[-i-1], sub[j]
        if a > b: sub[-i-1], sub[j] = b, a
print(sub[-K])
import fractions
a,b,c,d=map(int,input().split())

cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
s=b//(c*d//fractions.gcd(c,d))-(a-1)//(c*d//fractions.gcd(c,d))


print((b-(a-1)-(cc+dd-s)))

### FIXED CODE ###

a=list(input())

ans=0
for i in range(int(len(a))-1):
    if a[i]==a[i+1]:
        ans+=1
    else:
        ans+=0

if ans==0:
    print('Good')
else:
    print('Bad')
from math import factorial, log, floor
N = int(input())

if N % 2 != 0: print(0)
else:
    k = N//2
    ans = 0
    for i in range(1,int(log(k,5))+1):
        ans += floor(k/5**i)
    print(ans)

### FIXED CODE ###

from math import log
N = int(input())

if (N % 2 != 0) or N == 0: print(0)
else:
    k = N//2
    ans = 0
    for i in range(1,int(log(k,5)+1)):
        ans += k//(5**i)
    print(ans)
# https://atcoder.jp/contests/abc094/tasks/arc095_b
n = int(input())
nums = [int(i) for i in input().split()]

# すべてを計算する時間はなさそう
# 最大のモノを選らんで、それと絶対値差が大きいモノを選ぶ。いや、ここは全部やればいいのかな。
mod = (10 ** 9 + 7) ** 2
MAX = 2 * (10 ** 5) + 1 # これは変動するので注意。せいぜい10 ** 6くらいまでがTLEの限界

def com_init(MAX, mod):
    fac = [0] * MAX
    finv = [0] * MAX
    inv = [0] * MAX
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod
    return fac, finv

fac, finv = com_init(MAX, mod)

def nCr(n, r):
    if n < r:
        return 0
    elif n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod

t = -float('inf')
MAX = max(nums)
ans = None
for num in nums:
    if num == MAX:
        continue
    r = nCr(MAX, num)
    if r > t:
        t = r
        ans = (MAX, num)
print(*ans)

### FIXED CODE ###

# https://atcoder.jp/contests/abc094/tasks/arc095_b
n = int(input())
nums = [int(i) for i in input().split()]

# すべてを計算する時間はなさそう
# 最大のモノを選らんで、それと絶対値差が大きいモノを選ぶ。いや、ここは全部やればいいのかな。
# numsの値がめちゃくちゃでかいので、全部はできない。

MAX = max(nums)
t = 0
ans = 0
for num in nums:
    if num == MAX:
        continue
    d = min(MAX - num, num)
    if t < d:
        t = d
        ans = num
print(MAX, ans)
N,M=map(int,input().split())
keep=[]
lis=[]
ac=[0]*N
wa=[0]*N
WA=0
for i in range(M):
    ps=input().split()
    keep.append(ps)
    
for j in range(M):
    if keep[j][1]=="AC":
        ac[int(keep[j][0])-1]=1
    elif ac[int(keep[j][0])-1]==0:
        wa[int(keep[j][0])-1]+=1
AC=sum(ac)
for j in range(M):
    WA+=ac[j]*wa[j]
    
print(AC,WA)


### FIXED CODE ###

N,M=map(int,input().split())
keep=[]
lis=[]
ac=[0]*N
wa=[0]*N
WA=0
for i in range(M):
    ps=input().split()
    keep.append(ps)
    
for j in range(M):
    if keep[j][1]=="AC":
        ac[int(keep[j][0])-1]=1
    elif ac[int(keep[j][0])-1]==0:
        wa[int(keep[j][0])-1]+=1
AC=sum(ac)
for k in range(N):
    WA+=ac[k]*wa[k]
    
print(AC,WA)
N,T = list(map(int, input().split()))
max = 10000
for i in range(N):
    c,t = list(map(int, input().split()))
    if t <= T and c < max:
        max = c
if max == 10000:
    print("TLE")
else:
    print(max)

### FIXED CODE ###

n = input()
if n == "1":
    print("Hello World")
else:
    a = int(input())
    b = int(input())
    print(a+b)
a = int(input()) #ch
b = int(input())  #ch
h = int(input())  #hour
m = int(input())  #minits

import math

ang = abs(h * 30 + m * 0.5- m * 6)

if angle > 180:
    angle = 360 - angle
if ang==180:
  print(a+b)
elif(ang==0):
  print(abs(b - a)):
else:
cos = math.cos(math.radians(angle))
ans = (a * a) + (b * b) - (2 * a * b * cos)
print(math.sqrt(ans))



### FIXED CODE ###

import math

a, b, h, m = map(int, input().split())
h=h*60+m

ang=abs(h*0.5-m*6)
if ang > 180:
  ang = 360-ang
if ang==180:
  print(a+b)
elif(ang==0):
  print(abs(b-a))
else:
  ans=(a**2)+(b**2)-(2*a*b*math.cos(math.radians(ang)))
  print(math.sqrt(ans))
N = int(input())
k = 0
lis = list(range(1, N+1))
for i in range(1, N+1):
  a = int(input())
  if a == lis[i-1]:
    k += 10
  else:
    k += 0
if k >= 10 * (N-2):
  print('YES')
else:
  print('NO')



### FIXED CODE ###

A, B = map(int, input().split())
 
if (A + B)%2 == 0:
  k = (A + B)/2
  print(round(k))
else:
  print('IMPOSSIBLE')
min = int(input())
max = int(input())+1
power = int(input())

count = 0
for i in range(min, max):
    if i % power == 0:
        count += 1

print(count)


### FIXED CODE ###

param = input()
min, max, power = (param.split())

count = 0
for i in range(int(min), int(max)+1):
    if i % int(power) == 0:
        count += 1

print(count)
n,m=map(int,input().split())
e=[]
for i in range(n):
    e.append(list(map(int,input().split())))
ans=0
for i in range(m):
    nall=[]
    for j in range(m):
        if i==j:
            continue
        nall.append(e[j])
    visited=[0]*n
    visited[0]=1
    t=[1]
    while len(t)>0:
        tmp=[]
        ntmp=[]
        for p in t:
            visited[p-1]=1
            for q in nall:
                if q[0]==p:
                    if visited[q[1]-1]==0:
                        tmp.append(q[1])
                        visited[q[1]-1]=1
                elif q[1]==p:
                    if visited[q[0]-1]==0:
                        tmp.append(q[0])
                        visited[q[0]-1]=1
                else:
                    if visited[q[0]-1]==0 and visited[q[1]-1]==0:
                        ntmp.append(q)
        t=tmp
        nall=ntmp
    if sum(visited)!=n:
        ans+=1
print(ans)
                    


### FIXED CODE ###

n,m=map(int,input().split())
e=[]
for i in range(m):
    e.append(list(map(int,input().split())))
ans=0
for i in range(m):
    g=[[] for _ in range(n)]
    for j in range(m):
        if i==j:
            continue
        g[e[j][0]-1].append(e[j][1])
        g[e[j][1]-1].append(e[j][0])
    visited=[0]*n
    visited[0]=1
    q=[1]
    while len(q)>0:
        a=q.pop(0)
        visited[a-1]=1
        for k in g[a-1]:
            if visited[k-1]==0:
                q+=[k]
    if sum(visited)!=n:
        ans+=1
print(ans)
N,T = map(int,input().split())
CT = [list(map(int,input().split())) for i in range(N)]
CT = list(filter(lambda x:x[1]<=N,CT))
print(min(CT[0]))

### FIXED CODE ###

N,T = map(int,input().split())
CT = [list(map(int,input().split())) for i in range(N)]
CT = list(filter(lambda x:x[1]<=T,CT))
if len(CT)==0:
    print('TLE')
else:
    print(min(CT)[0])
#include<stdio.h>

int main(void){
    int a,b;
    scanf("%d\n",&a);
    scanf("%d\n",&b);
    if(a==b){
        printf("EQUAL\n");
    }else{
        if (a>b){
            printf("GREATER\n");
        }
        else{
            printf("LESS\n");
        }
    }
}


### FIXED CODE ###

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

a = int(input())
b = int(input())
if a == b:
    print("EQUAL")
elif a < b:
    print("LESS")
else:
    print("GREATER")
n = int(input())
s = input()
cnt = 1
for i in rage(n-1):
  if(s[i]!=s[i+1]):
    cnt = cnt+1
print(cnt)

### FIXED CODE ###

n = int(input())
s = input()
cnt = 1
for i in range(n-1):
  if(s[i]!=s[i+1]):
    cnt = cnt+1
print(cnt)
n, X = map(int, input().split())
x = [int(i) - X for i in input().split()]

import math
from functools import reduce

def gcd(*numbers):
   return reduce(math.gcd, numbers)

print(gcd(*x))


### FIXED CODE ###

from fractions import gcd

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

z = list(map(lambda i: abs(X - i), x))
ans = z[0]
for i in range(1, n):
   ans = gcd(ans, z[i])
print(ans)
from math import log2
import sys
N, K = [int(x) for x in input().split()]
a = [int(y) for y in input().split()]
cand = [i for i in range(K)]


def nketame(a, n):
    return (a & (1 << (n-1))) >> (n-1)


def f(x):
    return sum([y ^ x for y in a])


if K == 0:
    print(f(0))
    sys.exit(1)

k = int(log2(K)+1)              # keta
# print(k)
ans = 0
for i in range(k, 0, -1):
    # print("sum", [nketame(x, i) for x in a])
    if sum([nketame(x, i) for x in a]) > int(N/2):
        ans += 0
    else:
        ans += 1
    # print("ans", "{0:08b}".format(ans << (i-1)), ans << (i-1))
    cand = [x for x in cand if nketame(x, i) == (ans & 1)]
    # print("cand", cand)
    if len(cand) == 1:
        break
    ans = ans << 1

ans = ans << (i-1)
# print("A", ans)
# print("f(A)", f(ans))
print(f(ans))

# for x in a:
#     print("0b{0:08b}".format(x))
# for i in range(K):
#     print("i:{0}, 0b{1:08b}".format(i, i))

# for i in range(K):
#     ans = sum([x ^ i for x in a])
#     print("f({0}) = {1:08b} = {2}".format(i, ans, ans))


### FIXED CODE ###

from math import log2
import sys
N, K = [int(x) for x in input().split()]
a = [int(y) for y in input().split()]


def nketame(a, n):
    return (a & (1 << n)) >> n


def f(x):
    return sum([y ^ x for y in a])


if K == 0:
    print(f(0))
else:
    ans = []
    b = 0
    for i in range(int(log2(K))+1, 0, -1):
        # print("i", i)
        c = [nketame(x, i-1) for x in a].count(1)
        if c < N-c:
            bb = b + (1 << (i-1))
        else:
            bb = b
        if bb <= K:
            b = bb
            ans.append(b)
    # print(ans)
    print(f(max(ans)))

    # 全列挙
    # print("true ", max([(x, f(x)) for x in range(K+1)], key=lambda x: x[1]))
N=int(input())

if N%2==0:
	print(1/2)
else:
	print((n+1)/2)

### FIXED CODE ###

N=int(input())

if N%2==0:
	print(1/2)
else:
	print((N+1)/(2*N))
N=int(input())
H=list(map(int,input().split()))
answer='Yes'
for i in range(N-1):
    if H[N-1-i]>=H[N-2-i]:
        answer='Yes'
    elif H[N-1-i]+1==H[N-2-i]:
        H[N-2-i]-=1
    else:
        answer='No'
    print(H)
print(answer)

### FIXED CODE ###

N=int(input())
H=list(map(int,input().split()))
answer='Yes'
for i in range(N-1):
    left=H[N-2-i]
    right=H[N-1-i]
    if left<=right and answer=='Yes':
        answer='Yes'
    elif left==right+1 and answer=='Yes':
        H[N-2-i]-=1
    else:
        answer='No'
print(answer)
N=int(input())

print(int(((N-1)*N/2))

### FIXED CODE ###

N=int(input())

print((N-1)*N//2)
import math
A, B = map(int, input().split())
MAX = math.gcd(A, B)

def prime_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(prime_factorize(MAX)))+1)

### FIXED CODE ###

import fractions
A, B = map(int, input().split())
MAX = fractions.gcd(A, B)

def prime_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(prime_factorize(MAX)))+1)
import numpy as np
n, m = map(int,input().split())
c = np.zeros(n)
for i in range(m)
    a, b = map(int,input().split())
    c[a-1] + 1
    c[b-1] + 1
for i in c:
    print(i)

### FIXED CODE ###

a, b, c = map(int,input().split())
ans = 'Yes' if a <= c <= b else 'No'
print(ans)
n = int(input())
a = 1
for i range in (1,n):
    if i % 10 == 3:
        print('{0}'.format(i))
    elif i % 3 == 0:
        if i % 10 == 3:
            continue
        print('{0}'.format(i))
    


### FIXED CODE ###

n = int(input())
for i in range(1, n+1):
    if i%3 == 0 :
        print(' {}'.format(i),end='')

    elif '3' in str(i):
        print(' {}'.format(i),end='')
print()
t=list(map(int,input().split()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
p,q=[0],[0]
w=[]
for i in range(4):
    p.append(p[-1]+a[i%2]*t[i%2])
    q.append(q[-1]+b[i%2]*t[i%2])
    w.append(p[i+1]-q[i+1])
    if w[-1]==0:
        print("infinity")
        exit()
    if i==3:
        if len(set(w))!=4:
            print("infinity")
            exit()
        chk=0
        if (w[0]>0 and w[1]>0) or (w[0]<0 and w[1]<0):
            print(0)
            exit()
        elif (w[0]>0 and w[1]<0 and w[2]<0) or (w[0]<0 and w[1]>0 and w[2]>0):
            print(1)
            exit()
        elif (w[0]>0 and w[1]<0 and w[2]>0 and w[3]>0) or (w[0]<0 and w[1]>0 and w[2]<0 and w[3]<0):
            print(2)
            exit()
#print(w)
#print(max(abs(w[0]//(w[2]-w[0])),abs(w[1]//(w[3]-w[1])))*2-1)
x,y=(abs(w[0]//(w[2]-w[0])),abs(w[1]//(w[3]-w[1])))
if w[0]<w[2] and w[1]<w[3] and w[0]<0:
    print(x*2-1)
elif w[0]<w[2] and w[1]<w[3] and w[0]>0:
    print(x*2)
else:
    print(hhh)

### FIXED CODE ###

T1, T2 = map(int, input().split())
A1, A2 = map(int, input().split())
B1, B2 = map(int, input().split())
 
P = (A1 - B1) * T1
Q = (A2 - B2) * T2
if P > 0:
	P *= -1
	Q *= -1
 
if P + Q < 0:
	print(0)
elif P + Q == 0:
	print("infinity")
else:
	S = (-P) // (P + Q)
	T = (-P) % (P + Q)
	if T != 0:
		print(S * 2 + 1)
	else:
		print(S * 2)
N,M = map(int,input().split())
a = []
c = []
for i in range(N):
    b = list(input())
    a+=b
for i in range(M):
  b = list(input())
  c+=b
#print(c,a)
f = False
for i in range(N*N):
  if f == True:
    break
  if N*N-i<M*M:
    break
  count=0
  flag = True
  #print(i,c[0],a[i])
  if c[0] == a[i]:
    if N-(i%N)<M:
      continue
    num = i
    for j in range(M):
      for k in range(M):
        #print(c[count],a[num])
        if c[count] == a[num]:
          
          num+=1
          count+=1
        elif c[count]!=a[num]:
          flag =False
          break
      num+=N-M
      if flag == False:
        #print(i)
        break  
      if j == M-1:
        f = True
            
  else:
    continue
if f == False:
  print('No')
else:
  print('Yes')
           
    
    

### FIXED CODE ###

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

if M == N:
  print('Draw')
elif (M>N and N!=1) or M==1:
  print('Alice')
else:
  print('Bob')
a,b=raw_input().split()
if (a=='H' and b='H') or (a=='D' and b=='D'):
    print 'H'
else:
    print 'D'

### FIXED CODE ###

a,b=raw_input().split()
if (a=='H' and b=='H') or (a=='D' and b=='D'):
    print 'H'
else:
    print 'D'
a,b = list(map(int, input()split()))
if a>=b:
  print(10)
else:
  print(0)

### FIXED CODE ###

a,b = list(map(int, input().split()))
if a>=b:
  print(10)
else:
  print(0)
def main():
        n = int(input())
        s = [""] * n
        ans = 0
        for i in range(n):
            s[i] = SortString(input())
        s.sort()
        for i in range(n - 1):
            for j in range(i + 1, n):
                if s[i] == s[j]:
                    ans += 1
                else:
                    break
        print(ans)
     
     
    def SortString(text):
        return "".join(sorted(list(text)))
     
     
    if __name__ == '__main__':
        main()

### FIXED CODE ###

def main():
    n = int(input())
    s = [""] * n
    ans = 0
    for i in range(n):
        s[i] = SortString(input())
    sDictionary = {}
    for i in range(n):
        if sDictionary.get(s[i]):
            ans += sDictionary.get(s[i])
            sDictionary[s[i]] += 1
        else:
            sDictionary[s[i]] = 1
    print(ans)


def SortString(text):
    return "".join(sorted(list(text)))


if __name__ == '__main__':
    main()
N = int(input())
T = [int(input()) for _ in range(N)]

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)


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

ans = T[1]
for i in range(N):
    ans = lcm(ans, T[i])
print(ans)

### FIXED CODE ###

N = int(input())
if N == 1:
    T = [int(input())]
else:
    T = [int(input()) for _ in range(N)]

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)


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

ans = T[0]
for i in range(N):
    ans = lcm(ans, T[i])
print(ans)
import sys
stdin = sys.stdin

def li(): return [int(x) for x in stdin.readline().split()]
def li_(): return [int(x)-1 for x in stdin.readline().split()]
def lf(): return [float(x) for x in stdin.readline().split()]
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(ns())
def nf(): return float(ns())

# nの逆元のリスト
def inv_mod(n:int, mod:int) -> list:
    inv = [0,1]
    for i in range(2,n+1):
        inv.append(mod - ((mod//i)*inv[mod%i]) % mod)
    return inv
       
# nの階乗のリスト
def fact(n:int, mod:int) -> list:
    fac = [1,1]
    res = 1
    for i in range(2,n+1):
        res = res*i%mod
        fac.append(res)
    return fac

# nの階乗の逆元のリスト
def fact_inv(n:int, inv:list, mod:int) -> list:
    facInv = [1,1]
    for i in range(2,n+1):
        facInv.append(facInv[i-1]*inv[i] % mod)
    return facInv
        
# 二項係数
def nCr(n:int, r:int, mod:int, fac:list, facInv:list) -> int:
    if not (0<=r and r<=n):
        return 0
    
    return ((fac[n]*facInv[r]) % mod) * facInv[n-r] % mod

from itertools import accumulate
from collections import Counter

n,a,b = li()
v = li()

v.sort(reverse=True)
v_cum = list(accumulate(v))

ans_cand = []

# 貪欲に最大値を選ぶ
for i in range(a,b+1):
    ans_cand.append(v_cum[i-1] / i)
    
ans = max(ans_cand)
opt_is = []

while ans in ans_cand:
    opt_is.append(a + ans_cand.index(ans))
    ans_cand[ans_cand.index(int(ans))] = 0
    

cnt_v = Counter(v)

# 貪欲最大が何通りできるか考える
MOD = 46116646144580591
inv = inv_mod(n, MOD)
fac = fact(n, MOD)
facInv = fact_inv(n,inv, MOD)

pat = 0

for opt_i in opt_is:
    opt_set = v[:opt_i]
    cnt_opt = Counter(opt_set)
    
    temp = 1
    
    for key_op, val_op in cnt_opt.items():
        temp *= nCr(cnt_v[key_op], int(val_op), MOD, fac, facInv)
        
    pat += temp
        
print(ans)
print(pat)

### FIXED CODE ###

# nの逆元のリスト
def inv_mod(n:int, mod:int) -> list:
    inv = [-1,1]
    for i in range(2,n+1):
        inv.append(mod - ((mod//i)*inv[mod%i]) % mod)
    return inv
       
# nの階乗のリスト
def fact(n:int, mod:int) -> list:
    fac = [1,1]
    res = 1
    for i in range(2,n+1):
        res = res*i%mod
        fac.append(res)
    return fac

# nの階乗の逆元のリスト
def fact_inv(n:int, inv:list, mod:int) -> list:
    facInv = [1,1]
    for i in range(2,n+1):
        facInv.append(facInv[i-1]*inv[i] % mod)
    return facInv
        
# 二項係数
def nCr(n:int, r:int, mod:int, fac:list, facInv:list) -> int:
    if not (0<=r and r<=n):
        return 0
    
    return ((fac[n]*facInv[r]) % mod) * facInv[n-r] % mod

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

# 二項係数の準備
MOD = 9007199254740997
inv = inv_mod(N,MOD)
fac = fact(N,MOD)
facInv = fact_inv(N,inv,MOD)

V.sort(reverse=True)

max_avg = sum(V[:A])/A
print(max_avg)

ans = 0
if V[0] == V[A-1]:
    v = V.count(V[A-1])
    u = min(v,B)
    for i in range(A,u+1):
        ans += nCr(v,i,MOD,fac,facInv)

else:
    v_all = V.count(V[A-1])
    v_ch = V[:A].count(V[A-1])
    ans = nCr(v_all,v_ch,MOD,fac,facInv)

print(ans)
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5 100 90 80\n"
     ]
    }
   ],
   "source": [
    "N,A,B,C = map(int, input().split())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "98\n",
      "40\n",
      "30\n",
      "21\n",
      "80\n"
     ]
    }
   ],
   "source": [
    "l = []\n",
    "for i in range(n):\n",
    "    l.append(int(input()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "23\n"
     ]
    }
   ],
   "source": [
    "INF = 10 ** 9\n",
    "def dfs(cur, a, b, c):\n",
    "    if cur == n:\n",
    "        return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a,b,c) > 0 else INF\n",
    "    ret0 = dfs(cur + 1, a, b, c)\n",
    "    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10\n",
    "    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10\n",
    "    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10\n",
    "    return min(ret0, ret1, ret2, ret3)\n",
    "\n",
    "print(dfs(0, 0, 0, 0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}


### FIXED CODE ###

N, A, B, C = map(int, input().split())
L = [int(input()) for _ in range(N)]

import itertools
m = 4
n = N
bit_list = list(itertools.product([i for i in range(m)], repeat=n))

res = 10 ** 18
for b in bit_list:
    tmp1 = 0
    tmp2 = 0
    tmp3 = 0
    check1 = False
    check2 = False
    check3 = False
    cost = 0
    for i in range(n):
        if b[i] == 1:
            tmp1 += L[i]
            if check1:
                cost += 10
            check1 = True       
            
        if b[i] == 2:
            tmp2 += L[i]
            if check2:
                cost += 10
            check2 = True
            
        if b[i] == 3:
            tmp3 += L[i]
            if check3:
                cost += 10
            check3 = True
    if min(tmp1, tmp2, tmp3) != 0:
        res = min(res, abs(tmp1 - A)+abs(tmp2 - B)+abs(tmp3 - C)+cost)
print(res)
s=input()

for i in range(3):
  if s[i]==s[i+1]:
    print("Yes")
  else :
    print("No")

### FIXED CODE ###

s=input()
if s[0]==s[1] and s[1]==s[2]:
  print("No")
  
else :
  print("Yes")
a, b, k = [int(i) for i in input().split()]
maxs = (0, a - k)


print(str(maxs) + " " + str(b - maxs))

### FIXED CODE ###

a, b, k = list(map(int, input().split()))

if a < k:
  a1 = k - a
  a2 = b - a1 if b > a1 else 0
  print('0 ' + str(a2))
        
else:
  print(str(a-k) + ' ' + str(b))
sum=0
max=0
for i in range(5):

### FIXED CODE ###

X=[int(input()) for i in range(5)]
Y=[]
for x in X:
  Y.append(-(-x//10)*10-x)
print(sum(X)+sum(Y)-(max(Y)))
a,b=map(int(input()).split())
print(["Possible","Impossible"][a%3==b%3 and (a%3==1 or a%3==2)]

### FIXED CODE ###

a,b=map(int,input().split())
print(["Possible","Impossible"][a%3==b%3 and (a%3==1 or a%3==2)])
A, B, C = input().split()
if B == "+":
  print(int(A) + int(B))
else:
  print(int(A) - int(B))

### FIXED CODE ###

A, B, C = input().split()
if B == "+":
  print(int(A) + int(C))
else:
  print(int(A) - int(C))
import math

n = int(input())
a = round(0, sqrt(n))

print(a ** 2)

### FIXED CODE ###

import math

n = int(input())

print(math.floor(math.sqrt(n)) ** 2)