Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

# import functools
# import operator
# prod = functools.partial(functools.reduce, operator.mul)

# i=K+1の時、直近K回の期末テストの点数
# p_K = prod(A[:K])
p_K = 1
for i in range(K):
    p_K *= A[i]

for i in range(K, N):
    p_Kp1 = p_K / A[i-K] * A[i]
    if p_K < p_Kp1:
        print('Yes')
    else:
        print('No')


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

# import functools
# import operator
# prod = functools.partial(functools.reduce, operator.mul)

# i=K+1の時、直近K回の期末テストの点数
# p_K = prod(A[:K])
p_K = 1

for i in range(K, N):
    t = A[i] / A[i-K]
    p_Kp1 = p_K * t
    if p_K < p_Kp1:
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
A = list(map(int, input().split()))

import functools
import operator
prod = functools.partial(functools.reduce, operator.mul)

# print(A)

# i=K+1の時、直近K回の期末テストの点数
p_K = prod(A[:K])
# print(p_K)
for i in range(K, N):
    # print(i)
    p_Kp1 = p_K / A[i-K] * A[i]
    # print(p_Kp1)
    if p_K < p_Kp1:
        print('Yes')
    else:
        print('No')


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

# import functools
# import operator
# prod = functools.partial(functools.reduce, operator.mul)

# i=K+1の時、直近K回の期末テストの点数
# p_K = prod(A[:K])
p_K = 1

for i in range(K, N):
    t = A[i] / A[i-K]
    p_Kp1 = p_K * t
    if p_K < p_Kp1:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
alpha = input()

if alpha in string.ascii_lowercase:
  print('a')
else:
  print('A')

Fixed submission:
import string
alpha = input()

# alpha = 'a'

if alpha in string.ascii_lowercase:
  print('a')
else:
  print('A')
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
 
r = 1
t = 10 ** 18
for i in a:
  r *= a[i]
  if r > t:
    print(-1)
    return
print(r)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

# a = [0, 10, 10, 10, 10]

a.sort()
r = 1
t = 10 ** 18
for x in a:
  r *= x
  if r > t:
    break
if r <= t:
  print(r)
else:
  print(-1)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))

r = 1
t = 10 ** 18
for i in a:
  r *= a
  if r > t:
    print(-1)
    return
print(r)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))

# a = [0, 10, 10, 10, 10]

a.sort()
r = 1
t = 10 ** 18
for x in a:
  r *= x
  if r > t:
    break
if r <= t:
  print(r)
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
from decimal import Decimal

# t = '1000000000000000 9.99'

a = list(map(Decimal, t.split()))

print(int(a[0]*a[1]))

Fixed submission:
from decimal import Decimal

# t = '1000000000000000 9.99'
a = list(map(Decimal, input().split()))
# a = list(map(Decimal, t.split()))

print(int(a[0]*a[1]))

Buggy python submission (verdict: Runtime Error):
from decimal import Decimal 
a = map(Decimal, input().split())

print(a[0]*a[1])


Fixed submission:
from decimal import Decimal

# t = '1000000000000000 9.99'
a = list(map(Decimal, input().split()))
# a = list(map(Decimal, t.split()))

print(int(a[0]*a[1]))

Buggy python submission (verdict: Runtime Error):
ab = input().split()
a, b = int(ab[0]), int(ab[1]*100)

print(int(a * b / 100))

Fixed submission:
from decimal import Decimal

# t = '1000000000000000 9.99'
a = list(map(Decimal, input().split()))
# a = list(map(Decimal, t.split()))

print(int(a[0]*a[1]))
Buggy python submission (verdict: Runtime Error):
n = int(input().split())

n %= 10

if n == 0 or 1 or 6 or 8:
  print('pon')
elif n == 2 or 4 or 5 or 7 or 9:
  print('hon')
else:
  print('bon')


Fixed submission:
n = int(input())


n %= 10

if n == 0 or n == 1 or n == 6 or n==8:
  print('pon')
elif n == 2 or n==4 or n==5 or n==7 or n==9:
  print('hon')
else:
  print('bon')
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

A2N = list(map(int, input().split()))

for i in range(1, N):
    print(A2N.count(i))
print(0)

Fixed submission:
N = int(input())

A2N = list(map(int, input().split()))
import collections
c = collections.Counter(A2N)
for i in range(1, N):
    if i in c.keys():
        print(c[i])
    else:
        print(0)
print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

K = int(input())
summ = 0

# 組み合わせの数
# a, b, cが同じは1pattern
# a, b, cのうち、２つが同じパターンは３
# a, b, cのうち、全て異なるパターンは6
# つまり、３つの数の組み合わせの数を求め、各パターン倍すればよい

# タプルで集合を作成する
# st = set()
# # # for a in range(1, K+1):
# # #     for b in range(1, K+1):
# # #         for c in range(1, K+1):
# # #             sort_abc = sorted([a, b, c])
# # #             st.add(tuple(sort_abc))
# # # # print(st)
# # # for s in st:
# # #     if s[0] == s[1] == s[2]:
# # #         summ += reduce(math.gcd, s)
# # #         # print(0, s)
# # #     elif s[0] == s[1] or s[0] == s[2] or s[1] == s[2]:
# # #         summ += 3*reduce(math.gcd, s)
# # #         # print(1, s)
# # #     else:
# # #         summ += 6*reduce(math.gcd, s)
# # #         # print(2, s)
# # # print(summ)

for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            summ += reduce(math.gcd, [a, b, c])
print(summ)


Fixed submission:
import math
k = int(input())
ans = 0

for i in range(1, k+1):
    for j in range(1, k+1):
        num = math.gcd(i, j)
        for l in range(1, k+1):
            ans += math.gcd(num, l)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce

K = int(input())
summ = 0

# 組み合わせの数
# a, b, cが同じは1pattern
# a, b, cのうち、２つが同じパターンは３
# a, b, cのうち、全て異なるパターンは6
# つまり、３つの数の組み合わせの数を求め、各パターン倍すればよい

# タプルで集合を作成する
st = set()
for a in range(1, K+1):
    for b in range(1, K+1):
        for c in range(1, K+1):
            sort_abc = sorted([a, b, c])
            st.add(tuple(sort_abc))
# print(st)
for s in st:
    if s[0] == s[1] == s[2]:
        summ += reduce(math.gcd, s)
        # print(0, s)
    elif s[0] == s[1] or s[0] == s[2] or s[1] == s[2]:
        summ += 3*reduce(math.gcd, s)
        # print(1, s)
    else:
        summ += 6*reduce(math.gcd, s)
        # print(2, s)
print(summ)

Fixed submission:
import math
k = int(input())
ans = 0

for i in range(1, k+1):
    for j in range(1, k+1):
        num = math.gcd(i, j)
        for l in range(1, k+1):
            ans += math.gcd(num, l)

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = []
for i in range(n):
  s.append(int(input()))
 
ss = sum(s)
if ss % 10 == 0:
  # sの中で10で割り切れない最小の数を引けば良い
  s.sort()
  m = [t for t in s if t%10!=0]
  if len(m) == 0:
    print(0)
   else:
    print(ss-min(m))

Fixed submission:
n = int(input())
s = []
for i in range(n):
  s.append(int(input()))
 
ss = sum(s)
if ss % 10 == 0:
  # sの中で10で割り切れない最小の数を引けば良い
  s.sort()
  m = [t for t in s if t%10!=0]
  if len(m) == 0:
    print(0)
  else:
    print(ss-min(m))
else:
  print(ss)

Buggy python submission (verdict: Runtime Error):
def minus_min(s):
  sum(s)-min(s)

n = int(input())
s = []
for i in range(n):
  s.append(input())

ss = sum(s)
if ss % 10 == 0:
  # sの中で10で割り切れない最小の数を引けば良い
  s.sort()
  m = [t for t in s if t%10!=0]
  if len(m) == 0:
    print(0)
   else:
    print(ss-min(m))


Fixed submission:
n = int(input())
s = []
for i in range(n):
  s.append(int(input()))
 
ss = sum(s)
if ss % 10 == 0:
  # sの中で10で割り切れない最小の数を引けば良い
  s.sort()
  m = [t for t in s if t%10!=0]
  if len(m) == 0:
    print(0)
  else:
    print(ss-min(m))
else:
  print(ss)
Buggy python submission (verdict: Runtime Error):
N = input()
    if N[0] == '7' or N[1] == '7' or N[2] == '7':
        print("Yes")
    else:
        print("No")

Fixed submission:
N = input()
if N[0] == '7' or N[1] == '7' or N[2] == '7':
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))
q=int(input())
num=[0]*(10**5-1)
tot=0
for i in range(n):
    num[a[i]-1]+=1
    tot+=a[i]

for _ in range(q):
    b,c=map(int, input().split())
    tot+=(num[b-1]*(c-b))
    num[c-1]+=num[b-1]
    num[b-1]=0
    print(tot)

Fixed submission:
n=int(input())
a=list(map(int, input().split()))
q=int(input())
num=[0]*(10**5)
tot=0
for i in range(n):
    num[a[i]-1]+=1
    tot+=a[i]

for _ in range(q):
    b,c=map(int, input().split())
    tot+=(num[b-1]*(c-b))
    num[c-1]+=num[b-1]
    num[b-1]=0
    print(tot)

Buggy python submission (verdict: Runtime Error):
n=int(input())
a=list(map(int, input().split()))
q=int(input())
num=[0]*(10**5-1)
tot=0
for i in range(n):
    num[a[i]-1]+=1
    tot+=a[i]

for i in range(q):
    b,c=map(int, input().split())
    tot+=num[b-1]*(c-b)
    print(tot)
    num[c-1]+=num[b-1]
    num[b-1]=0

Fixed submission:
n=int(input())
a=list(map(int, input().split()))
q=int(input())
num=[0]*(10**5)
tot=0
for i in range(n):
    num[a[i]-1]+=1
    tot+=a[i]

for _ in range(q):
    b,c=map(int, input().split())
    tot+=(num[b-1]*(c-b))
    num[c-1]+=num[b-1]
    num[b-1]=0
    print(tot)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int, input().split()))

ans=1
for i in range(n):
    ans*=a[i]
    if ans>10**18:
        ans=-1   
if ans<0:
    print(-1)
else:
    print(ans)

Fixed submission:
n=int(input())
a=list(map(int, input().split()))

ans=1
for i in range(n):
    ans*=a[i]
    if ans>10**18:
        ans=-1
        break

if min(a)==0:
    print(0)
else:
    print(ans)
Buggy python submission (verdict: Runtime Error):
h1,m1,h2,m2,k=map(int,input().split())

if m1<=m2:
    print(max((h2-h1)*60+m2-m1-k),0)
else:
    print(max((h2-h1-1)*60+m2+60-m1-k,0))


Fixed submission:
h1,m1,h2,m2,k=map(int,input().split())

if m1<=m2:
    print(max((h2-h1)*60+m2-m1-k,0))
else:
    print(max((h2-h1-1)*60+m2+60-m1-k,0))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from collections import deque

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

arr2=[0]*n
for i in range(n):
    tmp=[]
    for j in range(n):
        if arr[i][j]==1:
            tmp.append(j)
    arr2[i]=tuple(tmp)
    if len(arr2[i])==0:
        print('No')
        sys.exit()


def bfs(d):
    que=deque()
    que.append(0)
    ans=[0]*n
    while que:
        x=que.popleft()
        if x==0:
            for j in range(n):
                if arr[0][j]==1:
                    ans[j]=1
                    que.append(j)
        else:
            for i in arr2[x]:
                if ans[i]==0 and i!=0:
                    ans[i]=x+1
                    que.append(i)
    print('Yes')
    for i in range(1,n):
        print(ans[i])        

bfs(arr)

Fixed submission:
import sys
from collections import deque

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

for i in range(n):
    if len(arr[i])==0:
        print('No')
        sys.exit()

def bfs(d):
    que=deque()
    que.append(0)
    ans=[0]*n
    while que:
        x=que.popleft()
        if x==0:
            for i in arr[x]:
                ans[i]=1
                que.append(i)
        else:
            for i in arr[x]:
                if ans[i]==0 and i!=0:
                    ans[i]=x+1
                    que.append(i)
    print('Yes')
    for i in range(1,n):
        print(ans[i])        

bfs(arr)
Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split())

def using_sqrt(limit):
    n = 0
    for k in range(2, limit+1):
        factor = 0
        
        # 2以外の偶数は素数ではないので無視する
        if k % 2 == 0 and k != 2:
            continue
        
        # 繰り返しの上限を対象の平方根にする
        for divisor in range(2, math.floor(math.sqrt(k))+1):
            if k % divisor == 0:
                factor += 1
                
        if factor == 0:
            n += 1
            
    return n

for i in range(n):
    if m%using_sqrt(i)==0:
        ans=i
        break
for j in range(m):
    print(i+1,i+1+ans)

Fixed submission:
n,m=map(int, input().split())
if m%2==1:
    for i in range(m//2):
        print(i+1,m-i)
    for i in range(m//2+1):
        print(m+i+1,2*m+1-i)
else:
    for i in range(m//2):
        print(i+1,m+1-i)
    for i in range(m//2):
        print(m+i+2,2*m+1-i)
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
    s=input()
    if s not in a:
        a.append(s)

print(len(a))


Fixed submission:
s,w=map(int,input().split())

if s<=w:
    print('unsafe')
else:
    print('safe')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
d={}
l=0
for i in range(n):
    s=input()
    if s not in d.values():
        d[l+1]=s
        l+=1

print(len(d))

Fixed submission:
n=int(input())
a=[0]*n

for i in range(n):
    a[i]=input()
a=sorted(a)
ans=1
for i in range(n-1):
    if a[i]!=a[i+1]:
        ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
d={}
for i in range(n):
    s=input()
    if s not in d.values():
        d[len(d)]=s

print(len(d))

Fixed submission:
n=int(input())
a=[0]*n

for i in range(n):
    a[i]=input()
a=sorted(a)
ans=1
for i in range(n-1):
    if a[i]!=a[i+1]:
        ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
for i in range(n):
    s=input()
    if s not in a:
        a.append(s)

print(len(a))


Fixed submission:
n=int(input())
a=[0]*n

for i in range(n):
    a[i]=input()
a=sorted(a)
ans=1
for i in range(n-1):
    if a[i]!=a[i+1]:
        ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[]
for i in range(n):
    s=input()
    if s not in a:
        a.append(s)

print(len(a))

Fixed submission:
n=int(input())
a=[0]*n

for i in range(n):
    a[i]=input()
a=sorted(a)
ans=1
for i in range(n-1):
    if a[i]!=a[i+1]:
        ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
k=int(input())
tot=0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            tot+=math.gcd(a,math.gcd(b,c))
print(tot)

Fixed submission:
import math
k=int(input())

tot=k*(k+1)//2

for i in range(1,k+1):
    for j in range(i+1,k+1):
        tot+=math.gcd(i,j)*6

for i in range(1,k+1):
    for j in range(i+1,k+1):
        for l in range(j+1,k+1):
            tot+=math.gcd(i,math.gcd(j,l))*6

print(tot)
Buggy python submission (verdict: Time Limit Exceeded):
n,x,y=map(int, input().split())
dist=[]

for i in range(1,n+1):
    for j in range(i+1,n+1):
        dist.append(min(j-i,abs(j-y)+1+abs(i-x)))
for i in range(1,n):
    print(dist.count(i))

Fixed submission:
n,x,y=map(int, input().split())
dist=[0]*(n+1)

for i in range(1,n+1):
    for j in range(i+1,n+1):
        dist[min(j-i,abs(j-y)+1+abs(i-x))]+=1
for i in range(1,n):
    print(dist[i])
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
s=list(input())
q=int(input())
rev=1

for i in range(q):
    a=list(input().split())
    if a[0]=='1':
        rev*=-1
    else:
        if a[1]=='1':
            if rev>0:
                s.insert(0,a[2])
            else:
                s.append(a[2])
        else:
            if rev>0:
                s.append(a[2])
            else:
                s.insert(0,a[2])

if rev<0:
    s=s[::-1]
print(''.join(s))

Fixed submission:
from collections import deque
s=deque(list(input()))
q=int(input())
rev=1

for i in range(q):
    a=list(input().split())
    if a[0]=='1':
        rev*=-1
    else:
        if a[1]=='1':
            if rev>0:
                s.appendleft(a[2])
            else:
                s.append(a[2])
        else:
            if rev>0:
                s.append(a[2])
            else:
                s.appendleft(a[2])

a=[]
for i in range(len(s)):
    a+=s.popleft()    
if rev<0:
    a=a[::-1]
print(''.join(a))

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
s=input()
q=int(input())
rev=1

for i in range(q):
    a=list(input().split())
    if a[0]=='1':
        rev*=-1
    else:
        if a[1]=='1':
            if rev>0:
                s=a[2]+s
            else:
                s=s+a[2]
        else:
            if rev>0:
                s=s+a[2]
            else:
                s=a[2]+s

if rev<0:
    s=s[::-1]
print(''.join(s))

Fixed submission:
from collections import deque
s=deque(list(input()))
q=int(input())
rev=1

for i in range(q):
    a=list(input().split())
    if a[0]=='1':
        rev*=-1
    else:
        if a[1]=='1':
            if rev>0:
                s.appendleft(a[2])
            else:
                s.append(a[2])
        else:
            if rev>0:
                s.append(a[2])
            else:
                s.appendleft(a[2])

a=[]
for i in range(len(s)):
    a+=s.popleft()    
if rev<0:
    a=a[::-1]
print(''.join(a))

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
q=int(input())
for i in range(q):
    a=list(input().split())
    if a[0]=='1':
        s=s[::-1]
    else:
        if a[1]=='1':
            s=a[2]+s
        else:
            s=s+a[2]
print(s)

Fixed submission:
from collections import deque
s=deque(list(input()))
q=int(input())
rev=1

for i in range(q):
    a=list(input().split())
    if a[0]=='1':
        rev*=-1
    else:
        if a[1]=='1':
            if rev>0:
                s.appendleft(a[2])
            else:
                s.append(a[2])
        else:
            if rev>0:
                s.append(a[2])
            else:
                s.appendleft(a[2])

a=[]
for i in range(len(s)):
    a+=s.popleft()    
if rev<0:
    a=a[::-1]
print(''.join(a))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
memo={}
for i in range(n):
  s=input()
  if s not in memo:
    memo[s]=1
  else:
    memo[s]+=1
max_k_list = [kv[0] for kv in memo.items() if kv[1] == max(memo.values())]
print('\n'.join(sorted(max_k_list)))

Fixed submission:
n=int(input())
memo={}
for i in range(n):
  s=input()
  if s not in memo:
    memo[s]=1
  else:
    memo[s]+=1
    
a=[]
max_v = max(memo.values())
for k, v in memo.items():
  if v==max_v:
    a.append(k)
print('\n'.join(sorted(a)))

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
memo={}
for i in range(n):
  s=input()
  if s not in memo:
    memo[s]=1
  else:
    memo[s]+=1
max_k_list = [kv[0] for kv in memo.items() if kv[1] == max(memo.values())]
print('\n'.join(sorted(max_k_list)))

Fixed submission:
n=int(input())
memo={}
for i in range(n):
  s=input()
  if s not in memo:
    memo[s]=1
  else:
    memo[s]+=1
    
a=[]
max_v = max(memo.values())
for k, v in memo.items():
  if v==max_v:
    a.append(k)
print('\n'.join(sorted(a)))
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
p=list(map(int,input().split()))
ans=0
for i in range(n-k+1):
    tmp=sum(p[i:i+k])
    if tmp>ans:
        ans=tmp
print((ans+k)/2)

Fixed submission:
n,k=map(int,input().split())
p=list(map(int,input().split()))

tmp=sum(p[:k])
ans=tmp
for i in range(n-k):
    tmp=tmp-p[i]+p[i+k]
    if tmp>ans:
        ans=tmp
print((ans+k)/2)
Buggy python submission (verdict: Runtime Error):
h,n=map(int,input().split())
a=list(map(int,input().split()),reverse=True)

for i in range(n):
    h-=a[i]
if h>0:
    print('No')
else:
    print('Yes')

Fixed submission:
h,n=map(int,input().split())
a=sorted(list(map(int,input().split())),reverse=True)

for i in range(n):
    h-=a[i]
if h>0:
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7

mb=format(max(a),'b')
arr=[0]*len(mb)

for i in range(n):
    b=format(a[i],'b')
    for j in range(len(b)):
        if b[-j-1]=='1':
            arr[j]+=1

ans=0

for i in range(len(mb)):
    ans+=(arr[i]*(n-arr[i])*(2**i))%mod
print(ans%mod)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7

mb=format(max(a),'b')
arr=[0]*len(mb)

for i in range(n):
    b=format(a[i],'b')
    for j in range(len(b)):
        if b[-j-1]=='1':
            arr[j]+=1

ans=0

for i in range(len(mb)):
    ans+=arr[i]*(n-arr[i])*(2**i)
print(ans%mod)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7

mb=format(max(a),'b')
arr=[0]*len(mb)

for i in range(n):
    b=format(a[i],'b')
    for j in range(len(b)):
        if b[-j-1]=='1':
            arr[j]+=1

ans=0

for i in range(len(mb)):
    ans+=arr[i]*(n-arr[i])*(2**i)
print(ans%mod)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
mod=10**9+7

mb=format(max(a),'b')
arr=[0]*len(mb)

for i in range(n):
    b=format(a[i],'b')
    for j in range(len(b)):
        if b[-j-1]=='1':
            arr[j]+=1

ans=0

for i in range(len(mb)):
    ans+=arr[i]*(n-arr[i])*(2**i)
print(ans%mod)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,intpu().split())
if a<10 and b<10:
  print(a*b)
else:
  print('-1')

Fixed submission:
a,b=map(int,input().split())
if a<10 and b<10:
  print(a*b)
else:
  print('-1')
Buggy python submission (verdict: Runtime Error):
print(max(0,a-b*2))

Fixed submission:
a,b=map(int,input().split())
print(max(0,a-b*2))
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
ans=1

for i in range(n-1):
  flag=s[0]
  if s[i+1]!=flag:
    ans+=flag
    flag=s[i+1]
print(flag)
    

Fixed submission:
n=int(input())
s=input()
ans=1
flag=s[0]

for i in range(n-1):
  if s[i+1]!=flag:
    ans+=1
    flag=s[i+1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=list(map(int,input().split()))

a=sorted(a,reverse=True)
for _ in range(m):
    a[0]=a[0]//2
    a=sorted(a,reverse=True)

print(sum(a))

Fixed submission:
import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))

for i in range(n):
    a[i]*=-1

heapq.heapify(a)
for _ in range(m):
    x=heapq.heappop(a)*(-1)
    x=x//2
    heapq.heappush(a,-x)

print(sum(a)*(-1))

Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())
a=list(map(int,input().split()))

a=sorted(a,reverse=True)
for _ in range(m):
    a[0]=a[0]//2
    a=sorted(a,reverse=True)

print(sum(a))

Fixed submission:
import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))

for i in range(n):
    a[i]*=-1

heapq.heapify(a)
for _ in range(m):
    x=heapq.heappop(a)*(-1)
    x=x//2
    heapq.heappush(a,-x)

print(sum(a)*(-1))

Buggy python submission (verdict: Runtime Error):
import math
n,m=map(int, input().split())
a=sorted(list(map(int, input().split())),reverse=True)
tot=0
rate=[0]*n
p=[0]*n

for i in range(n-1):
  rate[i]=math.log2(a[i]/a[i+1])
  
cur=0
while m>0:
  if rate[cur]>0:
    p[cur]+=1
    rate[cur]-=1
    m-=1
    if cur>0:
      rate[cur-1]+=1
      cur-=1
  else:
    if cur+1<n
      cur+=1
    else:
      p[cur+1]+=1
      rate[cur+1]-=1
      rate[cur]+=1
      cur-=1
  
for i in range(n):
  tot+=int(a[i]/(2**p[i]))
print(tot)

Fixed submission:
import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))

for i in range(n):
    a[i]*=-1

heapq.heapify(a)
for _ in range(m):
    x=heapq.heappop(a)*(-1)
    x=x//2
    heapq.heappush(a,-x)

print(sum(a)*(-1))

Buggy python submission (verdict: Runtime Error):
import math
n,m=map(int, input().split())
a=sorted(list(map(int, input().split())),reverse=True)
tot=0
rate=[0]*n
p=[0]*n

for i in range(n-1):
  rate[i]=math.log2(a[i]/a[i+1])
  
cur=0
while m>0:
  if rate[cur]>0:
    p[cur]+=1
    rate[cur]-=1
    m-=1
    if cur>0:
      rate[cur-1]+=1
      cur-=1
  else:
    cur+=1
  
for i in range(n):
  tot+=int(a[i]/(2**p[i]))
print(tot)

Fixed submission:
import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))

for i in range(n):
    a[i]*=-1

heapq.heapify(a)
for _ in range(m):
    x=heapq.heappop(a)*(-1)
    x=x//2
    heapq.heappush(a,-x)

print(sum(a)*(-1))