Harryxun/stf_run huggingface dataset:
H,N = map(int,input().split())
a = 0
for i in range(N):
        c = int(input())
        a+=c
if a>=H:
        print("Yes")
else:
        print("No")


### FIXED CODE ###

H,N = map(int,input().split())
A = list(map(int,input().split()))
a = 0
for i in A:
        a+=i
if a>=H:
        print("Yes")
else:
        print("No")
def solve():
    a = raw_input()
    n = len(a)
    cost = [[0 for i in range(n)] for j in range(n)]
 
    for length in range(2, n+1):
        for i in range(0, n-length+1):
            k = i+length-1
            def f(i,j,k):
                return cost[i][j-1]+cost[j][k]+M[i][0]*M[j-1][1]*M[k][1]
            cost[i][k] = min([f(i,j,k) for j in range(i+1,k+1)])
    return cost[0][n-1]
 
n = input()
M = []
for i in range(n):
    M.append(map(int, raw_input().split()))
     
print solve(M)

### FIXED CODE ###

def solve(a):
 n = len(a)
 cost = [[0 for i in range(n)] for j in range(n)]
 for length in range(2, n+1):
  for i in range(0, n-length+1):
   k = i+length-1
   def f(i,j,k):
    return cost[i][j-1]+cost[j][k]+M[i][0]*M[j-1][1]*M[k][1]
   cost[i][k] = min([f(i,j,k) for j in range(i+1,k+1)])
 return cost[0][n-1]
n = input()
M = []
for i in range(n):
 M.append(map(int, raw_input().split()))
print solve(M)
#!/usr/bin/env python

n, m = input().split(" ")
n = int(n)
m = int(m)
s_len = []
c_len = []
dig = 10**(n-1)

for i in range(m):
    tmp = input().split(" ")
    s_len.append(int(tmp[0]))
    c_len.append(int(tmp[1]))

c_t = 0
for i in c_len:
    c_t += int(i)

for i in range(dig-1, dig*10):
    flag = False
    for j,s in enumerate(s_len):
        if str(i)[s-1] != str(c_len[j]) and flag == False:
            flag = True
            break
    if flag==False:
        print(i)
        exit()

print("-1")

### FIXED CODE ###

#!/usr/bin/env python

import math

n = int(input())
print(math.ceil(n/2))
s=input()

flag=True
KIHBR="KIHBR"
s_new=s.replace("A", "")
cnt=0
for i in range(len(s_new)):
    if s_new[i]!=KIHBR[cnt]:
        flag=False
        break
    cnt+=1

if s.count("AA")>1:
    flag=False

print("YES" if flag else "NO")


### FIXED CODE ###

s=input()
AKB={"AKIHABARA","KIHABARA","AKIHBARA","KIHBARA","AKIHABRA","KIHABRA","AKIHBRA","KIHBRA","AKIHABAR","KIHABAR","AKIHBAR","KIHBAR","AKIHABR","KIHABR","AKIHBR","KIHBR"}

print("YES" if s in AKB else "NO")
from collections import defaultdict

n, m = [int(i) for i in raw_input().split()]

parents = {}

for _ in xrange(m):
    u, v = [int(x) for x in raw_input().split()]
    if v-1 in parents:
        parents[v-1].append(u-1)
    else:
        parents[v-1] = [u-1]

def calc_c(parents, f, i):
    if f[i] != -1:
        return f[i]

    f[i] = 0
    if i in parents:
        for v in parents[i]:
            f[i] = max(f[i], calc_c(parents, f, v)+1)

    return f[i]

f = [-1] * n
for i in xrange(n):
    calc_c(parents, f, i)

print max(f)

### FIXED CODE ###

from collections import defaultdict
import sys
sys.setrecursionlimit(1000000)

n, m = [int(i) for i in raw_input().split()]
parents = defaultdict(list)

i = 0
while i < m:
    u, v = [int(x) for x in raw_input().split()]
    parents[v-1].append(u-1)
    i += 1

def calc_f(parents, f, i):
    if i < 0 or i >= len(f):
        return 0

    if f[i] != -1:
        return f[i]

    f[i] = 0
    for v in parents[i]:
        f[i] = max(f[i], calc_f(parents, f, v)+1)

    return f[i]

f = [-1] * n
j = 0
while j < n:
    calc_f(parents, f, j)
    j += 1

if len(f) == 0:
    print 0
else:
    print max(f)
a, b, c = map(int, input().split())
print('Yes' if a+b>=c, else 'No')

### FIXED CODE ###

a, b, c = map(int, input().split())
print('Yes' if a+b>=c else 'No')
import sys

y = sys.stdin.readline()
y = int(y)

x = sys.stdin.readline()

x_list = int(x.split(" "))

for i in range(1, y):
  if list(i) < list(i - 1):
    for j range(i - 1, -1):
      if list(j) < list(i):
        list(i),  list(j+1) = list(j+1), list(i)
        break
  for k in range(0, y):
    print list(k)

### FIXED CODE ###

import sys

def insertionSort(x_list,y):
  for i in range(1, y):
    v = x_list[i]
    j = i - 1
    while j >= 0 and x_list[j] > v:
      x_list[j + 1] = x_list[j]
      j -= 1
    x_list[j+1] = v
    for k in range(0, y):
      print x_list[k],
    print

y = sys.stdin.readline()
y = int(y)

x = sys.stdin.readline()

x_list = x.split(" ")

for i in range(y):
  x_list[i] = int(x_list[i])

for k in range(0, y):
  print x_list[k],
print

insertionSort(x_list, y)
a, b = int(input().split())
 
if a > b * 2:
  ret = a - b * 2
else:
  ret = 0
  
print(ret)

### FIXED CODE ###

x = input().split()
 
a = int(x[0])
b = int(x[1])
 
if a > b * 2:
  ret = a - b * 2
else:
  ret = 0
  
print(ret)
while(True):
    h, w = map(int, input().split())
    if(h == 0 and w == 0):
        break
    for i in range(h):
        s = ''
        for j in range(w):
            s += '#' if ((i + j) % 2 == 0) else s += '.'
        print(s)
    print()



### FIXED CODE ###

while(True):
    h, w = map(int, input().split())
    if(h == 0 and w == 0):
        break
    for i in range(h):
        s = ''
        for j in range(w):
            if (i + j) % 2 == 0:
                s += '#'
            else:
                s += '.'
        print(s)
    print()
def main():
    N, C, K = map(int, input().split())
    T = [int(input()) for _ in range(N)]
    ans = 0
    i = 0
    j = 0
    T.sort()

    while True:
        if T[j] + K >= T[i+1]:
            i = i + 1
            if i == N-1:
                ans += 1
                return (ans)
            for h in range(C-2):
                if T[j] + K >= T[i+1]:
                    if h == C-3:
                        ans += 1
                        i += 2
                        j = i
                        if j >= N-1:
                            return(ans)
                        break
                    else:
                        i += 1
                        continue
                elif T[j] + K < T[i + 1]:
                    j = i + 1
                    i = i + 1
                    ans = 1
                    break

        elif T[j] + K < T[i+1]:
            ans += 1
            i += 1
            j = i
            if j == N-1:
                ans += 1
                return(ans)

print(main())


### FIXED CODE ###

def main():
    N, C, K = map(int, input().split())
    T = list(int(input()) for _ in range(N))

    T.sort()

    ans = 0
    temp = T[0]
    cnt = 1

    for i in range(1,N):
        if temp + K < T[i] or C == cnt:
            ans += 1
            temp = T[i]
            cnt = 1
        else:
            cnt += 1

    ans += 1
    return (ans)

print(main())
n = int(input())
count = 0
currCount = 0
ans = 0
for i in range(n+1):
    currCount = 0
    currNum = i
    while (i % 2) == 0:
        if i == 0:
            break
        i = int(i / 2)
        currCount += 1
    if count < caurrCount:
        count = currCount
        ans = currNum
print(ans)

### FIXED CODE ###

n = int(input())
count = 0
currCount = 0
ans = 0
for i in range(n+1):
    currCount = 0
    currNum = i
    while (i % 2) == 0:
        if i == 0:
            break
        i = int(i / 2)
        currCount += 1
    if count <= currCount:
        count = currCount
        ans = currNum
print(ans)
a,b=input()
if a=='H' and b=='H':
  print('H')
elif a=='H' and b=='D':
  print('D')
elif a=='D' and b=='D':
  print('H')
else:
  print('D')

### FIXED CODE ###

a,b=input().split()
if a=='H' and b=='H':
  print('H')
elif a=='H' and b=='D':
  print('D')
elif a=='D' and b=='D':
  print('H')
else:
  print('D')
import sys
input = lambda:sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)

def solve(k, cnt, Ans):
    S = str(bin(k)).count("1") 
    L = k % S
    if L < len(Ans)+1:
        return Ans[L]
    elif L == 0:
        return 1
    cnt += solve(L,cnt, Ans)
    return cnt 

N = int(input())
P = input()
I = P.count("1")
Df = int(P,2)
Ans = [1]

for i in range(1, I+1):
    cnt = 1
    Ans.append(solve(i, cnt, Ans)+1)
#print(Ans)

for i in range(N-1):
    if P[i] == "1":
        tmp = Df - 2**(N-i-1)
        cur = I - 1
    else:
        tmp = Df + 2**(N-i-1)
        cur = I + 1 
    print(Ans[tmp%cur])
    #print(solve(tmp,cnt))

if P[N-1] == "1":
    tmp = Df - 1
else:
    tmp = Df + 1
cur = str(bin(tmp)).count("1")
print(Ans[tmp%cur])
#print(solve(N,cnt))

### FIXED CODE ###

N = int(input())
x = input()

cnt_x = x.count("1")
px10 = 0
nx10 = 0
ans = [0] * (N+1)

for i in range(1, N+1): #Nまで先に出しておく
    popcnt = format(i,"b").count("1")
    fx = i % popcnt
    ans[i] = ans[fx] + 1

for i in range(N):
    px10 += (int(x[i]) * pow(2,N-1-i, cnt_x+1)) % (cnt_x+1)#0⇒1となった場合の合計
    if cnt_x != 0 and cnt_x != 1:
        nx10 += int(x[i])*pow(2,N-1-i,cnt_x-1) % (cnt_x-1)#1⇒0となった場合の合計
#print(px10)
#print(nx10)
for i in range(N):
    if x[i] == "0":
        xi10 = (px10+pow(2,N-1-i,cnt_x+1))%(cnt_x+1)
        print(ans[xi10]+1)
    else:
        if cnt_x != 1:
            xi10 = (nx10-pow(2,N-1-i,cnt_x-1))%(cnt_x-1)
            print(ans[xi10]+1)
        else:
            print(0)
n, k = map(int, input().split())
A = list(map(int, input().split()))
if k == 0:
  print(max(A))
  exit()
ng = -1
ok = max(A) + 1
def test(x):
    cnt = 0
    for a in A:
        if a > x:
            cnt += -(-a//x) - 1
    return cnt <= k

while ok - ng > 1:
    mid = (ok+ng) // 2
    if test(mid):
        ok = mid
    else:
        ng = mid
        
print(ok)

### FIXED CODE ###

n, k = map(int, input().split())
A = list(map(int, input().split()))
ng = -1
ok = max(A) + 1
def test(x):
    if x == 0:
      return False
    cnt = 0
    for a in A:
        if a > x:
            cnt += -(-a//x) - 1
    return cnt <= k

while ok - ng > 1:
    mid = (ok+ng) // 2
    if test(mid):
        ok = mid
    else:
        ng = mid
        
print(ok)
ab=int(input().replace(' ',''))
print(['No','Yes'][any(i**2==ab for i in range(ab))

### FIXED CODE ###

ab=int(input().replace(' ',''))
print(['No','Yes'][any(i**2==ab for i in range(ab))])
def func(x,y):
  if (x*y % 2 == 0): return("Even")
  else: return ("Odd")
a,b = input.split()
func(x,y)

### FIXED CODE ###

def choise(a,b):
    if(a*b%2 == 0):return "Even"
    else:return "Odd"




if __name__ == "__main__":
    i1, i2 = map(int, input().split())
    print(choise(i1, i2))
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors

X = int(input())
done = False
while not done:
    a = make_divisors(X)
    if len(a) == 2:
        done = True
        c = X
    else:
        X += 1
       

print(c)


### FIXED CODE ###

a = input().split()
S = a[0]
T = a[1]

print(T,end="")
print(S)
N,K=map(int, input().split())
AA=list(map(int, input().split()))
A=sorted(AA)
B=sorted(AA)[::-1]
mod=10**9+7

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
n = 10**4
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, n+1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

ans=0
for i in range(N-K+1):
  d=(A[K-1+i]%mod)*cmb(K-1+i,K-1,mod)
  e=(B[K-1+i]%mod)*cmb(K-1+i,K-1,mod)
  ans+=d%mod-e%mod
  ans%=mod
print(ans)

### FIXED CODE ###

N,K=map(int, input().split())
AA=list(map(int, input().split()))
A=sorted(AA)
B=sorted(AA)[::-1]
mod=10**9+7

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
mod = 10**9+7 #出力の制限
n = 10**6+1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, n+1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

ans=0
for i in range(N-K+1):
  d=(A[K-1+i]%mod)*cmb(K-1+i,K-1,mod)
  e=(B[K-1+i]%mod)*cmb(K-1+i,K-1,mod)
  ans+=d%mod-e%mod
  ans%=mod
print(ans)
s=input()
 
for i in range(len(s)):
  if s[i]=="h":
    if i<len(s):
      s[i+1]=="i":
        print("yes")
print("no")

### FIXED CODE ###

s=input()
a=len(s)//2
if len(s)%2==1:
    print("No")
else:
    if s=="hi"*a:
        print("Yes")
    else:
        print("No")
n,s = [int(input()) for _ in range(2))
print(s.count("ABC"))

### FIXED CODE ###

n,s = [input() for _ in range(2)]
print(s.count("ABC"))
from collections import Counter


from operator import mul
from functools import reduce


def cmb(n, r):
    if (n < r):
        return 0
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N = int(input())
A = list(map(int, input().split()))
c = Counter()
for i in A:
    c.update(str(i))
cmbL = {}
gsum = 0

for i in c.keys():
    tmp1 = cmb(int(c[i]), 2)
    tmp2 = tmp1 - (tmp1 * (1 - 2/c[i]))
    cmbL[i] = [tmp1, tmp2]
    gsum += tmp1

for i in A:
    print(int(gsum - cmbL[str(i)][1]))


### FIXED CODE ###

from collections import Counter


from operator import mul
from functools import reduce


def cmbf(n, r):
    if (n < r):
        return 0
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N = int(input())
A = list(map(int, input().split()))
c = [0]*(N+1)

for A_i in A:
    c[A_i] += 1

gsum = 0
for i in range(1, N + 1):
    if (c[i] != 0):
        gsum += cmbf(c[i], 2)

for i in A:
    print(gsum-(c[i]-1))
from math import factorial
n,k=[int(_) for _ in input().split()]
mod=10**9+7
for i in range(1,k+1):
    print(((factorial(k-1)//factorial(i-1)//factorial(k-i))%mod)*((factorial(n-k+1)//factorial(i)//factorial(n-k-i+1))%mod))

### FIXED CODE ###

from math import factorial
n,k=[int(_) for _ in input().split()]
mod=10**9+7
if n!=k:
    if k+1 > n-k+2:
        for i in range(1,n-k+2):print((((factorial(k-1)//factorial(i-1)//factorial(k-i))%mod)*((factorial(n-k+1)//factorial(i)//factorial(n-k-i+1))%mod))%mod)
        for i in range(2*k-n-1):print(0)
    else:
        for i in range(1,k+1):print((((factorial(k-1)//factorial(i-1)//factorial(k-i))%mod)*((factorial(n-k+1)//factorial(i)//factorial(n-k-i+1))%mod))%mod)
else:
    print(1)
    for i in range(1,k):print(0)
a, b, c = map(int,input().split())

d = b - c
e = a - b

if d = e:
  print("Yes")

else:
  print("No")
  

### FIXED CODE ###

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

d = b - c
e = a - b

if d == e:
  print("YES")

else:
  print("NO")
x,a,b=map(int,input().split())
if abs(x-a)<abs(x-b):
  print("A")
else print("B")

### FIXED CODE ###

x,a,b=map(int,input().split())
if abs(x-a)<abs(x-b):
  print("A")
else:print("B")
N,L = map(int,input().split())
A = [L+i for i in range(N)]
A.sort(a: abs(a))

print(sum(A)-A[0])


### FIXED CODE ###

N, L = map(int, input().split())

A = [L + i for i in range(N)]
A.sort(key=lambda a: abs(a))

print(sum(A) - A[0])
from statistics import mean
ans = 0

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

P = round(mean(X))

for i in range(N):
    ans += ((X[i] - P)**2)

print(ans)

### FIXED CODE ###

import numpy as np
ans = 0

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

P = int(round(np.average(X)))

for i in range(N):
    ans += ((X[i] - P)**2)

print(ans)
# coding: utf-8
# Your code here!
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)
    
a, b, c, d = map(int,input().split())
def cal(i, j, k):
    return i // j + i // k - i // lcm(j, k)

if a % c == 0 or a % d == 0:
    print(b - a - (cal(b, c, d) - cal(a, c, d)))
else:
    print(b - a - (cal(b, c, d) - cal(a, c, d)) + 1)

### FIXED CODE ###

# coding: utf-8
# Your code here!
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
    
a, b, c, d = map(int,input().split())
def cal(i, j, k):
    return i // j + i // k - i // lcm(j, k)

if a % c == 0 or a % d == 0:
    print(b - a - (cal(b, c, d) - cal(a, c, d)))
else:
    print(b - a - (cal(b, c, d) - cal(a, c, d)) + 1)
from math import log2, floor

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

print(floor(log2(n)/log2(k)) + 1)

### FIXED CODE ###

from math import log, floor
 
n, k = map(int, input().split())
 
print(floor(log(n)/log(k)) + 1)
s=[]
x,n=map(int,input().split())
if n==0:
  print(x)
  exit()
  
s=list(map(int,input().split()))
slist=sorted(s)
out=0
for i in range(0,1000):
  out=0
  for j in range(n):
    if slist[j]==x-i:
      out=1
  if out !=1:
   print(x-i)
   exit()
  out=0
  for k in range(n):
    if slist[k]==x+i:
      out=1
  if out !=1:
    print(x+i)
    exit()

### FIXED CODE ###

a=[]
a=input().split()
for i in range(5):
 if a[i]=='0':
   print(str(i+1))
 else:
   pass
N,M=map(int,input().split())
a=[int(input()) for i in range(N)]
a=sorted(a,reverse=True)
if sum(a)/(4*M)<=a[M-1]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N,M=map(int,input().split())
a=list(map(int,input().split()))
a=sorted(a, reverse=True)
if sum(a)/(4*M)<=a[M-1]:
  print("Yes")
else:
  print("No")
import math
N = int(input())
xy = [[0,0] for _ in range(N)]
for a in xy:
    a[0], a[1] = map(int, input().split())
x=a[0]
y=a[1]
at = []
for i in range(N):
    for j in range(N):
        ea = math.sqrt((x[i] - x[j])**2 + (y[i] - y[j])**2)
        at.append(ea)
da = 0
for ag in at:
    da += ag
avg = da * math.factorial(N - 1) / math.factorial(N)
print(avg)

### FIXED CODE ###

import math
N = int(input())
x = [0]*N
y = [0]*N
for i in range(N):
    x[i],y[i] = map(int,input().split())
at=[]
for i in range(N):
    for j in range(N):
        ea = math.sqrt((x[i] - x[j])**2 + (y[i] - y[j])**2)
        at.append(ea)
da = 0
for ag in at:
    da += ag
avg = da * math.factorial(N - 1) / math.factorial(N)
print(avg)
s=list(input())
K=int(input())

abc="bcdefghijklmnopqrstuvwxyza"

cnt=K
for i in range(len(s)):
    temp=25-abc.index(s[i])
    if cnt>=temp:
        s[i]="a"
        cnt-=temp

if cnt!=0:
    if abc.index(s[-1])+cnt>25:
        s[-1]=abc[abc.index(s[-1])+cnt-26]
    else:
        s[-1]=abc[abc.index(s[-1])+cnt]

print("".join(s))


### FIXED CODE ###

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

abc="bcdefghijklmnopqrstuvwxyza"

cnt=K
for i in range(len(s)):
    temp=25-abc.index(s[i])
    if cnt>=temp:
        s[i]="a"
        cnt-=temp

if cnt!=0:
    s[-1]=abc[(abc.index(s[-1])+cnt)%26]

print("".join(s))
# 数字
N = map(int, input().split()

# 文字
S = input()

AAA = ""

for char in list(S):
    hoge = ord(char)
    huga = hoge - 97
    huga = (huga + S) % 26
    hoge = num + 97
    AAA += chr(hoge)

print()

### FIXED CODE ###

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


def encrypt(S, N):
    X = ""

    for ch in list(S):
        if 'A' <= ch <= 'Z':
            X += chr((ord(ch) - ord('A') + int(N)) % 26 + ord('A'))
        elif 'a' <= ch <= 'z':
            X += chr((ord(ch) - ord('a') + int(N)) % 26 + ord('a'))
        else:
            X += ch

    return X

# 暗号化
X = encrypt(S, N)
print(X)
a,b,c,d = map(int, input().split())
#b>= x>= a and d>=x>=c

if b<c or a < d:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

x = int(input())
print("ACL" * x)
def inc(x):
    return x+1
while True:
    n = int(raw_input())
    if n == 0:
        break
    numbers = [int(raw_input()) for i in range(n)]
    pointers = filter(lambda x:x[0]<x[1], map(lambda x:(x/n,x%n+1),xrange(n*n)))
    ans = 0
    for pointer in pointers:
        tmp = reduce(lambda x,y:x+y,numbers[pointer[0],pointer[1]])
        ans = tmp > ans if tmp else ans
    print ans

### FIXED CODE ###

while True:
    n = int(raw_input())
    if n == 0:
        break
    numbers = [int(raw_input()) for i in range(n)]
    if max(numbers) <= 0:
        print max(numbers)
    else:
        ans = 0
        for i in range(n):
            tmp = 0
            for j in range(i,n):
                tmp += numbers[j]
                if(ans<tmp):
                    ans = tmp
        print ans
A,B = map(int, input().split())
if A>B:
  print(2A-1)
elif A==B:
  print(A+B)
else:
  print(2B-1)

### FIXED CODE ###

A,B = map(int, input().split())
if A>B:
  print(2*A-1)
elif A==B:
  print(A+B)
else:
  print(2*B-1)
A,B,K=map(int,input().split())
l=[]

for i in range(2,min(A,B)+1):
    if A%i==0 and B%i==0:
        l.append(i)
print(sorted(l)[K-1])

### FIXED CODE ###

A,B,K=map(int,input().split())
l=[]

for i in range(1,min(A,B)+1):
    if A%i==0 and B%i==0:
        l.append(i)
l=sorted(l)[::-1]
print(l[K-1])
def main ():
N = int(input())
A = list(map(int,input(). split ()))
if 0 in A:
print(0)
return
prod = 1
for a in A:
prod *= a
if prod > 1000000000000000000:
print(-1)
return
print(prod)
main ()


### FIXED CODE ###

n=int(input())
a=list(map(int, input().split( )))
if 0 in a:
  print(0)
  
else:
    c=1
    for i in a:
        c= c*i
        if c> 10**18:
            c=-1
            break
    print(c)
n, x = map(int, input().split())
l = list(map(int, input().split()))
# n, x = 3, 6
# l = [3, 4, 5]
d = 0
for i in range(1, n + 2):
    d = d + l[i - 1]
    if d > x:
        break
print(i)


### FIXED CODE ###

import numpy as np
N, X = map(int, input().split())
L = np.array(list(map(int, input().split())))
L = np.append(0, L)
print(np.count_nonzero(L.cumsum() <= X))
import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
    
    
N=int(input())
l=list(map(int,input().split()))
cnt=0
a=0
for i in range(N-1):
	if l[i]>=l[i+1]:
		cnt+=1
	else:
		if cnt>=a:
			a=cnt
			cnt=0
		else:
			cnt=0
	
if cnt>=a:
	a=cnt	
print(a)

### FIXED CODE ###

import sys

if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
S=input()
T=input()
cnt=0
l=len(S)

for i in range(l):
	if S[i]==T[i]:
		cnt+=1
	
print(cnt)
S = input()
T = input()
count = 0
flg = False
while True:
    flg = False
    for i in range(1,len(T)+1):
        if S[-i-count] != T[-i] and S[-i-count] != '?':
            count += 1
            flg = True
            break
    if count == len(S) - len(T):
        print('UNRESTORABLE')
        exit()
    if not flg:
        if count == 0:
            ans = S[0:len(S)-len(T)] + T
        elif count == len(S)-len(T):
            ans = T + S[:-len(S)+len(T)]
        else:
            ans = S[0:len(S)-len(T)-1] + T + S[-count:]
        print(ans.replace('?','a'))
        exit()

### FIXED CODE ###

S = input()
T = input()
count = 0
flg = False
if len(S) < len(T):
    print('UNRESTORABLE')
    exit()
while True:
    flg = False
    for i in range(1,len(T)+1):
        if S[-i-count] != T[-i] and S[-i-count] != '?':
            count += 1
            flg = True
            break
    if count == len(S) - len(T) + 1:
        print('UNRESTORABLE')
        exit()
    if not flg:
        if count == 0:
            ans = S[0:len(S)-len(T)] + T
        elif count == len(S)-len(T):
            ans = T + S[len(T):]
        else:
            ans = S[0:len(S)-len(T)-count] + T + S[-count:]
        print(ans.replace('?','a'))
        exit()
N = int(input())

base = ["3", "5", "7"]
nums = ["3", "5", "7"]
temp = []
x = 0

while 1:
    for num in nums[(3**x)-1:]:
        for b in base:
            temp.append(b + num)
    nums.extend(temp)
    
    x += 1
    if int(temp[-1]) > 10**9:
        break
    temp = []

target = []
for n in set(nums):
    if "7" in n and "5" in n and "3" in n:
        target.append(int(n))

count = 0
target.sort()
for n in target.:
    if int(n) < N:
        count += 1

print(count)

### FIXED CODE ###

N = int(input())

base = ["3", "5", "7"]
nums = ["3", "5", "7"]
temp = []
x = 0

while 1:
    for num in nums[(3**x)-1:]:
        for b in base:
            temp.append(b + num)
    nums.extend(temp)
    
    x += 1
    if int(temp[-1]) > 10**9:
        break
    temp = []

target = []
for n in set(nums):
    if "7" in n and "5" in n and "3" in n:
        target.append(int(n))

count = 0
for n in target:
    if n <= N:
        count += 1

print(count)