Problem:
 Score : 200 points    Problem Statement It's now the season of TAKOYAKI FESTIVAL!  This year, N takoyaki (a ball-shaped food with a piece of octopus inside) will be served. The deliciousness of the i -th takoyaki is d_i .  As is commonly known, when you eat two takoyaki of deliciousness x and y together, you restore x \times y health points.  There are \frac{N \times (N - 1)}{2} ways to choose two from the N takoyaki served in the festival. For each of these choices, find the health points restored from eating the two takoyaki, then compute the sum of these \frac{N \times (N - 1)}{2} values.      Constraints  All values in input are integers.  2 \leq N \leq 50  0 \leq d_i \leq 100         Input Input is given from Standard Input in the following format:  N  d_1  d_2  ...  d_N       Output Print the sum of the health points restored from eating two takoyaki over all possible choices of two takoyaki from the N takoyaki served.        Sample Input 1 3
3 1 2      Sample Output 1 11  There are three possible choices:   Eat the first and second takoyaki. You will restore 3 health points.  Eat the second and third takoyaki. You will restore 2 health points.  Eat the first and third takoyaki. You will restore 6 health points.   The sum of these values is 11 .       Sample Input 2 7
5 0 7 8 3 3 2      Sample Output 2 312

Solution (Python):
N = int(input())
d = [int(i) for i in input().split()]
ans = 0
for i in range(N):
    for j in range(i+1,N):
        ans += d[i]*d[j]
print(ans)

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
su = 0
for i in range(n):
    for j in range(i+1,n):
        su += li[i]*li[j]

print(su)

Solution (Python):
N=int(input())
D=list(map(int,input().split()))
print((sum(D)**2-sum(d*d for d in D))//2)

Solution (Python):
from itertools import combinations

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

ans=0
for a,b in combinations(range(n),2):
  ans+=D[a]*D[b]
  
print(ans)

Solution (Python):
import itertools
N = int(input())
d = list(map(int, input().split()))

lst = list(itertools.combinations(d, 2))
total = 0
for n in lst:
    c = n[0] * n[1]
    total += c
print(total)

Solution (Python):
from itertools import combinations as C

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

D = list(C(d, 2))

ans = 0

for i in D:
    ans += i[0] * i[1]

print(ans)

Solution (Python):
n=int(input())
d=list(map(int, input().split()))
ans=0
for i in range(n-1):
  for j in range(i+1,n):
    ans += d[i]*d[j]
print(ans)

Solution (Python):
from itertools import combinations
n = int(input())
d = list(map(int,input().split()))
c = combinations(d,2)
sumd = 0
for x,y in c:
    sumd += x*y
print(sumd)

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

Solution (Python):
n = int(input())
D = list(map(int, input().split()))
ans = 0

for i in range(n-1):
  for j in range(i+1, n):
    ans += D[i]*D[j]

print(ans)

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

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

Solution (Python):
N = int(input())
D = list(map(int, input().split()))
assert len(D) == N



total = 0
for i,x in enumerate(D[:-1]):
  for y in D[i+1:]:
    total += x * y
print(total)

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

Solution (Python):
n=int(input())
d=list(map(int,input().split()))

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

print(sum)

Solution (Python):
N = int(input())
d = [int(x) for x in input().split()]

result = 0
for i in range(N) :
    for j in range(i+1,N) :
        result += d[i]*d[j]
print(result)

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

Solution (Python):
import itertools

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

takocombi=list(itertools.combinations([i for i in range(N)],2))

ans=0
for h in range(len(takocombi)):
	ans+=D[takocombi[h][0]]*D[takocombi[h][1]]

print(ans)

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
ml = []
for i in range(n):
  for j in range(i+1,n):
    ml.append(d[i]*d[j])
print(sum(ml))

Solution (Python):
N = int(input())
d = list(map(int, input().split()))

ans = 0

for i in range(N):
  for j in range(N):
    if i != j:
      ans += d[i]*d[j]
      
print(ans//2)

Solution (Python):
import itertools
def resolve():
    n = int(input())
    d = tuple(map(int,input().split()))
    ans = 0
    for a in itertools.combinations(d,2):
        ans += a[0]*a[1]
    print(ans)
resolve()

Solution (Python):
N = int(input())
d  = [int(n) for n in input().split()]

ans = 0
for i in range(N-1):
    for j in range(i+1, N):
        ans += d[i] * d[j]

print(ans)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
a = 0
for i in range(n):
    for j in range(n):
        if i != j:
            a += d[i] * d[j]
print(a // 2)

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
ans = 0
for i in range(n-1):
    for j in range(i+1,n):
        ans += d[i] * d[j]
print(ans)

Solution (Python):
N=int(input())
d=list(map(int,input().split()))
ans = 0
from itertools import combinations
for i, j in combinations(range(N), 2):
    ans += d[i]*d[j]
print(ans)

Solution (Python):
from itertools import combinations

n = int(input())
d = list(map(int, input().split()))
ans = 0
sum = sum(d)
for i in d:
    sum -= i
    ans += i*sum
print(ans)

Solution (Python):
from itertools import combinations

n = int(input())
d = list(map(int, input().split()))
ans = 0
d = combinations(d, 2)
for i, j in d:
    ans += i*j
print(ans)

Solution (Python):
from itertools import permutations
n = int(input())
d = [int(i) for i in input().split()]
t = sum([i[0] * i[1] for i in permutations(d, 2)]) // 2
print(t)

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

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

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
print(sum(d[i] * d[j] for i in range(n) for j in range(i+1, n)))

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

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

Solution (Python):

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


ans =0

for i in range(0,n):
  
    for j in range(i+1,n):
       
        ans += d[i]*d[j]

print (ans)

Solution (Python):
N = int(input())
d = list(map(int,input().split()))

ans = 0
for i in range(N):
    for j in range(i+1,N):
        ans += d[i]*d[j]

print(ans)

Solution (Python):
N = int(input())
d = list(map(int,input().split()))

ans = 0
for i in range(N):
    for j in range(i+1, N):
        ans += d[i]*d[j]

print(ans)

Solution (Python):
N = int(input())
D = list(map(int, input().split()))
from itertools import combinations
ans = 0
for i , j in combinations(D,2):
    ans += i*j
print(ans)

Solution (Python):
N = int(input())
D = list(map(int, input().split()))
from itertools import accumulate
print(sum(list(d*c for d, c in zip(D[1:], accumulate(D)))))

Solution (Python):
N = int(input())
D = list(map(int,input().split()))

ans = 0
for i in range(N):
    for j in range(i+1,N):
        ans += D[i]*D[j]

print(ans)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))

ans = 0
for i in range(N-1):
  for j in range(i+1, N):
    ans += d[i] * d[j]
print(ans)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

ans = 0
for i in range(len(d) - 1):
    for k in range(i + 1, len(d)):
        ans += d[i] * d[k]

print(ans)

Solution (Python):
N=int(input())
D=list(map(int,input().split()))
print(sum([D[i]*D[j] for i in range(N) for j in range(i+1,N)]))

Solution (Python):
import itertools
N = int(input())
d = list(map(int, input().split()))

p = list(itertools.permutations(d,2))


n = 0

for i in range(len(p)):
    n = n + (p[i][0] * p[i][1])
    
A = int(n/2)
print(A)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
ans = 0
for i in range(N):
  for j in range(i+1, N):
    if i != j:
      ans += d[i] * d[j]
print(ans)

Solution (Python):
import itertools
n = int(input())
Tako = list(map(int, input().split()))
ans = 0
for x,y in itertools.combinations(Tako,2):
    ans += x*y

print(ans)

Solution (Python):
N = int(input())
dlst = list(map(int, input().split()))
ans = 0
for i in range(len(dlst)-1):
    k = dlst.pop()
    ans = ans + k*sum(dlst)

print(ans)

Solution (Python):
import itertools
n = int(input())
d = list(map(int, input().split()))
M = []
ans = 0

for v in itertools.combinations(d, 2):
    M.append(list(v))

for m in M:
    ans += m[0]*m[1]
print(ans)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        ans += d[i]*d[j]
print(ans)

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

Solution (Python):
N=int(input())
d=list(map(int,input().split()))
print(sum(d[i]*d[j] for i in range(N) for j in range(i+1,N)))

Solution (Python):
N = int(input())
alist = list(map(int, input().split()))
gokei = 0
for i in range(0,N):
    for j in range(i+1,N):
        kaihuku = alist[i]*alist[j]
        gokei += kaihuku
print(gokei)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
d2=[m**2 for m in d]
print((sum(d)**2-sum(d2))//2)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
sm=0
for i in range(len(d)-1):
  for j in range(i+1,len(d)):
    sm+=d[i]*d[j]
print(sm)

Solution (Python):
import itertools
n=int(input())
l=list(map(int,input().split()))
c=itertools.combinations(l,2)
ans=sum(x*y for x,y in c)
print(ans)

Solution (Python):
N = int(input())
D = list(map(int, input().split()))

ANS = 0
for i in range(N):
    for j in range(N):
        if i >= j:
            continue
        ANS = ANS + D[i] * D[j]
print(ANS)

Solution (Python):
n = int(input())
a = [int(x) for x in input().split()]
res = 0
for i in range(n):
  for j in range(i+1,n):
    res += a[i] * a[j]
print(res)

Solution (Python):
t = input()
d = list(map(int, input().split()))
cure = 0
for i in range(len(d)):
  for s in range(i+1, len(d)):
    cure += d[i] * d[s]
print(cure)

Solution (Python):
n = int(input())

oisi = list(map(int,input().split()))

total = 0
for i in range(0,n-1):
  for j in range(i+1,n):
    total += oisi[i] * oisi[j]
    
print(total)

Solution (Python):


n=int(input())
d=list(map(int,input().split()))
ans=0
for i in range(len(d)-1):
    for j in range(i+1,len(d)):
        ans+=d[i]*d[j]
print(ans)

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
ans = 0
for i in range(n):
  for j in range(i+1,n):
    ans += d[i] * d[j]
    

print(ans)

Solution (Python):
N = int(input())
D = list(map(int, input().split()))

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        ans += D[i] * D[j]
print(ans)

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
sum = 0

for x in range(N):
  for y in range(x+1, N):
    sum += L[x]*L[y]
print(sum)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))

s = 0

for i in range(n):
    for j in range(n):
        if i < j:
            s += (d[i] * d[j])

print(s)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
sam=0

for i in range(n):
  for j in range(i+1,n): 
    sam=sam+(d[i]*d[j]) 
    

print(sam)

Solution (Python):
import itertools
total = 0
recovery = 0
n = int(input())
di = list(map(int, input().split()))
for x in itertools.combinations(di, 2):
  
  recovery = x[0] * x[1]
  total += recovery
  
print(total)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))


ans = 0
for i in range(N):
  for j in range(i+1, N):
    ans += d[i]*d[j]
    
print(ans)

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

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

Solution (Python):
from itertools import combinations
input()
d = list(map(int,input().split()))
comb = combinations(d,2)
dsum = 0
for a,b in comb:
    dsum += a*b

print(dsum)

Solution (Python):
n = int(input())
list_d = [int(i) for i in input().split()]
ans = 0
for i in range(0, n - 1):
    ans += list_d[i] * sum(list_d[i + 1:])
print(ans)

Solution (Python):
def main():
    import sys
    readline = sys.stdin.buffer.readline

    n = int(readline())
    d = list(map(int, readline().split()))

    e = sum(d)
    ans = 0
    for i in d:
        e -= i
        ans += i*e
    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):


from typing import *
import collections
import functools as fts
import itertools as its
import math
import sys

INF = float('inf')


def solve(N: int, d: "List[int]"):
    return sum(x * y for x, y in its.combinations(d, 2))


def main():

    sys.setrecursionlimit(10 ** 6)

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  
    d = [int(next(tokens)) for _ in range(N)]  
    print(f'{solve(N, d)}')


if __name__ == '__main__':
    main()

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

Solution (Python):
n=int(input())
D=list(map(int,input().split()))
ans = 0
for i in range(n-1):
  for j in range(i+1,n):
    ans += D[i]*D[j]
print(ans)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))

c=0
for i in range(n-1):
    for j in range(i+1,n):
        c+=(d[i]*d[j])
print(c)

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

Solution (Python):
n = int(input())
lis = list(map(int, input().split()))
ans = 0


for i in range(0, n-1):
  for t in range(i+1, n):
    con = lis[i] * lis[t]
    ans += con
    

print(ans)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
S = [0]
for i in range(N):
  S.append(S[i] + d[i])
ans = 0
for j in range(N):
  ans += d[-j-1] * S[-j-2]
print(ans)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
S = [d[0]]
for i in range(N-1):
  S.append(S[i] + d[i+1])
ans = 0
for j in range(N-1):
  ans += d[j+1] * S[j]
print(ans)

Solution (Python):
n = int(input())
arr = list(map(int, input().split()))

answer = 0
for num1 in range(0, len(arr) - 1):
    for num2 in range(num1+1, len(arr)):
        answer += (arr[num1] * arr[num2])

print(answer)

Solution (Python):
N = int(input())
D = list(map(int,input().split()))

ans = 0

for i in range(N):
    tako1 = D[i]
    
    for j in range(0,i):
        tako2 = D[j]
        
        ans += tako1*tako2
    
    for j in range(i+1,N):
        tako2 = D[j]
        
        ans += tako1*tako2

print(ans//2)

Solution (Python):

N = int(input())
D = list(map(int, input().split()))
ans = 0

for i in range(len(D)-1):
    for j in range(i+1, len(D)):
        ans += D[i]*D[j]
print(ans)

Solution (Python):
import itertools
n = int(input())

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

pattern = itertools.combinations(a,2)
total = 0
for i,j in pattern:
    total += i*j
print(total)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
ans=0
for i in range(n-1):
  for j in range(i+1,n):
    ans+=d[i]*d[j]
print(ans)

Solution (Python):

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

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
sumd = sum(d)
d_2 = sum([i * i for i in d])
print((sumd*sumd-d_2)//2)

Solution (Python):
N = int(input())

dn = list(map(int,input().split()))
ans = 0

for i in range(N):
    for j in range(N):
        if i != j:
            ans += dn[i] * dn[j]
print(ans//2)

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

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

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

Solution (Python):
N=int(input())
D=list(map(int,input().split()))

M=0
for i in range(N):
    for j in range(i+1,N):
        M+=D[i]*D[j]
print(M)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
s = 0

for i in range(N):
    for j in range(i+1, N):
        s += d[i] * d[j]

print(s)

Solution (Python):
a=int(input())
b=0
c=list(map(int,input().split()))
for i in range(a):
  for k in range(a):
    b=b+c[i]*c[k]
for u in range(a):
  b=b-c[u]*c[u]
print(int(b/2))

Solution (Python):
N = int(input())
d = list(map(int, input().split()))

s = 0
for i in range(N):
    for j in range(i+1, N):
        s += d[i] * d[j]

print(s)

Solution (Python):
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    d = list(map(int, readline().split()))

    ans = 0

    for i in range(N):
        for j in range(i + 1, N):
            ans += d[i] * d[j]
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
N=int(input())
d=[int(s) for s in input().split()]
ans=0
for i in range(N-1):
    for j in range(i+1,N):
        ans+=d[i]*d[j]
print(ans)

Solution (Python):
from itertools import combinations
import numpy as np
N = int(input())
D = list(map(int, input().split()))
List = np.array(list(combinations(D,2)))
print(sum(np.product(List, axis = 1)))

Solution (Python):
n=int(input())
li=[int(x) for x in input().split()]
su=[]
for i in range(n-1):
  for j in range(i+1,n):
    su.append(li[i]*li[j])
print(sum(su))

Solution (Python):
from itertools import combinations

n = int(input())
D = list(map(int, input().split()))
x = combinations(D, 2)
ans = 0

for i, j in x:
    ans += i*j
print(ans)

Solution (Python):
n=int(input())
d=[int(x) for x in input().split()]
ans=0
import itertools

for seq in itertools.combinations(range(len(d)),2):
    ans+=d[seq[0]]*d[seq[1]]
print(ans)

Solution (Python):


n = int(input())
d = list(map(int, input().strip().split()))
res = 0
for i in range(1, n):
    for j in range(i):
        res += d[i] * d[j]
print(res)

Solution (Python):
n=int(input())
a=list(map(int,input().split(' ')))
ans = 0
for i in range(n-1):
    for j in range(i+1,n):
        ans+=a[i]*a[j]
print(ans)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
ans=0
for i in range(n):
  for j in range(i+1,n):
    ans+=d[i]*d[j]

print(ans)

Solution (Python):
from itertools import combinations

N = int(input())
d = map(int, input().split())

result = 0
for c in combinations(d, 2):
    result += c[0] * c[1]

print(result)

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

Solution (Python):
N = int(input())
D = list(map(int, input().split()))

A = sum(D)**2 - sum([d*d for d in D])

print(A//2)

Solution (Python):
a = int(input())
b = list(map(int, input().split()))
c = 0
for i in range(a-1):
  for j in range(1,a-i):
    c += b[i]*b[i+j]
print(c)

Solution (Python):
from itertools import combinations
n=int(input())
d=list(map(int,input().split()))
c = list(combinations(d,2))
ans = 0
for i,j in c:
    ans += (i*j)
print(ans)

Solution (Python):
import itertools
N = int(input())
ds = list(map(int, input().split()))
DC = list(itertools.combinations(ds, 2))
L = 0
for i in DC:
	L += i[0]*i[1]
print(L)

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

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
ans = 0

for i in range(n):
  for j in range(1,(len(d)-i)):
    ans += d[i] * d[(i + j)]

print(ans)

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

Solution (Python):
n = int(input())
x = list(map(int,input().split()))
c = 0
for i in range(n-1):
    for j in range(i+1,n):
        c+=x[i]*x[j]
print(c)

Solution (Python):
n = int(input())
x = list(map(int,input().split()))
c = 0
for i in range(n-1):
    for j in range(i+1,n):
        c+=x[i]*x[j]
print(c)

Solution (Python):
def main():
    n = int(input())
    d_lst = list(map(int, input().split()))
    sum_d_lst = sum(d_lst)
    ans = 0

    for i in range(n):
        ans += d_lst[i] * (sum_d_lst - d_lst[i])

    print(ans // 2)


if __name__ == "__main__":
    main()

Solution (Python):
def main():
    n = int(input())
    d_lst = list(map(int, input().split()))
    ans = 0

    for i in range(n - 1):
        for j in range(i + 1, n):
            ans += d_lst[i] * d_lst[j]

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N = int(input())

d = list(map(int, input().split()))
ans = 0

for i in range(N):
    for j in range(i+1, N):
        ans += d[i] * d[j]

print(ans)

Solution (Python):
n = int(input())
d = [int(s) for s in input().split()]

total = 0

for i in range(n - 1):
    for j in range(i + 1, n):
        total += d[i] * d[j]
print(total)

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

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
sm=0
for i in range(N):
    for j in range(i+1,N):
        sm+=d[i]*d[j]
print(sm)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
ans=0
for i in range(n-1):
    for j in range(i+1,n):
        ans+=d[i]*d[j]
print(ans)

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

Solution (Python):
import itertools

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


d = list(itertools.combinations(D,2))
cnt = 0
for i in d:
    cnt += i[0] * i[1]
print(cnt)

Solution (Python):
import itertools
import math

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

ans=0
for v in itertools.combinations(d, 2):
  x=v[0]*v[1]
  ans+=x

print(ans)

Solution (Python):
n=int(input())
li = list(map(int,input().split()))
a=0
for i in range(n-1):
    for j in range(i+1,n):
        a+=li[i]*li[j]
print(a)

Solution (Python):
n=int(input())
li = list(map(int,input().split()))
a=0
for i in range(n):
  for j in range(n):
    a += li[i]*li[j]
b=0
for i in range(n):
    b+= li[i]*li[i]
print((a-b)//2)

Solution (Python):
N=int(input())
d=list(map(int, input().split()))
sum=0
for i in range(0,N-1):
    for j in range(i+1,N):
        sum=sum+d[i]*d[j]
print(sum)

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
sumd = 0
for i in range(len(d)):
    for k in range(i+1,len(d)):
        sumd += d[i]*d[k]
print(sumd)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
l=[x for x in range(n)]


import itertools

p=list(itertools.combinations(l,2))

ans=0

for pp in p:
  ans+=d[pp[0]]*d[pp[1]]

print(ans)

Solution (Python):
import itertools

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

ans_lists = []
for v in itertools.combinations(tastes, 2):
    cure = v[0]*v[1]
    ans_lists.append(cure)

ans = 0
for i in ans_lists:
    ans += i
print(ans)

Solution (Python):
from itertools import combinations

def mapt(fn, *args):
    return tuple(map(fn, *args))

n = int(input())
d = mapt(int, input().split(" "))

print(sum(d[a]*d[b] for a, b in combinations(range(n), 2)))

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

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        ans += d[i]*d[j]
print(ans)

Solution (Python):
n=int(input())
d_list=[int(i) for i in input().split()]
sum_list=[]


for i in range(n):
    for j in range(i+1,n):
        
        sum_list.append(d_list[i]*d_list[j])
        

print(sum(sum_list))

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

Solution (Python):
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=ii()
    D=list(mi())

    ans = 0
    for i in range(N):
        for j in range(i+1,N):
            ans += D[i]*D[j]

    print(ans)




if __name__ == "__main__":
    main()

Solution (Python):
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy


import heapq
sys.setrecursionlimit(10**6)

INF = 10**18
import bisect
import statistics
mod = 10**9+7


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

ans = 0
for i in range(N):
    for j in range(i+1,N):
        ans += d[i]*d[j]

print(ans)

Solution (Python):


n = int(input())
D = list(map(int, input().split()))
ct = 0
for i in range(n):
    for j in range(n):
        if i != j:
            if i < j:
                ct += D[i] * D[j]
print(ct)

Solution (Python):
n=int(input())
d = list(map(int,input().split()))
import itertools
p = itertools.combinations(d, 2)
s=0
for v in p:
    s+=v[0]*v[1]
print(s)

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

Solution (Python):
import sys, bisect, math, itertools, string, queue, copy








def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
l = inpl()
ans = 0
for i in range(0, n):
    for j in range(i + 1, n):
        ans += l[i] * l[j]
print(ans)

Solution (Python):
N = int(input())
d = list(map(int,input().split()))
amount = 0
b = [0] * N
for i in range(N):
    b[i] = amount
    amount += d[N-1-i]


ans = 0
for i in range(N):
    ans += d[i]*b[N-1-i]
print(ans)

Solution (Python):
N = int(input())
d = list(map(int,input().split()))
ans = 0
for i in range(N):
    for j in range(N):
        if i != j:
            ans += d[i]*d[j]
print(ans//2)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
sum = 0

for i in range(n):
    for j in range(n):
        if i > j:
            sum += d[i]*d[j]
            
print(sum)

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
x = 0
for j in range(n - 1):
    for i in range(j + 1):
        x += d[i] * d[j + 1]
print(int(x))

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

Solution (Python):
from itertools import combinations

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

info = list(combinations(d, 2))

ans = 0
for x, y in info:
    ans += x*y

print(ans)

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

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

Solution (Python):
N = int(input())
d = list(map(int,input().split()))

ans = 0
for i in range(N-1):
    for j in range(i+1,N):
        ans += d[i] * d[j]

print(ans)

Solution (Python):
import sys
from itertools import combinations


def main():
    input = sys.stdin.buffer.readline
    _n = int(input())
    d = list(map(int, input().split()))
    ans = 0
    for i, j in combinations(d, 2):
        ans += i * j
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
N=int(input())
d=list(map(int,input().split()))
a=0
for i in range(len(d)):
    for j in range(len(d)):
        if i!=j and i>j:
            a+=d[i]*d[j]
print(a)

Solution (Python):
import itertools
N = int(input())
D = list(map(int, input().split()))

D = list(itertools.combinations(D, 2))

ans = 0
for d in D:
    ans += d[0]*d[1]

print(ans)

Solution (Python):
N = int(input())
D = list(map(int,input().split()))
ans = 0

for n in range(N-1):
  ans+=sum(D[n]*D[n+1:])
  
print(ans)

Solution (Python):
N = int(input())
S = list(map(int,input().split()))

ans = 0
for x in range(N-1):
  for y in range(x+1,N):
    ans += S[x]*S[y]
print(ans)

Solution (Python):
n = int(input())
d=list(map(int,input().split()))

kaihuku = 0

for i in range(n-1):
    for j in range(i+1,n):
        kaihuku += d[i] * d[j]

print(kaihuku)

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

Solution (Python):
import itertools
n = int(input())
a = list(map(int,input().split()))
cnt = 0
for i, j in itertools.combinations(a, 2):
  cnt += i*j
print(cnt)

Solution (Python):
import math 
import itertools

n = int(input())
d = list(map(int, input().split()))
ans = 0
for i in itertools.permutations(d, 2):
    ans += i[0] *i[1]
print(ans //2)

Solution (Python):
N = int(input())
D = list(map(int,input().split()))
power = 0
for i in range(N-1):
    for j in range(i+1,N):
        power += D[i]*D[j]
print(power)

Solution (Python):
N = int(input())
d = list(map(int,input().split()))
sumc = 0
for i in range(len(d)):
    for j in range(i+1,len(d)):
        sumc += d[i]*d[j]
print(sumc)

Solution (Python):
import numpy as np
n=int(input())
d_i = list(map(int, input().split()))  
d=np.array(d_i)
out=0
for i in range(1,n):
    a=d_i.pop(0)
    d_i.append(a)
    out+=np.dot(d,np.array(d_i))
print(int(out/2))

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
ans=0
for i in range(n-1,-1,-1):
    for j in range(0,n):
        if i<=j:
            break
        else:
            ans+=d[i]*d[j]
print(ans)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
ans=0
for i in range(n-1):
  for j in range(i+1,n):
    ans+=d[i]*d[j]
print(ans)