Problem: 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.

Submission attempts (in order):
Last login: Fri Oct 18 22:40:34 on ttys000

The default interactive shell is now zsh.
To update your account to use zsh, please run `chsh -s /bin/zsh`.
For more details, please visit https://support.apple.com/kb/HT208050.
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
  File "a.py", line 3
    s = A - 2B
             ^
SyntaxError: invalid syntax
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
12 4
Traceback (most recent call last):
  File "a.py", line 1, in <module>
    A, B = map(int, input().split)
TypeError: 'builtin_function_or_method' object is not iterable
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
12 4
4
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ vim k.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python k.py
(2, 3, 4)
nakamurashuntaMacBook-Pro:~ n.shunta$ vi k.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python k.py
4
nakamurashuntaMacBook-Pro:~ n.shunta$ rm k.py
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
  File "a.py", line 17
    for r in data
                ^
SyntaxError: invalid syntax
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
3
3 1 2
22
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
3
3 1 2
(3, 1)
(3, 2)
(1, 3)
(1, 2)
(2, 3)
(2, 1)
22
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
  File "a.py", line 9
    for i in itertools.combinations(box, 2)
                                          ^
SyntaxError: invalid syntax
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ python a.py
3
3 1 2
(3, 1)
(3, 2)
(1, 2)
11
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py
nakamurashuntaMacBook-Pro:~ n.shunta$ vim a.py

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

import itertools

boxes = []
data = []

for i in itertools.combinations(box, 2): 
    boxes.append(i)

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

i = 0 

for r in data:
    i = r + i 

print(i)

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) 

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

import itertools

boxes = []
data = []

for i in itertools.combinations(box, 2): 
    boxes.append(i)

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

i = 0 

for r in data:
    i = r + i 

print(i) 

Verdicts: Runtime Error

Wrong Answer

Accepted