Harryxun/stf_run huggingface dataset:
import math
N = int(input())
t_lcm = int(input())
for i in range(N-1):
  t = int(input())
  t_lcm = (t_lcm*t)//math.gcd(t,t_lcm)
print(t_lcm)



### FIXED CODE ###

import fractions
n=int(input())
ans=int(input())
for i in range(n-1):
  t=int(input())
  ans=(ans*t)//fractions.gcd(t,ans)
print(ans)
N, x = map(int, input())
child_list = list(map(int, input()))

nokori = x - min(child_list)
please_child = 0 
while nokori >0:
    please_child +=1
    mini = min(child_list)
    child_list.remove(mini)
    if child_list == []:
        break
    nokori -= min(child_list)
print(please_child)

### FIXED CODE ###

N, x = map(int, input().split())
child_list = list(map(int, input().split()))

if len(child_list) == 1:
    if x > min(child_list):
        please_child = 0
    elif x == min(child_list):
        please_child = 1
elif len(child_list) > 1:
    nokori = x - min(child_list)
    please_child = 0 
    while nokori >=0:
        please_child +=1
        mini = min(child_list)
        child_list.remove(mini)
        if child_list == []:
            break
        if len(child_list) == 1:
            if nokori == min(child_list):
                please_child += 1
            if nokori > min(child_list):
                break
            else:
            	break
        else:    
            nokori -= min(child_list)
print(please_child)
n = int(input())
a = list(map(int, input().split()))
ary = [0 for _ in range(10**5)]
​
for i in range(n):
    if a[i] > 1:
        ary[a[i]-2] += 1
        ary[a[i]-1] += 1
    ary[a[i]] += 1
​
print(max(ary))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ary = [0 for _ in range(10**5)]

for i in range(n):
    if a[i] > 1:
        ary[a[i]-2] += 1
        ary[a[i]-1] += 1
    ary[a[i]] += 1

print(max(ary))
# -*- coding: utf-8 -*-

################ DANGER ################
test = ""
#test = \
"""
5 2
8 7 6
rsrpr
ans 27
"""

"""
7 1
100 10 1
ssssppr
ans 211
"""

"""
30 5
325 234 123
rspsspspsrpspsppprpsprpssprpsr
ans 4996
"""
########################################
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
########################################  
        
n, k = map(int, input2().split())
r, s, p = map(int, input2().split())
t = list(input2())

rsp = {"r", "s", "p"}

for i in range(k, n):
    if t[i] == t[i-k]:
        t[i] = rsp - {t[i], t[i+1]}

ans = (t.count("r") * p +
       t.count("s") * r +
       t.count("p") * s)

print(ans)



### FIXED CODE ###

# -*- coding: utf-8 -*-

################ DANGER ################
test = ""
#test = \
"""
5 2
8 7 6
rsrpr
ans 27
"""

"""
7 1
100 10 1
ssssppr
ans 211
"""

"""
30 5
325 234 123
rspsspspsrpspsppprpsprpssprpsr
ans 4996
"""
########################################
test = list(reversed(test.strip().splitlines()))
if test:
    def input2():
        return test.pop()
else:
    def input2():
        return input()
########################################  
        
n, k = map(int, input2().split())
r, s, p = map(int, input2().split())
t = list(input2())

rsp = {"r", "s", "p"}

for i in range(k, n-1):
    if t[i] == t[i-k]:
        t[i] = rsp - {t[i], t[i+1]}
        
if t[n-1] == t[n-1-k]:
    t[n-1] = rsp - {t[n-1]}

ans = (t.count("r") * p +
       t.count("s") * r +
       t.count("p") * s)

print(ans)
import math
A,B,C,D=map(int,input().split())


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


#print(len([x for x in range(A,B) if x%2!=0 and x%3!=0]))

size=B-A-1
#C
C2=A%C
if C2 is 0:
    Csize=size
else:
    C2=C-C2
    Csize=size-C2

#D
D2=A%D
if D2 is 0:
    Dsize=size
else:
    D2=D-D2
    Dsize=size-D2

cd =lcm(C,D)

#c,dの最小公倍数
cd2=A%cd
if cd2 is 0:
    CDsize=size
else:
    cd2=cd-cd2
    CDsize=size-cd2

#Cの個数
Cq=Csize//C

#Dの個数
Dq=Dsize//D

#CDの個数
CDq=CDsize//cd

Q=size-(Cq+Dq-CDq)
print(Q)












"""
listsize=B-A-1
Q=0
for i in range(listsize+1):
    number=i+A
    if number % C is not 0 and number % D is not 0:
        Q+=1
print(Q)
"""




### FIXED CODE ###

from fractions import gcd
A,B,C,D=map(int,input().split())


def lcm(x, y):
    return (x * y) // gcd(x, y)

size=B

cd=lcm(C,D)
allC=size//C
allD=size//D
allcd=size//cd
ALL=size-(allC+allD-allcd)

size=A-1
cd=lcm(C,D)
pC=size//C
pD=size//D
pcd=size//cd
P=size-(pC+pD-pcd)

print(ALL-P)
import itertools
N, M, Q = map(int,input().split())
List = [list(map(int, input().split())) for i in range(Q)]

A_full = np.arange(1,M+1)

l_tensu = [0]
for subset in itertools.combinations(A_full, N):
    tensu = 0

    A = list(subset)
    for i in range(Q):
        a = List[i][0] - 1
        b = List[i][1] - 1
        c = List[i][2]
        d = List[i][3]
        if (A[b] - A[a] == c):
            tensu += d
    l_tensu.append(tensu)
    
print(max(l_tensu))

### FIXED CODE ###

import itertools
N, M, Q = map(int,input().split())
List = [list(map(int, input().split())) for i in range(Q)]

A_full = [i for i in range(1,M+1)]

l_tensu = 0
for subset in itertools.combinations_with_replacement(A_full, N):
    tensu = 0

    A = list(subset)
    for i in range(Q):
        a = List[i][0] - 1
        b = List[i][1] - 1
        c = List[i][2]
        d = List[i][3]
        if (A[b] - A[a] == c):
            tensu += d
    if(tensu > l_tensu):
        l_tensu = tensu
    
print(l_tensu)
def mostFrequent(L):
  return max(set(L), key = L.count)

N = input()
L = []
for i in range(0,N):
  L.append(input())
print(mostFrequent(L))

### FIXED CODE ###

from collections import defaultdict
from collections import OrderedDict
N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k]+=1
    else:
        ans.update({k:1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)
N,K=map(int,input().split())

S=[[]for i in range(10**5+1)]
for i in range(N):
    a,b=map(int,input().split())
    S[a].append(b)
S.sort(reverse=True)
#print(S)

k=0
o=0
E=[]
for i in range(len(S)):
    if S[i]==[]:
        break
    else:
        k+=1
        o+=S[i][0]
        E.append(S[i][0])
        del S[i][0]
E.sort()
#print(S)
S.sort(reverse=True)
A=[]
if k>K:
    for i in range(k-K):
        A.append(E[i])
        o-=E[i]
    for i in range(k-K):
        del E[i]
        k-=1

for i in range(len(S)):
    if S[i]==[]:
        break
    else:
        for j in range(len(S[i])):
            A.append(S[i][j])
A.sort(reverse=True)
#print(A)
if K-k>0:
    for i in range(K-k):
        o+=A[i]
        #print(i)
    del A[:i+1]
    print(A)
    print(E)
for i in range(min(K,len(A))):
    if k*k+o<(k-1)**2+o-E[i]+A[i]:
        k=(k-1)
        o=o-E[i]+A[i]
    else:
        break
print(k*k+o)

### FIXED CODE ###

Num,K=map(int,input().split())
L=[[]for i in range(Num+1)]
for i in range(Num):
    t,d=map(int,input().split())
    L[t].append(d)
for i in range(1,Num+1):
    L[i].sort(reverse=True)

M=[]
m=[]
for i in range(1,Num+1):
    if len(L[i])>=1:
        M.append(L[i][0])
        if len(L[i])>=2:
            for j in range(1,len(L[i])):
                m.append(L[i][j])
M.sort(reverse=True)
m.sort(reverse=True)
MM=[0]
for i in range(len(M)):
    MM.append(MM[-1]+M[i])
mm=[0]
for i in range(len(m)):
    mm.append(mm[-1]+m[i])
#print(MM)
#print(mm)
ANS=0

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**5+10
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

for i in range(1,min(K,len(M))+1):
    ANS=max(i*i+MM[i]+mm[min(len(mm)-1,K-i)],ANS)
    #print(ANS,i)
print(ANS)
d = int(intput())
if d==25:
  print("Christmas")
elif d==24:
  print("Christmas Eve")
elif d==23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")

### FIXED CODE ###

d = int(input())
if d==25:
  print("Christmas")
elif d==24:
  print("Christmas Eve")
elif d==23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")
N = int(input())
S = input()
ans=0
for i in range(1,N):
    if S[i]!=S[i-1]
        ans+=1
print(ans+1)

### FIXED CODE ###

N = int(input())
S = input()
ans=0
for i in range(1,N):
    if S[i]!=S[i-1]:
        ans+=1
print(ans+1)
a = input() 
b = input()
return (a * b) + " " + (2 * a + 2 * b)

### FIXED CODE ###

a, b = map(int, raw_input().split())
print a * b, 2 * a + 2 * b
s=list(map(int,input().split()))
t=list(map(int,input().split()))
a=[0]*26
for i in range(len(s)):
  if a[ord(s[i])]==0:
    a[ord(s[i])]=ord(t[i])
  elif a[ord(s[i])]==ord(t[i]):
    continue
  else:
    print("No")
    exit()

### FIXED CODE ###

a=list(input())
b=list(input())
from collections import Counter
def f(s):
    return sorted(Counter(s).values())
if f(a)==f(b):
    print("Yes")
else:
    print("No")
N = int(input())
P = list(map(int, input().split()))

ans = 0
cnt = 0
flag = 1
while flag:
    flag = 0
    for i in range(cnt, N):
        if P[i] == i+1:
            P[i], P[i+1] = P[i+1], P[i]
            ans += 1
            flag = 1
        else:
            cnt += 1

print(ans)

### FIXED CODE ###

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

ans = 0

for i in range(N):
    if P[i] != i+1:
        continue
    if i+1 < N and P[i] != i+2 or i == 0:
        P[i], P[i+1] = P[i+1], P[i]
        ans += 1
    else:
        P[i], P[i-1] = P[i-1], P[i]
        ans += 1

print(ans)
s = int(input)

A = []

A.append(s)
a = s
for i in range(10000):
    if a % 2 == 0:
        a = int(a/2)
        A.append(a)
    else:
        a = 3*a+1
        A.append(a)
    if A.count(a) == 2:
        print(len(A))
        break


### FIXED CODE ###

s = int(input())
A = []

A.append(s)
a = s
for i in range(10000):
    if a % 2 == 0:
        a = int(a/2)
        A.append(a)
    else:
        a = 3*a+1
        A.append(a)
    if A.count(a) == 2:
        print(len(A))
        break
import math
a = int(input())
d = a * a * math.pi
r = 2 * a * math.pi
print("{0:.6f} {1:.6f}".format(d, r))

### FIXED CODE ###

import math
a = float(input())
d = a * a * math.pi
r = 2 * a * math.pi
print("{0:.6f} {1:.6f}".format(d, r))
a,b=map(int,input().split())
if b==1:
    print(0)
elif a<b:
    print(b//a+1)
elif a=B:
    priint(b//a)
else:
    print(1)

### FIXED CODE ###

a,b=map(int,input().split())
if b==1:
    print(0)
elif a<b:
    x=(b-1)//(a-1)
    if (b-1)%(a-1)==0:
        print(x)
    else:
        print(x+1)
else:
    print(1)
import numpy as np
n,m = list(map(int, input().split()))
tmp_a = [list(input()) for _ in range(n)]
tmp_b = [list(input()) for _ in range(m)]

a = np.array(tmp_a)
b = np.array(tmp_b)

for a_i in range(n - m + 1):
    for a_j in range(n - m + 1):
        if((a[a_i:a_i + m, a_j:a_j + m] == b).all()):
            print("Yes")
            exit()
print("No")

### FIXED CODE ###

import numpy as np
n,m = list(map(int, input().split()))
tmp_a = [list(input()) for _ in range(n)]
tmp_b = [list(input()) for _ in range(m)]

a = np.array(tmp_a)
b = np.array(tmp_b)

for a_i in range(n - m + 1):
	for a_j in range(n - m + 1):
		if((a[a_i:a_i + m, a_j:a_j + m] == b).all()):
			print("Yes")
			exit()
print("No")
N, K = map(int, input().split())
S = input()
print(S[:K-1] + S[K-1].lower + S[K:])

### FIXED CODE ###

N, K = map(int, input().split())
S = input()
print(S[:K-1] + S[K-1].lower() + S[K:])
N, A, B = map(int, input().split())
    sa = B - A
    if sa % 2 == 0:
      print(int(sa/2))
    else:
      print(int(min(A -1,N -B) + 1 + (B- A)//2))

### FIXED CODE ###

N, A, B = map(int, input().split())
sa = B - A
if sa % 2 == 0:
   print(int(sa//2))
else:
   print(int(min(A -1,N -B) + 1 + (B- A)//2))
import sys
input = sys.stdin.readline

def main():
    N = int(input())
    X = int(input(),2)
    LIST = []
    ANS = [0]*N
    TEMP = [0]*N
    CHAIND = [0]*N
    bit = 1

    cnt = count_ones_by_bitmask(X)
    p = X % (cnt+1)
    m = X % (cnt-1)
    for i in range(N):
        LIST.append(X^bit)
        if LIST[i]!=0:
            ANS[i] = 1
            if (X & bit == 0):
                TEMP[i] = (p + pow(2, i, cnt+1) ) % (cnt+1)
            else:
                TEMP[i] = (m - pow(2, i, cnt-1) ) % (cnt-1)            
        bit = bit<<1


    CHA = list(set(TEMP))

    for i in range(len(CHA)):
        an = 0
        cha = CHA[i]
        cnt = count_ones_by_bitmask(CHA[i])
        while cnt>0:
            an += 1
            cha = cha%cnt
            cnt = count_ones_by_bitmask(cha)
        CHAIND[CHA[i]] = an

    for i in reversed(range(N)):
        print(ANS[i]+CHAIND[TEMP[i]])




def count_ones_by_bitmask(num):
    count = 0
    while num:
        count += num & 1
        num >>= 1
    return count

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N = int(input())
    X = input()
    XINT = int(X,2)
    ANS = [0]*N
    TEMP = [0]*N
    CHAIND = [0]*N

    cnt = count_ones_by_bitmask(XINT)
    
    if cnt == 0:
        for i in range(N):
            print(1)
            return
    if cnt ==1:
        for i in  range(N):
            if X[i] == '1':
                print(0) #全てが0になる
            else:
                if i==N-1:
                    print((int(X[N-1])+1)%2+1) # 2の剰余の反転
                else:
                    print((int(X[N-1]))%2+1) # 2の剰余
        return

    p = XINT % (cnt+1)
    m = XINT % (cnt-1)
    pmod = 1
    mmod = 1
    for i in range(N):
        ANS[i] = 1
        if (X[N-i-1] == '0'):
            TEMP[i] = (p + pmod) % (cnt+1)
        else:
            TEMP[i] = (m - mmod) % (cnt-1)
        pmod = (pmod*2) % (cnt+1)
        mmod = (mmod*2) % (cnt-1)


    CHA = list(set(TEMP))

    for i in range(len(CHA)):
        an = 0
        cha = CHA[i]
        cnt = count_ones_by_bitmask(CHA[i])
        while cnt>0:
            an += 1
            cha = cha%cnt
            cnt = count_ones_by_bitmask(cha)
        CHAIND[CHA[i]] = an

    for i in reversed(range(N)):
        print(ANS[i]+CHAIND[TEMP[i]])


def count_ones_by_bitmask(num):
    count = 0
    while num:
        count += num & 1
        num >>= 1
    return count

if __name__ == '__main__':
    main()
import sys
import numpy as np
from collections import Counter


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    max = A[-1]
    count = Counter(A)
    S = list(count.keys())
    C = []
    for s in S:
        if count[s] > 1:
            continue
        else:
            C.append(s)

    is_prime = np.ones(max + 1, np.bool)
    for a in A:
        if is_prime[a]:
            is_prime[a * 2 :: a] = 0
        else:
            continue
    answer = 0
    for c in C:
        if is_prime[c]:
            answer += 1
        else:
            continue
    print(answer)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
import numpy as np
from collections import Counter


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    max = A[-1]
    count = Counter(A)
    S = list(count.keys())
    C = []
    for s in S:
        if count[s] > 1:
            continue
        else:
            C.append(s)

    is_prime = np.ones(max + 1, np.bool)
    for a in A:
        if is_prime[a]:
            is_prime[a * 2 :: a] = 0
        else:
            continue
    answer = 0
    for c in C:
        if is_prime[c]:
            answer += 1
        else:
            continue
    print(answer)


if __name__ == "__main__":
    main()
input()
a=list(map(int,input().split(' ')))
sum=0
for i in a:
    sum+=i-1
print(sum)


### FIXED CODE ###

a=list(map(int,input().split(' ')))
a=sorted(a)
print(a[2]-a[0])
n = int(input())
m = n
while m > 10:
    m = m // 10
    ans += m

temp = n // 10
while temp > 5:
    temp = temp // 5
    ans += temp

print(ans)

### FIXED CODE ###

n = int(input())
ans = 0

if (n //2) *2 != n:
    print(ans)
else:
    n = n // 2
    while n >= 5:
        n = n // 5
        ans += n

    print(ans)
s = list(input())
n = len(s)
ans = []
for i in range(n):
  if i == "B":
    if ans == []:
      continue
    else:
      ans.remove(ans[-1])
  else:
    ans.appned(i)
print("".join(ans))

### FIXED CODE ###

from collections import deque
s = list(str(input()))
ans = deque()
for i in s:
  if i == "B":
    if ans == deque([]):
      continue
    else:
      ans.pop()
  else:
    ans.append(i)
print("".join(ans))
import numpy as np
N,M,X = map(int,input().split())

clist=[]
for i in range(N):
    clist.append(list(map(int,input().split())))

#print(clist)

total_all=[]
for i in range(2**N):
    total=np.zeros(M+1)
    for j in range(N):
        
        # iを2進数表記した場合の下から数えてj番目が1ならtrue
        if ((i >> j) & 1):
            total=total+np.array(clist[j])
    total_all.append(list(total))

#print(total_all)
ans=[]
for i in range(len(total_all)):
    if min(total_all[i][1:M])>=10:
        ans.append(total_all[i][0])

if len(ans)>=1:
    print(int(min(ans)))
else:
    print("-1")

### FIXED CODE ###

import numpy as np

N,M,X=map(int,input().split())

listC=[]
listall=[]

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

for i in range(2**N):
    total=np.zeros(M+1)
    for j in range(N):
        
        if ((i >> j) & 1):
            total=total+np.array(listC[j])
            #print(total)
    listall.append(list(total))
            


#print(listall)
ans=[]
for i in range(len(listall)):
    flag=True
    for j in range(M):
        if listall[i][j+1] < X:
            #print(j,listall[i][j+1])
            flag=False
        if j==(M-1) and flag==True:
            ans.append(listall[i][0])

if len(ans)>0:
    print(int(min(ans)))
else:
    print("-1")
N = input()
lit_N = []
for i in range(int(N)+1):
  if i % 5 == 0 and i % 3 == 0:
    lit_N.append("FizzBuzz")
  elif i % 3 == 0:
    lit_N.append("Fizz")
  elif i % 5 == 0:
  	lit_N.append("Buzz")
  else:
    lit_N.append(i)
print(sum(filter(int, lit_N[1:])))

### FIXED CODE ###

N = input()
lit_N = []
for i in range(int(N)+1):
  if i % 5 == 0 and i % 3 == 0:
    lit_N.append("FizzBuzz")
  elif i % 3 == 0:
    lit_N.append("Fizz")
  elif i % 5 == 0:
  	lit_N.append("Buzz")
  else:
    lit_N.append(i)
print(sum(list(filter(lambda x: isinstance(x,int), lit_N))))
a,b,c = map(int,input().split())
ans = "Yes" if len(set(a,b,c)) == 2 else "No"
print(ans)

### FIXED CODE ###

a = input().split()
if len(set(a)) == 2:
    ans = "Yes"
else:
    ans = "No"

print(ans)
n,k = map(int,input().split(" "))
s = list(input())

a = [0]
tmp = 1
for i in range(n-1):
    if s[i] == s[i+1]:
        tmp += 1
    else:
        a.append(tmp)
        tmp += 1
a.append(tmp)
m = len(a)
ans = 1
i = 1
if len(a) == 2 or m-2*k < 1:
    ans = a[m-1]
elif s[0] == "1":
    while (i <= m-2*k):
        if i % 2 != 0:        
            ans = max(ans,a[2*k+i]-a[i-1])
        else:
            ans = max(ans,a[2*k+i-1]-a[i-1])
        i += 1
else:
    while (i < m-2*k):
        if i % 2 == 0:        
            ans = max(ans,a[2*k+i]-a[i-1])
        else:
            ans = max(ans,a[2*k+i-1]-a[i-1])
        i += 1
print(ans)


### FIXED CODE ###

n,k = map(int,input().split(" "))
s = list(input())
a = [1]
for i in range(1,n):
    if s[i] != s[i-1]:
        a.append(i+1)
m = len(a)
ans = 1
i = 1
for i in range(m):
    if s[a[i]-1] == "1":
        if 2*k + i +1 < m:        
            ans = max(ans,a[2*k+i+1]-a[i])
        else:
            ans = max(ans,n+1- a[i])
    else:
        if 2*k+i< m:        
            ans = max(ans,a[2*k+i]-a[i])
        else:
            ans = max(ans,n+1-a[i])
print(ans)
def inpl(): return map(int, input().split())
from itertools import accumulate
from bisect import bisect, bisect_left
from collections import Counter
from functools import reduce
from itertools import accumulate
from operator import itemgetter, xor

from sys import setrecursionlimit
setrecursionlimit(10**9)
 
import sys
input = sys.stdin.readline
from collections import Counter
import numpy as np
def inpl(): return list(map(int, input().split()))
N, D = inpl()
S = set([i**2 for i in range(1, 400)])
X = np.array([inpl() for _ in range(N)], dtype=np.int64)

ans = 0
for i in range(N):
    for x in np.power(X - X[i], 2).sum(axis=1):
        if x in S:
            ans += 1
print(ans//2)

### FIXED CODE ###

def inpl(): return map(int, input().split())
from itertools import accumulate
from bisect import bisect, bisect_left
from collections import Counter
from functools import reduce
from itertools import accumulate
from operator import itemgetter, xor

from sys import setrecursionlimit
setrecursionlimit(10**9)
 
import sys
input = sys.stdin.readline
from collections import Counter
import numpy as np
def inpl(): return list(map(int, input().split()))
N, D = inpl()
S = set([i**2 for i in range(1, 400)])
X = np.array([inpl() for _ in range(N)], dtype=np.int64)

ans = 0
for i in range(N):
    for x in np.power(X - X[i], 2).sum(axis=1):
        if x in S:
            ans += 1
print(ans//2)
from math import*
n = int(input())
L = [int(input()) for i in range(5)]
ans = ceil(n //min(L) + 4
print(ans)


### FIXED CODE ###

n = int(input())
L = [int(input()) for i in range(5)]
ans = -(-n //min(L)) + 4
print(ans)
import numpy as np
H,W=map(int,input().split(' '))
maze = np.array([list(input()) for i in range(H)])
maze_w=[]
maze_h=np.array([['0']*W for i in range(H)])
for i in maze:
    cnt = 0
    l = 0
    r = 0
    tmp = ''
    for j in i:
        if j != "#":
            cnt += 1
            r += 1
        elif cnt:
            tmp += str(cnt)*cnt+'0'
            l = r+1
            r = r+1
            cnt = 0
        else:
            tmp +='0'
    if cnt:
        tmp +=str(cnt)*cnt
    maze_w.append(list(tmp))

for i in range(W):
    cnt = 0
    h = 0
    t = 0
    tmp = ""
    for j in maze[:,i]:
        if j!='#':
            cnt += 1
            t +=1
        elif cnt:
            tmp += str(cnt)*cnt+'0'
            h = t+1
            t = t+1
            cnt = 0
        else:
            tmp += '0'
    if cnt:
        tmp += str(cnt)*cnt
    maze_h[:,i] = list(tmp)
ans = 0
for i in range(H):
    for j in range(W):
        ans = max(ans,int(maze_h[i][j])+int(maze_w[i][j])-1)
print(ans)

### FIXED CODE ###

import numpy as np
H,W=map(int,input().split(' '))
maze = [list(input()) for i in range(H)]
maze = (np.array(maze) == '.')*1
L=np.zeros((H,W),dtype=int)
R=np.zeros((H,W),dtype=int)
U=np.zeros((H,W),dtype=int)
D=np.zeros((H,W),dtype=int)
for i in range(W):
    if i==0:
        L[:,i]=maze[:,i]
        R[:,W-i-1]=maze[:,W-i-1]
    else:
        L[:,i]=(L[:,i-1]+1)*maze[:,i]
        R[:,W-i-1]=(R[:,W-i]+1)*maze[:,W-i-1]
for i in range(H):
    if i==0:
        U[i,:]=maze[i,:]
        D[H-i-1,:]=maze[H-i-1,:]
    else:
        U[i,:]=(U[i-1,:]+1)*maze[i,:]
        D[H-i-1,:]=(D[H-i]+1)*maze[H-i-1,:]
print(max(np.max(U+D+L+R-3),0))