Harryxun/stf_run huggingface dataset:
import sys
input = lambda: sys.stdin.readline().rstrip()
from collections import deque

h,w,k= map(int, input().split())
sx,sy,gx,gy= map(int, input().split())
maze= [list(input()) for i in range(h)]


# 迷路　BFS
def clear_maze(sx, sy, gx, gy):

    INF=-10**9
    distance = [[INF for i in range(w)] for j in range(h)]
    #    distance = [[None]*field_x_length]*field_y_length
    def bfs():
        # きた点と方向を格納
        d=deque
        d.append((sx, sy))
        distance[sx][sy] =0

        while len(d):
            x, y = d.popleft()

            for i in range(0, 4):
                for j in range(1,k+1):
                    nx, ny = x + [j, 0, -j, 0][i], y + [0, j, 0, -j][i]
                    if 0 <= nx < h and 0 <= ny < w:
                        if maze[nx][ny] != '@' and distance[nx][ny] == INF:
                            d.append((nx, ny))
                            distance[nx][ny] = distance[x][y] + 1

                        else:
                            break
                    else:
                        break
                        
        return distance[gx][gy]

    return bfs()

ans=clear_maze(sx-1,sy-1,gx-1,gy-1)

if  ans==-10**9:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

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

h,w,k= map(int, input().split())
sx,sy,gx,gy= map(int, input().split())
maze= [list(input()) for i in range(h)]


# 迷路　BFS
def clear_maze(sx, sy, gx, gy):

    INF=10**9
    distance = [[INF for i in range(w)] for j in range(h)]
    #    distance = [[None]*field_x_length]*field_y_length
    def bfs():
        # きた点と方向を格納
        d=deque()
        d.append((sx, sy))
        distance[sx][sy] =0

        while len(d):
            x, y = d.popleft()

            for i in range(0, 4):
                for j in range(1,k+1):
                    nx, ny = x + [j, 0, -j, 0][i], y + [0, j, 0, -j][i]
                    if not (0 <= nx < h and 0 <= ny < w):
                        break

                    elif maze[nx][ny] == '@' or distance[nx][ny]<=distance[x][y]:
                        break

                    elif distance[nx][ny] == INF:
                        d.append((nx, ny))
                        distance[nx][ny] = distance[x][y] + 1


        return distance[gx][gy]

    return bfs()

ans=clear_maze(sx-1,sy-1,gx-1,gy-1)

if  ans==10**9:
    print(-1)
else:
    print(ans)
import numpy as np
A, B, N = map(int, input().split())
x = np.arange(0,N+1,1)

num = (A*x/B)//1 - A * ((x/B)//1)

print(int(np.max(num)))

### FIXED CODE ###

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

x = min(B-1, N)
print(A*x // B - A * (x//B))
import sys
from fractions import gcd
[print("{}{}".format(gcd(k[0], k[1]), k[0] * k[1] // gcd(k[0], k[1]))) for i in sys.stdin for k in [[int(j) for j in i.split()]]]

### FIXED CODE ###


import sys
from fractions import gcd
[print("{} {}".format(gcd(k[0], k[1]), (k[0] * k[1]) // gcd(k[0], k[1]))) for i in sys.stdin for k in [[int(j) for j in i.split()]]]
abcd = input()
s = 0
i = 0
for i in range(8):
    a = abcd[0]
    for j in range(3):
        if (i >> j) & 1:
            a += '+'
        else:
            a += '-'
    s = eval(a)
    if s == 7:
        ans = a + '=' + '7'
        break
print(ans)

### FIXED CODE ###

abcd = input()
s = 0
i = 0
for i in range(8):
    a = abcd[0]
    for j in range(3):
        if (i >> j) & 1:
            a += '+'
        else:
            a += '-'
        a += abcd[j+1]
    s = eval(a)
    if s == 7:
        ans = a + '=' + '7'
        break
print(ans)
# -*- coding: utf-8 -*-

r = raw_input()
r=r-0x30
if r<=1199:
    print'ABC'
elif r<=2799:
    print'ARC'
else:
    print'AGC'


### FIXED CODE ###

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

a = raw_input()
r=int(a)
if r<=1199:
    print'ABC'
elif r<=2799:
    print'ARC'
else:
    print'AGC'
h,w=map(int,input().split())
L=[list(input()) for i in range(h)]
for i in range(h):
    for j in range(w):
        if L[i][j]=='#':
            if L[i][max(i-1,0)]!='#' and L[i][min(i+1,w-1)]!='#' and L[max(i-1,0)][j]!='#' and L[min(i+1,h-1)][j]!='#':
                print('No')
                exit()
print('Yes')

### FIXED CODE ###

h,w=map(int,input().split())
L=[list(input()) for i in range(h)]
for i in range(h):
    for j in range(w):
        if L[i][j]=='#':
            if L[i][max(j-1,0)]!='#' and L[i][min(j+1,w-1)]!='#' and L[max(i-1,0)][j]!='#' and L[min(i+1,h-1)][j]!='#':
                print('No')
                exit()
print('Yes')
n = int(input())
st = input()
h = []
for i in range(n):
  h.append(int(st[2*i]))
  
result = 0
now_max = 0

for i in range(n):
  if h[i] >= now_max:
    result = result + 1
    now_max = h[i]
             
print(result)

### FIXED CODE ###

n = int(input())
h = list(map(int,input().split(" ")))

result = 0
now_max = 0

for i in range(n):
    if h[i] >= now_max:
        result = result + 1
        now_max = h[i]

print(result)
a = int(input())
b = int(input())

c = a*b%2

if c = 0:
    print("Even")
else:
    print("Odd")


### FIXED CODE ###

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

c = a*b%2

if c == 0:
    print("Even")
else:
    print("Odd")
n = int(input())
h = [int(i) for i in input().split()]
if h[0] != 1:
    h[0] -= 1
if len(h) == 1:
    print('Yes')
else:
    for i in range(1, n):
        if h[i] > h[i - 1]:
            h[i] -= 1
        elif h[i] < h[h - 1]:
            print('No')
            exit()
    print('Yes')


### FIXED CODE ###

n = int(input())
h = [int(i) for i in input().split()]
h[0] -= 1
flag = [True]
if len(h) == 1:
    print('Yes')
else:
    for i in range(1, n):
        if h[i] > h[i - 1]:
            h[i] -= 1
        elif h[i] < h[i - 1]:
            print('No')
            exit()
    print('Yes')
import sys
input = sys.stdin.readline

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

def yakusu(x,X):
    for i in range(2,int(x**0.5)+1):
        if x%i==0:
            X.append(i)
            if x!=i:
                X.append(x//i)
    
A=[]
B=[]
yakusu(a,A)
yakusu(b,B)
A.sort()
B.sort()
#print(A,B)
kouyakusu=[]
i=0
j=0
while i<len(A) and j<len(B):
    if A[i]==B[i]:
        kouyakusu.append(A[i])
        i+=1
        j+=1
    elif A[i]>B[j]:
        j+=1
    else:
        i+=1

ans=0
for i in range(len(kouyakusu)):
    if not(kouyakusu[i]): continue
    ans+=1
    for j in range(i+1,len(kouyakusu)):
        if kouyakusu[j]%kouyakusu[i]==0:
            kouyakusu[j]=False

print(ans+1)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

def yakusu(x,X):
    for i in range(1,int(x**0.5)+1):
        if x%i==0:
            X.append(i)
            if x!=i:
                X.append(x//i)
    
A=[]
B=[]
yakusu(a,A)
yakusu(b,B)
A.sort()
B.sort()
#print(A,B)
kouyakusu=[]
i=0
j=0
while i<len(A) and j<len(B):
    if A[i]==B[j]:
        kouyakusu.append(A[i])
        i+=1
        j+=1
    elif A[i]>B[j]:
        j+=1
    else:
        i+=1

ans=0
for i in range(1,len(kouyakusu)):
    if not(kouyakusu[i]): continue
    ans+=1
    for j in range(i+1,len(kouyakusu)):
        if kouyakusu[j]%kouyakusu[i]==0:
            kouyakusu[j]=False
#print(kouyakusu)
print(ans+1)
#ABC131c

import math


a,b,c,d=map(int,input().split())


count_c=b//c - (a-1)//c
count_d=b//d - (a-1)//d
count_cd=b//(c*d//math.gcd(c,d)) - (a-1)//(c*d//math.gcd(c,d))

print(b-a+1-count_c-count_d+count_cd)



### FIXED CODE ###

#ABC131c 3.4以前ではmathではなくfractons

import fractions

a,b,c,d=map(int,input().split())


count_c=b//c - (a-1)//c
count_d=b//d - (a-1)//d
count_cd=b//(c*d//fractions.gcd(c,d)) - (a-1)//(c*d//fractions.gcd(c,d))

print(b-a+1-count_c-count_d+count_cd)
H,W,D = map(int, input().split())
fields = []
amaris = [[0] * (H*W) for i in range(D)] # あまり
for i in range(H):
    row = list(map(int, input().split()))
    # あまりがいくつかで分類
    for j,e in enumerate(row):
        n = (e-1) // D
        m = (e-1) % D
        amaris[m][n] = (i,j)

# print(amaris[:10])
# あまりごとに累積和を取っておく
acc = [[0] * (H*W) for i in range(D)]
for i in range(D):
    cnt = 0
    x_pre, y_pre = amaris[i][0]
    for j in range(1,(H*W)//D+1):
        coords = amaris[i][j]
        if isinstance(coords,int): break
        x = coords[0]
        y = coords[1]
        cnt += abs(x-x_pre)+abs(y-y_pre)
        acc[i][j] = cnt
        x_pre = x
        y_pre = y


Q = int(input())
for i in range(Q):
    l,r  = map(int, input().split())
    m = (l-1) % D
    s = (l-1) // D
    g = (r-1) // D
    ans = acc[m][g] - acc[m][s]
    print(ans)



### FIXED CODE ###

H,W,D = map(int, input().split())
fields = []
amaris = [[0] * (H*W//D+1) for i in range(D)] # あまり
for i in range(H):
    row = list(map(int, input().split()))
    # あまりがいくつかで分類
    for j,e in enumerate(row):
        n = (e-1) // D
        m = (e-1) % D
        amaris[m][n] = (i,j)

# あまりごとに累積和を取っておく
acc = [[0] * (H*W//D+1) for i in range(D)]
for i in range(D):
    cnt = 0
    x_pre, y_pre = amaris[i][0]
    for j in range(1,(H*W)//D+1):
        coords = amaris[i][j]
        if isinstance(coords,int): break
        x = coords[0]
        y = coords[1]
        cnt += abs(x-x_pre)+abs(y-y_pre)
        acc[i][j] = cnt
        x_pre = x
        y_pre = y
# print(acc)

Q = int(input())
for i in range(Q):
    l,r  = map(int, input().split())
    m = (l-1) % D
    s = (l-1) // D
    g = (r-1) // D
    ans = acc[m][g] - acc[m][s]
    print(ans)
#!/usr/bin/env python3
import sys

s = stdin.readline().strip()
sl = len(s)

cnt = 0
for i in range(sl//2):
  if s[i]!=s[sl-1-i]:
    cnt += 1

print(cnt)

### FIXED CODE ###

#!/usr/bin/env python3
from sys import stdin

s = stdin.readline().strip()
sl = len(s)

cnt = 0
for i in range(sl//2):
  if s[i]!=s[sl-1-i]:
    cnt += 1

print(cnt)
import sys

s=input()
a,b,c,d,e,f,g=0
while s[a]!="k":
    a+=1
    if a==len(s):
        print("NO")
        sys.exit()
b=a+1
while s[b]!="e":
    b+=1
    if b==len(s):
        print("NO")
        sys.exit()
c=b+1
while s[c]!="y":
    c+=1
    if c==len(s):
        print("NO")
        sys.exit()
d=c+1
while s[d]!="e":
    d+=1
    if d==len(s):
        print("NO")
        sys.exit()
e=d+1
while s[e]!="n":
    e+=1
    if e==len(s):
        print("NO")
        sys.exit()
f=e+1
while s[f]!="c":
    f+=1
    if f==len(s):
        print("NO")
        sys.exit()
g=f+1
while s[g]!="e":
    g+=1
    if not "e" in s[g]:
        print("NO")
        sys.exit()
if s=="keyence":print("YES")
else:
    if b+g==c+f==d+e:
        print("YES")
    elif a==0 and b!=1 and(c==b+1 and d==c+1 and e==d+1 and f==e+1 and g==f+1):
        print("YES")
    elif a==0 and b==1 and c!=2 and(d==c+1 and e==d+1 and f==e+1 and g==f+1):
        print("YES")
    elif a==0 and b==1 and c==2 and d!=3 and (e==d+1 and f==e+1 and g==f+1):
        print("YES")
    elif a==0 and b==1 and c==2 and d==3 and e!=4 and (f==e+1 and g==f+1):
        print("YES")
    elif a==0 and b==1 and c==2 and d==3 and e==4 and f!=5 and g==f+1:
        print("YES")
    elif a==0 and b==1 and c==2 and d==3 and e==4 and f!=5 and g!=6:
        print("YES")
    else:
        print("NO")

### FIXED CODE ###

s=input()
if (s[:7]=="keyence" or s[:6]+s[-1:]=="keyence" or s[:5]+s[-2:]=="keyence" or s[:4]+s[-3:]=="keyence" or s[:3]+s[-4:]=="keyence" or s[:2]+s[-5:]=="keyence" or s[:1]+s[-6:]=="keyence" or s[-7]=="keyence"):
    print("YES")
else:
    print("NO")
h,w=map(int,input().split())
s=[input() for _ in range(h)]
yoko_map=[[0 for i in range(w)] for j in range(h)]
tate_map=[[0 for i in range(w)] for j in range(h)]
for i in range(h):
    p=0
    s_=s[i]
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            yoko_map[i][p]=num
            p+=1
        p+=1
for i in range(h):
    p=0
    s_=''.join([s__[i] for s__ in s])
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            tate_map[p][i]=num
            p+=1
        p+=1
m=0
for i in range(h):
    yoko_=yoko_map[i]
    tate_=tate_map[i]
    for j in range(w):
        m=max(m,tate_[j]+yoko_[j])
print(m-1)

### FIXED CODE ###

h,w=map(int,input().split())
s=[input() for _ in range(h)]
yoko_map=[[0 for i in range(w)] for j in range(h)]
tate_map=[[0 for i in range(w)] for j in range(h)]
for i in range(h):
    p=0
    s_=s[i]
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            yoko_map[i][p]=num
            p+=1
        p+=1
for i in range(w):
    p=0
    s_=''.join([s__[i] for s__ in s])
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            tate_map[p][i]=num
            p+=1
        p+=1
m=0
for i in range(h):
    yoko_=yoko_map[i]
    tate_=tate_map[i]
    for j in range(w):
        m=max(m,tate_[j]+yoko_[j])
print(max(0,m-1))
# D - People on a Line
n,m = map(int,input().split())
e = [[] for _ in range(n)]
for i in range(m):
  l,r,d = map(int,input().split())
  l -= 1
  r -= 1
  e[l].append((r,d))
  e[r].append((l,-d))

INF = float('inf')
c = [INF for _ in range(n)]

def dfs(u,x):
  if c[u] == INF:
    c[u] = x
  else:
    if c[u] != x:
      print('No')
      exit()
  for v,d in e[u]:
    if c[v] != INF and c[v] == c[u]+d:
      continue
    dfs(v,c[u]+d)

for i in range(n):
  if c[i] == INF:
    dfs(i,0)
print('Yes')


### FIXED CODE ###

# D - People on a Line
import sys
sys.setrecursionlimit(10 ** 9)

n,m = map(int,input().split())
e = [[] for _ in range(n)]
for i in range(m):
  l,r,d = map(int,input().split())
  l -= 1
  r -= 1
  e[l].append((r,d))
  e[r].append((l,-d))

INF = float('inf')
c = [INF for _ in range(n)]

def dfs(u,x):
  c[u] = x
  for v,d in e[u]:
    if c[v] != INF:
      if c[v] == c[u]+d:
        continue
      else:
        print('No')
        exit()
    else:
      dfs(v,c[u]+d)

for i in range(n):
  if c[i] == INF:
    dfs(i,0)
print('Yes')
X,Y,Z,K=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
SUM=[]
for a in A:
  for b in B:
    for c in C:
      SUM.append(a+b+c)
      if c < A[min(60,X-1)] or c < B[min(60,Y-1)]:
        break
    if b < A[min(60,X-1)] or b < C[min(60,Z-1)]:
      break
  if a < B[min(60,Y-1)] or a < C[min(60,Z-1)]:
      break
SUM.sort(reverse=True)
for i in range(K):
  print(SUM[i])

### FIXED CODE ###

X,Y,Z,K=map(int,input().split())
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
SUM=[]
for i in range(X):
  for j in range(Y):
    for k in range(Z):
      if (i+1)*(j+1)*(k+1)<=K:
        SUM.append(A[i]+B[j]+C[k])
      else:
        break
SUM.sort(reverse=True)
for i in range(K):
  print(SUM[i])
a, b = map(int, input().split())
if b%a==0:;print(a+b)
else:;print(b-a)

### FIXED CODE ###

a, b = map(int, input().split())
if b%a==0:
    print(a+b)
else:
    print(b-a)
a, b = map(int, input().split())
c = a-1
d = b-1
x = c//d
if c%d != 0:
    print(x+1)
else:
    print(x)

### FIXED CODE ###

a, b = map(int, input().split())
c = a-1
d = b-1
x = d//c
if d%c != 0:
    print(x+1)
else:
    print(x)
s = input()
k = False
if s[0] == 'A' and s[2:-1].count('C') == 1:
    t = s[1:s.find('C')] + s[s.find('C')+1:]
    k = t.islower():
print('AC' if k else 'WA')

### FIXED CODE ###

s = str(input())
if s[0] == 'A' and s[2:-1].count('C') == 1 and (s[1:s.find('C')]+s[s.find('C')+1:]).islower():
    print('AC')
else:
    print('WA')
N = int(input())
Y = int(input())
flag = 0
for num_fs in range(N):
    if flag == 1:
        break
    for num_so in range(N):
        num_ts = N - num_so - num_fs
        sum = num_ts * 10000 + num_fs * 5000 + num_so * 1000
        if flag == 1 or num_ts < 0:
            break
        elif num_ts + num_fs + num_so == N and sum == Y:
            print(num_ts, num_fs, num_so)
            flag = 1
            break

if flag == 0:
    print("-1 -1 -1")


### FIXED CODE ###

N, Y = map(int, input().split())
flag = 0
for num_so in range(N+1):
    if flag == 1:
        break
    for num_fs in range(N+1):
        num_ts = N - num_so - num_fs
        sum = num_ts * 10000 + num_fs * 5000 + num_so * 1000
        if flag == 1:
            break
        elif sum == Y and num_ts >= 0:
            print(num_ts, num_fs, num_so)
            flag = 1
            break

if flag == 0:
    print("-1 -1 -1")
import math
n = int(input())
d = int(input())
print(math.ceil(n/(2*d+1)))

### FIXED CODE ###

import math
n,d = map(int,input().split())
print(math.ceil(n/(2*d+1)))
N = int(input())
a = list(map(int, input().split()))

p = [i for i in a if i >= 0]
n = [i for i in a if i < 0]

process = []
if len(p) > 0 and len(n) > 0:
    p_seed = p.pop(0)
    n_seed = n.pop(0)
    while len(n) > 0:
        sub = n.pop(0)
        process.append((p_seed, sub))
        p_seed -= sub
    while len(p) > 0:
        sub = p.pop(0)
        process.append((n_seed, sub))
        n_seed -= sub
    process.append((p_seed, n_seed))
    print(p_seed - n_seed)
    for x, y in process:
        print(f'{x} {y}')
else:
    target = p if len(p) > 0 else n
    target.sort(reverse=True)
    p_seed = target.pop(0)
    n_seed = target.pop(-1)
    while len(target) > 0:
        sub = target.pop(0)
        process.append((n_seed, sub))
        n_seed -= sub
    process.append((p_seed, n_seed))
    print(p_seed - n_seed)
    for x, y in process:
        print(f'{x} {y}')


### FIXED CODE ###

N = int(input())
a = list(map(int, input().split(' ')))
a.sort(reverse=True)

process = []
p_seed = a.pop(0)
n_seed = a.pop(-1)
for e in a:
    if e >= 0:
        process.append((n_seed, e))
        n_seed -= e
    else:
        process.append((p_seed, e))
        p_seed -= e
process.append((p_seed, n_seed))
m = p_seed - n_seed
print(m)
for x, y in process:
    print(str(x) + ' ' + str(y))
n = int(input())
a, b, c = [], [], []
for _ in range(n):
    x, y = map(int, input().split())
    a.append(max(y-x, x))
    b.append(max(x-y, y))
    c.append([x, y])
num = [x for x in range(n)]
a, a0 = zip(*sorted(zip(a, num)))
b, b0 = zip(*sorted(zip(b, num)))
ans = 0
a, a0, b, b0 = list(a), list(a0), list(b), list(b0)
for i in range(n):
    if i%2 == 0:
       val = a0.pop()
       ans += c[val][0]
       a.pop()
       b.pop(val)
       b0.pop(val)
    else:
       val = b0.pop()
       ans -= c[val][1]
       b.pop()
       a.pop(val)
       a0.pop(val)
print(ans)


### FIXED CODE ###

n = int(input())
ans, a, b = 0, [], []
for _ in range(n):
    x, y = map(int, input().split())
    a.append(x+y)
    b.append([x, y])
num = [x for x in range(n)]
a, a0 = zip(*sorted(zip(a, num)))
a, a0 = list(a), list(a0)

for i in range(n):
    val = a0.pop()
    a.pop()
    if i%2 == 0:
       ans += b[val][0]
    else:
       ans -= b[val][1]
print(ans)
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
if W >= V:
    print("NO")
else:
    C = abs(A - B)
    X = V - W
    if C // X > T:
        print("NO")
    else:
        print("YES")

### FIXED CODE ###

S = input()
print(S[0]+S[1]+S[2])
def root(x):
  if par[x] == x:
    return x
  par[x] = root(par[x])
  return par[x]

def union(x, y):
  rx = root(x)
  ry = root(y)
  if rx != ry:
    par[rx] = ry
  return 0
    
def same(x,y):
  rx = root(x)
  ry = root(y)
  return rx == ry
    
n, m=map(int, input().split(" "))
par = list(range(n + 1))
for i in range(m):
  a, b = map(int, input().split(" "))
  union(a, b)
#print(par)
maxi = 0
count = 1
#print(par)
countpar = [0 for i in range(n + 1)]
for i in range(1, n + 1):
  countpar[root(par[i])] += 1
print(max(countpar))


### FIXED CODE ###

import sys
import resource

def root(x):
  if par[x] == x:
    return x
  par[x] = root(par[x])
  return par[x]

def union(x, y):
  rx = root(x)
  ry = root(y)
  if rx != ry:
    par[rx] = ry
  return 0

sys.setrecursionlimit(10 ** 6)
n, m=map(int, input().split(" "))
par = list(range(n + 1))
for i in range(m):
  a, b = map(int, input().split(" "))
  union(a, b)
#print(par)
maxi = 0
count = 1
#print(par)
countpar = [0 for i in range(n + 1)]
#print(len(countpar), len(par))
for i in range(1, n + 1):
  countpar[root(par[i])] += 1
print(max(countpar))
#print(countpar, par)
import numpy as np
h,w,n = map(int, input().split())
a = [0]*n
b = [0]*n
for i in range(n):
    a[i],b[i] = map(int, input().split())
    a[i] -= 1; b[i] -= 1
    
## 左上のマスを(0,0)とする
## 正方形の左上のマスを(j,i)とする
sq = [[0]*(w-2) for i in range(h-2)] 

for x in range(n):
    for k in range(3):
        for l in range(3):
            i = a[x]-k ; j = b[x]-l
            if i<0 or i+3>h or j<0 or j+3>w:
                continue
            sq[i][j] += 1

sq = np.array(sq)

for j in range(10):
    print(np.count_nonzero(sq == j))

### FIXED CODE ###

from collections import defaultdict
d = defaultdict(int)

h,w,n = map(int, input().split())
a = [0]*n
b = [0]*n
for i in range(n):
    a[i],b[i] = map(int, input().split())
    a[i] -= 1; b[i] -= 1
    
## 左上のマスを(0,0)とする
## 正方形の左上のマスを(j,i)とする
sq_i = []
sq_j = []

for x in range(n):
    for k in range(3):
        for l in range(3):
            i = a[x]-k ; j = b[x]-l
            if i<0 or i+3>h or j<0 or j+3>w:
                continue
            d[(j,i)] += 1

ans =[0]*10
for k,v in d.items():
    ans[v] += 1
ans[0] = (h-2)*(w-2)-sum(ans)

for i in range(10):
    print(ans[i])
import math
n,a,b=map(int,input().split())
c=0
for i in range(1,n+1):
    c+=(math.factorial(n)//(math.factorial(n - i) * math.factorial(i)))%(pow(10,9)+7)

c=c-(math.factorial(n)//(math.factorial(n - a) * math.factorial(a)))%(pow(10,9)+7)
c=c-(math.factorial(n)//(math.factorial(n - b) * math.factorial(b)))%(pow(10,9)+7)
print(c)
#TLE

### FIXED CODE ###

n,r=map(int,input().split())
if n>=10:
    print(r)
else:
    print(r+100*(10-n))
count=0
while true:
    count+=1
    a=input()
    b=len(a)
    if b==0:
        break
    else:
        print("Case",count+":",a)


### FIXED CODE ###

count=0
while True:
    count=count+1
    a=input()
    if int(a)==0:
        break
    else:
        print("Case "+str(count)+": "+str(a))
a, b, k = map(int, input().split())
lst = list(range(a, b+1))
for i in lst:
  if lst.index(i)+1 <= k or len(lst) - lst.index(i)+1 <= k:
    print(i)

### FIXED CODE ###

a, b, k = map(int, input().split())
lst = range(a, b+1)
for i in sorted(set(lst[:k]) | set(lst[-k:])):
  print(i)
while 1:
     x, y = map(int, raw_input().split())
     if x == 0 and y == 0:
         break
     if x > y:
         print "%s %s" % (y,x)
     else:
         print "%s %s" % (x,y)
    

### FIXED CODE ###

while 1:
   x, y = map(int, raw_input().split())
   if x == 0 and y == 0:
      break
   elif x > y:
      print '%s %s' % (y,x)
   else:
      print '%s %s' % (x,y)
D,T,S= [int(x) for x in input("Enter values in the range of 1 and 10000: ").split(",")] 5
if (D and T) and S <=10000 and D/S==T:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

D,T,S= [int(x) for x in input().split()]
if 1<=(D and T)<=10000 and (1<=S<=10000 and D/S<=T):
    print("Yes")
else:
    print("No")
from collections import deque

A = deque(input())
B = deque(input())
C = deque(input())

current = A.popleft()

while True:
    if current == "a":
        current = A.popleft()
    elif current == "b":
        current = B.popleft()
    elif current == "c":
        current = C.popleft()
    if current == "a" and len(A) == 0:
        print("A")
        break
    elif current == "b" and len(B) == 0:
        print("B")
        break
    elif current == "c" and len(C) == 0:
        print("C")
        break

### FIXED CODE ###

from collections import deque

A = deque(input())
B = deque(input())
C = deque(input())

current = "a"

while True:
    if current == "a":
        current = A.popleft()
    elif current == "b":
        current = B.popleft()
    elif current == "c":
        current = C.popleft()
    if current == "a" and len(A) == 0:
        print("A")
        break
    elif current == "b" and len(B) == 0:
        print("B")
        break
    elif current == "c" and len(C) == 0:
        print("C")
        break