Harryxun/stf_run huggingface dataset:
n = int(input())
*A, = map(int, input().split())
inf = 10**18
X0 = (0, A[0])
X1 = (0, max(A[0], A[1]))
for i in range(2, n):
    X20 = max(X0[0]+A[i], X1[1]*(1-i % 2)+X1[0]*(i % 2))
    X21 = max(X0[1]+A[i], X1[1]*(1-i % 2)+(-inf)*(i % 2))
    X2 = (X20, X21)
    X0, X1 = X1, X2
if n % 2 == 1:
    print(X2[0])
else:
    print(X2[1])


### FIXED CODE ###

n = int(input())
*A, = map(int, input().split())
inf = 10**18
# DP[i][0]=i番目まででi//2個選んだ最大値
# DP[i][1]=i番目まででi//2+1個選んだ最大値
DP = [[-inf]*2 for i in range(n)]
DP[0][0] = 0
DP[0][1] = A[0]
DP[1][0] = 0
DP[1][1] = max(A[0], A[1])
for i in range(2, n):
    if i % 2 == 0:
        DP[i][0] = max(DP[i-2][0]+A[i], DP[i-1][1])
        DP[i][1] = DP[i-2][1]+A[i]
    else:
        DP[i][0] = max(DP[i-2][0]+A[i], DP[i-1][0])
        DP[i][1] = max(DP[i-2][1]+A[i], DP[i-1][1])
if n % 2 == 0:
    print(DP[n-1][1])
else:
    print(DP[n-1][0])
N, food = input().split()
S = set(range(1,food+1))
for i in range(N):
  k, *a = input().split()
  S &= set(a)
print(len(S))

### FIXED CODE ###

n,m=map(int,input().split())
S=set(range(1,m+1))
for i in range(n):
    K,*A=map(int,input().split())
    S&=set(A)
print(len(S))
from sys  import stdin,stdout

import bisect

import math

def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")

def soe(limit):
    l=[1]*(limit+1)
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0

    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r

l=soe(10**5)

def solve():
    n=inp()
    a=bisect.bisect_left(l,n)
    print(l[a])



for _ in range(1):
    solve()
    


### FIXED CODE ###

from sys  import stdin,stdout

import bisect

import math

def st():
    return list(stdin.readline().strip())

def inp():
    return int(stdin.readline())

def li():
    return list(map(int,stdin.readline().split()))

def mp():
    return map(int,stdin.readline().split())

def pr(n):
    stdout.write(str(n)+"\n")

def soe(limit):
    l=[1]*(limit+1)
    prime=[]
    for i in range(2,limit+1):
        if l[i]:
            for j in range(i*i,limit+1,i):
                l[j]=0

    for i in range(2,limit+1):
        if l[i]:
            prime.append(i)
    return prime

def segsoe(low,high):
    limit=int(high**0.5)+1
    prime=soe(limit)
    n=high-low+1
    l=[0]*(n+1)
    for i in range(len(prime)):
        lowlimit=(low//prime[i])*prime[i]
        if lowlimit<low:
            lowlimit+=prime[i]
        if lowlimit==prime[i]:
            lowlimit+=prime[i]
        for j in range(lowlimit,high+1,prime[i]):
            l[j-low]=1
    for i in range(low,high+1):
        if not l[i-low]:
            if i!=1:
                print(i)

def power(a,n):
    r=1
    while n:
        if n&1:
            r=(r*a)
        a*=a
        n=n>>1
    return r

l=soe(10**6 +100)

def solve():
    n=inp()
    a=bisect.bisect_left(l,n)
    
    print(l[a])



for _ in range(1):
    solve()
a,b = int(input())
c = a*B
if c%2==0:
  print("Even")
else:
  print("Odd")

### FIXED CODE ###

a, b = map(int, input().split())
if a*b % 2 == 0:
  print("Even")
else:
  print("Odd")
import math

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

x=0
if n<math.sqrt(m):
	for i in range(m//n):
		if m%(i+1)==0 and m//(i+1)>n-1:
			x=max(x,i+1)
	print(x)
else:
	for i in range(math.floor(math,sqrt(m))):
		if m%(i+1)==0 and m//(i+1)>n-1:
			x=max(x,i+1)
	print(x)



### FIXED CODE ###

import math

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

x=0

s = []
for i in range(math.floor(math.sqrt(m))+3):
	if m%(i+1)==0:
		s.append(i+1)
		s.append(m//(i+1))




for i in s:
	if m%(i)==0 and m//(i)>n-1:
		x=max(x,i)
print(x)
coffee = str(input())
iff3 = coffee[3]
iff4 = coffee[4]
iff5 = coffee[5]
iff6 = coffee[6]
if iff3 == iff4 :
    if iff5 == iff6 :
        print("Yes")
    if iff5 != iff6 :
        print("No")
if iff3 != iff4:
    print("No")

### FIXED CODE ###

a = input()
iff3 = a[2]
iff4 = a[3]
iff5 = a[4]
iff6 = a[5]
if iff3 == iff4 :
    if iff5 == iff6 :
        print("Yes")
    else :
        print("No")
else :
    print("No")
s=input()
k=int(input())
S=''
#for i in range(k):
#	S+=s
#print(s)
S = list(s)
#last_word=s[-1]
count=0
l_s=len(S)
code_list = 'abcdefghijklmnopqrstuvwxyz'
#print('step1')
if S[0]==S[1]:
  flag=False
else:
  flag=True
for i in range(1,l_s):
  #print(S,count)
  if S[i]==S[i-1] and i<l_s-1:
    for j in code_list:
      if j != S[i+1] and j !=S[i-1]:
        S[i]=j
        count+=1
        break
  elif S[i]==S[i-1]:
    for j in code_list:
      if j != S[i-1] and j !=S[0]:
        S[i]=j
        count+=1
        break
if S[-1]==S[0] and flag:
  plu=k-1
else:
  plu= 0
print(count*k+plu)

### FIXED CODE ###

s=input()
k=int(input())
code_list = 'abcdefghijklmnopqrstuvwxyz'

def c1(s):#len(s)>1
  count1=0
  S = list(s)
  l_s=len(S)
  for i in range(1,l_s):
    #print(S,count)
    if S[i]==S[i-1] and i<l_s-1:
      for j in code_list:
        if j != S[i+1] and j !=S[i-1]:
          S[i]=j
          count1+=1
          break
    elif S[i]==S[i-1]:
      for j in code_list:
        if j != S[i-1] and j !=S[0]:
          S[i]=j
          count1+=1
          break
  return count1,S[-1]

def c2(s,last):#k>2 and len(s)>1
  S=list(s)
  count2=0
  l_s=len(S)
  for i in range(0,l_s):
    #print(S,count)
    if i==0:
      if S[0]==last:
        for j in code_list:
          if j != S[i+1] and j !=last:
            S[i]=j
            count2+=1
            break
    elif S[i]==S[i-1] and i<l_s-1:
      for j in code_list:
        if j != S[i+1] and j !=S[i-1]:
          S[i]=j
          count2+=1
          break
    elif S[i]==S[i-1]:
      for j in code_list:
        if j != S[i-1] and j !=S[0]:
          S[i]=j
          count2+=1
          break
  return count2,S[-1]

def c3(s,last):#k>1 len(s)>1
  S=list(s)
  count3=0
  l_s=len(S)
  for i in range(0,l_s):
    #print(S,count)
    if i==0:
      if S[0]==last:
        for j in code_list:
          if j != S[i+1] and j !=last:
            S[i]=j
            count3+=1
            break
    elif S[i]==S[i-1] and i<l_s-1:
      for j in code_list:
        if j != S[i+1] and j !=S[i-1]:
          S[i]=j
          count3+=1
          break
    elif S[i]==S[i-1]:
      for j in code_list:
        if j != S[i-1]:
          S[i]=j
          count3+=1
          break
  return count3

if len(s)==1:
  print(k//2)
elif k==1:
  c,_=c1(s)
  print(c)
elif k==2:
  count1,last=c1(s)
  count3=c3(s,last)
  print(count1+count3)
else:
  if k%2==0:
    count1,last=c1(s)
    count21,last21=c2(s,last)
    count22,last22=c2(s,last21)
    count3=c3(s,last22)
    #print(count1,count2,count3)
    print(count1+count21*((k-2)//2)+count22*((k-2)//2)+count3)
  else:
    count1,last=c1(s)
    count21,last21=c2(s,last)
    if k>3:
      count22,last22=c2(s,last21)
    else:
      count22=0
    count3=c3(s,last21)
    #print(count1,count21,count22,count3)
    print(count1+count21*((k-2)//2+1)+count22*((k-2)//2)+count3)
print("YES" if 5, 7, 5 == map(int, input().split()) else "NO")

### FIXED CODE ###

A = sorted(list(map(int, input().split())))
print("YES" if A == [5,5,7] else "NO")
import sys

lines = sys.stdin.readlines()
size = int(lines[0])
data = lines[1:len(lines)]
for line in data:
    line = line.split(" ")
    inp = []
    for i in line:
        inp.append(float(i))
    x = []
    x.append(inp[0])
    x.append(inp[2])
    x.append(inp[4])
    x.append(inp[6])
    y = []
    y.append(inp[1])
    y.append(inp[3])
    y.append(inp[5])
    y.append(inp[7])
    tilt1 = (y[1]-y[0])/(x[1]-x[0])
    tilt2 = (y[3]-y[2])/(x[3]-x[2])
    if tilt1==tilt2:
        print ("YES")
    else:
        print ("NO")

### FIXED CODE ###

import sys
import decimal

lines = sys.stdin.readlines()
size = int(lines[0])
data = lines[1:len(lines)]
for line in data:
    line = line.split(" ")
    inp = []
    for i in line:
        inp.append(decimal.Decimal(i))
    x = []
    x.append(inp[0])
    x.append(inp[2])
    x.append(inp[4])
    x.append(inp[6])
    y = []
    y.append(inp[1])
    y.append(inp[3])
    y.append(inp[5])
    y.append(inp[7])
    if x[1]==x[0] and x[3]==x[2]:
        print ("YES")
    elif x[1]==x[0] or x[3]==x[2]:
        print ("NO")
    else:
        tilt1 = (y[1]-y[0])/(x[1]-x[0])
        tilt2 = (y[3]-y[2])/(x[3]-x[2])
        if tilt1==tilt2:
            print ("YES")
        else:
            print ("NO")
n,*a=map(int,open(0).read().split())
s,*l=[0]*100001
for i in a[:n]: s+=i; l[i]+=1
for b,c in zip(*[iter(a[n+1:])]*2): s+=(c-b)*l[b]; l[c]+=l[b]; l[b]=0; print(s)

### FIXED CODE ###

f=lambda:list(map(int,input().split()))
n,l,q=f()[0],f(),f()[0]
from collections import *
C=Counter(l)
s=sum(k*C[k] for k in C)
for _ in range(q):
  b,c=f()
  v=C[b]
  C[b]-=v
  C[c]+=v
  s+=(c-b)*v
  print(s)
n,d = list(map(int, input().split()))
x = [[0 for x in range(2)] for y in range(3)]

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

cnt = 0
for i in itertools.combinations(x, 2):
    y = i[0]
    z = i[1]
    res = 0
    for j in d:
        res +=(y[j]-z[j])**2

    res = math.sqrt(res)
    if res.is_integer():
        cnt+=1

print (cnt)


### FIXED CODE ###

import itertools
import math
 
n,d = map(int, input().split())
x = [[0 for x in range(d)] for y in range(n)]

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

cnt = 0
for i in itertools.combinations(x, 2):
    y = i[0]
    z = i[1]
    res = 0
    for j in range(d):
        res +=(y[j]-z[j])**2

    res = math.sqrt(res)
    if res.is_integer():
        cnt+=1

print (cnt)
N=int(input())
S = input()

if N==1:
  print(0)
  exit()
else:
  W=[1 if S[0]=="." else 0]
  ans=float("inf")

  for i in range(1,N):
    if S[i]==".":
      W.append(W[-1]+1)
    else:
      W.append(W[-1])
      
  if W[-1]==0 or W[-1]==N:
    print(0)
    eixt()

  for i in range(N):
    cost_W = i+1-W[i]
    cost_B = W[-1]-W[i]
    cost=cost_W+cost_B
    #print(N, W[-1], i+1, W[i])
    #print("cost_W:",cost_W,"cost_B:",cost_B,"Total",cost)
    ans=min(ans,cost)
    print(ans)

### FIXED CODE ###

N=int(input())
S = input()

W=[1 if S[0]=="." else 0]
ans=float("inf")

for i in range(1,N):
  if S[i]==".":
    W.append(W[-1]+1)
  else:
    W.append(W[-1])
    
if W[-1]==0 or W[-1]==N:
  print(0)
  exit()

for i in range(N):
  cost_W = i+1-W[i]
  cost_B = W[-1]-W[i]
  cost=cost_W+cost_B
  #print(N, W[-1], i+1, W[i])
  #print(i,"cost_W:",cost_W,"cost_B:",cost_B,"Total",cost)
  ans=min(ans,cost)
ans=min(W[-1],N-W[-1],ans)
print(ans)
W, H, x, y, r = map(int, input.split())
if x-r >= 0 and y-r >= 0 and x+r <= W and y+r <= H:
    print 'Yes'
print 'No'

### FIXED CODE ###

W, H, x, y, r = map(int, raw_input().split())
if x-r >= 0 and y-r >= 0 and x+r <= W and y+r <= H:
    print 'Yes'
else: print 'No'
mport math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n = I()
    p = LI_()
    x = LI()
    e = collections.defaultdict(list)
    for i in range(n-1):
        e[p[i]].append(i+1)

    def f(i):
        if not e[i]:
            return [0,x[i]]
        a = []
        tx = x[i]
        for c in e[i]:
            rc = f(c)
            if not rc:
                return
            tx += x[c]
            a.append(rc)
        xi = x[i]
        txx = xi
        s = set([c for c in a[0] if c <= txx])
        for cl in a[1:]:
            t = set()
            for c in s:
                for d in cl:
                    if c+d > txx:
                        continue
                    t.add(c+d)
            s = t
        if s:
            return [tx-xi, xi]
        return

    if f(0):
        return 'POSSIBLE'

    return 'IMPOSSIBLE'


print(main())






### FIXED CODE ###

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

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()


def main():
    n = I()
    p = LI_()
    x = LI()
    e = collections.defaultdict(list)
    for i in range(n-1):
        e[p[i]].append(i+1)

    def f(i):
        if not e[i]:
            return [0,x[i]]
        a = 0
        xi = x[i]
        xi1 = xi + 1
        tx = [0] * xi1
        tx[0] = 1
        for c in e[i]:
            rc = f(c)
            if not rc:
                return
            a += sum(rc)
            tt = [0] * xi1
            for i in range(xi1):
                if tx[i] == 0:
                    continue
                for c in rc:
                    if i+c < xi1:
                        tt[i+c] = 1
            tx = tt
        for i in range(xi,-1,-1):
            if tx[i] == 1:
                return [xi, a-i]
        return

    if f(0):
        return 'POSSIBLE'

    return 'IMPOSSIBLE'


print(main())
d = int(input())
print(int(d+d**2+d***3))

### FIXED CODE ###

k = int(input())
print(int(k+k**2+k**3))
import collections

n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0

c = collections.Counter(a)
d = list(c.keys())
e = list(c.values())

if n == 1:
    print(1)
    exit()
elif n == 2:
    if a[0] == a[1] or abs(a[0] - a[1]) == 1:
        print(2)
        exit()
    else:
        print(1)
        exit()


for i in range(n-2):
    if abs(d[i] - d[i+1]) == 1 and abs(d[i] - d[i+2]) == 2:
        num = e[i] + e[i+1] + e[i+2]
    elif abs(d[i] -d[i+1]) == 1:
        num = e[i] + e[i+1]
    else:
        num = e[i]
    if num > ans:
        ans = num

if d[-2] == d[-1] or abs(d[-2] - d[-1]) == 1:
    num = e[-2] + e[-1]
else:
    num = max(e[-2], e[-1])

if num > ans:
    ans = num

print(ans)

### FIXED CODE ###

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

t = max(a)
num_list = [0] * (t + 2)

for i in range(n):
    num_list[a[i]] += 1
    if a[i] == 0:
        continue
    else:
        num_list[a[i]-1] += 1
    if a[i] == t:
        continue
    else:
        num_list[a[i]+1] += 1

print(max(num_list))
from collections import Counter
n = int(input())
t = [input() for _ in range(n)]
init = ''.join(['a' for _ in range(50)])
for s in t:
    if len(init) > len(s):  init = s

t.remove(init)
init = {k:v for k,v in Counter([s for s in sorted(list(init))]).items()}

for s in t:
    for k,v in init.items():
        if s.count(k) < v:  init[k] = s.count(k)
ans = ''
for k,v in init.items():
    for i in range(v):  ans += k
print(ans)


### FIXED CODE ###

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

import sys
import os
import math


N = int(input())
s_list = []
for i in range(N):
    s_list.append(input().strip())

alphabets = 'abcdefghijklmnopqrstuvwxyz'

for c in alphabets:
    min_count = float('inf')
    for s in s_list:
        count = s.count(c)

        if count < min_count:
            min_count = count
    print(c * min_count, end='')
print()
Sd=input()
T=input()
 
i=len(Sd)-len(T)
j=0
ans=[]
flag=False
while(1):
    #print('searching',i,j,Sd[i],T[j])
    if Sd[i]==T[j] or Sd[i]=='?':
        #print('find',i,j,Sd[i],T[j])
        if j==len(T)-1:
            ans.append((Sd[:i-j]+T+Sd[i-j+len(T):]).replace('?','a'))
            i-=j+1
            j=0
            flag=True
            continue
        j+=1
        i+=1
    else:
        i-=j+1
        j=0
        if i<0:
            #print('not find')
            break

ans.sort()
if flag:
    print(ans[0])
else:
    print('UNRESTORABLE')

### FIXED CODE ###

Sd=input()
T=input()


i=len(Sd)-len(T)
j=0
ans=[]
flag=False
while(1):
    if i<0:
        #print('not find')
        break
    #print('searching',i,j,Sd[i],T[j])
    if Sd[i]==T[j] or Sd[i]=='?':
        #print('find',i,j,Sd[i],T[j])
        if j==len(T)-1:
            ans.append((Sd[:i-j]+T+Sd[i-j+len(T):]).replace('?','a'))
            i-=j+1
            j=0
            flag=True
            continue
        j+=1
        i+=1
    else:
        i-=j+1
        j=0

if flag:
    ans.sort()
    print(ans[0])
else:
    print('UNRESTORABLE')
n,m=map(int,input().split())
wa=0
ac=0
check = [0]*n
for _ in range(m):
	a, b = input().split()
	i = int(a)
	if check[i]==0:
		if b == "WA":
			wa+=1
		elif b == "AC":
			ac+=1
			check[i]=1
print(ac,wa)

### FIXED CODE ###

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

ac = [False] * N
wa = [0] * N
for _ in range(M):
    p, S = input().split()
    p = int(p) - 1
    if S == 'AC':
        ac[p] = True
    else:
        if not ac[p]:
            wa[p] += 1

a = 0
b = 0
for i in range(N):
    if ac[i]:
        a += 1
        b += wa[i]
print(*[a, b])
while 1:
 x, y = map(int, raw_input().split())
 if x <= y:
    print '%d %d' %(x, y)
 if y < x:
    print '%d %d' %(y, x)
 if x == y == 0:
    break

### FIXED CODE ###

while 1:
   x, y = map(int, raw_input().split())
   if x == 0 and y == 0:
      break
   elif x > y:
      print '%s %s' % (y,x)
   else:
      print '%s %s' % (x,y)
lst = dict({0: 1, 1: 1, 2: 2})
def calc(n):
    if (n in lst):
        return lst[n]
    else:
        lst[n] = calc(n-1) + calc(n-2)
        return lst[n]

N, M = [int(x) for x in input().split()]
a_list = [int(input()) for _ in range(M)]
span_list = [a_list[0]-1]
ans = -1
for i, a in enumerate(a_list[:-1]):
    if (a_list[i+1] - a) == 1:
        ans = 0
    else:
        span_list.append(a_list[i+1] - 2 - a)
if (ans == 0):
    print(ans)
else:
    span_list.append(N - a_list[-1] -1)
    max_span = max(span_list)
    for i in range(max_span+1):
        calc(i)
    ans = 1
    for span in span_list:
        ans = (ans * lst[span]) % (10**9+7)
    print(ans)


### FIXED CODE ###

from sys import setrecursionlimit
setrecursionlimit(10**7)
lst = dict({0: 1, 1: 1, 2: 2})
def calc(n):
    if (n in lst):
        return lst[n]
    else:
        lst[n] = calc(n-1) + calc(n-2)
        return lst[n]

N, M = [int(x) for x in input().split()]
if (M != 0):
    a_list = [int(input()) for _ in range(M)]
    span_list = [a_list[0]-1]
    for i, a in enumerate(a_list[:-1]):
        if (a_list[i+1] - a) == 1:
            print(0)
            exit()
        else:
            span_list.append(a_list[i+1] - 2 - a)
    span_list.append(N - a_list[-1] -1)
else:
    span_list = [N]
max_span = max(span_list)
for i in range(max_span+1):
    calc(i)
ans = 1
for span in span_list:
    ans = (ans * lst[span]) % (10**9+7)
print(ans)
n=int(input())
print('ABC') if n<1200 else if n<2800 print('ARC') else print('AGC')

### FIXED CODE ###

n=int(input())
print('ABC') if n<1200 else print('ARC') if n<2800 else print('AGC')
n = int(input())

#1行ずつ読んでやる方がスマートだけど、とりあえず見た目わかりやすい方で

t = (0) * n
x = (0) * n
y = (0) * n

t(0) = 0
x(0) = 0
y(0) = 0

for i in range(n):
  t(i+1),x(i+1),y(i+1) = map(int,input().split())

### FIXED CODE ###

n = int(input())

#1行ずつ読んでやる方がスマートだけど、とりあえず見た目わかりやすい方で

t = [0] * (n+1)
x = [0] * (n+1)
y = [0] * (n+1)

t[0] = 0
x[0] = 0
y[0] = 0

for i in range(n):
    t[i+1],x[i+1],y[i+1] = map(int,input().split())

aFlg = True #ダメとなるまでは見なしOK

for i,tm in enumerate(t):
  xm = 0
  ym = 0
  if i > 0:
    if x[i] > x[i-1]:
      xm = x[i] - x[i-1]
    else:
      xm = x[i-1] - x[i]

    if y[i] > y[i-1]:
      ym = y[i] - y[i-1]
    else:
      ym = y[i-1] - y[i]

    if xm + ym > (t[i] - t[i-1]):  #動きすぎ
      aFlg = False
      break
    elif ((t[i] - t[i-1]) - (xm+ym))%2 == 1:  #そこには止まれない
      aFlg = False
      break

if aFlg:
  print('Yes')
else:
  print('No')
n, k = map(int, input().split())

ks = [x for x in range(1, n+1) if x % k == 0]
k2s = [x for x in range(1, n+1) if x % (k//2) == 0]

if k % 2 == 0: # if even
    print(len(k2s))
else:
    print(len(ks))

### FIXED CODE ###

n, k = map(int, input().split())

ks = [x for x in range(1, n+1) if x % k == 0]

if k % 2 == 0: # if even
    k2s = [x for x in range(1, n+1) if x % (k//2) == 0 and x % k != 0] 
    print(len(ks) ** 3 + len(k2s) ** 3)
else:
    print(len(ks) ** 3)
N=int(input)
L-list(map(int,input().split()))
print(max(L)-min(L))

### FIXED CODE ###

N=int(input())
L=list(map(int,input().split()))
print(max(L)-min(L))
from sys import stdin, stdout
input = stdin.readline
print = stdout.write
n, m, k = map(int, input().split())
a, b = [0], [0]
a += list(map(int, input().split())),
b += list(map(int, input().split())),
for i in range(1, n + 1):
    a[i] += a[i - 1]
for i in range(1, m + 1):
    b[i] += b[i - 1]
i, j, z = 0, m, 0
while i <= n and a[i] <= k:
    while b[j] > k - a[i]:
        j -= 1
    z = max(z, i + j)
    i += 1
print(str(z))

### FIXED CODE ###

from sys import stdin, stdout
input = stdin.readline
print = stdout.write 
n, m, k = map(int, input().split())
a = [0] + list(map(int, input().split()))
b = [0] + list(map(int, input().split()))
for i in range(1, n + 1):
    a[i] += a[i - 1]
for i in range(1, m + 1):
    b[i] += b[i - 1]
i, j, z = 0, m, 0
while i <= n and a[i] <= k:
    while b[j] > k - a[i]:
        j -= 1
    z = max(z, i + j)
    i += 1
print(str(z))
import math
import copy
from functools import reduce
n = int(input())
a = list(map(int,input().split()))
ans = reduce(math.gcd,a)
if n<=2 or (min(a)==max(a)):
    print(max(a))
else:
    for i in range(n):
        _a = copy.copy(a)
        _a.pop(i)
        tmp = reduce(math.gcd,_a)
        if tmp > ans:
            print(tmp)
            break
        else:
            pass

### FIXED CODE ###

#EOFERROR
# import math
# import copy
# from functools import reduce
# n = int(input())
# a = list(map(int,input().split()))
# ans = reduce(math.gcd,a)
# if n<=2 or (min(a)==max(a)):
#     print(max(a))
# else:
#     for i in range(n):
#         _a = copy.copy(a)
#         _a.pop(i)
#         tmp = reduce(math.gcd,_a)
#         if tmp > ans:
#             print(tmp)
#             break
#         else:
#             pass

def gcd(a,b):
    if b>a :
        a,b = b,a
    while b:
        a,b = b,a%b
    return a

def cul(n,x):
    l = len(x)
    b = [x[i] for i in range(l)]
    b.pop(n)
    tmp = b[0]
    for i in range(1,l-1):
        tmp = gcd(tmp,b[i])
    return tmp

import sys
p = 50
N = int(input())
if p>N : p=N
a = list(map(int,input().split()))

ans = 0

for i in range(p):
    s = cul(i,a[:p])
    if s>ans : ans=s

print(ans)
s = list(input())
if(len(s) > 10):
  print("NO")
  exit()

ans = "AKIHABARA"
i = 0

while(i < len(ans) and len(s) <= len(ans)):
  if("".join(s) == ans):
    print("YES")
    exit()
  
  if(i == len(ans) - 1 or s[i] != ans[i]):
    s.insert(i, "A")
  else:
    i += 1

print("NO")

### FIXED CODE ###

import re
print("YES" if re.match("^A?KIHA?BA?RA?$", input()) else "NO")