Problem:


Score : 300 points

Problem Statement

A company has N members, who are assigned ID numbers 1, ..., N.

Every member, except the member numbered 1, has exactly one immediate boss with a smaller ID number.

When a person X is the immediate boss of a person Y, the person Y is said to be an immediate subordinate of the person X.

You are given the information that the immediate boss of the member numbered i is the member numbered A_i. For each member, find how many immediate subordinates it has.

Constraints

2 \leq N \leq 2 \times 10^5

1 \leq A_i < i

Input

Input is given from Standard Input in the following format:

N
A_2 ... A_N

Output

For each of the members numbered 1, 2, ..., N, print the number of immediate subordinates it has, in its own line.

Sample Input 1

5
1 1 2 2

Sample Output 1

2
2
0
0
0

The member numbered 1 has two immediate subordinates: the members numbered 2 and 3.

The member numbered 2 has two immediate subordinates: the members numbered 4 and 5.

The members numbered 3, 4, and 5 do not have immediate subordinates.

Sample Input 2

10
1 1 1 1 1 1 1 1 1

Sample Output 2

9
0
0
0
0
0
0
0
0
0

Sample Input 3

7
1 2 3 4 5 6

Sample Output 3

1
1
1
1
1
1
0



Sample input:
5
1 1 2 2


Sample output:
2
2
0
0
0

Submission status: Time Limit Exceeded

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
from operator import itemgetter
from collections import deque
from collections import Counter
import math
import pprint
from functools import reduce
# stdin = open("sample.txt")

def keta(kazu):
    kazu_str = str(kazu)
    kazu_list = [int(kazu_str[i]) for i in range(0, len(kazu_str))]
    return kazu_list

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

N = int(stdin.readline().rstrip())
A = list(map(int,[int(x) for x in stdin.readline().rstrip().split()]))
attack = 0
menber = 0

while attack < N and menber < N:
    attack += 1
    ans = A.count(attack)
    print(ans)
    menber += ans
    
if attack < N:
    print('0\n'*(N-attack))

Submission status: Time Limit Exceeded

Solution code:
s = input().split()
n = int(s[0])
s = input().split()
d = {}

for i in s:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
keys=list(d.keys())

for i in range(1,n+1):
    if str(i) in keys:
        print(d[str(i)])
    else:
        print(0)

Submission status: Time Limit Exceeded

Solution code:
N= int(input())
A = list(map(int,input().split()))
for i in range(N):
    print(A.count(i+1))

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a_list = input().split()

for i in range(1, n+1):
  inf_count = a_list.count(str(i))
  print(inf_count)

Submission status: Time Limit Exceeded

Solution code:
import sys
import numpy as np
import math
from collections import deque 
from functools import reduce

# input = sys.stdin.readline

n = int(input())

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

a_n = np.array(a)

for i in range(n):
    b = np.where(a_n == i+1, 1, 0)
    print(b.sum())

Submission status: Time Limit Exceeded

Solution code:
data = [input() for i in range(2)]
N = int(data[0])
A = data[1].split()
A_num = [int(k) for k in A]
for i in range(N):
  num = i + 1
  print(A_num.count(num))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A=list(map(int,input().split()))
for i in range(1,N+1):
	print(A.count(i))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A=list(input().split())
cnt=[]

for i in range(N+1):
    if i==0:
        continue
    i=str(i)
    k=A.count(i)
    print(k)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(str,input().split()))

a_unique = list(set(a))

for i in range(1,n+1):
    if str(i) in a_unique:
        count_i = a.count(str(i))
        print(int(count_i))
    else:
        print(0)

Submission status: Time Limit Exceeded

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

max_A = max(A)

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

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = tuple(map(int,input().split())) #len == n-1
for i in range(1,n+1):
    if i==n:
        print(0)
    else:
        print(a.count(i))

Submission status: Time Limit Exceeded

Solution code:
num = int(input())
a = input().split()

l_a = [int(x) for x in a]
for i in range(1, num+1):
  print(l_a.count(i))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int,input().split()))
i = 0
while i<N:
    j = 0
    count = 0
    while j<N-1:
        if A[j]==i+1:
            count+=1
        j+=1
    print(count)
    i+=1

Submission status: Time Limit Exceeded

Solution code:
import sys

lines = sys.stdin.readlines()

N = int(lines[0])
Y = lines[1].split(' ')
A = []

for i in range(N):
    k = 0
    for j in range(N-1):
        if(int(Y[j])) == i+1:
            k = k +1
    A.append(k)

for i in range(N):
    print(A[i])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(str,input().split()))

print(A.count('1'))
for a in range(2, len(A)+2):
    print(A.count(str(a)))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A_List = list(map(int, input().split()))
i_before=1
for i in range(len(A_List)+1):
  i_count=A_List.count(i+1)
  print(i_count)
  if(i>i_before):
    continue
  i_before=i

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a_lst = list(map(int, input().split()))
res_lst = []

for i in range(n):
  cnt = (a_lst.count(i+1))
  print(cnt)

Submission status: Time Limit Exceeded

Solution code:
sh = int(input())
b = input()

id = [int(n) for n in b.split(" ")]
#id_list = set(id)

for i in range(1,sh+1):
    print(id.count(i))

Submission status: Time Limit Exceeded

Solution code:
count = int(input())
su_list = list(map(int, input().split()))
ans_list = []
for i in range(1, count + 1):
    ans_list.append(su_list.count(i))
for j in ans_list:
    print(j)

Submission status: Time Limit Exceeded

Solution code:
i = int(input())
a = list(map(int, input().split()))

for j in range(len(a)):
    s = a.count(j+1)
    print(s)
print(0)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
li = list(map(int,input().split()))
for i in range(1,n+1):
    print(li.count(i))

Submission status: Time Limit Exceeded

Solution code:
#!/usr/bin/env python3
n = int(input()) 
l = sorted(list(map(int, input().split())))
[print(l.count(i)) for i in range(1, n+1)]

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int,input().split()))
i = 1
while i <= N:
    print(A.count(i))
    i += 1

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = input()

for i in range(1,n+1):
  st = str(i)
  print(s.count(st))

Submission status: Time Limit Exceeded

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

for i in range(n):
    b = a[i:]
    print(b.count(i+1))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
List=list(map(int,input().split()))
List1=[]
for i in range(1,n+1):
  List1.append(List.count(i))
for i in List1:
  print(i)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
li = list(map(int,input().split()))

for i in range(1,N+1):
  print(li.count(i))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
a_list = list(map(int, input().split()))

for i in range(1, N+1):
    tmp_list = [a for a in a_list if a == i]
    print(len(tmp_list))

Submission status: Time Limit Exceeded

Solution code:
import sys
# sys.stdin = open('input.txt')

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

ans = {}
for i in range(1, n+1):
    ans[i] = a.count(i)

for i in ans.values():
    print(i)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
str1 = str(input())
s1 = str1.split(' ')
l1 = [int(x) for x in s1]
for i in range(1,n+1):
    print(l1.count(i))

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = [int(i) for i in input().split()]
del a[n:len(a)-1]
for i in range(n):
    count = 0
    for j in a:
        if i+1 == j:
            count += 1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int, input().split()))
bukalist = [0] * N
for i in range(len(bukalist)):
    print(A.count(i+1))

Submission status: Time Limit Exceeded

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

NMAX = max(A)

i=1
while i<=N:
    ans = A.count(i)
    print(ans)
    i+=1

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
L = list(map(int,input().split()))

for i in range(1,n+1):
    ans = L.count(i)
    print(ans)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = input().split(' ')

intAList = [int(i) for i in A]
#sortA = sorted(intAList)
#print(sortA)

for i in range(1,N+1):
  print(intAList.count(i))

Submission status: Time Limit Exceeded

Solution code:
num_staffs = int(input())
staffs = [int(i) for i in input().split()]

sets = set(staffs)

for i in range(1, num_staffs + 1):
    try:
        sets.remove(i)
        print(staffs.count(i))
    except:
        print(0)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
li = list(map(int,input().split()))
li_ans = [0]*len(li)

for i in range(1,N+1):
    print(li.count(i))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
    print(A.count(i + 1))

Submission status: Time Limit Exceeded

Solution code:
def main():
    mn = int(input())
    j = [int(x) for x in input().split()]
    for x in range(1, mn+1):
        print(j.count(x))


main()

Submission status: Time Limit Exceeded

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

for i in range(1, N+1):
    s = A.count(i)
    print(s)

Submission status: Time Limit Exceeded

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

a.sort()
tn = 1
cnt = 0
for i in range(n):
    
    for j in a:
        if j == tn: cnt += 1
    print(cnt)
    cnt = 0
    tn += 1

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
a_list = list(map(int, input().split()))

for i in range(1, N+1):
    print(a_list.count(i))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = []

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A_list = input().split()

for n in range(1,N+1,1):
    print(A_list.count(str(n)))

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
a = list(map(int,input().split()))
a.sort
for i in range(1,n+1):
    print(a.count(i))

Submission status: Time Limit Exceeded

Solution code:
def main():
  n = int(input())
  l = list(map(int, input().split()))
  for i in range(n):
    print(l.count(i+1))

if __name__ == '__main__':
  main()

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
tmp=input().split(" ")

list=[]
for i in range(N-1):
    list.append(int(tmp[i]))

count=0
for i in range(1,N+1):
    for j in range(N-1):
        if i==list[j]:
            count+=1
    print(count)
    count=0

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
c=list(map(int,input().split()))
for i in range(1,n+1):
    print(c.count(i))

Submission status: Time Limit Exceeded

Solution code:
a = int(input())
l = list(map(int, input().split()))
tot = 0
for i in range(a):
    if tot <= a - 1:
        print(l.count(i + 1))
        tot += l.count(i + 1)
    else:
        n = a - (i + 1)
        print('0\n' * n)
        exit()

Submission status: Time Limit Exceeded

Solution code:
def main():
    a = int(input())
    b = list(map(int, input().split()))
    for i in range(1,a+1):
        n = 0
        for j in b:
            if i == j:
                n = n + 1
        print(n)

if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
a = list(map(int, input().split()))
li = []
for i in range(N):
    li.append(a.count(i + 1))

for i in range(N):
    print(li[i])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = input().split()
count = 0
for i in range(n-1):
    if s[i] == '1':
        count += 1
print(count)
for i in range(n-1):
    count = 0
    num = i + 2
    for j in range(i+1,n-1):
        NUM = int(s[j])
        if NUM == num:
            count += 1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
l = list(map(int, input().split()))

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A = list(map(int, input().split()))
for i in range(N):
    print(A.count(i+1))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
li = list(map(int,input().split()))
li.sort()
for i in range(1,n+1):
    print(li.count(i))
    if i in li:
        li.remove(i)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:

import collections

N = int(input())

input_line = input()
Line = input_line.split()
Line = [int(s) for s in Line]

for i in range(1,N+1):
    print(Line.count(i))

Submission status: Time Limit Exceeded

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

from functools import lru_cache

ans = [0]*(N+1)

@lru_cache(maxsize=1000)
def main():
    for i in range(1,N+1):
        ans[i] = A.count(i)
        print(ans[i])

main()

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
L = list(map(int,input().split()))
for j in range(1,N+1):
    sum = 0
    for i in L:
        if i == j:
            sum += 1
    print(sum)

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
IDs =list(map(int,input().split()))

for i in range(1,N+1):
    print(IDs.count(i))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

boss_nums = input()
boss_nums = boss_nums.split()

subordinate = []

for boss in range(1, n+1):
    count = 0

    for num in boss_nums:
        if int(num) == boss:
            count = count + 1

    subordinate.append(count)


for num in range(0, n):
    print(subordinate[num])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int,input().split()))
num = 0
for i in range(1,N+1):
    print(A.count(i))
    num = num + A.count(i)
    if num > N:
        for j in range(N-i):
            print(0)
        break

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
An = [int(x) for x in input().split()]

for i in range(1, N+1):
    print(An.count(i))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A=list(map(int,input().split()))
ans=[0]*N
for i in range(1,N):
  ans[i]=A.count(i)
  print(ans[i])
print(A.count(N))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A=list(map(int,input().split()))
s=[]
for i in range(N-1):
    if A[i] not in s:
        print(A.count(i+1))
        s.append(i)
    else:
        print(0)
print(0)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

alist = input().split(" ")

aint = []

for i in range(n-1):
    aint.append(int(alist[i]))

for i in range(1, n+1):
    co = aint.count(i)
    print(co)

Submission status: Time Limit Exceeded

Solution code:

from collections import defaultdict
s = input().split()
n = int(s[0])
s = input().split()
d = defaultdict(int)
for i in s:
    d[i]+=1
keys=list(d.keys())

for i in range(1,n+1):
    if str(i) in keys:
        print(d[str(i)])
    else:
        print(0)

Submission status: Time Limit Exceeded

Solution code:
n=int(input())
j=list(map(int, input().split()))
for i in range(n):
    print(j.count(i+1))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = input().split(' ')

intAList = [int(i) for i in A]
sortA = sorted(intAList)

for i in range(1,N+1):
  print(sortA.count(i))

Submission status: Time Limit Exceeded

Solution code:
from collections import Counter
n=int(input())
lst=list(map(int,input().split()))
dic=Counter(lst)
def abc(i):
  if i in lst:
    return str(dic[i])
  else:
    return '0'
print('\n'.join([abc(i) for i in range(1,n+1)]))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
a = input().split(' ')
ans = []
for i in range(1,N+1):
    ans.append(a.count(str(i)))
for j in ans:
    print(j)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(1,N+1):
    if i in A:
        ans += A.count(i)
        print(ans)
        ans = 0
    else:
        print(0)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
s = input()

for i in range(n):
  st = str(i+1)
  print(s.count(st))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
Mgr = [int(num) for num in input().split()]

for i in range(1, N+1):
        ans = Mgr.count(i)
        print(ans)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A= [int(i) for i in input().split()]
for i in range(1,N+1):
  ans=A.count(i)
  print(ans)

Submission status: Time Limit Exceeded

Solution code:
num = int(input())
a = input().split()

for i in range(1, num+1):
  print(a.count(str(i)))

Submission status: Time Limit Exceeded

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

i = 1
while i <= n:
    print(A.count(i))
    i += 1

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
list = input().split()
for i in range(1, n + 1):
    count = 0
    for j in range(i - 1 ,n -1):
        if i == int(list[j]):
            count += 1
    print(count)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = [int(i) for i in input().split(' ')]

for i in range(1, n+1):
  if i in a:
    ans=a.count(i)
  else:
    ans = 0
  print(ans)

Submission status: Time Limit Exceeded

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

rsl = []
for i in range(1,n+1):
    rsl.append(a.count(i))

for _ in rsl:
    print(_)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())

alist = list(map(int, input().split()))
for _ in range(n):
  print(sum(1 for x in alist if x==_+1))

Submission status: Time Limit Exceeded

Solution code:
n= int(input())
li=list(map(int,input().split()))
ans=[]
for i in range(n):
  ans.append(li.count(i+1))
for i in ans:
  print(i)

Submission status: Time Limit Exceeded

Solution code:
def main():
    N = int(input())
    A_list = [A for A in input().split()]
    A_list = list(map(int, A_list))
    ans_list = []
    i_cycle = 1
    manage_dict = {}
    for n_cycle in range(1,N+1) :
        ans_list.append(A_list.count(n_cycle))
    for ans in ans_list :
        print(ans)


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    # print(i+1)
    # print(func(a, i + 1))
    print(a.count(i + 1))

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin
import numpy as np
N=list(map(int,(stdin.readline().strip().split())))[0]
A=np.array(list(map(int,(stdin.readline().strip().split()))))
count=np.count_nonzero(A==1)
print(np.count_nonzero(A==1))
flag=True
for i in range(2,N+1):
    count+=np.count_nonzero(A==i)
    if flag:print((np.count_nonzero(A==i)))
    else:print(0)
    if count == N - 1: flag = False

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin


def main():

    N = int(input())
    Alists = [int(x) for x in stdin.readline().rstrip().split()]

    for i in range(1, N+1):
        print(Alists.count(i))


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
a=int(input())
c=input().split()
for j in range(a):
    count=0
    for k in range(a-1):
        z=int(c[k])
        if z==(j+1):
            count+=1
        else:
            continue
    print(count)

Submission status: Time Limit Exceeded

Solution code:
a=int(input())
b=input().split()
l=[]
for i in b:
  l.append(int(i))
i=0
while i<a:
    print(l.count(i+1))
    i+=1

Submission status: Time Limit Exceeded

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

ans = [0] * n
for i in (range(n)):
    ans[i] = a.count(i+1)
    print(ans[i])

Submission status: Time Limit Exceeded

Solution code:
import collections

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

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

Submission status: Time Limit Exceeded

Solution code:
import sys
import math
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
import numpy as np
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson
from scipy.sparse import csr_matrix
import itertools
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(str, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
A = LIST()
A = sorted(A)

for i in range(N):
    count = 0
    for j in range(i, N - 1):
        if int(A[j]) == i + 1:
            count += 1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int,input().split()))
out = []
for i in range(1, N+1):
    if i not in A:
        print(0)
    else:
        print(A.count(i))

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A=list(input().split())
cnt=[]

for i in range(N+1):
    i=str(i)
    k=A.count(i)
    cnt.append(k)

for i in range(N+1):
    if  i==0:
        continue
    print(cnt[i])

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
s = set(a)
for i in range(1,n+1):
    if i in s:
        print(a.count(i))
    else:
        print(0)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
list_a = list(map(int, input().split()))
for i in range(n):
    print(list_a.count(i+1))

Submission status: Time Limit Exceeded

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
for i in range(1, n):
    print(a.count(i))
print(0)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
arr = [int(i) for i in input().split()]
for i in range(1, n + 1):
    print(arr.count(i))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
line = list(map(int,input().split()))
box = {}
for i in range(1,n+1):
  box[i] = 0
  for j in range(n-1):
    if  i == line[j]:
      box[i] += 1
for k in range(1,n+1):
  print(box[k])

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int,input().split()))
 
for i in range(n):
	print(a.count(i + 1))

Submission status: Time Limit Exceeded

Solution code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect

def LI(): return [int(x) for x in sys.stdin.readline().split()]


def I(): return int(sys.stdin.readline())


def LS(): return [list(x) for x in sys.stdin.readline().split()]


def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res


def IR(n):
    return [I() for i in range(n)]


def LIR(n):
    return [LI() for i in range(n)]


def SR(n):
    return [S() for i in range(n)]


def LSR(n):
    return [LS() for i in range(n)]


sys.setrecursionlimit(1000000)
mod = 1000000007


def solve():
    n = I()
    a = LI()
    for i in range(1,n):
        print(a.count(i))
    print(0)
    return


if __name__ == "__main__":
    solve()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
cnt = [0] * n
for i in a:
    if a.count(i) >= 1:
        p = 1
    else:
        p = 0
        
    cnt[i - 1] += p

for i in cnt:
    print(i)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a_list = list(map(int,input().split()))

for i in range(1, n+1):
  inf_count = a_list.count(i)
  print(inf_count)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
li = list(map(int, input().split()))

for i in range(len(li)+1):
    print(li.count(i + 1))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = []

for i in range(1,n+1):
    number = 0
    ans.append(a.count(i))

for j in ans:
    print(j)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
A = list(map(int, input().strip().split()))
for i in range(1,N+1):
  c=0
  for j in range(len(A)):
    if A[j]==i:
      c+=1
  print(c)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
lis = list(map(int,input().split()))

for i in range(n):
    a = i+1
    print(lis.count(a))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(n + 1):
    if i == 0: continue
    ans.append(a.count(i))

for i in range(n):
    print(ans[i])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
arr = list(map(int, input().split()))

for i in range(1,N+1,1):
    print(arr.count(i))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(str,input().split()))
for i in range(1,n+1):
    print(a.count(str(i)))
    a = [j for j in a if j != str(i)]

Submission status: Time Limit Exceeded

Solution code:
a=int(input())
li = list(map(int,input().split()))

for i in range(1,a+1):
  print(li.count(i))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = set(A)
C = []
D = [0]*N
for a in B:
    C.append(A.count(a))

for a, b in zip(B, C):
    D[a-1] += b

for a in D:
    print(a)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
d = input().split(" ")
for i in range(1, n+1):
	print(d.count(str(i)))

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
Alist = list(map(int,input().split()))
for i in range(N):
    if int(i+1) in Alist:
        a=i+1
        print(Alist.count(a))
    else:
        print(0)

Submission status: Time Limit Exceeded

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

import collections

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

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A_i = list(map(int, input().split()))
for i in range(N):
    print(A_i.count(i + 1))

Submission status: Time Limit Exceeded

Solution code:
import collections
n=int(input())
a=list(map(int,input().split()))
for i in range(1,n+1):
  print(collections.Counter(a)[i])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(1,N+1):
    if i in A:
        ans += A.count(i)
        print(ans)
        ans = 0
    else:
        print(0)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
#immediate boss and immediate subordinate
AS = input()
Ai = AS.split(" ")
output = []


for i in range(N):
    total = 0
    for j in Ai:
        if int(j) == i + 1:
            total = total + 1
    output.append(total)

x = ""
for A in output:
    x = x+str(A)+" "
print(x)

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
ans = []

for i in range(1, n+1):
    ans.append(a.count(i))

for i in range(n):
    print(ans[i])

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
data = list(map(int, input().split()))
exist_tuple = tuple(data)
for i in range(1, N + 1):
    if i in exist_tuple:
        print(data.count(i))
    else:
        print("0")

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
A = list(map(int,input().split()))
for i in range(1,N+1):
    print(A[i-1:].count(i))

Submission status: Time Limit Exceeded

Solution code:
syain_num = int(input())

boss_info_list = input().split(" ")

for i in range(syain_num):
    output = boss_info_list.count(str(i+1))
    print(output)

Submission status: Time Limit Exceeded

Solution code:
from sys import stdin

def main():

    input = stdin.readline

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

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


if __name__ == "__main__":
    main()

Submission status: Time Limit Exceeded

Solution code:
N=int(input())
X=list(map(int, input().split()))

for A in range(1,N+1):
  print(X.count(A))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
for i in range(1, n+1):
  b = a.count(i)
  print(b)

Submission status: Time Limit Exceeded

Solution code:
N = int(input())
a_list = list(map(int, input().split()))

for i in range(1, N+1):
    print(a_list.count(i))

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
list = input().split()
for i in range(1, n + 1):
    count = 0
    for j in range(i - 1 ,n -1):
        if i == int(list[j]):
            count += 1
    print(count)

Submission status: Time Limit Exceeded

Solution code:
def main():
    # 整数の入力
    N = int(input())
    A = list(map(int, input().split()))

    count = 0
    for i in range(1, N + 1):
        for a in A:
            if a == i:
                count += 1
        print(count)
        count = 0


if __name__ == '__main__':
    main()

Submission status: Time Limit Exceeded

Solution code:
n = int(input())
a = list(map(int, input().split()))
a.sort()
#print(a)
for i in range(n):
  b = a.count(i+1)
  print(b)

Submission status: Time Limit Exceeded

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

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

Submission status: Time Limit Exceeded

Solution code:

man_count = int(input())

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

ans = []

for i in range(len(infos)+1):
    print(infos.count(i+1))
    # work = infos.count(i+1)
    # ans.append(work)

#for i in ans:
#    print(i)