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):
import numpy as np

takoyaki_num = int(input())
oishisa_list = input().split(" ")

oishisa_vec = np.array(oishisa_list, dtype=int)


oishisa_outer_sum = np.sum(np.outer(oishisa_vec, oishisa_vec))
oishisa_dot = np.dot(oishisa_vec, oishisa_vec)

total_heal_int = int((oishisa_outer_sum - oishisa_dot) / 2)
print(total_heal_int)

Solution (Python):
import itertools

n = input()
list_ = [int(i) for i in input().split()]

def calc(x,y):
  return x * y


  
sum = 0
for i in itertools.combinations(list_, r=2):
    sum += calc(*i)
  
print(sum)

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

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

print(ans)

Solution (Python):
input1 = int(input())
input_list = list(map(int, input().split()))

done_dict = {}
sum = 0
for i in range(input1):
    for j in range(input1):
        if i != j and (not done_dict.get(j)):
            sum += input_list[i] * input_list[j]

    done_dict[i] = True
print(sum)

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

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

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

s = int(0)

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

print(s)

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

Solution (Python):
import copy

count = int(input())
balls = list(map(int, input().split()))
mutable_balls = copy.deepcopy(balls)

ans = 0
for i, ball in enumerate(balls):
  for j, ball2 in enumerate(balls):
    if i != j:
      ans += ball * ball2

print(int(ans / 2))

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

Solution (Python):


N = int(input())

d = [int(a) for a in input().split()]
sum = 0
i, j = 0, 0
while i < N:
  j = i+1
  while j < N:
    sum += d[i] * d[j]
    j += 1
  i+= 1
print('{}'.format(sum))

Solution (Python):
import itertools
a =int(input())
ans=0
l = [int(a) for a in input().split()]
for x in itertools.combinations(l, 2):
  ans+=int(x[0]*x[1])
print(ans)

Solution (Python):
import itertools
n = input()
b = [int(i) for i in input().split()]
cnt = 0
for c in itertools.combinations(b, 2):
    cnt = cnt + c[0]*c[1]
print(cnt)

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(raw_input())
li = map(int, raw_input().split())

s = 0

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

print s

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

count = 0
ans = 0

for i in d_list:
    count += 1
    sum_temp = 0
    for m in range(count, n):
        sum_temp += i*d_list[m]
    ans += sum_temp

print(ans)

Solution (Python):
import itertools

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

result = 0
for i in itertools.combinations((data), r=2):
  result += i[0] * i[1]

print(result)

Solution (Python):
import itertools
N = int(input())
A = list(map(int, input().split()))
s = []
ans = 0
for i in itertools.combinations(A, r=2):
    s.append(i)

for x in s:
    ans += x[0]*x[1]

print(ans)

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

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

for i in range(N):
    for j in range(N-1):
        if i < (j+1):
            sum = sum + nums[i]*nums[j+1]

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

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

Solution (Python):
import sys

total = 0
input = sys.stdin.readline

N = int(input())
point_list = [int(x) for x in input().split()]

for i in range(N):
  sub_total = 0
  M = point_list.pop()
  for p in point_list:
    sub_total += M * p
  total += sub_total

print(total)

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

Solution (Python):
N=int(input())
array = list(map(int, input().strip().split()))
sum_value=0
number_value=0
for item in array:
  sum_value = sum_value + item * number_value
  number_value = number_value + item
print(sum_value)

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

score = 0
for i in range(len(d_list) - 1):
  for j in range(i + 1, len(d_list)):
    score += d_list[i] * d_list[j]
    
print(score)

Solution (Python):
N = int(input())
dd = list(map(int, input().split()))
ans = []
for i in range(N):
    for d2 in dd[i+1:]:
        ans.append(dd[i]*d2)
print(sum(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]

print(ans)

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

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("{}".format(sum))

Solution (Python):
import sys

N = int(input())
a = list(map(int,input().split()))
b = len(a)

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


print(wa)

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

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

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
ans = 0
for i in range(0,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(0, n - 1):
    for j in range(0, n):
        if j <= i:
            continue

        ans += d[i] * d[j]


print(ans)

Solution (Python):
import itertools

num = input()
recoveryValues = input().split()
recoveryTotal = 0

combinations = itertools.combinations(recoveryValues, 2)

for v in combinations:
    recoveryTotal += (int(v[0]) * int(v[1]))

print(recoveryTotal)

Solution (Python):
import numpy as np
n=input()
data=np.array(list(map(int,input().split(' '))))
z=0
for i in range(len(data)-1):
    for j in range(i+1,len(data)):
        z+=data[i]*data[j]
print(z)

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

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

s = 0

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

  
print(s)

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

Solution (Python):
def square(list):
    return [i ** 2 for i in list]

n=int(input())
dlist=list(map(int, input().split()))
ans=0
s= sum(dlist)
w= sum(square(dlist))
ans=(s**2-w)//2
print(ans)

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

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

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

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

cnt = 0
for i, d1 in enumerate(d):
    for j, d2 in enumerate(d[i+1:]):
        cnt += d1 * d2
print(cnt)

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

import itertools
s = sum([i * j for i, j in list(itertools.combinations(d, 2))])
print(s)

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

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


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


from itertools import combinations

c = combinations(d, 2)
ans = 0
for i, j in c:
    ans += i*j

print(ans)

Solution (Python):

import sys
import itertools


def solve(N: int, d: "List[int]"):
    ans = sum([a * b for a, b in itertools.combinations(d, 2)])
    print(ans)
    return


def main():
    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)]  
    solve(N, d)


if __name__ == '__main__':
    main()

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




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

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

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

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

def double(n):
  return n**2

points = list(map(int, input().split( )))
points_2 = sum(list(map(double, points)))

total = list()

for i in range(n):
  for j in range(n):
    total.append(points[i] * points[j])

print(round((sum(total)-points_2)/2))

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

to = 0

ny = 0
for x in range(n):
    ny +=1
    for y in range(ny,n):
        
        to += h[x]*h[y]

print (to)

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

import itertools
X = list(itertools.combinations(range(N), 2))

Y = 0
Z = int(N * (N - 1) / 2)
for i in range(Z):
    Y += d[X[i][0]] * d[X[i][1]]
print(Y)

Solution (Python):
import itertools
import sys
input = sys.stdin.readline
A = 0
N = int(input())

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

for v in itertools.combinations(O, 2):
  A = A + (v[0] * v[1])
print(A)

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

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

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

import itertools

boxes = []
data = []

for i in itertools.combinations(box, 2): 
    boxes.append(i)

for k in boxes:
    data.append(k[0] * k[1])

i = 0 

for r in data:
    i = r + i 

print(i)

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

total = 0

for first in range(len(list_d)):
  for second in range(len(list_d)):
    if first < second:
      total += list_d[first] * list_d[second]

print(total)

Solution (Python):
n= int(input())
a= input().split()
d = [int(s) for s in a]
d_1 = 0
for i in range(n):
    d_1 = d[i]*d[i] + d_1
ans = (sum(d)*sum(d) - d_1)/2
print(int(ans))

Solution (Python):



def solve(*args: str) -> str:
    n = int(args[0])
    dn = list(map(int, args[1].split()))

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

    return str(s)


if __name__ == "__main__":
    print(solve(*[input() for _ in range(2)]))

Solution (Python):
def solve_b(n, d_list):
    s1 = sum(d_list)
    s2 = sum([d ** 2 for d in d_list])
    res = (s1 ** 2 - s2) // 2
    return res


def main():
    n = int(input())
    d_list = list(map(int, input().split()))
    res = solve_b(n, d_list)
    print(res)


def test():
    assert solve_b(3, [3, 1, 2]) == 11
    assert solve_b(7, [5, 0, 7, 8, 3, 3, 2]) == 312


if __name__ == "__main__":
    main()

Solution (Python):
import itertools

N = int(input())
ds = [int(k) for k in input().split()]

L = itertools.combinations(range(N), 2)
sum = 0
for l in L:
    sum += (ds[l[0]] * ds[l[1]])

print(sum)

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

ans = 0
for a, b in enumerate(li):
  for c in li[a+1:]:
    ans += b * c
print(ans)

Solution (Python):
import itertools

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

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

for t in Taco:
  ans += t[0] * t[1]

print(ans)

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

Solution (Python):
def Takoyaki(N, d):
    sum = 0
    for i in range(N):
        for j in range(N-i-1):
            sum += d[i] * d[i+j+1]
    return sum

N = int(input())
d = [int(x) for x in input().split()]
print(Takoyaki(N, d))

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

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

ans = 0

while len(tastes)>0:
    x = tastes.pop()
    for y in tastes:
        ans += x * y
            
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=input().split()
di=[]
for i in range(N):
    di.append(int(d[i]))

result=0
for i in range(N):
    for j in range(N):
        if i!=j:
            tmp=di[i]*di[j]
            result+=tmp
print(int(result/2))

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

Solution (Python):
import itertools

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

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

goukei=[]

for i in p:
    goukei.append(i[0]*i[1])

print(sum(goukei)//2)

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

print(sum(sn))

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

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=list(map(int,input().split()))
a=int(0)
i=int(0)
while i<n:
	a=a+d[i]
	i=i+1
a=a*a
i=int(0)
while i<n:
	a=a-d[i]*d[i]
	i = i+1
a=a/2
a=int(a)
print(a)

Solution (Python):
N=int(input())
from itertools import combinations
ds = list(map(int,input().split()))
a = 0
for d1, d2 in combinations(ds, 2):
    a += d1*d2
print(a)

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

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


print(kaifuku)

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

helth = 0

for x in range(0,len(d)):
    for y in range(0,len(d)):
        if x!= y:
            helth += d[x]*d[y]
            
print(int(helth/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
while len(d_)!=0:
	x=d_[0]
	d_.pop(0)
	for i in d_:
		ans+=x*i


print(ans)

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

Solution (Python):
N = int(input())
listed = list(map(int,input().split()))
sum_ = 0
for x in listed:
    sum_ -= x*x
    for y in listed:
        sum_ += x*y
print(sum_ // 2)

Solution (Python):
N = int(input().strip())
d = list(map(int, (input().strip().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):
n = int(input())
cur = res = 0
for e in map(int, input().split()):
    res += e * cur
    cur += e
print(res)

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

for index, i in enumerate(lists):
  if(index+1 >= len(lists)):
    break
  tmp_list = lists[index+1:len(lists)]
  for t in tmp_list:
    sum += t*i
      
print(sum)

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

Solution (Python):
N = int(input())
d = [int(i) for i in 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):
    ans += d[i] * sum(d[i+1:N])    

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

Solution (Python):
a = int(input())
b = list(map(int,input().split()))
tairyoku_sum = 0
sel1 = 0
sel2 = 0
for val in range(a):
    sel1 = val
    sel2 = val+1
    for val2 in range(a-val-1):
        tairyoku_sum += b[sel1]*b[sel2]
        sel2 += 1
print(tairyoku_sum)

Solution (Python):

yaki_num = int(input())
oisisa = list(int(i) for i in input().split())
hp = 0
for i in range(yaki_num):
  for j in range(i+1, yaki_num):
    hp += oisisa[i] * oisisa[j]
print(hp)

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

print(sum)

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

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

print(total)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
n = N
r = 0

for i in range(N):
  n = n - 1
  for j in range(n):
      r = r + (A[i] * A[i+j+1])

print(r)

Solution (Python):
def main():
    number_of_takoyakis = int(input())
    takoyaki_list = list(map(int,input().split()))
    cure_list = []
    for i in range(number_of_takoyakis):
        for j in range(number_of_takoyakis):
            if i != j:
                cure_list.append(caliculate_cure_point(takoyaki_list[i],takoyaki_list[j]))
    print(sum(cure_list)//2)

def caliculate_cure_point(takoyaki1,takoyaki2):
    return takoyaki1*takoyaki2

main()

Solution (Python):
import itertools
n=int(input())
d=[int(_) for _ in input().split()]
cross=0
l=list(itertools.combinations(d,2))
for i in range(len(l)):
	cross += l[i][0]*l[i][1]
print(cross)

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

for i in range(0, N):
	for j in range(0, N):
		TTL += d[i]*d[j]
		if i == j:
			TTL_odd += d[i]*d[j]
			
print(int((TTL-TTL_odd)/2))

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

Solution (Python):
import numpy as np

n=int(input())
d_list=list(map(int,input().split()))
d=np.array(d_list)
s=0

for i in range(n):
	for j in range(1,n):
		if j>i:
			s1=d[i]*d[j]
			s+=s1

print(s)

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

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

for i in range(len(A)):
    for j in range(1+i, len(A)):
        try:
            total += A[i]*A[j]
        except:
            pass
print(total)

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

gogei = 0

for i in range(len(d)):
    hei=  d[i] * sum(d[i+1::])
    gogei = gogei + hei
print(gogei)

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

import itertools

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

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

ans = 0
for i in range(len(d)):
    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()))
s=0
k=1

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

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

ans = 0
for x in d:
    for y in d:
        ans += x * y
    ans -= x*x

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

print(str(ans))

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

a=A[0]
for i in range(1,N):
    b=A[i]
    recover+=a*b
    a=a+b
print(recover)

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

print(ans)

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

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

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

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

all = sum(d)
ans = 0
for i in range(N):
    all -= d[i]
    ans += d[i] * all

print(ans)

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

Solution (Python):
import itertools

N = int(input())
A = list(map(int,input().split()))
res =list(itertools.combinations(A, 2))

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

print(ans)

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

ans = 0

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

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(i+1,N):
        if i != j:
            S += d[i] * d[j]
        
print(S)

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

print(sum)

Solution (Python):


if __name__ == "__main__":
    Input = [input() for i in range(2)]
    N = int(Input[0])
    d = list(map(int,Input[1].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()))

total = 0

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

Solution (Python):
takoyaki_count = input()

takoyaki = input().split(" ")

takoyaki_int = [int(n) for n in takoyaki]

life_up = []

x_count = 0
for x in takoyaki_int:
    y_count = 0
    for y in takoyaki_int:
        if x_count < y_count:
            life_up.append(takoyaki_int[x_count] * takoyaki_int[y_count])
            
        y_count += 1
    
    x_count += 1
    
print(sum(life_up))

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

Solution (Python):


''' 
------------------------
author : iiou16
------------------------
'''

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

    out = []
    for i in range(N):
        for j in range(i, N):
            if i != j:
                out.append(D[i] * D[j])
    print(sum(out))


if __name__ == '__main__':
    main()

Solution (Python):
n, *d = map(int, open(0).read().split())
ans= 0
for i in range (len(d)):
  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()))
p = 0
for i in range(n):
    D = d[0]
    d.remove(D)
    p += D*sum(d)

print(p)

Solution (Python):
a = int(input())
b = map(int, input().split())
b = list(b)
t = []

r = [0]

def he(b, t, idx, tm):
    if len(t) == 2:
        tm[0] += t[0] * t[1]
        return
    for i in range(idx, len(b)):
        t.append(b[i])
        he(b, t, i + 1, tm)
        t.pop()

he(b, t, 0, r)

print(r[0])

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




i_max = len(d_list) 
sum = 0

for i in range(i_max):
    j = i
    while j + 1 <  i_max:
        mul = d_list[i] * d_list[j + 1]
        sum += mul
        j += 1

print(sum)

Solution (Python):

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

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

print(total)

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

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

Solution (Python):
N = int(input())
d = [0 for _ in range(N)]
d = list(map(int, input().split()))

import itertools

ans  = sum([p[0]*p[1] for p in list(itertools.combinations(d,2))])

print(ans)

Solution (Python):
a = input()
b = input()
bs = [int(i) for i in b.split()]
print((int)((sum(i*j for i in bs for j in bs)-sum(i*i for i in bs))/2))

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

recover = 0

for n in range(0,N):
    for m in range(n+1,N):
        recover += d[n] * d[m]

print(recover)

Solution (Python):
N = int(raw_input())
num = list(map(int, raw_input().split()))

res = 0

for i in range(N):
    for j in range(i, N):
        if i == j:
            continue
        res += num[i] * num[j]

print(res)

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




print(power)

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

Solution (Python):
a=int(input())
b= list(map(int, input().split()))  
c=[]
for i in b:
  c.append(i**2)

num=(sum(b)**2-sum(c))//2
print(num)

Solution (Python):
total_tako = int(input())
tako_values = list(map(int, input().split()))
sum_value = 0

for i in range(total_tako):
  for j in range(total_tako):
    if j != i:
      sum_value += tako_values[i] * tako_values[j]

print(int(sum_value / 2))

Solution (Python):
import numpy as np
N=int(input())
D=np.array(list(map(int,input().split())))

kachi_matrix= np.expand_dims(D,axis=0) * np.expand_dims(D,axis=1)
np.fill_diagonal(kachi_matrix,0.0)
print(np.sum(kachi_matrix)//2)

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

HP = 0
for i in range(len(d_list)-1):
    for j in range(len(d_list[i+1:])):
        HP += d_list[i] * d_list[i+j+1]
print(HP)

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

Solution (Python):


import sys

n = int(sys.stdin.readline().strip())
d = [ int(x) for x in sys.stdin.readline().strip().split() ]

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

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