Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N,K=map(int, input().split())
    A = list(map(int, input().split()))
    B=0
    for i in range(N-K+1):
        S = (sum(A[i:i+K])+K)/2
        if B<S:
            B=S
    print(B)

main()

Fixed submission:
def main():
    N,K=map(int, input().split())
    A = list(map(int, input().split()))
    S = (sum(A[0:K])+K)/2
    S_max=S
    for i in range(K,N):
        S +=  A[i]/2
        S -= A[i-K]/2
        if S_max<S:
            S_max=S
    print(S_max)

main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    N,K=map(int, input().split())
    A = list(map(int, input().split()))
    B=0
    for i in range(N-K+1):
        S = (sum(A[i:i+K])+K)/2
        if B<S:
            B=S
    print(B)

main()

Fixed submission:
def main():
    N,K=map(int, input().split())
    A = list(map(int, input().split()))
    S = (sum(A[0:K])+K)/2
    S_max=S
    for i in range(K,N):
        S +=  A[i]/2
        S -= A[i-K]/2
        if S_max<S:
            S_max=S
    print(S_max)

main()

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int, input().split())
A = list(map(int, input().split()))
B=0
for i in range(N-K+1):
    S = (sum(A[i:i+K])+K)/2
    if B<S:
        B=S
print(B)

Fixed submission:
def main():
    N,K=map(int, input().split())
    A = list(map(int, input().split()))
    S = (sum(A[0:K])+K)/2
    S_max=S
    for i in range(K,N):
        S +=  A[i]/2
        S -= A[i-K]/2
        if S_max<S:
            S_max=S
    print(S_max)

main()

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int, input().split())
A = list(map(int, input().split()))
B=0
for i in range(N-K+1):
    S = (sum(A[i:i+K])+K)/2
    if B<S:
        B=S
print(B)

Fixed submission:
def main():
    N,K=map(int, input().split())
    A = list(map(int, input().split()))
    S = (sum(A[0:K])+K)/2
    S_max=S
    for i in range(K,N):
        S +=  A[i]/2
        S -= A[i-K]/2
        if S_max<S:
            S_max=S
    print(S_max)

main()

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int, input().split())
A = list(map(int, input().split()))
S=[]
for i in range(N-K+1):
    S += [(sum(A[i:i+K])+K)/2]
print(max(S))

Fixed submission:
def main():
    N,K=map(int, input().split())
    A = list(map(int, input().split()))
    S = (sum(A[0:K])+K)/2
    S_max=S
    for i in range(K,N):
        S +=  A[i]/2
        S -= A[i-K]/2
        if S_max<S:
            S_max=S
    print(S_max)

main()

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int, input().split())
A = list(map(int, input().split()))
for i in range(N):
    A[i] = (A[i]+1)/2
S=[]
for i in range(N-K+1):
    S += [sum(A[i:i+K])]
print(max(S))

Fixed submission:
def main():
    N,K=map(int, input().split())
    A = list(map(int, input().split()))
    S = (sum(A[0:K])+K)/2
    S_max=S
    for i in range(K,N):
        S +=  A[i]/2
        S -= A[i-K]/2
        if S_max<S:
            S_max=S
    print(S_max)

main()
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = list(range(1, N + 1))
print(sum(L[:-1]))

Fixed submission:
N = int(input())
if N % 2 == 0:
    print(int(N/2) * (N-1))
else:
    print(int((N-1)/2) * N)
Buggy python submission (verdict: Runtime Error):
N=int(input())
s=0
for i in range(N):
  a=int(input())
  s+=1/a
print(1/s)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = [1/i for i in A]
print(1/sum(B))
Buggy python submission (verdict: Runtime Error):
import numpy as np

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

A = np.arange(N)+L

if A[0] <= 0 and A[N] => 0:
    print(np.sum(A))
elif A[0] < 0 and A[N] < 0:
    print(np.sum(A)-A[N])
else:
    print(np.sum(A)-A[0])

Fixed submission:
import numpy as np

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

A = np.arange(N)+L

if A[0] <= 0 and A[N-1] >= 0:
    print(np.sum(A))
elif A[0] < 0 and A[N-1] < 0:
    print(np.sum(A)-A[N-1])
else:
    print(np.sum(A)-A[0])

Buggy python submission (verdict: Runtime Error):
import numpy as np

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

A = np.arange(N)+L
if A[0] < 0 and A[N] > 0:
    print(np.sum(A))
elif A[0] < 0 and A[N] < 0:
    print(np.sum(A)-A[N])
else:
    print(np.sum(A)-A[0])

Fixed submission:
import numpy as np

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

A = np.arange(N)+L

if A[0] <= 0 and A[N-1] >= 0:
    print(np.sum(A))
elif A[0] < 0 and A[N-1] < 0:
    print(np.sum(A)-A[N-1])
else:
    print(np.sum(A)-A[0])
Buggy python submission (verdict: Runtime Error):
from fractions import gcd
A,B,C,D = map(int,input())
N=B-A+1
print(N-(N//C)-(N//D)+(N//(gcd(C,D))))

Fixed submission:
from fractions import gcd
A,B,C,D = map(int,input().split())

Ans = []

for i in [B,A-1]:
  N = i
  E = (C * D) // gcd(C,D)
  modC = N//C
  modD = N//D
  modE = N//E
  Ans += [N - modC - modD + modE]
  
print(Ans[0]-Ans[1])
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import numpy as np
N, M = [int(x) for x in stdin.readline().rstrip().split()]
A = [int(x) for x in stdin.readline().rstrip().split()]
for i in range(M):
    B, C = [int(x) for x in stdin.readline().rstrip().split()]
    A.extend(list(np.zeros(B)+C))
A.sort(reverse= True)
print(int(sum(A[:N])))

Fixed submission:
from sys import stdin
import collections

N, M = [int(x) for x in stdin.readline().rstrip().split()]
A = [int(x) for x in stdin.readline().rstrip().split()]
A = collections.Counter(A)
for i in range(M):
    B, C = [int(x) for x in stdin.readline().rstrip().split()]
    A[C] += B 
A = dict(A)
A = dict(sorted(A.items()))

S = 0
j = -1

A_key = list(A.keys())
A_value = list(A.values())

while True:
    if A_value[j] < N:
        S += A_value[j] * A_key[j]
        N -= A_value[j]
        j -= 1
    else:
        S += N * A_key[j]
        break
print(S)
Buggy python submission (verdict: Runtime Error):
L = ['A','C','G','T']
S = list(input()) 
S = ['1' if ((i in L) == True) else '0' for i in S]
S = ''.join(S_list)
S = S.split('0')
S = [len(i) for i in S]
print(max(S))

Fixed submission:
S_list = list(input()) 
S_list = ['1' if i == 'A' or i == 'C' or  i == 'G' or i == 'T' else '0' for i in S_list]
S = ''.join(S_list)
S = S.split('0')
X = 0
for i in range(len(S)):
    if len(S[i]) > X:
        X = len(S[i])
print(X)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
print = sys.stdout.write
N, K = map(int, input().split())
A = tuple(map(int, input().split()))
temp = 1
for i in range(K):
  temp *= A[i]
for i in range(1, N - K + 1):
  scr = 1
  for j in range(K):
    scr *= A[i+j]
  print('Yes\n' if scr > temp else 'No\n')
  temp = scr

Fixed submission:
N, K = map(int, input().split())
A = tuple(map(int, input().split()))
for i in range(N - K): print('Yes' if A[K + i] > A[i] else 'No')

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
print = sys.stdout.write
N, K = map(int, input().split())
A = tuple(map(int, input().split()))
ans = []
temp = 1
for i in range(K):
  temp *= A[i]
for i in range(1, N - K + 1):
  scr = 1
  for j in range(K):
    scr *= A[i+j]
  ans.append('Yes' if scr > temp else 'No')
  temp = scr
print('\n'.join(ans))

Fixed submission:
N, K = map(int, input().split())
A = tuple(map(int, input().split()))
for i in range(N - K): print('Yes' if A[K + i] > A[i] else 'No')

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))
scrlst = []
for i in range(N - K + 1):
  scr = 1
  for j in range(K):
    scr *= A[i+j]
  scrlst.append(scr)
for i in range(N - K):
  print('Yes' if scrlst[i+1] > scrlst[i] else 'No')

Fixed submission:
N, K = map(int, input().split())
A = tuple(map(int, input().split()))
for i in range(N - K): print('Yes' if A[K + i] > A[i] else 'No')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
total = 1
for i in range(N):
  total *= A[i]
if total > 1e18:
  print(-1)
else:
  print(total)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
total = 1
if 0 in A:
  print(0)
  exit()
for i in range(N):
  total *= A[i]
  if total > 1e18:
    print(-1)
    exit()
print(total)
Buggy python submission (verdict: Runtime Error):
A, B = input().split()
A = int(A)
B = int(B.replace('.', ''))
print(a*b//100)

Fixed submission:
A, B = input().split()
A = int(A)
B = int(B.replace('.', ''))
print(A*B//100)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = input().split()
print(max(A)-min(A))

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
print(max(A)-min(A))
Buggy python submission (verdict: Runtime Error):
print(int(input())-int(input()))

Fixed submission:
X, t = map(int, input().split())
print(X-t if X > t else 0)
Buggy python submission (verdict: Runtime Error):
#include <stdio.h>

int main(void) {
  int N;
  scanf("%d", &N);
  int x = 800 * N;
  int y = N / 15 *200;
  int ans = x - y;
  printf("%d\n", ans);
  return 0;
}

Fixed submission:
N = int(input())
print(N * 800 - N // 15 * 200)
Buggy python submission (verdict: Runtime Error):
n=int(input())

l=list(map(int,str(n)))

a=sum(l)

if l%9==0:
  print('Yes')
else:
  print('No')

Fixed submission:
n=int(input())

l=list(map(int,str(n)))

a=sum(l)

if a%9==0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
X,K,D=(int(x) for x in input().split())
x=abs(X)
a=x//D

b=x-a*D
B=abs(x-(a+1)*D)

if b>B:
  a=a+1

if a>=K:
  print(abs(x-K*D))

else:
  c=K-a
  if c%2 == 0:
    print(abs(x-a*D))
  elif:
    d=abs(x-(a-1)*D)
    e=abs(x-(a+1)*D)
    print(min(d,e))

Fixed submission:
X,K,D=(int(x) for x in input().split())
x=abs(X)
a=x//D

b=x-a*D
B=abs(x-(a+1)*D)

if b>B:
  a=a+1

if a>=K:
  print(abs(x-K*D))

else:
  c=K-a
  if c%2 == 0:
    print(abs(x-a*D))
  else:
    d=abs(x-(a-1)*D)
    e=abs(x-(a+1)*D)
    print(min(d,e))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy

N,D=(int(x) for x in input().split())

answer=0
for i in range(N):
  A,B=(int(x) for x in input().split())
  a = numpy.array([0,0])
  b = numpy.array([A,B])
  u = b - a
  h=numpy.linalg.norm(u)
  if  D>=h:
    answer+=1
print(answer)

Fixed submission:
import math

N,D=(int(x) for x in input().split())

answer=0
for i in range(N):
  A,B=(int(x) for x in input().split())
  h=math.sqrt(A*A+B*B)
  if  D>=h:
    answer+=1
print(answer)
Buggy python submission (verdict: Runtime Error):
N=int(input())
print(a+a*a+a*a*a)

Fixed submission:
N=int(input())
print(N+N**2+N**3)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce
from operator import add, mul

N=int(input())
A=list(map(int, input().split()))
 
p=reduce(mul, A)

if p<=10**18:
  print(p)
else:
  print(-1)

Fixed submission:
#A,B,C=(int(x) for x in input().split())
N=int(input())
A=list(map(int, input().split()))


if 0 in A:
  t=0
else:
  t=A[0]
  i=1
  for k in range(N-1):
    t=t*A[i]
    if t>10**18:
      break
    i+=1

if t<=10**18:
  print(t)
else:
  print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
import functools
import operator

#A,B,C=(int(x) for x in input().split())
N=int(input())
A=list(map(int, input().split()))

result = functools.reduce(operator.mul, A)

if result<=10**18:
  print(result)
else:
  print(-1)

Fixed submission:
#A,B,C=(int(x) for x in input().split())
N=int(input())
A=list(map(int, input().split()))


if 0 in A:
  t=0
else:
  t=A[0]
  i=1
  for k in range(N-1):
    t=t*A[i]
    if t>10**18:
      break
    i+=1

if t<=10**18:
  print(t)
else:
  print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
#A,B,C=(int(x) for x in input().split())
N=int(input())
A=list(map(int, input().split()))

t=A[0]
i=1
for k in range(N-1):
  t=t*A[i]
  i+=1
if t<=10**18:
  print(t)
else:
  print(-1)

Fixed submission:
#A,B,C=(int(x) for x in input().split())
N=int(input())
A=list(map(int, input().split()))


if 0 in A:
  t=0
else:
  t=A[0]
  i=1
  for k in range(N-1):
    t=t*A[i]
    if t>10**18:
      break
    i+=1

if t<=10**18:
  print(t)
else:
  print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int, input().split()))

i=1
for j in range(N):
  print(A.count(i))
  i+=1


Fixed submission:
import collections

N=int(input())
A=list(map(int, input().split()))

c = collections.Counter(A)

i=1

for j in range(N):
  print(c[i])
  i+=1
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce


#A,B,C=(int(x) for x in input().split())
N=int(input())
#A=list(map(int, input().split()))

l=[(a,b,c) for a in range (1,N+1) for b in range  (1, N+1) for c in range (1, N+1)]



def gcd_list(numbers):
    return reduce(math.gcd, numbers)

i=0

for k in range(N**3):
    m=gcd_list(l[k])
    i=i+m
    
print(i)

Fixed submission:
import math

K=int(input())

total=0

for i in range(1,K+1):
  for j in range(1,K+1):
    g=math.gcd(i,j)
    for k in range(1,K+1):
      a=math.gcd(g,k)
      total+=a

print(total)
Buggy python submission (verdict: Runtime Error):
N,M=(int(x) for x in input().split())
A=list(map(int, input().split()))
A=np.array(A)
B=A[1:]-A[:-1]
b=max(B)
c=A[-1]-A[0]
if c > N/2:
    c=int(c-N/2)
else:
    c=c
d=max(b,c)
print(N-d)

Fixed submission:
import numpy as np

N,M=(int(x) for x in input().split())
A=list(map(int, input().split()))
A=np.array(A)
B=A[1:]-A[:-1]
b=max(B)
c=A[-1]-A[0]
if c > N/2:
    d=int(N-c)
else:
    d=c
e=max(b,d)
f=N-e

print(f)
Buggy python submission (verdict: Runtime Error):
N=list[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
print(N[K-1])

Fixed submission:
N=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K=int(input())
print(N[K-1])
Buggy python submission (verdict: Runtime Error):
import math
a,b,c=(int(x) for x in input().split())

x=c-a-b
if x>0:
  if x*x-4*a*b>0:
    print('Yes')
  else:
    primt('No')
else:
  print('No')


Fixed submission:
import math
a,b,c=(int(x) for x in input().split())

x=c-a-b
if x>0:
  if x*x-4*a*b>0:
    print('Yes')
  else:
    print('No')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
N,K=(int(x) for x in input().split())
P=list(map(int, input().split()))
S=sum(P[0:K])
ans=[S]
for i in range(N):
    S=sum(P[i:i+K])
    ans.append(S)
S=max(ans)
print((S+K)/2)

Fixed submission:
N,K=(int(x) for x in input().split())
P=list(map(int, input().split()))
s=sum(P[0:K])
ans=[s]

for i in range(K,N):
    s=s+P[i]-P[i-K]
    ans.append(s)

S=max(ans)
print((S+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=(int(x) for x in input().split())
P=list(map(int, input().split()))
S=0
for i in range(N):
    s=sum(P[i:i+K])
    S=max(S,s)
print((S+K)/2)

Fixed submission:
N,K=(int(x) for x in input().split())
P=list(map(int, input().split()))
s=sum(P[0:K])
ans=[s]

for i in range(K,N):
    s=s+P[i]-P[i-K]
    ans.append(s)

S=max(ans)
print((S+K)/2)

Buggy python submission (verdict: Time Limit Exceeded):
N,K=(int(x) for x in input().split())
P=list(map(int, input().split()))
S=sum(P[0:K])
for i in range(N):
    s=sum(P[i:i+K])
    S=max(S,s)
print((S+K)/2)

Fixed submission:
N,K=(int(x) for x in input().split())
P=list(map(int, input().split()))
s=sum(P[0:K])
ans=[s]

for i in range(K,N):
    s=s+P[i]-P[i-K]
    ans.append(s)

S=max(ans)
print((S+K)/2)
Buggy python submission (verdict: Runtime Error):
N,K=(int(x) for x in input().split())
H=list(map(int, input().split()))
A = sorted(H, reverse=True)
i=0

if K >= N:
    print('0')
else:
    
    for i in range(K):
        A.pop(i)
        i=i+1
    B=sum(A)
    print(B)

Fixed submission:
N,K=(int(x) for x in input().split())
H=list(map(int, input().split()))
A = sorted(H)
i=0
a=N-K
if K >= N:
    print('0')

else:
    B=A[:a]
    C=sum(B)
    print(C)

Buggy python submission (verdict: Runtime Error):
N,K=(int(x) for x in input().split())
H=list(map(int, input().split()))

i=0

if K >= N:
    print('0')
else:
    A = sorted(H, reverse=True)
    for i in range(K):
        A.pop(i)
        i=i+1
    B=sum(A)
    print(B)

Fixed submission:
N,K=(int(x) for x in input().split())
H=list(map(int, input().split()))
A = sorted(H)
i=0
a=N-K
if K >= N:
    print('0')

else:
    B=A[:a]
    C=sum(B)
    print(C)
Buggy python submission (verdict: Time Limit Exceeded):
import queue

H,W = map(int,input().split())
C = [int(i)+1 for i in input().split()]
D = [int(i)+1 for i in input().split()]

l = []
l.append([-1]*(W+4))
l.append([-1]*(W+4))
for _ in range(H):
    l.append([-1,-1]+ [0 if i=="." else -1 for i in input()] + [-1,-1])
l.append([-1]*(W+4))
l.append([-1]*(W+4))

l[C[0]][C[1]] = 1 

def p():
    for i in l[2:2+H]:
        print(",".join([str(j) for j in i[2:2+W]]))

q = queue.Queue()
q.put(C)
now = 1
q2 = queue.Queue()
while True:
    while not q.empty():
        x,y = q.get()
        q2.put([x,y])
        for i,j in [[1,0],[0,1],[-1,0],[0,-1]]:
            if l[x+i][y+j] ==0:
                q.put([x+i,y+j])
                l[x+i][y+j] = now
    if l[D[0]][D[1]] > 0:
        print(l[D[0]][D[1]]-1)
        break
    now += 1
    if q2.empty():
        print(-1)
        break
    while not q2.empty():
        x,y = q2.get()
        for i in range(-2,3):
            for j in range(-2,3):
                if l[x+i][y+j] ==0:
                    q.put([x+i,y+j])
                    l[x+i][y+j] = now
    if l[D[0]][D[1]] > 0:
        print(l[D[0]][D[1]]-1) 
        break
    

Fixed submission:
import queue

H,W = map(int,input().split())
C = [int(i)+1 for i in input().split()]
D = [int(i)+1 for i in input().split()]

l = []
l.append([-1]*(W+4))
l.append([-1]*(W+4))
for _ in range(H):
    l.append([-1,-1]+ [0 if i=="." else -1 for i in input()] + [-1,-1])
l.append([-1]*(W+4))
l.append([-1]*(W+4))

l[C[0]][C[1]] = 1 

def p():
    for i in l[2:2+H]:
        print(",".join([str(j) for j in i[2:2+W]]))

q = queue.Queue()
q.put(C)
now = 1
q2 = queue.Queue()
while True:
    while not q.empty():
        x,y = q.get()
        q2.put([x,y])
        for i,j in [[1,0],[0,1],[-1,0],[0,-1]]:
            if l[x+i][y+j] ==0:
                q.put([x+i,y+j])
                l[x+i][y+j] = now
    if l[D[0]][D[1]] > 0:
        print(l[D[0]][D[1]]-1)
        break
    now += 1
    if q2.empty():
        print(-1)
        break
    while not q2.empty():
        x,y = q2.get()
        for i in range(-2,3):
            for j in range(-2,3):
                if l[x+i][y+j] ==0:
                    q.put([x+i,y+j])
                    l[x+i][y+j] = now
    if l[D[0]][D[1]] > 0:
        print(l[D[0]][D[1]]-1) 
        break
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

lis = [0]*60

for a in input().split():
    a = int(a)
    for i in range(60):
        lis[i] += a % 2
        a = a//2
ans = 0
for i, j in enumerate(lis):
    ans += j * (N-j) *(2**i)
    ans = ans % (10**9 + 7)

print(ans)

Fixed submission:
N = int(input())
 
lis = [0]*60
 
for a in input().split():
    a = int(a)
    for i in range(60):
        lis[i] += a % 2
        a = a//2
ans = 0
for i, j in enumerate(lis):
    ans += j * (N-j) *(2**i)
    ans = ans % (10**9 + 7)
 
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())

lis = [0]*60

for a in input().split():
    a = int(a)
    for i,j in range(60):
        lis[i] += a % 2
        a = a//2
ans = 0
for i, j in enumerate(lis):
    ans += j * (N-j) *(2**i)
    ans = ans % (10**9 + 7)

print(ans)


Fixed submission:
N = int(input())
 
lis = [0]*60
 
for a in input().split():
    a = int(a)
    for i in range(60):
        lis[i] += a % 2
        a = a//2
ans = 0
for i, j in enumerate(lis):
    ans += j * (N-j) *(2**i)
    ans = ans % (10**9 + 7)
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

lis = [0]*60

for a in A:
    for i in range(60):
        lis[i] += a%2
        a = a //2
        if a == 0:
            break

ans = 0
for i, j in enumerate(lis):
    ans += j * (N-j) *(2**i)
    ans = ans % (10**9 + 7)

print(ans)

Fixed submission:
N = int(input())
 
lis = [0]*60
 
for a in input().split():
    a = int(a)
    for i in range(60):
        lis[i] += a % 2
        a = a//2
ans = 0
for i, j in enumerate(lis):
    ans += j * (N-j) *(2**i)
    ans = ans % (10**9 + 7)
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(i) for i in input().split()]

lis = [0]*60

for a in A:
    for i in range(60):
        lis[i] += a%2
        a = a //2

ans = 0
for i, j in enumerate(lis):
    ans += j * (N-j) *(2**i)
    ans = ans % (10**9 + 7)

print(ans)

Fixed submission:
N = int(input())
 
lis = [0]*60
 
for a in input().split():
    a = int(a)
    for i in range(60):
        lis[i] += a % 2
        a = a//2
ans = 0
for i, j in enumerate(lis):
    ans += j * (N-j) *(2**i)
    ans = ans % (10**9 + 7)
 
print(ans)
Buggy python submission (verdict: Runtime Error):
p = 10**9 + 7

def pow_mod(p,a,n):
    res = 1
    while n > 0:
        if n % 2 == 1:
            res = (res * a) % p
        n = n // 2
        a = (a*a)%p
    return res


def comb_mod(n,k):
    global fac
    res = fac[n] * pow_mod(p,fac[k],p-2) * pow_mod(p,fac[n-k],p-2) % p
    return res

X,Y = map(int,input().split())
X,Y = max(X,Y),min(X,Y)
n = (X+Y)//3

fac = [1]
foo = 1
for i in range(1,n+1):
    foo = (foo*i)%p
    fac.append(foo)

k = 2*n - X
if (X+Y)%3 != 0 or n < k:
    ans = 0
else:
    ans = comb_mod(n,k)
print(ans)

Fixed submission:
p = 10**9 + 7

def pow_mod(p,a,n):
    res = 1
    while n > 0:
        if n % 2 == 1:
            res = (res * a) % p
        n = n // 2
        a = (a*a)%p
    return res


def comb_mod(n,k):
    global fac
    res = fac[n] * pow_mod(p,fac[k],p-2) * pow_mod(p,fac[n-k],p-2) % p
    return res

X,Y = map(int,input().split())
X,Y = max(X,Y),min(X,Y)
n = (X+Y)//3

fac = [1]
foo = 1
for i in range(1,n+1):
    foo = (foo*i)%p
    fac.append(foo)

k = 2*n - X
if (X+Y)%3 != 0 or n < k or k < 0:
    ans = 0
else:
    ans = comb_mod(n,k)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
n,m = map(int,input().split())
A = [-int(i)for i in input().split()]
A.sort()
for _ in range(m):
    a = -((-A.pop(0)) //2)
    A.insert(bisect.bisect_left(A,a),a)
print(-sum(A))

Fixed submission:
import heapq

N , M = map(int,input().split())
A = [-int(i) for i in input().split()]
heapq.heapify(A)
for _ in range(M):
    a = -heapq.heappop(A) >> 1
    heapq.heappush(A,-a)
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N , M = map(int,input().split())
A = [int(i) for i in input().split()]
A.sort()
for _ in range(M):
    a = A.pop(-1) >> 1
    A.insert(bisect.bisect_left(A,a),a)
print(sum(A))


Fixed submission:
import heapq

N , M = map(int,input().split())
A = [-int(i) for i in input().split()]
heapq.heapify(A)
for _ in range(M):
    a = -heapq.heappop(A) >> 1
    heapq.heappush(A,-a)
print(-sum(A))

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
N , M = map(int,input().split())
A = [int(i) for i in input().split()]
A.sort()
for _ in range(M):
    a = A.pop(-1)//2
    A.insert(bisect.bisect_left(A,a),a)
print(sum(A))


Fixed submission:
import heapq

N , M = map(int,input().split())
A = [-int(i) for i in input().split()]
heapq.heapify(A)
for _ in range(M):
    a = -heapq.heappop(A) >> 1
    heapq.heappush(A,-a)
print(-sum(A))