qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
if n > sum(a):
    print(n-sum(a))
else:
    print('-1')

Fixed code:
n, m = map(int, input().split())
a = sum(list(map(int, input().split())))
if n >= a:
    print(n-a)
else:
    print(-1)
Buggy code:
a, _ =map(int,input().split())
li = [x for x in input().split()]
s = sum(li)
print(a-s)

Fixed code:
a, _ =map(int,input().split())
li = [int(x) for x in input().split()]
s = sum(li)
print(max(a-s, -1))
Buggy code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
d = n-sum(a)
if(a<0):
  d = -1
pritn(d)

Fixed code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
d = n-sum(a)
if(d<0):
  d = -1
print(d)
Buggy code:
N, M = map(int, input().split())
A = list(map(int, input().split()))

diff = N - sum(A)

if diff > 0:
    print(diff)
else:
    print(-1)

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

F = sum(A)
        
if N - F >= 0:
    print(N-F)
else:
    print(-1)
Buggy code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
sum_a = sum(a)
print(n-sum_a if n-sum_a >0 else -1) 

Fixed code:
n,m = map(int,input().split())
a = list(map(int,input().split()))
sum_a = sum(a)
print(n-sum_a if n-sum_a >=0 else -1)
Buggy code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = sum(a)
if b < n:
    print(n - b)
else:
    print("-1")

Fixed code:
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = sum(a)
if b <= n:
    print(n - b)
else:
    print("-1")
Buggy code:
n,m = map(int,input().split())
ls = list(map(int,input().split()))
if sum(ls) < n:
    print(n-sum(ls))
else:
    print("-1")

Fixed code:
n,m = map(int,input().split())
ls = list(map(int,input().split()))
if sum(ls) <= n:
    print(n-sum(ls))
else:
    print("-1")
Buggy code:
#!/usr/bin/env python3

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

sum_a = sum(a)
if sum_a > n:
    print(-1)
else:
    print(sum_a-n)


Fixed code:
#!/usr/bin/env python3

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

sum_a = sum(a)
if sum_a > n:
    print(-1)
else:
    print(n-sum_a)
Buggy code:
a,b = map(int,input().split())
c = [int(x) for x in input().split()]
print(c,len(c))
csum = 0
for i in range(len(c)):
    csum = csum + c[i]
if a>=csum:
    print(a-csum)
else:
    print(-1)

Fixed code:
a,b = map(int,input().split())
c = [int(x) for x in input().split()]
csum = 0
for i in range(len(c)):
    csum = csum + c[i]
if a>=csum:
    print(a-csum)
else:
    print(-1)
Buggy code:
n, m = map(int, input().split())
a = list(map(int, input().split()))

num = 0
for i in range(0, len(a)):
    num += int(a[i])

print(num)

target = n - num

if target >= 0:
    print(target)
else:
    print("-1")

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

num = 0
for i in range(0, len(a)):
    num += int(a[i])

target = n - num

if target >= 0:
    print(target)
else:
    print("-1")
Buggy code:
N,M=map(int,input().split())
A=list(map(int,input().split()))
total=sum(A)

playdays=N-total
if playdays>0:
    print(playdays)
else:
    print(-1)

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

playdays=N-total
if playdays>=0:
    print(playdays)
else:
    print(-1)
Buggy code:
def b163(n, m, al):


    return n - sum(al) if n - sum(al) < 0 else "-1"

def main():
    n , m = map(int, input().split())
    al = list(map(int, input().split()))
    print(b163(n, m, al))

if __name__ == '__main__':
    main()

Fixed code:
def b163(n, m, al):


    return n - sum(al) if n - sum(al) >= 0 else "-1"

def main():
    n , m = map(int, input().split())
    al = list(map(int, input().split()))
    print(b163(n, m, al))

if __name__ == '__main__':
    main()
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 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:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N = INT()
A = LIST()
CNT = [0]*N

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

for i in range(N-1):
	print(CNT[i])

Fixed code:
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
N = INT()
A = LIST()
CNT = [0]*N

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

for i in range(N):
	print(CNT[i])
Buggy code:
a=[0]*int(input())
for i in input().split(): a[int(i)-1]+=1
for i in range(N): print(f'{a[i]}')

Fixed code:
a=[0]*int(input())
for i in input().split(): a[int(i)-1]+=1
for i in range(len(a)): print(f'{a[i]}')
Buggy code:
N = int(input())

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

S = [0] * N

for i in A:
    S[i] += 1 

for s in S[1:]:
    print(s)


Fixed code:
N = int(input())

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

S = [0] * (N+1)

for i in A:
    S[i] += 1 

for s in S[1:]:
    print(s)
Buggy code:
n = int(input())
a = list(map(int, input().split()))

ans = [0]*n
counter = 0
for i in range(n):
    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
counter = 0
for i in range(n-1):
    ans[a[i]-1] += 1

for i in range(n):
    print(ans[i])
Buggy code:
import collections

n = int(input())
a = list(map(int, input().split()))
ac = 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()))
ac = collections.Counter(a)
 
for i in range(1,n+1):
    print(ac[i])
Buggy code:
 = int(input())
a_list = list(map(int, input().split()))
a_list = [ (i+2, s) for i, s in enumerate(a_list) ]
a_list = sorted(a_list, key=lambda x: x[1])
count = 0
boss = 1
for a in a_list:
    if a[1] == boss:
        count += 1
    else:
        diff = a[1] - boss
        for _ in range(diff):
            print(count)
            count = 0
        boss = a[1]
        count += 1

for _ in range(N - a_list[-1][1]+1):
    print(count)
    count = 0

Fixed code:
N = int(input())
a_list = list(map(int, input().split()))
a_list = [ (i+2, s) for i, s in enumerate(a_list) ]
a_list = sorted(a_list, key=lambda x: x[1])
count = 0
boss = 1
for a in a_list:
    if a[1] == boss:
        count += 1
    else:
        diff = a[1] - boss
        for _ in range(diff):
            print(count)
            count = 0
        boss = a[1]
        count += 1

for _ in range(N - a_list[-1][1]+1):
    print(count)
    count = 0
Buggy 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 j in B[1:]:
  print(j)

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 j in B:
  print(j)
Buggy code:
N = int(input())
A = input().split()
A.insert(0,0)
x = [0]*N
for i in range(N):
    x[A[i]-1]+=1
for j in range(N):
    print(x[j])


Fixed code:
N = int(input())
A = input().split()
x = [0]*N
for i in range(N-1):
    x[int(A[i])-1]+=1
for j in range(N):
    print(x[j])
Buggy code:
import collections

n = int(input())
mentors = input().split(" ")

a = collections.Counter(mentors)
print(a.keys())

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

Fixed code:
import collections

n = int(input())
mentors = input().split(" ")

a = collections.Counter(mentors)

for i in range(1, n+1):
    if str(i) in a.keys():
        print(a[str(i)])
    else:
        print(0)
Buggy code:
import sys
import os
import math

def file_input():
    f = open('input.txt', 'r')
    sys.stdin = f

def main():
   # file_input()

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

    for i in A:
        N[i]+=1

    for i in N[1:]:
        print(i)


if __name__ == '__main__':
    main()

Fixed code:
import sys
import os
import math

def file_input():
    f = open('input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()

    j = int(input())
    N = [0]*j
    A = list(map(int, input().split()))

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

    for i in N:
        print(i)


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[i]-1] += A[i]
    
[print(B[i]) for i in range(N)]

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

B = [0] * N

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

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

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

for i in range(k):
    print(k[i])

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

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

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

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

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

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

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

p = [0] * n

for i in p:
  for j in a:
    if(i == j - 1):
      p[i] += 1

for i in p:
  print(i)


Fixed code:
n = int(input())
a = list(int(i) for i in input().split())

p = [0] * n

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

for i in p:
  print(i)
Buggy code:
n = int(input())

data = input().split()
jousi = [int(s) for s in data]

buka = [0]*n

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

for i in buka:
  print(i)


Fixed code:
n = int(input())

data = input().split()
jousi = [int(s) for s in data]

buka = [0]*n

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

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

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

list = [0] * n
for i in a:
    list[i-1] += 1

[print(i) for i in list]
Buggy code:
EN = input().split()
Bc = [0] * int(EN[0])

tmp = input().split()
BossN = [int(s) for s in tmp]

for i in tmp:

    Bc[i-1] = Bc[i-1] + 1

print(*Bc,sep='\n')

Fixed code:
EN = input().split()
Bc = [0] * int(EN[0])

tmp = input().split()

for i in tmp:
    BossN = int(i)
    Bc[BossN-1] = Bc[BossN-1] + 1

print(*Bc,sep='\n')
Buggy code:
N = int(input())
A = [int(i) for i in input().split(' ')]
B = [0] * N
for i in A:
	B[i] += 1

for i in B:
	print(i)
	


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

for i in B:
	print(i)
Buggy code:
import numpy as np


if __name__ == '__main__':
    List = [list(map(int, input().split())) for i in range(2)]
    N = List[0][0]
    buka = np.array(List[1][:])


    l_out = np.zeros(N,dtype=int)

    for i in range(N):
        l_out[buka[i]-1] += 1

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



Fixed code:
import numpy as np
 
 
if __name__ == '__main__':
    List = [list(map(int, input().split())) for i in range(2)]
    N = List[0][0]
    buka = np.array(List[1][:])
 
 
    l_out = np.zeros(N,dtype=int)
 
    for i in range(N-1):
        l_out[buka[i]-1] += 1
 
    for i in range(N):
        print(l_out[i])
Buggy code:
from collections import Counter
N = int(input())
a  = list(input().split())
fact_count = Counter(a)
for i in range(1, N+1)
	try:
    	print(fact_count[i])
	except:
    	print(0)

Fixed code:
from collections import Counter
N = int(input())
a  = list(input().split())
fact_count = dict(Counter(a))
for i in range(1, N+1):
    try:
        print(fact_count[str(i)])
    except:
        print(0)
Buggy code:
n = int(input())
a = [int(n) for n in input().split()]

b = [0] * n

for i in a:
    b[i-1] += 1
    print(b)
 
for i in b:
    print(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 b:
    print(i)
Buggy code:
#C
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
m=max(a)
a = Counter(a)
print(a)

for i in range(1, n + 1):
    if i <= m:
        print(a[i])
    else:
        print(0)


Fixed code:
#C
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
m = max(a)
a = Counter(a)
# print(a)

for i in range(1, n + 1):
    if i <= m:
        print(a[i])
    else:
        print(0)
Buggy code:
from collections import Counter
n = input()
l = input().split()
lt = [int(i) for i in l]
f = Counter(l)
for i in lt:
    print(f[str(i+1)])


Fixed code:
from collections import Counter
n = list(range(int(input())))
l = input().split()
lt = [int(i) for i in l]
f = Counter(l)
for i in n:
    print(f[str(i+1)])
Buggy code:
n = int(input())
boss_list = list(map(int, input().split(' ')))

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

import collections
c = collections.Counter(boss_list)

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

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

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

import collections
c = collections.Counter(boss_list)

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


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

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

ans = [0]*num
print(ans)
print(indexes)

for i in range(num-1):
  ans[indexes[i]-1] +=1
print(ans)

Fixed code:
num = int(input())
indexes = list(map(int, input().split()))
ans = [0]*num
for i in range(num-1):
  ans[indexes[i]-1] +=1

for i in range(len(ans)):
  print(ans[i])
Buggy code:
n = input()
list = list(map(int,input().split()))
sum = 0

buka = [0]*(int(n))

for i in list:
    buka[i-1] += 1
for j in buka:
    print(buka[j])


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

buka = [0]*(int(n))

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

jyoshi=[0]*n
for i in range(n-1):
  jyo=a[i]
  jyoshi[jyo-1]=jyoshi[jyo-1]+1
  
for k in jyoshi:
  print k


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

jyoshi=[0]*n
for i in range(n-1):
  jyo=a[i]
  jyoshi[jyo-1]=jyoshi[jyo-1]+1
  
for k in jyoshi:
  print(k)
Buggy code:
N = int(input())
X = [0]*N
A = list(map(int,input().split()))
for i in A:
    X[i] +=1
print(X,sep="\n")

Fixed code:
N = int(input())
X = [0]*N
A = list(map(int,input().split()))
for i in A:
    X[i-1] +=1
print(*X,sep="\n")
Buggy code:
n = int(input())
arr = {}
s = list(map(int, input().split()))
for i in range(1, n):
  arr[i] = arr.get(s[i-1], 0) + 1

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

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

for i in range(1, n+1):
  print(arr[i] if i in arr else 0)
Buggy code:
import collections

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


ac = collections.Counter(a)

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

Fixed code:
import collections

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


ac = collections.Counter(a)

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

for i in a:
  l[i]+=1
print(l[1])
for i in a:
  print(l[i+1])


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

for i in a:
  i-=1
  l[i]+=1
for i in range(n):
  print(l[i])
Buggy code:
#https://atcoder.jp/contests/abc163/tasks/abc163_c
# -*- coding: utf-8 -*-
N = int(input())
A = input().split()
for i in range(len(A)):
  A[i] = int(A[i])
# A.insert(0,0)
buka = [0]*N
for i in range(len(A)):
  tmp = A[i]-1
  buka[tmp] += 1
print(buka)

Fixed code:
#https://atcoder.jp/contests/abc163/tasks/abc163_c
# -*- coding: utf-8 -*-
N = int(input())
A = input().split()
for i in range(len(A)):
  A[i] = int(A[i])
# A.insert(0,0)
buka = [0]*N
for i in range(len(A)):
  tmp = A[i]-1
  buka[tmp] += 1
for i in range(len(buka)):
  print(buka[i])
Buggy code:
n = int(input())
ai = list(map(int, input().split()))

ans = [0]*n
for i in range(len(ai)):
    ans[ai[i]] += 1
for i in range(len(ans)):
    print(ans[i])

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

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

Fixed code:
n = int(input())
a = list(map(int,input().split()))
l = [0]*n
for i in range(n-1):
    j = a[i]
    l[j-1] += 1
for i in range(n):
    print(l[i])
Buggy code:
n = int(input())
a = list(map(int, input().split()))
submap = {}
for each in a:
  try:
    submap[i] += 1
  except:
    submap[i] = 1
for i in range(1, n+1):
  try:
    print(submap[i])
  except:
    print(0)

Fixed code:

n = int(input())
a = list(map(int, input().split()))
submap = {}
for each in a:
  try:
    submap[each] += 1
  except:
    submap[each] = 1
for i in range(1, n+1):
  try:
    print(submap[i])
  except:
    print(0)
Buggy code:
N = int(input())
A = list(map(int,input().split()))
L = [0] * (N+1)
for i in range(N):
  L[A[i]]+=1
for i in range(1,N+1):
  print(L[i])

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
for i in range(1,N+1):
  print(L[i])
Buggy code:
from collections import Counter
n = int(input())
a = list(map(int,input().split()))

m = Counter(a)

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

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

m = Counter(a)

for i in range(1,n+1):
  print(m[i])
Buggy code:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
counter = np.bincount(A)
print(counter)
for i in range(1, N+1):
    if i < len(counter):
        print(counter[i])
    else:
        print(0)

Fixed code:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
counter = np.bincount(A)
for i in range(1, N+1):
    if i < len(counter):
        print(counter[i])
    else:
        print(0)
Buggy code:
N = int(input())
A = list(map(int, input().split()))
c = [0 for _ in range(N+1)]

for i in A:
  c[i-1] += 1
for i in c:
  print(i)

Fixed code:
N = int(input())
A = list(map(int, input().split()))
c = [0 for _ in range(N)]

for i in A:
  c[i-1] += 1
for i in c:
  print(i)
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 i in range(N):
  print(ans[i])

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

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

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

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

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

print(*A, sep='\n')


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

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

print(*ans, sep='\n')
Buggy code:
n = int(input())
A = list(map(int, input().split()))
ans = [0 for i in range(n)]
print(ans)

for i in range(n-1):
    ans[A[i]-1] += 1

print(ans)

Fixed code:
n = int(input())
A = list(map(int, input().split()))
ans = [0]*n
for e in A:
    ans[e-1] += 1

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

L = []
for i in range(N-1):
  L.append(0)

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

for j in range(N-1):
  print(L[j])

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

L = []
for i in range(N):
  L.append(0)

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

for j in range(N):
  print(L[j])
Buggy code:
N = int(input())
D = {i: [] for i in range(N)}
A = list(map(int, input().split()))
for i in range(N):
  D[i].append(A[i]-1)
for i in range(N):
  print(len(D[i]))

Fixed code:
N = int(input())
D = {i: [] for i in range(N)}
A = list(map(int, input().split()))
for i in range(N-1):
  D[A[i]-1].append(i)
for i in range(N):
  print(len(D[i]))
Buggy code:
N= int(input())
A=list(map(int,input().split()))


cnt=[0]*N
for i in range(1,N):
  cnt[A[i-1]-1]=cnt[A[i-1]-1]+1
print(cnt)

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


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

for c in cnt:
  print(c)
Buggy code:
N = int(input())
A = list(map(int,input().split()))

Clist = []
for count in range(len(A)+1):
    Clist.append(0)

for count in range(len(A)):
    Clist[A[count]-1] = Clist[A[count]-1] + 1

for count in range(0,len(A)):
    print(Clist[count])

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

Clist = []
for count in range(len(A)+1):
    Clist.append(0)

for count in range(len(A)):
    Clist[A[count]-1] = Clist[A[count]-1] + 1

for count in range(0,len(A)+1):
    print(Clist[count])