Harryxun/stf_run huggingface dataset:
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i],y[i] = map(int,input().split())

memo = {}

for i in range(N-1):
    for j in range(i+1,N):
        dx = abs(x[j] - x[i])
        dy = abs(y[j] - y[i])
        if (dx,dy) in memo:
            memo[(dx,dy)] += 1
        else:
            memo[(dx,dy)] = 1

M = max(memo.values())

print(N-M)


### FIXED CODE ###

N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i],y[i] = map(int,input().split())

if N == 1:
    print(1)
else:
    memo = {}

    for i in range(N-1):
        for j in range(i+1,N):
            dx = x[j] - x[i]
            dy = y[j] - y[i]
            if (dx,dy) in memo:
                memo[(dx,dy)] += 1
            elif (-dx,-dy) in memo:
                memo[(-dx,-dy)] += 1
            else:
               memo[(dx,dy)] = 1
            #print(memo)

    M = max(memo.values())

    print(N-M)
x=int(input())
for i in range(10**5):
	if int(i*(i-1)/2)<x<=int(i*(i+1)/2):
    	print(i)
        break

### FIXED CODE ###

x=int(input())
i=0
while i<=10**5:
    if int(i*(i-1)/2)<x<=int(i*(i+1)/2):
        print(i)
        break
    else:
        i+=1
N = input()

if N % 2 == 0:
    print((N/2)/N)
else:
    print(((N+1)/2)/N)
    


### FIXED CODE ###

N = int(input())

if N % 2 == 0:	
    print((N/2)/N)
else:
    print(((N+1)/2)/N)
s=input().split()
c=0
if s[0]==1:
    c+=1
if s[1]==1:
    c+=1
if s[2]==1:
    c+=1

print(c)

### FIXED CODE ###

import re

s=re.findall(r"1",input())
print(len(s))
h = int(input())
a = int(input())

if h % a == 0:
    print(h / a)
else:
    print(h // a + 1)


### FIXED CODE ###

h,a = map(int,input().split())

if h % a == 0:
    print(h // a)
else:
    print(h // a + 1)
N, K = map(int, input().split())
r = N - K
mod = 10 ** 9 + 7
dp1 = [[0] * (K) for _ in range(K)]
dp2 = [[0] * (r + 2) for _ in range(r + 2)]

for i in range(K):
	for j in range(K):
		if i == 0:
			dp1[i][j] = 1
		elif j == 0:
			dp1[i][j] = 0
		else:
			dp1[i][j] = (dp1[i - 1][j - 1] + dp1[i][j - 1]) % mod

for i in range(r + 2):
	for j in range(r + 2):
		if i == 0:
			dp2[i][j] = 1
		elif j == 0:
			dp2[i][j] = 0
		else:
			dp2[i][j] = (dp2[i - 1][j - 1] + dp2[i][j - 1]) % mod
			
for i in range(K):
	print((dp1[i][-1] * dp2[i + 1][-1]) % mod)


### FIXED CODE ###

N, K = map(int, input().split())
r = N - K
mod = 10 ** 9 + 7
dp1 = [[0] * (K) for _ in range(K)]
dp2 = [[0] * (r + 2) for _ in range(K + 1)]

for i in range(K):
	for j in range(K):
		if i == 0:
			dp1[i][j] = 1
		elif j == 0:
			dp1[i][j] = 0
		else:
			dp1[i][j] = (dp1[i - 1][j - 1] + dp1[i][j - 1]) % mod

for i in range(K + 1):
	for j in range(r + 2):
		if i == 0:
			dp2[i][j] = 1
		elif j == 0:
			dp2[i][j] = 0
		else:
			dp2[i][j] = (dp2[i - 1][j - 1] + dp2[i][j - 1]) % mod
			
for i in range(K):
	print((dp1[i][-1] * dp2[i + 1][-1]) % mod)
A-2*B

### FIXED CODE ###

A,B=input().split()
length = int(A) - 2 * int(B)
if length < 0:
    print(0)
else:
    print(length)
from collections import Counter
import numpy as np

MOD = 10 ** 9 + 7

n = int(input())
a = list(map(int, input().split()))
count = Counter(a)
# 0の個数は、count[0]
num = len(a)
ans = 1


if (num % 2 == 0):
    # 偶数パターン
    temp = 1
    loop = int(num / 2)
    for i in range(loop):
        tar = count[temp]
        if (tar == 2):
            ans *= 2
            temp += 2
        else:
            print(0)
            exit()

else:

    tar0 = count[0]
    if (tar0 == 1):
        pass
    else:
        print(0)
        exit()

    temp = 2

    for i in range(num // 2):
        if (count[temp] == 2):
            ans *= 2
            temp += 2
        else:
            print(0)
            exit()

ans % = MOD
print(ans)


### FIXED CODE ###

from collections import Counter
import numpy as np

MOD = 10 ** 9 + 7

n = int(input())
a = list(map(int, input().split()))
count = Counter(a)
# 0の個数は、count[0]
num = len(a)
ans = 1


if (num % 2 == 0):
    # 偶数パターン
    temp = 1
    loop = int(num / 2)
    for i in range(loop):
        tar = count[temp]
        if (tar == 2):
            ans *= 2
            temp += 2
        else:
            print(0)
            exit()

else:

    tar0 = count[0]
    if (tar0 == 1):
        pass
    else:
        print(0)
        exit()

    temp = 2

    for i in range(num // 2):
        if (count[temp] == 2):
            ans *= 2
            temp += 2
        else:
            print(0)
            exit()

ans %= MOD
print(ans)
h,w=map(int,input().split())
ans=h*w
for i in range(1,h):ans=min(ans,max(i*w,(h-i)*(w//2),(h-i)*((w-1)//2)+1)-min(i*w,(h-i)*(w//2),(h-i)*((w-1)//2)+1)
for i in range(1,w):ans=min(ans,max(i*h,(w-i)*(h//2),(w-i)*((h-1)//2)+1)-min(i*h,(w-i)*(h//2),(w-i)*((h-1)//2)+1)
print(ans)

### FIXED CODE ###

h,w=map(int,input().split())
ans=h*w
for i in range(1,h):
  a=w*i
  bb=w//2
  cc=(w-1)//2+1
  b=(h-i)*bb
  c=(h-i)*cc
  ans=min(ans,max(a,b,c)-min(a,b,c))
  bb=(h-i)//2
  cc=((h-i)-1)//2+1
  b=w*bb
  c=w*cc
  ans=min(ans,max(a,b,c)-min(a,b,c))
for i in range(1,w):
  a=h*i
  bb=h//2
  cc=(h-1)//2+1
  b=(w-i)*bb
  c=(w-i)*cc
  ans=min(ans,max(a,b,c)-min(a,b,c))
  bb=(w-i)//2
  cc=((w-i)-1)//2+1
  b=h*bb
  c=h*cc
  ans=min(ans,max(a,b,c)-min(a,b,c))
print(ans)
import numpy as np

n, m, l=map(int, input().split(" "))

A = np.matrix([ [ int(a) for a in input().split() ] for i in range(n) ])
B = np.matrix([ [ int(b) for b in input().split() ] for i in range(m) ])
C = A.dot(B)


for i in range(l):
    out_C = ""
    for j in range(n):
        out_C = out_C + " " + str(C[i, j])
    
    print(out_C.strip()) 

### FIXED CODE ###

n, m, l=map(int, input().split(" "))

A = [ [ int(a) for a in input().split() ] for i in range(n) ]
B = [ [ int(b) for b in input().split() ] for i in range(m) ]
C = [ [ 0 for i in range(l) ] for i in range(n) ]

for i in range(n):
    for j in range(l):
        for jj in range(m):
                 C[i][j] = C[i][j] + A[i][jj] * B[jj][j]

    print(" ".join([str(_) for _ in C[i]]))
# 2より大きい値段のものに高いものから順に割引券を振り分けていく
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
a = sorted(a, key=lambda x: -x)
coupon = [0 for i in range(n)]

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

i = 0
while m > 0 and v > 0:
    if len(a) == 1:
        coupon[i] = m
        break
    if a[i] > 2:
        l = a[i] // 2**(coupon[i]+1)
        if l >= 0:
            coupon[i] += 1
            if l == 0:
                v -= 1
        m -= 1
        i += 1
    elif a[i] <= 2 and m > 0:
        i = 0

total = 0
for i in range(n):
    if a[i] < 3 and m > 0:
      total += a[i] // 2
      m -= 1
    else:
      total += a[i] // 2**coupon[i]

print(total)

### FIXED CODE ###

import heapq
n,m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = []
for i in range(n):
    heapq.heappush(b, a[i] * (-1))

while m > 0:
    bb = ((heapq.heappop(b) * (-1)) // 2) * (-1)
    heapq.heappush(b, bb)
    m -= 1

total = 0
for i in range(n):
    total += b[i] * -1

print(total)
s = input()
if s % sum(map(int, list(s))):
  print("No")
else:
  print("Yes")

### FIXED CODE ###

s = input()
if int(s) % sum(map(int, list(s))):
  print("No")
else:
  print("Yes")
x, n = list(map(int, input().split()))
if not n:
  print(x) 
else:
  l = list(map(int, input().split()))
  dic = {} 
  for ll in l: dic[ll] = 1
  i = 1
  while true:
    if not dic.get(x-i,0):
      print(x-i)
      break
    elif not dic.get(x+i, 0):
      print(x+i) 
      break
    i+=1

### FIXED CODE ###

x, n = list(map(int, input().split()))
if not n:
  print(x) 
else:
  l = list(map(int, input().split()))
  dic = {} 
  for ll in l: dic[ll] = 1
  i = 0
  while True:
    if not dic.get(x-i,0):
      print(x-i)
      break
    elif not dic.get(x+i, 0):
      print(x+i) 
      break
    i+=1
import math
x,y = map(int,input().split())
sum_xy = x+y

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**6
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 )

if sum_xy%3!=0:
    print(0)
else:
    ab_sum = sum_xy//3
    a = x-ab_sum
    b = y-ab_sum
    if a<0 or b<0:
        print(0)
    else:
        print(cmb(ab_sum,a,inf))

### FIXED CODE ###

x, y = map(int, input().split())
if (x+y)%3 != 0:
    print(0)
    exit()

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**6
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 )
 
 
a = (2*x-y)//3
b = (2*y-x)//3
n = a+b
r = a
res = cmb(n,r,mod)
print(res)
import math
a,b,x=map(int,input().split())
f=b*(a**2)/2
if x>=f:
  y=2*(b*(a**2)-x)/(a**2)
  print(90-math.degrees(math.atan(a/y)))
else:
  y=2*x/(a*b)
  print(math.degrees(math.atan(b/y)))

### FIXED CODE ###

import math
a,b,x=map(int,input().split())
f=b*(a**2)/2
if x>=f:
  y=2*(b*(a**2)-x)/(a**2)
  if y==0:
    print(0)
    exit()
  print(90-math.degrees(math.atan(a/y)))
else:
  y=2*x/(a*b)
  if y==0:
    print(0)
    exit()
  print(math.degrees(math.atan(b/y)))
from heapq import *

def calcInk(wdt,val):
    maxval=val[-1]
    histnum=maxval//wdt
    hist=[]
    for i in range(histnum+1):
        hist.append([])
    vl=len(val)
    for i in range(vl):
        v=heappop(val)
        hist[v//wdt].append(v)
    
    highest=0
    for i in range(len(hist)):
        highest=max(highest,len(hist[i]))
    ink=0
    for i in range(len(hist)):
        ink+=(1-i/histnum)*(len(hist[i])/highest)
    return ink+0.01

if __name__=='__main__':
    while True:
        n,w=map(int,input().split())
        if n==w==0:
            break
        V=[]
        for _ in range(n):
            heappush(V,int(input()))

        INK=calcInk(w,V)
        print(INK)


### FIXED CODE ###

while 1:
    n,w=map(int,input().split())
    if n==w==0:break
    a=[0]*100
    s=h=int(0)
    while n:
        b=int(input())
        a[b//w]+=1
        s=max(s,b//w)
        h=max(h,a[b//w])
        n-=1
    ans=0.01
    for i in range(int(s)+1):
        ans+=a[i]/h*(s-i)/s
    print(ans)
S = list(input())
print(x*len(S))

### FIXED CODE ###

S = list(input())
print("x" * len(S))
def main():
    n = int(input())
    rate_count = [0] * 9
    a = tuple(map(int, input().split()))
    for ae in a:
        rank = ae // 400
        rate_count[rank] += 1

    reds =  rate_count[8]
    rate_count[8] = 0
    rc2 = [1 for rce in rate_count if rce > 0]
    res = sum(rc2)
    r_min = max(res, 1)
    r_max = min(8, res + reds)
    print(r_min, r_max)

if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    n = int(input())
    rate_count = [0] * 13
    a = tuple(map(int, input().split()))
    for ae in a:
        rank = ae // 400
        rate_count[rank] += 1

    reds = sum(rate_count[8:])
    res = 0
    for i1 in range(8):
        res += rate_count[i1] > 0
    r_min = max(res, 1)
    r_max = res + reds
    print(r_min, r_max)

if __name__ == '__main__':
    main()
lst = list(input())
print(sum(lst))

### FIXED CODE ###

lst = [int(x) for x in list(input())]
print(sum(lst))
H,W = input().split()
H,W=int(H),int(W)
sw=[[0]*W]*H

for i in range(W):
    sw[i] = input()

count=0
if sw[0][0]=='#':
    sw[0]='.'+sw[0][1:]
    count+=1
if sw[H-1][W-1]=='#':
    sw[H-1]=sw[H-1][:W-1]+'.'
    count+=1

def search(h,v):
    global H,W
    global sw
    if h==H-1 and v==W-1:
        return -2,-2
    elif v>=H-1 or h>=W-1:
        return -1,-1
    else:
        if sw[h+1][v]=='.':
            return h+1,v
        elif sw[h][v+1]=='.':
            return h,v+1
        else:
            return -1,-1

P=[[0,0]]
next=[]
i=0
plus=True
while(1):
    flag=False
    for p in P:
        for j in range(i+1):
            if p[0]+i-j>=W or p[1]+j>=H:
                continue
            result=search(p[0]+i-j,p[1]+j)
            #print('search',p[0]+i-j,p[1]+j,count)
            if result==(-2,-2):
                print(count)
                exit()
            elif result!=(-1,-1):
                next.append(result)
                flag=True
                i=0
                
    if not flag:
        #print('yaa')
        i+=1
        if plus:
            count+=1
        plus=False
    else:
        plus=True
        #print('next',next,count)
        P=[]
        P=next
        next=[]


### FIXED CODE ###

import numpy as np

H,W = input().split()
H,W=int(H),int(W)
P=[0]*H
for i in range(H):
    P[i] = input()

dp=np.zeros((H,W),dtype='u8')
if P[0][0]=='#':
    dp[0][0]=1
else:
    dp[0][0]=0

def DP(y,x):
    global dp
    if 0<=x<=W-1 and 0<=y<=H-1:
        return dp[y][x]
    else:
        return 9999999

for l in range(1,H+W):
    for i in range(l+1):
        if i<H and l-i<W:
            if P[i][l-i]=='#':
                a=DP(i-1,l-i)
                b=DP(i,l-i-1)
                if a < 9999999:
                    if P[i-1][l-i]=='.':
                        a+=1
                if b <  9999999:
                    if P[i][l-i-1]=='.':
                        b+=1
                dp[i][l-i]=min(a,b)
            else:
                #print(i,l-i,DP(i-1,l-i),DP(i,l-i-1))
                dp[i][l-i]=min(DP(i-1,l-i),DP(i,l-i-1))
print(dp[H-1][W-1])
# coding: utf-8
# Your code here!

a = raw_input().lower()
s = a.split()
ss = ""
tmp = ""
n = 0
for i in s:
    if len(ss) < len(i):
        ss = i
for i in s:
    i+=" " 
    if a.count(i) > n:
        n = a.count(i)
        tmp = i.trip()
print tmp, ss


### FIXED CODE ###

word = sorted(input().split())
length = len(word)
cnt = 0
cc = ""
w = ""
wc = 0
for i in word:
    if cnt < len(i):
        cnt = len(i)
        cc = i
for i in range(length):
    if word.count(word[i]) > wc:
        wc = word.count(word[i])
        w = word[i]
print(w, cc)
s=list(map(int,input().split()))
a=max(s)*3-sum(s)
if a%2==1
    a+=3
print(a//2)

### FIXED CODE ###

s=list(map(int,input().split()))
a=max(s)*3-sum(s)
if a%2==1:
    a+=3
print(a//2)
from math import gcd

A, B, K = map(int, input().split())
l = []

for i in range(1, gcd(A, B) + 1):
    if A % i == 0 and B % i == 0:
        l.append(i)

print(l[-K])

### FIXED CODE ###

A, B, K = map(int, input().split())
l = []

for i in range(1, min(A, B) + 1):
    if A % i == 0 and B % i == 0:
        l.append(i)

print(l[-K])
from math import *
data = list(map(int,input().split()))
print("%f %f %f" %(b*cos(radians(c))*a/2,a+b+b*sin(radians(c)),b*sin(radians(c))))


### FIXED CODE ###

from math import *
a,b,c = map(int,input().split())
c = radians(c)
S = a*b*sin(c)/2
print("%.10f %.10f %.10f" %(S,a+b+sqrt(a*a+b*b-2*a*b*cos(c)),2*S/a ))
N, X = map(int, input().split())
    L = list(map(int, input().split()))
    cnt = 1
    a = 0

    for i in range(len(L)):
        a += L[i]
        if a <= X:
            cnt += 1
    print(cnt)

### FIXED CODE ###

N, X = map(int, input().split())    
L = list(map(int, input().split()))
    
cnt = 1
    
a = 0

    
for i in range(len(L)):
    a += L[i]
    if a <= X:
        cnt += 1

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

A = [0 for _ in range(M)]
B = [0 for _ in range(M)]
S = set()
for i in range(M):
    A[i] , B[i] = map(int, input().split())



class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

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

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


uf = UnionFind(N)
for i in range(M):
    uf.union(A[i], B[i])
print(uf.group_count()-1)
    

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

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

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

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

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

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

A = [0 for _ in range(M)]
B = [0 for _ in range(M)]
for i in range(M):
    A[i] , B[i] = map(int, input().split())
    A[i] -= 1
    B[i] -= 1






uf = UnionFind(N)
for i in range(M):
    uf.union(A[i], B[i])
print(uf.group_count()-1)
import sys

N=input()
a=map(int, raw_input().split())
#print a
#print max(a)

dict={}


for i in range(len(a)):
	if a[i] in dict:
		dict[ a[i] ]+=1 
	else:
		dict[ a[i] ]=1
		#print dict


for j in range(max(a)):
	if not j in dict:
		dict[j]=0

#print dict

max_sum=0
for key,value in dict.items():
	if key==0:
		sum=dict[key]+dict[key+1]
	elif key==max(a):
		sum=dict[key-1]+dict[key]
	else:
		sum=dict[key-1]+dict[key]+dict[key+1]
	#print key,sum

	if max_sum<sum:
		max_sum=sum

print max_sum




### FIXED CODE ###

import sys

N=input()
a=map(int, raw_input().split())
#print a
#print max(a)

dict={}


for i in range(len(a)):
	if a[i] in dict:
		dict[ a[i] ]+=1 
	else:
		dict[ a[i] ]=1

#print dict

max_sum=0
for key,value in dict.items():
	#print key,value
	sum=dict[key]
	if key-1 in dict:
		sum+=dict[key-1]
	if key+1 in dict:
		sum+=dict[key+1]

	if max_sum<sum:
		max_sum=sum

print max_sum
import numpy as np

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

H = np.array(map(int, input().split()))

dp = np.zero(N, dtype=int)

for i in range(1, N):
    start = max(0, i-K)
            dp[i] = min(dp[start:i]+np.abs(H[i]-H[start:i]))

print(dp[N-1])

### FIXED CODE ###

import numpy as np

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

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

dp = np.zeros(N, dtype=int)

for i in range(1, N):
    start = max(0, i-K)
    dp[i] = min(dp[start:i]+np.abs(H[i]-H[start:i]))

print(dp[N-1])
N = int(input())
A = [list(map(int,input().split())) for i in range(N)]

es = [[[] for j in range(i)] for i in range(N)]
indeg = [[0]*i for i in range(N)]
for i,row in enumerate(A):
    for x,y in zip(row,row[1:]):
        x,y = x-1,y-1
        a0,b0 = (i,x) if i>x else (x,i)
        a1,b1 = (i,y) if i>y else (y,i)
        es[a0][b0].append((a1,b1))
        indeg[a1][b1] += 1

status = [[-1]*i for i in range(N)] #-1:new 0:active 1:finished
def has_cycle(v):
    a0,b0 = v
    status[a0][b0] = 0
    for a1,b1 in es[a0][b0]:
        if status[a1][b1] == 0: return True
        if status[a1][b1] == -1:
            if has_cycle((a1,b1)): return True
    status[a0][b0] = 1
    return False

for i in range(N):
    for j in range(i):
        if status[i][j] != -1: continue
        if has_cycle((i,j)):
            print(-1)
            exit()

from collections import deque
q = deque()
for i in range(N):
    for j in range(i):
        if indeg[i][j] == 0:
            q.append((i,j,1))

ans = -1
while q:
    a0,b0,d = q.popleft()
    ans = max(ans,d)
    for a1,b1 in es[a0][b0]:
        indeg[a1][b1] -= 1
        if indeg[a1][b1] == 0:
            q.append((a1,b1,d+1))
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import deque

N = int(input())
A = [list(reversed(list(map(lambda x:int(x)-1,input().split())))) for i in range(N)]
B = {i:row for i,row in enumerate(A)}

end = 0
for k in range(8000):
    used = set()
    dels = []
    for i,q in B.items():
        if not q: continue
        if i in used: continue
        j = q[-1]
        if j in used: continue
        if A[j][-1] == i:
            A[j].pop()
            A[i].pop()
            used.add(i)
            used.add(j)
            if not A[i]:
                end += 1
                dels.append(i)
            if not A[j]:
                end += 1
                dels.append(j)
    if not used:
        print(-1)
        exit()
    if end == N:
        print(k+1)
        exit()
    for i in dels:
        del B[i]

print(N*(N-1)//2)
a=input()
c=list(map(int, input().split(" ")))
 
from statistics import mean, median,variance,stdev
 
if sum(list1)-max(list1)< max(list1):
    print("Yes")
else:
    print("No")

### FIXED CODE ###

x,y= map(int, input().split(" "))
print(x/y)
s = list(input())
if (s[0] == "A") and (s[2:-1].count("C")==1):
    s[0] = "a"
    s[s[2:-2].index("C")+2] = "c"
    l = list()
    for i in range(len(s)):
        l.append(s[i].lower())
    #(s,l)
    if s == l:
        print("AC")
        exit()
print("WA")

### FIXED CODE ###

s = list(input())
if (s[0] == "A") and (s[2:-1].count("C")==1):
    s[0] = "a"
    s[s[2:-1].index("C")+2] = "c"
    l = list()
    for i in range(len(s)):
        l.append(s[i].lower())
    #(s,l)
    if s == l:
        print("AC")
        exit()
print("WA")
N=int(input())
Vs=str(input())
Cs=str(input())
ListV=Vs.split()
ListC=Cs.split()
for i in range(0,len(ListV),1):
  a=ListV.pop(0)
  ListV.insert(0,int(a))

for i in range(0,len(ListC),1):
  b=ListC.pop(0)
  ListC.insert(0,int(b))

ListI=[]
for i in range(0,len(ListV),1):
  c=ListV[i]-ListC[i]
  ListI.append(0)

Ans=0
for i in range(0,len(ListI),1):
  if ListI[i]>0:
    Ans+=ListI[i]

print(Ans)

### FIXED CODE ###

N=int(input())
Vs=str(input())
Cs=str(input())
ListV=Vs.split()
ListC=Cs.split()
for i in range(0,len(ListV),1):
  a=ListV.pop(0)
  ListV.append(int(a))

for i in range(0,len(ListC),1):
  b=ListC.pop(0)
  ListC.append(int(b))

ListI=[]
for i in range(0,len(ListV),1):
  c=ListV[i]-ListC[i]
  ListI.append(c)

Ans=0
for i in range(0,len(ListI),1):
  if ListI[i]>0:
    Ans+=ListI[i]

print(Ans)
A,B,C,D = map(int,input().split())
import fractions
lcm = int( C*D / ( math.fractions(C,D) ) )

first_c = ( A - 1) // C
first_d = ( A - 1) // D
first_cd = ( A - 1) // lcm 
first = ( A - 1 ) - ( first_c + first_d - first_cd )

end_c = B // C
end_d = B // D
end_cd = B // lcm 
end_ = B - ( end_c + end_d - end_cd )

print(end_ - first)


### FIXED CODE ###

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

first_c = ( A - 1) // C
first_d = ( A - 1) // D
first_cd = ( A - 1) // lcm 
first = ( A - 1 ) - ( first_c + first_d - first_cd )

end_c = B // C
end_d = B // D
end_cd = B // lcm 
end_ = B - ( end_c + end_d - end_cd )

print(end_ - first)