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()))
a=(sum(d))**2
b=sum((d[i])**2 for i in range(n))
print((a-b)//2)

Solution (Python):
import sys
import itertools
def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

N = I()
D = LI()

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

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


if __name__ == '__main__':
    main()

Solution (Python):
import itertools

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

num = list(itertools.combinations(num, 2))

count = 0

for i in num:
  count += i[0] * i[1]

print(count)

Solution (Python):
import math
n = int(input())
d = list(map(int, input().split()))
l = []
count = 0
for i in range(0, len(d)):
  for j in range(0, len(d)):
    if i != j or d[i] != d[j]:
      a = sorted([d[i], d[j]], reverse=True)
      l.append(a)
for i in range(0, len(l)):
  count += l[i][0]*l[i][1]
print(math.floor(count/2))

Solution (Python):
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations, combinations_with_replacement
from math import sqrt, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from copy import deepcopy
from operator import itemgetter
from functools import reduce


import sys
def I(): return int(input())
def Is(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def IR(n): return [I() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def TIR(n): return [TI() for _ in range(n)]
def S(): return input()
def Ss(): return input().split()
def LS(): return list(input())
def SR(n): return [S() for _ in range(n)]
def SsR(n): return [Ss() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
sys.setrecursionlimit(10**6)
MOD = 10**9+7
INF = float('inf')


n = I()
D = LI()
ans = 0
for x, y in combinations(D, 2):
    ans += x*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):
import sys
import os
import math
import bisect
import collections
import itertools
import heapq

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()
    cum = itertools.accumulate(D)
    print(sum(c * d for c, d in zip(cum, D[1:])))


if __name__ == '__main__':
    main()

Solution (Python):
import sys
import os
import math
import bisect
import collections
import itertools
import heapq

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 i in itertools.combinations(D, 2):
        ret += i[0] * i[1]
    print(ret)


if __name__ == '__main__':
    main()

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

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

x = len(t)

ans = 0

for i in range(x):
    for s in range(i+1,x):
        ans += t[i]*t[s]
        
print(ans)

Solution (Python):
from itertools import combinations

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

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

Solution (Python):
import sys
sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): return k.join(list(map(str, lst)))
INF = float('inf')

from itertools import combinations


def solve():
    n = II()
    D = LI()

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

if __name__ == '__main__':
    solve()

Solution (Python):
N=int(input())
L=list(map(int,input().split()))
a=0
for i in L:
  a=a+i**2
b=sum(L)
print((b**2-a)//2)

Solution (Python):


N = int(input())
D = [int(d) for d 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()))

from itertools import combinations
comb = list(combinations(range(N), 2))

ans = 0
for c in comb:
    ans = ans + d[c[0]] * d[c[1]]

print(ans)

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

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

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

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

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

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

Solution (Python):
import itertools

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


total = 0
for l in itertools.combinations(range(0, len(ds)), 2):
    total += ds[l[0]] * ds[l[1]]


print(total)

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

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

print(SUM)

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

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

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

Solution (Python):
N=int(input())
D=[int(s) for s in input().split(" ")]

D.sort()

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

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

Solution (Python):
import sys
def input(): return sys.stdin.readline().strip()

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

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

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

from itertools import combinations

c = combinations(Takoyaki,2)

total=0

for i in c:
    total += i[0]*i[1]

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

Solution (Python):


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

ans = 0

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

print(ans)

Solution (Python):
n = int(input())
d_lst = list(map(int,input().split()))
good = 0

for i in range(n-1):
    good1 = d_lst[i]

    for j in range(n-1-i):
        good2 = d_lst[-1-j]
        good += good1 * good2

print(good)

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

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

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

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

print(HP)

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

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: continue
        m = a[i] * a[j]
        ans += m
print(ans // 2)

Solution (Python):
import itertools
n = int(input())
dList = list(map(int, input().split()))

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

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

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

s = 0

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

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

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

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

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

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

l = list(itertools.combinations(d, 2))
t = 0
for i, j in l:
    t += (i*j)
print(t)

Solution (Python):

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

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


if __name__ == "__main__":
    main()

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

Solution (Python):
import itertools

if __name__ == '__main__':
    n = int(input())
    d = list(map(int, input().split()))
    x = itertools.combinations(d, 2)
    ans = 0
    for i in x:
        ans += i[0] * i[1]
    print(ans)

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

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

    print(answer)


if __name__ == '__main__':
    main()

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

main= sum-d[0]
piled=0
p=0
while p<=n-2:
  piled+= main*d[p]
  p+=1
  main-=d[p]
  

  
print(piled)

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

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

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

print(ans)

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

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():
    *I, = map(int, open(0).read().split())
    N = I[0]
    d = I[1:]
    s= []

    for i in range(0, len(d)):
        for k in range(0, len(d)):
            if not i == k and i > k:
                s.append(d[i] * d[k])

    print(sum(s))


main()

Solution (Python):
a = int(input())
al = tuple(int(x) for x in input().split())
ll = len(al)
sm = 0
for x in range(ll):
    for y in range(x + 1, ll):
        sm += al[x] * al[y]
print(sm)

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

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

Solution (Python):
input()
d = list(map(int, input().split()))
ans = (sum(d) ** 2 - sum(di ** 2 for di in d)) // 2
print(ans)

Solution (Python):
import itertools


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

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

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

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

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

Solution (Python):
import itertools
import operator


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

n = N * (N - 1) // 2
l = []
c = list(itertools.combinations(d, 2))
for i in range(n):
    l.append(operator.mul(c[i][0], c[i][1]))
ans = sum(l)
print(ans)

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

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

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

Solution (Python):
N=int(input())
d=list(input().split())
e=[]
for a in d:
  e.append(int(a))
A=[]
for i in range(len(d)):
  for j in range(i+1,len(d)):
    A.append(e[i]*e[j])
print(sum(A))

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

Solution (Python):
import os

def main():
	n = int(input())
	d_list = list(map(int, input().split()))
	score = 0
	for i in range(n-1):
		for j in range(i+1,n):
			if len(d_list) == i:
				continue
			score += d_list[i] * d_list[j]
	print(score)

if __name__ == "__main__":
	main()

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

for c in combinations(d, 2):
    ans += c[0] * c[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(1,n):
        if j > i:
            ans += d[i] * d[j]
print(ans)

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

Solution (Python):
n = int(input())
s = input().split()
c = 0
d = 0
for num in s:
  c += int(num)
  d += (int(num))**2
e = (c**2-d)//2
print(e)

Solution (Python):
N = int(input())
d = list(map(int, input().split()))
cnt = 0
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        cnt += d[i] * d[j]
print(cnt//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):
import sys
n = int(sys.stdin.readline())
li = list(map(int, sys.stdin.readline().split()))
s = 0
i = 0
while i < n-1:
  k = i+1
  while k < n:
    s += li[i] * li[k]
    k += 1
  i += 1
print(s)

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

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

print(ans)

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

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


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

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

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

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()))
tot=sum(d)**2
for i in range(n):
  tot-=d[i]**2
print(tot//2)

Solution (Python):
import itertools
n=int(input())
takoyaki=list(map(int,input().split()))
combs=list(itertools.combinations(takoyaki,2))
recovery=list(c[0]*c[1] for c in combs)
print(sum(recovery))

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):
    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(i+1,N):
    s += d[i]*d[j]

print(s)

Solution (Python):
import itertools

n = int(input())
takoyaki = list(map(int, input().split()))
combs = list(itertools.combinations(takoyaki, 2))
recovery = list(c[0] * c[1] for c in combs)
print(sum(recovery))

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

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

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

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()))
sum = 0
for x in range(N):
  for y in range(1,N-x):
    sum += d[x]*d[x+y]
print(sum)

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

result=0
for ind,item in enumerate(s[:-1]):
  for item2 in s[ind+1:]:
    result+=item*item2
    
print(result)

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

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

print(cnt)

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

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

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

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

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

    

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

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

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

print(cnt)

Solution (Python):


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

pure = 0
for i in range(N):
  for j in range(N):
    if(i != j):
      pure = pure + hp[i] * hp[j]
    else:
      pass

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

Solution (Python):
N = int(input())
d = list(map(int,input().split()))
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(n):
        if i != j:
            ans += l[i]*l[j]
print(ans//2)

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

print(sum(wa))

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

print(ans // 2)

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

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

Solution (Python):
N=int(input())
A=list(map(int,input().split()))
l=[]

for i in range(0,len(A)):
    for j in range(i+1,len(A)):
        l.append(A[i]*A[j])

print(sum(l))

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

Solution (Python):
import itertools

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

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

print(ans)
'''

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

print(ans)

Solution (Python):
import itertools

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

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

print(ans)

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

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

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

Solution (Python):

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

recovery = 0

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

print(recovery)

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

happiness = 0
for i,tako in enumerate(list_aji):
  for j, tako in enumerate(list_aji):
    if i > j:
      happiness += list_aji[i] * list_aji[j]
print(happiness)

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

res = 0

for i in range(len(d)):
  index = 1
  while(i + index < N):
    res += d[i] * d[i + index]
    index += 1
print(res)

Solution (Python):
from itertools import combinations

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

ans = 0
for temp in combinations(d_list, 2):
    ans += temp[0] * temp[1]
print(ans)

Solution (Python):
import numpy as np
n = int(input())
aa = np.array(list(map(int, input().split())))
asum = sum(aa)
a2sum = sum(aa * aa)
print((asum*asum - a2sum)//2)

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

ans = 0

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

Solution (Python):
import sys
from bisect import bisect_right as bsr
from collections import Counter as cnt
from collections import defaultdict as dd
from collections import deque
from fractions import gcd
from itertools import combinations as comb
from itertools import permutations as perm
from math import ceil, factorial, floor
from operator import itemgetter as ig

sys.setrecursionlimit(1000000)


args = None
INF = float("inf")
MOD = int(1e9 + 7)


def input(*ps):
    if type(ps[0]) is list:
        return [input(*ps[0][:-1]) for _ in range(ps[0][-1])]
    elif len(ps) == 1:
        return ps[0](next(args))
    else:
        return [p(next(args)) for p in ps]


def yesno(v, yes="Yes", no="No", upper=False):
    if upper:
        print([yes.upper(), no.upper()][not v])
    else:
        print([yes, no][not v])


def main():
    """エントリーポイント"""
    N = input(int)
    D = input([int, N])
    dcomb = comb(D, 2)
    ans = 0
    for d in dcomb:
        ans += d[0] * d[1]
    print(ans)


if __name__ == '__main__':
    args = iter(sys.stdin.read().split())
    main()

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