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

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

s = sum(d)

ans = s ** 2

for x in d:
    ans -= x ** 2

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())
d = [int(e) for e in input().split()]
i = 0
j = 0
ans = 0
while(i < n):
    j = i + 1
    while(j < n):
        ans += d[i] * d[j]
        j += 1
    i += 1
print(ans)

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

val = 0
sum = 0

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

Solution (Python):
n = int(input())
stamina = 0
a = 1
delicious = [int(i) for i in input().split()]
for i in range(n):
  while i + a <= n-1:
    stamina += delicious[i] * delicious[i + a]
    a += 1
  a = 1
print(stamina)

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

Solution (Python):
n=int(input())
d=[]
"""for i in range(n):
    d.append(int(input()))
"""
d=list(map(int,input().split()))

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

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

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

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

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

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

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

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

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

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

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

Solution (Python):
import copy

def j(n):
    if n:print("yes")
    else:print("no")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)

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

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

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

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

suffix_sum = [0]*n
suffix_sum[-1] = a[-1]
res = 0
for i in range(n-2, -1, -1):
	res += a[i]*suffix_sum[i+1]
	suffix_sum[i] = suffix_sum[i+1] + a[i]
print(res)

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

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

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

Solution (Python):
_,d=open(0);*d,=map(int,d.split());print(sum(d)**2-sum(i**2for i in d)>>1)

Solution (Python):
N, *D = map(int, open(0).read().split())

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

print(ans)

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

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

print(sum)

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

Solution (Python):


n = int(input().rstrip())
d = list(map(int,input().split()))
energy = 0
tekito = 0


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

print(energy)

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

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

d.sort()
counter = 1
total = 0
for _ in range(N - 1):
  total += d[counter - 1] * sum(d[counter:])
  counter += 1
print(total)

Solution (Python):

n = (int)(input())

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

sum = 0

for i in range(n):
    for j in range(n):
        if i == j or i > j:
            continue
        else:
            sum += tako[i] * tako[j]

print(sum)

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

answer = 0

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

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

Solution (Python):
n = int(input())
ln = input().split()
s = 0

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

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):
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(d) for d in input().split()]
DD = []
S = [0] * n
for u in range(n):
	S[u] = D[u] ** 2
for s in range(n):
	for t in range(n):
		DD.append(D[s] * D[t])
for v in range(n):
	DD.remove(S[v])
print(int(sum(DD) / 2))

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

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

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

Solution (Python):
N = int(input())
A = list(map(int, input().split())) 
X = 0
for a in range(N):
    if a+1 < N:
        x = A[a]
        y = sum(A[(a+1):(N+1)])
        X += x*y

print(X)

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

answer=0

for i in range(N):
  for t in range(N):
    if t>i:
      answer+=d[i]*d[t]

print(answer)

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

for i in range(n):
  for j in range(n):
    if i>=j:
      continue
    hp=d[i]*d[j]
    HP+=hp
print(HP)

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

Solution (Python):
N=raw_input()
DN=raw_input().split()

n = int(N)
dn = [int(i) for i in DN]

c = [dn[i]*dn[j] for i in range(n) for j in range(n) if i > j]

print reduce(lambda x,y: x+y, c)

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

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

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

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

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

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

print(sum)

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

total=0
for i_1 in range(n-1):
    for i_2 in range(n-i_1-1):
        total+=d[i_1]*d[i_1+i_2+1]
        
print(total)

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

Solution (Python):
import itertools
N = int(input())
nums = [int(e) for e in input().split()]

rec=0
comb_list = list(itertools.combinations(nums,2))

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

print(rec)

Solution (Python):
import sys

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

sum=0

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

    
print(sum)

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

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

ans = 0

for i in range(N-1):
    a = D.pop(0)
    for j in range(N):
        
        try:
            
            
            ans += a * D[j]
        except:
            continue
        


print(ans)

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

ans = 0

for i,di in enumerate(li):
    for j,dj in enumerate(li):
        if i <= j:
            continue
        ans += di*dj

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 sys

input = sys.stdin.readline

if __name__ == '__main__':
    N = int(input())
    d_list = list(map(int, input().split()))
    result = (sum(d_list) ** 2 - sum([d ** 2 for d in d_list])) // 2

    print(result)

Solution (Python):
import itertools

tako = input()
oishisa = [int(n) for n in input().split()]

tako_list = [int(n) for n in range(1, int(tako)+1)]
hutatoori = list(itertools.combinations(tako_list, 2))

result = sum([oishisa[toori[0]-1]*oishisa[toori[1]-1] for toori in hutatoori])
print(result)

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

recover = []

c = 0
for i in d:
    c += 1
    recover.append(i * sum(d[c:N]))

print(sum(recover))

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

ans = 0

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

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

for i in range(len(d) - 1):
    next_index = i + 1
    for d2 in d[next_index:]:
        output += d[i] * d2
print(output)

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

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

print(ans)

Solution (Python):
import itertools


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

print(sum(map(lambda tup: tup[0] * tup[1], itertools.combinations(d, 2))))

Solution (Python):
"""
author : halo2halo
date : 19,Oct,2019
"""

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

N = int(readline())
lis = list(map(int, readline().split()))
s = sum(lis)
ans = 0
for i in lis:
    s -= i
    ans += s * i

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):
N = str(input())
Ds = str(input()).split(" ")
answer = 0
 
for di in range(len(Ds)):
  for dii in range(di+1,len(Ds)):
    sum = int(Ds[di]) * int(Ds[dii])
    answer += sum
print(answer)

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

cure = 0
for i in range(N):
  
  for k in range(i, N-1):
    
    cure = cure + takoyaki[i] * takoyaki[k+1]

print(cure)

Solution (Python):

N = int(input())
D = [int(d) for d in input().split()]
deli_list = [x*y for x in D for y in D]


self_comb = sum(D[i]*D[i] for i in range(N))


ans = int(((sum(deli_list)-self_comb)/2))
print(ans)

Solution (Python):
N = input()
d = input().split()
i_1 = 0
i_2 = 0
result = 0
for index_1 in d:
    i_1 += 1
    i_2 = 0
    if i_1 > int(N):
        print('a break')
        break
    for index_2 in d:
        i_2 += 1
        if i_2 > int(N):
            print('b break')
            break
        
        if i_1 < i_2:
            result += (int(index_1) * int(index_2))
            

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

recovery = 0
for i_d1 in range(N):
    for i_d2 in range(i_d1+1, N):
        recovery = recovery + d[i_d1]*d[i_d2]
print(recovery)

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

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

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

print(sum)

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

for i in d:
    for j in d:
        S += i * j
for k in d:
    S -= k * k
print(S // 2)

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

Solution (Python):
import itertools

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

d = 0

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

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

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

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

point_sum = 0

for n in range(N):
    head = d.pop(0)
    point_sum += sum(list(map(lambda x : x * head, d)))
    
print(point_sum)

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

cnt = 0
dag = 0
for i in range(len(B)):
  dag +=B[i]*B[i]
  for j in range(len(B)):
    cnt += B[i]*B[j]

print(int((cnt-dag)/2))

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

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


tako = []
for i in range(N):
    for j in range(i+1,N):
        
        tako.append([d[i],d[j]])



sum = 0
for k in tako:
    sum += k[0]*k[1]
print(sum)

Solution (Python):
N = int(input())
d = list(map(int, input().split(" ")))
sum = 0
while len(d) >= 1:
    for i in range(1,len(d)):
        sum += d[0] * d[i]
    del d[0]
print(sum)

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

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

S = sum(d)

ans = 0

for i in range(N):
    ans += (S-d[i])*d[i]
print(int(ans/2))

Solution (Python):
from itertools import combinations as C

N = int(input())
ds = [i for i in map(int, input().split())]

S = sum(a*b for a, b in C(ds, 2))
print(S)

Solution (Python):
from itertools import combinations
T = 0
A = int(input())
L = list(map(int, input().split())) 
S = list(combinations(L, 2))
for i in S:
  T += i[0] * i[1]
print(T)

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

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

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

    

print(ans//2)

Solution (Python):

import itertools
import numpy as np

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

c = np.array([v for v in itertools.combinations(d, 2)])
print(sum(np.prod(c, axis=1)))

Solution (Python):
from itertools import combinations

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

comb = list(combinations(d, 2))

ans = 0

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

print(ans)

Solution (Python):
num = int(input())
heellist = input().split(' ')

HeelSum = 0

for i in range(0, num):
  for j in range(i+1, num):
    HeelSum += int(heellist[i]) * int(heellist[j])

print(HeelSum)

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

total = []
for i1, d1 in enumerate(D):
    for i2, d2 in enumerate(D):
        if i2 > i1:
            total.append(d1 * d2)

print(sum(total))

Solution (Python):
n = int(input())
l = [int(i) for i in input().split()]
sum = 0
i = 0
while i < n-1:
    j = i+1
    while j < n:
        sum += l[i] * l[j]
        j += 1
    i += 1
print(sum)

Solution (Python):
a = map(int, input().split())
b = list(map(int, input().split()))
c = []
while len(b)>0:
 k = b[0]
 b.pop(0)
 for s in b:
   c.append(k*s)
print(sum(c))

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

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

kaihuku =0

for i in range(n-1):
    
    first = D.pop(0)
    
    for j in range(len(D)):
        kaihuku += first*D[j]
print(kaihuku)

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

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

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

    sum = 0

    for i in range(n):
        for j in range(n):
            if i == j :
                break
            sum = sum + (dl[i] * dl[j])
    print(sum)

if __name__ == '__main__':
    answer_143b()

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

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

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

Solution (Python):
import numpy as np

n=int(input())
d_list=list(map(int,input().split()))
d=np.array(d_list)
s=0

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

print(s)

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

total_rec = 0
for i in range(total):
    for k in range(1, total - i):
        recover = tako_list[i] * tako_list[i + k]
        total_rec += recover
print(total_rec)

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

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())
b=[]
d=[]
b=input().split()

for i in range(N):
    d.append(int(b[i]))

x=0
index=0
for i in range(N):
    x=d[0]
    d.remove(d[0])
    for k in range(N-1):
            index += x*d[k]
    N-=1

print(index)

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


res = 0

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

print(res)

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

d_sum = sum(d)

m = 0
for k in d:
    m += k **2
    
print((d_sum**2 - m)//2)

Solution (Python):
import itertools

N = int(input())


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

c = itertools.combinations(d, 2)

E = []
for j in c:
    x, y = j
    E.append(x*y)

print(sum(E))

Solution (Python):


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

sum = 0

for x in range(N - 1):
    for y in range(x + 1, N):
        sum += d[x] * d[y]

print(sum)

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

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

Solution (Python):
import sys
sys.setrecursionlimit(int(1e6))

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

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

print(ans)

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

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

mount = 0

for i in range(len(tak) - 1):
	l = tak.pop(0)
	for k in tak:
		mount += l * k

print(mount)

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

pnt = 0
r = int((n * (n-1)) / 2)
cnt2 = 0

for i in range(r):
	cnt = i + 1
	cnt2 = 0
	for ii in range(n-cnt):
		cnt2 += 1
		pnt += ld[i] * ld[i+cnt2]
print(pnt)

Solution (Python):
import sys
from collections import Counter, deque, defaultdict
from math import factorial
import heapq, bisect
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

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

print(res)

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

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

Solution (Python):
N = int(input())
L = list(map(int, input().split()))
ans=0
roop=0
for i in range(N-1):
    for k in range(N-1):
        if k+1<=i:
            continue
        kaihuku = L[i]*L[k+1]
        ans+=kaihuku

print(ans)

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

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

print(ans)

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

double_ans = 0
ans = 0

for i in range(n):
    for j in range(n):
        if i != j:
            double_ans += d[i] * d[j]
        else:
            pass

print(int(double_ans / 2))

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

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

print(sum_num)

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

l = len(arr)

sumi = 0

for i in range(l):
  for j in range(i+1,l):
    sumi += arr[i]*arr[j]
    
print(sumi)

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

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

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

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

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

sum = 0
power = list(itertools.combinations(d_list,2))
for p in power:
    sum = sum + p[0] * p[1]

print(sum)

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())
import numpy as np
d_vec = np.array( list(map(int, input().split()) ))

d_mat = np.outer(d_vec, d_vec)
print(np.sum(np.triu(d_mat, k=1)))

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

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

print(sum)

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

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

map_o = map(int, input().split())
Dn = list(map_o)

tairyoku = 0

j = 0
while j < N-1:
	base = Dn[j]

	k = j+1
	while k < N:
		tmp = base*Dn[k]
		tairyoku += tmp
		k += 1
	j += 1

print(tairyoku)

Solution (Python):
N = int(input())
tako = list(map(int, input().split()))
num = 0
for n in range(N):
  for m in range(N-n-1):
    num += tako[n] * tako[n+m+1]
      
print(num)

Solution (Python):
n = int(input())
l = [int(i) for i in input().split()]
l2 = sum([i**2 for i in l])

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

print((ans - l2)//2)

Solution (Python):
N = int(input())
ans = 0
d = list(map(int,input().split()))
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()))
a=(sum(d))**2

def square(list):
    return [i ** 2 for i in list]

b=sum(square(d))
result=(a-b)/2
print(int(result))

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

for i in range(len(d)):
    d[i] = int(d[i])

for i in range(len(d)):

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

print(S)

Solution (Python):
import numpy as np

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

n = int()
all_sum = int(0)

def calcsum(b,b2):
  sum = int(0)
  for value in b2:
    sum += b * value 
  return sum

for index,value in enumerate(a):
  all_sum += calcsum(value,a[index+1:])
  
print(all_sum)