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

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

Solution (Python):
N = int(input())
D = [int(x) for x in input().split()]
ans = 0
for i, x in enumerate(D):
    for j, y in enumerate(D):
        if(i>=j):continue
        ans += x*y
print(ans)

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

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
j = 0
count = 0
i = 1
while j < n:
    if j + i < n:
        count += d[j] * d[j + i]
        i += 1
    else:
        j += 1
        i = 1
print(count)

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

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

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

su = 0

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

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

Solution (Python):
n=int(input())
D=tuple(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(0, N - 1):
    for j in range(i + 1, N):
        ans = 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):

import sys
sys.setrecursionlimit(300000)


def solve(N: int, d: "List[int]"):
    ret = 0
    for i in range(N):
        for j in range(i + 1, N):
            ret += d[i] * d[j]
    print(ret)
    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 x in range(n):
    for y in range(x+1, n):
        ans += d[x] * d[y]

print(ans)

Solution (Python):
import itertools

N = int(input())

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

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

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

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

Solution (Python):

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):
import sys
input = sys.stdin.readline

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


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

ans = 0
for i in range(n-1):
    for j in range(i+1,n):
        ans += arr[i]*arr[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:
      continue
    ans += D[i] * D[j]
print(ans // 2)

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

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

Solution (Python):
N = int(input())
d = [int(i) for i in input().split()]
Visit = [[False for j in range(N)]for i in range(N) ]
ans = 0

for i in range(N):
    for j in range(N):
        if i==j:
            continue
        if Visit[i][j] and Visit[j][i]:
            continue
        else:
            ans += d[i]*d[j]
            Visit[i][j] = True
            Visit[j][i] = True
print(ans)

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

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

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

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

Solution (Python):


def main():
    N = int(input())
    D = [int(d) for d in input().split()]
    
    hp = 0
    for n in range(N):
        for m in range(N):
            if n >= m:
                continue
            hp += D[n] * D[m]
    print(hp)

main()

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

ans=0
for i in range(n-1):
  tako_1=a[i]
  for v in range(i+1,n):
    tako_2=a[v]
    tako=tako_1*tako_2
    ans+=tako

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 itertools import combinations
a = int(input())
b = list(map(int, input().split()))
r = 0
for i in combinations(b,2):
    r += i[0] * i[1]
print(r)

Solution (Python):
import unittest
from io import StringIO
import sys


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


def resolve():
    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)


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3
3 1 2"""
        output = """11"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """7
5 0 7 8 3 3 2"""
        output = """312"""
        self.assertIO(input, output)


if __name__ == "__main__":
    resolve()

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

ans = 0
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        ans += D[i] * D[j]
print(int(ans / 2))

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

for i in range(N):
  for j in range(i+1):
    if i != j:
      s += d[i]* d[j]
    
print(s)

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

total = 0
i = 0
while i < N:
	j = i +1
	while j < N:
		total += D[i] * D[j]
		j += 1
	i += 1
	
print(total)

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

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

print(ans)

Solution (Python):
'''B - TAKOYAKI FESTIVAL 2019
https://atcoder.jp/contests/abc143/tasks/abc143_b

>>> main(3, [3, 1, 2])
11
>>> main(7, [5, 0, 7, 8, 3, 3, 2])
312

'''

from itertools import combinations


def main(n, d):
    value = 0

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

    print(value)


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

    main(n, d)

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

print(sum)

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


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)


if __name__ == '__main__': main()

Solution (Python):
from itertools import combinations

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

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

print(ans)

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

result = 0

for i in range(N):
    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()))
c=0
for i in range(N):
    c+=(D[i]*(sum(D)-D[i]))/2
print(int(c))

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

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

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

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

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

takoyaki = 0
sum = 0

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

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

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

s = sum(D)
sq = 0
for i in range(N):
    sq += D[i]**2
print((s**2 - sq)//2)

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

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

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

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

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

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

Solution (Python):
n = input()
l = map(int,raw_input().split())
val = list(l)
for i in xrange(n-2,-1,-1):
  l[i]+=l[i+1]
tot = 0
for i in xrange(n-1):
  tot+=((l[i]-val[i])*val[i])
print tot

Solution (Python):
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string



def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')



input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

n=I()
d=LI()
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(raw_input())
d=map(int,raw_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()))

print(((sum(d)) ** 2 - sum([x ** 2 for x in d])) // 2)

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

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

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

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

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

answer = 0

for i in range(N):
    for j in range(N-1-i):
        J = i + j + 1
        answer += d[i] * d[J]
        
print(answer)

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

heal=0
total=sum(d)

for i in range(n):
	total-=d[i]
	heal+=d[i]*total

print(heal)

Solution (Python):
def solve():
    N, *dl = map(int, open(0).read().split())
    ans = 0
    
    for i in range(N-1):
        for j in range(i+1, N):
            ans += dl[i] * dl[j]
    
    print(ans)

if __name__ == '__main__':
    solve()

Solution (Python):
from copy import deepcopy

if __name__ == "__main__":
    num = int(input())
    base_list=[]
    tmp_list=[]
    ans=0
    base_list = input().split()
    tmp_list = deepcopy(base_list)
    for i in base_list:
        tmp_list.remove(i)
        for j in tmp_list:
            ans+=int(i)*int(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):
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)
    
main()

Solution (Python):
n = int(input())
ds = [int(x) for x in input().split()]
ds2 = [x*x for x in ds]
s = 0
s2 = 0
for i in range(n):
  s += ds[i]
  s2 += ds2[i]
ss = 0
for i in range(n):
  ss += ds[i] * s

print((ss - s2) // 2)

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

sum_num = 0
for i, d1 in enumerate(D):
    for j, d2 in enumerate(D):
        if i < j:
            sum_num += d1*d2

print(sum_num)

Solution (Python):
n = int(input())
ds = [int(x) for x in input().split()]
ds2 = [x*x for x in ds]
s = sum(ds)
print(int((sum(ds * s) - sum(ds2)) / 2 ))

Solution (Python):

n = int(input())

ds = [int(x) for x in input().split()]
ds2 = [x*x for x in ds]


print(int((sum(ds * sum(ds)) - sum(ds2)) / 2 ))

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

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

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

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

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

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

print(t)

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

Solution (Python):
N = int(input())
sum_d = 0
sum_d2 = 0
for d in map(int,input().split()):
    sum_d += d
    sum_d2 += d * d
print((sum_d*sum_d - sum_d2)//2)

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

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


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

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

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

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

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

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


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

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

    ans = 0

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

    print(ans)
    
if __name__ == '__main__':
    answer_143b_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())

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

sum = 0
count = 1

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

print(sum)

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

total=0
for i in range(n):
    for j in range(n):
        total+=oisisa[i]*oisisa[j]

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

print(ans)

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

squ = [i**2 for i in lis]
sq = sum(squ)

a = []
for i in lis:
    for j in li:
        a.append(i*j)

print((sum(a)-sq)//2)

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

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

Solution (Python):

N = int(input())
D = list(map(int, input().split()))
s = sum(D)
square_s = sum([d ** 2 for d in D])
print((s ** 2 - square_s) // 2)

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

print(ans//2)

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

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

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

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

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

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

Solution (Python):
from itertools import combinations

N, *d = map(int, open(0).read().split())
print(sum(x * y for x, y in combinations(d, 2)))

Solution (Python):
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    a = LI()
    s = sum(a)
    r = 0
    for c in a:
        r += c * (s-c)

    return r // 2


print(main())

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)

if __name__ == '__main__':
    main()

Solution (Python):
import sys

class Solution(object):
    def __init__(self):
        self.n = int(sys.stdin.readline())
        a = sys.stdin.readline().split()
        self.d = [int(x) for x in a]

    def get_takoyaki_combo_sum(self):
        
        sum = 0
        for i in range(len(self.d)-1):
            for j in range(i+1, len(self.d)):
                sum += self.d[i] * self.d[j]
        return sum


if __name__ == "__main__":
    s = Solution()
    print(s.get_takoyaki_combo_sum())

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

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

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

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

print(total)

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

Solution (Python):
import sys

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

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

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

print(ans)

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

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

res = 0
for i in range(len(d_li)):
  for j in range(i+1,len(d_li)):
    res += d_li[i]*d_li[j]
print(res)

Solution (Python):
a = int(input())
b = [int(x) for x in input().split()]
s = [b[x]*b[y] for x in range(0, len(b)) for y in range(x+1, len(b))]
print(sum(s))

Solution (Python):
import sys
from fractions import gcd
from functools import reduce
from itertools import combinations
from random import random

import numpy as np

sys.setrecursionlimit(200000)


class Solver:
    def __init__(self):
        pass

    def input(self):
        """
            faster input function than builtin stdin.
        """
        return sys.stdin.readline()[:-1]

    def ii(self, t: type = int):
        """
            input single value.
        """
        return t(self.input())

    def il(self, t: type = int):
        """
            input single line.
        """
        return list(map(t, self.input().split()))

    def imi(self, N: int, t: type = int):
        return [self.ii(t) for _ in range(N)]

    def iml(self, N: int, t: type = int):
        return [self.il(t) for _ in range(N)]

    def solve(self):
        N = self.ii()
        d = self.il()
        ans = 0
        for x, y in combinations(d, 2):
            ans += x * y
        return ans


if __name__ == "__main__":
    solver = Solver()
    print(solver.solve())

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

Solution (Python):

def main():
    N, *D = map(int, open(0).read().split())
    ans = sum(x * y for i, x in enumerate(D) for y in D[i + 1 :])
    print(ans)


if __name__ == "__main__":
    main()

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

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

Solution (Python):

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

Solution (Python):
from itertools import combinations as com
n = int(input())
d = list(map(int,input().split()))
a = 0
for i in com(d,2):
  a += i[0] * i[1]
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):
a = int(input())
l = list(map(int,input().split()))
s = 0
for e,i in enumerate(l):
    for j in l[e+1:]:
        s+=i*j
print(s)

Solution (Python):
import sys
from collections import defaultdict, deque
from heapq import *
sys.setrecursionlimit(200000)
input = sys.stdin.readline


N = int(input())
L = [int(v) for v in input().split()]





ans = 0
for i in range(N):
    for j in range(N):
        if i != j:
            ans += L[i] * L[j]
print(ans // 2)

Solution (Python):
n = int(input())
takoyaki = list(map(int,input().split()))
ans = 0
for i in range(n):
    for j in range(i,n):
        if i == j:
            pass
        else:
            
            ans += takoyaki[i]*takoyaki[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):
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):
    for j in range(n):
        if i == j:
            continue
        ans += d[i] * d[j]
print(ans//2)

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

print(ans)

Solution (Python):
from sys import stdin
input = stdin.readline
lmi = lambda: list(map(int, input().split()))
mi = lambda: map(int, input().split())

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

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

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

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

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

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

for i in range(N-1):
    a = d[i]
    b = sum(d[i+1:])

    s += a * b

print(s)

Solution (Python):
import itertools

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

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

result = 0
for i in range(len(c)):
    result += c[i][0] * c[i][1]

print(result)

Solution (Python):
_,d=open(0)
a=b=0
for d in d.split():d=int(d);a+=d*d;b+=d
print(b*b-a>>1)

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

import itertools

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

Dcum = itertools.accumulate(D) 
answer = sum(s*d for s,d in zip(Dcum,D[1:]))
print(answer)

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

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

sum = 0
for index, takoyaki1 in enumerate(d[:-1]):
    for takoyaki2 in d[index+1:]:
        sum += takoyaki1*takoyaki2

print(sum)