Harryxun/stf_run huggingface dataset:
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    _LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N = NI()
    x = LI()
    L = NI()
    m = N.bit_length()
    f = [[N-1] * N for _ in range(m)]
    j = 1
    for i in range(N-1):
        while x[i] + L >= x[j+1]:
            j += 1
            if j >= N-1: break
        else:
            f[0][i] = j
            continue
        break
    for k in range(1,m):
        for i in range(N):
            f[k][i] = f[k-1][f[k-1][i]]

    for _ in range(NI()):
        ans = 0
        a,b = _LI()
        if a > b: a,b = b,a

        for k in range(m-1,-1,-1):
            if f[k][a] < b:
                a = f[k][a]
                ans += 2**k
        print(ans+1)



if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    _LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()

    N = NI()
    x = LI() + [INF]
    L = NI()
    m = N.bit_length()
    f = [[N-1] * N for _ in range(m)]
    j = 1
    for i in range(N-1):
        while x[i] + L >= x[j+1]:
            j += 1
            if j >= N-1: break
        f[0][i] = j
    for k in range(1,m):
        for i in range(N):
            f[k][i] = f[k-1][f[k-1][i]]

    for _ in range(NI()):
        ans = 0
        a,b = _LI()
        if a > b: a,b = b,a

        for k in range(m-1,-1,-1):
            if f[k][a] < b:
                a = f[k][a]
                ans += 2**k
        print(ans+1)



if __name__ == '__main__':
    main()
memo = {}
def f(x):
    if x==0:
        return 0
    if x==1:
        return 1
    if x in memo:
        return memo[x]
    k = sum(list(map(int,list(bin(x)[2:]))))
    memo[x] = 1+f(x%k)
    return memo[x]
    
N = int(input())
X = input().strip()
n = sum(list(map(int,list(X))))
C = {i:0 for i in range(N)}  # mod n-1
C[0] = 1
for i in range(1,N):
    C[i] = (C[i-1]*2)%(n-1)
D = {i:0 for i in range(N)} # mod n+1
D[0] = 1
for i in range(1,N):
    D[i] = (D[i-1]*2)%(n+1)
cnt0 = 0
cnt1 = 0
for i in range(N):
    if X[i]=="1":
        cnt0 = (cnt0+C[N-1-i])%(n-1)
        cnt1 = (cnt1+D[N-1-i])%(n+1)
for i in range(N):
    if X[i]=="1":
        a = (cnt0-C[N-1-i])%(n-1)
        print(1+f(a))
    else:
        a = (cnt1+D[N-1-i])%(n+1)
        print(1+f(a))

### FIXED CODE ###

memo = {}
def f(x):
    if x==0:
        return 0
    if x==1:
        return 1
    if x in memo:
        return memo[x]
    k = sum(list(map(int,list(bin(x)[2:]))))
    memo[x] = 1+f(x%k)
    return memo[x]
    
N = int(input())
X = input().strip()
n = sum(list(map(int,list(X))))
if n==0:
    for i in range(N):
        print(1)
elif n==1:
    D = {i:0 for i in range(N)} # mod n+1
    D[0] = 1
    for i in range(1,N):
        D[i] = (D[i-1]*2)%(n+1)
    cnt1 = 0
    for i in range(N):
        if X[i]=="1":
            print(0)
        else:
            a = (cnt1+D[N-1-i])%(n+1)
            print(1+f(a))
else:
    C = {i:0 for i in range(N)}  # mod n-1
    C[0] = 1
    for i in range(1,N):
        C[i] = (C[i-1]*2)%(n-1)
    D = {i:0 for i in range(N)} # mod n+1
    D[0] = 1
    for i in range(1,N):
        D[i] = (D[i-1]*2)%(n+1)
    cnt0 = 0
    cnt1 = 0
    for i in range(N):
        if X[i]=="1":
            cnt0 = (cnt0+C[N-1-i])%(n-1)
            cnt1 = (cnt1+D[N-1-i])%(n+1)
    for i in range(N):
        if X[i]=="1":
            a = (cnt0-C[N-1-i])%(n-1)
            print(1+f(a))
        else:
            a = (cnt1+D[N-1-i])%(n+1)
            print(1+f(a))
fn main(){
    let raw = input();
    let x: Vec<&str> = raw.split(' ').collect();
    
    let a: f64 = x[0].parse::<f64>().unwrap();
    let b: f64 = x[1].parse::<f64>().unwrap() * 100.0;
    
    println!("{}", (a * b / 100.0) as i32);
}

fn input() -> String{
    let mut buf = String::new();
    std::io::stdin().read_line(&mut buf).unwrap();
    buf.trim_end().to_string()
}

### FIXED CODE ###

raw = input().split(' ')
a = int(raw[0])
b = int(raw[1].replace('.', ""))

print(a * b // 100)
X, Y, Z, K = map(int, input().split())

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


# def get_good(a, v):
#     return max(a)
#     if v is not None:
#         return max(a[a < v])
#     else:
#         max(a)



prev_a = max(A)
prev_b = max(B)
prev_c = max(C)

value = prev_a + prev_b + prev_c

A.remove(max(A))
B.remove(max(B))
C.remove(max(C))

print(value)

for i in range(K - 1):
    a = max(A)
    b = max(B)
    c = max(C)

    sub_a = prev_a - a
    sub_b = prev_b - b
    sub_c = prev_c - c

    if sub_a < sub_b and sub_a < sub_c:
        A.remove(a)
    if sub_b < sub_a and sub_b < sub_c:
        B.remove(b)
    if sub_c < sub_a and sub_c < sub_b:
        B.remove(c)


    value -= min(sub_a, sub_b, sub_c)
    print(value)


### FIXED CODE ###

from heapq import heappush, heappop

X, Y, Z, K = map(int, input().split())

A = sorted([int(e) for e in input().split()], reverse=True)
B = sorted([int(e) for e in input().split()], reverse=True)
C = sorted([int(e) for e in input().split()], reverse=True)


def get_value(ai, bi, ci):
    return -(A[ai] + B[bi] + C[ci])


heap = []
heappush(heap, (get_value(0, 0, 0), 0, 0, 0))
used = {(0, 0, 0)}

for k in range(K):
    v, ia, ib, ic = heappop(heap)
    print(-v)

    if ia + 1 < X and (ia + 1, ib, ic) not in used:
        heappush(heap, (get_value(ia + 1, ib, ic), ia + 1, ib, ic))
        used.add((ia + 1, ib, ic))
    if ib + 1 < Y and (ia, ib + 1, ic) not in used:
        heappush(heap, (get_value(ia, ib + 1, ic), ia, ib + 1, ic))
        used.add((ia, ib + 1, ic))
    if ic + 1 < Z and (ia, ib, ic + 1) not in used:
        heappush(heap, (get_value(ia, ib, ic + 1), ia, ib, ic + 1))
        used.add((ia, ib, ic + 1))
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
S = list(input())
ls =[]
count = 0
for i in range(len(S)):
    
    if S[i] == 'A' or S[i] =='T' or S[i] == 'C' or S[i] =='G':
        count += 1
    else:
        ls.append(count)
        count = 0

print(max(ls))



### FIXED CODE ###

#! /usr/bin/env python3
# -*- coding: utf-8 -*-
S = list(input())
clst=[]
count = 0
for s in S:
    if s == 'A' or s == 'T' or s =='C' or s == 'G':
        count += 1
        clst.append(count)
    else:
        
        count = 0
        clst.append(count)
print(max(clst))
N = int(input())
A = list(map(int, input().split()))

k = {}
for i in range(N):
    if not A[i] in k:
        k[A[i]] = 1
    else:
        k[A[i]] += 1

a = 0
if len(k.keys()) == 3:
    B = 0
    for key, val in k.items():
        if val == N // 3:
            a += 1
        B = B ^ key
elif len(k.keys()) == 2:
    for key, val in k.items():
        if val == N // 3 and key == 0:
            a += 1
        elif val == N // 3 * 2:
            a += 2
    B = 0

if N % 3 == 0 and B == 0 and a == 3:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)

### FIXED CODE ###

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

x = False
k = {}
for i in range(N):
    if not A[i] in k:
        k[A[i]] = 1
    else:
        k[A[i]] += 1
B = 0
a = 0
if len(k.keys()) == 3:
    B = 0
    for key, val in k.items():
        if val == N // 3:
            a += 1
        B = B ^ key
elif len(k.keys()) == 2:
    for key, val in k.items():
        if val == N // 3 and key == 0:
            a += 1
        elif val == N // 3 * 2:
            a += 2
    B = 0
elif len(k.keys()) == 1:
    a = list(k.keys())
    if a[0] == 0:
        x = True

if (N % 3 == 0 and B == 0 and a == 3) or x:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)
n = int(input())
ans = n(n-1) // 2    
print(ans)

### FIXED CODE ###

n = int(input())
ans = n * (n-1) // 2    
print(ans)
import sys
input = sys.stdin.readline
N = int(input())
a = [0]
reva = [[] for _ in range(N + 1)]
for _ in range(N - 1): a.append(int(input()))
for i in range(N):
  if a[i] == 0: continue
  reva[a[i]].append(i + 1)

dp = [-1] * (N + 1)
def dfs(x):
  global dp
  if len(reva[x]) == 0:
    dp[x] = 1
    return 1
  t = []
  for y in reva[x]:
    t.append(dfs(y))
  t.sort(reverse = True)
  for i in range(len(t)):
    t[i] += i + 1
  dp[x] = max(t)
  return dp[x]

print(dfs(1) - 1)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)
N = int(input())
a = [0]
reva = [[] for _ in range(N + 1)]
for _ in range(N - 1): a.append(int(input()))
for i in range(N):
  if a[i] == 0: continue
  reva[a[i]].append(i + 1)
dp = [-1] * (N + 1)
def dfs(x):
  global dp
  if len(reva[x]) == 0:
    dp[x] = 1
    return 1
  t = []
  for y in reva[x]:
    t.append(dfs(y))
  t.sort(reverse = True)
  for i in range(len(t)):
    t[i] += i + 1
  dp[x] = max(t)
  return dp[x]
print(dfs(1) - 1)
x = int(input())
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

temp = prime_factorize(x)
ma = min(temp)
a = 0
b = 0
if x == 1:
    print(0,-1)
else:
    for i in range(ma+1):
        a = ma-i
        b = a-ma
        #print(a,b)
        if a**4+(a**3)*b+(a**2)*(b**2)+a*(b**3)+b**4 == max(temp):
            print(a,b)
            break


### FIXED CODE ###

import sys
x = int(input())
a = []
b = []
t = 0
for i in range(-1000,1000):
    t = i**5
    a.append([t,i])
    b.append([t,i])
    
for i in a:
    for j in b:
        if i[0]-j[0] == x:
            print(i[1],j[1])
            sys.exit()
from collections import defaultdict
vertices, edges = map(int, input().split(" "))
connect = defaultdict(set)
for i in range(vertices):
    a, b = map(int, input().split(" "))
    connect[a] |= {b}
    connect[b] |= {a}

answer = 0
queue = [[set(), 1]]
while queue:
    visited, now = queue.pop()
    visited |= {now}
    if len(visited) == vertices:
        answer += 1
        continue
    for conn in connect[now]:
        if conn not in visited:
            queue.append([visited | {conn}, conn])
print(answer)

### FIXED CODE ###

from collections import defaultdict
vertices, edges = map(int, input().split(" "))
connect = defaultdict(set)
for i in range(edges):
    a, b = map(int, input().split(" "))
    connect[a] |= {b}
    connect[b] |= {a}

answer = 0
queue = [[set(), 1]]
while queue:
    visited, now = queue.pop()
    visited |= {now}
    # print(visited, now, need_visit)
    if len(visited) == vertices:
        answer += 1
    else:
        for conn in connect[now]:
            if conn not in visited:
                queue.append([visited | {conn}, conn])
        # print(visited, now, need_visit)

print(answer)
k = int(input())

# 解説AC
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()

num = 1, 7
for i in range(k):
    if num % k == 0:
        print(i+1)
        break
    num = (num % k) * 10 + 7


### FIXED CODE ###

k = int(input())
if k % 2 == 0 or k % 5 == 0:
    print(-1)
    exit()

num = 7
for i in range(1,10**6):
    if num % k == 0:
        print(i)
        break
    num = (num % k) * 10 + 7
X=int(input(),16)
Y=int(input(),16)
if X>Y:
  print(">")
elif X<Y:
  print("<")
else:
  print("=")

### FIXED CODE ###

X,Y=input().split()
if X>Y:
    print(">")
elif X<Y:
    print("<")
else:
    print("=")
def main():
    import sys
    from fractions import gcd
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    tmp = float("inf")
    S = 0
    count = 0
    for i in A:
        if tmp > abs(A[i]):
            tmp = abs(A[i])
        if abs(A[i]) != A[i]:
            count += 1
        S += abs(A[i])
    if count%2 == 0:
        print(S)
    else:
        print(S-2*tmp)
    
main()

### FIXED CODE ###

def main():
    import sys
    from fractions import gcd
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    tmp = float("inf")
    S = 0
    count = 0
    for i in A:
        if tmp > abs(i):
            tmp = abs(i)
        if abs(i) != i:
            count += 1
        S += abs(i)
    if count%2 == 0:
        print(S)
    else:
        print(S-2*tmp)
    
main()
import numpy as np
N = input()
h = np.array(list(map(int, input().split())))

a = np.zeros(N)
h_min = min(h)
tmp = (h >= h_min+1)*1

cnt = 0
for idx, i in enumerate(tmp):
    if idx==0:
        a0 = i
        if i==1:
            cnt+=1
        continue
        
    if idx==a0:
        continue
    else:
        cnt+=1
else:
    if i==0:
        cnt-=1
        
print(cnt+h_min)

### FIXED CODE ###

import numpy as np
N = int(input())
h = np.array(list(map(int, input().split())))

# N =  8
# h = np.array(list(map(int, "4 23 75 0 23 96 50 100".split())))

a = np.zeros(N)
h_min = min(h)
h_max = max(h)
n_loop = h_max - h_min

cnt = 0
for zzz in range(n_loop):
    tmp = (h >= h_min+1+zzz)*1
#     print(tmp)
    for idx, i in enumerate(tmp):
        if idx==0:
            first = i
            a0 = i
            continue
            
        if i==a0:
            continue
        else:
            if i==1:
                cnt+=1
            a0 = i
    else:
        if first==1:
            cnt+=1
            
print(cnt+h_min)
ans = -1
if K in [2,5]:
    pass
else:
    num = 7
    ans = 0
    while True:
        ans += 1
        if num % K == 0:
            break
        else:
            num = (num * 10 + 7)%K
print(ans)

### FIXED CODE ###

K = int(input())
ans = -1
if K%2 == 0:
    pass
elif K%5 == 0:
    pass
else:
    num = 7
    ans = 0
    while True:
        ans += 1
        if num % K == 0:
            break
        else:
            num = (num * 10 + 7)%K
print(ans)
line = int(input().split)

area = line[0] * line[1] % 2

peri = line[0] * 2 + line[1] * 2

print(area + ' ' + peri)


### FIXED CODE ###


line = input().split()

a = int(line[0])
b = int(line[1])

print(str(a * b) + ' ' + str((a+b) * 2))
a, b, m = map(int,str(input()).split())
a_cost_map = map(int,str(input()).split())
a_cost = list(a_cost_map)
b_cost_map = map(int,str(input()).split())
b_cost = list(b_cost_map)

coupons_map = [str(input()).split() for i in range(m)]
coupons_map_all =  [[int(coupons_map[i][t]) for t in range(len(coupons_map[i]))] for i in range(len(coupons_map))]

minimum = min(a_cost) + min(b_cost)
for coupon in coupons_map_all:
    coupon_use = (a_cost[coupon[0]-1] +  b_cost[coupon[1]-1] - coupon[2]) 
    print(coupon_use)
    if minimum > coupon_use:
        minimum = coupon_use
print(minimum)


### FIXED CODE ###

test_input = str(input())
v = [(test_input[i*2]+test_input[i*2+1]) for i in range(int(len(test_input)/2))]
if len(test_input)%2 !=0:
    print("No")
elif set(v) == set(["hi"]):
    print("Yes")
else:
    print("No")
a = int(input())
b = int(input())
print('Odd') if a * b % 2 != 0 else print('Even')

### FIXED CODE ###

def main():
    a, b = [int(_) for _ in input().split()]
    print("Even") if a * b % 2 == 0 else print("Odd")

main()
n = int(input())
list1 = [list(int(input())) for i in range(n) ]
list1.sort(reverse = True)
print(list1[0]//2+sum(list1[1:]))

### FIXED CODE ###

n = int(input())
list1 = [int(input()) for i in range(n) ]
list1.sort(reverse = True)
print(list1[0]//2+sum(list1[1:]))
import sys
import numba as nb

input = sys.stdin.readline

@nb.njit
def main():
    N, W = map(int, input().split())
    x = [tuple(map(int, input().split())) for _ in range(N)]

    dp = [[0] * (W + 1) for _ in range(N + 1)]

    for i, (w, v) in enumerate(x, 1):
        dpi = dp[i]
        dpim = dp[i-1]    
        for j in range(1, W + 1):
            if w <= j:
                a = dpim[j - w] + v
                if a > dpim[j]:
                    dpi[j] = a
                else:
                    dpi[j] = dpim[j]
            else:
                dpi[j] = dpim[j]

    print(dp[-1][W])

if __name__ == "__main__":
    main()

### FIXED CODE ###

#import
#import math
#import numpy as np
#= int(input())
#= input()
N, W = map(int, input().split())
#= list(map(int, input().split()))
#= [input(), input()]

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

dp = [[0] * (W + 1) for _ in range(N + 1)]

for i in range(1, N + 1):
    for j in range(1, W + 1):
        dp[i][j] = dp[i - 1][j]
        if i != 0 and x[i - 1][0] <= j:
            dp[i][j] = max(dp[i][j], dp[i-1][j-x[i-1][0]] + x[i-1][1])

print(dp[-1][W])
import numpy as np

S=input()

print(sum(np.array(list(S[int(len(S)/2):]))!=np.array(list(S[:int(len(S)/2)][::-1]))))

### FIXED CODE ###

import numpy as np

S=input()

half_a=''
half_b=''

if len(S)%2==0:
    half_a=np.array(list(S[int(len(S)/2):]))
    half_b=np.array(list(S[:int(len(S)/2)][::-1]))
    
if len(S)%2==1:
    half_a=np.array(list(S[int(len(S)/2)+1:]))
    half_b=np.array(list(S[:int(len(S)/2)][::-1]))


print(np.sum(half_a!=half_b))
import copy
def main():
    S = input()
    K = int(input())
    a = list(S)
    b = copy.copy(a)
    cnt = 0
    if len(set(a))==1 and len(a) != 1:
        cnt = (len(a)*K)//2
    elif len(a) ==1:
        cnt += K//2
    else:
        cnt_2 = 0
        for i in range(len(a)-1):
            if a[i+1] == a[i]:
                a[i+1] = str(i)
                cnt += 1
        cnt *= K
        if a[0] == a[-1] and len(a) > 1:
            cnt += K-1
        for j in range(len(b)-1):
            if b[j+1] == b[j]:
                b[j] = str(j)
                cnt_2 += 1
        cnt_2 *= K
        if b[0] == b[-1] and len(b) > 1:
            cnt_2 += K-1

    print(min(cnt,cnt_2))

    
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    S = input()
    K = int(input())
    a = list(S)
    cnt = 0
    if len(set(a))==1:
        cnt = (len(a)*K)//2
    elif a[0] != a[-1]:
        for l in range(len(a)-1):
            if a[l+1] == a[l]:
                a[l+1] = str(l)
                cnt += 1
        cnt *= K
    else:
        temp = 1
        temp_2 = 1
        i = 0
        while a[i] == a[i+1]:
            temp += 1
            i += 1
        j = len(a) - 1
        while a[j] == a[j-1]:
            temp_2 += 1
            j -= 1
        for k in range(i+1,j-1):
            if a[k+1] == a[k]:
                a[k+1] = str(k)
                cnt += 1
        cnt *= K
        cnt += temp//2
        cnt += temp_2//2
        temp_3 = (temp + temp_2)//2
        cnt += temp_3 * (K-1)


    print(cnt)

    
if __name__ == '__main__':
    main()
S = input()
K = int(input())
 
ans = 0
s0 = 0
 
for s in S:
    if s == '1':
        s0 += 1
        if s0 == K:break
    else: break
print(s)

### FIXED CODE ###

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

print(A * B - A - B + 1)
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

# dp[i]: 残りがi個の状態で先手が勝つかどうか
dp = [-1 for _ in range(K+1)]

# dp[i] = 0: 残りi個で先手が負ける
# dp[i] = 1: 残りi個で先手が勝つ
# dp[i] = -1: 残りi個でも不明

for i in range(K + 1):
    # 遷移先: i-aで、そのとき手番は後手
    # どのi-aも1 = 後手がかならず勝つ = 負け
    # 1つでも0がある = 1つでも勝ち筋がある = (その手を打てば)勝ち
    # 
    # どのi-aにも遷移できない = 打てない = 負け
    if all([i - a < 0 for a in A]):
        dp[i] = 0
    else:
        if all([dp[i - a] == 1 for a in A]):
            dp[i] = 0
        elif any([dp[i - a] == 0 for a in A]):
            dp[i] = 1
        else:
            dp[i] |= int(not dp[i-a])

if dp[K]:
    print('First')
else:
    print('Second')

### FIXED CODE ###

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

# dp[i]: 残りがi個の状態で先手が勝つかどうか
dp = [0 for _ in range(K+1)]

# dp[i] = 0: 残りi個で先手が負ける
# dp[i] = 1: 残りi個で先手が勝つ
# dp[i] = -1: 残りi個でも不明
  
for i in range(K + 1):
    # 遷移先: i-aで、そのとき手番は後手
    # どのi-aも1 = 後手がかならず勝つ = 負け
    # 1つでも0がある = 1つでも勝ち筋がある = (その手を打てば)勝ち
    # どのi-aにも遷移できない = 打てない = 負け
    for a in A:
        # 遷移先が存在し、かつそれが勝ち筋
        if i - a >= 0 and not dp[i - a]:
            dp[i] = 1
            break

if dp[K]:
    print('First')
else:
    print('Second')
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(input())
def LS(): return input().split()
def S(): return input()

def main():
  s=S()
  k=I()

  _s=sorted(s)

  l=[]

  for i in range(3):
    for j in range(len(s)):
      if len(s)>i and _s[i]==s[j]:
        l.append(s[j])

        l.append(s[j:j+2])

        l.append(s[j:j+3])

        l.append(s[j:j+4])

        l.append(s[j:j+5])

  l=list(set(l))
  l.sort()

  return l[k-1]

print(main())


### FIXED CODE ###

# a〜z
l=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

s=list(input())
K=int(input())

l2=[]

a=''
for x in l:
  if x in s:
    a=x
    for i in range(len(s)):
      if s[i]==a:
        for j in range(6):
          l2.append(''.join(s[i:i+j]))

l2=list(set(l2))
l2.remove('')
l2.sort()
print(l2[K-1])
n = int(input())
a = list(map(int,input().split()))
print(abs(min(a)-max(a))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
print(abs(min(a)-max(a)))
import sys
import numpy as np
input = sys.stdin.readline

N, K = map(int, input().split())
H = np.array(input().split(), dtype='int32')
dp = np.zeros(N, dtype='int32')
dp[0], dp[1] = 0, abs(H[0]-H[1])

for i in range(2, N):
  dp[i] = np.min(dp[i-k] + abs(H[i]-H[i-k]) for k in range(1,K+1))
print(dp[-1])    

### FIXED CODE ###

import sys
input = sys.stdin.readline

def cmin(a, b, i):
  if a > b:
    dp[i] = b
    return True
  return False

N, K = map(int, input().split())
h = list(map(int, input().split()))
dp = [sys.maxsize]*N
dp[0] = 0

for i in range(0, N):
  for j in range(1,K+1):
    cmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]), i)
    if i > 1:
      cmin(dp[i], dp[i-j] + abs(h[i] - h[i-j]), i)
print(dp[N-1])
from collections import deque
import heapq

def dijkstra(s,g,m):
    color=[0]*n
    dis={}
    for i in xrange(n):
        dis[i]=float('inf')
    dis[s]=0
    heapq.heappush(pq,[0,s])
    while len(pq)!=0:
        t,u=heapq.heappop(pq)
        color[u]=2
        if dis[u]<t:
            continue
        for v in g[u]:
            if color[v]!=2:
                if dis[u]+m[u][v]<dis[v]:
                    dis[v]=dis[u]+m[u][v]
                    color[v]=1
                    heapq.heappush(pq,[dis[v],v])
    return dis

n,m,c=map(int,raw_input().split())
g=[[]*n for _ in xrange(n)]
cost=[[10**6]*n for _ in xrange(n)]
totalcost=0
for i in xrange(m):
    a,b,d=map(int,raw_input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)
    cost[a-1][b-1]=d
    cost[b-1][a-1]=d
    totalcost+=d

pq=[]
dis=dijkstra(0,g,cost)
dis=sorted(dis.items(), key=lambda x:x[1])

ans=float('inf')
visited=[0]*n
for u,x in dis:
    visited[u]=1
    for v in g[u]:
        if visited[v]==1:
            totalcost-=cost[u][v]
    ans=min(ans,totalcost+c*x)
print ans

### FIXED CODE ###

import heapq

def dijkstra(s,g):
    color=[0]*n
    dis={}
    for i in xrange(n):
        dis[i]=float('inf')
    dis[s]=0
    heapq.heappush(pq,[0,s])
    while len(pq)!=0:
        t,u=heapq.heappop(pq)
        color[u]=2
        if dis[u]<t:
            continue
        for v,cost in g[u]:
            if color[v]!=2:
                if dis[u]+cost<dis[v]:
                    dis[v]=dis[u]+cost
                    color[v]=1
                    heapq.heappush(pq,[dis[v],v])
    return dis

n,m,c=map(int,raw_input().split())
g=[[] for _ in xrange(n)]
totalcost=0
for i in xrange(m):
    a,b,d=map(int,raw_input().split())
    g[a-1].append([b-1,d])
    g[b-1].append([a-1,d])
    totalcost+=d

pq=[]
dis=dijkstra(0,g)
dis=sorted(dis.items(), key=lambda x:x[1])

ans=float('inf')
visited=[0]*n
for u,x in dis:
    visited[u]=1
    for v,cost in g[u]:
        if visited[v]==1:
            totalcost-=cost
    ans=min(ans,totalcost+c*x)
print ans