Harryxun/stf_run huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    string s;
    cin >> s;

    vector<int> count_e(n, 0);
    vector<int> count_e_sum(n + 1, 0);
    vector<int> count_w(n, 0);
    vector<int> count_w_sum(n + 1, 0);

    for (int i = 0; i < n; i++)
    {
        if (s[i] == 'E')
        {
            count_e[i]++;
        }
        else if (s[i] == 'W')
        {
            count_w[i]++;
        }
        count_e_sum[i + 1] = count_e_sum[i] + count_e[i];
        count_w_sum[i + 1] = count_w_sum[i] + count_w[i];
    }

    vector<int> ans(n);
    for (int i = 0; i < n; i++)
    {
        ans[i] = count_w_sum[i] + count_e_sum[n] - count_e_sum[i + 1];
    }

    int answer = *min_element(begin(ans), end(ans));

    cout << answer;
}

### FIXED CODE ###

N = int(input())
S = input()
int_s = [0] * N
cum_sum_w = [0] * (N + 1)
cum_sum_e = [0] * (N + 1)
answers = [0] * N
for i in range(N):
    if (S[i] == 'W'):
        int_s[i] = 1
    else:
        int_s[i] = 0
    cum_sum_w[i + 1] = cum_sum_w[i] + int_s[i]
for i in range(N):
    if (S[i] == 'E'):
        int_s[i] = 1
    else:
        int_s[i] = 0
    cum_sum_e[i + 1] = cum_sum_e[i] + int_s[i]
for i in range(N):
    answers[i] = cum_sum_w[i] + (cum_sum_e[N] - cum_sum_e[i + 1])
print(min(answers))
import sys

data=int(input())
data2=int(input())

if(data>data2):
    print("a > b")
if(data<data2):
    print("a < b")
if(data==data2):
    print("a == b")


### FIXED CODE ###

1
2
a,b = map(int, input().split())
print("a "+("==" if a == b else "<" if a < b else ">")+" b")
H,W = map(int,input().split())
s = [list(input()) for _ in range(W)]
dp = [[0] * W for _ in range(H)]

if s[0][0] == '.':
  dp[0][0] = 0
else:
  dp[0][0] = 1

for i in range(1,W):
  if s[0][i] == '.':
    dp[0][i] = dp[0][i-1]
  else:
    if s[0][i-1] == '.':
      dp[0][i] = dp[0][i-1]+1
    else:
      dp[0][i] = dp[0][i-1]

for i in range(1,H):
  for j in range(W):
    if j == 0:
      if s[i][j] == '.':
        dp[i][j] = dp[i-1][j]
      else:
        dp[i][j] = dp[i-1][j]+1
    else:
      if s[i][j] == '.':
        dp[i][j] = min(dp[i-1][j],dp[i][j-1])
      else:
        left = 0
        up = 0
        if s[i-1][j] == '.':
          left = 1
        if s[i][j-1] == '.':
          up = 1
        dp[i][j] = min(dp[i-1][j]+left,dp[i][j-1]+up)
print(dp[-1][-1])


### FIXED CODE ###

H,W = map(int,input().split())
s = [list(input()) for _ in range(H)]
dp = [[0] * W for _ in range(H)]
dp[0][0] = int(s[0][0]=="#")

for i in range(1, W):
    dp[0][i] = dp[0][i-1] + (int(s[0][i]=="#") if s[0][i-1]=="." else 0)
for h in range(1,H):
  dp[h][0] = dp[h-1][0] + (int(s[h][0]=="#") if s[h-1][0]=="." else 0)
  for w in range(1,W):
    dp[h][w] = min(dp[h-1][w]+(int(s[h][w]=="#") if s[h-1][w]=="." else 0), 
    dp[h][w-1]+(int(s[h][w]=="#") if s[h][w-1]=="." else 0))
print(dp[-1][-1])
print raw input()[::-1]

### FIXED CODE ###

print raw_input()[: : -1]
a = list(map(int,input().split()))
x = []
y = []
for i in range(a[1]):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)


for i in range(10**(a[0]-1),10**a[0]):
  s = str(i)
  flag = True
  for j in range(len(x)):
    if str(y[j]) != s[x[j]-4]:
      flag = False
      break
  if flag:
    break
      
#s = str(702)
#print(s[-1])
if flag:
  print(i)
else:
  print(-1)

### FIXED CODE ###

a = list(map(int,input().split()))
x = []
y = []
for i in range(a[1]):
    x1,y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
 
#s = str(2)
#print(s[-1])

def start(n):
  if n == 1:
    return 0
  else:
    return 10**(n-1)
    
flag = False
for i in range(start(a[0]),10**a[0]):
  s = str(i)
  flag = True
  for j in range(len(x)):
    if str(y[j]) != s[x[j]-(a[0]+1)]:
      flag = False
      break
  if flag:
    break
      

if flag:
  print(i)
else:
  print(-1)
#!/usr/bin/env python
# ---------------------------------------------------------------------------------------!
import os
import sys
from io import BytesIO, IOBase
# from bisect import bisect_left as bl                #c++ lowerbound bl(array,element)
# from bisect import bisect_right as br               #c++ upperbound br(array,element)


# ---------------------------------------MAIN()-----------------------------------------------!
def main():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
    a = input()
    if(a.isupper()):
        print("A")
    else:
        print("a")


# -----------------------------------------------------------------------------------------!
# region fastio
BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def _init_(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def _init_(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
def input(): return sys.stdin.readline().rstrip("\r\n")

# endregion


if __name__ == "__main__":
    main()


### FIXED CODE ###

a=input()
if(a.isupper()):
    print("A")
else:
    print("a")
n=int(input())
s=list(input() for _ in range(n))
m,i,f,both=0,0,0,0

for i in range(n):
    m +=s[i].count("AB")
    if s[i][0]=="B":
        i +=1
    if s[i][-1]=="A":
        f +=1
  

if both!=0:
    if i!=0 and f!=0:
        print(m+both+min(i,f)-1)
    else:
        print(m+both+min(i,f))

else:
    print(min(i,f))


### FIXED CODE ###

n,k=list(map(int,input().split()))
print(n-k+1)
import math
n=int(input())

x1,y1=0,0
x2,y2=10**9,1
end = n%x2

for x3 in range(1,end+1):
    y3 = (n+x3)/x2
    if float.is_integer(y3):
        x3 =  x2*y3 -n
        break
        
output=[x1,y1,x2,y2,x3,y3]
output=list(map(str,output))
    
print(" ".join(output))

### FIXED CODE ###

import math
n=int(input())
x1,y1=0,0
x2,y2=10**9,1
y3 = n//x2 +1
if y3>x2:
    y3=x2
x3 = y3*x2 - n


output=[x1,y1,x2,y2,x3,y3]
output=list(map(str,output))
    
print(" ".join(output))
class node:
    def __init__(self, num):
        self.number     = num
        self.distance   = -1
        self.link_node  = []
        self.is_serched = False

class queue:
    def __init__(self):
        self.top = 0
        self.bottom = 0
        self.que = [None] * 100
    
    def dequeue(self):
        self.top = self.top + 1
        return self.que[self.top - 1]
    
    def enqueue(self, item):
        self.que[self.bottom] = item
        self.bottom = self.bottom + 1
    
    def is_empty(self):
        if self.top == self.bottom:
            return True
        else:
            return False

n = input()
node_list = [None] * (n + 1)

for i in xrange(1, n + 1):
    node_list[i] = node(i)

for i in xrange(1, n + 1):
    line = raw_input().split()
    for node_num in line[2 : ]:
        node_list[i].link_node.append(node_list[int(node_num)])

node_que = queue()

node_list[1].distance = 0
node_que.enqueue(node_list[1])
while node_que.is_empty() == False:
    top_item = node_que.que[node_que.top]
    top_item.is_serched = True
    for item in top_item.link_node:
        if item.is_serched == False:
            node_que.enqueue(item)
            if item.distance == -1:
                item.distance = top_item.distance + 1
            elif item.distance > top_item.distance + 1:
                item.distance = top_item.distance + 1
    node_que.dequeue()

for item in node_list[1 : ]:
    print '%s %s' % (str(item.number), str(item.distance))
    

### FIXED CODE ###

class node:
    def __init__(self, num):
        self.number     = num
        self.distance   = -1
        self.link_node  = []
        self.is_serched = False

class queue:
    def __init__(self):
        self.top = 0
        self.bottom = 0
        self.que = []
    
    def dequeue(self):
        self.top = self.top + 1
        return self.que[self.top - 1]
    
    def enqueue(self, item):
        self.que.append(item)
        self.bottom = self.bottom + 1
    
    def is_empty(self):
        if self.top == self.bottom:
            return True
        else:
            return False

n = input()
node_list = [None] * (n + 1)

for i in xrange(1, n + 1):
    node_list[i] = node(i)

for i in xrange(1, n + 1):
    line = raw_input().split()
    for node_num in line[2 : ]:
        node_list[i].link_node.append(node_list[int(node_num)])

node_que = queue()

node_list[1].distance = 0
node_que.enqueue(node_list[1])
while node_que.is_empty() == False:
    top_item = node_que.que[node_que.top]
    top_item.is_serched = True
    for item in top_item.link_node:
        if item.is_serched == False:
            node_que.enqueue(item)
            if item.distance == -1:
                item.distance = top_item.distance + 1
            elif item.distance > top_item.distance + 1:
                item.distance = top_item.distance + 1
    node_que.dequeue()

for item in node_list[1 : ]:
    print '%s %s' % (str(item.number), str(item.distance))
a=input()
print a**3

### FIXED CODE ###

a=input()
print a**3
from math import gcd, floor, ceil
def lcd(x, y):
    return x*y//gcd(x,y)
def C():
    a,b,c,d = list(map(int, input().split()))
    c_divide = b//c - (a-1)//c
    d_divide = b//d - (a-1)//d
    cd_lcd = lcd(c,d)
    lcd_divide = b//cd_lcd - (a-1)//cd_lcd
    print(b-a+1 - c_divide - d_divide + lcd_divide)
C()


### FIXED CODE ###

def gcd(x, y):
  while y!=0:
    x, y = y, x%y
  return x
def lcd(x, y):
    return x*y//gcd(x,y)
def C():
    a,b,c,d = list(map(int, input().split()))
    c_divide = b//c - (a-1)//c
    d_divide = b//d - (a-1)//d
    cd_lcd = lcd(c,d)
    lcd_divide = b//cd_lcd - (a-1)//cd_lcd
    print(b-a+1 - c_divide - d_divide + lcd_divide)
C()
a, b, c, d = map(int, input().split())
print(min([a,b])+min([c,d]))

### FIXED CODE ###

a, b, c, d = [int(input()) for i in range(4)]
print(min([a,b])+min([c,d]))
from collections import deque
import sys
sys.setrecursionlimit(2000)
N, M = map(int, input().split())
graph = [[] for j in range(M)]
q = deque([])
depth_array = [-1 for i in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

def bfs(graph, q, depth_array):
    # 終了条件
    if len(q) == 0:
        return depth_array

    cur_room = q.popleft()

    # キューに追加
    for r in graph[cur_room]:
        if depth_array[r] == -1: #未訪問なら
            q.append(r)
            depth_array[r] = depth_array[cur_room] + 1

    return bfs(graph, q, depth_array)
    
# init
q.append(0)
depth_array[0] = 0
depth_array = bfs(graph, q, depth_array)

mark_array = [-1 for i in range(N)]
#print(depth_array)

for room, depth in enumerate(depth_array):
    for node in graph[room]:
        if depth_array[node] + 1 == depth_array[room]:
            mark_array[room] = node
if -1 in mark_array[1:]:
    print("No")
else:
    print("Yes")
    for m in mark_array[1:]:
        print(m+1)

### FIXED CODE ###

from collections import deque
import sys
sys.setrecursionlimit(200000)
N, M = map(int, input().split())
graph = [[] for j in range(N)]
q = deque([])
depth_array = [-1 for i in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

def bfs(graph, q, depth_array):
    # 終了条件
    if len(q) == 0:
        return depth_array

    cur_room = q.popleft()

    # キューに追加
    for r in graph[cur_room]:
        if depth_array[r] == -1: #未訪問なら
            q.append(r)
            depth_array[r] = depth_array[cur_room] + 1

    return bfs(graph, q, depth_array)
    
# init
q.append(0)
depth_array[0] = 0
depth_array = bfs(graph, q, depth_array)

mark_array = [-1 for i in range(N)]
#print(depth_array)

for room, depth in enumerate(depth_array):
    for node in graph[room]:
        if depth_array[node] + 1 == depth_array[room]:
            mark_array[room] = node

if -1 in mark_array[1:]:
    print("No")
else:
    print("Yes")
    for m in mark_array[1:]:
        print(m+1)
a, b, c, d = [int(t) for t in input()]
print(max([b*d, a*c, a*d, b*d]))

### FIXED CODE ###

a, b, c, d = [int(t) for t in input().split()]
print(max([b*d, a*c, a*d, b*c]))
N,M=map(int, input().split())
import sys
def input(): return sys.stdin.readline().strip()
A=list(map(int, input().split()))
BC=[list(map(int,input().split())) for i in range(M)]
A.sort()
BC.sort(key=lambda x: x[1],reverse=True)
from bisect import bisect_left
ans=0
for m in range(M):
    if A[BC[m][0]]<BC[m][1]:
        ans=ans+BC[m][1]*BC[m][0]
        A=A[BC[m][0]:]
    else:    
        r=bisect_left(A,BC[m][1])
        ans=ans+BC[m][1]*r
        A=A[r:]
ans+=sum(A)
print(ans)

### FIXED CODE ###

N,M=map(int, input().split())
import sys
def input(): return sys.stdin.readline().strip()
A=list(map(int, input().split()))
BC=[list(map(int,input().split())) for i in range(M)]
A.sort()
BC.sort(key=lambda x: x[1],reverse=True)
from bisect import bisect_left
ans=0
l=0
for m in range(M):
    if BC[m][0]<len(A)-l and A[BC[m][0]+l]<BC[m][1]:
        ans=ans+BC[m][1]*BC[m][0]
        l+=BC[m][0]
    else:     
        r=bisect_left(A[l:],BC[m][1])
        if r:
            ans=ans+BC[m][1]*r
            l+=r
        break
ans+=sum(A[l:])
print(ans)
WHITE = 0
GRAY = 1
BLACK = 2
color, d, f = [WHITE for i in range(n)]

def visit(u):
    color[u] = GRAY
    d[u] += tt
    for v in range(n):
        if (M[u-1][v-1] == 0):
            continue
        if (color[v] == WHITE):
            visit(v)
    color[u] = BLACK
    f[u] += tt

def dfs():
    tt = 0
    for u in range(n):
        if (color[u] = WHITE):
            visit(u)
    for u in range(n):
        print(u+1, d[u], f[u], sep = " ", end ="\n")

n = int(input())
    for i in range(n):
        for j in range(n):
            M[i][j] = 0
for i in range(n):
    u, k = int(input())
    u -= 1
    for j in range(k):
        v = int(input())
        v -= 1
        M[u][v] = 1

dfs()

### FIXED CODE ###

def dfs(u):
    global dfs_color, d, f, t
    color[u] = GRAY
    d[u] += t
    t += 1
    for v in range(n):
        if (M[u][v] == 0):
            continue
        else:
            if (color[v] == WHITE):
               dfs(v)
    color[u] = BLACK
    f[u] = t
    t += 1

n = int(input())
M = [[False for i in range(n)] for j in range(n)]
for i in range(n):
    tmp = list(map(int, input().split()))
    for j in range(tmp[1]):
        M[tmp[0]-1][tmp[j+2]-1] = True

WHITE = 0
GRAY = 1
BLACK = 2
color = [WHITE for i in range(n)]
d = [0 for i in range(n)]
f = [0 for i in range(n)]
t = 1

for u in range(n):
    if (color[u] == WHITE):
        dfs(u)
for u in range(n):
    print(str(u+1), str(d[u]), str(f[u]), sep = " ")
import sys
input = sys.stdin.readline
import numpy as np
N = int(input())
sum = 0
li = np.ones(100000010)
for i in range(N) :
    A = int(input())
    if li[A] == 1 :
        sum +=1
        li[A] = 0
    else :
        li[A] = 1
        sum -=1
print(sum)

### FIXED CODE ###

n=int(input())
s=set()
for i in range(n):
    a=int(input())
    if a in s:
        s.remove(a)
    else:
        s.add(a)
print(len(s))
def main():
    #import sys
    #input = sys.stdin.readline
    S = input()
    S_list = list(S)
    dig = len(S) - 1
    insert_plus = format(0,"0"+str(dig)+"b")
    insert_plus_max = "1"*len(insert_plus)
    s = 0
    for i in range(int(insert_plus_max,2)+1):
        before = 0
        num_list = []
        now = format(i,"0"+str(dig)+"b")
        for j in range(len(now)):
            if now[j] == "1":
                num_list.append("".join(S_list[before:int(j)+1]))
                before = j+1
            if j == len(now)-1:
                num_list.append("".join(S_list[before:]))
        for num in num_list:
            s += int(num)
    print(s)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    #import sys
    #input = sys.stdin.readline
    S = input()
    S_list = list(S)
    dig = len(S) - 1
    insert_plus = format(0,"0"+str(dig)+"b")
    insert_plus_max = "1"*len(insert_plus)
    s = 0
    if len(S) == 1:
        print(int(S))
        exit()

    for i in range(int(insert_plus_max,2)+1):
        before = 0
        num_list = []
        now = format(i,"0"+str(dig)+"b")
        for j in range(len(now)):
            if now[j] == "1":
                num_list.append("".join(S_list[before:int(j)+1]))
                before = j+1
            if j == len(now)-1:
                num_list.append("".join(S_list[before:]))
        for num in num_list:
            s += int(num)
    print(s)

if __name__ == "__main__":
    main()
if b=="A":
	print("T")
elif b=="T":
	print("A")
elif b=="G":
	print("C")
elif b=="C":
	print("G")



### FIXED CODE ###

b = raw_input()
if b=="A":
	print("T")
elif b=="T":
	print("A")
elif b=="G":
	print("C")
elif b=="C":
	print("G")
import math
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

ma = 0
for i in range(n):
    a[i] = a[i] // 2
    if a[i] > ma:
        ma = a[i]
l = a[0]
for i in range(1, n):
    l = lcm(l, a[i])
ans = ((m - ma) // (l * 3))
if (m - ma) // l // 2 == 0:
    print(0)
else:
    print((m - ma) // l // 2 + 1)


### FIXED CODE ###

import fractions
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

ma = 0
mod2count = -1
for i in range(n):
    if mod2count == -1:
        mod2count = bin(a[i])[2:][::-1].find('1')
    if mod2count != bin(a[i])[2:][::-1].find('1'):
        print(0)
        exit()
    a[i] = a[i] // 2
    if a[i] > ma:
        ma = a[i]

l = a[0]
for i in range(1, n):
    l = lcm(l, a[i])

tmp = m // l
if tmp % 2 == 0:
    print(tmp // 2)
else:
    print(tmp // 2 + 1)
def main():
    with open("input.txt", "r") as f:
        t = f.readlines()
        N = int(t[0].split()[0])
        K = int(t[0].split()[1])
        h = t[1].split()
        h = [int(i) for i in h]
#    N, K  = map(int, input().split())
#    h = list(map(int, input().split()))
    dp = [10**9] * N
    dp[0] = 0

    for i in range(N):
        if i == 0:
            pass
        elif i == 1:
            dp[i] = h[0]
        else:
            dp[i] = min([dp[i-j] + abs(h[i]-h[i-j]) for j in range(1, min(K,i)+1)])
    print(dp[N-1])

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    N, K  = map(int, input().split())
    h = list(map(int, input().split()))
    dp = [10**9] * N
    dp[0] = 0

    for i in range(N):
        dp[i] = min([dp[i-j] + abs(h[i]-h[i-j]) for j in range(min(K,i)+1)])
    print(dp[N-1])

if __name__ == "__main__":
    main()
# -*- coding: utf-8 -*-

# get three integers separated with half-width break
a, b, c = map(int, raw_input().split())
if c >= a and c <= b:
    print('Yes')
else:
    print("No")
# output


### FIXED CODE ###

# -*- coding: utf-8 -*-

# get three integers separated with half-width break
a, b, c = map(int, raw_input().split())
# output
if c >= a and c <= b:
    print "Yes" 
else:
    print "No"
import math
def solve():
    A, B, X = map(int, input().split())
    
    ans = 0
    for d in range(1, 18):
        N = (X - B*d)/A
        N = int(math.ceil(N))
        if N <= 0:
            continue
        if d == len(str(N)):
            if d >= 10:
                ans = 10**9
            else:
                ans = N
    
    print(ans)
 
if __name__ == '__main__':
    solve()

### FIXED CODE ###

def solve():
    S = input()
    day = ["MON","TUE","WED","THU","FRI","SAT","SUN"]
    for i in range(len(day)):
        if S == "SUN":
            print(7)
            break
        elif S == day[i]:
            print(6-i)
            break
if __name__ == '__main__':
    solve()
sum=0
min=9
for i in range(5):
  y=int(input())
  x=y%10
  if x==0:
    sum+=y
  else:
    min=min(x, min)
    if x==min:
      sum+=y
    else:
      sum+=(y+10-x)
print(sum)

### 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)))
n,m=map(int,input().split())
dic={}
for i in range(m):
  x,y=map(int,input().split())
  if x in dic:
    dic[x]+=1
  else:
    dic[x]=1
  if y in dic:
    dic[y]+=1
  else:
    dic[y]=1
for i in range(1,n+1):
  print(dic[i])

### FIXED CODE ###

n,m=map(int,input().split())
dic={}
for i in range(m):
  x,y=map(int,input().split())
  if x in dic:
    dic[x]+=1
  else:
    dic[x]=1
  if y in dic:
    dic[y]+=1
  else:
    dic[y]=1
for i in range(1,n+1):
  try:
    print(dic[i])
  except:
    print(0)
s=input()
K=int(input())
li=[]
for i in range(len(s)):
  m=min(K,len(s)-i)
  for j in range(m):
    li.append(s[i:i+j+1])
li.sort()
print(li[K])

### FIXED CODE ###

s=input()
K=int(input())
li=[]
for i in range(len(s)):
  m=min(K,len(s)-i)
  for j in range(m):
    li.append(s[i:i+j+1])
li.sort(reverse=True)
st=[]
while len(st)<K:
  t=li.pop()
  if t not in st:
    st.append(t)
print(st[-1])
N = int(input())
T, A = map(int, input())
HS = list(map(int, input().split()))

result = 0
min_dif = 10000
for i in range(N):
  dif = abs(A, T - HS[i] * 0.0060 )
  if dif < min_dif:
    min_dif = dif
    result = i
print(result)

### FIXED CODE ###

N = int(input())
T, A = map(int, input().split())
HS = list(map(int, input().split()))
 
result = 1
min_dif = 10000
for i in range(N):
  dif = abs(A - (T - HS[i] * 0.0060))
  if dif < min_dif:
    min_dif = dif
    result = i + 1
print(result)
import math

a = float(input())
b = float(input())
c = float(input())
d = float(input())
e = float(input())

last = 9

all = []

all.append(a%10)
all.append(b%10)
all.append(c%10)
all.append(d%10)
all.append(e%10)


for m, i in enumerate(all):
    # print(i)
    temp = i
    if temp < last and temp !=0:
        last = temp
        index = m

# print("index:" + str(index))
a = a/10
b = b/10
c = c/10
d = d/10
e = e/10

All = []
All.append(a)
All.append(b)
All.append(c)
All.append(d)
All.append(e)

sum = 0
for k, j in enumerate(All):
    # print(k)

    if k == index:
        # print(k)
        sum += j *10
    else:
        sum += math.ceil(j)*10

sum = int(sum)
print(sum)

### FIXED CODE ###

import math

a = float(input())
b = float(input())
c = float(input())
d = float(input())
e = float(input())

last = 9

all = []

all.append(a%10)
all.append(b%10)
all.append(c%10)
all.append(d%10)
all.append(e%10)

flag = 0
for m, i in enumerate(all):
    # print(i)
    temp = i
    if temp < last and temp !=0:
        last = temp
        index = m
        flag = 1

if flag ==0:
    index = 0

# print("index:" + str(index))
a = a/10
b = b/10
c = c/10
d = d/10
e = e/10

All = []
All.append(a)
All.append(b)
All.append(c)
All.append(d)
All.append(e)

sum = 0
for k, j in enumerate(All):
    # print(k)

    if k == index:
        # print(k)
        sum += j *10
    else:
        sum += math.ceil(j)*10

sum = int(sum)
print(sum)
input a
print "%d", (a * a * a)

### FIXED CODE ###

print(int(input())**3)