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

H,W=map(int,input().split())
S=[[i=="." for i in input()+"#"] for _ in range(H)]+[[False]*(W+1)]

map_=[[0]*W for _ in range(H)]
for i in range(H):
    cnt=0
    q=[]
    for j in range(W+1):
        if S[i][j]==False and cnt!=0:
            for Q in q:
                map_[Q[0]][Q[1]]=cnt
            cnt=0
            q=[]
        elif S[i][j]:
            cnt+=1
            q.append([i,j])
for j in range(W):
    cnt=0
    q=[]
    for i in range(H+1):
        if S[i][j]==False and cnt!=0:
            for Q in q:
                map_[Q[0]][Q[1]]+=cnt
            cnt=0
            q=[]
        elif S[i][j]:
            cnt+=1
            q.append([i,j])
print(max([max(i) for i in map_])-1)


### FIXED CODE ###

H,W=map(int,input().split())
S=[[i=="." for i in input()+"#"] for _ in range(H)]+[[False]*(W+1)]

map_=[[0]*W for _ in range(H)]
for i in range(H):
    cnt=0
    q=[]
    for j in range(W+1):
        if S[i][j]==False and cnt!=0:
            for Q in q:
                map_[Q[0]][Q[1]]=cnt
            cnt=0
            q=[]
        elif S[i][j]:
            cnt+=1
            q.append([i,j])
for j in range(W):
    cnt=0
    q=[]
    for i in range(H+1):
        if S[i][j]==False and cnt!=0:
            for Q in q:
                map_[Q[0]][Q[1]]+=cnt
            cnt=0
            q=[]
        elif S[i][j]:
            cnt+=1
            q.append([i,j])
print(max([max(i) for i in map_])-1)
### BUGGY CODE ###

def mapinput():
    return map(int,input().split())

n,m = mapinput()
rootlist = set()
delist = []
flag = [False for i in range(n)]
for i in range(m):
    rootlist.add(tuple(mapinput()))

que = [1]
while len(que) != 0:
    for root in rootlist:
        temp = list(root)
        if que[0] in temp:
            for i in [j for j in root if j != que[0]]:
                if flag[i-1]:
                    break
                else:
                    flag[i-1] = que[0]
                    que.append(i)
                    delist.append(root)

    for root in delist:
        rootlist.remove(root)
    delist = []
    que.pop(0)


print('Yes')
for i,root in enumerate(flag):#スライスで実装
    if i == 0:
        continue
    print(root)


### FIXED CODE ###

from collections import deque

def mapinput():
    return map(int,input().split())

n,m = mapinput()
rootlist = [[] for i in range(n)]
flag = [False for i in range(n)]

for i in range(m):
    a,b= mapinput()
    rootlist[a-1].append(b)
    rootlist[b-1].append(a)

que = deque()
que.append(1)
while len(que) !=0:
    now = que.popleft()
    for room in rootlist[now-1]:
        if flag[room-1] == False:
            flag[room-1] = now
            que.append(room)

print('Yes')
for i,root in enumerate(flag):#スライスで実装
    if i == 0:
        continue
    print(root)
### BUGGY CODE ###

n = int(input())
base = []
base_ans = []

for i in range(n):
  temp = [0]*26
  s = input()
  sign = 0
  
  for j in range(10):
    temp[ord(s[j]) - 97]  = temp[ord(s[j]) - 97] + 1
    
  for j in range(len(base)):
    if temp == base[j][0]:
      base[j][1] = base[j][1] + 1
      sign = 1
      
  if sign == 0:
    base.append([temp,1])

ans = 0
for i in range(len(base)):
  if base[i][1] >= 2:
    ans = ans + base[i][1]*(base[i][1] - 1)//2


print(ans)

### FIXED CODE ###

def main():
  n = int(input())
  mydict = {}

  for i in range(n):
    temp = list(input())
    temp.sort()
    temp = ''.join(temp)
    
    if temp not in mydict:
      mydict[temp] = 1
    else:
      mydict[temp] =  mydict[temp] + 1
      
  ans = 0
  for i in mydict.values():
    if i >= 2:
      ans = ans + i*(i-1)//2
    
  print(ans)
  
if __name__ == '__main__':
    main()
### BUGGY CODE ###

def g(l, n, v):
    for i in n:
        for j in range(i[0], i[1]):
            l[j] += v

def f(n, m, A):
    global D
    max_n = max(enumerate(D[n:m], n), key=lambda x:x[1])[0]
    dA = {i for i in A if i[0] <= max_n < i[1]}
    g(D, dA, -1)
    return max_n, A - dA

def ff(n, m, A):
    i, A_ = f(n, m, A)
    A_1 = set(j for j in A_ if j[1] <= i)
    A_2 = A_ - A_1

    a1 = ff(n, i, A_1) if A_1 else 0
    a2 = ff(i+1, m, A_2) if A_2 else 0

    return a1 + a2 + 1


w = [int(i) for i in input().split()]
N = w[0]
M = w[1]
A = {tuple([int(j) for j in input().split()]) for i in range(M)}

D = [0] * N
g(D, A, 1)

print(ff(1, N, A))



### FIXED CODE ###

w = [int(i) for i in input().split()]
N = w[0]
M = w[1]
A = {tuple([int(j) for j in input().split()]) for i in range(M)}

A_ = sorted(A, key=lambda x: x[1])
bridge = 0
c = 0
for i in A_:
    if i[0] > bridge:
        bridge = i[1]-1
        c += 1
print(c)
### BUGGY CODE ###

from collections import Counter
N,K=map(int,input().split())
A=input().split()
B=Counter(A).most_common()
print(sum(B[K:][i][1] for i in range(len(B[K:]))))

### FIXED CODE ###

from collections import Counter
N,K=map(int,input().split())
A=input().split()
B=Counter(A)
C=sorted(B.values(),reverse=True)
print(sum(C[K:]))
### BUGGY CODE ###

N=int(input())
ans=0
d=[0]*(N+1)
for n in range(1,N+1):
    ret=0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ret+=1
            if i != n // i:
                ret+=1
    ans+=n*ret
    d[n]=ret
print(ans)

### FIXED CODE ###

n=int(input())
ans=0
for i in range(1,n+1):
    m=n//i
    ans+=m*(m+1)//2*i
print(ans)
### BUGGY CODE ###

n=int(input())

re_list=[]

while n>0:
    re_list.append(n%10)
    n//=10
    
if sum(re_list)%9==0:
    print("Yes")
else:
    print("No")
    


### FIXED CODE ###

n=int(input())

if n%9==0:
    print("Yes")

else:
    print("No")
### BUGGY CODE ###

n = int(input())
s = [input() for i in range(n)]
set_s = set(s)
max_count = max([s.count(i) for i in set_s])
for i in sorted(set_s):
    if s.count(i) == max_count:
        print(i)


### FIXED CODE ###

from collections import Counter
n = int(input())
s = sorted([input() for i in range(n)])

counter = Counter(s)
max_num = max(counter.values())
ans_list = [i for i in counter if counter[i] == max_num]
for i in sorted(ans_list):
    print(i)
### BUGGY CODE ###

import copy

N = input()
A = input().split()
n = int(N)
Int_A = [int(a) for a in A]

result = [Int_A[0]]
Int_A.remove(Int_A[0])


def check(a, other):
    if len(other) == 1:
        if result[0] == other[0] ^ a:
            print("Yes")
            exit()
        return []

    res = []
    co_other = copy.deepcopy(other)
    for o in other:
        co_other.remove(o)
        if a ^ o in co_other:
            res.append(o)
        co_other.append(o)
    del co_other

    return res


def deep_check(depth):

    resp = check(result[depth - 1], Int_A)

    if len(resp) == 0:
        return

    for k in resp:
        result.append(k)
        Int_A.remove(k)
        depth += 1
        deep_check(depth)
        result.remove(k)
        Int_A.append(k)
    depth -= 1
    return


deep_check(1)
print('No')




### FIXED CODE ###

# import copy
#
N = input()
A = input().split()
n = int(N)
Int_A = [int(a) for a in A]

k = 0

for a in Int_A:
    k ^= a

if k == 0:
    print("Yes")
else:
    print("No")


#
# result = [Int_A[0]]
# Int_A.remove(Int_A[0])
#
#
# def check(a):
#     if len(Int_A) == 1:
#         if result[0] == Int_A[0] ^ a:
#             print("Yes")
#             exit()
#         return []
#
#     res = []
#     co_other = copy.deepcopy(Int_A)
#     for o in Int_A:
#         co_other.remove(o)
#         if a ^ o in co_other:
#             res.append(o)
#         co_other.append(o)
#     del co_other
#
#     return res
#
#
# def deep_check(depth):
#
#     resp = check(result[depth - 1])
#
#     if len(resp) == 0:
#         depth -= 1
#         return
#
#     for k in resp:
#         result.append(k)
#         Int_A.remove(k)
#         depth += 1
#         deep_check(depth)
#         result.remove(k)
#         Int_A.append(k)
#     depth -= 1
#     return
#
#
# deep_check(1)
# print('No')
### BUGGY CODE ###

N, K = map(int,input().split())
P = list(map(int, input().split()))

import numpy as np

numlist = []

for i in range(K):
    list = P[i:] + P[:i]
    numlist.append(list)

numlist = np.array(numlist)

wa = np.sum(numlist, axis=0)

max_index = np.argmax(wa[:N-K+1])
#print(max_index)

max = P[max_index:max_index+K]
#print(max)

ans = 0
for i in max:
    ans += (i*(1+i)/2)/i

print(ans)


### FIXED CODE ###

N, K = map(int,input().split())
P = list(map(int, input().split()))

''' 累積和 '''
cumulative_sum = [P[0]]
for i in range(len(P)-1):
    cumulative_sum.append(cumulative_sum[i] + P[i+1])

#入力
#print(P)
#累積和
#print(cumulative_sum)

#numpy 累積和（高速）
#import numpy
#res = numpy.cumsum(P)
#print(res)

''' 最大値探索 O(N-K) '''
#初期値
max = cumulative_sum[K-1]
max_index = 0
for i in range(N-K):
    now = cumulative_sum[K+i] - cumulative_sum[i]
    if max < now:
        max = now
        index = i
#print(max)
#print(max_index)


ans = (max + K)/2
print(ans)
### BUGGY CODE ###

N, M = map(int, input().split())
LRC = [list(map(int, input().split())) for _ in range(M)]
INF = 10 ** 10
graph = [[INF] * (N+1) for _ in range(N+1)]
for i in range(N+1):
    graph[i][i] = 0
LRC.sort(key=lambda x: x[2], reverse=True)
LRC.sort()
dp = [INF] * (N+1) # dp[0]は使わない
visited = set([1])
dp[1] = 0
for l, r, c in LRC:
    if l not in visited:
        print(-1)
        exit()
    for i in range(l, r+1):
        visited.add(i)
        dp[i] = min(dp[i], dp[l]+c)
if dp[N] == INF:
    print(-1)
else:
    print(dp[N])


### FIXED CODE ###

import sys
from heapq import heapify, heappop, heappush

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

def dijkstra(start):
    dist = [INF] * (N+1)
    dist[start] = 0
    que = [(0, start)]
    while que:
        d, prev = heappop(que)
        if dist[prev] < d:
            continue
        for cost, next in graph[prev]:
            d1 = d + cost
            if dist[next] > d1:
                dist[next] = d1
                heappush(que, (d1, next))
    return dist

N, M = lr()
INF = 10 ** 15
graph = [[] for _ in range(N+1)] # 1-indexed
for i in range(2, N+1):
    graph[i].append((0, i-1))

for _ in range(M):
    l, r, c = lr()
    graph[l].append((c, r))

dist = dijkstra(1)

if dist[N] == INF:
    print(-1)
else:
    print(dist[N])
# 19
### BUGGY CODE ###

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod
  
import sys
sys.setrecursionlimit(100000)
from math import factorial


mod = 10**9+7 #出力の制限
N = 10**5+1
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル
f=[0]*N
f[0]=1
for i in range(1,N):
  f[i]=(f[i-1]*i)%mod

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

n=int(input())
x=list(map(int,input().split()))
ans=0
for i in range(n-1):
  for j in range(i+1,n):
    if j!=n-1:
      t = (x[j]-x[i])%mod
      o =( f[n-1-j+i-1]*f[j-i-1])%mod
      g = (cmb(n-1,j-i+1,mod)*o)%mod
      t = (t * g)%mod

      ans=(ans + t)%mod
    else:
      t = (x[j]-x[i])%mod
      o =( f[n-1-j+i]*f[j-i-1])%mod
      g = (cmb(n-1,j-i,mod)*o)%mod
      t = (t * g)%mod
      ans=(ans+t)%mod
print(ans%mod)


### FIXED CODE ###

#----------------------------------------------------------
P = 10**9 + 7
N = 100001 #使う最大値+1以上にする、値に注意3*10^5とかにしとくと安心
inv = [0] + [1] # 1/x
finv = [1] + [1] # 1/x!
fac = [1] + [1] # x!
for i in range(2,N):
  inv += [inv[P % i] * (P - int(P / i)) % P]
  fac += [(fac[i-1] * i) % P]
  finv += [(finv[i-1] * inv[i]) % P]

def comb(a, b):
    if a<b or a<0 or b<0:
        return 0 # error
    return (fac[a] * ((finv[b] * finv[a-b]) % P)) %P
#----------------------------------------------------------

n=int(input())
x=list(map(int,input().split()))
s = [0] * n
for i in range(n):
    s[i] = x[i] + (s[i-1] if i>0 else 0)
ans=0

for i in range(n-1):
    t = (x[n-1]-x[n-2-i])%P
    t = (t * (fac[n-1]*inv[i+1])%P)%P
    ans=(ans+t)%P
for i in range(1, n-1):
    t = (s[n-2] - s[i-1] - s[n-2-i])%P
    p = (((fac[n-1] * inv[i])%P) * inv[i+1])%P
    ans = (ans + (t*p)%P)%P

print(ans%P)
### BUGGY CODE ###

S = list(input().replace("BC", "D"))
l = []
ans = 0
for i in range(len(S)-1):
    if(S[i] == "A" and S[i+1] == "D"):
        l.append(i+1)
        l.append(i-1)
        S[i] = "D"
        S[i+1] = "A"
        ans += 1

while(len(l)):
    target = l[0]
    if(target < len(S) - 1 and target >= 0):
        if(S[target] == "A" and S[target+1] == "D"):
            ans += 1
            S[target+1] = "A"
            S[target] = "D"
            l.append(target+1)
            l.append(target-1)
    l.pop(0)

print(ans)


### FIXED CODE ###

S = list(input().replace("BC", "D"))
l = []
ans = 0
a_cnt = 1
d_cnt = 1
for i in range(len(S)-1):
    if (S[i] == "A" and S[i + 1] == "D"):
        ans += a_cnt
        S[i] = "D"
        S[i + 1] = "A"
    else:
        if(S[i] == "A" and S[i+1] == "A"):
            a_cnt += 1
        else:
            a_cnt = 1

print(ans)
### BUGGY CODE ###

N = int(input())
import math 
m = math.floor(math.log(N,6)) #max 8
n = math.floor(math.log(N,9)) #max 7
s = [1]
for i in range(1,m+1):
    s.append(6**i)
for j in range(1,n+1):
    s.append(9**j)
s.sort()
l = len(s)
dp = [ i for i in range(N+1)]
for i in range(1,N+1):
    for j in range(1,6):
        m = 9**j
        
        K = min(i//m,8)
        for k in range(K+1):
            dp[i] = min(dp[i],dp[i-m*k]+k)
    for j in range(1,7):
        m = 6**j
        
        K = min(i//m,5)
        for k in range(K+1):
            dp[i] = min(dp[i],dp[i-m*k]+k)
print(dp[N])

### FIXED CODE ###

N = int(input())
import math 
m = math.floor(math.log(N,6)) #max 8
n = math.floor(math.log(N,9)) #max 7
s = [1]
for i in range(1,m+1):
    s.append(6**i)
for j in range(1,n+1):
    s.append(9**j)
s.sort()
l = len(s)
dp = [ i for i in range(N+1)]
for i in range(1,N+1):
    for j in range(1,6):
        m = 9**j
        
        K = min(i//m,8)
        for k in range(K+1):
            dp[i] = min(dp[i],dp[i-m*k]+k)
    for j in range(1,7):
        m = 6**j
        
        K = min(i//m,5)
        for k in range(K+1):
            dp[i] = min(dp[i],dp[i-m*k]+k)
print(dp[N])
### BUGGY CODE ###

import copy

data = input().split()
N = int(data[0])
K = int(data[1])

TL = list(input())
TLlist = []
TLLlist = []
now = TL[0]
nowlist = now
anslist = []

for lop in range(1,len(TL)):
    if not (now == TL[lop]):
        TLlist.append(nowlist)
        TLLlist.append(len(nowlist))
        nowlist = TL[lop]
        now = TL[lop]
    else:
        nowlist += now
TLlist.append(nowlist)
TLLlist.append(len(nowlist))


if TLlist[0][:1] == "0" :
    anslist.append( sum(TLLlist[:2*K]) )
    for lop in range(1,len(TLlist),2):
        if 2*K +  lop > len(TLlist):
            break
        anslist.append( sum(TLLlist[lop:2*K + 1 + lop]) )
elif TLlist[0][:1] == "1" :
    anslist.append( sum(TLLlist[:2*K + 1 ]) )
    for lop in range(2,len(TLlist),2):
        if 2*K +  lop > len(TLlist):
            break
        anslist.append( sum(TLLlist[lop:2*K + 1 + lop]) )


#print(TLlist)
#print(TLLlist)
#print(anslist)
print(max(anslist))



### FIXED CODE ###

data = input().split()
N = int(data[0])
K = int(data[1])
 
TL = list(input())
TLlist = []
TLLlist = []
now = TL[0]
nowlist = now
anslist = []
 
for lop in range(1,len(TL)):
    if not (now == TL[lop]):
        TLlist.append(nowlist)
        TLLlist.append(len(nowlist))
        nowlist = TL[lop]
        now = TL[lop]
    else:
        nowlist += now
TLlist.append(nowlist)
TLLlist.append(len(nowlist))
 
 
if TLlist[0][:1] == "0" :
    anslist.append( sum(TLLlist[:2*K]) )
    anslist.append( sum(TLLlist[1:2*K + 2]) )
    for lop in range(3,len(TLlist),2):
        if 2*K +  lop > len(TLlist):
            break
        anslist.append( anslist[len(anslist)-1] - sum(TLLlist[lop-2:lop]) + sum(TLLlist[lop + 2*K - 1 : lop + 2*K + 1])  )
elif TLlist[0][:1] == "1" :
    anslist.append( sum(TLLlist[:2*K + 1 ]) )
    for lop in range(2,len(TLlist),2):
        if 2*K +  lop > len(TLlist):
            break
        anslist.append( anslist[len(anslist)-1] - sum(TLLlist[lop-2:lop]) + sum(TLLlist[lop + 2*K - 1 : lop + 2*K + 1])  )
 
print(max(anslist))
### BUGGY CODE ###


from collections import deque


N, M, K = map(int, input().split())
friend = [list(map(int,input().split())) for _ in range(M)]
block = [list(map(int, input().split())) for _ in range(K)]
#sys.setrecursionlimit(2*N)
#print(friend)
#print(block)
graph = [[] for _ in range(N)]
bgraph = [[] for _ in range(N)]
cnt = []
for i in range(M):
    ii, jj = friend[i]
    graph[ii-1].append(jj-1)
    graph[jj-1].append(ii-1)

for i in range(K):
    ii, jj = block[i]
    bgraph[ii-1].append(jj-1)
    bgraph[jj-1].append(ii-1)

#print(graph)
#print(bgraph)

seen = [False for _ in range(N)]
seenb = [False for _ in range(N)]
def dfs():
    labelb = 1
    while False in seen:
        label = 1
        i = seen.index(False)
        seen[i] = label
        seenb[i] = labelb
        que = deque([i])
        seg = deque([i])
        while que:
            #print(que)
            neci = que.pop()
            for nec in graph[neci]:
                if seen[nec]== False:
                    seen[nec]=label
                    seenb[nec]=labelb
                    que.append(nec)
                    seg.append(nec)
                    label += 1
        for iii in seg:
            seen[iii] = label

        labelb += 1

dfs()
for i in range(N):
    count = seen[i] - 1 -len(graph[i])
    if bgraph[i]:
          for j in bgraph[i]:
                if seenb[i] == seenb[j]:
                    count -= 1
    cnt.append(count)
print(*cnt)


### FIXED CODE ###

#計算時間が足りない　何がダメなのか　工夫が足りない　研究が必要
from collections import deque


N, M, K = map(int, input().split())
friend = [list(map(int,input().split())) for _ in range(M)]
block = [list(map(int, input().split())) for _ in range(K)]
#sys.setrecursionlimit(2*N)
#print(friend)
#print(block)
graph = [[] for _ in range(N)]
bgraph = [[] for _ in range(N)]
cnt = [0]*N
for i in range(M):
    ii, jj = friend[i]
    graph[ii-1].append(jj-1)
    graph[jj-1].append(ii-1)

for i in range(K):
    ii, jj = block[i]
    bgraph[ii-1].append(jj-1)
    bgraph[jj-1].append(ii-1)

#print(graph)
#print(bgraph)

seen = [False for _ in range(N)]
seenb = [False for _ in range(N)]
def dfs():
    labelb = 1
    #while False in seen:
    for i in range(N):
        if seen[i] != False: continue
        label = 1
        #i = seen.index(False)
        seen[i] = label
        seenb[i] = labelb
        que = deque([i])
        seg = deque([i])
        while que:
            #print(que)
            neci = que.pop()
            for nec in graph[neci]:
                if seen[nec]== False:
                    seen[nec]=label
                    seenb[nec]=labelb
                    que.append(nec)
                    seg.append(nec)
                    label += 1
        for iii in seg:
            seen[iii] = label

        labelb += 1

dfs()
for i in range(N):
    count = seen[i] - 1 -len(graph[i])
    if bgraph[i] and seen[i]>=2:
          for j in bgraph[i]:
                if seenb[i] == seenb[j]:
                    count -= 1
    cnt[i]=count
print(*cnt)
### BUGGY CODE ###

R,G,B,N = map(int,input().split())

cnt = 0
for r in range(N//R+1):
    for g in range(N//G+1):
        if (N-R*r-G*g) % B == 0 and R*r+G*g <= N:
            cnt += 1
print(cnt)

### FIXED CODE ###

R,G,B,N = map(int,input().split())

cnt = 0
for r in range(N//R+1):
    for g in range(N//G+1):
        if (N-R*r-G*g) % B == 0 and R*r+G*g <= N:
            cnt += 1
print(cnt)
### BUGGY CODE ###

a,b,c=map(int,input().split())
d=0
e=0
ok=False
while True:
    for i in range(b):
        if d>=a:
            ok=True
            break
        d+=1
        e+=1
    if ok:
        break
    for i in range(c):
        if d>=a:
            ok=True
            break
        d+=1
    if ok:
        break
print(e)

### FIXED CODE ###

a,b,c=map(int,input().split())
d=0
e=0
ok=False

total=int(a/(b+c))
sa=a-(b+c)*total
if total==0:
    if a>=b:
        print(b)
    else:
        print(a)
else:
    if sa>=b:
        print(b+b*total)
    else:
        print(sa+b*total)
### BUGGY CODE ###

import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
 
from functools import reduce
# from math import *
from fractions import *
H, W = map(int, readline().split())
S = [0 for i in range(H)]
for i in range(H):
    S[i] = readline().decode().strip()

import queue
def bfs(start, H, W):
    visited = [False] * (H * W)
    q = queue.Queue()
    q.put((start[0], start[1], 0))
    max_dist = 0
    while not q.empty():
        (i, j, dist) = q.get()
        max_dist = max(dist, max_dist)
        visited[i * W + j] = True 
        for dy in range(-1, 2):
            for dx in range(-1, 2):
                if dx * dy != 0 or dx == dy:
                    continue
                if i + dy < 0 or i + dy >= H or j + dx < 0 or j + dx >= W:
                    continue
                if S[i + dy][j + dx] == '#':
                    continue
                if visited[(i + dy) * W + j + dx]:
                    continue
                q.put((i + dy, j + dx, dist + 1))
    return max_dist

ans = 0
for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            continue
        start = (i, j)
        ans = max(ans, bfs(start, H, W))
print(ans)


### FIXED CODE ###

import sys
import itertools
# import numpy as np
import time
import math
 
sys.setrecursionlimit(10 ** 7)
 
from collections import defaultdict
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
 
from functools import reduce
# from math import *
from fractions import *
H, W = map(int, readline().split())
S = [0 for i in range(H)]
for i in range(H):
    S[i] = readline().decode().strip()

from collections import deque
def bfs(start, H, W):
    INF = 10 ** 9
    dist = [INF] * (H * W)
    q = deque([start])
    dist[start[0] * W + start[1]] = 0
    while q:
        (i, j) = q.popleft()
        d = dist[i * W + j]
        for dy in range(-1, 2):
            for dx in range(-1, 2):
                if dx * dy != 0:
                    continue
                if dx == dy:
                    continue
                if i + dy < 0 or i + dy >= H or j + dx < 0 or j + dx >= W:
                    continue
                if S[i + dy][j + dx] == '#':
                    continue
                if dist[(i + dy) * W + j + dx] != INF:
                    continue
                dist[(i + dy) * W + j + dx] = d + 1
                q.append((i + dy, j + dx))
    return max(x for x in dist if x < INF)

ans = 0
for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            continue
        start = (i, j)
        ans = max(ans, bfs(start, H, W))
print(ans)
### BUGGY CODE ###

a,b,k=map(int,input().split())
for i in range(a,b+1):
    if abs(a-i)<=k-1 or abs(b-i)<=k-1:
        print(i)

### FIXED CODE ###

a,b,k=map(int,input().split())
s=range(a,b+1)
for i in sorted(set(s[:k])|set(s[-k:])):
    print(i)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys

N = int(input())
A = [int(i) for i in input().split()]

for i in range(len(A)):
    a = A[i]
    for aa in A[i+1:]:
        if aa == a:
            print('NO')
            sys.exit()

print('YES')

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys

N = int(input())
A = [int(i) for i in input().split()]

dp = {}

for a in A:
    if a-2 in dp:
        print('NO')
        break
    dp[a-2] = 1
else:
    print('YES')