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

print(ans)

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

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

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

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

a = 0

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

Solution (Python):
N = int(raw_input())
d = map(int,raw_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=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):
import sys
from itertools import combinations
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
MOD = 1000000007
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N=II()
xs=LI()

res = 0
for i, j in combinations(xs, 2):
    res += i*j

print(res)

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

while i < N:
  for k in range(i+1,N):
    tmp = d[i] * d[k]
    ans += tmp
  i += 1

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

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

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
more = N - 1
total = 0
for i in range(N):
  for j in range(more):
    try:
      total +=  int(d[i]) * int(d[i + j + 1])
    except IndexError:
      break
  more -= 1
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 = list(map(int, input().split()))
 
ret = 0
for i in range(N):
  for j in range(i+1,N):
    ret += d_list[i] * d_list[j]
print(ret)

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

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

a = 0

for i in range(len(d)):
    for j in range(i+1,len(d)):
        a = a + d[i]*d[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):
import itertools
n = 2
inputs = [[int(i) for i in input().split()] for i in range(n)]

combinations = list(itertools.combinations(inputs[1], 2))
energy = [combinations[i][0] * combinations[i][1] for i in range (len(combinations))]
energy_sum = sum(energy)
print(energy_sum)

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

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

c = 0

for x in range(len(li)) :
    for y in range(x+1,len(li)) :
        c += li[x]*li[y]

print(c)

Solution (Python):

import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 




 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    d = inputList()
    
    ans = 0
    for i, val in enumerate(d):
        for j in range(i+1, N):
            vol = d[j]
            
            ans += val * vol
    
    print(ans)
    
if __name__ == "__main__":
	main()

Solution (Python):


import sys
import math
import collections
import itertools
from inspect import currentframe
INF = 10 ** 10
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def gcd(x, y) : return y if x % y == 0 else gcd(y, x % y)
def lcm(x, y) : return (x * y) // gcd(x, y)
def I() : return int(input())
def MI() : return map(int, input().split())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def chkprint(*args) : names = {id(v):k for k,v in currentframe().f_back.f_locals.items()}; print(', '.join(names.get(id(arg),'???')+' = '+repr(arg) for arg in args))

N = I()
D = LI()

ans = 0

for i, d in enumerate(D):
    for j in range(i + 1, N):
        ans += (d * 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(N):
        if i != j:
            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, N):
        if i == j: continue
        ans += d[i] * d[j]
print(ans)

Solution (Python):
N = int(input())
TKY = input().split(' ')
heal = 0

for i in range(N-1):
	for j in range(N-(i+1)):
		heal += (int(TKY[i]) * int(TKY[i+j+1]))
	
print(heal)

Solution (Python):
def main():
    n = iread()
    d = aread()
    recover = 0
    for i in range(n):
        for j in range(i + 1, n):
            recover = recover + d[i] * d[j]
    print(recover)


def iread():
    return int(input())


def sread():
    return input()


def aread(t="int"):
    if t == "int":
        ret = [int(i) for i in input().split()]
    elif t == "str":
        ret = list(input().split())
    return ret


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


if __name__ == '__main__':
    main()

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

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

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

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

ans = 0
for i1 in range(N - 1):
  for i2 in range(i1 + 1, N):
    ans += ds[i1] * ds[i2]

print(ans)

Solution (Python):
X=int(input())
Y=[int(i) for i in input().split()]

result=0
for i in range(1, X):
  for j in range(X):
    if i+j<=X-1:
      result+=Y[j]*Y[j+i]
print(result)

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

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

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

ans = 0

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

Solution (Python):
import itertools,functools
N=int(input())
XY=list(map(int,input().split()))
A=list(itertools.combinations(XY, 2))
ANS=functools.reduce(lambda a,b: a+(b[0]*b[1]), A, 0)
print(ANS)

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


combi_list = list(combinations(L,2))
for i in combi_list:
    ans += i[0] * i[1]
print(ans)

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

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

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

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

Solution (Python):
import itertools

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

comb_list = list(itertools.combinations(D,2))

res = 0
for comb in comb_list:
    res += comb[0] * comb[1]

print(res)

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

sys.setrecursionlimit(10**7)
inf=10**20
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 [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n=I()
  l=LI()

  sm=0
  for i,x in enumerate(l):
    for j,y in enumerate(l[i+1:]):
      sm+=x*y
  return sm


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

sumn = 0

for i in d:
	for j in d:
		sumn += i*j
	sumn -= i*i

print(sumn//2)

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

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

print(sum)

Solution (Python):
length = input()
rtn = 0
li = list(map(int, input().split()))
for i, n1 in enumerate(li):
    if len(li) == i + 1:
        print(rtn)
        break
    for j, n2 in enumerate(li):
        if i >= j: continue
        rtn += n1 * li[j]

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

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

Solution (Python):
import itertools as itl

N=int(input())
d_i=(int(x) for x in input().split())
c_list=list(itl.combinations(d_i,2))

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

print(sum)

Solution (Python):
N = int(raw_input())
A = map(int, raw_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 = list(map(int,input().split()))

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

Solution (Python):

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

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

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

for i in range(N):
  for j in range(N):
    if i<j:
      t += d[i]*d[j]  
print(t)

Solution (Python):
import itertools

n = int(input())
nums = list(map(int,input().split()))
count = 0

for c in list(itertools.combinations(nums,2)):
    count += c[0] * c[1]

print(count)

Solution (Python):
gomi=input()
tako=[int(i) for i in input().split()]
print(int((sum(tako)**2-sum([i**2 for i in tako]))/2))

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

sum = 0
for i in range(N):
    for j in range(N):
        if j <= i:
            continue
        sum += int(d[i]) * int(d[j])
        

print(sum)

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

from itertools import combinations

comb = combinations(D, 2)

ans = 0
for c in comb:
    ans+=c[0]*c[1]
    
print(ans)

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

sn = 0

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

Solution (Python):
number_tako= int(input())
tako_taste= list(map(int,input().split()))
sum_taste=0

for index_first,taste_1 in enumerate(tako_taste):
	for index_second,taste_2 in enumerate(tako_taste):
		if index_first < index_second:
			sum_taste=sum_taste+taste_1*taste_2

print(sum_taste)

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

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

print(an)

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

Solution (Python):


n = int(input())
takoyaki = [int(s) for s in input().split()]

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

print(tairyoku)

Solution (Python):


N = int(input())

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

sum = 0

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

print(sum)

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

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

print(ans)

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

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

for fst in range(N-1):
  for snd in range(fst + 1,N):
    sum = sum + d[fst] * d[snd]
    
print(sum)

Solution (Python):
N = int(input())
lst = list(map(int, input().split()))
ret = 0
for idx, x in enumerate(lst[:-1]):
    for y in lst[idx + 1:]:
        ret += x * y
print(ret)

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

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

S=0
for i in range(len(D)-1):
    S1=0
    for j in range(i+1,len(D)):
        S1+=D[j]
    S+=D[i]*S1
print(S)

Solution (Python):



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

ans = 0 

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

print(ans)

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

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

Solution (Python):
import itertools
N = int(input())
strList = input().split(" ")
dList = [int(s) for s in strList]

cmb = list(itertools.combinations(dList, 2))
res = 0
for d1, d2 in cmb:
    res += d1 * d2

print(res)

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

left = sum(d_list)
ans = 0
for d in d_list:
    left-=d
    ans+=d*left
print(ans)

Solution (Python):
import itertools

n = int(input())
d = list(map(int,input().split()))
a=[]
a=list(itertools.combinations(d,2))
x=0
for i in range(len(a)):
  x+=a[i][0]*a[i][1]
  
print(x)

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

Solution (Python):



s = [input() for i in range(2)]

N = int(s[0])
D = list(map(int, s[1].split()))



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

H = int(H/2)



print(H)

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

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

accum = [0 for _ in range(N)]

for i, _d in enumerate(d):
  if i == 0:
    accum[i] = _d
  else:
    accum[i] = accum[i-1] + _d

res = 0
for i, _d in enumerate(d):
  if i < N-1:
    res += d[N-i-1] * accum[N-i-2]
  
print(res)

Solution (Python):





N = int(input())
Dn = list(map(int, input().split()))
ret = 0
for d1 in range(N):
  for d2 in range(d1+1,N):
    ret += Dn[d1] * Dn[d2]
print(ret)

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

Solution (Python):






from sys import stdin,setrecursionlimit





setrecursionlimit(10**6)
input=stdin.readline

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

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

Solution (Python):
def solve(n, d):
    res = 0
    for i in range(n):
        for j in range(i+1, n):
            res += d[i] * d[j]
    return res

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

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

print(ans)

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

Solution (Python):

import sys

import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

readl= lambda: list(map(int, sys.stdin.readline().split()))
readt= lambda: tuple(map(int, sys.stdin.readline().split()))
read = lambda: sys.stdin.readline().rstrip()
readi = lambda: int(read())
readmi = lambda: map(int, sys.stdin.readline().split())
readms = lambda: map(str, sys.stdin.readline().split())

n = readi()
d = readl()

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=input();d=list(map(int,input().split()));print((sum(d)**2-sum([x**2for x in d]))//2)

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

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):
n=int(input())
arr=list(map(int,input().split()))
ans=0
tmp=sum(arr)
for val in arr:
  ans+=val*(tmp-val)
print(ans//2)

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

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

print(sum)

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

print(summary)

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

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

f = sum(d)
s = 0

for i in d:
  s += i * (f-i)
print(s//2)

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

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

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

Solution (Python):
x = input()
y = input().split()

response = 0

for i in range(int(x)):
  for l in range(i+1,int(x)):
    num = int(y[i]) * int(y[l])
    response += num
    
print(response)

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

sum = 0
for i_idx, i in enumerate(d):
  for j_idx, j in enumerate(d):
    if(i_idx!=j_idx):
      sum+=i*j
print(int(sum/2))

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

sum = 0
for i_idx, i in enumerate(d):
  for j_idx, j in enumerate(d):
    if(i_idx!=j_idx):
      sum+=i*j
print(int(sum/2))

Solution (Python):
from itertools import combinations


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

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

    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
n = int(input())
d = list(map(int, input().split()))
sum = 0
i = 0
while i < n - 1:
  k = i
  while k < n - 1:
    k += 1
    sum += d[i] * d[k]
  i += 1
print(sum)

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

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

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

while i < n - 1:
  k = i
  while k < n - 1:
    k += 1
    sum += deliciousness[i] * deliciousness[k]
  i += 1
  
print(sum)

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

Solution (Python):
n = int(input())
arr = [int(x) for x in input().split()]
f = sum(arr)
s = 0
for i in arr:
  s += i * (f-i)

print(s // 2)

Solution (Python):
n=input()
D=list(map(int, input().split()))
total=0
while len(D)>0:
    tmp=D.pop()
    for i in range(len(D)):
        total = total + tmp*D[i]
print(total)

Solution (Python):
from sys import stdin

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

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

print(ans)

Solution (Python):
sumtaste = 0

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

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

print(sumtaste)

Solution (Python):
import itertools

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

print(sum(x * y for x, y in itertools.combinations(li_d, 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):
n=int(input())
a=list(map(int,input().split()))
s=0
for i in range(0,n-1):
  for j in range(i+1,n):
    s+=(a[i]*a[j])
print(s)

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

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

print(ans)

Solution (Python):
from sys import stdin


def fin(f):
    return f(input())


def gin(f, number=1):
    for _ in range(number):
        yield list(map(f, stdin.readline().split()))


def lin(f):
    return next(gin(f))


n = fin(int)

ans = 0
D = lin(int)
for i, d in enumerate(D):
    for e in D[i+1:]:
        ans += d*e

print(ans)

Solution (Python):
from sys import exit, stdin
N = int(stdin.readline().rstrip())
D = [int(_) for _ in stdin.readline().rstrip().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 numpy as np

n = int(input())

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

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

print(ans)

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

Solution (Python):
N = int(input())
D = list(map(int,input().split()))
D_cal = [D[i]*D[j] for i in range(N) for j in range(N) if i != j]

print(sum(D_cal)//2)

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

print(answer)

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

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

print(s)

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

Solution (Python):
from itertools import combinations
_=input()
d=list(map(int,input().split()))
print(sum([i*j for (i,j) in combinations(d,2)]))

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

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

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

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

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

Solution (Python):
import itertools

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

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

Solution (Python):
import numpy as np

def main():
    n=int(input())
    d=inputList()

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

    print(ans)

def inputList():
    a=list(map(int,input().split()))
    return a

def multisort(li,index):
    return sorted(li,key=lambda x: x[index])

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

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

all = 0
for i1, d1 in enumerate(dlist):
  for d2 in dlist[i1+1:]:
    all += d1*d2

print(all)

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

Solution (Python):
N=int(input())
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, m in enumerate(d):
    for j in d[i+1:]:
        
        
        ans += m*j
print(ans)

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

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

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

print(s)

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)