Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

max_digist = 60
MOD = 10**9 + 7

ans = 0
for i in range(max_digits):
    one_num = np.count_nonzero((a >> i) & 1)
    radix_mod = 2**i % MOD
    ans += (radix_mod * one_num * (n - one_num)) % MOD
print(ans%MOD)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

max_digits = 60
MOD = 10**9 + 7

ans = 0
for i in range(max_digits):
    one_num = np.count_nonzero((a >> i) & 1)
    radix_mod = 2**i % MOD
    ans += (radix_mod * one_num * (n - one_num)) % MOD
print(ans%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

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

max_digits = 60  # 最大桁数は60
MOD = 10**9 + 7

# format関数で10進数から2進数に変換
bin_arr = np.array(list(map(lambda x: list(format(x, 'b').zfill(max_digits))[::-1], a)), dtype='int')

ans = 0
n_mod = n % MOD
for i in range(max_digits):
    # 各位ごとの合計は2**k × 1の数 × 0の数
    one_mod = np.count_nonzero(bin_arr[:, i]) % MOD
    radix_mod = 2**i % MOD
    ans += (radix_mod * one_mod * (n_mod - one_mod)) % MOD
print(ans % MOD)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

max_digits = 60
MOD = 10**9 + 7

ans = 0
for i in range(max_digits):
    one_num = np.count_nonzero((a >> i) & 1)
    radix_mod = 2**i % MOD
    ans += (radix_mod * one_num * (n - one_num)) % MOD
print(ans%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

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

MOD = 10**9 + 7

# format関数で10進数から2進数に変換
max_digits = len(format(max(a), 'b'))  # 最大桁数

# 各位の1の数を記録していく
counter = []
for i in range(n):
    counter.append(list(format(a[i], 'b').zfill(max_digits))[::-1])  # 逆順にする 
cnt_arr = np.array(counter, dtype='int')

ans = 0
n_mod = n % MOD
for i in range(max_digits):
    # 各位ごとの合計は2**k × 1の数 × 0の数
    one_mod = np.count_nonzero(cnt_arr[:, i]) % MOD
    radix_mod = 2**i % MOD
    ans += (radix_mod * one_mod * (n_mod - one_mod)) % MOD
print(ans % MOD)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

max_digits = 60
MOD = 10**9 + 7

ans = 0
for i in range(max_digits):
    one_num = np.count_nonzero((a >> i) & 1)
    radix_mod = 2**i % MOD
    ans += (radix_mod * one_num * (n - one_num)) % MOD
print(ans%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

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

MOD = 10**9 + 7

# format関数で10進数から2進数に変換
max_digits = len(format(max(a), 'b'))  # 最大桁数

# 各位の1の数を記録していく
counter = []
for i in range(n):
    counter.append(list(format(a[i], 'b').zfill(max_digits))[::-1])  # 逆順にする 
cnt_arr = np.array(counter, dtype='int')

ans = 0
n_mod = n % MOD
for i in range(max_digits):
    # 各位ごとの合計は2**k × 1の数 × 0の数
    one_num = np.count_nonzero(cnt_arr[:, i]) % MOD
    ans += (2**i * one_num * (n_mod - one_num)) % MOD
print(ans % MOD)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

max_digits = 60
MOD = 10**9 + 7

ans = 0
for i in range(max_digits):
    one_num = np.count_nonzero((a >> i) & 1)
    radix_mod = 2**i % MOD
    ans += (radix_mod * one_num * (n - one_num)) % MOD
print(ans%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

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

MOD = 10**9 + 7

# format関数で10進数から2進数に変換
max_digits = len(format(max(a), 'b'))  # 最大桁数

# 各位の1の数を記録していく
counter = []
for i in range(n):
    counter.append(list(format(a[i], 'b').zfill(max_digits))[::-1])  # 逆順にする 
cnt_arr = np.array(counter, dtype='int')

ans = 0
for i in range(max_digits):
    # 各位ごとの合計は2**k × 1の数 × 0の数
    one_num = np.count_nonzero(cnt_arr[:, i]) % MOD
    ans += (2**i * one_num * (n - one_num)) % MOD
print(ans % MOD)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

max_digits = 60
MOD = 10**9 + 7

ans = 0
for i in range(max_digits):
    one_num = np.count_nonzero((a >> i) & 1)
    radix_mod = 2**i % MOD
    ans += (radix_mod * one_num * (n - one_num)) % MOD
print(ans%MOD)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

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

MOD = 10**9 + 7

# format関数で10進数から2進数に変換
max_digits = len(format(max(a), 'b'))  # 最大桁数

# 各位の1の数を記録していく
counter = []
for i in range(n):
    counter.append(list(format(a[i], 'b').zfill(max_digits))[::-1])  # 逆順にする 
cnt_arr = np.array(counter, dtype='int')

ans = 0
for i in range(max_digits):
    # 各位ごとの合計は2**k × 1の数 × 0の数
    one_num = np.count_nonzero(cnt_arr[:, i])
    ans += (2**i * one_num * (n - one_num)) % MOD
print(ans % MOD)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

max_digits = 60
MOD = 10**9 + 7

ans = 0
for i in range(max_digits):
    one_num = np.count_nonzero((a >> i) & 1)
    radix_mod = 2**i % MOD
    ans += (radix_mod * one_num * (n - one_num)) % MOD
print(ans%MOD)

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

# format関数で10進数から2進数に変換
max_digits = len(format(max(a), 'b'))  # 最大桁数

# 各位の1の数を記録していく
counter = [0]*max_digits
for i in range(n):
    for i, b in enumerate(format(a[i], 'b')[::-1]):
        counter[i] += int(b)
        
MOD = 10**9 + 7

ans = 0
for i in range(max_digits):
    # 各位ごとの合計は2**k × 1の数 × 0の数
    ans += (2**i * counter[i] * (n - counter[i])) % MOD
print(ans % MOD)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

max_digits = 60
MOD = 10**9 + 7

ans = 0
for i in range(max_digits):
    one_num = np.count_nonzero((a >> i) & 1)
    radix_mod = 2**i % MOD
    ans += (radix_mod * one_num * (n - one_num)) % MOD
print(ans%MOD)

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

# format関数で10進数から2進数に変換
max_digits = len(format(max(a), 'b'))  # 最大桁数

# 各位の1の数を記録していく
counter = [0]*max_digits
for i in range(n):
    for i, b in enumerate(format(a[i], 'b')[::-1]):
        counter[i] += int(b)
        
MOD = 10**9 + 7

ans = 0
for i in range(max_digits):
    # 各位ごとの合計は2**k × 1の数 × 0の数
    ans += (2**i * counter[i] * (n - counter[i])) % MOD
print(ans % MOD)

Fixed submission:
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

max_digits = 60
MOD = 10**9 + 7

ans = 0
for i in range(max_digits):
    one_num = np.count_nonzero((a >> i) & 1)
    radix_mod = 2**i % MOD
    ans += (radix_mod * one_num * (n - one_num)) % MOD
print(ans%MOD)