qyliang/CodeNanoFix huggingface dataset:
Buggy code:

N,M = map(int,input().split())
adj = [[0]*N for _ in range(N)]
intx = lambda x: int(x)-1
for i in range(M):
    a,b = map(intx,input().split())
    #print(a,b)
    adj[a][b] = 1
    adj[b][a] = 1
for i in range(N): 
    print(sum(adj[i]))

Fixed code:

N,M = map(int,input().split())
adj = [[0]*N for _ in range(N)]
intx = lambda x: int(x)-1
for i in range(M):
    a,b = map(intx,input().split())
    #print(a,b)
    adj[a][b] += 1
    adj[b][a] += 1
#print(adj)
for i in range(N): 
    print(sum(adj[i]))
Buggy code:
N, M = map(int, input().split())
R = [list(map(int, input().split())) for _ in range(N)]

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


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

for i in range(1,N+1):
    print(R.count(i))
Buggy code:
n, m = map(int, input().split())
ab = [input().split() for _ in range(m)]
ab = [item for ab in ab for item in ab]
print(ab)

for x in range(1, n+1):
    print(ab.count(str(x)))

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

for x in range(1, n+1):
    print(ab.count(str(x)))
Buggy code:
n, m = map(int, input().split())
a = []
for i in range(m):
    a += list(map(int, input().split()))
for i in range(n):
    print(a.count(i))

Fixed code:
n, m = map(int, input().split())
a = []
for i in range(m):
    a += map(int, input().split())
for i in range(1, n+1):
    print(a.count(i))
Buggy code:
import collections

n,m=map(int,input().split())
# a = []
# b = []
temp = []
for i in range(m):
    tempa,tempb = map(int,input().split())
    temp.append(tempa)
    temp.append(tempb)
temp.sort()
temp_count = collections.Counter(temp)
print(temp_count)
for i in range(1,n+1):
    print(temp_count[i])

Fixed code:
import collections

n,m=map(int,input().split())
# a = []
# b = []
temp = []
for i in range(m):
    tempa,tempb = map(int,input().split())
    temp.append(tempa)
    temp.append(tempb)
temp.sort()
temp_count = collections.Counter(temp)
# print(temp_count)
for i in range(1,n+1):
    print(temp_count[i])
Buggy code:
N, M =map(int, input().split())
ans = []
for i in range(M):
    a, b = map(int, input().split())
    ans.append(a)
    ans.append(b)

for i in range(1,N+1):
    print(ans.index(i))
    
    

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

for i in range(1,N+1):
    print(ans.count(i))
Buggy code:
N = int(input())
count = [0]*N
for i in range(N):
	x, y = [int(x) for x in input().split()]
    count[x] += 1
    count[y] += 1
for c in N:
    print(c)

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

r = [[0]*n for _ in [0]*n]

for _ in range(m):
  a,b = tuple(map(int,input().split()))
  r[a-1][b-1] = 1
  r[b-1][a-1] = 1

for r_i in r:
  print(sum(r_i))

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

r = [[0]*n for _ in [0]*n]

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

for r_i in r:
  print(sum(r_i))
Buggy code:
N, M = map(int, input().split())
mat = [[0 for _ in range(N)] for _ in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    mat[a][b] = 1
    mat[b][a] = 1
for i in range(N):
    cnt = 0
    for j in range(N):
        if mat[i][j] != 0:
            cnt += 1
    print(cnt)

Fixed code:
N, M = map(int, input().split())
mat = [[0 for _ in range(N)] for _ in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    mat[a][b] += 1
    mat[b][a] += 1
for i in range(N):
    cnt = 0
    for j in range(N):
        cnt += mat[i][j]
    print(cnt)
Buggy code:
import numpy as np
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(N):
    print(c.count(i+1))
print(c)

Fixed code:
import numpy as np
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(N):
    print(c.count(i+1))
Buggy code:
from collections import defaultdict

n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
cnt=defaultdict(lambda :0)

for i in l:
    cnt[i[0]]+=1
    cnt[i[1]]+=1

print(*cnt.values(),sep='\n')

Fixed code:
from collections import defaultdict

n,m=map(int,input().split())
l=[list(map(int,input().split())) for i in range(m)]
cnt=[0]*n

for i in l:
    cnt[i[0]-1]+=1
    cnt[i[1]-1]+=1

print(*cnt,sep='\n')
Buggy code:
n,m=map(int,input().split())
a=[]
for i in range(m):
  a+=list(map(int,input()))

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


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

for i in range(n):
  dumy=a.count(i+1)
  print(dumy)
Buggy code:
n, m = map(int, input().split())
ret = [[] for i in range(n + 1)]
for i in range(m):
    a, b = map(int, input().split())
    ret[a] += [a]
    ret[b] += [a]
for i in range(1, n + 1):
    print(len(set(ret[i])))


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

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


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

for i in range(n):
    print(len(g[i]))
Buggy code:
N, M = int(input())
cities = [0] * (N+1)
for _ in range(M):
  a, b = map(int, input().split())
  cities[a] += 1
  cities[b] += 1
for idx in range(1, N+1):
  print(cities[idx])

Fixed code:
N, M = map(int, input().split())
cities = [0] * (N+1)
for _ in range(M):
  a, b = map(int, input().split())
  cities[a] += 1
  cities[b] += 1
for idx in range(1, N+1):
  print(cities[idx])
Buggy code:
n, m = map(int, input().split())
ab = [0] * m
for i in range(m):
    ab[i] = list(map(int, input().split()))
roads = [0] * n
for a, b in ab:
    roads[a-1] += 1
    roads[b-1] += 1
print(roads)


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

for i in L:
    pront(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] += 1
    L[b - 1] += 1

for i in L:
    print(i)
Buggy code:
N,M=[int(i) for i in input().split()]
arrR=[0]*N
for m in range(M):
    a,b=[int(i) for i in input().split()]
    arrR[a-1]+=1
    arrR[b-1]+=1
[print(arrR[i]) for i in range(M)]


Fixed code:
N,M=[int(i) for i in input().split()]
arrR=[0]*N
for m in range(M):
    a,b=[int(i) for i in input().split()]
    arrR[a-1]+=1
    arrR[b-1]+=1
[print(arrR[i]) for i in range(N)]
Buggy code:
# B - Counting Roads
N, M = map(int,input().split())
city = [list(map(int, input().split())) for i in range(M)]
road = [0]*N

for i in range(N):
    count = 0
    for j in range(M):
        if i+1 == city[j][0]:
            count += 1
        else:
            pass
        if i+1 == city[j][1]:
            count += 1
        else:
            pass
    road[i] = count
print(road)
for k in range(N):
    print(road[k])


Fixed code:
# B - Counting Roads
N, M = map(int,input().split())
city = [list(map(int, input().split())) for i in range(M)]
road = [0]*N

for i in range(N):
    count = 0
    for j in range(M):
        if i+1 == city[j][0]:
            count += 1
        else:
            pass
        if i+1 == city[j][1]:
            count += 1
        else:
            pass
    road[i] = count
for k in range(N):
    print(road[k])
Buggy code:
def solve():
    n, m = map(int, input().split())
    lists = []

    for _ in range(m):
        lists += input().split()
    
    for i in range(i, n + 1):
        print(lists.count(str(i)))


solve()

Fixed code:
def solve():
    n, m = map(int, input().split())
    lists = []

    for _ in range(m):
        lists += input().split()
    
    for i in range(1, n + 1):
        print(lists.count(str(i)))


solve()
Buggy code:
def main():
	N, M = map(int, input().split())
    d = dict()
    for _ in range(M):
        a, b = map(int, input().split())
        d[a] = d.get(a, 0) + 1
        d[b] = d.get(b, 0) + 1

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

if __name__ == '__main__':
    main()

Fixed code:
def main():
    N, M = map(int, input().split())
    d = dict()
    for _ in range(M):
        a, b = map(int, input().split())
        d[a] = d.get(a, 0) + 1
        d[b] = d.get(b, 0) + 1

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

if __name__ == '__main__':
    main()
Buggy code:
N, M = map(int, input().split())
road = [0]*N
for i in range(M):
    a, b = map(int,input().split())
    road[a-1] += 1
    road[b-1] += 1
for i in road:
    print(road)

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

Fixed code:
n,m=map(int,input().split())
l=[]
for i in range(m):l+=list(map(int,input().split()))
for j in range(1,n+1):print(l.count(j))
Buggy code:
n,m=map(int,input().split())
l=" ".join([input() for _ in [0]*m])
for i in range(i,n+1):print(s.split().count(str(i)))

Fixed code:
n,m=map(int,input().split())
l=" ".join([input() for _ in [0]*m])
for i in range(1,n+1):print(l.split().count(str(i)))
Buggy code:
n, m = map(int, input().split())
road = [0] * n

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

for i in road:
    print(i)

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

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

for i in road:
    print(i)
Buggy code:
n,m = map(int,input().split())
graph = {i:[] for i in range(1, n+1)}
for _ in range(m):
  a,b = map(int,input().split())
  graph[a].append(b)
  graph[b].append(a)
for i in range(1, n+1):
  print(len(graphp[i]))

Fixed code:
n,m = map(int,input().split())
graph = {i:[] for i in range(1, n+1)}
for _ in range(m):
  a,b = map(int,input().split())
  graph[a].append(b)
  graph[b].append(a)
for i in range(1, n+1):
  print(len(graph[i]))
Buggy code:
# ABC061B - Counting Roads
def main():
    N, M = tuple(map(int, input().split()))
    E = tuple(tuple(map(int, input().split())) for _ in range(M))
    G = [[] for _ in range(N + 1)]
    for v, u in E:
        G[v] += [u]
        G[u] += [v]
    print(*G[1:], sep="\n")


if __name__ == "__main__":
    main()

Fixed code:
# ABC061B - Counting Roads
def main():
    N, M = tuple(map(int, input().split()))
    E = tuple(tuple(map(int, input().split())) for _ in range(M))
    G = [[] for _ in range(N + 1)]
    for v, u in E:
        G[v] += [u]
        G[u] += [v]
    print(*(len(g) for g in G[1:]), sep="\n")


if __name__ == "__main__":
    main()
Buggy code:
n,m = map(int,input().split())
s = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    s[a-1].append(b)
    s[b-1].append(a)
for i in s:
    print(len(set(i)))

Fixed code:
n,m = map(int,input().split())
s = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    s[a-1].append(b)
    s[b-1].append(a)
for i in s:
    print(len(i))
Buggy code:
n, m = map(int, input().split())
es = [[] for _ in range(n)]
for _ in range(m):
  s, t = map(int, input().split())
  es[s-1].append(t-1)
  es[t-1].append(s-1)
for i in range(n):
  print(len(list(set(es[i]))))
  

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

for i in ans:
    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] += 1
    ans[b-1] += 1

for i in ans:
    print(i)
Buggy code:
n, m = map(int,input().split())
array = [[]for i in range(n)]

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

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

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

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

for i in range(n):
  print(len(array[i]))
Buggy code:
N, M = map(int, input().split())

dic = { m:0for m in range(M)}
for n in range(N):
  a,b = map(int,input().split())
  dic[a-1] += 1
  dic[b-1] += 1

for m in range(M):
  print(dic[m])

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

dic = { n:0for n in range(N)}
for m in range(M):
  a,b = map(int,input().split())
  dic[a-1] += 1
  dic[b-1] += 1

for n in range(N):
  print(dic[n])
Buggy code:
n,m = map(int, input().split())
bridge = [0,0,0,0]
for i in range(m):
    a,b = map(int,input().split())
    bridge[a-1] += 1
    bridge[b-1] += 1
for i in bridge:
    print(i)

Fixed code:
n,m = map(int, input().split())
bridge = []
for i in range(n):
    bridge.append(0)
for i in range(m):
    a,b = map(int,input().split())
    bridge[a-1] += 1
    bridge[b-1] += 1
for i in bridge:
    print(i)
Buggy code:
I=lambda:map(int,input().split())
N,M=I()
r=range(N)
m={i:0 for i in r}
for _ in[0]*M:a,b=I();m[a]+=+1;m[b]+=1
for i in r:print(m[i])

Fixed code:
I=lambda:map(int,input().split())
N,M=I()
r=range(N)
m={i:0 for i in r}
for _ in[0]*M:
  a,b=I()
  m[a-1]+=1
  m[b-1]+=1
for i in r:print(m[i])
Buggy code:
n,m=map(int,input().split())
d={}
for i in range(5):
    d[i]=0
for i in range(m):
    a,b=map(int,input().split())
    d[a-1]+=1
    d[b-1]+=1
for i in range(n):
    print(d[i])

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

Fixed code:
n,m = map(int, input().split())
ans=[0]*n
for i in range(m):
  a,b = list(map(int,input().split()))
  ans[a-1]+=1
  ans[b-1]+=1
for i in range(n):
  print(ans[i])
Buggy code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,m = inpl()
res = [[False] * n for i in range(n)]
for i in range(m):
    a,b = inpl()
    res[a-1][b-1] = True
    res[b-1][a-1] = True
for i in range(n):
    print(res[i].count(True))


Fixed code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

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

Fixed code:
N,M=map(int,input().split())
list=[[] for j in range(N)]
for i in range(M):
  a,b=map(int,input().split())
  list[a-1]+="Y"
  list[b-1]+="Y"
for i in range(N):
  print(len(list[i]))
Buggy code:
N, M = map(int, input().split())
a = []
b = []
for i in range(M):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)

for i in range(N):
    r = 0
    r += a.count(i+1)
    r += b.count(i+1)
print(r)

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

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

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

for i in range(M):
  b[a[i][0]-1][a[i][1]-1] = 1
  b[a[i][1]-1][a[i][0]-1] = 1
  
for i in range(N):
  print(sum(b[i]))


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

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

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

Fixed code:
n,m=[int(i) for i in input().split()]
x=[0 for i in range(n)]
for i in range(m):
	a,b=[int(i) for i in input().split()]
	x[a-1]+=1
	x[b-1]+=1
for i in x:
	print(i)
Buggy code:
n,m = map(int,input().split())
ab_list = [list(map(int, input().split())) for _ in range(m)]
tmp_list = sorted(list(chain(*ab_list)))
tmp_dic = {}
for i in range(1,n+1):
    tmp_dic[i]=0
for val in tmp_list:
    tmp_dic[val] += 1
for k,v in tmp_dic.items():
    print(v)


Fixed code:
from itertools import chain
n,m = map(int,input().split())
ab_list = [list(map(int, input().split())) for _ in range(m)]
tmp_list = sorted(list(chain(*ab_list)))
tmp_dic = {}
for i in range(1,n+1):
    tmp_dic[i]=0
for val in tmp_list:
    tmp_dic[val] += 1
for k,v in tmp_dic.items():
    print(v)
Buggy code:
import numpy as np

n, m = map(int, input().split(' '))

array = np.zeros(n)

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

Fixed code:
import numpy as np

n, m = map(int, input().split(' '))

array = np.zeros(n)

for i in range(m):
    a, b = map(int, input().split(' '))
    array[a-1] += 1
    array[b-1] += 1
    
for number in array:
    print(int(number))
Buggy code:
N,M = map(int,input().split())

glaf = [[] for i in range(N)]

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

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

glaf = [[] for i in range(N)]

for i in range(M):
    a,b = map(int,input().split())
    a=a-1
    b=b-1
    glaf[a].append(b)
    glaf[b].append(a)
    
for i in glaf:
    cnt =0
    for j in i:
        cnt+=1
    
    print(cnt)
Buggy code:
N, M = map(int, input().split())
ans = [0] * N
for _ in range(M):
  a, b = map(int, input().split())
  ans[a - 1] += 1
  ans[b - 1] += 1
print(ans, sep="\n")


Fixed code:
N, M = map(int, input().split())
ans = [0] * N
for _ in range(M):
  a, b = map(int, input().split())
  ans[a - 1] += 1
  ans[b - 1] += 1
print(*ans, sep="\n")
Buggy code:
n,m = map(int,input().split())
l = [0]*n
for i in range(n):
  a,b = map(int,input().split())
  l[a-1] += 1
  l[b-1] += 1
for i in l:
  print(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] += 1
  l[b-1] += 1
for i in l:
  print(i)
Buggy code:
n, m = [int(item) for item in input().split()]
count = [0] * n
for i in range(n):
    a, b = [int(item) for item in input().split()]
    count[a-1] += 1
    count[b-1] += 1
for item in count:
    print(item)

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


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

for v in lst:
    print(len(v))

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

for v in lst:
    print(len(v))
Buggy code:
N,M = map(int,input().split())
G = {}
for _ in range(N):
    a,b = map(int,input().split())
    if a not in G:
        G[a] = []
    G[a].append(b)
    if b not in G:
        G[b] = []
    G[b].append(b)
for i in range(1,N+1):
    print(len(G[i]))

Fixed code:
N,M = map(int,input().split())
G = {}
for _ in range(M):
    a,b = map(int,input().split())
    if a not in G:
        G[a] = []
    G[a].append(b)
    if b not in G:
        G[b] = []
    G[b].append(b)
for i in range(1,N+1):
    if i in G:
    	print(len(G[i]))
    else:
        print(0)
Buggy code:
#ABC061B
N,M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]
ans =[]
for i in range(1,M+1):
    count=0
    for j in range(M):
        if ab[j][0] ==i:
            count +=1
        if ab[j][1] ==i:
            count +=1
    ans.append(count)
for a in ans:
    print(a)

Fixed code:
#ABC061B
N,M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]
ans =[]
for i in range(1,N+1):
    count=0
    for j in range(M):
        if ab[j][0] ==i:
            count +=1
        if ab[j][1] ==i:
            count +=1
    ans.append(count)
for a in ans:
    print(a)
Buggy code:
x = list(map(int, input().split()))
a=[input() for i in range(x[0])]
count=[]
for i in range(0,x[0]+2):
    count=count+[[0,i]]



for i in a:
    i=list(map(int, i.split()))
    count[i[0]][0]+=1
    count[i[1]][0]+=1
   
  
for i in range (1,x[0]+1):
    print(count[i][0])


Fixed code:

x = list(map(int, input().split()))
a=[input() for i in range(x[1])]
count=[]

for i in range(0,x[0]+2):
    count=count+[[0,i]]

for i in a:
    i=list(map(int, i.split()))
    count[i[0]][0]+=1
    count[i[1]][0]+=1
   
  
for i in range (1,x[0]+1):
    print(count[i][0])
Buggy code:
n,m=map(int,input().split())
al=[]
bl=[]
for i in range(m):
  a,b=map(int,input().split())
  al.append(a)
  bl.append(b)

for i in range(m+1):
  print(al.count(i)+bl.count(i))

Fixed code:
n,m=map(int,input().split())
al=[]
bl=[]
for i in range(m):
  a,b=map(int,input().split())
  al.append(a)
  bl.append(b)

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