qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n,m=map(int,input().split())
lst=[0]*m

for i in range(m):
    a,b=map(int,input().split())
    lst[a-1]+=1
    lst[b-1]+=1

for i in lst:
    print(i)

Fixed code:
n,m = map(int,input().split())
ans = [0]*n
for i in range(m):
  a,b = map(int,input().split())
  ans[a-1] = ans[a-1]+1
  ans[b-1] = ans[b-1]+1
[print(i) for i in ans]
Buggy code:
def main():
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for i in range(m)]
    res = [0] * n
    for i in ab:
        res[i[0] - 1] += 1
        res[i[1] - 1] += 1
    for i in res:
        print(i)
if __name__ == '__main__':
    main(

Fixed code:
def main():
    n, m = map(int, input().split())
    ab = [list(map(int, input().split())) for i in range(m)]
    res = [0] * n
    for i in ab:
        res[i[0] - 1] += 1
        res[i[1] - 1] += 1
    for i in res:
        print(i)
if __name__ == '__main__':
    main()
Buggy code:
N,M = map(int, input().split())
a = []
for i in range(M):
    tmp_l = map(int, input().split())
    for i in tmp_l:
        a.append(i)

itr = 0
count = 0
d = {}
print(list(range(1,N+1,1)))
print(a)
for j in list(range(1,N+1,1)):
    d[j] = 0

for k in a:
    d[k] = d[k] + 1

for o in list(range(1,N+1,1)):
    print(d[o])


Fixed code:
N,M = map(int, input().split())
a = []
for i in range(M):
    tmp_l = map(int, input().split())
    for i in tmp_l:
        a.append(i)

itr = 0
count = 0
d = {}
for j in list(range(1,N+1,1)):
    d[j] = 0

for k in a:
    d[k] = d[k] + 1

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

Fixed code:
n,m=map(int,input().split())
A=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    A[a-1] += 1
    A[b-1] += 1
for h in range(n):
    print(A[h])
Buggy code:
n,m=map(int,input().split())
l=[]
g=0
for i in range(n):
  a,b=map(int,input().split())
  a.append(l)
  b.append(l)
  
for j in range(1,n+1):
  g+=l.count(j)
  
print(g)
  

Fixed code:
n,m=map(int,input().split())
l=[]
for i in range(m):
  a,b=map(int,input().split())
  l.append(a)
  l.append(b)
  
for j in range(1,n+1):
  print(l.count(j))
Buggy code:
N, M = [int(i) for i in input().split(" ")]

lst = []

for i in range(0,M):
	lst.extend(input().split(" "))
    
print(lst)

for i in range(1,N+1):
	print(lst.count("{}".format(i)))


Fixed code:
N, M = [int(i) for i in input().split(" ")]
lst = []

for i in range(0,M):
	lst.extend(input().split(" "))
for i in range(1,N+1):
	print(lst.count("{}".format(i)))
Buggy code:
N,N=map(int,input().split())
a=[0]*M
b=[0]*M
r=[0]*M
for i in range(M):
  A[i],B[i]=map(int,input().split())
  r[A[i]-1] +=1
  r[B[i]-1] +=1
  
for item in r:
  print(item)

Fixed code:
N,M=map(int,input().split())
a=[0]*M
b=[0]*M
r=[0]*N
for i in range(M):
  a[i],b[i]=map(int,input().split())
  #print(a[i]-1,b[i]-1)
  r[a[i]-1] +=1
  r[b[i]-1] +=1
  
for item in r:
  print(item)
Buggy code:
import collections

[N,M]=list(map(int,input().split()))
R=[list(map(int,input().split())) for _ in range(M)]

#print(R)
c = collections.Counter(sum(R,[]))
keys=c.keys()
for n in range(1,N+1):
  if n not in keys:
    print(n,0)
  else:
    print(n,c[n])

Fixed code:
import collections

[N,M]=list(map(int,input().split()))
R=[list(map(int,input().split())) for _ in range(M)]

#print(R)
c = collections.Counter(sum(R,[]))
keys=c.keys()
for n in range(1,N+1):
  if n not in keys:
    print(0)
  else:
    print(c[n])
Buggy code:
N,M = [int(i) for i in input().split()]
list = []

for i in range(M):
  a,b = [int(i) for i in input().split()]
  list.append(a)
  list.append(b)
  
for i in range(N):
  print(list.count(i))
  

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

for i in range(M):
  a,b = [int(i) for i in input().split()]
  list.append(a)
  list.append(b)

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

for  i in range(1, M+1):
    a, b = list(map(int, input().split()))
    array[a] = array[a] +1
    array[b] = array[b] +1

for j in range(1, N):
    print(array[j])


Fixed code:
N, M = list(map(int, input().split()))
array= [0] * (N+1)

for  i in range(1, M+1):
    a, b = list(map(int, input().split()))
    array[a] = array[a] +1
    array[b] = array[b] +1

for j in range(0, N):
    print(array[j+1])
Buggy code:
N, M = [int(i) for i in input().strip().split()]
A=[]
for i in range(M):
    A.append(input().strip().split())
B =[]
for i in range(M):
    B.append(A[i][0])
    B.append(A[i][1])
for i in range(N):
    print(B.count(i+1))

Fixed code:
N, M = [int(i) for i in input().strip().split()]
A=[]
for i in range(M):
    A.append(input().strip().split())
B =[]
for i in range(M):
    B.append(int(A[i][0]))
    B.append(int(A[i][1]))
for i in range(N):
    print(B.count(i+1))
Buggy code:
# Counting Roads

n,m =  list(map(int, input().split()))
a = []
for i in range(m):
    a.append( list(map(int, input().split())) ) 

b = []
for s in a:
    b.extend(s)
print(b)

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

Fixed code:
# Counting Roads

n,m =  list(map(int, input().split()))
a = []
for i in range(m):
    a.append( list(map(int, input().split())) ) 

b = []
for s in a:
    b.extend(s)
for i in range (n):
    print(b.count(i+1))
Buggy code:
N, M = map(int, input().split())
road = [0 for _ in range(N)]

for _ in range(N):
    a, b = [int(i) for i in input().split()]
    road[a - 1] += 1
    road[b - 1] += 1
for r in road:
    print(r)


Fixed code:
N, M = map(int, input().split())
road = [0] * N

for _ in range(M):
    a, b = [int(i) for i in input().split()]
    road[a - 1] += 1
    road[b - 1] += 1
for r in road:
    print(r)
Buggy code:
def main():
    N, M = map(int, input().split())

    R = [[0]*N for x in range(N)]
    for n in range(M):
        a, b = map(lambda x:int(x)-1, input().split())
        R[a][b] = 1
        R[b][a] = 1

    for n in range(N):
        print(sum(R[n]))

if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()



Fixed code:
def main():
    N, M = map(int, input().split())

    R = [[0]*N for x in range(N)]
    for n in range(M):
        a, b = map(lambda x:int(x)-1, input().split())
        R[a][b] += 1
        R[b][a] += 1

    for n in range(N):
        print(sum(R[n]))

if __name__ == "__main__":
    # global stime
    # stime = time.clock()
    main()
Buggy code:
N,M=[int(x) for x in input().split()]
ans=[0]*N
for n in range(N):
  a,b=[int(x) for x in input().split()]
  ans[a-1]+=1
  ans[b-1]+=1
for a in ans:
  print(a)

Fixed code:
N,M=[int(x) for x in input().split()]
ans=[0]*N
for m in range(M):
  a,b=[int(x) for x in input().split()]
  ans[a-1]+=1
  ans[b-1]+=1
for a in ans:
  print(a)
Buggy code:
n,m = map(int, input().split()) 
AB = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int,input().split())
    a -= 1
    b -= 1 
    AB[a].append(b)
    AB[b].append(a)

for i in range(n)
    print(len(AB[i]))

Fixed code:
n,m = map(int, input().split()) 
AB = [[] for _ in range(n)]
for i in range(m):
    a, b = map(int,input().split())
    a -= 1
    b -= 1 
    AB[a].append(b)
    AB[b].append(a)

for i in range(n):
    print(len(AB[i]))
Buggy code:
n,m=map(int,input().split())
road=[0]*n
for _ in range(m):
  a,b=map(int,input().split())
  road[a]+=1
  road[b]+=1

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

Fixed code:
n,m=map(int,input().split())
road=[0]*n
for _ in range(m):
  a,b=map(int,input().split())
  road[a-1]+=1
  road[b-1]+=1

for i in range(n):
  print(road[i])
Buggy code:
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
for i in range(m) :
    a[i], b[i] = map(int, input().split())
loute = a + b
for i in range(n) :
    print(loute.count(i))

Fixed code:
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
for i in range(m) :
    a[i], b[i] = map(int, input().split())
loute = a + b
for i in range(n) :
    print(loute.count(i + 1))
Buggy code:
# coding: utf-8
# Your code here!

N, M = map(int, input().split())
arr = [0 for i in range(N)]

for i in range(M):
    A, B = map(int, input().split())
    arr[A - 1] += 1
    arr[B - 1] += 1
  
for j in range(M):
    print(arr[j])


Fixed code:
# coding: utf-8
# Your code here!

N, M = map(int, input().split())
arr = [0 for i in range(N)]

for i in range(M):
    A, B = map(int, input().split())
    arr[A - 1] += 1
    arr[B - 1] += 1
  
for j in arr:
    print (j)
Buggy code:
N, M = map(int,input().split())
a = []
b = []
for i in range(M):
    a.append(list(map(int, input().split())))
print (a)
a=[flatten for inner in a for flatten in inner]
 
for i in range(N):
    b.append((a.count(i+1)))


c = list(map(str, b))

answer = '\n'.join(c)
print(answer)




Fixed code:
N, M = map(int,input().split())
a = []
b = []
for i in range(M):
    a.append(list(map(int, input().split())))

a=[flatten for inner in a for flatten in inner]
 
for i in range(N):
    b.append((a.count(i+1)))


c = list(map(str, b))

answer = '\n'.join(c)
print(answer)
Buggy code:
n,m = map(int, input().split())
g = [[] for _ in range(n)]

for i in range(m):
  a,b = map(int, input().split())
  g[a-1] = b-1
  g[b-1] = a-1
  
for nd in g:
  print(len(nd))

Fixed code:
n,m = map(int, input().split())
g = [[] for _ in range(n)]

for i in range(m):
    a,b = map(int, input().split())
    g[a-1].append( b-1)
    g[b-1].append( a-1)
            
for nd in g:
    print(len(nd))
Buggy code:
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]
b = [0]*n
for i in range(m):
  b.index(a[i][0]-1) += 1
  b.index(a[i][1]-1) += 1
for i in range(n):
  print(b[i])


Fixed code:
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]
b = [0]*n
for i in range(m):
  b[a[i][0]-1] += 1
  b[a[i][1]-1] += 1
for i in range(n):
  print(b[i])
Buggy code:
import itertools
n,m=map(int,input().split())
ab= [list(input()) for _ in range(m)]
ab=list(itertools.chain.from_iterable(ab))
for i in range(1,n+1):
    print(ab.count(i))

Fixed code:
import itertools
n,m=map(int,input().split())
ab= [list(map(int,input().split())) for _ in range(m)]
ab=list(itertools.chain.from_iterable(ab))
for i in range(1,n+1):
    print(ab.count(i))
Buggy code:
n,m=map(int,input().split())
c=[]
for _ in range:
    a,b=map(int,input().split())
    c.append(a)
    c.append(b)
for i in range(1,n+1):
    print(c.count(i))

Fixed code:
n,m=map(int,input().split())
c=[]
for _ in range(m):
    a,b=map(int,input().split())
    c.append(a)
    c.append(b)
for i in range(1,n+1):
    print(c.count(i))
Buggy code:
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

cnt = [0] * n

for i in range(m):
    cnt[ab[i][0] - 1] += 1
    cnt[ab[i][1] - 1] += 1

for i in range(n):
    print(cnt(i))


Fixed code:
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]

cnt = [0] * n

for i in range(m):
    cnt[ab[i][0] - 1] += 1
    cnt[ab[i][1] - 1] += 1

for i in range(n):
    print(cnt[i])
Buggy code:
from collections import defaultdict
n, k = map(int, input().split())
d = defaultdict(int)
for _ in [0]*k:
  a, b = map(int, input().split())
  d[a] += 1
  d[b] += 1
for i in range(n):
  print(d[i])

Fixed code:
from collections import defaultdict
n, k = map(int, input().split())
d = defaultdict(int)
for _ in [0]*k:
  a, b = map(int, input().split())
  d[a] += 1
  d[b] += 1
for i in range(n):
  print(d[i+1])
Buggy code:
n,m = map(int,input().rstrip().split(' '))
G = [[]]*n
for i in range(m):
  a,b = map(int,input().rstrip().split(' '))
  a-=1
  b-=1
  G[a].append(b)
  G[b].append(a)

for i in range(n):
  print(len(G[i]))

Fixed code:
n,m = map(int,input().rstrip().split(' '))
G = [[] for i in range(n)]
for i in range(m):
  a,b = map(int,input().rstrip().split(' '))
  a-=1
  b-=1
  G[a].append(b)
  G[b].append(a)

for i in range(n):
  print(len(G[i]))
Buggy code:
(nodes, roads) = (int(tok) for tok in input().split())

count = { i:0 for i in range(1, nodes + 1) }
for _ in range(roads):
	for tok in input().split():
		count[int(node)] += 1
          
for i in range(1, nodes + 1):
	print(count[i])

Fixed code:
(nodes, roads) = (int(tok) for tok in input().split())

count = { i : 0 for i in range(1, nodes + 1) }
for _ in range(roads):
    for tok in input().split():
        count[int(tok)] += 1

for i in range(1, nodes + 1):
    print(count[i])
Buggy code:
N,M=map(int, input().split())
result=[]
for i in range(N):
  result.append(0)
for j in range(M):
  print(j)
  a,b=map(int, input().split())
  result[a-1]+=1
  result[b-1]+=1
for k in range(N):
  print(result[k])

Fixed code:
N,M=map(int, input().split())
result=[]
for i in range(N):
  result.append(0)
for j in range(M):
  a,b=map(int, input().split())
  result[a-1]+=1
  result[b-1]+=1
for k in range(N):
  print(result[k])
Buggy code:
n, m = map(int, input().split())
[print(a.count(str(i + 1))) for a in sum([input().split() for _ in range(m)], []) for i in range(n)]

Fixed code:
n, m = map(int, input().split())
a = sum([input().split() for _ in range(m)], [])
[print(a.count(str(i + 1))) for i in range(n)]
Buggy code:
# B
import numpy as np
N, M = map(int, input().split())
mat = np.zeros((N, N))
for i in range(M):
    a, b = map(int, input().split())
    mat[a-1, b-1] = 1
    mat[b-1, a-1] = 1

for n in range(N):
    print(int(mat[n, :].sum()))

Fixed code:
# B
import numpy as np
N, M = map(int, input().split())
mat = np.zeros((N, N))
for i in range(M):
    a, b = map(int, input().split())
    mat[a-1, b-1] += 1
    mat[b-1, a-1] += 1

for n in range(N):
    print(int(mat[n, :].sum()))
Buggy code:
n,m = map(int,input().split())
a_all = []
b_all = []
for i in range(m):
    a,b = map(int,input().split())
    a_all.append(a-1)
    b_all.append(b-1)
for j in range(n):
    c = set()
    for k in range(m):
        if a_all[k] == j:
            c.add(b_all[k])
        if b_all[k] == j:
            c.add(a_all[k])
    print(len(c))

Fixed code:
n,m = map(int,input().split())
a_all = []
b_all = []
for i in range(m):
    a,b = map(int,input().split())
    a_all.append(a-1)
    b_all.append(b-1)
for j in range(n):
    c = list()
    for k in range(m):
        if a_all[k] == j:
            c.append(b_all[k])
        if b_all[k] == j:
            c.append(a_all[k])
    print(len(c))
Buggy code:
n, m = list(map(int, input().split()))
routes = []
for i in range(m):
  ri = list(map(int, input().split()))
  routes.extend(ri)
  
for i in range(n):
  print(routes.count(i))
  

Fixed code:
n, m = list(map(int, input().split()))
routes = []
for i in range(m):
  ri = list(map(int, input().split()))
  routes.extend(ri)
  
for i in range(n):
  print(routes.count(i+1))
Buggy code:
N,M=map(int,input().split())
city_l=[]
for i in range(M):
    a,b=map(int,input().split())
    city_l.append(a)
    city_l.append(b)
print(city_l)
for i in range(1,N+1):
    print(city_l.count(i))

Fixed code:
N,M=map(int,input().split())
city_l=[]
for i in range(M):
    a,b=map(int,input().split())
    city_l.append(a)
    city_l.append(b)
for i in range(1,N+1):
    print(city_l.count(i))
Buggy code:
n,m=map(int,input().split())
road=[list(map(int,input().split())) for i in range(m)]
road=sum(road,[])
print(road)

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

Fixed code:
n,m=map(int,input().split())
road=[list(map(int,input().split())) for i in range(m)]
road=sum(road,[])

for i in range(1,n+1):
    print(road.count(i))
Buggy code:
from collections import defaultdict
n, m = map(int, input().split())
d = defaultdict(int)
for _ in range(m):
  a, b = input().split()
  d[a] += 1
  d[b] += 1
for i in range(n):
  print(d[i + 1])

Fixed code:
from collections import defaultdict
n, m = map(int, input().split())
d = defaultdict(int)
for _ in range(m):
  a, b = input().split()
  d[a] += 1
  d[b] += 1
for i in range(n):
  print(d[str(i + 1)])
Buggy code:
n, m = map(int, input().split())
a = []
for i in range(n):
  x, y = map(int, input().split())
  a.append(x)
  a.append(y)
for i in range(m):
  print(a.count(i+1))

Fixed code:
n, m = map(int, input().split())
a = []
for i in range(m):
  x, y = map(int, input().split())
  a.append(x)
  a.append(y)
for i in range(n):
  print(a.count(i+1))
Buggy code:
n, m = map(int, input().split())
result = [0 for _ in range(m)]
for i in range(m):
    a, b = map(int, input().split())
    result[a-1] += 1
    result[b-1] += 1

for j in result:
    print(j)



Fixed code:
n, m = map(int, input().split())
result = [0 for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    result[a-1] += 1
    result[b-1] += 1

for j in result:
    print(j)
Buggy code:
n,m=map(int, input().split())
road_num=[0]*n
for i in range(m):
  a,b=map(int, input().split())
  road_num[a]+=1
  road_num[b]+=1
for i in range(n):
  print(road_num[i])

Fixed code:
n,m=map(int, input().split())
road_num=[0]*n
for i in range(m):
  a,b=map(int, input().split())
  road_num[a-1]+=1
  road_num[b-1]+=1
for i in range(n):
  print(road_num[i])
Buggy code:
n,m=map(int,input().split())
city=[[] for i in range(n+1)]
for i in range(m):
  a,b=map(int,input().split())
  city[a].append(b)
  city[b].append(a)
for i in range(1,n+1):
  print(len(set(city[i]))-1)


Fixed code:
n,m=map(int,input().split())
city=[[] for i in range(n+1)]
for i in range(m):
  a,b=map(int,input().split())
  city[a].append(b)
  city[b].append(a)
for i in range(1,n+1):
  print(len(city[i]))
Buggy code:
n, m = [int(e) for e in input().split()]
map_dict = {}
for i in range(n):
    map_dict[str(i+1)] = 0
for _ in range(m):
    cities = [e for e in input().split()]
    map_dict[cities[0]]+=1
    map_dict[cities[1]]+=1
for i in range(m):
    print(map_dict[str(i+1)])

Fixed code:
n, m = [int(e) for e in input().split()]
map_dict = {}
for i in range(n):
    map_dict[str(i+1)] = 0
for _ in range(m):
    cities = [e for e in input().split()]
    map_dict[cities[0]]+=1
    map_dict[cities[1]]+=1
for i in range(n):
    print(map_dict[str(i+1)])
Buggy code:
n,m = map(int, input().split())
a = [0]*n
for i in range(m):
  b,c = map(int, input().split())
  a[b] += 1
  a[c] += 1
[print(i) for i in a]

Fixed code:
n,m = map(int, input().split())
a = [0]*n
for i in range(m):
  b,c = map(int, input().split())
  a[b-1] += 1
  a[c-1] += 1
[print(i) for i in a]
Buggy code:
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

N,M = MI()
from collections import defaultdict

d = defaultdict(int)
for i in range(M):
    a,b = MI()
    d[a] += 1
    d[b] += 1

print(sum(d[i] for i in d.keys()))


Fixed code:
import sys
def MI(): return map(int,sys.stdin.readline().rstrip().split())

N,M = MI()
from collections import defaultdict

d = defaultdict(int)
for i in range(M):
    a,b = MI()
    d[a] += 1
    d[b] += 1

for i in range(1,N+1):
    print(d[i])
Buggy code:
n,m=map(int,input().split())
a=[0]*n
b=[0]*n
for i in range(n):
  a[i],b[i]=map(int,input().split())
for j in range(m):
  print(a.count(m+1)+b.count(m+1))

Fixed code:
n,m=map(int,input().split())
a=[0]*m
b=[0]*m
for i in range(m):
  a[i],b[i]=map(int,input().split())
for j in range(n):
  print(a.count(j+1)+b.count(j+1))
Buggy code:
n,m = map(int,input().split())
ab = [[0 for i in range(n)] for j in range(n)]

for i in range(m):
    a,b = map(int,input().split())
    ab[a][b] += 1
    ab[b][a] += 1

for i in range(n):
    cnt = 0
    for j in range(m):
        cnt += ab[i][j]
    print(cnt)


Fixed code:
n,m = map(int,input().split())
ab = [[0 for i in range(n)] for j in range(n)]

for i in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    ab[a][b] += 1
    ab[b][a] += 1

for i in range(n):
    cnt = 0
    for j in range(n):
        cnt += ab[i][j]
    print(cnt)
Buggy code:
n, m = map(int, input().split())
ll = [0] + [ 0 * n]
for i in range(m):
    a, b = map(int, input().split())
    ll[a] += 1
    ll[b] += 1
for l in ll[1:]:
    print()


Fixed code:
n, m = map(int, input().split())
ll = [0] + [ 0 for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    ll[a] += 1
    ll[b] += 1
for l in ll[1:]:
    print(l)
Buggy code:
n, m = map(int, input().split())
ll = [0] + [ 0 for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    ll[a] += 1
    ll[b] += 1
for l in ll[1:]:
    print()


Fixed code:
n, m = map(int, input().split())
ll = [[0]] + [ [] for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    ll[a].append(b)
    ll[b].append(a)
for l in ll[1:]:
    print(len(l))
Buggy code:
N, M = map(int,input().split())
a = []
for i in range(M):
  K,S = map(int, input().split())
  a.append(K)
  a.append(S)
print(a)
for i in range(N):
  print(a.count(i+1))

Fixed code:
N, M = map(int,input().split())
a = []
for i in range(M):
  K,S = map(int, input().split())
  a.append(K)
  a.append(S)
for i in range(N):
  print(a.count(i+1))
Buggy code:
n,m = map(int,input().split(" "))

city_road_count = [0] * m
for i in range(m):
  a,b = map(int,input.split(" "))
  city_road_count[a-1] += 1
  city_road_count[b-1] += 1
  
for c in city_road_count:
  print(c)

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

city_road_count = [0] * n
for i in range(m):
      a,b = map(int,input().split(" "))
      city_road_count[a-1] += 1
      city_road_count[b-1] += 1
      
for c in city_road_count:
      print(c)
Buggy code:
n,m=map(int,input().split())
hoge=[]
for i in range(m):
  a,b=map(int,input())
  hoge.append(a)
  hoge.append(b)
  
for i in range(n):
  print(hoge.count(i+1))

Fixed code:
n,m=map(int,input().split())
hoge=[]
for i in range(m):
  a,b=map(int,input().split())
  hoge.append(a)
  hoge.append(b)
  
for i in range(n):
  print(hoge.count(i+1))
Buggy code:
[n,m] = [int(i) for i in input().split()]
ab = []
dic = {}
for i in range(m):
  ab.append([int(j) for j in input().split()])

for i in range(m):
  if ab[i][0] in dic.keys():
	dic[ab[i][0]] += 1
  else:
    dic[ab[i][0]] = 1
    
  if  ab[i][1] in dic.keys():
	dic[ab[i][1]] += 1
  else:
    dic[ab[i][1]] = 1
    
for i in range(n):
  print(dic[i+1])

Fixed code:
[n,m] = [int(i) for i in input().split()]
ab = []
dic = {}
for i in range(m):
  ab.append([int(j) for j in input().split()])

for i in range(m):
  if ab[i][0] in dic.keys():
    dic[ab[i][0]] += 1
  else:
    dic[ab[i][0]] = 1
    
  if  ab[i][1] in dic.keys():
    dic[ab[i][1]] += 1
  else:
    dic[ab[i][1]] = 1
    
for i in range(n):
  if i+1 in dic.keys():
    print(dic[i+1])
  else:
    print(0)
Buggy code:
N, M = map(int, input().split())

dp = [[0 for i in range(N)] for j in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    dp[a-1][b-1] += 1
    dp[b-1][a-1] += 1
    print(dp)
for i in range(N):
    print(sum(dp[i]))

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

dp = [[0 for i in range(N)] for j in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    dp[a-1][b-1] += 1
    dp[b-1][a-1] += 1
for i in range(N):
    print(sum(dp[i]))
Buggy code:
n,m = map(int, input().split())
c = [0]*n
for i in range(m):
  a,b = map(int, input().split())
  c[a] += 1
  c[b] += 1
for i in c:
  print(i)

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

Fixed code:
n,m=map(int,input().split())
L=[0]*n

for i in range(m):
    a,b=map(int,input().split())
    L[a-1]=L[a-1]+1
    L[b-1]=L[b-1]+1

for i in range(n):
    print(L[i])
Buggy code:
n,m = map(int,input().split())
l = []
for _ in range(m):
  a,b = map(int,input().split())
  l.append(a)
for i in range(1,n+1):
  print(l.count(i))

Fixed code:
n,m = map(int,input().split())
l = []
for _ in range(m):
  a,b = map(int,input().split())
  l.append(a)
  l.append(b)
for i in range(1,n+1):
  print(l.count(i))