Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
def main():
    a = int(input())
    p = list(map(int,input().split()))
    mod = 10**9 + 7
    sum_list =[p[i]*p[t] for i in range(a) for t in range(a) if i<t ]
    num = np.sum(sum_list)
    num = num%mod
    return num
num = main()
print(num)



Fixed submission:
import itertools as itr

a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7
ans =0
sum_list = list(itr.accumulate(p))
for i in range(len(p)-1):
    o = p[i+1]
    w =sum_list[i]
    ans = (ans+o*w%mod)%mod
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np

a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7

sum_list =[p[i]*p[t] for i in range(a) for t in range(a) if i<t ]
num = np.sum(sum_list)
num = num%mod
print(num)

Fixed submission:
import itertools as itr

a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7
ans =0
sum_list = list(itr.accumulate(p))
for i in range(len(p)-1):
    o = p[i+1]
    w =sum_list[i]
    ans = (ans+o*w%mod)%mod
print(ans)

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

a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7

sum_list =[p[i]*p[t] for i in range(a) for t in range(a) if i<t ]
num = np.sum(sum_list)
num = num%mod
print(num)

Fixed submission:
import itertools as itr

a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7
ans =0
sum_list = list(itr.accumulate(p))
for i in range(len(p)-1):
    o = p[i+1]
    w =sum_list[i]
    ans = (ans+o*w%mod)%mod
print(ans)

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

a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7

sum_list =[p[i]*p[t] for i in range(a) for t in range(a) if i<=t and not i ==t]
num = np.sum(sum_list)
num = num%mod
print(num)

Fixed submission:
import itertools as itr

a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7
ans =0
sum_list = list(itr.accumulate(p))
for i in range(len(p)-1):
    o = p[i+1]
    w =sum_list[i]
    ans = (ans+o*w%mod)%mod
print(ans)

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

sum_list =[p[i]*p[t] for i in range(a) for t in range(a) if i<=t and not i ==t]
num = sum(sum_list)%mod
print(num)

Fixed submission:
import itertools as itr

a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7
ans =0
sum_list = list(itr.accumulate(p))
for i in range(len(p)-1):
    o = p[i+1]
    w =sum_list[i]
    ans = (ans+o*w%mod)%mod
print(ans)

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

sum_list =[p[i]*p[t] for i in range(a) for t in range(a) if i<=t and not i ==t]
print(sum(sum_list)%mod)

Fixed submission:
import itertools as itr

a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7
ans =0
sum_list = list(itr.accumulate(p))
for i in range(len(p)-1):
    o = p[i+1]
    w =sum_list[i]
    ans = (ans+o*w%mod)%mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7
t = 1
sum_list = []
for i in range(a):
    for t in range(a):
        if i <= t and not i ==t:
            w = p[i]*p[t]
            sum_list.append(w)

print(sum(sum_list)%mod)

Fixed submission:
import itertools as itr

a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7
ans =0
sum_list = list(itr.accumulate(p))
for i in range(len(p)-1):
    o = p[i+1]
    w =sum_list[i]
    ans = (ans+o*w%mod)%mod
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7
t = 1
sum_list = []
for i in range(a):
    for t in range(a):
        if i >= t:
            continue
        w = p[i]*p[t]
        sum_list.append(w)

print(sum(sum_list)%mod)

Fixed submission:
import itertools as itr

a = int(input())
p = list(map(int,input().split()))
mod = 10**9 + 7
ans =0
sum_list = list(itr.accumulate(p))
for i in range(len(p)-1):
    o = p[i+1]
    w =sum_list[i]
    ans = (ans+o*w%mod)%mod
print(ans)