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

    res = 0
    bits = [[0]*2 for _ in range(60)]
    for a in al:
        i = 0
        while a > 0:
            bits[i][a&1] += 1
            a = a >> 1
            d += 1

    res = 0

    for i in range(60):
        res += bits[i][0] * bits[i][1]  * (2 ** i)

    print(res % (10 ** 9 + 7))

if __name__ == "__main__":
    main()

Fixed submission:

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

res = 0
bits = [0]*60
for a in al:
    i = 0
    b = a
    while b:
        bits[i] += b&1
        b = b >> 1
        i += 1

res = 0

for j in range(60):
    res += bits[j] * (n - bits[j])  * (2 ** j)

print(res % (10 ** 9 + 7))

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

    res = 0
    bits = [[0]*2 for _ in range(60)]
    for a in al:
        i = 0
        while a > 0:
            bits[i][a&1] += 1
            a == a >> 1
            d += 1

    res = 0

    for i in range(60):
        res += bits[i][0] * bits[i][1]  * (2 ** i)

    print(res % (10 ** 9 + 7))

if __name__ == "__main__":
    main()

Fixed submission:

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

res = 0
bits = [0]*60
for a in al:
    i = 0
    b = a
    while b:
        bits[i] += b&1
        b = b >> 1
        i += 1

res = 0

for j in range(60):
    res += bits[j] * (n - bits[j])  * (2 ** j)

print(res % (10 ** 9 + 7))

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

    res = 0
    bits = [[0]*2 for _ in range(60)]
    for a in al:
        for i in range(60):
            bits[i][int(bin(a >> i)[-1])] += 1

    res = 0

    for i in range(60):
        res += bits[i][0] * bits[i][1]  * (2 ** i)

    print(res % (10 ** 9 + 7))

if __name__ == "__main__":
    main()

Fixed submission:

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

res = 0
bits = [0]*60
for a in al:
    i = 0
    b = a
    while b:
        bits[i] += b&1
        b = b >> 1
        i += 1

res = 0

for j in range(60):
    res += bits[j] * (n - bits[j])  * (2 ** j)

print(res % (10 ** 9 + 7))

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

res = 0
bits = [[0]*2 for _ in range(60)]
for a in al:
    for i in range(60):
        bits[i][int(bin(a >> i)[-1])] += 1

res = 0

for i in range(60):
    res += bits[i][0] * bits[i][1]  * (2 ** i) % (10 ** 9 + 7)

print(res % (10 ** 9 + 7))

Fixed submission:

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

res = 0
bits = [0]*60
for a in al:
    i = 0
    b = a
    while b:
        bits[i] += b&1
        b = b >> 1
        i += 1

res = 0

for j in range(60):
    res += bits[j] * (n - bits[j])  * (2 ** j)

print(res % (10 ** 9 + 7))

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

res = 0
bits = [[0]*2 for _ in range(60)]
for a in al:
    for i in range(60):
        bits[i][int(bin(a >> i)[-1])] += 1

res = 0

for i in range(60):
    res += bits[i][0] * bits[i][1]  * (2 ** i) % (10 ** 9 + 7)

print(res % (10 ** 9 + 7))

Fixed submission:

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

res = 0
bits = [0]*60
for a in al:
    i = 0
    b = a
    while b:
        bits[i] += b&1
        b = b >> 1
        i += 1

res = 0

for j in range(60):
    res += bits[j] * (n - bits[j])  * (2 ** j)

print(res % (10 ** 9 + 7))

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

res = 0
bits = [[0]*2 for _ in range(60)]
for a in al:
    for i in range(60):
        bits[i][int(bin(a >> i)[-1])] += 1

res = 0

for i in range(60):
    res += bits[i][0] * bits[i][1]  * (2 ** i)

print(res % (10 ** 9 + 7))


Fixed submission:

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

res = 0
bits = [0]*60
for a in al:
    i = 0
    b = a
    while b:
        bits[i] += b&1
        b = b >> 1
        i += 1

res = 0

for j in range(60):
    res += bits[j] * (n - bits[j])  * (2 ** j)

print(res % (10 ** 9 + 7))