Harryxun/stf_run huggingface dataset:
pf={}
n = int(input())
x=n
for i in range(2,int(n**0.5)+1):
    while n % i == 0:
        pf[i] = pf.get(i,0)+1
        n//= i
if n > 1 : pf[n] = 1

# print((list(pf.keys()))[0]) #素因数分解したときの最小の因数取得

for b in range(-10,10):
    a=b+int(list(pf.keys())[0])
    siki=a**4 + a**3*b + a**2*b**2 + a*b**3 + b**4
    if siki==x/int(list(pf.keys())[0]):
        print(*(a,b))

### FIXED CODE ###


x=int(input())
A=0
B=0
for a in range(-500,500):
    for b in range(-500,500):
        if a**5-b**5==x:
            A=a
            B=b
            break
print(A,B)
x = int(input())

dp=[float('inf')]*(x+1)
dp[0]=0
for i in range(1,x+1):
    for j in range((i-1)*i//2+1):
        if 0<=j<=x and 0<=i+j<=x:
            dp[i+j]=min(dp[i+j],i)
print(dp[x])

### FIXED CODE ###

x = int(input())

ans=0
y=0
for i in range(1,x+1):
    y=y+i
    ans+=1
    if y>=x:
        print(ans)
        break
A,B=input().split()
print('YNeos'[int(A+B)**0.5%1!=0::2])

### FIXED CODE ###

N,*D=open(0);print(len(set(D)))
A,B,C,D = map(int, input().split())
print(sum(500*i+100*j+50*k==d for i in range(A+1) for j in range(B+1) for k in range(C+1)))

### FIXED CODE ###

A, B, C, D = [int(input()) for i in range(4)]
print(sum([500*a+100*b+50*c == D for a in range(A+1) for b in range(B+1) for c in range(C+1)]))
a,b,c,d,e,f = input().split()
if c == d and e == f:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

a,b,c,d,e,f = list(input())
if c == d and e == f:
    print('Yes')
else:
    print('No')
N = int(input())
A = [int(input()) for i in range(N)]
B = [int(input()) for i in range(N)]
C = [int(input()) for i in range(N-1)]

ans = 0

for i in range(N):
  ans += B[A[i]-1]
  if i >0 and A[i] - A[i-1] ==1:
    ans += C[A[i]-2]
        
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
ans = 0
 
for i in range(N):
  ans += B[A[i]-1]
  if i >0 and A[i] - A[i-1] ==1:
    ans += C[A[i]-2]
        
print(ans)
import sys
import copy
import math
import itertools
import numpy as np
import re

R,G,B,N = [int(c) for c in input().split()]
cnt = 0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        if r*R+g*G <= N and (N-r*R-g*G)%B == 0:
            cnt += 1
print(cnt)

### FIXED CODE ###

import sys
import copy
import math
import itertools
import numpy as np
import re

R,G,B,N = [int(c) for c in input().split()]
cnt = 0
for r in range(N//R+1):
    for g in range((N-r*R)//G+1):
        if r*R+g*G <= N and (N-r*R-g*G)%B == 0:
            cnt += 1
print(cnt)
s = input()
r = input()
for i in range (len(s)+len(t)):
    if i % 2 == 0: 
        print(s[i//2],end="")
    else:
        print(t[i//2],end="")

### FIXED CODE ###

s = input()
t = input()
for i in range (len(s)+len(t)):
    if i % 2 == 0: 
        print(s[i//2],end="")
    else:
        print(t[i//2],end="")
import math
from collections import Counter
A= int(input())
resArray = []
tmpA = A
i = 1
while i <= math.sqrt(A):
    #print (i)
    i += 1
    if tmpA == 1:
        break

    if i >2 and i %2 == 0:
        continue


    while tmpA % i == 0:
        tmpA = tmpA / i
        resArray.append(i)

res = 0
if tmpA == A:
    print(1)
    exit()
else tmpA > 1:
    res += 1


cArray = Counter(resArray)

for i in cArray.values():
    if i > 0:
        
        tmp = 1
        while tmp*(tmp+1)//2 <= i:
            tmp += 1
        res += tmp -1
print(res)

### FIXED CODE ###

import math
from collections import Counter
A= int(input())
if A == 1:
    print(0)
    exit()
resArray = []
tmpA = A
i = 1
while i <= math.sqrt(A):
    #print (i)
    i += 1
    if tmpA == 1:
        break

    if i >2 and i %2 == 0:
        continue


    while tmpA % i == 0:
        tmpA = tmpA / i
        resArray.append(i)

res = 0
if tmpA == A:
    print(1)
    exit()
elif tmpA > 1:
    res += 1


cArray = Counter(resArray)

for i in cArray.values():
    if i > 0:
        
        tmp = 1
        while tmp*(tmp+1)//2 <= i:
            tmp += 1
        res += tmp -1
print(res)
N = int(input())
A = list(map(int,input().split()))

import functools
from functools import reduce

def gcd_list(numbers):
    return reduce(functools.gcd, numbers)

score = 0
for i in range(N):
    B = A
    keep = B.pop(0)
    n = gcd_list(B)
    if n > score:
        score = n
    A.append(keep)


print(score)

### FIXED CODE ###

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

import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

L = [0 for i in range(N+1)]
R = [0 for j in range(N+1)]

for i in range(N):
    L[i+1] = fractions.gcd(L[i],A[i])
    R[N-1-i] = fractions.gcd(R[N-i],A[N-i-1])

M = 0
for i in range(N):
    M = max(M,fractions.gcd(L[i],R[i+1]))

print(M)
n=int(input())
A=list(map(int,input().split()))

ans=1
for i in range(n):
    ans*=A[i]
    if ans > 10**18
    break

if ans>10**18:
    print(-1)
else :
    print(ans)


### FIXED CODE ###

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

ans=1

if 0 in A:
    print(0)
else :
    for i in range(n):
        ans*=A[i]
        if ans > 10**18:
            break

    if ans>10**18:
        print(-1)
    else :
        print(ans)
import copy
R, C, K = map(int,input().split())
i = [list(map(int,input().split())) for k in range(K)]
dp = []
for k in range(4):
   dp.append([])
   for r in range(R):
      dp[k].append([])
      for c in range(C):
         dp[k][r].append([])
         dp[k][r][c] = 0
location = copy.deepcopy(dp[0])
for k in range(K):
   location[i[k][0]-1][i[k][1]-1] = i[k][2]
dp[1][0][0] = location[0][0]
if R > 1:
   for r in range(R-1):
      dp[1][r+1][0] = location[r][0] + max(dp[1][r][0],dp[0][r][0])
      dp[0][r+1][0] = max(dp[1][r][0],dp[0][r][0])
if C > 1:
   for c in range(C-1):
         dp[1][0][c+1] = max(location[0][c+1] + dp[0][0][c], dp[1][0][c])
         dp[2][0][c+1] = max(location[0][c+1] + dp[1][0][c], dp[2][0][c])
         dp[3][0][c+1] = max(location[0][c+1] + dp[2][0][c], dp[3][0][c])
   if R > 1:
      for r in range(R-1):
         for c in range(C-1):
            dp[0][r+1][c+1] = max(dp[0][r+1][c], dp[0][r][c+1], dp[1][r][c+1], dp[2][r][c+1], dp[3][r][c+1])
            dp[1][r+1][c+1] = max(dp[0][r+1][c+1] + location[r+1][c+1], dp[1][r+1][c])
            dp[2][r+1][c+1] = max(dp[1][r+1][c] + location[r+1][c+1], dp[2][r+1][c])
            dp[3][r+1][c+1] = max(dp[2][r+1][c] + location[r+1][c+1], dp[3][r+1][c])
if R==1 and C==1:
   ans = i[2]
else:
   ans = max(dp[0][R-1][C-1], dp[1][R-1][C-1], dp[2][R-1][C-1], dp[3][R-1][C-1])
print(ans)

### FIXED CODE ###

import sys
import copy
R, C, K = map(int, input().split())
item = [[0] * (C + 1) for _ in range(R + 1)]  # dp配列と合わせるために, 0行目, 0列目を追加している.
for s in sys.stdin.readlines():
    r, c, v = map(int, s.split())
    r -= 1
    c -= 1
    item[r][c] = v
    
dp0 = [[0] * (C+1) for r in range(R+1)]
dp1 = [[0] * (C+1) for r in range(R+1)]
dp2 = [[0] * (C+1) for r in range(R+1)]
dp3 = [[0] * (C+1) for r in range(R+1)]
 
for r in range(R):
   for c in range(C):
      dp3[r][c] = max(dp3[r][c], dp2[r][c] + item[r][c])
      dp2[r][c] = max(dp2[r][c], dp1[r][c] + item[r][c])
      dp1[r][c] = max(dp1[r][c], dp0[r][c] + item[r][c])
      dp1[r][c+1] = max(dp1[r][c], dp1[r][c+1])
      dp2[r][c+1] = max(dp2[r][c], dp2[r][c+1])
      dp3[r][c+1] = max(dp3[r][c], dp3[r][c+1])
      dp0[r+1][c] = max(dp0[r+1][c], dp1[r][c])
      dp0[r+1][c] = max(dp0[r+1][c], dp2[r][c])
      dp0[r+1][c] = max(dp0[r+1][c], dp3[r][c])
ans = max(dp0[R-1][C-1], dp1[R-1][C-1])
ans = max(ans, dp3[R-1][C-1])
ans = max(ans, dp2[R-1][C-1])
print(ans)
import sys
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
if n==1:
    print("Hello World")
a=int(input())
b=int(input())
print(a+b)

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
n=int(input())
if n==1:
    print("Hello World")
    quit()
a=int(input())
b=int(input())
print(a+b)
n,m = map(int,input().split())
a=[0]*n
w=[0]*n
ac=0
wa=0
for _ in range(m):
    p,s=input().split()
    p=int(p)-1
    if a[p]==0:
        if s=="AC":
            a[p]=1
            ac+=1
            wc+=w[p]
        else:
            w[p]+=1
print(ac,wc)

### FIXED CODE ###

n,m = map(int,input().split())
a=[0]*n
w=[0]*n
ac=0
wc=0
for _ in range(m):
    p,s=input().split()
    p=int(p)-1
    if a[p]==0:
        if s=="AC":
            a[p]=1
            ac+=1
            wc+=w[p]
        else:
            w[p]+=1
print(ac,wc)
N = int(input())
ar = list(map(int, input().split()))

arFast = sorted(ar, key=lambda x: x[1], reverse=True)
print(arFast)

### FIXED CODE ###

N = int(input())
ar = list(map(int, input().split()))
dic = {}
for i in range(len(ar)):
    dic[i] = ar[i]

arFast = sorted(dic.items(), key=lambda x: x[1], reverse=False)
for n in arFast:
    print(n[0]+1, end=" ")
S = input()
if S[0] == 'A' and S[2:-1].count('C')==1 and sum([for c in S c.isupper()])==2 :
  print('AC')
else:
  print('WA')

### FIXED CODE ###

S = input()
if S[0] == 'A' and S[2:-1].count('C')==1 and sum([c.isupper() for c in S])==2 :
  print('AC')
else:
  print('WA')
def main():
    N = int(input())
    v = list(map(int, input().split()))
    v_ki = v[1:N:2].copy()
    val_ki = [i+1 for i in range(10**5)]
    count_ki = [0] * (10**5)
    v_gu = v[0:N:2].copy()
    val_gu = [i+1 for i in range(10**5)]
    count_gu = [0] * (10**5)
    for i in range(N//2):
        count_ki[v_ki[i]] += 1
        count_gu[v_gu[i]] += 1
    
    ki = list(zip(count_ki, val_ki))
    ki.sort()
    ki_len = len(ki)
    gu = list(zip(count_gu, val_gu))
    gu.sort()
    gu_len = len(gu)
    if ki[-1][1] != gu[-1][1]:
        return N-(ki[-1][0])-(gu[-1][0])
    elif ki_len == gu_len:
        return N//2
    else:
        return min(N-(ki[-2][0])-(gu[-1][0]), N-(ki[-1][0])-(gu[-2][0]))

if __name__ == "__main__":
    print(main())


### FIXED CODE ###

def main():
    N = int(input())
    v = list(map(int, input().split()))
    v_ki = v[1:N:2].copy()
    val_ki = [i+1 for i in range(10**5)]
    count_ki = [0] * (10**5)
    v_gu = v[0:N:2].copy()
    val_gu = [i+1 for i in range(10**5)]
    count_gu = [0] * (10**5)
    for i in range(N//2):
        count_ki[v_ki[i]-1] += 1
        count_gu[v_gu[i]-1] += 1
    
    ki = list(zip(count_ki, val_ki))
    ki.sort()
    gu = list(zip(count_gu, val_gu))
    gu.sort()
    if ki[-1][1] != gu[-1][1]:
        return N-ki[-1][0]-gu[-1][0]
    else:
        return min(N-ki[-2][0]-gu[-1][0], N-ki[-1][0]-gu[-2][0])

if __name__ == "__main__":
    print(main())
s = str(input())
k = int(input())
for i in s:
    if i != "1":
        ans = i
        break
print(ans)

### FIXED CODE ###

s = str(input())
k = int(input())
ans = None
for i in range(k):
    if s[i] != "1":
        ans = s[i]
        break
if ans != None:
    print(ans)
else:
    print("1")
T = input().split()

a = T[0]
b = T[1]

A = int(a * int(b))
B = int(b + int(a))

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

### FIXED CODE ###

a, b = map(str, input().split())

A = int(a * int(b))
B = int(b * int(a))

if A > B:
  print(A)
else:
  print(B)
from collections import defaultdict, deque
hwsss = [s.rstrip() for s in open(0)]
H,W = map(int, hwsss[0].split())
sss = [[int(c=='#') for c in list(l)] for l in hwsss[1:]]

dhw = [
    [0,1],
    [1,0],
    [0,-1],
    [-1,0],
]

dists = defaultdict(lambda: defaultdict(lambda: float('inf')))
passed = defaultdict(lambda: defaultdict(lambda: False))

# h,w,dist
dq = deque([(0,0)])
dists[0][0] = 0

while dq:
    h, w = dq.popleft()
    dist = dists[h][w]
    passed[h][w] = True
    
    if h == H - 1 and w == W - 1:
        fdist = dist
        break
        
    for dh, dw in dhw:
        nh = h + dh
        nw = w + dw
        ndist = dist + 1
        if not(0 <= nh < H) or not(0 <= nw < W):
            continue
        if passed[nh][nw]:
            continue
        if sss[nh][nw]:
            continue
        dists[nh][nw] = min(dists[nh][nw], ndist)
        dq.append((nh,nw))

print(H * W - sum(sum(sss,[])) - fdist - 1)

### FIXED CODE ###

from collections import defaultdict, deque
hwsss = [s.rstrip() for s in open(0)]
H,W = map(int, hwsss[0].split())
sss = [[int(c=='#') for c in list(l)] for l in hwsss[1:]]

dhw = [
    [0, 1],
    [1, 0],
    [0, -1],
    [-1, 0],
]

# h,w,dist
dq = deque([(0, 0, 0)])
# h,w
queued = {(0, 0)}

fdist = -1
while dq:
    h, w, dist = dq.popleft()
    
    if h == H - 1 and w == W - 1:
        fdist = dist
        break
        
    for dh, dw in dhw:
        nh = h + dh
        nw = w + dw
        ndist = dist + 1

        if (nh,nw) in queued:
            continue
        if not(0 <= nh < H) or not(0 <= nw < W):
            continue
        if sss[nh][nw]:
            continue

        dq.append((nh, nw, ndist))
        queued.add((nh, nw))

if fdist == -1:
    print(-1)
else:
    print(H * W - sum(sum(sss,[])) - fdist - 1)
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    S=[]
    for i in range(n):
        S.append(int(input()))
    from functools import reduce
    from math import gcd

    def lcm(A, B):
        return A * B // gcd(A, B)


    print(reduce(lcm, S))
resolve()

### FIXED CODE ###

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

def resolve():
    n=int(input())
    S=[]
    for i in range(n):
        S.append(int(input()))
    from functools import reduce
    from fractions import gcd

    def lcm(A, B):
        return A * B // gcd(A, B)


    print(reduce(lcm, S))
resolve()
import math

d = [int(x) for x in input().split()]
print(d[1] - d[0] + 1 - (int(d[1] / d[2]) - int((d[0] - 1) / d[2]) + int(d[1] / d[3]) - int((d[0] - 1) / d[3]) - int(d[1] / (d[2] * d[3] / math.gcd(d[2], d[3]))) - int((d[0] - 1) / (d[2] * d[3]/ math.gcd(d[2], d[3])))))


### FIXED CODE ###

import fractions

d = [int(x) for x in input().split()]
lcm = int(d[2] * d[3] // fractions.gcd(d[2], d[3]))
b = d[1] - int(d[1] // d[2]) - int(d[1] // d[3]) + int(d[1] // lcm)
a_1 = d[0] - 1
a = a_1 - int(a_1 // d[2]) - int(a_1 // d[3]) + int(a_1 // lcm)
print(b - a)
x,a,b = map(int, input().split())
if (abs(x-a) > abc(x-b)):
    print("A")
else:
    print("B")

### FIXED CODE ###

x,a,b = map(int, input().split())
if (abs(x-a) < abs(x-b)):
    print("A")
else:
    print("B")
a, b c = [input(i) for i in input().split()]

total = 0 
for d in range(a, b + 1):
    if c % d == 0:
        total += 1
        
print(total)

### FIXED CODE ###

a, b, c = [int(i) for i in input().split()]

total = 0 
for d in range(a, b + 1):
    if c % d == 0:
        total += 1
        
print(total)
#-*-coding:utf-8-*-

def main():
    n, m = map(int, input().split())

    ab_list = []
    cd_list = []
    for _ in range(n):
        ab_list.append(list(map(int, input().split())))
    for _ in range(m):
        cd_list.append(list(map(int, input().split())))
    

    for i in ab_list:
        min_distance = 2 * 10 ** 8
        for j in range(m):
            distance = abs(i[0] - cd_list[j][0]) + abs(i[1] - cd_list[j][1])
            if distance < min_distance:
                min_distance = distance
                min_coord = j + 1
        print(min_coord)

if __name__ == '__main__':
    main()

### FIXED CODE ###

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

def main():
    n, m = map(int, input().split())

    ab_list = []
    cd_list = []
    for _ in range(n):
        ab_list.append(list(map(int, input().split())))
    for _ in range(m):
        cd_list.append(list(map(int, input().split())))
    
    for i in ab_list:
        min_distance = float('inf')
        for j in range(m):
            distance = abs(i[0] - cd_list[j][0]) + abs(i[1] - cd_list[j][1])
            if distance < min_distance:
                min_distance = distance
                min_coord = j + 1
        print(min_coord)

if __name__ == '__main__':
    main()
a,b,c = map(int,input().split())

result = "Yes" if a<b<c else "No"
print(result)

### FIXED CODE ###

a,b,c = map(int,input().split())

result = "Yes" if a<b<c else "No"
print(result)
N, Q = map(int,input().split())
tree = [[0] for i in range(N+1)]
for i in range(N-1):
    a,b = map(int,input().split())
    if tree[a] == [0]:
        tree[a] = [b]
    else:
        tree[a].append(b)
counter = [0 for i in range(N+1)]
def dfs(p,x):
    if p == 0:
        return
    counter[p] += x
    for i in tree[p]:
        dfs(i,x)   
    
for i in range(Q):
    p,x = map(int,input().split())
    dfs(p,x)
counter = [str(i) for i in counter]
ans = ' '.join(counter[1:])
print(ans)

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
 
n,q = map(int, input().split())
#長さn個のリストを入れ子にしたリストの作成：adj
adj = [[] for i in range(n)]
 
#adjに繋がっている要素を上流下流関わらず全て加える。
for j in range(n-1):
    a,b=map(int, input().split())
    adj[a-1].append(b-1)
    adj[b-1].append(a-1) 
 
#加算する値を合計したリストの作成
queries = [0 for i in range(n)]
for j in range(q):
    p, x = map(int, input().split())
    queries[p-1] += x
 
ans = [0 for i in range(n)]
 
#aの値，直前の値，直前のaの値
st = [(0, 0, -1)] 
 
#つながってる奴の一番後ろから処理していく。
#０スタート→1,2繋がってるなら2にいく。2に3が繋がってるなら次は3。
#3に繋がってるのがなければ1に戻る。
#この際，aの直前の値をタプルで保持したままリストに挿入して保管しておく。
while st:
    #stの先頭を取り出す。初期値は末尾のため-1
    l = st.pop()  
    ans[l[0]] = l[1] + queries[l[0]]
    for v in adj[l[0]]:
        if v != l[2]:
            st.append((v, ans[l[0]], l[0]))
 
print(*ans)
class UF:
    def __init__(self, N):
        self.uf = [-1]*N

    def find(self, x):
        if self.uf[x]<0: return x
        self.uf[x] = self.find(self.uf[x])
        return self.uf[x]

    def size(self, x):
        return -self.uf[self.find(x)]

    def union(self, x, y):
        x, y = self.find(x), self.find(y)
        if self.size(x) > self.size(y): x, y = y, x
        self.uf[y] += self.uf[x]
        self.uf[x] = y

N, K, L = list(map(int, input().split()))
uf1, uf2 = UF(N), UF(N)
for _ in range(K):
    p, q = list(map(int, input().split()))
    uf1.union(p-1, q-1)

for _ in range(L):
    r, s = list(map(int, input().split()))
    if uf1.find(r-1)==uf1.find(s-1):
        uf2.union(r-1, s-1)

print(*[uf2.size(x) for x in range(N)])

### FIXED CODE ###

class UF:
    def __init__(self, N):
        self.uf = [-1]*N
        self.n = N

    def find(self, x):
        if self.uf[x]<0: return x
        self.uf[x] = self.find(self.uf[x])
        return self.uf[x]

    def size(self, x):
        return -self.uf[self.find(x)]

    def union(self, x, y):
        x, y = self.find(x), self.find(y)
        if x==y: return
        if self.size(x) > self.size(y): x, y = y, x
        self.uf[y] += self.uf[x]
        self.uf[x] = y
        self.n -= 1

N, K, L = list(map(int, input().split()))
uf1, uf2 = UF(N), UF(N)
for _ in range(K):
    p, q = list(map(int, input().split()))
    uf1.union(p-1, q-1)

for _ in range(L):
    r, s = list(map(int, input().split()))
    uf2.union(r-1, s-1)

keys = [(uf1.find(x), uf2.find(x)) for x in range(N)]
count = {}
for key in keys:
    if key in count: count[key]+=1
    else: count[key]=1

print(*[count[key] for key in keys])
N, K = map(int, input().split)
a = list(map(int, input().split))
count = 0
for i in range(len(a)):
    if a[i] >= K:
        count += 1
print(count)

### FIXED CODE ###

N, K = map(int, input().split())
a = list(map(int, input().split()))
count = 0
for i in range(len(a)):
    if a[i] >= K:
        count += 1
print(count)
def solve():

    N, K = map(int, input().split())
    hlist = [int(input()) for i in range(N)]

    # sortして走破？
    hlist.sort()
    l = []

    for i in range(N-K+1):
        l.append(hlist(i+K-1)-hlist(i))

    print(min(l))


if __name__ == "__main__":
    solve()


### FIXED CODE ###



def solve():

    N, K = map(int, input().split())
    hlist = [int(input()) for i in range(N)]

    # sortして走破？
    hlist.sort()
    l = []

    for i in range(N-K+1):
        l.append(hlist[i+K-1]-hlist[i])

    print(min(l))


if __name__ == "__main__":
    solve()
N, D = [int(_) for _ in input().split()]
X = []
for i in range(D):
    X.append([int(_) for _ in input().split()])

# N, D = [3, 4]
# X = [
# [-3, 7, 8, 2],
# [-12, 1, 10, 2],
# [-2, 8, 9, 3]
# ]

import math
import numpy

ans = 0
for i in range(N):
    for j in range(i):
        # print(i,j)
        d = [(x[0] - x[1]) ** 2 for x in zip(X[i], X[j])]
        if math.sqrt(sum(d)).is_integer():
            ans += 1
print(ans)

### FIXED CODE ###

N, D = [int(_) for _ in input().split()]
X = []
for i in range(N):
    X.append([int(_) for _ in input().split()])

# N, D = [3, 4]
# X = [
# [-3, 7, 8, 2],
# [-12, 1, 10, 2],
# [-2, 8, 9, 3]
# ]

from math import sqrt

ans = 0
for i in range(N):
    for j in range(i):
        d = 0
        for k in range(D):
            d += (X[i][k] - X[j][k]) ** 2
        if sqrt(d) % 1 == 0:
            ans += 1
print(ans)
hoge = input()
c,s = hoge.sprit()

if x * 500 >= s:
  res = "Yes"
else:
  res = "No"
  
print(res)

### FIXED CODE ###

# 100 points
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
k, x = map(int, input().split())
if k*500 >= x:
    # 出力
    print('Yes')
else:
    # 出力
    print('No')# 100 points
s=input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s:
    print("NO")
else:
    print("YES"

### FIXED CODE ###

S=str(input())
S=S.replace('eraser','1')
S=S.replace('erase','2')
S=S.replace('dreamer','3')
S=S.replace('dream','4')
S=S.replace('1','')
S=S.replace('2','')
S=S.replace('3','')
S=S.replace('4','')
if len(S)==0:
    print('YES')
else:
    print('NO')
S = input()
ans = 0
ACGT = 0
for i in len(S):
  if S[i]=='A' or S[i]=='G' or A[i]=='C' or A[i]=='T':
    ACGT += 1
  else:
    ans = max(ans,ACGT)
    ACGT = 0
print(ans)

### FIXED CODE ###

S = list(input())
M = 0
count = 0
for x in S:
  if x =="A" or x =="C" or x =="T" or x =="G":
    count += 1
  else:
    count = 0
  if M<count:
    M = count
print(M)
import statistics
n = int(input())
a = list(map(int, input().split()))
median_low = statistics.median_low(a)
median_high = statistics.median_high(a)
for i in range(n):
    if median_high > a[i]:
        print(median_high)
    elif median_low < a[i]:
        print(median_low)
    elif median_high == a[i]:
        print(a[i])
    else:
        print(a[i-1])


### FIXED CODE ###

import statistics
n = int(input())
a = list(map(int, input().split()))
median_low = statistics.median_low(a)
median_high = statistics.median_high(a)
for i in range(n):
    if median_high > a[i]:
        print(median_high)
    elif median_low < a[i]:
        print(median_low)
    elif median_high == a[i]:
        print(a[i])
    else:
        print(a[i-1])