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



Sample input:
4 3
1 2
2 3
1 4


Sample output:
2
2
1
1

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
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])

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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]

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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]

Submission status: Accepted

Solution code:
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]

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Runtime Error

Solution code:
import collections
N, M = map(int, input().split())

xy = [map(int, input().split()) for _ in range(M)]
x, y = [list(i) for i in zip(*xy)]
M = []


Z = x + y
Z = sorted(Z)


c = collections.Counter(Z)



V = list(c.values())



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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    numbers=[]
    n,m = map(int,input().split())
    numbers=[list(map(int,input().split())) for _ in range(m)]
    dp={}
    for number in numbers:
        for n in number:
            if n not in dp:
                dp[n]=1
            else:
                dp[n]+=1
    
    for i in range(1,len(dp)+1):
        print(dp[i])

if __name__=="__main__":
    main()

Submission status: Runtime Error

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    numbers=[]
    #n = int(input())
    n,m = map(int,input().split())
    #numbers=list(map(int,input().split()))
    numbers=[list(map(int,input().split())) for _ in range(m)]
    dp={}
    for number in numbers:
        for n in number:
            if n not in dp:
                dp[n]=1
            else:
                dp[n]+=1
    
    for i in range(1,len(dp)+1):
        print(dp[i])

if __name__=="__main__":
    main()

Submission status: Runtime Error

Solution code:
#-*-coding:utf-8-*-
import sys
input=sys.stdin.readline

def main():
    numbers=[]
    #n = int(input())
    n,m = map(int,input().split())
    #numbers=list(map(int,input().split()))
    numbers=[list(map(int,input().split())) for _ in range(m)]
    dp={}
    for number in numbers:
        for n in number:
            if n not in dp:
                dp[n]=1
            else:
                dp[n]+=1
    for i in range(1,n+1):
        print(dp[i])

if __name__=="__main__":
    main()

Submission status: Runtime Error

Solution code:
mycode = '''
# distutils: language=c++
# cython: language_level=3, boundscheck=False, wraparound=False
# cython: cdivision=True
# False:Cython はCの型に対する除算・剰余演算子に関する仕様を、(被演算子間の符号が異なる場合の振る舞いが異なる)Pythonのintの仕様に合わせ、除算する数が0の場合にZeroDivisionErrorを送出します。この処理を行わせると、速度に 35% ぐらいのペナルティが生じます。 True:チェックを行いません。

ctypedef long long LL

cdef extern int __builtin_popcount(unsigned int) nogil

import numpy as np

import sys
readline = sys.stdin.buffer.readline
read = sys.stdin.readline #文字列読み込む時はこっち


cdef ints(): return np.fromstring(readline(), sep=' ', dtype=np.int64)


cdef read_matrix(LL H,LL W):
    #return np.ndarray shape=(H,W) matrix
    lines=[]
    cdef LL _
    for _ in range(H): 
        lines.append(read())
    lines=' '.join(lines) #byte同士の結合ができないのでreadlineでなくreadで
    return np.fromstring(lines, sep=' ',dtype=np.int64).reshape(H,W)

# この問題をあえてグラフの構造を持つことで解く
from libcpp.vector cimport vector as vec

cdef LL N,M
N,M=ints()
AB=read_matrix(M,2)-1
cdef LL a,b

ctypedef vec[vec[LL]] Graph
cdef Graph graph=Graph(N)

for a,b in AB:
    graph[a].push_back(b)
    graph[b].push_back(a)

cdef vec[int] ans
for i in range(N):
    ans.push_back(graph[i].size())
print(*ans, sep='\n')
'''

import sys
import os
if sys.argv[-1] == 'ONLINE_JUDGE':  # コンパイル時
    with open('mycode.pyx', 'w') as f:
        f.write(mycode)
    os.system('cythonize -i -3 -b mycode.pyx')

import mycode

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N, M = open(0).readline().split()
from collections import Counter
cnt = Counter(open(0).read().split())
for i in range(1,int(N)+1):
    print(cnt[str(i)])

Submission status: Runtime Error

Solution code:
N, M = open(0).readline().split()
from collections import Counter
cnt = Counter(open(0).read().split())
print('\n'.join(list(map(str,cnt.values()))))

Submission status: Runtime Error

Solution code:
N, M = open(0).readline().split()
from collections import Counter
cnt = Counter(open(0).read().split())
print('\n'.join(map(str,cnt.values())))

Submission status: Runtime Error

Solution code:
N, M = open(0).readline().split()
from collections import Counter
cnt = Counter([x for x in open(0).read().split()])
print('\n'.join(map(str,cnt.values())))

Submission status: Runtime Error

Solution code:
N, M = open(0).readline().split()
from collections import Counter
cnt = Counter([int(x) for x in open(0).read().split()])
print('\n'.join(map(str,cnt.values())))

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
import ita
data=ita.array.make1d(2*M)
for i in range(0,M):
    data[2*i],data[2*i+1]=map(int,input().split())
honsu=ita.array.make1d(N)
for j in range(0,N):
    honsu[j]=0
    for k in range(0,len(data)):
        if data[k]==j+1:
            honsu[j]=honsu[j]+1
for l in range(0,len(honsu)):
    print(honsu[l])

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
import ita
data=ita.array.make1d(2*M)
for i in range(0,M):
    data[2*i],data[2*i+1]=map(int,input().split())
honsu=ita.array.make1d(N)
for j in range(0,N):
    honsu[j]=0
    for k in range(0,len(data)):
        if data[k]==j+1:
            honsu[j]=honsu[j]+1
for l in range(0,len(honsu)):
    print(honsu[l])

Submission status: Runtime Error

Solution code:
4 3
1 2
2 3
1 4

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
a_s=[]
b_s=[]
for i in range(m):
  a,b=map(int,input().split())
  a_s.append(a)
  b_s.append(b)

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef vector<ll> vl;
typedef vector<string> vs;

#define N 50

int p[N];

int main(){
	ll n, m, ans;
	ll a, b;
	cin >> n >> m;

	for (int i = 0; i < N; i++) {
		p[i] = 0;
	}

	for (int i = 0; i < m; i++) {
		cin >> a >> b;
		p[a]++;
		p[b]++;
	}

	for (int i = 1; i <= n; i++) {
		cout << p[i] << endl;
	}

	return 0;
}

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
n,m = map(int,input().split())
dic = {}
for i in range(m):
    a,b = map(int,input().split())
    dic.setdefault(a,0)
    dic[a] += 1
    dic.setdefault(b,0)
    dic[b] += 1
for j in range(1,n+1):
    print(dic[j])

Submission status: Runtime Error

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

a = []

for i in m:
  a1, a2 = map(int, input().split())
  a.append(a1)
  a.append(a2)

for s in n:
  print(a.count(s))

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
city = [0] * 10
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])

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
ans=[0 for _ in range(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(a[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
A=[0]*(N*1)

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

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

Submission status: Runtime Error

Solution code:
M,N = map(int,input().split())
ans = [0 for _ in range(N)]
for _ 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])

Submission status: Runtime Error

Solution code:
from collections import defaultdict

n,m=map(int,input().split())
r=[list(map(int,input().split())) for _ in range(n)]
d=defaultdict(int)
for x in r:
  d[x[0]]+=1
  d[x[1]]+=1

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

Submission status: Runtime Error

Solution code:
N,_,*L=map(int,open(0).read().split());for n in range(N):print(L.count(n+1))

Submission status: Runtime Error

Solution code:
from itertools import combinations
import math
n,d=map(int,input().split())
X=[list(map(int,input().split())) for _ in range(n)]
cnt=0
for perm in list(combinations(range(n),2)):
    d=sum(map(lambda x: (x[0]-x[1])**2,zip(X[perm[0]],X[perm[1]])))
    if d==int(math.sqrt(d))**2:
        cnt+=1
print(cnt)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

for i in lst:
    print(i)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
from collections import Counter
N, M = map(int, input().split())
dis_list = []
my_count = Counter()
for i in range(M):
    a, b = map(int, input().split())
    my_count[a] += 1
    my_count[b] += 1
my_count = sorted(my_count.items())
for i in range(N):
    print(my_count[i][1])

Submission status: Runtime Error

Solution code:
from collections import Counter
from operator import itemgetter
N, M = map(int, input().split())
dis_list = []
my_count = Counter()
for i in range(M):
    a, b = map(int, input().split())
    my_count[a] += 1
    my_count[b] += 1
my_count = sorted(my_count.items())
for i in N:
    print(i[1])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
count = [0] * n
for i in range(m):
    a = list(map(int, input().split()))
    for j in range(j):
        if j + 1 in a:
            count[j] += 1
for i in range(i):
    print(count[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def counting_sort(array,city,road):
    bucket = [0] * city

    for i in range(road):
        for j in range(2):
            bucket[ array[i][j] ] += 1

    return bucket

def main():
    n,m = map(int, input().split())
    way = [list(map(int,input().split())) for _ in range(m)]
    ans_list = counting_sort(way, n, m)
    for k in range(n):
        print( ans_list[i] )

main()

Submission status: Runtime Error

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

for j in result:
    print(j)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
def ABC_61_B():
    N,M = map(int, input().split())
    t = [ 0 for _ in range(N)]
    t2 = [ 0 for _ in range(N)]

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

    for i in range(len(t)):
        t2=list(t[i])
        print(len(t2)-1)

if __name__ == '__main__':

    ABC_61_B()

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import numpy as np
n, m = map(int, input().split())
road = [0]*n
a = [0]*m
a = np.array(a)
b = [0]*m
b = np.array(b)
for i in range(m):
  x, y = input().split()
  a[i] = (int(x))
  b[i] = (int(y))
for i in road:
  road[int(a[i]) - 1] += 1
  road[int(b[i]) - 1] += 1
for i in road:
    print(i)

Submission status: Runtime Error

Solution code:
def resolve():
    # 整数 1 つ
    # n = int(input())
    # 整数複数個
    n, m = list(map(int, input().split()))
    # 整数 N 個 (改行区切り)
    # N = [int(input()) for i in range(N)]
    # 整数 N 個 (スペース区切り)
    # N = list(map(int, input().split()))
    # 整数 (縦 H 横 W の行列)
    A = [list(map(int, input().split())) for i in range(m)]

    towns = {}
    for i in range(n):
        towns[i] = 0

    for j in range(m):
        for k in range(2):
            towns[A[j][k]] += 1

    print(towns.values())

resolve()

Submission status: Runtime Error

Solution code:

n,m = map(int, input().split())
xy = [map(int,input().split()) for _ in range(m)]
x,y = [list(i) for i in zip(*xy)]
l = x + y


d = {}#辞書同士の追加はupdate

for i in n:
    d[i] =0
for i in l:
    if i not in d:
        d[i] = 0
    d[i] += 1

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

Submission status: Runtime Error

Solution code:

n,m = map(int, input().split())
xy = [map(int,input().split()) for _ in range(m)]
x,y = [list(i) for i in zip(*xy)]
l = x + y


d = {}
for i in l:
    if i not in d:
        d[i] = 0
    d[i] += 1

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

Submission status: Runtime Error

Solution code:
n,m = map(int, input().split())
xy = [map(int,input().split()) for _ in range(m)]
x,y = [list(i) for i in zip(*xy)]
l = x + y

print(l)

d = {}
for i in l:
    if i not in d:
        d[i] = 0
    d[i] += 1

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

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
for _ in range(M):
    a, b = map(int, input().split())
    
for i in range(1, M, 1):
  a.count(i)
  b.count(i)
  
  
c = a + b

C = np.zeros((len(c), 1), dtype = 'int')

for i in range(len(C)):
  C[i,0] = c[i]
  
print(C)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,M = int(input())
S = [list(map(int, input().split())) for i in range(M)]
for i in range(M):
  print(S.count('i'))

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
L=input()
for i in range(b):
  L.append(input())
  
  for j in range(b):
    print(L.count(L))

Submission status: Runtime Error

Solution code:
n, m =map(int,input().split())
city = {}
for i in range(m):
    x, y =map(int,input().split())
    if x not in city:
        city[x] = 1
    else:        
        city[x] += 1
    if y not in city:
        city[y] = 1
    else:        
        city[y] += 1    
for i in range(1,n+1):
    print(city[i])

Submission status: Runtime Error

Solution code:
n, m =map(int,input().split())
city = {}
for i in range(m):
    x, y =map(int,input().split())
    if x not in city:
        city[x] = 1
    else:        
        city[x] += 1
    if y not in city:
        city[y] = 1
    else:        
        city[y] += 1    
for i in range(n):
    print(city[i])

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
d = {}
def f(n):
    if n not in d:
        d[n] = 1
    else:
        d[n] += 1
for _ in [0]*m:
    a, b = map(int, input().split())
    f(a)
    f(b)
for i in range(1, n+1):
    print(d[i])

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
while m>0:

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
for _ in range(M):
    a, b = map(int, input().split())
for i in range(1,N+1):
    print(a.count("i")+b.count("i"))

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
for _ in range(M):
    a, b = map(int, input().split())
for i in range(1,N+1):
    print(a.count(i)+b.count(i))

Submission status: Runtime Error

Solution code:
N, M = input().split()
for _ in range(M):
    a, b = input().split()
for i in range(1, N+1):
    print(a.count("i")+b.count("i"))

Submission status: Runtime Error

Solution code:
N, M = input().split()
for i in range(1, M+1):
    a, b = input().split()
for i in range(1, N+1):
    print(a.count("i")+b.count("i"))

Submission status: Runtime Error

Solution code:
N, M = input().split()
for i in range(1, M+1):
    a, b = input().split()
for i in range(1, N+1):
    print(a.count("i")+b.count("i")

Submission status: Runtime Error

Solution code:
N, M = input().split()
for _ in range(M):
    a, b = input().split()
for _ in range(1, N+1):
    print(a.count("i")+b.count("i")

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
for _ in range(M):
    a, b = input().split()
for _ in range(1, N+1):
    print(a.count("i")+b.count("i")

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n, m = map(int,input().split())
c = [0 for i in range(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)

Submission status: Runtime Error

Solution code:
import numpy as np
n, m = map(int,input().split())
c = np.zeros(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)

Submission status: Runtime Error

Solution code:
n, m = map(int,input().split())
c = np.zeros(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)

Submission status: Runtime Error

Solution code:
import numpy as np



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

a = np.ones(M)
b = np.ones(M)

for i in in range(M):
    a[i],b[i] = [int(j) for j in input().split()]
    
ans = np.zeros(N)
    
for i in range(N):
    A = int(a[i]-1)
    B = int(b[i]-1)
    ans[A]+=1
    ans[B]+=1
    
for i in range(N):
    print(ans[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,M=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(M)]
 
ans=[0]
for a in A:
    ans[a[0]-1]+=1
    ans[a[1]-1]+=1
 
for a in ans:
    print(a)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
8 8
1 2
3 4
1 5
2 8
3 7
5 2
4 1
6 8

Submission status: Runtime Error

Solution code:
n, m = [int(e) for e in input().split()]
map_dict = {}
for i in range(n):
    map_dict[str(i+1)] = 0
for _ in range(m):
    cities = [e for e in input().split()]
    map_dict[cities[0]]+=1
    map_dict[cities[1]]+=1
for i in range(m):
    print(map_dict[str(i+1)])

Submission status: Runtime Error

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

lst2 = [0]*n

for i,j in lst1:
    lst2[i] += 1
    lst2[j] += 1

for i in lst2:
    print(i)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
dic = {}
for i in range(M):
  a, b = map(int, input().split())
  if a in dic:
    dic[a] += 1
  else:
    dic[a] = 1
  if b in dic:
    dic[b] += 1
  else:
    dic[b] = 1
for i in range(1, N + 1):
  print(dic[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
[N, M] = list(map(int, input().split()))
[s, e] = [ [], [] ]
for _ in range(M):
  input_line = list(map(int, input().split()))
  s.append(input_line[0])
  e.append(input_line[1])
bucket = {}

for i in range(M):
  if s[i] in bucket and e[i] in bucket:
    bucket[s[i]].append(s[i])
    bucket[e[i]].append(e[i])
  elif s[i] in bucket:
    bucket[s[i]].append(s[i])
    bucket[e[i]] = [e[i]]
  elif e[i] in bucket:
    bucket[s[i]] = [s[i]]
    bucket[e[i]].append(e[i])
  else:
    bucket[s[i]] = [s[i]]
    bucket[e[i]] = [e[i]]

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

Submission status: Runtime Error

Solution code:
[N, M] = list(map(int, input().split()))
[s, e] = [ [], [] ]
for _ in range(N):
  input_line = list(map(int, input().split()))
  s.append(input_line[0])
  e.append(input_line[1])
bucket = {}

for i in range(N):
  if s[i] in bucket and e[i] in bucket:
    bucket[s[i]].append(s[i])
    bucket[e[i]].append(e[i])
  elif s[i] in bucket:
    bucket[s[i]].append(s[i])
    bucket[e[i]] = [e[i]]
  elif e[i] in bucket:
    bucket[s[i]] = [s[i]]
    bucket[e[i]].append(e[i])
  else:
    bucket[s[i]] = [s[i]]
    bucket[e[i]] = [e[i]]

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

Submission status: Runtime Error

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

for i in range(0,N):
	lst.append(input().split(" "))

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

Submission status: Runtime Error

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

for i in range(0,N)
	lst.append(input().split(" "))

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3

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

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

    if b in d:
        d[b]=d[b]+1
    else:
        d[b]=1

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

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
ABs = [input().split() for i in range(M)]


MPs = {}
# この書き方でa,bが取り出せる
for a, b in ABs:
    a = int(a)  # intに直すには先に直しておく
    b = int(b)
    if a not in MPs:
        MPs[a] = 1
    else:
        MPs[a] += 1
    if b not in MPs:
        MPs[b] = 1
    else:
        MPs[b] += 1

for mp in range(1, N+1):
    print(MPs[mp])