Harryxun/stf_run huggingface dataset:
n=int(input())
L=list(map(int,input().split()))
#a,b=map(int,input().split())
A=[0 for i in range(n-1)] 
#l = [int(input()) for i in range(N)]
B=[0 for i in range(n-1)] 
for i in range(n-1):
  A[i]=L[i]-L[i+1]

for i in range(n-1):
  if A[i]>=0:
    B[i]=B[i-1]+1
  else:
    B[i]=0

print(max(B))

### FIXED CODE ###

n=int(input())
if n==1:
  print(0)
else: 
  L=list(map(int,input().split()))
#a,b=map(int,input().split())
  A=[0 for i in range(n-1)] 
#l = [int(input()) for i in range(N)]
  B=[0 for i in range(n-1)] 
  for i in range(n-1):
    A[i]=L[i]-L[i+1]

  for i in range(n-1):
    if A[i]>=0:
      B[i]=B[i-1]+1
    else:
      B[i]=0

  print(max(B))
n,m=map(int,input().split())
st=[]
ch=[]
def mht(a,b):
  return abs(a[0]-b[0])+abs(a[1]-b[1])
for i in range(n):
  st.append(list(map(int,input().split())))
for i in range(m):
  ch.append(list(map(int,input().split())))
  
for i in st:
  mn=100000000
  for (j,k) in zip(ch,range(m)):
    mh=mht(i,j)
    if mh<mn:
      mn=mh
      nm=k+1
  print(nm)
      

### FIXED CODE ###

n,m=map(int,input().split())
st=[]
ch=[]
def mht(ax,ay,bx,by):
  return abs(ax-bx)+abs(ay-by)

for i in range(n):
  st.append(list(map(int,input().split())))
for i in range(m):
  ch.append(list(map(int,input().split())))
  
for i in st:
  ax=i[0]
  ay=i[1]
  mn=1000000000
  for (j,k) in zip(ch,range(len(ch))):
    bx=j[0]
    by=j[1]
    mh=mht(ax,ay,bx,by)
    if mh<mn:
      mn=mh
      nm=k
  print(nm+1)
import re

def checkFunction(c):
    print(c)
    c = re.sub('W+$','',c)
    if (not 'WR' in c):
        return 0
    if c.index('WR') + 2 != len(c):
        c2 = c.replace('WR', 'RR',1)[:-1]
        return checkFunction(c2) + 1
    return 1


N = int(input())
c= input()

print(checkFunction(c))

### FIXED CODE ###


def check(N, c):
    RinRight = c.count('R')
    WinLeft = 0
    r = RinRight
    for i in range(N):
        if c[i] == 'R':
            RinRight -= 1
        else: # c[i] == 'W'
            WinLeft +=1
        r = min(r, max(RinRight,WinLeft))

    return r


N = int(input())
c= input()
print(check(N,c))
N,M = list(map(int,input().split()))
xarray = list(map(int,input().split()))
diff = []
for i in range(len(xarray)-1):
    diff.append(abs(xarray[i+1]-xarray[i]))
diff2 = sorted(diff, reverse = True)
for j in range(N):
    diff2[j] = 0
print(sum(diff2))
    

### FIXED CODE ###

N,M = list(map(int,input().split()))
xarray = sorted(list(map(int,input().split())))
 
diff = []
if len(xarray) == 1:
    print(0)
elif N >= M:
    print(0)
else:
    for i in range(len(xarray)-1):
        diff.append(abs(xarray[i+1]-xarray[i]))
 
    if len(diff) == 0:
        print(0)
    else:
        diff2 = sorted(diff, reverse = True)
        
 
        if N == 1:
            
            print(sum(diff2))
        else:
            for j in range(N-1):
                diff2[j] = 0
            
            print(sum(diff2))
num = 0
while(true):
    x = sys.stdin.readline()
    num += 1
    if x == '0':
        break
    print("Case %d: %s".% num, x)

### FIXED CODE ###

import sys
num = 0
while(True):
    x = int(sys.stdin.readline())
    num += 1
    if x == 0:
        break
    print("Case %d: %d" % (num, x))
import sympy

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())

ans = []
used_list = []

def solve(n, used_list):
  if n == 1:
    return len(used_list)
  div_list = sympy.divisors(n)[1:]
  for i in div_list:
    z_kouho = factorization(i)
    if i not in used_list and len(z_kouho) == 1:
      used_list.append(i)
      return solve(int(n/i),used_list)
  
  return len(used_list)
      
print(solve(n, used_list))

### FIXED CODE ###

def make_divisors(n):
    lower_divisors = []
    upper_divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)

    upper_divisors.reverse()
    return lower_divisors + upper_divisors

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

n = int(input())

ans = []
used_list = []

def solve(n, used_list):
  if n == 1:
    return len(used_list)
  div_list = make_divisors(n)[1:]
  for i in div_list:
    z_kouho = factorization(i)
    if i not in used_list and len(z_kouho) == 1:
      used_list.append(i)
      return solve(int(n/i),used_list)
  
  return len(used_list)
      
print(solve(n, used_list))
A=list(map(int,input().split()))
pop = 1/(4*M)*sum(A)
lis = []

for i in A:
    if i>pop:
        lis.append(i)
if len(lis)>=M:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

N,M=map(int,input().split())
A=list(map(int,input().split()))
pop = 1/(4*M)*sum(A)
lis = []
for i in A:
    if i>=pop:
        lis.append(i)
if len(lis)>=M:
    print("Yes")
else:
    print("No")
#133_E
mod = 10 ** 9 + 7
n, k = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
    
def dfs(frm, cur):
    if frm == -1:
        color_num = k - 1
    else:
        color_num = k - 2
    
    mul = 1
    for to in edges[cur]:
        if to == frm:
            continue
        mul *= color_num * dfs(cur, to)
        mul %= mod
        color_num -= 1
    
    return mul

print(k * dfs(-1, 0) % mod)

### FIXED CODE ###

#133_E
import sys
sys.setrecursionlimit(100000)
mod = 10 ** 9 + 7
n, k = map(int, input().split())
edges = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
    
def dfs(frm, cur):
    if frm == -1:
        color_num = k - 1
    else:
        color_num = k - 2
        
    if k < len(edges[cur]):
        return 0
    
    mul = 1
    for to in edges[cur]:
        if to == frm:
            continue
        mul *= color_num
        mul %= mod
        color_num -= 1
        
    for to in edges[cur]:
        if to == frm:
            continue
        mul *= dfs(cur, to)
        mul %= mod
    
    return mul

print(k * dfs(-1, 0) % mod)
num = raw_input().split()
a = num[0]
b = num[1]
c = num[2]

if a < b:
    if b < c:
        print "%d %d %d" % a, b, c
    if c < b:
        if a < c:
            print "%d %d %d" % a, c, b
        if c < a:
            print "%d %d %d" % c, a, b
if b < a:
    if a < c:
        print "%d %d %d" % b, a, c
    if c < a:
        if b < c:
            print "%d %d %d" % b, c, a
        if c < b:
            print "%d %d %d" % c, b, a

### FIXED CODE ###

a, b, c = raw_input().split()

def ITP1(a, b, c):
    if (a <= b):
        if (b <= c):
            print a, b, c
            return
        if (c <= b):
            if (c <= a):
                print c, a, b
                return
            if (a <= c):
                print a, c, b
                return
    if (b <= a):
        if (a <= c):
            print b, a, c
            return
        if (c <= a):
            if (c <= b):
                print c, b, a
                return
            if (b <= c):
                print b, c, a
                return

ITP1(a, b, c)
K,X = map(int,input().split())
L1 = list(range(X-K+1,X+K-1))
L2 =' '.join(L1)
print(L2)

### FIXED CODE ###

K,X = map(int,input().split())
L1 = list(range(X-K+1,X+K))
L1_str = [str(n) for n in L1]
L2 = ' '.join(L1_str)
print(L2)
n=int(input())
arr=[int(i) for i in input().strip().split(" ")]
t=int(input())
dic={}
sum_array=0
for i in arr:
    dic[i]=dic.get(i,0)+1
    sum_array+=i
    

for _ in range(t):
    a,b=[int(i) for i in input().split(" ")]
    if b in dic:
        dic[b]+=dic[a]
    else:
        dic[b]=dic[a]
    
    sum_array+=dic[a]*(b-a)
    print(sum_array)
    dic[a]=0

### FIXED CODE ###

n=int(input())
arr=[int(i) for i in input().strip().split(" ")]
t=int(input())
dic={}
sum_array=0
for i in arr:
    dic[i]=dic.get(i,0)+1
    sum_array+=i
    

for _ in range(t):
    a,b=[int(i) for i in input().split(" ")]
    if a not in dic:
        print(sum_array)
        continue
    if b in dic:
        dic[b]+=dic[a]
    else:
        dic[b]=dic[a]
    
    sum_array+=dic[a]*(b-a)
    print(sum_array)
    dic[a]=0
S = input() W = input()
if(int(W)>=int(S)):
  print('unsafe')
else:
  print('safe')


### FIXED CODE ###

S,W = map(int, input().split())
if W >= S:
 print('unsafe')
else:
 print('safe')
count = 0
scounts = []
N = int(input())
for n in range(N):
    s = sorted(input())
    found = False
    index = -1
    for i in range(len(scounts)):
        if scounts[i][0] == s:
            found = True
            count += scounts[i][1]
            scounts[i][1] += 1
            break
        elif scounts[i][0] > s:
            index = i
            break
        else: # scounts[i][0] > s:
			pass

    print("index="+str(index))
    if not found:
        if index<0:
            scounts.append([s,1])
        else:
            scounts.insert(index, [s, 1])

        print(str(s))
        print("DONE: "+str(scounts))
    print("===")
print(count)


### FIXED CODE ###

ss = []
N = int(input())
for n in range(N):
    s = sorted(input())
    ss.append(s)

ss = sorted(ss)

total = 0
count = 0
for n in range(N):
    if n==0:
        continue
    # print("ss["+str(n-1)+"]="+str(ss[n-1]))
    # print("ss["+str(n)+"]="+str(ss[n]))
    if ss[n-1]==ss[n]:
        count += 1
    else:
        total += int(count*(count+1)/2)
        count = 0
    # print("===")
total += int(count*(count+1)/2)
count = 0

print(int(total))
n, m, x = map(int,input().split())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
if x == 1 or x == n:
    print(0)
else:
    for i in range(1, x):
        if len(a) != 0:
            if a[0] == i:
                ans1 += 1
                a.pop(0)
    if len(a) != 0:
        for i in range(x, n):
            if a[0] == i:
                ans2 += 1
                a.pop(0)
    ans = min(ans1, ans2)
    print(ans)

### FIXED CODE ###

n, m, x = map(int,input().split())
a = list(map(int,input().split()))
ans1 = 0
ans2 = 0
if x == 1 or x == n:
    print(0)
else:
    for i in range(1, x):
        if len(a) != 0:
            if a[0] == i:
                ans1 += 1
                a.pop(0)
    if len(a) != 0:
        for i in range(x, n):
            if len(a) != 0:
                if a[0] == i:
                    ans2 += 1
                    a.pop(0)
    ans = min(ans1, ans2)
    print(ans)
int(input(a,b))
if a >= 10:
  x = b
else:
  x = b+100*(10-a)
print(x)

### FIXED CODE ###

a,b=map(int, input().split())
if a >= 10:
  x = b
else:
  x = b+100*(10-a)
print(x)
x,y = list(map(int,input().split()))
if x < 10 abd y < 10:
	print(x*y)
    exit()
else:
  print('-1')


### FIXED CODE ###

x,y = list(map(int,input().split()))
if x < 10 and y < 10:
	print(x*y)
else:
  print('-1')
N = input()
ans = 0

for i in range(N):
  a,b = map(float, input().split())
  if b =="JPY":
    ans += a
  else:
    ans += a*380000
print(ans)

### FIXED CODE ###

N = int(input())
ans = 0

for i in range(N):
  a,b = map(str, input().split())
  if b =="JPY":
    ans += int(a)
  else:
    ans += float(a)*380000
print(ans)
s=input()
t=input()
ls=len(s)
lt=len(t)
sa=[]

def change_to_a(sd):
    new_sd=""
    for i in range(len(sd)):
        if sd[i]=="?":
            new_sd+="a"
        else:
            new_sd+=sd[i]
    return new_sd

if lt > ls:
    print("UNRESTORABLE")
elif lt==ls:
    for i in range(ls):
        if s[j]!=t[j] and s[j]!="?":
            print("UNRESTORABLE")
            break
    else:
        print(t)
else:
    for i in range(0,ls-lt+1):
        for j in range(i,i+lt):
            if s[j]!=t[j-i] and s[j]!="?":
                break
            if j==i+lt-1:
                if i==0:
                    sa.append(t+change_to_a(s[lt:]))
                elif i==ls-lt:
                    print(0)
                    sa.append(change_to_a(s[:ls-lt])+t)
                else:
                    sa.append(change_to_a(s[:i])+t+change_to_a(s[i+lt:]))

    if sa == []:
        print("UNRESTORABLE")
    else:
        print(min(sa))


### FIXED CODE ###

s=input()
t=input()
ls=len(s)
lt=len(t)
sa=[]

def change_to_a(sd):
    new_sd=""
    for i in range(len(sd)):
        if sd[i]=="?":
            new_sd+="a"
        else:
            new_sd+=sd[i]
    return new_sd

if lt > ls:
    print("UNRESTORABLE")
elif lt==ls:
    for i in range(ls):
        if s[i]!=t[i] and s[i]!="?":
            print("UNRESTORABLE")
            break
    else:
        print(t)
else:
    for i in range(0,ls-lt+1):
        for j in range(i,i+lt):
            if s[j]!=t[j-i] and s[j]!="?":
                break
            if j==i+lt-1:
                if i==0:
                    #print(0)
                    sa.append(t+change_to_a(s[lt:]))
                elif i==ls-lt:
                    #print(0)
                    sa.append(change_to_a(s[:ls-lt])+t)
                else:
                    #print(0)
                    sa.append(change_to_a(s[:i])+t+change_to_a(s[i+lt:]))

    if sa == []:
        print("UNRESTORABLE")
    else:
        print(min(sa))
5 10 0
1 2
1 3
1 4
1 5
3 2
2 4
2 5
4 3
5 3
4 5

### FIXED CODE ###

import sys

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,K = map(int,input().split())
friend =[0]*N
block = {}
for i in range(N):
  block[i] = []
uf = UnionFind(N)
for i in range(M):
  a,b = map(int,input().split())  
  a -= 1;b-=1
  friend[a]+=1
  friend[b]+=1
  uf.union(a,b)
  
for i in range(K):
  c,d = map(int,input().split())
  c -= 1
  d -= 1
  block[c].append(d)
  block[d].append(c)
res = [0]*N
for i in range(N):
  ans = uf.size(i)-1-friend[i]
  for u in block[i]:
    if uf.same(i,u):
      ans -= 1
      
  res[i] = ans
  
print(*res)
n,m=map(int,input().split())
a=list(map(int,input().split()))
x=[2,5,5,4,5,6,3,7,6]
dp=[0 for i in range(n+1)]
for i in range(1,n+1):
  l=[-99999999]
  for j in range(m):
    if i-x[a[j]-1]>=0:
      l.append(dp[i-x[a[j]-1]])
  dp[i]=max(l)+1
ans=[]
a.sort()
a.reverse()
y=n
for i in range(dp[n]):
  for j in range(m):
    if dp[y-x[a[j]-1]]==dp[y]-1:
      ans.append(str(a[j]))
      y-=x[a[j]-1]
      break
print(''.join(ans))

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
x=[2,5,5,4,5,6,3,7,6]
dp=[0 for i in range(n+1)]
for i in range(1,n+1):
  l=[-99999999]
  for j in range(m):
    if i-x[a[j]-1]>=0:
      l.append(dp[i-x[a[j]-1]])
  dp[i]=max(l)+1
ans=[]
a.sort()
a.reverse()
y=n
for i in range(dp[n]):
  for j in range(m):
    if y-x[a[j]-1]>=0:
      if dp[y-x[a[j]-1]]==dp[y]-1:
        ans.append(str(a[j]))
        y-=x[a[j]-1]
        break
print(''.join(ans))
costs = [2,5,5,4,5,6,3,7,6]

N, M = map(int, input().split())
A = list(map(int, input().split()))
neginf = -1 * 1e20
D = [neginf]*(N+1)

def dp(n_match):
    D[0] = 0
    for n in range(1,n_match+1):
        arr = [D[n-costs[a-1]] if n-costs[a-1]>=0 else neginf for a in A]
        D[n] = max(arr)+1

def main():
    dp(N)
    n = N
    ans = ''
    while n>1:
        for a in A:
            arr = [ a for a in A if D[n-costs[a-1]]==D[n]-1 ]
        a = max(arr)
        ans += str(a)
        n -= costs[a-1]
    print(ans)

main()

### FIXED CODE ###

costs = [2,5,5,4,5,6,3,7,6]

N, M = map(int, input().split())
A = list(map(int, input().split()))
neginf = -1 * 1e20
D = [neginf]*(N+1)

def dp(n_match):
    D[0] = 0
    for n in range(1,n_match+1):
        arr = [D[n-costs[a-1]] if n-costs[a-1]>=0 else neginf for a in A]
        D[n] = max(arr)+1

def main():
    dp(N)
    n = N
    ans = ''
    while n>1:
        arr = [ a for a in A if  n-costs[a-1]>=0 and D[n-costs[a-1]]==D[n]-1 ]
        if len(arr)>0:
            a = max(arr)
            ans += str(a)
            n -= costs[a-1]
        else:
            break
    print(ans)

main()
import math

nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]


n, a, b, k = map(int, input().split())
count = 0
for i in range(math.floor(k/a)):
    if (k - (i * a)) % b == 0:
        count += (cmb(n, i) * cmb(n, (k-a*i)/b))
print(count%998244353)

### FIXED CODE ###

N,A,B,K = map(int,input().split())
sprime = 998244353 # approx 10**9
A,B = sorted((A,B))
if (A+B) * N < K:
	print(0)
	exit()
 
def egcd(a, b):
    if a == 0:
        return (b, 0, 1)
    else:
        g, y, x = egcd(b % a, a)
        return (g, x - (b // a) * y, y)
 
def modinv(a, m):
    g, x, y = egcd(a, m)
    if g != 1:
        raise Exception('modular inverse does not exist')
    else:
        return x % m
 
memo = [0] * (N+1)
memo[0] = memo[N] = 1
for i in range(1,N//2+1):
	v = memo[i-1] * (N-i+1) * modinv(i,sprime)
	v = v % sprime
	memo[i] = memo[N-i] = v
 
# max is A*N + B*N
sum = 0
for b in range(N+1):
  a = (K-b*B)//A
  if 0 <= a <= N and a*A+b*B == K:
    sum += memo[a]*memo[b]
    sum %= sprime
 
print(sum)
def main():
    buf = input()
    buflist = buf.split()
    N = int(buflist[0])
    K = int(buflist[1])
    buf = input()
    buflist = buf.split()
    V = list(map(int, buflist))
    max_value = 0
    for i in range(K+1):
        push_limit = K - i
        for j in range(i+1):
            jewel = []
            for k in range(-i+j, j):
                jewel.append(V[k])
            jewel = list(sorted(jewel))
            value = sum(jewel)
            for k in range(push_limit):
                if k >= len(jewel):
                    break
                if jewel[k] < 0:
                    value += -jewel[k]
                else:
                    break
            if value > max_value:
                max_value = value
    print(max_value)


if __name__ == '__main__':
    main()


### FIXED CODE ###


def main():
    buf = input()
    buflist = buf.split()
    N = int(buflist[0])
    K = int(buflist[1])
    buf = input()
    buflist = buf.split()
    V = list(map(int, buflist))
    max_value = 0
    for i in range(min(N+1, K+1)):
        push_limit = K - i
        for j in range(i+1):
            jewel = []
            for k in range(-i+j, j):
                jewel.append(V[k])
            jewel = list(sorted(jewel))
            value = sum(jewel)
            for k in range(push_limit):
                if k >= len(jewel):
                    break
                if jewel[k] < 0:
                    value += -jewel[k]
                else:
                    break
            if value > max_value:
                max_value = value
    print(max_value)


if __name__ == '__main__':
    main()
a, b  = raw_input().split()

if int(a) > 8 or int(b) > 8:
    print(":(")
else:
    print("yay!")

### FIXED CODE ###

a, b  = input().split()

if int(a) > 8 or int(b) > 8:
    print(":(")
else:
    print("Yay!")
n,h=int(input());list(map(int,input().split()));m,a=0,0
for i in range(n):
  if m<=h[i]:
    a+=1
    m=h[i]
print(a)

### FIXED CODE ###

n,h=int(input()),list(map(int,input().split()));m,a=0,0
for i in range(n):
  if m<=h[i]:
    a+=1
    m=h[i]
print(a)
n = int(input())
s = [int(input()) for _ in range(n)]

score = sum(s)
s.sort()
i = 0
while score % 10 == 0:
    score -= s[i]
    i += 1
    if score == 0:
        break
print(score)


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

a, b = map(int, readline().split())
ans = a+b if (a+b) < 10 else 'error'
print(ans)
n = int(input())
box = [list(map(int, input().split())) for i in range(n)]

li = sorted(box, key = lambda x: sum(x), reverse = True)

taka = []
aoki = []

for i in range(len(li)):
    taka.append(li[0][0])
    del li[0]
    if li == []:
        print(sum(taka) - sum(aoki))
        quit()
    aoki.append(li[0][1])
    del li[0]

print(sum(taka) - sum(aoki))

### FIXED CODE ###

n = int(input())
box = [list(map(int, input().split())) for i in range(n)]

li = list(sorted(box, key=lambda x: sum(x), reverse = True))

taka = []
aoki = []

for i in range(len(li)):
    taka.append(li[0][0])
    del li[0]
    if li == []:
        print(sum(taka) - sum(aoki))
        quit()
    aoki.append(li[0][1])
    del li[0]
    if li ==[]:
        print(sum(taka) - sum(aoki))
        quit()
import sys
sys.getrecursionlimit(1e9)

def func(x, graph, flag, dp):
    if (flag[x]):
        return dp[x]

    flag[x] = 1
    check = 0
    for i in graph[x]:
        check = max(check, func(i, graph, flag, dp) + 1)

    dp[x] = check

    return dp[x]

N, M = [int(i) for i in input().split()]
flag = [0] * (N + 1)
dp = [0] * (N + 1)
graph = [[] for _ in range(N + 1)]
#%%
for _ in range(M):
    temp_x, temp_y = [int(i) for i in input().split()]
    graph[temp_x].append(temp_y)

#%%
ans = 0
for i in range(1, N + 1):
    ans = max(ans, func(i, graph, flag, dp))

print(ans)


### FIXED CODE ###

#%%
from sys import stdin, setrecursionlimit as srl
from threading import stack_size
srl(int(1e9)+7)
stack_size(int(1e8))

def func(x, graph, flag, dp):
    if (flag[x]):
        return dp[x]

    flag[x] = 1
    check = 0
    for i in graph[x]:
        check = max(check, func(i, graph, flag, dp) + 1)

    dp[x] = check

    return dp[x]

N, M = [int(i) for i in input().split()]
flag = [0] * (N + 1)
dp = [0] * (N + 1)
graph = [[] for _ in range(N + 1)]
#%%
for _ in range(M):
    temp_x, temp_y = [int(i) for i in input().split()]
    graph[temp_x].append(temp_y)

#%%
ans = 0
for i in range(1, N + 1):
    ans = max(ans, func(i, graph, flag, dp))

print(ans)
a,b=map(int,input().split())
s=str(input())
e=["0",'1','2','3','4','5','6','7','8','9']
for i in range(len(s)):
  if a=i:
    if s[i]!='-':
      print("No")
      exit()
  else:
    if s[i] not in e:
      print("No")
      exit()

print("Yes")


### FIXED CODE ###

a,b=map(int,input().split())
s=str(input())
e=["0",'1','2','3','4','5','6','7','8','9']
for i in range(len(s)):
  if a==i:
    if s[i]!='-':
      print("No")
      exit()
  else:
    if s[i] not in e:
      print("No")
      exit()

print("Yes")
n = input()
A = map(int, input().split())
q = input()
m = map(int, input().split())

 def solve(i, m):
  if i == m:
   return true
  if i > n:
   return false
  res = solve(i + 1, m) || solve(i + 1, m - A[i])
   return res
 
 for j in range(0, q-1):
  if m == solve(j, m(j)):
   print "yes"
  else:
   print "no"

### FIXED CODE ###

n = input()
A = map(int, raw_input().split())
q = input()
m = map(int, raw_input().split())

def solve(i, m):
 if m == 0:
  return True
 if i >= n or m > sum(A):
  return False
 res = solve(i+1, m) or solve(i+1, m-A[i])
 return res

for j in range(0, q):
 if solve(0, m[j]):
  print 'yes'
 else:
  print 'no'