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

from functools import reduce

words = lambda t : list(map(t, input().split()))
n = int(input())
xs = words(int)

def func(y, x):
    for i in range(60):
        if x == 0:
            continue
        y[i] += x & 1
        x = x >> 1
    return y

ys = reduce(func, xs, [0]*60)
ans = 0

for i,yi in enumerate(ys):
    ans += 2**(i) * yi * (n-yi)
    ans %= 10**9 + 7
print(ans)


### FIXED CODE ###

words = lambda t : list(map(t, input().split()))
n = int(input())
xs = words(int)

ys = [0]*60
for x in xs:
    for i in range(60):
        if x == 0:
            continue
        ys[i] += x & 1
        x = x >> 1

ans = 0

for i,yi in enumerate(ys):
    ans += 2**(i) * yi * (n-yi)
    ans %= 10**9 + 7
print(ans)
### BUGGY CODE ###

k = int(input())

def gcd(a,b,c):
    gc =1
    for i in range(1,min(a,b,c)+1):
        if a%i==0 and b%i==0 and c%i ==0:
            gc=i
    return gc

ans = 0

for i in range(1,k+1):
    for j in range(1,k+1):
        for l in range(1,k+1):
            ans += gcd(i,j,l)

print(ans)

### FIXED CODE ###

import math
from functools import reduce
k = int(input())

def gcd(*numbers):
    return reduce(math.gcd,numbers)

ans = 0

for a in range(1,k+1):
    ans +=gcd(a,a,a)

for a in range(1,k+1):
    for b in range(1,k+1):
        if a!=b:
            ans += 3*gcd(a,a,b)

for a in range(1,k-1):
    for b in range(a+1,k):
        for c in range(b+1,k+1):
            #if a!=b and a!=c and b!=c:
            ans +=6*gcd(a,b,c)


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

n = int(input())
l = list(map(int, input().split()))
l.sort()
def bin_search(key, list):
    ok = len(list)
    ng = -1
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if list[mid] > key:
            ok = mid
        else:
            ng = mid
    return ok

ans = 0
for i in range(1, n - 1):
    for j in range(i + 1, n):
        c_min_len = l[j] - l[i]
        x = i - bin_search(c_min_len, l)
        if x > 0:
            ans += x
print(ans)

### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
l.sort()
def bin_search(key, list):
    ok = n
    ng = -1
    while abs(ok - ng) > 1:
        mid = (ok + ng) // 2
        if list[mid] > key:
            ok = mid
        else:
            ng = mid
    return ok

ans = 0
for i in range(1, n - 1):
    for j in range(i + 1, n):
        c_min_len = l[j] - l[i]
        x = i - bin_search(c_min_len, l)
        ans += max(0, x)
print(ans)
### BUGGY CODE ###

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

count = 0

for j in range(N):
    #print("j="+str(j))
    for k in range(j+1):
        #print("k="+str(k))
        if(list[k] < list[j]):
            break

        if(k == j):
            count += 1
            break


print(count)


### FIXED CODE ###

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

ans = 0
min = list[0]

for j in range(N):
    if (min  >= list[j]):
        ans += 1
        min = list[j]
    else:
        continue

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

N = int(input())
S = input()

diff_dic = {}

diff_dic[('R', 'G')] = []
diff_dic[('R', 'B')] = []
diff_dic[('G', 'R')] = []
diff_dic[('G', 'B')] = []
diff_dic[('B', 'G')] = []
diff_dic[('B', 'R')] = []

for i in range(N):
    for j in range(i + 1, N):

        if S[i] == 'R':
            if S[j] != 'R':
                diff_dic[('R', S[j])].append((i, j - i))

        if S[i] == 'G':
            if S[j] != 'G':
                diff_dic[('G', S[j])].append((i, j - i))

        if S[i] == 'B':
            if S[j] != 'B':
                diff_dic[('B', S[j])].append((i, j - i))

cnt = 0
for i in range(N):
    if S[i] == 'R':
        for j, d in diff_dic[('G', 'B')]:
            if j > i and (j - i) != d:
                cnt += 1

        for j, d in diff_dic[('B', 'G')]:
            if j > i and (j - i) != d:
                cnt += 1

    if S[i] == 'G':
        for j, d in diff_dic[('R', 'B')]:
            if j > i and (j - i) != d:
                cnt += 1

        for j, d in diff_dic[('B', 'R')]:
            if j > i and (j - i) != d:
                cnt += 1

    if S[i] == 'B':
        for j, d in diff_dic[('R', 'G')]:
            if j > i and (j - i) != d:
                cnt += 1

        for j, d in diff_dic[('G', 'R')]:
            if j > i and (j - i) != d:
                cnt += 1

print(cnt)


### FIXED CODE ###

N = int(input())
S = input()

diff_dic = {}
diff_dic[('R', 'G')] = []
diff_dic[('R', 'B')] = []
diff_dic[('G', 'R')] = []
diff_dic[('G', 'B')] = []
diff_dic[('B', 'G')] = []
diff_dic[('B', 'R')] = []

R_lst = [0] * N
G_lst = [0] * N
B_lst = [0] * N

r_cnt = 0
g_cnt = 0
b_cnt = 0

cnt = 0
for i in range(N):
    if S[i] == 'R':
        r_cnt += 1
    elif S[i] == 'G':
        g_cnt += 1
    else:
        b_cnt += 1

    R_lst[i] = r_cnt
    G_lst[i] = g_cnt
    B_lst[i] = b_cnt

    for j in range(i):
        d = i - j
        if (S[i] == 'R' and S[j] == 'G') or (S[i] == 'G' and S[j] == 'R'):
            if j - 1 >=0 and B_lst[j - 1] > 0:
                cnt += B_lst[j - 1]
                if j - d >= 0 and S[j - d] == 'B':
                    cnt -= 1

        if (S[i] == 'G' and S[j] == 'B') or (S[i] == 'B' and S[j] == 'G'):
            if j - 1 >=0 and R_lst[j - 1] > 0:
                cnt += R_lst[j - 1]
                if j - d >= 0 and S[j - d] == 'R':
                    cnt -= 1

        if (S[i] == 'B' and S[j] == 'R') or (S[i] == 'R' and S[j] == 'B'):
            if j - 1 >= 0 and G_lst[j - 1] > 0:
                cnt += G_lst[j - 1]
                if j - d >= 0 and S[j - d] == 'G':
                    cnt -= 1

print(cnt)
### BUGGY CODE ###

import sys
import collections
# import math
# import string
# import bisect

def main():
    n, *parts = (int(x) for x in sys.stdin.read().split())
    uppers, middles, lowers = (parts[n*i:n*(i+1)] for i in range(3))

    count = 0
    for a, ca in collections.Counter(uppers).items():
        for b, cb in collections.Counter((b for b in middles if b > a)).items():
            count += ca * cb * sum(collections.Counter((c for c in lowers if c > b)).values())

    print(count)

if __name__ == "__main__":
    main()


### FIXED CODE ###


import sys
# import collections
# import math
# import string
import bisect

def main():
    n, *parts = (int(x) for x in sys.stdin.read().split())
    uppers, middles, lowers = (parts[n*i:n*(i+1)] for i in range(3))
    uppers.sort()
    lowers.sort()

    count = 0
    for j in middles:
        i = bisect.bisect_left(uppers, j)
        k = len(lowers) - bisect.bisect_right(lowers, j)
        count += i * k
        
    print(count)

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

n, k = map(lambda x: int(x), input().split())
list_a =  list(map(lambda x: int(x), input().split()))


scores = list_a[0:k]
score_first_time = list_a
score = 1
for each in scores:
    score *= each
    
for i, next_score in enumerate(list_a[k:]):
    score_before = score
    score = score_before * next_score / list_a[i]
    if score > score_before:
        print('Yes')
        continue
    print('No')
    
    

### FIXED CODE ###

n, k = map(lambda x: int(x), input().split())
list_a =  list(map(lambda x: int(x), input().split()))

band_score = 1
    
for i, score in enumerate(list_a[k:]):
    if list_a[i] < score:
        print('Yes')
        continue
    print('No')
### BUGGY CODE ###

from collections import deque
s = deque(input())
n = len(s)

temp = [0]*2019
t = 1
num = 0
for i in range(n):
    num += int(s.pop())*t
    temp[num % 2019] += 1
    t *= 10

ans = temp[0]
for t in temp:
    if t > 1:
        ans += t*(t-1)/2

print(int(ans))

### FIXED CODE ###

S=input()
N=len(S)
M=2019

remainder=[0]*M
val=0
for i in range(N):
  val=(int(S[N-1-i])*pow(10,i,M)+val)%M
  remainder[val]+=1

ans=remainder[0]
for i in range(2019):
  ans+=remainder[i]*(remainder[i]-1)//2
print(ans)
### BUGGY CODE ###

x = input().split()
plist = list(range(1, int(x[0])+1))
pointdict = {}
y = []
i = 1
while i < int(x[0]) + 1:
    pointdict[i] = int(x[1])
    i += 1

l = 0
while l < int(x[2]):
    ans = input()
    y.append(ans)
    l += 1

for i in y:
    for e in plist:
        if e != int(i):
            pointdict[e] -= 1

for p in pointdict:
    if pointdict[p] > 0:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

x = input().split()
plist = [int(x[1]) for i in range(int(x[0]))]
y = []
l = 0
while l < int(x[2]):
    ans = input()
    y.append(int(ans))
    l += 1

for i in y:
    plist[i-1] += 1

for p in plist:
    if p - int(x[2]) > 0:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

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

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
  
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
  
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

le = -1
ri = max(A) + 1
mid = (le + ri) // 2
while ri - le > 1:
    S = [0] * n
    S[0] = -1 + 2 * int(A[0] >= mid)
    for i in range(n-1):
        S[i+1] = S[i] - 1 + 2 * int(A[i] >= mid)
    bit = Bit(n+2)
    ans = 0

    Smin = min(S)
    S = [S[i]-min(S)+1 for i in range(n)]
    #print(S)
    for i, p in enumerate(S):
        bit.add(p, 1)
        ans += bit.sum(p) - 1  # 「S[i] >= S[i]」をカウントしないように1を引く

    #print(le, ri, mid, ans)

    if ans >= (n*(n-1))//(2*2):
        le = mid
    else:
        ri = mid
    mid = (le + ri) // 2

print(le)
    


### FIXED CODE ###

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

# n = 4
# A = [i+1 for i in range(n)]

class Bit:
    def __init__(self, n):
        self.size = n
        self.tree = [0] * (n + 1)
  
    def sum(self, i):
        s = 0
        while i > 0:
            s += self.tree[i]
            i -= i & -i
        return s
  
    def add(self, i, x):
        while i <= self.size:
            self.tree[i] += x
            i += i & -i

#print((n*(n+1))//(2*2))

le = -1
ri = max(A) + 1
mid = (le + ri) // 2
while ri - le > 1:
    S = [0] * n
    S[0] = -1 + 2 * int(A[0] >= mid)
    for i in range(n-1):
        S[i+1] = S[i] - 1 + 2 * int(A[i+1] >= mid)
    bit = Bit(n+2)
    ans = 0
    for i in range(n):
        if S[i] >= 0:
            ans += 1

    #print("S OK")

    Smin = min(S)
    S = [S[i] - Smin + 1 for i in range(n)]

    #print("S OK2")
    #print(S)
    for i, p in enumerate(S):
        
        bit.add(p, 1)

        ans += bit.sum(p) - 1  # 「S[i] >= S[i]」をカウントしないように1を引く
        #print(i,ans)


    #print(le, ri, mid, ans)

    if ans >= (n*(n+1))//(2*2):
        le = mid
    else:
        ri = mid
    mid = (le + ri) // 2

print(le)
### BUGGY CODE ###

n,k=map(int,input().split())
B=[[0]*2 for i in range(k)]
for i in range(k):
  B[i]=list(map(int,input().split()))
mod=998244353
A=[0]*(n+1)
A[0]=1
a=1
for i in range(n):
  for j in range(k):
    A[min(n,i+B[j][0])]=A[min(n,i+B[j][0])]+a
    A[min(n,i+B[j][1]+1)]=A[min(n,i+B[j][1]+1)]-a
  a=a+A[i+1]
print(A[-2]%mod)

### FIXED CODE ###

n,k=map(int,input().split())
B=[[0]*2 for i in range(k)]
for i in range(k):
  B[i]=list(map(int,input().split()))
mod=998244353
A=[0]*(n+1)
A[0]=1
a=1
for i in range(n):
  for j in range(k):
    A[min(n,i+B[j][0])]=(A[min(n,i+B[j][0])]+a)%mod
    A[min(n,i+B[j][1]+1)]=(A[min(n,i+B[j][1]+1)]-a)%mod
  a=a+A[i+1]
print(A[-2]%mod)
### BUGGY CODE ###

# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque


def run():
    N, K, *A = map(int, read().split())
    A = [-1] + A
    INF = 1 << 50
    X = [INF, 1, 1]
    for i, a in enumerate(A[1:], 1):
        pre = X[1]
        if i <= K:
            if a == 0:
                X[0] = i
                X[1] = 0
                X[2] = 1
                continue

            X[1] *= a
            X[2] *= a
        if i > K:
            if a == 0:
                X[0] = i
                X[1] = 0
                X[2] = 1
                continue
            if i - K == X[0]:
                X[0] = INF
                X[1] = X[2]
            elif A[i-K] == 0:
                pass
            else:
                X[1] /= A[i-K]
            X[1] *= a
            X[2] *= a
            if pre < X[1]:
                print('Yes')
            else:
                print('No')


if __name__ == "__main__":
    run()

### FIXED CODE ###

# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
from collections import defaultdict
sys.setrecursionlimit(10**7)
import math
#from itertools import product, accumulate, combinations, product
#import bisect# lower_bound etc
#import numpy as np
#from copy import deepcopy
#from collections import deque


def run():
    N, K, *A = map(int, read().split())
    A = [-1] + A
    INF = 1 << 50
    X = [INF, 1, 1]
    for i in range(K, N):
        if A[i+1] > A[i-K+1]:
            print('Yes')
        else:
            print('No')




if __name__ == "__main__":
    run()
### BUGGY CODE ###

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

ans = 0
for i in range(min(a), max(a) + 1):
    temp = [1 if abs(i - x) <= 1 else 0 for x in a]
    ans = max(ans, sum(temp))

print(ans)


### FIXED CODE ###

from collections import Counter

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

x = []
for i in a:
    x.append(i)
    x.append(i + 1)
    x.append(i - 1)

ans = max(Counter(x).values())
print(ans)
### BUGGY CODE ###

X=int(input())
for B in range(-10**8,10**8):
    if type((X+B**5)**0.2)!=complex:
        if (X+B**5)**0.2==int((X+B**5)**0.2):
            print(int((X+B**5)**0.2), B)
            break

### FIXED CODE ###

X=int(input())
for B in range(-10**3,10**3):
    if type((X+B**5)**0.2)!=complex:
        if int((X+B**5)**0.2)-0.0001<=(X+B**5)**0.2<=int((X+B**5)**0.2)+0.0001:
            print(int((X+B**5)**0.2), B)
            break
### BUGGY CODE ###

def main():
    n, a, b = map(int, input().split())
    a_count = 0
    a_amari = 0
    while True:
        n = n - a
        if n < 0:
            a_amari = a + n
            break
        a_count += 1
        n = n - b
        if n <= 0:
            break

    print(a_count*a + a_amari)


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n, a, b = map(int, input().split())
    count = n // (a + b)
    amari = n % (a + b)

    if amari - a < 0:
        print(count*a + amari)
    else:
        print((count + 1) * a)


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

import queue
import sys
sys.setrecursionlimit(10 ** 5)

N, X, Y = map(int, input().split())

G = [[] for _ in range(N + 1)]
for i in range(1, N):
    G[i].append(i + 1)
    G[i + 1].append(i)
G[Y].append(X)
G[X].append(Y)
#print(G)

seen = [False] * (N + 1)
todo = queue.Queue()
route = [0] * (N + 1)
def bfs(parent):
    seen[parent] = True
    #print(route)
    for child in G[parent]:
        if seen[child] == False:
            seen[child] = True
            route[child] = route[parent] + 1
            todo.put(child)
    if not todo.empty():
        bfs(todo.get())

bfs(1)
#print(route)

bucket = [0] * N
for i in range(1, N + 1):
    seen = [False] * (N + 1)
    route = [0] * (N + 1)
    bfs(i)
    for val in route:
        bucket[val] += 1
#print(bucket)
for i in range(1, N):
    print(bucket[i] // 2)


### FIXED CODE ###

import copy

N, X, Y = map(int, input().split())
def check(num, distance):
    if num!=0:
        distance[num-1]=min(distance[num]+1, distance[num-1])
    if num!=N-1:
        distance[num+1]=min(distance[num+1], distance[num]+1)
    if num==X-1:
        distance[Y-1]=min(distance[Y-1], distance[X-1]+1)
    elif num==Y-1:
        distance[X-1] = min(distance[X-1], distance[Y-1]+1)
total_answer=[]
answer=[N]*N
for k in range(N):
    temp=copy.copy(answer)
    temp[k]=0
    #print(temp)
    for i in range(0, N):
        check(i, temp)
        #print(temp)
    #print(temp)
    for j in range(N-1,-1,-1):
        check(j, temp)
    #print(temp)
    #print('/n')

    for i in range(0, N):
        check(i, temp)

    for j in range(N - 1, -1, -1):
        check(j, temp)
    for i in range(0, N):
        check(i, temp)

    for j in range(N - 1, -1, -1):
        check(j, temp)

        #print(temp)
    #print(temp)
    total_answer+=temp
#print(total_answer)
import collections
dict=collections.Counter(total_answer)
#print(dict)
for i in range(1, N):
    print(dict[i]//2)
### BUGGY CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

import numpy as np
from numba import jit



r, c, k = map(int, input().split())
itm = [[0]*(c) for _ in range(r)]
for i in range(k):
    ri, ci, vi = map(int, input().split())
    itm[ri-1][ci-1] = vi

dp = np.zeros((3005, 3005, 4), dtype=np.int64)

@jit
def f(i, j, x, dp):
    dp[i][j][1:] = np.maximum(dp[i][j][1:], dp[i][j][:3] + x)
    dp[i+1][j][0] = max(dp[i+1][j][0], max(dp[i][j]))
    dp[i][j+1][:] = np.maximum(dp[i][j+1][:], dp[i][j][:])


for i in range(r):
    for j in range(c):
        nowv = itm[i][j]
        f(i, j, nowv, dp)
#        dp[i][j][1:] = np.maximum(dp[i][j][1:], dp[i][j][:3] + nowv)
#        dp[i+1][j][0] = max(dp[i+1][j][0], max(dp[i][j]))
#        dp[i][j+1][:] = np.maximum(dp[i][j+1][:], dp[i][j][:])

print(max(dp[r-1][c-1]))


### FIXED CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-

r, c, k = map(int, input().split())
itm = [[0]*(c) for _ in range(r)]
for i in range(k):
    ri, ci, vi = map(int, input().split())
    itm[ri-1][ci-1] = vi

dp0 = [[0]*4 for c_ in range(3005)]
dp1 = [[0]*4 for c_ in range(3005)]

for i in range(r):
    for j in range(c):
        nowv = itm[i][j]
        dp0[j][3] = max(dp0[j][3], dp0[j][2] + nowv)
        dp0[j][2] = max(dp0[j][2], dp0[j][1] + nowv)
        dp0[j][1] = max(dp0[j][1], dp0[j][0] + nowv)

        dp0[j+1][0] = max(dp0[j+1][0], dp0[j][0])
        dp0[j+1][1] = max(dp0[j+1][1], dp0[j][1])
        dp0[j+1][2] = max(dp0[j+1][2], dp0[j][2])
        dp0[j+1][3] = max(dp0[j+1][3], dp0[j][3])

        dp1[j][0] = max(dp1[j][0], max(dp0[j]))
    dp0 = dp1.copy()

print(max(dp1[c-1]))
### BUGGY CODE ###

A,B,K = map(int,input().split())
for i in range(K):
    if A > 0:
        A -= 1
    elif B > 0:
        B -= 1
    else:
        break
print(A,B)

### FIXED CODE ###

A,B,K = map(int,input().split())
if K <= A:
    print(A-K,B)
elif A < K and K <= B + A:
    print(0,A+B-K)
else:
    print(0,0)
### BUGGY CODE ###

#!/usr/bin/env python
N, A = map(int, raw_input().split())
x = map(int, raw_input().split())

x1 = x[:N // 2]
x2 = x[N // 2:]
hoge = [(0, 0)]

for num in x1:
    sz = len(hoge)
    for i in range(sz):
        p = (hoge[i][0] + 1, hoge[i][1] + num)
        hoge.append(p)

dic = {}
for p in hoge:
    rem = A * p[0] - p[1]
    if not rem in dic:
        dic[rem] = 1
    else:
        dic[rem] += 1

hoge = [(0, 0)]

for num in x2:
    sz = len(hoge)
    for i in range(sz):
        p = (hoge[i][0] + 1, hoge[i][1] + num)
        hoge.append(p)

ans = 0
for p in hoge:
    rem = p[1] - A * p[0]
    if rem in dic:
        ans += dic[rem]

print ans - 1

### FIXED CODE ###

#!/usr/bin/env python
N, A = map(int, raw_input().split())
x = map(int, raw_input().split())

DP =[[0 for i in range(N * 50 + 1)] for j in range(N + 1)]

DP[0][0] = 1

for i in range(N):
	for j in range(N, 0, -1):
		for k in range(x[i], N * 50 + 1):
			DP[j][k] += DP[j - 1][k - x[i]]

ans = 0
for i in range(1, N + 1):
	ans += DP[i][i * A]

print ans
### BUGGY CODE ###

import collections
from scipy.special import comb
n = int(input())
num_list = list(map(int, input().split()))
all = 0

c = collections.Counter(num_list)
value_list = list(c.values())

for i in range(len(value_list)):
    if not value_list[i] == 1:
        all += comb(value_list[i],2,exact=True)

for k in range(n):
    if not num_list.count(num_list[k]) == 1:
        ans = all + comb(num_list.count(num_list[k])-1,2,exact=True) - comb(num_list.count(num_list[k]),2,exact=True)
        print(ans)
    else:
        print(all)

### FIXED CODE ###

import collections
n = int(input())
num_list = list(map(int, input().split()))
all = 0

c = collections.Counter(num_list)

for i in c:
    all += c[i]*(c[i]-1)//2

for k in range(n):
    print(all - c[num_list[k]] + 1)
### BUGGY CODE ###

H, W = map(int, input().split())
#B = [input() for _ in range(H)]
Close = set()
Open = []

Dx = [0,1,0,-1]
Dy = [1,0,-1,0]

for y in range(H):
    b = input()
    for x, c in enumerate(b):
        if c=="#":
            Open.append((y, x))
            Close.add((y, x))
ans = -1
while len(Open)>0:
    Open_ = []
    for y, x in Open:
        for dx, dy in zip(Dx, Dy):
            x_ = x+dx
            y_ = y+dy
            if 0<=x_<W and 0<=y_<H and (y_, x_) not in Close:
                Open_.append((y_, x_))
                Close.add((y_, x_))
    Open = Open_
    ans += 1
print(ans)


### FIXED CODE ###

H, W = map(int, input().split())
B = [input() for _ in range(H)]
BB = [[1<<30]*W for _ in range(H)]
for y in range(H):
    p=1<<30
    for x in range(W):
        p+=1
        if B[y][x]=="#":
            p=0
        BB[y][x] = p

    p = 1 << 30
    for x in range(W-1,-1,-1):
        p += 1
        if B[y][x] == "#":
            p = 0
        p = min(p, BB[y][x])
        BB[y][x] = p
#print(BB)
ans = 0
for x in range(W):
    p = 1 << 30
    for y in range(H):
        p = min(p+1, BB[y][x])
        BB[y][x] = p

    p = 1 << 30
    for y in range(H - 1, -1, -1):
        p = min(p+1, BB[y][x])
        ans = max(ans, p)
        BB[y][x] = p
#print(BB)
print(ans)
### BUGGY CODE ###

from collections import Counter
import math

def main():
    r=2
    def comb2(n):
        if n < 2:
            return 0
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    
    N = int(input())
    A = list(map(int, input().split()))
    
    c = Counter(A)
    
    for ball in A:
        res = 0
        for num in c:
            res += comb2(c[num] - int(num == ball))
        print(res)

if __name__ == "__main__":
    main()

### FIXED CODE ###

from collections import Counter
import math

def main():
    r=2
    def comb2(n):
        if n < 2:
            return 0
        return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    
    N = int(input())
    A = list(map(int, input().split()))
    
    count = Counter(A)
    
    all_c = sum([comb2(count[i]) for i in count])
    
    for b in A:
        print(all_c - (count[b]-1))
    
if __name__ == "__main__":
    main()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n = int(input())
hL = list(map(int, input().split()))
 
for i in range(n):
    if hL[i] - min(hL[i:n])==1:
        hL[i]-=1
if hL ==sorted(hL):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

import sys
import numpy as np
input = sys.stdin.readline
n = int(input())

L = np.array(list(map(int, input().split())))

for i in range(n-1, 0, -1):
    if L[i]-L[i-1] ==-1:
        L[i-1] -=1

if np.all(L ==sorted(L)):
    print('Yes')
else:
    print('No')