Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import itertools
def main():
    number = int(input())
    num_list = list(map(int, stdin.readline().split()))
    comb = list(itertools.combinations(num_list, 2))
    total = sum([c1*c2 for c1, c2 in comb])
    print(total % (1000000007))
if __name__ == '__main__':
    main()


Fixed submission:
from sys import stdin
import itertools
def main():
    number = int(input())
    num_list = list(map(int, stdin.readline().split()))
    num_list_sum = sum(num_list)
    total = 0
    for i in range(number):
        num_list_sum -= num_list[i]
        total += num_list[i] * num_list_sum
    print(total % (10**9+7))
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
import itertools
def main():
    number = int(input())
    num_list = list(map(int, stdin.readline().split()))
    comb = list(itertools.combinations(num_list, 2))
    total = sum([c1*c2 for c1, c2 in comb])
    print(total % (10**9 + 7))
if __name__ == '__main__':
    main()

Fixed submission:
from sys import stdin
import itertools
def main():
    number = int(input())
    num_list = list(map(int, stdin.readline().split()))
    num_list_sum = sum(num_list)
    total = 0
    for i in range(number):
        num_list_sum -= num_list[i]
        total += num_list[i] * num_list_sum
    print(total % (10**9+7))
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
def main():
    number = int(input())
    num_list = list(map(int, stdin.readline().split()))
    sum = 0
    for i in range(number):
        temp = num_list[i]
        for j in range(i+1, number):
            sum += temp*num_list[j]
    print(sum % (10**9 + 7))
if __name__ == '__main__':
    main()

Fixed submission:
from sys import stdin
import itertools
def main():
    number = int(input())
    num_list = list(map(int, stdin.readline().split()))
    num_list_sum = sum(num_list)
    total = 0
    for i in range(number):
        num_list_sum -= num_list[i]
        total += num_list[i] * num_list_sum
    print(total % (10**9+7))
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
def main():
    number = int(input())
    num_list = list(map(int, stdin.readline().split()))
    sum = 0
    for i in range(number):
        temp = num_list[i]
        for j in range(i+1, number):
            sum += temp*num_list[j]
    div = sum // (10**9 + 7)
    print(sum - div * (10**9 + 7))
if __name__ == '__main__':
    main()

Fixed submission:
from sys import stdin
import itertools
def main():
    number = int(input())
    num_list = list(map(int, stdin.readline().split()))
    num_list_sum = sum(num_list)
    total = 0
    for i in range(number):
        num_list_sum -= num_list[i]
        total += num_list[i] * num_list_sum
    print(total % (10**9+7))
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    number = int(input())
    num_list = list(map(int, input().split()))
    total = sum([num_list[i]*num_list[j] % (10**9 + 7) for i in range(number) for j in range(i+1, number)])
    print(total % (10**9 + 7))
if __name__ == '__main__':
    main()

Fixed submission:
from sys import stdin
import itertools
def main():
    number = int(input())
    num_list = list(map(int, stdin.readline().split()))
    num_list_sum = sum(num_list)
    total = 0
    for i in range(number):
        num_list_sum -= num_list[i]
        total += num_list[i] * num_list_sum
    print(total % (10**9+7))
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    number = int(input())
    num_list = list(map(int, input().split()))
    total = sum([num_list[i]*num_list[j] for i in range(number) for j in range(i+1, number)])
    #div = total // (10**9 + 7)
    #print(total - div * (10**9 + 7))
    print(total % (10**9 + 7))
if __name__ == '__main__':
    main()

Fixed submission:
from sys import stdin
import itertools
def main():
    number = int(input())
    num_list = list(map(int, stdin.readline().split()))
    num_list_sum = sum(num_list)
    total = 0
    for i in range(number):
        num_list_sum -= num_list[i]
        total += num_list[i] * num_list_sum
    print(total % (10**9+7))
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    number = int(input())
    num_list = list(map(int, input().split()))
    total = sum([num_list[i]*num_list [j]for i in range(number) for j in range(i+1, number)])
    div = total // (10**9 + 7)
    print(total - div * (10**9 + 7))
if __name__ == '__main__':
    main()

Fixed submission:
from sys import stdin
import itertools
def main():
    number = int(input())
    num_list = list(map(int, stdin.readline().split()))
    num_list_sum = sum(num_list)
    total = 0
    for i in range(number):
        num_list_sum -= num_list[i]
        total += num_list[i] * num_list_sum
    print(total % (10**9+7))
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
def main():
    number = int(input())
    num_list = list(map(int, input().split()))
    sum = 0
    for i in range(number):
        for j in range(i+1, number):
            sum += num_list[i]*num_list[j]
    div = sum // (10**9 + 7)
    print(sum - div * (10**9 + 7))
if __name__ == '__main__':
    main()

Fixed submission:
from sys import stdin
import itertools
def main():
    number = int(input())
    num_list = list(map(int, stdin.readline().split()))
    num_list_sum = sum(num_list)
    total = 0
    for i in range(number):
        num_list_sum -= num_list[i]
        total += num_list[i] * num_list_sum
    print(total % (10**9+7))
if __name__ == '__main__':
    main()