Harryxun/stf_run huggingface dataset:
N = int(input())

X = [0] * N
Y = [0] * N

X[0],Y[0] = map(int,input().split(" "))
ev = abs(X[0] + Y[0])%2
flg = False
for i in range(N-1):
    X[i+1],Y[i+1] = map(int,input().split(" "))
    if abs(X[i+1] + Y[i+1]) % 2 != ev:
        flg = True

if flg:
    print(-1)
    exit(0)

if ev == 1:
    m =  39
else:
    m = 40

stop = "LR"

print(m)
print('1 ' * (m-1) + '1')
for i in range(N):
    need = (abs(X[i])+abs(Y[i]))
    s = stop * (m - need)
    if X[i] < 0:
        s += ("L" * abs(X[i]))
    else:
        s += ("R" * abs(X[i]))
        
    if Y[i] < 0:
        s += ("D" * abs(Y[i]))
    else:
        s += ("U" * abs(Y[i]))

    print(s)

### FIXED CODE ###

N = int(input())
X,Y = [0]*N,[0]*N
U,V = [0]*N,[0]*N
mod = [0] * N
for i in range(N):
    X[i],Y[i] = map(int,input().split(" "))
    mod[i] = (X[i] + Y[i]) % 2
    U[i],V[i] = (X[i]+Y[i]),(X[i]-Y[i])

l = len(list(filter(lambda x: x == 1,mod)))

if l != 0 and l != N:
    print(-1)
    exit(0)

# 偶数
if l == 0:
    d = [ 1 << i for i in range(38,-1,-1) ] + [1]

else:
    d = [ 1 << i for i in range(39,-1,-1) ]

ans = []
for i in range(N):
    move = []
    curU,curV = 0,0
    for step in d:
        if curU <= U[i] and curV <= V[i]:
            curU += step
            curV += step
            move.append('R')

        elif curU > U[i] and curV <= V[i]:
            curU -= step
            curV += step
            move.append('D')

        elif curU <= U[i] and curV > V[i]:
            curU += step
            curV -= step
            move.append('U')

        elif curU > U[i] and curV > V[i]:
            curU -= step
            curV -= step
            move.append('L')

    ans.append(move)

print(len(d))
print(*d)
for i in range(N):
    print("".join(ans[i]))
N = int(input())
list={}
for i in range(N):
    list ^= {int(input())}
print(len(list))

### FIXED CODE ###

N = int(input())
list=set()
for i in range(N):
    list ^= {int(input())}
print(len(list))
s=int(input)
def c(x):
  co=0
  for i in range(1,10):
    if x%i==0 and x//i<=9:
      co+=1
  if co>0:
    return("Yes")
  else:
    return("No")
print(c(s))

### FIXED CODE ###

numeros = [1,2,3,4,5,6,7,8,9]
multiplicaciones = []

for x in numeros:
	for z in numeros:
		multiplicaciones.append(x*z)
		pass
	pass
entrada = int(input())
si = False
for x in multiplicaciones:
	if(x==entrada):
		si=True
		break

if(si):
	print("Yes")
else:
	print("No")
hoge = input().split()
N = int(hoge[0])
L = int(hoge[1])

if L > 0:
  erase_apple = 0
elif L+N >= 0:
  for i in range(N):
    if i + L == 0:
      erase_apple = i
      break
else:
  erase_apple = N-1

if erase_apple == N:
  erase_apple = N-1

apples = []
for i in range(N):
  apples.append(L+i)

apples.pop(erase_apple)
print(sum(apples))

### FIXED CODE ###

hoge = input().split()
N = int(hoge[0])
L = int(hoge[1])

if L > 0:
  erase_apple = 0
elif L+N >= 0:
  for i in range(N+1):
    if i + L == 0:
      erase_apple = i
      break
else:
  erase_apple = N-1

if erase_apple == N:
  erase_apple = N-1

apples = []
for i in range(N):
  apples.append(L+i)

apples.pop(erase_apple)
print(sum(apples))
a,b,c = [int(i) for i in input() split()]
if a < b < c:
  print("Yes)
else:
  print("No")

### FIXED CODE ###

a,b,c = [int(i) for i in input().split()]
if a < b < c:
  print('Yes')
else:
  print('No')
nn=int(input())
import sys
input=sys.stdin.readline
cc=[int(input()) for _ in range(n)]
c=[cc[0]]
for i in range(1,nn):
    if cc[i]!=c[-1]:
        c.append(cc[i])
n=len(c)
mod=10**9+7
dp=[0]*(n+1)
sm=[0]*(max(c)+1)
dp[0]=1
for i in range(n):
    x=c[i]
    dp[i+1]+=sm[x]+dp[i]
    sm[x]+=dp[i]
    dp[i]%=mod
    dp[i+1]%=mod
print(dp[n])


### FIXED CODE ###

nn=int(input())
import sys
input=sys.stdin.readline
cc=[int(input()) for _ in range(nn)]
c=[cc[0]]
for i in range(1,nn):
    if cc[i]!=c[-1]:
        c.append(cc[i])
n=len(c)
mod=10**9+7
dp=[0]*(n+1)
sm=[0]*(max(c)+1)
dp[0]=1
for i in range(n):
    x=c[i]
    dp[i+1]+=sm[x]+dp[i]
    sm[x]+=dp[i]
    dp[i]%=mod
    dp[i+1]%=mod
print(dp[n])
n=int(raw_input())
N=[]
for i in range(n):
	N.append(int(raw_input()))
N.sort()
ans=1
for i in range(1,n):
	if N[i]!=N[i-1]:
		ans+=1
print ans

### FIXED CODE ###

print "2018"+raw_input()[4:]
n = int(input())
s = sum([i for i in str(n)])

if n % s == 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n = int(input())
s = sum([int(i) for i in str(n)])

if n % s == 0:
    print("Yes")
else:
    print("No")
s = [list(map(int,input().split())) for i in range(2)]

a=0
for i in range(s[0][1]):
  a += s[1][i]

r = "Yes"
if a < s[0][0]:
  print("No")
else:
  print("Yes")

### FIXED CODE ###

s = list(map(int,input().split()))
a = s[0] // s[1]
b = s[0] % s[1]
if b != 0:
  a +=1
print(a)
def popcnt(n):
    return bin(n).count("1")

def f(n):
    cnt = 0
    while n>0:
        n = n%popcnt(n)
        cnt += 1
    return cnt

def solve(X):
    Y = int(X, 2)
    c = X.count("1")
    if c == 0:
        return 0
    m, p = c-1, c+1
    Ym, Yp = Y%m, Y%p
    for i in range(N):
        if X[i] == "1":
            Y = (Ym - pow(2,N-i-1,m))%m
        else:
            Y = (Yp + pow(2,N-i-1,p))%p
        print(f(Y) + 1)

N = int(input())
solve(input())



### FIXED CODE ###

def popcnt(n):
    return bin(n).count("1")

def f(n):
    cnt = 0
    while n>0:
        n = n%popcnt(n)
        cnt += 1
    return cnt

def solve(X):
    Y = int(X, 2)
    c = X.count("1")
    m, p = c-1, c+1
    Ym, Yp = Y%m if m else -1, Y%p
    for i in range(N):
        if X[i] == "1":
            Y = (Ym - pow(2,N-i-1,m))%m if Ym!=-1 else -1
        else:
            Y = (Yp + pow(2,N-i-1,p))%p
        print(f(Y) + 1 if Y!=-1 else 0)

N = int(input())
solve(input())
def diikstraMethd(G, s):
    # ?????????
    n = len(G)
    # White:0 Gyay:1 Black:2
    color = [0 for _ in range(n)]
    d = [INF for _ in range(n)]
    p = [None for _ in range(n)]

    d[s] = 0

    while True:
        mincost = INF
        for i in range(n):
            if color[i] != 2 and d[i] < mincost:
                mincost = d[i]
                u = i

        if mincost == INF: break

        color[u] = 2

        for v in range(n):
            if color[v] != 2 and M[u][v] != INF:
                if d[u] + M[u][v] < d[v]:
                    d[v] = d[u] + M[u][v]
                    p[v] = u
                    color[u] = 1

    return d

if __name__ == '__main__':
    n = int(input())
    M = [[INF for _ in range(n)] for i in range(n)]
    for _ in range(n):
        tmp = list(map(int, input().split()))
        u = tmp.pop(0)
        k = tmp.pop(0)
        for _ in range(k):
            v = tmp.pop(0)
            c = tmp.pop(0)
            M[u][v] = c
    d = diikstraMethd(M, 0)

    for i in range(n):
        print('{0} {1}'.format(i, d[i]))

### FIXED CODE ###

INF = 1000000


def diikstraMethd(G, s):
    # ?????????
    n = len(G)
    # White:0 Gyay:1 Black:2
    color = [0 for _ in range(n)]
    d = [INF for _ in range(n)]
    p = [None for _ in range(n)]

    d[s] = 0

    while True:
        mincost = INF
        for i in range(n):
            if color[i] != 2 and d[i] < mincost:
                mincost = d[i]
                u = i

        if mincost == INF: break

        color[u] = 2

        for v in range(n):
            if color[v] != 2 and M[u][v] != INF:
                if d[u] + M[u][v] < d[v]:
                    d[v] = d[u] + M[u][v]
                    p[v] = u
                    color[u] = 1

    return d


if __name__ == '__main__':
    n = int(input())
    M = [[INF for _ in range(n)] for i in range(n)]
    for _ in range(n):
        tmp = list(map(int, input().split()))
        u = tmp.pop(0)
        k = tmp.pop(0)
        for _ in range(k):
            v = tmp.pop(0)
            c = tmp.pop(0)
            M[u][v] = c
    d = diikstraMethd(M, 0)

    for i in range(n):
        print('{0} {1}'.format(i, d[i]))
import math
n = int(input())
x1 = math.ceil(n/1.08)
print(':(' if math.floor(x1*1.08) != n else x1)

### FIXED CODE ###

n,a,b = map(int, input().split())
s = input()
p = a+b
cnt = 0
bcnt = 0
for i in range(n):
    if s[i] == 'a' and cnt < p:
        print('Yes')
        cnt+=1
    elif s[i] == 'b' and cnt < p and bcnt < b:
        print('Yes')
        cnt+=1
        bcnt+=1
    else:
        print('No')
n,x=map(int,input().split())
L=list(map(int,input().split()))
#print(L)
D=0
B=[0]
C=[]
for i in range(len(L)):
  D=D+L[i]
  B.append(D)
#print(B)
for i in range(len(L)):
  if B[i]<=x:
    C.append(i)
  else:
    pass
#print(C)
print(min(n+1,len(C)))


### FIXED CODE ###

X,A = list(map(int, input().split()))
if X<A:
  print(0)
else:
  print(10)
n,m=map(int,input().split())
vis,ci,cb,cc=[0]*(n+5),0,0,0
g=[[] for i in range(n+5)]
def dfs(x,col):
	if vis[x]:
		return vis[x]==col
	vis[x],flag=col,True
	for i in g[x]:
		flag&=dfs(i,3-col)
	return flag
for i in range(m):
	u,v=map(int,input().split())
	g[u]+=[v]
	g[v]+=[u]
for i in range(1,n+1):
	if vis[i]==0:
		if len(g[i])==0:
			ci+=1
		else:
			if dfs(i,1):
				cb+=1
			else:
				cc+=1
print(ci*ci+2*ci*(n-ci)+cc*cc+2*cb*cc+2*cb*cb)

### FIXED CODE ###

import queue
n,m=map(int,input().split())
vis,ci,cb,cc=[0]*(n+1),0,0,0
g=[[] for i in range(n+1)]
def dfs(x):
	stk,flag=queue.LifoQueue(),True
	stk.put((x,1))
	while not stk.empty():
		u,col=stk.get()
		if vis[u]:
			flag&=(vis[u]==col)
			continue
		vis[u]=col
		for i in g[u]:
			stk.put((i,3-col))
	return flag
for i in range(m):
	u,v=map(int,input().split())
	g[u]+=[v]
	g[v]+=[u]
for i in range(1,n+1):
	if vis[i]==0:
		if len(g[i])==0:
			ci+=1
		else:
			if dfs(i):
				cb+=1
			else:
				cc+=1
print(ci*ci+2*ci*(n-ci)+cc*cc+2*cb*cc+2*cb*cb)
import sys
import math
A, B = map(int, input().split())
if A == B:
  print (A)
  sys.exit()

def xor(a, b):
  r = ""
  for i in range(len(a)):
    if a[i] == "0" and b[i] == "0" or a[i] == "1" and b[i] == "1":
      r += "0"
    else:
      r += "1"
  return r

S = "0" * 50
def xorn(S, n):
  m = int(math.log2(n))
  b = n - 2 ** m
#  print (S[0:-m-1],1,S[-m-1:-1],m,b)
  S = S[0:-m-1] + "1" + S[-m-1:-1]
  if b == 0:
    return S
  return xorn(S, b)

print (int("0b" + xor(xorn(S, A), xorn(S, B)), 0))

### FIXED CODE ###

import sys
import math
A, B = map(int, input().split())

def nXor(n):
  if n % 2 == 0:
    if (n//2) % 2 == 0:
      return 0 ^ n
    else:
      return 1 ^ n
  else:
    if ((n+1)//2) % 2 == 0:
      return 0
    else:
      return 1
n = 0
for i in range(9):
  n = n^i
print (nXor(A-1) ^ nXor(B))
def d170(n,a):
    count=0
    sa=sorted(list(set(a)))
    if sa[0]==1:
        if 1 in t:
            return 0
        else:
            return 1
    else:
        for i in range(sa) :
            if i>=len(sa):
                break
            else:
                p=sa[i]
                k=[]
                for j in range(i+1,len(sa)):
                     if sa[j]%p==0:
                        k.append(sa[j])
                sa=sorted(list(set(sa)-set(k)))
        return len(set(sa))
    
n=int(input())
a= list(map(int, input().split()))    
print(d170(n,a))
            

### FIXED CODE ###

def d170(n,a):
    k=max(a)+1
    count=0
    dp=[0 for i in range(k)]
    for x in a:
        if dp[x]!=0:
                dp[x]=2
                
        else:
            for j in range(x,k,x):
                     dp[j]+=1
    for x in a:
        if dp[x]==1:
            count+=1
    return count
    
n=int(input())
a=list(map(int, input().split()))    
print(d170(n,a))
import math

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

def acinput():
    return list(map(int, input().split(" ")))


a,b=acinput()

print(lcm(a,b))


### FIXED CODE ###

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

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

def acinput():
    return list(map(int, input().split(" ")))


a,b=acinput()

print(lcm(a,b))
n = int(input())

cnt = 1

for i in range(3):
cnt = cnt * n

print(cnt)

### FIXED CODE ###

n = int(input())

cnt = 1

for i in range(3):
	cnt = cnt * n

print(cnt)
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print a[int(input())-1]

### FIXED CODE ###

a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[int(input())-1])
import numpy as np

N=int(input())
S=input()

W=[0 for i in range(N)] # W[i]=(S[i]より西で西を向いている人の数)
E=[0 for i in range(N)] # E[i]=(S[i]より東で東を向いている人の数)

for i in range(1,N):
    if S[i-1]=='W':
        W[i]=W[i-1]+1
    else:
        W[i]=W[i-1]
for i in reversed(range(N-1)):
    if S[i+1]=='E':
        E[i]=E[i+1]+1
    else:
        E[i]=E[i+1]

print(min([x for x in np.array(W)+np.array(E)]))

### FIXED CODE ###

import numpy as np

N=int(input())
S=input()

W=[0 for i in range(N)] # W[i]=(S[i]より西で西を向いている人の数)
E=[0 for i in range(N)] # E[i]=(S[i]より東で東を向いている人の数)

for i in range(1,N):
    if S[i-1]=='W':
        W[i]=W[i-1]+1
    else:
        W[i]=W[i-1]
for i in reversed(range(N-1)):
    if S[i+1]=='E':
        E[i]=E[i+1]+1
    else:
        E[i]=E[i+1]

print(min([x for x in np.array(W)+np.array(E)]))
x = input()
y = input()
z = input()

### FIXED CODE ###

N = input() 
heights = input()

N = int(N)
heights = list(map(int, heights.split(' ')))

def solve_problem_dp(N, heights):
    if N == 1:
        return 0
    elif N == 2:
        return abs(heights[0] - heights[1])
    costs = [0] * len(heights)
    costs[1] = abs(heights[0] - heights[1])

    for i in range(2, len(heights)):
        cost_jump1 = abs(heights[i] - heights[i-1]) + costs[i-1]
        cost_jump2 = abs(heights[i] - heights[i-2]) + costs[i-2] 
        best_cost = min(cost_jump1, cost_jump2)
        costs[i] = best_cost
    
    return costs[-1]


print(solve_problem_dp(N, heights))
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    L = int(sys.stdin.buffer.readline().rstrip())
    print(L ** 3 / 27)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import os

MOD = 10 ** 9 + 7


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = list(map(int, sys.stdin.buffer.readline().split()))
    even = (N * (N - 1)) // 2
    odd = 0 if M == 1 else (M * (M - 1)) // 2
    print(even + odd)


if __name__ == '__main__':
    main()
import sys
N, M = map(int, sys.stdin.readline().split())
A = sorted(list(map(int, sys.stdin.readline().split())))
B = []
C = []
for _ in range(M):
    b, c = map(int, sys.stdin.readline().split())
    B.append(b)
    C.append(c)

card_list = [0] * (N + sum(B))
card_list[:N] = A
start = N
for i in range(M):
    list = [C[i]] * B[i]
    card_list[start:start + len(list)] = list
    start = start + len(list)
    
sorted_cards = sorted(card_list, reverse=True)
ans = sum(sorted_cards[:N])
print(ans)

### FIXED CODE ###

import sys
N, M = map(int, sys.stdin.readline().split())
A = [[1, i] for i in list(map(int, sys.stdin.readline().split()))]
BC = [list(map(int, sys.stdin.readline().split())) for _ in range(M)]

card_list = A + BC
sorted_cards = sorted(card_list, key=lambda x: x[1], reverse=True)
n = 0
cards_sum = 0
for i in range(N):
    if sorted_cards[i][0] + n <= N:
        cards_sum += sorted_cards[i][1] * sorted_cards[i][0]
        n += sorted_cards[i][0]
    elif n < N and sorted_cards[i][0] + n > N:
        cards_sum += sorted_cards[i][1] * (N - n)
        n = N
        break
    else:
        break

print(cards_sum)
# -*- coding: utf-8 -*-
#ABC070C
import math

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

n = int(input())
#tmp = input().split()
#hoge = list(map(lambda a: int(a), tmp))

t=[]
for i in range(0,n):
	t.append(int(input()))
#print(t)

ans = t[0]
for i in range(1,n):
	ans = lcm(ans,t[i])

print(ans)



### FIXED CODE ###

# -*- coding: utf-8 -*-
#ABC070C
import math

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

n = int(input())

t=[]
for i in range(0,n):
	t.append(0)
for i in range(0,n):
    t[i] = int(input())

ans = t[0]
for i in range(1,n):
	j = gcd(ans,t[i])
	ans *= t[i]
	ans = ans//j

print(ans)
A,B = (int(i) for i in input().split())  
if len(A)>1 | len(B)>1:
  print("-1")
else:
  print(A*B)

### FIXED CODE ###

A,B = (int(i) for i in input().split())  
if (A>9) or (B>9):
    print("-1")
else:
    print(A*B)
n=int(input())
A=list(map(int, input().split()))
box=[0]*n
for i in range(n-1,-1,-1):
    if n//(i+1)<=1 and A[i]==1:
        box[i]=1
    elif n//(i+1)<=1 and A[i]==0:
        pass
    elif n//(i+1)>1:
        if A[i]==sum(box[2*(i+1)-1::(i+1)])%2:
            pass
        elif A[i]!=sum(box[2*(i+1)-1::(i+1)])%2:
            box[i]=1
ans=""
for i in range(n):
    if box[i]==1:
        ans+=str(A[i])+" "
if sum(box)%2==A[0]:
    print(sum(box))
    print(ans)
else: print("-1")

### FIXED CODE ###

r=int(input())
print(3*(r**2))
N = input()
array = list(map(int, input().split()))


for i in range(1, N):
    v = array[i]
    j = i - 1
    while j >= 0 and array[j] > v:
        array[j + 1] = array[j]
        j -= 1
        array[j + 1] = v
    array = list(map(str, array))
    x = " ".join(array)
    print(x)



### FIXED CODE ###

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

y = list(map(str, array))
y = " ".join(y)
print(y)

for i in range(1, N):
    v = array[i]
    j = i - 1
    while j >= 0 and array[j] > v:
        array[j + 1] = array[j]
        j -= 1
        array[j + 1] = v
    x = list(map(str, array))
    x = " ".join(x)
    print(x)
l = input()
dpf = [0] * (len(l) + 2)
dpf[len(l)-1] = 3
mod = 1000000007
for i in range(len(l)-2, -1, -1):
    dpf[i] = (3 * dpf[i+1]) % mod
#print(dpf)
def dfs(i):
    if i == len(l)-1:
        if l[i] == '1':
            return 3
        else:
            return 1
    if l[i] == '0':
        return dfs(i+1)
    return (dpf[i+1] + (dfs(i+1) * 2) % mod) % mod

print(dfs(0))

### FIXED CODE ###

l = input()
dpf = [0] * (len(l) + 2)
dpf[len(l)-1] = 3
mod = 1000000007
for i in range(len(l)-2, -1, -1):
    dpf[i] = (3 * dpf[i+1]) % mod
#print(dpf)
# def dfs(i):
#     if i == len(l)-1:
#         if l[i] == '1':
#             return 3
#         else:
#             return 1
#     if l[i] == '0':
#         return dfs(i+1)
#     return (dpf[i+1] + (dfs(i+1) * 2) % mod) % mod
#
# print(dfs(0))

dp = [0] * (len(l))
dp[-1] = 1
if l[-1] == '1':
    dp[-1] = 3
for i in range(len(l)-2, -1, -1):
    if l[i] == '0':
        dp[i] = dp[i+1]
    else:
        dp[i] = (dpf[i+1] + (dp[i+1]*2)%mod)%mod
print(dp[0])
import numpy as np
N, K, Q = map(int, input().split())
S = []
for _ in range(H):
    S.append(int(input())) 
P=np.array([K]*N)
for i in range(Q):
  a=[-1]*N
  a[S[i]]=0
  P +=a
for i in range(N):
  if P[i] <= 0:
    print("No")
  else:
    print("Yes")

### FIXED CODE ###

import numpy as np
N, K, Q = map(int, input().split())
S = []
for _ in range(Q):
    S.append(int(input())) 
P=[K]*N
for i in range(Q):
  P[S[i]-1]+=1
P = np.array(P)
P -= Q
for i in range(N):
  if P[i] <= 0:
    print("No")
  else:
    print("Yes")
print(n*x) if n<k else print(k*x+(n-k)*y)

### FIXED CODE ###

n = int(input())
k = int(input())
x = int(input())
y = int(input())
print(n*x) if n<k else print(k*x+(n-k)*y)
a = input()
if a < 1200:
    print("ABC")
elif a < 2800:
    print("ARC")
else:
    print("AGC")

### FIXED CODE ###

a = int(input())
if a < 1200:
 print("ABC")
elif a < 2800:
 print("ARC")
else:
 print("AGC")
,# 最大で5文字になりそうなので上位K個を保持しつつ全探索
s = input() + " "
k = int(input())
ans = []
for i in range(len(s)):
    for j in range(i + 1, min(len(s), i + 5 + 1)):
        t = "".join(s[i:j])
        if t not in ans:
            ans.append(t)
            ans = sorted(ans)[:6]
print(ans[k - 1])


### FIXED CODE ###

# 最小かつ最長はzzzzzなので各文字+4まで調べてみるか（27^5-1で全探索もできると思うがやり方がわからん
s = input()
k = int(input())
d = set()
for i in range(len(s)):
    for j in range(1, 6):
        if i + j <= len(s):
            d.add(s[i : i + j])
print(sorted(list(d))[k-1])
N,M = map(int,input().split())
As = list(map(int,input().split()))

for i in range(M):
    index = As.index(max(As))
    As[index] = As[index] // 2

print(sum(As))

### FIXED CODE ###

s = 'Sunny'
c = "Cloudy"
r = "Rainy"

S = input()
if S == s:
    print(c)
elif S == c:
    print(r)
else:
    print(s)
n,a,b=map(int,input().split())
mod = 10**9+7
MAX_N = 10**6

fact = [1]
fact_inv = [0]*(MAX_N+4)
for i in range(MAX_N+3):
    fact.append(fact[-1]*(i+1)%mod)

fact_inv[-1] = pow(fact[-1],mod-2,mod)
for i in range(MAX_N+2,-1,-1):
    fact_inv[i] = fact_inv[i+1]*(i+1)%mod


def mod_comb_k(n,k,mod):
    return fact[n] * fact_inv[k] % mod * fact_inv[n-k] %mod



x=mod_comb_k(n,a,mod)+mod_comb_k(n,b,mod)
y=((pow(2,n)-1)%(10**9+7))
ans=(y-x%(10**9+7))
while ans<0:
          ans+=10**9+7
print(ans)





### FIXED CODE ###

n,a,b=map(int,input().split())
def comb(n,k):
    nCk = 1
    MOD = 10**9+7

    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

x=pow(2,n,10**9+7)-1
y=comb(n,a)+comb(n,b)
ans=x-y





while ans<0:
          ans+=10**9+7
print(ans)
import sys

d_num = int(sys.stdin.readline().strip())

graph_list = []

for _ in range(0, d_num):
    array = sys.stdin.readline().strip().split(" ")
    if len(array) > 2:
        graph_list.append([])
    else:
        graph_list.append([int(array[i]) for i in range(2, len(array))])

t = 1
result = [[] for _ in range(0, d_num)]
searched_list = []
stack = []

stack.append(0)
while sorted(searched_list) != range(0, d_num):
    if len(stack) == 0:
        stack.append(filter(lambda x: x not in searched_list, range(0, d_num))[0])
    node = stack[-1]
    searched_list.append(node)
    children = filter(lambda x: x not in searched_list, graph_list[node])
    if len(child) == 0:
        next_node = children[0]
        result[next_node].append(t)
    else:
        stack.pop()
        result[node].append(t)
    t += 1

s = ""

for i in range(0, len(result)):
    print str(i+1) + " " + str(result[i][0] + 1) + " " + str(result[i][1] + 1)
    

### FIXED CODE ###

import sys

d_num = int(sys.stdin.readline().strip())

graph_list = []

for _ in range(0, d_num):
    array = sys.stdin.readline().strip().split(" ")
    if len(array) <= 2:
        graph_list.append([])
    else:
        graph_list.append([int(array[i]) - 1 for i in range(2, len(array))])

t = 1
result = [[] for _ in range(0, d_num)]
searched_list = []
stack = []

while True:
    if len(stack) == 0:
        ll = filter(lambda x: x not in searched_list, range(0, d_num))
        if len(ll) == 0:
            break
        stack.append(ll[0])
        result[ll[0]].append(t)
        searched_list.append(ll[0])
    else:
        node = stack[-1]
        children = filter(lambda x: x not in searched_list, graph_list[node])
        if len(children) != 0:
            next_node = children[0]
            stack.append(next_node)
            result[next_node].append(t)
            searched_list.append(next_node)
        else:
            stack.pop()
            result[node].append(t)
    t += 1

s = ""

for i in range(0, len(result)):
    print str(i+1) + " " + str(result[i][0]) + " " + str(result[i][1])
import collections
n = int(input())
s = []
for _ in range(n):
    s.append(input())
m = int(input())
t = []
for _ in range(m):
    t.append(input())
s_ = collections.Counter(s)
t_ = collections.Counter(t)
a = []
for key in s_.keys():
    num = s_[key] - t_[key]
    a.append(num)
print(max(a, 0))

### FIXED CODE ###

import collections
n = int(input())
s = []
for _ in range(n):
    s.append(input())
m = int(input())
t = []
for _ in range(m):
    t.append(input())
s_ = collections.Counter(s)
t_ = collections.Counter(t)
a = []
for key in s_.keys():
    num = s_[key] - t_[key]
    a.append(num)
print(max(max(a),0))