Problem:
 Score : 200 points    Problem Statement There are N cities and M roads.
The i -th road (1≤i≤M) connects two cities a_i and b_i  (1≤a_i,b_i≤N) bidirectionally.
There may be more than one road that connects the same pair of two cities.
For each city, how many roads are connected to the city?      Constraints  2≤N,M≤50  1≤a_i,b_i≤N  a_i ≠ b_i  All input values are integers.         Input Input is given from Standard Input in the following format:  N  M  a_1  b_1  :  a_M  b_M       Output Print the answer in N lines.
In the i -th line (1≤i≤N) , print the number of roads connected to city i .        Sample Input 1 4 3
1 2
2 3
1 4      Sample Output 1 2
2
1
1   City 1 is connected to the 1 -st and 3 -rd roads.  City 2 is connected to the 1 -st and 2 -nd roads.  City 3 is connected to the 2 -nd road.  City 4 is connected to the 3 -rd road.        Sample Input 2 2 5
1 2
2 1
1 2
2 1
1 2      Sample Output 2 5
5       Sample Input 3 8 8
1 2
3 4
1 5
2 8
3 7
5 2
4 1
6 8      Sample Output 3 3
3
2
2
2
1
1
2

Solution (Python):
a, b = map(int, input().split())
c = [0] * (a+1)
for i in range(b):
    x, y = map(int, input().split())
    c[x] += 1
    c[y] += 1
for j in range(1, len(c)):
    print(c[j])

Solution (Python):
n, m = map(int, input().split())
cnt = [0] * (n+1)
for i in range(m):
    a, b = map(int, input().split())
    cnt[a] += 1
    cnt[b] += 1
for i in range(1, n+1):
    print(cnt[i])

Solution (Python):
n,m=map(int,input().split())
li=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  li[a-1]+=1
  li[b-1]+=1
for i in li:
  print(i)

Solution (Python):
n,m = map(int,input().split())
r = [[int(I) for I in input().split()] for i in range(m)]
c = [0 for i in range(n)]
for i in range(m):
    for j in [0,1]:
        c[r[i][j]-1] += 1
for i in range(n):
    print(c[i])

Solution (Python):
n, m = map(int, input().split())
ab = [map(int, input().split()) for _ in range(m)]
ans = [0] * n
for a, b in ab:
    ans[a - 1] += 1
    ans[b - 1] += 1
for i in ans:
    print(i)

Solution (Python):
N,M=map(int,input().split())
arr=[0]*N
for _ in range(M):
    ab=list(map(int,input().split()))
    arr[ab[0]-1]+=1
    arr[ab[1]-1]+=1
for i in range(N):
    print(arr[i])

Solution (Python):
N,M= map(int,input().split())
NN = [0]*N
for i in range(M):
    a,b = map(int,input().split())
    NN[a-1] += 1
    NN[b-1] += 1
for _ in NN:
    print(_)

Solution (Python):
from collections import Counter
N, M = map(int, input().split())
ab = [input().split() for _ in range(M)]
ab = sum(ab, [])
c = Counter(ab)
for i in range(1, N+1):
    print(c[str(i)])

Solution (Python):
n, m = map(int, input().split())

l = [list(map(int, input().split())) for _ in range(m)]

l2 = [[0 for i in range(n)] for i in range(n)]

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

for i in l2:
    print(sum(i))

Solution (Python):
n, m = map(int, input().split())
city = [0] * n
for i in range(m):
  a, b = map(int,input().split())
  city[a - 1] += 1
  city[b - 1] += 1
for i in range(n):
  print(city[i])

Solution (Python):
import collections
n, m = map(int, input().split())
counter = collections.Counter()
for _ in range(m):
    a, b = map(int, input().split())
    counter[a] += 1
    counter[b] += 1
for i in range(n):
    print(counter[i + 1])

Solution (Python):

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

Solution (Python):
a,b = map(int,input().split())
li = [input().split() for i in range(b)]
for i in range(b):
    li[i] = [int(x) for x in li[i]]
li2 = []
for i in range(b):
    li2.append(li[i][0])
    li2.append(li[i][1])

for i in range(1,a+1):
    print(li2.count(i))

Solution (Python):
N,M=map(int,input().split())
R=[0]*N

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


for r in R:
  print(r)

Solution (Python):
N,M = map(int,input().split())
c = [0]*(N+1)

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

Solution (Python):
n,m = map(int, input().split())
ab =[]
c = []
for i in range(m):
  a,b = map(int, input().split())
  ab.extend([a,b])
for j in range(n):
  print(ab.count(j+1))

Solution (Python):
def resolve():
    n, m = map(int, input().split())
    xy = list(list(map(int, input().split())) for _ in range(m))
    ans = [0] * n
    for x, y in xy:
        ans[x - 1] += 1
        ans[y - 1] += 1
    for a in ans:
        print(a)


if __name__ == "__main__":
    resolve()

Solution (Python):
N, M = map(int, input().split())
edges = [[] for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
for i in range(N):
    print(len(edges[i]))

Solution (Python):
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[i])

Solution (Python):
n, m = map(int, input().split())
s = list(list(map(int, input().split())) for i in range(m))
t = []

for i in range(m):
    for j in range(2):
        t.append(s[i][j])


for k in range(n):
    print(t.count(k+1))

Solution (Python):
N, M = map(int, input().split())

g = [[0] * (N+1) for _ in range(N+1)]

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

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

Solution (Python):
N, M = tuple(map(int, input().split()))
A, B = [], []
for _ in range(M):
    a, b = tuple(map(int, input().split()))
    A.append(a)
    B.append(b)
roads = {i: 0 for i in range(1, N+1)}
for a, b in zip(A, B):
    roads[a] += 1
    roads[b] += 1
for key, val in sorted(roads.items()):
    print(val)

Solution (Python):
n, m = map(int, input().split())
ab = []
for i in range(m):
    ab.extend(input().split())
for i in range(n):
    print(ab.count(str(i+1)))

Solution (Python):
N, M = map(int, input().split())
A = []
B = []
for _ in range(M):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
C = A + B
for i in range(1, N+1):
    print(C.count(i))

Solution (Python):

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])

Solution (Python):
n, m = map(int, input().split())

roads = {}
for i in range(1, n + 1):
    roads[i] = []

for _ in range(m):
    a, b = map(int, input().split())
    roads[a].append(b)
    roads[b].append(a)

for i in sorted(roads):
    print(len(roads[i]))

Solution (Python):
N,M = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(M)]
a = [0] * N

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

Solution (Python):
def main():
    n,m=map(int,input().split(' '))
    road = [[i for i in list(map(int,input().split(' ')))] for i in range(m)]
    ans = [0]*n
    for i,j in road:
        ans[i-1] += 1
        ans[j-1] += 1
    for i in ans:
        print(i)
if __name__ == '__main__':
    main()

Solution (Python):
N, M =map(int,input().split())
ab = [list(map(int,input().split())) for i in range(M)]
ans = [0]*N
for i in range(M):
    ans[ab[i][0]-1]+=1
    ans[ab[i][1]-1]+=1
for i in range(N):
    print(ans[i])

Solution (Python):
N, M = map(int, input().split())
lst = []
for _ in range(M):
    a, b = input().split()
    lst.append(a)
    lst.append(b)
    
for i in range(N):
    print(lst.count(str(i+1)))

Solution (Python):
N,M,*A=map(int,open(0).read().split());l=[0]*N
for a in A:l[a-1]+=1
for r in l:print(r)

Solution (Python):
N,M,*A=map(int,open(0).read().split());l=[0]*N
for a,b in zip(A[::2],A[1::2]):l[a-1]+=1;l[b-1]+=1
for r in l:print(r)

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

Solution (Python):
import sys
input = sys.stdin.readline

def main():
    N, M = map(int, input().split())
    
    count = [0] * N

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


if __name__ == "__main__":
    main()

Solution (Python):
n, m = map(int, input().split())
A = []
B = []
for i in range(m):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
for i in range(1, n+1):
  cnt = 0
  for j, k in zip(A,B):
    if i == j or i == k:
      cnt += 1
  print(cnt)

Solution (Python):
n, m = map(int, input().split())
cities = []
for i in range(n):
    cities.append(0)
for i in range(m):
    x = list(input().split())
    for j in range(2):
        cities[int(x[j]) - 1] += 1
for i in range(len(cities)):
    print(cities[i])

Solution (Python):
import numpy as np
N,M = map(int, input().split())

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

Solution (Python):
n, m = list(map(int, input().split()))

roads = [[] for _ in range(n)]
for _ in range(m):
    f, t = list(map(int, input().split()))
    roads[f-1].append(t-1)
    roads[t-1].append(f-1)
for i in range(n):
    print(len(roads[i]))

Solution (Python):
N,M=map(int,input().split())
import itertools
A=[list(map(int,input().split())) for i in range(M)]

B=list(itertools.chain.from_iterable(A))

 
for a in range(1,N+1):
    print(B.count(a))

Solution (Python):
N,M=map(int,input().split())
import itertools
A=[list(map(int,input().split())) for i in range(M)]
B=list(itertools.chain.from_iterable(A))

for a in range(1,N+1):
  print(B.count(a))

Solution (Python):
n, m = map(int, input().split(" "))

city = [0 for i in range(n + 1)]

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

Solution (Python):
N,M = map(int,input().split())
ab = []
[[ab.append(int(x)) for x in input().split()] for i in range(M)]
[print(ab.count(i)) for i in range(1,N+1)]

Solution (Python):
N,M = (int(x) for x in input().split())

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

for j in range(1,N+1):
    print(list.count(j))

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

for i in range(1,n+1):
    ans=0
    for j in range(m):
        if ab[j][0]==i or ab[j][1]==i:
            ans+=1
    print(ans)

Solution (Python):
from collections import Counter
N, M = map(int, input().split())
C = Counter()
for n in range(M):
  a,b = map(int, input().split())
  C[a] += 1
  C[b] += 1
for i in range(N):
  print(C[i+1])

Solution (Python):
n, m = map(int,input().split())
A = [0] * (n+1)
for i in range(m):
    a0, a1 = map(int,input().split())
    A[a0] += 1
    A[a1] += 1
for i in range(1, n+1):
    print(A[i])

Solution (Python):
n,m=map(int,input().split())
ab=[]
for i in range(m):
    ab.append(list(map(int,input().split())))
ans=[]
for i in range(1,n+1):
    tmp=0
    for j in range(m):
        if i in ab[j]:
            tmp+=1
    ans.append(tmp)
for i in range(n):
    print(ans[i])

Solution (Python):
N,M = map(int,input().split())
k = []
douro = []
for i in range(N):
  douro.append(0)
for i in range(M):
    k.append(list(map(int,input().split())))
for i in range(M):
    douro[(k[i][0]-1)] += 1
    douro[(k[i][1]-1)] += 1
for i in range(N):
  print(douro[i])

Solution (Python):
n,m = list(map(int, input().split()))
arr = [list(map(int, input().split())) for _ in range(m)]
from collections import defaultdict
city = defaultdict(list)

for road in arr:
  city[road[0]].append(road[1])
  city[road[1]].append(road[0])

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

Solution (Python):
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)

Solution (Python):


def resolve():
  n, m = map(int, input().split())

  arr = [0] * (n+1)

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

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


if __name__ == "__main__":
    resolve()

Solution (Python):
N, M = map(int, input().split())
road = []
for _ in range(M):
    a, b = map(int, input().split())
    road.append(a)
    road.append(b)
    
for i in range(1, N+1):
    r = road.count(i)
    print(r)

Solution (Python):
n,m = map(int,input().split())
ab = [] 
for _ in range (m):
    a,b = map(int,input().split())
    ab.append(a)
    ab.append(b)
for i in range(1,n+1):
    s = ab.count(i)
    if s == 0:
        print(0)
    else:
        print(s)

Solution (Python):


def main():


   N , M= map(int,input().split())
   tmpList = [ list(map(int,input().split())) for _ in range(M)]
   roadList = [ j for i in tmpList for j in i]

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







if __name__== "__main__":
    main()

Solution (Python):
n, m = map(int, input().split())
arr = [map(int, input().split()) for _ in range(m)]
d = {i:0 for i in range(1, n+1)}
for a, b in arr:
    d[a] += 1
    d[b] += 1
for v in sorted(d.items(), key=lambda x: x[0]):
    print(v[1])

Solution (Python):
n,m=map(int,input().split())
li=[[] for i in range(n+1)]

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

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

Solution (Python):
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])

Solution (Python):
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)

Solution (Python):
def resolve():
    n,m=map(int,input().split())
    edges=[0 for _ in range(n)]
    for _ in range(m):
        a,b=map(lambda x:int(x)-1,input().split())
        edges[a]+=1
        edges[b]+=1
    print(*edges,sep='\n')
resolve()

Solution (Python):
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
for a in ans:
  print(a)

Solution (Python):
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

for a in ans:
    print(a)

Solution (Python):
import sys
import copy
import  math
from _bisect import *
from collections import *
from operator import itemgetter
from math import factorial
"""
from fractions import gcd
def lcm(x, y):
    return (x * y) // gcd(x, y)
"""
stdin = sys.stdin
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline()

n, m = na()
d = [0] * n
for i in range(m):
    a, b = na()
    d[a - 1] += 1
    d[b - 1] += 1
for i in range(n):
    print(d[i])

Solution (Python):
N, M = map(int, input().split())
lst = []
for _ in range(M):
    lst.extend(list(map(int, input().split())))
for i in range(N):
    print(lst.count(i+1))

Solution (Python):
import collections

N, M = map(int, input().split())

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

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

for l in L:
  print(l)

Solution (Python):
N, M = map(int,input().split())

s = [0]*N

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

Solution (Python):
n,m=[int(i) for i in input().split()]
l=[]
for i in range(m):
	a=list(map(int,input().split()))
	l.extend(a)
for x in range(1,n+1):
	print(l.count(x))

Solution (Python):
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]

ans = [0]*N
for road in ab:
  ans[road[0] - 1] += 1
  ans[road[1] - 1] += 1
  
for a in ans:
  print(a, end='\n')

Solution (Python):
n, m = [int(num) for num in input().split(" ")]
list_road = []
for i in range(m):
  list_road += [int(num) for num in input().split()]

import collections as cl
dic = cl.Counter(list_road)
for i in range(1, n+1):
  print(dic[i])

Solution (Python):

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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

ans = [0] * n

for r in a:
    ans[r[0]-1] += 1
    ans[r[1]-1] += 1

for a in ans:
    print(a)

Solution (Python):



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


ans = [0] * N
for i in range(M):
    ans[ab[i][0] - 1] += 1
    ans[ab[i][1] - 1] += 1


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

Solution (Python):
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 range(n):
    print(L[i])

Solution (Python):
import math
import sys
from itertools import accumulate
from functools import reduce
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

def combination_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def permutations_count(n, r):
    return math.factorial(n) // math.factorial(n - r)

sys.setrecursionlimit(10000)

mod = 1000000007

"""

a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654


char_list = list("abcd") 



    = sys.stdin.readline().rstrip()
    = list(sys.stdin.readline().rstrip())
    = [list(list(sys.stdin.readline().rstrip())) for i in range(h)] 


    = int(sys.stdin.readline())
    = map(int, sys.stdin.readline().split())
    = list(map(int, sys.stdin.readline().split()))
    = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  
"""

if __name__ == "__main__":
    n,m= map(int, sys.stdin.readline().split())
    a=[]
    for i in range(m):
        a += list(map(int, sys.stdin.readline().split()))
    for i in range(n):
        print(a.count(i+1))

Solution (Python):
n,m = map(int,input().split())
array = []
for i in range(m):
    array.extend(list(map(int,input().split())))
for i in range(n):
    print(array.count(i+1))

Solution (Python):
n, m = map(int, input().split())

arr = []
for i in range(m):
    arr += list(map(int, input().split()))

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

Solution (Python):
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(n):
  print(l.count(i+1))

Solution (Python):
n, m = map(int, input().split())
a_b = [[int(j) for j in input().split()] for i in range(m)]
a = []
b = []
for i in range(m):
  a.append(a_b[i][0])
  b.append(a_b[i][1])
  
for i in range(1,n+1):
  print(sum(1 for j in a if j == i) + sum(1 for j in b if j == i))

Solution (Python):
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+1))

Solution (Python):
n,m = map(int,input().split())
A = []
B = []
for i in range(m):
  a,b = map(int,input().split())
  A.append(a)
  B.append(b)
for j in range(1,n+1):
  print(A.count(j)+B.count(j),end='\n')

Solution (Python):
N,M = map(int,input().split())
num = [0]*N
for _ in range(M):
    a,b = map(lambda x: int(x)-1,input().split())
    num[a] += 1
    num[b] += 1
for i in range(N):
    print(num[i])

Solution (Python):
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]))

Solution (Python):
n,m=map(int,input().split())
AB=[list(map(int,input().split())) for _ in range(m)]
ans=[0]*n

for ab in AB:
  ans[ab[0]-1]+=1
  ans[ab[1]-1]+=1
print(*ans,sep='\n')

Solution (Python):
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 i in range(1,n+1):
  print(a.count(i)+b.count(i))

Solution (Python):
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 x in range(n):
  print(road[x])

Solution (Python):
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()

Solution (Python):
n,m=map(int,input().split())
D=dict()
for i in range(n):
  D[i]=[]
for i in range(m):
  a,b=map(int,input().split())
  D[a-1].append([b-1])
  D[b-1].append([a-1])
for i in range(n):
  print(len(D[i]))

Solution (Python):
N,M = map(int, input().strip().split(' '))
G = [[] for _ in range(N)]
for _ in range(M):
  a,b = map(int, input().strip().split(' '))
  a,b = a-1, b-1
  G[a].append(b)
  G[b].append(a)

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

Solution (Python):
from collections import defaultdict
n,m=map(int,input().split())
graph = defaultdict(list)
for i in range(m):
  a,b=map(int, input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)

for i in range(0,n):
  if i not in graph:
    print(0)
  else:
    print(len(graph[i]))

Solution (Python):


cities, roads = map(int, input().split())
connections = []
for i in range(roads):
    x, y = map(int, input().split())
    connections.append((x, y))

road_count = {}
for i in range(cities):
    road_count[i] = 0

for (x, y) in connections:
    
    road_count[x - 1] += 1
    road_count[y - 1] += 1



for i in road_count.values():
    print(i)

Solution (Python):
import sys
N, M = map(int, sys.stdin.readline().rstrip().split())
bucket = [0 for _ in range(N)]
for i in range(M):
    a, b = map(int, sys.stdin.readline().rstrip().split())
    bucket[a-1] += 1
    bucket[b-1] += 1
for n in bucket:
    print(n)

Solution (Python):
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
for v in ans:
    print(v)

Solution (Python):
n,m=map(int,input().split())
ans=[0]*51
for i in range(m):
    a,b=map(int,input().split())
    ans[a]+=1
    ans[b]+=1
for i in range(1,n+1):    
    print(ans[i])

Solution (Python):
n, m = (int(i) for i in input().split())
city2city = [0] * n
for i in range(m):
    a,b = (int(i) for i in input().split())
    city2city[a-1] += 1
    city2city[b-1] += 1

for c in city2city:
    print(c)

Solution (Python):
n,m=map(int,input().split())
ans=[0 for i in range(n+1)]
for i in range(m):
    a,b=[int(j) for j in input().split()]
    ans[a]+=1
    ans[b]+=1
for i in range(1,1+n):
    print(ans[i])

Solution (Python):
N, M = map(int,input().split())
roads = []
for i in range(M):
  a,b = map(int,input().split())
  roads.append([a,b])

ans = []
for i in range(1,N+1):
  counter = 0
  for j in range(M):
    if i in roads[j]:
      counter += 1
  ans.append(counter)

for i in range(len(ans)):
  print(ans[i])

Solution (Python):
n, m = map(int, input().split())
L = [list(map(int, input().split())) for i in range(m)]
for i in range(1, n+1):
  count = 0
  for k in range(m):
    for v in range(2):
      if i == L[k][v]:
        count += 1
  print(count)

Solution (Python):
nm = input().split()
n = int(nm[0])
m = int(nm[1])
a = []
b = []
for i in range(m):
	ab = input().split()
	a.append(int(ab[0]))
	b.append(int(ab[1]))


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

Solution (Python):
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))

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

c=[flatten for inner in road for flatten in inner]

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

Solution (Python):
n,m=map(int,input().split())
road=[list(map(int,input().split())) for i in range(m)]
 
ans={}
for i in range(m):
  sta,gol = road[i][0],road[i][1]
  if sta not in ans:
    ans[sta] = []
  ans[sta].append(gol)
  
  if gol not in ans:
    ans[gol] = []
  ans[gol].append(sta)
  
for i in range(1,n+1):
  if i in ans:
  	print(len(ans[i]))
  else:
    print(0)

Solution (Python):

import sys
input = sys.stdin.readline

N, M = map(int, input().split())
ret = [0] * N

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

print(*ret, sep="\n")

Solution (Python):
n,m = map(int,input().split())
c = [0] * (n+1)
for i in range(m):
  a,b = map(int,input().split())
  c[a] += 1
  c[b] += 1
print('\n'.join(map(str,c[1:])))

Solution (Python):
n, m = map(int, input().split())

a = [0] * n
for i in range(m):
    x, y = map(int, input().split())
    a[x - 1] += 1
    a[y - 1] += 1

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

Solution (Python):
n,m=list(map(int,input().split()))
count={}
for i in range(n):
  count[i+1]=0
for i in range(m):
  a1,b1=[int(j) for j in input().split()]
  count[a1]=count[a1]+1
  count[b1]=count[b1]+1
for i in range(n):
  print(count[i+1])

Solution (Python):
from collections import defaultdict
N, M = map(int, input().split())
D = defaultdict(list)
for i in range(M):
  a, b = map(int, input().split())
  D[a-1].append(b-1)
  D[b-1].append(a-1)

for i in range(N):
  print (len(D[i]))

Solution (Python):

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()

Solution (Python):
n,m=input().split()
n,m=int(n),int(m)
x=[0 for _ in range(n)]
for i in range(m):
    a,b=input().split()
    a,b=int(a)-1,int(b)-1
    x[a]+=1
    x[b]+=1

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

Solution (Python):
N, M = map(int, input().split())
rs = [0]*N
for i in range(M):
  a, b = map(int, input().split())
  a, b = a-1, b-1
  rs[a] += 1
  rs[b] += 1
for r in rs:
  print(r)

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

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

Solution (Python):
N, M = map(int, input().split())

A = [0 for _ in range(N)]

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

for a in A:
    print(a)

Solution (Python):
N,M = map(int,input().split())

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

for n in range(N):
  print(hist[n])

Solution (Python):
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]))

Solution (Python):
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
print('\n'.join(map(str, road)))

Solution (Python):
N, M = map(int, input().split())
ans = {i+1:0 for i in range(N)}
for i in range(M):
  x, y = map(int, input().split())
  ans[x] += 1
  ans[y] += 1

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

Solution (Python):
n,m=map(int,input().split())
road=[[] for _ in range(n)]
for _ in range(m):
    a,b=map(int,input().split())
    road[a-1].append(b-1)
    road[b-1].append(a-1)

for i in road:
    print(len(i))

Solution (Python):
N, M = map(int,input().split())
roads = [0]*N
for _ in range(M):
    a,b = map(int,input().split())
    roads[a-1] += 1
    roads[b-1] += 1
for i in range(N):
    print(roads[i])

Solution (Python):
n, m = map(int, input().split())
edges = [list() for _ in range(n)]

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

for edge in edges:
    print(len(edge))

Solution (Python):
n, m = map(int, input().split())
ans = [0] * n
for i in range(m):
    s, e = map(int, input().split())
    ans[s - 1] += 1
    ans[e - 1] += 1
for a in ans:
    print(a)

Solution (Python):
n,m = map(int,input().split())
li = [0]*n
for i in range(m):
    a,b = map(int,input().split())
    li[a-1] += 1
    li[b-1] += 1
for i in li:
    print(i)

Solution (Python):
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 j in range(n):
    print(l[j])

Solution (Python):
cities , num = map(int,input().split())
ary = [0 for i in range(num)]
result = [0 for i in range(cities)]
check = 0

for i in range(num):
    ary[i] = list(map(int,input().split()))

for i in range(num):
    check = ary[i][0]
    result[check-1] += 1
    check = ary[i][1]
    result[check-1] += 1

for i in range(cities):
    print(result[i])

Solution (Python):
(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])

Solution (Python):
n,m = map(int, input().split())
ab = []
for i in range(m):
  a, b = map(int, input().split())
  ab.append(a)
  ab.append(b)
for j in range(1,n+1):
  print(ab.count(j))

Solution (Python):
from collections import Counter
n, m = map(int, input().split())
ab = []
for i in range(m):
    a, b = map(int, input().split())
    ab.append(a)
    ab.append(b)
ab_cnt = Counter(ab)
for i in range(n):
    print(ab_cnt[i+1])

Solution (Python):
N, M = map(int, input().split())
ab_list = [list(map(int, input().split())) for _ in range(M)]

num_road = [0] * N

for a, b in ab_list:
  num_road[a-1] += 1
  num_road[b-1] += 1

for item in num_road:
  print(item)

Solution (Python):
n, m = map(int, input().split())
ls = [0] * n
for i in range(m):
    a, b = map(int, input().split())
    ls[a-1] += 1
    ls[b-1] += 1
for i in ls:
    print(i)

Solution (Python):
n,m=map(int,input().split())
li=[list(map(int,input().split())) for i in range(m)]

ans=[]

for i in range(m) :
  temp=li[i]
  ans.append(temp[0])
  ans.append(temp[1])
for i in range(n) :
  print(ans.count(i+1))

Solution (Python):
N,M = map(int,input().split())
num = [0] * N
for i in range(M):
  li = list(map(int,input().split()))
  num[li[0] - 1] += 1
  num[li[1] - 1] += 1

for i in num:
  print(i)

Solution (Python):

import sys
INF = float("inf")


def solve(N: int, M: int, a: "List[int]", b: "List[int]"):
    ans = [0]*N
    for aa, bb in zip(a, b):
        ans[aa-1] += 1
        ans[bb-1] += 1
    print(*ans, sep="\n")

    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    M = int(next(tokens))  
    a = [int()] * (M)  
    b = [int()] * (M)  
    for i in range(M):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
    solve(N, M, a, b)


if __name__ == '__main__':
    main()

Solution (Python):
N, M = map(int, input().split())
result = [0] * N
for i in range(M):
    a, b = map(int, input().split())
    result[a-1] += 1
    result[b-1] += 1
[print(result[i]) for i in range(N)]

Solution (Python):
N,M = map(int,input().split())
road=[0]*N
for i in range(M):
    aa,bb=map(int,input().split())
    road[aa-1]+=1
    road[bb-1]+=1
    
for i in road:
    print(i)