Harryxun/stf_run huggingface dataset:
from scipy.misc import comb
import time

N = input()
K = int(input())

N_len = len(N)

ans = 0
if K == 1:
  	time.sleep(0.5)
    ans = int(N[0]) + 9 * (N_len-1)
elif K == 2:
  	time.sleep(1)
    if N_len >= 2:
        ans = (int(N[0])-1) * 9 *(N_len-1)
        ans += int(N[1]) + 9 * (N_len-2)
        for i in range(1,N_len-1):
            ans += 9*9*i
elif K == 3:
  	time.sleep(1.5)
    if N_len >= 3:
        # N[0],N[1]
        ans = int(N[2]) + 9 * (N_len-3)
        # N[0], 1~N[1]-1
        ans += max(int(N[1])-1,0) * 9 * (N_len-2)
        # N[0], N[1] = 0
        ans += 9**2 * comb(N_len-2,2,exact=True)
        # 1~N[0]-1
        ans += (int(N[0])-1) * 9**2 * comb(N_len-1,2,exact=True)     
        # N[0] = 0
        for i in range(2,N_len-1):
            ans += 9**3 * comb(i,2,exact=True)


#print(9**3*comb(N_len,3,exact=True))
print(ans)


### FIXED CODE ###

import numpy as np

dp = np.zeros((105,4,2),dtype=np.int32)

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

dp[0][0][0] = 1
for i in range(n):
    for j in range(4):
        for k in range(2):
            nd = int(s[i])
            for d in range(10):
                ni = i + 1
                nj = j 
                nk = k
                if d != 0:
                    nj += 1
                if nj > K:
                    continue
                if k == 0:
                    if d > nd:
                        continue
                    if d < nd:
                        nk = 1
                dp[ni][nj][nk] += dp[i][j][k]
ans = dp[n][K][0] + dp[n][K][1]
print(ans)
import math
a,b=map(int,input().split())
g=math.gcd(a,b)
print(a*b//g)


### FIXED CODE ###

import fractions
a,b=map(int,input().split())
g=fractions.gcd(a,b)
print(a*b//g)
N = int(input())
a = map(int, input().split())

count = 0

for i, target in enumerate(a):
	if a[target - 1] == i + 1:
		count += 1

print(count // 2)

### FIXED CODE ###

s = list(input())
s = s[:4] + [' '] + s[4:]
print(''.join(s))
print(input()[::-1])

### FIXED CODE ###

print(input()[::-1])
import sys 
N = int(input())

t = []
cordinate = []

#　リストtに時間の情報、二次元配列のcordinateにx,y座標を入れる
for i in range(N):
    time,x,y = map(int, input().split())
    t.append(time)
    cordinate.append([x,y])

# 初期の時間と初期座標
time = 0
x,y = 0,0


for i in range(len(t)):
    
    # 移動先への移動にかけて良い時間
    time = abs(time - t[i])
    
    #移動先のx,y座標
    objx = cordinate[i][0]
    objy = cordinate[i][1]
    

    
    #移動できる時間より距離が長い場合はアウト
    if time < abs((objx - x) + (objy - y)):
        print("No")
        sys.exit()
    
    #偶奇の判定
    if (abs((objx - x) + (objy - y)))%2 != time % 2:
        print("No")
        sys.exit()

    x,y = objx,objy
    time = t[i]

print("Yes")

### FIXED CODE ###

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

a_b = ((a*b)%2)

if a_b == 0:
    print("Even")
else:
    print("Odd")
a = str(input())

if a[0]=="A":
    if "C" in a[2:len(a)-1]:
        if len(ad)==len(a)-2:
            ad = a[1:].replace("C","")
            if ad.islower():
                print("AC")
            else:
                print("WA")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")
            

### FIXED CODE ###

a = str(input())

if a[0]=="A":
    if "C" in a[2:len(a)-1]:
        ad = a[1:].replace("C","")
        if len(ad)==len(a)-2:
            if ad.islower():
                print("AC")
            else:
                print("WA")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")
#!/usr/bin/env python3
import cupy
import sys
from operator import itemgetter
# import math
# import numpy as np
# from functools import lru_cache

args = sys.argv
if len(args) == 2:
  from IPython import embed
  em = True
else:
  em = False

# sys.setrecursionlimit(10000)


input = sys.stdin.readline
#### input
N, Q = list(map(int, input().split()))
ABs = [None]*(N-1)
for i in range(0, N-1):
  ABs[i] = list(map(int, input().split()))

ABs.sort(key=itemgetter(0))

PXs = [None]*Q
for i in range(0, Q):
  PXs[i] = list(map(int, input().split()))
# a = list(map(int, input().split()))
# required_list = list(map(lambda x: int(x)*(-1), target_list))  # 各要素を-1倍


# n = int(input())
# t = [int(input()) for i in range(n)]
if em: sys.stdin = open('/dev/tty')
#### class
# class Node:
#   def __init__(self, data):
#     self.data = data
#     self.child= []
#     self.below = []

#### function
# @lru_cache(maxsize=10000)

#### process
scores = [0] * N
above_nodes  = [[x+1] for x in range(0, N)]

for AB in ABs:
  above_nodes[AB[1]-1].extend(above_nodes[AB[0]-1])

for PX in PXs:
  scores[PX[0]-1] = scores[PX[0]-1] + PX[1]

node_scores = [None] * N
for i in range(0, N):
  node_score = 0
  for above_node in above_nodes[i]:
    node_score = node_score + scores[above_node-1]
  node_scores[i] = node_score
print(' '.join(map(str, node_scores)))

# if em: embed()
## heapsort, O(NlogN)
# import heapq
# As = [0,1,2,3]
# heapq.heapify(As)
# min = heapq.heappop(As)
# heapq.heappush(As, inserted_element)


### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
 
# 遅延評価で加えてあげるだけ
 
N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(N-1)]
PX = [[int(x) for x in input().split()] for _ in range(Q)]
 
graph = [[] for _ in range(N+1)]
for a,b in AB:
    graph[a].append(b)
    graph[b].append(a)
 
value = [0] * (N+1)
for p,x in PX:
    value[p] += x
    
q = [(1,0)]
while q:
    x,parent = q.pop()
    value[x] += value[parent]
    for y in graph[x]:
        if y == parent:
            continue
        q.append((y,x))
 
answer = ' '.join(map(str,value[1:]))
print(answer)
s = list(input())
N = len(s)

ref = ["A","C","G","T"]
lst = []

for i in range(N):
    ans = ""
    if s[i] in ref:
        while s[i] in ref:
            ans = ans + s[i]
            i += 1
    lst.append(ans)

ans = -float("inf")
for i in range(N):
    ans = max(ans, len(lst[i]))

print(ans)

### FIXED CODE ###

s = list(input())
N = len(s)

ref = ["A","C","G","T"]
lst = []

for i in range(N):
    ans = ""
    if s[i] in ref:
        while s[i] in ref:
            ans = ans + s[i]
            i += 1
            if i >= N:
                break
    lst.append(ans)

ans = -float("inf")
for i in range(N):
    ans = max(ans, len(lst[i]))

print(ans)
from fractions import gcd

k = int(input())
cnt = 0
for a in range(k):
    for b in range(k):
        for c in range(k):
            d = math.gcd(a+1,b+1)
            cnt = cnt + math.gcd(d,c+1)
print(cnt)



### FIXED CODE ###

import math

k = int(input())
cnt = 0
for a in range(k):
    for b in range(k):
        for c in range(k):
            cnt = cnt + math.gcd(math.gcd(a+1,b+1),c+1)
print(cnt)
import math
N = int(input())
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
print(lcm(2, N))

### FIXED CODE ###

N = int(input())
if N % 2 == 0:
    print(N)
else:
    print(2 * N)
N,A=map(int,input().split())
print("Yes" if N-N//500*500<A else "No")

### FIXED CODE ###

N=int(input())
A=int(input())
print("Yes" if N-(N//500)*500<=A else "No")
import math
from decimal import Decimal
a, b = input().split()
//a = decimal.Decimal(a)
//b = decimal.Decimal(b)
print(math.floor(Decimal(a) * Decimal(b)))


### FIXED CODE ###

import math
import decimal
a, b = input().split()
a = decimal.Decimal(a)
b = decimal.Decimal(b)
print(math.floor(a * b))
N, M, C = map(int, input().split)
Blis = [int(x) for x in input().split()]
Alis = []
k = 0
for i in range(N):
  Alis[i] = [int(x) for x in input().split()]
for i in range(N):
  total = 0
  for j in range(M):
    total = total + (Alis[i][j])*(Blis[i][j])
  total = total + C
  if total > 0:
    k = k + 1
print(k)    

### FIXED CODE ###

N, M, C = map(int, input().split())
Blis = [int(x) for x in input().split()]
k = 0
for i in range(N):
  Alis = [int(x) for x in input().split()]
  total = 0
  for j in range(M):
    total = total + (Alis[j])*(Blis[j])
  total = total + C
  if total > 0:
    k = k + 1
print(k)
n = int(input())
A = list(map(int, input().split()))
r = 0
for i in range(n):
    p, x = 0, 0
    for j in range(i, n):
        p += A[j]
        x ^= A[j]
        if p == x:
            r += 1
        else:
            break
print(r)

### FIXED CODE ###

a, b = map(int, input().split())
print(max(a+b, a-b, a*b))
def solve():
	N = int(input())
	h = [int(i) for i in input().split()]
    ans = 0
	for i in range(1, N):
		ans += max(h[i] - (0 if i - 1 < 0 else h[i - 1]), 0)
	return ans

print(solve())

### FIXED CODE ###

def solve():
	N = int(input())
	h = [int(i) for i in input().split()]
	ans = 0
	for i in range(0, N):
		ans += max(h[i] - (0 if i - 1 < 0 else h[i - 1]), 0)
	return ans

print(solve())
H,W = input().split()
h, w = input().split()
print(H * W - (h * W + w * H - h * w))

### FIXED CODE ###

H,W = map(int, input().split())
h, w = map(int, input().split())
print(H * W - (h * W + w * H - h * w))
n=int(input())
l=[]
tmp=n
i=0
while abs(tmp)>=(2**(i)):
    if tmp%(2**(i+1))!=0:
        l.append(1)
        tmp=tmp-(-2)**i
        i+=1
    else:
        l.append(0)
        i+=1
l=l[::-1]
l=map(str,l)
l="".join(l)
print(l)


### FIXED CODE ###

n,k=map(int,input().split())
if n%k==0:
    print(0)
else:
    print(1)
def resolve():
    import numpy as np
    n=int(input())
    x_base=list(map(int,input().split()))
    x_base.sort()
    x=np.array(x_base)
    ans=10**10
    for i in range(x[0],x[-1]+1):
        if sum((x-i)**2) <=ans:
            ans=sum((x-i)**2)
    print(ans)
resolve()


### FIXED CODE ###

def resolve():
    import numpy as np
    n=int(input())
    x_base=list(map(int,input().split()))
    x_base.sort()
    x=np.array(x_base)
    ans=10**10
    for i in range(x[0],x[-1]+1):
        if sum((x-i)**2) <=ans:
            ans=sum((x-i)**2)
    print(ans)
resolve()
n, k = (int(x) for x in input().split())
s = input()
happy = 0

if(s[0] == 'R' and s[1] == 'R'):
    happy = happy + 1
if(s[-1] == 'L' and s[-2] == 'L'):
    happy = happy + 1

for i in range(1,n-1):
    if(s[i] == 'R' and s[i+1] == 'R'):
        happy = happy + 1
    if(s[i] == 'L' and s[i-1] == 'L'):
        happy = happy + 1

happy = happy + 2*k
print(min(happy, n-1))


### FIXED CODE ###

n, k = (int(x) for x in input().split())
s = input()
happy = 0

if(s[0] == 'R' and s[1] == 'R'):
    happy = happy + 1
if(s[n-1] == 'L' and s[n-2] == 'L'):
    happy = happy + 1

for i in range(1,n-1):
    if(s[i] == 'R' and s[i+1] == 'R'):
        happy = happy + 1
    if(s[i] == 'L' and s[i-1] == 'L'):
        happy = happy + 1

happy = happy + 2*k
print(min(happy, n-1))
def get_input(inp):
    li = inp.split("\n")

    def inner():
        return li.pop(0)
    return inner

INPUT = """azzel
apple
"""
input = get_input(INPUT)

#######################################################
a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
        np+=1
    if b[i] not in l:
        l.append(b[i])
        nq+=1
    if i != 0:
        if not (k.index(a[i])==l.index(b[i]) and ((a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i])):
            np*=0
if np == nq:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a = input()
b = input()
k = []
l = []
np=0
nq=0
for i in range(0,len(a)):
    if a[i] not in k:
        k.append(a[i])
        np+=1
    if b[i] not in l:
        l.append(b[i])
        nq+=1
    if i != 0:
        if not (k.index(a[i])==l.index(b[i]) and ((a[i-1]==a[i] and b[i-1] == b[i]) or ( a[i-1] != a[i] and b[i-1]!= b[i]))):
            np*=0
if np == nq:
    print("Yes")
else:
    print("No")
n, k = map(int,input().split())
al = list(map(int,input().split()))
dics = {}

for i in range(n):
    if al[i] in dics:
        dics[al[i]] = dics[al[i]] + 1
    else:
        dics.update({al[i]:1})
        
counts = len(dics.values())
kesu = 0
sortv = dics.values()
while len(sortv) > k:
    kesu = kesu + min(sortv)
    sortv.remove(min(sortv))
print(kesu)

### FIXED CODE ###

n, k = map(int,input().split())
al = list(map(int,input().split()))
dics = {}
 
for i in range(n):
    if al[i] in dics:
        dics[al[i]] = dics[al[i]] + 1
    else:
        dics.update({al[i]:1})
        
counts = len(dics.values())
kesu = 0
sortv = list(sorted(list((dics.values()))))

i = counts
j = 0
while i > k:
    kesu = kesu + sortv[j]
    i = i - 1
    j = j + 1
print(kesu)
a,b = map(int,input().split())

if a < b:
    print "a < b"
elif a >b:
    print "a > b"
else:
    print "a == b"

### FIXED CODE ###

a,b = map(int,raw_input().split())
 
if a < b:
    print "a < b"
elif a >b:
    print "a > b"
else:
    print "a == b"
def gcd(a, b):
    if b == 0: return a
    mod = a % b
    buf = gcd(b, mod)
    return buf

def lcm(a, b):
    buf = gcd(a, b)
    return int(a * b / buf)

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

lcm_a = 0
for i in range(len(a_li)) :
    if i == 0 :
        lcm_a = a_li[i]
    else :
        lcm_a = lcm(lcm_a, a_li[i])

m = lcm_a - 1
f = 0
for i in range(len(a_li)) :
    f = f + m % a_li[i]

print(f)

### FIXED CODE ###

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

f = 0
for i in range(len(a_li)) :
    f = f + a_li[i] - 1

print(f)
S,T = input().split()
A,B = map(int, input().split())
U = input()

if U = S: A-=1
else: B-=1
print(A,B)

### FIXED CODE ###

S,T = input().split()
A,B = map(int, input().split())
U = input()

if U == S: A-=1
else: B-=1
print(A,B)
n=int(input())
s=input()

remain = [[0,0,0]]
for i in range(n):
    r, g, b = remain[-1]
    if s[-i-1] == "R":
        r = r+1
    elif s[-i-1] == "G":
        g = g + 1
    elif s[-i-1] == "B":
        b = b + 1

    remain.append([r,g,b])

total = 0
for i in range(n-2):
    if s[i] == "R":
        for j in range(i+1, n):
            if s[j] == "G":
                total += remain[-j-1][2]
                if i+((j-i)*2) < n:
                    if s[i+((j-i)*2)]=="B":
                        total -= 1
            elif s[j] == "B":
                total += remain[-j-1][1]
                if i+((j-i)*2) < n:
                    if s[i+((j-i)*2)]=="G":
                        total -= 1
    elif s[i] == "G":
        for j in range(i+1, n):
            if s[j] == "B":
                total += remain[-j-1][0]
                if i+((j-i)*2) < n:
                    if s[i+((j-i)*2)]=="R":
                        total -= 1
            elif s[j] == "R":
                total += remain[-j-1][2]
                if i+((j-i)*2) < n:
                    if s[i+((j-i)*2)]=="B":
                        total -= 1
    elif s[i] == "B":
        for j in range(i+1, n):

            if s[j] == "R":
                total += remain[-j-1][1]
                if i+((j-i)*2) < n:
                    if s[i+((j-i)*2)]=="G":
                        total -= 1
            elif s[j] == "G":
                total += remain[-j-1][0]
                if i+((j-i)*2) < n:
                    if s[i+((j-i)*2)]=="R":
                        total -= 1
print(total)

### FIXED CODE ###

n,k = map(int,input().split())
gcds = []


def power_func(a,n,p):
    bi=str(format(n,"b"))#2進表現に
    res=1
    for i in range(len(bi)):
        res=(res*res) %p
        if bi[i]=="1":
            res=(res*a) %p
    return res

mod = 10**9+7
for i in range(k):
    div = k//(k-i)
    count = power_func(div,n, mod)
    for j in range(1,div):
        count = count - gcds[k-((k-i)*(j+1))]
    gcds.append(count)

total = 0

for i in range(k):
    total = (total + (gcds[i]*(k-i)%mod))%mod
print(total)
# coding: utf-8
N = int(input())
A = input().split()
for k in range(N):
  A_ = A.copy()
  del A_[k]
  ans = 0
  while len(A_) > 0:
    val = A_[0]
    counts = A_.count(val)
    ans += int(counts * (counts - 1) / 2)
    while True:
      try:
        A_.remove(val)
      except:
        break

  print('{}'.format(ans))

### FIXED CODE ###

N, M = input().split()
N, M = int(N), int(M)
if N < 2:
  print(int(M*(M-1)/2))
elif M < 2:
  print(int(N*(N-1)/2))
else:
  print(int(N*(N-1)/2 + M*(M-1)/2))
from collections import deque

A, B, K = input().split()

A = int(A)
B = int(B)
K = int(K)

value = deque([])
s = deque([i for i in range(A, B+1)])

value.extend(s[0:K])
value.extend(s[len(s)-K:len(s)])

num = deque()

for i in range(len(value)):
    if value[i] not in num:
        num.append(value[i])
        print(value[i])

### FIXED CODE ###

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

value = []

if B - A < K or B <= K:
    value.extend([i for i in range(A, B+1)])
    
else:
    value.extend([i for i in range(A, A+K)])
    value.extend([i for i in range(B-K+1, B+1)])    

num = list(set(value))
num.sort()

for i in range(len(num)):
    print(num[i])
import math

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

if a + b + 2 * math.sqrt(a * b) < c:
    ans = 'Yes'
else:
    ans = 'No'

if math.isclose(math.sqrt(a) + math.sqrt(b), math.sqrt(c)):
    ans = 'Yes'

print(ans)


### FIXED CODE ###

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

if 4 * a * b < (c - a - b) ** 2 and 0 <= c - a - b:
    ans = 'Yes'
else:
    ans = 'No'

print(ans)
n=int(input())

a=[]
for i in range(1,10):
	if n/i<10:
      a.append("Yes")

if "Yes" in a:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

import sys
 
N=int(input())
for i in range(1,10):
  if N/i==N//i  and N/i<10:
    print("Yes")
    sys.exit()
print("No")
#coding: utf-8

line = input().strip()
N = int(line[0])
A = int(line[2])
B = int(line[4])
monster = [int(input()) for i in range(N)]

times = 0
while len(monster) > 0:
    n = monster.index(max(monster)) #一番体力が大きい魔物のインデックス
    monster[n] = monster[n] - A
    if monster[n] < 1:
        monster[n] = 0

    for i, x in enumerate(monster):
        if i != n:
            monster[i] = monster[i] - B
            if monster[i] < 1:
                monster[i] = 0
    for i in monster:
        if i == 0:
            monster.remove(0)

    times = times + 1

print (times-1)

### FIXED CODE ###

#coding: utf-8
import math

N, A, B = map(int, input().split())
monster = [int(input()) for i in range(N)]


def enough(T):
    attack = B * T
    diff = A-B
    count = 0
    for i in monster:
        tmp = math.ceil((i - attack)/diff)
        if tmp > 0:
            count += tmp

    if count <= T:
        return True
    else:
        return False

def bs():
    left = 0
    right = 1000000000

    while left < right:
        mid = (left + right) // 2
        if enough(mid):
            right = mid
        else:
            left = mid + 1
    return left

print(bs())
import numpy as np
from copy import deepcopy
N = int(input())

status = [[] for _ in range(N)]
for i in range(N):
    A = int(input())
    for _ in range(A):
        x, y = list(map(int, input().split()))
        status[i].append((x-1,y))

honest = 0

# bit全探索
for i in range(2 ** N):
    flag = True
    for j in range(N):
        if ((i >> j) & 1) == 1:
            # bitが立っている箇所に対して処理。つまり,人jが正直者だとしたとき、
            # その人の発言と、矛盾していないか判定
            for x, y in status[j]: # 人jの証言            
                if ((i >> x) & 1) != y:
                    flag = False
                    break
    if flag:
        honest = max(honest, bin(i)[2:].count('1'))  # 0bが先頭につくため

print(honest)

### FIXED CODE ###

N = int(input())

status = [[] for _ in range(N)]
for i in range(N):
    A = int(input())
    for _ in range(A):
        x, y = list(map(int, input().split()))
        status[i].append((x-1,y))

honest = 0

# bit全探索
for i in range(2 ** N):
    flag = True
    for j in range(N):
        if ((i >> j) & 1) == 1:
            # bitが立っている箇所に対して処理。つまり,人jが正直者だとしたとき、
            # その人の発言と、矛盾していないか判定
            for x, y in status[j]: # 人jの証言            
                if ((i >> x) & 1) != y:
                    flag = False
                    break
    if flag:
        honest = max(honest, bin(i)[2:].count('1'))  # 0bが先頭につくため

print(honest)
N = int(input())
ls = []
for _ in range(N):
    ls.append(list(map(int, input().split())))

for cx in range(101):
    for cy in range(101):
        n = -1
        for l in ls:
            if l[2] != 0:
                if n == -1:
                    H = abs(cx - l[0]) + abs(cy - l[1]) + l[2]
                    n += 1
                if abs(cx-l[0])+abs(cy-l[1])+l[2] != H:
                    break
        else:
            print(cx, cy, H)
            exit(1)


### FIXED CODE ###

N = int(input())
lst = [list(map(int, input().split())) for _ in range(N)]

for cx in range(101):
    for cy in range(101):
        for l in lst:
            if l[2] != 0:
                H = abs(cx-l[0]) + abs(cy-l[1]) + l[2]
        for l in lst:
            if l[2] != max(0, H - abs(cx-l[0]) - abs(cy-l[1])):
                break
        else:
            print(cx, cy, H)
            exit(0)
n = input
print("Yes" if n[0] == n[1] == n[2] or n[1] == n[2] == n[3] else "No")


### FIXED CODE ###

n = input()
print("Yes" if n[0]==n[1]==n[2] or n[1]==n[2]==n[3] else "No")
import math
a, b, c = list(map(int, input().split()))
# xのn乗根を得る
def nroot(a, n, x=1.0, eps=1e-7):
    while abs(a - x**n) > eps:
#         print(abs(a - x**n))
        x = ( (n-1)*x + a/(x**(n-1)) ) / n
    return x
def sq(a):
    aa = np.sqrt(a)
    return nroot(a, 2, aa)
if (sq(a) + sq(b)) < sq(c):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

from decimal import *
getcontext().prec = 20      # デフォルト28桁のところを20桁にする
def sq(n):
    m = Decimal(n).sqrt()
    return m

import math
a, b, c = list(map(int, input().split()))
# def sq(a):
#     aa = math.sqrt(a)
#     return aa
if (sq(a) + sq(b)) < sq(c):
    print("Yes")
else:
    print("No")
N,j = map(int,input().split())
P = list(map(int,input().split()))
count = 0
i = 0
while i < N:
  if P[i] <= P[j]:
    count += 1
print(count)

### FIXED CODE ###

N = int(input())
P = list(map(int,input().split()))
ans = 1
Pj = P[0]
for i in range(1,N):
  Pj = min(Pj,P[i])
  if P[i] <= Pj:
    ans += 1
  else:
    pass
print(ans)
N_A_B = list(map(int, input()))

if N_A_B[2] - N_A_B[1] %2 == 0:
    print("Borys")
elif N_A_B[2] - N_A_B[1] %2 == 1:
    print("Alice")

### FIXED CODE ###

N_A_B = list(map(int, input().split()))

if (N_A_B[2] - N_A_B[1]) %2 == 0:
    print("Alice")
elif (N_A_B[2] - N_A_B[1]) %2 == 1:
    print("Borys")
if min(As)==0:
    num=0
else:
    num=1
    for i in range(N):
        num *= As[i]
        if num>10**18:
            print("breakに突入")
            num=-1
            break

print(num)

### FIXED CODE ###

#169B
N=int(input())
As=list(map(int,input().split()))

if min(As)==0:
    num=0
else:
    num=1
    for i in range(N):
        num *= As[i]
        if num>10**18:
            num=-1
            break

print(num)
from fractions import gcd
n,m=map(int,input().split())
s=input()
t=input()
g=gcd(n,m)
l=n*m//g
ans=l
L=[0]*l
p=0
for i in s:
  L[p]=i
  p+=l//n
p=0
for j in t:
  if L[p]!=0 and L[p]!=j:
    ans=-1
    break
  p+=l//m
print(ans)

### FIXED CODE ###

from fractions import gcd
N,M=map(int,input().split())
S=input()
T=input()
L=gcd(N,M)
print(N*M//L if all([S[i*N//L]==T[i*M//L] for i in range(L)]) else "-1")
k,n = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]

c = a[0] + (k - a[n-1])

c = max(c,[a[i]-a[i-1] for i in range(1,n)])

print(k-c)


### FIXED CODE ###

k,n = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
c = a[0] + (k - a[n-1])
for i in range(1,n):
  c = max(c,a[i] - a[i-1])
print(k-c)
n = int(input())
s = str(input())
k = int(input())

char = s[k]
result = ""
for x in s:
    if x == char:
        result += char
    else:
        result += "*"
print(result)


### FIXED CODE ###

n = int(input())
s = str(input())
k = int(input())
 
char = s[k-1]
result = ""
for x in s:
    if x == char:
        result += char
    else:
        result += "*"
print(result)