Harryxun/stf_run huggingface dataset:
N, M = map(int, input().split())
a = [int(input()) for i in range(M)]
n = 1
a.insert(0, -1)
a.append(N + 1)

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)
    return nCr[(n,r)]

def v(x):
    if x == -1:
        return 1
    else:
        q = x // 2
        r = x % 2
        ans = 0
        for i in range(x // 2 + 1):
            ans += cmb(q + r, r)
            r = r + 2
            q = q - 1
        return ans
for i in range(M + 1):
    if a[i + 1] - a[i] == 1:
        print(0)
        exit()

for i in range(M + 1):
    n *= v((a[i + 1] - 1) - (a[i] + 1))  % 1000000007

print(n)

### FIXED CODE ###

N, M = map(int, input().split())
a = set([int(input()) for i in range(M)])
n = [0] * (N + 1)
n[0] = 1
n[1] = 1

#listの中をinで探すのはくっそ遅い
if 1 in a:
    n[1] = 0

for i in range(2, N + 1):
    if i in a:
        continue
    else:
        n[i] = (n[i - 1] + n[i - 2]) % 1000000007

print(n[N])
S = input()
if len(set(S)) == 2:
  ans = 'Yes'  
else ans = 'No'
print(ans)


### FIXED CODE ###

S = input()
if len(set(S)) == 2:
	ans = 'Yes'  
else:
	ans = 'No'
print(ans)
print(x*x*x)

### FIXED CODE ###

x = int(input())
print(x**3)
N = int(input())
A = list(map(int, input().split()))

print(max(A) - max(B))

### FIXED CODE ###

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

print(max(A) - min(A))
a = input()
b = list(map(int,input().split()))
if 'Y' in b:
    print('Four')
else:
    print('Three')

### FIXED CODE ###

a = input()
b = list(input().split())
if 'Y' in b:
    print('Four')
else:
    print('Three')
import numpy as np
N, M = map(int, input().split())
A = np.array([int(input()) for _ in range(M)], dtype = int)

MOD= 1000000007
dp = np.zeros(N, dtype = int)
if M != 0:
    dp[A - 1] = -1

if dp[0] == -1 and dp[1] == -1:
    pass
elif dp[0] == -1:
    dp[1] = 1
elif dp[1] == -1:
    dp[0] = 1
else:
    dp[0] = 1
    dp[1] = 2


# if N >= 3:
#     for n in range(2, N):
#         if dp[n] != -1:
#             dp[n] = (max(dp[n-1], 0) + max(dp[n-2], 0)) % MOD

print (dp[-1])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
import numpy as np
N, M = map(int, input().split())

MOD = 1000000007
dp = np.zeros(N, dtype = int)
if M != 0:
    A = np.array([int(input()) for _ in range(M)], dtype = int)
    dp[A - 1] = -1


if dp[0] == -1 and dp[1] == -1:
    pass
else:
    if dp[0] == -1:
        dp[1] = 1
    elif N >= 2 and dp[1] == -1:
        dp[0] = 1
    elif N >= 2:
        dp[0] = 1
        dp[1] = 2
    else:
        dp[0] = 1


if N >= 3:
    for n in range(2, N):
        if dp[n] != -1:
            dp[n] = (max(dp[n-1], 0) + max(dp[n-2], 0)) % MOD

print (dp[-1])
n,k=map(int,input().split())
lst=list(map(int,input().split()))
mod=10**9+7

plst=sorted([x for x in lst if x>=0],reverse=True)
nlst=sorted([abs(x) for x in lst if x<0],reverse=True)
lenn=len(nlst)
lenp=len(plst)



if lenp==0 and k%2==1:
    sm=1
    for i in range(lenn-1,lenn-k-1,-1):
        sm*=-nlst[i]
        sm%=mod
    print(sm)
    exit()


ptoken=0
ntoken=0
token=0


sm=1
while token<k:
    if ptoken==lenp:
        sm*=-nlst[ntoken]
        ntoken+=1
    elif ntoken==lenn:
        sm*=plst[ptoken]
        ptoken+=1
    elif plst[ptoken]>nlst[ntoken]:
        sm*=plst[ptoken]
        ptoken+=1
    else :
        sm*=-nlst[ntoken]
        ntoken+=1
    token+=1

if sm<0:
    if ptoken<lenp:
        sm//=nlst[ntoken-1]
        sm*=plst[ntoken]
    else : 
        if n!=k :
            sm//=plst[ntoken-1]
            sm*=nlst[ntoken]
sm%=mod
print(sm)

### FIXED CODE ###

n,k=map(int,input().split())
lst=list(map(int,input().split()))
mod=10**9+7

plst=sorted([x for x in lst if x>=0],reverse=True)
nlst=sorted([abs(x) for x in lst if x<0],reverse=True)
out=[None for _ in range(k)]
lenn=len(nlst)
lenp=len(plst)



if lenp==0 and k%2==1:
    sm=1
    for i in range(lenn-1,lenn-k-1,-1):
        sm*=-nlst[i]
        sm%=mod
    print(sm)
    exit()

if n==k:
    sm=1
    for x in lst:
        sm*=x
        sm%=mod
    print(sm)
    exit()



ptoken=0
ntoken=0
token=0
pm=0



while token<k:
    if ptoken==lenp:
        out[token]=nlst[ntoken]
        pm=(pm+1)%2
        ntoken+=1
    elif ntoken==lenn:
        out[token]=plst[ptoken]
        ptoken+=1
    elif plst[ptoken]>nlst[ntoken]:
        out[token]=plst[ptoken]
        ptoken+=1
    else :
        out[token]=nlst[ntoken]
        pm=(pm+1)%2
        ntoken+=1
    token+=1

if pm==1:
    if ptoken==lenp:          
        out.remove(plst[ptoken-1])
        out.append(nlst[ntoken])
    elif ntoken==lenn:
        out.remove(nlst[ntoken-1])
        out.append(plst[ptoken])
    elif ptoken==0 : 
        out.remove(nlst[ntoken-1])
        out.append(plst[ptoken])
    else : 
        if nlst[ntoken-1]*nlst[ntoken]>=plst[ptoken-1]*plst[ptoken]:
            out.remove(plst[ptoken-1])
            out.append(nlst[ntoken])
        else :
            out.remove(nlst[ntoken-1])
            out.append(plst[ptoken])               

sm=1
for x in out:
    sm*=x
    sm%=mod

print(sm)
N= int(input())
if N%2==1:
 print(0)
else:
 a=0
 i=0
 while (5**i)*2<=N:
  i+=1
  b=(5**i)*2
  a+=(N//b)
print(a)

### FIXED CODE ###

N= int(input())
if N%2==1:
 print(0)
else:
 a=0
 i=0
 while (5**i)*2<=N:
  i+=1
  b=(5**i)*2
  a+=(N//b)
 print(a)
import random
import time
start=time.time()
h,w,m=map(int,input().split())
hh=[[0,i]for i in range(h)]
ww=[[0,i]for i in range(w)]
hw=set()
for _ in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  hh[a][0]+=1
  ww[b][0]+=1
  hw.add((a,b))
ww.sort(reverse=1)
s=ww[0][0]
w=[]
for x,j in ww:
  if x==s:w.append(j)
hh.sort(reverse=1)
t=hh[0][0]
hhh=[]
for x,i in hh:
  if x==t:h.append((x,i))
ans=[]
random.shuffle(w)
for j in w:
  for x,i in hhh:
    if (i,j) in hw:
      ans.append(s+x-1)
    else:
      exit(print(s+x))
  if time.time()-start>=1.7:
    m=ans[0]
    if h-50000<=len(hhh)<=h-random.randint(1,30):m+=1
    exit(print(m))
print(ans[0])

### FIXED CODE ###

import random
import time
start=time.time()
h,w,m=map(int,input().split())
hh=[[0,i]for i in range(h)]
ww=[[0,i]for i in range(w)]
hw=set()
for _ in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  hh[a][0]+=1
  ww[b][0]+=1
  hw.add((a,b))
ww.sort(reverse=1)
s=ww[0][0]
w=[]
for x,j in ww:
  if x==s:w.append(j)
hh.sort(reverse=1)
t=hh[0][0]
hhh=[]
for x,i in hh:
  if x==t:hhh.append((x,i))
ans=[]
random.shuffle(w)
for j in w:
  for x,i in hhh:
    if (i,j) in hw:
      ans.append(s+x-1)
    else:
      exit(print(s+x))
  if time.time()-start>=1.7:
    m=ans[0]
    if h-50000<=len(hhh)<=h-random.randint(1,30):m+=1
    exit(print(m))
print(ans[0])
parseInt(x) = parse(Int,x)

parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    X, A = readline() |> split |> parseMap
    if X<A
        println(0)
    else
        println(10)
    end
end

main()

### FIXED CODE ###

X,A = list(map(int,input().split()))

if X<A:
    print(0)
else:
    print(10)
# -*- coding: utf-8 -*-
#値の取得
t_1 = input()
t_2 = input()
if (t_1 < t_2):
  sum_1 = t_1
else:
  sum_1 = t_2
  
b_1 = input()
b_2 = input()
if (b_1 < b_2):
  sum_2 = b_1
else:
  sum_2 = b_2
  
print(int(s_1) + int(s_2))

### FIXED CODE ###

# -*- coding: utf-8 -*-
#値の取得
t_1 = int(input())
t_2 = int(input())
if (t_1 < t_2):
  sum_1 = t_1
else:
  sum_1 = t_2
  
b_1 = int(input())
b_2 = int(input())
if (b_1 < b_2):
  sum_2 = b_1
else:
  sum_2 = b_2
  
print(sum_1 + sum_2)
N = int(input())
if N % 2 != 0:
    n *= 2
print(N)

### FIXED CODE ###

N = int(input())
if N % 2 != 0:
    N *= 2
print(N)
S = input()

print(S.count(1))

### FIXED CODE ###

S=input()

print(S.count('1'))
s = int(input())
 
t = [False] * 1000001
i = 1
while True:
  if t[s] == True:
    break
  t[s] = True
  i += 1
  if s % 2 == 0:
    s = s // 2
  else:
    s = 3 * s + 1
 
print(i)

### FIXED CODE ###

a,b,c = map(int,input().split())
print(int(a*b/2))
n=int(input())
d=list(map(int,input().split()))
if n>=24:
    print(0)
    exit()
op=[[0],[1]]
for i in range(n-1):
    tmp=[]
    for j in op:
        tmp.append(j+[0])
        tmp.append(j+[1])
    op=tmp
ans=0
for i in op:
    t=[0]
    for j in range(n):
        if i[j]==0:
            t.append(d[i])
        else:
            t.append(24-d[i])
    a=10000
    for p in range(1+n):
        for q in range(1+n):
            if p>q:
                b=abs(t[p]-t[q])
                a=min(a,min(b,24-b))
    ans=max(ans,a)
print(ans)

### FIXED CODE ###

n=int(input())
d=list(map(int,input().split()))
if n>=24:
    print(0)
    exit()
if n>=22:
    t=[]
    d.append(0)
    d.sort()
    f=1
    for i in range(n):
        if d[i]==d[i+1]:
            f+=1
        else:
            if f>2:
                print(0)
                exit()
            f=1
    print(1)
    exit()

op=2**n-1
ans=0
for i in range(op):
    t=[0]
    for j in range(n):
        if i&(2**j)>0:
            t.append(d[j])
        else:
            t.append(24-d[j])
    a=10000
    for p in range(1,1+n):
        for q in range(p):
            b=abs(t[p]-t[q])
            a=min(a,min(b,24-b))
    ans=max(ans,a)
print(ans)
a,b=(int(x), for x in input().splite())
c=a+b
if c==3:
    print(3)
elif c==4:
    print(2)
else:
    print(1)

### FIXED CODE ###

a=int(input())
b=int(input())

c=a+b
if c==3:
    print(3)
elif c==4:
    print(2)
else:
    print(1)
import numpy as np
N=int(input())
A=np.array(list(map(int,input().split(' '))))
A=A-np.arange(N)
err=[]
for b in range(A.min(),A.max()):
    err.append(np.sum(np.abs(A-b)))
print(min(err))


### FIXED CODE ###

import numpy as np
N=int(input())
A=np.array(list(map(int,input().split(' '))))
A=A-np.arange(N)
Amed=np.int(np.median(A))
err=[]
for b in (Amed,Amed+1):
    err.append(np.sum(np.abs(A-b)))
print(min(err))
def resolve():
    n, l = map(int, input().split())
    a = list(map(int, input().split()))
    for i in range(n):
        if a[i] + a[i + 1] >= l:
            last = i
            print("Possible")
            for j in range(last):
                print(i)
            for j in range(last + 1, n):
                print(i)
            print(last)
            return 0
    print("Impossible")
    return 0


if __name__ == "__main__":
    resolve()


### FIXED CODE ###

def resolve():
    n, l = map(int, input().split())
    a = list(map(int, input().split()))
    for i in range(n - 1):
        if a[i] + a[i + 1] >= l:
            print("Possible")
            for j in range(i):
                print(j + 1)
            for j in range(n - 1, i, -1):
                print(j)
            return 0
    print("Impossible")


if __name__ == "__main__":
    resolve()
a, b = map(int, input())
print(int((a * 3 + b) / 2))

### FIXED CODE ###

a, b = map(int, input().split())
print( int( (a * 3 + b) / 2) )
N=int(input())
a=[int(input()) for i in range(N)]
b=sorted(a)[::-1]
for i in range(N):
  if a[i]=b[0]:
    print(b[1])
  else:
    print(b[0])
    

### FIXED CODE ###

N=int(input())
a=[int(input()) for i in range(N)]
b=sorted(a)[::-1]
for i in range(N):
  if a[i]==b[0]:
    print(b[1])
  else:
    print(b[0])
import gcc

def gcd(a,b):
    if a<b:
        c=a;
        a=b;
        b=c;
    c=a%b

    if c==0:
        return b
    else:
        return gcc.gcd(b,c)

def lcm(a,b):
    c=gcd(a,b);
    return a/c*b


n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[n])
print(int(ans))

### FIXED CODE ###

'''
def gcd(a,b):
    if a<b:
     c=a
     a=b
     b=c

    c=a%b

    if c==0:
     return b
    else:
     return gcd(b,c)
'''

def gcd(a,b):
    return a if b == 0 else gcd(b,a%b)

def lcm(e,f):
    c=gcd(e,f)
    g=e*f
    return g//c



n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))
def f(x):
    p=0
    cnt=0
    for i in range(n-1,-1,-1):
        while p<n and a[i]+a[p]<x:
            p+=1
            if p==n: return cnt
        cnt+=n-p
    return cnt

n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()

l,r=a[0]*2,a[n-1]*2

while r-l>0:
    if r-l<=1: md=l;break
    md=(r+l)//2
    k=f(md)
    if k==m: break
    elif k>m: l=md
    else: r=md

p=0
cnt=0
ans=0
for i in range(n-1,-1,-1):
    while p<n and a[i]+a[p]<=md:
        p+=1
    if p==n: break
    cnt+=n-p
    ans+=a[i]*(n-p)*2


ans+=(m-cnt)*md
print(ans)

### FIXED CODE ###

import sys

def f(x):
    p=0
    cnt=0
    for i in range(n-1,-1,-1):
        while p<n and a[i]+a[p]<x:
            p+=1
        cnt+=n-p
    return cnt

n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()

l,r=a[0]*2,a[n-1]*2
md=(r+l)//2
while r-l>0:
    if r-l<=1:
        if f(r)==m: md=r;break 
        else: md=l;break
    md=(r+l)//2
    k=f(md)
    if k==m: break
    elif k>m: l=md
    else: r=md

p=0
cnt=0
ans=0

for q in range(n-1,-1,-1):
    try:
        while p<n and a[q]+a[p]<=md:
            p+=1
    except:
        b=1
        while True:
            b+=1

    if p==n: break
    cnt+=n-p
    ans+=a[q]*(n-p)*2


ans+=(m-cnt)*md
print(ans)
import queue
n,m = map(int,input().split())
pi = [int(i) for i in input().split()]

xy = [[] for j in range(n+1)]

for i in range(m):
    x,y = map(int,input().split())
    xy[x].append(y)
    xy[y].append(x)
    
path = [[] for i in range(n+1)]
#check = [0] * (n+1)

check = [-1]*(n+1)

def dfs(x,check):
    #if check[x] != -1:
    #    return
    for i in range(len(xy[x])):
        cho = xy[x][i]
        #print(cho,x)
        if check[cho] != -1:
            continue
        check[cho] = num
        dfs(cho,check)
    
    return

num = 0
for i in range(1,n+1):
    #print(i,check[i])
    if check[i] != -1:
        continue
    if len(xy[i]) == 0:
        continue
    dfs(i,check)
    num += 1
#print(check)
ans = 0

for i in range(1,n+1):
    if pi[i-1] == i:
        ans += 1
    elif check[i] == check[pi[i-1]]:
        ans += 1
print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
n,m = map(int,input().split())
pi = [int(i) for i in input().split()]

xy = [[] for j in range(n+1)]

for i in range(m):
    x,y = map(int,input().split())
    xy[x].append(y)
    xy[y].append(x)
    
path = [[] for i in range(n+1)]
#check = [0] * (n+1)

check = [-1]*(n+1)

def dfs(x,check):
    #if check[x] != -1:
    #    return
    for i in range(len(xy[x])):
        cho = xy[x][i]
        #print(cho,x)
        if check[cho] != -1:
            continue
        check[cho] = num
        dfs(cho,check)
    
    return

num = 0
for i in range(1,n+1):
    #print(i,check[i])
    if check[i] != -1:
        continue
    if len(xy[i]) == 0:
        continue
    dfs(i,check)
    num += 1
#print(check)
ans = 0

for i in range(1,n+1):
    if pi[i-1] == i:
        ans += 1
    elif check[pi[i-1]] == -1:
        continue
    elif check[i] == check[pi[i-1]]:
        ans += 1
print(ans)
from scipy.sparse import*
i=lambda:tuple(map(int,input().split()))
f=csgraph.floyd_warshall
n,m,l=i()
d=eval('[0]*-~n,'*-~n)
exec('a,b,c=i();d[a][b]=c;'*m)
d=f(f(d,0)<=l)
d*=d<n
for _ in'_'*i()[0]:print(int(d[i()])-1)

### FIXED CODE ###

from scipy.sparse import*
s=csgraph.floyd_warshall
n,m,l,*t=map(int,open(0).read().split())
d=eval('[9e9]*-~n,'*-~n)
for a,b,c in zip(*[iter(t[:m*3])]*3):d[a][b]=d[b][a]=c
d=s(d)
d[d>l]=9e9
d[d<=l]=1
d=s(d)
d[d>9e9]=9e9
for s,t in zip(*[iter(t[m*3+1:])]*2):print(int(d[s,t]%9e9-1))
x,a = map(int,input().split())
print([0,10][x//a])

### FIXED CODE ###

x,a = map(int,input().split())
if x < a:
    print(0)
else:
    print(10)
n=int(input())
s=list(input())
k=int(input())
for i in range(n):
    if s[i]!=s[k]:
        s[i]='*'
print(print(' '.join(s)))

### FIXED CODE ###

n=int(input())
s=list(input())
k=int(input())
p=s[k-1]

for i in range(n):
    if s[i]!=p:
        s[i]='*'
print(''.join(s))
h,w,a,b=map(int,input().split())

ans = False
keyhi = 0
keywi = 0

sqsq = False
if (h==w)&(a==b):
    sqsq=True

if sqsq == False:
    for hi in range(h+1):
        tmp_sum_h = hi*a + (h-hi)*(w-a)
        for wi in range(w+1):
            tmp_sum_w = wi*b + (w-wi)*(h-b)

            if tmp_sum_h == tmp_sum_w:
                ans = True
                keyhi = hi
                keywi = wi
                break

        if ans == True:
            break

    print(keyhi,keywi)

    if (h/2 < b)|(w/2 < a):
        ans = False

    if ans == True:
        for hi in range(h):
            if hi<keyhi:
                    row = "1"*a + "0"*(w-a)
            else:
                    row = "0"*a + "1"*(w-a)
            print(row)
    else:
        print("No")

if sqsq == True:
    if h%a!=0:
        print("No")
    else:
        koma = a
        for hi in range(h):
            ov = hi//koma
            row = "0"*(ov*koma) +"1"*koma+"0"*(w-ov*koma-koma)
            print(row)

### FIXED CODE ###

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

if (h/2 < b)|(w/2 < a):
        print("No")    
else:
    for hi in range(h):
        if hi<b:
            row = ""
            for wi in range(w):
                if wi <a:
                    row += "1"
                else:
                    row += "0"
        else:
            row = ""
            for wi in range(w):
                if wi <a:
                    row += "0"
                else:
                    row += "1"
            
        print(row)
N = int(input())
ab_list = [list(map(int,input().split())) for i in range(N-1)]

ab_list.sort()

graph = [[] for i in range(N)]
for i in range(N-1):
    graph[ab_list[i][0]-1].append((ab_list[i][1],i))
    graph[ab_list[i][1]-1].append((ab_list[i][0],i))
    
ans = [0 for i in range(N-1)]
ten_col = [[] for i in range(N)]
def dfs(start,now,color):
    ten_col[now-1]=[color]
    for (future,i) in graph[now-1]:
        if future == start:
            pass
        else:
            new_col = 1
            while True:
                if new_col not in ten_col[now-1]:
                    ten_col[now-1].append(new_col)
                    ans[i] = new_col
                    break
                else:
                    new_col += 1
            dfs(now,future,new_col)
            
dfs(-1,1,0)
print(max(ans))
for i in ans:
    print(i)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)

N = int(input())

graph = [[] for i in range(N)]

for i in range(N-1):
    a,b = map(int,input().split())
    graph[a-1].append((b,i))
    graph[b-1].append((a,i))
    
ans = [0]*(N-1)

def dfs(past,now,edge_col):
    new_col = 1
    for (future,i) in graph[now-1]:
        if future == past:
            pass
        else:
            if new_col == edge_col:
                new_col += 1
            ans[i] = new_col
            dfs(now,future,new_col)
            new_col += 1
            
dfs(-1,1,-1)

print(max(ans))
for i in ans:
    print(i)
N = int(input())
li = [int(input()) for x in range(N)]
lili = sorted(li)
lili.reverse()
score = 0
isA = 1
for i in lili:
    if isA % 2 == 1:
        score += i
    else:
        score -= i
    isA += 1
print(score)

### FIXED CODE ###

N = int(input())
li = list(map(int, input().split()))
lili = sorted(li)
lili.reverse()
score = 0
isA = 1
for i in lili:
    if isA % 2 == 1:
        score += i
    else:
        score -= i
    isA += 1
print(score)
# -*- coding: utf-8 -*-
import sympy

N, M = list(map(int, input().split()))
F = sympy.divisors(M)

gcd = 0
for i in range(len(F)):
    if F[i] * N > M:
        break

    gcd = F[i]

print(gcd)

### FIXED CODE ###

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

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


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)

    divisors.sort()
    return divisors


F = make_divisors(M)
gcd = 0

for i in range(len(F)):
    if F[i] * N > M:
        break

    gcd = F[i]

print(gcd)
h,w=map(int,input().split())
a=0
if h=a or w=1:
	a=1
elif:
	if h%2==1 and w%2==1:
		a=(h*w+1)/2
	else:
		a=h*w/2
print(a)


### FIXED CODE ###

h,w=map(int,input().split())
a=0
if h==1 or w==1:
	a=1
else:
	if h%2==1 and w%2==1:
		a=(h*w+1)//2
	else:
		a=h*w//2
print(a)
N = int(input())
num = list(map(int,input().split()))
b= 0
for a in range(N):
  b = b * num[a]
  if b > 10**18:
    print('-1')
  else:
    print(b)

### FIXED CODE ###

a,b = map(int,input().split())
print(a*b)
import math
a,b,x = map(float,input().split())

c = a/(2*b-(2*x)/(a*a))
d = (2*x)/(a*b*b)
if x/a >= a*b/2:
  result = math.atan(c)
else:
  result = math.degrees(math.atan(d))
print(result)
  

### FIXED CODE ###

A,B = map(int,input().split())
if 1<=A<=9 and 1<=B<=9:
  print(A*B)
else:print(-1)
print(input().count(2))

### FIXED CODE ###

print(input().count('2'))
def f(a, b, le, tf):
    b[le] = tf
    if le == len(b)-1:
        t = ""
        s1 = 0
        for i in range(len(b)):
            t += a[i]
            if b[i] == 1:
                s1 += int(t)
                t = ""
        t += a[len(b)]
        s1 += int(t)
        return s1
    else:
        return f(a, b, le+1, 0) + f(a, b, le+1, 1)


aa = input()
bb = [0] * (len(aa)-1)
if len(a) == 1:
    print(a)
else:
    print(f(aa, bb, 0, 0) + f(aa, bb, 0, 1))

### FIXED CODE ###

def f(a, b, le, tf):
    b[le] = tf
    if le == len(b)-1:
        t = ""
        s1 = 0
        for i in range(len(b)):
            t += a[i]
            if b[i] == 1:
                s1 += int(t)
                t = ""
        t += a[len(b)]
        s1 += int(t)
        return s1
    else:
        return f(a, b, le+1, 0) + f(a, b, le+1, 1)


aa = input()
bb = [0] * (len(aa)-1)
if len(aa) == 1:
    print(aa)
else:
    print(f(aa, bb, 0, 0) + f(aa, bb, 0, 1))
def main():
    n = int(input())
    h = list(map(int, input().split(' ')))
    print('Yes' if check(h) else 'No')


def check(l):
    if len(l) <= 1:
        ('true')
        return True
    elif len(l) == 2:
        return False if l[0] - l[1] >= 2 else True
    else:
        return False if l[0] - l[1] == 1 and l[1] - l[2] >= 1 else check(l[1::])


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n = int(input())
    h = list(map(int, input().split(' ')))

    ans = True
    MAX = h[0]
    for i in range(n):
        if h[i] > MAX:
            MAX = h[i]
        elif h[i] < MAX - 1:
            ans = False
        else:
            continue
        
    print('Yes' if ans else 'No')


if __name__ == '__main__':
    main()