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

n,m=map(int,input().split())
a=[0 for i in range(n)]
for i in range(m):
  l,r=map(int,input().split())
  for j in range(l,r+1):
    a[j-1]+=1
print(a.count(m))

### FIXED CODE ###

n,m=map(int,input().split())
lll=[]
rrr=[]
for i in range(m):
  l,r=map(int,input().split())
  lll.append(l)
  rrr.append(r)
print(max(0,min(rrr)-max(lll)+1))
### BUGGY CODE ###

N = int(input())
s = []
ans = 0
i=0
for n in range(N):
    S=input()
    tmp=list(S)
    tmp.sort()
    s.append("".join(tmp))

while i<N:
    j = i + 1
    while j<N:
        if s[i] == s[j]:
            ans += 1
        j += 1
    i += 1

print(ans)

### FIXED CODE ###

import collections

N = int(input())
s = ["".join(sorted(input())) for _ in range(N)]
c = collections.Counter(s)
ans = sum(x*(x-1)//2 for x in c.values())
print(ans)
### BUGGY CODE ###

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

b = []
total = 0

for i in range(n):
    b.append(0)

for i in range(n):
    b[a[i]-1] += 1

for i in range(n):
    b[a[i]-1] -= 1
    for j in range(n):
        if b[j] >= 2:
            total += b[j]*(b[j]-1)//2
    print(total)
    total = 0
    b[a[i]-1] += 1


### FIXED CODE ###

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

b = []
total = 0

for i in range(n):
    b.append(0)

for i in range(n):
    b[a[i]-1] += 1
for i in range(n):
    if b[i] >= 2:   
        total += b[i]*(b[i]-1)//2



for i in range(n):
    ans = total
    ans -= b[a[i]-1]*(b[a[i]-1]-1)//2
    b[a[i]-1] -= 1
    ans += b[a[i]-1]*(b[a[i]-1]-1)//2
    print(ans)
    b[a[i]-1] += 1
### BUGGY CODE ###

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

ans = 1

for d in data:
  ans = ans * int(d)

if ans > 10**18:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

n = int(input())
data = list(map(int, input().split()))
data.sort()
data.reverse()

while data[-1] == 0:
  data.insert(0,0)
  data.pop(-1)
 
ans = 1

for d in data:
  ans = ans * int(d)
  if ans > 10**18 or ans == 0:
    break
 
if ans > 10**18:
  print(-1)
else:
  print(ans)
### BUGGY CODE ###

MOD = 10**9 + 7
n = int(input())
a = list(map(int, input().split()))
s = 0
for i in range(n-1):
    for j in range(i+1, n):
        s += (a[i]^a[j])%MOD
        s %= MOD
print(s)

### FIXED CODE ###

MOD = 10**9 + 7
n = int(input())
a = list(map(int, input().split()))
s = 0
m = 1
for i in range(60):
    c = sum(ai & m for ai in a)
    c //= m
    s = (s + m*c*(n-c))%MOD
    m <<= 1
print(s)
### BUGGY CODE ###

import sys
import collections
input = sys.stdin.readline
N = int(input())
S = input().strip()
assert 1 <= N <= 4000
assert N == len(S)
A = S.count('R')*S.count('G')*S.count('B')
total = 0
for j in range(1, N-1):
    for i in range(j):
        k = 2*j-i
        if k < len(S):
            if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
                total += 1
# print(c["R"]*c["G"]*c["B"]-total)
print(A - total)


### FIXED CODE ###

n = int(input())
s = input()
r,g,b =0,0,0
ls = len(s)
for i in range(ls):
    if s[i]=='R':
        r+=1
    elif s[i]=='G':
        g+=1
    elif s[i]=='B':
        b+=1
cnt =0
for j in range(1,ls-1):
    for i in range(j):
        k = 2*j-i
        if k<ls:
            if s[i]!=s[j] and s[i]!=s[k] and s[j]!=s[k]:
                cnt+=1
print(r*g*b-cnt)
### BUGGY CODE ###

# coding: utf-8
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N, W = map(int, input().split())
dp = [[0 for j in range(W+1)] for i in range(N+1)]

for i in range(N):
    w, v = map(int, input().split())
    for sum_w in range(W+1):
        # i番目の品を取る
        if w <= sum_w:
            dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w - w] + v)
        # i番目の品を取らない
        dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])

print(dp[-1][-1])

### FIXED CODE ###

# coding: utf-8
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N, W = map(int, input().split())
dp = [[0 for j in range(W+1)] for i in range(N+1)]

for i in range(N):
    w, v = map(int, input().split())
    for sum_w in range(W+1):
        # i番目の品を取る
        if w <= sum_w:
            dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w - w] + v)
        # i番目の品を取らない
        dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])

print(dp[-1][-1])
### BUGGY CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = 29
val = 0

from bisect import bisect_left as bll, bisect_right as brr
def bl(bb, ind):
        if ind in dl:
            return dl[ind]
        else:
            tt = bll(bb, ind)
            dl[ind] = tt
            return tt
def br(bb, ind):
    if ind in dr:
        return dr[ind]
    else:
        tt = brr(bb, ind)
        dr[ind] = tt
        return tt

for k in range(l):
    # i桁目を求める
    tmp = pow(2, k+1)
    bb = [item%(tmp) for item in b]
    bb.sort()
    ans = 0
    dl = {}
    dr = {}
    if k==11:
        bl = bll
        br = brr
    for item in a:
        aa = item%tmp
        if aa<=tmp//2:
            ans += (br(bb, tmp-1-aa) - bl(bb, tmp//2-aa))%2
        else:
            ans += (br(bb, tmp-1-aa) + (n - bl(bb, tmp//2*3-aa)))%2
    if ans%2:
        val += pow(2, k)
print(val)

### FIXED CODE ###

import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
l = 29
val = 0

def lcount(a,b,x):
    """ソート済a,bに対して, a[i]+b[j]<=xなるi,jの個数
    """
    la = len(a)
    lb = len(b)
    j = -1
    ans = 0
    for i in range(la-1, -1, -1):
        while j+1<lb and a[i]+b[j+1]<=x:
            j += 1
        ans += (j+1)
    return ans
for k in range(l):
    # i桁目を求める
    tmp = pow(2, k+1)
    bb = [item%(tmp) for item in b]
    aa = [item%(tmp) for item in a]
    aa.sort()
    bb.sort()
    ans = n**2 - lcount(aa,bb,tmp//2*3-1) + lcount(aa,bb,tmp-1) - lcount(aa,bb,tmp//2-1)
    if ans%2:
        val += pow(2, k)
print(val)
### BUGGY CODE ###

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

k = int(input())
ans = 0
for l in range(1,k+1):
  for m in range(1,k+1):
    for n in range(1,k+1):
      ans += gcd(l,m,n)

print(ans)

### FIXED CODE ###

import math
import itertools
def gcd(lst):
  return math.gcd(math.gcd(lst[0],lst[1]), lst[2])

k = int(input())
lst = [i for i in range(1,k+1)]
itr = itertools.combinations_with_replacement(lst, 3)
ans = 0

for i in itr:
  st = set(i)
  num = len(st)
  if num == 1:
    ans += i[0]
  elif num == 2:
    a,b = st
    ans += math.gcd(a,b) * 3
  else:
    ans += math.gcd(math.gcd(i[0],i[1]), i[2]) * 6

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

def f(n):
    a=0
    while n%2==0:
        n//=2
        a+=1
    return a    
n,m,*a=map(int,open(0).read().split())
c=[f(i) for i in a]
if sum(c)!=c[0]*n:
    print(0)
    exit()
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
a=list(set(a))
a=[i//(2**c[0]) for i in a]
b=a[0]
for i in a:
    b=lcm(i,b)
b*=(2**c[0])    
print(0 if b//2>m else (m-b//2)//b+1)  

### FIXED CODE ###

def f(n):
    a=0
    while n%2==0:
        n//=2
        a+=1
    return a    
n,m,*a=map(int,open(0).read().split())
c=[f(i) for i in a]
if sum(c)!=c[0]*n:
    print(0)
    exit()
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
a=list(set(a))
a=[i//(2**c[0]) for i in a]
b=a[0]
for i in a:
    b=lcm(i,b)
    if b*(2**c[0])>2*m:
        print(0)
        exit()
b*=2**c[0]    
print(0 if b//2>m else (m-b//2)//b+1)
### BUGGY CODE ###

N = int(input())
Al = input().split()
A = list( map((lambda x: int(x)), Al))
num = 0
ma = 10**9 + 7

for i in range(N):
  num = (num + A[i]*sum(A[i+1:])) % ma

print(num)


### FIXED CODE ###

N = int(input())
Al = input().split()
A = list( map((lambda x: int(x)), Al))
num = 0
ma = 10**9 + 7
li = 0

for i in range(N-1, 0, -1):
  li += A[i]
  num += A[i-1] * li

num = num % ma
print(num)
### BUGGY CODE ###

# D - RGB Triplets
import itertools 

n = int(input())
s = str(input())

R = [i for i, x in enumerate(s) if x=='R']
G = [i for i, x in enumerate(s) if x=='G']
B = [i for i, x in enumerate(s) if x=='B']

ans = 0
for r, g, b in itertools.product(R, G, B):
    mi = min(r, g, b)
    ma = max(r, g, b)
    if (r+g+b)==mi+ma+(mi+ma)/2:
        continue
    else:
        ans += 1

print(ans)

### FIXED CODE ###

# D - RGB Triplets

n = int(input())
s = str(input())

r = len([i for i, x in enumerate(s) if x=='R'])
g = len([i for i, x in enumerate(s) if x=='G'])
b = len([i for i, x in enumerate(s) if x=='B'])

ans = r * g * b

for i in range(n):
    for j in range(i+1, n):
        k = j+j-i
        if k >= n:
            break
        if s[i]!=s[j] and s[j]!=s[k] and s[k]!=s[i]:
            ans -= 1

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

import sys
 
N , M = (int(a) for a in input().split())
stair = [1]
brake = []
for i in range(1 , M+1) :
    a = int(input())
    brake.append(a)
 
for i in range(1, N+1) :
    if i in brake :
        brake.pop(0)
        stair.append(0)
    elif i == 1 : 
        stair.append(1) 
    else : stair.append((stair[i-1] + stair[i-2]) % (10**9+7))
    
print(stair[N])

### FIXED CODE ###

# coding: utf-8
# Your code here!

import sys
 
N , M = (int(a) for a in input().split())
stair = [1]
brake = []
for i in range(0, N + 1):
    brake.append(False)
for i in range(1 , M+1) :
    a = int(input())
    brake[a] = True

for i in range(1, N+1) :
    if brake[i] :
        stair.append(0)
    elif i == 1 : 
        stair.append(1) 
    else : stair.append((stair[i-1] + stair[i-2]) % (10**9+7))
         
print(stair[N])
### BUGGY CODE ###

n,k=map(int,input().split())
l=list(map(int,input().split()))
ans=[]
s=0

for i in range(k,n+1):
  p = l[i-k:i]
  for j in range(k):
    s += int(0.5*p[j]*(p[j]+1))/p[j]
  
  ans.append(s)
  s=0
  
print(max(ans))

### FIXED CODE ###

n, k = list(map(int, input().split()))
p = list(map(int, input().split()))
s = sum(p[:k])
m = s

for i in range(n-k):
  s = s-p[i]+p[i+k]
  if m < s:
    m = s
print((m+k)/2)
### BUGGY CODE ###

from collections import defaultdict
from queue import Queue

n, m = list(map(int, input().split()))
MX = int(1e6)
edge = defaultdict(set)
dist = [[MX, MX, MX] for i in range(n)]
reached = [[False, False, False] for i in range(n)]

for loop in range(m):
    a, b = list(map(int, input().split()))
    edge[a-1].add(b-1)

s, t = list(map(int, input().split()))
s = s-1
t = t-1
dist[s][0] = 0

q = Queue()
q.put((s, 0))
while not q.empty():
    node, step = q.get()
    next_step = (step + 1) % 3
    for next_node in edge[node]:
        if reached[next_node][next_step]: continue
        q.put((next_node, next_step))
        reached[next_node][next_step] = True
        if step == 2:
            dist[next_node][next_step] = min(dist[next_node][next_step], dist[node][step] + 1)
        else:
            dist[next_node][next_step] = min(dist[next_node][next_step], dist[node][step])

if dist[t][0] == MX:
    print(-1)
else:
    print(dist[t][0])



### FIXED CODE ###

from collections import defaultdict
from queue import Queue

n, m = list(map(int, input().split()))
MX = int(1e6)
edge = defaultdict(set)
dist = [[MX, MX, MX] for i in range(n)]
reached = [[False, False, False] for i in range(n)]

for loop in range(m):
    a, b = list(map(int, input().split()))
    edge[a-1].add(b-1)

s, t = list(map(int, input().split()))
s = s-1
t = t-1
dist[s][0] = 0

q = Queue()
q.put((s, 0))
while not q.empty():
    node, step = q.get()
    next_step = (step + 1) % 3
    for next_node in edge[node]:
        if reached[next_node][next_step]: continue
        q.put((next_node, next_step))
        reached[next_node][next_step] = True
        if step == 2:
            dist[next_node][next_step] = min(dist[next_node][next_step], dist[node][step] + 1)
        else:
            dist[next_node][next_step] = min(dist[next_node][next_step], dist[node][step])

if dist[t][0] == MX:
    print(-1)
else:
    print(dist[t][0])
### BUGGY CODE ###

def resolve():
        n, k = map(int, input().split())
        a = list(map(int, input().split()))
        bn1 = [0] * n
        bn2 = [0] * n
        s = 0
        t = 0
        check=[0]*n
        for _ in range(k):
            for i in range(n):
                b1 = max(i - a[i], 0)
                b2 = min(i + a[i], n - 1)
                bn1[b1] += 1
                bn2[b2] += 1
            for i in range(n):
                s += bn1[i]
                a[i] = s
            s = 0
            for i in range(1, n):
                t += bn2[i - 1]
                a[i] -= t
                if a[i]==n and check[i]==0:
                    check[i]=1
            if sum(check)==n:
                break
            t = 0
            bn1 = [0] * n
            bn2 = [0] * n
        c = [str(x) for x in a]
        L = " ".join(c)
        print(L)
resolve()

### FIXED CODE ###

def resolve():
        n, k = map(int, input().split())
        a = list(map(int, input().split()))
        bn1 = [0] * n
        s = 0
        t = 0
        chec = 0
        for _ in range(k):
            for i in range(n):
                b1 = max(i - a[i], 0)
                b2 = min(i + a[i], n - 1)
                bn1[b1] += 1
                if b2<n-1:
                    bn1[b2+1] -= 1
            for i in range(n):
                s += bn1[i]
                a[i] = s
                if s==n:
                    chec+=1
            s = 0
            if chec == n:
                break
            chec = 0
            bn1 = [0] * n
        c = [str(x) for x in a]
        L = " ".join(c)
        print(L)
resolve()
### BUGGY CODE ###

n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
fib=[0]*(n+2)
fib[0]=1
fib[1]=[1,0][a.count(1)]
for i in range(2,n+1):
  fib[i]=[fib[i-1]+fib[i-2],0][a.count(i)]
  fib[i]%=10**9+7
print(fib[n])

### FIXED CODE ###

n,m=map(int,input().split())
mod=10**9+7
a=[False]*(n+1)
for i in range(m):
  a[int(input())]=True
fib=[0]*(n+1)
fib[0]=1
fib[1]=[1,0][a[1]]
for i in range(2,n+1):
  if a[i]:
    fib[i]=0
  else:
    fib[i]=(fib[i-1]+fib[i-2])%mod
print(fib[n])
### BUGGY CODE ###

S = list(input())
Q = int(input())
flag = 0
for i in range(Q):
    Query = list(map(str, input().split()))
    if Query[0] == "1":
        if flag == 0:
            flag = 1
        else:
            flag = 0
    elif Query[1] == "1" and flag == 0:
        S.insert(0, Query[2])

    elif Query[1] == "1" and flag == 1:
        S.append(Query[2])

    elif Query[1] == "2" and flag == 0:
        S.append(Query[2])

    elif Query[1] == "2" and flag == 1:
        S.insert(0, Query[2])

if flag == 0:
    print("".join(S))

else:
    S.reverse()
    print("".join(S))


### FIXED CODE ###

import collections
S = input()
Q = int(input())
q = collections.deque()
q.append(S)
inversion = True
for i in range(Q):
    Query = list(map(str, input().split()))
    if Query[0] == "1":
        inversion = not(inversion)
    elif Query[1] == "1":
        if inversion:
            q.appendleft(Query[2])
        else:
            q.append(Query[2])
    else:
        if inversion:
            q.append(Query[2])
        else:
            q.appendleft(Query[2])

if inversion:
    print("".join(q))
else:
    print("".join(q)[::-1])
### BUGGY CODE ###

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

def count_kth_bit(k):
    ret = 0
    t = 2**k
    am = list(sorted([a%(2*t) for a in A]))
    bm = list(sorted([b%(2*t) for b in B]))

    r1 = r2 = r3 = 0
    for a in reversed(am):
        while r1 < N and a + bm[r1] < t:
            r1 += 1
        while r2 < N and a + bm[r2] < 2*t:
            r2 += 1
        while r3 < N and a + bm[r3] < 3*t:
            r3 += 1
        ret += (r2-r1) + (N-r3)
    return ret

ans = 0
for k in range(29):
    c = count_kth_bit(k)
    ans += ((c%2) << k)
print(ans)

### FIXED CODE ###

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

def count_kth_bit(k):
    ret = 0
    t = 2**k
    am = list(sorted([a%(2*t) for a in A]))
    bm = list(sorted([b%(2*t) for b in B]))

    r1 = r2 = r3 = 0
    for a in reversed(am):
        while r1 < N and a + bm[r1] < t:
            r1 += 1
        while r2 < N and a + bm[r2] < 2*t:
            r2 += 1
        while r3 < N and a + bm[r3] < 3*t:
            r3 += 1
        ret += (r2-r1) + (N-r3)
    return ret

ans = 0
for k in range(29):
    c = count_kth_bit(k)
    ans += ((c%2) << k)
print(ans)
### BUGGY CODE ###

n=int(input())
s=input()
l,r=[],[]
ans=float("inf")
for i in range(n):
    k=0
    l=s[:i]
    r=s[i:]
    k+=l.count("W")
    k+=r.count("E")
    ans=min(ans,k)
print(ans)

### FIXED CODE ###

n=int(input())
s=input()
l,r=[],[]
ans=min(s.count("W"),s.count("E"))
k=s.count("E")
for i in range(n):
    if s[i]=="W":
        k+=1
    else:
        k-=1
    ans=min(ans,k)
print(ans)
### BUGGY CODE ###

S=input()
Q=int(input())
for i in range(Q):
    L=list(input().split())
    if L[0]=="1":
        S=S[::-1]
    else:
        if L[1]=="1":
            S=L[2]+S
        else:
            S=S+L[2]
print(S)
            


    









        

    









    

        




    















    



    





    






        






    
















        


























            
    


    


    
    














    


    














### FIXED CODE ###

from collections import deque
S=input()
d=deque()
for i in S:
    d.append(i)
Q=int(input())
Flag=True
for i in range(Q):
    L=input().split()
    if L[0]=="1":
        Flag=not Flag
    else:
        if L[1]=="1" and Flag or L[1]=="2" and not Flag:
            d.appendleft(L[2])
        else:
            d.append(L[2])
ans=""
for i in d:
    ans+=i
if not Flag:
    ans=ans[::-1]
print(ans)
### BUGGY CODE ###

MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)

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

    power = 10
    dic = {i:0 for i in range(2019)}
    dic[0] = 1
    for _ in range(len(str(s))):
        x = s%power%2019
        dic[x] += 1
        power *= 10
    
    ans = 0
    for v in dic.values():
        ans += v*(v - 1)//2
    print(ans)
if __name__ == '__main__':
    main()

### FIXED CODE ###

MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)

def main():
    s = input()

    power = 1
    dic = [0] * 2019
    dic[0] = 1
    x = 0
    dic1 = {i:j for i,j in zip('0123456789',range(10))}
    for i in range(len(s)-1,-1,-1):
        x += power * dic1[s[i]]
        x %= 2019
        dic[x] += 1
        power *= 10
        power %= 2019
    
    ans = 0
    for v in dic:
        ans += v*(v - 1)//2
    print(ans)
if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))  # applies to only numbers
rs = lambda: stdin.readline().rstrip()  # ignores trailing space

N = ri()
B = rl()
l = []
for i in range(N):
    if i + 1 < B[i]:
        print(-1)
        exit()

while B:
    for i in range(len(B)-1, -1, -1):
        while True:
            if i + 1 == B[i]:
                if i == len(B)-1:
                    l.append(B.pop(i))
                    break
                elif B[i+1] <= i+1:
                    l.append(B.pop(i))
                else:
                    break
            else:
                break

l = l[::-1]
print(*l, sep='\n')
# 47

### FIXED CODE ###

import sys

stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))  # applies to only numbers
rs = lambda: stdin.readline().rstrip()  # ignores trailing space

N = ri()
B = rl()
l = []
for i in range(N):
    if i + 1 < B[i]:
        print(-1)
        exit()

while B:
    for i in range(len(B)-1, -1, -1):
        if i + 1 == B[i]:
            l.append(B.pop(i))
            break

l = l[::-1]
print(*l, sep='\n')
# 47
### BUGGY CODE ###

def main():
    from sys import stdin
    #input = stdin.readline
    import numpy as np
    h, w, n = map(int, input().split())
    ab = [list(map(int, input().split())) for _ in [0]*n]
    ab_d = {(a, b) for a, b in ab}

    ans = [set() for _ in range(10)]
    ans[0] = 0
    for a, b in ab:
        temp = np.zeros((5, 5), dtype=np.int8)
        yoko_0 = max(3-b, 0)
        yoko_1 = min(w-b+3, 5)
        tate_0 = max(3-a, 0)
        tate_1 = min(h-a+3, 5)
        for i in range(tate_0, tate_1):
            for j in range(yoko_0, yoko_1):
                if (a+i-2, b+j-2) in ab_d:
                    temp[i, j] = 1
        # print(temp)
        [ans[np.sum(temp[i:i+3, j:j+3])].add((a+i, b+j)) for i in range(tate_0, tate_1-2) for j in range(yoko_0, yoko_1-2)]

    for i in range(9):
        ans[i+1] = len(ans[i+1])

    print((h-2)*(w-2)-sum(ans))
    for i in ans[1:]:
        print(i)


main()

### FIXED CODE ###

h,w,n=map(int,input().split())
ab=[list(map(int,input().split())) for _ in [0]*n]
ab_d={a*(10**9)+b-1 for a,b in ab}

ans=[set() for _ in range(9)]
for a,b in ab:
    temp=[None for _ in [0]*25]
    for i in range(5):
        for j in range(5):
            if 0<a+i-2<=h and 0<b+j-2<=w:
                if (a+i-2)*(10**9)+b+j-3 in ab_d:
                    temp[i*5+j]=1
                else:
                    temp[i*5+j]=0
    for i in range(3):
        for j in range(3):
            cnt=[temp[(i+k)*5+j+l] for k in range(3) for l in range(3)]
            if None not in cnt:
                ans[sum(cnt)-1].add((a+i-2)*(10**9)+b+j-3)
                
for i in range(9):
    ans[i]=len(ans[i])

print((h-2)*(w-2)-sum(ans))
for i in ans:
    print(i)
### BUGGY CODE ###

# ABC073C - Write and Erase
import sys
input = sys.stdin.readline

n = int(input())
arr = []
for _ in range(n):
    m = int(input())
    if m in arr:
        arr.pop(arr.index(m))
    else:
        arr += [m]
print(len(arr))

### FIXED CODE ###

# ABC073C - Write and Erase
import sys
input = sys.stdin.readline

n = int(input())
arr = set()
for _ in range(n):
    m = int(input())
    if m in arr:
        arr.remove(m)
    else:
        arr.add(m)
print(len(arr))
### BUGGY CODE ###

# Segment tree (GCD)
from fractions import gcd


class SegmentTree():
    _data = []
    _offset = 0
    _size = 0

    def __init__(self, size):
        _size = size
        t = 1
        while t < size:
            t *= 2
        self._offset = t - 1
        self._data = [0] * (t * 2 - 1)

    def update_all(self, iterable):
        self._data[self._offset:self._offset+self._size] = iterable
        for i in range(self._offset - 1, -1, -1):
            self._data[i] = gcd(self._data[i * 2 + 1], self._data[i * 2 + 2])

    def update(self, index, value):
        i = self._offset + index
        self._data[i] = value
        while i >= 1:
            i = (i - 1) // 2
            self._data[i] = gcd(self._data[i * 2 + 1], self._data[i * 2 + 2])

    def query(self, start, stop):
        result = 0
        l = start + self._offset
        r = stop + self._offset
        while l < r:
            if l & 1 == 0:
                result = gcd(result, self._data[l])
            if r & 1 == 0:
                result = gcd(result, self._data[r - 1])
            l = l // 2
            r = (r - 1) // 2
        return result


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

st = SegmentTree(N)
st.update_all(A)

result = st.query(1, N)
for i in range(1, N - 1):
    result = max(result, gcd(st.query(0, i), st.query(i + 1, N)))
result = max(result, st.query(0, N - 1))
print(result)


### FIXED CODE ###

from fractions import gcd
n = int(input())
a = list(map(int, input().split()))
c1 = [0] * (n + 1)
c2 = [0] * (n + 1)
# c1[1] = a[0]
# c2[n - 1] = a[n - 1]
for i in range(1, n + 1):
  c1[i] = gcd(c1[i - 1], a[i - 1])
  c2[n - i] = gcd(c2[n - i + 1], a[n - i])
print(max(gcd(c1[i], c2[i + 1]) for i in range(n)))