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



Sample input:
3
3 1 2


Sample output:
11

Submission status: Accepted

Solution code:
def main():
    n, *d = map(int, open(0).read().split())

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

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    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__":
    main()

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!


import sys
#sys.setrecursionlimit(10**6)
readline = sys.stdin.readline 

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

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

print(ans)

Submission status: Accepted

Solution code:
a= input().split(" ")

N=int(a[0])

#d=[int(input()) for _ in range(N)]
d=input().split(" ")
for i in range(N):
  d[i] = int(d[i])

sum=0
#print(d)

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

Submission status: Accepted

Solution code:
n = int(input())
a = [int(n) for n in input().split()]
s = 0
for c in range(n):
    for cc in range(n):
        if cc >= c:
            continue
        else:
            s += a[c] * a[cc]

print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
l = list(map(int,input().split()))
ans = 0
while len(l)>0:
  i = l[0]
  del l[0]
  for k in l:
    ans+=i*k
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
d = [int(x) for x in input().split()]

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

print(total)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n,*d=map(int,open(0).read().split())
s=sum(d)**2
for v in d: s-=v**2
print("%d"%(s/2))

Submission status: Accepted

Solution code:
n = int(input())
li = list(map(int, input().split()))

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
input(); d_list = list(map(int, input().split()))
sum=0
for i, x in enumerate(d_list):
  for y in d_list[i+1:]:
    sum+=x*y
print("%d" % sum)

Submission status: Accepted

Solution code:
N = int(input())
d1 = input().split()
sum= 0

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

print(sum)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

res = 0
for x in range(0, N-1):
	for y in range(x+1, N):
		res += vD[x] * vD[y]

print(res)

Submission status: Accepted

Solution code:
n=int(input())
d=[int(n) for n in input().split()]

sum=0
i=int(1)
t=int(0)
while t<=n-2:
    while i<=n-1:
        sum=sum+d[t]*d[i]
        i+=1
    t+=1
    i=t+1
print(sum)

Submission status: Accepted

Solution code:
N = int(input())
d1 = input().split()
sum= 0

for i in range(len(d1)-1):
    for j in range(i+1,len(d1),1): 
            sum += int(d1[i])*int(d1[j])

print(sum)

Submission status: Accepted

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

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

print(total)

Submission status: Accepted

Solution code:
N = int(input())
d1 = input().split()
sum= 0

for i in range(len(d1)):
    for j in range(i+1,len(d1),1): 
            sum += int(d1[i])*int(d1[j])

print(sum)

Submission status: Accepted

Solution code:
N = int(input())
d1 = input().split()
sum= 0

for i in range(len(d1)):
    for j in range(i+1): 
        if(i != j):
            sum += int(d1[i])*int(d1[j])

print(sum)

Submission status: Accepted

Solution code:
N = int(input())
d1 = input().split()
sum= 0

for i in range(len(d1)):
    for j in range(len(d1)): 
        if(i != j and j > i):
            sum += int(d1[i])*int(d1[j])

print(sum)

Submission status: Accepted

Solution code:
n = int(input())
d_list = list(map(int, input().split()))
count = 0
result_list = []
for val1 in d_list:
    count += 1
    for val2 in d_list[count:]:
        result_list.append(val1*val2)
print(sum(result_list))

Submission status: Accepted

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

i = 0
j = 0
p = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
d=list(map(int,input().split()))
res=0

for i in range(N-1):
    for j in range(N-i-1):
        #d[i+1]~d[N-1]
        res+=d[i]*d[i+j+1]


print(res)

Submission status: Accepted

Solution code:
N=int(input())
d=input().split(" ")
ans=0
for p in range(0,N):
    for q in range(0,N):
        if p<q:
            ans+=int(d[p])*int(d[q])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
N = int(sys.stdin.readline())
D = list(map(int,sys.stdin.readline().split()))

psum = sum(D)
var = 0
for i in range(N):
  var += D[i]**2
  
print((psum**2 - var) // 2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
recover = 0
d = input().split()
for i, d1 in enumerate(d):
    for j, d2 in enumerate(d):
        if i < j:
            #print(d1+d2)
            recover = recover +  int(d１)* int(d2)
print(recover)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
D = [int(i) for i in input().split(" ")]
r = 0
for i in range(len(D)):
    for j in range(i,len(D)):
        if i == j:
            continue
        r+=D[i] * D[j]
        
print(r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools

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

Submission status: Accepted

Solution code:
N = int(input())
ns = input().split()

sum_ = 0

for i in range(N):
    for j in range(N):
        if(i>j):
            sum_ += int(ns[i])*int(ns[j])
        
print(sum_)

Submission status: Accepted

Solution code:
# たこふぇす
n = int(input())
d = [int(i) for i in input().split()]

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=0
ans=0
takoyaki=int(input())
li = list(map(int,input().split()))
allUmami=sum(li)
for i in range(takoyaki):
  a+=li[i]
  ans+=li[i]*(allUmami-a)
print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    lst_d = list(map(int, input().split()))

    ans = 0
    for i in range(N - 1):
        for j in range(i + 1, N):
            x = lst_d[i]
            y = lst_d[j]
            ans += x * y
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
d = input().split()
d = [int(d[i]) for i in range(N)]

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a=int(input())
b=list(map(int,input().split()))
c=sum(b)
d=[(c-x)*x for x in b]
e=sum(d)
print(int(e/2))

Submission status: Accepted

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

ans = 0
total = sum(d)

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

print(ans // 2)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(len(a)):
    ans+=(su-a[i])*a[i]
print(ans//2)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
takos = list(map(int, input().split()))

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

print(ans)

Submission status: Accepted

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

sum = 0
for a in range(n-1):
  for b in range(a+1,n):
    sum += d[a] * d[b]
print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
*D, = map(int, input().split())

sum = 0

for i in range(0, len(D), 1):

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


print(sum)

Submission status: Accepted

Solution code:
from itertools import combinations

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

for combo in list(combinations(D, 2)):
    ans += combo[0] * combo[1]

print(ans)

Submission status: Accepted

Solution code:
import copy
x = int(input())
y = list(map(int,input().split()))

result = 0
for (i, v) in enumerate(y):
  z = copy.deepcopy(y)
  c = copy.deepcopy(x) - 1 - i
  r = 0
  for j in range(c):
    r = r + z.pop()
  result = result + r * v

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:


def next_int():
    return int(input())

def next_ints():
    return list(map(int, input().split()))
n = next_int()
a = next_ints()
sum = ans = 0
for i in range(n):
    sum += a[i]
for i in range(n):
    sum -= a[i]
    ans += a[i] * sum
print(ans)

Submission status: Accepted

Solution code:
#たこ焼きの個数を読み取る
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]
        j = j + 1
    i = i + 1

print(result)

Submission status: Accepted

Solution code:
def main():

    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)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#143b
import itertools

N = int(input())
a_list = [int(e) for e in input().split()]

print(sum([comb[0]*comb[1] for comb in itertools.combinations(a_list, 2)]))

Submission status: Accepted

Solution code:
n = int(input())
t_list = list(map(int, input().split()))

u = 0

for val in range(n):
	u += t_list[val]*(sum(t_list) - t_list[val])

u /= 2
m = int(u)
print(m)

Submission status: Accepted

Solution code:
N = input()
tako = list(map(int,input().split(" ")))
a = 0
for n in tako:
    for m in tako:
        a += n * m
b = 0
for n in tako:
    b += n ** 2
print(int((a-b)/2))

Submission status: Accepted

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

goukei = 0
for dd in d:
    for ll in d:
        goukei += dd * ll
    goukei -= dd ** 2

goukei = goukei / 2
print(int(goukei))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

ans = 0

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

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

print(int(ans/2))

Submission status: Accepted

Solution code:
N = int(input())
s = list(map(int, input().split()))
hp1 = 0
for i in range(N):
    for j in range(N):
        if  i != j:
            hp1 += s[i]*s[j]
        else:
            hp1 += 0
hp2 = hp1/2
print(int(hp2))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
S=list(map(int,input().split()))
c=0

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


print(int(c/2))

Submission status: Accepted

Solution code:
def solve(string):
    n, *d = map(int, string.split())
    return str(sum([d1 * d2 for i, d1 in enumerate(d) for d2 in d[i + 1:]]))


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))

Submission status: Accepted

Solution code:
n = int(input())
D = list(map(int, input().split()))
s1, s2 = 0, 0
for d in D:
  s1 += d
  s2 += d*d

print((s1*s1 - s2) // 2)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

n = int(input())

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

s = (n * (n - 1)) / 2

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

print(sumv)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

from collections import deque

N = int(input())
A = deque(list(map(int, input().split())))
ctr, tmp = 0, 0

for i in range(N):
    tmp = A.popleft()
    ctr += tmp * sum(A)

print(ctr)

Submission status: Accepted

Solution code:
import copy

n = int(input())
d = list(map(int,input().split()))
cnt = 0
for k,v in enumerate(d):
	s = copy.copy(d)
	del s[k]
	l = map(lambda x:v*x,s)
	cnt += sum(l)
print(int(cnt/2))

Submission status: Accepted

Solution code:

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

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

Submission status: Accepted

Solution code:
from sys import stdin
n = int(stdin.readline().rstrip())
tasty = list(map(int, stdin.readline().rstrip().split()))
res = 0
for i in range(n):
    for j in range(i+1, n):
        res += tasty[i] * tasty[j]
print(res)

Submission status: Accepted

Solution code:
N=int(input())
d_i=[]
d=input()
d=d.split(" ")
for i in d:
 d_i.append(int(i))

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

print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


def main():
    from itertools import combinations

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

    for first, second in combinations(d, 2):
        ans += first * second

    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
data = list(map(int, input().split()))

resp = 0
for var1 in range(0,len(data)):
	for var2 in range(0,len(data)):
		if var1 == var2:
			pass
		else:
			resp = resp + data[var1]*data[var2]

resp = resp/2



print(int(resp))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
d_list = [int(num) for num in input().split()]

count = 0
for i, num in enumerate(d_list):
  for j, num2 in enumerate(d_list):
    if i == j:
      continue
    count = count + num*num2

print(count//2)

Submission status: Accepted

Solution code:
n = input();n = int(n)
a = input().split()
b = 0
for i in range(n-1):
  for j in range(i+1,n):
    b += eval(a[i]+'*'+a[j])
print(b)

Submission status: Accepted

Solution code:
n = int(input())
A= [int(c) for c in input().strip().split(' ')]
_sum =0
for i in range(n):
    for j in range(i+1,n):
        _sum+=A[i]*A[j]

print(_sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
n = int(input())
point = list(map(int,input().split()))
for i in range(point.count(0)):
    point.remove(0)
result = list(itertools.combinations(point, 2))
s = 0

for i in result:
    s += i[0]*i[1]
print(s)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

a = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from itertools import combinations
sys.setrecursionlimit(10**7)
INTMAX = 9223372036854775807
INTMIN = -9223372036854775808
MOD = 1000000007
def POW(x, y): return pow(x, y, MOD)
def INV(x, m=MOD): return pow(x, m - 2, m)
def DIV(x, y, m=MOD): return (x * INV(y, m)) % m
def LI(): return [int(x) for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()
def II(): return int(input())

N=II()
xs=LI()

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

print(res)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
d = list(map(int, input().split()))
s = sum(d)
ans = 0
for i in d:
    s -= i
    ans += s * i
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
d = list(map(int, input().split()))
more = N - 1
total = 0
for i in range(N):
  for j in range(more):
    try:
      total +=  int(d[i]) * int(d[i + j + 1])
    except IndexError:
      break
  more -= 1
print(total)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

a = 0

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

print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import itertools
n = 2
inputs = [[int(i) for i in input().split()] for i in range(n)]

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

Submission status: Accepted

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

Submission status: Accepted

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

c = 0

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

print(c)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush, heapify
import math
import itertools
import random
 
# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev
 
INF = float('inf')
def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    d = inputList()
    
    ans = 0
    for i, val in enumerate(d):
        for j in range(i+1, N):
            vol = d[j]
            
            ans += val * vol
    
    print(ans)
    
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
# coding: utf-8

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

N = I()
D = LI()

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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


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


def sread():
    return input()


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


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


if __name__ == '__main__':
    main()