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

n,q=map(int,input().split())
nowbl=(n-2)**2
mu=[n-1]*n 
mh= [n-1]*n 

nowu=n-1 ; nowh=n-1
for i in range(q):
    a,b=map(int,input().split())
    a-=1;b-=1
    if a==0:
        if mu[b]==1:
            continue
        nowbl-= mu[b]-1
        mu[b]=0
        if nowu< b:
            continue
        nowu=b
        for i in range(1,nowh):
            mh[i]= min(mh[i],b)
        
    if a==1:
        a=b
        if mh[a]==1:
            continue
        nowbl-= mh[a]-1
        mh[a]=0
        if nowh< a:
            continue
        nowh= a 
        for i in range(1,nowu):
            mu[i]= min(mu[i],a)
print(nowbl)
        
        


### FIXED CODE ###

n,q=map(int,input().split())
x= n-2
y= n-2
dx={}
dy={}

for _ in range(q):
    a,b=map(int,input().split())
    b-=1
    if a==1:
        if y< b:
            dy[b]=0;continue
        # y= b-1
        for i in range(b+1,y+1):
            dy[i] = x
        y=b-1

    if a==2:
        if x < b:
            dx[b]=0;continue
        # x=b-1
        for i in range(b+1,x+1):
            dx[i] =y
        x=b-1
print(x*y + sum(dx.values()) + sum(dy.values()) )
### BUGGY CODE ###

# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
bins = [format(i, "b").zfill(60) for i in A]

keta = []
for i in range(60):
    tmp = list(map(int, [r[i] for r in bins]))
    keta.append(tmp[:])
keta.reverse()

ans = 0
for i in range(60):
    s = sum(keta[i])
    ans += s * (N - s) * 2 ** i
print(ans % mod)

### FIXED CODE ###

#入力値処理
N = int(input())
A = list(map(int, input().split()))
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    one = 0
    for a in A:
        if (a >> i & 1) == 1:
            one += 1
    ans += one * (N - one) * 2 ** i
    ans %= mod
print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline

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

if A.count(0):
    print(0)
else:
    for a in A:
        mal = mal * a
    if mal <= 10 ** 18:
        print(mal)
    else:
        print(-1)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 8)
input = sys.stdin.readline

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

    if A.count(0):
        print(0)
        return

    ans = 1
    for a in A:
        ans = ans * a
        if ans > 10 ** 18:
            print(-1)
            return
    print(ans)

Main()
### BUGGY CODE ###

# -*- coding: utf-8 -*-
# 整数の入力
n = int(input())
# スペース区切りの整数の入力
ar = []
for i in range(n):
  ar.append("".join(sorted(input())))

#for t in ar:
#  print(t)

count = 0
for i in range(n):
  for j in range(i+1, n):
    if ar[i] == ar[j]:
      count = count + 1
print(count)

### FIXED CODE ###

# -*- coding: utf-8 -*-
# 整数の入力
N = int(input())

# スペース区切りの整数の入力
ar = []
for i in range(N):
  l = list(input())
  l.sort()
  ar.append("".join(l).__hash__())

# 数を数える
list = {}
for i in ar:
  if i in list:
    list[i] = list[i] + 1
  else:
    list[i] = 1
  
count = 0
for i in list.values():
  n = i - 1
  count = count + int(((n * (n + 1)) / 2))

print(count)
### BUGGY CODE ###

k = int(input())

def check(num):
    elems = str(num)
    flag = 0
    for elem1, elem2 in zip(elems[:-1], elems[1:]):
        if abs(ord(elem1) - ord(elem2)) <= 1:
            pass
        else:
            flag = 1
            break
    if flag == 0:
        return num
    else:
        return -1

i = 1
lst = []
while len(lst) < k:
    res = check(i)
    if res != -1:
        lst.append(res)
    i += 1
print(lst[-1])

### FIXED CODE ###

def main():
     k = int(input())

     runrun = [1, 2, 3, 4, 5, 6, 7, 8, 9]
     count = 0
     while(len(runrun) < k):
          target = runrun[count]
          num = target % 10
          if num != 0:
               runrun.append(target * 10 + num - 1)
          runrun.append(target * 10 + num)
          if num != 9:
               runrun.append(target * 10 + num + 1)

          count += 1

     print(runrun[k-1])

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

def check(a, b, c):
	if(c<a+b and a<b+c and b<c+a):
		return True
	else:
		return False


n = int(input())
ListL = [int(i) for i in input().split()]

ListL.sort()

ans = 0
for i in range(n-2):
	a = ListL[i]
	for j in range(i+1, n-1):
		b = ListL[j]
		for k in range(j+1, n):
			c = ListL[k]
			if(check(a, b, c)):
				ans += 1
			else:
				break

print(ans)

### FIXED CODE ###

import bisect

n = int(input())
ListL = [int(i) for i in input().split()]

ListL.sort()
ans = 0

for i in reversed(range(2, n)):
	a = ListL[i]
	for j in reversed(range(1, i)):
		b = ListL[j]
		index = bisect.bisect_right(ListL, a-b)
		#print(a, b)
		if (index >= j):
			break
		else:
			ans += j - index

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

def resolve():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    import collections
    counter = collections.Counter(A)
    dp = [True for _ in range(max(A)+1)]
    ans = 0
    for a in A:
        if dp[a]:
            for j in range(max(A)//a+1):
                dp[a*j] = False
            if counter[a] == 1:
                ans += 1
    print(ans)

if '__main__' == __name__:
    resolve()


### FIXED CODE ###

def resolve():
    N = int(input())
    A = sorted(list(map(int, input().split())))
    import collections
    counter = collections.Counter(A)
    maxA = max(A)
    dp = [True for _ in range(max(A)+1)]
    for a in A:
        if counter[a] > 1:
            dp[a] = False
        for j in range(a+a, maxA+1, a):
            dp[j] = False
    #print(dp)
    print(sum(1 for a in A if dp[a]))

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

#!/usr/bin/env python3
import sys
INF = float("inf")

MOD = 1000000007  # type: int


def solve(S: str):
    dp = [0]*13
    dp[0] = 1
    ep = [0]*13
    zero = [0]*13
    for c in S:
        ep[:] = zero
        for i in range(10):
            if c != "?" and int(c) != i:
                continue
            for j in range(13):
                ep[(10*j+i) % 13] += dp[j]
                ep[(10*j+i) % 13] %= MOD
        dp, ep = ep, dp

    print(dp[5])

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
INF = float("inf")

MOD = 1000000007  # type: int


def solve(S: str):
    dp = [0]*13
    dp[0] = 1
    dpn = [0]*13
    keta = 1
    zero = 0
    # print(dp)
    for c in reversed(S):
        if c == "?":
            dpn = [0]*13
            for i in range(10):
                for j in range(13):
                    dpn[j] += dp[(j - i*keta) % 13]
                    dpn[j] %= MOD
            dp = dpn
        else:
            shift = (int(c)*keta) % 13
            dpn = [0]*13
            for i in range(13):
                dpn[i] = dp[(i-shift) % 13]
            # dpn = dp[13-shift:]+dp[:13-shift]
            dp = dpn

        # print(c, dp)
        keta *= 10
        keta %= 13

    print(dp[5])

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = next(tokens)  # type: str
    solve(S)


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

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


for i in range(N,-1,-1):
    if (N+1)//B-1 == i//B:
        ans_i = i
        break

if N//B == 0:
    ans_i = N

print((A*ans_i)//B - A*(ans_i//B))


### FIXED CODE ###

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


if N//B == 0:
    ans_i = N
else :
    ans_i = B*(N//B)-1

print((A*ans_i)//B - A*(ans_i//B))
### BUGGY CODE ###

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


def fact_table(N, MOD=10**9 + 7):

    inv = np.empty(N, np.int64)
    fact = np.empty(N, np.int64)
    fact_inv = np.empty(N, np.int64)

    inv[0] = 0
    inv[1] = 1
    for n in range(2, N):
        q, r = divmod(MOD, n)
        inv[n] = inv[r] * (-q) % MOD

    fact[0] = 1
    for n in range(1, N):
        fact[n] = n * fact[n - 1] % MOD

    fact_inv[0] = 1
    for n in range(1, N):
        fact_inv[n] = fact_inv[n - 1] * inv[n] % MOD

    return fact, fact_inv, inv


def main():

    N, M = in_nn()
    mod = 10**9 + 7
    fact, fact_inv, inv = fact_table(M + 1)

    def comb(n, r, mod=10**9 + 7):
        return fact[n] * fact_inv[r] % mod * fact_inv[n - r] % mod

    def perm(n, r, mod=10**9 + 7):
        return fact[n] * fact_inv[n - r] % mod

    ans = 0
    for i in range(N + 1):
        t = comb(N, i)

        t *= (-1)**(i % 2)
        t %= mod

        t *= perm(M, i)
        t %= mod

        t *= perm(M - i, N - i)
        t %= mod

        t *= perm(M - i, N - i)
        t %= mod

        ans += t
        ans %= mod

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

in_n = lambda: int(readline())
in_nn = lambda: map(int, readline().split())
in_nl = lambda: list(map(int, readline().split()))
in_na = lambda: map(int, read().split())
in_s = lambda: readline().rstrip().decode('utf-8')


class CombMod:

    def __init__(self, N, MOD=10**9 + 7):

        N = N + 1
        inv = [0] * N
        fact = [0] * N
        fact_inv = [0] * N

        inv[0] = 0
        inv[1] = 1
        for n in range(2, N):
            q, r = divmod(MOD, n)
            inv[n] = inv[r] * (-q) % MOD

        fact[0] = 1
        for n in range(1, N):
            fact[n] = n * fact[n - 1] % MOD

        fact_inv[0] = 1
        for n in range(1, N):
            fact_inv[n] = fact_inv[n - 1] * inv[n] % MOD

        self.fact = fact
        self.fact_inv = fact_inv
        self.inv = inv

    def comb(self, n, r, mod=10**9 + 7):
        return self.fact[n] * self.fact_inv[r] % mod * self.fact_inv[n - r] % mod

    def perm(self, n, r, mod=10**9 + 7):
        return self.fact[n] * self.fact_inv[n - r] % mod


def main():

    N, M = in_nn()
    mod = 10**9 + 7
    c = CombMod(M)

    ans = 0
    for i in range(N + 1):
        t = c.comb(N, i)

        t *= (-1)**(i % 2)
        t %= mod

        t *= c.perm(M, i)
        t %= mod

        t *= c.perm(M - i, N - i)
        t %= mod

        t *= c.perm(M - i, N - i)
        t %= mod

        ans += t
        ans %= mod

    print(ans)


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

from collections import Counter
from itertools import combinations

N = int(input())
c = Counter(["".join(sorted(list(input()))) for i in range(N)])
res = 0
for i in c.values():
  if i > 1:
    res += len(list(combinations([0 for n in range(i)],2)))

print(res)

### FIXED CODE ###

N = int(input())
l = ["".join(sorted(list(input()))) for i in range(N)]
d = {}
ans = 0

for text in l:
  if text in d.keys():
    d[text] += 1
    ans += d[text]
  else:
    d[text] = 0

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

N = int(input())
list = [int(N) for N in input().split()]
for i in range(N):
    print(list.count(i+1))

### FIXED CODE ###

import collections
N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
for i in range(1,N+1):
    print(c[i])
### BUGGY CODE ###

N, M, L = map(int,input().split())
rd = [[] for _ in range(N+1)]
rc = [[] for _ in range(N+1)]

for _ in range(M):
    a,b,c = map(int,input().split())
    if c <= L:
        rd[a].append(b)
        rc[a].append(c)
        rd[b].append(a)
        rc[b].append(c)

Q = int(input())
S = []
T = []
for _ in range(Q):
    s,t = map(int,input().split())
    S.append(s)
    T.append(t)

ZO = [[-1 for i in range(N+1)] for i in range(N+1)]
NP = [[10**9+1 for i in range(N+1)] for i in range(N+1)]

for i in range(1,N+1):
    for d,c in zip(rd[i], rc[i]):
        NP[i][d] = 0
        ZO[i][d] = L - c

up = True
while up:
    up = False
    for i in range(1,N+1):
        for j in range(1,N+1):
            if ZO[i][j] < 0: continue
            for d,c in zip(rd[j], rc[j]):
                if d == i: continue
                if ZO[i][j] < c:
                    nnp = NP[i][j] + 1
                    nzo = L - c
                else:
                    nnp = NP[i][j]
                    nzo = ZO[i][j] - c
                if NP[i][d] > nnp or NP[i][d] == nnp and ZO[i][d] < nzo:
                    ZO[i][d] = nzo
                    NP[i][d] = nnp
                    up = True
                    
for i in range(Q):
    if NP[S[i]][T[i]] > 10**9:
        print (-1)
    else:
        print(NP[S[i]][T[i]])

### FIXED CODE ###

import sys,queue,math,copy,itertools,bisect,collections,heapq


def wf(d,n):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d

def main():
    INF = 10**18
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    N,M,L = LI()
    road = [[INF] * N for _ in range(N)]
    for _ in range(M):
        a,b,c = LI()
        if c <= L:
            road[a-1][b-1] = c
            road[b-1][a-1] = c

    road = wf(road,N)


    gas = [[INF] * N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            if road[i][j] <= L:
                gas[i][j] = 1

    gas = wf(gas,N)

    Q = NI()
    for _ in range(Q):
        s,t = LI()
        if gas[s-1][t-1] == INF:
            print(-1)
        else:
            print(gas[s-1][t-1]-1)


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

import fractions
def main():
  _=int(input())
  a=list(map(int,input().split()))
  a1=a[0]
  fgcd=fractions.gcd
  for i in a:
    a1=(i*a1)//fgcd(i,a1)
  x=[a1//i for i in a]
  print(sum(x)%(10**9+7))
  
if __name__ == '__main__':
    main()

### FIXED CODE ###

import fractions
from functools import reduce
def main():
  _=input()
  a=tuple(map(int,input().split()))
  fgcd=fractions.gcd
  def lcm_base(x, y):
    return (x * y) // fgcd(x, y)
  def lcm(numbers):
    return reduce(lcm_base, numbers, 1)
  q=lcm(a)
  x=[q//i for i in a]
  print(sum(x)%(10**9+7))
  
if __name__ == '__main__':
    main()
### BUGGY CODE ###

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

S = []

while len(S)<N:
    for i in range(A):
        if len(S)<N:
            S.append('b')
    for j in range(B):
        if len(S)<N:
            S.append('r')

print(S.count('b'))

### FIXED CODE ###

N, A, B = input().split()
N = int(N)
A = int(A)
B = int(B)
ans=0

if N%(A+B)<=A:
    ans = N//(A+B) * A + N%(A+B)
else:
    ans = N//(A+B) * A + A

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

import math
import sys

n, m = map(int, input().split())
a_list = [-1]
for _ in range(m):
    a_list.append(int(input()))
a_list.append(n + 1)

memo = dict()
ans = 1
for i in range(1, len(a_list)):
    sub = a_list[i] - a_list[i-1] - 1
    if sub == 0:
        print(0)
        sys.exit()
    if sub <= 2:
        continue
    sub -= 1
    if sub in memo.keys():
        ans *= memo[sub]
        continue
    count = 0
    for j in range(sub // 2 + 1):
        count += math.factorial(sub - j) // math.factorial(j) // math.factorial(sub - j * 2)
    memo[sub] = count
    ans *= count
print(ans % 1000000007)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
readline = sys.stdin.readline

N, M = map(int, readline().split())
ans = [0] * (N + 2)
ans[0] = 1
for _ in range(M):
    a = int(readline())
    ans[a] = -1

for i in range(1, N + 1):
    if ans[i] == -1:
        continue
    a1 = max(ans[i - 2], 0)
    a2 = max(ans[i - 1], 0)
    ans[i] = a1 + a2

print(ans[N] % (10 ** 9 + 7))
### BUGGY CODE ###

N = int( input() )
h_list = list( map( int, input().split() ) )
h_list.append(10**10)
a = 0
new = 0
for i in range(N):
    j = i
    while(h_list[j] >= h_list[j + 1]):
        new += 1
        j += 1
    a = max(a,new)
    new = 0
print(a)

### FIXED CODE ###

N = int( input() )
h_list = list( map( int, input().split() ) )
h_list.append(10**10)
a = 0
new = 0
j = -1
for i in range(N):
    if j + 1 == i: 
        j = i
        while(h_list[j] >= h_list[j + 1]):
            new += 1
            j += 1
        a = max(a,new)
        new = 0
print(a)
### BUGGY CODE ###

n=int(input())
A=list(map(int,input().split()))
B=[]
S=''
for i in range(1,n+1):
  B.append(i)
for i in range(1,n+1):
  S+=str(B[A.index(i)])+' '
print(S)

### FIXED CODE ###

n=int(input())
A=[]*n
A[:]=map(int,input().split())
S=[' ']*n
for i in range(n):
  S[A[i]-1]=str(i+1)
print(' '.join(S))
### BUGGY CODE ###

s = input()
K = int(input())
a = set([])
for i in range(1,len(s)+1):
    for j in range(len(s)-i+1):
        a.add(s[j:j+i])
a = sorted(a)
print(a[K-1])

### FIXED CODE ###

def su(a,s,K):
    for i in range(1,K+1):
        for j in range(len(s)-i+1):
            a.add(s[j:j+i])
    a = sorted(a)
    return(a)
    
s = input()
K = int(input())
a = set([])
a = su(a,s,K)
print(a[K-1])
### BUGGY CODE ###

from functools import reduce
N, M = map(int,input().split())
ary1 =[]
for x in range(N):
  ary1.append(list(map(int,input().split())))

ary2 = sorted(ary1)
print(sum(reduce(lambda a,b: a+b ,[[x[0]]*x[1] for x in ary2])[0:M]))



### FIXED CODE ###

from functools import reduce
N, M = map(int,input().split())
ary1 =[]
for x in range(N):
  ary1.append(list(map(int,input().split())))

ary2 = sorted(ary1)
count = 0
total_sum = 0
for i in range(N):
  if count + ary2[i][1] <= M:
    total_sum += ary2[i][0] * ary2[i][1]
    count += ary2[i][1]
  elif count > M :
    break
  else:
    zan = M - count
    total_sum += ary2[i][0] * zan
    count += zan

print(total_sum)
### BUGGY CODE ###

from collections import deque

def bfs():
    global ans
    while q:
        p = q.popleft()
        for u in v:
            x, y = p[0] + u[0], p[1] + u[1]
            if 0 <= x < h and 0 <= y < w:
                if s[x][y] == -1:
                    s[x][y] = s[p[0]][p[1]] + 1
                    q.append([x, y])
                    ans = max(ans, s[x][y])
    return

h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
s = [[-1] * w for _ in range(h)]
v = [[1, 0], [-1, 0], [0, 1], [0, -1]]
q = deque()
ans = 0
for i in range(h):
    for j in range(w):
        if a[i][j] == "#":
            s[i][j] = 0
            q.append([i, j])
bfs()
print(ans)

### FIXED CODE ###

from collections import deque

def bfs():
    global ans
    while q:
        p = q.popleft()
        for u in v:
            x, y = p[0] + u[0], p[1] + u[1]
            if 0 <= x < h and 0 <= y < w:
                if s[x][y] == -1:
                    s[x][y] = s[p[0]][p[1]] + 1
                    q.append([x, y])
                    ans = max(ans, s[x][y])
    return

h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
s = [[-1] * w for _ in range(h)]
v = [[1, 0], [-1, 0], [0, 1], [0, -1]]
q = deque()
ans = 0
for i in range(h):
    for j in range(w):
        if a[i][j] == "#":
            s[i][j] = 0
            q.append([i, j])
bfs()
print(ans)
### BUGGY CODE ###


[N,K] = list(map(int,input().split()))
A = list(map(int,input().split()))
# print('A:',A)
hyoten=[0]*N

dammy=1
for i in range(K):
    dammy*=A[i]
# print('dammy0:', dammy)
hyoten[K-1] = dammy

for i in range(K,N):
    dammy/=A[i-K]
    dammy*=A[i]
    hyoten[i]=dammy

# print('hyoten:',hyoten)

for i in range(K,N):
    if hyoten[i-1]<hyoten[i]:
        print('Yes')
    else:
        print('No')


### FIXED CODE ###


[N,K] = list(map(int,input().split()))
A = list(map(int,input().split()))
# print('A:',A)

for i in range(K,N):
    if A[i-K]<A[i]:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

n, m = map(int, input().split())
a = [int(x) for x in input().split()]
a = sorted(a)
d = []
for i in range(m):
    b, c = map(int, input().split())
    d.extend([c] * b)
d = sorted(d)
k = d.pop()
for i in range(n):
    if k > a[i]:
        a[i] = k
        if len(d) == 0:
            break
        k = d.pop()
    else:
        break
print(sum(a))

### FIXED CODE ###

n, m = map(int, input().split())
a = [[1, int(x)] for x in input().split()]
bc = [list(map(int, input().split())) for x in range(m)]
a.extend(bc)
a = sorted(a, key=lambda x: x[1], reverse=True)
d = []
ans = 0
cnt = 0
for x in a:
    if cnt > n:
        break
    k = x[0]
    if cnt + k > n:
        k = n - cnt
    ans += x[1] * k
    cnt += k
print(ans)
### BUGGY CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()

A = FLI()

flg = False
for a in A:
   if A.count(a) > 1:
      print("NO")
      exit()

print("YES")

### FIXED CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()

A = FLI()

flg = len(set(A)) == n

print("YES" if flg else "NO")
### BUGGY CODE ###

import bisect

h,w,n = map(int, input().split())

# 黒マス black[y座標] = [x1,x2,...]
black = dict()

# 周囲に黒マスがあるマス
search = set()

for i in range(n):
    a,b = map(int, input().split())
    a-=1
    b-=1
    for x in [-1,0,1]:
        for y in [-1,0,1]:
            if 1<=a+y<h-1 and 1<=b+x<w-1:
                search.add((a+y,b+x))  # タプル。set()内にリストは格納できない。
    try:
        black[a].append(b)
    except:
        black[a]=[b]

# 二分探索のためソート
for b in black:
    black[b].sort()


ans = [0]*10
# 探索すべき全マスに対して、周囲の黒マスの数を数える。
for a,b in search:
    p = 0
    for y in [-1,0,1]:
        for x in [-1,0,1]:
            try:
                c = black[a+y]
                if b+x==c[bisect.bisect_left(c,b+x)]:
                    p+=1
            except:
                continue
    ans[p]+=1
ans[0]=(h-2)*(w-2)-sum(ans[1:])

for a in ans:
    print(a)

### FIXED CODE ###

h,w,n = map(int, input().split())

# 黒マス black[y座標] = [x1,x2,...]
black = dict()

# 周囲に黒マスがあるマス
search = set()

for i in range(n):
    a,b = map(int, input().split())
    a-=1
    b-=1
    for x in [-1,0,1]:
        for y in [-1,0,1]:
            if 1<=a+y<h-1 and 1<=b+x<w-1:
                search.add((a+y,b+x))  # タプル。set()内にリストは格納できない。
    try:
        black[a][b]=1
    except:
        black[a]=dict()
        black[a][b]=1


ans = [0]*10
# 探索すべき全マスに対して、周囲の黒マスの数を数える。
for a,b in search:
    p = 0
    for y in [-1,0,1]:
        for x in [-1,0,1]:
            try:
                if black[a+y][b+x]==1:
                    p+=1
            except:
                continue
    ans[p]+=1
ans[0]=(h-2)*(w-2)-sum(ans[1:])

for a in ans:
    print(a)