qyliang/CodeNanoFix huggingface dataset:
Buggy code:
n = int(input())
d = list(map(lambda x: int(x), input().split()))

s = 0
for i in range(n):
    for j in range(n):
        if i != j:
            s += (i+1)*(j+1)

print(s // 2)

Fixed code:
n = int(input())
d = list(map(lambda x: int(x), 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)
Buggy 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)]))

Fixed 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)]))
Buggy 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)

Fixed code:
n=int(input())
arr=list(map(int,input().split()))
s=0
for i in range(n):
    for j in range(i+1,n):
        s+=(arr[i]*arr[j])
print(s)
Buggy code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
D = iil()
ans = 0
for i in range(n):
    for j in range(i,n):
       ans += D[i]*D[j] 

Fixed code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
D = iil()
ans = 0
for i in range(n):
    for j in range(i+1,n):
#        print(i,j)
        ans += D[i]*D[j] 
print(ans)
Buggy code:
N = int(input())
D = list(map(int,input().split()))
A = []
for i in range(N):
  for j in range(1,N):
    A.append(N[i]*(j-i)
print(sum(A))

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

Fixed 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)):
        sum += d[i] * d[j]
print(sum)
Buggy code:
a = int(input())
b = list(input().split())
sum = 0
for i in range(len(b)):
  for j in range(i,len(b)):
    sum += b[i] * b[j]
print(sum)

Fixed code:
a = int(input())
b = list(input().split())
sum = 0
for i in range(len(b)):
  for j in range(i,len(b)):
    if i != j:
        sum += int(b[i]) * int(b[j])
print(sum)
Buggy code:
n = int(input())
d = list(map(int, input().split()))
ans =0
for i in range(n):
  for j in range(i-1):
    ans += d[i] * d[j]
    
print(ans)

Fixed 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)
Buggy code:
a=int(input())
b=list(map(int,input().split()))
c=0
for d,e in combinations(b,2):
  c+=d*e
print(c)


Fixed code:
a=int(input())
import itertools 
b=list(map(int,input().split()))
c=0
for d,e in itertools.combinations(b,2):
  c+=d*e
print(c)
Buggy code:
N = int(input())
D = list(map(int, input().split()))

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


Fixed code:
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)
Buggy code:
import sys

n = int(sys.stdin.readline())
xs = [int(s) for s in sys.stdin.readline().split(" ")]

result = 0

for i in range(0, n):
    x = xs[i]
    for j in range(i + 1, n):
        print(x, xs[j])
        result += x * xs[j]

print(result)

Fixed code:
import sys

n = int(sys.stdin.readline())
xs = [int(s) for s in sys.stdin.readline().split(" ")]

result = 0

for i in range(0, n):
    x = xs[i]
    for j in range(i + 1, n):
        result += x * xs[j]

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

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

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

sum = 0

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

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

Fixed code:
n=int(input())
d=list(map(int,input().split()))
heal=0
for i in range(n-1):
    for j in range(i,n):
        if i!=j:
            heal+=d[i]*d[j]
print(heal)
Buggy code:
n=int(input())
d = list(map(int, input().split()))
a=0
for i in d:
  if d[i]=d[-1]:
    break
  for j in d[i+1:]:
    a+=d[i]*d[j]
print(a)

Fixed code:
n=int(input())
d = list(map(int, input().split()))
a=0
for i in range(0,n,1):
  if i==n:
     break
  for j in d[i+1:]:
    a+=d[i]*j
print(a)
Buggy 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)
  

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

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


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

val = 0
sum = 0

for i in range(N - 1):
    val += d[i]
    sum += val * d[i + 1]
    
print(sum)
Buggy 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)

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

print(res)
Buggy 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(ans)

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

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

Fixed 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)
Buggy code:
import sys
input = sys.stdin.readline

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

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

Fixed code:
import sys
input = sys.stdin.readline
 
N = int(input())
d = list(map(int, input().split()))
P = 0
 
for i in range(N - 1):
    if d[i] == 0:
        continue
    for j in range(i + 1, N):
        if d[j] == 0:
            continue
        P += d[i] * d[j]
print(P)
Buggy code:
N = int(input())
d = list(map(int, input().split()))
ans = 0

from itertools import combinations
for i,j in combinations(N,2):
  ans += d[i]*d[j]
print(ans)
  

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

from itertools import combinations
for i,j in combinations(range(N),2):
  ans += d[i-1]*d[j-1]
print(ans)
Buggy 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)

Fixed 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)
Buggy 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)


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

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

print(all)
Buggy code:
n = int(input())
d = list(map(int, input().split()))
count = 0
for i in range(len(d)):
    for j in range(i+1, len(d)):
        count += d[i] * d[j]
print(count)7

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

d_sum = sum(d)

m = 0
for k in d:
    m += k **2
    
print((d_sum**2 - m)　//　2)

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

d_sum = sum(d)

m = 0
for k in d:
    m += k **2
    
print((d_sum**2 - m)//2)
Buggy code:
# -*- coding: utf-8 -*-
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)

Fixed code:
# -*- coding: utf-8 -*-
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(int(sum/2))
Buggy code:
n=int(input())
S=list(map(int,input().split()))
c=0

print(n,S)

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


print(int(c/2))

Fixed 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))
Buggy 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])


Fixed code:

N=int(input())
d=input().split( )
sutamina = 0
for i in range(N-1):
    for j in range(i+1,N):
        sutamina = sutamina + int(d[i]) * int(d[j])
print(sutamina)
Buggy code:
#B
N = int(input())
A = list(map(int,input().split()))
s = sum(A)**2
for i in range(N):
    s -= A[i]**2
print(s/2)

Fixed code:
N = int(input())
A = list(map(int,input().split()))
s = sum(A)**2
for i in range(N):
    s -= A[i]**2
print(int(s/2))
Buggy 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)

Fixed 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)
Buggy 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)


Fixed code:
import sys

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

Fixed 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)
Buggy code:
n = int(input())
a = map(int,input().split())
res = 0
for i in range(n):
  for j in range(i+1,n):
    res += a[i]*a[j]
print(res)

Fixed code:
n = int(input())
a = list(map(int,input().split()))
res = 0
for i in range(n):
  for j in range(i+1,n):
    res += a[i]*a[j]
print(res)
Buggy 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) 

Fixed code:
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)
Buggy 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)
    

Fixed 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)
Buggy 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)

Fixed 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)
Buggy code:
words = lambda t : list(map(t, input().split()))
n = int(input())
d = words(int)

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

print(ttl)


Fixed code:
words = lambda t : list(map(t, input().split()))
n = int(input())
d = words(int)

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

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

print(res)

Fixed code:
N = int(input())
D = list(map(int,input().split()))
tot = 0
for i in range(N-1):
    for j in range(i+1,N):
        tot += D[i]*D[j]
print(tot)
Buggy code:
n = int(input())
d = [int(x) for x in input().split()]
s = 0
for i in range(0, n):
  for j in range(i, n):
    s += d[i] * d[j]
print(s)

Fixed code:
n = int(input())
d = [int(x) for x in input().split()]
s = 0
for i in range(0, n):
  for j in range(i+1, n):
    s += d[i] * d[j]
print(s)
Buggy code:
N = int(input())
d = 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)

Fixed 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)
Buggy 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)

Fixed 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+=l[j]*l[i]
print(s)
Buggy code:
N = int(input())
d = list(map(int,input().split()))

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


Fixed 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)
Buggy 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)

Fixed code:
n=int(input())
d=list(map(int,input().split()))
ct=0
for i in range(n):
  for j in range(i+1,n):
    ct+=d[i]*d[j]
print(ct)
Buggy code:
n=int(input())
d=list(map(int,input().split()))
s=[]
for i in range(n-1):
    for j in range(i+1,n):
        s.append(i*j)
print(sum(s))
        

Fixed code:
n=int(input())
d=list(map(int,input().split()))
s=[]
for i in range(n-1):
    for j in range(i+1,n):
        s.append(d[i]*d[j])
print(sum(s))
Buggy 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(e/2)

Fixed 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))
Buggy code:
if __name__ == "__main__":
    num = int(input())
    base_list=[]
    tmp_list=[]
    ans=0
    base_list = input().split()
    tmp_list = deepcopy(base_list)
    for i in base_list:
        print("i:"+i)
        tmp_list.remove(i)
        for j in tmp_list:
            ans+=int(i)*int(j)
    print(ans)

Fixed code:
from copy import deepcopy

if __name__ == "__main__":
    num = int(input())
    base_list=[]
    tmp_list=[]
    ans=0
    base_list = input().split()
    tmp_list = deepcopy(base_list)
    for i in base_list:
        tmp_list.remove(i)
        for j in tmp_list:
            ans+=int(i)*int(j)
    print(ans)
Buggy code:
N = int(input())
arr = list(map(int, input().split()))

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

Fixed code:
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)
Buggy code:
a=int(inputu())
b=list(map(int,input().split()))
out=0
for i in range(a):
  for j in range(i-1):
    out=out+b[i]*b[j]
    
print(out)

Fixed code:
a=int(input())
b=list(map(int,input().split()))
out=0
for i in range(a):

  for j in range(i+1,a):

    out=out+b[i]*b[j]
    
print(out)
Buggy code:
import numpy as np
n = int(input())
d = list(map(int,input().split()))
print(int((np.sum(np.array(d))**2 - np.sum(np.array(d)**2)) /

Fixed code:
import numpy as np
n = int(input())
d = list(map(int,input().split()))
print(int((np.sum(np.array(d))**2 - np.sum(np.array(d)**2)) /2))
Buggy code:
n=int(input())
d=map(int,input().split())
d=list(d)
kotae=0
for i in range(n):
  for j in range(i+1,n):
    kotae=kotae+d[i]*d[i+j]
print(kotae)


Fixed 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)
Buggy code:
n=int(input())
d=map(int,input().split())
kotae=0
for i in range(n):
  for j in range(n-i-1):
    kotae=kotae+d[i]*d[j]
print(kotae)

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

kotae=0
for i in range(n):
  for j in range(i+1,n):
    kotae=kotae+d[i]*d[j]
print(kotae)
Buggy code:
N = int(input())
d = map(int, input().split())
d_2 = map(lambda x: x*x, d)
print((sum(d)**2 - sum(d_2)) // 2)

Fixed code:
N = int(input())
d = list(map(int, input().split()))
d_2 = map(lambda x: x*x, d)
print((sum(d) ** 2 - sum(d_2)) // 2)
Buggy code:
n = int(input())
lis = [int(i) for i in input().split()]
sum = 0
for i in range(n-1):
  for j in range(i+1,n):
    sum += i*J
print(sum)

Fixed code:
n = int(input())
lis = [int(i) for i in input().split()]
sum = 0
for i in range(n-1):
  for j in range(i+1,n):
    sum += lis[i]*lis[j]
print(sum)
Buggy code:
n=int(input())
d=map(int,input().split())
d=list(d)
kotae=0
for i in range(n):
  for j in range(n-i-1):
    kotae=kotae+d[i]*d[j]
print(kotae)

Fixed 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)
Buggy code:
import sys
import time
import math
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

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

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)


Fixed code:
import sys
import time
import math
def inpl():
    return list(map(int, input().split()))
st = time.perf_counter()
# ------------------------------

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

# ------------------------------
ed = time.perf_counter()
print('time:', ed-st, file=sys.stderr)
Buggy code:
n = int(input())

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

s = 0

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

Fixed 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)
Buggy code:
from itertools import combinations

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

score = 0
for i,j in combinations(range(N), 2):
  score += d[i] * d[j]

print(score)
  

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

Fixed 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(int(helth/2))
Buggy code:
N = int(input())
A = list(map(int, input().split()))
ans = 0
while len(d) > 1:
    current = d[0]
    for y in range(len(d)):
        ans += current * d[y]
#         print(ans)
    ans -= current ** 2
    d.pop(0)
print(ans)

Fixed code:
N = int(input())
d = list(map(int, input().split()))
ans = 0
while len(d) > 1:
    current = d[0]
    for y in range(len(d)):
        ans += current * d[y]
#         print(ans)
    ans -= current ** 2
    d.pop(0)
print(ans)
Buggy code:
N = int(input())
d = list(map(int, input()))
S = d[0]
delic = 0
for i in range(N-1):
  P = d[i+1]
  delic += P * S
  S += P
print(delic)

Fixed code:
N = int(input())
d = list(map(int, input().split()))
S = d[0]
delic = 0
for i in range(N-1):
  P = d[i+1]
  delic += P * S
  S += P
print(delic)
Buggy 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)


Fixed 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)
Buggy code:
n = int(input())
nums = list(map(int, input()))
ans = []
for i in range(n):
    for j in range(i+1,n):
        ans.append(nums[i] * nums[j])
print(sum(ans))

Fixed code:
n = int(input())
nums = list(map(int, input().split()))
ans = []
for i in range(n):
    for j in range(i+1,n):
        ans.append(nums[i] * nums[j])
print(sum(ans))
Buggy code:
N = int(input())
li = list(map(int, input().split()))
ans = 0
for i in range(len(li)):
	for j in range(len(li)):
		if i != j:
			ans += li[i]*li[j]
print(ans/2)

Fixed code:
N = int(input())
li = list(map(int, input().split()))
ans = 0
for i in range(len(li)):
	for j in range(len(li)):
		if i != j:
			ans += li[i]*li[j]
print(int(ans/2))
Buggy 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)

Fixed 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))
Buggy code:
s = int(input())
d = list(map,input().split())
sum = 0

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

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