qyliang/CodeNanoFix huggingface dataset:
Buggy 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)

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

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

Fixed code:

N = int(input())

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

ans = 0
for i in range(N):

    for j in range(i):

        ans += d[i] * d[j]

print (ans)
Buggy code:
n=int(input())
d=list(map(int,input().split()))
s=sum(d)
print(sum([x*(d-x) for x in d])//2)

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

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

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

print(count)


Fixed code:
n = int(input())
li = list(map(int,input().split()))
count = 0

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

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

Fixed code:
gomi=input()
tako=[int(i) for i in input().split()]
print(int((sum(tako)**2-sum([i**2 for i in tako]))/2))
Buggy 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)

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

Fixed code:
n=int(input())
d=[int(i) for i in input().split()]
dsum=0
for i in range(n):
  for j in range(n):
    dsum+=d[i]*d[j]
  dsum-=d[i]*d[i]
print(dsum//2)
Buggy code:
n = int(input())
l = list(map(int, input().split()))

print(sum([l[i]*x for i in range(len(l)-1) for x in l[i+1:]))

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

print(sum(l[i]*x for i in range(len(l)-1) for x in l[i+1:]))
Buggy code:
n = int(input())
del = list(map(int, input().split()))
sum = 0
i = 0

while i < n - 1:
  k = i
  while k < n - 1:
    k += 1
    sum += del[i] * del[k]
  i += 1
  
print(sum)



Fixed code:
n = int(input())
deliciousness = list(map(int, input().split()))
sum = 0
i = 0

while i < n - 1:
  k = i
  while k < n - 1:
    k += 1
    sum += deliciousness[i] * deliciousness[k]
  i += 1
  
print(sum)
Buggy 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)

Fixed 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(v)
Buggy 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
print(s)

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

Fixed code:
n=int(input())
tako=list(map(int,input().split()))
umami=0
for i in range(n):
  for j in range(i+1,n):
    umami+=tako[i]*tako[j]
print(umami)
Buggy code:
n= int(input())
a=list(map(int,input().split()))
i=0
j=0
p=0
while(i<len(a)):
  j=i+1
  s=0
  while(j<len(a)):
    s=s+a[j]
   	j=j+1
  p=p+s*a[i]
  i=i+1
print(p)

Fixed code:
n=int(input())
a=list(map(int,input().split()))
i=0
j=0
p=0
while(i<len(a)):
  j=i+1
  s=0
  while(j<len(a)):
      s=s+a[j]
      j=j+1
  
  p=p+s*a[i]
  i=i+1
print(p)
Buggy code:
n=int(input())
d=list(map(int,input.split()))
sam=0

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

print(sam)

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

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

print(sam)
Buggy code:

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





Fixed code:

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

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


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

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

Fixed 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(int(result))
Buggy code:
n=int(input())
a=list(map(int,input().split()))
sum=0
for i in a:
  x=i**2
  sum+=x
print((sum(a)**2)-sum)

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

for x in range(N):
  for y in range(x+1,N):
    ans += D[x] * D[y]

print(ans)



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

ans = 0
for x in range(N):
  for y in range(x+1,N):
    ans += D[x] * D[y]

print(ans)
Buggy code:
n=int(input())
d=[int(i) for i in input().split()]

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

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

count=0
for i in range(n-1):
    for j in range(i+1,n):
        count+=(d[i]*d[j])
print(count)
Buggy code:
N=int(input())
D=list(map(int,input().split()))
from itertools import combinations
ans=0
comb=combinations(D,2)
for c in comb:
  ans+=c[0]+c[1]
print(ans)

Fixed code:
N=int(input())
D=list(map(int,input().split()))
from itertools import combinations
comb=combinations(D, 2)
ans=0
for c in comb:
    ans+=c[0]*c[1]
print(ans)
Buggy code:
n=int(input())
d=li(map(int,input().split())
 
sum=0
for i in range(n-1):
    for l in range(i+1,n):
        sum+=d[i]*d[l]
print(sum)

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

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

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


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

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

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

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

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


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

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

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

Fixed 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
a=int(a)
print(a)
Buggy code:
n = int(input())
arrd = list(map(int,input().split()))
import itertools 
num = 0
for i in itertools.permutations(arrd,2):
    num += i[0] * i[1]
print(num/2)

Fixed code:
n = int(input())
arrd = list(map(int,input().split()))
import itertools 
num = 0
for i in itertools.permutations(arrd,2):
    num += i[0] * i[1]
print(num//2)
Buggy 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)

Fixed code:
N = int(input())
listed = list(map(int,input().split()))
sum_ = 0
for x in listed:
    sum_ -= x*x
    for y in listed:
        sum_ += x*y
print(sum_ // 2)
Buggy code:
N=int(input())
d=list(map(int,input().split()))
s=0
for i in range(d):
  s+=d[i]*sum(d[i+1:N+1])
print(s)


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

Fixed 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)):
    d_sum += d_list[i] * d_list[j]
    
print(d_sum)
Buggy code:
n = int(input())
d = [int(i) for input().split()]
s = []
for i in range(n):
	for j in range(i):
		s.append(d[i]*d[j])
n = s.size()
for i in range(n):
	print(s[i])

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

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

Fixed code:
N=int(input())
takoyaki=list(map(int,input().split()))
count=0
for i in range(0,N-1):
  for j in range(i+1,N):
    count+=takoyaki[i]*takoyaki[j]
print(count)
Buggy code:
N=int(input().strip())
d=list(map(int,input().strip().split()))
sum_=0
for i,x in enumerate(d):
  for y in d[i+1:]:
      print(x,y)
      sum_+=x*y
print(sum_)

Fixed code:
N=int(input().strip())
d=list(map(int,input().strip().split()))
sum_=0
for i,x in enumerate(d):
  for y in d[i+1:]:
      sum_+=x*y
print(sum_)
Buggy 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)

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

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

print(ans)

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

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

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())
A=list(map(int,input().split()))
ans=0
for i in range(n):
  for j in range(i):
    ans+=i*j
print(ans)

Fixed code:
n=int(input())
A=list(map(int,input().split()))
ans=0
for i in range(n):
  for j in range(i):
    ans+=A[i]*A[j]
print(ans)
Buggy code:
N = int(sys.stdin.readline())
d = list(map(int, input().split()))

recover = []

c = 0
for i in d:
    c += 1
    recover.append(i * sum(d[c:N]))

print(sum(recover))


Fixed code:
import sys
N = int(sys.stdin.readline())
d = list(map(int, input().split()))

recover = []

c = 0
for i in d:
    c += 1
    recover.append(i * sum(d[c:N]))

print(sum(recover))
Buggy code:
N=int(input())
d=list(map(int,input().split()))
S=sum(d)
S_2=S**2
d_2 = [i**2 for i in d]
S_3=sum(d_2)
print((S_2-S_3)/2)


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

Fixed code:
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)
Buggy code:
N = int(input())

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

S = sum(d)

ans = 0

for i in range(N):
    ans += (S-d[i])*d[i]
print(ans(

Fixed code:
N = int(input())

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

S = sum(d)

ans = 0

for i in range(N):
    ans += (S-d[i])*d[i]
print(int(ans/2))
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 += 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())
li = list(map(int,input().split()))
a=0
for i in range(n-1):
  for j in range(n):
    a += li[i]*li[j+1]
print(a)

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

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

def j(n):
    if n:print("yes")
    else:print("no")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)

n = ip()
a = iprow()
s = 0
for i in range(n-1):
    for k in range(i+1,n):
        s+=a[i]*a[j]
print(s)

Fixed code:
import copy

def j(n):
    if n:print("yes")
    else:print("no")
    exit(0)
rem = 10 ** 9 + 7

"""
def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")
"""

def ip():
    return int(input())
def iprow():
    return [int(i) for i in input().split()]
def ips():
    return (int(i) for i in input().split())
def ipmultiplerow(n):
    a = []
    for i in range(n):
        a.append(ip())
    return a
def printrow(a):
    for i in a:
        print(i)

n = ip()
a = iprow()
s = 0
for i in range(n-1):
    for k in range(i+1,n):
        s+=a[i]*a[k]
print(s)
Buggy code:
N=int(input())
d = list(map(int, input().split()))
total=0
for n in range(N):
    for j in range(n+1,N):
        total+=d[n]*d[j]
total

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

total = 0

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


print(total)

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

total = 0

for i in range(0,len(d)-1):
    for j in range(i+1,len(d)):
        total += d[i]*d[j]
print(total)
Buggy code:
import sys
n = int(sys.stdin.radline())
li = list(map(int, sys.stdin.readline().split()))
s = 0
i = 0
while i < n-1:
  s += li[i] * li[i+1]
  i += 1
print(s)

Fixed code:
import sys
n = int(sys.stdin.readline())
li = list(map(int, sys.stdin.readline().split()))
s = 0
i = 0
while i < n-1:
  k = i+1
  while k < n:
    s += li[i] * li[k]
    k += 1
  i += 1
print(s)
Buggy code:
import itertools
import numpy as np

N = int(input())
lst = np.array(list(map(int,input().split())))

lst2 = np.array(list(itertools.combinations(lst,2)))
lst3 =[]
for i in range(len(lst2):
               dot = np.dot(lst2[i][0],lst2[i][1])
               lst3.append(dot)

print(sum(lst3))

Fixed code:
import itertools
import numpy as np

N = int(input())
lst = np.array(list(map(int,input().split())))
lst2 = np.array(list(itertools.combinations(lst,2)))
lst3 =[]

for i in range(len(lst2)):
               dot = np.dot(lst2[i][0],lst2[i][1])
               lst3.append(dot)

print(sum(lst3))
Buggy code:
N = int(input())
d = [int(i) for i in input().split()]
ans = 0
for i in range(N):
    for j in range(i+1,N):
        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:
import itertools
N = int(input())
b = list(map(int, input().split()))
c = list(itertools.combinations(b,2))
a = 0
for i,j in c:
    a += i*j
print(i,j)

Fixed code:
import itertools
N = int(input())
b = list(map(int, input().split()))
c = list(itertools.combinations(b,2))
a = 0
for i,j in c:
    a += i*j
print(a)
Buggy code:
n = int(input())
d = [int(i) for i in input().split()]
s = 0
for i in range(n-1):
  for j in range(i+1,n):
    s+=i*j
print(s)

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

Fixed 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]
    else:
      continue
print(sum)
Buggy code:
import itertools
N = int(input())
D=[]*N
D=map(int,input().split(" "))
sum=0
for i,j in itertools.permutations(D,2):
    sum+=i*j

print(sum/2)

Fixed code:
import itertools
N = int(input())
D=[]*N
D=map(int,input().split(" "))
sum=0
for i,j in itertools.permutations(D,2):
    sum+=i*j

print(int(sum/2))
Buggy code:
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    d = list(map(int, input().slit()))
    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__': main()

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


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

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

print(X)