peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import math
minimum = 10**14
def prime_divisors(X):
    L=[]
    for i in range(2,math.floor(X**0.5)):
        if X % i == 0:
            L.append(i)
    return L
N = int(input())
L = prime_divisors(N)
L.append(1)
for prime in L:
    if (prime-1 + N//prime - 1) < minimum:
        minimum = (prime-1 + N//prime - 1)
print(minimum)
# Judge status: Accepted
n=int(input())
s=input()
if n%2==1:
  print("No")
else:
  if s[0:(n//2)]==s[n//2:(n+1)]:
    print ("Yes")
  else:
    print("No")
# Judge status: Accepted
X,Y = map(int,input().split())
print(int(X + Y/2))
# Judge status: Accepted
n, m = map(int,input().split())
if m >= 3 and n >= 3:
    print((m-2) * (n-2))
elif (m == 2 or n == 2):
    print(0)
elif m >= 3 or n >= 3:
    print((max(m,n)-2) * min(m,n))
else:
    if (m * n) % 2 == 0:
        print(0)
    else:
        print(m * n)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
D, T, S = map(int, input().split())
#print(D, T, S)
t = D/S
if t <= T:
	print('yes')
else:
	print('no')
# Judge status: Accepted
# -*- coding: utf-8 -*-

D = int(input())
c = [int(i) for i in input().split()]
s = []
for i in range(D):
    s.append([int(j) for j in input().split()])

for i, s_i in enumerate(s):
    print(s_i.index(max(s_i)) + 1)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-

N=int(input())
C=input()

J=0
ans=0
for i in range(N):
    if C[i]=="W":
        for j in range(J,N):
            if i+j>N:break
            if C[N-1-j]=="R":
                ans+=1
                #print(i,N-1-j)
                J=j+1
                break

    if i+J>N:break
    
print(ans)
# Judge status: Wrong Answer
n,a,b,c,d=map(int,input().split())
s=input()
if c<d:
    print("No" if "##" in s[a-1:d] else "Yes")
else:
    print("Yes" if "##" not in s[a-1:c] and "..." in s[a-1:c] else "No")
# Judge status: Accepted
n,m=map(int,input().split())
l=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  l[a-1]+=1
  l[b-1]+=1
for i in range(n):
  print(l[i])
# Judge status: Accepted
x = int(input())
ans = 8
max = 599
min = 400
while True:
  if min <= x <= max:
    print(ans)
    break
  else:
    max += 200
    min += 200
    ans -= 1
# Judge status: Wrong Answer
n = int(input())
ans = 0

for i in range(10**6):
    if i*i < n:
        continue
    elif i*i >= n:
        break

for j in range(i):
    if (i-j) * (i+j) == n:
        break

if (i-j) * (i+j) != n:
    for j in range(i):
        if (i-1-j) * (i+j) == n:
            ans = 2*i-3
            break
else:
    ans = 2*i-2

if ans == 0:
    ans = n-1

print(ans)
# Judge status: Accepted
a=list(map(str,input().split()))
b=list(map(int,input().split()))
b[a.index(input())]-=1
print(*b)
# Judge status: Accepted
L,R = map(int,input().split())
if R - L >= 2019:
    ans = 0
else:
    ans = 2018**2
    for i in range(L,R+1):
        for j in range(i+1,R+1):
            ans = min(ans,(i*j)%2019)
print(ans)
# Judge status: Accepted
N = list(map(int, input().split()))
print(N.index(0)+1)
# Judge status: Accepted
n, k = map(int, input().split())
p = 0
for i in range(n):
	s = i + 1
	tempp = 1
	while s < k:
		s *= 2
		tempp /= 2
	p += tempp / n
print(p)
# Judge status: Accepted
l=list(map(int,input().split()))
k=int(input())

d=max(l)
e=d*(2**k)

l.remove(max(l))
l.append(e)

print(sum(l))
# Judge status: Accepted
S = input()

ans_1 = S[0]=="A"
ans_2 = S[2:-1].count("C")==1
S = S[1:].replace("C", "")
ans_3 = S.islower()

print("AC") if ans_1 & ans_2 & ans_3 else print("WA")
# Judge status: Accepted
N = int(input())
a, b = [], []

for i in range(N):
    c, d = map(int, input().split())
    a.append(c)
    b.append(d)

total = 0
for i, j in zip(a[::-1], b[::-1]):
    k = i + total
    if k % j != 0:
        total += int((k / j) + 1)*j - k
print(total)
# Judge status: Wrong Answer
a, b = input().split()
if int(a) < 9:
  ans = int(b) - 100 * (10 - int(a))
  print(ans)
else:
  print(b)
# Judge status: Accepted
antennas = [int(input()) for _ in range(5)]
distance = int(input())
antennas.sort()
antennas_distance = abs(antennas[len(antennas)-1] - antennas[0])
print(':(' if antennas_distance > distance else 'Yay!')
# Judge status: Wrong Answer
def sumDigits(i):
    s = 0
    while i > 0:
        s += (i % 10)
        i = int(i / 10)
    return s

N = int(input())

m = 9 * 6
for i in range(1, N):
    k = N - i
    if k > 1:
        m = min(m, sumDigits(i) + sumDigits(k))

print(m)
# Judge status: Wrong Answer
a,b=input().split()
a=int(a)
b=int(b)
c=[input().split() for i in range(a)]
d=1001
for i in range(a-1):
  if int(c[i][1])<=b:
    if d>int(c[i][0]):
      d=int(c[i][0])
print(d)
# Judge status: Wrong Answer
N = int(input())

ans = 0
C = [ [0 for i in range(10)] for i in range(10)]

for i in range(1,N):
  first_num = int(str(i)[0])
  last_num = int(str(i)[-1])
  C[first_num][last_num] += 1

for first_num in range(10):
  for last_num in range(10):
    ans += C[first_num][last_num] * C[last_num][first_num]

print(ans)
# Judge status: Accepted
import collections
def pf(N):
    res = []
    x = N
    y = 2
    while y*y <= x:
        while x % y == 0:
            res.append(y)
            x //= y
        y += 1
    if x > 1:
        res.append(x)
    return res

cnt = collections.Counter(pf(int(input())))
ans = 0
for x in cnt:
    tmp = 1
    while cnt[x] > 0:
        cnt[x] -= tmp
        if cnt[x] < 0:
            break
        tmp += 1
        ans += 1
print(ans)
# Judge status: Accepted
import sys
import itertools as it
L, R = map(int, input().split())
if R-L > 2017: print(0); sys.exit()

DL = L % 2019
DR = R % 2019
if DL > DR: print(0); sys.exit()

print(min(x*y%2019 for x,y in it.combinations(range(DL, DR+1), 2)))
# Judge status: Wrong Answer
a = int(input())
b = list(map(int, input().split()))
c = 1
for i in range(a):
  c *= b[i]
  if c > 10**18:
    print(-1)
    break
else:
  print(c)
# Judge status: Accepted
n, a, b = map(int, input().split())

if b < a:
    print(0)
elif n == 1:
    if a == b:
        print(1)
    else:
        print(0)
else:
    small = a * (n - 2)
    big = b * (n - 2)
    num = big - small + 1
    print(num)
# Judge status: Wrong Answer
N = int(input())

S = list(input())

ans = [0]*N
ans[0] = S.count("E")

for i in range(1, N):
    ans[i] += (ans[i-1] + int(S[i-1]=="W") - int(S[i]=="E"))

print(min(ans))
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**6)

h = int(input())
def f(x):
	if x == 1:
		return 1
	else:
		return 2 * f(x//2) + 1
print(f(h))
# Judge status: Accepted
a = int(input())
b = int(input())

if a in (1,2) and b in (1,2):
  print(3)
elif a in (2,3) and b in (2,3):
  print(1)
else:
  print(2)
# Judge status: Accepted
N = int(input())
MOD = 10**9+7

ans = 10**N-(9**N+9**N-8**N)

print(ans%MOD)
# Judge status: Wrong Answer
import math

A, B, H, M = map(int, input().split())


doubledt = 60*H - 11*M
t = 0
if(doubledt > 360):
    t = math.pi * (doubledt-360)/360
else:
    t = math.pi * doubledt/360

tlen = math.sqrt(A*A + B*B - 2*A*B*math.cos(t))
print(tlen)
# Judge status: Accepted
N=int(input())
x=1000;p=-1
S=[111,222,333,444,555,666,777,888,999]
for i in range(len(S)):
  if S[i]-N>=0:
    if x>(S[i]-N):
      p=i
      x=S[i]-N
print(S[p])
# Judge status: Accepted
a,b=map(int,input().split())

num=a*b

if num%2==0:
    print('Even')

else:
    print('Odd')
# Judge status: Accepted
from fractions import gcd
n = int(input())
t = list(int(input()) for _ in range(n))
ans = t[0]
for i in range(1, n):
    ans = ans*t[i] // gcd(ans, t[i])
print(ans)
# Judge status: Wrong Answer
N = int(input())
a = [int(x) for x in input().split()]
b = [int(y) for y in input().split()]
c = [int(z) for z in input().split()]

ans = 0
pre = 0
for i in range(N):
    ans += b[a[i]-1]
    if a[i] == pre + 1:
        ans += c[pre-1]
    pre = a[i]
print(ans)
# Judge status: Wrong Answer
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
r=0
t=0
m_i=0
n_i=0
m+=-1
n+=-1
for i in range(m+n+2):
  #print(n_i)
  a_i=a[min(n_i,n)]
  b_i=b[min(m_i,m)]
  if ((a_i>b_i and m_i <=m) or (n_i > n)):
    m_i+=1
    t+=b_i
    #m_i=min(m_i,m)
  else:
    n_i+=1
    t+=a_i
    #n_i=min(n_i,n)
  if t>k:
    break
  r+=1
print(r)
# Judge status: Accepted
# -*- coding: utf-8 -*-

D = int(input())
C = list(map(int, input().split()))
L = [0 for _ in range(26)]

for _ in range(1,D+1):
  S = list(map(int, input().split()))
  contest_index = -1
  contest_manzoku = -10**9
  for i in range(26):
    i_manzoku = S[i]+C[i]+L[i]
    if i_manzoku > contest_manzoku:
      contest_index = i
      contest_manzoku = i_manzoku
  print(contest_index+1)
  for i in range(26):
    if i==contest_index:
      L[i] = 0
    else:
      L[i] += C[i]
# Judge status: Accepted
import math
a,b = input().split()
c = int(a + b)
if math.sqrt(c).is_integer():
    print("Yes")
else:
    print("No")
# Judge status: Accepted
if __name__ == '__main__':
    D, T, S = map(int, input().split())
    if D / T > S:
        print('No')
    else:
        print('Yes')
# Judge status: Wrong Answer
n,a,b = map(int,input().split())
if(a==0):
  print(0)
  exit()

c = n//(a+b)
d = n%(a+b)
if(c==0):
  print()
elif(d==0):
  print(a*c)
elif(d%a==0):
  print(a*c+(d%a)+a)
else:
  print(a*c+(d%a))
# Judge status: Accepted
n = int(input())
a = input().split()
reb_a = a[::-1]
if n % 2 == 0:
    res = reb_a[::2]+a[::2]
else:
    res = reb_a[::2]+a[1::2]

print(' '.join(res))
# Judge status: Wrong Answer
n, k = map(int, input().split())
al = list(map(int, input().split()))

cnt = [0]*9
for i in range(1,10):
    cnt[i-1] = al.count(i)
cnt.sort(reverse=True)

print(sum(cnt[k:]))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
barlen = 0
for x in a:
  barlen += x
halflen = barlen/2
curbarlen = 0
minhalfdis = barlen
for i in range(n):
  curbarlen += a[i]
  minhalfdis = min(minhalfdis,abs(halflen-curbarlen))
print(int(minhalfdis*2))
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if a==b!=c or a!=b==c or a!=c==b:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
s = {'a': input(), 'b': input(), 'c': input()}

now = 'a'
while s[now] != '':
    next = s[now][0]
    s[now] = s[now][1:]
    now = next
print(now.upper())
# Judge status: Accepted
n, m = map(int, input().split())

if n < m // 2:
    res = n + (m - n * 2) // 4
    print(res)
else:
    res = m // 2
    print(res)
# Judge status: Accepted
n=int(input())
inp=input()
num=[0]*(n+1)

k=0
for i in range(n):
  if inp[i]=='R':k+=1
  num[i+1]=k
R=num[-1]
W=n-R

ans=float('inf')
for i in range(n+1):
  rl=num[i]
  wl=i-rl
  rr=R-rl
  wr=W-wl
  swap=min(wl,rr)
  change=max(wl,rr)-swap
  ans=min(ans,swap+change)
print(ans)
# Judge status: Wrong Answer
from math import floor,sqrt
N=int(input())

p = [1]*floor(sqrt(10**6))
p[0]=p[1]=0
prime=[]
for i in range(2,len(p)):
    if p[i]==0:
        continue
    prime.append(i)
    for j in range(i*2,len(p),i):
        p[j]=0

ans=0
for x in prime:
    cnt=0
    while N%x==0:
        cnt+=1
        N/=x
    ans+=floor((-1+sqrt(1+8*cnt))/2)
print(ans+int(N!=0))
# Judge status: Accepted
n = int(input())
lis = list(map(int, input().split()))

minus = 0
for i in range(n):
    if lis[i] < 0:
        minus += 1
        lis[i] = lis[i]*-1

if 0 in lis or minus % 2 == 0:
    print(sum(lis))
else:
    print(sum(lis) - 2*min(lis))
# Judge status: Wrong Answer
L=int(input())
ans=0
tmp=0
d=3
for i in range(int(L*d/1.3)):
  for j in range(int((L*d-i)/1.3)):
    tmp=(i/d)*(j/d)*(L-(i/d)-(j/d))
    ans=max(ans,tmp,0)
print(ans)
# Judge status: Wrong Answer
a,b,c=map(int,input().split()) 
k=int(input()) 
print((max([a,b,c]))*(2*k-1)+sum([a,b,c]))
# Judge status: Accepted
S,C = map(int,input().split())
ans = min(S,C//2)
C -= ans*2
ans += C//4
print(ans)
# Judge status: Accepted
s=list(input())
t=list(input())

import sys
dic_s={}
dic_t={}

for i in range(len(s)):
  a=dic_s.get(s[i],t[i])
  b=dic_t.get(t[i],s[i])
  if a!=t[i] or b!=s[i]:
    print("No")
    sys.exit()
  dic_s[s[i]]=t[i]
  dic_t[t[i]]=s[i]
print("Yes")
# Judge status: Wrong Answer
a = int(input())
arr = []
s = "abcdefghijklmnopqrstuvwxyz"
if a == 1:
    print("a")
else:
    first = s[0]
    arr.append(first*(a-1))
    for i in range(a-1):
        arr.append(first+s[i+1])
for i in range(len(arr)):
    print(arr[i])
# Judge status: Accepted
s = input()
t = input()
ds = {}
dt = {}
for i in range(len(s)):
  if s[i] in ds:
    if ds[s[i]] == t[i]:
      pass
    else:
      print('No')
      exit()
  else:
    ds[s[i]] = t[i]
    
  if t[i] in dt:
    if dt[t[i]] == s[i]:
      pass
    else:
      print('No')
      exit()
  else:
    dt[t[i]] = s[i]
    
print('Yes')
# Judge status: Wrong Answer
import sys
n,m,k=map(int,input().split())
for i in range(n):
  for j in range(m):
    if i*j+(n-i)*(m-j)==k:
      print('Yes')
      sys.exit()
print('No')
# Judge status: Accepted
a,b,c,d = map(int,input().split())

if abs (a - c) <= d or  abs (a - b) <= d and abs (b - c) <= d:
    print('Yes')

else:
    print(' No')
# Judge status: Accepted
n, m = map(int, input().split())

ans = 0
if n < m:
    if 2*n <= m:
        m = m -2*n
        ans += n
    
    ans += m//4
else:
    ans += m//2

print(ans)
# Judge status: Accepted
import math
a, b, c = map(int,input().split())
d = math.ceil(a / b)
print(d * c)
# Judge status: Wrong Answer
from bisect import bisect_right,insort_right
N = int(input())
A = [int(input()) for _ in range(N)]
G = []
for i in range(N):
    a = A[i]
    ind = bisect_right(G,a)
    if ind==0:
        insort_right(G,a)
    else:
        if G[ind-1]<a:
            G[ind-1] = a
        else:
            insort_right(G,a)
print(len(G))
# Judge status: Accepted
N, M,X,Y=[int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
mx = max(x)
my = min(y)
ok = False
for i in range(X+1, Y+1):
   if mx<i and i<=my:
     ok =True

if ok:
    print("No War")
else:
    print("War")
# Judge status: Wrong Answer
import math
r = int(input())
print(math.pi * r)
# Judge status: Accepted
r = int(input())

print(6.283*r)
# Judge status: Accepted
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a=[0]
b=[0]

for i in range(N):
  a.append(a[i] + A[i])

for i in range(M):
  b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
  if a[i] > K:
    break
  while b[j] > K - a[i]:
    j -= 1
  ans = max(ans, i + j)
print(ans)
# Judge status: Accepted
import numpy as np
n, m = map(int, input().split())
stairs = set([int(input()) for i in range(m)])
ans = [1] * (n+1)
mod = 10**9 + 7
if 1 in stairs:
    ans[1] -= 1
for i in range(2, n+1):
    if i in stairs:
        ans[i] = 0
    else:
        ans[i] = ans[i-1] + ans[i-2]

print(ans[-1]%mod)
# Judge status: Wrong Answer
n=int(input())
print(800*n-(n//3)*40)
# Judge status: Wrong Answer
import random
N = int(input())
lismoto = "0"*N*2
lis = list(lismoto)
for i in range(0,len(lis),2):
    lis[i],lis[i+1] = map(int,input().split())

li = [lis[idx:idx + 2] for idx in range(0,len(lis), 2)]

ma = 0
for i in range(10**5):
    a = random.randint(0,N-1)
    b = random.randint(0,N-1)
    
    karima = abs(li[a][0]-li[b][0]) + abs(li[a][1] - li[b][1])
    if karima > ma:
        ma = karima

print(ma)
# Judge status: Accepted
def main():

    N = int(input())

    d = dict()
    for i in range(1, N+1):
        u = int(str(i)[0])
        v = int(str(i)[-1])
        d[(u, v)] = d.get((u, v), 0) + 1

    ans = 0
    for u, v in d:
        if (v, u) in d:
            ans += d[(u, v)] * d[(v, u)]
    return ans


if __name__ == '__main__':
    print(main())
# Judge status: Wrong Answer

n=int(input())
a=list(map(int,input().split()))
a.sort()
ok=[0]*(a[-1]+1)
for i in range(n):
  ok[a[i]]+=1
for i in range(n):
  if ok[a[i]]>1:
    ok[a[i]]=0
  elif ok[a[i]]:
    for j in range(2,a[-1]//a[i]+1):
      ok[a[i]*j]=0
    
print(sum(ok))
# Judge status: Accepted
import sys

n, m = map(int, input().split())
N = [None]*n
for _ in range(m):
    s, c = map(int, input().split())
    if s-1 == c == 0 and n != 1:
        print(-1)
        sys.exit(0)
    if N[s-1] == None or N[s-1] == c:
        N[s-1] = c
    else:
        print(-1)
        sys.exit(0)
if N[0] == None and n > 1:
    N[0] = 1
for i in range(n):
    if N[i] == None:
        N[i] = 0
    print(N[i], end="")
print()
# Judge status: Wrong Answer
x, y, z = map(int, input().split())
print(x * y / 2)
# Judge status: Accepted
S=input()
Sf=int(S[:2])
Sb=int(S[2:])
if 1<=Sf<=12:
  if 1<=Sb<=12:
    print('AMBIGUOUS')
  else:
    print('MMYY')
else:
  if 1<=Sb<=12:
    print('YYMM')
  else:
    print('NA')
# Judge status: Accepted
n=int(input())
v = list(map(int,input().split()))
v.sort()
for i in range(n-1):
    x = (v[i] + v[i+1])/2
    v[i+1] = x


print(v[n-1])
# Judge status: Accepted

S=input()
s=""
for i in range(len(S)):
    s="".join((s,"x"))
print(s)
# Judge status: Accepted
from collections import Counter
n=int(input())
L=[int(input()) for i in range(n)]
L1=Counter(L)
ans=0
for i in L1:
    if L1[i]%2!=0:
        ans+=1
print(ans)
# Judge status: Accepted
n = int(input())
c = [i for i in input()]
cnt = 0
for num, i in enumerate(sorted(c)):
    if c[num] != i:
        cnt += 1
print(cnt // 2)
# Judge status: Wrong Answer
a_list = []
for i in range(5):
  a_list.append(int(input()))
k = int(input())

frag = True
for i in range(1,5):
  if a_list[i] - a_list[i-1] > k:
    frag = False
    
if frag == True:
  print("Yay!")
else:
  print(":(")
# Judge status: Accepted
s = input()
if s == "SUN":
    print(7)
elif s == "MON":
    print(6)
elif s == "TUE":
    print(5)
elif s == "WED":
    print(4)
elif s == "THU":
    print(3)
elif s == "FRI":
    print(2)
else:
    print(1)
# Judge status: Accepted
N = int(input())
List = []

A = []
B = []

for i in range(N):
  a,b = map(int,input().split())
  List.append([a,b])
  A.append(a)
  B.append(b)
  

if N%2 == 1:
  A.sort()
  B.sort()
  ans = B[N//2] - A[N//2] + 1
  print(int(ans))
else:
  A.sort()
  B.sort()
  c = B[N//2] - A[N//2] + 1
  d = B[N//2-1] - A[N//2-1] + 1
  print(c+d-1)
# Judge status: Accepted
N=int(input())
count=0
for i in range(N):
	T,X,Y=map(int,input().split())
	if T%2==(X+Y)%2 and T>=(X+Y):
		count+=1
if count==N:
	print("Yes")
else:
	print("No")
# Judge status: Accepted
from math import sqrt
N = int(input())
X = []
Y = []
for i in range(N):
  x, y = map(int, input().split())
  X.append(x)
  Y.append(y)
ans = 0
for i in range(0, N-1):
  for j in range(i+1, N):
    ans += sqrt((X[i] - X[j]) ** 2 + (Y[i] - Y[j]) ** 2)
print(ans * 2.0 / N)
# Judge status: Accepted
S = input()
f = int(S[:2])
b = int(S[2:])
if (not 0 < f <= 12) and 0 < b <= 12:
    print('YYMM')
elif (not 0 < b <= 12) and 0 < f <= 12:
    print('MMYY')
elif 0 < f <= 12 and 0 < b <= 12:
    print('AMBIGUOUS')
else:
    print('NA')
# Judge status: Accepted
from operator import sub
N, M = map(int, input().split())
X = sorted(map(int, input().split()))
print(sum(sorted(map(sub, X[1:], X), reverse=True)[N-1:]))
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))
a.sort()
sum = 0
for i in range(N):
    sum += a[N+2*i]
print(sum)
# Judge status: Accepted
S,C = map(int, input().split())

if S*2 < C:
    #use all peace

    #1. use all S, and create Scc
    scc_num=S
    C -= S*2

    #2. c->s, and create Scc
    scc_num += int(C/4)

else:
    #Scc is bound by c
    scc_num=int(C/2)

print(scc_num)
# Judge status: Accepted
a,b,c,d = input()

print("Bad" if a==b or b==c or c==d else "Good")
# Judge status: Accepted
N, A, B = map(int, input().split())
if (B-A)%2 ==0:
  ans = (B-A)//2
else:
  tmp = min(N-B, A-1)
  ans = tmp + 1 + (B-A-1)//2
print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
x=[int(i) for i in input().split()]
ans=10**9
 
for i in range(n-k+1):
    temp=0
    temp+=(min(abs(x[i]),abs(x[i+k-1]))+abs(x[i]-x[i+k-1]))
    ans=min(ans,temp)
print(ans)
# Judge status: Accepted

n=int(input())


if n%2==0:
    x=0
    for i in range(1,100):
        x+=(n//(5**i))//2
    print(x)
else:
    print(0)
# Judge status: Accepted
a,b,c,d = map(int, input().split())
x = min(b,d)-max(a,c)
if x < 0:
    print(0)
else:
    print(x)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(0,n,2):
  if a[i] % 2 == 0:
    ans += 1
print(ans)
# Judge status: Accepted
N = int(input())
H = list(map(int, input().split()))

if N == 1:
    print("Yes")
    exit()

for i in range(N - 1):
    if H[i] < H[i + 1]:
        H[i + 1] -= 1
        pass
    elif H[i] > H[i + 1]:
        print("No")
        exit()

print("Yes")
# Judge status: Accepted
N, A, B = map(int, input().split())

ans = 0

for x in range(1, N + 1):
    SUM = 0
    num = x
    while x > 0:
        SUM += (x % 10)
        x //= 10
    if A <= SUM <= B:
        ans += num
        
print(ans)
# Judge status: Accepted
def main():
    S, W = list(map(int, input().split()))
    
    print("unsafe" if S <= W else "safe")
    pass

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
l = list(map(int,input().split()))

if n <= 2:
  print(0)
  exit()

cnt=0
l.sort()
for i in range(n):
  for j in range(i,n):
    for k in range(j,n):
      if (l[i]!=l[k]!=l[j]) and (l[i]+l[j]>l[k]):
        cnt += 1
        
print(cnt)
# Judge status: Wrong Answer
a, b = map(float, input().split())
print(int(a * b))
# Judge status: Accepted
n = int(input())
v = sorted([int(i) for i in input().split()], reverse=True)
ans = 0
for i in range(n):
  ans += (v[i] if i%2 == 0 else -v[i])
print(ans)
# Judge status: Accepted
a, b, c = sorted(map(int, input().split()))
print("Yes" if a+b == c else "No")
# Judge status: Accepted
import numpy as np
n = int(input())
s = list(map(int,input().split()))
a = np.array(list(range(1,n+1)))
b = np.array(s)
if len(a[a==b]) >= n-2:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n=int(input())
chk=0
add=1
while chk<n:
    chk+=add
    add+=1
add-=1
if n==chk:
    for i in range(add):
        print(i+1)
else:
    exc=chk-n
    for i in range(add):
        if i+1==exc:
            continue
        print(i+1)
# Judge status: Wrong Answer
ABC=list(map(int,input().split()))
K=int(input())
ABC.sort()
print(ABC[0]+ABC[1]+ABC[2]*2*K)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if 4 * a * b < (c-a-b) ** 2:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
from math import ceil
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
maxC = sum(B)-sum(A)
C = 0
for i in range(n):
    a, b = A[i], B[i]
    if a<b:
        C += ceil((b-a)/2)
    elif a>b:
        C += a-b
print('Yes' if C<=maxC else 'No')
# Judge status: Accepted
n = int(input())
s = 'abcdefghijklmnopqrstuvwxyz'
ans = ''
while n > 0:
  n, i = divmod(n - 1, 26)
  ans = s[i] + ans
print(ans)
# Judge status: Accepted
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
A=A1+A2+A3
N=int(input())
ans=[0]*9
a='No'
for i in range(N):
    b=int(input())
    if b in A:
        ans[A.index(b)]=1
cheack=[ans[0:3],ans[3:6],ans[6:9],ans[0::3],ans[1::3],ans[2::3],ans[0::4],ans[2:7:2]]
for C in cheack:
    if sum(C)==3:
        a='Yes'
        break
print(a)
# Judge status: Accepted
n, m = map(int, input().split())

if n == 1 and m == 1:
    print(1)
elif n == 1:
    print(m - 2)
elif m == 1:
    print(n - 2)
else:
    print((n - 2) * (m - 2))
# Judge status: Accepted
l = list(map(int, input().split()))

l[0],l[1]=l[1],l[0]
l[0],l[2]=l[2],l[0]
print(*l)
# Judge status: Accepted
a,b = map(int,input().split())
n = b-a
tower = ((n+1)*n)/2
print(int(tower-b))
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if a==b and b==c:
    print(-1)
else:
    ans=0
    while a%2==0 and b%2==0 and c%2==0:
        a0,b0,c0=(b+c)//2,(c+a)//2,(a+b)//2
        a,b,c=a0,b0,c0
        ans+=1
    print(ans)
# Judge status: Accepted
import itertools

N, M, Q = map(int, input().split())
ABCD = [[int(x) for x in input().split()] for i in range(Q)]

ans=0
for A in itertools.combinations_with_replacement([m for m in range(1,M+1)], N):
  ans2=0
  for (a,b,c,d) in ABCD:
    if A[b-1]-A[a-1]==c:
      ans2+=d
  ans=max(ans, ans2)
print(ans)
# Judge status: Wrong Answer
a=input()
b=input()
a=sorted(a)
b=sorted(b)
if a==b:
  print("Yes")
else:
  print("No")