Harryxun/stf_run huggingface dataset:
def main():
    height, width = map(int, input().split(" "))
    grids = ["." * (width + 2)]
    for _ in range(height):
        grids.append("." + input() + ".")
    is_possible = True
    grids.append("." * (width + 2))
    for i in range(1, width + 1):
        for j in range(1, height + 1):
            if grids[i][j] == "#":
                if not(grids[i + 1][j] == "#" or grids[i - 1][j] == "#"  or grids[i][j + 1] == "#" or grids[i][j - 1] == "#"):
                    is_possible = False
        if not is_possible:
            break
    if is_possible:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    height, width = map(int, input().split(" "))
    grids = ["." * (width + 2)]
    for _ in range(height):
        grids.append("." + input() + ".")
    grids.append("." * (width + 2))
    is_possible = True
    for i in range(1, height + 1):
        for j in range(1, width + 1):
            if grids[i][j] == "#":
                if not (grids[i + 1][j] == "#" or grids[i - 1][j] == "#" or grids[i][j + 1] == "#" or grids[i][j - 1] == "#"):
                    is_possible = False
    if is_possible:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
_ = input()
A = list(map(int,input().split()))
if 'Y' in A:
  print('Four')
else:
  print('Three')

### FIXED CODE ###

_ = input()
A = list(input().split())
if 'Y' in A:
  print('Four')
else:
  print('Three')
_l=input().split()
_s=sum([int(i) for i in s])
if _s % 2 != 0:
  print('IMPOSSIBLE')
else:
  print(s/2)

### FIXED CODE ###

_l = input().split()
_s = sum([int(i) for i in _l])
if _s % 2 != 0:
    print('IMPOSSIBLE')
else:
    print(int(_s / 2))
L,R=map(int,input().split())
li=[]
for i in range(L,R):
  for j in range(i+1,R+1):
    while i*j<2019**2:
      mod=(i*j)%2019
      li.append(mod)
      if mod==0:
        break
print(min(li))


### FIXED CODE ###

L,R=map(int,input().split())
R=min(R, L+2019)
li=[]
for i in range(L,R):
  for j in range(i+1,R+1):
      mod=(i*j)%2019
      li.append(mod)
      if mod==0:
        break
print(min(li))
n,k = map(int,input().split())
num = 0
while True:
	num = n-k
    if num < 0:
      print(abs(num))

### FIXED CODE ###

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

d = n//k

n = n - d*k

if abs(n-k)>n:
  print(n)
else:
  print(abs(n-k))
n = int(input())
t = list(map(int, input().split()))
m = int(input())
p, x = [], []
for i in range(m):
  q, y = map(int, input().split())
  p.append(q)
  x.append(y)
s = sum(t)
for j in range(m):
  print(s - t[p[j]] + x[j])

### FIXED CODE ###

n = int(input())
t = list(map(int, input().split()))
m = int(input())
p = []
x = []
for i in range(m):
  q, y = map(int, input().split())
  p.append(q)
  x.append(y)
  
s = sum(t)
for j in range(m):
  print(s - t[p[j]-1] + x[j])
def num_divisors(n):
  res = 0
  i = 2
  while i * i <= n:
    if n % i == 0:
      res += 1
      res += 1 if i * i != n else 0
    i += 1
  return res


N = input()
res = 0
for n in range(1, N + 1):
  if num_divisors(n) == 8:
    res += 1
print(res)


### FIXED CODE ###

def num_divisors(n):
  res = 0
  i = 1
  while i * i <= n:
    if n % i == 0:
      res += 1
      res += 1 if i * i != n else 0
    i += 1
  return res


N = int(input())
res = 0
for n in range(1, N + 1, 2):
  if num_divisors(n) == 8:
    res += 1
print(res)
import sys
W, H, x, y = map(int, input().split())

area = max(min((W - x) * H, x * H), min((H - y) * W, y * W))

num = 0

if (x, y) == (0, 0) or (x, y) == (W, H) or (x, y) == (W, 0) or (x, y) == (0, H):
    print((W * H) / 2, str(0))
    sys.exit()

if (y == (W / H) * x or y == H - (H / W) * x) and (x, y) != (W / 2, H / 2):
    print(W * H / 2, str(0))
    sys.exit()

if (x, y) == (W / 2, H / 2):
  	print(W * H / 2, str(1))
    sys.exit()


if min((W - x) * H, x * H) == min((H - y) * W, y * W):
    num = 1
else:
    num = 0

print(area, str(num))

### FIXED CODE ###

from decimal import *
import sys
W, H, x, y = map(int, input().split())
num = 0
if 2 * x == W and 2 * y == H:
    num = 1

print(W * H / 2, num)
import itertools
H, W = [int(_) for _ in input().split()]
S = [input() for _ in range(H)]
A = [[0 for _ in range(W)] for _ in range(H)]
count = {}


def bfs(x, y, p, q):
    if A[x][y] == 1:
        return
    else:
        A[x][y] = 1
        count[p * H + q] = count.get(p * H + q, {})
        count[p * H + q]['#'] = count[p * H + q].get('#', 0)
        count[p * H + q]['.'] = count[p * H + q].get('.', 0)
        count[p * H + q][S[x][y]] += 1
        dxy = [[-1, 0], [1, 0], [0, -1], [0, 1]]
        for dx, dy in dxy:
            nx, ny = x + dx, y + dy
            if 0 <= nx < H and 0 <= ny < W:
                if S[x][y] != S[nx][ny] and A[nx][ny] == 0:
                    bfs(nx, ny, p, q)


for i, j in itertools.product(range(H), range(W)):
    bfs(i, j, i, j)
ans = 0
for i in count:
    ans += count[i].get('#', 0) * count[i].get('.', 0)
print(ans)


### FIXED CODE ###

import itertools
H, W = [int(_) for _ in input().split()]
S = [input() for _ in range(H)]
A = [[0 for _ in range(W)] for _ in range(H)]


def dfs(p, q):
    if A[p][q] == 1:
        return 0
    count = {'#': 0, '.': 0}
    stack = [[p, q]]
    while stack:
        x, y = stack.pop()
        if A[x][y] != 1:
            count[S[x][y]] += 1
            A[x][y] = 1
            dxy = [[-1, 0], [1, 0], [0, -1], [0, 1]]
            for dx, dy in dxy:
                nx, ny = x + dx, y + dy
                if 0 <= nx < H and 0 <= ny < W and S[x][y] != S[nx][ny]:
                    stack += [[nx, ny]]
    return count['#'] * count['.']


print(sum([dfs(i, j) for i, j in itertools.product(range(H), range(W))]))
a,b=map(int,inpput().split())
print(max(a+b,2*max(a,b)))


### FIXED CODE ###

a,b=map(int,input().split())
print(max(a+b,max(a,b)+max(a-1,b-1)))
a,b,c=map(int,input().split())
def gojo(x,y):
    if x%y==0:
        return y
    else:
        return gojo(y,x-y)

if c%gojo(a,b)!=0:
    print("NO")
else:
    print("YES")

### FIXED CODE ###

a,b,c=map(int,input().split())
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a
if c==0:
    print("YES")
elif c%gcd(a,b)==0 and c!=0:
    print("YES")
else:
    print("NO")
import sys
sys.setrecursionlimit(100000)

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    nCr[(n,r)]=nCr[(n,r)]%(10**9+7)
    return nCr[(n,r)]


def f(a,b):
    return cmb(a+b-1,b-1)

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

N,K=acinput()

B=K
R=N-K


for i in range(1,K+1):
    _B=B-i
    _R=R-i+1

    PB=f(_B,i)
    PR=f(_R,i+1)

    #print("b r",_B,_R)
    #print(PB,PR)
    print(int(PB*PR)%(10**9+7))



### FIXED CODE ###



import sys
sys.setrecursionlimit(40000)

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    nCr[(n,r)]=nCr[(n,r)]
    return nCr[(n,r)]


def f(a,b):
    #print(a,b)
    if b<0 or a<0:    
        return 0
    return cmb(a+b-1,b-1)

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

N,K=acinput()

B=K
R=N-K


for i in range(1,K+1):
    _B=B-i
    _R=R-i+1

    PR=f(_R,i+1)
    if PR>0:
        PB=f(_B,i)
    else:
        PB=1
    

    #print("b r",_B,_R)
    #print(PB,PR)
    print(int(PB*PR)%(10**9+7))
n, m = list(map(int, input().split()))
num = [-1] * n


for i in range(m):
    s, c = list(map(int, input().split()))
    if n > 1 and s == 1 and c == 0:
        print(-1)
        exit()
    elif num[s-1] != -1 and num[s-1] != c:
        print(-1)
        exit()
    else:
        num[s-1] = c

for i in range(m):
    if i == 0 and num[i] == -1:
        num[i] = 1
    elif num[i] == -1:
        num[i] = 0

print(int(''.join(list(map(str, num)))))


### FIXED CODE ###

n, m = list(map(int, input().split()))
num = [-1] * n


for i in range(m):
    s, c = list(map(int, input().split()))
    if n > 1 and s == 1 and c == 0:
        print(-1)
        exit()
    elif num[s-1] != -1 and num[s-1] != c:
        print(-1)
        exit()
    else:
        num[s-1] = c

for i in range(n):
    if i == 0 and num[i] == -1:
        if n == 1:
            num[i] = 0
        else:
            num[i] = 1

    elif num[i] == -1:
        num[i] = 0

print(int(''.join(list(map(str, num)))))
# 入力
N,L=map(int,input().split())

l=[]
for i in range(N):
  l.append(input())

# ソート
l.sort()

# 出力
print(''.join(l))

### FIXED CODE ###

# -*- coding: utf-8 -*-
A_B_C = list(map(int, input().split()))
A_B_C.sort()
if A_B_C == [5,5,7]:
    print('YES')
else:
    print('NO')
# -*- coding: utf-8 -*-

import math

n = int(input())
x = list(map(float, input().split()))
y = list(map(float, input().split()))
abs_xy = []

for i in range(n):
    abs_xy.append(abs(x[i] - y[i]))

d1 = sum(abs_xy)

d2 = 0
for i in range(n):
    d2 += abs_xy * abs_xy
d2 = math.sqrt(d2)

d3 = 0
for i in range(n):
    d3 += abs_xy * abs_xy * abs_xy
d3 = math.pow(d3, 1/3)

d = max(abs_xy)

print(d1)
print(d2)
print(d3)
print(d)


### FIXED CODE ###

# -*- coding: utf-8 -*-

import math

n = int(input())
x = list(map(float, input().split()))
y = list(map(float, input().split()))
abs_xy = []

for i in range(n):
    abs_xy.append(abs(x[i] - y[i]))

d1 = sum(abs_xy)

d2 = 0
for i in range(n):
    d2 += abs_xy[i] * abs_xy[i]
d2 = math.sqrt(d2)

d3 = 0
for i in range(n):
    d3 += abs_xy[i] * abs_xy[i] * abs_xy[i]
d3 = math.pow(d3, 1/3)

d = max(abs_xy)

print(d1)
print(d2)
print(d3)
print(d)
# -*- coding: utf-8 -*-
import logging
logging.basicConfig(level = logging.DEBUG,
                    format = " %(levelname)s - %(message)s")
logging.disable()

n, m = map(int, input().split())
p = ["" for _ in range(m)]
s = ["" for _ in range(m)]
for i in range(m):
    tmp = input().split()
    p[i] = int(tmp[0])
    s[i] = tmp[1]

isACed = [0 for _ in range(n)]

logging.debug("p: {}".format(p))
logging.debug("s: {}".format(s))
logging.debug("isACed: {}".format(isACed))

n_correct = 0
n_penalty = 0

for i in range(m):
    logging.debug("range({})開始".format(i))
    if isACed[p[i]-1] != 1:
        logging.debug("isACed[{}] != 1".format(p[i]-1))
        if s[i] == "AC":
            n_correct += 1

            #正解ラベルを付ける
            isACed[p[i]-1] = 1
        else: #"WA"の時
            n_penalty += 1
print(n_correct, n_penalty)


### FIXED CODE ###

# -*- coding: utf-8 -*-

n, m = map(int, input().split())
p = ["" for _ in range(m)]
s = ["" for _ in range(m)]
for i in range(m):
    tmp = input().split()
    p[i] = int(tmp[0])
    s[i] = tmp[1]

isACed = [[0,0] for _ in range(n)]

n_correct = 0
n_penalty = 0
for i in range(m):
    if isACed[p[i]-1][1] != 1:
        if s[i] == "WA": #"WA"の時
            isACed[p[i]-1][0] += 1
        else: #"AC"の時
            n_correct += 1
            isACed[p[i]-1][1] = 1
            n_penalty += isACed[p[i]-1][0]

print(n_correct, n_penalty)
N, X = map(int, input().split())
L = list(map(int, input().split()))

i = 0
D = 0

if L[0] > X:
    print(1)
    exit()

while D <= X and i <= N:
    D += L[i]
    i += 1

print(i)


### FIXED CODE ###

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

i = 0
D = 0
cnt = 1

for i in range(N):
    D += L[i]
    if D <= X:
        cnt += 1
print(cnt)
n, m = map(int, iput().split())
ans = (n-1)*(m-1)
print(ans))

### FIXED CODE ###

n, m = map(int, input().split())
ans = (n-1)*(m-1)
print(ans)
N= int(input())
X1 = N / 1.08
X = int(X1)
N_calc = int(X*1.08)
N_calc2 = int((X+1)*1.08)
if N_calc == N :
    print(X)
elif: N_calc2==N:
    print(X+1)
else :
    print(":(")

### FIXED CODE ###

N= int(input())
X1 = N / 1.08
X = int(X1)
N_calc = int(X*1.08)
N_calc2 = int((X+1)*1.08)
if N_calc == N :
    print(X)
elif N_calc2==N:
    print(X+1)
else :
    print(":(")
def BellmanFord(edges,num_v,source):
  dist=[float("inf") for i in range(num_v)]
  dist[source]=0
  
  for i in range(num_v):
    for edge in edges:
      if edge[0] != float("inf") and dist[edge[1]] > dist[edge[0]] + edge[2]:
        dist[edge[1]] = dist[edge[0]] + edge[2]
        if i==num_v-1: return -1
  
  return dist

N,M = map(int,input().split())
edges = []
edges2 = []
for i in range(M):
    a,b,c = map(int,input().split())
    edges.append([a-1,b-1,-c])
    edges2.append([a-1,b-1,c])

d  = BellmanFord(edges,N,0)
d2  = BellmanFord(edges2,N,0)
if d==-1:
    print("inf")
    exit()

for i in range(N):
    if d[i] == float("inf"):
        print("inf")
        exit()

print(max(-d[N-1],d2[N-1]))



### FIXED CODE ###

def BellmanFord(edges,num_v,source):
  dist=[float("inf") for i in range(num_v)]
  dist[source]=0
  
  for i in range(num_v):
    for edge in edges:
      if edge[0] != float("inf") and dist[edge[1]] > dist[edge[0]] + edge[2]:
        dist[edge[1]] = dist[edge[0]] + edge[2]
        if i==num_v-1 and edge[1] == N - 1:
            return -1
  
  return dist

N,M = map(int,input().split())
edges = []
for i in range(M):
    a,b,c = map(int,input().split())
    edges.append([a-1,b-1,-c])

d  = BellmanFord(edges,N,0)
if d==-1:
    print("inf")
    exit()

print(-d[N-1])
A,B,C,D=map(int,input().split())
if(A+B>C+D):
  print("Left")
elif(A+B==C+D):
  print("Balanced")
else:
  ptint("Right")

### FIXED CODE ###

A,B,C,D=map(int,input().split())
if(A+B>C+D):
  print("Left")
elif(A+B==C+D):
  print("Balanced")
else:
  print("Right")
import sys
N, L, T = [int(x) for x in input().strip().split(" ")]

xys = []
candidates = []
for line in sys.stdin:
    x, y = line.strip().split(" ")
    x, y = int(x), int(y)
    xys.append((x,y))
    candidates.append((x + (1 if y == 1 else -1) * T)%L)

x0, y0 = xys[0]

dxs = []
pr_x = None
counter = 0
for x, y in xys[1:]:
    if y != y0:
        if pr_x == None:
            if y0 == 1:
                a = (x - x0)
        else:
            dxs.append(x - pr_x)
        pr_x = x
        counter += 1
if y0 == 2:
    a = (L - pr_x) + x0

ree = (2*T)%L
num_round = (2*T)//L
ree = ree - a
if ree < 0:
    max_i = 0
else:
    for i, dx in enumerate(dxs if y0 == 1 else dxs[::-1]):
        ree = ree - dx
        if ree < 0:
            max_i = i + 1
            break
    else:
        max_i = counter

c_n = num_round * counter + max_i

rep = ( 
        ((1 if y0 == 1 else -1) * (c_n % N) % N),
        ((x0 + (1 if y0 == 1 else -1) * (T % L)) % L)
        )
result = []

candidates = sorted(candidates)

for i, c in enumerate(candidates):
    if c == rep[1]:
        start = i - rep[0]
        break

for j in range(N):
    if ree != 0:
        print(candidates[(start + j) % N])
    else:
        1/0


### FIXED CODE ###


import sys
N, L, T = [int(x) for x in input().strip().split(" ")]

xys = []
candidates = []
for line in sys.stdin:
    x, y = line.strip().split(" ")
    x, y = int(x), int(y)
    xys.append((x,y))
    candidates.append((x + (1 if y == 1 else -1) * T)%L)

x0, y0 = xys[0]

dxs = []
pr_x = None
counter = 0
for x, y in xys[1:]:
    if y != y0:
        if pr_x == None:
            if y0 == 1:
                a = (x - x0)
        else:
            dxs.append(x - pr_x)
        pr_x = x
        counter += 1

if pr_x == None:
    for x in candidates:
        print(x)
    sys.exit()
if y0 == 2:
    a = (L - pr_x) + x0

ree = (2*T)%L
num_round = (2*T)//L
ree = ree - a
if ree <= 0:
    max_i = 0
else:
    for i, dx in enumerate(dxs if y0 == 1 else dxs[::-1]):
        ree = ree - dx
        if ree <= 0:
            max_i = i + 1
            break
    else:
        max_i = counter

if ree == 0 and y0 == 2:
    max_i += 1

c_n = num_round * counter + max_i

rep = ( 
        ((1 if y0 == 1 else -1) * (c_n % N) % N),
        ((x0 + (1 if y0 == 1 else -1) * (T % L)) % L)
        )


candidates = sorted(candidates)

for i, c in enumerate(candidates):
    if c == rep[1]:
        start = i - rep[0]
        break

for j in range(N):
    print(candidates[(start + j) % N])
# -*- coding: utf-8 -*-
 
N = raw_input()
ans = 0
 
a = []
b = []
c = []
for i in range(N):
    a.append(map(int, raw_input().split()))
for i in range(N):
    b.append(map(int, raw_input().split()))
for i in range(N):
    c.append(map(int, raw_input().split()))
    
for i in range(N-1)
	if a[N] - a[N+1] = 1
  		ans += c[N]
ans += sum(b)
 
print(int(ans))

### FIXED CODE ###

# -*- coding: utf-8 -*-

N = int(raw_input())

C = N*N*N

print(C)
n=int(input())
d={AC:0,RE:0,WA:0,TLE:0}
for i in range(n):
    s=input().strip()
    d[s]=d[s]+1
print('AC x '+str(d[AC]))
print('WA x '+str(d[WA]))
print('TLE x '+str(d[TLE]))
print('RE x '+str(d[RE]))


### FIXED CODE ###

n=int(input())
d={'AC':0,'RE':0,'WA':0,'TLE':0}
for i in range(n):
    s=input().strip()
    d[s]=d[s]+1
print('AC x '+str(d['AC']))
print('WA x '+str(d['WA']))
print('TLE x '+str(d['TLE']))
print('RE x '+str(d['RE']))
N = int(input())
S = [input() for i in range(N)]

S_first = [S[i][0] for i in range(N)]
march = ['M','A','R','C','H']
march_number = [0]*5

for i in range(N):
    march_number[i] = S_first.count(march[i])

import itertools
ptr = list(itertools.combinations(march_number,3))

ans = 0
seki = 1

for i in range(len(ptr)):
    for j in range(3):
        seki *= ptr[i][j]
    ans += seki
    seki = 1

print(ans)

### FIXED CODE ###

N = int(input())
S = [input() for i in range(N)]

S_first = [S[i][0] for i in range(N)]
march = ['M','A','R','C','H']
march_number = [0]*5

for i in range(5):
    march_number[i] = S_first.count(march[i])

import itertools
ans = 0
for v in itertools.combinations(march_number,3):
    ans += v[0]*v[1]*v[2]
print(ans)
s="Christmas"
for i in range(25-int(input()):
  s += " Eve"
print(s)

### FIXED CODE ###

s="Christmas"
for i in range(25-int(input())):
  s += " Eve"
print(s)
import numpy as np
from collections import defaultdict
import sys

read = sys.stdin.buffer.read
INF = 10 ** 6 + 1
is_prime = [1] * INF

def eratorasu():
    is_prime[0] = 0
    is_prime[1] = 0
    for i in range(2, INF):
        if is_prime[i] == 0:
            continue
        for j in range(i * 2, INF, i):
            is_prime[j] = 0
    return

def f(n):
    yakusu = []
    if is_prime[n]:
        yakusu.append(n)
    else:
        for i in range(2, int(n ** 0.5) + 1):
            if n % i == 0:
                yakusu.append(i)
                if i != n //i:
                    yakusu.append(n // i)
                break

    for i in yakusu:
        if i != 1:
            d[i] += 1


eratorasu()
d = defaultdict(int)
N = int(input())
A = np.array(read().split(), np.int64)[1:]

for i in range(N):
    f(A[i])

cnt = 1
for i, v in d.items():
    if v != 1:
        cnt = max(cnt, v)

if cnt == N:
    print('not coprime')
elif cnt == 1:
    print('pairwise coprime')
else:
    print('setwise coprime')


### FIXED CODE ###

from collections import defaultdict
import math

INF = 10 ** 6 + 1
is_prime = [1] * INF

def eratorasu():
    is_prime[0] = 0
    is_prime[1] = 0
    for i in range(2, INF):
        if is_prime[i] == 0:
            continue
        for j in range(i * 2, INF, i):
            is_prime[j] = 0
    return

def f(n):
    yakusu = []
    if is_prime[n]:
        yakusu.append(n)
    else:
        for i in range(2, int(n ** 0.5) + 1):
            if n % i == 0:
                yakusu.append(i)
                if i != n //i:
                    yakusu.append(n // i)
                break

    for i in yakusu:
        if i != 1:
            d[i] += 1

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

tmp = A[0]
for i in range(1, N):
    tmp = math.gcd(tmp, A[i])
    f(A[i])

if tmp != 1:
    print('not coprime')
    exit()
eratorasu()
f(A[0])

for i, v in d.items():
    if v != 1:
        print('setwise coprime')
        exit()

print('pairwise coprime')
x,a,b=map(int,input().split())
if b-a<x:
    print('delicious')
elif b-a=x:
    print('safe')
else:
    print('dangerous')

### FIXED CODE ###

x,a,b=map(int,input().split())
if b-a<=x:
    if b-a<=0:
        print('delicious')
    else:
        print('safe')
else:
    print('dangerous')
#include <bits/stdc++.h>
using namespace std;

int main() {
  string s;
  cin >> s;

  if (s <= "2019/04/30") {
    cout << "Heisei" << endl;
  } else {
    cout << "TBD" << endl;
  }
}


### FIXED CODE ###

def main():
    s = input()
    
    m = int(s[5]+s[6])
    d = int(s[8]+s[9])

    if m < 4:
        print("Heisei")
    elif m == 4 and d <= 30:
        print("Heisei")
    else:
        print("TBD")




if __name__ == '__main__':
    main()
N,K = map(int,input().split())
A = list(map(int,input().split()))

inf = 10 ** 18

for i in range(1,inf):
  N -= (K - 1)a
  if N <= 1:
    print(i)
    break
  

### FIXED CODE ###

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

inf = 10 ** 18

for i in range(1,inf):
  N -= (K - 1)
  if N <= 1:
    print(i)
    break
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = sorted(list(zip(b, a)))
 
a.sort()
b.sort()
for i in range(n):
  if a[i] > b[i]:
    print('No')
    exit()
    
fir, las = {}, {}
s = [0] * n
for i in range(n):
  fir[a[i]] = min(fir.get(a[i], n), i)
  las[a[i]] = max(las.get(a[i], 0), i)
  if i > 0 and a[i] <= b[i - 1]:
    s[i] = 1
for i in range(1, n):
  s[i] += s[i - 1]
 
for i, (x, y) in enumerate(l):
  if x >= y:
    if y >= a[i] or s[fir[x]] - s[las[y]] == fir[x] - las[y]:
      print('Yes')
      exit()
 
print('No')

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = list(zip(b, a))
 
a.sort()
b.sort()
for i in range(n):
  if a[i] > b[i]:
    print('No')
    exit()

ptr, pos = {}, {}
for i in range(n):
  if i > 0 and a[i] <= b[i - 1]:
    print('Yes')
    exit()
  ptr[l[i][1]] = l[i][0]
  pos[b[i]] = i

sta, now, cnt = a[0], a[0], 1
while True:
  now = a[pos[ptr[now]]]
  if now == sta:
    break
  cnt += 1
if cnt == n:
  print('No')
else:
  print('Yes')
import os

def main():
	n = int(input())
	list_a = make_divisors(n)
	min_num = 1000000000000
	for i in range(0,len(list_a),2):
		if min_num < (list_a[i] + list_a[i+1] - 2):
			pass
		else:
			min_num = list_a[i] + list_a[i+1] - 2
	print(min_num)
	
			


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

	
if __name__ == "__main__":
	main()


### FIXED CODE ###

import os

def main():
	n = int(input())
	list_a = make_divisors(n)
	min_num = 1000000000000
	for i in range(0,len(list_a),2):
		if n//list_a[i] == list_a[i]:
			min_num = list_a[i] * 2 - 2
			break
		if min_num < (list_a[i] + list_a[i+1] - 2):
			pass
		else:
			min_num = list_a[i] + list_a[i+1] - 2
	print(min_num)
	
			


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

	
if __name__ == "__main__":
	main()
h,w = int(input())
Array = [list(map(int, input().split())) for _ in range(h)]
dx = [1,1,0,-1,-1,-1,0,1]
dy = [0,1,1,1,0,-1,-1,-1]
for i in range(h):
  for j in range(w):
    if Array[i][j]='#':
      continue
      
    num=0
    for d in range(8):
      ni = i+dx[d]
      nj = j+dj[d]
      if ni<0 or h<=ni:
        continue
      if nj<0 or w<=nj:
        continue
      if Array[ni][nj]=='#':
        num=num+1
        
    Array[i][j]=char(num + '0')
    
for i in Array:
  print(*Array)

### FIXED CODE ###

h,w = map(int,input().split())
Array = [list(map(str,input())) for _ in range(h)]
dx = [1,1,0,-1,-1,-1,0,1]
dy = [0,1,1,1,0,-1,-1,-1]
for i in range(h):
  for j in range(w):
    if Array[i][j]=='#':
      continue
    num=0
    for d in range(8):
      ni = i+dy[d]
      nj = j+dx[d]
      if ni<0 or h<=ni:
        continue
      if nj<0 or w<=nj:
        continue
      if Array[ni][nj]=='#':
        num=num+1
    Array[i][j]=str(num)
    
for i in Array:
  print(*i, sep='')