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

Solution (Python):
import sys

def solve(n, d):
  ans = 0
  for i, d_i in enumerate(d):
    for j, d_j in enumerate(d):
      if i == j:
        continue
      ans += d_i * d_j
        
  print(ans // 2)

if __name__ == '__main__':
  n = sys.stdin.readline().strip()
  d = list(map(int, sys.stdin.readline().strip().split(" ")))
  solve(n, d)

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

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


if __name__ == '__main__':
    main()

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

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

comb = list(itertools.combinations(range(n), 2))

print(sum([c[i[0]]*c[i[1]] for i in comb]))

Solution (Python):
n=int(input())
d=list(map(int,input().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 = list(map(int,input().split()))
sum_all = 0
for i in range(n):
    for j in range(n):
        sum_all += d_list[i] * d_list[j]
sum_diff = 0
for k in range(n):
    sum_diff += d_list[k] * d_list[k]
print((sum_all - sum_diff) // 2)

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

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

cnt = 0

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

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

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

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

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

print(ans)

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

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

Solution (Python):

import sys


def solve(N: int, d_li: "List[int]"):
    s = 0
    for i in range(N):
        di = d_li.pop()
        s += sum([di * d for d in d_li])
    print(s)



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

cnt = 0
for i in range(N):
    for j in range(i,N):
        if i == j:
            pass
        else:
            cnt += d[i] * d[j]

print(cnt)

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

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

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

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

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

Solution (Python):


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

    print((sum(D)**2 - sum(d**2 for d in D))//2)
    


if __name__ == '__main__':
    main()

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

for i in range(N):
  S = S + D[i]

for i in range(N):
  Ans = Ans + D[i] * (S - D[i])

Ans = Ans // 2

print(Ans)

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

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

print(ans)

Solution (Python):
import itertools

N = int(input())
nums = list(map(int, input().split()))
print(sum([i[0]*i[1] for i in list(itertools.combinations(nums, 2))]))

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

Solution (Python):
import sys
inputs = sys.stdin.readlines()

n = int(inputs[0])
D = list(map(int, inputs[1].split()))

ans = 0
for i in range(n):
    for j in range(n):
        if i == j:
            break
        ans += D[i] * D[j]
print(ans)

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

Solution (Python):
import itertools

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

print(sum([ c[0]*c[1] 
    for c in list(itertools.combinations(D, 2))]))

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

from sys import stdin
n = int(stdin.readline().rstrip())
ds = [int(x) for x in stdin.readline().rstrip().split()]

ans = 0

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

print(ans)

Solution (Python):
import itertools

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

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

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

ans = 0

for i in range(N):
  for j in range(N-1):
    if j >= i:
      pass
    else:
      ans += d[i] * d[j]

print(ans)

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

x = 0

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

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

Solution (Python):
n = int(input())
li = list(map(int,input().split()))
sum = 0
for i in li:
  for j in li:
    sum += i * j

for i in li:
  sum -= i ** 2
sum //= 2
print(sum)

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

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

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

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

print(m)

Solution (Python):
n = int(input())
D = [int(x) for x in 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 itertools
n=int(input())
d=list(map(int,input().split()))
print(sum([i*j for i,j in list(itertools.combinations(d, 2))]))

Solution (Python):

import sys
import itertools

def solve(N: int, d: "List[int]"):
    l = list(itertools.combinations(d, 2))
    ans = 0
    for x,y in l:
        ans += x*y
    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):
def main():
    n=int(input())
    d=list(map(int,input().split(' ')))
    ans = 0
    for n,i in enumerate(d):
        for m,j in enumerate(d):
            if n != m:
                ans += i*j
    print(ans//2)

if __name__ == '__main__':
    main()

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

Solution (Python):
n = int(input())
d = [int(i) for i in input().split()]
ans = []
for i in range(n):
    for j in range(n):
        if i < j:
            ans.append(d[i] * d[j])
print(sum(ans))

Solution (Python):
import itertools

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

a = [i for i in range(n)]
ans = 0

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

print(ans)

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

total = 0
for i in range(len(d_ls)):
    for k in range(i+1, len(d_ls)):
        total += d_ls[i] * d_ls[k]

print(total)

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

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

print(M)

Solution (Python):


def solve(N, d):
    total = 0
    for i1 in range(len(d)):
        for i2 in range(i1+1, len(d)):
            total += d[i1] * d[i2]
    return total


if __name__ == '__main__':
    N = int(input())
    d = map(int, input().split())

    ans = solve(N, list(d))

    print(ans)

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

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

solve()

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

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

print(ans)

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

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

Solution (Python):
import itertools

N = int(input())
D = map(int, input().split())
s = 0
for d1, d2 in itertools.combinations(D, 2):
    s += d1 * d2
print(s)

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

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

import itertools
n = int(input())
d = list(map(int,input().split()))
ans = 0
for i,j in itertools.combinations(d,2):
    ans += 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 = list(map(int,input().split()))
ans = 0

for i in range(N):
    for j in range(N):
        if (i != j):
            kaihuku = d_list[i]*d_list[j]
            ans += kaihuku

print(int(ans/2))

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

import itertools
cmb_d = list(itertools.combinations(d_i, 2))

sum =0
for cmb in cmb_d:
  sum += cmb[0] * cmb[1]

print(sum)

Solution (Python):
import sys
import itertools
n = int(sys.stdin.readline())
L = list(map(int, sys.stdin.readline().split()))
total =0
L = list(itertools.combinations(L, 2))
for ele in L:
    total +=ele[0]*ele[1]
print(total)

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

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

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()))
import itertools
ans = 0
for l in list(itertools.combinations(D,2)):
    x, y = l
    ans += x*y
print(ans)

Solution (Python):
N = int(input())
D = [int(v) for v in input().split()]

num = len(D)

total = 0
for i in range(num):
    d1 = D[i]
    for j in range(i + 1, num):
        d2 = D[j]

        total += d1 * d2

print(total)

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

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

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

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

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

Solution (Python):
import sys,queue,copy
sys.setrecursionlimit(10**8)
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())
INF = float('inf')

N = int(input())
dlist = inpl()

ans = 0

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

print(ans)

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

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

print(ret)

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

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

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

Solution (Python):

import itertools


import sys

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



P = list(itertools.combinations(list(range(N)),2))
ans = 0
for p in P :
    
    a = D[p[0]] * D[p[1]]
    ans += a
print(ans)

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

tako_list = list(map(int, input().split()))
tako_len = len(tako_list)

sum = 0

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

print(sum)

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

Solution (Python):

import sys
import math
import numpy as np
import itertools


n = int(input())


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

sum_all = 0
sum2_all = 0
for i in range(n):
    sum_all += d[i]
    sum2_all += d[i]*d[i]

print( (sum_all*sum_all - sum2_all)//2)

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

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

print(ans)

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

print(score)

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

ans=0

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

print(ans)

Solution (Python):
n = int(input())
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())
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 = 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())
inputData = input().split()
d = [int(x) for x in inputData]

total_sum = 0
for i, vald in enumerate(d):
    e = d[i+1:]

    for vale in e:
        total_sum += vald * vale
print(total_sum)

Solution (Python):
from itertools import combinations
def solve():
    n = int(input())
    D = list(map(int, input().split()))
    print(sum(x * y for x, y in combinations(D, 2)))
solve()

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

Solution (Python):
import glob



REL_PATH = 'ABC\\143\\B'


TOP_PATH = 'C:\\AtCoder'

class Common:

    problem = []
    index = 0

    def __init__(self, rel_path):
        self.rel_path = rel_path

    def initialize(self, path):
        file = open(path)
        self.problem = file.readlines()
        self.index = 0
        return

    def input_data(self):
        try:
            IS_TEST
            self.index += 1
            return self.problem[self.index-1]
        except NameError:
            return input()

    def resolve(self):
        pass

    def exec_resolve(self):
        try:
            IS_TEST
            for path in glob.glob(TOP_PATH + '\\' + self.rel_path + '/*.txt'):
                print("Test: " + path)
                self.initialize(path)
                self.resolve()
                print("\n\n")
        except NameError:
            self.resolve()


class B(Common):

    def resolve(self):

        n = int(self.input_data())
        tako = [int(i) for i in self.input_data().split()]
        result = 0

        for i in range(len(tako)):
            for j in range(len(tako)):
                if i < j:
                    result += tako[i] * tako[j]
                else:
                    continue

        print(str(result))

solver = B(REL_PATH)
solver.exec_resolve()

Solution (Python):
num =int(input())
tako = [int(s) for s in input().split()]
p=0
for i in range(num):
  for j in range(num - i -1):
    p += tako[i]*tako[j+i+1]
print(p)

Solution (Python):
import sys
from itertools import combinations

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

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

    return ans

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

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

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

value = 0
value2 = 0

for i in range(N):
    for j in range(N):
        value = value + d[i]*d[j]
        
for i in range(N):
    value2 = value2 + d[i]*d[i]
    
print(int((value-value2)/2))

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

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

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

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

mypow = 0

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


print(mypow)

Solution (Python):
import itertools

n = int(input())
d = list(map(int, input().split()))
sum = 0
cmb = list(itertools.combinations(d, 2))
for case in cmb:
    sum += case[0]*case[1]

print(sum)

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

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

print(num)

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

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())
a = list(map(int, input().split()))
ans = 0
t = 0
for i in a:
    t+=i**2
    for j in a:
        ans+=i*j
print(int((ans-t)/2))

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

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

print(ans)

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

ans = 0

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

print(ans)

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

print(ans)

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

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

print(tot)

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())
d=list(map(int,input().split()))
ans=0
for i in d:
  for j in d:
    ans+=i*j
  
for i in d:
  ans-=i*i
print(ans//2)

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

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

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

sum_val = 0
for i in range(n):
    start = i+1
    
    for j in range(start, n):
        sum_val += d_list[i] * d_list[j]

print(sum_val)

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

Solution (Python):
n = input()

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

ans_L = []

from itertools import product, permutations,combinations
for i in combinations(a_L,2):
    ans_L.append(i[0]*i[1])

print(sum(ans_L))

Solution (Python):


import array
import math
import os
import sys


def main():
    N = read_int()
    D = read_ints()
    s = 0
    for i in range(N):
        for j in range(i + 1, N):
            s += D[i] * D[j]
    print(s)


DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def read_int():
    return int(inp())


def read_ints():
    return [int(e) for e in inp().split()]


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


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

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



print(ret)

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

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


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):
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):
def resolve():
    n = int(input())

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

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

    print(ans)

resolve()

Solution (Python):
from itertools import combinations

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

answer = sum(d1 * d2 for d1, d2 in combinations(d, 2))
print(answer)

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

dd=[d[0]]

for i in range(1,N):
    dd.append(dd[i-1]+d[i])

out=0

for i in range(N-1):
    out+=d[N-1-i]*dd[N-2-i]

print(out)

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

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

Solution (Python):
n = input()
takoyakis = list(map(int,input().split()))
res = 0
for i,takoyaki in enumerate(takoyakis):
	for takoyaki2 in takoyakis[i+1:]:
		res += takoyaki*takoyaki2
print(res)

Solution (Python):

import sys


def solve(N: int, d: "List[int]"):
    s=0
    for i in range(N):
        s=s+d[i]*(sum(d)-d[i])
    print(int(s/2))
    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()))

ans = 0

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

print(ans)

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

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

Solution (Python):
import sys


		
def main():
	n = int(input())
	al = list(map(int, input().split()))
	ans=0
	for i, v in enumerate(al):
		for j, v2 in enumerate(al[i+1:]):
			
			ans+=v*v2
	print(ans)
	return 
	
	

isTest=False

def pa(v):
	if isTest:
		print(v)

if __name__ == "__main__":
	if sys.platform =='ios':
		sys.stdin=open('inputFile.txt')
		isTest=True
	else:
		pass
		
			
	ret = main()
	if ret is not None:
		print(ret)

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

Solution (Python):
N = int(input())
O = list(map(int,input().split()))
A = 0
for i in range(N):
    for j in range(N):
        if i >= j:
            continue
        else:
            A += O[i]*O[j]
print(A)

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

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

sum1 = 0
for i in range(N):
    sum1 = sum1 + d[i]

sum1 = sum1*sum1

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

print (sum1 - sum2)/2

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    d = [int(i) for i in input().split()]

    sum = 0

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

Solution (Python):

import sys
import math
from copy import deepcopy
from collections import deque, defaultdict
from operator import mul
from functools import reduce
sys.setrecursionlimit(20000000)




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

    ans = []

    for x in range(N):
        for y in range(x + 1, N):
            ans.append(v[x] * v[y])

    print(sum(ans))


if __name__ == '__main__':
    main()

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

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

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

print(ans)

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

a_list=[]
for i in range(N):
    for j in range(1,N-i):
        a_list.append(d[i]*d[i+j])
print(sum(a_list))

Solution (Python):
import itertools

def B():
    n = input()
    d = list(map(int,input().split(" ")))
    temp = list(itertools.combinations(d,2))
    s = sum(list(map(lambda x:x[0]*x[1],temp)))
    print(s)

if __name__ == '__main__':
    B()

Solution (Python):
a = int(input())
list = list(map(int, input().split(" ")))
sum = 0
for num_1, i in enumerate(list):
  for num_2, j in enumerate(list):
    if num_1 <= num_2:
      continue
    else:
      sum += i*j
print(sum)

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

Solution (Python):
import itertools


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

print(sum([comb[0] * comb[1] for comb in itertools.combinations(d, 2)]))

Solution (Python):
N=int(input())
d=list(map(int,input().split()))
c=[x*y for x in d for y in d]
x=[x*y for (x, y) in zip(d,d)]
print((sum(c)-sum(x))//2)

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

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

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