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):
from itertools import combinations
 
N = int(input())
d = list(map(int, input().split()))
 
score = 0
for i,j in combinations(range(N), 2):
  score += d[i] * d[j]
print(score)

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

Solution (Python):
import itertools
N=int(input())
D=list(map(int,input().split(' ')))
sum_=0
for cmb in itertools.combinations(D, 2):
  sum_+=cmb[0]*cmb[1]

print(sum_)

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

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
ans = 0
for i, ni in enumerate(d):
    for j, nj in enumerate(d):
        if j <= i:
            continue
        else:
            ans += ni * nj

print(ans)

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

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

print(sum)

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 = ans + d[i]*d[j]

print(ans)

Solution (Python):
num=int(input())
data=input().split()
sum=0
 
for a in range(num):
  for b in range(num-1-a):
    sum+=int(data[a])*int(data[-1-b])
print(sum)

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

S = 0

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

print(S)

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 = 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 numpy
N = int(input())
b = list(int(i) for i in input().split())
sum = 0
for i,x in enumerate(b):
    for y in range(i+1,N,1):
        sum =sum +x*b[y]
print(sum)

Solution (Python):
n = int(input())
di = list(map(int,input().split()))
ans0 = 0
ans1 = 0

for i in di:
    ans1 += i * i
    for j in di:
        ans0 += i * j
ans = int((ans0 - ans1)/2)

print(ans)

Solution (Python):
from itertools import combinations
from functools import reduce
from operator import add

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

print(reduce(add, map(lambda x: x[0] * x[1], combinations(d, 2))))

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

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

Solution (Python):
N=int(input())
d=list(map(int,input().split()))
list_A=[]
list_B=[]
for num3 in d:
    list_B.append(int(num3*num3))
k=sum(list_B)
for num in d:
    for num2 in d:
        list_A.append(int(num*num2))
print((sum(list_A)-k)//2)

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

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

result = 0
for x in range(n):
    for y in range(x+1,n):
        result += d[x]*d[y]

print(result)

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

sum=0
for i in range(N):
    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()))
S=0
for i in range(0,N):
  for j in range(0,N):
    if i<j:
      S=S+d[i]*d[j]
print(S)

Solution (Python):
n=int(input())
a=list(map(int,input().split()))
import itertools as it
import numpy as np
al=list(it.combinations(a,2))
total=0
for i in al:
    total+=np.prod(i)
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()))
hp=0
for i in range(n-1):
       for j in range(i+1,n):
            hp=hp+d[i]*d[j]
print(hp)

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

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

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

s = 0

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

print(s)

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

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

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

Solution (Python):

import copy
import random
import bisect 
import fractions 
import math
import sys
import bisect

mod = 10**9+7
sys.setrecursionlimit(mod) 

def LI(): return list(map(int, sys.stdin.readline().split()))

N = int(input())
d = LI()
takoyakis = sum(d)
ans = 0
for takoyaki in d:
    ans += (takoyakis - takoyaki) * takoyaki
print(ans // 2)

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

sum = 0

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

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

sum = 0

for i in range(1, N):
    for s in range(N-1):
        if (s + i) < N:
            sum = sum + (d[s] * d[s+i])
        else:
            break

print(sum)

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

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

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

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

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 itertools

N = input()
d = list(map(int, input().split()))
c = list(itertools.combinations(d,2))
sum = 0
for i,j in c:
  sum += i*j
print(sum)

Solution (Python):
N = int(input())
d_s = list(map(int, input().split()))
S = sum(d_s)
print(sum(list(map(lambda x:(S-x)*x, d_s)))//2)

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

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

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

Solution (Python):
import itertools
n= int(input())
d_list= list(map(int,input().split(" ")))

power_sum = 0
d_comb = itertools.combinations(d_list, 2)
for i in d_comb:
  power_sum+=i[0]*i[1]
  
print(power_sum)

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

for i in range(n-1):
  a = sum(d[i+1:n])
  s += d[i]*a
  
print(s)

Solution (Python):
n = int(input())
array = list(map(int, input().split()))
total = 0

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

print(total)

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

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

print(ans)

Solution (Python):
import itertools
print(sum([i * j for i, j in itertools.combinations([int(i) for i in (input(),input())[1].split()], 2)]))

Solution (Python):
import numpy as np
n = int(input())
d = np.array([int(i) for i in input().split(" ")])
print(np.sum(np.tril(d * d.reshape((len(d), -1)), k=-1)))

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

print(count)

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

Solution (Python):
import itertools

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

health = 0
combination = list(itertools.combinations(d, 2))

for x, y in combination:
    health += x * y

print(health)

Solution (Python):


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

ans = 0

for i in range(0, a):
  if (i == a):
  	break
  
  for j in range(i + 1, a):
    ans += blist[i] * blist[j]

print(ans)

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

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 = s + d[i]*d[j]
       
s = s / 2

print(int(s))

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

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

Solution (Python):
n = input().strip()
d = input().split()
n = int(n)
ans = 0

for i in range(n):
    for j in range(n):
        if i != j:
            ans += int(d[i])* int(d[j])

print(ans // 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):
import itertools

if __name__ == '__main__':

	n = int(input())

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

	B =list(itertools.combinations(A,2))

	cnt = 0
	for lst in B:
		cnt += lst[0] * lst[1]

	print(cnt)

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

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

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

print(total)

Solution (Python):
from itertools import combinations

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

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

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

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

Solution (Python):
import sys
import math

N=int(input())
d=list(map(int,input().split()))
x=[d[i]**2 for i in range(N)]
m=sum(d)**2-sum(x)
print(m//2)

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

print(res)

Solution (Python):
from itertools import combinations

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

ans = sum([x*y for x, y in list(combinations(A, 2))])
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_d=0
sum_d2=0
ans=0

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

print(int(ans/2))

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

for i in range(n):
    sum_d+=d[i]
    sum_d2+=d[i]**2

ans=(sum_d**2-sum_d2)/2
print(int(ans))

Solution (Python):
n = int(input())
d = [int(x) for x 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())
t = list(map(int, input().split()))
a = 0

for i in range(0, n):
    for j in range(i+1, n):
        a += t[i]*t[j]
print(a)

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

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

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

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())
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()))
d_2 = map(lambda x: x*x, d)
print((sum(d) ** 2 - sum(d_2)) // 2)

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

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

ans = 0

while len(takoyaki) > 1:
    s = takoyaki.pop()
    for x in takoyaki:
        ans += s*x

print(ans)

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

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:
			pass 
		else:
			s = s + d[i]*d[j]
			
print(int(s/2))

Solution (Python):
N = int(input())
ds = input().split()
dsum = 0
for i in range(N):
  ds[i] = int(ds[i])
for i in range(N):
  for j in range(i):
    dsum += ds[i]*ds[j]
print(dsum)

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

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

Solution (Python):

from itertools import combinations

def main():
    N = int(input())
    delicious = [int(s) for s in input().split()]
    combis = list(combinations(delicious, 2))
    heal = 0

    for combi in combis:
        heal += combi[0] * combi[1]
    print(heal)

if __name__ == "__main__":
    main()

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

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

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

print(k)

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()))

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

Solution (Python):
import sys
input = sys.stdin.readline
def print_ans(N,input_line):
    """Test Case
    >>> print_ans(3,"3 1 2")
    11
    >>> print_ans(7,"5 0 7 8 3 3 2")
    312
    """
    arr = list(map(int,input_line.split()))
    res = 0
    for i in range(N):
        for j in range(i+1,N):
            res += arr[i] * arr[j]
    print(str(res))
if __name__ == '__main__':
    N = int(input())
    input_line = input()
    print_ans(N,input_line)

Solution (Python):
import itertools
N = int(input())
cb = list(itertools.combinations(list(map(int, input().split())), 2))
sm = 0
for c in cb:
    sm += c[0] * c[1]
print(sm)

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

Solution (Python):


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

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

print(sum)

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

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

ans = 0
for i in range(len(li)):
  for j in range(len(li)):
    if i == j:
      continue
    ans += li[i]*li[j]
    
print(ans//2)

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

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

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

points = 0
for i in range(n-1):
	for j in range(i+1, n):
		points += ListD[i] * ListD[j]

print(points)

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())
a = [int(x) for x in input().split()]
otv = 0
for i in range(n):
    for j in range(i + 1, n):
        otv += a[i]*a[j]
print(otv)

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

dSum = sum(d) ** 2

for i in d:
    dSum -= i ** 2

print(dSum // 2)

Solution (Python):
import itertools
N = int(input())
d = list(map(int, input().split()))
ans = sum([x * y for x, y in itertools.combinations(d, 2)])
print(ans)

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

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
ways = int(n * (n -1) / 2)

total = 0
for i in range(ways):
    for j in range(1 + i, len(d)):
        heal = d[i] * d[j]
        total += heal

print(total)

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

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

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

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

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

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

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

HP = 0

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

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

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

Solution (Python):
a = int(input())
b = input().split(" ")

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

print(sum)

Solution (Python):
n=int(input())
d=list(int(x) for x in input().split())
N=0

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

print(str(N))

Solution (Python):
n = int(input().strip())
ds = list(map(lambda x: int(x.strip()), input().split()))

ans = 0

for i in range(n):
    for j in range(n):
        if (i != j):
            ans += ds[i] * ds[j]

print(int(ans / 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()))
import itertools
import numpy as np
lis = list(itertools.combinations(d,2))
for i in range(len(lis)):
    lis[i] = np.prod(lis[i])
print(sum(lis))

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-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()))
res = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        res += d[i] * d[j]
print(res)

Solution (Python):
n=int(input())
l=list(map(int,input().split()))
m=0
b=0 

for i in range(n):
   b=i
   for j in range((n-i)-1):
       b=b+1
       m=m+l[i]*l[b]

print(m)

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

store=[]

for i in range(N):
    if i < N:
        for j in range(i+1,N):
            store.append(l[i]*l[j])
print(sum(store))

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

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

print(ret)

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

Solution (Python):
n = int(input())
s = list(map(int,input().split()))
e =0

for i in range(n-1):
  for j in range(n-i-1):
    e += s[i]*s[j+i+1]
print(e)

Solution (Python):
def p_b():
    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)
    
p_b()

Solution (Python):
n = int(input())
a = list(map(int,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):



tako_cnt = int(input())
tako_deli = list(map(int, input().strip().split()))

eat_hp = 0
for i in range(0,tako_cnt):
    for j in range(i + 1,tako_cnt):
        eat_hp += tako_deli[i] * tako_deli[j]

print(eat_hp)

Solution (Python):
N=int(input())
takoyaki = list(map(int,input().split()))
cnt=0


for i in range(N-1):
  for j in range(i+1,N):
    cnt+=takoyaki[i]*takoyaki[j]
    

print(cnt)

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

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

Solution (Python):


def solve():
    N = int(input())
    Ds = list(map(int, input().split()))

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

if __name__ == "__main__":
    solve()

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

Solution (Python):
from itertools import *

raw_input()
v = map(int, raw_input().split())
s = sum(x*y for x, y in combinations(v, 2))
print s

Solution (Python):
import math

N=int(input())
d=[0]*N
str=input().split(' ')
for i in range(0,N):
    d[i]=int(str[i])

result=0

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

print(result)

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

umaaji = 0

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

print(umaaji)

Solution (Python):


MOD = 10 ** 9 + 7

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

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

print(ans)

Solution (Python):
N=int(input())
d=list(map(int,input().split()))
s=0
for i in range(N-1):
    for j in range(N-1-i):
        s+=d[i]*d[j+i+1]
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(N-1-i):
        s+=d[i]*d[j+i+1]
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(N-1-i):
        s+=d[i]*d[j+i+1]
print(s)

Solution (Python):



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

ans = 0
for i in range(n):
    for j in range(n):
        if i < j:
            ans += dl[i] * dl[j]

print(ans)

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+=(d[i]*d[j])
print(sum)

Solution (Python):
import numpy as np


def main():
    N = int(input())
    d = np.array([int(a) for a in input().split(" ")])
    s = np.sum(d)
    s2 = np.sum(d * d)
    print(int((s * s - s2) / 2))


if(__name__ == "__main__"):
    main()

Solution (Python):
def main():
  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)
    

if __name__ == '__main__':
    main()

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

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

print(de)

Solution (Python):
n=int(input())
a=[int(i) for i in input().split()]
s=0
for i in range(n-1):
    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())
sum=0
d=input().split()
for i in range(N-1):
    for j in range(i+1,N):
        sum+=int(d[i])*int(d[j])
print(sum)

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

s=0
for i in range(n):
  for j in range(i+1,n):
    s += fav[i]*fav[j]
print(s)

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

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

Solution (Python):
import itertools
N = int(input())
D=[]*N
D=map(int,input().split(" "))
sum=0
for i,j in itertools.permutations(D,2):
    sum+=i*j

print(int(sum/2))

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())
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(i) for i in input().split()]
sum = 0

for i in range(N):
  for j in range(N):
    if i != j:
      sum += d[i] * d[j]

print(int(sum/2))

Solution (Python):
def takoyaki():
    amount = int(input())
    inStr = input().split()
    takoyakis = []
    sumEnergy = 0

    for i in range(amount):
       takoyakis.append(int(inStr[i]))

    for i in range(amount):
        for j in range(i + 1, amount):
            sumEnergy += takoyakis[i] * takoyakis[j]

    print(sumEnergy)

takoyaki()

Solution (Python):
SQ = 0
Pr = 0
N = int(input())
List = list(map(int,input().split()))
for i in range(N):
  SQ += List[i]*List[i]
  for j in range(N):
    Pr += List[i]*List[j]
print(int((Pr-SQ)/2))

Solution (Python):
n = int(input())
d = [int(i) for i 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())
A=list(map(int,input().split()))
result=0
for i in range(n):
    for j in range(i+1,n):
        result+=A[i]*A[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):
n=int(input())
d=list(map(int,input().split()))

ans=0

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

print(ans)

Solution (Python):
from sys import stdin
n = int(stdin.readline().rstrip())
d = [int(x) for x in stdin.readline().rstrip().split()]
a = 0
for i in range(len(d)):
    for j in range(i):
        if i != j:
            a += d[i] * d[j]
print(a)

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

Solution (Python):
from itertools import combinations
input()
print(sum(x * y for x, y in combinations([int(i) for i in input().split()], 2)))

Solution (Python):
from itertools import combinations
input()
d = [int(i) for i in input().split()]
ans = 0
for x, y in combinations(d, 2):
  ans += x * y
print(ans)

Solution (Python):
N = int(input())
A = input().split()
for i in range(0,N):
    A[i] = int(A[i])
s = 0
for i in range(0,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()))
t = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        t += d[i] * d[j]
print(t)

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 x in range(len(d)):
    for y in range(len(d)):
        if x != y :
            ans += d[x] * d[y]

print(int(ans / 2))