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

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

ans = 0

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

Solution (Python):

from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip


def main():
    n = int(input())
    d = [int(i) for i in input().split()]

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

    print(s)




BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")



if __name__ == "__main__":
    main()

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

ans = 0

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

print(ans)

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

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

ans = 0

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

print(ans)

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

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

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

print(ans)

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

ans = sum((x*y for i, x in enumerate(seq) for y in seq[i+1:]))
print(ans)

Solution (Python):
n = int(input())
ds = [int(elem) for elem in input().split()]

import itertools

c = list(itertools.combinations(ds, 2))

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

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

Solution (Python):
if __name__ == '__main__':
    n = int(input())
    d = list(map(int,input().split()))

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

    print(answer//2)

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

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

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

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

ret = 0

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

print(ret)

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

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

count = 0

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


print(count)

Solution (Python):
import sys

input = sys.stdin.readline

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

s = 0
s2 = 0
for di in d:
	s += di
	s2 += di*di

ans = (s*s-s2)//2
print(ans)

Solution (Python):
import itertools

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

ans = 0
buff = list(itertools.permutations(D, 2))

for e in buff:
    ans += e[0] * e[1]


print(ans//2)

Solution (Python):
N = int(input())
d = [int(i) for i in input().split()]
tot = 0
for i in range(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()))
res = 0
for i in range(N):
    for j in range(i):
        res += D[i] * D[j]
print(res)

Solution (Python):
from itertools import combinations

n = int(input())
d = list(map(int, input().split()))
s = sum([i[0] * i[1] for i in combinations(d, 2)])
print(s)

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

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

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

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, 1):
        x = d[i] * d[j]
        res += x
print(res)

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

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

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

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

print(cnt)

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

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

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

c = 0
for i in range(len(t_list)):
  for j in range(len(t_list)):
    if (i == j):
      pass
    else:
      c += t_list[i] * t_list[j]
print(c // 2)

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

ans=0

for i in range(1,n+1):
  for j in range(1,n+1):
    if j>i:
      ans+=dl[i-1]*dl[j-1]
    else :
      continue
      
print(ans)

Solution (Python):
import itertools

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

L = list(itertools.combinations(l,2))

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

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

Solution (Python):
import itertools

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

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

print(ans)

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

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

count = 0

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

print(count)

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

Solution (Python):

import sys


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


def read(f=int):
    return f(readline())


def reads(f=int):
    return list(map(f, readline().split()))


def read_n(n: int, f=int):
    return [read(f) for _ in range(n)]


def reads_n(n: int, f=int):
    return [reads(f) for _ in range(n)]

N = read()
D = reads()

from itertools import combinations

print(sum(a * b for a, b in combinations(D, 2)))

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

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

Solution (Python):




def main():
  input()
  vals = list(map(int, input().split()))
  s = 0
  b = sum(vals)

  for v in vals[:-1]:
    b -= v
    s += v * b

  print(s)


if __name__ == '__main__':
  main()

Solution (Python):
import itertools

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


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

Solution (Python):

import sys
input = sys.stdin.readline


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

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

    print(result)


if __name__ == '__main__':
    main()

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

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

li = []
for i in range(n):
    for j in range(i, n):
        if i == j:
            continue
        li.append(d[i]*d[j])

print(sum(li))

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

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

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

t = 0

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

print(t)

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

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

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

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

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

print(ans)

Solution (Python):
from sys import stdout
printn = lambda x: stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split()) 
DBG = True 
BIG = 999999999
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

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

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

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

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

print(ans)

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

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

print(sum)

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

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

Solution (Python):






class Solution:
    def main(self):
        N = int(input())
        d = list(map(int, input().split()))

        print((sum(d)**2 - sum([d[i]**2 for i in range(len(d))]))//2)


if __name__ == '__main__':
    Solution().main()

Solution (Python):


N = int(input())

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

res = 0
for i_a in range(len(d)-1):
  for i_b in range(i_a+1,len(d)):
    
    res += d[i_a]*d[i_b]
    
print(res)

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

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

print(ans)

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

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

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

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

print(res)

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

li=list(map(int,input().split()))
ans=0
for n in range(N):
  for k in range(n):
    ans+=li[n]*li[k]
print(ans)

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

N = len(D)
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())
d = list(map(int,input().split()))
ans1 = 0
ans2 = 0
for i in d:
    ans1 += i
    ans2 += i**2

print((ans1**2 - ans2)//2)

Solution (Python):
from itertools import combinations


n = int(input())
d = list(map(int, input().split()))
comb_list = list(combinations(d, 2))
ans = 0
for a, b in comb_list:
    ans += a * b
print(ans)

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

Solution (Python):
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush
from fractions import gcd
from copy import deepcopy
import math
import queue


Mod = 1000000007
 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




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

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

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

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

ans = 0

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

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

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

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

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

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

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

ans = 0

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

print(ans)

Solution (Python):

import itertools

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

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

Solution (Python):
N = int(input())
hoge = input().split()
A = []
for i in range(N):
  A.append(int(hoge[i]))
  
sums = 0
for i in range(N):
  for j in range(i+1,N):
    sums += A[i] * A[j]
    
print(sums)

Solution (Python):
import itertools

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

    ans = 0

    for i, j in list(itertools.combinations(d,2)):
        ans += i * j

    print(ans)

if __name__ == "__main__":
    main()

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

N=int(input())
D=list(map(int,input().split()))
_sum = 0
for _ in list(itertools.combinations(D,2)):
    _sum += _[0] * _[1]
print(_sum)

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

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

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

from itertools import combinations
x = list(combinations(D, 2))

ans = 0
for a, b in x:
    ans += a * b
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(i):
        ans += d_list[i]*d_list[j]
print(ans)

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

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

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 solve():
  N = int(input())
  D = [int(i) for i in input().split()]
  s = sum(D)
  ans = 0
  for d in D:
    s -= d
    ans += s * d
  return ans

print(solve())

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

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

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

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

print(ans)

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

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

E = [d**2 for d in D]
print((sum(D)**2 - sum(E))//2)

Solution (Python):
import sys
import itertools
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

def main():
    n = int(input())
    d = map(int, input().split())
    arr = list(itertools.combinations(d,2))
    ans = 0
    for x, y in arr:
        ans += x*y
    print(ans)



if __name__ == '__main__':
        main()

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

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

print(result)

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

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

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

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

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

print(output)

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

ans=0
for i in range(len(l)):
    for j in range(len(l)):
        if i==j:
            pass
        else:
            ans+=(l[i]*l[j])

print ans/2

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

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

Solution (Python):
from itertools import combinations
N, *d = map(int, open(0).read().split())
ans = 0
for i, j in combinations(range(N), 2):
    ans += d[i] * d[j]
    
print(ans)

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

ans = 0

for j in range(N):
    for i in range(N):
        if j == i:
            continue
        if j < i:
            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):
def f_b():
    n, *d = map(int, open(0).read().split())
    o = 0
    for i in range(n):
        for j in range(i+1, n):
            o += d[i]*d[j]
    print(o)

if __name__ == "__main__":
    f_b()

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

Solution (Python):
ans = 0
stock = []
input()
for i in map(int, input().split()):
  for j in stock:
    ans += i * j
  stock.append(i)

print(ans)

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

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

Solution (Python):

from fractions import gcd

from math import factorial as f

from math import ceil,floor,sqrt

from sys import exit

from copy import deepcopy
import numpy as np

import bisect
import re


ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))



def main():
    n = ii()
    a = li()

    s = sum(a)

    ans = 0

    for i in a:
        ans+=(s-i)*i
    
    print(ans//2)


main()

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

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

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

print(sum)

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

ans = 0
for i,j in combinations(range(N), 2):
    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 itertools

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

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

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

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

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

Solution (Python):
from itertools import combinations
N = int(input())
D = [int(d) for d in input().split()]

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

Solution (Python):
def two_int():
    N, K = map(int, input().split())
    return N,K

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

import itertools as it
N=one_int()
ds=many_int()

temp = list(it.combinations(ds,2))
sums=0
for i in temp:
    sums+=(i[0]*i[1])

print(sums)

Solution (Python):
import itertools

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

ans = 0

p = itertools.permutations(d, 2)
for v in itertools.permutations(d, 2):
    v = list(v)
    ans += v[0] * v[1]


print(ans // 2)

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