Harryxun/stf_run huggingface dataset:
n,d=map(int,input().split())

l=[]
for _ in range(n):
  l1=[map(int,input().split())]
  l.append(l1)

import math

ans=[]
for a in range(n):
  for b in range(n):
    a=0
    for c in range(d):
      D=(l[a][c]-l[b][c])**2
      a+=D
    ans.append(isinstance(math.sqrt(a),int))
      
ans=sum(ans)-n
print(ans)

### FIXED CODE ###

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

l=[]
for _ in range(n):
  l1=list(map(int,input().split()))
  l.append(l1)

import math

ans=[]
for a in range(n):
  for b in range(n):
    x=0
    for c in range(d):
      D=(l[a][c]-l[b][c])**2
      x+=D
    y=math.sqrt(x)
    ans.append(y.is_integer())
      
ans=(ans.count(True)-n)//2
print(ans)
[print(s) for s in map(lambda x:x[0]+x[1]==x[2] and 'YES' or 'NO', [sorted(int(x)**2 for x in raw_input().split(' ')) for i in range(int(raw_input()))])]

### FIXED CODE ###

print "\n".join(s for s in map(lambda x:x[0]+x[1]==x[2] and 'YES' or 'NO', [sorted(int(x)**2 for x in raw_input().split(' ')) for i in range(int(raw_input()))]))
import numpy as np
N = int(input())
XL = []
for n in range(N):
	XL.append([int(x) for x in input().split()])
XL = sorted(XL, key=lambda x:x[1])
s = np.zeros(2*(10**9))
ans = 0
for n in range(N):
	a = s[max(XL[n][0]-XL[n][1],-1)+1:XL[n][0]+XL[n][1]]
	if a.max() != 0:
		ans += 1
	else:
		s[max(XL[n][0]-XL[n][1],-1)+1:XL[n][0]+XL[n][1]] += 1
print(N-ans)


### FIXED CODE ###

N = int(input())
XL = []
for n in range(N):
    XL.append([int(x) for x in input().split()])
XL = sorted(XL, key=lambda x:x[0]+x[1])
m = -float("inf")
ans = 0
for n in range(N):
    if XL[n][0]-XL[n][1] >= m:
        ans += 1
        m = XL[n][0]+XL[n][1]
print(ans)
R,G,B,N = map(int,input().split())
cnt = 0
for r in range((N // R) + 1):
    for g in range(N // (r * G) + 1):
        V = N - (r * R + g * G)
        if V >= 0 and V % B == 0:
            cnt += 1
print(cnt)


### FIXED CODE ###

R,G,B,N = map(int,input().split())
cnt = 0
for r in range((N // R) + 1):
    for g in range((N - (r * R)) // G + 1):
        V = N - (r * R + g * G)
        if V >= 0 and V % B == 0:
            cnt += 1
print(cnt)
import numpy as np
from sys import stdin
sys.setrecursionlimit(10**6) 

def main(args):
    a = args[0]
    b = args[1]
    if 6 <= a and a <= 12:
        v = b//2
    elif a <= 5:
        v = 0
    else:
        v = b
    print(v)

main([int(x) for x in stdin.readline().rstrip().split()])

### FIXED CODE ###

import numpy as np
from sys import stdin
#sys.setrecursionlimit(10**6) 

def main():
    a, b = [int(x) for x in stdin.readline().rstrip().split()]
    if 6 <= a and a <= 12:
        v = b//2
    elif a <= 5:
        v = 0
    else:
        v = b
    print(v)

if __name__ == "__main__":
    main()
#!/usr/bin/env python3
n, m = map(int, input().split())
s = [-1 for _ in range(m)]
c = [-1 for _ in range(m)]
for i in range(m):
    s[i], c[i] = map(int, input().split())

for x in range(1000):
    keta = 1 
    nx = x/10
    d = []
    while nx: 
        keta += 1
        d.append(nx%10)
        nx /= 10
    if keta != n:
        continue
    ok = True
    d = d[::-1]
    for i in range(m):
        if d[s[i]-1] != c[i]:
            ok = False
    if ok: 
        print(x)
        exit(0)

print(-1)


### FIXED CODE ###

#!/usr/bin/env python3
n, m = map(int, input().split())
s = [-1 for _ in range(m)]
c = [-1 for _ in range(m)]
for i in range(m):
    s[i], c[i] = map(int, input().split())

for x in range(1000):
    x = str(x)
    if len(x) != n:
        continue
    ok = True
#    print('x =', x)
    for i in range(m):
#        print('s[i] =', s[i])
#        print('x[s[i]-1] =', x[s[i]-1])
#        print('c[i] =', c[i])
        if x[s[i]-1] != str(c[i]):
            ok = False
    if ok: 
        print(x)
        exit(0)

print(-1)
#D-XXOR

n,k=map(int,input().split())
lists=list(map(int,input().split()))
a=format(k,"b")
length=max(len(a),len(format(max(lists),"b")))
uselists=[0]*length
for some in lists:
    check=format(some,"0%ib"%length)
    for i in range(length):
        if check[i]=="1":
            uselists[length-1-i]+=1         
if k>=1:
    for i in range(length):
        if  2**i<=k<2**(i+1):
            order=i
            break            
    ans1=0
    ans2=0
    for j in range(order):
        ans1+=(2**j)*max(uselists[j],n-uselists[j])
    for j in range(order+1,length):
        ans2+=(2**j)*uselists[j]
    ans2+=(2**order)*(n-uselists[order])
    bigger=0
    newlist=[0]*(k-2**order+1)
    for g in range(0,k-2**order+1):
        some=format(g,"0%ib"%order)
        newlist[g]=some
    for some in newlist:
        checker=0
        for i in range(order):
            if some[i]=="1":
                checker+=(2**(order-1-i))*(n-uselists[i])
            else:
                checker+=(2**(order-1-i))*uselists[i]
        bigger=max(bigger,checker)  
    ans2=ans2+bigger
    print(max(ans1,ans2))
    
elif k==0:
    ans=0
    for i in range(length):
        if uselists[i]=="1":
            ans+=(2**i)*(n-uselists[i])
        else:
            ans+=(2**i)*uselists[i]     
    print(ans)

### FIXED CODE ###

n,k=map(int,input().split())
k2=format(k+1,"0%ib"%40)
lists=list(map(int,input().split()))
countlist=[0]*40
for j in lists:
    c=format(j,"0%ib"%40)
    for i in range(40):
        if c[i]=="1":
            countlist[i]+=1

emptylist=[]
for i in range(40):
    if k2[i]=="1":
        emptylist.append(i)
if k>=1:
    ans=0
    for i in emptylist:
        subing=0
        for j in range(40):
            if j<i:
                if k2[j]=="1":
                    subing+=(2**(39-j))*(n-countlist[j])
                elif k2[j]=="0":
                    subing+=(2**(39-j))*countlist[j]
            if j==i:
                subing+=(2**(39-i))*countlist[i]
            
            if j>i:
                subing+=(2**(39-j))*max(countlist[j],n-countlist[j])
        ans=max(ans,subing)
    print(ans)
elif k==0:
    ans=0
    for i in range(40):
        ans+=(2**(39-i))*countlist[i]
    print(ans)
memo = [0] * 1000000
memo[1] = 1

def saiki(n):
    global memo
    tmp = 0
    if n <= 1:
        return memo[1]
    else:
        tmp = int(n/2)
        if memo[tmp] == 0:
            memo[tmp] = saiki(tmp)
        return memo[tmp]+memo[tmp]+1
    
h = int(input())
print(saiki(h))


### FIXED CODE ###

#memo = [0] * 100000000
#memo[1] = 1

def saiki(n):
#    global memo
    tmp = 0
    if n <= 1:
        return 1
#        return memo[1]
    else:
        tmp = int(n/2)
        return saiki(tmp) * 2 + 1
#        if memo[tmp] == 0:
#            memo[tmp] = saiki(tmp)
#        return memo[tmp]+memo[tmp]+1
    
h = int(input())
print(saiki(h))
mport sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
from collections import deque
def resolve():
    S = deque(list(sr().split()), maxlen=1000000)
    Q = ir()
    rev = 1
    for i in range(Q):
        T = list(sr().split())
        if int(T[0]) == 1:
            rev *= -1
        else:
            x, F, C = T
            if int(F) == 1:
                if rev == 1:
                    S.appendleft(C)
                else:
                    S.append(C)
            else:
                if rev == 1:
                    S.append(C)
                else:
                    S.appendleft(C)
    if rev == -1:
        S.reverse()
    print(*S, sep='')
resolve()

### FIXED CODE ###

import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
from collections import deque
def resolve():
    S = deque(sr())
    Q = ir()
    rev = 1
    for i in range(Q):
        T = list(sr().split())
        if int(T[0]) == 1:
            rev *= -1
        else:
            x, F, C = T
            if int(F) == 1:
                if rev == 1:
                    S.appendleft(C)
                else:
                    S.append(C)
            else:
                if rev == 1:
                    S.append(C)
                else:
                    S.appendleft(C)
    if rev == -1:
        S.reverse()
    print(*S, sep='')
resolve()
N = int(input())
A = list(map(int,input().split()))

A = sorted(A, reverse = True)

la = len(A)

for i in range(la-1):
   ans += A[i]

print(ans)

### FIXED CODE ###

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

A = sorted(A, reverse = True)

B = [A[0]] + [A[i] for i in range(1,N)] * 2

B = sorted(B, reverse = True)

ans = 0

for i in range(N - 1):
   ans +=  B[i]
print(ans)
A, B, C, D, E, F = map(int, input().split())

A *= 100
B *= 100
dp = [-1]*(F+1)
dp[A] = 0
dp[B] = 0
for i in range(A, F + 1):
    if A <= i:
        dp[i] = max(dp[i - A], dp[i])
    if B <= i:
        dp[i] = max(dp[i - B], dp[i])
    if C <= i and dp[i-C] >= 0:
        if dp[i-C] + C <= (i-C - dp[i-C]) * (E / 100):
            dp[i] = max(dp[i-C] + C, dp[i])

    if D <= i and dp[i-D] >= 0:
        if dp[i-D] + D <= ((i - D) - dp[i-D]) * (E / 100):
            dp[i] = max(dp[i-D] + D, dp[i])


x = 0
id = 0
for i in range(A, F+1):

    if x <= (dp[i] / (i)):
        x = dp[i] / (i)
        id = i

print(id, dp[id])


### FIXED CODE ###

A, B, C, D, E, F = map(int, input().split())

water = set()
for i in range(F//(100*A) + 1):
    for j in range(F // (100*B) + 1):
        if 100*A * i + 100*j*B <= F:
            water |= {100*A * i + 100*j*B}
        else:
            break

sugar = set()
for i in range(F//C + 1):
    for j in range(F // D + 1):
        if C * i + D*j <= F:
            sugar |= {C * i + D*j}
        else:
            break
ans = [100*A, 0]
for x in water:
    if x == 0:
        continue
    for y in sugar:
        if x + y <= F and y <= (x/100)*E:
            if ans[1]/ans[0] < y / (x+y):
                ans = [x+y, y]

print(ans[0], ans[1])
import math
v = int(math.sqrt(N))
print(v*v)

### FIXED CODE ###

import math
n = int(input())
v = int(math.sqrt(n))
print(v*v)
n=int(input())
ans=1
a=list(map(int,input().split()))
m=n-a.count(1)
b=sorted(a)
c=list(set(b))
if (1 in b)and(len(c)>1):
    if c[1]==1: 
        del b[:b.index(c[2])-1]
    else:
        del b[:b.index(c[1])-1]
for i in range(n):
    ans*=b[i]
    if 0 in a:
        ans=0
        break
    if m>68:
        ans=-1
        break
    if ans>1000000000000000000:
        ans=-1
        break
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
flag=0
ans=0
if 0 in a:
    flag=1
if flag==0:
    ans=1
    for i in range(n):
        ans*=a[i]
        if ans>1000000000000000000:
            flag=-1
            break
if flag==-1:
    print(-1)
else:
    print(ans)
from collections import defaultdict
from bisect import *
def solve():
    d = defaultdict(lambda: [])
    N = int(input())
    for i in range(N):
        a = int(input())
        d[a].append(i)
    selist = []
    ends = [-1]
    for l in d.values():
        for i in range(len(l)-1):
            if l[i+1]-1>l[i]:
                selist.append([l[i],l[i+1]])
                ends.append(l[i+1])
    selist = [[-1,-1]]+sorted(selist,key=lambda x:x[1])
    # s_ind = {}
    # for i,(s,e) in enumerate(selist):
        # e_ind[e] = i
    # ends = list(e_ind.keys())
    ends.sort()
    dp = [0]*(len(selist))
    for i in range(1,len(selist)):
        dp[i] = dp[i-1]+1
        ind = bisect_right(ends,selist[i][0])
        dp[i] += dp[ind-1]
    ans = dp[-1]+1
    ans %= mod
    return ans
print(solve())

### FIXED CODE ###

from collections import defaultdict
from bisect import *
def solve():
    mod = 10**9+7
    d = defaultdict(lambda: [])
    N = int(input())
    for i in range(N):
        a = int(input())
        d[a].append(i)
    selist = []
    ends = [-1]
    for l in d.values():
        for i in range(len(l)-1):
            if l[i+1]-1>l[i]:
                selist.append([l[i],l[i+1]])
                ends.append(l[i+1])
    selist = [[-1,-1]]+sorted(selist,key=lambda x:x[1])
    # s_ind = {}
    # for i,(s,e) in enumerate(selist):
        # e_ind[e] = i
    # ends = list(e_ind.keys())
    ends.sort()
    dp = [0]*(len(selist))
    for i in range(1,len(selist)):
        dp[i] = dp[i-1]+1
        ind = bisect_right(ends,selist[i][0])
        dp[i] += dp[ind-1]
    ans = dp[-1]+1
    ans %= mod
    return ans
print(solve())
N, M = map(int, input().split())

If N==M :
	print("Yes")
else :
	print("No")

### FIXED CODE ###

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

if N == M :
	print("Yes")
else :
	print("No")
#include<iostream>
#include<set>
using namespace std;

int main(){
    int N;
    int d[110];
    cin>>N;
    for(int i=0;i<N;i++){
        cin>>d[i];
    }
    set<int>values;
    for (int i=0;i<N;i++){
        values.insert(d[i]);
    }
    cout<<values.size()<<endl;
}

### FIXED CODE ###

#ABC085B
n=int(input())
l=[]
for i in range(n):
	l.append(input())
#set型のオブジェクトはコンストラクタset()でも生成できる。
#引数としてリストやタプルのようなイテラブルオブジェクトを指定すると、重複する要素が除外されて一意な値のみが要素となるsetオブジェクトが生成される。
s_l=set(l)
#s_l=sorted(s_l)
#set to list by sorted
#print(type(s_l))
ans=len(s_l)
print(ans)
#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, *A =  map(int, read().split())

A = sorted(A)
A = A[N:-N]

print(sum(A))


### FIXED CODE ###

#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, *A = map(int, read().split())

A = sorted(A)[::-1]
A = A[1:-N:2]

print(sum(A))
import math
N,K = map(int,input().split())

for i in range(int(math.log2(N)+1)):
    if N >= pow(K,i) and N < pow(K,i+1):
        print(i+1)
        exit()


### FIXED CODE ###

import math
N,K = map(int,input().split())

for i in range(int(math.log2(N)+1)):
    if N >= pow(K,i) and N < pow(K,i+1):
        print(i+1)
        exit()
#%%
l = list(map(int,input().split()))
N = l[0]
A = l[1] 
B = l[2]
C = l[3]
D = l[4]
S = input()
S_list = list(S)

if C < D :
    count = 0
    for i in range(A-1, D-1):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    else : 
        print('Yes')
elif C == D :
    print('No')
else:
    count = 0
    for i in range(A-1, C-1):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    count = 0
    for i in range(B-2, D):
        if S_list[i] == S_list[i+1] == S_list[i+2] == '.' :
            count += 1
    if count >= 1:
        print('Yes')  
    else:
        print('No') 

### FIXED CODE ###

l = list(map(int,input().split()))
N = l[0]
A = l[1] 
B = l[2]
C = l[3]
D = l[4]
S = input()
S_list = list(S)

if B < C < D :
    count = 0
    for i in range(A, D-2):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    else : 
        print('Yes')
elif C < B < D :
    count = 0
    for i in range(A, C-2):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1
    for j in range(B, D-1):
        if S_list[j] == S_list[j+1] == '#' :
            count += 1
    if count >= 1:
        print('No')
    else :
        print('Yes')
elif B < D < C:
    count = 0
    for i in range(A, C-2):
        if S_list[i] == S_list[i+1] == '#' :
            count += 1

    cou = 0
    for i in range(B-2, D-1):
        if S_list[i] == S_list[i+1] == S_list[i+2] == '.' :
            cou += 1
    if cou >= 1 and count < 1 :
        print('Yes')  
    else:
        print('No')
N = int(input())
S = list(input())
cnt =0
for i in range(n-2):
  if S[i] =="A":
    if S[i+1] =="B":
      if S[i+2] == "C":
        cnt +=1
print(cnt)

### FIXED CODE ###

N = int(input())
S = list(input())
cnt =0
for i in range(N-2):
  if S[i] =="A":
    if S[i+1] =="B":
      if S[i+2] == "C":
        cnt +=1
print(cnt)
a = int(input())
b = int(input())
print(a*b)
print((a+b)*2)

### FIXED CODE ###

a,b = [int(i) for i in input().split()]
print(a*b,a*2+b*2)
k = 3
p,q,r = [2],[],[]
while k < 100000:
  flag = True
  for t in p:
    if t*t > k:
      break
    if k%t == 0:
      flag = False
  if flag:
    p.append(k)
  k += 2
for t in p[1:]:
  if (t+1)//2 in p:
    q.append(t)
q.append(100000+3)
k = 0
for i in range(99999//2):
  while q[k]<=2*i+1:
    k += 1
  r.append(k)
for _ in [0]*int(input()):
  x,y = map(int,input().split())
  print(r[y//2]-r[max(x,3)//2-1])
  

### FIXED CODE ###

N = 10**5
p = [0]*(N+1)
q = [0]*(N+1)

p[2] = 1
primes = [2]

for i in range(3,N+1):
  f = 1
  for t in primes:
    if t*t > i:
      break
    if i%t == 0:
      f = 0
      break
  if f == 1:
    primes.append(i)
    p[i] = 1
    if p[(i+1)//2]:
      q[i] = 1
m = 0
s = [0]*(N+1)
for i in range(1,N+1):
  m += q[i]
  s[i] = m
  
for i in range(int(input())):
  l,r = map(int,input().split())
  print(s[r]-s[l-1])
import decimal
n,k=map(int,input().split())
num=[]
num2=[]
num4=0
num5=n
if n>=k:
    num4=decimal.Decimal((n-k+1)/n)
    n=k-1
num6=-1*(k//(-1*n))
for i in range(18):
    num.append(2**i)
for i in range(18):
    if num6<=num[i+1]:
        num6=i
        break
for i in range(18):
    if num[i]>=n:
        num2.append(n-num[i-1])
        break
    else:
        if i==0:
            num2.append(1)
        else:
            num2.append(num[i]-num[i-1])
ans=0
num3=len(num2)
for i in range(len(num2)):
    ans+=num2[i]*(2**(i))
print((decimal.Decimal(decimal.Decimal(ans/num5)/(2**(num3+num6))))+num4)


### FIXED CODE ###

import decimal
n,k=map(int,input().split())
num1=1
num2=0
for i in range(20):
    if num1>=k:
        break
    num1*=2
    num2+=1
num=n*(2**num2)
num1=num2
num3=0
for i in range(1,n+1):
    if i*(2**(num2-1))>=k:
        num2-=1
    if i>=k:
        num3+=2**num1
    else:
        num3+=2**(num1-num2)
print(decimal.Decimal(num3/num))
n,d=map(int,input().split())
lists=[list(map(int,input().split())) for x in range(n)]
answer=0
for i in range(1,n):
  for j in range(i+1,n+1):
    for y in range(d):
      count=0
      count+=(lists[j-1][y]-lists[i-1][y])**2
      n=count**(1/2)
      if n.is_integer():
        answer+=1
print(answer)

### FIXED CODE ###

n,d=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]
cnt=0
for i in range(n-1):
  for j in range(i+1,n):
    sum=0
    for dd in range(d):
      sum+=(l[i][dd]-l[j][dd])**2
    if sum**0.5==int(sum**0.5):
      cnt+=1
print(cnt)
A = input()
B = input()

A = int(A)
B = int(B)

if A > B :
    X = A
    A = A - 1

else :
    X = B
    B = B - 1

if A > B :
    X = X + A
else :
    X = X + B

print(X)

### FIXED CODE ###

A,B = input().split(' ')

A = int(A)
B = int(B)

if A > B :
    X = A
    A = A - 1

else :
    X = B
    B = B - 1

if A > B :
    X = X + A
else :
    X = X + B

print(X)
n=int(input())
model=[]
for i in range(n):
  model.append(i+1)
p=list(map(int,input().split()))
cnt=0
for j in p:
  if j != model[j]:
    cnt+=1
if cnt=<2:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

n=int(input())
model=[]
for i in range(n):
  model.append(i+1)
#print(model)
p=list(map(int,input().split()))
cnt=0
for j in range(n):
  if p[j] != model[j]:
    cnt+=1
if cnt<=2:
  print("YES")
else:
  print("NO")
a = list(input())
b = list(input())

count = 0
for i in range(3):
  if a[i] == b[i]:
    count += 1

ptint(count)

### FIXED CODE ###

a = list(input())
b = list(input())

count = 0
for i in range(3):
  if a[i] == b[i]:
    count +=1

print(count)
# div2019-2B - Picking Up
import collections
import sys
input = sys.stdin.readline

n = int(input())
arr = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])
dif = []
for i in range(1, n):
    x = arr[i][0] - arr[i - 1][0]
    y = arr[i][1] - arr[i - 1][1]
    dif += [(x, y)]

x_min, x_max = min(dif, key=lambda i: i[0])[0], max(dif, key=lambda i: i[0])[0]
y_min, y_max = min(dif, key=lambda i: i[1])[1], max(dif, key=lambda i: i[1])[1]
ans = float("inf")
for p in range(x_min, x_max + 1):
    for q in range(y_min, y_max + 1):
        cnt = 1
        for i in range(1, n):
            if (arr[i - 1][0], arr[i - 1][1]) != (arr[i][0] - p, arr[i][1] - q):
                cnt += 1
        ans = min(ans, cnt)
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
arr = sorted([list(map(int, input().rstrip().split())) for _ in range(n)])
cnt = {}
for i in range(n):
    for j in range(i + 1, n):
        dif = (arr[j][0] - arr[i][0], arr[j][1] - arr[i][1])
        cnt.setdefault(dif, 0)
        cnt[dif] += 1
print(1 if cnt == {} else n - max(cnt.values()))
import collections
n, m = [int(i) for i in input().split()]
todc = collections.defaultdict(lambda: [])

for k in range(m):
    i, j = input().split()
    todc[int(j)] += [int(i)]

def maxlen(n):
    if len(todc[n]) == 0:
        return 0
    else:
        m = 0
        for i in todc[n]:
            m = max(m, (maxlen(i)+1))
        return m

k = 0
for i in range(1, n+1):
    k = max(k, maxlen(i))
    print("k ", i, maxlen(i))
print(k)

### FIXED CODE ###

import collections
n, m = [int(i) for i in input().split()]
todc = collections.defaultdict(lambda: [])
lendc = collections.defaultdict(lambda: -1)


for k in range(m):
    i, j = [int(n) for n in input().split()]
    todc[j] += [i]


def maxlen(n):
    if len(todc[n]) == 0:
        lendc[n] = 0
        return 0
    else:
        m = 0
        for i in todc[n]:
            if lendc[i] == -1:
                lendc[i] = maxlen(i)
            m = max(m, lendc[i]+1)
        return m
       

def maxlen_stack(org_n):
    stack = [org_n]
    while stack:
        n = stack.pop()
        if len(todc[n]) == 0:
            lendc[n] = 0
        else:
            m = 0
            recursive = []
            for i in todc[n]:
                if lendc[i] == -1:
                    recursive.append(i)
                else:
                    m = max(m, lendc[i]+1)
            if recursive:
                stack += [n] + recursive
            else:
                lendc[n] = m         
    return lendc[org_n]

k = 0
for i in range(1, n+1):
    if lendc[i] == -1:
        #lendc[i] = maxlen(i)
        lendc[i] = maxlen_stack(i)
    k = max(k, lendc[i])
print(k)
A,B = map(int,input().split())
if (A==1 and B==2) or (A==2 and B==1):
  print(3)
elif (A==2 and B==3) or (A==3 and B==2):
  print(1)
elif (A==3 and B==1) or (A==1 and B==3):
  print(2)

### FIXED CODE ###

a = int(input())
b = int(input())
if a+b == 3:
  print(3)
elif a+b == 4:
  print(2)
else:
  print(1)
try:
    s1=(input(''))
    if len(s1)==4:
        check=list((s1))
    assert bool(int(check[0]+check[1])<=12) != bool(int(check[2]+check[3])<=12)
    if int(check[0]+check[1])<=12:
        print("MMYY")
    elif int(check[2]+check[3])<=12:
        print("YYMM")
except AssertionError:
    if int(check[0]+check[1])<=12 and int(check[2]+check[3])<=12:
        print("AMBIGUOUS")
    else:
        print("NA")


### FIXED CODE ###

n,k=map(int, input("").split(' '))
assert n>=k>=1
assert 1<=n<=50

s=input('')
assert ("a","b","c" in s)

z=list((s))
z[k-1]=z[k-1].swapcase()

for i in z:
    print(i, end='')
N=int(input())
for n in range(1,N+1):
    s=0
    for x in range(1,50):  
        for y in range(x,50):
            for z in range(y,50):
                fn=x*x+y*y+z*z+x*y+y*z+z*x
                if fn==n and x==y and x==z:
                    s=s+1
                if fn==n and x<y and y==z:
                    s=s+3
                if fn==n and x==y and y<z:
                    s=s+3              
                if fn==n and x<y and y<z:
                    s=s+6    
    print(s)  

### FIXED CODE ###

l, r, D = input().split()
L=int(l)
R=int(r)
d=int(D)
s=0
for i in range(L,R+1):
    if i%d==0:
        s=s+1
print(s)
c11,c12,c13=input().split()
c21,c22,c23=input().split()
c31,c32,c33=input().split()
print(str(c11)+str(c22)+str(c33))


### FIXED CODE ###

a=str(input())
b=str(input())
c=str(input())
print(a[0]+b[1]+c[2])