Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def solve(string):
    string = string.split("\n")
    n, m = map(int, string[0].split())
    ans = set([i + 1 for i in range(m)])
    for loves in string[1:]:
        ans &= set(map(int, loves.split()[1:]))
    return str(len(ans))


if __name__ == '__main__':
    base = input()
    n, m = map(int, base)
    tmp = [base]
    for _ in range(n):
        tmp.append(input())
    print(solve('\n'.join(tmp)))


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def solve(string):
    string = string.split("\n")
    n, m = map(int, string[0].split())
    ans = {i + 1 for i in range(m)}
    for loves in string[1:]:
        ans &= set(map(int, loves.split()[1:]))
    return str(len(ans))


if __name__ == '__main__':
    base = input()
    n, m = map(int, base.split())
    tmp = [base]
    for _ in range(n):
        tmp.append(input())
    print(solve('\n'.join(tmp)))
def f(N,h,n):
    return 4/N - 1/h - 1/n

N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        tmp = f(N, h, n)
        if tmp > 0:
            w = 1/tmp
            if w.is_integer():
                ans = [h,n,int(w)]
                break
print(*ans)

### FIXED CODE ###

N = int(input())
for h in range(1, 3501):
    for n in range(1, 3501):
        div = 4*h*n - N*(h+n)
        if div!=0 and N*h*n%div==0:
            w = N*h*n // div
            if w > 0:
                print(h,n,w)
                exit()
import fraction  # python3.5以降ではmath


def seekGcd(A, n):
    ans = A[0]
    for i in range(1, n):
        ans = fraction.gcd(ans, A[i])  # python3.5以降ではmath.gcd
    ans_list.append(ans)


n = int(input())
A = list(map(int, input().split()))
ans_list = []

for i in range(n):
    p = A.pop(0)
    seekGcd(A, n-1)
    A.append(p)

print(max(ans_list))


### FIXED CODE ###

import fractions

n = int(input())
A = list(map(int, input().split()))
n = len(A)

L = [0]
R = [0]
ans_list = []

for i in range(n-1):
    L.append(fractions.gcd(L[i], A[i]))
    R.append(fractions.gcd(R[i], A[n-1-i]))

for j in range(n):
    ans_list.append(fractions.gcd(L[j], R[-j-1]))

print(max(ans_list))
n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

def function():
    x = int(map_list[-1][0])
    y = int(map_list[-1][1])
    h = int(map_list[-1][2])

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(x - i) + abs(y - j) + h
            
            for k in range(n):
                x = int(map_list[k][0])
                y = int(map_list[k][1])
                h = int(map_list[k][2])

                if h != max(H - abs(x - i) - abs(y - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H

i, j, H = function()
print(i, j, H)

### FIXED CODE ###

n = int(input())
map_list = []
for _ in range(n):
    map_list.append(input().split())

def function():
    for i in range(101):
        if int(map_list[i][2]) > 0:
            x = int(map_list[i][0])
            y = int(map_list[i][1])
            h = int(map_list[i][2])
            break
        else:
            continue

    for i in range(101):
        for j in range(101):
            cont_check = True
            H = abs(x - i) + abs(y - j) + h
            
            for data in map_list:
                xx, yy, hh = map(int, data)
                if hh != max(H - abs(xx - i) - abs(yy - j), 0):
                    cont_check = False
                    break
            if cont_check:
                return i, j, H

i, j, H = function()
print(i, j, H)
import math
A, B = map(int,input().split())
def yakusuu(N):
    P = set([1,N])
    for k in range(2,math.floor(math.sqrt(N))+1):
        if N % k == 0:
            P.add(k)
            P.add(N//k)
    return P
C = sorted(list(yakusuu(A)&yakusuu(B)))
N = len(C)
if N == 1:
    print(1)
else:
    ans = 0
    for k in range(N):
        f = 1
        for l in range(k-1):
            if math.gcd(C[k],C[l]) != 1:
                f = 0
                break
        ans += f
    print(ans)


### FIXED CODE ###

import sys,math

def input():
    return sys.stdin.readline()[:-1]
def yakusuu(N):
    P = [1,N]
    for k in range(2,math.floor(math.sqrt(N))+1):
        if N % k == 0:
            P.append(k)
            P.append(N//k)
    return P
def gcd(a,b):
    if b == 0:
        return a
    return gcd(b,a%b)

def main():
    A, B = map(int,input().split())
    C = sorted(list(set(yakusuu(A))&set(yakusuu(B))))

    if len(C) == 1:
        print(1)
        exit(0)
    D = [1]
    for k in range(1,len(C)):
        f = 1
        for l in range(k):
            if gcd(C[k],C[l]) != 1:
                f = 0
                break
        if f == 1:
            D.append(C[k])
    print(len(D))


if __name__ == '__main__':
    main()
n, q = map(int, input().split())
s=input()
for i in range(n):
  l[i],r[i] = map(int, input().split())
  t[i]=s[l[i]:r[i+1]].count("AC")
  print(t(i))

### FIXED CODE ###

n, q = map(int, input().split())
s=input()
d=[0]*n
c=0
for i in range(n-1):
  if s[i:i+2]=="AC":
    c+=1
  d[i+1]=c
for i in range(q):
  l,r= map(int, input().split())
  print(d[r-1]-d[l-1])
N = int(input())
X = list(map(int, input().split()))

_sum = sum(X)
buff_x = X.copy()


X.sort()
mm = X[N//2-1]
mx = X[N//2]
for i in range(N):
    if buff_x[i] < mx:
        print(mx)
    else:
        print(mm)

### FIXED CODE ###

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

# _sum = sum(X)
buff_x = X.copy()


X.sort()
mm = X[N//2-1]
mx = X[N//2]
for i in range(N):
    if buff_x[i] < mx:
        print(mx)
    else:
        print(mm)
import sys
sys.setrecursionlimit(200000)
n=int(input())
t=[int(i) for i in sys.stdin]
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
n=int(input())
t=[int(i) for i in sys.stdin]
if n==1:
  print(t[0])
  exit()
def gcd(x,y):
  if y==0:
    return x
  return gcd(y,x%y)
x=t[0]
for i in range(1,n):
  y=x*t[i]//gcd(x,t[i])
  x=y
print(y)
n,m = map(int,input().split())

c = []
for i in range(m):
    c.append(list(map(int,input().split())))

max = 0
for i in range(m):
    if c[i][0] >= max:
        max = c[i][0]

ans = -1
for i in range(pow(10,max-1),pow(10,n)):
    tmp = 0
    for j in range(m):
        if str(i)[c[j][0]-1] == str(c[j][1]):
            tmp += 1
    if tmp == m:
         ans = i

print(ans)  

### FIXED CODE ###

n,m = map(int,input().split())
 
c = []
for i in range(m):
    c.append(list(map(int,input().split())))
 

ans = -1
if n == 1 and m == 0:
    ans = 0
elif m == 0 and n != 1:
    ans = pow(10,n-1)
elif n == 1:
    tmp = 0
    for i in range(m):
        if c[i][1] == c[0][1]:
            tmp += 1
        if tmp == m:
            ans = c[0][1]
            break
else:            
 for i in range(pow(10,n-1),pow(10,n)):
    tmp = 0
    for j in range(m):
        if str(i)[c[j][0]-1] == str(c[j][1]):
            tmp += 1
    if tmp == m:
         ans = i
         break
print(ans)
a = int(input())
b = map(int, input().split())

cnt = 0
endflag = False

while(True):
  for i in range(0,len(b)-1):
    if ((b[i] % 2 ) == 0):
      b[i] = b[i] /2
    else:
      endflag = true
  cnt = cnt +1  
  if (endflag):
    break
      
print(cnt)


### FIXED CODE ###

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

cnt = 0
endflag = False

while(True):
  for i in range(0,a):
    if ((b[i] %2 ) == 0):
      b[i] = b[i] / 2
    else:
      endflag = True
      break
  if (endflag):
    break
  cnt = cnt + 1

print(cnt)
n = int( input() )
A = list( int, input().split() )

ret = 1
for a in A:
  ret *= a
  if a == 0:
    ret = 0
    break
  if a > 10 ** 18:
    ret = -1
    break
print( ret )

### FIXED CODE ###

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

if 0 in A:
  print( 0 )
else:
  ret = 1
  for a in A:
    ret = ret * a
    if ret > 10 ** 18:
      ret = -1
      break
  print( ret )
L,R=map(int,input().split())
list=[]
if (R-L)>=2018:
  print(0)
else:
  for i in range(L,R):
    for j in range(i+1,R+1):
      s=i*j
      m=s%2019
      list.append(m)
print(min(list))
  

### FIXED CODE ###

L,R=map(int,input().split())
if (R-L)>=2018:
  print(0)
else:
  ans=2019
  for i in range(L,R):
    for j in range(i+1,R+1):
      ans=min(ans,(i*j)%2019)
  print(ans)
n = int(raw_input())
taro=hana=0
for i in xrange(n):
	x,y=map(str,raw_input().split())
	if x == y:
		taro += 1
		hana += 1
	elif x < y:
		hana += 3
	else
		taro += 3
print "%d %d\n" % (taro,hana)

### FIXED CODE ###

n = int(raw_input())
taro=hana=0
for i in xrange(n):
	x,y=map(str,raw_input().split())
	if x == y:
		taro += 1
		hana += 1
	elif x < y:
		hana += 3
	else:
		taro += 3
print "%d %d" % (taro,hana)
8
5 7 4 2 6 8 1 3

### FIXED CODE ###

m = input()
arr = input().split()
cnt = 0
flg = 1
mnn = arr[0]
for n in arr:
  if(int(n)>int(mnn)):
    continue
  else:
    mnn = n
    cnt = cnt + 1
print(cnt)
S, W = input().split()
if int(S) =< int(W):
  print("safe")
else:
  print("unsafe")

### FIXED CODE ###

S, W = input().split()
if int(S) <= int(W):
  print("unsafe")
else:
  print("safe")
N = input()
 
if N == 1:
  print('Hello World')
else:
  A = int(input())
  B = int(input())
  print(A + B)

### FIXED CODE ###

N = int(input())
 
if N == 1:
  print('Hello World')
else:
  A = int(input())
  B = int(input())
  print(A + B)
n, k =map(int,input().split())
# x1、x2と複数入力
x = list(input().split()) for i in range(n)
x.sort()
print(sum(list[0:k]))

### FIXED CODE ###

n, k =map(int,input().split())
# x1、x2と複数入力
x = list(map(int,input().split()))
x.sort()
print(sum(x[0:k]))
n,x=map(int, input().split())
l=list(map(int,input().split()))
cnt=0
zahyou=0
while zahyou<=x:
  zahyou+=l[cnt]
  cnt+=1
print(cnt)

### FIXED CODE ###

n,x=map(int, input().split())
l=list(map(int, input().split()))
cnt=0
ans=1
for i in range(n):
  if cnt+l[i]<=x:
    ans+=1
    cnt+=l[i]
  else:
    break
print(ans)
A,B,C,D=map(int,input().split())
while True:
    C-=B
    if c<=0:
        print("Yes")
        break
    A-=D
    if a<=0:
        print("No")
        break

### FIXED CODE ###

A,B,C,D=map(int,input().split())
while True:
    C-=B
    if C<=0:
        print("Yes")
        break
    A-=D
    if A<=0:
        print("No")
        break
n, k = map(int, input().split())
s = input().rstrip()
m = 0
cur_s = cur_e = 0

while True:
  while s[cur_e] == '1':
    cur_e++
  
  if k <= 0 or cur_e >= n:
    wm = cur_e - cur_s
    if wm < m:
      m = wm
      
    if cur_e >= n:
      break
 
    while s[cur_s] == '1':
      cur_s++
    while s[cur_s] == '0':
      cur_s++
    k++

  if k > 0:
    while s[cur_e] = '0':
      cur_e++
    k--
    
print(m)


### FIXED CODE ###

n, k = map(int, input().split())
s = input().rstrip()


#n, k = 5, 3
#s = "00010"

m = 0
cur_s = cur_e = 0

while True:
  while cur_e < n and s[cur_e] == '1':
    cur_e+=1
  
  if k <= 0 or cur_e >= n:
    wm = cur_e - cur_s
    if wm > m:
      m = wm
      
    if cur_e >= n:
      break
 
    while cur_s < n and s[cur_s] == '1':
      cur_s+=1
    while cur_s < n and s[cur_s] == '0':
      cur_s+=1
    k+=1

  if k > 0:
    while cur_e < n and s[cur_e] == '0':
      cur_e+=1
    k-=1
    
print(m)
n, m = map(int, input().split())
h = list(map(int, input().split()))
edges = [[] for i in range(m+1)]
for i in range(m):
    a, b = map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
#print(edges)
check = [[0]*n for _ in range(n)]
count = 0
for i in range(n):
    for node in edges[i]:
        if h[i] > h[node]:
            continue
        else:
            break
    else:
        count += 1
print(count)

### FIXED CODE ###

from collections import deque
n, m = map(int, input().split())
h = list(map(int, input().split()))
edges = [[] for i in range(n+1)]
for i in range(m):
    a, b = map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
check = [0]*n
q = deque()
for i in range(n):
    q.append(i)
ans = 0
while q:
    node = q.pop()
    if check[node] != 0:
        continue
    else:
        check[node] = 1
        count = 0
        for v in edges[node]:
            q.append(v)
            if h[node] > h[v]:
                check[v] = 1
                count += 1
            elif h[node] == h[v]:
                check[v] = 1
        if count == len(edges[node]):
            ans += 1
print(ans)
while True:
    (n, s) = [int(i) for i in raw_input().split()]
    if((0,0) == (n,s)):
        break
    r = xrange(10**(n-1),10**n)
    r = map(str,r)
    r = filter(lambda x:len(set(x)) == len(x),r)
    r = map(lambda x:map(int,x),r)
    r = filter(lambda x:reduce(lambda x,y:x+y,x) == s, r)
    print len(r)

### FIXED CODE ###

def dfs(n, sum ,depth):
    if(depth == 0):
        return int(sum == s)
    else:
        count = 0
        for i in xrange(n+1,10):
            count += dfs(i, sum+i, depth-1)
        return count

while True:
    (n, s) = [int(i) for i in raw_input().split()]
    if((0,0) == (n,s)):
        break
    print dfs(-1,0,n)
N=int(input())
if N%2==0:
  prnit(N)
else:
  print(2*N)

### FIXED CODE ###

N=int(input())
if N%2==0:
  print(N)
else:
  print(2*N)
from math import inf

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

dp = [inf] * n
dp[0] = 0

for i in range(1, n):
    for j in range(i - 1, max(0, i - k) - 1, -1):
        dp[i] = min(dp[j] + abs(hs[i] - hs[j]), dp[i])
    # dp[i] = min(
    #     dp[i-1] + abs(hs[i] - hs[i-1]),
    #     dp[i-2] + abs(hs[i] - hs[i-2]),
    # )

print(dp[-1])

### FIXED CODE ###

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

inf = 10**20
dp = [inf] * n
dp[0] = 0

for i in range(1, n):
    for j in range(i - 1, max(0, i - k) - 1, -1):
        dp[i] = min(dp[j] + abs(hs[i] - hs[j]), dp[i])

print(dp[-1])
S=input()
N=len(S)
if N<5:
  print(0)
  exit()
A={}
for i in range(N-4+1):
  a=int(S[i:])%2019
  A.setdefault(a,0)
  A[a]+=1

ans=0
import math
def comb(n,r):
  return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))
for i in A.values():
  if i>1:
    ans+=comb(i,2)
ans+=A[0]
print(ans)
  

### FIXED CODE ###

s=input()
n=0
ans=0
A=[0]*2019
A[0]=1
for i,j in enumerate(reversed(s)):
  n=(n+int(j)*pow(10,i,2019))%2019
  #print(i,n)
  A[n]+=1
for i in A:
  ans+=i*(i-1)//2
print(ans)
from sys import stdin
n = int(stdin.readline())
a = map(int,stdin.readline().split(' '))

res, l, r = 0, 0, 0
while r < n:
  l = r
  while r+1 < n and a[r+1] == a[l]:
    r += 1
  res += (r - l + 1) / 2
  r += 1
print res

### FIXED CODE ###

from sys import stdin
n = int(stdin.readline())
a = map(int,stdin.readline().split(' '))

res, l, r = 0, 0, 0
while r < n:
  l = r
  while r+1 < n and a[r+1] == a[l]:
    r += 1
  res += (r - l + 1) / 2
  r += 1
print res
H, W = map(int, input().split())
s = [list(input()) i in range(H)]
dh = [-1, 0, 0, 1]
dw = [0, -1, 1, 0]

for h in range(H):
  for w in range(W):
    # Don't check white cell
    if s[h][w] == '.':
      continue
    # check neighbor cell
    for k in range(4):
      nh = h + dh
      nw = w + dw
      if nh < 0 or nw < 0 or H <= nh or W <= nw:
        continue
      # neighbor black is found => ok
      if s[nh][nw] == '#':
        break
    # There is independ black => failed
    else:
      print('No')
      break
  # ok
  else:
    continue
  # failed
  break
# ok
else:
  print('Yes')
    

### FIXED CODE ###

H, W = map(int, input().split())
s = [list(input()) for i in range(H)]
dh = [-1, 0, 0, 1]
dw = [0, -1, 1, 0]
cnt = 0

for h in range(H):
  for w in range(W):
    # Check only black cell
    if s[h][w] == '.':
      continue
    for k in range(4):
      nh = h + dh[k]
      nw = w + dw[k]
      if nh < 0 or nw < 0 or H <= nh or W <= nw:
        continue
      # ok
      if s[nh][nw] == '#':
        break
    # failed
    else:
      cnt += 1

if cnt == 0:
  print('Yes')
else:
  print('No')
K = int(input())

if K%2==0:
	print((K/2)*(K/2))
else:
	print((k-1)*(k-1)/4)

### FIXED CODE ###

K = int(input())

if K%2==0:
	print(round((K/2)*(K/2)))
else:
	print(round((K-1)*(K+1)/4))
# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest051-B
#  https://atcoder.jp/contests/abc051/tasks/abc051_b
def  queueAnswer(maxValue,sumNumber):
	counter = 0
	for x in range(0,maxValue+1,1):
		for y in range(0,maxValue+1,1):
			for z in range(0,maxValue+1,1):
				thisSum = x+y+z
				if  thisSum=sumNumber:
					counter = counter + 1
	answer = counter
	return answer


if __name__ == '__main__':
	k,s = map(int,input().strip().split(' '))
	solution=queueAnswer(k,s)
	print(solution)

### FIXED CODE ###

# _*_ coding:utf-8 _*_
#  Atcoder_Beginners_Contest051-B
#  https://atcoder.jp/contests/abc051/tasks/abc051_b
from itertools import product
def  queueAnswer(maxValue,sumNumber):
	baseList = list(range(0,maxValue+1,1))
	xyPool = product(baseList,baseList)
	counter = 0
	for x,y in xyPool:
		z = sumNumber - x - y
		if ( 0 <= z ) and ( z <= maxValue):
			counter = counter + 1

	answer = counter
	return answer


if __name__ == '__main__':
	k,s = map(int,input().strip().split(' '))
	solution=queueAnswer(k,s)
	print(solution)
X, Y, A, B, C = map(int, input().split())
Alist = list(map(int, input().split()))
Blist = list(map(int, input().split()))
cl = list(map(int, input().split()))

Alist.sort(reverse = True)
Blist.sort(reverse = True)
cl.sort(reverse = True)
list=[]

for i in range(X):
    list.append(Alist[i])
for i in range(Y):
    list.append(Blist[i])
list.sort()

k = min (A + B, C)

for i in range(k):
    if cl[0] > list[i]:
        list[i] = cl[0]
        cl.pop(0)
ans = 0
for i in list:
    ans += i

print(ans)

### FIXED CODE ###

X, Y, A, B, C = map(int, input().split())
Alist = list(map(int, input().split()))
Blist = list(map(int, input().split()))
list = list(map(int, input().split()))

Alist.sort(reverse = True)
Blist.sort(reverse = True)

for i in range(X):
    list.append(Alist[i])
for i in range(Y):
    list.append(Blist[i])
list.sort(reverse = True)

ans =0
for i in range(X + Y):
    ans += list[i]
    
print(ans)
s = (input()
l = list(s)
flag = 0
for i in range(0,len(l)-1):
	if l[i+1]==l[i]:
    	flag=1
		break
if flag==1:
	print('Bad')
else:
	print('Good')

### FIXED CODE ###

s = input()
l = list(s)
flag = 0
for i in range(0,len(l)-1):
	if l[i+1]==l[i]:
		flag=1
		break
if flag==1:
	print('Bad')
else:
	print('Good')
def solution(arr):
  count = 0
  for i, val in enumerate(arr):
    if i > 0 and arr[i - 1] == val:
      count += 1
    else:
      count = 0
    if count == 2:
      return 'Yes'
  return 'No'
n = int(input())
arr = []
for _ in range(n):
  arr.append(input())
print(solution(arr)

### FIXED CODE ###

def solution(arr):
  count = 0
  for i, j in arr:
    if i == j:
      count += 1
    else:
      count = 0
    if count == 3:
      return 'Yes'
  return 'No'
n = int(input())
arr = []
for _ in range(n):
  arr.append([ int(i) for i in input().split()])
print(solution(arr))
from math import gcd
from math import reduce
from fractions import gcd
from functools import reduce
def Gcd(list):
    gcd = 1
    G = reduce(gcd, list)
    return G

A = [2,6,8]
print(Gcd(A))


### FIXED CODE ###

#####################
#複数の最小公倍数lcm
#####################
from fractions import gcd
def Lcm(list):
  L = 1
  for a in list:
    L = (a // gcd(a, L))*L
  return L
n= int(input())
A = [int(input()) for i in range(n)]
print(Lcm(A))
n = int(input())
a = []
max_num = -1
for i range(n):
    ipt = int(input())
    if ipt > max_num:
        max_num = max(ipt, max_num)
        idx = i
    a.append(ipt)
a = sorted(a)
if a[-1] == a[-2]:
    for i in range(n):
        print(max_num)
else:
    for i in range(n):
        if i == idx:
            print(a[-2])
        else:
            print(max_num)

### FIXED CODE ###

n = int(input())
a = []
max_num = -1
for i in range(n):
    ipt = int(input())
    if ipt > max_num:
        max_num = max(ipt, max_num)
        idx = i
    a.append(ipt)
a = sorted(a)
if a[-1] == a[-2]:
    for i in range(n):
        print(max_num)
else:
    for i in range(n):
        if i == idx:
            print(a[-2])
        else:
            print(max_num)
n=int(input())
p=list(map(int,input().split()))
li=[]
for i in range(1,n):
    q=p.count(i)
    li.append(q)
nl=li.split("\n")
print(nl)

### FIXED CODE ###

n=int(input())
p=list(map(int,input().split()))
m=[0]*n
for i in p:
    m[i-1]+=1
for a in m:
    print(a,"\n")
s = input()
K = int(input())

ct = 0
alp = 'abcdefghijklmnopqrstuvwxyz'
for i in alp:
    ct += s.count(i)
    if ct >= K:
        key = i
        break

list_rank = []
for i in range(len(s)):
    if s[i] > key:
        continue
    if i < len(s) - K + 1:
        for j in range(K):
            if s[i:i+j+1] not in list_rank:
                list_rank.append(s[i:i+j+1])
    else:
        for j in range(len(s)-i):
            if s[i:i+j+1] not in list_rank:
                list_rank.append(s[i:i+j+1])

list_rank.sort()
print(list_rank[K-1])


### FIXED CODE ###

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

ct = 0
alp = 'abcdefghijklmnopqrstuvwxyz'
for i in alp:
    ct += s.count(i)
    if ct >= K:
        break

key = i

list_rank = []
for i in range(len(s)):
    if s[i] > key:
        continue
    if i < len(s) - K + 1:
        for j in range(K):
            if s[i:i+j+1] not in list_rank:
                list_rank.append(s[i:i+j+1])
    else:
        for j in range(len(s)-i):
            if s[i:i+j+1] not in list_rank:
                list_rank.append(s[i:i+j+1])

list_rank.sort()
print(list_rank[K-1])
X,t = map(int,input().split())
if (x >= t):
  print(x-t)
else:
  print(0)

### FIXED CODE ###

x,t = map(int,input().split())
if (x >= t):
  print(x-t)
else:
  print(0)
S=input()
if S[0] == S[1] and S[2] == S[3] and S[0] != S[2]:
    print(Yes)
elif S[0] == S[2] and S[1] == S[3] and S[0] != S[1]:
    print(Yes)
elif S[0] == S[3] and S[1] == S[2] and S[0] != S[1]:
    print(Yes)
else:
    print(No)

### FIXED CODE ###

S=input()
if S[0] == S[1] and S[2] == S[3] and S[0] != S[2]:
    print('Yes')
elif S[0] == S[2] and S[1] == S[3] and S[0] != S[1]:
    print('Yes')
elif S[0] == S[3] and S[1] == S[2] and S[0] != S[1]:
    print('Yes')
else:
    print('No')
N=int(input())
if N%2==0:
  print('{:.06}'.format(N//2))
else:
  print('{:.06}'.format(N//2+1))

### FIXED CODE ###

N=int(input())
if N%2==0:
  print('{:.010f}'.format((N//2)/N))
else:
  print('{:.010f}'.format((N//2+1)/N))
import numpy as np
def num_match(n):
    if n==1:
        return 2
    elif n==2 or n==3 or n==5:
        return 5
    elif n==4:
        return 4
    elif n==6:
        return 6
    elif n==7:
        return 3
    elif n==8:
        return 7
    elif n==9:
        return 6
N,M = map(int, input().split())
A = list(map(int,input().split()))
match = np.array([[a,num_match(a)] for a in A])
sorted_num = match[np.argsort(match[:,0])[::-1]]
sorted_match = match[np.argsort(match[:,1])]
min_num_match = sorted_match[0][1]
max_k = int(N/min_num_match)#一番小さいマッチ数の整数を使える数
rem = N%min_num_match + min_num_match
#rem+match[min_match_index][1]*kがmin以外の組み合わせの合計
ans_exist = False
ans = 0
used_match = []
for k in range(max_k):#remを更新していく？
    if rem in sorted_match[:,1]:
        ans_exist = True
        used_match.append(rem)
        break
    else:
        for n in sorted_match[:,1]:
            if n < rem and n!=min_num_match :
                used_match.append(n)
                rem = rem-n
                break
    if ans_exist:
        #max_k = max_k-k
        break
    else:
        rem = rem + min_num_match
used_match.append(min_num_match)
used_num = []
for um in used_match:
    for i in range(sorted_num.shape[0]):
        if um == sorted_num[i][1]:
            used_num.append(sorted_num[i][0])
            break
base_num=used_num.pop()
sorted_used_num = sorted(used_num,reverse=True)
upper  =[]
lower = []
for s in sorted_used_num:
    if s > base_num:
        upper.append(s)
    else:
        lower.append(s)
lower = sorted(lower)
ans_list = [base_num]*max_k
if len(upper) > 0:
    for i in range(len(upper)):
        ans_list[i] = upper[i]
if len(lower) > 0:
    for j in range(len(lower)):
        ans_list[len(ans_list)-1-j] = lower[j]
ans = ""
for a in ans_list:
    ans = ans + str(a)
ans = int(ans)
print(ans)

### FIXED CODE ###

A,B = map(int, input().split())
ans = 0
if B%A == 0:
    ans = A+B
else:
    ans = B-A
print(ans)