Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
k = int(input())

a=[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]

print(a[K-1])

Fixed submission:
k = int(input())

a=[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]

print(a[k-1])
Buggy python submission (verdict: Runtime Error):
S = input()

ans = "No"
for i in range(1:6):
    if S == "hi"*i:
        ans="Yes"
print(ans)

Fixed submission:
S = input()

ans = "No"
for i in range(1,6):
    if S == "hi"*i:
        ans="Yes"
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

A,B=map(int,input().split())

ans=-1
for i in range(1,B*10+1)
    if math.floor(i*0.08)==A and math.floor(i*0.1)==B:
        ans=i
        break

print(ans)

Fixed submission:
import math

A,B=map(int,input().split())

ans=-1
for i in range(1,1001):
    if math.floor(i*0.08)==A and math.floor(i*0.1)==B:
        ans=i
        break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S=input()
Q=int(input())
query=[]
for _ in range(Q):
    query.append(input().split())

flag = True

for i in query:
    if i[0]=="1":
        flag = not flag
#        S=S[::-1]
    else:
        if flag:
            if i[1]=="1":
                S=i[2]+S
            else:
                S=S+i[2]
        else:
            if i[1]=="1":
                S=S+i[2][::-1]
            else:
                S=i[2][::-1]+S
if flag:
    print(S)
else:
    print(S[::-1])

Fixed submission:
S=input()
Q=int(input())
query=[]
for _ in range(Q):
    query.append(input().split())

flag = True
t=""
u=""

for i in query:
    if i[0]=="1":
        u,t=t,u
        flag = not flag
#        S=S[::-1]
    else:
        if i[1]=="1":
            t+=i[2]
        else:
            u+=i[2]
if flag:
    print(t[::-1]+S+u)
else:
    print(t[::-1]+S[::-1]+u)

Buggy python submission (verdict: Runtime Error):
S=input()
Q=int(input())
query=[]
for _ in range(Q):
    query.append(input().split())

flag = True

for i in query:
    if i[0]=="1":
        flag = not flag
#        S=S[::-1]
    else:
        if flag:
            if i[1]=="1":
                S=i[2]+S
            else:
                S=S+i[2]
        else:
            if i[1]=="1":
                S=S+i[2][::-1]
            else:
                S=i[2][::-1]+S
if flag:
    print(S)
else:
    print(S[::-1]

Fixed submission:
S=input()
Q=int(input())
query=[]
for _ in range(Q):
    query.append(input().split())

flag = True
t=""
u=""

for i in query:
    if i[0]=="1":
        u,t=t,u
        flag = not flag
#        S=S[::-1]
    else:
        if i[1]=="1":
            t+=i[2]
        else:
            u+=i[2]
if flag:
    print(t[::-1]+S+u)
else:
    print(t[::-1]+S[::-1]+u)

Buggy python submission (verdict: Time Limit Exceeded):
S=input()
Q=int(input())
query=[]
for _ in range(Q):
    query.append(input().split())

for i in query:
    if i[0]=="1":
        S=S[::-1]
    else:
        if i[1]=="1":
            S=i[2]+S
        else:
            S=S+i[2]
print(S)

Fixed submission:
S=input()
Q=int(input())
query=[]
for _ in range(Q):
    query.append(input().split())

flag = True
t=""
u=""

for i in query:
    if i[0]=="1":
        u,t=t,u
        flag = not flag
#        S=S[::-1]
    else:
        if i[1]=="1":
            t+=i[2]
        else:
            u+=i[2]
if flag:
    print(t[::-1]+S+u)
else:
    print(t[::-1]+S[::-1]+u)
Buggy python submission (verdict: Runtime Error):
_ = input()
a=map(int,*input().split())
flag = True
for i in a:
  if i%2 == 0:
    if i%3 != 0:
      if i%5 != 0:
        flag = False
        break
if flag:
  print("APPROVED")
else:
  print("DENIED")

Fixed submission:
_ = input()
a=map(int,input().split())
flag = True
for i in a:
  if i%2 == 0:
    if i%3 != 0:
      if i%5 != 0:
        flag = False
        break
if flag:
  print("APPROVED")
else:
  print("DENIED")

Buggy python submission (verdict: Runtime Error):
_ = input()
*a,=input().split()
flag = True
for i in a:
  if i%2 == 0:
    if i%3 != 0:
      if i%5 != 0:
        flag = False
        break
if flag:
  print("APPROVED")
else:
  print("DENIED")

Fixed submission:
_ = input()
a=map(int,input().split())
flag = True
for i in a:
  if i%2 == 0:
    if i%3 != 0:
      if i%5 != 0:
        flag = False
        break
if flag:
  print("APPROVED")
else:
  print("DENIED")
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n%2==0:
  print(0.5)
else:
  print((n//2+1)/(n//2))

Fixed submission:
n=int(input())
if n%2==0:
  print(0.5)
else:
  print((n//2+1)/n)
Buggy python submission (verdict: Runtime Error):
print(int(input())**3

Fixed submission:
print(int(input())**3)
Buggy python submission (verdict: Runtime Error):
print(eval(input().replace(" ","//")))

Fixed submission:
a,p=map(int,input().split())
print((a*3+p)//2)
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
K=int(input())

for i in range(len(S)):
  if S[i]!=S[K-1]:
    S[i]="*"
print(S)

Fixed submission:
N=int(input())
S=list(input())
K=int(input())

for i in range(len(S)):
  if S[i]!=S[K-1]:
    S[i]="*"
print(*S,sep="")
Buggy python submission (verdict: Runtime Error):
import math
l=[]
for i in range(5):
  l=l+[int(input())]

temp=[10-i for i in l if i%10!=0]

print(sum(l)-max(li))

Fixed submission:
import math
l=[]
for i in range(5):
  l=l+[int(input())]

li=[i%10 for i in l]
lil = [i for i in li if i!=0]
if lil:
  minimum=min([i for i in li if i!=0])
else:
  minimum=0
ans=l.pop(li.index(minimum))
for i in l:
  ans+=math.ceil(i/10)*10

print(ans)

Buggy python submission (verdict: Runtime Error):
import math
l=[]
for i in range(5):
  l=l+[int(input())]

li=[i%10 for i in l]
minimum=min([i for i in li if i!=0])
ans=l.pop(li.index(minimum))
for i in l:
  ans+=math.ceil(i/10)*10

print(ans)

Fixed submission:
import math
l=[]
for i in range(5):
  l=l+[int(input())]

li=[i%10 for i in l]
lil = [i for i in li if i!=0]
if lil:
  minimum=min([i for i in li if i!=0])
else:
  minimum=0
ans=l.pop(li.index(minimum))
for i in l:
  ans+=math.ceil(i/10)*10

print(ans)
Buggy python submission (verdict: Runtime Error):
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
A=[]
for i in range(N):
  A.append([int(i) in i for input().split()])
ans=0
for a in A:
  asum=0
  for i in range(M):
    asum+=A[i]+B[i]
  asum+=C
  if asum > 0:
    ans+=1
print(ans)

Fixed submission:
N,M,C=map(int,input().split())
B=list(map(int,input().split()))
A=[]
for i in range(N):
  A.append([int(i) for i in input().split()])
ans=0
for a in A:
  asum=0
  for i in range(M):
    asum += a[i]*B[i]
  asum+=C
  if asum > 0:
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
K=[]
ans=0
for _ in range(N):
  K+=[input().split()]
S=set(K)
for s in S:
  if K.count(s)==N:
    ans+=1
print(ans)

Fixed submission:
N,M = map(int,input().split())
K=[]
ans=0
for _ in range(N):
  K+=input().split()[1:]
S=set(K)
for s in S:
  if K.count(s)==N:
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
p=sorted([int(input()) for _ in range(int(input()))])
print(sum(p[0:-1]+p[-1]/2)

Fixed submission:
p=sorted([int(input()) for _ in range(int(input()))])
print(sum(p[0:-1])+p[-1]//2)
Buggy python submission (verdict: Runtime Error):
N=int(input())
s=[int(input()) for _ in range(N)]
M=int(input())
t=[int(input()) for _ in range(M)]
l=set(s)
List=[s.count(l[i])-t.count(l[i]) for i in range(len(l))]
print(max(0,max(List)))

Fixed submission:
N=int(input())
s=[input() for _ in range(N)]
M=int(input())
t=[input() for _ in range(M)]
l=list(set(s))
List=[s.count(l[i])-t.count(l[i]) for i in range(len(l))]
print(max(0,max(List)))
Buggy python submission (verdict: Runtime Error):
N,Yen=map(int,input())

def solver(n,yen):
  for x in range(n+1):
    for y in range(n-x+1):
      z=n-x-y
      if x*10000+y*5000+z*1000 == yen:
        return x,y,z
  return -1,-1,-1
print(solver(N,Yen))

Fixed submission:
N,Yen=map(int,input().split())

def solver(n,yen):
  for x in range(n+1):
    for y in range(n-x+1):
      z=n-x-y
      if x*10000+y*5000+z*1000 == yen:
        return x,y,z
  return -1,-1,-1
print(*solver(N,Yen))
Buggy python submission (verdict: Runtime Error):
print(abs(int(input())-int(input())*2)

Fixed submission:
print(-1*(int(input())-int(input())*2))
Buggy python submission (verdict: Runtime Error):
s=input.split(",")
print(*s)

Fixed submission:
s=input().split(",")
print(*s)

Buggy python submission (verdict: Runtime Error):
s=list(input.split(","))
print(*s)

Fixed submission:
s=input().split(",")
print(*s)
Buggy python submission (verdict: Runtime Error):

N = int(input())
list = [int(a) for a in input().split()]

A = sum(list)//N
ans = 0

for k in range(N):
    ans = ans + (list[j] - A) ** 2

for i in range(-100,100):
    sum = 0
    sum_new = 0
    for j in range(N):
        sum_new = sum_new + (list[j] - i) ** 2
    if(sum > sum_new):
        ans = sum_new

print(ans)


Fixed submission:

N = int(input())
s = 0

for i in range(N):
    s += i+1

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split()))
mod=1000000000000000000
ans=1
p=1
l.sort()
for i in range(0,n):
  x=l[i]
  p=p*x
  if(x==0):
    ans=0
    break
if(p>mod):
    ans=-1
if(ans!=0 and ans!=-1):
  ans=p
print(ans)
  
  


Fixed submission:
n=int(input())
l=list(map(int,input().split()))
mod=1000000000000000000
ans=1
p=1
if(l.count(0)>=1):
    ans=0
else:
    for i in range(0,n):
        x=l[i]
        p=p*x
        if(p>mod):
            ans=-1
            break
if(ans!=0 and ans!=-1):
    ans=p
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split()))
mod=1000000000000000000
ans=1
p=1
for i in range(0,n):
  x=l[i]
  p=p*x
  if(x==0):
    ans=0
    break
if(p>mod):
    ans=-1
if(ans!=0 and ans!=-1):
  ans=p
print(ans)
  
  


Fixed submission:
n=int(input())
l=list(map(int,input().split()))
mod=1000000000000000000
ans=1
p=1
if(l.count(0)>=1):
    ans=0
else:
    for i in range(0,n):
        x=l[i]
        p=p*x
        if(p>mod):
            ans=-1
            break
if(ans!=0 and ans!=-1):
    ans=p
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
l=list(map(int,input().split()))
ans=1;
x=10**18
for i in range(0,n):
    if(l[i]!=0):
        ans=ans*l[i]
    else:
        ans=0
        break;
if(ans>x):
    ans=-1
print(ans)



Fixed submission:
n=int(input())
l=list(map(int,input().split()))
mod=1000000000000000000
ans=1
p=1
if(l.count(0)>=1):
    ans=0
else:
    for i in range(0,n):
        x=l[i]
        p=p*x
        if(p>mod):
            ans=-1
            break
if(ans!=0 and ans!=-1):
    ans=p
print(ans)
Buggy python submission (verdict: Runtime Error):
strings = input()
lists = []
count = 0
for i in strings:
    if i == 'R':
        count += 1
    elif i == 'S':
        lists.append(count)
        count = 0
print(max(lists))

Fixed submission:
strings = input()
lists = []
count = 0
for i in strings:
    if i == 'R':
        count += 1
    elif i == 'S':
        lists.append(count)
        count = 0
lists.append(count)
print(max(lists))
Buggy python submission (verdict: Runtime Error):
print(int(eval(input()) * eval(input()))

Fixed submission:
a, b = map(int, input().split())
print(int(a*b))
Buggy python submission (verdict: Time Limit Exceeded):
n, res = int(input()), 1
List = list(map(int, input().split()))
if 0 in List:
    print(0)
    quit()
for x in List:
    res *= x
    if res > 10**18:
        res = -1
print(res)

Fixed submission:
n = int(input())
List = list(map(int, input().split()))
res = 1
if 0 in List:
    print(0)
    quit()
for x in List:
    res *= x
    if res > 10**18:
        print(-1)
        quit()
print(res)

Buggy python submission (verdict: Runtime Error):
N, result = eval(input()), 1
List = list(map(int, input().split()))
if 0 in List:
  print(0)
  quit()
for i in List[N]:
    result *= i
    
print(result if result <= 10**18 else -1)

Fixed submission:
n = int(input())
List = list(map(int, input().split()))
res = 1
if 0 in List:
    print(0)
    quit()
for x in List:
    res *= x
    if res > 10**18:
        print(-1)
        quit()
print(res)

Buggy python submission (verdict: Runtime Error):
N, result = eval(input()), 1
List = list(map(int, input().split()))
for i in List[N]:
    result *= i
    
print(result if result <= 10**18 else -1)

Fixed submission:
n = int(input())
List = list(map(int, input().split()))
res = 1
if 0 in List:
    print(0)
    quit()
for x in List:
    res *= x
    if res > 10**18:
        print(-1)
        quit()
print(res)

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

N, result = eval(input()), 1
List = list(map(int, input().split()))
result = reduce(lambda x, y: x * y, List[:N])
print(result if result <= 10**18 else -1)

Fixed submission:
n = int(input())
List = list(map(int, input().split()))
res = 1
if 0 in List:
    print(0)
    quit()
for x in List:
    res *= x
    if res > 10**18:
        print(-1)
        quit()
print(res)

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

N, result = eval(input()), 1
List = list(map(int, input().split()))
result = reduce(lambda x, y: x * y, List)
print(result if result <= 10**18 else -1)

Fixed submission:
n = int(input())
List = list(map(int, input().split()))
res = 1
if 0 in List:
    print(0)
    quit()
for x in List:
    res *= x
    if res > 10**18:
        print(-1)
        quit()
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
N, result = eval(input()), 1
List = list(map(int, input().split()))
for i in List[:N]:
    result *= i
    
print(result if result <= 10**18 else -1)

Fixed submission:
n = int(input())
List = list(map(int, input().split()))
res = 1
if 0 in List:
    print(0)
    quit()
for x in List:
    res *= x
    if res > 10**18:
        print(-1)
        quit()
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
N, result = eval(input()), 1
List = list(map(int, input().split()))
for i in List:
    result *= i
print(result if result <= 10**18 else -1)

Fixed submission:
n = int(input())
List = list(map(int, input().split()))
res = 1
if 0 in List:
    print(0)
    quit()
for x in List:
    res *= x
    if res > 10**18:
        print(-1)
        quit()
print(res)
Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
list1, list2, k = [], [], k*2
for x in range(k):
    list1.append(input().split())
while i < k:
    for j in list1[i]:
        list2.append(j)
    i += 2
print(n - len(set(list2)))

Fixed submission:
n, k = map(int, input().split())
li = []
for x in range(k*2):
    li.append(input().split())
li2 = []
i = 1
while i < k*2:
    for j in li[i]:
        li2.append(j)
    i += 2
li2 = set(li2)
print(n - len(li2))

Buggy python submission (verdict: Runtime Error):
n, k = map(int, input().split())
list1, list2, k = [], [], k*2
for x in range(k):
    list1.append(input().split())
while i < k:
    for j in list1[i]:
        list2.append(j)
    i += 2
print(n - len(set(list2)))


Fixed submission:
n, k = map(int, input().split())
li = []
for x in range(k*2):
    li.append(input().split())
li2 = []
i = 1
while i < k*2:
    for j in li[i]:
        li2.append(j)
    i += 2
li2 = set(li2)
print(n - len(li2))
Buggy python submission (verdict: Runtime Error):
K, A, B = map(int, input().split())
count = 0
for i in range(A, B+1):
    if i % K == 0:
        count += 1
print('OK' if count > 0 else 'NG')

Fixed submission:
count, K = 0, int(input())
A, B = map(int, input().split())
for i in range(A, B+1):
    if i % K == 0:
        count += 1
print('OK' if count > 0 else 'NG')
Buggy python submission (verdict: Runtime Error):
from math import floor

X, val, a = eval(input()), 100, 1

while True :
    val += floor(val * 0.01)
    if val >= X:
        break
    a += 1
print(a)

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
daytofinish = sum(A)
if N-daytofinish < 0:
    print(-1)
else:
    print(N-daytofinish)

Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
daytofinish = sum(A)
print(N-daytofinish)
N, M = map(int, input().split())
A = list(map(int, input().split()))
daytofinish = sum(A)
if N-daytofinish < 0:
    print(-1)
else:
    print(N-daytofinish)

Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split()))
daytofinish = sum(A)
if N-daytofinish < 0:
    print(-1)
else:
    print(N-daytofinish)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())
lists = []
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            def gcd(a,b): 
                if(b==0): 
                    return a 
                else: 
                    return gcd(b,a%b)
            
            ans = gcd(a, gcd(b, c))
            lists.append(ans)
print(sum(lists))

Fixed submission:
from math import gcd

k = int(input())
answer = 0
for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            answer += gcd(gcd(a, b), c)
print(answer)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
N = abs(N - K)
if N // 10 == 0:
    while N > 100:
        N = N / 100
while N > 0:
    N = (N - K) 
print(abs(N))

Fixed submission:
a, b, c = map(int, input().split())
print(c, a, b)
Buggy python submission (verdict: Runtime Error):
N, K = map(int, input().split())
N = abs(N - K)
while N > 100:
    N = round(N / N[0])
while N > 0:
    N = (N - K) 
print(abs(N))


Fixed submission:
n, k = map(int, input().split())
if n==0 or k==1:
    print(0)
    exit()
elif n<k:
    print(min(n, abs(n-k)))
    exit()
elif n % k == 0:
    print(0)
    exit()
else:
    mx = n%k
print(min(abs(mx-k), mx))
Buggy python submission (verdict: Runtime Error):
K, N = input().split()
i, lists = 0, []
while i < N:
    lists.append(eval(input()))
    i += 1
if 0 in lists:
   lists.remove(0) 
print(max(lists) - min(lists))

Fixed submission:
string = input("").lower()
print("Yes" if (string[2] == string[3]) and (string[4] == string[5]) else "No")

Buggy python submission (verdict: Runtime Error):
string = input("").lower()
print("Yes" if string[3] == string[4] and string[5] == string[6] else "No")

Fixed submission:
string = input("").lower()
print("Yes" if (string[2] == string[3]) and (string[4] == string[5]) else "No")
Buggy python submission (verdict: Runtime Error):
from itertools import combinations

n = int(input())
list = list(map(int, input().split()))
combination = combinations(lst, 3)
count = 0
for i in combination:
  if i[0] != i[1] and i[1] != i[2] and i[0] != i[2]:
    if i[0] + i[1] > i[2] and i[1] + i[2] > i[0] and i[0] + i[2] > i[1]:
      count += 1

print(count)

Fixed submission:
from itertools import combinations

n = int(input())
num_list = list(map(int, input().split()))
combination = combinations(num_list, 3)
count = 0
for i in combination:
  if i[0] != i[1] and i[1] != i[2] and i[0] != i[2]:
    if i[0] + i[1] > i[2] and i[1] + i[2] > i[0] and i[0] + i[2] > i[1]:
      count += 1
print(count)

Buggy python submission (verdict: Runtime Error):
n = int(input())
lst = list(map(int, input().split()))
comb = combinations(lst, 3)
count = 0
for i in comb:
  if i[0] != i[1] and i[1] != i[2] and i[0] != i[2]:
    if i[0] + i[1] > i[2] and i[1] + i[2] > i[0] and i[0] + i[2] > i[1]:
      count += 1
print(count)

Fixed submission:
from itertools import combinations

n = int(input())
num_list = list(map(int, input().split()))
combination = combinations(num_list, 3)
count = 0
for i in combination:
  if i[0] != i[1] and i[1] != i[2] and i[0] != i[2]:
    if i[0] + i[1] > i[2] and i[1] + i[2] > i[0] and i[0] + i[2] > i[1]:
      count += 1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N, strings, answers = int(input()), [], []
for x in range(N):
    string = input()
    strings.append(string)
max_char = strings.count(max(strings, key=strings.count))
for x in strings:
    if strings.count(x) == max_char:
        answers.append(x)
for x in sorted(set(answers), key=str.lower):
    print(x)

Fixed submission:
from collections import defaultdict
from collections import OrderedDict
N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k]+=1
    else:
        ans.update({k:1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = input().split(" ")
b = set(a)
print "YES" if len(b) > len(a) else "NO"

Fixed submission:
n = int(input())
a = input().split(" ")
b = set(a)
if len(b)<len(a):
    print("NO")
else:
    print("YES")
Buggy python submission (verdict: Runtime Error):
input = sys.stdin.readline
 
n = int(input())
robots = []
for i in range(n):
    x, l = [int(item) for item in input().split()]
    robots.append((x+l, x-l))
 
robots.sort()
 
cnt = 0
node = -10**12
for end, start in robots:
    if start >= node:
        node = end
        cnt += 1
print(cnt)

Fixed submission:
N = int(input())
robots, count = [], 0
for x in range(N):
    X, L = map(int, input().split())
    robots.append((X+L, X-L))
robots.sort()
node = -10**12
for end, start in robots:
    if start >= node:
        node = end
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
s = int(input()).split(" ")
print("bust") if sum(s) >= 22 else print("win")

Fixed submission:
a = [int(x) for x in input().split(" ")]
print("bust") if sum(a) >= 22 else print("win")
Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
s = input().split(" ")
num_list = [int(x) for x in s]
taken_list, count = [x for x in num_list], 0
for x in num_list:
    taken_list.remove(taken_list[0])
    for y in taken_list:
        count += x ^ y
print(count % (pow(10, 9)+7))


Fixed submission:
import numpy as np
 
MAX_DIGIT = 60
MOD = 10**9 + 7
 
N = int(input())
A = np.array([int(a) for a in input().split()])
 
answer = 0
for d in range(MAX_DIGIT + 1):
    A, r = (A>>1), A % 2
    s = int(r.sum())
    base = (1<<d) % MOD
    answer += (base * s * (N - s)) % MOD
 
answer %= MOD
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
s = input().split(" ")
num_list = [int(x) for x in s]
taken_list, count = [x for x in num_list], 0
for x in num_list:
    taken_list.remove(taken_list[0])
    for y in taken_list:
        count += x ^ y
print(count % (pow(10, 9)+7))


Fixed submission:
import numpy as np
 
MAX_DIGIT = 60
MOD = 10**9 + 7
 
N = int(input())
A = np.array([int(a) for a in input().split()])
 
answer = 0
for d in range(MAX_DIGIT + 1):
    A, r = (A>>1), A % 2
    s = int(r.sum())
    base = (1<<d) % MOD
    answer += (base * s * (N - s)) % MOD
 
answer %= MOD
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
s = input().split(" ")
num_list = [int(x) for x in s]
taken_list, count = num_list.copy(), 0
for x in num_list:
    taken_list.remove(taken_list[0])
    for y in taken_list:
        count += x ^ y
print(count % (pow(10, 9)+7))

Fixed submission:
import numpy as np
 
MAX_DIGIT = 60
MOD = 10**9 + 7
 
N = int(input())
A = np.array([int(a) for a in input().split()])
 
answer = 0
for d in range(MAX_DIGIT + 1):
    A, r = (A>>1), A % 2
    s = int(r.sum())
    base = (1<<d) % MOD
    answer += (base * s * (N - s)) % MOD
 
answer %= MOD
print(answer)

Buggy python submission (verdict: Time Limit Exceeded):
num = int(input())
num_list = [int(x) for x in input().split(" ")]
taken_list = num_list.copy()
count = 0
for x in num_list:
    taken_list.remove(taken_list[0])
    for y in taken_list:
        count += x ^ y
print(count%(pow(10, 9)+7))

Fixed submission:
import numpy as np
 
MAX_DIGIT = 60
MOD = 10**9 + 7
 
N = int(input())
A = np.array([int(a) for a in input().split()])
 
answer = 0
for d in range(MAX_DIGIT + 1):
    A, r = (A>>1), A % 2
    s = int(r.sum())
    base = (1<<d) % MOD
    answer += (base * s * (N - s)) % MOD
 
answer %= MOD
print(answer)