peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n, m = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(m)]
d = [[] for i in range(n)]
l = [float('inf')] * n
for i1, i2 in L:
    d[i1 - 1].append(i2)
    d[i2 - 1].append(i1)
l[0] = 0
for i in range(len(d)):
    for j in range(len(d[i])):
        l[d[i][j] - 1] = min(l[d[i][j] - 1], l[i] + 1)
print('Yes')
for i in range(1, len(l)):
    if l[i] == 1:
        print(1)
    else:
       print(l.index(l[i] - 1) + 1)
# Judge status: Accepted
n = int(input())

if n % 2 == 1:
    print(0)
else:
    count = 0
    for i in range(1, 26):
        count += n // (2 * 5 ** i)
    print(count)
# Judge status: Accepted
n = int(input())
a_lst = list(map(int, input().split()))

x = a_lst[0]
y = sum(a_lst[1:])
diff = abs(y - x)
for a in a_lst[1:-1]:
  x += a
  y -= a
  diff = min(diff, abs(y - x))
print(diff)
# Judge status: Accepted
n,x = map(int, input().split())
al = list(map(int, input().split()))
   
import math

temp = abs(x- al[0])

for i in range(1,n):
    y = al[i]-al[i-1]
    temp = math.gcd(temp,y)
 
print(temp)
# Judge status: Accepted
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()

from collections import defaultdict, deque, Counter
from sys import exit
import heapq
import math
import copy
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

S = input()
N = len(S)

ans = mod
for i in range(N - 2):
    opt = abs(int(S[i:i + 3]) - 753)
    ans = min(ans, opt)
print(ans)
# Judge status: Accepted
s = input()
ans = 0
for i in s:
    ans += int(i)
print(ans)
# Judge status: Wrong Answer
N = int(input())

ans = 0
tmp = -10
for i in range(N):
    a = int(input())
    ans += a//2
    if a%2 == 1:
        if tmp == i-1:
            ans += 1
        else:
            tmp = i
print(ans)
# Judge status: Wrong Answer
N,K = map(int,input().split())
n=1
while N>K:
	N=N/K
	n += 1
	
if N==1:
	print(1)
else:
	
	print(n)
# Judge status: Accepted
a, b, k = map(int, input().split())
if k > a:
    if k > a + b:
        print(0, 0)
    else: print(0, a + b - k)
else: print(a - k, b)
# Judge status: Accepted
n, k = map(int, input().split())
a = input().split()

from collections import Counter
dic = Counter(a)

v = len(dic) #種類数

l = [i for i in dic.values()]
l.sort()

ans = 0
for i in range(v-k):
    ans += l[i]

print(ans)
# Judge status: Wrong Answer
n,a,b,c,d = map(int,input().split(" "))
l = input()
if c < d:
    if "##" not in l:
        print("Yes")
    else:
        print("No")
else:
    if "##" not in l:
        if '...' in l[b:d]:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
# Judge status: Wrong Answer
s1=[x for x in input()]
s2=s1[::-1]

print(s1)
print(s2)

cnt=0
for i in range(len(s1)):
  if s1[i] != s2[i]:
    cnt+=0.5
print(int(cnt))
# Judge status: Accepted
N=int(input())

sum=0
for i in range(1, N+1):
    sum += i
    if i%3==0 or i%5==0:
        sum -= i
print(sum)
# Judge status: Wrong Answer
N=int(input())
if N<105:
    print(0)
elif N==105:
    print(1)
else:
    ans=0
    for n in range(106,N+1):
        K=n//2
        y=0
        for k in range(2,K):
            if n%k==0:
                y+=1
        if y==6:
            ans+=1
    print(ans)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())

print(c-a+b)
# Judge status: Accepted
N = int(input())

ret = 0

for i in range(N):
    if ((i+1)%3 != 0 and (i+1)%5 != 0):
        ret += i+1

print(ret)
# Judge status: Wrong Answer
import collections
s = input()
cnt = collections.Counter(s)
cnt = cnt.most_common()
# print(cnt)
if len(s) == 1:
    print('YES')
    exit()
if len(cnt) == 2:
    if len(s) == 2:
        print('YES')
    else:
        print('NO')
    exit()

if cnt[0][1] > cnt[-1][1] + 1:
    print('NO')
else:
    print('YES')
# Judge status: Accepted
n, m = map(int, input().split())
f = [0]*200020
s = [0]*200020


for i in range(m):
    a, b = map(int, input().split())
    if a == 1 or b == 1:
        f[max(a, b)] = 1
        if s[max(a, b)] == 1:
            print("POSSIBLE")
            exit()
    if a == n or b == n:
        s[min(a, b)] = 1
        if f[min(a, b)] == 1:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")
# Judge status: Wrong Answer
l = list(map(int,input().split()+input().split()+input().split()))
l1 = []
for i in range(int(input())):
  num = int(input())
  if num in l:
    l1.append(l.index(num))
if (0 and 1 and 2 in l1) or (3 and 4 and 5 in l1) or (6 and 7 and 8 in l1) or (0 and 4 and 8 in l1) or (2 and 4 and 6 in l1):
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
import math
N,K = map(int,input().split())


print(sum([(1/N)*(0.5)**math.ceil(math.log2(max(K//i,1))) for i in range(1,N+1)]))
# Judge status: Accepted
x, y = map(int, input().split())
group1 = [1, 3, 5, 7, 8, 10, 12]
group2 = [4, 6, 9, 11]
group3 = [2]
if x in group1 and y in group1:
    print('Yes')
elif x in group2 and y in group2:
    print('Yes')
elif x in group3 and y in group3:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
x = int(input())
if x == 3 or x == 5 or x == 7:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
if __name__ == '__main__':
    A, B, C, K = map(int, input().split())

    if K <= A:
        print(K)
    elif A < K <= A + B:
        print(A)
    else:
        print(A - (K - A - B))
# Judge status: Accepted
from itertools import accumulate

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

x=[]
for i in p:
 x.append((i+1)/2)

b=[0]+list(accumulate(x))

ans=0
for i in range(n-k+1):
 ans=max(ans,b[i+k]-b[i])

print(ans)
# Judge status: Wrong Answer
n, m = map(int, input().split())
sc = [list(map(int, input().split())) for _ in range(m)]

l = []
for i in sc:
    if i not in l:
        l.append(i)
l.sort()
s = [0]*n
flag = False
for i in range(len(l)):
    s[l[i][0]-1] = l[i][1]
    if l[i-1][0] == l[i][0]:
        flag = True
        break
if flag:
    print(-1)
else:
    if s[0] == 0:
        s[0] == 1
    print(s)
# Judge status: Accepted
def main():
    from itertools import dropwhile

    S = input()
    it = dropwhile(lambda char: char == '9', reversed(S))
    # 末尾から見て9以外の数字が現れたら、以降をiterate

    len_ = len(list(it))
    if len_ <= 1:
        print(sum(map(int, S)))
    else:
        head = S[0]
        body = str(int(head) - 1)
        body += '9' * (len(S) - 1)

        print(sum(map(int, body)))


if __name__ == '__main__':
    main()
# Judge status: Accepted
from sys import stdin
from math import cos, radians, sqrt

a,b,h,m = [int(x) for x in stdin.readline().strip().split()]
thete_t = 360*h/12+30*m/60
thete_m = 360*m/60
diff_thete = max(thete_t, thete_m)-min(thete_t, thete_m)
thete = diff_thete if diff_thete < 180 else 360 - diff_thete
c2 = a**2 + b**2 - 2*a*b*cos(radians(thete))

print(sqrt(c2))
# Judge status: Accepted
import sys
input = sys.stdin.readline
from collections import defaultdict, deque

n, s, res, MOD = int(input()), list(map(int, input().split())), 0, int(1e9) + 7
for i in range(61):
    x, c = int(pow(2, i, MOD)), [0, 0]
    for j in range(n): c[1 if s[j] & 1 << i else 0] += 1
    x = (x * c[0]) % MOD; x = (x * c[1]) % MOD; res = (res + x) % MOD
print(res)
# Judge status: Wrong Answer
# input
N = int(input())
d = list(map(int, input().split()))

# check
max_diff = max(d)
min_diff = min(d)
cnt = 0
for k in range(min_diff, max_diff):
    if len([i for i in d if i >= k]) == len([j for j in d if j < k]):
        cnt += 1

print(cnt)
# Judge status: Accepted
# yorikatu_58_b.py

N = int(input())
A = list(map(int,input().split()))
cnt = [0]*(10**5+2)
for i in A:
    cnt[i]+=1
    cnt[i+1]+=1
    cnt[i+2]+=1
    
print(max(cnt))
# Judge status: Accepted
N, W = map(int, input().split())
wv = [list(map(int, input().split())) for _ in range(N)]

# DP
dp = [[0 for _ in range(W+1)] for _ in range(N+1)]
for i in range(N):
    for j in range(W+1):
        if wv[i][0] <= j:
            dp[i+1][j] = max(dp[i][j - wv[i][0]] + wv[i][1], dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]
print(dp[N][W])
# Judge status: Wrong Answer
x = int(input())

abc = [5, 6]
ans = (x // 11) * 2
sub = x % 11
if sub <= 5:
    ans += 1
else:
    ans += 2

print(ans)
# Judge status: Accepted
c = [list(map(int, input().split())) for _ in range(3)]

b = c[0]
a = [0, c[1][0] - b[0], c[2][0] - b[0]]

flag = True
for i in range(3):
  for j in range(3):
    if c[i][j] != a[i] + b[j]:
      flag = False
      
print("Yes" if flag else "No")
# Judge status: Wrong Answer
import itertools

N = int(input())
L = list(map(int,input().split()))
 
l_list = list(itertools.combinations(L, 3))

res = 0
 
for tri in l_list:
  l = list(tri)
  l.sort()
  if (l[0] + l[1] > l[2]):
  	res += 1
    
print(res)
# Judge status: Wrong Answer
a=input().split()
print(int(a[0]),int(a[1]))
# Judge status: Accepted
import sys
n = int(input())
a = [int(i) for i in input().split()]
if not 1 in a:
    print(-1)
    sys.exit()
target = 1
count = 0
for i in a:
    if i == target:
        target += 1
    else:
        count += 1
print(count)
# Judge status: Accepted
n,m,K=map(int,input().split());print("YNeos"[all(k*m-K+l*n-k*l*2for k in range(n+1)for l in range(m+1))::2])
# Judge status: Accepted
# N = input()
# sum = 0
# for n in N:
#     sum += int(n)
#     sum %= 9
# if sum == 0:
#     print("Yes")
# else:
#     print("No")
N = int(input())
if N % 9 == 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
#!/usr/bin/env python3
a,b,k = map(int,input().split())
for i in range(a,min(b+1,a+k)):
    if a <= i <= a+k-1: print(i)
for i in range(b-k+1,b+1):
    if a+k-1 < i:print(i)
# Judge status: Accepted
n, l = [int(i) for i in input().split()]
s = sorted([input() for i in range(n)])

print("".join(s))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
b=[]
cnt=0
for i in range(n):
    if a[i]%2==1:
        print('0')
        exit()
    else:
        while a[i]%2==0:
            cnt += 1
            a[i] /= 2
        b.append(cnt)
print(min(b)-1)
# Judge status: Accepted
s=input()
a=0
for i in range (len(s)//2):
    if s[i]==s[-i-1]:
        pass
    else:
        a+=1
print(a)
# Judge status: Accepted
time = [int(input()) for _ in range(5)]

import math
ans = 0
minmod = 10
for i in range(5):
  if time[i]%10!=0:
    minmod = min(minmod,time[i]%10)
  else:
    minmod = min(minmod,10)
  ans += math.ceil(time[i]/10)*10

ans -= (10-minmod)
print(ans)
# Judge status: Accepted

def yakusu(num):
    x=num
    count=0
    i=0
    while (i<num):
        i+=1
        if (num%i==0):
            num=num/i
            count+=2
            if (num**2==x):
                count-=1
    return count

n=int(input())
ans=0
for j in range(1,n+1,2):
    if (yakusu(j)==8):
        ans+=1
print(ans)
# Judge status: Accepted
import collections
N = int(input())
A = list(map(int, input().split()))
d = [[x, y] for x, y in collections.Counter(A).items() if y > 1]
d.sort(reverse=True)
if len(d) > 0:
    if d[0][1] >= 4:
        print(d[0][0]**2)
    elif len(d) > 1:
        print(d[0][0]*d[1][0])
else:
    print(0)
# Judge status: Accepted
from bisect import bisect_left

n = int(input())
l = sorted(list(map(int, input().split())))

#aを1番短い辺、bを2番めに短い辺とする
cnt = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        c_i = bisect_left(l, l[i] + l[j])
        cnt += c_i - (j+1)

print(cnt)
# Judge status: Wrong Answer
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

diff = N - M
for i in range(diff+1):
    for j in range(diff+1):
        flag = True
        for k in range(M):
            print(A[j+k][i:i+M])
            if not (B[k] in A[j+k][i:i+M]):
                flag = False
        if flag:
            print('Yes')
            exit(0)

print('No')
# Judge status: Accepted
N = int(input())
st = 0
sx = 0
sy = 0
flg = False
for _ in range(N):
    t,x,y = map(int,input().split())

    if abs((x+y)-(sx+sy)) > (t-st) or (t-st) % 2 != abs((x+y)-(sx+sy)) % 2:
        flg = True
        break
    else:
        st = t
        sx = x
        sy = y
print('No' if flg else 'Yes')
# Judge status: Wrong Answer
a, b = map(str, input().split())

c = a + b
c = int(c)

for i in range(400)[1:]:
    if c == i**2:
        print('Yes')
        break

print('No')
# Judge status: Wrong Answer
n = int(input())
s = input()

ans=0

for i in range(0, n-2):
    for j in range(1, n-1):
        for k in range(2, n):
            if j-i == k-j:
                continue
            if s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]:
                ans += 1

print(str(ans))
# Judge status: Accepted
n = int(input())
s = input()
t = input()

if len(s)+len(t)<= n:
  print(n)
  exit()
  
dup = min(len(s)+ len(t)-n, len(s), len(t))
for i in range(dup, 0 , -1):
  if s[-i:] == t[:i]:
    print(len(t)+len(s) - i)
    break
else:
  print(len(s)+len(t))
# Judge status: Accepted
p, q, r = map(int, input().split())
lis = [p, q, r]
print(sum(lis)-max(lis))
# Judge status: Accepted
from collections import Counter
n=input()
a=list(map(int,input().split()))
b=Counter(a)
n=int(input())
ans=sum(a)
for i in range(n):
    x,y=map(int,input().split())
    ans+=b[x]*(y-x)
    print(ans)
    b[y]+=b[x]
    b[x]=0
# Judge status: Wrong Answer
N,K=map(int,input().split())
R,S,P=map(int,input().split())
T=input()
r=T.count('s')
s=T.count('p')
p=T.count('r')
value=r*R+s*S+p*P
n=0
m=0
for i in range(N-K):
  if T[i]==T[i+K] and (n!=i or m==i):
    n =i+K
    m =i+2*K
    if T[i]=='p':
      value -= S
    elif T[i]=='r':
      value -= P
    else:
      value -= R
print(value)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))

from collections import Counter
A_=Counter(A)

A_key=list(A_.keys())
A_key.sort()

ans=0
for k in A_key:
    if k > A_[k]:
        ans += A_[k]
    else:
        ans += A_[k]-k
print(ans)
# Judge status: Wrong Answer
q,h,s,d = map(int, input().split())
n = int(input())

ans = 0

if (n % 2 == 1):
    print(min(q * 8, h * 4, s * 2, d) * (n // 2)+min(q * 4, h * 2, s))
else:
    print(min(q*8,h*4,s*2,h)*n/2)
# Judge status: Accepted
d = ["SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT"]
s = input()
for i in range(7):
    if d[i] == s:
        break
print(7 - i)
# Judge status: Wrong Answer
import sys
from heapq import heappush, heappop
#input = sys.stdin.readline

def main():
    l,r=map(int,input().split())
    if r-l>=2019:
        print(0)
    else:
        ans=[]
        for i in range(l,r+1):
            ans.append(i%2019)
        ans.sort()
        print((ans[0]*ans[1])%2019)

if __name__ == '__main__':
    main()
# Judge status: Accepted
x,k,d = map(int,input().split())
x = abs(x)
if k*d <= x:
  print(x - k*d)
  exit()
n = x//d
x = x - (d * n)
k -= n
k %= 2
x -= d*k
x = abs(x)
print(x)
# Judge status: Wrong Answer
N, K = map(int, input().split())
S = list(input())
r_cnt = 0
answer = 0
before = S[0]
for s in S:
  if s == before:
    answer += 1
  else:
    r_cnt += 1
    before = s
answer -= 1
if r_cnt%2 == 0:
  print(answer+min(r_cnt//2, K)*2)
elif r_cnt//2 >= K:
  print(answer+K*2)
else:
  print(answer+r_cnt*2-1)
# Judge status: Accepted
import sys
input = lambda: sys.stdin.readline().rstrip()

def main():
    a, v = map(int, input().split())
    b, w = map(int, input().split())
    t = int(input())
    if a < b:
        if b + (w * t) <= a + (v * t):
            print('YES')
        else:
            print('NO')
    else:
        if b + -(w * t) >= a + -(v * t):
            print('YES')
        else:
            print('NO')

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n = int(input())
h = list(map(int,input().split()))
ans = "Yes"
for i in range(n-1):
    if h[i]>h[i+1]:
        h[i] -= 1
        if h[i]>h[i+1] or h[i-1]>h[i]:
            ans = "No"
            break
print(ans)
# Judge status: Accepted
s = input()
k = int(input())
cnt = 0

for i in range(len(s)):
    if s[i] == '1':
        cnt += 1
    else:
        break

if cnt < k:
    print(s[cnt])
else:
    print(1)
# Judge status: Accepted
a,b=map(int,input().split())

if a*b%2==1:
    print('Odd')
else:
    print('Even')
# Judge status: Wrong Answer
n = int(input())
S = input()

A  = []
for i in range(n):
    if S[i] == "R":
        A.append(1)
    if S[i] == "G":
        A.append(2)
    if S[i] == "B":
        A.append(3)

cnt = 0
for i in range(0, n):
    for j in range(i+1, n):
        for k in range(j+1, n):
            if A[i]+A[j]+A[k]== 6:
                if (j - i) != (k - j):
                    cnt += 1

print(cnt)
# Judge status: Accepted
S = set(input())
if (("W" in S and "E" in S) or ("W" not in S and "E" not in S)) and (("N" in S and "S" in S) or ("N" not in S and "S" not in S)):
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N,K=map(int,input().split())
A=list(map(int,input().split()))

C=[1]
p=0

for i in range(N):
    C.append(A[C[i]-1])
    p+=1
    if C[i+1]==1:
        break

print(C[K%p])
# Judge status: Accepted
n = input()

if n[-1] == "3":
  print("bon")
elif n[-1] == "1" or n[-1] == "0" or n[-1] == "6" or n[-1] == "8":
  print("pon")
else:
  print("hon")
# Judge status: Accepted
a,b,c=map(int,input().split())
if (a<c and c<b) or (a>c and c>b):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())

print("ABC" if N < 1000 else "ABD")
# Judge status: Accepted
a,b,c=map(int, input().split())
print(a+b+c+9*max(a,b,c))
# Judge status: Wrong Answer
s = input()
p = list(s) 
if p[len(p) - 1] == "?":
  p[len(p) - 1] = "D"

for i in range(len(p) - 1):
  if p[i] == "?":
    if p[i + 1] == "D" or p[i + 1] == "?":
      p[i] = "P"
    else: 
      p[i] = "D" 
  
print("".join(p))
# Judge status: Accepted
n, r = map(int, input().split())

if n >= 10:
    print(r)
else:
    print(r + (100*(10-n)))
# Judge status: Accepted
balls = input().split(" ")

n = int(balls[0])
b = int(balls[1])
r = int(balls[2])


if( b == 0 ):
  print( 0 )
else:
  
  step = b + r 
  cnt = n // step
  remain = n % step
  bcnt = cnt * b + min( remain, b)
  
  print( bcnt )
# Judge status: Accepted
N, Q = map(int, input().split())
S = input()

# 累積和 s を計算
c = [0 for _ in range(N + 1)]
for i in range(1, N):
    a = 0
    if S[i-1:i+1] == 'AC':
        a = 1
    c[i + 1] = c[i] + a

# 各クエリに答える
for _ in range(Q):
    l, r = map(int, input().split())
    l -= 1
    result = c[r] - c[l]
    if l > 0 and S[l-1:l+1] == 'AC':
        result -= 1
    print(result)
# Judge status: Wrong Answer
h = int(input())
w = int(input())
n = int(input())

if h >= w:
    cnt = int(n // h)
    if not isinstance(n // h, int):
        cnt += 1
else:
    cnt = int(n // w)
    if not isinstance(n // w, int):
        cnt += 1
print(cnt)
# Judge status: Wrong Answer
A, B, C = list(map(int, input().split()))
if B // A >= C:
    print(C)
else:
    print(A//B)
# Judge status: Accepted
a,b,c=map(int, input().split())
print(b//a if b//a<c else c)
# Judge status: Accepted
A, B, C, K = map(int, input().split())
if K % 2 == 0:
  print(A-B)
else:
  print(B-A)
# Judge status: Accepted
N, M = map(int, input().split())
cities = {}
for m in range(M):
    p, y = map(int, input().split())
    if p not in cities:
        cities[p] = []
    cities[p].append([y, m])

ids = [None for _ in range(M)]
for city in sorted(cities.keys()):
    for idx, value in enumerate(sorted(cities[city])):
        year, m = value
        ids[m] = str(city).zfill(6) + str(idx + 1).zfill(6)

[print(id) for id in ids]
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = list(map(int, input().split()))

pos = 0
kiseki = [0]
while len(kiseki) < N:
    pos = A[pos] - 1
    if pos in kiseki:
        past = kiseki.index(pos)
        kiseki = kiseki[past:]
        print(kiseki[(K - past) % len(kiseki)] + 1)
        exit()
    else:
        kiseki.append(pos)
        # print(kiseki)

print(kiseki[K % len(kiseki)] + 1)
# Judge status: Accepted
import math
def resolve():
	n, k = map(int, input().split())
	a = list(map(int, input().split()))
	i = a.index(min(a)) + 1
	if k - 1 > i:
		v = max(0, math.ceil((n - k - 2) / (k - 1))) + 1
	else:
		v = math.ceil(i / (k - 1)) + math.ceil((n - i - 1) / (k - 1))
	print(v)
resolve()
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a += [0]
x = 1000
s = 0
for i in range(n):
  if a[i] < a[i + 1]:
    d = x // a[i]
    s += d
    x -= d * a[i]
  elif a[i] > a[i + 1]:
    x += s * a[i]
    s = 0
print(x)
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a > 0 :
  print("Positive")
elif a < 0 :
  if (b - a) % 2 == 0 :
      print("Positive")
  else:
      print("Negative")
else:
   print("Zero")
# Judge status: Wrong Answer
import sys

n = int(sys.stdin.readline())
h = list(map(int, sys.stdin.readline().split()))

ans = 'Yes'
for i in range(n - 1):
    if h[i + 1] - h[i] < 0:
        ans = 'No'
        break
    elif h[i + 1] - h[i] <= 1:
        h[i + 1] -= 1
print(ans)
# Judge status: Accepted
n = int(input())
A = list(map(int,input().split()))
from collections import Counter
A = Counter(A)
B = A.most_common()
B.sort(key = lambda x:x[0], reverse = 1)

fst_len = 0
snd_len = 0

for i,c in B:
  if c >1:
    if fst_len==0:
      fst_len = i
      if c >3:
        snd_len = i
    elif snd_len ==0:
      snd_len = i
    else:
      break


print(fst_len * snd_len)
# Judge status: Wrong Answer
N,K=list(map(int,input().split()))

if N==0:
    print(0)

N=min(N%K,K-N%K)

print(N)
# Judge status: Wrong Answer
x = int(input())
i = 0
SUM = 0
while SUM <= x:
    i += 1
    SUM += i
print(i)
# Judge status: Accepted
X, Y, A, B, C = map(int, input().split())
p = sorted(list(map(int, input().split())))[-X:]
q = sorted(list(map(int, input().split())))[-Y:]
r = list(map(int, input().split()))

total = sorted(p + q + r)[::-1]
print(sum(total[:X + Y]))
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))

ans = 0
for i in range(0,N,2):
    if a[i]%2==1:
        ans+=1

print(ans)
# Judge status: Accepted
H = float(input())
W = float(input())
N = float(input())

if H > W:
  d = H
else:
  d = W

c = N / d

if c - c//1 == 0:
  print(int(c))
else:
  print(int(c//1)+1)




#print('H=', H, 'W=', W, 'N=', N)
# Judge status: Accepted
n,a,b = map(int,input().split())

mod = 10 ** 9 + 7
k = max(a,b)
com = [1]

for i in range(1,k+1):
    com.append((com[i-1]*(n-i+1)*pow(i,mod-2,mod))%mod)

print((pow(2,n,mod)-1-com[a]-com[b])%mod)
# Judge status: Accepted
x = int(input())
ans = 0
if 11 <= x:
    ans += 2*(x//11)
    x %= 11
if 6 <= x:
    ans += 1
    x -= 6
if x:
    ans += 1
print(ans)
# Judge status: Accepted
L = list(map(str, input().split()))
L.sort()
a = int(L[2]+L[1])
b = int(L[0])
print(a + b)
# Judge status: Accepted
n, m = map(int, input().split())
students = [list(map(int,input().split())) + [float('inf'), -1] for _ in range(n)]
for i in range(m):
    x, y = map(int,input().split())
    for stu in students:
        dist = abs(stu[0]-x) + abs(stu[1]-y) 
        if dist < stu[2]: stu[2], stu[3] = dist, i+1
for stu in students: print(stu[3])
# Judge status: Wrong Answer
A = input()
B = input()
if A[0] == B[0] and A[1] ==B[1]  and A[2]== B[2]:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
H, W = map(int, input().split())

if (H * W) % 2 == 0:
    ans = (H * W) // 2
else:
    ans = (H * W) // 2 + 1

if H == 1 or W == 1:
    ans = 1

print(ans)
# Judge status: Accepted
n=input().split()
n[0]=int(n[0])
n[1]=int(n[1])
if n[0]<=n[1]:
    print('unsafe')
else:
    print('safe')
# Judge status: Accepted
n, m = map(int, input().split())
p = [list(map(int, input().split())) for _ in range(n)]
c = [list(map(int, input().split())) for _ in range(m)]


def dist(p1, p2):
    return abs(p1[0] - p2[0]) + abs(p1[1] - p2[1])


for i in range(n):
    x = min(c, key=lambda x: dist(p[i], x))
    num = c.index(x) + 1
    print(num)
# Judge status: Accepted
n = int(input())
sp = []
for i in range(n):
    s,p = map(str, input().split())
    sp.append((s,int(p)))
sp1 = tuple(sp)
sp = sorted(sp, key=lambda x:(x[0],-x[1]))
for h in sp:
    print(sp1.index(h)+1)