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

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

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

print(total)

Solution (Python):
num=int(input().rstrip())
numlis=input().rstrip().split(" ")


s=0
for i in range(num):
    for j in range(i+1,num):
        a=int(numlis[i])
        
        b=int(numlis[j])
        
        c=a*b
        
        s+=c


print(s)

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

sum_ = 0
for i, x in enumerate(d):
  for j, y in enumerate(d):
    if i != j:
      sum_ += x * y

print(sum_//2)

Solution (Python):

from itertools import combinations

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

n = 0
for e in combinations(D, 2):
    n += e[0] * e[1]
print(n)

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

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

print(r)

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

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

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

print(ans)

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

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

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

print(int(ans/2))

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

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

Solution (Python):
from itertools import combinations

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

s = 0
for item in list(combinations(d, 2)):
    s += item[0] * item[1]

print(s)

Solution (Python):
a = int(input())
input_list = list(map(int, input().split()))
sum = 0
for element in range(a):
    for element2 in range(a):
        if element >= element2:
            continue
        sum += input_list[element] * input_list[element2]
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 = sum + d[i]*d[j]


print(sum)

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

print(out)

Solution (Python):

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

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

print(int(sum/2))

Solution (Python):
N = int(input())
A = list(map(int, input().split()))
O = []
B = 0

for i in range(len(A)):
    for j in range(i+1, len(A)):
        C = A[i] * A[j]
        O.append(C)
for i in range(len(O)):
    B += O[i]
print(B)

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

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

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

print(sum)

Solution (Python):
import sys
def input():
    return sys.stdin.readline()[:-1]
_ = int(input())
ds = list(map(int, input().split()))
sum = 0

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

print(sum)

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

Solution (Python):

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

sum = 0

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

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

heal_value = 0
for i in range(len(d) - 1):
    heal_value += d[i] * sum(d[i + 1:])
print(heal_value)

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

print(ans)

Solution (Python):
import sys
input = sys.stdin.readline
 
N = int(input())
d = list(map(int, input().split()))
P = 0
 
for i in range(N - 1):
    if d[i] == 0:
        continue
    for j in range(i + 1, N):
        if d[j] == 0:
            continue
        P += d[i] * d[j]
print(P)

Solution (Python):
from sys import stdin

N = int(stdin.readline())
d = [int(x) for x in stdin.readline().rstrip().split()]

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

print(tmp)

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

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

print(ans)

Solution (Python):
import itertools
import numpy

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

ls = itertools.combinations(D, 2)
for i in ls:
    ans += numpy.prod(i)

print(ans)

Solution (Python):
import itertools

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

list_res = list(itertools.combinations(d,2))
result = 0
for x,y in list_res:
    result += x * y
print(result)

Solution (Python):
from enum import Enum
from queue import Queue
import collections

import sys
import math

BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001

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

energy = 0
for i in range(N):
    tmp = D.pop(0)
    energy += tmp*sum(D)

print(energy)

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

print(ans)

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

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

Solution (Python):
a = int(input())
b = list(input().split())
sum = 0
for i in range(len(b)):
  for j in range(i,len(b)):
    if i != j:
        sum += int(b[i]) * int(b[j])
print(sum)

Solution (Python):
import itertools

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

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

total = 0

for i in conbi:
	total += i[0] * i[1]

print(total)

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

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

print(s // 2)

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

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

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

A = sum(D)
ans = 0
for d in D:
    A -= d
    ans += A*d

print(ans)

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

Solution (Python):
n = input()
di = list(map(int, input().split()))
sum_di = sum(di)
answer = 0
for d in di:
    answer += d * (sum_di - d)
print(answer // 2)

Solution (Python):
import itertools
 

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

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

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

Solution (Python):
import itertools



a=input()
a=int(a)

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



max=0
for i in itertools.combinations(li,2):
    max+=i[0]*i[1]
print(max)

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

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

result = 0

for i in range(n):
   tmp = d.pop(0)
   for j in d:
      result += j * tmp

print(str(result))

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

for i in d:
    s += i * (sum(d) - i)

print(s//2)

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





total_cmb = int(N * (N-1) / 2)

total = 0
add_cnt = 0
for n1 in range(N):
    for n2 in range(N):
        if n1 < n2:
            total = total + d_list[n1] * d_list[n2]
            add_cnt = add_cnt + 1


print(total)

Solution (Python):
from itertools import combinations

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

patterns = list(combinations(takoyakis,2))

sum = 0
for p in patterns:
  sum += p[0] * p[1]
  
print(sum)

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

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

sum_(N, D)

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

Solution (Python):
import itertools


def main():
    _ = int(input())
    d = list(map(int, input().split()))

    comb = itertools.combinations(d, 2)

    ans = 0
    for v in comb:
        ans += v[0] * v[1]

    print(ans)


if __name__ == "__main__":
    main()

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

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

print(ans//2)

Solution (Python):
import itertools
N=int(input())
l=list(map(int,input().split()))
ans=0
for item in list(itertools.combinations(range(N),2)):
  ans=ans+l[item[0]]*l[item[1]]

print(ans)

Solution (Python):
from sys import stdin
def main():
    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)
if __name__ == '__main__':
    main()

Solution (Python):
num = int(input())
num_list = [int(item) for item in input().split()]

sum_heal = 0

for i, item_d1 in enumerate(num_list):
    for k, item_d2 in enumerate(num_list):
        if i > k:
            sum_heal += item_d1 * item_d2

print(sum_heal)

Solution (Python):

N = int(input())

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


if len(l) == 1:
    print(l)
else:
    sum = 0

    for i1 in range(len(l)):
        for i2 in range(i1+1, len(l)):
            sum += l[i1] * l[i2]

    print(sum)

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

print(r)

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

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

if __name__ == '__main__':
    solve()

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

Solution (Python):
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from fractions import Fraction as frac
import bisect
import sys
input = sys.stdin.readline

setrecursionlimit(1000000)

dp = defaultdict(lambda x:-1)

def main():
	n = int(input())
	d = list(map(int,input().split()))
	ans = 0
	for i in range(n):
		for j in range(n):
			if(j == i):
				continue
			ans += d[i] * d[j]
	print(ans//2)

def zip(a):
	mae = a[0]
	ziparray = [mae]
	for i in range(1,len(a)):
		if(mae != a[i]):
			ziparray.append(a[i])
			mae = a[i]
	return ziparray

def is_prime(n):
	if n < 2: return False

	for k in range(2, int(math.sqrt(n)) + 1):
		if n % k == 0:
			return False

	return True

def list_replace(n,f,t):
	return [t if i==f else i for i in n]

def base_10_to_n(X, n):
	X_dumy = X
	out = ''
	while X_dumy>0:
		out = str(X_dumy%n)+out
		X_dumy = int(X_dumy/n)
	if(out == ''): return '0'
	return out

def gcd(l):
	x = l.pop()
	y = l.pop()
	while(x%y!=0):
		z = x%y
		x = y
		y = z
	l.append(min(x,y))
	return gcd(l) if len(l) > 1 else l[0]

class Queue():
	def __init__(self):
		self.q = deque([])
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.popleft()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class Stack():
	def __init__(self):
		self.q = []
	def push(self,i):
		self.q.append(i)
	def pop(self):
		return self.q.pop()
	def size(self):
		return len(self.q)
	def debug(self):
		return self.q

class graph():
	def __init__(self):
		self.graph = defaultdict(list)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
		self.graph[t].append(f)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
		self.graph[t].remove(f)
	def linked(self,f):
		return self.graph[f]

class dgraph():
	def __init__(self):
		self.graph = defaultdict(set)
	def addnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].append(t)
	def rmnode(self,l):
		f,t = l[0],l[1]
		self.graph[f].remove(t)
	def linked(self,f):
		return self.graph[f]

main()

Solution (Python):


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

ans=sum(l)**2
for i in range(n):
    ans-=l[i]**2
ans=ans//2
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):
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(N):
    for j in range(i+1, N):
        ans += d[i]*d[j]

print(ans)

Solution (Python):


N = int(input())

d = list(map( lambda x:int(x), input().split(" ") ))

sum_d = 0

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

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

sum = 0

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

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())
L=[]
m=0
k=0

l=list(map(int,input().split()))
m=sum(l)
for i in range(N):
    k+=(m-l[i])*l[i]
ans=int(k/2)



print(ans)

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

Solution (Python):
from itertools import combinations as cb
n = int(input())
l = [int(j) for j in input().split()]
m = cb(l, 2)
ans = 0

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

Solution (Python):


import sys
from itertools import combinations

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    d = i2nn()
    print(sum(a*b for a, b in combinations(d, 2)))
main()

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

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

Solution (Python):
n = int(input())
d = [int(x) for x in input().split()]
total = 0
for i in range(n):
    for j in range(n):
        if i == j or i > j:
            continue
        else:
            total += d[i] * d[j]
print(total)

Solution (Python):
N = int(input())
tmp = input()
d = [int(x.strip()) for x in tmp.split(' ')]
su = 0
sq = 0
for i in range(N):
    su = su + d[i]
    sq = sq + d[i]*d[i]
print(int((su*su-sq)/2))

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

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

Solution (Python):
import numpy as np
N = int(input())
d = np.fromiter(map(int, input().split()), np.int64)

s1 = np.sum(d)
s2 = np.sum(d * d)
print((s1 * s1 - s2) // 2)

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

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

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

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

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

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

total = sum(D)
ans = 0
for d in list(D):
    ans += (total - d) * d
print(ans//2)

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

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

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

print(sum)

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

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

from itertools import combinations
ret = 0
for it in combinations(arr, 2):
    ret += (it[0]*it[1])
print(ret)

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

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

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 product
def tako(ds):
    products = [each[0]*each[1] for each in list(product(ds, ds))]
    self_sum = sum([item**2 for item in ds])
    return (sum(products) - self_sum)//2

n = int(input())
ds = list(map(int, input().split()))
output = tako(ds)
print(output)

Solution (Python):


n = input()

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

print(int(ans/2))

Solution (Python):
import itertools

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

result = 0

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

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

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

pro = 0
for i in range(N):
	pro = pro + d[i] ** 2

print(int((sum(d)**2 - pro)/2))

Solution (Python):
import sys

N = int(sys.stdin.readline().strip())
D = [int(n) for n in sys.stdin.readline().strip().split()]

total = 0
for i in range(N):
  total += D[i]*sum(D[i+1:])
print(total)

Solution (Python):
from itertools import combinations

n = int(input())
ds = map(int, input().split())
res = sum(map(lambda x: x[0] * x[1], combinations(ds, 2)))
print(res)

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

tastes = [int(i) for i in input().split()]
total_tastes = sum(tastes)
total_squared = 0
for i in range(N):
    total_squared += tastes[i]**2
print((total_tastes**2-total_squared)//2)

Solution (Python):
a = input()

a = int(a)

b = input().split(' ')

from itertools import combinations

comb = combinations(b, 2)

sum = 0

for i in list(comb):
    sum += int(i[0])*int(i[1])

print(sum)

Solution (Python):

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


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

Solution (Python):
from copy import deepcopy
from sys import exit,setrecursionlimit
import math
from collections import defaultdict,Counter,deque
from itertools import permutations, combinations,combinations_with_replacement,product
from fractions import Fraction as frac
import bisect
import heapq

import logging
logging.basicConfig(level=logging.DEBUG)

import sys


setrecursionlimit(1000000)

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

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

Solution (Python):
import itertools

def main():
  n = int(raw_input())
  dishes = map(int, raw_input().split())
  result = 0
  for c in itertools.combinations(dishes, 2):
    result += c[0]*c[1]
  print(result)

main()

Solution (Python):
n = int(input())
numbers = [int(i) for i in input().split()]
total = 0
for x in range(len(numbers)):
    for y in range(x+1,len(numbers)):
        total+=numbers[x]*numbers[y]
print(total)

Solution (Python):
N = int(input())
D = [int(i) for i in input().split(' ')]
Dsum = sum(D)
kaifuku = 0
for d in D:
    kaifuku += d*(Dsum-d)
print(kaifuku//2)

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

for i in range(N):
  if i+1 == N:
    break
  for j in heal[i+1:]:
    ans = ans + heal[i] * j

print(ans)

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

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

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

Solution (Python):

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


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

print(res)

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

sum = 0

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

Solution (Python):
def solve(takoyakis):
    ans = 0

    for i, x in enumerate(takoyakis):
        for j, y in enumerate(takoyakis):
            if j <= i:
                continue
            ans += x * y

    return ans


if __name__ == "__main__":
    n = int(input())
    d_s = [int(d) for d in input().split(' ')]
    print(solve(d_s))

Solution (Python):
N=int(input())
d_list=[int(thing) for thing in input().split(" ")]

dd=sum([x*x for x in d_list])
s=sum(d_list)
S=s*s
ret=int(0.5*(S-dd))
print(ret)

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

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

Solution (Python):

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

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

print(ans)

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

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

print(count)

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

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

Solution (Python):
from sys import stdin


def main():
    input = lambda: stdin.readline()[:-1]
    N = int(input())
    D = list(map(int, input().split()))

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


main()

Solution (Python):
import itertools
N = int(input())
d_list = list(map(int, input().split()))
c_d_list = list(itertools.combinations(d_list, 2))
answer = 0
for a in c_d_list:
    temp = a[0] * a[1]
    answer += temp
print(answer)

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

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

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

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

tot = sum(d)
res = 0

for i in range(N):
    tot -= d[i]
    res += tot * d[i]

print(res)

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

sums = 0
for i, x in enumerate(d_list):
  for j, y in enumerate(d_list):
    if i!=j:
      sums += x*y

print(int(sums/2))

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

sum=0

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

print(sum)

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

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

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

print(total//2)

Solution (Python):
from sys import stdin
from itertools import accumulate, dropwhile, takewhile, groupby
import copy




'''
条件に合うものを絞り込む
data = [1, 2, 3]
s = [x for x in data if x % 3 == 0]
'''

'''
文字配列を数値に
l_si = ['-10', '0', '100']

l_si_i = [int(s) for s in l_si]
'''

'''
a = [2, 4, 6, 8]
b = [3, 6, 9]

print(list(set(a) | set(b)))  
print(list(set(a) & set(b)))  
'''

'''
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
count = 0
while len([x for x in A if x % 2 == 0]) == N:
    A = list(map(lambda y: y / 2, A))
    count += 1
print(count)
'''

'''
.append(要素)
.extend(要素)
.insert(場所,要素)
-1で末尾で末尾から一つ前
'''
'''
間に空白追加
' '.join(lis)
'''
'''
copy.copy(配列名)
'''

n = int(stdin.readline().rstrip())
d = stdin.readline().rstrip().split()
res = 0
count1 = 0
for el1 in d:
    count2 = 0
    for el2 in d:
        if (count2 > count1):
            res += int(el1) * int(el2)
        count2 += 1
    count1 += 1

print(res)

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()))
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):
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()))
sum1 = sum(d)**2
sum2 = sum([i*i for i in d])
print(int((sum1-sum2)/2))

Solution (Python):
import itertools

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


if __name__ == "__main__":
    test()

Solution (Python):
N = int(input())
d_list = list(map(int, input().split()))
d_sum = 0
for i, x in enumerate(d_list):
    for j, y in enumerate(d_list[i+1:]):
        d_sum += x*y

print(d_sum)

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

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

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()))
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())
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):
import sys
import itertools
N = int(input())
D = [int(v) for v in sys.stdin.readline().split()]

l = [a * b for a, b in itertools.combinations(D, 2)]
print(sum(l))

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

print(sum_cure)

Solution (Python):

N = int(input())
D = input().split(' ')

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

print(a)

Solution (Python):
n1 = int(input())
d1 = [int(i) for i in input().split()]

r1 = 0

for i1 in range(n1 - 1):
    for i2 in range(n1 - i1 - 1):
        r1 += d1[i1] * d1[i2 + i1 + 1]

print(r1)

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)