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):
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
Ds = list(mapint())

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

print(ans)

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

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

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

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

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

S = []
for i in range(N):
    for t in range(i):
        if i != t:
            S.append(d[i]*d[t])
print(sum(S))

Solution (Python):
from itertools import combinations

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

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

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

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

Solution (Python):
import itertools

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

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

chofuku = 0
for x in d:
    for y in d:
        chofuku += x*y
chofuku //= 2

nochofuku = 0
for x in d:
    nochofuku += x*x
nochofuku //= 2

print(chofuku-nochofuku)

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




def main():
    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(int(ans/2))

if __name__ == "__main__":
    main()

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

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

Solution (Python):
import itertools

N = int(input())
d_int_list = list(map(int, input().split()))
comb_list = list(itertools.combinations(d_int_list, 2))
ans = 0

for i in comb_list:
    ans += i[0] * i[1]

print(ans)

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

total = 0

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

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

Solution (Python):

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

Solution (Python):
import itertools

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

d.sort(reverse=True)

result = []
for conb in itertools.combinations(d, 2):
  result.append(list(conb)) 
  
answer = 0
for i in result:
  answer += i[0]*i[1]

print(answer)

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

l1 = [x for x in range(n)]
l2 = [x for x in range(n)]

ans = 0
sub = 0

for v1, v2 in itertools.product(l1, l2):
    ans += D[v1] * D[v2]

for i in range(n):
    sub += D[i]*D[i]

print((ans-sub)//2)

Solution (Python):
import itertools


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

ans = 0
for v in itertools.combinations(D,2):
    ans += v[0]*v[1]

print(ans)

Solution (Python):
import itertools

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

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

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

Solution (Python):

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

print(ans)

Solution (Python):
import sys


from collections import defaultdict, Counter
inp = sys.stdin.readline
read = lambda: list(map(int, inp().strip().split()))





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


		

if __name__ == "__main__":
	solve()

Solution (Python):
import sys


from collections import defaultdict, Counter
inp = sys.stdin.readline
read = lambda: list(map(int, inp().strip().split()))





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


		

if __name__ == "__main__":
	solve()

Solution (Python):
from itertools import combinations

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

c=list(combinations(d,2))

ans=0

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

print(ans)

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

Solution (Python):
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  

N = I()
d = LI()

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

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

print(tmp)

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

Solution (Python):
import sys
from itertools import accumulate

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    csum = accumulate(D)
    ans = sum(s * d for s, d in zip(csum, D[1:]))
    print(ans)
    return


if __name__ == '__main__':
    main()

Solution (Python):
import sys
from itertools import accumulate

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    csum = accumulate(D)
    ans = sum(s * d for s, d in zip(csum, D[1:]))
    print(ans)
    return


if __name__ == '__main__':
    main()

Solution (Python):
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


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

    ans = 0
    for i in range(N):
        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 = [int(x) for x in input().split()]
print((pow(sum(d),2)-sum([pow(x,2) for x in d]))//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):
def main():
    n = int(input())
    inlis = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        for j in range(n):
            if i < j:
                ans += inlis[i] * inlis[j]
    print(ans)
    
    
    
if __name__ == "__main__":
    main()

Solution (Python):
def main():
    n = int(input())
    d = [int(x) for x in input().split()]
    ans = 0
    for i in range(n):
        for j in range(n):
            if i < j:
                ans += d[i]*d[j]
    print(ans)

if __name__ == '__main__':
    main()

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

print(ans)

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

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

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

Solution (Python):
import math
import itertools

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

for i in itertools.combinations(A,2):
    a,b = int(i[0]), int(i[1])
    s = a*b
    ans.append(s)

print(sum(ans))

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

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

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

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

print(result)

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

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

cnt, sumd =0, sum(d)
for i in d:
    cnt += i * (sumd - i)
print(cnt // 2)

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

sumd = sum(d)
cnt = 0
for i in d:
    cnt += i * (sumd - i)
print(cnt // 2)

Solution (Python):
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(500000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

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

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

print(sum)

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

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

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

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

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

Solution (Python):
n=int(input())
list=list(map(int, input().split()))
def pair(parameter):
        pairedList = []
        for iterater1 in range(len(parameter)):
                for iterater2 in range(iterater1+1,len(parameter)):
                        pairedList.append([parameter[iterater1],parameter[iterater2]])
        return pairedList

pairings = pair(list)
count=0
add=0
for i in pairings:
    x=i[0]*i[1]
    add+=x
print(add)

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
ans=0
for i in range (0,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()))
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())
d = list(map(int,input().split()))
a = (list(itertools.permutations(d,2)))
b = []
for i in range(len(a)):
    b.append(a[i][0]*a[i][1])
print(sum(b)//2)

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

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

ans=0

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

print(ans)

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

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

if __name__ == '__main__':
    main()

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

Solution (Python):
from itertools import accumulate as Z
n = input()
d = list(map(int,input().split()))
print(sum(a*b for a,b in zip(d[1:],Z(d))))

Solution (Python):
from itertools import accumulate
n = int(input())
d = list(map(int, input().split()))
print(sum(a*b for a, b in zip(d[1:], accumulate(d))))

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

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

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

print(ans)

Solution (Python):
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9
import itertools

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

    C = itertools.combinations(D, 2)
    ans = 0
    for c in C:
        ans += c[0]*c[1]

    print(ans)



if __name__ == '__main__':
    main()

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

Solution (Python):
import math
import sys
from collections import deque
import heapq
import copy
import itertools
from itertools import permutations
def mi() : return map(int,sys.stdin.readline().split())
def ii() : return int(sys.stdin.readline().rstrip())
def i() : return sys.stdin.readline().rstrip()
a=ii()
l=list(mi())
s=0
t=0
for i in l:
  s+=i
  t+=i**2
print(int((s**2-t)/2))

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

Solution (Python):

def main():
    import itertools

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

    for v in itertools.combinations(ｄ, 2):
        sum += v[0] * v[1]
    print(sum)

if __name__ == "__main__":
    main()

Solution (Python):
def solve():
    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__':
    solve()

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

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, os, math, bisect, itertools, collections, heapq, queue
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict



sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)


MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    D = il()
    ret = 0
    for x, y in itertools.combinations(D, 2):
        ret += x * y
    print(ret)


if __name__ == '__main__':
    main()

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

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


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


if __name__ == '__main__':
    resolve()

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

Solution (Python):
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor



dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n = int(input())
d = readints()
x = (list(itertools.combinations(d, 2)))
ans = 0
for i in range(len(x)):
    ans += x[i][0]*x[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):
N = int(input())
D = list(map(int, input().split()))
ans = 0
for i in range(N):
    for j in range(i+1,N):
        ans += D[i]*D[j]
print(ans)

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

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

Solution (Python):
n = int(input())
D = 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):
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
from collections import *

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

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

print(a)

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

for i in range(n):
    b = b + num[i] * num[i]

print((a - b) // 2)

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

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

sum = 0

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

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

for i in range(n):
    j = i + 1
    while j < n:
        c = c + (a[i] * a[j])
        j += 1

print(c)

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 d:
    s+=i**2
print(int(((sum(d))**2)/2-(s/2)))

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

ans = 0
for i, j in lst:
    ans += i * j
print(ans)

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

ans = 0
for i in lst:
    a = i[0] * i[1]
    ans += a
print(ans)

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

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

total = 0
for i in list(combinations(d, 2)):
    total += i[0] * i[1]
print(total)

Solution (Python):
N = int(input())
D = [int(s) for s in input().split(' ')]
D_sum = sum(D)
ret = 0
for d in D:
    ret += d * (D_sum - d)

print(ret // 2)

Solution (Python):

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

life = 0

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

print(life)

Solution (Python):
import os, sys, re, math

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

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

print(value)

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

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

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

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

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

result = 0

for i in range(len(d)):
    for h in range(i+1,len(d)):

        result += d[i] * d[h]

print(result)

Solution (Python):


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

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

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

    print(ans)

if __name__ == '__main__':
    main()

Solution (Python):


def main():
    N = int(input())
    D = list(map(int, input().split()))
    ans = 0
    for i in range(N-1):
        d1 = D[i]
        for d2 in D[i+1:]:
            ans += d1 * d2

    print(ans)

if __name__ == '__main__':
    main()

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

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

dans = 0
for i in range(N):
    y = d[i] ** 2
    dans += y

fans = (ans - dans) // 2

print(fans)

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

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

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

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

Solution (Python):
import itertools

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

total = 0
for i in itertools.combinations(d_list, 2):
    x, y = i
    total += x*y
    
print(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):
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 k(n):
  return n**2
a=int(input())
L=list(map(int,input().split()))
c=sum(L)
c=c**2
L=list(map(k,L))
d=sum(L)
print((c-d)//2)

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


if __name__ == "__main__":
    main()

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

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

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

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

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

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

result = 0

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

Solution (Python):
n=int(input())
d=list(map(int,input().split()))
sum1=sum(d)
sum2=0
for i in d:
    sum2+=i**2
print((sum1**2-sum2)//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())
l=sorted(list(map(int,input().split())))

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

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(x) for x in input().split()]

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

print(ans)

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

Solution (Python):
"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") 

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


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

print(answer)

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

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

sum = int(sum/2)
print(sum)