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

n = int(input())
A = [int(input()) for i in range(n)]
for i in range(n):
  Ai = A[:]
  Ai.pop(i)
  print(max(Ai))


### FIXED CODE ###

n = int(input())
A = [int(input()) for _ in range(n)]

sort = sorted(A)

max = sort[-1]
maxx = sort[-2]

for i in range(n):
  if max == A[i]:
    print(maxx)
  else:
    print(max)
### BUGGY CODE ###

#D
n,k = map(int,input().split())

MOD = 10 ** 9 + 7

def nCr(a,b):
    bunshi = 1
    bunbo = 1
    
    for i in range(b):
        bunshi *= a-i
    for j in range(b):
        bunbo *= b-j
        
    return bunshi//bunbo % MOD

for i in range(1,k+1):
    a1 = nCr(n-k+1,i)
    if i > 1:
        a2 = nCr(k-1,i-1)
    else:
        a2 = 1
    print(a1*a2 % MOD)

### FIXED CODE ###

#D
n,k = map(int,input().split())

MOD = 10 ** 9 + 7

from operator import mul
from functools import reduce

def nCr(n,r):
    if n < r:
        return 0
    r = min(n-r,r)
    if r == 0: 
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under % MOD



for i in range(1,k+1):
    a1 = nCr(n-k+1,i)
    a2 = nCr(k-1,i-1)
    print(a1*a2 % MOD)
### BUGGY CODE ###

import itertools
H, W, M = map(int, input().split())
Hsum = [0] * H
Wsum = [0] * W
hw = []
for m in range(M):
  h, w = map(int, input().split())
  Hsum[h-1] += 1
  Wsum[w-1] += 1
  hw.append(str(h-1)+"_"+str(w-1))

hmax_ind = list(map(lambda x: True if x == max(Hsum) else False, Hsum))
hmax_ind = list(itertools.compress(range(len(Hsum)), hmax_ind))
wmax_ind = list(map(lambda x: True if x == max(Wsum) else False, Wsum))
wmax_ind = list(itertools.compress(range(len(Wsum)), wmax_ind))

fi = 0
for h in hmax_ind:
  for w in wmax_ind:
    if str(h)+"_"+str(w) not in hw:
      fi = 1
if fi == 1:
  print(max(Hsum) + max(Wsum))
else:
  print(max(Hsum) + max(Wsum)-1)


### FIXED CODE ###

import sys
input = sys.stdin.readline
 
H, W, M = map(int, input().split())
Hsum = [0] * H
Wsum = [0] * W
hw = set()
for m in range(M):
  h, w = map(lambda x: int(x) - 1, input().split())
  Hsum[h] += 1
  Wsum[w] += 1
  hw.add((h, w))

mh = max(Hsum)
mw = max(Wsum)
hidx = [i for i, _ in enumerate(Hsum) if _ == mh]
widx = [i for i, _ in enumerate(Wsum) if _ == mw]
 
if len(hidx) * len(widx) > M:
  print(mh + mw)
else:
  fi_flg = False
  for h in hidx:
    for w in widx:
      if (h, w) not in hw:
        print(mh + mw)
        fi_flg = True
        break
    if fi_flg:
      break
  if fi_flg is False:
    print(mh + mw - 1)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(500*500)

h,w=list(map(int,input().split()))
s=[[1 if c=='#' else 0 for c in input()] for _ in range(h)]
g=[[] for _ in range(h*w)]

for i in range(w):
    for j in range(h):
        for di in [-1,0,1]:
            for dj in [-1,0,1]:
                if abs(di)+abs(dj)!=1:
                    continue
                if 0<=i+di<w and 0<=j+dj<h:
                    if s[j][i]!=s[j+dj][i+di]:
                        g[j*w+i].append(i+di+(j+dj)*w)

visit=[0]*(h*w)
black=[0]*(h*w)
white=[0]*(h*w)

def rec(j,i,rj,ri):
    if s[j][i]:
        black[rj*w+ri]+=1
    else:
        white[rj*w+ri]+=1
    
    for n in g[j*w+i]:
        if visit[n]==1:
            continue

        visit[n]=1

        rec(n//w,n%w,rj,ri)

ans=0

for i in range(w):
    for j in range(h):
        if visit[w*j+i]:
            continue
        visit[w*j+i]=1

        rec(j,i,j,i)
        
        ans+=black[w*j+i]*white[w*j+i]

print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(500*500)

h,w=list(map(int,input().split()))
s=[[1 if c=='#' else 0 for c in input()] for _ in range(h)]
g=[[] for _ in range(h*w)]

for i in range(w):
    for j in range(h):
        for di in [-1,0,1]:
            for dj in [-1,0,1]:
                if abs(di)+abs(dj)!=1:
                    continue
                if 0<=i+di<w and 0<=j+dj<h:
                    if s[j][i]!=s[j+dj][i+di]:
                        g[j*w+i].append(i+di+(j+dj)*w)

visit=[0]*(h*w)
black=[0]*(h*w)
white=[0]*(h*w)

def rec(j,i,rj,ri):
    if s[j][i]:
        black[rj*w+ri]+=1
    else:
        white[rj*w+ri]+=1
    
    for n in g[j*w+i]:
        if visit[n]:
            continue

        visit[n]=1

        rec(n//w,n%w,rj,ri)

ans=0

for i in range(w):
    for j in range(h):
        if visit[w*j+i]:
            continue
        visit[w*j+i]=1

        rec(j,i,j,i)
        
        ans+=black[w*j+i]*white[w*j+i]

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

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

import sys
from itertools import accumulate

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def bisearch_min(mn, mx, func):
    """ 条件を満たす最小値を見つける二分探索 """

    ok = mx
    ng = mn
    while ng+1 < ok:
        mid = (ok+ng) // 2
        if func(mid):
            # 下を探しに行く
            ok = mid
        else:
            # 上を探しに行く
            ng = mid
    return ok

def rec(x, di, X):
    if di == 10:
        return 0
    if int(x) > X:
        return 0
    last = int(x[-1])
    res = 0
    res += rec(x+str(last), di+1, X)
    if last != 0:
        res += rec(x+str(last-1), di+1, X)
    if last != 9:
        res += rec(x+str(last+1), di+1, X)
    return res + 1

def check(X):
    res = 0
    for i in range(1, 10):
        res += rec(str(i), 0, X)
    return res >= K

K = INT()

res = bisearch_min(0, 3234566668, check)
print(res)


### FIXED CODE ###

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

import sys
from itertools import accumulate

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def bfs():
    from collections import deque

    que = deque()
    cnt = 1
    memo = {}
    for i in range(1, 10):
        que.append(str(i))
        memo[cnt] = str(i)
        cnt += 1
    while que:
        x = que.popleft()
        last = int(x[-1])
        if last != 0:
            que.append(x+str(last-1))
            memo[cnt] = x + str(last-1)
            cnt += 1
        que.append(x+str(last))
        memo[cnt] = x+str(last)
        cnt += 1
        if last != 9:
            que.append(x+str(last+1))
            memo[cnt] = x + str(last+1)
            cnt += 1
        if cnt > K:
            return memo

K = INT()

res = bfs()
print(res[K])
### BUGGY CODE ###

INF = 1001001001
N = int(input())
D = list(map(int, input().split())) + [0]

ans = 0
for i in range(1<<(N-1)):
    tmp = INF
    for j in range(N-1):
        if i>>j & 1:
            d1 = D[j]
        else:
            d1 = 24 - D[j]
        for k in range(j+1, N-1):
            if i>>k & 1:
                d2 = D[k]
            else:
                d2 = 24 - D[k]
            tmp = min(tmp, min(abs(d1-d2), 24-abs(d1-d2)))
        tmp = min(tmp, min(abs(d1-D[N-1]), 24-abs(d1-D[N-1])))
        tmp = min(tmp, min(d1, 24-d1))
    tmp = min(tmp, min(D[N-1], 24-D[N-1]))
    ans = max(ans, tmp)

print(ans)


### FIXED CODE ###

def f(a, b):
    d = abs(a-b)
    return min(d, 24-d)

N = int(input())
D = list(map(int, input().split())) + [0]
D.sort()
for i in range(N+1):
    if i%2:
        D[i] = 24 - D[i]
D.sort()
ans = f(D[0], D[-1])
for i in range(N):
    ans = min(ans, f(D[i], D[i+1]))
print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
ans = 0
for i in range(61):
	x = 0
	for j in a:
		if j >> i & 1:
			x += 1
	z = x*(n-x)%mod
	z *= 2**i
	z %= mod
	ans += z
	ans %= mod
print (ans)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
ans = 0
for i in range(61):
	x = 0
	for j in a:
		if j >> i & 1:
			x += 1
	z = x*(n-x)%mod
	z *= 2**i
	z %= mod
	ans += z
	ans %= mod
print (ans)
### BUGGY CODE ###

n = int(input())
s = list(range(n))
for i in range(n):
  s[i] = list(str(input()))
  s[i].sort()

ans = 0
for i in range(n-1):
  for j in range(i+1, n):
    if s[i] == s[j]:
      ans += 1
print(ans)


### FIXED CODE ###

n = int(input())
s = []
cnt = {}
ans = 0
for i in range(n):
  s_ = list(str(input()))
  s_.sort()
  s_ = "".join(s_)
  if s_ in cnt:
    ans += cnt[s_]
    cnt[s_] += 1
  else:
    cnt[s_] = 1

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

n = int(input())
ss = sorted([sorted(input()) for _ in range(n)])
ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        #print(i, ss[i], j, ss[j])
        if ss[i] == ss[j]:
            ans += 1
        else:
            break
print(ans)

### FIXED CODE ###

n = int(input())
ss = sorted([sorted(input()) for _ in range(n)])
ans = 0
cnt = 1
for i in range(n - 1):
    if ss[i] != ss[i + 1]:
        ans += cnt * (cnt - 1) // 2
        cnt = 0
    cnt += 1
ans += cnt * (cnt - 1) // 2
print(ans)
### BUGGY CODE ###

import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    C = kwargs["C"]
    res = n

    for i in range(n + 1):
        left = C[:i+1].count("W")
        right = C[i+1:].count("R")
        tmp = max([left, right])
        res = min(res, tmp)
    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    kwargs["n"] = [int(i) for i in cin][0]
    cin = input().split()[0]
    kwargs["C"] = [i for i in cin]

    cout = main(kwargs)
    print(cout)

### FIXED CODE ###

import numpy as np
import math
import scipy as sp
import queue
import collections

MOD = 10 ** 9 + 7
INF = 10 ** 9

def main(kwargs):
    n = kwargs["n"]
    C = kwargs["C"]
    left = 0
    right = C.count("R")
    res = max([left, right])

    for i in range(n):
        if C[i] == "W":
            left += 1
        if C[i] == "R":
            right -= 1
        tmp = max([left, right])
        res = min(res, tmp)
    return res

if __name__ == "__main__":
    kwargs = {}

    cin = input().split()
    kwargs["n"] = [int(i) for i in cin][0]
    cin = input().split()[0]
    kwargs["C"] = [i for i in cin]

    cout = main(kwargs)
    print(cout)
### BUGGY CODE ###

from itertools import product


def resolve():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    a.sort(reverse=True)
    aa = list(product(a[:], repeat=2))
    print(sum(sorted(list(map(lambda x: x[0] + x[1], aa)), reverse=True)[:m]))
    
resolve()

### FIXED CODE ###

import sys
from itertools import accumulate
from bisect import bisect_left

n, m, *a = map(int, sys.stdin.read().split())
a.sort()


def f(x):
    # 幸福度がx未満となる組み合わせの個数を数える
    cnt = 0
    for ai in a:
        cnt += bisect_left(a, x-ai)
    # 幸福度がx以上の組み合わせの個数がm未満かどうか
    return n * n - cnt < m


left = a[0] * 2
right = a[-1] * 2
while right - left > 1:
    mid = (right + left) // 2
    if f(mid):
        right = mid
    else:
        left = mid
ans = 0
cumsum = [0] + list(accumulate(a))
j = 0
for ai in a:
    i = bisect_left(a, left-ai)
    j += n - i
    ans += ai * (n - i) + cumsum[-1] - cumsum[i]
ans += (m - j) * left
print(ans)
### BUGGY CODE ###

#ちょうどK個
#絶対値の大きいものから選びたい
#正の数を1個選ぶ時,2個選ぶ時,…k個選ぶ時
#絶対値が小さいもの同士または絶対値が大きいもの同士
#負の時は絶対値小さいものk個
mod=10**9+7
n,k=map(int,input().split())
a=list(map(int,input().split()))
a1=[]
a2=[]
a3=[]
for i in range(n):
    if a[i]>0:
        a1.append(a[i])
    elif a[i]<0:
        a2.append(a[i])
    else:
        a3.append(a[i])
#絶対値の小さい順
a1.sort()
a2.sort(reverse=True)
ans=[]
if len(a3):
    ans.append(0)
from itertools import accumulate
suma11=list(accumulate(a1,lambda x,y:x*y))
suma12=list(accumulate(a1[::-1],lambda x,y:x*y))
suma21=list(accumulate(a2,lambda x,y:(x*y)))
suma22=list(accumulate(a2[::-1],lambda x,y:x*y))
#print(suma11)
#print(suma12)
#print(suma21)
#print(suma22)
#正の数の個数
l1=len(a1)
l2=len(a2)
for i in range(0,k+1):
    if i==0:
        if k<=l1:
            ans.append(suma12[k-1])
        continue
    if i==k:
        if k<=l2:
            ans.append(suma21[k-1])
        continue
    if i<=l1 and k-i<=l2:
        ans.append(suma11[i-1]*suma21[k-i-1])
        ans.append(suma12[i-1]*suma22[k-i-1])
print(max(ans)%mod)

### FIXED CODE ###

#正の場合、0の場合、負の場合で分ける
#負の数のみの場合は調整しようがない
#偶数の時は絶対値の大きい順
#奇数の時は絶対値の小さい順
#正の数のみの場合は大きい順
#大きい順

#他は調整できるので、正で大きくする方向で考える(正→0以上)
#負の数は偶数個ないと正にならないので二つ一組で先にかけて考える
#正の数も同様に先にかけて、その中で大きいものを選べば良い

#負の数が奇数個、正の数が奇数個の時(負の数が余る、正の数が余る)
#Kが偶数の時はいい感じに選んでく(N=kの時は仕方ないので全部)
#Kが奇数の時は正の中で最大のものを選ぶ
#負の数が偶数個、正の数が奇数個の時(正の数が余る)
#Kが偶数の時はいい感じに選んでく
#奇数の時は残りの正の中から選ぶ
#負の数が奇数個、正の数が偶数個の時(負の数が余る)
#N=Kの時は全部選ぶ、それ以外の場合は余った負の数はいらない
#Kが奇数の時は残りの正の中で最大のものを選べば良い
#負の数が偶数個、正の数が偶数個の時
#Kが奇数の時は残りの正の中で最大のものを選べば良い

#N=Kの時は別で分けて考えるとすると、負の数及び正の数によらず
#Kが偶数の時は大きいものからいい感じに選んでく
#Kが奇数の時は最後の残り一個は正の残りの中で最大のものを選ぶ
#と簡単に言い換えることができる

#x:配列
mod=10**9+7
def multarray(x):
    ret=1
    for i in x:
        ret*=i
        ret%=mod
    return ret

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

if n==k:
    print(multarray(a))
    exit()

ap,am=[],[]
for i in range(n):
    if a[i]>=0:
        ap.append(a[i])
    else:
        am.append(a[i])
#絶対値の順番
ap.sort(reverse=True)
am.sort()

if len(am)==0:
    print(multarray(ap[:k]))
    exit()
if len(ap)==0:
    if k%2==0:
        print(multarray(am[:k]))
    else:
        print(multarray(am[::-1][:k]))
    exit()

apm2=[]
for i in range(len(am)//2):
    apm2.append((am[2*i]*am[2*i+1],0))
for i in range(len(ap)//2):
    apm2.append((ap[2*i]*ap[2*i+1],1))
apm2.sort(reverse=True)

#+の次にどこを見るのかをチェックしておく
#まだかけない
p=0
ans=[]
for i in range(k//2):
    p+=(2*apm2[i][1])
    ans.append(apm2[i][0])

#ここで不正アクセスの可能性を避ける
#プラスが余ってない場合(一個減らして次のマイナス使う)
if k%2==0:
    print(multarray(ans))
    exit()
if p==len(ap):
    #一個減らす
    check_i=ans.index(ap[p-1]*ap[p-2])
    ans[check_i]=ap[p-2]
    ans.append(apm2[k//2][0])
    print(multarray(ans))
else:
    #余ってる場合もafter_contestで落ちる
    #その一個をとるのが最適とは限らない
    #一個減らして二個とる場合も
    ans_cand=[]
    #一個増やす場合
    ans_cand.append(multarray(ans)*ap[p]%mod)
    if p>=2:
        #一個減らして二個増やす場合
        check_i=ans.index(ap[p-1]*ap[p-2])
        #0除算を避ける
        ans[check_i]=ap[p-2]
        ans.append(apm2[k//2][0])
        ans_cand.append(multarray(ans))
    print(max(ans_cand))
### BUGGY CODE ###

s=input()
l=len(s)
amari=[0]*2019
amari[0]=1

for i in range(1,l+1):
    amari[int(s[l-i:])%2019]+=1

ans=0
for i in amari:
    ans+=i*(i-1)//2
print(ans)

### FIXED CODE ###

s=input()
l=len(s)
amari=[0]*2019
amari[0]=1

d=0
digi=1

for c in s[::-1]:
    d=(int(c)*digi + d)%2019
    amari[d]+=1
    digi=(digi*10)%2019

ans=0
for i in amari:
    ans+=i*(i-1)//2
print(ans)
### BUGGY CODE ###

def make_list(L, R):
    mod_list = list()

    if R - L <= 2019:
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                mod_list.append((i * j) % 2019)
    else:
        for i in range(L, R):
            for j in range(i + 1, i + 2021):
                mod_list.append((i * j) % 2019)

    return mod_list


def main():
    L, R = map(int, input().split())

    mod_list = make_list(L, R)

    print(min(mod_list))

    return


if __name__ == "__main__":
    main()


### FIXED CODE ###

def make_list(L, R):
    mod_list = list()

    if R - L <= 2019:
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                mod_list.append((i * j) % 2019)
    else:
        for i in range(L, L + 2020):
            for j in range(i + 1, i + 2021):
                mod_list.append((i * j) % 2019)

    return mod_list


def main():
    L, R = map(int, input().split())

    mod_list = make_list(L, R)

    print(min(mod_list))

    return


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

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}


n, m = map(int, input().split())
p_list = list(map(int, input().split()))
q_list = []
for item in p_list:
    q_list.append(item-1)

uni = UnionFind(n)

for i in range(m):
    x, y = map(int, input().split())
    uni.union(x-1, y-1)

ret = 0

tmp_dict = uni.all_group_members()

for item in tmp_dict:
    t_list = tmp_dict[item]
    tmp = set()
    for var in t_list:
        tmp.add(q_list[var])
    ret += len(tmp & set(t_list))

print(ret)


### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.parents = list(range(n))
        self.rank = [0] * n

    def find(self, x):
        if self.parents[x] == x:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.rank[x] < self.rank[y]:
            self.parents[x] = y
        else:
            self.parents[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1


n, m = map(int, input().split())
p_list = list(map(int, input().split()))
q_list = list(map(lambda x: x - 1, p_list))

uni = UnionFind(n)

for i in range(m):
    x, y = map(int, input().split())
    uni.union(x-1, y-1)

ret = 0

tmp_dict = dict()

for i in range(n):
    parent = uni.find(i)
    if parent in tmp_dict:
        tmp_dict[parent].append(i)
    else:
        tmp_dict[parent] = [i]

for item in tmp_dict:
    t_list = tmp_dict[item]
    tmp = set()
    for var in t_list:
        tmp.add(q_list[var])
    ret += len(tmp & set(t_list))

print(ret)
### BUGGY CODE ###

N, K = map(int, input().split())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())

ans = (max(x) - min(x)) * (max(y) - min(y))

for i in range(N):
    for j in range(N):
        for k in range(N):
            for l in range(N):
                cnt = 0

                lx = x[i]
                rx = x[j]
                uy = y[k]
                dy = y[l]

                if lx >= rx or dy >= uy:
                    continue

                for m in range(N):
                    if lx <= x[m] <= rx and dy <= y[m] <= uy:
                        cnt += 1

                if cnt >= K:
                    ans = min(ans, (rx - lx) * (uy - dy))

print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())

ans = (max(x) - min(x)) * (max(y) - min(y))

for i in range(N):
    for j in range(N):
        for k in range(N):
            for l in range(N):
                cnt = 0

                lx = x[i]
                rx = x[j]
                uy = y[k]
                dy = y[l]

                if lx >= rx or dy >= uy:
                    continue

                for m in range(N):
                    if lx <= x[m] <= rx and dy <= y[m] <= uy:
                        cnt += 1

                if cnt >= K:
                    ans = min(ans, (rx - lx) * (uy - dy))

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

S=input()
Q=int(input())
ref=0
for i in range(Q):
    T=input().split()
    if T[0] == '2':
        if (T[1]=='1' and ref%2==0):
            S=T[2]+S
        elif (T[1]=='2' and ref%2==0):
            S=S+T[2]
        elif (T[1]=='1' and ref%2==1):
            S=S+T[2]
        elif (T[1]=='2' and ref%2==1):
            S=T[2]+S
    else:
        ref+=1
print(S if ref%2==0 else S[::-1])

### FIXED CODE ###

from collections import deque
S=deque(input())
Q=int(input())
ref=0
for i in range(Q):
    T=input().split()
    if T[0] == '2':
        if (T[1]=='1' and ref%2==0):
            S.appendleft(T[2])
        elif (T[1]=='2' and ref%2==0):
            S.append(T[2])
        elif (T[1]=='1' and ref%2==1):
            S.append(T[2])
        elif (T[1]=='2' and ref%2==1):
            S.appendleft(T[2])
    else:
        ref+=1
for i in range(len(S)):
    if ref%2==0:
        char=S.popleft()
        print(char,end='')
    else:
        char=S.pop()
        print(char,end='')
### BUGGY CODE ###

def main():
  import numpy as np
  n = int(input())
  a = np.array([int(x) for x in input().split()])
  a = a-np.array([int(i) for i in range(1, n+1)])
  a.sort()

  sum_0 = np.sum(np.abs(a-a[0]))
  sum_n = np.sum(np.abs(a-a[-1]))

  l, r = n//3, n*2//3

  while r-l > 1:
    sum_l = np.sum(np.abs(a-a[l]))
    sum_r = np.sum(np.abs(a-a[r]))
    if sum_l < sum_r:
      if sum_r > sum_0:
        r = l
        l = l//2
        sum_n = sum_r
      else:
        l = (r+l)//2
        sum_0 = sum_l
    else:
      if sum_l > sum_n:
        l = r
        r = (r+n)//2
        sum_0 = sum_l
      else:
        r = (r+l)//2
        sum_n = sum_r

  print(min([np.sum(np.abs(a-a[l])), np.sum(np.abs(a-a[r]))]))

if __name__ == "__main__":
   main()

### FIXED CODE ###

import numpy as np
n = int(input())
a = np.array([int(x)-i-1 for x, i in zip(input().split(), range(n))])
ans = np.sum(np.abs(a-int(np.median(a))))
print(ans)
### BUGGY CODE ###

from itertools import product

H, W, N = map(int, input().split())
V = set([tuple(map(int, input().split())) for _ in range(N)])
D = tuple(product((-1, 0, 1), repeat=2))

A = set()
for a, b in V:
    for h, w in D:
        if 2 <= a + h <= H - 1 and 2 <= b + w <= W - 1:
            A.add((a + h, b + w))

ans = [0] * 10
for a, b in A:
    cnt = 0
    for h, w in D:
        if (a + h, b + w) in V:
            cnt += 1
    ans[cnt] += 1

ans[0] = (H - 2) * (W - 2) - sum(ans)
print(*ans, sep='\n')


### FIXED CODE ###

from collections import defaultdict

def sol():
    H, W, N = map(int, input().split())
    origin = defaultdict(int)

    ans = [0 for _ in range(10)]
    ans[0] = (H - 2) * (W - 2)

    def addBlack(h, w):
        ans[origin[(h, w)]] -= 1
        ans[origin[(h, w)] + 1] += 1
        origin[(h, w)] += 1

    for _ in range(N):
        h, w = map(int, input().split())

        for a in [-1, 0, 1]:
            for b in [-1, 0, 1]:
                if 2 <= h + a <= H - 1 and 2 <= w + b <= W - 1:
                    addBlack(h + a, w + b)

    for a in ans:
        print(a)

sol()