ZhenlongDai/ACPR huggingface dataset:
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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])


Failing test case input:
4 3
1 2
2 2
1 4

Expected output:
2
3
0
1


Actual output:
0
2
3
0


Fixed submission (verdict: Accepted):
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(1,N+1):
  print(table[i])

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict

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

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

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


Failing test case input:
11 7
2 4
3 4
1 5
2 8
2 7
8 2
4 1
0 14

Expected output:
2
4
1
3
1
0
1
2
0
0
0


Actual output:
2
4
1
3
1
1
2


Fixed submission (verdict: Accepted):
def int_input():
    line = input()
    return [int(x) for x in line.split()]

n, m = int_input()
cities = {}

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

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

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

Problem: p03720
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n,m = map(int,input().split())


dic = {}

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

    try:
        dic[a] += 1
    except:
        dic[a] = 1

    try:
        dic[b] += 1
    except:
        dic[b] = 1

dic = sorted(dic.items(),key=lambda x:x[0])

for i in dic:
    print(i[1])


Failing test case input:
8 7
2 3
3 4
1 5
2 8
1 7
8 2
4 1
0 14

Expected output:
3
3
2
2
1
0
1
2


Actual output:
3
3
2
2
1
1
2


Fixed submission (verdict: Accepted):
n,m = map(int,input().split())


dic = {}

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

    try:
        dic[a] += 1
    except:
        dic[a] = 1

    try:
        dic[b] += 1
    except:
        dic[b] = 1



for i in range(1,n+1):
    try:
        print(dic[i])
    except:
        print(0)
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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]))

Failing test case input:
11 1
2 4
3 4
1 5
2 8
4 7
8 2
4 1
0 14

Expected output:
0
1
0
1
0
0
0
0
0
0
0


Actual output:
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]
0
1
0
1
0
0
0
0
0
0
0


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())

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

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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))
  

Failing test case input:
8 7
1 2
5 8
1 5
1 8
3 7
5 2
4 1
6 8

Expected output:
4
2
1
1
3
0
1
2


Actual output:
0
4
2
1
1
3
0
1


Fixed submission (verdict: Accepted):
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+1))

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)


Failing test case input:
8 7
3 2
3 3
1 5
2 8
3 7
5 2
4 1
6 8

Expected output:
2
3
4
1
2
0
1
1


Actual output:
2
3
4
1
2
1
1


Fixed submission (verdict: Accepted):
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:
    print(i)

Problem: p03720
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):


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)

Failing test case input:
8 7
3 2
3 3
1 5
2 8
3 7
5 2
4 1
6 8

Expected output:
2
3
4
1
2
0
1
1


Actual output:
0
1
2
3
4
5
6
7


Fixed submission (verdict: Accepted):


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

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

for i in range(n):
    print(arr[i])
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = tuple(map(int,input().split()))

r = [[0]*n for _ in [0]*n]

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

for r_i in r:
  print(sum(r_i))

Failing test case input:
8 7
1 3
3 4
1 5
3 8
3 7
5 2
5 1
6 8

Expected output:
3
1
4
1
3
0
1
1


Actual output:
2
1
4
1
2
0
1
1


Fixed submission (verdict: Accepted):
n,m = tuple(map(int,input().split()))

r = [[0]*n for _ in [0]*n]

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

for r_i in r:
  print(sum(r_i))

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int,input().split())
Q=[]
for i in range(M):
    a=list(map(int,input().split()))
    Q.extend(a)
for i in range(M+1):
    if Q.count(i+1)!=0:
        print(Q.count(i+1))

Failing test case input:
8 7
1 3
3 4
1 5
4 8
3 7
1 4
4 1
6 14

Expected output:
4
0
3
4
1
0
1
1


Actual output:
4
3
4
1
1
1


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
Q=[]
for i in range(M):
    a=list(map(int,input().split()))
    Q.extend(a)
    
for i in range(1,N+1):
        print(Q.count(i))

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict
N, M = map(int, input().split())
city_road_nums = defaultdict(int)

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

for _, value in sorted(city_road_nums.items()):
    print(value)


Failing test case input:
8 7
1 2
3 4
1 5
1 8
3 7
5 2
4 1
6 8

Expected output:
4
2
2
2
2
0
1
1


Actual output:
4
2
2
2
2
1
1


Fixed submission (verdict: Accepted):
from collections import defaultdict
N, M = map(int, input().split())
city_road_nums = defaultdict(int)

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

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

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections

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


c = collections.Counter(sum(R,[])).values()
[print(item) for item in c]

Failing test case input:
8 7
1 3
3 4
1 5
2 8
3 7
5 2
5 1
6 8

Expected output:
3
2
3
1
3
0
1
1


Actual output:
3
3
1
3
2
1
1


Fixed submission (verdict: Accepted):
import collections

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


c = collections.Counter(sum(R,[]))
keys=c.keys()
for n in range(1,N+1):
  if n not in keys:
    print(0)
  else:
    print(c[n])
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int,input().split())
a = []
for i in range(M):
  K,S = map(int, input().split())
  a.append(K)
  a.append(S)
print(a)
for i in range(N):
  print(a.count(i+1))

Failing test case input:
8 8
1 2
3 4
1 5
2 8
3 7
5 2
4 2
6 8

Expected output:
2
4
2
2
2
1
1
2


Actual output:
[1, 2, 3, 4, 1, 5, 2, 8, 3, 7, 5, 2, 4, 2, 6, 8]
2
4
2
2
2
1
1
2


Fixed submission (verdict: Accepted):
N, M = map(int,input().split())
a = []
for i in range(M):
  K,S = map(int, input().split())
  a.append(K)
  a.append(S)
for i in range(N):
  print(a.count(i+1))

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
g = [[]] * n
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a] += [b]
    g[b] += [a]

for i in range(n):
    print(len(set(g[i])))


Failing test case input:
11 1
2 4
3 4
1 5
2 8
4 7
8 2
4 1
0 14

Expected output:
0
1
0
1
0
0
0
0
0
0
0


Actual output:
2
2
2
2
2
2
2
2
2
2
2


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    g[a] += [b]
    g[b] += [a]

for i in range(n):
    print(len(g[i]))

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
8 7
2 4
3 4
1 5
2 8
1 7
5 2
4 1
0 14

Expected output:
3
3
1
3
2
0
1
1


Actual output:
3
3
1
3
2
1
1


Fixed submission (verdict: Accepted):
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 = [0]*N
for r in AB:
    for c in r:
        ans[c-1] += 1
print(*ans, sep='\n')

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
8 8
1 2
6 4
2 5
2 8
1 7
3 2
4 2
6 8

Expected output:
2
5
1
2
1
2
1
2


Actual output:
2


Fixed submission (verdict: Accepted):
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)
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
dic = {}
for i in range(m):
	x, y = map(int, input().split())
	if x in dic:
		dic[x] += 1
	else:
		dic[x] = 1
	if y in dic:
		dic[y] += 1
	else:
		dic[y] = 1
for i,j in sorted(dic.items()):
	print (j)

Failing test case input:
8 7
1 3
3 4
1 5
3 8
3 7
1 2
4 1
6 14

Expected output:
4
1
4
2
1
0
1
1


Actual output:
4
1
4
2
1
1
1


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
dic = {}
for i in range(n):
	dic[i+1] = 0
for i in range(m):
	x, y = map(int, input().split())
	if x in dic:
		dic[x] += 1
	else:
		dic[x] = 1
	if y in dic:
		dic[y] += 1
	else:
		dic[y] = 1
for i,j in sorted(dic.items()):
	print (j)

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import itertools
n,m=map(int,input().split())
ab= [list(input()) for _ in range(m)]
ab=list(itertools.chain.from_iterable(ab))
k=len(set(ab))
for i in range(1,k+1):
    print(ab.count(i))

Failing test case input:
8 7
2 4
3 4
1 5
2 8
1 7
8 2
4 1
0 14

Expected output:
3
3
1
3
1
0
1
2


Actual output:
0
0
0
0
0
0
0
0


Fixed submission (verdict: Accepted):
import itertools
n,m=map(int,input().split())
ab= [list(map(int,input().split())) for _ in range(m)]
ab=list(itertools.chain.from_iterable(ab))
for i in range(1,n+1):
    print(ab.count(i))

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
ans = 0

roads_memo = [[None] for i in range(N)]

for _ in range(M):
    ai, bi = map(int, input().split())
    roads_memo[ai-1].append(bi)
    roads_memo[bi-1].append(ai)

for memo in roads_memo:
    del memo[0]
    memo = set(memo)
    print(len(memo))


Failing test case input:
2 5
1 2
2 1
1 2
2 1
1 2

Expected output:
5
5

Actual output:
1
1


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
ans = 0

roads_memo = [[None] for i in range(N)]

for _ in range(M):
    ai, bi = map(int, input().split())
    roads_memo[ai-1].append(bi)
    roads_memo[bi-1].append(ai)

for memo in roads_memo:
    del memo[0]
    print(len(memo))

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections

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


c = collections.Counter(sum(R,[]))
keys=c.keys()
for n in range(1,N+1):
  if n not in keys:
    print(n,0)
  else:
    print(n,c[n])

Failing test case input:
11 7
2 4
3 4
1 5
2 8
4 7
8 2
4 1
0 14

Expected output:
2
3
1
4
1
0
1
2
0
0
0


Actual output:
1 2
2 3
3 1
4 4
5 1
6 0
7 1
8 2
9 0
10 0
11 0


Fixed submission (verdict: Accepted):
import collections

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


c = collections.Counter(sum(R,[]))
keys=c.keys()
for n in range(1,N+1):
  if n not in keys:
    print(0)
  else:
    print(c[n])
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)


Failing test case input:
3 5
1 2
2 1
1 3
2 1
1 2

Expected output:
5
4
1


Actual output:
0
5
4
1


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

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int,input().rstrip().split(' '))
G = [[]]*n
for i in range(m):
  a,b = map(int,input().rstrip().split(' '))
  a-=1
  b-=1
  G[a].append(b)
  G[b].append(a)

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

Failing test case input:
8 7
1 6
3 3
1 5
2 8
3 7
1 2
4 1
6 8

Expected output:
4
2
3
1
1
1
1
1


Actual output:
14
14
14
14
14
14
14
14


Fixed submission (verdict: Accepted):
n,m = map(int,input().rstrip().split(' '))
G = [[] for i in range(n)]
for i in range(m):
  a,b = map(int,input().rstrip().split(' '))
  a-=1
  b-=1
  G[a].append(b)
  G[b].append(a)

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

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int,input().split())
array = [[]for i in range(n)]

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

for i in range(n):
  print(len(set(array[i])))
  

Failing test case input:
3 3
1 1
2 1
1 2
2 1
1 2

Expected output:
4
2
0


Actual output:
2
1
0


Fixed submission (verdict: Accepted):
n, m = map(int,input().split())
array = [[]for i in range(n)]

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

for i in range(n):
  print(len(array[i]))

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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])

Failing test case input:
8 7
2 4
3 4
1 5
2 8
1 7
5 2
4 1
0 14

Expected output:
3
3
1
3
2
0
1
1


Actual output:
0
1
2
3
4
5
6
3
3
1
3
2
0
1
1


Fixed submission (verdict: Accepted):
N,M=map(int, input().split())
result=[]
for i in range(N):
  result.append(0)
for j in range(M):
  a,b=map(int, input().split())
  result[a-1]+=1
  result[b-1]+=1
for k in range(N):
  print(result[k])
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())
res = {}
for _ in range(M):
    a,b = map(int,input().split())
    if a in res.keys():
        res[a] += 1
    else:
        res[a] = 1
    if b in res.keys():
        res[b] += 1
    else:
        res[b] = 1
for key in sorted(res.keys()):
    print(res[key])


Failing test case input:
8 8
1 2
1 4
2 5
2 8
1 7
3 2
4 2
3 8

Expected output:
3
5
2
2
1
0
1
2


Actual output:
3
5
2
2
1
1
2


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
res = {}
for i in range(1,N+1):
    res[i] = 0
for _ in range(M):
    a,b = map(int,input().split())
    res[a] += 1
    res[b] += 1
for key in sorted(res.keys()):
    print(res[key])

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N,M = map(int,input().split())
L = []
for i in range(M):
    a,b = map(int,input().split())
    L.append([a,b])
for m in range(1,N+1):
    ans = L.count(m)
    print(ans)

Failing test case input:
11 1
2 1
2 4
1 5
2 8
4 7
8 4
2 2
0 39

Expected output:
1
1
0
0
0
0
0
0
0
0
0


Actual output:
0
0
0
0
0
0
0
0
0
0
0


Fixed submission (verdict: Accepted):

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 m in range(1,N+1):
    ans = L.count(m)
    print(ans)

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

N, M = map(int,input().split())
city = [list(map(int, input().split())) for i in range(M)]
road = [0]*N

for i in range(N):
    count = 0
    for j in range(M):
        if i+1 == city[j][0]:
            count += 1
        else:
            pass
        if i+1 == city[j][1]:
            count += 1
        else:
            pass
    road[i] = count
print(road)
for k in range(N):
    print(road[k])


Failing test case input:
8 7
2 4
3 4
1 5
2 8
1 7
5 2
4 1
0 14

Expected output:
3
3
1
3
2
0
1
1


Actual output:
[3, 3, 1, 3, 2, 0, 1, 1]
3
3
1
3
2
0
1
1


Fixed submission (verdict: Accepted):

N, M = map(int,input().split())
city = [list(map(int, input().split())) for i in range(M)]
road = [0]*N

for i in range(N):
    count = 0
    for j in range(M):
        if i+1 == city[j][0]:
            count += 1
        else:
            pass
        if i+1 == city[j][1]:
            count += 1
        else:
            pass
    road[i] = count
for k in range(N):
    print(road[k])
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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])

Failing test case input:
3 5
1 1
2 1
1 2
2 1
1 3

Expected output:
6
3
1


Actual output:
[1, 2, 3]
[1, 1, 2, 1, 1, 2, 2, 1, 1, 3]
6
3
1


Fixed submission (verdict: Accepted):
N,M = map(int, input().split())
a = []
for i in range(M):
    tmp_l = map(int, input().split())
    for i in tmp_l:
        a.append(i)

itr = 0
count = 0
d = {}
for j in list(range(1,N+1,1)):
    d[j] = 0

for k in a:
    d[k] = d[k] + 1

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

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import itertools
n,m=map(int,input().split())
ab= [list(input()) for _ in range(m)]
ab=list(itertools.chain.from_iterable(ab))
for i in range(1,n+1):
    print(ab.count(i))

Failing test case input:
3 5
1 2
2 1
1 2
2 1
1 2

Expected output:
5
5
0


Actual output:
0
0
0


Fixed submission (verdict: Accepted):
import itertools
n,m=map(int,input().split())
ab= [list(map(int,input().split())) for _ in range(m)]
ab=list(itertools.chain.from_iterable(ab))
for i in range(1,n+1):
    print(ab.count(i))

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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) + ' '))

Failing test case input:
8 7
1 6
3 3
1 5
2 8
3 7
1 2
4 1
6 8

Expected output:
4
2
3
1
1
1
1
1


Actual output:
4
2
2
1
1
1
1
1


Fixed submission (verdict: Accepted):
from collections import Counter

N, M = map(int, input().split())
c = Counter(' '.join([input() for i in range(M)]).split())

for i in range(N):
    print(c[str(i + 1)])

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter

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

l = []

for _ in range(M):
    a, b = input().split()
    l.append(str(a))
    l.append(str(b))

c = Counter(l)

for k, v in c.items():
    print(v)

Failing test case input:
8 7
2 4
3 4
1 6
2 8
1 7
5 2
4 2
0 14

Expected output:
2
4
1
3
1
1
1
1


Actual output:
4
3
1
2
1
1
1
1


Fixed submission (verdict: Accepted):
from collections import Counter

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

l = []

for _ in range(M):
    a, b = input().split()
    l.append(str(a))
    l.append(str(b))





nums = [str(i) for i in range(1, N + 1, 1)]

for num in nums:
    print(l.count(num))
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int,input().split())

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

ans={}

for m in range(M):
  for road in roads[m]:
    if road in ans:
      ans[road]+=1
    else:
      ans[road]=1
print(ans)

for n in range(N):
  if str(n+1) in ans:
    print(ans[str(n+1)])
  else:
    print(0)


Failing test case input:
8 7
1 4
3 4
1 2
1 8
3 7
5 2
4 1
6 8

Expected output:
4
2
2
3
1
0
1
1


Actual output:
{'1': 4, '4': 3, '3': 2, '2': 2, '8': 1, '7': 1, '5': 1}
4
2
2
3
1
0
1
1


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())

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

ans={}

for m in range(M):
  for road in roads[m]:
    if road in ans:
      ans[road]+=1
    else:
      ans[road]=1

for n in range(N):
  if str(n+1) in ans:
    print(ans[str(n+1)])
  else:
    print(0)

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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]))


Failing test case input:
8 7
2 2
3 6
1 5
2 8
2 7
5 4
4 1
6 8

Expected output:
2
4
1
2
2
1
1
1


Actual output:
2
3
1
2
2
1
1
1


Fixed submission (verdict: Accepted):
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]))

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M  = map(int, input().split())

from collections import defaultdict

d = defaultdict(int)

for i in range(M):
    x, y  = map(int, input().split())
    d[x] += 1
    d[y] += 1

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

Failing test case input:
8 7
1 2
3 4
1 5
2 8
3 7
5 4
4 1
6 8

Expected output:
3
2
2
3
2
0
1
1


Actual output:
3
2
2
3
2
1
1


Fixed submission (verdict: Accepted):
N, M  = map(int, input().split())

d = dict.fromkeys(range(1, N+1), 0)

for i in range(M):
    x, y  = map(int, input().split())
    d[x] += 1
    d[y] += 1

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

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int,input().split())
road = []

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

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

Failing test case input:
8 8
1 2
3 4
1 5
2 8
3 5
5 2
1 2
6 8

Expected output:
3
4
2
1
3
1
0
2


Actual output:
0
0
0
0
0
0
0
0


Fixed submission (verdict: Accepted):
n,m = map(int,input().split())
road = []

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

road = sum(road,[])

    
for j in range(n):
   print (road.count(j+1))
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import defaultdict
n, m = map(int, input().split())
d = defaultdict(int)
for _ in range(m):
  a, b = input().split()
  d[a] += 1
  d[b] += 1
for i in range(n):
  print(d[i + 1])

Failing test case input:
8 7
2 4
3 4
1 5
2 8
1 7
5 2
4 2
0 14

Expected output:
2
4
1
3
2
0
1
1


Actual output:
0
0
0
0
0
0
0
0


Fixed submission (verdict: Accepted):
from collections import defaultdict
n, m = map(int, input().split())
d = defaultdict(int)
for _ in range(m):
  a, b = input().split()
  d[a] += 1
  d[b] += 1
for i in range(n):
  print(d[str(i + 1)])

Problem: p03720
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import Counter
N, M = map(int, input().split())
dis_list = []
my_count = Counter()
for i in range(M):
    a, b = list(map(int, input().split()))
    my_count[a] += 1
    my_count[b] += 1
for i in my_count.values():
    print(i)

Failing test case input:
3 3
1 1
2 2
2 2
2 1
1 2

Expected output:
2
4
0


Actual output:
2
4


Fixed submission (verdict: Accepted):
from collections import Counter
N, M = map(int, input().split())
dis_list = []
my_count = Counter()
for i in range(1, N + 1):
    my_count[i] = 0
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])

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
8 5
1 3
3 4
1 5
2 8
3 7
5 2
4 1
6 8

Expected output:
2
1
3
1
1
0
1
1


Actual output:
2
1
3
1
1
1
1


Fixed submission (verdict: Accepted):
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 = Counter(ab)

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

Problem: p03720
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m = map(int,input().split())
s = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    s[a-1].append(b)
    s[b-1].append(a)
for i in s:
    print(len(set(i)))

Failing test case input:
8 8
1 2
3 4
2 5
2 8
3 7
5 2
4 2
6 8

Expected output:
1
5
2
2
2
1
1
2


Actual output:
1
4
2
2
1
1
1
2


Fixed submission (verdict: Accepted):
n,m = map(int,input().split())
s = [[] for i in range(n)]
for i in range(m):
    a,b = map(int,input().split())
    s[a-1].append(b)
    s[b-1].append(a)
for i in s:
    print(len(i))
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
city = {}
for i in ab:
  for j in i:
    if j not in city:
      city[j] = 1
    else:
      city[j] += 1
for k, v in sorted(city.items()):
  print(v)

Failing test case input:
12 0
0 3
2 0
0 4

Expected output:
0
0
0
0
0
0
0
0
0
0
0
0


Actual output:

Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
city = {}
for i in ab:
  for j in i:
    if j not in city:
      city[j] = 1
    else:
      city[j] += 1
for number in range(1, n+1):
  if number in city:
    print(city[number])
  else:
    print(0)

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter


def main():
    n, m = map(int, input().split())
    ABs = [list(map(int, input().split())) for _ in range(m)]
    ABs = [b for a in ABs for b in a]
    anss = Counter(ABs)
    anss = sorted(anss.items(), key=lambda x: x[0])
    for ans in anss:
        print(ans[1])


if __name__ == "__main__":
    main()


Failing test case input:
8 8
1 2
3 4
2 5
2 8
3 5
5 2
1 2
5 5

Expected output:
2
5
2
1
5
0
0
1


Actual output:
2
5
2
1
5
1


Fixed submission (verdict: Accepted):
def main():
    n, m = map(int, input().split())
    ABs = [list(map(int, input().split())) for _ in range(m)]
    anss = [0]*n
    for AB in ABs:
        anss[AB[0]-1] += 1
        anss[AB[1]-1] += 1
    for ans in anss:
        print(ans)


if __name__ == "__main__":
    main()

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
ABs = [input().split() for i in range(M)]


MPs = {}
for a, b in sorted(ABs, key=lambda i: i[1]):
    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 x, y in sorted(MPs.items(), key=lambda j: j[0]):
    print(y)

Failing test case input:
8 7
2 2
3 4
1 5
2 8
3 7
5 2
4 1
6 8

Expected output:
2
4
2
2
2
0
1
1


Actual output:
2
4
2
2
2
1
1


Fixed submission (verdict: Accepted):
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)

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
r = [0]*N
for _ in range(M):
    a, b = map(int, input().split())
    r[a-1]+1
    r[b-1]+1
for rr in r:
    print(rr)

Failing test case input:
8 7
2 2
3 3
1 5
2 8
3 7
5 2
4 1
6 8

Expected output:
2
4
3
1
2
0
1
1


Actual output:
0
0
0
0
0
0
0
0


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
r = [0]*N
for _ in range(M):
    a, b = map(int, input().split())
    r[a-1] += 1
    r[b-1] += 1
for rr in r:
    print(rr)
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
import sys

[N, M] = list(map(int, stdin.readline().rstrip().split()))

a = []
for i in range(M):
    a.append(list(map(int, stdin.readline().rstrip().split())))

city = [[] for i in range(N+1)]

for i in range(M):
    [s, d] = a[i]
    city[s].append(d)
    city[d].append(s)

for i in range(1, N+1):
    if len(city[i]) > 0:
        print(len(city[i]))


Failing test case input:
8 7
3 2
3 3
1 5
2 8
3 7
5 2
4 1
6 8

Expected output:
2
3
4
1
2
0
1
1


Actual output:
2
3
4
1
2
1
1


Fixed submission (verdict: Accepted):
from sys import stdin
import sys

[N, M] = list(map(int, stdin.readline().rstrip().split()))

a = []
for i in range(M):
    a.append(list(map(int, stdin.readline().rstrip().split())))

city = [[] for i in range(N+1)]

for i in range(M):
    [s, d] = a[i]
    city[s].append(d)
    city[d].append(s)

for i in range(1, N+1):
    if len(city[i]) >= 0:
        print(len(city[i]))

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)


Failing test case input:
8 3
1 2
3 4
2 5
2 8
3 5
5 3
1 2
5 2

Expected output:
1
2
1
1
1
0
0
0


Actual output:
1
2
1
1
1


Fixed submission (verdict: Accepted):
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=dict(Counter(A).items())
for i in range(1,N+1):
    if i in Acnt:
        print(Acnt[i])
    else:
        print(0)

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int, input().split())
r=[0]*n
for _ in range(m):
    a,b=map(int, input().split())
    r[a-1]+=1
    r[b-1]+=1

for i in r:
    if i!=0:
        print(i)

Failing test case input:
3 5
1 2
2 1
1 2
1 1
1 2

Expected output:
6
4
0


Actual output:
6
4


Fixed submission (verdict: Accepted):
n,m=map(int, input().split())
r=[0]*n
for _ in range(m):
    a,b=map(int, input().split())
    r[a-1]+=1
    r[b-1]+=1

for i in r:
    print(i)

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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()

Failing test case input:
11 7
2 4
3 4
1 5
2 8
8 7
8 2
4 1
0 14

Expected output:
2
3
1
3
1
0
1
3
0
0
0


Actual output:
2
3
1
3
1
1
3


Fixed submission (verdict: Accepted):
from collections import defaultdict


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

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

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


if __name__ == "__main__":
    main()
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
ans = [0] * N
for i in range(M):
  a, b = map(int, input().split())
  ans[a - 1] += 1
  ans[b - 1] += 1
for i in range(N):
  print(ans)


Failing test case input:
8 8
1 2
3 6
2 5
2 8
1 7
3 2
4 2
6 8

Expected output:
2
5
2
1
1
2
1
2


Actual output:
[2, 5, 2, 1, 1, 2, 1, 2]
[2, 5, 2, 1, 1, 2, 1, 2]
[2, 5, 2, 1, 1, 2, 1, 2]
[2, 5, 2, 1, 1, 2, 1, 2]
[2, 5, 2, 1, 1, 2, 1, 2]
[2, 5, 2, 1, 1, 2, 1, 2]
[2, 5, 2, 1, 1, 2, 1, 2]
[2, 5, 2, 1, 1, 2, 1, 2]


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
ans = [0] * N
for _ in range(M):
  a, b = map(int, input().split())
  ans[a - 1] += 1
  ans[b - 1] += 1
print(*ans, sep="\n")

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b=map(int,input().split())
L=[]
for i in range(b):
   L.append(list(map(int,input().split())))
for i in range(b):
      print(L.count(i+1))
       

Failing test case input:
8 8
1 2
3 4
2 5
2 8
3 5
5 2
1 2
5 2

Expected output:
2
6
2
1
4
0
0
1


Actual output:
0
0
0
0
0
0
0
0


Fixed submission (verdict: Accepted):
a,b=map(int,input().split())
L=[]
for i in range(1,b+1):
    L +=[int(x) for x in input().split()]
for j in range(1,a+1):
      print(L.count(j))

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int,input().split())
a = []
b = []
for i in range(M):
    a.append(list(map(int, input().split())))
print (a)
a=[flatten for inner in a for flatten in inner]
 
for i in range(N):
    b.append((a.count(i+1)))


c = list(map(str, b))

answer = '\n'.join(c)
print(answer)

Failing test case input:
8 7
2 2
3 6
1 8
2 8
3 7
5 2
4 1
6 0

Expected output:
2
4
2
1
1
1
1
2


Actual output:
[[2, 2], [3, 6], [1, 8], [2, 8], [3, 7], [5, 2], [4, 1]]
2
4
2
1
1
1
1
2


Fixed submission (verdict: Accepted):
N, M = map(int,input().split())
a = []
b = []
for i in range(M):
    a.append(list(map(int, input().split())))

a=[flatten for inner in a for flatten in inner]
 
for i in range(N):
    b.append((a.count(i+1)))


c = list(map(str, b))

answer = '\n'.join(c)
print(answer)

Problem: p03720
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N,M = map(int,input().split())
def in_dic(s,dic):
    if((s in dic) == False):
        dic[s] = 1
    else:
        dic[s] += 1
dic = {}
for i in range(M):
    a,b = map(int,input().split())
    in_dic(a,dic)
    in_dic(b,dic)
for key,value in dic.items():
    print(value)

Failing test case input:
8 8
1 2
3 4
2 5
2 8
3 7
5 2
5 4
6 8

Expected output:
1
4
2
2
3
1
1
2


Actual output:
1
4
2
2
3
2
1
1


Fixed submission (verdict: Accepted):
N,M = map(int,input().split())
dic = {}
for i in range(1,N+1):
    dic[i] = 0
for i in range(M):
    a,b = map(int,input().split())
    dic[a] += 1
    dic[b] += 1
for key,value in dic.items():
    print(value)
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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])


Failing test case input:
3 3
1 1
2 1
2 2
2 1
1 2

Expected output:
3
3
0


Actual output:
Counter({1: 3, 2: 3})
3
3
0


Fixed submission (verdict: Accepted):
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)
for i in range(N):
    print(toshicount[i+1])

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int,input().split())
Q=[]
for i in range(M):
    a=list(map(int,input().split()))
    Q.extend(a)
for i in range(1,N+1):
    if Q.count(i)!=0:
        print(Q.count(i))

Failing test case input:
8 7
2 3
3 4
1 5
3 8
3 7
5 2
5 1
6 8

Expected output:
2
2
4
1
3
0
1
1


Actual output:
2
2
4
1
3
1
1


Fixed submission (verdict: Accepted):
N,M=map(int,input().split())
Q=[]
for i in range(M):
    a=list(map(int,input().split()))
    Q.extend(a)
    
for i in range(1,N+1):
        print(Q.count(i))

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import Counter


def main():
    n, m = map(int, input().split())
    ABs = [list(map(int, input().split())) for _ in range(m)]
    ABs = [b for a in ABs for b in a]
    anss = Counter(ABs)
    for ans in anss.values():
        print(ans)


if __name__ == "__main__":
    main()


Failing test case input:
11 1
2 8
3 4
1 5
2 8
4 7
8 2
4 1
0 14

Expected output:
0
1
0
0
0
0
0
1
0
0
0


Actual output:
1
1


Fixed submission (verdict: Accepted):
def main():
    n, m = map(int, input().split())
    ABs = [list(map(int, input().split())) for _ in range(m)]
    anss = [0]*n
    for AB in ABs:
        anss[AB[0]-1] += 1
        anss[AB[1]-1] += 1
    for ans in anss:
        print(ans)


if __name__ == "__main__":
    main()

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)

Failing test case input:
11 1
2 3
2 4
1 5
2 8
4 7
8 4
2 1
0 22

Expected output:
0
1
1
0
0
0
0
0
0
0
0


Actual output:
1
1


Fixed submission (verdict: Accepted):
from itertools import chain
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)
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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])

Failing test case input:
3 5
1 2
2 1
1 2
2 1
1 2

Expected output:
5
5
0


Actual output:
5
5


Fixed submission (verdict: Accepted):
from itertools import chain
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)

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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)


Failing test case input:
8 8
1 2
3 4
2 5
2 8
3 7
5 2
4 2
6 8

Expected output:
1
5
2
2
2
1
1
2


Actual output:
[1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 2, 5, 2, 8, 3, 7, 5, 2, 4, 2, 6, 8]
1
5
2
2
2
1
1
2


Fixed submission (verdict: Accepted):
import collections


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

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


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

c = collections.Counter(li)

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

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M=map(int, input().split())
dic={n:0 for n in range(1,N)}
for n in range(M):
    for x in map(int, input().split()):
        dic[x]=1
[print(v) for v in dic.values()]


Failing test case input:
12 0
0 3
2 0
0 4

Expected output:
0
0
0
0
0
0
0
0
0
0
0
0


Actual output:
0
0
0
0
0
0
0
0
0
0
0


Fixed submission (verdict: Accepted):
N,M=map(int, input().split())
dic={n:0 for n in range(1,N+1)}
for n in range(M):
    a,b=map(int, input().split())
    dic[a]+=1
    dic[b]+=1
for v in dic.values():        
    print(v)

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
for i in range(m) :
    a[i], b[i] = map(int, input().split())
loute = a + b
for i in range(n) :
    print(loute.count(i))

Failing test case input:
8 8
1 2
3 4
1 5
2 8
3 5
5 2
1 2
5 5

Expected output:
3
4
2
1
5
0
0
1


Actual output:
0
3
4
2
1
5
0
0


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
for i in range(m) :
    a[i], b[i] = map(int, input().split())
loute = a + b
for i in range(n) :
    print(loute.count(i + 1))
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
A=[0]*n
print(A)
for i in range(m):
    a,b=map(int,input().split())
    A[a-1] += 1
    A[b-1] += 1
for h in range(n):
    print(A[h])

Failing test case input:
8 7
1 2
3 4
1 5
2 8
3 7
5 4
4 1
6 8

Expected output:
3
2
2
3
2
0
1
1


Actual output:
[0, 0, 0, 0, 0, 0, 0, 0]
3
2
2
3
2
0
1
1


Fixed submission (verdict: Accepted):
N,M = map(int, input().split())
A=[0]*N
for i in range(M):
    a,b=map(int,input().split())
    A[a-1] += 1
    A[b-1] += 1
for h in range(N):
    print(A[h])

Problem: p03720
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n,m = map(int,input().split())
lst = [[] for i in range(n)]
for _ in range(m):
    a,b = map(int,input().split())
    lst[a-1].append(b-1)
    lst[b-1].append(a-1)
print(lst)

for v in lst:
    print(len(v))

Failing test case input:
10 1
2 4
3 4
1 5
2 8
4 7
8 4
4 1
0 22

Expected output:
0
1
0
1
0
0
0
0
0
0


Actual output:
[[], [3], [], [1], [], [], [], [], [], []]
0
1
0
1
0
0
0
0
0
0


Fixed submission (verdict: Accepted):
n,m = map(int,input().split())
lst = [[] for i in range(n)]
for _ in range(m):
    a,b = map(int,input().split())
    lst[a-1].append(b-1)
    lst[b-1].append(a-1)

for v in lst:
    print(len(v))

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
x_l=[]
for i in range(m):
    x_l+= list(map(int,input().split()))



dic={}
for i in x_l:
    if i not in dic:
        dic[i]=1
    else:dic[i]+=1

for i in range(n+1):
    if i not in dic:
        continue
    else: print(dic[i])


Failing test case input:
8 7
3 2
3 3
1 5
2 8
3 7
5 2
4 1
6 8

Expected output:
2
3
4
1
2
0
1
1


Actual output:
2
3
4
1
2
1
1


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
x_l=[]
for i in range(m):
    x_l+= list(map(int,input().split()))
dic={}
for i in x_l:
    if i not in dic:
        dic[i]=1
    else:dic[i]+=1

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

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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])


Failing test case input:
8 8
1 2
3 4
2 5
2 8
3 7
5 2
4 3
6 8

Expected output:
1
4
3
2
2
1
1
2


Actual output:
[1, 2, 3, 4, 5, 6, 7, 8]
[1, 2, 3, 4, 2, 5, 2, 8, 3, 7, 5, 2, 4, 3, 6, 8]
1
4
3
2
2
1
1
2


Fixed submission (verdict: Accepted):
N,M = map(int, input().split())
a = []
for i in range(M):
    tmp_l = map(int, input().split())
    for i in tmp_l:
        a.append(i)

itr = 0
count = 0
d = {}
for j in list(range(1,N+1,1)):
    d[j] = 0

for k in a:
    d[k] = d[k] + 1

for o in list(range(1,N+1,1)):
    print(d[o])
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
root_dic = {}
for i in range(M):
    root = list(map(int, input().split()))
    for i in range(2):
        if root[i] in root_dic:
            root_dic[root[i]] += 1
        else:
            root_dic[root[i]] = 1
for i, v in sorted(root_dic.items()):
    print(v)

Failing test case input:
8 7
1 3
3 4
1 5
2 8
3 7
5 2
4 1
6 8

Expected output:
3
2
3
2
2
0
1
1


Actual output:
3
2
3
2
2
1
1


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
root_dic = {}
for i in range(N):
    root_dic[i+1] = 0
for i in range(M):
    root = list(map(int, input().split()))
    for i in range(2):
        root_dic[root[i]] += 1
for i, v in sorted(root_dic.items()):
    print(v)

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m=map(int,input().split())
x_l=[]
for i in range(m):
    x_l+= list(map(int,input().split()))



dic={}
for i in x_l:
    if i not in dic:
        dic[i]=1
    else:dic[i]+=1

for i in range(m+1):
    if i not in dic:
        continue
    else: print(dic[i])

Failing test case input:
5 5
1 2
2 1
1 2
1 1
1 2

Expected output:
6
4
0
0
0


Actual output:
6
4


Fixed submission (verdict: Accepted):
n,m=map(int,input().split())
x_l=[]
for i in range(m):
    x_l+= list(map(int,input().split()))
dic={}
for i in x_l:
    if i not in dic:
        dic[i]=1
    else:dic[i]+=1

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

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n,m = map(int,input().split())
a_all = []
b_all = []
for i in range(m):
    a,b = map(int,input().split())
    a_all.append(a-1)
    b_all.append(b-1)
for j in range(n):
    c = set()
    for k in range(m):
        if a_all[k] == j:
            c.add(b_all[k])
        if b_all[k] == j:
            c.add(a_all[k])
    print(len(c))

Failing test case input:
8 8
1 2
3 4
1 5
2 8
3 5
5 2
1 2
6 8

Expected output:
3
4
2
1
3
1
0
2


Actual output:
2
3
2
1
3
1
0
2


Fixed submission (verdict: Accepted):
n,m = map(int,input().split())
a_all = []
b_all = []
for i in range(m):
    a,b = map(int,input().split())
    a_all.append(a-1)
    b_all.append(b-1)
for j in range(n):
    c = list()
    for k in range(m):
        if a_all[k] == j:
            c.append(b_all[k])
        if b_all[k] == j:
            c.append(a_all[k])
    print(len(c))