ZhenlongDai/ACPR huggingface dataset:
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 mp in range(1, N+1):
    if str(mp) not in MPs:
        MPs[str(mp)] = '0'

for x, y in sorted(MPs.items()):
    print(y)

Failing test case input:
11 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
0
0
0


Actual output:
3
0
0
3
1
3
1
0
1
2
0


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


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

Expected output:
5
4
1


Actual output:
5
4
1
0
0


Fixed submission (verdict: Accepted):
n,m = map(int, input().split())
ab = []
for _ in range(m):
    ab.append(list(map(int, input().split())))
ans = {}
for i in range(1, n+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)

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(N+1):
    if Q.count(i+1)!=0:
        print(Q.count(i+1))

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

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


Actual output:
1
1
2


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


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

Expected output:
4
5
1


Actual output:
[4, 5, 1]


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.8.2), verdict: Wrong Answer):
from collections import Counter
from operator import itemgetter
N, M = map(int, input().split())
dis_list = []
my_count = Counter()
for i in range(M):
    a, b = map(int, input().split())
    my_count[a] += 1
    my_count[b] += 1
my_count = sorted(my_count.items())
for i in my_count:
    print(i[1])

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


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):
t,l=map(int,input().split())
li=[set() for i in range(t)]
for i in range(l):
  a,b= map(int,input().split())
  li[a-1].add(b)
  li[b-1].add(a)
for i in li:
  print(len(i))

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

Expected output:
3
2
3
0
3
0
2
1


Actual output:
2
2
2
0
2
0
1
1


Fixed submission (verdict: Accepted):
t,l=map(int,input().split())
li=[0 for i in range(t)]
for i in range(l):
  a,b= map(int,input().split())
  li[a-1]+=1
  li[b-1]+=1
print(*li,sep="\n")

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

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

Expected output:
5
4
1


Actual output:
2
1
1


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

l = [list(map(int, input().split())) for _ in range(m)]

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

for i in l:
    l2[i[0] - 1][i[1] - 1], l2[i[1] - 1][i[0] - 1] = 1, 1

for i in l2:
    print(sum(i))


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

Expected output:
6
3
1


Actual output:
3
1
1


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

l = [list(map(int, input().split())) for _ in range(m)]

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

for i in l:
    l2[i[0] - 1][i[1] - 1] += 1
    l2[i[1] - 1][i[0] - 1] += 1

for i in l2:
    print(sum(i))
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)
tmp_list2 = sorted(tmp_list)
c = collections.Counter(tmp_list2)
for s,num in c.items():
    print(num)

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

Expected output:
0
0
0
0
0
0


Actual output:

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

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

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

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

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

ls.sort()
aa = collections.Counter(ls)

for k in aa.values():
    print(k)


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())
ls = []

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

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

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

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

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

aa = collections.Counter(ls)
aa = sorted(aa.items())

for a in aa:
    print(a[1])


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):
n, m = map(int, input().split())
ls = []

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

for i in range(1, n+1):
    print(ls.count(i))
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)
c = sorted(dict(c).items(), key=lambda x:x[0])

for v in c:
    print(v[1])

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:
3
1
4
1
3
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):
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])






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):
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 range(1, int_n + 1):
    print("0" if i not in roads else roads[i])

Problem: p03720
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import itertools
from collections import Counter
from typing import List


def answer(n: int, m: int, ab_s: List[List[int]]) -> List[int]:
    counter = Counter(itertools.chain.from_iterable(ab_s))
    roads = list(i[1] for i in sorted(counter.items()))
    return roads


def main():
    n, m = map(int, input().split())
    ab_s = [list(map(int, input().split())) for _ in range(m)]
    for i in answer(n, m, ab_s):
        print(i)


if __name__ == '__main__':
    main()

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

Expected output:
3
4
2
1
4
0
0
2


Actual output:
3
4
2
1
4
2


Fixed submission (verdict: Accepted):
from typing import List


def answer(n: int, m: int, ab_s: List[List[int]]) -> List[int]:
    roads = [0 for _ in range(n)]
    for ab in ab_s:
        a, b = ab
        roads[a - 1] += 1
        roads[b - 1] += 1

    return roads


def main():
    n, m = map(int, input().split())
    ab_s = [list(map(int, input().split())) for _ in range(m)]
    for i in answer(n, m, ab_s):
        print(i)


if __name__ == '__main__':
    main()
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n, m = map(int, input().split())

road_list = [0] * n

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

for road in road_list:
  if(road != 0):
    print(road)

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

road_list = [0] * n

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

for road in road_list:
  print(road)

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


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


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

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

print(n,m,x_l)

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

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:
8 7 [2, 4, 3, 4, 1, 5, 2, 8, 1, 7, 5, 2, 4, 2]
{2: 4, 4: 3, 3: 1, 1: 2, 5: 2, 8: 1, 7: 1}
2
4
1
3
2
0
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 (PyPy3 (2.4.0), verdict: Wrong Answer):


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)

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

Expected output:
3
3
0


Actual output:
0
1
2


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 = 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(set(g[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())
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):
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)

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

Expected output:
0
0
0
0
0
0
0
0


Actual output:
[]
0
0
0
0
0
0
0
0


Fixed submission (verdict: Accepted):
N, M = map(int, input().split())
cities = [list(map(int, input().split())) for _ in range(M)]

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

for road in roads:
  print(road)

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

nm = a+b

ans = [0 for i in range(N)]
for j in range(0,(len(nm))):
    i = nm[j]
    ans[i-1] += 1


print(ans)


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

Expected output:
3
4
2
1
4
1
0
1


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


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

nm = a+b

ans = [0 for i in range(N)]
for j in range(0,(len(nm))):
    i = nm[j]
    ans[i-1] += 1

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

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

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

count_dict = collections.Counter(roads)

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

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:
3
4
2
1
3
2
1


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

for i in range(1,N+1):
    cnt = 0
    for j in roads:
        if j == i:
            cnt+=1
    print(cnt)
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = list(map(int, input().split()))
paths = [list(map(int, input().split())) for _ in range(M)]

roads = {i : 0 for i in range(N)}
for path in paths:
  roads[path[0]-1] +=1
  roads[path[1]-1] +=1

for i in range(N):
  if not roads[i] == 0:
    print(roads[i])

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

Expected output:
3
4
3
1
3
1
0
1


Actual output:
3
4
3
1
3
1
1


Fixed submission (verdict: Accepted):
N, M = list(map(int, input().split()))
paths = [list(map(int, input().split())) for _ in range(M)]

roads = {i : 0 for i in range(N)}
for path in paths:
  roads[path[0]-1] +=1
  roads[path[1]-1] +=1

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

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

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


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

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

Expected output:
4
2
4
1
1
0
1
1


Actual output:
Counter({1: 4, 3: 4, 2: 2, 4: 1, 5: 1, 7: 1, 8: 1})
4
2
4
1
1
0
1
1


Fixed submission (verdict: Accepted):
import collections

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


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)

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

Problem: p03720
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,m = inpl()
res = [[False] * n for i in range(n)]
for i in range(m):
    a,b = inpl()
    res[a-1][b-1] = True
    res[b-1][a-1] = True
for i in range(n):
    print(res[i].count(True))


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

Expected output:
4
1
2
3
2
0
1
1


Actual output:
3
1
2
2
2
0
1
1


Fixed submission (verdict: Accepted):
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,m = inpl()
res = [[0] * n for i in range(n)]
for i in range(m):
    a,b = inpl()
    res[a-1][b-1] += 1
    res[b-1][a-1] += 1
for i in range(n):
    print(sum(res[i]))
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())

ans = dict()
for i in range(M):
    a, b = map(int, input().split())
    if a in ans:
        ans[a] += 1
    else:
        ans[a] = 1
    if b in ans:
        ans[b] += 1
    else:
        ans[b] = 1
        
ans = sorted(ans.items(), key=lambda x:x[0])
for k, v in ans:
    print(v)

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

Expected output:
4
3
2
1
3
1
0
2


Actual output:
4
3
2
1
3
1
2


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

ans = dict()
for i in range(1, N+1):
    ans[i] = 0

for i in range(M):
    a, b = map(int, input().split())
    if a in ans:
        ans[a] += 1
    if b in ans:
        ans[b] += 1
        
ans = sorted(ans.items(), key=lambda x:x[0])
for k, v in ans:
    print(v)

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

n,m=map(int, input().split())
l=[]
for i in range(m):
  x,y=map(int, input().split())
  l.extend([x,y])
d={key:l.count(key) for key in set(l)}
for i in d.values():
  print(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:
4
2
1
1
3
1
2


Fixed submission (verdict: Accepted):

import collections as col
n,m=map(int, input().split())
l=[]
for i in range(m):
  x,y=map(int, input().split())
  l.extend([x,y])

d=col.defaultdict(int, col.Counter(l))

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

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 mp in range(N):
    if mp in MPs:
        MPs[mp] = 0

for x, y in sorted(MPs.items(), key=lambda j: j[0]):
    print(y)

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:
3
4
2
1
3
1
2


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())
ans = []
for i in range(M):
    a, b = map(int, input().split())
    ans.append(a)
    ans.append(b)

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

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:
[1, 2, 3, 4, 2, 5, 2, 8, 3, 5, 5, 2, 1, 2, 5, 5]
2
5
2
1
5
0
0
1


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

for i in range(1,N+1):
    print(ans.count(i))
Problem: p03720
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N, M = input().split(' ')
N = int(N)
M = int(M)
citys = []
for i in range(M):
  a, b = input().split(' ')
  a = int(a)
  b = int(b)
  citys.append(a)
  citys.append(b)
print(citys)
for i in range(1, N+1):
  print(citys.count(i))

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

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


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


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

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

for _ in range(N):
    V.append(set())

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

for node in range(N):
    print(len(V[node]))

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

Expected output:
5
3
2


Actual output:
2
1
1


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

for _ in range(N):
    V.append(0)

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

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

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

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

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:
0
2
0
0
0
0
0
0


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

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

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

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

Expected output:
0
0
0
0
0
0
0
0


Actual output:

Fixed submission (verdict: Accepted):
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 s in range(1,n+1):
  print(len(d[s]))
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N,M = map(int,input().split())

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

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

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:
[[1, 4, 7, 3], [0, 4], [6], [0], [7, 0, 1], [], [2], [4, 0]]
4
2
1
1
3
0
1
2


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

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

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

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

ans = dict()
for i in range(M):
    a, b = map(int, input().split())
    if a in ans:
        ans[a] += 1
    else:
        ans[a] = 1
    if b in ans:
        ans[b] += 1
    else:
        ans[b] = 1
        
for v in ans.values():
    print(v)


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

Expected output:
0
0
0
0
0
0
0
0


Actual output:

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

ans = dict()
for i in range(1, N+1):
    ans[i] = 0

for i in range(M):
    a, b = map(int, input().split())
    if a in ans:
        ans[a] += 1
    if b in ans:
        ans[b] += 1
        
ans = sorted(ans.items(), key=lambda x:x[0])
for k, v in ans:
    print(v)

Problem: p03720
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import defaultdict
N, M = map(int, input().split())
d = defaultdict(int)
for _ in range(M):
    a, b = map(int, input().split())
    d[a] += 1
    d[b] += 1

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

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

Expected output:
3
4
2
1
4
0
1
1


Actual output:
3
4
2
1
4
1
1


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

for c in counter:
    print(c)

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

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

Expected output:
2
5
2
2
1
1
1
2


Actual output:
0
2
5
2
2
1
1
1


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
a = []
for i in range(m):
    a += map(int, input().split())
for i in range(1, n+1):
    print(a.count(i))
Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import collections

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

dic = collections.defaultdict(int)
for _ in range(m):
    a, b = list(map(int, input().split()))
    dic[a] += 1
    dic[b] += 1

for key in sorted(dic.keys()):
    print(dic[key])


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


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

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

for key in sorted(dic.keys()):
    print(dic[key])

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N, M = map(int, input().split())
road = []
for _ in range(M):
    a, b = map(int, input().split())
    road.append(a)
    road.append(b)
    
from collections import Counter

c = Counter(road)
for i in c:
    print(c[i])

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

Expected output:
0
0
0
0
0
0
0
0


Actual output:

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

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
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))
k=len(set(ab))
for i in range(1,k+1):
    print(ab.count(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
0
1


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


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


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

Expected output:
2
4
0


Actual output:
0
2
4
0


Fixed submission (verdict: Accepted):




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


for i in range(1, n+1):
    print(rcnt[i])
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)
c = sorted(dict(c).items(), key=lambda x:x[0])


for v in c:
    print(v[1])

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

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.8.2), verdict: Wrong Answer):
N,M = [int(i) for i in input().split()]
list = []

for i in range(M):
  a,b = [int(i) for i in input().split()]
  list.append(a)
  list.append(b)
  
for i in range(N):
  print(list.count(i))
  

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

Expected output:
4
1
3
3
1
0
1
1


Actual output:
0
4
1
3
3
1
0
1


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

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

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

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

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

Problem: p03720
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
dd = {}
n, m = map(int, input().split())
for _ in range(m):
    a, b = map(int, input().split())
    dd[a] = dd.get(a,0) + 1
    dd[b] = dd.get(b,0) + 1
for i in sorted(dd.keys()):
    print(dd[i])

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

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


Actual output:
1
1
2


Fixed submission (verdict: Accepted):
dd = {}
n, m = map(int, input().split())
for _ in range(m):
    a, b = map(int, input().split())
    dd[a] = dd.get(a,0) + 1
    dd[b] = dd.get(b,0) + 1
for i in range(1, n+1):
    print(dd.get(i, 0))

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

for i in range(1,m+1):
  print(al.count(i)+bl.count(i))


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

Expected output:
3
3
2
2
2
0
1
1


Actual output:
3
3
2
2
2
0
1


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

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


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

Expected output:
4
2
1
1
3
0
2
1


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


Fixed submission (verdict: Accepted):
n, m = map(int, input().split())
ab = [0] * m
for i in range(m):
    ab[i] = list(map(int, input().split()))
roads = [0] * n
for a, b in ab:
    roads[a-1] += 1
    roads[b-1] += 1
for i in roads:
    print(i)
Problem: p02838
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))

ans = 0
for i in range(61):
  c0 = 0
  c1 = 0
  for a in A:
    if (a>>i)&1 == 1:
      c1 += 1
    else:
      c0 += 1
  
  ans += ((c0*c1)<<i)
print(ans)


Failing test case input:
10
2 1 49 6527 58979 541636 4318549 2345853 102512643 14164456034

Expected output:
323177671


Actual output:
128323178567


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7

ans = 0
for i in range(61):
  c0 = 0
  c1 = 0
  for a in A:
    if (a>>i)&1 == 1:
      c1 += 1
    else:
      c0 += 1
  
  ans += ((c0*c1)<<i)
  ans %= MOD
print(ans)
Problem: p02838
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def solve(string):
    n, *a = map(int, string.split())
    a = [list(map(int, "{:060b}".format(_a))) for _a in a]
    m = 10**9 + 7
    print(a)
    ans = 0
    for i, d in enumerate(zip(*a)):
        ans += (sum(d) * (n - sum(d)) * 2**(59 - i)) % m
        ans %= m
    return str(ans)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))


Failing test case input:
10
4 1 32 6527 144969 1412470 1425293 2621982 195528422 15184658045

Expected output:
156202879


Actual output:
[[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, 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, 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, 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, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 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, 1, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 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, 1, 0, 1, 0, 1, 1, 0, 0, 0, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 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, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 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, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 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, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 1, 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, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1]]
156202879


Fixed submission (verdict: Accepted):
def solve(string):
    n, *a = map(int, string.split())
    a = ["{:060b}".format(_a) for _a in a]
    m = 10**9 + 7
    ans = 0
    for i, d in enumerate(zip(*a)):
        s = "".join(d).count("1")
        ans += s * (n - s) * pow(2, 59 - i, m)
        ans %= m
    return str(ans)


if __name__ == '__main__':
    import sys
    print(solve(sys.stdin.read().strip()))
Problem: p02838
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
mod = 10**9+7
N = int(input())
A = list(map(int, input().split()))
mx = max(A)
d = {i:0 for i in range(len(str(bin(mx))))}
for a in A:
  for i in range(len(str(bin(a)))-2):
    if (a>>i)&1:
      d[i] += 1

ans = 0
for k, v in d.items():
  ans += v*(10-v) * (2**k)
  ans %= mod
print(ans)

Failing test case input:
3
1 7 1

Expected output:
12


Actual output:
75


Fixed submission (verdict: Accepted):
mod = 10**9+7
N = int(input())
A = list(map(int, input().split()))
mx = max(A)
d = {i:0 for i in range(len(str(bin(mx)))-2)}
for a in A:
  for i in range(len(str(bin(a)))-2):
    if (a>>i)&1:
      d[i] += 1

ans = 0
for k, v in d.items():
  ans += v*(N-v) * (2**k)
  ans %= mod
print(ans)

Problem: p02838
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
a=[2**66+int(i) for i in input().split()]
ans=0
for i in range(64):
    x,y=0,0
    for j in a:
        if bin(j)[-i-1]=='1':
            y+=1
        else:
            x+=1
    ans+=x*y*(1<<i)
print(ans)

Failing test case input:
10
4 1 32 9374 144969 2339779 1425293 2621982 195528422 15184658045

Expected output:
160543643


Actual output:
138160544609


Fixed submission (verdict: Accepted):
n=int(input())
a=[int(i) for i in input().split()]
ans=0
for i in range(64):
    x,y=0,0
    for j in a:
        if j>>i&1:
            y+=1
        else:
            x+=1
    ans+=x*y*(1<<i)
    ans%=10**9+7
print(ans)

Problem: p02838
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))
digit=[0 for i in range(0,61)]
for i in range(0,N):
    for j in range(0,60):
        digit[j+1]+=(A[i]>>j)&1
ans=((N-1)*sum(A))%(10**9+7)
subans=[(digit[k]*(digit[k]-1)*2**(k-1))%(10**9+7) for k in range(1,61)]
print(ans-sum(subans))

Failing test case input:
10
1 3 302 2653 58979 271148 2643383 17374604 63661178 9375105820

Expected output:
998937087


Actual output:
-1062920


Fixed submission (verdict: Accepted):
N=int(input())
A=list(map(int,input().split()))
digit=[0 for i in range(0,61)]
for i in range(0,N):
    for j in range(0,60):
        digit[j+1]+=(A[i]>>j)&1
ans=((N-1)*sum(A))%(10**9+7)
X=[(digit[k]*(digit[k]-1)*2**(k-1))%(10**9+7) for k in range(1,61)]
print((ans-sum(X))%(10**9+7))

Problem: p02838
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
ans=0
mod=10**9+7
for j in range(60):
    cnt1=sum([1 for i in a if i>>j&1])
    cnt0=len(bin(j))-2-cnt1
    ans+=(cnt1*cnt0*2**j)
print(ans%(10**9+7))


Failing test case input:
10
1 14 159 2653 58979 376446 2643383 27950288 419716939 9375105820

Expected output:
104328928


Actual output:
564750493


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
ans=0
mod=10**9+7
for j in range(60):
    cnt1=sum([1 for i in a if i>>j&1])
    cnt0=n-cnt1
    ans+=(cnt1*cnt0*2**j)
print(ans%(10**9+7))
Problem: p02838
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
C = {i:0 for i in range(60)}
A = input().split()
for i in range(N):
    a = bin(int(A[i]))[2:]
    n = len(a)
    for j in range(n):
        if a[j]=="1":
            C[n-1-j] += 1
cnt = 0
for i in range(60):
    if C[i]>0:
        cnt += C[i]*(N-C[i])*2**i
print(cnt)

Failing test case input:
10
1 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820

Expected output:
103715608


Actual output:
88103716224


Fixed submission (verdict: Accepted):
p = 10**9+7
N = int(input())
C = {i:0 for i in range(60)}
A = input().split()
for i in range(N):
    a = bin(int(A[i]))[2:]
    n = len(a)
    for j in range(n):
        if a[j]=="1":
            C[n-1-j] += 1
cnt = 0
for i in range(60):
    if C[i]>0:
        cnt = (cnt+C[i]*(N-C[i])*2**i)%p
print(cnt)
Problem: p02838
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))
ans=0

for i in range(60):
  x=0
  for j in range(N):
    if A[j]>>i&1: x+=1
  ans+=x*(N-x)*(2**i)
print(ans)

Failing test case input:
10
5 1 1 4519 144969 3606555 535597 1781441 195528422 25753549153

Expected output:
214703852


Actual output:
233214705483


Fixed submission (verdict: Accepted):
mod=10**9+7
N=int(input())
A=list(map(int,input().split()))
ans=0
 
for i in range(60):
  x=0
  for j in range(N):
    if A[j]>>i&1: x+=1
  ans+=x*(N-x)*(2**i)
print(ans%mod)

Problem: p02838
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
N = int(input())
C = {i:0 for i in range(60)}
A = input().split()
for i in range(N):
    a = bin(int(A[i]))[2:]
    n = len(a)
    for j in range(n):
        if a[j]=="1":
            C[n-1-j] += 1
cnt = 0
for i in range(20):
    if C[i]>0:
        cnt += C[i]*(N-C[i])*2**i
print(cnt)

Failing test case input:
10
1 1 302 6527 58979 541636 4318549 2345853 102512643 14164456034

Expected output:
323177923


Actual output:
16273731


Fixed submission (verdict: Accepted):
p = 10**9+7
N = int(input())
C = {i:0 for i in range(60)}
A = input().split()
for i in range(N):
    a = bin(int(A[i]))[2:]
    n = len(a)
    for j in range(n):
        if a[j]=="1":
            C[n-1-j] += 1
cnt = 0
for i in range(60):
    if C[i]>0:
        cnt = (cnt+C[i]*(N-C[i])*2**i)%p
print(cnt)

Problem: p02838
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n=int(input())
l=sorted(list(map(int,input().split())))
for i,x in enumerate(l):
  l[i]=format(x,'63b')
memo=[0]*63
for i in range(61):
  for j in range(n):
    if l[j][i]=='1':
      memo[-i-1]+=1
now=1
ans=0
mod=10**9+7
for x in memo:
  ans+=(now*x*(n-x))%mod
  now*=2
print(ans%mod)


Failing test case input:
10
0 0 1 387 39763 3606555 92549 663262 332665684 12968449561

Expected output:
711332179


Actual output:
711332107


Fixed submission (verdict: Accepted):
n=int(input())
l=sorted(list(map(int,input().split())))
for i,x in enumerate(l):
  l[i]=format(x,'63b')
memo=[0]*63
for i in range(63):
  for j in range(n):
    if l[j][i]=='1':
      memo[-i-1]+=1
now=1
ans=0
mod=10**9+7
for x in memo:
  ans+=(now*x*(n-x))%mod
  now*=2
print(ans%mod)

Problem: p02838
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))

mod = 10**9 + 7

ans = 0
for i in range(60):
    X = sum([1 for x in A if (x >> 1) & 1])
    ans += (1 << i) * X * (N - X)
    ans %= mod

print(ans)


Failing test case input:
10
1 14 159 2653 58979 323846 2643383 27950288 419716939 9375105820

Expected output:
103715608


Actual output:
873515988


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

mod = 10**9 + 7

ans = 0
for i in range(60):
    X = sum([1 for x in A if (x >> i) & 1])
    ans += (1 << i) * X * (N - X)
    ans %= mod

print(ans)
Problem: p02838
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
c1_list = [0]*60
for i in range(n):
  b = format(a[i], '060b')
  print(b)
  for j in range(len(b)):
    if b[j] == "1":
      c1_list[j] += 1
count = 0
for i in range(60):
  count = (count + c1_list[i]*(n-c1_list[i])*2**(59-i)) % 1000000007
print(count)

Failing test case input:
10
5 1 45 4519 144969 3606555 535597 2132271 195528422 15184658045

Expected output:
160150727


Actual output:
000000000000000000000000000000000000000000000000000000000101
000000000000000000000000000000000000000000000000000000000001
000000000000000000000000000000000000000000000000000000101101
000000000000000000000000000000000000000000000001000110100111
000000000000000000000000000000000000000000100011011001001001
000000000000000000000000000000000000001101110000100000011011
000000000000000000000000000000000000000010000010110000101101
000000000000000000000000000000000000001000001000100100101111
000000000000000000000000000000001011101001111000011011100110
000000000000000000000000001110001001000100110111111001111101
160150727


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
c1_list = [0]*60
for i in range(n):
  b = format(a[i], '060b')

  for j in range(len(b)):
    if b[j] == "1":
      c1_list[j] += 1
count = 0
for i in range(60):
  count = (count + c1_list[i]*(n-c1_list[i])*2**(59-i)) % 1000000007
print(count)

Problem: p02838
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys
input=sys.stdin.readline
n=int(input())
mod=10**9+7
a=list(map(int,input().split()))
s=[0]*61
for i in range(n):
  c=format(a[i], 'b')
  L=len(c)
  for j in range(L)[::-1]:
    s[L-j-1]+=int(c[j])
ans=0
for i in range(61)[::-1]:
  ans+=2**(i)*(s[L-i-1])*(n-s[L-i-1])
  ans%=mod
print(ans)


Failing test case input:
10
0 0 1 358 39763 7015634 92549 663262 332665684 12968449561

Expected output:
727852887


Actual output:
121052619


Fixed submission (verdict: Accepted):
import sys
input=sys.stdin.readline
n=int(input())
mod=10**9+7
a=list(map(int,input().split()))
s=[0]*61
for i in range(n):
  c=format(a[i], 'b')
  L=len(c)
  for j in range(L)[::-1]:
    s[L-j-1]+=int(c[j])
ans=0
for i in range(61):
  ans+=2**(i)*(s[i])*(n-s[i])
  ans%=mod
print(ans)

Problem: p02838
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
mod = 10e9+7
ans = 0
for i in range(60):
    x = 1<< i
    l = len([1 for j in a if j & x])
    ans += x * l * (n-l) % mod
    ans %= mod
print(ans)

Failing test case input:
10
4 1 32 6527 144969 1412470 3564681 2621982 195528422 15184658045

Expected output:
166815883


Actual output:
8166816758.0


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
ans = 0
for i in range(60):
    x = 1<< i
    l = len([1 for j in a if j & x])
    ans += x * l * (n-l) % mod
    ans %= mod
print(ans)