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 fractions import gcd
from itertools import combinations,permutations,accumulate, product 

from collections import deque,defaultdict,Counter
import decimal
import re












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

def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
n = I()
ans = 0
d = readInts()
for a,b in combinations(d,2):
    ans += a*b
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()))

pairs = combinations(d, 2)

print(sum(map(lambda x: x[0]*x[1], pairs)))

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

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

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

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):
from itertools import combinations

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

xy = list(combinations(D,2))
ans = 0

for i in range(len(xy)):
    ans += xy[i][0]*xy[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):
import itertools

N, *D = map(int, open(0).read().split())
ans = 0
for v in itertools.combinations(D, 2):
    ans += v[0] * v[1]

print(ans)

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

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

print(ans)

Solution (Python):
import itertools
import functools
import operator
pi = functools.partial(functools.reduce, operator.mul)


def solve():
    N = int(input())
    d = [int(x) for x in input().split()]
    ans = 0
    for c in itertools.combinations(d, 2):
        
        ans += pi(c)
    print(ans)


if __name__ == "__main__":
    solve()

Solution (Python):
N = int(input())
D = list(map(int,input().split()))
cnt = 0
for i in range(N):
    cnt += D[i]**2
tot = 0
for i in range(N):
    tot += D[i]
tot = tot**2
tot -= cnt
print(tot//2)

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):
    temp = A[i]*A[j]
    ans += temp
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):
n = int(input())
l = list(map(int,input().split(' ')))
x = 0
start = 1

for i in l:
    for j in range(start,n):
        x += (i*l[j])
    start += 1

print(x)

Solution (Python):
from functools import reduce
from itertools import accumulate
from math import gcd
n=int(input())
L=list(map(int,input().split()))
print(sum(d*cumulate for d,cumulate in zip(L[1:],accumulate(L))))

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()))
ans=0
import itertools
cb=itertools.combinations(d, 2)
for v in cb:
    ans+=v[0]*v[1]
print(ans)

Solution (Python):
import itertools
N=int(input())
d=list(map(int,input().split()))
ls=[]
for i in range(N):
    ls.append(i)
lsp=list(itertools.permutations(ls,2))

ans=0

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

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

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

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

l = list(it.combinations(d,2))

ans = 0
for i in range(len(l)):
    ans += l[i][0] * l[i][1]

print(ans)

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

Solution (Python):
import itertools

n = int(input())
d = list(map(int, input().split()))
s = 0
c = itertools.combinations(d, 2)

for x, y in c:
    s += x*y
print(s)

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

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

m = 1
num = 0
for s in range(0,n-1):
    for t in range(m,n):
        num += (d[s]*d[t])
    m += 1
print(num)

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

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

d[0]

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())
arr = list(map(int,input().split()))
ans = 0
for i in range(n):
    for j in range(i+1,n):
        ans+=(arr[i]*arr[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 bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
d = LI()
ans = 0
l = list(itertools.combinations(d,2))
for i, j in l:
    ans += i*j
print(ans)

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

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

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

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):
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
d = list(map(int, input().split()))
ans = (sum(d)**2 - sum(item**2 for item in d))//2
print(ans)

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

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

Solution (Python):
n = int(input())
d = [int(s) for s in input().split()]
ans = 0
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        else:
            ans += d[i] * d[j]
print(ans // 2)

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

for i in range(n):
    for j in range(n):
        if i == j:
            continue
        ans += q[i] * q[j]
    
print(ans//2)

Solution (Python):


def main():

    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)


if __name__ == "__main__":
    main()

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())
numList = map(int,input().split())
numList = list(numList)

multiplyList = []
start = 0
for i in range(n+1):
    start += 1
    for j in range(start, n):
        multiplyList.append(numList[i] * numList[j])

print(sum(multiplyList))

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):
    for j in range(n):
        if i != j:
            s += d[i]*d[j]

s //= 2

print(s)

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):
import itertools

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

ans = sum(x * y for x, y in itertools.combinations(D, 2))
print(ans)

Solution (Python):


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    N = read_int()
    D = read_ints()
    S = sum(D)
    answer = 0
    for d in D:
        S -= d
        answer += d*S
    return answer


if __name__ == '__main__':
    print(solve())

Solution (Python):
from itertools import accumulate

N=int(input())
d=[int(i) for i in input().split()]
hp=[]

for i in range(N):
    for j in range(N):
        if i>j:
            hp.append(d[i]*d[j])
l=list(accumulate(hp))
print(l[-1])

Solution (Python):
from itertools import combinations

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

ans = 0
for x, y in combinations(D, 2):
    ans += x * y

print(ans)

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

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

print(ans)

Solution (Python):
n=int(input())
d=[int(x) for x in input().rstrip().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_mul = sum(d)

recovery = 0
for i in range(n):
    sum_mul -= d[i]
    recovery += d[i] * sum_mul

print(recovery)

Solution (Python):
import itertools

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

recovery = 0
for i in itertools.combinations(range(n), 2):
    recovery += d[i[0]] * d[i[1]]
print(recovery)

Solution (Python):
from sys import stdin,stdout
def INPUT():return list(int(i) for i in stdin.readline().split())
import math
def inp():return stdin.readline()
def out(x):return stdout.write(x)
import math as M
MOD=10**9+7
import sys

n=int(input())
A=INPUT()
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()))

from  itertools import combinations

ans = 0
for x, y in combinations(d, 2):
    ans += x*y
print(ans)

Solution (Python):

















































global FLAG_LOG
FLAG_LOG = False


def log(value):
    
    
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    
    N = int(lines[0])
    
    values = list(map(int, lines[1].split()))
    
    
    
    
    
    
    

    result = 0
    for i in range(N-1):
        for j in range(i+1, N):
            log(f'i=[{i}], j=[{j}]')
            result += values[i] * values[j]
            

    return [result]



def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines



def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['3', '3 1 2']
        lines_export = [11]
    if pattern == 2:
        lines_input = ['7', '5 0 7 8 3 3 2']
        lines_export = [312]
    return lines_input, lines_export



def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode



def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(2)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    
    
    
    
    
    
    
    
    
    
    



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 = 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()));print(sum([a[i]*a[j] for i in range(n) for j in range(i+1,n)]))

Solution (Python):



N = int(input())
d = list(map(int, input().split()))
dc = d[:]

ans = []

for i, v in enumerate(d):    
    for j, w in enumerate(dc):
        
        if (i == j):
            continue        
        ans.append(v * w)

print(int(sum(ans)/2))

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

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

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

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

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):
from itertools import combinations
N = int(input())
d = list(map(int,input().split()))
C = list(combinations(range(0,N),2))

ans = 0
for x,y in C:
  ans += d[x] * d[y]

print(ans)

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

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

ans = 0
for i in range(n):
    for j in range(n):
        if i < j:
            ans = ans + l[i] * l[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-1):
        if i == j:
            break
        else:
            ans = ans + d[i]*d[j]
print(ans)

Solution (Python):

import sys
def file():
	sys.stdin = open('input.py', 'r')
	sys.stdout = open('output.py', 'w') 

def main(N, arr):

	
	maxi=float("inf")

	
	ans=0

	
	for i in range(N):

		
	    maxi=min(maxi,arr[i])
	    
	    ans+=maxi
	    print("dhh")

    
	return ans
        

if __name__ == '__main__':

	
	'''N = 4

	
	Arr = [4,3,2,1]

	
	answer = main(N,Arr)

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

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

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

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

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

Solution (Python):
import itertools
N = int(input())
D = list(input().split())
a = itertools.combinations(D,2)
sum= 0
for i,j in a:
    sum += eval("{} * {}".format(i,j))
print(sum)

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

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

Solution (Python):
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def s(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

n = k()
d=l()

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

print(ans)

Solution (Python):
def resolve():
    N = int(input())
    D = list(map(int, input().split()))
    ans = 0
    import itertools
    for x, y in itertools.combinations(D, 2):
        ans += x*y
    print(ans)

if '__main__' == __name__:
    resolve()

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

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

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

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

final = 0

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

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

sum = 0
for I in list(itertools.combinations(array,2)):
    sum += I[0]*I[1]
print(sum)

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

S = sum(d)
T = sum(x*x for x in d)

print((S*S-T)//2)

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

Solution (Python):
def main():
    N = int(input())
    d = list(map(int, input().split()))
    total = 0
    while len(d) > 1:
        c = d[0]
        for i in range(len(d) - 1):
            total = total + (c * d[1 + i])
        d.pop(0)
    print(total)
main()

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

Solution (Python):



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

if __name__ == '__main__':
    main()

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

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):
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):
ans=0
n=int(input())
li=list(map(int,input().split()))
for i in range(len(li)):
  for j in range(len(li)):
    if i==j:
      break
    ans+=li[i]*li[j]
print(ans)

Solution (Python):
n = int(input())
a = [int(x) for x in 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):
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

n = i()
d = intl()

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

Solution (Python):
input()
*l,=map(int,input().split())
print((pow(sum(l),2)-sum([pow(x,2) for x in l]))//2)

Solution (Python):
input()
*l,=map(int,input().split())
ans=0
for i in l:
    for j in l:
        ans+=i*j
print((ans-sum([pow(x,2) for x in l]))//2)

Solution (Python):
input()
*l,=map(int,input().split())
ans=0
for i in l:
    for j in l:
        ans+=i*j
print((ans-sum([x*y for (x, y) in zip(l,l)]))//2)

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

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

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

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

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

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

print(z)

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

Solution (Python):
import sys
input = sys.stdin.readline

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):
import sys
import heapq
import math
import fractions
import bisect
import itertools
from collections import Counter
from collections import deque
from operator import itemgetter
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n=int(input())
a=lmp()
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):
N=int(input())
listD=list(map(int,input().split()))

ans=0

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

print(ans)

Solution (Python):
N = int(input())
Tot = 0
d = [int(x) for x in input().split()]  
for i in range(N):
  for j in range(N):
    if i > j:
      
      Tot += d[i] *d[j]
print(Tot)

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]*N
for i in range(N):
  for j in range(N):
    if(i!=j):
      res[i]+=d[i]*d[j]
print(int(sum(res)/2))

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

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

dd = [di ** 2 for di in d]
print((sum(d) * sum(d) - sum(dd)) // 2)

Solution (Python):
import sys, os, math, bisect, itertools, collections, heapq, queue

from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    D = il()

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


if __name__ == '__main__':
    main()

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):
from itertools import combinations

N = int(input())
takoyaki = list(int(x) for x in input().split())

life = 0

for c in combinations(range(N), 2):
    life += takoyaki[c[0]] * takoyaki[c[1]]

print(life)

Solution (Python):
import sys
import time
import math
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()


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


ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)

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())
dl = list(map(int, input().split()))

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

print(ans)

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

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

print(ans)

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

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

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

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

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

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

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

def main():
    N = input()
    D = map(int, input().split())
    ans = 0
    for v in itertools.combinations(D, 2):
        ans += v[0] * v[1]
    print(ans)


if __name__ == '__main__':
    main()

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

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):
from itertools import *
N = int(input())
D = list(map(int,input().split()))
print(sum(x*y for x,y in combinations(D,2)))

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

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


import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**6)
INF = float("inf")

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 = list(map(int,input().split()))
sum = 0
for i in range(n-1) :
    for k in range(i+1,n):
        sum += d[i]*d[k]
print(sum)

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

from itertools import combinations
counter = 0
for i in combinations(range(N),2):
    a,b = i
    counter += D[a]*D[b]
    

print(counter)

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()))
su = 0

for j  in range(N-1):
  for k in range(j+1, N):
    su += D[j] * D[k]
print(su)

Solution (Python):
N=int(input())
d=list(map(int, input().split()))
ans=0
while len(d) > 1:
    tmp = d.pop(0)
    for i in d:
        ans += tmp * i
print(ans)