Harryxun/stf_run huggingface dataset:
n,m=map(int,input().split())
l=[[] for i in range(n)]
for i in range(m):
    p=[int(j) for j in input().split()]
    l[p[1]-1].append(p[0]-1)

dp=[0 for i in range(n)]
from functools import lru_cache
@lru_cache(maxsize=1000000)
def f(n):
    if dp[n]!=0:
        return dp[n]
    for i in l[n]:
        dp[n]=max(dp[n],f(i)+1)
    return dp[n]

for i in range(n):
    f(i)

print(max(dp))

### FIXED CODE ###

n,m=map(int,input().split())
l=[[] for i in range(n)]
for i in range(m):
    p=[int(j) for j in input().split()]
    l[p[1]-1].append(p[0]-1)

dp=[-1]*n
import sys
sys.setrecursionlimit(10**6)
def f(v):
    if dp[v]!=-1:
        return dp[v]
    p=0
    for i in l[v]:
        p=max(p,f(i)+1)
    dp[v]=p
    return dp[v]

for i in range(n):
    f(i)

print(max(dp))
import collections

s = input()
K = int(input())

l = len(s)
sub = set()

if l <= 0:
    for i in range(l):
        for j in range(i+1):
            sub.add(s[j:i+1])
    #print(sub)
    subl = list(sub)
    subl.sort()
    #print(subl)
    print(subl[K-1])

else:
    cl = collections.Counter(s).most_common()
    cl.sort(key=lambda x: x[0])
    print(cl)
    be = cl[0][0]
    for i in range(l):
        if s[i] == be:
            for j in range(K):
                sub.add(s[i:i+j+1])
    #print(sub)
    subl = list(sub)
    subl.sort()
    print(subl[K-1])


### FIXED CODE ###

import collections

s = input()
K = int(input())

l = len(s)
sub = set()

if l <= 50:
    for i in range(l):
        for j in range(i+1):
            sub.add(s[j:i+1])
    #print(sub)
    subl = list(sub)
    subl.sort()
    #print(subl)
    print(subl[K-1])

else:
    cl = collections.Counter(s).most_common()
    cl.sort(key=lambda x: x[0])
    #print(cl)
    d = 0
    while len(sub) < K:
        be = cl[d][0]
        for i in range(l):
            if s[i] == be:
                for j in range(K):
                    sub.add(s[i:min(i+j+1,l)])
        d += 1
    #print(sub)
    subl = list(sub)
    subl.sort()
    print(subl[K-1])
h,w = map(int, input().split())
listA = [input() for i in range(h)]
for i in range(h):
  print(listA[i-1]\nlistA[i-1])


### FIXED CODE ###

h,w = map(int, input().split())
listA = [input() for i in range(h)]
for i in range(h):
  print(listA[i]+"\n"+listA[i])
s = list(input())
n = len(s)

def kaibun(st):
  sta = list()
  for k in range(len(st)//2):
    sta.append(st[k])
  for k in range(len(st)//2):
    if st[-(-len(st)//2)+k] != sta.pop():
      return False
  return True

if kaibun(s) == False:
  print('No')
elif kaibun(s[:(n-1)//2]) == No:
  print('No')
elif kaibun(s[(n+3)//2-1:]) == No:
  print('No')
else:
  print('Yes')


### FIXED CODE ###

s = list(input())
n = len(s)

def kaibun(st):
  sta = list()
  for k in range(len(st)//2):
    sta.append(st[k])
  for k in range(len(st)//2):
    if st[-(-len(st)//2)+k] != sta.pop():
      return False
  return True

if kaibun(s) == False:
  print('No')
elif kaibun(s[:(n-1)//2]) == False:
  print('No')
elif kaibun(s[(n+3)//2-1:]) == False:
  print('No')
else:
  print('Yes')
import bisect
a,b,q = map(int,input().split())
x = [int(input()) for i in range(a)]
y = [int(input()) for i in range(b)]
x.sort()
y.sort()
for i in range(q):
    z = int(input())
    ans = 1<<61
    n = bisect.bisect_left(x, z)
    if n<a:
        tmp = abs(x[n]-z)
        m = bisect.bisect_left(y, x[n])
        try:
            ans = min(ans,abs(y[m]-x[n])+tmp)
        except:
            pass
        try:
            ans = min(ans,abs(y[m-1]-x[n])+tmp)
        except:
            pass
    if n>0:
        tmp = abs(x[n-1]-z)
        m = bisect.bisect_left(y, x[n-1])
        try:
            ans = min(ans,abs(y[m]-x[n-1])+tmp)
        except:
            pass
        try:
            ans = min(ans,abs(y[m-1]-x[n-1])+tmp)
        except:
            pass

    n = bisect.bisect_left(y, z)
    if n<a:
        tmp = abs(y[n]-z)
        m = bisect.bisect_left(x, y[n])
        try:
            ans = min(ans,abs(y[n]-x[m])+tmp)
        except:
            pass
        try:
            ans = min(ans,abs(x[m-1]-y[n])+tmp)
        except:
            pass
    if n>0:
        tmp = abs(y[n-1]-z)
        m = bisect.bisect_left(x, y[n-1])
        try:
            ans = min(ans,abs(x[m]-y[n-1])+tmp)
        except:
            pass
        try:
            ans = min(ans,abs(x[m-1]-y[n-1])+tmp)
        except:
            pass
    print(ans)

### FIXED CODE ###

import bisect
import sys
input = sys.stdin.readline
a,b,q = map(int,input().split())
x = [int(input()) for i in range(a)]
y = [int(input()) for i in range(b)]
osoi = [int(input()) for i in range(q)]
x.sort()
y.sort()
xx = [0]*a
yy = [0]*b
n = 0
for i in range(a):
    while n < b-1 and abs(x[i]-y[n]) > abs(x[i]-y[n+1]):
        n+=1
    xx[i] = abs(x[i]-y[n])
n = 0
for i in range(b):
    while n < a-1 and abs(y[i]-x[n]) > abs(y[i]-x[n+1]):
        n+=1

    yy[i] = abs(y[i]-x[n])

for i in range(q):
    z = osoi[i]
    ans = 1<<61
    n = bisect.bisect_left(x, z)
    if n<a:
        tmp = abs(x[n]-z)+xx[n]
        ans = min(ans,tmp)
    if n>0:
        tmp = abs(x[n-1]-z)+xx[n-1]
        ans = min(ans,tmp)

    n = bisect.bisect_left(y, z)
    if n<b:
        tmp = abs(y[n]-z)+yy[n]
        ans = min(ans,tmp)
    if n>0:
        tmp = abs(y[n-1]-z)+yy[n-1]
        ans = min(ans,tmp)
    print(ans)
N = int(input())

t = input().split()
T = []
for i in range(N):
    T.append(int(t[i]))

M = int(input())

time = []
total = sum(T)
for i in range(M):
    p,x = (int(i) for i in input().split())
    time.append（total - T[p] + x)

print(time)

### FIXED CODE ###

N = int(input())

t = input().split()
T = []
for i in range(N):
    T.append(int(t[i]))

M = int(input())

time = []
total = sum(T)
for k in range(M):
    p,x = (int(i) for i in input().split())
    time.append(total - T[p-1] + x)

for i in range(M):
    print(time[i])
number = input()
coordinates = list(map(int, input().split()))
coordinates.sort()
coordinates.reverse()
#print(coordinates)
list = []
for i in range(coordinates[0]):
    total=0
    for j in range(number):
        total += (coordinates[j]-i)**2
    list.insert(0, total)
list.sort()
print(list[0])

### FIXED CODE ###

number = int(input())
coordinates = list(map(int, input().split()))
coordinates.sort()
coordinates.reverse()
#print(coordinates)
list = []
for i in range(coordinates[0]+1):
    total=0
    for j in range(number):
        total += (coordinates[j]-i)**2
    list.insert(0, total)
list.sort()
print(list[0])
N,K=map(int,input().split())
tree=[[]for _ in range(N+1)]
MOD=10**9+7
ans=K
for i in range(N-1):
    a,b=map(int,input().split())
    tree[a].append(b)
    tree[b].append(a)
def enu(a,b):
    num=1
    for i in range(b):
        num=num*(a-i)
        num%=MOD
    return num
def dfs(a,b):
    if a==1:
        node=len(tree[a])
        ret=enu(K-1,node)%MOD
    else:
        node=len(tree[a])-1
        ret=enu(K-2,node)%MOD
    for i in tree[a]:
        if i==b:
            continue
        ret=ret*dfs(i,a)%MOD
    return ret
ans*=dfs(1,0)
print(ans%MOD)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
N,K=map(int,input().split())
tree=[[]for _ in range(N+1)]
MOD=10**9+7
ans=K
enuk=[1]*(N)
for i in range(N-1):
    a,b=map(int,input().split())
    tree[a].append(b)
    tree[b].append(a)
    enuk[i+1]=(enuk[i]*(K-2-i))%MOD
def dfs(a,b):
    if a==1:
        node=len(tree[a])
        ret=1
        for i in range(node):
            ret*=K-1-i
            ret%=MOD
    else:
        node=len(tree[a])-1
        ret=enuk[node]%MOD
    for i in tree[a]:
        if i==b:
            continue
        ret=ret*dfs(i,a)%MOD
    return ret
ans*=dfs(1,0)
print(ans%MOD)
import sys
input = sys.stdin.readline

import sys
input = sys.stdin.readline

class Unionfind:

    __slots__ = ['nodes','size']

    def __init__(self, n):
        self.nodes = list(range(n))
        self.size = [1]*n

    def root(self, x):
        if self.nodes[x] == x:
            return x
        else:
            root_x = self.root(self.nodes[x])
            self.nodes[x] = root_x
            return root_x

    def unite(self, x, y):
        x = self.root(x); y = self.root(y)
        if x == y:
            return
        if self.size[x] < self.size[y]:
            x, y = y, x
        self.size[x] += self.size[y]
        self.nodes[y] = x

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

N = int(input())
edge = [list(map(int,input().split())) for _ in range(N-1)]

uf = Unionfind(N)

for u,v,w in edge:
    u -= 1; v -= 1
    if w % 2 == 1:
        continue
    uf.unite(u,v)

if len(set(uf.nodes)) == 1:
    for _ in range(N):
        print(0)
    exit()

w,b = list(set(uf.nodes))

for i in range(N):
    if uf.nodes[i] == w:
        uf.nodes[i] = 0
    elif uf.nodes[i] == b:
        uf.nodes[i] = 1

for v in uf.nodes:
    print(v)

### FIXED CODE ###

import sys
input = sys.stdin.readline

from heapq import heappush, heappop
inf = float('inf')
# (始点,隣接リスト)
def dijkstra(start,ad):
    dist = [inf]*len(ad)
    dist[start] = 0
    pq = [(start,0)]
    while pq:
        v = heappop(pq)[0]
        for nv,nw in ad[v]:
            if dist[nv] > dist[v] + nw:
                dist[nv] = dist[v] + nw
                heappush(pq,(nv,dist[nv]))
    return dist

N = int(input())

ad = [[] for _ in range(N)]

for _ in range(N-1):
    u,v,w = map(int,input().split())
    u -= 1; v -= 1
    ad[u].append((v,w))
    ad[v].append((u,w))

dist = dijkstra(0,ad)

for d in dist:
    if d % 2 == 0:
        print(0)
    else:
        print(1)
N, Q = map(int, input().split())
str = input()
length = [list(map(int, input().split())) for _ in range(Q)]

ans = [0 for _ in range(N)]
for i in range(1, N):
    if (str[i-1] == "A")
        if (str[i] == "C"):
            ans[i] = ans[i-1] + 1
        else:
            ans[i] = ans[i-1]
    else:
        ans[i] = ans[i-1]
        ans[i+1] = ans[i-1]
        i += 1

for l1, l2 in length:
    # print(ans)
    print(ans[l2-1] - ans[l1-1])


### FIXED CODE ###

N, Q = map(int, input().split())
str = input()
length = [list(map(int, input().split())) for _ in range(Q)]

ans = [0 for _ in range(N)]
for i in range(1, N):
    if (str[i-1] == "A") and (str[i] == "C"):
        ans[i] = ans[i-1] + 1
    else:
        ans[i] = ans[i-1]

for l1, l2 in length:
    # print(ans)
    print(ans[l2-1] - ans[l1-1])
N = input()
fizz = list()
for i in range(int(N+1)):
    if not i // 3==0 or not i//5==0:
        fizz.append(i)
print(sum(fizz))

### FIXED CODE ###

N = int(input())
a = 0
for i in range(N+1):
    if i % 3 != 0 and i % 5 != 0:
        a += i
print(a)
def check_prime(k):
    '''
    素数の時1、合成数の時0を返す
    '''
    if k == 1:return 0
    num = int(k ** 0.5 // 1)
    for i in range(2, num + 1):
        if k % i == 0:return 0
    return 1

n = int(input())
prime = []
for i in range(1, 55556):
    if check_prime(i):
        prime.append(i)

rec = [2]
cnt = 0
for i in range(n - 1):

    while True:
        if prime[cnt] < 2 * rec[-1]:
            cnt += 1
        else:
            rec.append(prime[cnt])
            cnt += 1
            break
print(rec)

### FIXED CODE ###

def check_prime(k):
    '''
    素数の時1、合成数の時0を返す
    '''
    if k == 1:return 0
    num = int(k ** 0.5 // 1)
    for i in range(2, num + 1):
        if k % i == 0:return 0
    return 1

n = int(input())
prime = []

for i in range(2, 55556):
    if check_prime(i):
        prime.append(i)

rec = [2]
ind = 1
for i in range(n - 1):
    while True:
        if prime[ind] % 5 == 1:
            rec.append(prime[ind])
            ind += 1
            break
        ind += 1

print(*rec)
mod = 1000003
"""
for i in range(2,57000):
    if n%i==0:
        print("nonPrime")
        exit()
print("prime")
"""
q = int(input())
fct = [0]
tmp = 1
for i in range(1,mod):
    tmp *=i
    tmp%=mod
    fct.append(tmp)
for i in range(q):
    x,d,n = map(int, input().split( ))
    if d%mod == 0:
        print(pow(x,mod-2,mod))
        continue
    if n>=mod:
        print(0)
        continue
    rev_d = pow(d,mod-2,mod)
    x*=rev_d
    x%=mod
    tmp = pow(d,n,mod)
    tmp*=fct[x+n-1]
    if x>=1:
        tmp*=pow(fct[x-1],mod-2,mod)
    tmp%=mod
    print(tmp)

### FIXED CODE ###

mod = 1000003
"""
for i in range(2,57000):
    if n%i==0:
        print("nonPrime")
        exit()
print("prime")
"""
q = int(input())
fct = [0]
tmp = 1
for i in range(1,mod+3):
    tmp *=i
    tmp%=mod
    fct.append(tmp)
for i in range(q):
    x,d,n = map(int, input().split( ))
    if d%mod == 0:
        print(pow(x,n,mod))
        continue
    if n>=mod:
        print(0)
        continue
    rev_d = pow(d,mod-2,mod)
    x*=rev_d
    x%=mod
    tmp = pow(d,n,mod)
    try:
        tmp*=fct[x+n-1]
    except:
        print(0)
        continue
    if x>=2:
        tmp*=pow(fct[x-1],mod-2,mod)
    tmp%=mod
    print(tmp)
s=input();print(eval(s[:2]+'*'+s[2:-2])//2)

### FIXED CODE ###

a,b,_=map(int,input().split())
print(a*b//2)
n = input()

if (n[-1].include(2,4,5,7,9)):
  print('pon')
elif (n[-1].include(0,1,6,8)):
  print('hon')
elif (n[-1] == 3):
  pirint('bon')

### FIXED CODE ###

n = int(input())
a = n%10

if a in [2,4,5,7,9]:
    print("hon")
elif a in [0, 1, 6, 8]:
    print("pon")
else:
    print("bon")
N=int(input())
def f(N):
	for i in range(1,10):
  		j=N//i
        if i*j==N and j>=1 and j<=9:
          return(True)
   	return(False)
if f(N):
  print("YES")
else:
  print("NO")
      


### FIXED CODE ###

N=int(input())
def f(N):
  for i in range(1,10):
    j=N//i
    if i*j==N and (j>=1 and j<=9):
      return(True)
  return(False)
if f(N):
  print("Yes")
else:
  print("No")
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N = inputInt()
	A = inputList()

	A.sort()
	ref = [0 for i in range(2*100000 + 2)]
	for i,val in enumerate(A):
		for j in range(val,2*100000 + 1,val):
			if ref[j] >= 2:
				break
			ref[j] += 1

	ans = 0
	for i,val in enumerate(A):
		if ref[val] < 2:
			ans += 1

	print(ans)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import itertools
from decimal import *

input = sys.stdin.readline

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
def inputStr(): return input()[:-1]

inf = float('inf')
mod = 1000000007

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

def main():
	N = inputInt()
	A = inputList()

	A.sort()
	zyuufuku = {}
	for i,val in enumerate(A):
		if i == 0:
			continue
		if val == A[i-1]:
			if val in zyuufuku:
				pass
			else:
				zyuufuku[val] = 1

	refd = [0 for i in range(1000000 + 1)]
	for i,val in enumerate(A):
		if val in zyuufuku:
			if zyuufuku[val] > 2:
				continue
			else:
				zyuufuku[val] += 1
		for j in range(val,1000000 + 1,val):
			refd[j] += 1

	ans = 0
	for i,val in enumerate(A):
		if val in zyuufuku:
			continue
		if refd[val] < 2:
			ans += 1

	print(ans)

#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
#-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
if __name__ == "__main__":
	main()
import math
deta=[float(i) for i in input().split()]
h1=math.sqrt((deta[2]-deta[0])**2+(deta[3]-deta[1])**2)
h2=math.sqrt((deta[4]-deta[2])**2+(deta[5]-deta[3])**2)
h3=math.sqrt((deta[0]-deta[4])**2+(deta[1]-deta[5])**2)
sub=(h1+h2+h3)/2
s=math.sqrt(sub*(sub-h1)*(sub-h2)*(sub-h3))
sum=((h1*h2*h3)/s)/4

a=2*deta[2]-2*deta[0]
b=2*deta[3]-2*deta[1]
c=-(deta[0]**2+deta[1]**2-(deta[2]**2)-(deta[3]**2))
d=2*deta[4]-2*deta[2]
e=2*deta[5]-2*deta[3]
f=-(deta[2]**2+deta[3]**2-(deta[4]**2)-(deta[5]**2))

x=(e*c-b*f)/(a*e-b*d)
y=(a*f-c*d)/(a*e-b*d)
print("{0:.3f} {1:.3f} {2:.3f}".format(x,y,sum))

### FIXED CODE ###

import math

n=int(input())
for i in range(n):
    deta=[float(i) for i in input().split()]
    h1=math.sqrt((deta[2]-deta[0])**2+(deta[3]-deta[1])**2)
    h2=math.sqrt((deta[4]-deta[2])**2+(deta[5]-deta[3])**2)
    h3=math.sqrt((deta[0]-deta[4])**2+(deta[1]-deta[5])**2)
    sub=(h1+h2+h3)/2
    s=math.sqrt(sub*(sub-h1)*(sub-h2)*(sub-h3))
    sum=((h1*h2*h3)/s)/4
    a=2*deta[2]-2*deta[0]
    b=2*deta[3]-2*deta[1]
    c=-(deta[0]**2+deta[1]**2-(deta[2]**2)-(deta[3]**2))
    d=2*deta[4]-2*deta[2]
    e=2*deta[5]-2*deta[3]
    f=-(deta[2]**2+deta[3]**2-(deta[4]**2)-(deta[5]**2))
    
    x=(e*c-b*f)/(a*e-b*d)
    y=(a*f-c*d)/(a*e-b*d)
    print("{0:.3f} {1:.3f} {2:.3f}".format(x,y,sum))
while True:
    a = map(float, raw_input().split(' '))
    x = (a[1]*a[5]-a[2]*a[4])/(a[1]*a[3]-a[0]*a[4])
    y = (a[2]*a[3]-a[0]*a[5])/(a[1]*a[3]-a[0]*a[4])
    if x == 0:
        x = abs(x)
    if y == 0:
        y = abs(y)
    print '%.3f %.3f ' % (x,y)

### FIXED CODE ###

while True:
    try:
        a = map(float, raw_input().split(' '))
        x = (a[1]*a[5]-a[2]*a[4])/(a[1]*a[3]-a[0]*a[4])
        y = (a[2]*a[3]-a[0]*a[5])/(a[1]*a[3]-a[0]*a[4])
        if x == 0: 
            x = abs(x)
        if y == 0:
            y = abs(y)
        print '%.3f %.3f' % (x,y)
    except EOFError:
        break
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
# input=lambda :sys.stdin.readline().rstrip()
def resolve():
    from math import ceil
    K=int(input())
    X,Y=map(int,input().split())
    print(K,X,Y)
    # defaultは 0 <= Y <= X
    def trans(u,v):
        if(abs(X)<abs(Y)): u,v=v,u
        if(X<0): u=-u
        if(Y<0): v=-v
        return u,v

    x,y=max(abs(X),abs(Y)),min(abs(X),abs(Y))
    if(K%2==0 and (X+Y)&1):
        print(-1)
        return

    # x+y<K
    if(x+y<K and (x+y)&1):
        print(3)
        print(*trans(x,-K+x))
        print(*trans(x+(K+x-y)//2,-(K-x-y)//2))
        print(*trans(x,y))
        return
    if(x+y<K and (not (x+y)&1)):
        print(2)
        print(*trans((x+y)//2,-k+(x+y)//2))
        print(*trans(x,y))
        return

    # x+y>=K
    # c=(-x-y)%K
    # n=ceil((x+y)/K)+(c&1)
    # l=(K*n-x-y)//2
    # print(n)
    # nx,ny=K-l,-l
    # print(*trans(nx,ny))
    # while(nx+K<=x):
    #     nx+=K
    #     print(*trans(nx,ny))
    # nx,ny=x,ny+(K-(x-nx))
    # print(*trans(nx,ny))
    # while(ny+K<=y):
    #     ny+=K
    #     print(*trans(nx,ny))
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    from math import ceil
    K=int(input())
    X,Y=map(int,input().split())
    # defaultは 0 <= Y <= X
    def trans(u,v):
        if(abs(X)<abs(Y)): u,v=v,u
        if(X<0): u=-u
        if(Y<0): v=-v
        return u,v

    x,y=max(abs(X),abs(Y)),min(abs(X),abs(Y))
    if(K%2==0 and (X+Y)&1):
        print(-1)
        return

    # x+y<K
    if(x+y<K and (x+y)&1):
        print(3)
        print(*trans(x,-K+x))
        print(*trans(x+(K+x-y)//2,-(K-x-y)//2))
        print(*trans(x,y))
        return
    if(x+y<K and (not (x+y)&1)):
        print(2)
        print(*trans((x+y)//2,-K+(x+y)//2))
        print(*trans(x,y))
        return

    # x+y=K
    if(x+y==K):
        print(1)
        print(*trans(x,y))
        return
    
    # x+y>K
    c=(-x-y)%K
    n=ceil((x+y)/K)+(c&1)
    l=(K*n-x-y)//2
    print(n)
    nx,ny=K-l,-l
    print(*trans(nx,ny))
    while(nx+K<=x):
        nx+=K
        print(*trans(nx,ny))
    nx,ny=x,ny+(K-(x-nx))
    print(*trans(nx,ny))
    while(ny+K<=y):
        ny+=K
        print(*trans(nx,ny))
resolve()
n = int(input())
x = list(map(int, input().split()))

p0 = math.floor(sum(x)/len(x))
# 123
cost = 10**9
for i in range(0,100):
    now = 0
    for i in x:
        now += abs(p0-i)**2
    if cost > now:
        cost = now

print(now)


### FIXED CODE ###


n = int(input())
x = list(map(int, input().split()))
cost = 10**9
for i in range(1,100):
    now = 0
    for j in x:
        now += (i-j)**2
    if cost > now:
        cost = now
print(cost)
x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    ans = x

d = float('inf')

for i in range(n+1):
    tmpx = x + 1 + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            if ans >= tmpx:
                ans = tmpx

print(ans)




### FIXED CODE ###

x, n = map(int, input().split())
p = list(map(int, input().split()))

if n == 0:
    ans = x
else:
    ans = float('inf')

d = float('inf')

for i in range(n+2):
    tmpx = x + 1 + n//2 - i
    if not tmpx in p:
        tmpd = abs(x -tmpx) 
        if d >= tmpd:
            d = tmpd
            if ans >= tmpx:
                ans = tmpx

print(ans)
S1 = input()
T = input()

if len(S1) < T:
    print("UNRESTORABLE")
    quit()

for i in range(len(S1)-len(T)+1):
    flag1 = True
    flag2 = True
    for s,t in zip(S1[i:i+len(T)],T):
        if s == "?" or s == t:
            pass
        else:
            flag1 = False 
            break
    if flag1:
        flag2 = False
        S1 = S1.replace(S1[i:i+len(T)],T)
        S = ["a" if s1 == "?" else s1 for s1 in S1]
        print("".join(S))
        break
if flag2:
    print("UNRESTORABLE")

### FIXED CODE ###

S1 = input()
T = input()

S1_r = S1[::-1]
T_r = T[::-1]
if len(S1) < len(T):
    print("UNRESTORABLE")
else:    
    for i in range(len(S1)-len(T)+1):
        flag1 = True
        flag2 = True
        for s,t in zip(S1_r[i:i+len(T)],T_r):
            if s == "?" or s == t:
                pass
            else:
                flag1 = False 
                break
        if flag1:
            flag2 = False
            S1_r = S1_r.replace(S1_r[i:i+len(T)],T_r,1)
            S_r = ["a" if s1 == "?" else s1 for s1 in S1_r]
            print("".join(S_r[::-1]))
            break
    if flag2:
        print("UNRESTORABLE")
def int_(num_str):
    return int(num_str) - 1


N, M = map(int, input().split())
ablist = [list(map(int_, input().split())) for _ in range(M)]
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
        self.group_count = 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

        self.group -= 1

        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 all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
ans = 0
for i in range(M):
    uf = UnionFind(N)
    for j in range(M):
        if i != j:
            uf.union(*ablist[j])
    if uf.group_count >= 2:
        ans += 1
print(ans)


### FIXED CODE ###

from copy import deepcopy
N, M = map(int, input().split())
graph = dict()
for i in range(N):
    graph[i] = []
ab = [tuple(map(int, input().split())) for _ in range(M)]

import numpy as np
from scipy.sparse.csgraph import shortest_path
from scipy.sparse import csr_matrix
inf = float("inf")

graph = np.zeros((N, N))

for a, b in ab:
    graph[a - 1][b - 1] = 1
counter = 0
for a, b in ab:
    g = deepcopy(graph)
    g[a - 1][b - 1] = 0
    g = csr_matrix(g)
    shortest_paths = shortest_path(g, directed=False, method="D")
    if inf in shortest_paths[0]:
        counter += 1
print(counter)