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

"""
B - TAKOYAKI FESTIVAL 2019
https://atcoder.jp/contests/abc143/tasks/abc143_b

"""
import sys


from itertools import combinations

def solve(takoyaki):
    return sum(x * y for x, y in combinations(takoyaki, 2))


def main(args):
    _ = input()
    takoyaki = map(int, input().split())
    ans = solve(takoyaki)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Solution (Python):
import itertools


def actual(n, D):
    """
    combinations でゴリ押し
    """
    comb = itertools.combinations(D, 2)

    

    """
    「順番を考慮しない2要素の選び方」を全探索する際のポイント
        内側のループ変数の始点を外側のループ変数 +1 から始めるとよい。
        これにより、内側のループで選ぶインデックスが必ず外側のループで選ぶインデックスより大きくなり、
        同じ選び方を 2 回見てしまうことを回避できます。
    """
    
    
    
    
    
    

    """
    O(N)で解くパターン
    
    ex: a, b, c, d
        a*b + a*c + a*d = a * (b + c +d)
              b*c + b*d = b * (    c +d)
                    c*d = c * (       d)
    """
    s = 0
    for i in range(len(D) - 1):
        s += D[i] * sum(D[i + 1:])

    return s


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

print(actual(n, D))

Solution (Python):
import itertools


def actual(n, D):
    comb = itertools.combinations(D, 2)

    

    """
    「順番を考慮しない2要素の選び方」を全探索する際のポイント
        内側のループ変数の始点を外側のループ変数 +1 から始めるとよい。
        これにより、内側のループで選ぶインデックスが必ず外側のループで選ぶインデックスより大きくなり、
        同じ選び方を 2 回見てしまうことを回避できます。"""
    s = 0
    for i in range(len(D)):
        for j in range(i + 1, len(D)):
            s += D[i] * D[j]

    return s

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

print(actual(n, D))

Solution (Python):
import itertools


def actual(n, D):
    comb = itertools.combinations(D, 2)

    return sum([x * y for x, y in comb])

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

print(actual(n, D))

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()))
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 sys
from collections import defaultdict
readline = sys.stdin.buffer.readline



def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def main():
    n = gete(int)
    d = tuple(geta(int))

    print(((sum(d)**2 - sum([di**2 for di in d]))) // 2)


if __name__ == "__main__":
    main()

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

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

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

sum=0
for i,j in c:
  sum+=i*j
  
print(sum)

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

Solution (Python):
def resolve():
    N = int(input())
    pow = list(map(int, input().split()))
    ans = 0
    for i in range(N):
        for j in range(N):
            if i != j:
                ans += pow[i]*pow[j]
    print(ans//2)
resolve()

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

Solution (Python):
import itertools

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

P = 0
for i in itertools.permutations(D, 2):
    P += i[0]*i[1]

print(P // 2)

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


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

    ruiseki = list(itertools.accumulate(d))
    ans = 0
    for i in range(N - 1):
        ans += d[i] * (ruiseki[N - 1] - ruiseki[i])

    print(ans)


if __name__ == '__main__':
    solve()

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


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

    comb = list(itertools.combinations(range(N), 2))
    ans = 0
    for c in comb:
        i1, i2 = c
        ans += d[i1] * d[i2]

    print(ans)


if __name__ == '__main__':
    solve()

Solution (Python):
n = int(input())
l = list(map(int,input().split()))
ans = 0
for i1, i2 in enumerate(l):
    for j in l[i1+1:]:
        ans += i2 * 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
from sys import stdin

INF = float("inf")
def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


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

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

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

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

heal = 0

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

print(heal)

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

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

a = list(itertools.combinations(d, 2))

print(sum(i*j for i, j in a))

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

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

sum = 0

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

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

ans = 0

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

print(ans)

Solution (Python):
import sys
import decimal 

def input():
    return sys.stdin.readline().strip()

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

Solution (Python):
import itertools

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

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

print(sum)

Solution (Python):
import itertools

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

print(sum([i * j for i, j in list(itertools.combinations(d, 2))]))

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

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

print(out)

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

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

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

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

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

Solution (Python):

n=int(input())
item_list=list(map(int,input().split()))
c=int((n*(n-1))/2)
Answer=0
for i  in range(c):
    for k in range(i+1,n,1):
        Answer+=item_list[i]*item_list[k]

    
print(Answer)

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

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

print(sum)

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

import itertools
e = itertools.combinations(list(range(n)),2)
ans = 0
for i,j in e:
  ans += d[i] * d[j]
print(ans)

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

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

import itertools

ans = 0
pairs = list(itertools.combinations(d, 2))

for pair in pairs:
    ans += pair[0] * pair[1]
    
print(ans)

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

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

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

total = 0
for i,iv in enumerate(d):
    for j,jv in enumerate(d):
        if i < j:
            
            total += iv * jv

print(total)

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

total = 0
for i,iv in enumerate(d):
    for j,jv in enumerate(d):
        if i < j:
            
            total += iv * jv

print(total)

Solution (Python):
N,*D = map(int,open(0).read().split())
import itertools
print(sum(a * b for a,b in itertools.combinations(D,2)))

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

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

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

import itertools

D = list(range(1, len(d)+1))
p = itertools.permutations(d, 2)

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

print(int(ans/2))

Solution (Python):


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

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

ans = 0
for c in cmb(D, 2):
    ans += c[0]*c[1]
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 = tuple(map(int, input().split()))
s = 0
for i in range(0, len(D)-1):
    for j in range(i+1, len(D)):
        s += D[i] * D[j]
print(s)

Solution (Python):
import itertools

def main():
    n = int(input())
    d = map(int, input().split())
    
    h = 0
    for d1, d2 in itertools.combinations(d, 2):
        h += d1 * d2
    print(h)
    
if __name__ == '__main__':
    main()

Solution (Python):
N = int(input())
A = [int(a) for a in input().split()]
print((sum(A)**2 - sum([a**2 for a in A]))//2)

Solution (Python):
import itertools

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

combi = list(itertools.combinations(range(N), 2))
sumD = 0
for x in combi:
    sumD += d[x[0]] * d[x[1]]

print(sumD)

Solution (Python):
n = int(raw_input())
elems = map(int, raw_input().split(' '))
cumul = 0
res = 0
for j in range(len(elems)):
	res += elems[j] * cumul
	cumul += elems[j]
print res

Solution (Python):
import itertools




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

ans = 0
for a, b in list(itertools.combinations(range(N), 2)):
    ans += d[a] * d[b]

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

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

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

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    _ = int(readline())
    ds = map(int, readline().split())

    ans = 0
    for d1, d2 in itertools.combinations(ds, 2):
        ans += d1 * d2
    print(ans)

if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):
import itertools

def takoyaki_festival2019(n, dli):

    ans = 0
    itelist = list(itertools.combinations(range(n), 2))

    for i, k in itelist:
        ans += dli[i]*dli[k]

    return ans

def main():
    n = int(input())
    dli = list(map(int, input().split()))
    print(takoyaki_festival2019(n, dli))

if __name__ == '__main__':
    main()

Solution (Python):
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    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)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

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

recover = 0

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

print(int(recover/2))

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

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

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

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

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

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

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

s = sum(d)
ans = 0

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

print(ans)

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

from itertools import combinations as comb
ans = 0 
for x,y in comb(range(n),2):
    ans += d[x]*d[y]
print(ans)

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

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

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

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

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

print(total)

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

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

print(ans)

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

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

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=[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 = [int(x) for x in 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 = [int(x) for x in input().split()]
total = 0
for i in range(n):
    for j in range(n):
        if j > i:
            total += d[i] * d[j]
print(total)

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

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

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

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

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

Solution (Python):
import sys

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

n = int(input())
D = ILI()
cnt=0
for i in range(n):
	for j in range(n-1-i):
		cnt += D[i]*D[j+i+1]
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):
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

N = ri()
D = rl()

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
import os
import math
import bisect
import collections
import itertools
import heapq
import re
import queue



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 f(N):
    return math.ceil(N / 10) * 10


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

    N = ii()
    D = il()

    ret = 0
    for d in itertools.combinations(D, 2):
        ret += d[0]*d[1]
    print(ret)


if __name__ == '__main__':
    main()

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

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

def point(x,y):
  return x*y

sum = 0
for i in range(N):
  for j in range(i+1,N):
    sum  += point(l[i],l[j])
    
print(sum)

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

print(sum(l))

Solution (Python):
n = int(input())
b = list(map(int,input().split()))
power = 0

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

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

Solution (Python):
n=int(input())
a=[0]*n
a[:]=map(int,input().split())
r=0
for ii in range(n):
  for jj in range(n):
    if ii!=jj:
      r+=a[ii]*a[jj]
print(r//2)

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

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

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

for i in range(0,N):
    for j in range(0,N):
        if not i == j:
            d = d + D[i]*D[j]
        if i == j:
            pass

print(d//2)

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

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

list_ = list(itertools.combinations(range(n),2))
count = 0;

for i in range(len(list_)):
  count += D[list_[i][0]] * D[list_[i][1]];
  
print(count)

Solution (Python):
import math
import time
from collections import defaultdict, deque
from sys import stdin, stdout
from bisect import bisect_left, bisect_right
n=int(input())
a=list(map(int,stdin.readline().split()))
suff=defaultdict(lambda:0)
ans=0
for i in range(n-1,-1,-1):
    ans+=a[i]
    suff[n-i]=ans 
ans=0

for i in range(n-1):
    ans+=a[i]*suff[n-i-1]
print(ans)

Solution (Python):
import itertools
import math
import fractions
import functools
n = int(input())
d = list(map(int, input().split()))

sum = 0

xy = list(itertools.combinations(d, 2))
for i in range(len(xy)):
    sum += xy[i][0] * xy[i][1]

print(sum)

Solution (Python):
import itertools

N=int(input())
List = list(map(int, input().split()))
ans=0
    
 
for i in itertools.permutations(List, r=2):
    ans+=(i[0]*i[1])
    
    
print(int(ans/2))

Solution (Python):
import itertools

n = int(input())
d = list(map(int,input().split()))
c = list(itertools.combinations(d,2))

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

print(sum(c))

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

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

Solution (Python):
from itertools import combinations


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

nC2 = list(combinations(d, 2))
add_hp = sum(
    [
        x * y
        for x, y in nC2
    ]
)

print(add_hp)

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):
import itertools
def main():
    N  = int(input())
    A = list(map(int, input().split())) 
    combilist = itertools.combinations(A,2)
    sum = 0
    for item in combilist:
        sum += item[0]*item[1]

    print(sum)



if __name__ == '__main__':
    main()

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

Solution (Python):
import itertools

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

num=itertools.combinations(a,2)

for i in list(num):
  ans+=i[0]*i[1]
  
print(ans)

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

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

print(sum(life))

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

print(ans)

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

Solution (Python):
import itertools

n = int(input())
lst = list(map(int,input().split()))
ans = []
for v, k in itertools.combinations(lst, 2):
    ans.append(v*k)
print(sum(ans))

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

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


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

if __name__ == "__main__":
    main()

Solution (Python):
from itertools import combinations

input()
values = tuple(map(int, input().split(' ')))
print(sum([x * y for x, y in combinations(values, 2)]))

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

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

Solution (Python):
from itertools import combinations
n, *d = map(int, open(0).read().split())
print(sum(d1 * d2 for d1, d2 in combinations(d, 2)))

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

Solution (Python):
from sys import stdin
import itertools
import numpy as np

def main():
    N = int(stdin.readline().rstrip())
    L = [int(x) for x in stdin.readline().rstrip().split()]
    C = list(itertools.combinations(L, 2))
    for i in range(len(C)):
        C[i] = np.prod(np.array(C[i]))
    C = sum(C)
    print(C)
    
main()

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

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

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

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

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

print(ans)

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

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