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

from collections import Counter
for i in t:
  if d[i] < t[i]:
    print('NO')
    exit()
print('YES')


### FIXED CODE ###

from collections import Counter
n=int(input())
d=Counter(map(int,input().split()))
m=int(input())
t=Counter(map(int,input().split()))
for i in t:
  if d[i] < t[i]:
    print('NO')
    exit()
print('YES')
N = int(input())
graph = [[] for _ in range(N)]

for i in range(N-1):
    u, v, w = map(int, input().split())
    graph[u-1].append((v-1, w))
    graph[v-1].append((u-1, w))
# これによって木が定義できた
# print(graph)

flag = [None for _ in range(N)]  # まだどの頂点も探索していない


def k(v, distance):  # distanceは0or1
    flag[v] = distance  # 最初は0

    for next_v, w in graph[v]:
        if flag[next_v] == 1 or flag[next_v] == 0:  # 到達済み（親）であればcontinue
            continue
        if (w % 2) == 0:  # そのノードへの距離が偶数であればそのまま（最初は0なので）
            k(next_v, distance)
        else:
            k(next_v, 1-distance)


k(0, 0)  # 親を強制的に決めてよい, この場合は0のノードを親にしている
for i in range(N):
    print(int(flag[i]))


### FIXED CODE ###

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

hoge = ""
for i in range(len(S)):
    if i == K-1:
        hoge += S[i].lower()
    else:
        hoge += S[i]

print(hoge)
while True:
    (a, op, b) = [int(i) if i.isdigit() else i for i in input()]

    if op == '?':
        break
    elif op == '+':
        print(a + b)
    elif op == '-':
        print(a - b)
    elif op == '*':
        print(a * b)
    elif op == '/':
        print(a // b)

### FIXED CODE ###

while True:
    (a, op, b) = [int(i) if i.isdigit() else i for i in input().split()]
 
    if op == '?':
        break
    elif op == '+':
        print(a + b)
    elif op == '-':
        print(a - b)
    elif op == '*':
        print(a * b)
    elif op == '/':
        print(a // b)
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 11 14:44:47 2018
ABC046C
@author: maezawa
"""
import math
n = int(input())
ti, ai = list(map(int, input().split()))
vp = ti + ai
tp = ti
ap = ai
for i in range(1,n):
    ti, ai = list(map(int, input().split()))
    niv = vp/(ti+ai)
    nit = tp/ti
    nia = ap/ai
    ni = math.ceil(max(niv, nit, nia))
    vi = ni*(ti+ai)
    #print(ni, vi)
    tp = ni*ti
    ap = ni*ai

print(vi)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sat Aug 11 14:44:47 2018
ABC046C
@author: maezawa
"""
import math
n = int(input())
tp = 1
ap = 1
for i in range(n):
    ti, ai = list(map(int, input().split()))
    #nit = math.ceil(tp/ti)
    #nia = math.ceil(ap/ai)
    nit = -tp//ti
    nia = -ap//ai
    ni = max(-nit, -nia)
    vi = ni*(ti+ai)
    #print(ni, vi)
    tp = ni*ti
    ap = ni*ai

print(vi)
x,y = [int(i) for i in input().split()]
area = x*y
length = (x*2)+(y*2)
print(area+" "+length)

### FIXED CODE ###

x,y = [int(i) for i in input().split()]
area = x*y
length = (x*2)+(y*2)
print(area,length)
a,b,c=map(int,input().split())
d=[]
for i in range(a,b+1):
	d.append(i)
#print(d)
e=[]
if c<b:
	for i in range(c):
		e.append(d[i])
		e.append(d[-i-1])
else:
	for i in d:
		print(i)


e=set(e)
e=list(e)
e.sort()
for i in e:
	print(i)


### FIXED CODE ###

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

if b-a+1>2*c:
	x=[i for i in range(a,a+c)]
	y=[i for i in range(b-c+1,b+1)]
	e=x+y
else:
	e=[i for i in range(a,b+1)]
#print(e)
for i in e:
	print(i)
h,w,a,b = map(int, input().split())

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 = h+w
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 = cmb(n,r,mod)
ans = 0
for i in range(b,w):
  ans += cmd(h-a-1+i, i, mod) * cmd(a-1+w-i-1, a-1, mod)
print(ans%mod)

### FIXED CODE ###

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

mod = 10**9+7 #出力の制限
N = h+w
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 )

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

ans = 0
for j in range(b,w):
  ans += cmb(h-a-1+j, j, mod) * cmb(a-1+w-j-1, a-1, mod)
print(ans%mod)
#!/usr/bin/python3
# -*- coding:utf-8 -*-

import heapq
import numpy

def main():
  na, nb, nc, k = map(int, input().split())
  As = sorted(list(map(int, input().split())), reverse=True)
  Bs = sorted(list(map(int, input().split())), reverse=True)
  Cs = sorted(list(map(int, input().split())), reverse=True)
  
  scores = [(-(As[0]+Bs[0]+Cs[0]), 0, 0, 0)]
  used = numpy.zeros((na, nb, nc), dtype=numpy.int)
  used[0, 0, 0] = 1
  for _ in range(k):
    (score, i, j, k) = heapq.heappop(scores)
    print(-score)
    if i + 1 < na and not used[i+1][j][k]:
      heapq.heappush(scores, (-(As[i+1]+Bs[j]+Cs[k]),   i+1, j,   k))
      used[i+1, j, k] = 1
    if j + 1 < nb and not used[i][j+1][k]:
      heapq.heappush(scores, (-(As[i]+Bs[j+1]+Cs[k]),   i,   j+1, k))
      used[i, j+1, k] = 1
    if k + 1 < nc and not used[i][j][k+1]:
      heapq.heappush(scores, (-(As[i]+Bs[j]+Cs[k+1]), i,   j,   k+1))
      used[i, j, k+1] = 1

if __name__=='__main__':
  main()



### FIXED CODE ###

#!/usr/bin/python3
# -*- coding:utf-8 -*-

import heapq

def main():
  na, nb, nc, K = map(int, input().split())
  As = sorted(list(map(int, input().split())), reverse=True)
  Bs = sorted(list(map(int, input().split())), reverse=True)
  Cs = sorted(list(map(int, input().split())), reverse=True)
  
  scores = [(-(As[0]+Bs[0]+Cs[0]), 0, 0, 0)]
  used = [(0, 0, 0)]
  def push(i, j, k):
    heapq.heappush(scores, (-(As[i] + Bs[j] + Cs[k]), i, j, k))
    
  for _ in range(K):
    (score, i, j, k) = heapq.heappop(scores)
    print(-score)
    for di, dj, dk in [[1,0,0], [0,1,0], [0,0,1]]:
      if not (i+di < na and j+dj<nb and k+dk < nc):
        continue        
      if (i+di, j+dj, k+dk) not in used:
        push(i+di, j+dj, k+dk)
        used.append((i+di, j+dj, k+dk))

if __name__=='__main__':
  main()
N
if N[0] == "7" or N[1] == "7" or N[2] == "7" : print ("yes")
else:print ("no")


### FIXED CODE ###

N = input()
if N[0] == "7" or N[1] == "7" or N[2] == "7" : print ("Yes")
else:print ("No")
s = raw_input()

ans = "yes"

for i in s:
    if s.count(s[i]) != 1:
        ans = "no"

print ans

### FIXED CODE ###

s = raw_input()

ans = "yes"

for i in s:
    if s.count(i) != 1:
        ans = "no"

print ans
n,l=map(int,input().split())
for i range(n):
  s=input()
s=s.sort()
print(*s,sep='')

### FIXED CODE ###

n,l=map(int,input().split())
s=sorted([input() for i in range(n)])
print(*s,sep="")
def quest_d():
    N = int(input())
    S = input()

    index_dict = {
        'R':0,
        'G':0,
        'B':0
    }
    for index in range(len(S)):
        index_dict[S[index]] = index_dict[S[index]] + 1

    if index_dict['R'] * index_dict['G'] * index_dict['B'] == 0:
        print(0)
        return

    rrr = combi_three(index_dict['R'])
    ggg = combi_three(index_dict['G'])
    bbb = combi_three(index_dict['B'])
    rrg = combi_three(index_dict['R'] + index_dict['G'])
    ggb = combi_three(index_dict['G'] + index_dict['B'])
    bbr = combi_three(index_dict['B'] + index_dict['R'])

    i = 0
    sum = 0
    while i < len(S):
        a = S[i]
        j = i
        while j < len(S) - 1:
            j += 1
            if S[j] == a:
                continue

            k = 2 * j - i
            if k < len(S):
                b = S[j]
                if S[k] != a and S[k] != b:
                    sum += 1
        i += 1
    print(combi_three(N) - sum - rrg - bbr - ggb + rrr + ggg + bbb)

if __name__ == '__main__':
    quest_d()

### FIXED CODE ###

def combi_three(n):
    if n < 3:
        return 0
    else:
        return int((n * (n - 1) * (n - 2)) / 6)

def quest_d():
    N = int(input())
    S = input()

    index_dict = {'R':0, 'G':0, 'B':0 }
    for index in range(N):
        index_dict[S[index]] = index_dict[S[index]] + 1

    if index_dict['R'] * index_dict['G'] * index_dict['B'] == 0:
        print(0)
        return

    rrr = combi_three(index_dict['R'])
    ggg = combi_three(index_dict['G'])
    bbb = combi_three(index_dict['B'])
    rrg = combi_three(index_dict['R'] + index_dict['G'])
    ggb = combi_three(index_dict['G'] + index_dict['B'])
    bbr = combi_three(index_dict['B'] + index_dict['R'])

    i = 0
    sum = 0
    while i < N:
        a = S[i]
        j = i
        while j < N - 1:
            j += 1
            if S[j] == a:
                continue

            k = 2 * j - i
            if k < N:
                b = S[j]
                if S[k] != a and S[k] != b:
                    sum += 1
        i += 1
    print(combi_three(N) - sum - rrg - bbr - ggb + rrr + ggg + bbb)

if __name__ == '__main__':
    quest_d()
from math import gcd

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

G = gcd(N, M)
L = N * M // G
n = N // G
m = M // G

ans = True
for k in range(G):
    if S[k * n] != T[k * m]:
        ans = False
        break
print(L if ans else -1)


### FIXED CODE ###

from fractions import gcd

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

G = gcd(N, M)
L = N * M // G
n = N // G
m = M // G

ans = True
for k in range(G):
    if S[k * n] != T[k * m]:
        ans = False
        break
print(L if ans else -1)
line = input().split()
n, m, k = int(line[0]), int(line[1]), int(line[2])
line = input().split()
a = [None] * n
for i in range(n):
    a[i] = int(line[i])
line = input().split()
b = [None] * m
for i in range(m):
    b[i] = int(line[i])

time = [[0 for j in range(n+1)] for i in range(m+1)]
for i in range(1,n+1):
    time[0][i] = time[0][i-1] + a[i-1]
for j in range(1,m+1):
    time[j][0] = time[j-1][0] + b[j-1]
ans = 0
for i in range(1,n+1):
    for j in range(1,m+1):
        if time[j-1][i-1] + a[i-1] > k or time[j-1][i-1] + b[i-1] > k or time[j-1][i-1] + a[i-1] + b[j-1] > k:
            break
        else:
            time[j][i] = time[j-1][i-1] + a[i-1] + b[j-1]
            ans = max(ans, i+j)
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
def line_to_int(): return int(sys.stdin.readline())
def line_to_each_int(): return map(int, sys.stdin.readline().split())
def line_to_list(): return list(map(int, sys.stdin.readline().split()))
def line_to_list_in_iteration(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
# def dp(init, i, j): return [[init]*i for i2 in range(j)]
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
from itertools import accumulate #A = [0]+list(accumulate(A))
import bisect #bisect.bisect_left(B, a), bisect.bisect_right(B,a)

n,m,k = line_to_each_int()
A = line_to_list()
B = line_to_list()

a, b = [0], [0]
a = [0]+list(accumulate(A))
b = [0]+list(accumulate(B))

ans, j = 0, m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)
n = int(input())
A = list(map(int,input().split()))

#ユーグリッドの互除法で、a,bを与えて、aをbで割ってあまりを計算する
#あまりがないときは、最後に割った数を返す（最大公約数）
#あまりがあるときは、bにあまりを入れて、再び計算する
def gcd(a,b):
	if b == 0:
		return a
	return gcd(b,a%b)


x = A[0]
for i in a[1:]:
	x = gcd(x,i)
print(x)

### FIXED CODE ###

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

#ユーグリッドの互除法で、a,bを与えて、aをbで割ってあまりを計算する
#あまりがないときは、最後に割った数を返す（最大公約数）
#あまりがあるときは、bにあまりを入れて、再び計算する
def gcd(a,b):
	if b == 0:
		return a
	return gcd(b,a%b)


x = A[0]
for i in A[1:]:
	x = gcd(x,i)
print(x)
#最小全域木　プリム法
from heapq import *

n=int(input())
xy=[]
for i in range(n):
    x,y=map(int,input().split())
    xy.append([x,y,i])

#今回の問題では,高々xが隣のやつとyが隣のやつを全部考えればよし
#（詳しくは解説pdfより）
x_sort = sorted(xy, key=lambda x: x[0])
y_sort = sorted(xy, key=lambda x: x[1])

cost = [[]for _ in range(n+3)] #cost[i]にはi番目から(j,k)でj番目にコストkかかる
for i in range(n-1):
    cost[x_sort[i][2]].append((x_sort[i+1][2],x_sort[i+1][0]-x_sort[i][0]))
    cost[x_sort[i+1][2]].append((x_sort[i][2],x_sort[i+1][0]-x_sort[i][0]))

    cost[y_sort[i][2]].append((y_sort[i+1][2],y_sort[i+1][1]-y_sort[i][1]))
    cost[y_sort[i+1][2]].append((y_sort[i][2],y_sort[i+1][1]-y_sort[i][1]))


used=[False]*(n+3)#頂点が最小全域木にもうすでに含まれているかどうか
q=[]
#すでに最小全域木が決まっている部分からまだ決まっていない部分への辺をヒープで管理
#(a,b)でaには向かう先の頂点,bにはかかるコスト
#ヒープで小さいコストからとりだせる

#初期条件
#はじめはどこでもよいので０番目スタートとする(0番目だけではコストは0)
used[0] = True
ans = 0

#0番目からの辺をすべてヒープに挿入
for to,cst in cost[0]:
    heappush(q,(cst,to))

#すでに決まっている最小全域木部分からまだ決まっていない部分を貪欲的にひたすら追加する
#はじめは初期条件の通り
while(len(q)!=0):
    c,ver=heappop(q)
  #すでに決まっている部分から一番小さいコストの辺を取り出す
    if used[ver] == True:
        continue
  #もしすでに最小全域木部分であればやり直し
  #そうでなければコストの分を加算し、新しい頂点を最小全域木部分に追加する
    ans += c
    used[ver] = True
  #新しく追加した頂点からの辺をヒープに追加する
    for to,cst in cost[ver]:
        heappush(q,(cst,to))
　#これを貪欲的に繰り返すことでうまくいくらしい
print(ans)


### FIXED CODE ###

#最小全域木　プリム法
from heapq import *

n=int(input())
xy=[]
for i in range(n):
    x,y=map(int,input().split())
    xy.append([x,y,i])

#今回の問題では,高々xが隣のやつとyが隣のやつを全部考えればよし
#（詳しくは解説pdfより）
x_sort = sorted(xy, key=lambda x: x[0])
y_sort = sorted(xy, key=lambda x: x[1])

cost = [[]for _ in range(n+3)] #cost[i]にはi番目から(j,k)でj番目にコストkかかる
for i in range(n-1):
    cost[x_sort[i][2]].append((x_sort[i+1][2],x_sort[i+1][0]-x_sort[i][0]))
    cost[x_sort[i+1][2]].append((x_sort[i][2],x_sort[i+1][0]-x_sort[i][0]))

    cost[y_sort[i][2]].append((y_sort[i+1][2],y_sort[i+1][1]-y_sort[i][1]))
    cost[y_sort[i+1][2]].append((y_sort[i][2],y_sort[i+1][1]-y_sort[i][1]))


used=[False]*(n+3)#頂点が最小全域木にもうすでに含まれているかどうか
q=[]
#すでに最小全域木が決まっている部分からまだ決まっていない部分への辺をヒープで管理
#(a,b)でaには向かう先の頂点,bにはかかるコスト
#ヒープで小さいコストからとりだせる

#初期条件
#はじめはどこでもよいので０番目スタートとする(0番目だけではコストは0)
used[0] = True
ans = 0

#0番目からの辺をすべてヒープに挿入
for to,cst in cost[0]:
    heappush(q,(cst,to))

#すでに決まっている最小全域木部分からまだ決まっていない部分を貪欲的にひたすら追加する
#はじめは初期条件の通り
while(len(q)!=0):
    c,ver=heappop(q)
#すでに決まっている部分から一番小さいコストの辺を取り出す
    if used[ver] == True:
        continue
#もしすでに最小全域木部分であればやり直し
#そうでなければコストの分を加算し、新しい頂点を最小全域木部分に追加する
    ans += c
    used[ver] = True
#新しく追加した頂点からの辺をヒープに追加する
    for to,cst in cost[ver]:
        heappush(q,(cst,to))
#これを貪欲的に繰り返すことでうまくいくらしい
print(ans)
n, a, b = list(map(int, input().split()))
ans = (n//(a+b)) * a)
ans += n % (a+b) if (n % (a+b)) <= a) else a
print()

### FIXED CODE ###

l = input().split()

[n,a,b] = [int(x) for x in l]

if a==b and a==0:
    print(0)
else:
    x = a+b
    y = n//x

    if a == 0:
        print(0)
    else:
        if b == 0:
            print(n)
        else:
            t = n - y*x
            if t > a:
                print(y*a+a)
            else:
                print(y*a+t)
our code goes here
#15rectangle
H,W=(int(i) for i in input().split())
while H!=0 or W!=0:
    for i in range(H-1):
        S=""
        for j in range(W):
            S+="#"
        print(S)
    S=""
    for j in range(W):
        S+="#"
    print(S, end="")
    H,W=(int(i) for i in input().split())
    if H!=0 or W!=0:
        print("\n")

### FIXED CODE ###

#15rectangle
H,W=(int(i) for i in input().split())
while H!=0 or W!=0:
    for i in range(H-1):
        S=""
        for j in range(W):
            S+="#"
        print(S)
    S=""
    for j in range(W):
        S+="#"
    print(S, end="")
    H,W=(int(i) for i in input().split())
  #  if H!=0 or W!=0:
    print("\n")
N = list(map(int,input().split()))

p = [i%2 for i in N]

ans = 0

if sum(p) == 0 or sum(p) == 3:
    m = max(N)
    for i in N:
        ans += (m-i)//2
elif sum(p) == 1:
    for i in range(3):
        if N[i]%2 == 0:
            N[i] += 1
    ans += 1
    m = max(N)
    for i in N:
        ans += (m-i)//2
else:
    for i in range(3):
        if N[i]%2 == 1:
            N[i] += 1
    ans += 1
    for i in N:
        ans += (m-i)//2

print(ans)

### FIXED CODE ###

A = list(map(int,input().split()))
A.sort()
B = []
for i in A:
    B.append(i%2)

ans = 0

if B.count(1) == 1:
    for i in range(3):
        if B[i] == 0:
            A[i] += 1
    ans += 1
elif B.count(0) == 1:
    for i in range(3):
        if B[i] == 1:
            A[i] += 1
    ans += 1

ans += A[2] - A[1]
A[0] += A[2] - A[1]
ans += (A[2]-A[0])//2

print(ans)
import math

d=math.gcd(a,b)

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
  
r=make_divisors(d)
l=len(r)
ans=1
w=[True]*l
if l>=2:
  for x in range(1,l):
    if w[x]==True:
      ans+=1
      for y in range(x,l):
        if r[y]%r[x]==0:
          w[y]=False
          
print(ans)

### FIXED CODE ###

a,b=map(int,input().split())
import math

d=math.gcd(a,b)

def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]
  
r=make_divisors(d)
l=len(r)
ans=1
w=[True]*l
if l>=2:
  for x in range(1,l):
    if w[x]==True:
      ans+=1
      for y in range(x,l):
        if r[y]%r[x]==0:
          w[y]=False
          
print(ans)
k,x = map(int,input().split())
p = [x-k+1+i for i in range(2*k-1)]
print(q)

### FIXED CODE ###

k,x = map(int,input().split())
p = [x-k+1+i for i in range(2*k-1)]
q = [str(j) for j in p]
r = " ".join(q)
print(r)
import numpy as np
from numba import njit
@nJit
def D_160():
    N, X, Y = map(int, input().split())
    count_list = [[0]*N for i in range(N)]
    for i in range(0,N):
        for j in range(i,N):
            count_list[i][j] = min(j-i,abs(X-1-i) + abs(j-(Y-1)) + 1)
    
    #print(count_list)
    count_list = sum(count_list,[])
    
    for i in range(1,N):
        print(count_list.count(i))

D_160()

### FIXED CODE ###


def D_160():
    N, X, Y = map(int, input().split())
    #count_list = [[0]*N for i in range(N)]
    ans = [0 for i in range(N-1)]
    for i in range(0,N):
        for j in range(1+i,N):
            ans_i = min(j-i,abs((X-1)-i) + abs(j-(Y-1)) + 1)
            ans[ans_i-1] += 1
    
    
    for i in ans:
        print(i)

D_160()
n = int(input())
lists =[int(input()) for i in range(n)]
sums = sum(lists)
maxs = max(lists)
print(sums-max//2)


### FIXED CODE ###

n = int(input())
lists =[int(input()) for i in range(n)]
sums = sum(lists)
maxs = max(lists)
print(sums-maxs//2)
N, M = map(int, input().split())
nodes = [[] for _ in range(N)]

for _ in range(M):
  x, y = map(int, input().split())
  nodes[x-1].append(y-1)

dp = [-1] * N

def judge(index):
  if dp[index] != -1:
    return dp[index]
  else:
    edges = 0
    for i in nodes[index]:
      edges = max(edges, 1+judge(i))
    dp[index] = edges
    return dp[index]

answer = 0  
for i in range(N):
  answer = max(answer, judge(i))
print(answer)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5 + 1)

N, M = map(int, input().split())
nodes = [[] for _ in range(N)]

for _ in range(M):
  x, y = map(int, input().split())
  nodes[x-1].append(y-1)

dp = [-1] * N

def judge(index):
  if dp[index] != -1:
    return dp[index]
  else:
    edges = 0
    for i in nodes[index]:
      edges = max(edges, 1+judge(i))
    dp[index] = edges
    return edges

answer = 0  
for i in range(N):
  answer = max(answer, judge(i))
print(answer)
l = int(input());

ans = (l / 3) ^ 3;

print(ans);


### FIXED CODE ###

l = int(input());

ans = (l / 3) ** 3;

print(ans);
import numpy as np
n = input()
x = input().split()
n = int(n)
x = list(map(int,x))
x = np.array(x)
maxed = np.max(x)
cand = []

for p in range(1,maxed):
    xp = (x - p) ** 2
    cand.append(np.sum(xp))
y = np.min(cand)
print(y)

### FIXED CODE ###

import numpy as np
n = input()
x = input().split()
n = int(n)
x = list(map(int,x))
x = np.array(x)
maxed = np.max(x)
cand = []

for p in range(1,maxed+1):
    xp = (x - p) ** 2
    cand.append(np.sum(xp))
y = np.min(cand)
print(y)
s=list(map(len,input().split("T")))
x,y=map(int,input().split())
def f(t,i,w):
    if i==0:
        return w==0
    return f(t,i-1,w-t[i-1]) or f(t,i-1,w+t[i-1])
print(["No","Yes"][f(sorted(s[2::2]),len(s[2::2]),x-s[0]) and f(sorted(s[1::2]),len(s[1::2]),y)])

### FIXED CODE ###

s=list(map(len,input().split("T")))
x,y=map(int,input().split())
def f(t,w):
    m=[{} for i in range(len(t)+1)]
    m[0][0]=1
    for i in range(len(t)):
        for z in m[i]:
            m[i+1][z+t[i]]=1
            m[i+1][z-t[i]]=1
    return w in m[len(t)]
print(["No","Yes"][f(s[2::2],x-s[0]) and f(s[1::2],y)])
a,b = [int(x) for x in split().input()]
if a%3==0 or b%3==0 or (a+b)%3==0:
  print("Possible")
else:
  print("Impossible")

### FIXED CODE ###

a,b = [int(x) for x in input().split()]
if a%3==0 or b%3==0 or (a+b)%3==0:
  print("Possible")
else:
  print("Impossible")
x, n = input().split(' ')
line = input()
if line == '':
    print(x)
    exit()

x = int(x)

alist = line.split(' ')
for i in range(int(n)):
    alist[i] = int(alist[i])
if not x in alist:
    print(x)
    exit()

blist = [i for i in range(1,101)]
bset = set(blist)
aset = set(alist)
cset = bset-aset
clist = list(cset)
clist.append(x)
clist.sort()

count = 0
for i,v in enumerate(clist):
    if v == x:
        count = i
        print(len(clist),i,v,x)
if count == 0:
    print(clist[1])
elif count == len(clist)-1:
    print(clist[-2])
else:
    minx = x - clist[count-1]
    maxx = clist[count+1]-x
    if minx > maxx:
        print(clist[count+1])
    else:
        print(clist[count-1])

### FIXED CODE ###

x, n = input().split(' ')
line = input()
if line == '':
    print(x)
    exit()

x = int(x)

alist = line.split(' ')
for i in range(int(n)):
    alist[i] = int(alist[i])
if not x in alist:
    print(x)
    exit()

blist = [i for i in range(0,102)]
bset = set(blist)
aset = set(alist)
cset = bset-aset
clist = list(cset)
clist.append(x)
clist.sort()

count = 0
for i,v in enumerate(clist):
    if v == x:
        count = i
if count == 0:
    print(clist[1])
elif count == len(clist)-1:
    print(clist[-2])
else:
    minx = x - clist[count-1]
    maxx = clist[count+1]-x
    if minx > maxx:
        print(clist[count+1])
    else:
        print(clist[count-1])
import math
n = int(input())
a = [int(input()) for _ in range(n)]
print(math.ceil(n/min(a))+4)

### FIXED CODE ###

import math
n = int(input())
tra = [int(input()) for i in range(5)]
print(math.ceil(n/min(tra))+4)
A,B,C = map(int,input().split())
abc = [A,B,C]
Even = []
Odd = []
for i in range(3):
    if min(abc) == abc[i]:
        idx1 = i
    elif max(abc) == abc[i]:
        idx3 = i
    else:
        idx2 = i
    if abc[i]%2 == 0:
       Even += [i]
    else:
       Odd += [i]
       
ans = 0

if len(Even) == 3 or len(Odd) == 3:
    ans = (abc[idx3]-abc[idx2])//2 + (abc[idx3]-abc[idx1])//2
elif len(Even) == 2:
    ans += 1
    abc[Even[0]] += 1
    abc[Even[1]] += 1
    ans += (abc[idx3]-abc[idx2])//2 + (abc[idx3]-abc[idx1])//2
elif len(Odd) == 2:
    ans += 1
    abc[Odd[0]] += 1
    abc[Odd[1]] += 1
    ans += (abc[idx3]-abc[idx2])//2 + (abc[idx3]-abc[idx1])//2
    
print(ans)
    



### FIXED CODE ###

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

abc = [A,B,C]
ieven = []
iodd = []
for i in range(3):
    if abc[i] % 2 == 0:
        ieven += [i]
    else:
        iodd += [i]
        
if len(ieven) == 3 or len(iodd) == 3:
    abc.sort()
    ans = (abc[2]-abc[1])//2 + (abc[2]-abc[0])//2
else:
    if len(ieven) > len(iodd):
        abc[ieven[0]] += 1
        abc[ieven[1]] += 1
        abc.sort()
        ans = 1 + (abc[2]-abc[1])//2 + (abc[2]-abc[0])//2
    else:
        abc[iodd[0]] += 1
        abc[iodd[1]] += 1
        abc.sort()
        ans = 1 + (abc[2]-abc[1])//2 + (abc[2]-abc[0])//2
        
print(ans)