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=input().split()
for i in range(n):
	d[i]=int(d[i])
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())
list=list(map(int,input().split()))

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

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

print(s)

Solution (Python):
a=int(input())
b=list(map(int,input().split()))
out=0
for i in range(a):

  for j in range(i+1,a):

    out=out+b[i]*b[j]
    
print(out)

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

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

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

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

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

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

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

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

sum = 0

for i in range(0, N):
    for j in range(i, N):
        if i != j:
            sum = sum + d[i] * d[j]

print(sum)

Solution (Python):
N = input()
re = [int(x) for x in input().split()]
j = 0
s = len(re) - 1
for n in range(s):
	for m in reversed(range(s)):
		if m+1 == n:
			break
		j += re[n]*re[m+1]
print(j)

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

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

print(ans)

Solution (Python):
m=input()
A=int(m)
n=input()
t=n.split()
N=[]
sum=0
for i in range(0,A):
    N.append(int(t[i]))
for k in range(0,A):
    for l in range(k,A):
        if k!=l:
            sum=sum+N[k]*N[l]
print(sum)

Solution (Python):

import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n = int(input())
    dl = list(map(int, input().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__':
    main()

Solution (Python):
sum=0

n=int(input())
s=input().split()
t=[]
for i in range(n):
  t.append(int(s[i]))

for i in range(n):
  for j in range(n):
    if i==j:
        sum+=0
    else:
        sum+=t[i]*t[j]
print(int(sum/2))

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

sum = 0

for i in range(0, N):
    for j in range(i, N):
        if i != j:
            sum = sum + d[i] * d[j]

print(sum)

Solution (Python):
n=input()
d=[int(i) for i in input().split()]
sum=0
while True:
  a=d[0]
  del d[0]
  if d == []:
    break
  for i in d:
    sum += a*i
print(sum)

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

from itertools import combinations
for i,j in combinations(range(N),2):
  ans += d[i-1]*d[j-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] if d[i]!=d[j] else d[i]**2
print(ans)

Solution (Python):
a = int(input())
b = input().split()
b = [int(elem) for elem in b]
total = 0
for i in range(len(b)-1):
  for j in range(i+1, len(b)):
    total += b[i] * b[j]
print('{}'.format(total))

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 

input()
v = [int(i) for i in input().split(" ")]
combs = list(combinations(v, 2))
sums = [i[0] * i[1] for i in combs]
print(sum(sums))

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

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

print(sum)

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

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

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

print(ans)

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

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

su = 0
for i in list(itertools.combinations(x,2)):
    su  += i[0]*i[1]
print(su)

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

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

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

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

souwa = 0

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

print(souwa)

Solution (Python):
from itertools import combinations

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

ans = sum([x * y for x, y in combinations(D, 2)])

print(ans)

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

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

print(heal)

Solution (Python):
import sys
sys.setrecursionlimit(1000000000)
ii = lambda: int(input())
mis = lambda: map(int,input().split())
lmis = lambda: list(mis())
INF = float('inf')

def main():
    N=ii()
    D=lmis()
    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):
n = int(input())
d = [int(i) for i in input().split()]
ans = 0

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

Solution (Python):
n = int(input())
d = [int(i) for i in input().split()]
s = n * (n-1)//2

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

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
import itertools
import math
INF = 10**9
MOD = 10**9+7

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

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

sum = 0

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

print(sum)

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

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

print(ttl)

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

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

print(ans)

Solution (Python):
n = int(input())
d = list(map(int,input().split()))
ans = 0
count = 0
for x in d:
  for y in d:
    ans += (x * y)
ans_ = 0
for m in d:
  ans_ += m**2
print(int((ans-ans_)/2))

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

Solution (Python):
import sys
import itertools


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    d = list(map(int, input().rstrip('\n').split()))
    t = 0
    for v in itertools.combinations(d, 2):
        t += (v[0] * v[1])
    print(t)


if __name__ == '__main__':
    solve()

Solution (Python):
N = int(input())
data = [int(x) for x in input().split()]
data2 = [x**2 for x in data]

print((sum(data)**2 - sum(data2))//2)

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

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

print(int(s/2))

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

res = 0
cs = 0
for a in vA:
  res += cs * a
  cs += a
print(res)

Solution (Python):
import math
n = int(input())
d = list(map(int,input().split()))
li=[]
li2=[]
for i in range(n):
  for j in range(n):
    a = d[i]*d[j]
    li.append(a)
b = sum(li)
for k in range(n):
  c=d[k]**2
  li2.append(c)
d=sum(li2)
b -= d
print(math.floor(b/2))

Solution (Python):
N = int(input())
d = input().split(' ') 
pattern = N * (N - 1) / 2
ans = []
for i in range(N):
	x = int(d[i])
	for j in range(N):
		y = int(d[j])
		if i > j:
			ans.append(x*y)
		else:
			pass
print(sum(ans))

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

i = 0
HP = 0
while i <= N-2:
	HP += d[0]*(sum(d)-d[0])
	del d[0]
	i+=1
    
print(HP)

Solution (Python):
n=int(input())
d=[int(di) for di in 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(di) for di in 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_list = list(map(lambda x: int(x), input().split(" ")))

total = 0
for i in range(N-1):
    total += sum(list(map(lambda x: d_list[i]*x, d_list[i+1:])))

print(total)

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

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

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):
def main():
    n, *d = map(int, open(0).read().split())

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

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

readline = sys.stdin.readline 

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

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

print(ans)

Solution (Python):
a= input().split(" ")

N=int(a[0])


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

sum=0


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

Solution (Python):
n = int(input())
a = [int(n) for n in input().split()]
s = 0
for c in range(n):
    for cc in range(n):
        if cc >= c:
            continue
        else:
            s += a[c] * a[cc]

print(s)

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()))
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())
l = list(map(int,input().split()))
ans = 0
while len(l)>0:
  i = l[0]
  del l[0]
  for k in l:
    ans+=i*k
    
print(ans)

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

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

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

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

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

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

Solution (Python):
n,*d=map(int,open(0).read().split())
s=sum(d)**2
for v in d:s-=v**2
print(s//2)

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

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

print(ans)

Solution (Python):
n,*d=map(int,open(0).read().split())
s=sum(d)**2
for v in d: s-=v**2
print("%d"%(s/2))

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

ans = 0

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

print(ans)

Solution (Python):
input(); d_list = list(map(int, input().split()))
sum=0
for i, x in enumerate(d_list):
  for y in d_list[i+1:]:
    sum+=x*y
print("%d" % sum)

Solution (Python):
N = int(input())
d1 = input().split()
sum= 0

for i in range(N):
    for j in range(i+1,N): 
            sum += int(d1[i])*int(d1[j])

print(sum)

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

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

res = 0
for x in range(0, N-1):
	for y in range(x+1, N):
		res += vD[x] * vD[y]

print(res)

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

sum=0
i=int(1)
t=int(0)
while t<=n-2:
    while i<=n-1:
        sum=sum+d[t]*d[i]
        i+=1
    t+=1
    i=t+1
print(sum)

Solution (Python):
N = int(input())
d1 = input().split()
sum= 0

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

print(sum)

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

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

print(total)

Solution (Python):
N = int(input())
d1 = input().split()
sum= 0

for i in range(len(d1)):
    for j in range(i+1,len(d1),1): 
            sum += int(d1[i])*int(d1[j])

print(sum)

Solution (Python):
N = int(input())
d1 = input().split()
sum= 0

for i in range(len(d1)):
    for j in range(i+1): 
        if(i != j):
            sum += int(d1[i])*int(d1[j])

print(sum)

Solution (Python):
N = int(input())
d1 = input().split()
sum= 0

for i in range(len(d1)):
    for j in range(len(d1)): 
        if(i != j and j > i):
            sum += int(d1[i])*int(d1[j])

print(sum)

Solution (Python):
n = int(input())
d_list = list(map(int, input().split()))
count = 0
result_list = []
for val1 in d_list:
    count += 1
    for val2 in d_list[count:]:
        result_list.append(val1*val2)
print(sum(result_list))

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

i = 0
j = 0
p = 0

while i < n - 1:
    while j < n - 1:
        p += d[i] * d[j + 1]
        j = j + 1 
    i = i + 1
    j = i
print(p)

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

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


print(res)

Solution (Python):
N=int(input())
d=input().split(" ")
ans=0
for p in range(0,N):
    for q in range(0,N):
        if p<q:
            ans+=int(d[p])*int(d[q])
print(ans)

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

Solution (Python):
import sys
N = int(sys.stdin.readline())
D = list(map(int,sys.stdin.readline().split()))

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

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

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())
recover = 0
d = input().split()
for i, d1 in enumerate(d):
    for j, d2 in enumerate(d):
        if i < j:
            
            recover = recover +  int(d１)* int(d2)
print(recover)

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

Solution (Python):
n = int(input())
d = [int(i) for i in 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(i) for i in input().split(" ")]
r = 0
for i in range(len(D)):
    for j in range(i,len(D)):
        if i == j:
            continue
        r+=D[i] * D[j]
        
print(r)

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

Solution (Python):
import itertools

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

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

sum_ = 0

for i in range(N):
    for j in range(N):
        if(i>j):
            sum_ += int(ns[i])*int(ns[j])
        
print(sum_)

Solution (Python):

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

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

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

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

print(ans)

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

print(ans)

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

Solution (Python):
a=0
ans=0
takoyaki=int(input())
li = list(map(int,input().split()))
allUmami=sum(li)
for i in range(takoyaki):
  a+=li[i]
  ans+=li[i]*(allUmami-a)
print(ans)

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

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


if __name__ == "__main__":
    main()

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

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

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

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

ans = 0
total = sum(d)

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

print(ans // 2)

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

Solution (Python):
n=int(input())
a=[int(i) for i in input().split()]
ans=0
su = sum(a)

for i in range(len(a)):
    ans+=(su-a[i])*a[i]
print(ans//2)

Solution (Python):
n=int(input())
a=[int(i) for i in 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())
takos = list(map(int, input().split()))

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

print(ans)

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

sum = 0
for a in range(n-1):
  for b in range(a+1,n):
    sum += d[a] * d[b]
print(sum)

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

ans = 0

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

print(ans)

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

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

sum = 0

for i in range(0, len(D), 1):

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


print(sum)

Solution (Python):
from itertools import combinations

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

for combo in list(combinations(D, 2)):
    ans += combo[0] * combo[1]

print(ans)

Solution (Python):
import copy
x = int(input())
y = list(map(int,input().split()))

result = 0
for (i, v) in enumerate(y):
  z = copy.deepcopy(y)
  c = copy.deepcopy(x) - 1 - i
  r = 0
  for j in range(c):
    r = r + z.pop()
  result = result + r * v

print(result)

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 next_int():
    return int(input())

def next_ints():
    return list(map(int, input().split()))
n = next_int()
a = next_ints()
sum = ans = 0
for i in range(n):
    sum += a[i]
for i in range(n):
    sum -= a[i]
    ans += a[i] * sum
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]
        j = j + 1
    i = i + 1

print(result)

Solution (Python):
def main():

    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)

if __name__ == "__main__":
    main()

Solution (Python):

import itertools

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

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

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

u = 0

for val in range(n):
	u += t_list[val]*(sum(t_list) - t_list[val])

u /= 2
m = int(u)
print(m)

Solution (Python):
N = input()
tako = list(map(int,input().split(" ")))
a = 0
for n in tako:
    for m in tako:
        a += n * m
b = 0
for n in tako:
    b += n ** 2
print(int((a-b)/2))

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

goukei = 0
for dd in d:
    for ll in d:
        goukei += dd * ll
    goukei -= dd ** 2

goukei = goukei / 2
print(int(goukei))

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):
from itertools import combinations
N = int(input())
d = list(map(int,input().split()))
a = 0

for i,j in combinations(d,2):
  a+=i*j

print(a)

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

ans = 0

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

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

print(int(ans/2))

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

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

Solution (Python):
n=int(input())
S=list(map(int,input().split()))
c=0

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


print(int(c/2))

Solution (Python):
def solve(string):
    n, *d = map(int, string.split())
    return str(sum([d1 * d2 for i, d1 in enumerate(d) for d2 in d[i + 1:]]))


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Solution (Python):
n = int(input())
D = list(map(int, input().split()))
s1, s2 = 0, 0
for d in D:
  s1 += d
  s2 += d*d

print((s1*s1 - s2) // 2)

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

Solution (Python):


n = int(input())

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

s = (n * (n - 1)) / 2

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

print(sumv)

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

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

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

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

Solution (Python):
import itertools
n = int(input())
d = list(map(int, input().split()))
print(sum(map(lambda x: x[0]*x[1], itertools.combinations(d, 2))))

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

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

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

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

Solution (Python):



from collections import deque

N = int(input())
A = deque(list(map(int, input().split())))
ctr, tmp = 0, 0

for i in range(N):
    tmp = A.popleft()
    ctr += tmp * sum(A)

print(ctr)

Solution (Python):
import copy

n = int(input())
d = list(map(int,input().split()))
cnt = 0
for k,v in enumerate(d):
	s = copy.copy(d)
	del s[k]
	l = map(lambda x:v*x,s)
	cnt += sum(l)
print(int(cnt/2))

Solution (Python):

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

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

Solution (Python):
from sys import stdin
n = int(stdin.readline().rstrip())
tasty = list(map(int, stdin.readline().rstrip().split()))
res = 0
for i in range(n):
    for j in range(i+1, n):
        res += tasty[i] * tasty[j]
print(res)

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

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

print(count)

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



def main():
    from itertools import combinations

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

    for first, second in combinations(d, 2):
        ans += first * second

    print(ans)


if __name__ == '__main__':
    main()

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

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

resp = 0
for var1 in range(0,len(data)):
	for var2 in range(0,len(data)):
		if var1 == var2:
			pass
		else:
			resp = resp + data[var1]*data[var2]

resp = resp/2



print(int(resp))

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

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

count = 0
for i, num in enumerate(d_list):
  for j, num2 in enumerate(d_list):
    if i == j:
      continue
    count = count + num*num2

print(count//2)

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

Solution (Python):
n = int(input())
A= [int(c) for c in input().strip().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()))
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())
point = list(map(int,input().split()))
for i in range(point.count(0)):
    point.remove(0)
result = list(itertools.combinations(point, 2))
s = 0

for i in result:
    s += i[0]*i[1]
print(s)