Harryxun/stf_run huggingface dataset:
import sys
readline = sys.stdin.readline

K = int(readline())
S = readline().rstrip()
S = len(S)
N = K + S

DIV = 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 ) % DIV )
    inverse.append( ( -inverse[DIV % i] * (DIV//i) ) % DIV )
    g2.append( (g2[-1] * inverse[-1]) % DIV )

def nCr(n, r, DIV):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % DIV

# K = 3, S = 5のとき
# ..X.X.X.
# Xが取る3か所を選んだ上で、
# 最も右のXよりも右のマス：各26通り
# 最も右のXを含む、それより左のマス：Xのマスは1通り、それ以外は各25通り
# 最も右のXが
# ..X.....　の状態から、
# .......X  
# の状態について、場合の数を求める

ans = 0
for xpos in range(S, N + 1):
  # xpos箇所からK箇所を選ぶ場合の数
  # 一番右に1個固定した状態で、残りのxpos - 1か所からS - 1個を選ぶ
  pat = nCr(xpos - 1, S - 1, DIV)
  # その場合の数に対して、X以外の文字の選び方は25 ** (X - S)通りある
  pat *= pow(25, xpos - S, DIV)
  pat %= DIV
  
  # 残りのマスに対しては26通りずつ選べる
  pat *= pow(26, N - xpos, DIV)
  pat %= DIV
  
  ans += pat
  ans %= DIV

print(ans)


### FIXED CODE ###

import sys
readline = sys.stdin.readline

K = int(readline())
S = readline().rstrip()
S = len(S)
N = K + S

DIV = 10 ** 9 + 7
n = (10 ** 6) * 5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

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

def nCr(n, r, DIV):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % DIV

# K = 3, S = 5のとき
# ..X.X.X.
# Xが取る3か所を選んだ上で、
# 最も右のXよりも右のマス：各26通り
# 最も右のXを含む、それより左のマス：Xのマスは1通り、それ以外は各25通り
# 最も右のXが
# ..X.....　の状態から、
# .......X  
# の状態について、場合の数を求める

ans = 0
for xpos in range(S, N + 1):
  # xpos箇所からK箇所を選ぶ場合の数
  # 一番右に1個固定した状態で、残りのxpos - 1か所からS - 1個を選ぶ
  pat = nCr(xpos - 1, S - 1, DIV)
#  print("xpos",xpos,"ncr",ncr)
#  print(S,"from",xpos,"pat",pat)
  # その場合の数に対して、X以外の文字の選び方は25 ** (X - S)通りある
#  print("25 for",xpos - S,"boxes")
  pat *= pow(25, xpos - S, DIV)
  pat %= DIV
  
  # 残りのマスに対しては26通りずつ選べる
#  print("26 for ",N - xpos,"boxes")
  pat *= pow(26, N - xpos, DIV)
  pat %= DIV
#  print("xpos",xpos,"pat",pat)
  
  ans += pat
  ans %= DIV

print(ans)
a, b = map(int, input().split())
c = a * b
d = c % 2
if d = 0:
    print('Even')
else:
    print('Odd')

### FIXED CODE ###

a, b = map(int, input().split())
c = a * b
d = c % 2
if d == 0:
    print('Even')
else:
    print('Odd')
import math

a=int(input())
b=int(input())
h=int(input())
m=int(input())
t=360*h+m/60-30*h-m/720
ans2=a**2+b**2-math.cos(math.radians(t))

### FIXED CODE ###

import math

a,b,h,m=map(int,input().split())
t=360*h+m*6-30*h-m/2
ans2=a**2+b**2-2*a*b*math.cos(math.radians(t))
print(math.sqrt(ans2))
from math import ceil

n,h=map(int,input().split())
a=[]
b=[]
ans=0

for i in range(n):
  aa,bb=map(int,input().split())
  a.append(aa)
  b.append(bb)

b.sort()

pin=max(a)

while True:
  p=b.pop()
  if p<pin:
    break
  ans+=1
  h-=p

ans+=ceil(h/pin)


print(ans)

### FIXED CODE ###

import sys
import math
input=sys.stdin.readline

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

once=[]
infinity=[]

for i in range(n):
  a,b=map(int,input().split())
  once.append(b)
  infinity.append(a)
  
once.sort(reverse=True)

pin=max(infinity)

once2=[]
for i in range(n):
  if once[i]>pin:
    once2.append(once[i])
  
  else:
      break

ans=0
for i in once2:
    ans+=1
    h-=i
    if h<=0:
        print(ans)
        exit()

ans+=math.ceil(h/pin)


print(ans)
n = 6;
a = [input() for i in range(n)]

k = a[-1];
ans = "Yay!";

for i in range(n-1):
	for j in reversed(range(n-1)):
  		if k < a[i] - a[j]:
  			ans = ":( ";
  			break;

print ans;

### FIXED CODE ###

n = 6;
a = [input() for i in range(n)];
 
k = a[-1];
ans = "Yay!";
 
for i in range(n-1):
  for j in reversed(range(n-1)):
    if k < a[i] - a[j]:
      ans = ":( ";
      break;
print ans;
s = sorted(input())
t = sorted(input())
t_reverse = t[::-1]
if s < t_reverse:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a, b = map(int, input().split())
c = (a + b) % 2
d = (a + b) // 2

if c == 0:
  print(d)
else:
  print(d+1)
a = int(input())
b = int(input())
print((a*b)//2)


### FIXED CODE ###

a,b,c = map(int,input().split())
print(a*b//2)
a = input().replace("S", " S").replace("H", " H").replace("D", " D").replace("C", " C").split()
m, s, h, d, c = [], [], [], [], []
ans = []
for i in range(len(a)):
    if a[i][1] in ["2", "3", "4", "5", "6", "7", "8", "9"]:
        m.append(i)
    else:
        if a[i][0] == "S":
            s.append(i)
            if len(s) == 5:
                ans = s
                break
        elif a[i][0] == "H":
            h.append(i)
            if len(h) == 5:
                ans = h
                break
        elif a[i][0] == "D":
            d.append(i)
            if len(d) == 5:
                ans = d
                break
        else:
            c.append(i)
            if len(c) == 5:
                ans = c
                break
ch = 0
d = ""
for i in ans:
    d += "".join(a[ch:i])
    ch = i+1
if d == "":
    print(0)
else:
    print(d)

### FIXED CODE ###

s = list(input())
k = int(input())
n = len(s)
map = {(chr(ord("a") + i)): (26-i)%26 for i in range(26)}
for i in range(n):
    if k >= map[s[i]]:
        k -= map[s[i]]
        s[i] = "a"
if k > 0:
    s[n-1] = chr((ord(s[n-1])+k%26)%123)
print("".join(s))
# ハッシュで数えてキーでソートして+-1を全探索
n = int(input())
arr = list(map(int, input().split()))
hash = dict()
for a in arr:
    if a in hash:
        hash[a] += 1
    else:
        hash[a] = 1

lis = list(sorted(hash.items(), key=lambda x: x[0]))

ans = 0
for i in range(1, n - 2):
    temp = lis[i][1]
    if lis[i - 1][0] + 1 == lis[i][0]:
        temp += lis[i - 1][1]
    if lis[i + 1][0] - 1 == lis[i][0]:
        temp += lis[i + 1][1]
    ans = max(ans, temp)

print(ans)


### FIXED CODE ###

# ハッシュで数えてキーでソートして+-1を全探索
# と思ったけど登場してないやつでもいける 3 5 なら4が2個になるのでN個から全探索

n = int(input())
arr = list(map(int, input().split()))
lis = [0 for _ in range(10**5+1)]
hash = dict()
for a in arr:
    lis[a] += 1

ans = 1
for i in range(1, 10**5):
    ans = max(ans, lis[i-1]+lis[i]+lis[i+1])

print(ans)
arr = input().split()
h=int(arr[0])
w=int(arr[1])

if w%2!=0:
    if h%2!=0:
        ans=(w+1)//2*(h+1)//2+(w-1)//2*(h-1)//2
    else:
        ans=(w+1)//2*h//2+(w-1)//2*h//2
else:
    ans=w//2*h
print(ans)

### FIXED CODE ###

arr="1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51"
list=arr.split(", ")

k=int(input())
print(list[k-1])
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LLI(): return [int(x) for x in sys.stdin.readlines()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
from bisect import bisect_left

def main():
    N, Q = LI()
    XST = []
    for _ in range(N):
        s, t, x = LI()
        XST.append([x, s, t])
    XST.sort()
    D = LLI()
    ans = [-1] * Q
    skip = [0] * Q
    for x, s, t in XST:
        i = bisect_left(D, s - x)
        end = bisect_left(D, t - x)
        while i < end:
            while skip[i] != 0:
                i += skip[i]
                if i > end:
                    break
            ans[i] = x
            skip[i] = end - i
            i += 1
    for y in ans:
        print(y)
    return

main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()
from bisect import bisect_left

def main():
    N, Q = LI()
    XST = []
    for _ in range(N):
        s, t, x = LI()
        s -= x
        t -= x
        XST.append([x, s, t])
    D = []
    for _ in range(Q):
        D.append(II())
    ans = [-1] * Q
    nexts = [-1] * Q
    XST.sort()
    for x, s, t in XST:
        i = bisect_left(D, s)
        end = bisect_left(D, t)
        while i < end:
            if nexts[i] == -1:
                ans[i] = x
                nexts[i] = end
                i += 1
            else:
                i = nexts[i]
    for y in ans:
        print(y)
    return

main()
#小さいCから変更
n = int(input())
c = list(map(int, input().split( )))

c.sort()

#i　bit目が違うようなs,tは 2**(2*n-2)*2通り
sm = 0
for i in range(n):
    sm += (n-i)*c[i]

sm *= pow(2,2*n-2,10**9+7)

print(sm)

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

if 500*k>=x:
    print("Yes")
else:
    print("No")

### FIXED CODE ###


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

if 500*k>=x:
    print("Yes")
else:
    print("No")
N, M = map(int, input().split())

ac = [False] * N
wa = [0] * N
for _ in range(M):
   p, S = input().split()
   p = int(p) - 1
   if (S == 'AC'):
      ac[p] = True
   else:
   if not ac[p]:
      wa[p] += 1

a = 0
b = 0
for i in range(N):
   if ac[i]:
      a += 1
      b += wa[i]
      print(*[a, b])


### FIXED CODE ###

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

ac = [False] * N
wa = [0] * N
for _ in range(M):
   p, S = input().split()
   p = int(p) - 1
   if (S == 'AC'):
      ac[p] = True
   else:
      if not ac[p]:
         wa[p] += 1

a = 0
b = 0
for i in range(N):
   if ac[i]:
      a += 1
      b += wa[i]
print(*[a, b])
n=int(input())
w1=list(input())
s="S"
w="W"
o="o"
x="x"
l=[[s,s],[s,w],[w,w],[w,s]]
for j in range(4):
    for i in range(1,n):
        if w1[i]==o:
            if l[j][-1]==s:
                if l[j][-2]==s:
                    l[j].append(s)
                else:
                    l[j].append(w)
            else:
                if l[j][-2]==s:
                    l[j].append(w)
                else:
                    l[j].append(s)
        else:
            if l[j][-1]==s:
                if l[j][-2]==s:
                    l[j].append(w)
                else:
                    l[j].append(s)
            else:
                if l[j][-2]==s:
                    l[j].append(s)
                else:
                    l[j].append(w)
for i in range(4):
  if l[i][0]==l[i][-1]:
    del l[i][-1]
    answer=l[i]
    b=True
    break
if not b:
    print(-1)
else:
    print("".join(answer))

### FIXED CODE ###

n=int(input())
w1=list(input())
s="S"
w="W"
o="o"
x="x"
l=[[s,s],[s,w],[w,w],[w,s]]
for j in range(4):
    for i in range(1,n):
        if w1[i]==o:
            if l[j][-1]==s:
                if l[j][-2]==s:
                    l[j].append(s)
                else:
                    l[j].append(w)
            else:
                if l[j][-2]==s:
                    l[j].append(w)
                else:
                    l[j].append(s)
        else:
            if l[j][-1]==s:
                if l[j][-2]==s:
                    l[j].append(w)
                else:
                    l[j].append(s)
            else:
                if l[j][-2]==s:
                    l[j].append(s)
                else:
                    l[j].append(w)
b=False
for i in range(4):
  if l[i][0]==l[i][-1] and not b:
    del l[i][-1]
    if l[i][0]==s:
      if (l[i][1]==l[i][-1] and w1[0]==o) or (l[i][1]!=l[i][-1] and w1[0]==x):
        answer=l[i]
        b=True
        break
    else:
      if (l[i][1]!=l[i][-1] and w1[0]==o) or (l[i][1]==l[i][-1] and w1[0]==x):
        answer=l[i]
        b=True
        break
if not b:
    print(-1)
else:
    print("".join(answer))
import numpy as np
n, k = map(int, input().split())
h = np.array(list(map(int, input().split())))

dp = np.full_like(h, 10**9)
dp[0] = 0

for i in range(n-1):
    for j in range(1, k+1):
        if i+j < n:
            dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]))
print(dp[-1])


### FIXED CODE ###

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

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

for i in range(n-1):
    for j in range(1, k+1):
        if i+j < n:
            dp[i+j] = min(dp[i+j], dp[i]+abs(h[i]-h[i+j]))
print(dp[-1])
a, b = input().split(' ')
diff = int(b) - int(a)
a_orig = sum([i for i in range(1, diff)])
snow = a_orig - a
print(snow)

### FIXED CODE ###

a, b = input().split(' ')
a, b = int(a), int(b)
diff = b - a
a_orig = sum([i for i in range(1, diff)])
snow = a_orig - a
print(snow)
n = input()
d = [int(input()) for i in range(n)]
print(len(set(d)))

### FIXED CODE ###

n = int(input())
d = [input() for i in range(n)]
print(len(set(d)))
yen = map(int, input().slice(" "))
if yen[0] * 500 >= yen[1]:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

k,x = map(int, input().split())
if(k * 500 >= x):
    print("Yes")
else:
    print("No")
K=int(input())
A=int(input())
B=int(input())
if B-A>=7:
  print("OK")
elif K=="1":
  print("OK")
else:
  print("NG")

### FIXED CODE ###

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

if B%K == 0 or A%K == 0:
    print("OK")

elif X == 0 :
    print("NG")

else :
    print("OK")
n = int(input())

meal_price = n * 15
meal_discount_count = n // 15

return meal_price - (meal_discount_count * 200)

### FIXED CODE ###

n = int(input())
  
meal_price = n * 800
meal_discount_count = n // 15
  
print (meal_price - (meal_discount_count * 200))
N, D = map(int,input().split())
P = [list(map(int,input().split())) for i in range(M)]
ans = 0
for i in range(N):
    num = P[N]
    X , Y = num
    if X*X + Y*Y <= D*D:
        ans += 1
print(ans)


### FIXED CODE ###

N, D = map(int, input().split())
ans = 0
for l in range(N):
    X , Y = map(int,input().split())
    if X*X + Y*Y <= D*D:
        ans += 1
print(ans)
a,b = map(int, input().split())

if (a+b)%2 == 0:
    print((a+b)/2)
else
    print("IMPOSSIBLE")

### FIXED CODE ###

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

if (a+b)%2 == 0:
    print(int((a+b)/2))
else:
    print("IMPOSSIBLE")
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra

N, M = map(int, input().split())
edge = np.array([input().split() for _ in range(M)], dtype = np.int64).T
ones = np.ones(M)
graph = csr_matrix((ones, (edge[:2] - 1)), (N, N))


distance_mat, processors = dijkstra(graph, directed = False, indices = 0, return_predecessors = True)

processors = processors + 1

'''
print ('点0からの最短距離')
print (distance_mat)


print ('各点の直前の点')
print (processors)
'''

print('Yes')
for i in range(1,N):
    print(processors[i])

### FIXED CODE ###

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

dist = [-1] * (N+1)
dist[1] = 0
connection = [[] for _ in range(N+1)]
ans = [-1] * (N+1)

for quel in range(M):
    a, b = map(int, input().split())
    connection[a].append(b)
    connection[b].append(a)

que = []
que.append(1)

while que:
    v = que.pop(0)

    for i in connection[v]:
        if dist[i] != -1:continue

        dist[i] = dist[v] + 1
        que.append(i)
        ans[i] = v

#print(dist)
print('Yes')
for j in range(2, N+1):
    print(ans[j])
n, k = map(int, input().split())
a = [i-1 for i in list(map(int, input().split()))]

l = []
used = [0 for _ in range(n)]

c = 0
flag = True
while 1:
    if flag:
        flag = False
    else:
        l.append(c)
    if used[c] == 1 and l:
        break
    used[c] = 1
    c = a[c]

p = 0
for i in range(len(l)):
    if l[i] == l[-1]:
        l = l[i:-1]
        p = i
        break

print(l[(k-p)%len(l)-1]+1)


### FIXED CODE ###

n, k = map(int, input().split())
a = [i-1 for i in list(map(int, input().split()))]

l = []
used = [0 for _ in range(n)]

c = 0
flag = True
while 1:
    if not flag:
        l.append(c)
    if used[c] == 1 and l:
        break
    if not flag:
        used[c] = 1
    c = a[c]
    flag = False

p = 0
length = len(l)
b = []
for i in range(length):
    if l[i] == l[-1]:
        b = l[:i]
        l = l[i:-1]
        p = i
        break


if len(b) >= k:
    print(b[k - 1]+1)
else:
    print(l[(k - p - 1) % len(l)] + 1)
N = int(input())
x = [0] * (N + 1)
y = [0] * (N + 1)
for i in range(1, N + 1):
    t[i], x[i], y[i] = map(int, input().split())
for i in range(1, N + 1):
    if t[i] - t[i - 1] < abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]):
        print('No')
        exit()
    elif t[i] % 2 != (x[i] + y[i]) % 2:
        print('No')
        exit()
print('Yes')

### FIXED CODE ###

N = int(input())
t = [0] * (N + 1)
x = [0] * (N + 1)
y = [0] * (N + 1)
for i in range(1, N + 1):
    t[i], x[i], y[i] = map(int, input().split())
for i in range(1, N + 1):
    if t[i] - t[i - 1] < abs(x[i] - x[i - 1]) + abs(y[i] - y[i - 1]):
        print('No')
        exit()
    elif t[i] % 2 != (x[i] + y[i]) % 2:
        print('No')
        exit()
print('Yes')
import numpy as np
n, wt = map(int, input().split())
 
d = np.full(n*10**7+1,wt+1, 'i8')
d[0] = 0
for _ in range(n):
  w, v = map(int, input().split())
  d[v:] = np.minimum(d[v:], d[:-v]+w)
print(np.max(np.where(d<=wt)))

### FIXED CODE ###

import numpy as np
n, W = map(int, input().split())
dp = np.zeros(W+1,'i8')

for i in range(n):
  w, v = map(int, input().split())
  dp[w:] = np.maximum(dp[w:], dp[:-w]+v)
print(dp[-1])
line = trim(input(STDIN))
line = line.split(' ')
A = line[0]
B = line[1]
ans = 0
ans = max(ans, A + A - 1)
ans = max(ans, A + B)
ans = max(ans, B + B - 1)
print(ans)


### FIXED CODE ###

line = input().strip()
line = line.split(' ')
A = int(line[0])
B = int(line[1])
ans = 0
ans = max(ans, A + A - 1)
ans = max(ans, A + B)
ans = max(ans, B + B - 1)
print(ans)
S = input()
if len(set(S[0], S[1], S[2])) == 3:
    print("Yes")
else:
    pritn("No")


### FIXED CODE ###

S = input()
if len(set((S[0], S[1], S[2]))) == 3:
    print("Yes")
else:
    print("No")
N, M, Q = map(int, input().split())
abcd = []
ans = 0
for i in range(Q):
  abcd.append(input())
for X in intertools.conbinations_with_replacemant(range(1, M + 1), N):
  tmp = 0
  for z in abcd:
    a, b, c, d = map(int, z.split())
    if X[b - 1] - X[a - 1] == c:
      tmp += d
  ans = max(ans, tmp)
print(ans)

### FIXED CODE ###

import itertools
N, M, Q = map(int, input().split())
abcd = []
ans = 0
for i in range(Q):
  abcd.append(input())
for X in itertools.combinations_with_replacement(range(1, M + 1), N):
  tmp = 0
  for z in abcd:
    a, b, c, d = map(int, z.split())
    if X[b - 1] - X[a - 1] == c:
      tmp += d
  ans = max(ans, tmp)
print(ans)
import math
import copy
import sys


inputa = input().split()
inputb = input().split()
# inputc = input().split()

a = int(inputa[0])
b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

# inputaList = [int(n) for n in inputa]

# inputb = input().split()
# inputbList = [int(n) for n in inputb]
#
# inputList = []
# inputNumList = []
# for i in range(a):
#     inputNum = input()
#     inputNumList = list(inputNum)
#     inputList.append(inputNumList)

# inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

if a == 0:
    print(b)
else:
    ans = a * 100 * b
    print(ans)




### FIXED CODE ###

import math
import copy
import sys


inputa = input().split()
# inputb = input().split()
# inputc = input().split()

a = int(inputa[0])
b = int(inputa[1])
# c = int(inputa[2])

# x = int(inputb[0])
# y = int(inputb[1])

# inputaList = [int(n) for n in inputa]

# inputb = input().split()
# inputbList = [int(n) for n in inputb]
#
# inputList = []
# inputNumList = []
# for i in range(a):
#     inputNum = input()
#     inputNumList = list(inputNum)
#     inputList.append(inputNumList)

# inputList = [int(n) for n in inputList]

# b = [int(n) for n in inputb]
# c = [int(n) for n in inputc]

if b == 100:
    ans = pow(100, a) * (b + 1)
else:
    ans = pow(100, a) * b
print(int(ans))
S = input(str())
W = input(str())

if S > W:
    print('safe')

elif S < W:
    print('unsafe')

### FIXED CODE ###

s, w = list(map(int, input().split()))

if w >= s:
    print("unsafe")
else:
    print("safe")
n=int(input())
result=100000000000000000000000000
for i in range(n):
  nn=n/i
  if (nn.is_integer() and result>nn+i-2):
	result=nn+i-2
print(result)
    
    

### FIXED CODE ###

n = int(input())
list=[]
for i in range(1,int(n**0.5+1)):
  if n%i == 0:
    list.append(int(i+n/i))
print(min(list)-2)
# ABC081C - Not so Diverse (ARC086C)
from collections import Counter


def main():
    N, K, *A = map(int, open(0).read().split())
    C = Counter(A).values()
    C.sort(reverse=1)
    ans = sum(C[K:])
    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

# ABC081C - Not so Diverse (ARC086C)
n, k = list(map(int, input().rstrip().split()))
lst = sorted(list(map(int, input().rstrip().split())))
dic = {}
for i in lst:
    if i not in dic:
        dic[i] = 1
    else:
        dic[i] += 1

cnt = sorted([i for i in dic.values()], reverse=True)
ans = 0
for i in range(len(cnt)):
    if k > 0:
        k -= 1
        continue
    ans += cnt[i]
print(ans)
N = int(input())%10;
if(N == 2 or N == 4 or N == 5 or N ==7 or N== 9)
    print(hon)
elif(N == 0 or N ==1 or N ==8 or N ==6) 
    print(pon)
else
    print(bon);

### FIXED CODE ###

N = int(input())%10
yomi = {0:"pon",1:"pon",2:"hon",3:"bon",4:"hon",5:"hon",6:"pon",7:"hon",8:"pon",9:"hon"}
print(yomi[N])
import numpy as np

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

a = np.arange(L, R + 1)

# print(a)

a %= 2019

a.sort()

print(a[0] * a[1])

### FIXED CODE ###

import numpy as np

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

min_ = np.inf
for i in range(L, R):
    for j in range(i + 1, R + 1):
        if (i * j) % 2019 <= min_:
            min_ = (i * j) % 2019
            if min_ == 0:
                print(min_)
                exit()

print(min_)
N = int(input())
G = [[] for _ in range(N+1)]
for _ in range(N-1):
    a, b, c = map(int, input().split())
    G[a].append((b, c))
    G[b].append((a, c))
Q, K = map(int, input().split())


d = [-1]*(N+1)


def dfs(v, c):
    d[v] = c
    for nv, cost in G[v]:
        if d[nv] == -1:
            dfs(nv, cost+c)

dfs(K, 0)

for _ in range(Q):
    x, y = map(int, input().split())
    print(d[x]+d[y])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
N = int(input())
G = [[] for _ in range(N+1)]
for _ in range(N-1):
    a, b, c = map(int, input().split())
    G[a].append((b, c))
    G[b].append((a, c))
Q, K = map(int, input().split())


d = [-1]*(N+1)


def dfs(v, c):
    d[v] = c
    for nv, cost in G[v]:
        if d[nv] == -1:
            dfs(nv, cost+c)

dfs(K, 0)

for _ in range(Q):
    x, y = map(int, input().split())
    print(d[x]+d[y])
x = input()
n = int(x[0]) * 5
k = int(x[1:3])
if k <= n:
    print(1)
else:
    print(0)


### FIXED CODE ###

x = int(input())
ans = 0
if x < 100:
    ans = 0
else:
    n = (x // 100) * 5
    k = x % 100
    if k <= n:
        ans = 1
    else:
        ans = 0

print(ans)