Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import sys
import heapq as hp


class Edge:
    def __init__(self, end, cost):
        self.to = end
        self.cost = cost


class Dijkstra:
    def __init__(self, V):
        self._node = V
        self._graph = [[] for i in range(self._node)]
        self._inf = sys.maxsize
        self.dist = [self._inf for i in range(self._node)]

    def add_edge(self, st, ed, cost):
        self._graph[st].append(Edge(ed, cost))
    def solve(self, s):
        que = []
        self.dist[s] = 0
        hp.heappush(que, (0, s))
        while que:
            info = hp.heappop(que)
            cur_cost, cur_vertex = info
            if self.dist[cur_vertex] < cur_cost:
                continue
            for e in self._graph[cur_vertex]:
                if cur_cost + e.cost < self.dist[e.to]:
                    self.dist[e.to] = cur_cost + e.cost
                    hp.heappush(que, (self.dist[e.to], e.to))
                    hp.heapify(que)


if __name__ == '__main__':
    V, E, r = map(int, sys.stdin.readline().split())
    dk = Dijkstra(V)
    for i in range(E):
        s, t, d = map(int, sys.stdin.readline().split())
        dk.add_edge(s, t, d)
    dk.solve(r)
    for value in dk.dist:
        if value == sys.maxsize:
            sys.stdout.writelines("INF\n")
        else:
            sys.stdout.writelines("%d\n" % value)



### FIXED CODE ###

import sys
from heapq import heappush, heappop


class Dijkstra:
    class Edge:
        def __init__(self, end, cost):
            self.to = end
            self.cost = cost

    def __init__(self, node_size, inf):
        self._node = node_size
        self._graph = [[] for _ in range(self._node)]
        self.inf = inf
        self.dist = [self.inf for _ in range(self._node)]

    def add_edge(self, st, ed, cs):
        self._graph[st].append(self.Edge(ed, cs))

    def solve(self, start):
        que = []
        self.dist[start] = 0
        heappush(que, (0, start))
        while que:
            cur_cost, cur_vertex = heappop(que)
            if self.dist[cur_vertex] < cur_cost:
                continue
            for e in self._graph[cur_vertex]:
                if self.dist[e.to] > cur_cost + e.cost:
                    self.dist[e.to] = cur_cost + e.cost
                    heappush(que, (self.dist[e.to], e.to))


if __name__ == '__main__':
    V, E, r = map(int, sys.stdin.readline().split())
    dk = Dijkstra(V, 10 ** 10)
    for i in range(E):
        s, t, d = map(int, sys.stdin.readline().split())
        dk.add_edge(s, t, d)
    dk.solve(r)
    for value in dk.dist:
        if value == dk.inf:
            sys.stdout.write("INF\n")
        else:
            sys.stdout.write("%s\n" % value)
### BUGGY CODE ###

n,q = map(int,input().split())
s = input()
s_num = []
sa = []
for i in range(len(s)):
  if s[i] == "T" or s[i] == "G":
    s_num.append(100)
  elif s[i] == "A":
    s_num.append(0)
  elif s[i] == "C":
    s_num.append(1)
    
for j in range(1,len(s)):
  if s_num[j] - s_num[j-1] == 1:
    sa.append(True)
  else:
    sa.append(False)
    
for m in range(q):
  l,r = map(int,input().split())
  target  = sa[l-1:r-1]
  print(target.count(True))
 
  

### FIXED CODE ###

n,q = map(int,input().split())
s = input()
s_num = []
sa = [0]
count = 0
for i in range(1,len(s)):
  if s[i] == "C"and s[i-1] == "A":
    count += 1
    sa.append(count)
  else:
    sa.append(count)
    
for i in range(q):
  l,r = map(int,input().split())
  print(sa[r-1] - sa[l-1])
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

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

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a
#リストの最小公倍数
def lcm(a):    
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

N = ir()
A = lr()
A.sort()
if N == 1:
    print(1)
    exit()
MOD = 10 ** 9 + 7
l = []
first = A[0]
l = [x//gcd(x, first) for x in A[1:]]
x = lcm(l) #B[0]
answer = x%MOD

for i in range(1, N):
    answer += first * x // A[i]
    if i % 10 == 0:
        answer %= MOD

print(answer%MOD)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

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

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a
#リストの最小公倍数
def lcm(a):    
    x = a[0]
    for i in range(1, len(a)):
        x = (x * a[i]) // gcd(x, a[i])
    return x

N = ir()
A = lr()
A.sort()
if N == 1:
    print(1)
    exit()
MOD = 10 ** 9 + 7
l = []
first = A[0]
l = [x//gcd(x, first) for x in A[1:]]
x = lcm(l) #B[0]
answer = x%MOD

for i in range(1, N):
    answer += first * x // A[i]

print(answer%MOD)
### BUGGY CODE ###

# https://atcoder.jp/contests/abc168/tasks/abc168_d
from pprint import pprint

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

A = []
B = []
for i in range(M):
    _a, _b = map(int, input().split(' '))
    A.append(_a)
    B.append(_b)

room_next = [[] for n in range(N)]

for a, b in zip(A, B):
    room_next[a - 1].append(b - 1)
    room_next[b - 1].append(a - 1)

room_depth = [None] * N
room_depth[0] = 0
room_sign = [None] * N

stack = [0]
visited = []

while stack:
    now = stack.pop()
    if now not in visited:
        visited.append(now)
        for r in room_next[now]:
            if room_depth[r] is None or room_depth[r] > room_depth[now] + 1:
                room_depth[r] = room_depth[now] + 1
                room_sign[r] = now + 1
                stack.append(r)

print('Yes')
for s in room_sign[1:]:
    print(s)

### FIXED CODE ###

# https://atcoder.jp/contests/abc168/tasks/abc168_d
from collections import deque

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

A = []
B = []

# 隣接リスト
route2 = [[] for n in range(N)]

for i in range(M):
    a, b = map(int, input().split(' '))
    A.append(a)
    B.append(b)

for a, b in zip(A, B):
    route2[a - 1].append(b - 1)
    route2[b - 1].append(a - 1)

room_sign = [None] * N

queue = deque([])
visited = set()

queue.append(0)
visited.add(0)

while len(queue) > 0:
    now = queue.popleft()
    for i in route2[now]:
        if i not in visited:
            queue.append(i)
            visited.add(i)

            room_sign[i] = now + 1

print('Yes')
for s in room_sign[1:]:
    print(s)
### BUGGY CODE ###

import sys

N, M = map(int, input().split())
way_list = list()
first_list = list()
for i in range(M):
    a, b = map(int, input().split())
    if b == N:
        way_list.append(a)
    if a == 1:
        first_list.append(b)

way_list.sort()
first_list.sort()

for first in first_list:
    if first in way_list:
        print("POSSIBLE")
        sys.exit()
print("IMPOSSIBLE")

### FIXED CODE ###

import sys

def possible():
    print("POSSIBLE")
    sys.exit()

def main():
    N, M = map(int, input().split())
    hashdict = dict()
    for i in range(1009):
        hashdict[i] = list()
    alist = list()
    for i in range(M):
        a, b = map(int, input().split())
        if a == 1:
            temp = b % 1009
            hashdict[temp].append(b)
        if b == N:
            alist.append(a)

    for start in alist:
        temp = start % 1009
        if start in hashdict[temp]:
            possible()
    print("IMPOSSIBLE")

if __name__ == "__main__":
    main()
### BUGGY CODE ###

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

if n % 2:
    if a.count(0) != 1:
        print(0)
        exit()
    for i in range(1, n//2+1):
        if a.count(2*i) != 2:
            print(0)
            exit()

else:
    for i in range(1, n//2+1):
        if a.count(2*i-1) != 2:
            print(0)
            exit()

print(2**(n//2))


### FIXED CODE ###

n = int(input())
a = sorted(list(map(int, input().split())))
p = 10**9 + 7

if n % 2:
    if a[0] != 0:
        print(0)
        exit()
    for i in range(1, n//2+1):
        if a[2*i-1] == a[2*i] and a[2*i-1] == 2*i:
            continue
        else:
            print(0)
            exit()

else:
    for i in range(1, n//2+1):
        if a[2*i-2] == a[2*i-1] and a[2*i-2] == 2*i-1:
            continue
        else:
            print(0)
            exit()

print((2**(n//2))%p)
### BUGGY CODE ###

from itertools import accumulate

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

ans = 0

"""
for i, p in enumerate(P):
    # if np.any(P[0:i] < p): あまり以下と変わらなかった
    # if any([True for p2 in P[0:i] if p2 < p]): # 2回のループが☓ O(n^2)なので
        pass
    else:
        ans += 1
"""

for i, p in enumerate(P):
    tmp = list(accumulate(P[0:i+1], min))[-1]
    if p <= tmp:
        ans += 1

print(ans)


### FIXED CODE ###

from itertools import accumulate

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

ans = 0

"""
for i, p in enumerate(P):
    # if np.any(P[0:i] < p): あまり以下と変わらなかった
    # if any([True for p2 in P[0:i] if p2 < p]): # 2回のループが☓ O(n^2)なので
        pass
    else:
        ans += 1
"""

P_min = list(accumulate(P, min))

for p, p_min in zip(P, P_min):
    if p == p_min:
        ans += 1

print(ans)
### BUGGY CODE ###

n = int(input())
hs = list(map(int, input().split()))

max_ = -5
for i in range(n):
    j = i
    count = 0
    while (j <= n-2) and (hs[j] >= hs[j+1]):
        j += 1
        count += 1
    
    if count > max_:
        max_ = count
print(max_)

### FIXED CODE ###

n = int(input())
hs = list(map(int, input().split()))

max_ = 0
point = 0
while point <= n-2:
    j = point
    count = 0
    while hs[j] >= hs[j+1]:
        j += 1
        count += 1
        if j == n-1:
            break
    
    if count > max_:
        max_ = count
    
    point = j+1
print(max_)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
b=[]
for i in range(n):
    b.append(a[i])
    b=b[::-1]
print(*(b))

### FIXED CODE ###

N=int(input())
s=list(input().split())
b=s[N::-2]+s[N%2::2]
print(*(b))
### BUGGY CODE ###

#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

s = str(input())
K = I()
n = len(s)

a = []
for i in range(n):
    for j in range(i+1,n+1):
        a.append(s[i:j])

a = list(set(a))
a.sort()
print(a[K-1])

### FIXED CODE ###

#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

s = str(input())
K = I()
n = len(s)

a = set()
for i in range(n):
    for j in range(i+1,min(i+6,n+1)):
        a.add(s[i:j])

a = list(a)
a.sort()
print(a[K-1])
### BUGGY CODE ###

N,Q = map(int,input().split())
S = input()
list = [list(map(int,input().split())) for i in range(Q)]

for l,r in list:
    cnt = 0
    S_rep = S[l-1:r].replace('AC','')
    print(int((len(S[l-1:r])-len(S_rep))/2))


### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)

for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])
### BUGGY CODE ###

import fractions
N = int(input())
A = [int(i) for i in input().split()]
if N == 2:
  print(max(A[0],A[1]))
else:
  ans = -1
  for i in range(N):
    x = -1
    li = [A[i] for i in range(N)]
    li.pop(i)
    for j in range(N-2):
      if j == 0:
        x = fractions.gcd(li[0],li[1])
      else:
        x = fractions.gcd(x,li[j+1])
    if x > ans:
      ans = x
  print(ans)

### FIXED CODE ###

from fractions import gcd

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

B = [0] * (N - 1)
C = [0] * (N - 1)

for n in range(N - 1):
    if n == 0:
        B[0] = A[0]
        C[N - 2] = A[N - 1]
    else:
        B[n] = gcd(B[n - 1], A[n])
        C[N - n - 2] = gcd(A[N - n - 1], C[N - n - 1])

ans = 0
for n in range(N):
    if n == 0:
        ans = C[0]
    elif n == N - 1:
        ans = max(ans, B[N - 2])
    else:
        ans = max(ans, gcd(B[n - 1], C[n]))
print(ans)
### BUGGY CODE ###

n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
maxs = []
for i in range(n):
	a2 = a[i]
	a[i] = 0
	maxs.append(max(a))
	a[i] = a2

for i in range(n):
	print(maxs[i])

### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
max1 = max(a)
idx = a.index(max1)
a[idx] = 0
max2 = max(a)

for i in range(n):
	if i != idx:
		print(max1)
	else:
		print(max2)
### BUGGY CODE ###

from operator import mul
from functools import reduce
N, K = map(int, input().split())
As = list(map(int, input().split()))
base = []
ans2=0
for n in range(K, N+1):
    ans1=ans2
    start = n-K
    ans = 1
    ans = reduce(mul, As[start:n])
    ans2 = ans
    if n != K:
        if ans1 < ans2:
            print("Yes")
        else:
            print("No")

### FIXED CODE ###

N, K = map(int, input().split())
As = list(map(int, input().split()))
ans2=0
for n in range(K+1, N+1):
    ans1 = As[n-K-1]
    ans2 = As[n-1]
    if ans1 < ans2:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

n,m,k = map(int,input().split())
mod = 998244353
ans = 0

def comb(n,k,mod):
    nCk = 1

    for i in range(n-k+1, n+1):
        nCk *= i
        nCk %= mod
 
    for i in range(1,k+1):
        nCk *= pow(i,mod-2,mod)
        nCk %= mod
    return nCk
for i in range(k+1):
    a = pow(m-1, n-i-1, mod)
    b = comb(n-1,i,mod)
    ans += (a*b)%mod
ans *= m
print(ans%mod)

### FIXED CODE ###

n,m,k = map(int,input().split())
mod = 998244353
ans = 0

def comb(n, r, mod):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % mod
  
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, n+1):
    fact.append((fact[-1] * i) % mod)
    inv.append((-inv[mod % i] * (mod // i)) % mod)
    factinv.append((factinv[-1] * inv[-1]) % mod)


for i in range(k+1):
    a = pow(m-1, n-i-1, mod)
    b = comb(n-1,i,mod)
    ans += (a*b)%mod
ans *= m
print(ans%mod)
### BUGGY CODE ###

N=int(input())
Alist=list(map(int,input().split()))
sum=0
for i in range(N-1):
  for j in range((i+1),N):
    sum=(sum+(Alist[i]*Alist[j]))%(10**9+7)
print(sum)

### FIXED CODE ###

N=int(input())
Alist=list(map(int,input().split()))
sum1=0
sum2=0
for i in range(N):
  sum1=sum1+Alist[i]
  sum2=sum2+(Alist[i])**2
ans=(sum1**2-sum2)//2
print(ans%(10**9+7))
### BUGGY CODE ###

s = [i for i in list(input())]
n = 10**6
result = [0]*len(s)
for i in range(len(s)):
    x = i
    count = 0
    while s[i] == s[x]:
        if s[x] == 'R':
            x += 1
        else:
            x -= 1
    if s[i] == 'R':
        count = x-i
        result[x-((count)%2)] += 1
    else:
        count = i - x
        result[x+((count)%2)] += 1
print(' '.join(list(map(str, result))))

### FIXED CODE ###

s = [i for i in  list(input())]
x = 0
i = 0
a = []
result = []
while x < len(s)-1:
    while s[x] == s[i]:
        i += 1
        if i > len(s)-1:
            break
    a.append([s[x],int(i-x)])
    x = i
if a[-1][0] != 'L':
    a.append(['L',1])
for p in range(len(a)):
    if a[p][0] == 'R':
        result.extend([0]*(a[p][1]+1))
        result[len(result)-2] += a[p][1]//2+a[p][1]%2
        result[len(result)-1] += a[p][1]//2
    elif a[p][0] == 'L':
        result[len(result)-2] += a[p][1]//2
        result[len(result)-1] += a[p][1]%2+a[p][1]//2
        result.extend([0]*(a[p][1]-1))
print(' '.join(map(str, result)))
### BUGGY CODE ###

MOD = 998244353
N,M,K = [int(hoge) for hoge in input().split()]
NcK = []
POWER = []
cur = 1#Nc0
for k in range(K+1):
    NcK.append(cur % MOD)
    cur *= (N-1-k)
    if k==K:break
    cur //= (k+1)    
curpower = 1
for n in range(N):#M-1 ** n
   POWER.append(curpower)
   curpower *= M-1
   curpower %= MOD

ans = 0

for k in range(K+1):
    ans += M * POWER[N-1-k] * NcK[k]
    #M-1 ** N-1-k ということは…？
ans %= MOD
print(ans)


### FIXED CODE ###

#互いに素なa,bについて、a*x+b*y=1の一つの解
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

# aの逆元(mod m)を求める。(aとmは互いに素であることが前提)
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

import math
MOD = 998244353
N,M,K = [int(hoge) for hoge in input().split()]
NcK = []
POWER = []
cur = 1#Nc0
for k in range(K+1):
    NcK.append(cur)
    cur *= (N-1-k)* mod_inv(k+1,MOD)
    cur %= MOD    

ans = 0
Power = 1
for k in range(N-1-K):#M-1**n-1-K
    Power *= M-1
    Power %= MOD

for k in range(K,-1,-1):
    ans += Power * NcK[k]
        #M-1 ** N-1-k ということは…？
    if k:
        Power *= M-1
        Power %= MOD
    

print((M*ans)%MOD)
### BUGGY CODE ###

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

ans=1
for aa in a:
    ans=ans*aa

if ans>10**18:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

n=int(input())
a = [int(i) for i in input().split() if i!="1"]

if 0 in a:
    print(0)
else:
    ans=1
    for aa in a:
        ans=ans*aa
        if ans>10**18:
            print(-1)
            break
    else:
        print(ans)
### BUGGY CODE ###

K,S = map(int,input().split())
ans = 0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x + y + z == S:
                ans += 1
print(ans)


### FIXED CODE ###

K,S = map(int,input().split())
ans = 0
for x in range(K+1):
    for y in range(K+1):
        z = S - (x + y)
        if  0 <= z <= K:
            ans += 1
print(ans)
### BUGGY CODE ###

#coding:utf-8
import bisect
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = True



def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    n, t = LMIIS()
    ab = XLMIIS(n)

    dp1 = [[0]*t for _ in range(n)]
    for i in range(1, n):
        for j in range(1, t):
            if j < ab[i-1][0]:
                dp1[i][j] = dp1[i-1][j]
            else:
                dp1[i][j] = max(dp1[i-1][j], dp1[i-1][j-ab[i-1][0]] + ab[i-1][1])


    dp2 = [[0]*t for _ in range(n)]
    for i in range(1, n):
        for j in range(1, t):
            if j < ab[n - i][0]:
                dp2[i][j] = dp2[i-1][j]
            else:
                dp2[i][j] = max(dp2[i-1][j], dp2[i-1][j-ab[n-i][0]] + ab[n-i][1])

    ans = 0
    for i in range(n):
        for j in range(t - 1):
            ans = max(ans, dp1[i][j] + dp2[n - i - 1][t - j - 1] + ab[i][1])
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#coding:utf-8
import bisect
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = True



def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    n, t = LMIIS()
    ab = XLMIIS(n)

    dp1 = [[0]*t for _ in range(n)]
    for i in range(1, n):
        for j in range(1, t):
            if j < ab[i-1][0]:
                dp1[i][j] = dp1[i-1][j]
            else:
                dp1[i][j] = max(dp1[i-1][j], dp1[i-1][j-ab[i-1][0]] + ab[i-1][1])


    dp2 = [[0]*t for _ in range(n)]
    for i in range(1, n):
        for j in range(1, t):
            if j < ab[n - i][0]:
                dp2[i][j] = dp2[i-1][j]
            else:
                dp2[i][j] = max(dp2[i-1][j], dp2[i-1][j-ab[n-i][0]] + ab[n-i][1])

    ans = 0
    for i in range(n):
        for j in range(t - 1):
            ans = max(ans, dp1[i][j] + dp2[n - i - 1][t - j - 1] + ab[i][1])
    print(ans)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

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

results = set()
abc = "abcdefghijklmnopqrstuvwxyz"

for al in abc:
    idxs = []
    last = 0
    while True:
        f = s.find(al, last)
        if f < 0:
            break
        idxs.append(f)
        last = f + 1
    count = len(idxs)
    if count == 0:
        continue

    lens = [1 for i in range(count)]
    while len(results) < K:
        useIdx = -1
        useStr = "あああ"
        for i in range(count):
            i1 = idxs[i]
            i2 = idxs[i] + lens[i]
            if i2 <= len(s):
                ss = s[i1:i2]
                if useStr > ss:
                    useStr = ss
                    useIdx = i
        if useIdx < 0:
            break
        lens[useIdx] += 1
        results.add(useStr)
sorted = list(results)
sorted.sort()
print(sorted[K - 1])


### FIXED CODE ###

s = input()
sLen = len(s)
K = int(input())

result = set()
for i in range(sLen):
    for j in range(1, K + 1):
        if i + j > sLen:
            break
        ss = s[i:i+j]
        result.add(ss)
print(sorted(result)[K - 1])
### BUGGY CODE ###

string=input()
length=len(string)
mod=[1]+[0]*2018
while length > 0:
  mod[int(string[length-1:])%2019]+=1
  length-=1
print(sum([i*(i-1)//2 for i in mod]))

### FIXED CODE ###

string=input()
length=len(string)
mod=[1]+[0]*2018
s=0
for i in range(length):
  s=(s+int(string[-1-i])*pow(10,i,2019))%2019
  mod[s]+=1
print(sum([i*(i-1)//2 for i in mod]))
### BUGGY CODE ###

k = int(input())
seven = '7'
count = 0

while True:
    if k % 2 == 0:
        count = -1
        break

    elif int(seven) % k == 0:
        count += 1
        break
    else:
        count += 1
        seven += '7'

print(count)

### FIXED CODE ###

def main():
    k = int(input())
    num = 1
    n = 7

    if (k % 2 == 0):
        print(-1)
        return
    
    for i in range(1000000):
        if (n % k == 0):
            print(num)
            return
        else:
            n = (n*10 + 7) %k
            num += 1
    print(-1)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

iteration_count = int(input())
for my_target in range(1,iteration_count+1):
  guess_max_range = int((my_target + 2) ** 0.5)
  number_of_match = 0
  for xx in range(1,guess_max_range):
    xxxx = xx**2
    for yy in range(1,guess_max_range):
      yyyy = yy**2
      xxyy = xx*yy
      for zz in range(1,guess_max_range):
        result = xxxx + yyyy + (zz)**2 + xxyy + (yy)*(zz) + (zz)*(xx)
        if result == my_target:
          number_of_match = number_of_match + 1
  print(number_of_match)

### FIXED CODE ###

nn = int(input())
number_of_match = [0 for _ in range(10005)]
for xx in range(1,105):
  xxxx = xx**2
  for yy in range(1,105):
    yyyy = yy**2
    xxyy = xx*yy
    for zz in range(1,105):
      result = xxxx + yyyy + (zz)**2 + xxyy + (yy)*(zz) + (zz)*(xx)
      if result < 10005:
        number_of_match[result] += 1
for i in range(1,nn+1):
  print(number_of_match[i])