qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n = int(input())

A = [int(x) for x in input().split()]
B = {}

for a in A:
    if a not in B:
        B[a] = 0
    B[a] += 1

for i in range(n):
    if i in B:
        print(B[i])
    else:
        print(0)


Fixed code:
n = int(input())

A = [int(x) for x in input().split()]
B = {}

for a in A:
    if a not in B:
        B[a] = 0
    B[a] += 1

for i in range(1, n + 1):
    if i in B:
        print(B[i])
    else:
        print(0)
Buggy code:
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(n - 1):
    ans[A[i] - 1] += 1
for i in range(n):
    print(ans[i])



Fixed code:
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(N - 1):
    ans[A[i] - 1] += 1
for i in range(N):
    print(ans[i])
Buggy code:
N = int(input())
A = list(map(int,input().split()))
l = [0]*N
for i in A:
    l[i-1] +=1
print(x for x in l)

Fixed code:
N = int(input())
A = list(map(int,input().split()))
l = [0]*N
for i in A:
    l[i-1] +=1
for x in l:
    print(x)
Buggy code:
N=int(input())
A=[int(x) for x in input().split()]
M=[0 for i in range(N)]

for i in range(len(A)):
    M[A[i]-1]+=1
print(M)

Fixed code:
N=int(input())
A=[int(x) for x in input().split()]
M=[0 for i in range(N)]

for i in range(len(A)):
    M[A[i]-1]+=1
for i in M:
    print(i)
Buggy code:
n = int(input())
a = input().split()
ans = [0] * n
for i in range(n-1):
    ans[int(a[i])-1] +=1

print(ans)


Fixed code:
n = int(input())
a = input().split()
ans = [0] * n
for i in range(n-1):
    ans[int(a[i])-1] +=1
for i in ans:
    print(i)
Buggy code:
N = int(input())
A=[int(i) for i in input().split()]

B = [0 for i in range(len(A))]
for i in A:
    B[i] =B[i] + 1

for i in range(B):
    print(i)

Fixed code:
N = int(input())
A=[int(i) for i in input().split()]

B = [0 for i in range(N)]
for i in A:
    B[i-1] =B[i-1] + 1

for i in B:
    print(i)
Buggy code:
import collections as c
n=int(input())
a=list(map(int,input().split()))
b=c.Counter(a)
for i in range(1,N+1):
    print(b[i])

Fixed code:
import collections as c
n=int(input())
a=list(map(int,input().split()))
b=c.Counter(a)
for i in range(1,n+1):
    print(b[i])
Buggy code:
N = int(input())
A = list(map(int,input().split()))

count = [0]*(N-1)

for i in range(N-1):
    count[A[i]-1] += 1

for i in count:
    print(i)


Fixed code:
N=int(input())
A=list(map(int,input().split()))
x=[0]*N
for i in range(N-1):
  x[A[i]-1]+=1
for i in range(N):
  print(x[i])
Buggy code:
N=int(input())
A = list(map(int,input().split()))
buka=[0]*N
for i in A:
    buka[i-1]+=1
print(buka)


Fixed code:
N=int(input())
A = list(map(int,input().split()))
buka=[0]*N
for i in A:
    buka[i-1]+=1
for m in buka:
    print(m)
Buggy code:
s = input().split()
n = int(s[0])
s = input().split()
d = [0]*n
print(d)
for i in s:
    d[int(i)-1]+=1

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

Fixed code:
s = input().split()
n = int(s[0])
s = input().split()
d = [0]*n
for i in s:
    d[int(i)-1]+=1

for i in range(n):
    print(d[i])
Buggy code:
n = int(input())
alist = list(map(int,input().split()))
print(alist)
num_b = [0]*(n+1)
for i in range(n-1):
    num_b[alist[i]] += 1 
for i in range(1,n+1):
    print(num_b[i])

Fixed code:
n = int(input())
alist = list(map(int,input().split()))
num_b = [0]*(n+1)
for i in range(n-1):
    num_b[alist[i]] += 1 
for i in range(1,n+1):
    print(num_b[i])
Buggy code:
n=int(input())
a=list(map(int,input().split()))
mem=[0]*10

for i in a:
	mem[i-1]+=1

for i in mem:
	print(i)

Fixed code:
n=int(input())
a=list(map(int,input().split()))
mem=[0]*n

for i in a:
	mem[i-1]+=1

for i in mem:
	print(i)
Buggy code:
n = int(input())
l = list(map(int, input().split()))

ans = [0] * n
for i in l:
  l[i-1] += 1
  
for i in ans:
  print(i)

Fixed code:
n = int(input())
l = list(map(int, input().split()))
 
ans = [0] * n
for i in l:
  ans[i-1] += 1
  
for i in ans:
  print(i)
Buggy code:
t = int(input())
A = list(map(int,input().split()))
B = [-1]*t
for i in range(t-1):
    B[A[i]-1] += 1
for i in range(t):
    if B[i]!= -1:
      print(B[i]) 
    else:
      print(0)

Fixed code:
t = int(input())
A = list(map(int,input().split()))
B = [0]*t
for i in range(t-1):
    B[A[i]-1] += 1
for i in range(t):
    if B[i]!= -1:
      print(B[i]) 
    else:
      print(0)
Buggy code:
N=int(input())
A=list(map(int,input().split()))
ans=[]
for i in A:
    ans[i-1]+=1
for j in ans:
    print(j)

Fixed code:
N=int(input())
A=list(map(int,input().split()))
ans=[0]*N
for i in A:
    ans[i-1]+=1
for j in ans:
    print(j)
Buggy code:
n = int(input().strip().split())
arr = [int(i) for i in input().strip().split()]
result = {i:0 for i in range(1, n + 1)}
for i, j in enumerate(arr, 2):
    result[j] += 1
    
for i in result.values():
    print(i)

Fixed code:
n = int(input().strip())
arr = [int(i) for i in input().strip().split()]
result = {i:0 for i in range(1, n + 1)}
for i, j in enumerate(arr, 2):
    result[j] += 1
    
for i in result.values():
    print(i)
Buggy code:
from collections import Counter
n = int(input())
a = [int(x) for x in input().split()]
a_ = [int(x) for x in range(1, n+1)]
a += a_
a_count = Counter(a)
for i in range(n):
    print(a_count[i+1])

Fixed code:
from collections import Counter
n = int(input())
a = [int(x) for x in input().split()]
a_count = Counter(a)
for i in range(n):
    print(a_count[i+1])
Buggy code:
N=int(input())
A=list(map(int, input().split()))
b=[0]*N
for i in A:
    b[i-1]+=1
for i in b:
    print(b)

Fixed code:
N=int(input())
A=list(map(int, input().split()))
b=[0]*N
for i in A:
    b[i-1]+=1
for j in b:
    print(j)
Buggy code:
N = int(input())
values = list(map(int, input().split()))
values_dict = {}

for value in values:
    values_dict[value] = values_dict.get(value, 0) + 1

print(values_dict.get(i, 0) for i in range(1, N+1))



Fixed code:
N = int(input())
values = list(map(int, input().split()))
values_dict = {}

for value in values:
    values_dict[value] = values_dict.get(value, 0) + 1
for i in range(1, N+1):
    print(values_dict.get(i, 0))
Buggy code:
N = int(input())
A = sorted(list(map(int,input().split())))
L = [0]*(N+1)
for i in range(N-1):
  L[A[i]] += 1
for l in L:
  print(l)

Fixed code:
N = int(input())
A = sorted(list(map(int,input().split())))
L = [0]*(N+1)
for i in range(N-1):
  L[A[i]] += 1
for l in L[1:]:
  print(l)
Buggy code:
N = int(input())
A = input().split()
B = [0]*(N)
for i in range(0, len(A)):
    A[i] = int(A[i])
    B[A[i]-1] += 1

print(B)


Fixed code:
N = int(input())
A = input().split()
B = [0]*(N)
for i in range(0, len(A)):
    A[i] = int(A[i])
    B[A[i]-1] += 1

for i in B:
    print(i)
Buggy code:
n = int(input())
A = list(map(int, input().split()))
B = [0]*N

for i in A:
    B[i-1] += 1

for i in B:
    print(i)


Fixed code:
n = int(input())
A = list(map(int, input().split()))
B = [0]*n

for i in A:
    B[i-1] += 1

for i in B:
    print(i)
Buggy code:
N = int(input())
A = [int(i) for i in input().split()]
from collections import defaultdict as ddict
for n in range(N-1):
  A.append(int(input()))

B = ddict(int)
for a in A:
  B[a-1] += 1
for n in range(N):
  print(B[n])


Fixed code:
N = int(input())
A = [int(i) for i in input().split()]
from collections import defaultdict as ddict

B = ddict(int)
for a in A:
  B[a-1] += 1
for n in range(N):
  print(B[n])
Buggy code:
from collections import defaultdict

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

d=defaultdict(int)
for item in a:
    d[item-1]+=1
print(d)
for i in range(n):
    print(d[i])


Fixed code:
from collections import defaultdict

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

d=defaultdict(int)
for item in a:
    d[item-1]+=1
for i in range(n):
    print(d[i])
Buggy code:
N=int(input())
A=list(map(int,input().split()))
dic={}
for i in range(1,N+1):
  dic[i]=0
for a in A:
  dic[a]=+1
for i in range(1,N+1):
  print(dic[i])

Fixed code:
n = int(input())
A = list(map(int, input().split()))
dic = {}
for i in range(1, n+1):
  dic[i] = 0
for a in A:
  dic[a] += 1
for i in range(1, n+1):
  print(dic[i])
Buggy code:
N = int(input())
a = list(map(int,input().split()))
buka_num=[0 for _ in range(N+1)]

for i in a:
  buka_num[i]+=1
buka_num.pop(0)
buka_num.append(0)
for j in buka_num:
  print(j)

Fixed code:
N = int(input())
a = list(map(int,input().split()))
buka_num=[0 for _ in range(N+1)]

for i in a:
  buka_num[i]+=1
buka_num.pop(0)
for j in buka_num:
  print(j)
Buggy code:
N = int(input())
A = list(map(int, input()))

result = [0] * N

for a in A:
  result[a-1] += 1
  
for i in range(N):
  print(result[i])

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

result = [0] * N

for a in A:
  result[a-1] += 1
  
for i in range(N):
  print(result[i])
Buggy code:
n = int(input())
L = list(map(int,input().split()))
M = [0]*n
for i in range(n-1):
    M[L[i]-1] +=1
print(M)

Fixed code:
n = int(input())
L = list(map(int,input().split()))
M = [0]*n
for i in range(n-1):
    M[L[i]-1] +=1
for j in range(n):
    print(M[j])
Buggy code:
import collections
N=int(input())
A=list(map(int,input().split()))
a=collections.Counter(A)
for i in range(1,N+1):
  print(a["i"])

Fixed code:
import collections
N=int(input())
A=list(map(int,input().split()))
a=collections.Counter(A)
for i in range(1,N+1):
  print(a[i])
Buggy code:
n = int(input())
a = list(map(int, input().split()))
b = [0]*(n+1)

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

Fixed code:
n = int(input())
a = list(map(int, input().split()))
b = [0]*(n+1)

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

for i in range(1,n+1):
  print(b[i])
Buggy code:
def resolve():
    n = int(input())
	a = list(map(int, input().split()))
	ans = [0]*n
	for i in a:
		ans[i-1] += 1
	for i in ans:
		print(i)
resolve()

Fixed code:
def resolve():
	n = int(input())
	a = list(map(int, input().split()))
	ans = [0]*n
	for i in a:
		ans[i-1] += 1
	for i in ans:
		print(i)
resolve()
Buggy code:
import numpy as np

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

boss=[0]*N

for x in staff:
    boss[x-1] += 1
print(list)

Fixed code:
import numpy as np

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

boss=[0]*N

for x in A:
    boss[x-1] += 1
for i in boss:
    print(i)
Buggy code:
n=int(input())
a=list(map(int,input().split(" "))
list=[0 for i in range(n)]
for i in a:
  b=a[i]
  list[b]=list[b]+1
for j in list:
  print(list[j])

Fixed code:
n=int(input())
a=list(map(int,input().split(" ")))
t=[0 for i in range(n)]
for i in range(n-1):
  b=a[i]
  t[b-1]=t[b-1]+1
for j in range(n):
  print(t[j])
Buggy code:
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
for i in range(len(a)):
    ans[i-1] += 1
for i in range(len(a)):
    print(ans[i])


Fixed code:
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
for i in range(len(a)):
    ans[a[i]-1] += 1
for i in range(n):
    print(ans[i])
Buggy code:
from sys import stdin,stdout
size = int(stdin.readline())
li = list(map(int,stdin.readline().split()))
"""ans = [0]*size
for i in li:
    if i not in ans:
        ans[i-1] = 1
    else:
        ans[i-1] += 1
for i in ans:
    print(i)
"""
from collections import Counter
c1 = Counter(li)
ans2 = [0] * size
for i,j in c1.items():
    ans2[i-1] = j
for i in ans2:
    stdout.write(i)


Fixed code:
from sys import stdin,stdout
size = int(stdin.readline())
li = list(map(int,stdin.readline().split()))
"""ans = [0]*size
for i in li:
    if i not in ans:
        ans[i-1] = 1
    else:
        ans[i-1] += 1
for i in ans:
    print(i)
"""
from collections import Counter
c1 = Counter(li)
ans2 = [0] * size
for i,j in c1.items():
    ans2[i-1] = j
for i in ans2:
    stdout.write(str(i)+"\n")
Buggy code:
from collections import Counter
 
n = int(input())
a = list(map(int, input().split()))
 
c = Counter(a)
 
for _ in range(1, n):
  print(c[_])

Fixed code:
from collections import Counter
 
n = int(input())
a = list(map(int, input().split()))
 
c = Counter(a)
 
for _ in range(1, n+1):
  print(c[_])
Buggy code:
import collections
import numpy as np

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

zero = np.zeros(n+1)
c = collections.Counter(a)

for val,key in c.items():
    zero[val] = key

for i in range(len(zero)):
    if i > 0:
        print(zero[i])

Fixed code:
import collections
import numpy as np

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

zero = np.zeros(n+1)
c = collections.Counter(a)

for val,key in c.items():
    zero[val] = key

for i in range(len(zero)):
    if i > 0:
        print(int(zero[i]))
Buggy code:
N = int(input())
A = list(map(int, input().split()))
x = [0]**(2*10**5)
for i in range(N):
  x[A[i]] += 1

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

Fixed code:
N = int(input())
A = list(map(int, input().split()))
x = [0]*(2*10**5+1)
for i in range(N-1):
    x[A[i]] += 1
for i in range(1,N+1):
    print(x[i])
Buggy code:
N = int(input())
liste = list(map(int, input().split()))

from collections import Counter
countedList = Counter(liste)

for i in range(N):
  if i in countedList:
    print(countedList[i])
  else:
    print('0')

Fixed code:
N = int(input())
liste = list(map(int, input().split()))
 
from collections import Counter
countedList = Counter(liste)
# print(

for i in range(N):
  if i+1 in countedList:
    print(countedList[i+1])
  else:
    print('0')
Buggy code:
# coding: utf-8
# Your code here!
import collections
num = int(input())
line = list(map(int,input().split()))
clist = collections.Counter(line)
for i in range (1,num):
    print(clist[i])

Fixed code:
# coding: utf-8
# Your code here!
import collections
num = int(input())
line = list(map(int,input().split()))
clist = collections.Counter(line)
for i in range (1,num+1):
    print(clist[i])
Buggy code:
n = int(input())
a = list(map(int,input().split()))
ki = [[] for i in range(n)]
for i in range(n-1):
    ki[a[i]-1].append(i+1)
    ki[i+1].append(a[i]-1)
for i in range(n):
    if i == 0:
        print(len(ki[i]))
        continue
    print(len(ki[i])-1)
print(ki)

Fixed code:
n = int(input())
a = list(map(int,input().split()))
ki = [[] for i in range(n)]
for i in range(n-1):
    ki[a[i]-1].append(i+1)
    ki[i+1].append(a[i]-1)
for i in range(n):
    if i == 0:
        print(len(ki[i]))
        continue
    print(len(ki[i])-1)
Buggy code:
n = int(input())
lst = list(map(int,input().split()))
lst2 = [0 for i in range(n)]
for i in range(n):
  x = lst[i]
  lst2[x - 1] = lst2[x - 1] + 1
for i in range(n):
  print(lst2[i])

Fixed code:
n = int(input())
lst = list(map(int,input().split()))
lst2 = [0 for i in range(n)]
for i in range(n - 1):
  x = lst[i]
  lst2[x - 1] = lst2[x - 1] + 1
for i in range(n):
  print(lst2[i])
Buggy code:
N = int(input())
A = list(map(int, input().split()))
worker = [0] * N

for i in range(len(A)):
    worker[A[i] - 1] += 1
    print(worker)

for i in worker:
    print(i)

Fixed code:
N = int(input())
A = list(map(int, input().split()))
worker = [0] * N

for i in range(len(A)):
    worker[A[i] - 1] += 1

for i in worker:
    print(i)
Buggy code:
N = int(input())
A = list(map(int, input().split()))
lst = [0]*N
for i in A:
    joushi = A[i]
    lst[joushi-1] += 1
for syainn in lst:
    print(syainn)

Fixed code:
N = int(input())
A = list(map(int, input().split()))
lst = [0]*N
for i in A:
    lst[i-1] += 1
for syainn in lst:
    print(syainn)
Buggy code:
N = int(input())
ls = list(map(int, input()))
anls = [0]*(N+1)
for i in ls:
    anls[i] += 1
for i in range(1,N+1):
    print(anls[i])


Fixed code:
N = int(input())
ls = list(map(int, input().split()))
anls = [0]*(N+1)
for i in ls:
    anls[i] += 1
for i in range(1,N+1):
    print(anls[i])
Buggy code:

n = int(input())
a = list(int(i) for i in input().split())
lst = [0] * (n + 1)

for i in a:
    lst[i] += 1

for i in range(1, n):
    print(lst[i])


Fixed code:

n = int(input())
a = list(int(i) for i in input().split())
lst = [0] * (n + 1)

for i in a:
    lst[i] += 1

for i in range(1, n + 1):
    print(lst[i])
Buggy code:
import collections
N = int(input())
A = list(map(int,input().split()))
c = collections.Counter(A)
for i in range(N+1):
    print(c[i])

Fixed code:
import collections

N = int(input())
A = list(map(int, input().split()))
cnt = collections.Counter(A)
for i in range(1, N+1):
    print(cnt[i])
Buggy code:
N = int(input())
A = list(map(int,input().split()))
m = [0]*N #0~N-1
print(m)
for i in A:
    m[i-1] += 1
for i in range(N):
    print(m[i])


Fixed code:
N = int(input())
A = list(map(int,input().split()))
m = [0]*N #0~N-1

for i in A:
    m[i-1] += 1
# print(m)
for i in range(N):
    print(m[i])
Buggy code:
def function(n, list1):
  ans = [0] * n
  for i in list1:
    ans[i - 1] += 1
  string = ""
  for i in range(len(ans)):
    if i < len(ans) - 1:
      string += ans[i] + "\n"
    else:
      string += ans[i]
  return string

n = int(input())
list1 = input().split()
list1 = [int(i) for i in list1]
print(function(n, list1))
    

Fixed code:
def function(n, list1):
  ans = [0] * n
  for i in list1:
    ans[i - 1] += 1
  string = ""
  for i in range(len(ans)):
    if i < len(ans) - 1:
      string += str(ans[i]) + "\n"
    else:
      string += str(ans[i])
  return string
 
n = int(input())
list1 = input().split()
list1 = [int(i) for i in list1]
print(function(n, list1))
Buggy code:
N = int(input())
A =[int(i) for i in input().split()]
b = [0]*N
for i in A:
  result[i-1]+=1
for i in range(N):
    print(b[i])


Fixed code:
N = int(input())
A =[int(n) for n in input().split()]
b = [0]*N
for i in A:
  b[i-1]+=1
for i in range(N):
  print(b[i])
Buggy code:
# C - management
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
for i in range(n-1):
    ans[a[i]-1] += 1
print(ans)

Fixed code:
# C - management
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
for i in range(n-1):
    ans[a[i]-1] += 1
for i in range(n):
    print(ans[i])
Buggy code:
import numpy as np
n = int(input())
a = np.array(input().split(),dtype=int)
buka = [0 for i in range(n)]

for i in a:
    buka[i] += 1

for i in buka:
    print(i)


Fixed code:
import numpy as np
n = int(input())
a = np.array(input().split(),dtype=int)
buka = [0 for i in range(n)]

for i in a:
    buka[i-1] += 1

for i in buka:
    print(i)
Buggy code:
#!/usr/bin/env python3
from sys import stdin


def solve(tc):
    n = int(stdin.readline().strip())
    ai = list(map(int, stdin.readline().split()))

    adj = [[] for i in range(n)]
    for i in range(n - 1):
        adj[ai[i] - 1].append(i + 1)

    for children in adj:
        print(len(children))



LOCAL_TEST = not __debug__
if LOCAL_TEST:
    infile = __file__.split('.')[0] + "-test.in"
    stdin = open(infile, 'r')

tcs = int(stdin.readline().strip())
tc = 1
while tc <= tcs:
    solve(tc)
    tc += 1

Fixed code:
#!/usr/bin/env python3
from sys import stdin


def solve(tc):
    n = int(stdin.readline().strip())
    ai = list(map(int, stdin.readline().split()))

    adj = [[] for i in range(n)]
    for i in range(n - 1):
        adj[ai[i] - 1].append(i + 1)

    for children in adj:
        print(len(children))



LOCAL_TEST = not __debug__
if LOCAL_TEST:
    infile = __file__.split('.')[0] + "-test.in"
    stdin = open(infile, 'r')

tcs = 1
tc = 1
while tc <= tcs:
    solve(tc)
    tc += 1
Buggy code:
N=int(input())
A=list(map(int, input().split()))
ans=[0]*N
for a in A:
  ans[a-1]+=1
print(ans)

Fixed code:
N=int(input())
A=list(map(int, input().split()))
ans=[0]*N
for a in A:
  ans[a-1]+=1
for n in ans:
  print(n)
Buggy code:
n = int(input())
m = input().split()
m = [int(i) for i in m]

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

for i in m:
  ind = i-1
  l[ind] += 1

for i in l:
    print(i)
  
  

Fixed code:
n = int(input())
m = input().split()
m = [int(i) for i in m]
 
l =[]
for i in range(n):
  l.append(0)
for i in m:
  ind = i-1
  l[ind] += 1
for i in l:
  print(i)
Buggy code:
import collections
N = int(input())
A =[int(a) for a in input().split()]
def f():
    d = collections.defaultdict(int)
    for i, e in enumerate(A):
        d[e] += 1
    for key in range(1, N+1):
        print(d[key])


Fixed code:
import collections
N = int(input())
A =[int(a) for a in input().split()]
def f():
    d = collections.defaultdict(int)
    for i, e in enumerate(A):
        d[e] += 1
    for key in range(1, N+1):
        print(d[key])
f()
Buggy code:
N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in A:
    ans[i] += 1
for a in ans[1:]:
    print(a)

Fixed code:
N = int(input())
A = list(map(int,input().split()))
ans = [0]*N

for i in A:
    ans[i-1] += 1

for i in ans:
    print(i)
Buggy code:
n = int(input())
s = list(map(int, input().split()))
t = [0 for _ in range(n)]
for i in range(n-1):
  t[i] += 1
for i in range(n):
  print(t[i])

Fixed code:
n = int(input())
s = list(map(int, input().split()))
t = [0 for _ in range(n)]
for i in range(n-1):
  t[s[i]-1] += 1
for i in range(n):
  print(t[i])
Buggy code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
a = list(map(int, readline().split()))
l = [0]*n
for i in a:
    l[i - 1] += 1
print(l, sep="/n")

Fixed code:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
a = list(map(int, readline().split()))
l = [0]*n
for i in a:
    l[i - 1] += 1
print(*l,sep='\n')
Buggy code:
N = int(input())
A = list(map(int, input().split()))

G = [0] * (N + 1)
for i, val in enumerate(A):
    G[val] += 1
print(G)

for i in range(1, N + 1):
    print(G[i])

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

G = [0] * (N + 1)
for i, val in enumerate(A):
    G[val] += 1

for i in range(1, N + 1):
    print(G[i])
Buggy code:
n = int(input())
a = list(map(int, input().split()))
c = [] * n
for x in a:
  c[x-1] += 1
for x in c:
  print(x)

Fixed code:
n = int(input())
a = list(map(int, input().split()))
c = [0] * n

for x in a:
  c[x-1] += 1
for x in c:
  print(x)
Buggy code:
n = int(input())
a1 = list(map(int, input().split())) 
a2 = [0] * n

for i in range(n) :
    print(i)
    for j in range(n-1) :
        if i+1 == a1[j] :
            a2[i] += 1
    print(a2[i])
    

Fixed code:
n = int(input())
a1 = list(map(int, input().split())) 
a2 = [0] * n

for i in range(n -1) :
    a2[a1[i]-1] += 1
for j in range(n) :
    print(a2[j])
Buggy code:
from collections import Counter

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

c = Counter(A) 

for i in range(1, n):
  if i in c.keys():
    print(c[i])
  else:
    print(0)

Fixed code:
from collections import Counter

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

c = Counter(A) 

for i in range(1, n + 1):
  if i in c.keys():
    print(c[i])
  else:
    print(0)
Buggy code:
from collections import Counter

n = int(input())
s = mapt(int, input().split(" "))
data = Counter(s)
for i in range(1, n+1):
    print(data.get(i, 0))

Fixed code:
from collections import Counter

n = int(input())
s = map(int, input().split(" "))
data = Counter(s)
for i in range(1, n+1):
    print(data.get(i, 0))
Buggy code:
a = int(input())
b = list(map(int,input().split()))
c = [0]*a
for i in b:
    c[i-1] += 1
print(c)
for i in c:
    print(i)





Fixed code:
a = int(input())
b = list(map(int,input().split()))
c = [0]*a
for i in b:
    c[i-1] += 1
for i in c:
    print(i)
Buggy code:
N = int(input())
b = list(map(int,input().split()))
c= list()

for i in range( N - 1):
    c.append(0)
    
for i in b:
    c[i - 1] += 1
for i in c:
    print(c[i - 1])


Fixed code:
N = int(input())
b = list(map(int,input().split()))
c = list()

for i in range( N ):
    c.append(0)
for i in b:
    c[i - 1] += 1
#print(c)
for i in range(N):
    print(c[i])
Buggy code:
n = int(input())
a = list(map(int, input().split()))
s = [0]*n
for i in a:
    s[a[i-1]] += 1
for S in s[1::]:
    print(str(S))
print('0')

Fixed code:
n = int(input())
a = list(map(int, input().split()))
s = [0]*n
for i in a:
    s[i-1] += 1
for S in s[::]:
    print(str(S))
Buggy code:
worker_num=int(input())
num_director=input().split()
print(num_director)
count_director=[]
for j in range(len(num_director)+1):
    count_director.append(int(0))

for i in num_director:
    count_director[int(i)-1] +=1

for out in num_director:
    print(out)

Fixed code:
worker_num=int(input())
num_director=input().split()
count_director=[]
for j in range(len(num_director)+1):
    count_director.append(int(0))

for i in num_director:
    count_director[int(i)-1] +=1

for out in count_director:
    print(out)