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: Wrong Answer

Solution code:
n,m=map(int,input().split())
roads=[]
for i in range(m):
  roads.append(input().split())
count=0
for j in range(1,n+1):
  for k in range(m):
    if roads[k][0]==j or roads[k][1]==j:
      count+=1
  print(count)
  count=0

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
li = [list(map(int, input().split())) for i in range(m)]
li = [flatten for inner in li for flatten in inner ]
a = li[::2]
b = li[1::2]
for i in range(m):

        if a.count(i+1) + b.count(i+1) == 0:
            exit()
        else:
            print(a.count(i+1) + b.count(i+1))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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)
l.sort()
count = 1
for i in range(2*m-1):
    if l[i] == l[i+1]:
        count = count + 1
    elif l[i] > l[i+1]+1:
        print(count)
        for x in range(l[i+1]-l[i]-1):
            print(0)
        count = 1
    else:
        print(count)
        count = 1
print(count)

Submission status: Wrong Answer

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)
l.sort()
count = 1
for i in range(2*m-1):
    if l[i] == l[i+1]:
        count = count + 1
    else:
        print(count)
        count = 1
print(count)

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=open(0).read().split()
print(*[l.count(str(i+1)) for i in range(n)],sep='\n')

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=list(map(int,open(0).read().split()))
print(*[l.count(i+1) for i in range(n)],sep='\n')

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
l=list(open(0).read().split())
print(*[l.count(str(i+1)) for i in range(n)],sep='\n')

Submission status: Wrong Answer

Solution code:
a, b = map(int, input().split())
c = {}
for i in range(b):
    d, e = map(int, input().split())
    if d not in c:
        c.setdefault(d, 1)
    else:
        c[d] += 1
    if e not in c:
        c.setdefault(e, 1)
    else:
        c[e] += 1
f = sorted(c.keys())
for i in f:
    print(c[i])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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
    print(dp)
for i in range(N):
    print(sum(dp[i]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
N,M = map(int,input().split())
mapping = defaultdict(list)
for i in range(M):
    a,b = map(int,input().split())
    mapping[a].append(b)
    mapping[b].append(a)
for m,mlist in sorted(mapping.items(),key=lambda x:x[0]):
    print(len(mlist))

Submission status: Wrong Answer

Solution code:
n,m = list(map(int,input().split(' ')))
#print(type(m))
road = []
for i in range(m):
  x,y =(list(map(int,input().split(' '))))
  road.append(x)
  road.append(y)

ans = list(set(road))
ans.sort()
#print(ans)  
#print(road)
for i in ans:
  print(road.count(i))

Submission status: Wrong Answer

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

print(cities)

roads = [0] * N
for city in cities:
  roads[city[0] - 1] += 1
  roads[city[1] - 1] += 1

for road in roads:
  print(road)

Submission status: Wrong Answer

Solution code:
n,m=map(int, input().split())
ab=[]
for i in range(m):
  ab.append(input())
nab="".join(ab)
cnt=0
for j in range(n):
    cnt=nab.count(str(j+1))
    print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int, input().split())
ab=[]
for i in range(m):
  ab.append(input())
nab="".join(ab)
cnt=0
for j in range(n):
    cnt=nab.count(str(j+1))
    print(cnt)

Submission status: Wrong Answer

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(n+1):
    print(rcnt[i])

Submission status: Wrong Answer

Solution code:
from sys import stdin
N, M = [int(_) for _ in stdin.readline().rstrip().split()]
AB = [list(map(int, stdin.readline().rstrip().split())) for _ in range(M)]
ans = {}
for r in AB:
    for c in r:
        if c not in ans:
            ans[c] = 1
        elif c in ans:
            ans[c] += 1
for v in ans.values():
    print(v)

Submission status: Wrong Answer

Solution code:
from sys import stdin
from itertools import chain
from collections import Counter
N, M = [int(_) for _ in stdin.readline().rstrip().split()]
AB = [list(map(int, stdin.readline().rstrip().split())) for _ in range(M)]
AB = Counter(chain.from_iterable(AB))
for v in AB.values():
    print(v)

Submission status: Wrong Answer

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.get(i))

Submission status: Wrong Answer

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)
for i in range(n):
    print(l.count(i))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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(len(z)):
    print(l.count(z[i]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
#ABC061B
N,M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]
ans =[]
for i in range(1,M+1):
    count=0
    for j in range(M):
        if ab[j][0] ==i:
            count +=1
        if ab[j][1] ==i:
            count +=1
    ans.append(count)
for a in ans:
    print(a)

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

for i in range(len(x)):
    print(l.count(x[i]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m = list(map(int, input().split()))
cities = [0 for i in range(n)]
for i in range(m):
    bridges = list(map(int, input().split()))
    cities = [i+1 if i+1 in bridges else i for i in cities]
print("\n".join(list(map(str, cities))))

Submission status: Wrong Answer

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

for i in range(n):
    ans = 0
    for x, y in bridge:
        if x == i or y == i:
            ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
import collections
n,m = map(int,input().split())
ab_list = [list(map(int, input().split())) for _ in range(m)]
tmp_list = []
for ab in ab_list:
    tmp_list.extend(ab)
c = collections.Counter(tmp_list)
for i in range(len(c)):
    print(c[i+1])

Submission status: Wrong Answer

Solution code:
import collections
n,m = map(int,input().split())
ab_list = [list(map(int, input().split())) for _ in range(m)]
tmp_list = []
for ab in ab_list:
    tmp_list.extend(ab)
tmp_list2 = sorted(tmp_list)
c = collections.Counter(tmp_list2)
for s,num in c.items():
    print(num)

Submission status: Wrong Answer

Solution code:
import collections
n,m = map(int,input().split())
ab_list = [list(map(int, input().split())) for _ in range(m)]
tmp_list = []
for ab in ab_list:
    tmp_list.extend(ab)
c = collections.Counter(sorted(tmp_list))
for s,num in c.items():
    print(num)

Submission status: Wrong Answer

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

countDic = {}

for ab in abm:
	countDic[ab[0]] = 0
	countDic[ab[1]] = 0
	
for ab in abm:
	countDic[ab[0]] += 1
	countDic[ab[1]] += 1

ks = countDic.keys()
ks = sorted(ks)

for k in ks:
	print(countDic[k])

Submission status: Wrong Answer

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-1].append(t-1)
  es[t-1].append(s-1)
for i in range(n):
  print(len(list(set(es[i]))))

Submission status: Wrong Answer

Solution code:
import collections

n, m = map(int, input().split())
l = [list(map(int, input().split())) for i in range(m)]
for i in range(m):
    tmp = l[i][1]
    l.append(tmp)
    l[i] = l[i][0]
c = collections.Counter(l)
for i in c.values():
    print(i)

Submission status: Wrong Answer

Solution code:
from itertools import chain
List=[[1,2,3],[4,5,6],[7,8,9]]
print(*chain(*List))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
roads = [list(map(lambda x:int(x)-1, input().split())) for _ in range(m)]

for r in roads:
    print(r)

arr = [0]*n
for r in roads:
    arr[r[0]] +=1
    arr[r[1]] +=1

for a in arr:
    print(a)

Submission status: Wrong Answer

Solution code:
from collections import Counter

N, M = list(map(int, input().split()))
ab = []

for i in range(M):
    ab.extend(list(map(int, input().split())))

ab.sort()
ab = Counter(ab)

for value in ab.values():
    print(value)

Submission status: Wrong Answer

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(int(s.count(str(k+1))))

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n,m=map(int,input().split())
d=defaultdict(list)
for s in range(m):
  a,b=map(int,input().split())
  d[a].append(b)
  d[b].append(a)
for k,v in d.items():
  print(len(v))

Submission status: Wrong Answer

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

ans = [0 for _ in range(m*n)]
length_array = []
for _ in range(m):
    a, b = map(int, input().split())
    length_array = list(set(length_array + [a, b]))
    ans[a-1] += 1
    ans[b-1] += 1

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

Submission status: Wrong Answer

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)
A = sorted(Counter(A).most_common())
for a in A:
    print(a[1])

Submission status: Wrong Answer

Solution code:
n,m=(int(i) for i in input().split())
#print(n,m)
mylist=[]
for i in range(m):
  a,b=(int(i) for i in input().split())
  mylist.append(a)
  mylist.append(b)
  
setlist=set(mylist)
listsetlist=list(setlist)
listsetlist.sort()
for i in range(len(listsetlist)):
  print(mylist.count(listsetlist[i]))

Submission status: Wrong Answer

Solution code:
n,m=(int(i) for i in input().split())
#print(n,m)
mylist=[]
for i in range(m):
  a,b=(int(i) for i in input().split())
  mylist.append(a)
  mylist.append(b)
  
setlist=set(mylist)
listsetlist=list(setlist)
for i in range(len(listsetlist)):
  print(mylist.count(listsetlist[i]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
int_n, int_m = map(int, input().split())

roads = dict()

for i in range(int_m):
    road = tuple(map(int, input().split()))

    for r in road:
        if r in roads:
            roads[r] += 1
        else:
            roads[r] = 1


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

Submission status: Wrong Answer

Solution code:
N,  M = [int(i) for i in input().split()]
citys = {}
for i in range(M):
    for c in [int(i) for i in input().split()]:
        if c in citys:
            citys[c] += 1
        else:
            citys[c] = 1

for key, val in sorted(citys.items()):
    print(val)

Submission status: Wrong Answer

Solution code:
N, M = [int(i) for i in input().strip().split()]
A=[]
for i in range(M):
    A.append(input().strip().split())
B =[]
for i in range(M):
    B.append(A[i][0])
    B.append(A[i][1])
for i in range(N):
    print(B.count(i+1))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N, M = map(int, input().split())

val = ",".join([input().replace(" ",",") for _ in range(M)])
for i in range(1, N+1):
    print(val.count(str(i)))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N, M = map(int, input().split())

val = "".join([input().replace(" ","") for _ in range(M)])
for i in range(1, N+1):
    print(val.count(str(i)))

Submission status: Wrong Answer

Solution code:
# coding: utf-8
N, M = map(int, input().split())
bridge = "".join(["".join(input().split()) for _ in range(M)])
for x in range(1,N+1):
    print(bridge.count(str(x)))

Submission status: Wrong Answer

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

for i in range(a[1]):
  c.append("".join(b[i]))
d = "".join(c)

e = list(d)
for i in range(1,a[0]+1):
  f = d.count(str(i))
  print(f)

Submission status: Wrong Answer

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

toshicount = collections.Counter(toshi)
print(toshicount)
for i in range(N):
    print(toshicount[i+1])

Submission status: Wrong Answer

Solution code:
import collections

n,m=map(int,input().split())
# a = []
# b = []
temp = []
for i in range(m):
    tempa,tempb = map(int,input().split())
    temp.append(tempa)
    temp.append(tempb)
temp.sort()
temp_count = collections.Counter(temp)
print(temp_count)
for i in range(1,n+1):
    print(temp_count[i])

Submission status: Wrong Answer

Solution code:
n, m = list(map(int, input().split()))
routes = []
for i in range(m):
  ri = list(map(int, input().split()))
  routes.extend(ri)
  
for i in range(n):
  print(routes.count(i))

Submission status: Wrong Answer

Solution code:
from collections import Counter
N,M=map(int, input().split())
A=[]
for i in range(M):
    tmp=list(map(int, input().split()))
    A.append(tmp[0])
    A.append(tmp[1])
Acnt=Counter(A).values()
for i in Acnt:
    print(i)

Submission status: Wrong Answer

Solution code:
a,b=map(int,input().split())
l=[list(map(int,input().split())) for _ in range(b)]
for i in range(1,a+1):
  print(sum(1 for i in l if i[0]==i or i[1]==i))

Submission status: Wrong Answer

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

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

c =collections.Counter(b)

for j in c.values():
    print(j)

Submission status: Wrong Answer

Solution code:
import sys

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

roads_count = dict([(i, set()) for i in range(1, n+1)])
for a_i, b_i in ab:
    roads_count[a_i].add(b_i)
    roads_count[b_i].add(a_i)
for key_num, connect_nums in sorted(roads_count.items()):
    print(len(connect_nums))

Submission status: Wrong Answer

Solution code:
import sys

n, m = map(int, sys.stdin.readline().split(" "))
ab_str = "".join(["" if len(set(line.split(" "))) == 1 else line for line in sys.stdin.read().split("\n")])

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

Submission status: Wrong Answer

Solution code:
import sys

n, m = map(int, sys.stdin.readline().split(" "))
ab_str = sys.stdin.read()

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

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n, k = map(int, input().split())
d = defaultdict(int)
for _ in [0]*k:
  a, b = map(int, input().split())
  d[a] += 1
  d[b] += 1
for i in range(n):
  print(d[i])

Submission status: Wrong Answer

Solution code:
"""
https://abc061.contest.atcoder.jp/tasks/abc061_b
"""
[n,m]=[int(i) for i in input().split()]
c=[]
d=""
for i in range(m):
    c.append(input().split())
#print(c)

for i in range(m):
    for j in range(2):
        d=d+str(c[i][j])
#print(d)
for i in range(1,n+1):
    print(d.count(str(i)))

Submission status: Wrong Answer

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

for i in range(N):
    ans = 0
    for j in range(M):
        if i in R[j]:
            ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
n,m = map(int, input().split())
ab = []
for _ in range(m):
    ab.append(list(map(int, input().split())))
ans = {}
for i in range(1, m+1):
    ans.update({i : 0})
for i in range(m):
    for j in range(2):
        if ab[i][j] in ans:
            ans[ab[i][j]] += 1
for v in ans.values():
    print(v)

Submission status: Wrong Answer

Solution code:
from collections import Counter

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

for j in range(M):
    for i in input().split():
        input_counter[int(i)] += 1

for element in input_counter.keys():
    print(input_counter[element])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
s=open(0).read()
for i in range(1,n+1):print(s.count(str(i)))

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
s=open(0).read()
for i in range(1,n+1):print(s.count(str(i+1)))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

Solution code:
from collections import Counter
def getinputdata():
    # 配列初期化
    array_result = []

    data = input()

    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if (data != ""):

                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:

        return array_result


arr_data = getinputdata()

n = int(arr_data[0][0])
m = int(arr_data[0][1])

arr=[]

for i in range(1,1+m):

    arr.append(int(arr_data[i][0]))
    arr.append(int(arr_data[i][1]))

list01=Counter(arr)

for k in sorted(list01):

    print(list01[k])

Submission status: Wrong Answer

Solution code:
from collections import Counter
def getinputdata():
    # 配列初期化
    array_result = []

    data = input()

    array_result.append(data.split(" "))

    flg = 1

    try:

        while flg:

            data = input()

            array_temp = []

            if (data != ""):

                array_result.append(data.split(" "))

                flg = 1

            else:

                flg = 0
    finally:

        return array_result


arr_data = getinputdata()

n = int(arr_data[0][0])
m = int(arr_data[0][1])

arr=[]

for i in range(1,1+m):

    arr.append(arr_data[i][0])
    arr.append(arr_data[i][1])

list01=Counter(arr)

for k in sorted(list01):

    print(list01[k])

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split());a=[]
for _ in[0]*m:a+=input()
for x in range(n):print(a.count(str(-~x)))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, M = map(int, input().split())
count_dct = {}
count_list = []
for _ in range(M):
    count_list.append(list(map(int, input().split())))
    
count_dct = {}
for i in count_list:
    a, b = i[0], i[1]
    if a in count_dct.keys():
        count_dct[a] += 1
    else:
        count_dct[a] = 1
    
    if b in count_dct.keys():
        count_dct[b] += 1
    else:
        count_dct[b] = 1
        
for i in sorted(count_dct.items()):
    print(i[1])

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,m=map(int,input().split())
line=[tuple(map(int,input().split()))for i in range(m)]
from collections import Counter
ans=[]
for i in range(m):
    ans.append(line[i][0])
    ans.append(line[i][1])
data=Counter(ans)
for i in data.values():
    print(i)

Submission status: Wrong Answer

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

for x in range(1, n+1):
    print(ab.count(str(x)))

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
import collections
dic = collections.defaultdict(lambda: 0)
for i in range(m):
    a, b = map(int, input().split())
    dic[a] += 1
    dic[b] += 1
for i in sorted(list(dic.keys())):
    print(dic[i])

Submission status: Wrong Answer

Solution code:
n,m = map(int,input().split())
lis = []
li = [0]*n
for i in range(m):
    a = list(map(int,input().split()))
    a.sort(reverse=True)
    b = 100*a[0] + a[1]
    if b not in lis:
        lis.append(b)
        li[a[0]-1] += 1
        li[a[1]-1] += 1
for t in range(n):print(li[t])

Submission status: Wrong Answer

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


count_dict = collections.Counter(num)
for k, v in count_dict.items():
    print (v)

Submission status: Wrong Answer

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

for i in range(1, m + 2):
  if not bridge.count(i) == 0:
    print(bridge.count(i))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict


def main():
    n, m = map(int, input().split())
    d = defaultdict(lambda: 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()

Submission status: Wrong Answer

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

print(li)

c = collections.Counter(li)

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

Submission status: Wrong Answer

Solution code:
import collections


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

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)

Submission status: Wrong Answer

Solution code:
# Counting Roads

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
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, m + 1)]

Submission status: Wrong Answer

Solution code:
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 value in info:
    print(value)

Submission status: Wrong Answer

Solution code:
from collections import OrderedDict
n, m = map(int, input().split())
info = OrderedDict()
for i in range(0, n + 1):
    info[i] = 0
for i in range(0, m):
    a, b = map(int, input().split())
    info[a] = info[a] + 1
    info[b] = info[b] + 1
for value in info.values():
    print(value)

Submission status: Wrong Answer

Solution code:
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(n):
    print d[p]

Submission status: Wrong Answer

Solution code:
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 sorted(d.keys()):
    print d[p]

Submission status: Wrong Answer

Solution code:
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 d.values():
    print p

Submission status: Wrong Answer

Solution code:
# ==================================================== #
# -*- coding: utf-8 -*
n, m = map(int, input().split())

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

Submission status: Wrong Answer

Solution code:
# ==================================================== #
# -*- coding: utf-8 -*
n, m = map(int, input().split())

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

Submission status: Wrong Answer

Solution code:
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 = {}
print(list(range(1,N+1,1)))
print(a)
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])

Submission status: Wrong Answer

Solution code:
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 = {}
print(list(range(1,N+1,1)))
print(a)
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])

Submission status: Wrong Answer

Solution code:
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))
print(hyou)
j = 1
while j <= N:
    print(hyou.count(j))
    j += 1