Harryxun/stf_run huggingface dataset:
n,m=map(int,input().split())
nexts=[None for i in range(n)]
for i in range(n):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  if nexts[a]==None:
    nexts[a]=[b]
  elif b not in nexts[a]:
    nexts[a].append(b)
  if nexts[b]==None:
    nexts[b]=[a]
  elif a not in nexts[b]:
    nexts[b].append(a)

ans=0
stack=[]
stack.append([0,[]])
while stack:
  node=stack.pop()
  v=node[0]
  seen=node[1][:]
  seen.append(v)
  if len(seen)==n:
    ans+=1
    continue
  childs=nexts[v]
  if childs:
    for child in (set(childs)-set(seen)):
      stack.append([child,seen])
  
print(ans)


### FIXED CODE ###

n,m=map(int,input().split())
nexts=[None for i in range(n)]
for i in range(m):
  a,b=map(int,input().split())
  a,b=a-1,b-1
  if nexts[a]==None:
    nexts[a]=[b]
  elif b not in nexts[a]:
    nexts[a].append(b)
  if nexts[b]==None:
    nexts[b]=[a]
  elif a not in nexts[b]:
    nexts[b].append(a)

ans=0
stack=[]
stack.append([0,[]])
while stack:
  node=stack.pop()
  v=node[0]
  seen=node[1][:]
  seen.append(v)
  if len(seen)==n:
    ans+=1
    continue
  childs=nexts[v]
  if childs:
    for child in (set(childs)-set(seen)):
      stack.append([child,seen])
  
print(ans)
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    ans = 1
 
    for i in a:
        ans *= i
      	if ans > int(1e18): return -1
    
    
    return ans
    

print(solve())


### FIXED CODE ###

def solve():
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        return 0
    prod = 1
    for i in range(N):
        if 10**18//prod < A[i]:
            return -1
        prod *= A[i]
    return prod
print(solve())
# coding:utf-8
a, b= map(int, input().split())

diff = b-a
d = 0
for i in enumerate(diff+1, 1):
    d += i 

print(abs(d-a)
    


### FIXED CODE ###

# coding:utf-8
a, b= map(int, input().split())

diff = b-a
d = 0
for i in range(1, diff):
    d += int(i)
print(abs(d-a))
# -*- coding: utf-8 -*-

a = int(input())
b = int(input())

print((a-1)*(b-1))

### FIXED CODE ###

# -*- coding: utf-8 -*-
 
a,b = map(int, input().split())

print((a-1)*(b-1))
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range (n):
    if(a[i]>=b[i]):
        ans+=b[i]
    elif(a[i+1]<b[i]-a[i])
        ans+=a[i]+a[i+1]
        a[i+1]=0
    else:
        ans+=b[i]
        a[i+1]-=b[i]-a[i]
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range (n):
    if(a[i]>=b[i]):
        ans+=b[i]
    elif(a[i+1]<b[i]-a[i]):
        ans+=a[i]+a[i+1]
        a[i+1]=0
    else:
        ans+=b[i]
        a[i+1]-=b[i]-a[i]
print(ans)
A = int(input())
B = int(input())
print(A*B - A - B + 1)

### FIXED CODE ###

A,B = map(int,input().split())
print(A*B - A - B + 1)
x,y,a,b,c = map(int, input().split())
li_p = list(map(int, input().split()))
li_q = list(map(int, input().split()))
li_r = list(map(int, input().split()))
li_p.sort(reverse=True)
li_q.sort(reverse=True)
li_r.sort(reverse=True)
p,q = [],[]
for i in range(x):
  r.append(li_p[i])
for i in range(y):
  r.append(li_q[i])
for i in range(c):
  r.append(li_r[i])
r.sort(reverse=True)
print(sum(r[:x+y]))

### FIXED CODE ###

x,y,a,b,c = map(int, input().split())
li_p = list(map(int, input().split()))
li_q = list(map(int, input().split()))
li_r = list(map(int, input().split()))
li_p.sort(reverse=True)
li_q.sort(reverse=True)
li_r.sort(reverse=True)
r = []
for i in range(x):
  r.append(li_p[i])
for i in range(y):
  r.append(li_q[i])
for i in range(c):
  r.append(li_r[i])
r.sort(reverse=True)
print(sum(r[:x+y]))
N, K = map(int, input().split())
A = list(map(int, input().split()))

dist = A[0]
visited = {1}
_v = [1]
stop = 0
while True:
    if dist in visited:
        stop = dist
        break
    visited.add(dist)
    _v.append(dist)
    dist = A[dist-1]

made = 0
for i in range(len(_v)):
    if _v[i] == stop:
        break
    made += 1

loop = len(_v) - made
_v = _v[made:]

# print(stop)
# print(loop)
# print(made)
# print(_v)

if K <= made:
    print(_v[K])
else:
    K -= made
    K %= loop
    print(_v[K])

### FIXED CODE ###

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

dist = A[0]
visited = {1}
_v = [1]
stop = 0
while True:
    if dist in visited:
        stop = dist
        break
    visited.add(dist)
    _v.append(dist)
    dist = A[dist-1]

made = 0
l = len(_v)
for i in range(l):
    if _v[i] == stop:
        break
    made += 1

# print(stop)
# print(loop)
# print(made)
# print(_v)

if K <= made:
    print(_v[K])
else:
    loop = l - made
    _v = _v[made:]
    K -= made
    K %= loop
    print(_v[K])
import math

r = flaot(input())

#menseki
a = r*r*math.pi

#ensyu
b = 2*r*math.pi

print("%.5f %.5f" % (a, b))

### FIXED CODE ###

import math

r = float(float(input())) #??´??°??§?????????????????\???????????¨??? int?????????????????????????????????

#menseki
a = r*r*math.pi
 
#ensyu
b = 2*r*math.pi

print("%.6f %.6f" % (a, b))
#ABC042C
N,K=map(int,input().split())
N=str(N)
N_len=len(N)
a=[]
out=N
for i in range(K):
    a.append(input())
for i2 in range(N_len):    
    for i3 in range(K):
        if N[i2]==a[i3]:
            out += 1
print(out)
    
    

### FIXED CODE ###

# ABC042C
N,K=map(int,input().split())
out=N
N=str(N)
a = list(map(int, input().split()))
while 1<2:
    N1=N
    i=0
    for i in range(len(a)):
        if str(a[i]) in N:
            N=int(N) 
            N+=1
            N=str(N)
    if N1==N:
        break

print(N)
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=list(Counter(a).values())
lst=[]
for i in range(len(b)):
  if b[i]>1:
    lst.append(int(Counter(a).keys()[i]))
lst.sort(reverse=True)
if len(lst)<2:
  print(0)
else:
  print(lst[0]*lst[1])
    

### FIXED CODE ###

import collections
n=int(input())
a=map(int,input().split())
b=list(collections.Counter(a).items())
lst=[]
Lst=[]
for i in range(len(b)):
  if b[i][1]>1:
    lst.append(int(b[i][0]))  
    if b[i][1]>3:
      Lst.append(int(b[i][0]))
if len(lst)<2 and len(Lst)==0:
  print(0)
else:
  if len(lst)==1:
    Lst.sort(reverse=True)
    print(Lst[0]**2)
  else:
    if len(Lst)>0:
      lst.sort(reverse=True)
      Lst.sort(reverse=True)
      print(max(lst[0]*lst[1],Lst[0]**2))     
    else:
      lst.sort(reverse=True)
      print(lst[0]*lst[1])
import sys,heapq as hq
sys.setrecursionlimit(100000)
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())
def s(x): #圧縮
    a = []
    aa = x[0]
    su = 1
    for i in range(len(x)-1):
        if aa != x[i+1]:
            a.append([aa,su])
            aa = x[i+1]
            su = 1
        else:
            su += 1
    a.append([aa,su])
    return a
def jo(x): #listをスペースごとに分ける
    return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
    return max(map(max,x))

n = onem()

a = l()

b = l()

t = []

for i in range(n):
    if b[i] != a[i]:
        hq.heappush(t,(-b[i],i))
co = 0
while t:
    k = hq.heappop(t)
    k = (-k[0],k[1])
    if k[1] == 0:
        ppp = (k[0]-a[k[1]]) // (b[-1] + b[1])
        if ppp == 0:
            print(-1)
            exit()
        co += ppp
        k[0] = (k[0]-a[k[1]]) % (b[-1] + b[1]) + a[k[1]]
    elif k[1] == n-1:
        ppp = (k[0]-a[k[1]]) // (b[-2] + b[0])
        if ppp == 0:
            print(-1)
            exit()
        co += ppp
        k[0] = (k[0]-a[k[1]]) % (b[-2] + b[0]) + a[k[1]]
    else:
        ppp = (k[0]-a[k[1]]) // (b[k[1]+1] + b[k[1]-1])
        if ppp == 0:
            print(-1)
            exit()
        co += ppp
        k[0] = (k[0]-a[k[1]]) % (b[k[1]+1] + b[k[1]-1]) + a[k[1]]
    b[k[1]] = k[0]
    if b[k[1]] != a[k[1]]:
        hq.heappush(t,(-b[k[1]],k[1]))

print(co)

### FIXED CODE ###

import heapq as hq
mod = 10**9+7
def l(): #intのlist
    return list(map(int,input().split()))
def m(): #複数文字
    return map(int,input().split())
def onem(): #Nとかの取得
    return int(input())

def onon():
    n = onem()

    a = l()

    b = l()

    t = []

    for i in range(n):
        if b[i] != a[i]:
            hq.heappush(t,(-b[i],i))
    co = 0
    while t:
        k = hq.heappop(t)
        k = (-k[0],k[1])
        q,w = divmod(k[0] - a[k[1]], b[(k[1] - 1) % n] + b[(k[1] + 1) % n])
        co += q
        if q == 0:
            return -1
        w = a[k[1]] + w
        b[k[1]] = w
        if b[k[1]] != a[k[1]]:
            hq.heappush(t,(-w,k[1]))
    return co
print(onon())
n,k,s = map(int,input().split())
ans = [s]*k + [(s%(10**6)+1) for i in range(n-k)]
 
print(" ".join(map(str,ans)))

### FIXED CODE ###

import math
h = int(input())
w = int(input())
n = int(input())
print(min(math.ceil(n/h),(math.ceil(n/w))))
import gcc

def gcd(a,b):
    if a<b:
        c=a;
        a=b;
        b=c;
    c=a%b

    if c==0:
        return b
    else:
        return gcc.gcd(b,c)

def lcm(a,b):
    c=gcd(a,b);
    return a/c*b


n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))

### FIXED CODE ###

'''
def gcd(a,b):
    if a<b:
     c=a
     a=b
     b=c

    c=a%b

    if c==0:
     return b
    else:
     return gcd(b,c)
'''

def gcd(a,b):
    return a if b == 0 else gcd(b,a%b)

def lcm(e,f):
    c=gcd(e,f)
    g=e*f
    return g//c



n=int(input())
t=[0]*n

for lop2 in range(n):
    t[lop2]=int(input())

ans=t[0]

for lop in range(1,n):
    ans=lcm(ans,t[lop])
print(int(ans))
x,a  = [int(e) for e in input().split()]
if x < a:
  return 0
else:
  return 10

### FIXED CODE ###

x,a  = [int(e) for e in input().split()]
if x < a:
  print(0)
else:
  print(10)
flag=0
while flag==0:
    a,b=[int(i) for i in input().split()]
    if a=0 and b=0:
        flag=1
        break
    else:
        for i in range(a):
        print("#"*b)

### FIXED CODE ###


flag=0
while flag==0:
    a,b=[int(i) for i in input().split()]
    if a==0 and b==0:
        flag=1
        break
    else:
        for i in range(a):
            print("#"*b)
    print("")
import sys
input = sys.stdin.readline
N, T = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N)]
ab2 = [ab[i] for i in range(N) if ab[i][0] >= T]
ab2.append([0,0])
ab.sort(key=lambda x: x[1])

c = ab[-1][0]
ans = ab[-1][1]
i = 2
while(c<T):
    c+=ab[-i][0]
    ans += ab[-i][1]
    i += 1

dp = [[0]*(T) for i in range(N+1)]

ab.sort(key=lambda x: x[0])
ab2.sort(key=lambda x: x[1])
for i in reversed(range(1,N)):
    for j in range(T):
        if j < ab[i][0]:
            dp[i][j] = dp[i+1][j]
        else:
            dp[i][j] = max(dp[i+1][j], dp[i+1][j-ab[i][0]] + ab[i][1])
    tmp = dp[i][T-1] + max(ab[i-1][1],ab2[-1][1])
    ans = max(ans, tmp)
ans = max(ans,ab[0][1] + ab2[-1][1])
print(ans)



### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    N, T = map(int, input().split())
    ab = [list(map(int, input().split())) for i in range(N)]
    ab.sort(key=lambda x: (x[0], x[1]))
    dp = [-1 for i in range(T*2 + 1)]
    dp[0] = 0
    for a, b in ab:
        for i in range(T*2, 0, -1):
            if i >= a:
                if dp[i-a] >= 0 and i - a < T:
                    dp[i] = max(dp[i], dp[i-a] + b)

    for i in range(1, T*2+1):
        dp[i] = max(dp[i], dp[i-1])
    ans = dp[-1]

    ab.sort(key=lambda x: x[1])
    tmp = ab.pop()
    dp = [-1 for i in range(T)]
    dp[0] = 0
    for a, b in ab:
        for i in range(T-1, 0, -1):
            if i >= a:
                if dp[i-a] >= 0:
                    dp[i] = max(dp[i], dp[i-a] + b)

    for i in range(1, T):
        dp[i] = max(dp[i], dp[i-1])
    ans = max(ans, tmp[1] + dp[-1])

    # print(dp)
    print(ans)


main()
S, T = input()
print(T + S)

### FIXED CODE ###

s, t = input().split()
print(t + s)
a, b, c, x = [int(input()) for i in range(4)]
counter = 0

for rep1 in range(a + 1):
    for rep2 in range(b + 1):
        for rep3 in range(c + 1):
            if rep1 * 500 + rep2 * 100 + rep3 * 50 == x:
                counter += 1

print(counter)


### FIXED CODE ###

x, a, b = [int(input()) for i in range(3)]

print((x - a) % b)
input_data = []
data = input()



i=0
k=0

#最後二つが同じなら削除
inv_data=data[::-1]
memory=inv_data[0]
count=1
for ch in inv_data[1:]:
    if ch==memory:
        count+=1
    else:
        break
if count>=2:
    if count%2!=0:
        count-=1

    k+=count//2
    
    data=data[:len(data)-count] 


memory="first"
max_len=len(data)
while max_len!=i:
    if data[i] != memory:
        memory=data[i]
        i+=1             
    else:
   
        memory=data[i:i+2]
        i+=2
    k+=1
    
print(k)

### FIXED CODE ###

input_data = []
data = input()


memory="first"
i=0
k=0

#最後二つが同じなら削除
if data[-1]==data[-2]:
    k+=1
    data=data[:-2]

max_len=len(data)
while max_len!=i:
    try:
        if data[i] != memory:
            memory=data[i]
            i+=1             
        else:
            memory=data[i:i+2]
            i+=2
    except:
        break
    k+=1
    
print(k)
a, b, k = map(int ,input().split())
num = []
for i in range(a,b+1):
    num.append(i)
ans = []
for i in range(k):
    ans.append(num[i])
for i in range(-k,0):
    ans.append(num[i])

anss = list(set(ans))

for i in range(len(anss)):
    print(anss[i])

### FIXED CODE ###

a, b, k = map(int ,input().split())
if b-a+1 <= k:
    k = b-a+1
ans = []
for i in range(k):
    print(a+i)
    ans.append(a+i)
for i in range(-k+1,1):
    if b+i not in ans:
        print(b+i)
import sys
import math
from collections import defaultdict

input = sys.stdin.buffer.readline
MOD = 1000000007
N = int(input())
dd = defaultdict(int)
count = 1
iwashi = [list(map(int, input().split())) for _ in range(N)]


checked = defaultdict(bool)
zeros = 0

for i in range(N):
    if iwashi[i][0] == iwashi[i][1] == 0:
        zeros += 1
        continue
    iw = iwashi[i]
    gcd_iw = math.gcd(iw[0], iw[1])
    if gcd_iw != 0:
        iw = [iw[0] / gcd_iw, iw[1] / gcd_iw]
    if iw[0] < -1:
        iw *= -1
    dd[tuple(iw)] += 1
for key, val in dd.items():
    if checked[key]:
        continue
    vert_key = (key[1], -key[0]) if key[1] >= 0 else (-key[1], key[0])
    vert_val = dd[vert_key] if vert_key in dd else 0
    count *= (pow(2, val, MOD) - 1) + (pow(2, vert_val, MOD) - 1) + 1
    count %= MOD
    checked[vert_key] = True

# 0匹入れる場合を除外
count -= 1

count += zeros
print(count % MOD)


### FIXED CODE ###

import sys
import math
from collections import defaultdict

input = sys.stdin.buffer.readline
MOD = 1000000007
N = int(input())
dd = defaultdict(int)
count = 1
iwashi = [list(map(int, input().split())) for _ in range(N)]


checked = defaultdict(bool)
zeros = 0

for i in range(N):
    if iwashi[i][0] == iwashi[i][1] == 0:
        zeros += 1
        continue
    iw = iwashi[i]
    gcd_iw = math.gcd(iw[0], iw[1])
    if gcd_iw != 0:
        iw = list(map(lambda x: x // gcd_iw, iw))
    if iw[0] < 0:
        iw = list(map(lambda x: -x, iw))
    if iw[0] == 0 and iw[1] < 0:
        iw = list(map(lambda x: -x, iw))
    dd[tuple(iw)] += 1

for key, val in dd.items():
    if checked[key]:
        continue
    vert_key = (key[1], -key[0]) if key[1] > 0 else (-key[1], key[0])
    vert_val = dd[vert_key] if vert_key in dd else 0
    count *= (pow(2, val, MOD) - 1) + (pow(2, vert_val, MOD) - 1) + 1
    count %= MOD
    checked[vert_key] = True

# 0匹入れる場合を除外
count -= 1

count += zeros
print(count % MOD)
#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    N, M = map(int, input().split())
    a_list = [int(input()) for _ in range(M)]

    def comb(N):
        if N<0:
            return 0
        if N==0:
            return 1
        import numpy as np
        dp=np.zeros((3, N+1), dtype=np.int64)
        for j in range(1,N+1):
            dp[0][j] = 1
            for i in [1,2]:
                if j == i:
                    dp[i][j] = dp[i-1][j]
                else:
                    dp[i][j] = dp[1][j-i] + dp[2][j-i]
        return dp[1][N]+dp[2][N]
    p = 0
    divider = 1000000007
    ans = 1
    for a in a_list:
        r = comb(a-1-p)%divider
        ans = ans * r
        p = a + 1
    else:
        if a < N:
            r = comb(N-p)%divider
            ans = ans * r
    ans = ans%divider
    print(ans)
        

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc129","c",main)

### FIXED CODE ###

#%%
import sys
def input():
    return sys.stdin.readline().rstrip()

def main():
    N, M = map(int, input().split())
    a_list = [int(input()) for _ in range(M)]

    p = 0
    steps=[]
    m = 0
    for a in a_list:
        if a != 1:
            steps.append((p, a-1))
            m = max(m, a-p)
        p = a + 1
    else:
        steps.append((p, N))
        m = max(m, N-p+1)

    dp=[0 for _ in range(m+1)]

    divider = 1000000007
    dp[0], dp[1] = 1, 1
    for i in range(2,m+1):
        dp[i]=(dp[i-1]+dp[i-2])%divider

    ans = 1
    for p, n in steps:
        if n < p:
            ans = 0
            break
        else:
            r = dp[n-p]
        ans = (ans*r)%divider 

    print(ans)
        

# %%
if __name__ == '__main__':
    main()

# %%
# from atcoder_test import doTest
# doTest("abc129","c",main)
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

def calc(p, x, li, ans):
    ans[p] += x
    if len(li[p]) == 0:
        return
    for b in li[p]:
        calc(b, x, li, ans)

n, q = na()
li = [[] for i in range(n+1)]
ans = [0 for i in range(n+1)]
for i in range(n-1):
    a, b = na()
    li[a].append(b)

for i in range(q):
    p, x = na()
    calc(p, x, li, ans)
print(*ans[1:])







### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

from collections import deque
sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

def dfs(v, par):
    for nv in g[v]:
        if nv == par:
            continue
        memo[nv] += memo[v]
        dfs(nv, v)

n, q = na()
g = [deque() for _ in range(n)]
for i in range(n-1):
    a, b = na()
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)
memo = [0] * n
for i in range(q):
    #seen = [False] * n
    p, x = na()
    p -= 1
    memo[p] += x

dfs(0, -1)
print(*memo)
n = int(input())
arr = list(map(int, input().split()))

ans = 0
sum_arr = sum(arr)

for x in arr:
    ans += x * (sum_arr - x) // 2
    ans %= MOD

print(ans)

### FIXED CODE ###

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

MOD = 10**9 + 7

ans = 0
sum_arr = sum(arr)

for x in arr:
    sum_arr -= x
    ans += x * sum_arr
    ans %= MOD

print(ans)
import sys
input = sys.stdin.readline

qs = [list(input().split()) for _ in range(q)]

left = ''
right = ''


front = False
for i in qs:
    if(i[0] == '1'):
        front = not front
        continue

    f = int(i[1])
    c = i[2]
    if(front + f == 2):
        right = right + c
    else:
        left = left + c

if(not front):
    ans = left[::-1] + s + right
else:
    ans = right[::-1] + s[::-1] + left

print(ans)

### FIXED CODE ###

s = input()
q = int(input())

import sys
input = sys.stdin.readline

qs = [list(input().split()) for _ in range(q)]

left = ''
right = ''


front = False
for i in qs:
    if(i[0] == '1'):
        front = not front
        continue

    f = int(i[1])
    c = i[2]
    if(front + f == 2):
        right = right + c
    else:
        left = left + c

if(not front):
    ans = left[::-1] + s + right
else:
    ans = right[::-1] + s[::-1] + left

print(ans)
n=int(input())
d,x=map(int,input().split())

for i in range(n):
    A=0
    count=0
    while(A*int(input())+1<=d):
        count+=1
        A+=1
    x+=count
print(x)

### FIXED CODE ###

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

a=[int(input()) for _ in range(n)]
sum_count=0
for i in range(n):
    A=0
    count=0
    
    while(A*a[i]+1<=d):
        count+=1
        A+=1
    sum_count+=count
print(sum_count+x)
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,K=map(int,input().split())
    dp=[[[0]*2600 for _ in range(55)] for _ in range(55)]
    dp[0][0][0]=1
    for i in range(n):
        for j in range(n):
            for k in range(K+1):
                dp[i+1][j][k+2*j]+=(2*j+1)*dp[i][j][k]
                dp[i+1][j][k+2*j]%=MOD
                dp[i+1][j+1][k+2*(j+1)]+=dp[i][j][k]
                dp[i+1][j+1][k+2*(j+1)]%=MOD
                if(j>0):
                    dp[i+1][j-1][k+2*(j-1)]+=j*j*dp[i][j][k]
                    dp[i+1][j-1][k+2*(j-1)]%=MOD
    print(dp[n][0][K])
resolve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    n,K=map(int,input().split())
    dp=[[[0]*2700 for _ in range(55)] for _ in range(55)]
    dp[0][0][0]=1
    for i in range(n):
        for j in range(i+1):
            for k in range(K+1):
                dp[i+1][j][k+2*j]+=(2*j+1)*dp[i][j][k]
                dp[i+1][j][k+2*j]%=MOD
                dp[i+1][j+1][k+2*(j+1)]+=dp[i][j][k]
                dp[i+1][j+1][k+2*(j+1)]%=MOD
                if(j):
                    dp[i+1][j-1][k+2*(j-1)]+=j*j*dp[i][j][k]
                    dp[i+1][j-1][k+2*(j-1)]%=MOD
    print(dp[n][0][K])
resolve()
N, Y = map(int, input().split())

Y //= 1000
xmax = Y//10
flag = True

for x in range(xmax, -1, -1):
    if flag==False:
        break
    for y in range(N-x, -1, -1):
        if 9*x + 6*y == Y - N:
            xans = x
            yans = y
            zans = N - x - y
            flag = False
            break

print(xans, yans, zans)

### FIXED CODE ###

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

aMax = Y//10000

flag = False

for i in range(aMax+1):
    for j in range(N-i+1):
        if i*10000 + j*5000 + (N-i-j)*1000 == Y:
            a = i
            b = j
            c = N-i-j
            flag = True
            break
    if flag:
        break
            
if flag:
    print(a, b, c)
else:
    print(-1, -1, -1)
# -*- coding: utf-8 -*- 

rank = ["AAA", "AA", "A", "B", "C", "D", "E"]
ref0 = [35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0]
ref1 = [71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0]

while True:
  try:
    t1,t2 = map(float,input().split())
  except EOFError:
    break
  
  #print(len(rank))
  
  for i in range(len(rank)):
    if t1 < ref0[i] and t2 < ref1[i]:
      print(rank[i])
      break
  else:
    print("NA")
  

### FIXED CODE ###

# -*- coding: utf-8 -*- 

rank = ["AAA", "AA", "A", "B", "C", "D", "E"]
ref0 = [35.5, 37.5, 40.0, 43.0, 50.0, 55.0, 70.0]
ref1 = [71.0, 77.0, 83.0, 89.0, 105.0, 116.0, 148.0]

while True:
  try:
    t1,t2 = map(float,raw_input().split())
  except EOFError:
    break
  
  #print(len(rank))
  
  for i in range(len(rank)):
    if t1 < ref0[i] and t2 < ref1[i]:
      print rank[i]
      break
  else:
    print "NA"
n = int(input())
a = input().split()

for i in range(n):
    buka = a.count(str(i+1))
    print(buka)


### FIXED CODE ###

import math
r = int(input())
print(2*math.pi*r)
#入力
S=input()

#処理
l=len(S)
if l==0:
  t=1
else:
  t=0

X="AKIHABAR"
while len(S)!=0:
  if S[0]=="A":
    if S[0]==X[0]:
      S=S[1:]
      X=X[1:]
    else:
      t=1
      break
  else:
    if X[0]=="A":
      X=X[1:]
    else:
      if S[0]==X[0]:
      	S=S[1:]
      	X=X[1:]
      else:
        t=1
        break
        
if t==1:
  print("NO")
elif len(X)!=0:
  print("NO")
else:
  print("YES")
        


### FIXED CODE ###

#1
#入力
S=input()


#処理
import re
m=re.fullmatch(r'A?KIHA?BA?RA?',S)

if m==None:
    print("NO")
else:
    print("YES")