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

N, M = map(int, input().split())
list_a, list_b, ans = ( [], [], [] )
num = [ tmp for tmp in range(1,N+1) ]
for tmp in range(M):
    a, b = map(int, input().split())
    list_a.append(a)
    list_b.append(b)

for tmp in range(len(num)):
    x = list_a.count(num[tmp])
    y = list_b.count(num[tmp])
    ans.append(x+y)

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

Solution (Python):

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

count = [0]*N

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

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

Solution (Python):


from collections import defaultdict

if __name__ == "__main__":
    N, M = map(int, input().split(" "))

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

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

Solution (Python):
n, m  = map(int, input().split())
def prob_B(n, m):    
    ls_ans = [0] * n

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

    return ls_ans    
    
ls_ans = prob_B(n=n, m=m)
[print(ls_ans[i]) for i in range(len(ls_ans))]

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

for e in Es:
    print(len(e))

Solution (Python):
n, m = input().split(' ',2)
a = []
for ii in range(int(n)):
    a.append(0)
for ii in range(int(m)):
    tmpA, tmpB = input().split(' ',2)
    a[int(tmpA) - 1] += 1
    a[int(tmpB) - 1] += 1
for ii in range(int(n)):
    print(a[ii])

Solution (Python):
import numpy as np
mat = np.zeros((50, 50)).astype(int)

N, M = list(map(int, input().split(' ')))
for m in range(M):
    i, j = list(map(int, input().split(' ')))
    i, j = i-1, j-1
    mat[i][j] += 1
    
for n in range(N):
    res = 0
    for i in range(N):
        res += mat[n][i]
        res += mat[i][n]
    print(res)

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

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

Solution (Python):
cr = input().split()
c = int(cr[0])
r = int(cr[1])
i = 0
n = []
michi = []
citi = [0] * c
while(i < r):
    michi.append(input().split())
    i += 1
    pass
i = 0
while(i < r):
    src = int(michi[i][0])
    dst = int(michi[i][1])
    citi[src-1] += 1
    citi[dst-1] += 1
    i += 1
    pass
i = 0
while(i < c):
    print(citi[i])
    i += 1

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

d = []
for i in range(M):
	d = d + c[i]

for i in range(N):
	print(d.count(str(i+1)))

Solution (Python):


x = input()
y=[]
y=x.split(" ")
N=int(y[0])
M=int(y[1])

z=[]
for i in range(M):
	temp1=input()
	temp2=temp1.split(" ")
	for j in temp2:
		j=int(j)
		z.append(j)

dict={}
for i in range(N):
	i+=1
	dict[i]=0

for i in z:
	dict[i]=dict[i]+1

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

Solution (Python):


nm = input().split(' ')
vv = []
for i in range(int(nm[1])):
    a = input().split(' ')
    vv.append(int(a[0]))
    vv.append(int(a[1]))

for i in range(int(nm[0])):
    c = vv.count(1+i)
    if c != 0:
        print(c)
    else:
        print('0')

Solution (Python):
n, m = map(int, input().split())
a = []
b = []

for i in range(m):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)

for i in range(n):
    count = 0
    for j in range(m):
        if a[j] == i+1:
            count += 1
        if b[j] == i+1:
            count += 1
    print (count)

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

deg = [0]*n

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

print('\n'.join(map(str,deg)))

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

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

road = sum(road,[])

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

Solution (Python):
N, M = map(int, raw_input().split())
kotae = [0]*N
for i in range(M):
 l=map(int, raw_input().split())
 for j in range(len(l)):
  kotae[l[j]-1]=kotae[l[j]-1]+1
for k in range(N):
 print kotae[k]

Solution (Python):
import sys
import numpy as np
n,m = [int(x) for x in sys.stdin.readline().split()]
r = np.zeros(n)
for i in range(m):
	a, b = [int(x) for x in sys.stdin.readline().split()]
	r[a-1] += 1
	r[b-1] += 1
for i in range(n):
	print(int(r[i]))

Solution (Python):
arnum = input().split()
n = int(arnum[0])
m = int(arnum[1])
road = []
for i in range(m):
    lists = [int(x) for x in input().split()]
    road.append(int(lists[0]))
    road.append(int(lists[1]))
for j in range(1,n+1):
    print(road.count(j))

Solution (Python):


mozir=input()
hyo=mozir.split(' ')
N_toshi=int(hyo[0])
M_miti=int(hyo[1])

hindo=[0]*N_toshi

for idx in range(0,M_miti,1):
    mozir=input()
    hyo=mozir.split(' ')
    hashis=(int(mono)-1 for mono in hyo)
    for tenn in hashis:
        hindo[tenn]=hindo[tenn]+1

for tenn in hindo:
    print(tenn)

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

for i in range(1,N+1):
    cnt = 0
    for j in roads:
        if j == i:
            cnt+=1
    print(cnt)

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

Solution (Python):


from itertools import chain

N,M=map(int,raw_input().split())
road=[0]*M
for i in range(M):
    road[i]=map(int,raw_input().strip().split())

road=list(chain.from_iterable(road))

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

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

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

for key in sorted(dic.keys()):
    print(dic[key])

Solution (Python):
if __name__ == '__main__':

	N, M = map(int, input().split())
	n=[]
	for j in range(N):
		n.append(0)

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

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

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

Solution (Python):
N, M = [int(i) for i in input().split()]
g = [[int(i) for i in input().split()] for j in range(M)]
f = [item for sublist in g for item in sublist]
for i in range(1,N+1):
    print(f.count(i))

Solution (Python):
M,N=map(int,raw_input().split())
cnt=[0]*M
for i in xrange(N):
    a,b=map(int,raw_input().split())
    cnt[a-1]+=1
    cnt[b-1]+=1

for i in xrange(M):
    print cnt[i]

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

for i in range(n):
    i+=1
    ans=list.count(i)
    print(ans)

Solution (Python):
NM = list(map(int,input().split()))
r = [0 for _ in range(NM[0])]
for _ in range(NM[1]):
    for i in list(map(int,input().split())):
        r[i-1] += 1
for i in r:
    print(i)

Solution (Python):
def main():
    N, M = map(int, input().split())
    m = [None, None] * M
    i = 0
    while i < M * 2:
        a, b = map(int, input().split())
        m[i] = a
        m[i+1] = b
        i += 2

    for s in range(1, N + 1):
        ans = m.count(s)
        print(ans)

main()

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

Solution (Python):

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

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

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

Solution (Python):
def int_input():
    line = input()
    return [int(x) for x in line.split()]

n, m = int_input()
cities = {}

for i in range(n):
    cities[i+1] = []

for i in range(m):
    a, b = int_input()
    cities[a].append(b)
    cities[b].append(a)

for i in sorted(cities.keys()):
    print(len(cities[i]))

Solution (Python):



line = input().split(' ')
N = int(line[0])
M = int(line[1])

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

for i in range(M):
    line = input().split(' ')
    for j in line:
        count_list[int(j)-1] += 1


if __name__ == '__main__':
    for count in count_list:
        print(count)

Solution (Python):


from collections import Counter

n, m = map(int, raw_input().split())
f = [int(flatten) for _ in range(m) for flatten in raw_input().split()]
c = Counter(f)

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

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


dp = {}
for i in range(M):
    a = ab[i][0]
    b = ab[i][1]
    if a not in dp:
        dp[a] = 1
    else:
        dp[a] += 1

    if b not in dp:
        dp[b] = 1
    else:
        dp[b] += 1

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

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

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

for c in city:
    print(c)

Solution (Python):
import numpy as np
n,m = input().split()
n = int(n)
m = int(m)
count = np.zeros(n)
for i in range(m):
    a, b = input().split()
    count[int(a)-1] += 1
    count[int(b)-1] += 1

for i in count:
    print(int(i))

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

a = [0]*M
b = [0]*M
c = [0]*N

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

for j in range(N):
    
    for k in range(M):
        if a[k]==j+1:
            c[j]+=1

        if b[k]==j+1:
            c[j]+=1

    print(c[j])

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

a = []

for i in range(M):
    a.append(list(map(int,input().split())))
a = np.array(a)
a = a.flatten()

count = Counter(a)
for i in range(N):
    print (count[i+1])

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

r = []
for i in range(m):
    r += [int(i) for i in input().split()]

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

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

path_num = [0 for i in range(N)] 
for i in range(M):
    k, l = map(int, input().split())
    path_num[k - 1] += 1
    path_num[l - 1] += 1

for num in path_num:
    print(num)

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n,m = LI()
    r = [0] * n
    for _ in range(m):
        a,b = LI_()
        r[a] += 1
        r[b] += 1
    return '\n'.join(map(str, r))

print(main())

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

Solution (Python):

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

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

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):

N, M = map(int, raw_input().split())
a = []
b = []
for _ in range(M):
    _a, _b = map(int, raw_input().split())
    a.append(_a)
    b.append(_b)

ans = [0] * N
for i in range(0, N):
    ans[i] = a.count(i + 1) + b.count(i + 1)
    print ans[i]

Solution (Python):
import collections


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

    streets = collections.defaultdict(list)

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

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


if __name__ == '__main__':
    main()

Solution (Python):
N,M = map(int,input().split())
A = [0 for i in range(N)]
for m 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):
a = list(map(int,input().split(" ")))
b = list()
c = list()
tmp = list()

for i in range(a[1]):
    tmp = list(map(int,input().split(" ")))
    b.append(tmp[0])
    b.append(tmp[1])

for i in range(a[0]):
    print(b.count(i + 1))

Solution (Python):
n, m = map(int, raw_input().split(' '))
d = {}

for i in range(m):
	a, b = map(int, raw_input().split(' '))
	if d.has_key(a):
		d[a] += 1
	else:
		d[a] = 1
	if d.has_key(b):
		d[b] += 1
	else:
		d[b] = 1

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

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

ans = np.sum(mat, axis=1)
for i in range(N):
    print(int(ans[i]))

Solution (Python):
def rren(): return list(map(int, input().split()))


N, M = rren()
road = [[0 for i in range(N+1)] for j in range(N+1)]

for i in range(M):
    a, b = rren()
    road[a][b] += 1
    road[b][a] += 1

for i in range(1, N+1):
    count = 0
    for j in range(1, N+1):
        count += road[i][j]
    print(count)

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

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

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

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

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

for i in c:
	print i

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

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

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

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

for i in range(m):
	ai = a[i] - 1
	bi = b[i] - 1
	res[ai] += 1
	res[bi] += 1

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

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

mp = [[0]*n for _ in xrange(n)]

for idx in xrange(m):
    a, b = map(int, raw_input().split())
    mp[a-1][b-1] += 1
    mp[b-1][a-1] += 1

for idx in range(n):
    print sum(mp[idx])

Solution (Python):
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 i in l:
	print(i)

Solution (Python):
import sys
import random

def rd():
        return sys.stdin.readline().rstrip()

def rdi():
        return [ int(x) for x in rd().split() ]

N, M = rdi()
a = []
b = []
for i in range(M):
        ai, bi = rdi()
        a.append(ai)
        b.append(bi)

c = {}
for i in range(N):
        c[i+1] = 0
for i in range(M):
        ai = a[i]
        bi = b[i]
        c[ai] += 1
        c[bi] += 1
for i in range(N):
        print c[i+1]

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

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

Solution (Python):
import sys
from collections import defaultdict

def main():
    line = sys.stdin.readline()
    lst = line.split()
    n = int(lst[0])
    m = int(lst[1])

    ans_dic = defaultdict(int) 
    for i in range(m):
        line = sys.stdin.readline()
        lst = line.split()
        a = int(lst[0])
        b = int(lst[1])
        ans_dic[a] += 1
        ans_dic[b] += 1

    for i in range(1, n+1):
        print("%d" % ans_dic[i])
    return 0

if __name__ == '__main__':
    sys.exit(main())

Solution (Python):
def linput():
    return list(map(int,input().split(" ")))


N,M=linput()
L=[0]*N
for i in range(M):
    a,b=linput()
    L[a-1]+=1
    L[b-1]+=1

for l in L:
    print(l)

Solution (Python):
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]

ans = [0 for i in range(n)]
for i in range(m):
    ab = list(map(int, input().split()))
    ans[ab[0]-1] += 1
    ans[ab[1]-1] += 1

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

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

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

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):
    print(A.count(i)+B.count(i))

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

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

Solution (Python):
temp=input().split()
N=int(temp[0])
M=int(temp[1])
ab=[[int(j)-1 for j in input().split()] for i in range(M)]

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

for i in range(M):
	place[ab[i][0]].append(ab[i][1])
	place[ab[i][1]].append(ab[i][0])

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

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

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

for city in city_list:
    print(city)

Solution (Python):


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

Solution (Python):
import collections

if __name__ == '__main__':
    n, m = map(int, input().split())

    counter = collections.defaultdict(int)
    for _ in range(m):
        a, b = map(int, input().split())
        counter[a] += 1
        counter[b] += 1

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

Solution (Python):

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

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

roads_cnt=[0]*N
for i in range(M):
    a_i,b_i=map(int,input().split())
    roads_cnt[a_i-1] +=1
    roads_cnt[b_i-1] +=1

for road_cnt in roads_cnt:
    print(road_cnt)

Solution (Python):


import numpy as np

if __name__ == "__main__":
	n, m = map(int, input().split())

	mat = [[0]*n for _ in range(n)]
	for _ 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):
		print(sum(mat[i]))

Solution (Python):
N, M = map(int, raw_input().split())
E = [map(int, raw_input().split()) for _ in range(M)]

cnt = [0 for _ in range(N)]
for a, b in E:
    cnt[a-1] += 1
    cnt[b-1] += 1

for v in cnt:
    print v

Solution (Python):
import numpy as np

n, m = map(int, raw_input().split())
ans = np.zeros(n)
for i in range(m):
    l = map(int, raw_input().split())
    ans[l[0] - 1] += 1
    ans[l[1] - 1] += 1

for i in ans:
    print int(i)

Solution (Python):
n, m = map(int, input().split())
city = [0] * 100

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

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

Solution (Python):


import sys
import os
import math

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

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

    A[a] += 1
    A[b] += 1

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

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

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

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

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

for i in range(M):
    a,b = map(int,raw_input().split())
    road[a-1]+=1
    road[b-1]+=1
    
for r in road:
    print r

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

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

for c in cnt:
    print(c)

Solution (Python):

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

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


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

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

for i in range(n):
    print(sum(nodes[i]))

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

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

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

Solution (Python):
n, m = map(int, input().split())
f = [0] * (n + 2)
for i in range(m):
    x, y = map(int, input().split())
    f[x] += 1
    f[y] += 1
for i in range(1, n + 1):
    print(f[i])

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

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

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

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

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

Solution (Python):
n,m=map(int,input().split())
d={i:0 for i in range(1,n+1)}
for i in range(m):
    u,v=map(int,input().split())
    d[u]+=1
    d[v]+=1
for i in range(1,n+1):
    print(d[i])

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

Solution (Python):
import sys
import math
sys.setrecursionlimit(10000)

mod = 10**9 + 7

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

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

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

Solution (Python):
n, m = map(int, raw_input().split())
g = [0]*n
for i in xrange(m):
    a, b = map(int, raw_input().split())
    g[a-1]+=1
    g[b-1]+=1
print "\n".join(map(str, g))

Solution (Python):
import sys

stdin = sys.stdin


def na(): return map(int, stdin.readline().split())


def ns(): return stdin.readline().strip()


n,m = map(int,stdin.readline().split())

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

Solution (Python):

N, M = map(int, raw_input().split())
cnt = [0]*N
for loop in xrange(M):
    a, b = map(int, raw_input().split())
    cnt[a - 1] += 1
    cnt[b - 1] += 1
for i in cnt:
    print i