qyliang/CodeNanoFix huggingface dataset:
# Buggy code:
n=int(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(set(a)))
l=len(b)
if l>=4:
    print("No")
    exit()
else:
    if l==1:
        if b[0]==0:
            print("Yes")
        else:
            print("No")
    elif l==2:
        if n%3!=0:
            print("No")
        else:
            if b[0]!=0:
                print("No")
            else:
                cnt1=a.count(b[0])
                cnt2=a.count(b[1])
                if cnt2==(n//3)*2:
                    print("Yes")
                else:
                    print("No")
    else:
        if n%3!=0:
            print("No")
        else:
            cnt1=a.count(b[0])
            cnt2=a.count(b[1])
            cnt3=a.count(b[2])
            print(cnt1,cnt2,cnt3)
            if cnt1!=n//3 or cnt2!=n//3 or cnt3!=n//3:
                print("No")
            else:
                if b[0]^b[2]!=b[3]:
                    print("No")
                else:    
                    print("Yes")


# Fixed code:
n=int(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(set(a)))
l=len(b)
if l>=4:
    print("No")
    exit()
else:
    if l==1:
        if b[0]==0:
            print("Yes")
        else:
            print("No")
    elif l==2:
        if n%3!=0:
            print("No")
        else:
            if b[0]!=0:
                print("No")
            else:
                cnt1=a.count(b[0])
                cnt2=a.count(b[1])
                if cnt2==(n//3)*2:
                    print("Yes")
                else:
                    print("No")
    else:
        if n%3!=0:
            print("No")
        else:
            cnt1=a.count(b[0])
            cnt2=a.count(b[1])
            cnt3=a.count(b[2])
            if cnt1!=n//3 or cnt2!=n//3 or cnt3!=n//3:
                print("No")
            else:
                if b[0]^b[2]!=b[1]:
                    print("No")
                else:
                    print("Yes")
# Buggy code:
n=int(input())
a=sorted(list(map(int,input().split())))

if n%3==0:
    for j in range(3):
        for i in range(j*(n//3),(j+1)*(n//3)-1):
            if a[i]!=a[i+1]:
                print("No")
                exit()
    if x[0]^x[n//3]==x[2*n//3]:
        print("Yes")
    else:
        print("No")
    exit()
for i in range(0,n-1):
    if a[i]!=a[i+1]:
        print("No")
        exit()
print("Yes")

# Fixed code:
n=int(input())
a=sorted(list(map(int,input().split())))

if n%3==0:
    for j in range(3):
        for i in range(j*(n//3),(j+1)*(n//3)-1):
            if a[i]!=a[i+1]:
                print("No")
                exit()
    if a[0]^a[n//3]==a[2*n//3]:
        print("Yes")
    else:
        print("No")
    exit()
for i in range(0,n-1):
    if a[i]!=a[i+1]:
        print("No")
        exit()
print("Yes")
# Buggy code:
n = int(input())
l = list(map(int, input().split()))
u = list(set(l))
if len(u)==1 and u[0]==0:
  print("Yes")
elif n%3==0:
  if len(u)==2:
  	x = l.count(u[0])
  	y = l.count(u[1])
    if (x==2*n/3 and y==n/3) or (y==2*n/3 and x==n/3):
      print("Yes")
    else:
      print("No")
  elif len(u)==3:
    x = l.count(u[0])
  	y = l.count(u[1])
    z = l.count(u[2])
    if x==n/3 and y==n/3 and z==n/3:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")

# Fixed code:
n = int(input())
l = list(map(int, input().split()))
u = list(set(l))
if len(u)==1 and u[0]==0:
  print("Yes")
elif n%3==0:
  if len(u)==2:
    x = l.count(u[0])
    y = l.count(u[1])
    if (x==2*n/3 and y==n/3 and u[1]==0) or (y==2*n/3 and x==n/3 and u[0]==0):
      print("Yes")
    else:
      print("No")
  elif len(u)==3:
    x = l.count(u[0])
    y = l.count(u[1])
    z = l.count(u[2])
    if x==n/3 and y==n/3 and z==n/3 and ((u[0]^u[1])^u[2])==0:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")
# Buggy code:
from collections import Counter 
import sys
def No():
    print("No")
    sys.exit()

def Yes():
    print("Yes")
    sys.exit()

N=int(input())
A = [int(i) for i in input().split()]
C=Counter(A)
if N%3:
    if len(C)==1:
        if C.get(0,0):
            Yes()
        else:No()
    if len(C)==2:
        if C.get(0,0) == N//3:
            Yes()
        else:No()
    if len(C)!=3:No()
    bits = [format(a,"040b") for a in C.keys()]
    if all([z.count("0")%2 for z in zip(*bits)]):
        print("Yes")
    else:No()
else:
    if len(C)==1 and C.get(0,0):
        Yes()
    else:No()

# Fixed code:
from collections import Counter 
import sys
def No():
    print("No")
    sys.exit()

def Yes():
    print("Yes")
    sys.exit()

N=int(input())
A = [int(i) for i in input().split()]
C=Counter(A)
if N%3==0:
    if len(C)==1:
        if C.get(0,0):
            Yes()
        else:No()
    if len(C)==2:
        if C.get(0,0) == N//3:
            Yes()
        else:No()
    if len(C)>3:No()
    if not all([v==N//3 for v in C.values()]):
        No()    
    bits = [format(a,"040b") for a in C.keys()]
    if all([z.count("0")%2 for z in zip(*bits)]):
        print("Yes")
    else:No()
else:
    if len(C)==1 and C.get(0,0):
        Yes()
    else:No()
# Buggy code:
N, A, B = map(int, input().split())

print(N *min(A,B))


# Fixed code:
N , A, B = map(int,input().split())
print(min(N*A, B))
# Buggy code:
#!/usr/bin/env python

def main():
    N, A, B = list(map(int, input().strip().split()))
    if N * A < B:
        return N * A
    else:
        return B

 print(main())

# Fixed code:
#!/usr/bin/env python

def main():
    N, A, B = list(map(int, input().strip().split()))
    if N * A < B:
        return N * A
    else:
        return B

if __name__ == '__main__':
    print(main())
# Buggy code:
n,a,b = map(int, input().split())

if n * a > n * b:
    print(n * b)
else:
    print(n * a)

# Fixed code:
n,a,b = map(int, input().split())
 
if n * a > b:
    print(b)
else:
    print(n * a)
# Buggy code:
N,A,B = map(int,input().split())
if N*4 < B:
    print(N*4)
else:
    print(B)

# Fixed code:
N,A,B = map(int,input().split())
if N*A < B:
    print(N*A)
else:
    print(B)
# Buggy code:
N, A, B = map(int, input().split())

if N * A > B:
    print(N * A)
else:
    print(B)


# Fixed code:
N, A, B = map(int, input().split())

if N * A > B:
    print(B)
else:
    print(N*A)
# Buggy code:
nums = list(map(int, input().split()))

if nums[0]*nums[1] > nums[2]:
    print(nums[0]*nums[1])
    
elif nums[0]* nums[1] <= nums[2]: 
    print(nums[2])

# Fixed code:
nums = list(map(int, input().split()))

if nums[0]*nums[1] > nums[2]:
    print(nums[2])
    
elif nums[0]* nums[1] <= nums[2]: 
    print(nums[0] * nums[1])
# Buggy code:
n,a,b=map(int,input().split())
print(min(a,b)*n)

# Fixed code:
n,a,b=map(int,input().split())
ans=min(b,a*n)
print(ans)
# Buggy code:
from sys import stdin

li = list(map(int,stdin.readline().rstrip.split()))

if li[1] > li[2]:
    print(li[0]*li[1])
else:
    print(li[0]*li[2])
    

# Fixed code:
from sys import stdin
li = list(map(int,stdin.readline().rstrip().split()))
if li[1]*li[0] > li[2]:
    print(li[2])
else:
    print(li[0]*li[1])
# Buggy code:
n, a, b = map(int, input().split())
if a <= b:
    print(a*n)
else:
    print(b*n)

# Fixed code:
n, a, b = map(int, input().split())
if a*n <= b:
    print(a*n)
else:
    print(b)
# Buggy code:
N, A, B = map(int, input().split())
print(B, A*N)

# Fixed code:
N,A,B = map(int,(input().split()))
print(min(A*N,B))
# Buggy code:
def minimizer(n,a,b):
  first=n*a
  second=n*b
  if first>second:
    return second
  elif first<second:
    return first
  else:
    return first
inputing=input()
input_sep=inputing.split(" ")
input_sep=[int(i) for i in input_sep]
print(minimizer(int(input_sep[0]),int(input_sep[1]),int(input_sep[2])))

# Fixed code:
def minimizer(n,a,b):
  first=n*a
  second=b
  if first>second:
    return second
  else: 
    return first

inputing=input()
input_sep=inputing.split(" ")
input_sep=[int(i) for i in input_sep]
print(minimizer(int(input_sep[0]),int(input_sep[1]),int(input_sep[2])))
# Buggy code:
n, a, b = map(int, input().split)
m = n*b
if m < a :
    print(m)
else:
    print(a)

# Fixed code:
n, a, b = map(int, input().split())
m = n*a
if m < b :
    print(m)
else:
    print(b)
# Buggy code:
N,A,B = map(int,input().split())
if A>=B:
    print(N*A)
else:
    print(N*B)
    

# Fixed code:
N, A, B = map(int,input().split())

if N * A > B:
  print(B)
else:
  print(N * A)
# Buggy code:
a,b,c = map(int,input().split)

if a*b < c:
  print(a:b)
else:
  print(c)

# Fixed code:
a,b,c = map(int,input().split())
if a*b < c:
  print(a*b)
else:
  print(c)
# Buggy code:
n, a, b = map(int, input().split())
if n*a > b:
  print(n*a)
else:
  print(b)

# Fixed code:
n , a , b = map(int,input().split())
t = n*a
if t>b:
    print(b)
else:
    print(t)
# Buggy code:
import sys

input = sys.stdin.readline


def main():
    n, a, b = [int(i) for i in input().split()]
    print(min([a, b]) * n)


if __name__ == "__main__":
    main()


# Fixed code:
import sys

input = sys.stdin.readline


def main():
    n, a, b = [int(i) for i in input().split()]
    print(min([a * n, b]))


if __name__ == "__main__":
    main()
# Buggy code:
num = input().split()
a = int(num[0]) * int(num[1])
b = int(num[0]) * int(num[2])
print(min(a,b))

# Fixed code:
num = input().split()
a = int(num[0]) * int(num[1])
b = int(num[2])
print(min(a,b))
# Buggy code:
n,a,b=map(int,input().split())
if n*a<=b:
  print(n*b)
else:
  print(b)

# Fixed code:
n,a,b=map(int,input().split())
c=n*a
if(c<b):
  print(c)
else:
  print(b)
# Buggy code:
n, a, b = [int(s) for in input().split(" ")]

print("%d" % min(n * a, b))

# Fixed code:
n, a, b = [int(s) for s in input().split(" ")]

print("%d" % min(n * a, b))
# Buggy code:
a = input().split(' ')

b = int(a[0]) * int(a[1])
c = int(a[0]) * int(a[2])

if (b < c):
  print(b)

else:
  print(c)

# Fixed code:
a = input().split(' ')
 
b = int(a[0]) * int(a[1])
 
if (b < int(a[2])):
  print(b)
 
else:
  print(a[2])
# Buggy code:
N A B = list(map(int, input().split()))

total_cost = N * A

if total_cost > B:
  total_cost = B
  
print(total_cost)


# Fixed code:
N, A, B = list(map(int, input().split()))
 
total_cost = N * A
 
if total_cost > B:
  total_cost = B
  
print(total_cost)
# Buggy code:
n,a,b = map(int,input().split())
ans = a*b
if(ans > n):
    print(n)
elif(ans < n):
    print(ans)
else:
    print(ans)

# Fixed code:
#ABC133
n,a,b = map(int,input().split())
ans =n*a
if(ans > b):
    print(b)
elif(ans < b):
    print(ans)
else:
    print(ans)
# Buggy code:
a,b,c = map(int,input().split())
if a*b > a*c:
  print(a*c)
elif a*b < a*c:
  print(a*b)
else:
  print(a*b)

# Fixed code:
n,a,b = map(int,input().split())
if b > n*a:
  print(a*n)
elif b < a*a:
  print(b)
else:
  print(b)
# Buggy code:
#input
N, A, B = map(int, input().split())

#output
if N*A > B:
  print(B)
elif:
  print(N*A)

# Fixed code:
#input
N, A, B = map(int, input().split())
 
#output
if N*A > B:
  print(B)
else:
  print(N*A)
# Buggy code:
a,b,c=map(int, input().split())
print(a*min(b,c))

# Fixed code:
a,b,c=map(int, input().split())
print(min(b*a,c))
# Buggy code:
n,a,b=map(int,input().split())
print(n*a if a<b else n*b)

# Fixed code:
n,a,b = map(int, input().split())

if a * n <= b:
    print(a*n)
    
else:
    print(b)
# Buggy code:
elem = input().split(" ")
tx = int(elem[0]) * int(elem[1])
tr = int(elem[0]) * int(elem[2])
print(tx if tx < tr else tr)

# Fixed code:
elem = input().split(" ")
tx = int(elem[0]) * int(elem[1])
print(tx if tx < int(elem[2]) else int(elem[2]))
# Buggy code:
n, a, b = map(int, input().split())

def solve():
  return min(n * a, b)

# Fixed code:
n, a, b = map(int, input().split())
def solve():
	return min(n * a, b)
  
print(solve())
# Buggy code:
n,a,b = map(int,input().split())	
if n*a=<b:
  print(int(n*a))
else:
  print(b)

# Fixed code:
n,a,b= map(int, input().split())
if(a * n < b):
    print(a*n)
else:
    print(b)
# Buggy code:
N,A,B = map(int,input().split())
if N*A > B:
    print(B)
else:
    print(A)

# Fixed code:
N,A,B = map(int,input().split())
if N*A > B:
    print(B)
else:
    print(N*A)
# Buggy code:
squares = []
for i in range(0, 16001):
	squares.append(i+i)
N, D = map(int, input().split())
X = []
for i in range(0, N):
	X.append(list(map(int, input().split())))
cnt = 0
for i in range(0, N):
	for j in range(i+1, N):
		sqdist = 0
		for k in range(0, D):
			sqdist += (X[i][k]-X[j][k])**2
		if sqdist in squares:
			cnt += 1
print(cnt)

# Fixed code:
squares = []
for i in range(0, 16001):
	squares.append(i*i)
N, D = map(int, input().split())
X = []
for i in range(0, N):
	X.append(list(map(int, input().split())))
cnt = 0
for i in range(0, N):
	for j in range(i+1, N):
		sqdist = 0
		for k in range(0, D):
			sqdist += (X[i][k]-X[j][k])**2
		if sqdist in squares:
			cnt += 1
print(cnt)
# Buggy code:
def distance(a, b):
    s = 0
    for i in range(len(a)):
        s += (a[i] - b[i]) ** 2

    return s ** 0.5

N,D = map(int,input().split())

X = []

for i in range(D):
    X.append([int(x) for x in input().split()])

count = 0

for i in range(D):
    for j in range(i+1, D):
        if distance(X[i], X[j]).is_integer():
            count += 1

print(count)

# Fixed code:
def distance(a, b):
    s = 0
    for i in range(len(a)):
        s += (a[i] - b[i]) ** 2

    return s ** 0.5

N,D = map(int,input().split())

X = []

for i in range(N):
    X.append([int(x) for x in input().split()])

count = 0

for i in range(N):
    for j in range(i+1, N):
        if distance(X[i], X[j]).is_integer():
            count += 1

print(count)
# Buggy code:
import math
n,d = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]
def distance(a,b):
  s = 0
  for i in range(d):
    s += (a[i]-b[i])**2
  return math.sqrt(ans)
ans = 0
for i in range(n-1):
  for j in range(i+1,n):
    if distance(x[i],x[j])//1 == distance(x[i],x[j]):
      ans += 1
print(ans)

# Fixed code:
import math
n,d = map(int,input().split())
x = [list(map(int,input().split())) for _ in range(n)]
def distance(a,b):
  s = 0
  for i in range(d):
    s += (a[i]-b[i])**2
  return math.sqrt(s)
ans = 0
for i in range(n-1):
  for j in range(i+1,n):
    if distance(x[i],x[j])//1 == distance(x[i],x[j]):
      ans += 1
print(ans)
# Buggy code:
from math import sqrt
n,d=map(int,input().split())
l=[list(map(float,input().split())) for i in range(n)]
nums=[i for i in range(n-1)]
fa=[i for i in range(d)]
cnt=0
ans=0
t=[]
for i in nums:
  for j in l[i+1:]:
    cnt=0
    for k in fa:
      cnt+=(l[i][k]-j[k])**2
    cnt=sqrt(cnt)
    print(cnt)
    t.append(cnt)
for v in t:
  if(v.is_integer()):
    ans+=1
print(ans)
    

# Fixed code:
from math import sqrt
n,d=map(int,input().split())
l=[list(map(float,input().split())) for i in range(n)]
nums=[i for i in range(n-1)]
fa=[i for i in range(d)]
cnt=0
ans=0
t=[]
for i in nums:
  for j in l[i+1:]:
    cnt=0
    for k in fa:
      cnt+=(l[i][k]-j[k])**2
    cnt=sqrt(cnt)
    t.append(cnt)
for v in t:
  if(v.is_integer()):
    ans+=1
print(ans)
# Buggy code:
n,d=map(int,input().split())
x=[[int(a) for a in input().split(" ")] for _ in range(n)]
cnt=0
dis=0
for i in range(n-1):
  for j in range(i+1,n):
    for k in range(d):
      dis+=(x[i][k]-x[j][k])**2
      if (dis**0.5).is_integer:
        cnt+=1
print(cnt)

# Fixed code:
n,d=map(int,input().split())
x=[[int(a) for a in input().split(" ")] for _ in range(n)]
cnt=0
for i in range(n-1):
  for j in range(i+1,n):
    dis=0
    for k in range(d):
      dis+=(x[i][k]-x[j][k])**2
    if (dis**0.5).is_integer():
        cnt+=1
print(cnt)
# Buggy code:
import math

n, d = map(int, input().split())
x = []
cnt = 0
sum = 0
for _ in range(n):
    tmp = list(map(int, input().split()))
    x.append(tmp)

for i in range(n):
    for j in range(i + 1, n):
        l = 1
        for k in range(d):
            sum += (x[i][k] - x[j][k]) ** 2
        while (l ** 2 <= sum):
            if l ** 2 == sum:
                cnt += 1
            l += 1

print(cnt)


# Fixed code:
n, d = map(int, input().split())
x = []
cnt = 0
sum = 0
for _ in range(n):
    tmp = list(map(int, input().split()))
    x.append(tmp)

for i in range(n):
    for j in range(i + 1, n):
        sum = 0
        l = 1
        for k in range(d):
            sum += (x[i][k] - x[j][k]) ** 2
        while (l ** 2 <= sum):
            if l ** 2 == sum:
                cnt += 1
            l += 1

print(cnt)
# Buggy code:
import math
N,D=map(int,input().split())
x=[]
for i in range(N):
    y=list(map(int,input().split()))
    x.append(y)

cnt=0
for n in range(N):
    a=[]
    for d in range(D):
        if n == N-1:
            a.append((x[-1][d]-x[0][d])**2)
        else:
            a.append((x[n][d]-x[n+1][d])**2)
    c=math.sqrt(sum([abs(i) for i in a]))
    if c%1==0:
        cnt+=1
print(cnt)

# Fixed code:
import math
N,D=map(int,input().split())
x=[]
for i in range(N):
    y=list(map(int,input().split()))
    x.append(y)

cnt=0
for n in range(N):
    for nn in range(N):
        if n==nn:
            continue
        else:
            a=[]
            for d in range(D):
                a.append((x[n][d]-x[nn][d])**2)
            c=math.sqrt(sum([abs(i) for i in a]))
            if c%1==0:
                cnt+=1
print(int(cnt/2))
# Buggy code:
import math

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


all_list = []

for i in range(n):
    x = input()
    x = x.split(' ')

    # x = list(x)
    # print(x)
    x = [float(v) for v in x] # to float

    all_list.append(x)  # list of list

# print(all_list)

cnt = 0

for i in range(n):
    target = all_list[i]

    for j in range(n - (i + 1)):
        target2 = all_list[j + i + 1]

        sum_1 = [u ** 2 + v ** 2 for u, v in zip(target, target2)]
        sum_2 = sum(sum_1)
        dis = math.sqrt(sum_2)

        # print('---')
        # print(target)
        # print(target2)

        if dis.is_integer():
            cnt += 1

print(cnt)


# Fixed code:
import math

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


all_list = []

for i in range(n):
    x = input()
    x = x.split(' ')

    # x = list(x)
    # print(x)
    x = [float(v) for v in x] # to float

    all_list.append(x)  # list of list

# print(all_list)

cnt = 0

for i in range(n):
    target = all_list[i]

    for j in range(n - (i + 1)):
        target2 = all_list[j + i + 1]

        # sum_1 = [u ** 2 + v ** 2 for u, v in zip(target, target2)]
        sum_1 = [(target[q] - target2[q]) ** 2 for q in range(d)]
        sum_2 = sum(sum_1)
        dis = math.sqrt(sum_2)

        # print('---')
        # print(target)
        # print(target2)

        if dis.is_integer():
            cnt += 1

print(cnt)
# Buggy code:
N, D = map(int,input().split())
K = [list(map(int,input().split()))for x in range(N)]
ans = 0
for i in range(N-1):
  for j in range(i+1,N):
    goukei=0
    for a,b in zip(K[i],K[j]):
      goukei += (a-b)**2
    ans += (goukei**0.5).is_integer()
print(K)

# Fixed code:
N, D = map(int,input().split())
K = [list(map(int,input().split()))for x in range(N)]
ans = 0
for i in range(N-1):
  for j in range(i+1,N):
    goukei=0
    for a,b in zip(K[i],K[j]):
      goukei += (a-b)**2
    ans += (goukei**0.5).is_integer()
print(ans)
# Buggy code:
n,d=map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
a=0
for i in range(len(x)):
    for j in range(i+1, len(x)):
        if float.is_integer(((x[i][0]-x[j][0])**2+(x[i][1]-x[j][1])**2)**0.5):
            a += 1
print(a)

# Fixed code:
n, d = map(int, input().split())
x = [list(map(int, input().split())) for i in range(n)]
a = 0
for i in range(len(x)):
    for j in range(i+1, len(x)):
        t = 0
        for k in range(d):
            t += (x[i][k]-x[j][k])**2
        if float.is_integer(t**0.5):
            a += 1
print(a)
# Buggy code:
temp=input().split()
N=int(temp[0])
D=int(temp[1])

points=[]
for i in range(N):
  temp=input().split()
  points.add([int(temp[x]) for x in range(D)])
  
counter=0
for i in range(N):
  for j in range(i+1, N):
    l=pow(sum([pow(points[i, x]-points[j, x], 2) for x in range(D)]), 1/2)
    if l==int(l):
      counter+=1
      
print(counter)

# Fixed code:
temp=input().split()
N=int(temp[0])
D=int(temp[1])

points=[]
for i in range(N):
  temp=input().split()
  points.append([int(temp[x]) for x in range(D)])
  
counter=0
for i in range(N):
  for j in range(i+1, N):
    l=pow(sum([pow(points[i][x]-points[j][x], 2) for x in range(D)]), 1/2)
    if l.is_integer():
      counter+=1
      
print(counter)
# Buggy code:
import math
import itertools


N, D = (int(i) for i in input().split())
X = [0]*N


for n in range(N):
    l = input().split()
    X[n]=[0]*D
    for d in range(D):
        X[n][d] = int(l[d])


count = 0
for y, z in itertools.combinations(X, 2):
    print(f"y={y}, z={z}")
    d = math.sqrt(sum(pow(y[i] - z[i], 2) for i in range(D)))
    if d.is_integer():
        count += 1

print(count)


# Fixed code:
import math
import itertools


N, D = (int(i) for i in input().split())
X = [0]*N


for n in range(N):
    l = input().split()
    X[n] = [0]*D
    for d in range(D):
        X[n][d] = int(l[d])


count = 0
for y, z in itertools.combinations(X, 2):
    d = math.sqrt(sum(pow(y[i] - z[i], 2) for i in range(D)))
    if d.is_integer():
        count += 1

print(count)
# Buggy code:
n,d = map(int,input().split())
x = []
for i in range(n):
    xi = [int(i) for i in input().split()]
    x.append(xi)
count = 0
ans = 0
for i in range(n-1):
    for l in range(i+1,n):
        ans = 0
        for j in range(d):
            ans += (x[i][j]-x[l][j])**2

        ans = ans **(1/2)
        print(ans)
        if ans == int(ans):
            count += 1
print(count)
    

# Fixed code:
n,d = map(int,input().split())
x = []
for i in range(n):
    xi = [int(i) for i in input().split()]
    x.append(xi)
count = 0
ans = 0
for i in range(n-1):
    for l in range(i+1,n):
        ans = 0
        for j in range(d):
            ans += (x[i][j]-x[l][j])**2

        ans = ans **(1/2)
        if ans == int(ans):
            count += 1
print(count)
# Buggy code:
import numpy as np

N, D = list(map(int, input().split()))
X = []
for i in range(D):
    x_i = [int(i) for i in input().split()]
    X.append(i)
X = np.array(X)

ans = 0
for i in range(D):
    for j in range(i + 1, D):
        if np.is_integer(np.sqrt(np.sum(X[i] - X[j]) ** 2)):
            ans += 1
print(ans)


# Fixed code:
import numpy as np

N, D = list(map(int, input().split()))
X = []
for i in range(N):
    x_i = [int(i) for i in input().split()]
    X.append(x_i)
X = np.array(X)

ans = 0
for i in range(N):
    for j in range(i + 1, N):
        if np.sqrt(np.sum((X[i] - X[j]) ** 2)).is_integer():
            ans += 1
print(ans)
# Buggy code:
import math
N, D = map(int, input().split())
X = []

for i in range(N):
  inp = input()
  buf = list(map(int, inp))
  X.append(buf)

cnt = 0

for i in range(N-1):
  for j in range(i+1,N):
    dist2 = 0
    for index in range(D):
      dist2 += (X[i][index] - X[j][index]) ** 2
    dist = math.sqrt(dist2)
    if dist == float(int(dist)):
      cnt += 1

print(cnt)

# Fixed code:
import math
N, D = map(int, input().split())
X = []

for i in range(N):
  buf = list(map(int, input().split()))
  X.append(buf)

cnt = 0

for i in range(N-1):
  for j in range(i+1,N):
    dist2 = 0
    for index in range(D):
      dist2 += (X[i][index] - X[j][index]) ** 2
    dist = math.sqrt(dist2)
    if dist == float(int(dist)):
      cnt += 1

print(cnt)
# Buggy code:
import numpy as np

N, D = map(int, input().split())
X = np.array([list(map(int, input().split())) for _ in range(N)])
ans = 0
Dist = 0

for i in range(N - 1):
    for j in range(i + 1, N):
        Dist = np.sum((X[i] - X[j]) ** 2)
        print(Dist)
        for k in range(1, Dist // 2 + 2):
            if k ** 2 == Dist:
                ans += 1
print(ans)

# Fixed code:
import numpy as np

N, D = map(int, input().split())
X = np.array([list(map(int, input().split())) for _ in range(N)])
ans = 0
Dist = 0

for i in range(N - 1):
    for j in range(i + 1, N):
        Dist = np.sum((X[i] - X[j]) ** 2)
        for k in range(1, Dist // 2 + 2):
            if k ** 2 == Dist:
                ans += 1
print(ans)