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 = [int(i) for i in input().split()]
R = [[int(i) for i in input().split()] for j in range(M)]
adj = [[] for _ in range(N)]
for a,b in R:
  adj[a-1].append(b-1)
  adj[b-1].append(a-1)
for i in range(N):
  print(len(adj[i]))

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

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

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

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

Solution (Python):

from collections import Counter

n, m = list(map(int, input().split()))
c = Counter()
for i in range(m):
    a, b = list(map(int, input().split()))
    c[a] += 1
    c[b] += 1
for j in range(1, n+1):
    print(c[j])

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


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

Solution (Python):
n, m = [int(x) for x in input().split()]
g = [[] for _ in range(n)]
for _ in range(m):
    a, b = [int(x) for x in input().split()]
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)
for gv in g:
    print(len(gv))

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

Solution (Python):
n,m=map(int,input().split())
a=eval(",".join(input().replace(" ",",")for i in [0]*m))
for i in range(n):
    print(a.count(i+1))

Solution (Python):
N,M=input().split(' ')
dict={}
for i in range(int(N)):
  dict[i+1]=0
for i in range(int(M)):
  a,b=input().split(' ')
  a=int(a)
  b=int(b)
  dict[a]+=1
  dict[b]+=1
for i in range(int(N)):
  print(dict[i+1])

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

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

Ans = 0

for k in range(1,N+1):
	for i in range(0,M):
		for j in range(0,2):
			if lis[i][j] == k:
				Ans += 1
	print(Ans)
	Ans = 0

Solution (Python):
def solve():
    n, m = list(map(int, input().split(" ")))
    roads = [0 for _ in range(n)]
    for _ in range(m):
        a, b = list(map(int, input().split(" ")))
        roads[a - 1] += 1
        roads[b - 1] += 1

    for road in roads:
        print(road)


solve()

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

road = []
for i in range(M):
    for j in range(2):
        road.append(s[i][j])


for k in range(N):
    ans = 0
    ans = road.count(k+1)
    print(ans)

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


N,M=list( int(i) for i in input().split() )
counter=[0]*N

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

for i in range(0, N):
    print(counter[i])

Solution (Python):
N,M=map(int,raw_input().split())
c=[0 for i in range(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 = map(int,input().split())

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

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

Solution (Python):
num = [int(x) for x in input().split()]

array = []
for i in range(num[1]):
    array.append([int(x) for x in input().split()])

res = [0 for x in range(num[0])]

for j in array:
    res[j[0]-1] = res[j[0]-1] +1
    res[j[1]-1] = res[j[1]-1] +1

for k in res:
    print(k)

Solution (Python):
N, M = map(int, input().split())
ans = {i+1: 0 for i in range(N)}
for _ in range(M):
    a, b = map(int, input().split())
    ans[a] += 1
    ans[b] += 1
print(*ans.values(), sep='\n')

Solution (Python):

"""
http://abc061.contest.atcoder.jp/tasks/abc061_b

"""
import sys
from sys import stdin
input = stdin.readline


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

    roads = [0] * (N+1)
    for _ in range(M):
        f, t = map(int, input().split())
        roads[f] += 1
        roads[t] += 1

    print('\n'.join(map(str, roads[1:])))


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):

import math
import sys
import itertools
import numpy as np
import functools
import collections
mo = 1000000007
INF = 10**100
r = range

class infix(object):
    def __init__(self, function):
        self.function = function

    def __ror__(self, other):
        self.left = other
        return self

    def __or__(self, other):
        return self.function(self.left, other)

    def __call__(self, value1, value2):
        return self.function(value1, value2)

@infix
def c(f_t_u, f_u_r): return lambda t: f_u_r(f_t_u(t))

class _Ap(object):
    def __rlshift__(self, other):
        self.value = other
        return self

    def __rshift__(self, other):
        return other(self.value)
Ap = _Ap()
ap = Ap




n,m=map(int,input().split())
c=dict()
ret=[]
for i in range(m):
    ret+=map(int,input().split())<<ap>>list

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

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

Solution (Python):
N, M = map(int, input().split())
L = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    L[a].append(b)
    L[b].append(a)
for i in range(N):
    print(len(L[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

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

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

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

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

for i in range(x[0]):
    print(b.count('{}'.format(i+1)))

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

for r in ret:
    print(r)

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

AB = [tuple(map(int,input().split())) for _ in range(M)]
tree = [[] for _ in range(N+1)]

for ab in AB:
    tree[ab[0]].append([ab[1]])
    tree[ab[1]].append([ab[0]])

tree.pop(0)
for t in tree:
    print(len(t))

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

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

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

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

Solution (Python):
N, M = [int(i) for i in input().split()]
ans = [0]*N
for i in range(M):
    a,b = [int(i) for i in 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())
arr = [list(map(int,input().split())) for i in range(m)]
ans = []
for i in arr:
    ans.extend(i)
for i in range(1,n + 1):
    print(ans.count(i))

Solution (Python):
N, M = [int(i) for i in input().split()]
counter = {
  i+1: 0 for i in range(N)
}
for _ in range(M):
  a,b = [int(i) for i in input().split()]
  counter[a] += 1
  counter[b] += 1

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

Solution (Python):
def makelist(n, m):
    return [[0 for i in range(m)] for j in range(n)]






N, M = map(int, input().split())
dp = makelist(N+1, N+1)

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

for i in range(1, N+1):
    ans = 0
    for k in range(1, N+1):
        if k != i:
            ans += dp[i][k]
    print(ans)

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

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

Solution (Python):
from collections import defaultdict


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

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

    for i, v in sorted(d.items()):
        print(v)


if __name__ == "__main__":
    main()

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

c_n=[int(i) for k in range(M) for i in input().split()]

d_n=[c_n.count(i) for i in range(1,N+1)]

for i in range(N):
    print(d_n[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 j in range(1, n+1):
	print(l.count(j))

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

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

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

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

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

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

Solution (Python):



import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)



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

    cnt = [0 for _ in range(N+1)]
    for _ 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])

if __name__ == "__main__": main()

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

count = [0] * N
for i in range(M):
    for j in range(N):
        if a[i] == (j+1) or b[i] == (j+1):
            count[j] += 1

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

Solution (Python):
import collections


n, m = map(int, input().split())
li = []

for i in range(n):
    li.append(i+1)


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

c = collections.Counter(li)

for k, v in sorted(c.items(), key=lambda x: x[0]):
        print(v-1)

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

graph = [list() for _ in range(N+1)]

for _ in range(M):
    a, b = list(map(int, input().split(" ")))
    graph[a].append(b)
    graph[b].append(a)
    
for i in range(1, N+1):
    print(len(graph[i]))

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

    print("\n".join(map(str, load_counts)))

if __name__ == '__main__':
    main()

Solution (Python):
from collections import defaultdict


def main():
    N, M = map(int, input().split())
    d = defaultdict(list)
    for _ in range(M):
        a, b = map(int, input().split())
        d[a].append(b)
        d[b].append(a)
    for i in range(1, N + 1):
        print(len(d[i]))


if __name__ == '__main__':
    main()

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

count = [0 for i in range(0,n)]

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

for i in range(0, n):
    print(count[i])

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

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 ans in l:
    print(ans)

Solution (Python):


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

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

for c in count:
    print(c)

Solution (Python):
import sys

N, M = (int(i) for i in raw_input().split())
ab_list = [[int(i) for i in raw_input().split()] for i in range(M)]

road_list = [0] * N
for ab in ab_list:
    a, b = ab
    road_list[a-1] += 1
    road_list[b-1] += 1

for road_num in road_list:
    print road_num

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

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

arr = []

for i in range(M):
    arr.append(map(int, raw_input().split()))

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

for i in range(M):
    tempa = arr[i][0] - 1
    tempb = arr[i][1] - 1

    ans[tempa] += 1
    ans[tempb] += 1

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

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

Solution (Python):


import sys
import subprocess
import json
import time
import math
import re
import sqlite3

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

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

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

Solution (Python):


import sys
import subprocess
import json
import time
import math
import re
import sqlite3

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

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

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

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

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

Solution (Python):
import sys


from collections import Counter

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

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

Solution (Python):
import sys



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

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

res = [0] * n
for a, b in roads:
    res[b - 1] += 1
    res[a - 1] += 1
for r in res:
    print(r)

Solution (Python):
N,M = [int(i) for i in input().split(" ")]
road = [0]*(N+1)
for i in range(M):
    a_i,b_i = [int(j) for j in input().split(" ")]
    road[a_i] += 1
    road[b_i] += 1
for i in range(1,N+1):
    print(road[i])

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

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

Solution (Python):
n, m = map(int, input().split())
info = list()
for i in range(0, n + 1):
    info.append(0)
for i in range(0, m):
    a, b = map(int, input().split())
    info[a] = info[a] + 1
    info[b] = info[b] + 1
for i, value in enumerate(info):
    if i is not 0:
        print(value)

Solution (Python):
N,M=map(int,input().split())
lis=list()
for var in range(1,M+1):
    a,b=map(int,input().split())
    lis.append(a)
    lis.append(b)

for n in range(1,N+1):
    print(lis.count(n))

Solution (Python):
N,M=map(int,input().split())
g = [0] * N
for _ in range(M):
  a,b=map(int,input().split())
  g[a-1] += 1
  g[b-1] += 1
print("\n".join(map(str,g)))

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):
N,M=map(int,raw_input().split())

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

for i in r:
    print i

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

if __name__ == '__main__':
    main()

Solution (Python):

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

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

ab_list = [list(map(lambda x: int(x) - 1, input().split())) for i in range(m)]

result_list = [[] for i in range(n)]

for ab in ab_list:
    result_list[ab[0]].append(ab[1])
    result_list[ab[1]].append(ab[0])


for result in result_list:
    print(len(result))

Solution (Python):
a = input().split()
city = int(a[0])
road = int(a[1])

x = []
for i in range(road):
    b = input().split()
    x.append(int(b[0]))
    x.append(int(b[1]))

for i in range(city):
    count = 0
    for j in x:
        if i+1 == j:
            count += 1
    print(count)

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

Solution (Python):


n,m = map(int, input().split())
city = [0] * (n + 1)

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

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

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

if __name__ == "__main__":
    solve()

Solution (Python):


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

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

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

for s in street:
    print(s)

Solution (Python):
N, M = list(map(int, input().split()))
roads = [list(map(int, input().split())) for i in range(M)]
cnt = [0 for i in range(N)]
for road in roads:
    for r in road:
        cnt[r-1] += 1

for c in cnt:
    print(c)

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

Solution (Python):
def solve():
  ar = raw_input().split(' ')
  N = int(ar[0])
  M = int(ar[1])
  counts = [0 for i in range(N)]
  for i in range(M):
    
    ar = raw_input().split(' ')
    a = int(ar[0])
    b = int(ar[1])
    counts[a-1] = counts[a-1] + 1
    counts[b-1] = counts[b-1] + 1
  
  print '\n'.join(str(c) for c in counts)

if __name__ == '__main__' :
  solve()

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

Solution (Python):
nm = [int(n) for n in input().split()]
c = [0] * nm[0]
for i in range(nm[1]):
    ab = [int(num) for num in input().split()]
    c[ab[0] - 1] += 1
    c[ab[1] - 1] += 1
for i in range(nm[0]):
    print(c[i])

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

Solution (Python):
n, m = map(int, input().split())
nums = []
for i in range(m) :
    for val in map(int, input().split()):
        nums.append(val-1)
for i in range(n):
    print(nums.count(i))

Solution (Python):

size ,times = map(int, input().split())
road = [0 for i in range(size)]

for i in range(times):
    t1,t2 = map(int,input().split())
    road[t1-1] += 1
    road[t2-1] += 1

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

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

Solution (Python):


N, M = map(int, input().split())
a=[];
b=[];

for i in range(M):
    c, d= map(int, input().split())
    a.append(c)
    b.append(d)
f=[]
f2=[]
for i in range(N):
    f=[]
    for j in range(M):
        if (a[j]==i+1):
            f.append(j+1)
        if (b[j]==i+1):
            f.append(j+1)
            f=list(set(f))
    dd=len(f)
    f2.append(dd)


for i in f2:
    print(i)

Solution (Python):
""" abc061_b:B - Counting Roads """
L = input().rstrip().split(' ')
N = int(L[0])
M = int(L[1])

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

for i in range(M):
    L = input().rstrip().split(' ')
    ANS[int(L[0])-1] += 1
    ANS[int(L[1])-1] += 1

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

Solution (Python):

import array, bisect, collections, copy, heapq, itertools, math, random, re, string, sys, time
sys.setrecursionlimit(10 ** 7)
INF = 10 ** 20
MOD = 10 ** 9 + 7


def II(): return int(input())
def ILI(): return list(map(int, input().split()))
def IAI(LINE): return [ILI() for __ in range(LINE)]
def IDI(): return {key: value for key, value in ILI()}


def read():
    N, M = ILI()
    edges = IAI(M)
    return (N, M, edges)


def solve(N, M, edges):
    ans = [0] * N
    for edge in edges:
        a, b = map(lambda x: x - 1, edge)
        ans[a] += 1
        ans[b] += 1
    
    return ans


def main():
    params = read()
    ans = solve(*params)
    for i in ans:
        print(i)


if __name__ == "__main__":
    main()

Solution (Python):

l = list(map(int, input().split()))
N = l[0]
M = l[1]



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


def r(x):
	y = str(c.count(x))
	return y


dic = {}
for i in range(1,N+1):
	print(r(i))

Solution (Python):
if __name__ == '__main__':
    from numpy import zeros
    N, M = map(int, input().split())
    city = zeros(2*M, dtype='int32')
    for i in range(M):
        city[2*i:2*i+2] = list(map(int, input().split()))
    ans = zeros(N+1, dtype='int32')
    for j in city:
        ans[j] += 1
    for i in range(1, N+1):
        print(ans[i])

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

Solution (Python):
b = input().split(" ")
num = [0 for i in range(int(b[0]))] 
for i in range(int(b[1])):
    a = input().split(" ")
    num[int(a[0])-1] = num[int(a[0])-1]+1
    num[int(a[1])-1] = num[int(a[1])-1]+1

for i in range(int(b[0])):
    print(num[i])

Solution (Python):
a,b=map(int,input().split())

alllist=[]

for i in range(b):
    tmp=list(map(int,input().split()))
    alllist.extend(tmp)

for chk in range(a):
    print(alllist.count(chk+1))

Solution (Python):
from collections import defaultdict
n,m = map(int, raw_input().split())
d = defaultdict(int)
for _ in range(m):
    a,b = map(int, raw_input().split())
    d[a] += 1
    d[b] += 1
for p in range(1,n+1):
    print d[p]

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

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

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

for city in cities:
    print(len(city))

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

Solution (Python):


n, m = map(int, input().split())
arr = [0] * 114514

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

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

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

for i in range(n):
    ans = 0
    for j in range(n):
        ans += graph[j + 1][i + 1]
    print(ans)

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

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 = map(int, input().split())

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

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

Solution (Python):
N, M = map(int, raw_input().split())
v = [map(int, raw_input().split()) for i in range(M)]
w = [0 for i in range(N)]
for a, b in v:
    w[a-1] += 1
    w[b-1] += 1
for i in range(N):
    print w[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):
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)

Solution (Python):


n,m=map(int,raw_input().split())
l=[]
for i in xrange(m):
 a,b=map(int,raw_input().split())
 l.append(a)
 l.append(b)
for i in xrange(1,n+1):
 cnt=l.count(i)
 print cnt

Solution (Python):
table = input().split()
N,M = int(table[0]),int(table[1])
hyou = []
for i in range(M):
    ith = input().split()
    hyou += ith
hyou = list(map(int,hyou))
j = 1
while j <= N:
    print(hyou.count(j))
    j += 1

Solution (Python):
import sys

def solve():
    N, M = map(int, input().split())

    deg = [0] * N

    for i in range(M):
        ai, bi = map(int, input().split())
        ai, bi = ai - 1, bi - 1
        deg[ai] += 1
        deg[bi] += 1

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

if __name__ == '__main__':
    solve()

Solution (Python):
import sys
n,m = [int(x) for x in sys.stdin.readline().split()]
r = [0]*n
for _ 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 r:
	print(i)

Solution (Python):


import numpy as np
N, K = map(int, raw_input().split())
R = []
for i in xrange(K):
    ia, ib = map(int, raw_input().split())
    R.extend([ia, ib])

R = sorted(R)
R.reverse()

count = 1
c = 0
r = R.pop()

for i in xrange(N):
    while count == r:
        c += 1
        if len(R) > 0:
             r = R.pop()
        else:
             break

    print c
    count += 1
    c = 0

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

b()

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

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

Solution (Python):
import sys
from collections import Counter

sys.setrecursionlimit(10**7)
 
inf = 1<<100
 
def solve():
    N, M = map(int, input().split())
    ans = [0]*N

    for i in range(M):
        ai, bi = map(int, input().split())
        ai -= 1
        bi -= 1
        ans[ai] += 1
        ans[bi] += 1

    print(*ans, sep='\n')
 
if __name__ == '__main__':
    solve()

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

road_list = [0] * n

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

for road in road_list:
  print(road)

Solution (Python):
import numpy as np
n,m=map(int,raw_input().split())
a=[]
b=[]
for k in range(m):
    aa,bb=map(int,raw_input().split())
    a.append(aa)
    b.append(bb)
a=np.array(a)
b=np.array(b)

for k in range(1,n+1):
    print(len(np.where(a==k)[0])+len(np.where(b==k)[0]))

Solution (Python):
n = input()
tmp_n = n.split(" ")

N = tmp_n[0]
M = tmp_n[1]
n_list = []

for i in range(int(M)):
    num = input()
    tmp_num = num.split()
    n_list.append(int(tmp_num[0]))
    n_list.append(int(tmp_num[1]))
    
for j in range(1,int(N)+1):
    count = 0
    for k in n_list:
        if k == j:
            count = count + 1        
    print(count)

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

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