qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n=int(input())
a=list(map(int,input().split()))

answer=[0]*n
for i in range(n):
    answer[a[i]-1]+=1

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



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

answer=[0]*n
for i in range(n-1):
    answer[a[i]-1]+=1

for i in range(n):
    print(answer[i])
Buggy code:
import sys
input = sys.stdin.readline

n = int(input())
A = [int(a) for a in input().split()]

sub_list = [0] *n

for a in A:
  sub_list[a] +=1

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

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

n = int(input())
A = [int(a) for a in input().split()]

sub_list = [0] *n

for a in A:
  sub_list[a-1] +=1

for i in range(n):
  print(sub_list[i])
Buggy code:
import sys

n, *a = map(int, sys.stdin.read().split())
print(a)
graph = [[] for _ in range(n)]
for i in range(n - 1):
    graph[a[i]-1].append(i)
def main():
    for i in range(n):
        print(len(graph[i]))


if __name__ == '__main__':
    main()

Fixed code:
import sys

n, *a = map(int, sys.stdin.read().split())
graph = [[] for _ in range(n)]
for i in range(n - 1):
    graph[a[i]-1].append(i)
def main():
    for i in range(n):
        print(len(graph[i]))


if __name__ == '__main__':
    main()
Buggy code:
n = int(input())
A = list(map(int, input().split()))

N = [0]*n
for a in A:
  N[a] += 1

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

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

N = [0]*(n+1)
for a in A:
  N[a] += 1

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

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 range(N):
  print(ans[i])
Buggy code:
n = int(input())
a = list(map(int, input().split()))

l = [0]*n
for i in range(n-1):
  l[a[i]] += 1
  
print(*l[1:], sep = '\n')

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

l = [0]*(n+1)
for i in range(n-1):
  l[a[i]] += 1
  
print(*l[1:], sep = '\n')
Buggy code:
import sys
from collections import Counter
from typing import Callable, NoReturn, Tuple


def main() -> NoReturn:
    scan: Callable[[], str] = sys.stdin.readline

    n: int = int(scan().rstrip())
    a: Tuple[int] = tuple(int(a_i) for a_i in scan().rstrip().split())

    count: Counter = Counter(a)

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


if __name__ == '__main__':
    main()


Fixed code:
import sys
from collections import Counter
from typing import Callable, NoReturn, Tuple


def main() -> NoReturn:
    scan: Callable[[], str] = sys.stdin.readline

    n: int = int(scan().rstrip())
    a: Tuple[int] = tuple(int(a_i) for a_i in scan().rstrip().split())

    count: Counter = Counter(a)

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


if __name__ == '__main__':
    main()
Buggy code:
n=int(input())
a_list=[int(i) for i in input().split(' ')]

c = collections.Counter(a_list)
[print(c[i+1]) for i in range(n)]

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

import collections

c = collections.Counter(a_list)
[print(c[i+1]) for i in range(n)]
Buggy code:
n = int(input())
a = [int(i) for i in input().split()]
A = [0 for i in range(n)]
for aa in a:
    A[a]+=1
for aa in A:
    print(aa)

Fixed code:
n = int(input())
a = [int(i) for i in input().split()]
A = [0 for i in range(n)]
for aa in a:
    A[int(aa)-1]+=1
for aaa in A:
    print(aaa)
Buggy code:
import collections
n=int(input())
a=list(map(int,input().split()))
dic=collections.Counter(a)
for i in range(1,n):
    if i in dic.keys():
        print(dic[i])
    else:
        print(0)

Fixed code:
import collections
n=int(input())
a=list(map(int,input().split()))
dic=collections.Counter(a)
for i in range(1,n+1):
    if i in dic.keys():
        print(dic[i])
    else:
        print(0)
Buggy code:
n = int(input())
a = list(map(int,input().split()))

id = [0 for _ in range(n)]
for i in range(len(a)):
	id[a[i]-1] += 1

for i in id:
	print(i

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

id = [0 for _ in range(n)]
for i in range(len(a)):
	id[a[i]-1] += 1

for i in id:
	print(i)
Buggy code:
import 
n = int(input())
lst = list(map(int, input().split()))
dct = {i: 0 for i in range(n+1)}
for i in lst:
  dct[i] += 1

for i in range(2, n+1):
  print(dct[i])

Fixed code:
n = int(input())
lst = list(map(int, input().split()))
dct = {i: 0 for i in range(n+1)}
for i in lst:
  dct[i] += 1

for i in range(1, n+1):
  print(dct[i])
Buggy code:
n = int(input())
a_list = map(int, input().split())
nl = [0] * n
for a in a_list:
    nl[a] += 1
for v in nl:
    print("{}".format(v))

Fixed code:
n = int(input())
a_list = map(int, input().split())
nl = [0] * n
for a in a_list:
    nl[a-1] += 1
for v in nl:
    print("{}".format(v))
Buggy code:
n = int(input())
a_list = map(int input().split())
nl = {str(i):0 for i in range(n)}
for a in a_list:
    nl[str(a-1)] += 1
for v in nl.values():
    print("{}".format(v))

Fixed code:
n = int(input())
a_list = [int(i) for i in input().split()]
nl = {str(i):0 for i in range(n)}
for a in a_list:
    nl[str(a-1)] += 1
for v in nl.values():
    print("{}".format(v))
Buggy code:
n = int(input())
a_list = [int(i) for i in input().split()]

nl = [0 for i in range(n)]
print(nl)
for a in a_list:
    nl[a-1] += 1

for i in nl:
    print("{}".format(i))

Fixed code:
n = int(input())
a_list = [int(i) for i in input().split()]
nl = [0 for i in range(n)]
for a in a_list:
    nl[a-1] += 1
for i in nl:
    print("{}".format(i))
Buggy code:
n=int(input())
arr=[int(i) for i in input().split()]
ans=[ 0 for i in range(n+1)]
for i in range(n):
    ans[arr[i]-1]+=1
for i in ans:
    print(i)


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

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

for i in As:
    ans[i]+=1

for j in ans:
    print(j)

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

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

for j in ans:
    print(j)
Buggy code:
n=int(input())
a=list(map(int,input().split()))
b=[0]*(n)

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

print(b for _ in range(n-1))

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 range(n):
  print(b[i])
Buggy code:
N = int(input())
A = list(map(int, input().split()))

B = [0] * N

for i in A:
  B[i-1] = int(B[i-1]) + 1
  
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 i in B:
    print(i)
Buggy code:
N = int(input())
A = [0]
B = list(map(int, input().split()))
A += B
#print(A)

sig = [0] * N

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

print(sig)
for i in sig:
  print(i)

Fixed code:
N = int(input())
A = [0]
B = list(map(int, input().split()))
A += B
#print(A)

sig = [0] * N

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

#print(sig)
for i in sig:
  print(i)
Buggy code:
N = int(input())
arr = list(map(int, input().split()))
ans = [0]*N

for i in range(N-1):
    ans[(arr[i])-1] += 1

print(ans)

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

for i in range(N-1):
    ans[(arr[i])-1] += 1

for i in range(len(ans)):
    print(ans[i])
Buggy code:
# import math
# import statistics
a=int(input())
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#    c.append(i)
# e1,e2 = map(int,input().split())
f = list(map(int,input().split()))
#g = [input() for _ in range(a)]

f.sort()
count=1
ans=[0 for i in range(len(f))]

for i in range(len(f)-1):
    if f[i]==f[i+1]:
        count+=1
    else:
        ans[f[i]-1]=count
        count=1
if count>1:
    ans[f[-1]-1]=count
for i in ans:
    print(i)

Fixed code:
# import math
# import statistics
a=int(input())
#b,c=int(input()),int(input())
# c=[]
# for i in a:
#    c.append(i)
# e1,e2 = map(int,input().split())
f = list(map(int,input().split()))
#g = [input() for _ in range(a)]

f.sort()
count=1
ans=[0 for i in range(a)]

for i in range(len(f)-1):
    if f[i]==f[i+1]:
        count+=1
    else:
        ans[f[i]-1]=count
        count=1
if count>=1:
    ans[f[-1]-1]=count
for i in ans:
    print(i)
Buggy code:

def main():
    n = int(input())
    a = list(map(int, input().split(' ')))
    buka = [0]*n
    print(a)

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

    for i in buka:
        print(i)


if __name__ == "__main__":
    main()


Fixed code:

def main():
    n = int(input())
    a = list(map(int, input().split(' ')))
    buka = [0]*n

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

    for i in buka:
        print(i)


if __name__ == "__main__":
    main()
Buggy code:
N =int(input())
A =list(map(int,input().split()))
l =[0]*N
for i in A:
  l[i-1]+=1
print(l)

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 =input()
A =list(map(input().split()))
l =[0*N]
for i in A:
  A[i]+=1
print(l, sep ="\n")


Fixed code:
N=int(input())
A=list(map(int,input().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()))
ans=[0]*N
for _i in range(N):
  ans[A[i]-1]+=1

for x in ans:
  print(x)

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 x in ans:
  print(x)
Buggy code:
n = int(input())
a = list(map(int, input().split()))

result = [0 for _ in range(n)]
for i in range(n - 1):
    result[a[i]-i] += 1

for v in result:
    print(v)

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

result = [0 for _ in range(n)]
for i in range(n - 1):
    result[a[i]-1] += 1

for v in result:
    print(v)
Buggy code:
n = int(input())
a = list(map(int, input().split()))

num = [0] * n
for i in range(0,n):
    num[i-1] += 1
print(num[i])    

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

member_list = [0]*N
for rel in rel_list:
    member_list[rel-1] += 1

print([i for i in member_list])

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

member_list = [0]*N
for rel in rel_list:
    member_list[rel-1] += 1

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

result = [0] * N
for a in A:
    result[a - 1] += 1
print('\n'.join(result))


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

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

a = [0]*N
for i in range(len(A)):
    a[A[i]-1] += 1
    
for j in range(len(A)):
    print(a[A[j]-1])
print(0)

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

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

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

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 j in range(N):
  print(ans[j])
Buggy code:
n = int(input())
a = [0 for _ in range(n)]
m = list(map(int, input().split()))
for i in m:
	a[i-1] += 1
print(a)

Fixed code:
n = int(input())
a = [0 for _ in range(n)]
m = list(map(int, input().split()))
for i in m:
	a[i-1] += 1
for v in a:
	print(v)
Buggy code:
import numpy as np
n = int(input())
jousi = list(map(int, input().split()))
a = np.zeros(n)
for i in jousi :
    a[jousi[i] -1] += 1
    print(int(a[jousi[i] - 1]))

Fixed code:
import numpy as np
n = int(input())
jousi = list(map(int, input().split()))
a = np.zeros(n)
for i in range(len(jousi)) :
    a[jousi[i] - 1] += 1
for i in range(len(a)):
    print(int(a[i]))
Buggy code:
n = int(input())
a = list(map(int,input().split()))
countlist = [0 for i in range(n)]
for j in range(n):
    countlist[a[j]-1]+=1
for i in range(n):
    print(countlist[i])

Fixed code:
n = int(input())
a = list(map(int,input().split()))
countlist = [0 for i in range(n)]
for j in range(n-1):
    countlist[a[j]-1]+=1
for i in range(n):
    print(countlist[i])
Buggy code:
def main():
    n = int(input())
    a = list(map(int,input().split()))
    al = [0 for i in range(n)]
    
    for i in a:
        al[a[i]-1] += 1
    for i in range(n):
        print(al[i])
main()

Fixed code:
n = int(input())
a = list(map(int,input().split()))
al = [0 for i in range(n)]

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

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

for i in range(n - 1):
  answer[a[i] - 1] += 1
    
for i in range(n):
  print(answer[i])
Buggy code:
import collections
from collections import Counter
n=int(input())
d=collections.deque()
l=list(map(int,input().split()))
d.extend(l)
d.appendleft(0)
c=dict(Counter(d))
s=set(d)
for x in d:
    if x+1 in s:print(c[x+1])
    else:print(0)



Fixed code:
import collections
from collections import Counter
n=int(input())
d=collections.deque()
l=list(map(int,input().split()))
d.extend(l)
d.appendleft(0)
c=dict(Counter(d))
s=set(d)
for x in range(1,len(d)+1):
    if x in s:
        print(c[x])
    else:
        print(0)
Buggy code:
n=int(input())
s = list(map(int, input().split()))
z=[]*n
for  i in range(len(s)):
    z[s[i]-1]+=1
for j in range(n):
    print(z[j])

Fixed code:
n=int(input())
s = list(map(int, input().split()))
z=[0]*n
for  i in range(len(s)):
    k=s[i]-1
    z[k]+=1
for j in range(n):
    print(z[j])
Buggy code:
N = int(input())
A = input().split()
c = collections.Counter(A)

import collections
for i in range(1,N+1):
    print(c[str(i)])


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

import collections
c = collections.Counter(A)

for i in range(1,N+1):
    print(c[str(i)])
Buggy code:
N = int(input())
A = list(map(int, input().split())) # <- note that this has (N - 1) elements
print(A)
A_0 = [x - 1 for x in A]
print(A_0)
ans = [0] * N # <- represents number of immediate subordinates of each person

for i in range(0, N - 1):
    ans[A_0[i]] += 1

for i in range(0, N):
    print(ans[i])


Fixed code:
N = int(input())
A = list(map(int, input().split())) # <- note that this has (N - 1) elements
#print(A)
A_0 = [x - 1 for x in A]
#print(A_0)
ans = [0] * N # <- represents number of immediate subordinates of each person

for i in range(0, N - 1):
    ans[A_0[i]] += 1

for i in range(0, N):
    print(ans[i])
Buggy code:
import collections
N = int(input())
ls = list(map(int,input().split()))
count = collections.Counter(ls)
for i in range(1,N+1):
    if i in count.items():
        print(count[i])
    else:
        print(0)

Fixed code:
import collections
N = int(input())
ls = list(map(int,input().split()))
count = collections.Counter(ls)
for i in range(1,N+1):
    if i in count.keys():
        print(count[i])
    else:
        print(0)
Buggy code:
 -*- coding: utf-8 -*-

N = int(input())
A = list(map(int, input().split()))
sheet = [0]*(N)
for i in range(N-1):
    sheet[A[i]-1]=sheet[A[i]-1]+1


for i in range(N):
    print("{}".format(sheet[i]))


Fixed code:
# -*- coding: utf-8 -*-

N = int(input())
A = list(map(int, input().split()))
sheet = [0]*(N)
for i in range(N-1):
    sheet[A[i]-1]=sheet[A[i]-1]+1


for i in range(N):
    print("{}".format(sheet[i]))
Buggy code:
n=int(input())
a=list(map(int,input().split()))
buka=[0]*n
for i in a:
  s[i]=s[i]+1
for i in buka:
  print(i)

Fixed code:
n=int(input())
a=list(map(int,input().split()))
buka=[0]*n
for i in a:
  buka[i-1]=buka[i-1]+1
for i in buka:
  print(i)
Buggy code:
from collections import Counter
a=int(input())
l=list(map(int,input().split()))
d=Counter(l)
print(d)
for i in range(1,a+1):
    if i in d:
        print(d[i])
    else:
        print("0")

Fixed code:
from collections import Counter
a=int(input())
l=list(map(int,input().split()))
d=Counter(l)
# print(d)
for i in range(1,a+1):
    if i in d:
        print(d[i])
    else:
        print("0")
Buggy code:
n = int(input())
a = [0]+list(map(int, input().split()))
print(a)
ans = [0] * n
for i in range(n):
    if 0 < a[i]:
        ans[a[i]-1] += 1
print(ans)

Fixed code:
n = int(input())
a = [0]+list(map(int, input().split()))
#print(a)
ans = [0] * n
for i in range(n):
    if 0 < a[i]:
        ans[a[i]-1] += 1
for i in ans:
    print(i)
Buggy code:
n = int(input())
a = [int(x) for x in input().split()]
ans = [0] * n
for i in range(n):
  ans[a[i]] += 1
for i in range(n):
  print(ans[i])

Fixed code:
n = int(input())
a = [int(x) for x in 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:
# -*- coding: utf-8 -*-
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    ans = []
    for _ in range(N):
        ans.append(0)
    for i in A:
        ans[A[i]-1]+=1
    for j in ans:
        print(j)
if __name__ == '__main__':
    main()

Fixed code:
# -*- coding: utf-8 -*-
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    ans = []
    for _ in range(N):
        ans.append(0)
    for i in A:
        ans[i-1]+=1
    for j in ans:
        print(j)
if __name__ == '__main__':
    main()
Buggy code:
N = int(input())
A = list(map(int,input().split()))
B = [0]*N
for i in range(N-1):
    B[A.pop()-1]+=1
for i in B:
    print(B[i])

Fixed code:
N = int(input())
A = list(map(int,input().split()))
B = [0]*N
for i in range(N-1):
    B[A.pop()-1]+=1
for i in range(N):
    print(B[i])
Buggy code:
from sys import stdin, stdout
from collections import deque, defaultdict
import math as m

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')

def main():
	n = int(rl())
	A = list(rli())
	cnt = defaultdict(lambda: 0)
	for i, boss in enumerate(A):
		cnt[boss] += 1
	for i in range(1, n):
		print(cnt[i])
	stdout.close()

if __name__ == "__main__":
	main()

Fixed code:
from sys import stdin, stdout
from collections import deque, defaultdict
import math as m

rl = lambda: stdin.readline()
rll = lambda: stdin.readline().split()
rli = lambda: map(int, stdin.readline().split())

INF, NINF = float('inf'), float('-inf')

def main():
	n = int(rl())
	A = list(rli())
	cnt = defaultdict(lambda: 0)
	for i, boss in enumerate(A):
		cnt[boss] += 1
	for i in range(1, n + 1):
		print(cnt[i])
	stdout.close()

if __name__ == "__main__":
	main()
Buggy code:
N = int(input())
counter = [0] * N
As = map(int, input().split())
for A in As:
  counter[A] += 1
for c in counter:
  print(c)

Fixed code:
N = int(input())
counter = [0] * N
As = map(int, input().split())
for A in As:
  counter[A-1] += 1
for c in counter:
  print(c)
Buggy code:
N=int(input())
alist=list(map(int,input().split()))

answer_dic={}
for a in alist:
  if a in answer_dic:
    answer_dic[a]+=1
  else:
    answer_dic[a]=1
print(answer_dic)

for i in range(1,N+1):
  if i in answer_dic:
    print(answer_dic[i])
  else:
    print(0)

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

answer_dic={}
for a in alist:
  if a in answer_dic:
    answer_dic[a]+=1
  else:
    answer_dic[a]=1
#print(answer_dic)

for i in range(1,N+1):
  if i in answer_dic:
    print(answer_dic[i])
  else:
    print(0)
Buggy code:
def main():
  n = int(input())
  A = list(map(int, input().split()))
  
  num = [0] * n
  
  for i in range(0, n-1):
    for k in range(0, len(A)):
      if A[k] == i+1:
        num[i] += 1
      
  print(num)
  
main()

Fixed code:
def main():
  n = int(input())
  A = list(map(int, input().split()))
  
  num = [0] * n + [0]
  
  # for i in range(0, n-1):
  #   for k in range(0, len(A)):
  #     if A[k] == i+1:
  #       num[i] += 1
  
  for i in range(0, n-1):
    num[A[i]] += 1
  
  for k in range(1, n+1):    
    print(num[k])
  
main()
Buggy code:
n = int(input())
a = list(input().split())
#print(a)

employ = {}

for i in range(len(a)):
    if a[i] in employ:
        employ[a[i]] = employ[a[i]] + 1
    else:
        employ[a[i]] = 1

#print(employ)
for i in range(1, n):
    if str(i) in employ:
        print(employ[str(i)])
    else:
        print(0)

Fixed code:
n = int(input())
a = list(input().split())
#print(a)

employ = {}

for i in range(len(a)):
    if a[i] in employ:
        employ[a[i]] = employ[a[i]] + 1
    else:
        employ[a[i]] = 1

#print(employ)
for i in range(1, n+1):
    if str(i) in employ:
        print(employ[str(i)])
    else:
        print(0)
Buggy code:
N=int(input())
A_r=list(input().split())
A=[int(x) for x in A_r]
B=[0 for i in range(N)]
print(B)
for i in range(len(A)):
    B[A[i]-1]+=1
[print(i) for i in B]

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

for i in range(len(A)):
    B[A[i]-1]+=1
for i in range(len(B)):
    print(B[i])
Buggy code:
def resolve():
    n = int(input())
    woker = list(map(int, input().split()))
    woker_count = collections.Counter(woker)
    for i in range(n):
        print(woker_count[i + 1])


resolve()

Fixed code:
import collections


def resolve():
    n = int(input())
    woker = list(map(int, input().split()))
    woker_count = collections.Counter(woker)
    for i in range(n):
        print(woker_count[i + 1])


resolve()
Buggy code:
from itertools import repeat

n = int(input())
lis = list(map(int, input.split()))
d = [[0] for i in repeat(None, n)]

for i in lis:
  d[i - 1][0] += 1
  
for i in d:
  print(i[0])

Fixed code:
from itertools import repeat
 
n = int(input())
lis = list(map(int, input().split()))
d = [[0] for i in repeat(None, n)]
 
for i in lis:
  d[i - 1][0] += 1
  
for i in d:
  print(i[0])
Buggy code:
import numpy as np
n = int(input())
a = [int(i) for i in input().split()]
b = np.zeros(n)
for i in a: b[i-1] += 1
print(b)


Fixed code:
import numpy as np
n = int(input())
a = [int(i) for i in input().split()]
b = np.zeros(n)
for i in a: b[i-1] += 1
for i in b: print(int(i))
Buggy code:
import collections
n=int(input())
a=list(map(int, input().split()))
c=collections.Counter(a)
for i in range(n):
    print(c[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])
Buggy code:
import collections
n = int(input)
A = list(map(int, input().split()))
cnt = collections.Counter(A)
for i in range(n):
  print(cnt[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:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

l = collections.Counter(A)
for i in range(1, N+1):
  print(l[i])


Fixed code:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))

l = Counter(A)
for i in range(1, N+1):
  print(l[i])
Buggy code:
def main():
  N = input()
  A = [int(x) for x in input().split()]
  
  B = [0] * N
  for i in range(N):
    B[A[N-i-1]] += 1
  
  for i in range(N):
    print(B[i])
    
if __name__ == '__main__':
  main()

Fixed code:
def main():
  N = int(input())
  A = [int(x) for x in input().split()]
  
  B = [0] * N    
  for i in range(N-1):
      B[A[N-i-2]-1] += 1
  
  for i in range(N):
    print(B[i])
    
if __name__ == '__main__':
  main()
Buggy code:
import collections
N = int(input())
A = list(map(int, input().split()))

c = collections.Counter(A)
print(c)

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

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