Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import collections

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

ans = [0] * (N + 1)
parent = [0] * (N + 1)
parent[0] = N+M
child = [[] for i in range(N+1)]
deq = collections.deque()

for i in range(N+M-1):
    p, c = map(int, input().split())
    parent[c] += 1
    child[p].append(c)
root = parent.index(min(parent))
deq.append(root)
while len(deq) > 0:
    v = deq.pop()
    if len(child[v]) > 0:
        for u in child[v]:
            deq.appendleft(u)
            ans[u] = v
for i in range(1,N+1):
    print(ans[i])

### FIXED CODE ###

import collections

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

ans = [0] * (N + 1)
parent = [0] * (N + 1)
parent[0] = N+M
child = [[] for i in range(N+1)]
deq = collections.deque()

for i in range(N+M-1):
    p, c = map(int, input().split())
    parent[c] += 1
    child[p].append(c)
root = parent.index(min(parent))
deq.append(root)
while len(deq) > 0:
    v = deq.pop()
    if len(child[v]) > 0:
        for u in child[v]:
            if parent[u] == 1:
                deq.appendleft(u)
                ans[u] = v
            else:
                parent[u] -= 1
for i in range(1,N+1):
    print(ans[i])
### BUGGY CODE ###

import sys
import bisect


def main():
    n, K, L, R = map(int, sys.stdin.readline().split())
    a = tuple(map(int, sys.stdin.readline().split()))
    m = n//2
    ls = [[] for _ in range(m+1)]
    for i in range(1 << m):
        cnt = 0
        val = 0
        for j in range(m):
            if i >> j & 1:
                cnt += 1
                val += a[j]
        bisect.insort_left(ls[cnt], val)
    for i in range(m):
        ls[i].sort()
    ans = 0
    for i in range(1 << n-m):
        cnt = 0
        val = 0
        for j in range(n-m):
            if i >> j & 1:
                cnt += 1
                val += a[m+j]
        if K-m <= cnt <= K:
            ans += bisect.bisect_right(ls[K-cnt], R-val) - bisect.bisect_right(ls[K-cnt], L-val-1)
    print(ans)


if __name__ == '__main__':
    main()



### FIXED CODE ###

import sys
import bisect


def main():
    n, K, L, R = map(int, sys.stdin.readline().split())
    a = tuple(map(int, sys.stdin.readline().split()))
    m = (n-1)//2
    ls = [[] for _ in range(m+1)]
    for i in range(1 << m):
        cnt = 0
        val = 0
        for j in range(m):
            if i >> j & 1:
                cnt += 1
                val += a[j]
        ls[cnt].append(val)
    for i in range(m+1):
        ls[i].sort()
    ans = 0
    for i in range(1 << n-m):
        cnt = 0
        val = 0
        for j in range(n-m):
            if i >> j & 1:
                cnt += 1
                val += a[m+j]
        if K-m <= cnt <= K:
            ans += bisect.bisect_right(ls[K-cnt], R-val) - bisect.bisect_right(ls[K-cnt], L-val-1)
    print(ans)


if __name__ == '__main__':
    main()
### BUGGY CODE ###

indexes = []


def dfs(Ds, s, e, v=None):
    if e - s == 1:
        if v == Ds[s]:
            indexes.append((s, e))
        return Ds[s]
    else:
        center = (s + e) // 2
        left = dfs(Ds, s, center, v=v)
        right = dfs(Ds, center, e, v=v)

        left_m = - (10 ** 9)
        li = -1
        for i in range(s, center):
            su = sum(Ds[i:center])
            if left_m != max(left_m, su):
                left_m = max(left_m, su)
                li = i

        right_m = -(10 ** 9)
        ri = -1
        for i in range(center + 1, e + 1):
            su = sum(Ds[center:i])
            if right_m != max(right_m, su):
                right_m = max(right_m, su)
                ri = i

        if left_m + right_m == v:
            indexes.append((li, ri))

        m = max(left, right, left_m + right_m)
        return m

def solve(N, T, As):
    Ds = [As[i + 1] - As[i] for i in range(N - 1)]
    max_v = dfs(Ds, 0, N - 1)
    dfs(Ds, 0, N - 1, v=max_v)
    return len(indexes)

if __name__ == "__main__":
    N, T = map(int, input().split(" "))
    As = list(map(int, input().split(" ")))
    print(solve(N, T, As))


### FIXED CODE ###

indexes = []


def dfs(Ds, s, e, v=None):
    if e - s == 1:
        if v == Ds[s]:
            indexes.append((s, e))
        return Ds[s]
    else:
        center = (s + e) // 2
        left = dfs(Ds, s, center, v=v)
        right = dfs(Ds, center, e, v=v)

        left_m = - (10 ** 9)
        li = -1
        su = 0
        for i in range(center-1, s-1, -1):
            su += Ds[i]
            if left_m != max(left_m, su):
                left_m = max(left_m, su)
                li = i

        right_m = -(10 ** 9)
        ri = -1
        su = 0
        for i in range(center, e):
            su += Ds[i]
            if right_m != max(right_m, su):
                right_m = max(right_m, su)
                ri = i

        if left_m + right_m == v:
            indexes.append((li, ri))

        m = max(left, right, left_m + right_m)
        return m


def solve(N, T, As):
    Ds = [As[i + 1] - As[i] for i in range(N - 1)]
    max_v = dfs(Ds, 0, N - 1)
    dfs(Ds, 0, N - 1, v=max_v)
    return len(indexes)


if __name__ == "__main__":
    N, T = map(int, input().split(" "))
    As = list(map(int, input().split(" ")))
    print(solve(N, T, As))
### BUGGY CODE ###

n=int(input())
s=input()
l=set()
r=set()
for i in range(0,n-2):
    if s[i] in r:
        continue
    else:
        r.add(s[i])
    for j in range(i+1,n-1):
        # print(i,s[i])
        if i==0 and j>=2 and s[j]==s[1]  :
            continue
        for k in range(j+1,n):
            if j==1 and k>=3 and s[k]==s[2]:
                continue
            m=s[i]+s[j]+s[k]
            l.add(m)
print(len(l))


### FIXED CODE ###

n=int(input())
s=input()
l=set()
r=set()

for i in range(0,n-2):
    a=set()
    if s[i] in r:
        continue
    else:
        r.add(s[i])
    for j in range(i+1,n-1):
        if s[j] in a:
            continue
        else:
            a.add(s[j])
        for k in range(j+1,n):
            if j==1 and k>=3 and s[k]==s[2]:
                continue
            m=s[i]+s[j]+s[k]
            l.add(m)
print(len(l))
### BUGGY CODE ###

from collections import deque
H, W = list(map(int, input().split(' ')))
FIELD = list()
for _ in range(H):
    FIELD.append(input())
removal_cell_flag = [[1 if FIELD[h][w] == '.' else 0 for w in range(W)] for h in range(H)]
class Node:
    def __init__(self, h, w):
        self.h = h
        self.w = w
        self.parent = None
sh, sw = 0, 0  # start
gh, gw = H - 1, W - 1  # goal
# We can get the maximum score
# when we change colors of cells which are not on the shortest path.
frontier = deque()
frontier.append(Node(sh, sw))
explored_flag = [[0 for _ in range(W)] for _ in range(H)]
node = None
while len(frontier) > 0:
    node = frontier.popleft()
    if node.h == gh and node.w == gw:  # reach goal
        break
    explored_flag[node.h][node.w] = 1
    for dh, dw in [[1, 0], [-1, 0], [0, 1], [0, -1]]:
        nh, nw = node.h + dh, node.w + dw  # next
        if (nh < 0) or (H - 1 < nh) or (nw < 0) or (W - 1 < nw):
            continue
        if FIELD[nh][nw] == '#':
            continue
        if explored_flag[nh][nw] == 1:
            continue
        next_node = Node(nh, nw)
        next_node.parent = node
        frontier.append(next_node)
if node.h != gh and node.w != gw:
    print(-1)
    exit(0)
while True:
    removal_cell_flag[node.h][node.w] = 0
    if node.parent is None:
        break
    node = node.parent
print(sum([sum(row) for row in removal_cell_flag]))

### FIXED CODE ###

from collections import deque
H, W = list(map(int, input().split(' ')))
FIELD = list()
for _ in range(H):
    FIELD.append(input())
WHITE_CELL_NUM = 0
for h in range(H):
    for w in range(W):
        if FIELD[h][w] == '.':
            WHITE_CELL_NUM += 1
sh, sw = 0, 0  # start
gh, gw = H - 1, W - 1  # goal
# We can get the maximum score
# when we change colors of cells which are not on the shortest path.
frontier = deque()
ch, cw = sh, sw
frontier.append((ch, cw))
steps = [[-1 for _ in range(W)] for _ in range(H)]
steps[ch][cw] = 0
while len(frontier) > 0:
    ch, cw = frontier.popleft()  # current
    if ch == gh and cw == gw:  # reach goal
        break
    for dh, dw in [[1, 0], [-1, 0], [0, 1], [0, -1]]:
        nh, nw = ch + dh, cw + dw  # next
        if (nh < 0) or (H - 1 < nh) or (nw < 0) or (W - 1 < nw):
            continue
        if FIELD[nh][nw] == '#':
            continue
        if steps[nh][nw] >= 0:
            continue
        steps[nh][nw] = steps[ch][cw] + 1
        frontier.append((nh, nw))
if ch != gh and cw != gw:
    print(-1)
    exit(0)
shortest_path_length = steps[gh][gw] + 1
print(WHITE_CELL_NUM - shortest_path_length)
### BUGGY CODE ###

import numpy as np
K=int(input())
result=0
for a in range(1,K+1):
    for b in range(a+1,K+1):
        for c in range(b+1,K+1):
            result+=np.gcd.reduce([a,b,c])*6
    b=a
    for c in range(1,K+1):
        result+=np.gcd.reduce([a,c])*3
    result-=a*2
print(result)

### FIXED CODE ###

from math import gcd
K=int(input())
result=0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            result+=gcd(gcd(a,b),c)
print(result)
### BUGGY CODE ###

from _collections import deque

n,m=map(int,input().split())
f=[[] for i in range(n+1)]
for i in range(m):
    a,b=map(int,input().split())
    f[a].append(b)
    f[b].append(a)
g=[0]*(n+1)
p=[0]*(n+1)
for i in range(1,n+1):
    if p[i]==0:
        p[i]=i
        data=[i]
        data=deque(data)
        while len(data)>0:
            pos=data.popleft()
            p[pos]=i
            for j in f[pos]:
                if p[j]==0:
                    data.append(j)
for i in range(n):
    g[p[i+1]]+=1
print(max(g))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**9)
n,m=map(int,input().split())
root=[-1]*n
def r(x):
    if root[x]<0:
        return x
    else:
        root[x]=r(root[x])
        return root[x]
def unite(x,y):
    x=r(x)
    y=r(y)
    if x==y:
        return
    root[x]+=root[y]
    root[y]=x
def size(x):
    x=r(x)
    return -root[x]
for i in range(m):
    x,y=map(int,input().split())
    x-=1
    y-=1
    unite(x,y)
ans=0
for i in range(n):
    ans=max(ans,size(i))
print(ans)
### BUGGY CODE ###

import numpy as np
amari = np.array([[i] for i in range(10)])
p = 10**9 + 7
s =  str(input())
n = len(s)
ans = np.zeros(13, dtype = np.int64)
ans[0] = 1
for i in reversed(s):
  dp = np.zeros(13, dtype = np.int64)
  if i == '?':
    for j in range(13):
      dp[(j + amari)%13] += ans[j]
  else:
    for j in range(13):
      dp[(j + amari[int(i)])%13] += ans[j]
  dp %= p
  ans = dp
  amari = amari*10 %13
print(ans[5])

### FIXED CODE ###

amari = [i for i in range(10)]
p = 10**9 + 7
s =  str(input())
n = len(s)
ans = [0]*13
ans[0] = 1
for i in reversed(s):
  dp = [0]*13
  if i == '?':
    for j in range(13):
      for k in amari:
        dp[(j + k)%13] += ans[j]
  else:
    for j in range(13):
      dp[(j + amari[int(i)])%13] += ans[j]
      
  for i in range(len(dp)):
    dp[i] %= p
  ans = dp
  for i in range(len(amari)):
    amari[i] = amari[i]*10%13
print(ans[5])
### BUGGY CODE ###

def calc_m_value(M, A, B, N, h):
    m_cand = []
    for i in range(N):
        index = h - A[i]
        if (index < 0):
            m = B[i]
        else:
            m = M[index] + B[i]
        m_cand.append(m)
    return min(m_cand)

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

M = [0]
for i in range(1, H+1):
    M.append(calc_m_value(M, A, B, N, i))

print(M[H])


### FIXED CODE ###

def calc_m_value(M, A, B, N, h):
    return min([M[h - A[i]]+B[i] if A[i] <= h else B[i] for i in range(N)])

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

M = [0] * (H+1)
for i in range(1, H+1):
    M[i] = calc_m_value(M, A, B, N, i)

print(M[H])
### BUGGY CODE ###

T = input()
n = T.count("?")

ans = ""
count = 0
for i in range(2 ** n):
    S = T
    for j in range(n):
        if ((i >> j) & 1):
            S = S.replace("?", "P", 1)
        else:
            S = S.replace("?", "D", 1)
    tmp = S.count("D") + S.count("PD")
    count = max(count, tmp)
    if count == tmp:
        ans = S

print(ans)

### FIXED CODE ###

T = input()
print(T.replace("?", "D"))
### BUGGY CODE ###

#https://www.slideshare.net/chokudai/union-find-49066733
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * self.n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)

    if x == y: return False
    if self.parents[x] > self.parents[y]:
      x, y = y, x
    self.parents[x] += self.parents[y]
    self.parents[y] = x
        
  def issame(self, x, y):
    return self.find(x) == self.find(y)
  
  def get_node_members(self):
    return [[j for j in range(self.n) if self.issame(i, j)] for i in range(self.n)]
  
  def size(self, x):
    return -self.parents[self.find(x)]
  
N = list(map(int, input().split()))
uf = UnionFind(N[0])
results = [0 for i in range(N[0])]
for i in range(N[1]):
  x, y = list(map(int, input().split()))
  x, y = x - 1, y - 1
  results[x] += 1
  results[y] += 1
  uf.union(x, y)
#print(uf.parents)

for i in range(N[2]):
  x, y = list(map(int, input().split()))
  x, y = x - 1, y - 1
  if uf.issame(x, y):
  	results[x] += 1
  	results[y] += 1
  
node_members = uf.get_node_members()
#print(node_members, results)

print(" ".join([str(uf.size(i) - results[i] - 1) for i in range(N[0])]))

### FIXED CODE ###

import sys
input = lambda: sys.stdin.readline().rstrip()

#https://www.slideshare.net/chokudai/union-find-49066733
class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * self.n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)

    if x == y: return False
    if self.parents[x] > self.parents[y]:
      x, y = y, x
    self.parents[x] += self.parents[y]
    self.parents[y] = x
        
  def issame(self, x, y):
    return self.find(x) == self.find(y)
  
  def get_node_members(self):
    return [[j for j in range(self.n) if self.issame(i, j)] for i in range(self.n)]
  
  def size(self, x):
    return -self.parents[self.find(x)]

N = list(map(int, input().split()))
parents = [-1] * N[0]
def find(x):
  if parents[x] < 0:
    return x
  else:
    parents[x] = find(parents[x])
    return parents[x]

def union(x, y):
  x = find(x)
  y = find(y)

  if x == y: return False
  if parents[x] > parents[y]:
    x, y = y, x
  parents[x] += parents[y]
  parents[y] = x
        
def issame(x, y):
  return find(x) == find(y)
  
def size(x):
  return -parents[find(x)]
  

results = [0 for i in range(N[0])]
for i in range(N[1]):
  x, y = list(map(int, input().split()))
  x, y = x - 1, y - 1
  results[x] += 1
  results[y] += 1
  union(x, y)
#print(uf.parents)

for i in range(N[2]):
  x, y = list(map(int, input().split()))
  x, y = x - 1, y - 1
  if issame(x, y):
  	results[x] += 1
  	results[y] += 1
  
#print(node_members, results)

print(" ".join([str(size(i) - results[i] - 1) for i in range(N[0])]))
### BUGGY CODE ###

import sys
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, K = read_int()
p = read_int()

def solve():
    res = 0
    index = 0
    for h in range(N - K + 1):
        partial = 0
        for i in range(h, h + K):
            partial += p[i]
        if res < partial:
            index = h
            res = partial
    ans = 0
    for i in range(K):
        ans += (p[index + i] + 1) / 2
    return ans

if __name__ == "__main__":
    print(solve())

### FIXED CODE ###

import sys
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N, K = read_int()
p = read_int()


memo = [0 for i in range(N - K + 1)]

def solve():
    memo[0] = sum(p[:K])
    for i in range(1, N - K + 1):
        memo[i] = memo[i - 1] + p[i + K - 1] - p[i - 1]
    index = 0
    res = 0
    for i, m in enumerate(memo):
        if res < m:
            res = m
            index = i
    ans = 0
    for i in range(K):
        ans += (p[index + i] + 1) / 2
    return ans
if __name__ == "__main__":
    print(solve())
### BUGGY CODE ###

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

A.sort(reverse=True)
for i in range(M):
    A[0] = (A[0]) // (2)
    A.sort(reverse=True)

print(sum(A))

### FIXED CODE ###

import heapq
import sys

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

if N == 1:
    for i in range(M):
        A[0] = A[0] // 2
    print(sum(A))
    sys.exit()
h = []
for i in range(N):
    heapq.heappush(h, -A[i])

for i in range(M):
    tmp = heapq.heappop(h)
    tmp = -(-tmp // 2)
    heapq.heappush(h, tmp)


print(-sum(h))
### BUGGY CODE ###

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

sum_max = 0
for i in range(n-k+1):
  sum_max = max(sum_max, sum(nums[i:i+k]))

print((sum_max +k)/2)


### FIXED CODE ###

n, k = map(int, input().split())
nums = list(map(int, input().split()))
 
sum_max = sum(nums[:k])
temp = sum_max
for i in range(k,n):
  temp -= nums[i-k]
  temp += nums[i]
  sum_max = max(temp, sum_max)
print((sum_max +k)/2)
### BUGGY CODE ###

import itertools
inf = float("inf")
n,m,r = map(int,input().split())
ra = list(map(int,input().split()))
dist = [[inf for i in range(n+1)] for i in range(n+1)]
for i in range(m):
    a,b,c = map(int,input().split())
    dist[a][b] = c
    dist[b][a] = c

for a in range(n+1):
    for b in range(n+1):
        for c in range(n+1):
            dist[b][c] = min(dist[b][c],dist[b][a]+dist[a][c])

#print("距離行列は以下")
#for i in range(n+1):
    #print(dist[i])

ans = inf
for p in itertools.permutations(ra):
    subt = 0
    for i in range(r-1):
        subt += dist[p[i]][p[i+1]]
    if subt < ans:
        ans = subt
print(ans)


### FIXED CODE ###

import itertools
inf = float("inf")
n,m,r = map(int,input().split())
ra = list(map(int,input().split()))
dist = [[inf for i in range(n)] for i in range(n)]
for i in range(m):
    a,b,c = map(int,input().split())
    dist[a-1][b-1] = c
    dist[b-1][a-1] = c

for a in range(n):
    for b in range(n):
        for c in range(n):
            dist[b-1][c-1] = min(dist[b-1][c-1],dist[b-1][a-1]+dist[a-1][c-1])

#print("距離行列は以下")
#for i in range(n+1):
    #print(dist[i])

ans = inf
for p in itertools.permutations(ra):
    subt = 0
    for i in range(r-1):
        subt += dist[p[i]-1][p[i+1]-1]
    if subt < ans:
        ans = subt
print(ans)
### BUGGY CODE ###

n = int(input())
arr = list(map(int,input().split()))
ans = 0
def odd(arr):
    for i in arr:
        if i % 2 == 0:
            return True
            break
    return False

while odd(arr):
    maxOdd = max(list(filter(lambda x: x % 2 == 0, arr)))
    arr[arr.index(maxOdd)] = arr[arr.index(maxOdd)] // 2
    arr = list(map(int,arr))
    arr = list(map(lambda arr:arr * 3, arr))
    ans += 1

print(ans)

### FIXED CODE ###

n = int(input())
arr = list(map(int,input().split()))
ans = 0

def div(x):
    cnt = 0
    while x % 2 == 0:
        x = x // 2
        cnt += 1
    return cnt

for i in arr:
    if i % 2 == 0:
        ans += div(i)
print(ans)
### BUGGY CODE ###

b = []
def binomial(n):
    global b
    b = [None] * n
    for i in range(n):
        b[i] = [0] * n
        b[i][i] = 1
    for i in range(1, n):
        for j in range(1, i + 1):
            b[i][j] = b[i - 1][j - 1] + b[i - 1][j]
    
cache = {}

def s(x, a, k, i):
    key = (a, k, i)
    if key in cache: return cache[key]
    if a < 0: return 0
    if k < 0: return 0
    if k == 0:
        if a == 0: return 1
        else: return 0
    if i > a: return 0
    if i == 51: return 0
    c = s(x, a, k, i + 1)
    for j in range(1, x[i] + 1):
        c += b[x[i] + 1][j + 1] * s(x, a - i * j, k - j, i + 1)
    cache[key] = c
    return c

n, a = map(int, input().split())
binomial(n + 2)
x = [0] * 51
for k in input().split():
    x[int(k)] += 1

c = 0
for i in range(1, n + 1):
    c += s(x, a * i, i, 0)
print(c)


### FIXED CODE ###

n, a = map(int, input().split())
x = [int(i) for i in input().split()]
cache = {}
def s(v, k, i):
    if i == n: return int(v > 0 and v == k * a)
    if v > a * n: return 0
    key = (v, k, i)
    if key in cache: return cache[key]
    cache[key] = s(v, k, i + 1) + s(v + x[i], k + 1, i + 1)
    return cache[key]

print(s(0, 0, 0))
### BUGGY CODE ###

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

N, Q = map(int,input().split())
Node = [-1] * N
Counter = [0] * N
Result = [0] * N

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

for i in range(Q):
    p, x = map(int,input().split())
    Counter[p-1] += x

for i in range(N):
    p = i
    ans = 0
    while p >= 0:
        ans = ans + Counter[p]
        p = Node[p]
        
    Result[i] = ans

print(" ".join(list(map(str,Result))))


### FIXED CODE ###

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

N, Q = map(int,input().split())
Node = [-1] * N
Counter = [0] * N
Result = [0] * N

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

for i in range(Q):
    p, x = map(int,input().split())
    Counter[p-1] += x

for i in range(N):
    p = i
    ans = 0
    while p >= i:
        ans += Counter[p]
        p = Node[p]
    Result[i] = ans
    if p >= 0:
        Result[i] += Result[p]

print(" ".join(list(map(str,Result))))
### BUGGY CODE ###

N=int(input())
h_list=[int(x) for x in input().split()]

flag=True
for i in range(len(h_list)-1):    
    tmp=h_list[i:]
    if tmp[0]-min(tmp[1:])>=2:
        flag=False
        break
        
if flag:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N=int(input())
h_list=[int(x) for x in input().split()]

flag=True

m=h_list[0]
for j in range(len(h_list)-1):
    if m<h_list[j]:
        m=h_list[j]
    if m-h_list[j+1]>=2:
        flag=False
        break        
    
if flag:
    print("Yes")
else:
    print("No")
### BUGGY CODE ###

n,m=map(int,input().split())
step=list(range(n+1))
broken=[]
for i in range(m):
    broken+=[int(input())]
mod=10**9+7
enable=[i for i in step if not i in broken and not i == 0]
dp=[0]*(n+1)
dp[0]=1
if enable[0]==1:
    dp[1]=1
    enable.pop(0)
for i in enable:
    dp[i]=(dp[i-1]+dp[i-2])
print(dp[n]%mod)

### FIXED CODE ###

N, M = list(map(int, input().split()))
A = {i: 0 for i in range(N+1)}
mod = 10 ** 9 + 7
for _ in range(M):
    A[int(input())] = 1
 
dp = [0 for _ in range(N+1)]
dp[0] = 1
 
for i in range(N+1):
    if A.get(i+1) == 0:
        dp[i + 1] += dp[i]
    if A.get(i+2) == 0:
        dp[i + 2] += dp[i]
 
print(dp[N]%mod)
### BUGGY CODE ###

import itertools
def count(string):
    sets = sorted(list(set(string)))
    return {s: string.count(s) for s in sets}

def infer(match):
    match_num = 0
    for x, y in itertools.combinations(match, 2):
        if x == y:
            match_num += 1
    
    return match_num

N = int(input())
sents = [input() for i in range(N)]
match = [count(sents[i]) for i in range(N)]
ans = infer(match)
print(ans)

### FIXED CODE ###

N = int(input())
dicts = {}
for i in range(N):
    s = "".join(sorted(input()))
    dicts[s] = dicts[s] + 1 if s in dicts.keys() else 1

num = 0
for k, v in dicts.items():
  num += v * (v-1) // 2
print(num)
### BUGGY CODE ###

from itertools import chain
n,m=map(int,input().split())
a=list(map(int,input().split()))
bc=[list(map(int,input().split())) for i in range(m)]
a.sort()
bc.sort(key=lambda x:x[1],reverse=True)
t=[]
for i in range(m):
    t.append([bc[i][1]]*bc[i][0])
t=list(chain.from_iterable(t))
ans=0
 
for i in range(n):
    if i<len(t):
        ans+=max(a[i],t[i])
    else:
        ans+=a[i]
print(ans)


### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
bc=[list(map(int,input().split())) for i in range(m)]
a.sort()
bc.sort(key=lambda x:x[1],reverse=True)
t=[]

for b,c in bc:
    a.extend([c]*b)
    if len(a)>2*n:
        break
a.sort(reverse=True)
print(sum(a[:n]))