Problem:


Score : 300 points

Problem Statement

Given are N integers A_1,\ldots,A_N.

Find the sum of A_i \times A_j over all pairs (i,j) such that 1\leq i < j \leq N, modulo (10^9+7).

Constraints

2 \leq N \leq 2\times 10^5

0 \leq A_i \leq 10^9

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 \ldots A_N

Output

Print \sum_{i=1}^{N-1}\sum_{j=i+1}^{N} A_i A_j, modulo (10^9+7).

Sample Input 1

3
1 2 3

Sample Output 1

11

We have 1 \times 2 + 1 \times 3 + 2 \times 3 = 11.

Sample Input 2

4
141421356 17320508 22360679 244949

Sample Output 2

437235829



Sample input:
3
1 2 3


Sample output:
11

Submission status: Wrong Answer

Solution code:
def ans():
    s = 0
    for i in range(n):
        s+=a[i]*sum(a[i+1:])
    return s
n = int(input())
a = list(map(int, input().split()))
print(ans())

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))


sum_a = sum(A)
ans = 0
mod = int(1e9+7)

for a in A:
    sum_a -= a
    ans += (sum_a * a) % 1000000007

print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))


sum_a = sum(A)
ans = 0
mod = int(1e9+7)

for a in A:
    sum_a -= a
    ans += (sum_a * a) % (1e9+7)

ans %= (1e9+7)
print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))


sum_a = sum(A)
ans = 0

for a in A:
    sum_a -= a
    ans += (sum_a * a) % (1e9+7)

print(int(ans % (1e9+7)))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))


sum_a = sum(A)
ans = 0

for a in A:
    sum_a -= a
    ans += sum_a * a

print(int(ans % (1e9+7)))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

ans = 0
x = 0

for a in A:
    ans = (ans + a * x)
    x = (x + a)

print(int(ans % (1e9+7)))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

ans = 0
x = 0

for a in A:
    ans = (ans + a * x) % (1e9+7)
    x = (x + a) % (1e9+7)

print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
Ai = list(map(int, input().split()))
sum_ans = sum(Ai)
ans = 0
mod = 100000007

for i in range(n-1):
    sum_ans -= Ai[i]
    ans += sum_ans * Ai[i]
    ans %= mod
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
list1=list(map(int,input().split()))

x=0
for i in list1:
    for j in list1:
        if i<j:
            x=x+i*j
        else:
            continue

x=x%(10**9+7)
print(str(x))

Submission status: Wrong Answer

Solution code:
import copy
N=int(input())
list1=list(map(int,input().split()))

list2=copy.copy(list1)

x=0
for i in list1:
    for j in list2:
        if i<j:
            x=x+i*j
        else:
            continue

x=x%(10**9+7)
print(str(x))

Submission status: Wrong Answer

Solution code:
import copy
N=int(input('N='))
s=0
list1=list(map(int,input().split()))

list2=copy.copy(list1)

x=0
for i in list1:
    for j in list2:
        if i<j:
            x=x+i*j
        else:
            continue

x=x%(10**9+7)
print(str(x))

Submission status: Wrong Answer

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

s = sum(a)
aa = [a[i]*a[i] for i in range(n)]
s2 = sum(aa)

print((s**2 - s2) //2)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 0
mod = 1e9 + 7
s = sum(A) % mod

for i in range(N):
    s -= A[i]
    ans += (A[i] * s) % mod
    ans = ans % mod
print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 0
mod = 1e9 + 7
s = sum(A) % mod

for i in range(N):
    s -= A[i]
    ans += (A[i] * s) % mod
    ans = ans % mod
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 0
mod = 1e9 + 7
s = int(sum(A) % mod)

for i in range(N):
    s -= A[i]
    ans += int((A[i] * s) % mod)
    ans = int(ans % mod)
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 0
mod = 1e9 + 7
s = sum(A) % mod

for i in range(N):
    s -= A[i]
    ans += A[i] * s
    ans = ans % mod
print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 0
mod = 1e9 + 7
s = sum(A) % mod

for i in range(N-1):
    s -= A[i]
    ans += A[i] * s
    ans = ans % mod
print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 0

for i in range(N-1):
    ans += A[i] * sum(A[(i+1):])
    ans = ans % (1e9 + 7)
print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = map(int,input().split())
mod = 10**9 + 7
temp = sum(a)**2
for x in a:
  temp -= x**2
print((temp//2)%mod)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = map(int,input().split())
temp = sum(a)**2
for x in a:
  temp -= x**2
print(temp//2)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
n = int(input())
a = list(map(int, input().split()))
mod = 10 ** 9 + 7
sumA = (sum(a) ** 2) % mod
ans = sumA
for i in range(n):
    ans -= a[i] ** 2
    ans = ans % mod
ans = ans % mod
print(ans // 2)

Submission status: Wrong Answer

Solution code:
m = 10**9 + 7
n = input()
a = list(map(int,input().split()))
ans = 0
s = sum(a)

for i in a:
  s -= i
  ans += s*i
  s += i

ans = ans%m

print(ans)

Submission status: Wrong Answer

Solution code:
l = int(input())
num = input().split(' ')
num = [int(i) for i in num]
ans = 0
s = sum(num)
for i in range(l):
    print(s)
    s -= num[i]
    ans += num[i] * s
    print(ans)
print(ans%(10**9+7))

Submission status: Wrong Answer

Solution code:
times = int(input())
numbers = list(map(int, input().split()))
result = 0
for i in range(times):
  for j in range(i+1, times):
    result += numbers[i] * numbers[j]
print(result)

Submission status: Wrong Answer

Solution code:
n=int(input())
l=list(map(int,input().split()))
s=0
for i in range(0,n):
    for j in range(i+1,n):
        s=s+l[i]*l[j]
print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
sum = 0
ans = 0
for b in a:
  sum = (sum + b) % (10**9+7)
for b in a:
  ans = (ans + (sum - b) * b) % (10**9+7)
print(ans//2)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
    num1 = A[i]
    for j in range(N):
        if i == j:
            continue
        num2 = A[j]
        ans += num1*num2
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
A = list(map(int, input().split()))

mod = 1000000007
res = np.cumsum(A, dtype=np.float64)
ans = 0

for i in range(N-1):
    S = (res[N-1]-res[i]) % mod
    ans += A[i]*S
    ans %= mod

print(int(ans))

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
A = list(map(int, input().split()))

mod = 1000000007
res = np.cumsum(A, dtype=np.float64)
ans = 0

for i in range(N-1):
    S = (res[N-1]-res[i]) % mod
    ans += A[i]*S
    ans %= mod

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
x = list(map(int, input().split()))
import numpy as np
x = np.array(x)
x_sum = np.sum(x)
sq_each = 0
for i in x:
  sq_each += i**2
X = int((x_sum**2 - sq_each) / 2)
while X >= 10**9 + 7:
  X = X - 10**9 - 7
print(int(X))

Submission status: Wrong Answer

Solution code:
a = [list(map(int, input().split())) for i in range(2)]
sum = 0

for i in range(0,a[0][0]-1):
  for j in range(i,a[0][0]):
    sum += a[1][i] * a[1][j]

q = 10 ** 9 + 7
    
print(sum % q)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
Sum = 0
for i in range(N-1):
    for j in range(i+1,N):
        E = int(A[i])*int(A[j])
        Sum += E
print(Sum)

Submission status: Wrong Answer

Solution code:
n = int(input())

arr = list(map(int,input().split()))
summ  = 0
print(arr)
for o in range(n):

	for i in range(o+1,n):
		
		new = arr[i] * arr[o]
		summ+=new
summ = summ % 1000000007		
print(summ)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = []
A += list(map(int,input().split()))
S = 0
k = 0

B = A[1:N]   # A1を除外

C = []

Num = 0
Dum = 0
Gum = 0

for i in range(N-1):
    Num = i
    for j in range(Num+1):
        Dum += A[j]
    C.append(Dum)
    Dum = 0

for k in range(N-1):
    Gum += B[k] * C[k]

print(B)
print(C)
print(Gum % 1000000007)

Submission status: Wrong Answer

Solution code:
N = int(input())
list = input().split()
count = 0
for j in range(N):
  for i in range(j-1):
    a = int(list[i])
    b = int(list[j])
    count += a*b%(10**9+7)
    
print(count)

Submission status: Wrong Answer

Solution code:
N = int(input())
list = input().split()
count = 0
for j in range(N):
  for i in range(j):
    count += int(list[i])*int(list[j])
    
print(count%(10*9+7))

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())
mod = 10**9+7

SUM = sum(As)
ans = 0
for i, a in enumerate(As, 1):
    ans += a*(SUM-a)
    ans %= mod
print(ans*pow(2, mod-2, mod))

Submission status: Wrong Answer

Solution code:
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = list(mapint())
mod = 10**9+7

SUM = sum(As)
ans = 0
for i, a in enumerate(As, 1):
    ans += a*(SUM-a)
    ans %= mod
print(ans//2)

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
su = sum(a)
su %= mod
res = 0
for x in a:
    res += su*x
    res -= x*x
    res %= mod
print(res//2%mod)

Submission status: Wrong Answer

Solution code:
def solve():
    n = int(input())
    A = list(map(int, input().split()))
    ans = sum(A)
    ans *= ans
    ans -= sum([a * a for a in A])
    ans /= 2
    ans %= 1000000007
    print(int(ans))


if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
su = sum(a)
su %= mod
res = 0
for x in a:
    res += su*x
    res -= x*x
    res %= mod
print(res//2)

Submission status: Wrong Answer

Solution code:
n=int(input())
arr=list(map(int, input().split()))
m=[]
for i in range(n):
  for j in range(n):
    if (arr[i]==arr[j]):
      pass
    elif ((arr[i]*arr[j]) in m):
        pass
    else:
      m+=[(arr[i]*arr[j])]
      
print(sum(m))

Submission status: Wrong Answer

Solution code:
n= int(input())
mod=10**9+7
a= [int(x ) for x in input().split()]
b= a[:]

s=0
for i in range(n-2,-1,-1):
    b[i]=b[i+1]+b[i]

for i in range(n):
    s += (b[i]-a[i])*a[i]

Submission status: Wrong Answer

Solution code:
n= int(input())
mod=10**9+7
a= [int(x ) for x in input().split()]
x = sum(a)
y=0
for i in a:
    y=(y+i**2)%mod
print((pow(x,2,mod) - y)//2)

Submission status: Wrong Answer

Solution code:
from operator import index, truediv


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

m = (10**9)+7
l: list = []
for ind, i in enumerate(a):
    for w in a[ind+1:]:
        t = sorted([i, w])
        l.append(t)

l = list(map(list, set(map(tuple, l))))
print(l)
tmp = 0
for i in l:
    tmp += i[0] * i[1]

print(tmp % m)

Submission status: Wrong Answer

Solution code:
import numpy as np
n=int(input())
a=list(map(int, input().split()))
a=np.array(a)
b=np.cumsum(a)
ans=0
mod=10**9+7
for i in range(n-1):
  ans+=a[i]*(b[-1]-b[i])%mod
  ans%=mod
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))

AA=[0]*N
c=0
for i in range(N):
    c=c+A[i]**2

print(int(1/2*((sum(A)**2-c)))%(10**9+7))

Submission status: Wrong Answer

Solution code:
m=int(input(""))
L=[int(i) for i in input().split(" ")]
tot=int(0)
total=sum(L)
for i in range(m):
    total-=L[i]
    tot+=L[i]*total
print(tot)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split(" ")))
mod = 10 ** 9 + 7
s=0
for i in range(n):
    s =(s+a[i])%mod
s = (s*s)%mod
for i in range(n):
    s = (s-(a[i] ** 2)%mod) % mod
s =(s//2)%mod
print(s)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split(" ")))
mod = 10 ** 9 + 7
s=0
for i in range(n):
    s += a[i]
    s %= mod
s = s*s
s %= mod
for i in range(n):
    s -= (a[i] ** 2) % mod
    s %= mod
s /= 2
s %= mod
print(int(s))

Submission status: Wrong Answer

Solution code:
m=input()
L=[int(i) for i in input().split(" ")]
tot=int(0)
for i in range(len(L)-1):
  tot+=L[i]*sum(L[i+1:])
print(tot)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split(" ")))
mod = 10 ** 9 + 7
summ=0
for i in range(n):
    summ+= a[i]
    summ %= mod
s = (summ % mod) ** 2
s %= mod
sq = 0
for i in range(n):
    sq += (a[i] ** 2) % mod
    sq %= mod
s -= sq
s %= mod
s /= 2
s%=mod
print(int(s))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split(" ")))
mod = 10 ** 9 + 7
s = (sum(a) % mod) ** 2
s %= mod
sq = 0
for i in range(n):
    sq += (a[i] ** 2) % mod
    sq %= mod
s -= sq
s%=mod
s /= 2
print(int(s % mod))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

i = 0

for j in A:
    i += j * j
ans = (sum(A) * sum(A) - i) / 2

print(int(ans % 1000000007))

Submission status: Wrong Answer

Solution code:
n = int(input())
s = list(map(int,input().split()))

ans = 0
for i in range(n):
  ans = ans + s[i] * (sum(s) - s[i])

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

Submission status: Wrong Answer

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

ans = 0
sum = 0
for sum_cnt in range(1, n):
    sum += a[sum_cnt]

for i in range(n-1):
    if i == 0:
        ans += a[i]*sum
    else:
        sum -= a[i-1]
        ans += a[i]*sum

ans = ans % (10**9 + 7)

print(ans)

Submission status: Wrong Answer

Solution code:
#整数値入力 1文字の入力
def input_one_number():
    return int(input())

#整数値龍力　複数の入力
def input_multiple_number():
    return map(int, input().split())

#整数値龍力　複数の入力(配列)
def input_multiple_number_as_list():
    return list(map(int, input().split()))

n = input_one_number()
a = input_multiple_number_as_list()

mod = 10**9+7
ssum = 0

sumA = sum(a)%mod

for _a in a:
	ssum += _a * (sumA-_a)
	ssum %= mod

print(ssum//2)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

ans = 0
Q = 1e9 + 7

b = 0

for i in range(1, N):
    b += A[i-1]
    #b %= Q
    ans += A[i] * (b % Q)
    ans %= Q

print(int(ans))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n = int(input())
a_list = list(map(int, input().split()))
a_list = np.array(a_list)
a_square = a_list**2

temp = ((a_list.sum()*a_list.sum())%MOD - (a_square.sum())%MOD)%MOD
if temp&1:
    temp += MOD

ans = temp//2

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n = int(input())
a_list = list(map(int, input().split()))
a_list = np.array(a_list)
a_square = a_list**2

ans = ((a_list.sum()*a_list.sum())%MOD - (a_square.sum())%MOD)//2
ans = ans%MOD

print(ans)

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, copy, time
from fractions import gcd
import numpy as np
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7
EPS = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n = int(input())
a_list = list(map(int, input().split()))
a_list = np.array(a_list)
a_square = a_list**2

ans = (a_list.sum()*a_list.sum() - a_square.sum())//2
ans = ans%MOD

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = list(map(int, input().split()))

s_2 = 0
for i in a_list:
    s_2 += i**2

ans = (sum(a_list)**2 - s_2)/2  

ans = ans%(10**9+7)
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = list(map(int, input().split()))

s_2 = 0
for i in a_list:
    s_2 += i**2

ans = (sum(a_list)**2 - s_2)/2  

ans = int(ans%(10**9+7))
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

ans = 0
Q = 1e9 + 7

b = 0

for i in range(1, N):
    b += A[i-1]
    b %= Q
    ans += A[i] * b
    ans %= Q

print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
sum_A = sum(A)
ans = 0

for i in range(N):
  sum_A = sum_A - A[i]
  ans += A[i] * sum_A
  
print(ans//(10^9 + 7))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
sum_A = sum(A)
ans = 0

for i in range(N-1):
  sum_A = sum_A - A[i]
  ans += A[i] * sum_A
  
print(ans%(10^9 + 7))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
sum_A = sum(A)
ans = 0

for i in range(N):
  sum_A = sum_A - A[i]
  ans += A[i] * sum_A
  
print(ans%(10^9 + 7))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

ans = 0
Q = 1e9 + 7

sumA = sum(A) % Q

for i in range(N-1):
    sumA -= A[i]
    sumA %= Q
    ans += sumA * A[i]
    ans %= Q

print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

ans = 0
Q = 1e9 + 7

sumA = sum(A)

for i in range(N-1):
    sumA -= A[i]
    ans += sumA * A[i]
    ans %= Q

print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

ans = 0
Q = 1e9 + 7

for i in range(N-1):
    for j in range(i+1, N):
        print(A[i], A[j])
        ans += (A[i] * A[j])
        ans %= Q

print(int(ans))

Submission status: Wrong Answer

Solution code:
n = int(input())
A = list(map(int,input().split()))
MOD = 10**9+7
sum_A = sum(A)
ans = 0
for i in range(n-1):
    sum_A -= A[i]
    ans += (A[i]*sum_A)%MOD
print(ans)

Submission status: Wrong Answer

Solution code:
n= int(input())
a=list(map(int,input().split()))
nanika=[]
s=sum(a)
k=0
ans=0
for i in range(n):
    k+=a[i]
    nanika.append(k)
for j in range(n):
    ans+=a[j]*(s-nanika[j])
print(int(ans%(1e+9 +7)))

Submission status: Wrong Answer

Solution code:
n= int(input())
a=list(map(int,input().split()))
sum_a = sum(a)
nanika=[]
k=0
ans=0
for i in range(n):
    k+=a[i]
    nanika.append(k)
for j in range(n):
    ans+=a[j]*(nanika[-1]-nanika[j])
print(int(ans%(1e+9 +7)))

Submission status: Wrong Answer

Solution code:
n= int(input())
a=list(map(int,input().split()))
sum_a = sum(a)
nanika=[]
k=0
ans=0
for i in range(n):
    k+=a[i]
    nanika.append(k)
for j in range(n):
    ans+=a[j]*(nanika[-1]-nanika[j])
print(ans%(1e+9 +7))

Submission status: Wrong Answer

Solution code:
n = int(input())
i_j_list = list(map(int, input().split()))

total = 0
for i,v in enumerate(i_j_list):
  for j in range(i,len(i_j_list)):
    if i < i_j_list[j]:
      total += i * i_j_list[j]
ans = total % (10**9 + 7)
print(ans)

Submission status: Wrong Answer

Solution code:
N=int(input())
a=list(map(int,input().split()))
kick=0
for i in range(N):
    for j in range(N):
        if i<j:
            k=(a[i])*(a[j])
            kick+=k
            print(kick)
print(kick%(1e+9 +7))

Submission status: Wrong Answer

Solution code:
# C - Sum of product of pairs
import numpy as np

N = int(input())
A = list(int(a) for a in input().split())
MOD = 10**9 + 7
A = np.array(A)
csA = np.zeros((N+1), dtype=object)
for i in range(N):
    csA[i+1] = csA[i] + A[i]
    
ans = 0
for i in range(N-1):
    ans += (A[i] * (csA[N] - csA[i+1])) % MOD
print(ans%MOD)

Submission status: Wrong Answer

Solution code:
##C - Sum of product of pairs
N = int(input())
A = list(map(int,input().split()))
import itertools
B = list(itertools.combinations(A,2))
print(sum (list(map(lambda x: x[0] * x[1], B))) )

Submission status: Wrong Answer

Solution code:
##C - Sum of product of pairs
N = int(input())
A = list(map(int,input().split()))
import itertools
B = list(itertools.combinations(A,2))
ans = 0
for i in B:
    ans += i[0]*i[1]
print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
a_list = list(map(int, input().split()))
 
s = 0
for i in a_list:
    for j in a_list:
        s += i*j

s_2 = 0
for i in a_list:
    s_2 += i**2
    
ans = int((s - s_2)/2)
ans %(10**9+7)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

sum = sum(A)
mod = 10 ** 9 + 7
squ = 0

sum = sum **  2

for i in range(N):
    squ +=  A[i] ** 2

answer = int(((sum - squ)  /  2 ) % mod)
print(answer)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

sum_tmp = sum(A)
mod = 10 ** 9 + 7
squ = 0
sum = 0

for i in range(N):
    sum += A[i]*sum_tmp
    squ +=  A[i] ** 2

sum = (sum - squ) / 2
print(int(sum % mod))

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))

sum_tmp = sum(A)
mod = 10 ** 9 + 7
squ = 0
sum = 0

for i in range(N):
    sum += A[i]*sum_tmp
    squ +=  A[i] ** 2

sum = (sum - squ) / 2
print(sum % mod)

Submission status: Wrong Answer

Solution code:
N = int(input())
As = list(map(int, input().split()))
a = sum(As)
b = (a * a - sum([i*i for i in As])) / 2

print(int(b % (1E9 + 7)))

Submission status: Wrong Answer

Solution code:
mod = 10 ** 9 + 7


N = int(input().rstrip())
As = list(map(int, input().rstrip().split()))
ans = 0
add = 0

for i in range(N):
	add += As[i]
	add %= mod
ans = add * add % mod

for i in range(N):
	ans -= As[i] * As[i] % mod
	if (ans < 0):
		ans += mod

ans *= (mod + 1) / 2

print(ans % mod)

Submission status: Wrong Answer

Solution code:
mod = 10 ** 9 + 7


N = int(input().rstrip())
As = list(map(float, input().rstrip().split()))
ans = 0
add = 0

for i in range(N):
	add += As[i]
	add %= mod
ans = add * add % mod

for i in range(N):
	ans -= As[i] * As[i] % mod
	if (ans < 0):
		ans += mod

ans *= (mod + 1) / 2

print(ans % mod)

Submission status: Wrong Answer

Solution code:

mod = 10 ** 9 + 7


N = int(input().rstrip())
As = list(map(int, input().rstrip().split()))
ans = 0.0
add = 0.0

for i in range(N):
	add += As[i]
ans = add * add / 2.0

for i in range(N):
	ans -= As[i] * As[i] / 2.0

print(int(ans) % mod)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N):
    for j in range(i + 1, N):
        a = A[i]
        b = A[j]
        ans += A[i] * A[j]
        ans = ans % (10 ^ 9 + 7)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 0
print(A)
for i in range(N):
    for j in range(N):
        ans += A[i] * A[j]
        ans = ans % (10 ^ 9 + 7)

print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
ans = 0
print(A)
for i in range(N):
    for j in range(N):
        ans += A[i] * A[j]

print(ans % (10 ^ 9 + 7))

Submission status: Wrong Answer

Solution code:
# C - Sum of product of pairs
import numpy as np

N = int(input())
A = list(int(a) for a in input().split())
MOD = 10**9 + 7
A = np.array(A)
csA = np.zeros((N+1), np.object)
for i in range(N):
    csA[i+1] = csA[i] + A[i]
    
ans = 0
for i in range(N-1):
    ans += (A[i] * (csA[N] - csA[i+1])) % MOD
print(ans%MOD)

Submission status: Wrong Answer

Solution code:
import sys

stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n = ni()
    A = nl()
    mod = 10 ** 9 + 7
    s = sum(A)
    q = sum([a ** 2 for a in A])
    ans = (((s * s) - q)) / 2
    print(int(ans) % mod)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
# C - Sum of product of pairs
import numpy as np

N = int(input())
A = list(int(a) for a in input().split())
MOD = 10**9 + 7
A = np.array(A)
csA = np.zeros((N+1), np.int64)
for i in range(N):
    csA[i+1] = csA[i] + A[i]
    
ans = 0
for i in range(N-1):
    ans += (A[i] * (csA[N] - csA[i+1])) % MOD
print(ans%MOD)

Submission status: Wrong Answer

Solution code:
def readInt():
    return list(map(int, input().split()))

n = int(input())
a = readInt()
b = 0
ans = 0

for i in a:
    b += i ** 2

print(sum(a))
ans = ((sum(a) ** 2 - b) // 2) % (10 ** 9 + 7)
print(ans)

Submission status: Wrong Answer

Solution code:
# C - Sum of product of pairs
import numpy as np

N = int(input())
A = list(int(a) for a in input().split())
MOD = 10**9 + 7
npcsA = np.cumsum(A)

ans = 0
for i in range(N-1):
    ans += (A[i] * (npcsA[N-1] - npcsA[i])) % MOD
print(ans%MOD)

Submission status: Wrong Answer

Solution code:
# C - Sum of product of pairs
import numpy as np

N = int(input())
A = list(int(a) for a in input().split())
A = np.array(A)
MOD = 10**9 + 7
csA = np.cumsum(A)

ans = 0
for i in range(N-1):
    ans += (A[i] * (csA[N-1] - csA[i])) % MOD
print(ans%MOD)

Submission status: Wrong Answer

Solution code:
# C - Sum of product of pairs
import numpy as np

N = int(input())
A = list(int(a) for a in input().split())
A = np.array(A)
MOD = 10**9 + 7
csA = np.cumsum(A)

ans = 0
for i in range(N-1):
    ans += (A[i] * (csA[-1] - csA[i])) % MOD
    ans = ans % MOD
print(ans%MOD)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
A = list(int(a) for a in input().split())
A = np.array(A)
MOD = 10**9 + 7

csA = np.cumsum(A)

ans = 0
for i in range(N-1):
    ans = ans + (A[i] * (csA[-1] - csA[i]))%MOD

print(ans%MOD)

Submission status: Wrong Answer

Solution code:
import numpy as np
N=int(input())
A=list(map(int,input().split()))

mod=10**9+7

B=np.zeros(N+1)
for i in range(1,N+1):
    B[i]=A[i-1]+B[i-1]

ans=0
for i in range(N-1):
    ans+=A[i]*(B[N]-B[i+1])
    ans%=mod

print(int(ans))

Submission status: Wrong Answer

Solution code:
mod = 1000000007
n = int(input())
a = list(map(int, input().split()))
ans = 0
a_sum = sum(a) 
a_total = (a_sum*a_sum) 
lat = 0
for i in a:
    lat = lat + i*i
ans = (a_total - lat + 0.1) // 2
ans = ans % mod

print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())
al = list(map(float,input().split()))
sss=0
pss=0
for i in range(1,N):
    pss+=al[i-1]
    sss+=al[i]*pss
print(int(sss)%1000000007)

Submission status: Wrong Answer

Solution code:
mod = 1000000007
n = int(input())
a = list(map(int, input().split()))
ans = 0
a_sum = sum(a) % mod
a_total = (a_sum*a_sum) 
lat = 0
for i in a:
    lat = lat + i*i
ans = (a_total - lat) / 2
ans = ans % mod

print(int(ans))

Submission status: Wrong Answer

Solution code:
N = int(input())
al = list(map(float,input().split()))
sss=0
for i in range(N):
    sss+=al[i]*sum(al[i+1:N])
print(int(sss)%1000000007)

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
a = np.array(list(map(int,input().split())))
a = a.astype("int64")
s1 = a[:]**2
s2 = a.sum()
S = (s2**2-s1.sum())//2 % (np.power(10,9)+7)
print(S)

Submission status: Wrong Answer

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
MOD = 10 ** 9 + 7
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    A = LI()

    ans = (sum(A) ** 2 % MOD - sum([i ** 2 for i in A])) // 2 % MOD
    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Wrong Answer

Solution code:
import numpy as np

N = int(input())
a = np.array(list(map(int,input().split())))
a = a.astype("int64")
s1 = a**2
s2 = a.sum()
S = (s2**2-s1.sum())//2 % (1000000007)
print(S)

Submission status: Wrong Answer

Solution code:
N=int(input())
List = list(map(int, input().split()))
S=0
for i in range(len(List)):
    S+=List[i]
mod=10**9+7
S=S%mod
T=0
for i in range(len(List)):
    T+=List[i]*(S-List[i])
    T=T%mod
print(T//2)

Submission status: Wrong Answer

Solution code:
N=int(input())
List = list(map(int, input().split()))
S=0
for i in range(len(List)):
    S+=List[i]
mod=10**9+7
S=S%mod
T=0
for i in range(len(List)):
    T+=List[i]*(S-List[i])
    T=T%mod
print(T/2)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
a = np.array(list(map(int,input().split())))
s1 = (a*a).sum()
s2 = (a.sum())**2
S = int((s2-s1)/2 % (pow(10,9)+7))
print(S)

Submission status: Wrong Answer

Solution code:
import numpy as np
N = int(input())
a = np.array(list(map(int,input().split())))
s1 = (a*a).sum()
s2 = a.sum()**2
S = (s2-s1)//2%(np.power(10,9)+7)
print(S)

Submission status: Wrong Answer

Solution code:

N = int(input())
p = 10**9 + 7
A = [int(i) for i in input().split()]
S = (sum(A)%p) ** 2 %p
s = sum([(i**2)%p for i in A])%p
if S < s:
    S += p
if (S-s)%2 == 0:
    print((S-s)//2)
else:
    print((s-s+p)//2)

Submission status: Wrong Answer

Solution code:
#入力:[n1,n2,...nk](int:整数配列)
def input_array():
	return list(map(int,input().split()))
  
n=int(input())
A=input_array()
acc_A=[0]

for i in range(n):
	acc_A.append(acc_A[i]+A[i])
ans=0
print(A,acc_A)
for i in range(n):
	# print(A[i]*acc_A[i:n+1])
	ans+=A[i]*(acc_A[n]-acc_A[i+1])

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

Submission status: Wrong Answer

Solution code:
input_num = int(input())
input_list = list(map(int, input().split()))

sum = 0

for i in range(input_num):
    for j in range(input_num - i - 1):
        print(input_list[i], input_list[input_num -1-j])
        sum += input_list[i] * input_list[input_num -1 - j]

print(sum % 1000000007)