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

Q = int(input())
left = []
right = []
for a in range(Q):
    l,r = map(int,input().split())
    left.append(l)
    right.append(r)

import math

# 0以上整数x「未満」の素数をリストに格納して返す
def primes(x):
    if x < 2: return []

    primes = [i for i in range(x)]
    primes[1] = 0 # 1は素数ではない

    # エラトステネスのふるい
    for prime in primes:
        if prime > math.sqrt(x): break
        if prime == 0: continue
        for non_prime in range(2 * prime, x, prime): primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]


# 整数xが素数かどうかを判定する
def is_prime(x):
    if x < 2: return False # 2未満に素数はない
    if x == 2 or x == 3 or x == 5: return True # 2,3,5は素数
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False # 2,3,5の倍数は合成数

    # ためし割り: 疑似素数(2でも3でも5でも割り切れない数字)で次々に割っていく
    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False

        prime += step
        step = 6 - step

    return True


if __name__ == '__main__':

    ls = [x for x in range(100000) if is_prime(x)]

for j in range(Q):
    width = right[j]-left[j]
    count = 0
    k = 0
    for k in range(width+1):
        if left[j]+k in ls and int((left[j]+k+1)/2) in ls:
            count+=1
        else:
            pass
    print(count)

### FIXED CODE ###

#D問題
import math
def isprime(n):
    nroot=int(math.sqrt(n))
    flag=0
    for i in range(2,nroot+1):
        if n%i == 0:
            flag=1
            break
    return flag
Q=int(input())
L=[]
R=[]
for i in range(Q):
    l,r=map(int,input().split())
    L.append(l)
    R.append(r)
Rmax=max(R)
pcount=[]
for i in range(Rmax):
    I=i+1
    if I == 1:
        pcount.append(0)
    elif I%2 == 1:
        pf=pcount[-2]
        if isprime(I) == 0 and isprime(int((I+1)/2)) == 0:
            pf+=1
        pcount.append(pf)
    else:
        pcount.append(0)
for i in range(Q):
    ans=pcount[R[i]-1]-pcount[L[i]-3]
    print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 6)

n = int(input())
x = input()
z = '1' * n
o = '0' * n

if (z == x):
  u = n - 1
  d = n - 1
elif (z == o):
  u = 1
  d = 1
else:
  tmp = len(list(filter(lambda x: x == '1', x)))
  u = tmp + 1
  d = tmp - 1


def popcount(i):
  return i % len(list(filter(lambda x: x == '1', format(i, 'b'))))


def toggle(i):
  if (i == '1'):
    return '0'
  else:
    return '1'


def solve(i, count):
  if (i <= 2 * 10**5 and ans[i] != 0):
    return count + ans[i]
  elif (i == 0):
    return count
  else:
    return solve(popcount(i), count + 1)


def solve2(i, count, d):
  if (i <= 2 * 10**5):
    return count + ans[i]
  elif (i == 0):
    return count
  else:
    return solve2(i % d, count + 1, d)


ans = [0] * (2 * 10 ** 5 + 1)
for i in range(1, 2 * 10 ** 5):
  ans[i] = solve(i, 0)
for i in range(n):
  if(i == 0):
    _x = toggle(x[0]) + x[1: n]
  elif (i == n - 1):
    _x = x[:i] + toggle(x[n - 1])
  else:
    _x = x[:i] + toggle(x[i]) + x[i + 1 :n]
  if(x[i] == '0'):
    print(solve2(int(_x, 2), 0, u))
  else:
    print(solve2(int(_x, 2), 0, d))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)

n = int(input())
x = input()
z = '1' * n
o = '0' * n
X = int(x, 2)

if (n == 1 and x == '1'):
  print(0)
  exit()

if (z == x):
  u = n - 1
  d = n - 1
elif (o == x):
  u = 1
  d = 1
else:
  tmp = len(list(filter(lambda x: x == '1', x)))
  u = tmp + 1
  d = tmp - 1


def popcount(i):
  return i % len(list(filter(lambda x: x == '1', format(i, 'b'))))


def solve(i, count):
  if (i <= 2 * 10**5 and ans[i] != 0):
    return count + ans[i]
  elif (i == 0):
    return count
  else:
    return solve(popcount(i), count + 1)


def solve2(i, div):
  if (i <= 2 * 10**5):
    return ans[i]
  else:
    return ans[i % div] + 1


ans = [0] * (2 * 10 ** 5 + 4)
_u = (2 * 10 ** 5) // u
U = X % u + (u * _u) + u
if(d != 0):
  _d = (2 * 10 ** 5) // d
  D = X % d + (d * _d) * 2 + d * 2
Us = [0] * (2 * 10 ** 5)
Ds = [0] * (2 * 10 ** 5)
for i in range(1, 2 * 10 ** 5 + 4):
  ans[i] = solve(i, 0)
Us[0] = 1 % u
if(d != 0):
  Ds[0] = 1 % d
for i in range(1, 2 * 10 ** 5):
  Us[i] = (Us[i - 1] * 2) % u
  if(d != 0):
    Ds[i] = (Ds[i-1] * 2) % d

for i in range(n):
  if(x[i] == '0'):
    print(solve2(U + Us[n-i-1], u))
  else:
    if (d == 0):
      print(0)
    else:
      print(solve2(D - Ds[n-i-1], d))
### BUGGY CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
prod=1
for i in range(0,k):
    prod=prod*a[i]
i=0
for j in range(k,len(a)):
    if a[j]>a[i]:
        print("Yes")
    else:
        print("No")
    i+=1


### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
i=0
for j in range(k,len(a)):
    if a[j]>a[i]:
        print("Yes")
    else:
        print("No")
    i+=1
### BUGGY CODE ###

N = int(input())
L = list(map(int,input().split()))
ANS = []
for i in range(N-1) :
    p = abs(sum(L[:i+1])-sum(L[i+1:]))
    ANS.append(p)
print(min(ANS))


### FIXED CODE ###

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

for i in range(N-1) :
    if i == 0 :
        p = L[i]
        q = sum(L)-p
        ans = abs(p-q)
    else :
        p += L[i]
        q -= L[i]
        if ans > abs(p-q) :
            ans = abs(p-q)
        
print(ans)
### BUGGY CODE ###

def gcd(a, b):
    if a < b:
        return gcd(b, a)
    if b == 0:
        return a
    else:
        c = a % b
        return gcd(b, c)

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

g_max = -1
for i in range(n):
    g = -1
    for j in range(n):
        if j == i:
            continue
        if g == -1:
            g = a[j]
        else:
            g = gcd(g, a[j])
    if g > g_max:
        g_max = g

print(g_max)


### FIXED CODE ###

def gcd(a, b):
    if a == 0:
        return b
    if b == 0:
        return a
    if a < b:
        return gcd(b, a)
    if b == 0:
        return a
    else:
        c = a % b
        return gcd(b, c)

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

g_max = -1
l = [0] * n
r = [0] * n
for i in range(n):
    if i == 0:
        l[0] = 0
    else:
        l[i] = gcd(l[i-1], a[i-1])

for i in range(n-1,-1,-1):
    if i == n-1:
        r[i] = 0
    else:
        r[i] = gcd(r[i+1], a[i+1])

g_max = -1
for i in range(n):
    g = gcd(l[i], r[i])
    if g > g_max:
        g_max = g

print(g_max)
### BUGGY CODE ###

l = input().split()

res = 'a'

for a in range(int(l[0]),int(l[1])+1):
    for b in range(int(l[2]),int(l[3])+1):
        tmp = a * b
        if res == 'a':
            res = tmp
        if res < tmp:
            res = tmp

print(res)
        

### FIXED CODE ###

l = input().split()
a = int(l[0])
b = int(l[1])
c = int(l[2])
d = int(l[3])
r = []
r.append(a*c)
r.append(a*d)
r.append(b*c)
r.append(b*d)
print(max(r))
### BUGGY CODE ###

A,B,N = map(int,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
m=0
if B<N:
    N=B
s=int(B/A)
if s>N:
    print(0)
    exit()
for x in range(s,N+1):
    num=int(A*x/B) - A * int(x/B)

    m=max(num,m)

print(m)


### FIXED CODE ###

A,B,N = map(int,input().split())
#N=int(input())
#A = list(map(int,input().split()))
#S=str(input())
m=0
if B<=N:
    m=int(A * (B-1) / B)
    print(m)

else:
    m=int(A * N / B)
    print(m)
### BUGGY CODE ###

k = int(input())
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
ans = 0
dic = {}
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            tmp = [a,b,c]
            tmp = list(sorted(tmp))
            moji = list(map(str,tmp))
            moji = " ".join(moji)
            try:
                dic[moji]
                ans += dic[moji]
            except:
                num = gcd(tmp[0],tmp[1],tmp[2])
                ans += num
                dic[moji] = num

print(ans)

### FIXED CODE ###

k = int(input())
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
ans = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            ans += gcd(a,b,c)
print(ans)
### BUGGY CODE ###

#入力部
H, W = [int(i) for i in input().split()]

mymap = [] #mapの配列
myansmap = list(list(-1 for a in range(W)) for b in range(H)) #列方向を探索配列
myansmap2 = list(list(-1 for a in range(W)) for b in range(H)) #行方向を探索配列

#入力しながら，列方向を探索する
for i in range(H):
  myinput =  input()
  for j in range(W):
    if myinput[j] == '#':
      myansmap[i][j] = 0
    elif myinput[j] == '.':
      if myansmap [i][j] == -1 :
        mycnt = 0
        for m in range(j,W):
          if myinput[m] == '#':
            break
          mycnt += 1
      for k in range(j, m+1):
        myansmap[i][k] = mycnt
  mymap.append(myinput)

mymax = -99 #出力用変数

#行方向を探索する
for i in range(H):
  for j in range(W):
    #探索していない箇所について
    if myansmap2 [i][j] == -1:
      mycnt = 0
      for m in range(i,H):
        if myansmap[m][j] == 0:
          break
        mycnt += 1
      for k in range(i, m+1):
        if i > 0 and i < H or  j > 0 and i < W:
          myansmap2[k][j] = mycnt
        else: 
          myansmap2[k][j] = mycnt
    if myansmap[i][j] == 0:
      myansmap2[i][j] = 0

      
    if mymax < myansmap[i][j] + myansmap2[i][j]:
      mymax=myansmap[i][j] + myansmap2[i][j]

print(mymax-1)

### FIXED CODE ###

import numpy as np
 
H, W = map(int, input().split())
#mapの入力
mymap = [] 
for i in range(H):
    mymap.append(list(input()))

#探索可能性をブーリアン表記
mymap = (np.array(mymap) == ".")
  
L = np.zeros((H, W), dtype=int) #左側から探索した場合の配列
R = np.zeros((H, W), dtype=int) #右側から探索した場合の配列
U = np.zeros((H, W), dtype=int) #上側から探索した場合の配列
D = np.zeros((H, W), dtype=int) #下側から探索した場合の配列

#列ごとに左から
for j in range(W):
  if j == 0: #左端
    L[:, j] = mymap[:, j] #true = 1, false = 0
  else:
    L[:, j] = (L[:, j - 1] + 1) * mymap[:, j] #trueの場合は1つ左の列の値を加算しながら

#列ごとに右から
for j in range(W - 1, -1, -1): #(引数：開始数，終了数，加算数）
  if j >= W - 1: #右端
    R[:, j] = mymap[:, j]
  else:
    R[:, j] = (R[:, j + 1] + 1) * mymap[:, j] 

#行ごとに上から
for i in range(H):
  if i <= 0: #上端
    U[i, :] = mymap[i, :]
  else:
    U[i, :] = (U[i - 1, :] + 1) * mymap[i, :]

#行ごとに下から
for i in range(H - 1, -1, -1):
  if i >= H - 1: #下端
    D[i, :] = mymap[i, :]
  else:
    D[i, :] = (D[i + 1, :] + 1) * mymap[i, :]

#総和から重複分(=3)の差をとって，最大値を出力
print(np.max(L + R + U + D - 3))
### BUGGY CODE ###

def gcd(a, b):
	while a > 0 and b > 0:
		a, b = b, a % b
	return a + b

def st(a, b):
	if b == 0:
		return 1
	if b % 2 == 0:
		q = st(a, b // 2)
		return q * q
	return a * st(a, b - 1)

n = int(input())
a = []
for i in range(n + 1):
	x = int(input())
	a.append(x)
ans = 0
for x in range(1, 24):
	tmp = 0
	r = st(x, n)
	for i in range(0, n + 1):
		tmp += a[i] * r
		r //= x
	ans = gcd(ans, abs(tmp))
v = []
j = 2
while j * j <= ans:
	if ans % j == 0:
		ans //= j
		v.append(j)
	else:
		j += 1
if ans != 1:
	v.append(ans)
v.sort()
for i in range(len(v)):
	if i == 0 or v[i] != v[i - 1]:
		print(v[i])


### FIXED CODE ###

def gcd(a, b):
	while a > 0 and b > 0:
		a, b = b, a % b
	return a + b

def st(a, b):
	if b == 0:
		return 1
	if b % 2 == 0:
		q = st(a, b // 2)
		return q * q
	return a * st(a, b - 1)

n = int(input())
a = []
for i in range(n + 1):
	x = int(input())
	a.append(x)
ans = 0
for x in range(1, 18):
	tmp = 0
	r = st(x, n)
	for i in range(0, n + 1):
		tmp += a[i] * r
		r //= x
	ans = gcd(ans, abs(tmp))
v = []
j = 2
while j * j <= ans:
	if ans % j == 0:
		ans //= j
		v.append(j)
	else:
		j += 1
if ans != 1:
	v.append(ans)
v.sort()
for i in range(len(v)):
	if i == 0 or v[i] != v[i - 1]:
		print(v[i])
### BUGGY CODE ###

def resolve():
	n=int(input())
	a=list(map(int,input().split()))
	l=min(a)+1
	g=max(a)
	if n==1:
		ans=1
	else:
		ans=0
		for i in a:
			ans=max(ans,a.count(i))
		for i in range(l,g):
			ans=max(ans,a.count(i-1)+a.count(i)+a.count(i+1))
	print(ans)
resolve()

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
dic={}
for i in a:
	if i-1 in dic:
		dic[i-1]+=1
	else:
		dic[i-1]=1
	if i in dic:
		dic[i]+=1
	else:
		dic[i]=1
	if i+1 in dic:
		dic[i+1]+=1
	else:
		dic[i+1]=1
print(max(dic.values()))
### BUGGY CODE ###

number=10**9+7

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

c=sorted(c, reverse=True)
sum=0
for i in range(1, n+1):
    sum=(sum+(4**(n-1))*(i+1)*c[i-1])%number
print(sum)


### FIXED CODE ###


number=10**9+7

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

c.sort(reverse=True)
sum=0
for i in range(1, n+1):
    sum=(sum+(pow(4, (n-1), number))*(i+1)*c[i-1])%number
print(sum)
### BUGGY CODE ###

from itertools import combinations
s = input()
n = int(input())

le = len(s)
seed = tuple(combinations(range(le + 1), 2))

res = set()
for i, j in seed:
    res.add(s[i:j])

ans = sorted(res)
print(ans[n - 1])


### FIXED CODE ###

from itertools import combinations
s = input()
n = int(input())

le = len(s)
tmp = s[:5]

for i in range(le - 4):
    tmp = min(tmp, s[i:i+5])

seed = tuple(combinations(range(min(6, le+1)), 2))
res = set()
for i, j in seed:
    res.add(tmp[i:j])
ans = sorted(res)
print(ans[n - 1])
### BUGGY CODE ###

#!/usr/bin/env pypy3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
# INF = float("inf")
import sys,collections

N = int(sys.stdin.readline())
a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param

from math import gcd
import math
acc = a[0]
LIMIT=max(a)
minPrime = [0]*(LIMIT+1)
minPrime[1] = 1
count = 0
for i in range(2,LIMIT+1):
    if minPrime[i] == 0:
        count += 1
        j = i
        while j <= LIMIT:
            if minPrime[j] == 0:
                minPrime[j] = i
            j += i
#print(minPrime)
def factrial(N):
    ret = []
    while minPrime[N] != N:
        ret.append(minPrime[N])
        N = N//minPrime[N]
    if N != 1:
        ret.append(N)
    return ret

for i in range(N):
    acc = gcd(acc,a[i])
if acc != 1:
    print("not coprime")
    exit()

pairwise = True
# facts = [set(factrial(e)) for e in a]
p = set() #all prime
#s = set(factrial(a[0])) # pair prime
for e in a:
    if not pairwise:
        break
    f = set(factrial(e))
    # s = s & f
    if p & f != set():
        pairwise = False
    p = p | f
#print(p,s,pairwise)

if pairwise:
    print("pairwise coprime")
else:
    print("setwise coprime")
# for s:
#     acc = math.gcd(acc,a[i])
# if acc != 1:
#     print("not coprime")
#     exit()
# print("pairwise coprime")
# for i in range(N):
#     for j in range(i+1,N):
#         b = gcd(a[i],a[j])
#         if b != 1:
#             print("setwise coprime")
#             exit()
# if pairwise == True:
#     print("pairwise coprime")
# else:
#     print("not coprime")


### FIXED CODE ###

import math
from collections import defaultdict
pc = True
n = int(input())
a = list(map(int,input().split()))
g = math.gcd(a[0],a[1])
for i in range(2,n):
    g = math.gcd(g,a[i])
M = max(a)
class Sieve_of_Eratosthenes:
    def __init__(self, N):
        self.sieve = [-1] * (N+1)
 
        for i in range(2,N+1):
            if self.sieve[i] == -1:
                for j in range(1,1+N//i):
                    self.sieve[i*j] = i
 
    def isprime(self, num):
        if num <= 1:
            return False
        else:
            return self.sieve[num] == num
 
    def factorization(self, num):
        ret = set([])
        while num != 1:
            div = self.sieve[num]
            ret.add(div)
            num //= div
        return ret
 
sofe = Sieve_of_Eratosthenes(M)
ddic = defaultdict()
judge = set([])
 
for i in a:
    if not pc:
        break
    asf = sofe.factorization(i)
    
    if judge & asf != set():
        pc = False
    judge |= asf
if pc:
    print("pairwise coprime")
elif g == 1:
    print("setwise coprime")
else:
    print("not coprime")
### BUGGY CODE ###

from collections import Counter
def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, m, r = read_line(int, int, int)

rs = [int(r) for r in input().split()]

cities = Counter()

routes = {}
costs = {}
for _ in range(m):
    a, b, c = read_line(int, int, int)

    cities[a] = 1
    cities[b] = 1

    if a in routes:
        routes[a][b] = c
    else:
        routes[a] = { b : c }

    if b in routes:
        routes[b][a] = c
    else:
        routes[b] = { a : c }

for a in cities.keys():
    for b in cities.keys():
        if a not in costs:
            costs[a] = {}
        if b not in costs[a]:
            if a in routes and b in routes[a]:
                costs[a][b] = routes[a][b]
            else:
                costs[a][b] = 100000 + 1

for k in cities.keys():
    for a in cities.keys():
        for b in cities.keys():
            if costs[a][b] > costs[a][k] + costs[k][b]:
                costs[a][b] = costs[a][k] + costs[k][b]

def cost(selected):
    c = 0
    for i in range(len(selected) - 1):
        a = selected[i]
        b = selected[i + 1]
        c += costs[a][b]
    return c

smallest = 100000 + 1

def f(selected, rest):
    global smallest
    if len(rest) == 0:
        c = cost(selected)
        if smallest > c:
            smallest = c
    else:
        for i in range(len(rest)):
            r = rest[i]
            rest_copy = rest[:]
            del rest_copy[i]
            # if cost(selected + [r]) < smallest:
            #     f(selected + [r], rest_copy)
            f(selected + [r], rest_copy)

f([], list(rs))
print(smallest)


### FIXED CODE ###

from itertools import permutations

def read_line(*types): return [f(a) for a, f in zip(input().split(), types)]

n, m, r = read_line(int, int, int)

rs = [int(r) for r in input().split()]

costs = {}
for i in range(n + 1):
    costs[i] = {}
    for j in range(n + 1):
        costs[i][j] = float('inf')

for _ in range(m):
    a, b, c = read_line(int, int, int)

    costs[a][b] = costs[b][a] = c

for k in range(n + 1):
    for i in range(n + 1):
        for j in range(n + 1):
            c = costs[i][k] + costs[k][j]
            if costs[i][j] > c:
                costs[i][j] = c

def cost(selected):
    c = 0
    for i in range(len(selected) - 1):
        a = selected[i]
        b = selected[i + 1]
        c += costs[a][b]
    return c

smallest = float('inf')

for p in permutations(rs):
    c = cost(p)
    if smallest > c:
        smallest = c

print(smallest)
### BUGGY CODE ###

import math
import heapq
N, K = map(int, input().split())
A = sorted([(-int(i), 1) for i in input().split()])
heapq.heapify(A)  # リストhqのheap化

for _ in range(K):
    L, T = heapq.heappop(A)  # heap化されたリストhqから最小値を削除＆その最小値を出力
    heapq.heappush(A, (L*T/(T+1), T+1))  # heap化されたリストhqに要素xを追加
print(math.ceil(-heapq.heappop(A)[0]))


### FIXED CODE ###

N, K = map(int, input().split())
A = [int(i) for i in input().split()]

OK = 10**12
NG = 0

while OK-NG > 1:
    mid = (OK+NG)//2
    cnt = 0
    for a in A:
        cnt += (a-1)//mid
    if cnt <= K:
        OK = mid
    else:
        NG = mid
    # print('OK:{}, NG:{}, cnt:{}'.format(OK, NG, cnt))

print(OK)
### BUGGY CODE ###

from collections import deque
from copy import deepcopy, copy
dy = [-1, 0, 0, 1]
dx = [0, -1, 1, 0]
N = 3
def MAIN():
    MAP = tuple(sum([input().split() for _ in range(N)], []))
    y0, x0 = divmod(MAP.index("0"), N)
    goal = ('1', '2', '3', '4', '5', '6', '7', '8', '0')
    ans = 0
    dp = deque([[y0, x0, 0, MAP]])
    LOG = {MAP}
    while dp:
        y, x, cnt, M = dp.popleft()
        cnt += 1
        yx = y * N + x
        for i in range(4):
            ny = y + dy[i]
            nx = x + dx[i]
            if 0 <= ny < N and 0 <= nx < N:
                CM = list(deepcopy(M))
                nyx = ny * N + nx
                CM[yx], CM[nyx] = CM[nyx], CM[yx]
                CM = tuple(CM)
                if not CM in LOG:
                    if CM == goal:
                        print(cnt)
                        dp = []
                        break
                    dp.append([ny, nx, cnt, CM])
                    LOG.add(CM)
MAIN()



### FIXED CODE ###

from collections import deque
N = 3
m = {8: {7, 5}, 7: {8, 6, 4}, 6: {7, 3}, 5: {8, 4, 2}, 4: {7, 5, 3, 1}, 3: {6, 4, 0}, 2: {5, 1}, 1: {4, 2, 0},
     0: {3, 1}}
goal = 123456780
def g(i, j, a):
    t = a // (10 ** j) % 10
    return a - t * (10 ** j) + t * (10 ** i)
def solve():
    MAP = "".join(input().replace(" ", "") for _ in range(N))
    zero = 8 - MAP.find("0")
    start = int(MAP)
    if start == goal:
        return 0
    dp = deque([(0, start, zero, 1), (0, goal, 0, 0)])
    TABLE = {start: (1, 0), goal: (0, 0)}
    while dp:
        cnt, M, yx, flg = dp.popleft()
        cnt += 1
        for nyx in m[yx]:
            key = g(yx, nyx, M)
            if key in TABLE:
                if TABLE[key][0] != flg:
                    return TABLE[key][1] + cnt
                continue
            TABLE[key] = (flg, cnt)
            dp.append((cnt, key, nyx, flg))
def MAIN():
    print(solve())
MAIN()
### BUGGY CODE ###

S = list(str(input()))
Q = int(input())
num_rev = 0
for i in range(Q):
  a = list(map(str, input().split()))
  if len(a) == 1:
    num_rev += 1
  else:
    if num_rev % 2 == 0:
      if a[1] == "1":
        S.insert(0, a[2])
      else:
        S.append(a[2])
    else:
      if a[1] == "1":
        S.append(a[2])
      else:
        S.insert(0, a[2])
if num_rev % 2 == 1:
  S = list(reversed(S))
print(''.join(S))

### FIXED CODE ###

S = list(str(input()))
Q = int(input())
s1 = []#先頭
s2 = []#後方
b = []
num_rev = 0
for i in range(Q):
  a = list(map(str, input().split()))
  if len(a) == 1:
    num_rev += 1
  else:
    if (num_rev + int(a[1]))%2==0:
      s2.append(a[2])
    else:
      s1.append(a[2])
if num_rev % 2 == 0:
  s1 = list(reversed(s1))
  s1.extend(S)
  s1.extend(s2)
  print(''.join(s1))
else:
  s2 = list(reversed(s2))
  s2.extend(list(reversed(S)))
  s2.extend(s1)
  print(''.join(s2))
### BUGGY CODE ###

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

for i in range(1, n+1):
    print(A.count(i))

### 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])