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

print(recovery)

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

total = sum(d) ** 2
for i in range(n):
    total -= d[i]**2

print(total // 2)

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

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

ans = 0

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

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

ans = 0

for i in range(N):
    for j in range(N):
        ans += list[i]*list[j]

for i in range(N):
    ans += -list[i]**2

print(int(ans/2))

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

print(int((buf-squaresum)/2))

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

print(S)

Solution (Python):

 
import math
import itertools
import sys
import copy
 




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

print(S)

Solution (Python):
N = int(input())
list_d = list(map(int, input().split()))
len_d = len(list_d)
list_2d = []

for i in range(len_d-1):
    for j in range(i+1,len_d):
        recovery = list_d[i] * list_d[j]
        list_2d.append(recovery)

print(sum(list_2d))

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

ans = 0
for i, j in enumerate(d):
    for k, l in enumerate(d):
        if i > k:
            ans += j * l
print(ans)

Solution (Python):
n = int(input())
D = list(map(int, input().split()))
from itertools import combinations as cm
total = 0
for pair in cm(D, 2):
  total += pair[0] * pair[1]
print(total)

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

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

heal = 0
for x in range(n):
    for y in range(n):
        if x == y:
            pass
        else:
            heal += (a[x] * a[y]) / 2

print(int(heal))

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

Solution (Python):
import itertools

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


ans = 0

for i,j in itertools.combinations(range(N),2):
    ans += d[i]*d[j]

print(ans)

Solution (Python):
import itertools

n = int(input())
dList = list(itertools.combinations(list(map(int,input().split())),2))

hp = 0
for i in dList:
  hp += i[0]*i[1]

print(hp)

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

Solution (Python):
import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n = INT()
d = LIST()
a = 0

c = list(combinations(d, 2))

for l in c:
  a += l[0] * l[1]
print(a)

Solution (Python):
N = int(input())
delicious = [0] * N
delicious = list(map(int, input().split()))
total = 0

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

print(total)

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

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

Solution (Python):
from itertools import accumulate

_ = int(input())
d = tuple(map(int, input().split()))
a = tuple(accumulate(reversed(d)))[::-1]
print(sum(dd * aa for dd, aa in zip(d, a[1:])))

Solution (Python):
from itertools import accumulate

_ = int(input())
d = tuple(map(int, input().split()))
a = tuple(reversed(tuple(accumulate(reversed(d)))))
print(sum(dd * aa for dd, aa in zip(d, a[1:])))

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

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

arr = []
for i in range(n-1):
    for j in range(i,n):
        if i == j:
            pass
        else:
            arr.append(d[i] * d[j])

print(sum(arr))

Solution (Python):

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

    print(power)

ABC143B()

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

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

sum = 0
for x in range(n):
    for y in range(n):
        if x != y: sum += l[x] * l[y]

print(int(sum/2))

Solution (Python):
N = int(input())
d = [int(x) for x in input().split()]
res = 0
for count in range(len(d)-1):
    fd = d[count]
    for e in d[count+1:]:
        res += fd * e
print(res)

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

s = 0

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

Solution (Python):
from itertools import combinations

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

print(sum(x*y for x, y in combinations(dn, 2)))

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

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

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

ans = 0

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

print(ans)

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

ans = 0

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

print(ans)

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

Solution (Python):
import itertools

def LI():
  return [int(s) for s in input().split()]

N = int(input())
d_s = LI()

count = 0
for x,y in itertools.combinations(d_s,2):
  count+=x*y
  
print(count)

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

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

Solution (Python):
import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def s(generator, splitter, mapper):
    return [ mapper(s) for s in generator().split(splitter) ]


def get_nums_l():
    return [ int(s) for s in input().split(" ")]


def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

n = int(input())
ddd = get_nums_l()

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

print(ans)

Solution (Python):
import sys
from itertools import combinations

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
LIST = lambda: list(map(int, INPUT().split()))

sys.setrecursionlimit(10 ** 9)


def main():
    _ = INT()
    D = LIST()

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


if __name__ == '__main__':
    main()

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

Solution (Python):
n, *d = map( int, open(0).read().split())

recover = 0
for i in range(n):
  recover += d[i] * sum( d[ i+1: n ] )
print( recover )

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

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

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

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

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

r = 0

for i, x in enumerate(numbers[:-1]):
  for y in numbers[i+1:]:
    r += x * y

print(r)

Solution (Python):
import itertools

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

d_com = list(itertools.combinations(d_l, 2))

d_sum = 0
for x in range(len(d_com)):
    d_sum += d_com[x][0] * d_com[x][1]
print(d_sum)

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

    result = 0

    for i in range(n):
        for j in range(n):
            if i == j or i > j:
                continue
            result += num_list[i] * num_list[j]

    print(result)

if __name__ == '__main__':
    main()

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

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

print(oishisa)

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

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

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

res = 0
for i, di in enumerate(ds):
    for h in range(i + 1, N):
        res += di * ds[h]

print(res)

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

Solution (Python):
import itertools

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

    ans = 0
    for i in range(N):
        for j in range(i+1, N):
            ans += (D[i] * D[j])
    print(ans)
    return 0
if __name__ == '__main__':
    main()

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

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

print(ans)

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

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

print(ans)

Solution (Python):
def calc_double(n):
    return n ** 2

n=int(input())
L=list(map(int,input().split()))
L2=list(map(calc_double,L))
print((sum(L)**2-sum(L2))//2)

Solution (Python):
n=int(input())
dlis=list(map(int,input().split()))
rlis=[]
for i in range(n):
	for j in range(n):
		if i<j:
			r=dlis[i]*dlis[j]
			rlis.append(r)
print(sum(rlis))

Solution (Python):
def main():

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

if __name__ == "__main__":
    main()

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

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

print(ans)

Solution (Python):
n = int(input())
ds = input().split(" ")
rec = 0
for i in range(0, len(ds) - 1):
  di = int(ds[i])
  for j in range(i+1, len(ds)):
    dj = int(ds[j])
    rec += di * dj
print(rec)

Solution (Python):
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)




import itertools

N, *D = map(int, read().split())


S = sum(D)
T = sum([x * x for x in D])

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

Solution (Python):
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N = int(readline())
D = [int(d) for d in readline().split()]

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

print(ans)

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

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

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

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

print(sum)

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

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

    print(res)

if __name__ == '__main__':
    main()

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

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

_ = input()
i = list(map(int, input().split()))

A = np.matrix(i)
mat = np.dot(A.T, A)

print(np.tril(mat, k = -1).sum())

Solution (Python):
n = int(input())
d = [int(i) for i in 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):



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

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

ans = 0
d_sum = sum(d)

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

print(ans)

Solution (Python):
from itertools import combinations

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

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

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

y=[]
for i in range(n-1):
    for j in range(i+1,n):
        y.append(a[i]*a[j])
v=0
for k in y:
    v=v+k
print(v)

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

sum = 0
i = 0
while i<n:
    j = i + 1
    while j<n:
        sum += int(d[i]) * int(d[j])
        j+=1
    i+=1

print(sum)

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

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

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

def main():
    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)
        
if __name__ == "__main__":
    main()

Solution (Python):
n = int(raw_input())
ds = map(int, raw_input().split())
t = 0
for i in range(n):
  for j in range(i+1, n):
    t += ds[i] * ds[j]
print(t)

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

print(ans)

Solution (Python):
from itertools import permutations
n = int(input())
li = list(map(int, input().split()))
x = 0
for j in permutations(range(n), 2):
    x += li[int(j[0])] * li[int(j[1])]

print(x//2)

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

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

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

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

Solution (Python):
from sys import stdin
import sys

def ria(sep = ''):
    if sep == '' :
        return list(map(int, input().split())) 
    else: return list(map(int, input().split(sep)))
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()

def main():
    N = ri()
    D = ria()

    s = sum(D)
    s *= s
    d = sum(map(lambda x: x * x, D))
    print((s - d) //2)


if __name__ == "__main__":
    main()

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

len_ds = len(ds)
s = 0


for i in range(len_ds-1):
    for j in range(i+1, len_ds):
        s += ds[i] * ds[j]
print(s)

Solution (Python):
def main():
    N = int(input())
    ll = input().split(" ")
    d = []
    result = 0
    for l in ll:
        d.append(int(l))
    for i in range(N):
        for j in range(i + 1, N):
            result += d[i] * d[j]
    print(result)


if __name__ == '__main__':
    main()

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

ans = 0

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

print(ans)

Solution (Python):
import itertools

n = int(input())
d_lst = list(map(int,input().split()))
pair_lst = list(itertools.combinations(d_lst,2))

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

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

Solution (Python):
import itertools

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

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

print(ans)

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

Solution (Python):



from itertools import combinations


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


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


print(res)

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

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

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

Solution (Python):

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

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

Solution (Python):
import itertools

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

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

Solution (Python):
import itertools

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

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

print(sum)

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

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

sum_takos = sum(takos[1:])

result = 0

for i in range(N - 1):
  result += sum_takos * takos[i]
  sum_takos -= takos[i + 1]
  
print(result)

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

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

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

answers = [d_n[i]*d_n[j] for i in range(N-1) for j in range(i+1,N)]



print(sum(answers))

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

import itertools

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

print(sum)

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

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

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

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

total = 0

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

print(total)

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

print(int(s/2))

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

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

Solution (Python):
import itertools

N = int(input())
d_list = input().split(" ")

sum = 0

for i, j in itertools.combinations(d_list, 2):
    sum += int(i) * int(j)

print(sum)

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

Solution (Python):
import itertools

n = int(input())
d = [int(_) for _ in input().split()]
ans = 0

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

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

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

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

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

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

	print(ans)



if __name__ == '__main__':
	main()

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

Solution (Python):

import sys
sys.setrecursionlimit(10000000)
INF = 1<<32


def solve(N: int, d: "List[int]"):
    ans = 0
    for i in range(N-1):
        for j in range(i+1, N):
            
            ans += d[i]*d[j]

    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-1):
    for j in range(i+1,N):
        result+=D[i]*D[j]
print(result)

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

s = 0
for i, di in enumerate(d):
    for dj in d[i+1:]:
        s += di * dj
print(s)

Solution (Python):
num = int(input())
data = input().split(' ')
data_int = [int(data[i]) for i in range(num)]

result = 0

for i in range(num):
    for l in range(num - i - 1):
        result += data_int[i] * data_int[l + i + 1]

print(result)

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

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

print(x)

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

ans = 0

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

print(ans)

Solution (Python):
from itertools import combinations


N = int(input())
d = [inp for inp in map(int, input().split())]

ret = 0
for pair in combinations(d, 2):
  ret += pair[0] * pair[1]
  
print(ret)

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

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

for s in range(N):
  for t in range(s+1,N):
    Total += D[s]*D[t]
    
print(Total)

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

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

print(sum)

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

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

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

for i in range(N-1):
    t = D[i]
    for d in D[i+1:]:
        c += t * d

print(c)

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

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

print(tmp)

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

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

Solution (Python):
input()
A = list(map(int,input().split()))
b = 0
while A:
  a = A.pop(0)
  for i in A:
    b += i * a
print(b)

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

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

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]+ans

print(ans)

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

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

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

c = 0

for i in range(n):
    for j in  range(n):
        if i == j:
            break
       
        c += l[i]*l[j]
        

print(c)

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

import itertools
combinations = list(itertools.combinations(d, 2))

answer = 0
for i in combinations:
    answer += int(i[0]) * int(i[1])

print(answer)

Solution (Python):
n = int(input())
lst = list(map(int, input().split()))
x = 0

for i in range(n):

    x += lst[i]*sum(lst[i+1:n])

print(x)