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: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

print(ans/2)

Submission status: Wrong Answer

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

ans/=2
print(ans)

Submission status: Wrong Answer

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

print(ans/2)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:

N = int(input())
d1 = input().split()
sum= 0

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

Submission status: Wrong Answer

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

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

print(sum)

Submission status: Wrong Answer

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('合計は%a' % sum)

print(sum)

Submission status: Wrong Answer

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

print(n)
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: Wrong Answer

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

print(n)
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=', p)

Submission status: Wrong Answer

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])
    print(s)
    ans = ans + s * Xs[i]
    print(ans)
print(ans)

Submission status: Wrong Answer

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)

Submission status: Wrong Answer

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: Wrong Answer

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

result = 0
for i, j in enumerate(y):
    if i == (len(y) - 1):
        break
    array = copy.deepcopy(y)
    b = array.pop(i)
    a_sum = sum(array)
    result = result + b * len(y) + a_sum

print(result)

Submission status: Wrong Answer

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

print(u)

Submission status: Wrong Answer

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((a-b)/2)

Submission status: Wrong Answer

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

print(n,S)

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


print(int(c/2))

Submission status: Wrong Answer

Solution code:
n=int(input())
a = list(map(int,input().split()))
b=0
for i in range(n):
  for j in range(i,n):
    try:
      b+=a[i]*a[j+1]
      print(b)
    except:
      pass
print(b)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ret = 0
for i in range(N):
  for j in range(i,N):
    ret += i * j
print(ret)

Submission status: Wrong Answer

Solution code:
X=int(input())
Y=[int(i) for i in input().split()]

print(Y)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = [int(i) for i in input().split()]
print(sum(b)*(len(b)-1)//2)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = [int(i) for i in input().split()]
ans = 0
for i in range(a):
  ans += b[i]*(sum(b)-b[i])
print(ans)

Submission status: Wrong Answer

Solution code:
a = int(input())
b = [int(i) for i in input().split()]
print(sum(b)*(len(b)-1))

Submission status: Wrong Answer

Solution code:
rtn = 0
li = list(map(int, input().split()))
for i, n1 in enumerate(li):
    if len(li) == i + 1:
        print(rtn)
        break
    for j, n2 in enumerate(li):
        if i >= j: continue
        rtn += n1 * li[j]

Submission status: Wrong Answer

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

res = 0
for i in range(N):
  for j in range(N):
    if i != j:
    	res += L[i] * L[j]
        
print(res)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
gomi=input()
tako=[int(i) for i in input().split()]
print((sum(tako)**2-sum([i**2 for i in tako]))/2)

Submission status: Wrong Answer

Solution code:
from itertools import combinations
a = [input().split() for l in range(2)]
N=int(a[0][0])
a[1]=''.join(a[1])
c=list(combinations(a[1], 2))
goukei=0
for i in range(int(N*(N-1)/2)):
    goukei=goukei+int(c[i][0])*int(c[i][1])

print(goukei)

Submission status: Wrong Answer

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

for fst in range(N-1):
  for snd in range(fst + 1,N):
    sum = sum + d[fst] * d[snd]
    
print(sum)

Submission status: Wrong Answer

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

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

print(s)

Submission status: Wrong Answer

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

print(sum)

Submission status: Wrong Answer

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

print(sum)

Submission status: Wrong Answer

Solution code:
n = int(input())
arr = [int(x) for x in input().split()]
f = sum(arr)
s = 0
for i in arr:
  s += i * (f-i)

print(s)

Submission status: Wrong Answer

Solution code:

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

Submission status: Wrong Answer

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

all = 0
for i1, d1 in enumerate(dlist):
  for d2 in dlist[i1:]:
    all += d1*d2

print(all)

Submission status: Wrong Answer

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

all = 0
for i1, d1 in enumerate(dlist):
  for i2, d2 in enumerate(dlist):
    if i1 != i2:
      all += d1*d2

print(all)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
def main():
    N = int(input())
    D = list(map(int,input().split()))
    ans = 0
    for i in range(N):
        for j in range(i,N):
            ans += (D[i]*D[j])
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
data = [int(x) for x in input().split()]
data_sum = 0
for i in range(N):
    for j in range(i+1,N):
        print(i,j)
        data_sum += data[i] * data[j]
print(data_sum)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

print(sum)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

print((sum(d)) ** 2 - sum(x ** 2 for x in d) // 2)

Submission status: Wrong Answer

Solution code:
#import numpy as np
n = int(input())
#ds = np.array([int(x) for x in input().split()])
ds = [int(x) for x in input().split()]
ds2 = [x*x for x in ds]
#dss = ds * sum(ds)
#print((sum(ds * sum(ds)) - sum(ds ** 2)) / 2 )
print((sum(ds * sum(ds)) - sum(ds2)) / 2 )

Submission status: Wrong Answer

Solution code:
n = int(input())
ds = [int(x) for x in input().split()]
ret = 0
for i in range(n):
  for j in range(n-1):
    ret += ds[i] * ds[j + 1]
print(ret)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
D = list(map(int, input().split()))
s = sum(D)
square_s = sum([d ** 2 for d in D])
print((s ** 2 - square_s) / 2)

Submission status: Wrong Answer

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

def double(n):
    return int(l[i])*int(l[i+t])

e = int(N*(N-1)/2)
print(e)

x = []
i = 0
t = 1
L =int(len(l))

for n in range(e):
    if i+t < L:
        for u in range(N):
            if i+t < L:
                x.append(double(n))
                t += 1
    t = 1
    i += 1
print(sum(x))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

val = 0
sum = 0

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

print(sum)

Submission status: Wrong Answer

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]

Submission status: Wrong Answer

Solution code:
l=input()
L=list(map(int,input().split()))

a=[]

for i,j in zip(L,L):
    b=i*j
    a.append(b)

import itertools
c=[]
for m, n in itertools.product(L,L):
    d=m*n
    c.append(d)
 
print((sum(c)-sum(a))/2)

Submission status: Wrong Answer

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

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

print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
D = [int(d) for d in input().split()]
DD = []
S = [0] * n
for u in range(n):
	S[u] = D[u] ** 2
for s in range(n):
	for t in range(n):
		DD.append(D[s] * D[t])
for v in range(n):
	DD.remove(S[v])
print(sum(DD) / 2)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

answer=0

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

print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import itertools

def _input():
    _ = int(input())
    str_array = input().split()
    return ''.join(str_array)

def calc(array):
   total = 0
   for tp in list(itertools.combinations(array, 2)):
       total += int(tp[0]) * int(tp[1])
   return total

if __name__ == "__main__":
    str_array =_input()
    print(calc(str_array))

Submission status: Wrong Answer

Solution code:
N = int(input())
d = list(map(int, input().split(' ')))
output = 0
for d1 in d:
    next_index = d.index(d1) + 1
    for d2 in d[next_index:]:
        output += d1 * d2

print(output)

Submission status: Wrong Answer

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

print(result)

Submission status: Wrong Answer

Solution code:
# B: TAKOYAKI FES
N = int(input())
D = [int(d) for d in input().split()]
deli_list = [x*y for x in D for y in D]

# sum of diagonal 
self_comb = sum(D)

# (sum of 2D-Table - sum of diagonal) / 2
ans = int(((sum(deli_list)-self_comb)/2))
print(ans)

Submission status: Wrong Answer

Solution code:
N = str(input())
Ds = str(input()).split(" ")
answer = 0
 
for di in range(len(Ds)):
  for dii in range(di):
    sum = int(Ds[di]) + int(Ds[dii]) 
    answer += sum
 
print(answer)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

X = 0
for a in range(1,N+1):
    if a < N:
        X += A[a]*sum(A[a+1:N+1])
    else:
        break

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

HeelSum = 0

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

tako = []
for i in range(N):
    for j in range(i+1,N):
        #print(i,j, "(", d[i], d[j], ")")
        if [d[j],d[i]] not in tako:
            tako.append([d[i],d[j]])
#print(tako)
#print(len(tako))

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

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# coding: utf-8

# In[23]:


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


# In[24]:


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


# In[ ]:

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(res)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
n = input(int())
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: Wrong Answer

Solution code:
N=int(input())
d=list(map(int, input().split()))
a=(sum(d))**2

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
input1 = int(input())
input_list = list(map(int, input().split()))

done_dict = {}
sum = 0
for i in range(input1):
    for j in range(input1):
        if i != j and (not done_dict.get(j)):
            sum += input_list[i] * input_list[j]
            print("i:", i, "j:", j, " ", input_list[i] * input_list[j])
    done_dict[i] = True
print(sum)

Submission status: Wrong Answer

Solution code:
N=int(input())
d=list(map(int, input().split()))
a=(sum(d))**2

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

b=sum(square(d))
result=a-b
print(result)

Submission status: Wrong Answer

Solution code:
import copy

count = int(input())
balls = list(map(int, input().split()))
mutable_balls = copy.deepcopy(balls)

ans = 0
for i, ball in enumerate(balls):
  for j, ball2 in enumerate(balls):
    if i != j:
      ans += ball * ball2

print(ans / 2)

Submission status: Wrong Answer

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

toori = n * (n-1)
print(tako,toori)

Submission status: Wrong Answer

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

score = 0
for i in d_list:
  for j in d_list:
    score += i * j
    
print(score)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import sys

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

wa = 0
for i in range(b-1):
    for j in range(i+1,b):
        wa += a[i]*a[j]


print(wa)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

total = 0

for first in range(len(list_d)):
  for second in range(len(list_d)):
    if first < second:
      total += list_d[first] * list_d[second]

print(total)

Submission status: Wrong Answer

Solution code:
n=int(input())
d=list(map(int,input().split()))
a=int(0)
i=int(0)
while i<n:
	a=a+d[i]
	i=i+1
a=a*a
i=int(0)
while i<n:
	a=a-d[i]*d[i]
	i = i+1
a=a/2
print(a)

Submission status: Wrong Answer

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

helth = 0

for x in range(0,len(d)):
    for y in range(0,len(d)):
        if x!= y:
            helth += d[x]*d[y]
            
print(helth/2)

Submission status: Wrong Answer

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

result=0
for i in range(N):
    for j in range(N):
        if i!=j:
            tmp=di[i]*di[j]
            result+=tmp
print(result/2)

Submission status: Wrong Answer

Solution code:
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 += i*j

Submission status: Wrong Answer

Solution code:
def main():
    number_of_takoyakis = int(input())
    takoyaki_list = list(map(int,input().split()))
    cure_list = []
    for i in range(number_of_takoyakis):
        for j in range(number_of_takoyakis):
            if i != j:
                cure_list.append(caliculate_cure_point(takoyaki_list[i],takoyaki_list[j]))
    print(sum(cure_list)/2)

def caliculate_cure_point(takoyaki1,takoyaki2):
    return takoyaki1*takoyaki2

main()

Submission status: Wrong Answer

Solution code:
def A():
    temp = [int(i) for i in input().split()]
    print(max(0, temp[0]-2*temp[1]))

def B():
    N = int(input())
    T = [int(i) for i in input().split()]
    s = 0
    for i in range(N):
        for j in range(i):
            s += T[i]*T[j]
    print(s)

def C():
    N = int(input())
    S = input()
    if len(S) == 0:
        print(0)
        return
    elif len(S) == 1:
        print(1)
        return
    ans = 1
    cur_c = S[0]
    for c in S:
        if c != cur_c:
            ans += 1
            cur_c = c
    
    print(ans)

C()

Submission status: Wrong Answer

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

import itertools

boxes = []
data = []

for i in itertools.permutations(box, r=2):
    boxes.append(i)

for k in boxes:
    data.append(k[0] * k[1])

i = 0 

for r in data:
    i += r

print(i)

Submission status: Wrong Answer

Solution code:
N = int(input())
listed = list(map(int,input().split()))
sum_ = 0
for x in listed:
    for y in listed:
        sum_ += x*y
        sum_ -= x*x
print(sum_ / 2)

Submission status: Wrong Answer

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

total = 0

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

Submission status: Wrong Answer

Solution code:
a=int(input())
b= list(map(int, input().split()))  # 114514 810 893
c=[]
for i in b:
  c.append(i**2)

num=(sum(b)**2-sum(c))/2
print(num)

Submission status: Wrong Answer

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]

Submission status: Wrong Answer

Solution code:
N = int(input())
dd = list(map(int, input().split()))
ans = []
for d1 in dd:
    for d2 in dd:
        if d1 != d2:
            ans.append(d1*d2)
print(sum(ans)//2)

Submission status: Wrong Answer

Solution code:
a = input()
b = input()
bs = [int(i) for i in b.split()]
print(sum(i*j for i in bs for j in bs)-2*sum(i*i for i in bs))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())
dd = list(map(int, input().split()))
ans = []
for d1 in dd:
    for d2 in dd:
        if d1 != d2:
            ans.append(d1*d2)
print(sum(ans)/2)

Submission status: Wrong Answer

Solution code:
N = int( input() )
takoyaki_list = list( map( int, input().split() ) )
answer = 0
for i in takoyaki_list:
  for j in takoyaki_list:
    if i != j:
    	answer += int(i*j)
print( int( answer/2) )

Submission status: Wrong Answer

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

s = sum(L)
p = 0
for a in L:
 p += a*a

ans=(s*s-p)/2

print(ans)

Submission status: Wrong Answer

Solution code:
n = int(input())
d = list(map(int,input().split(" ")))
count = []
for i in range(n):
  for j in range(n):
    if i!= j:
      cure = d[i]*d[j]
      count.append(cure)
print(sum(count))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int( input() )
takoyaki_list = list( map( int, input().split() ) )
answer = 0
for i in takoyaki_list:
  for j in takoyaki_list:
    answer += int(i*j)
print( int( answer/2) )

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
d = list(map(int,input().split(" ")))
count = []
for i in range(n):
  for j in range(n):
    if i!= j:
      cure = d[i]*d[j]
      count.append(cure)
print(len(count))

Submission status: Wrong Answer

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

sum=0

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())
d = list(map(int,input().split(" ")))
count = []
for i in range(n):
  for j in range(n):
    if i!= j:
      cure = d[i]*d[j]
      if count.count(cure) !=0:
        count.append(cure)
print(sum(count))

Submission status: Wrong Answer

Solution code:
n = int(input())
d = list(map(int,input().split(" ")))
count = []
for i in range(n):
  for j in range(n):
    if i!= j:
      cure = d[i]*d[j]
      if count.count(cure) !=0:
        count.append(cure)
print(len(count))

Submission status: Wrong Answer

Solution code:
N=int(input())
D=list(map(int,input().split()))
p=0
q=0
for i in range(N):
  p= p+D[i]**2
  q= q+D[i]
print((q**2-p)/2)