Harryxun/stf_run huggingface dataset:
N = int(input())
S = input()
ans = 0
for i in range(1, N):
    # cnt = 0
    pass
    for j in range(N-i):
    #     if S[j] == S[i+j]:
    #         cnt += 1
    #     else:
    #         ans = max(ans, min(cnt, i))
    #         cnt = 0
    # ans = max(ans, min(cnt, i))
    pass
print(ans)


### FIXED CODE ###

N = int(input())
S = input()
ans = 0
for i in range(1, N):
    cnt = 0
    for j in range(N-i):
        if S[j] == S[i+j]:
            cnt += 1
            if cnt == i:
                ans = max(ans, i)
                break
        else:
            ans = max(ans, cnt)
            cnt = 0
    ans = max(ans, cnt)
print(ans)
H,W,A,B=map(int,input().split()
for i in range(B)
            print("0"*A +"1"*(W-A))
for i in range(H-B)
            print("1"*A +"0"*(W-A))

### FIXED CODE ###

H,W,A,B=map(int,input().split())
for i in range(B):
            print("0"*A +"1"*(W-A))
for i in range(H-B):
            print("1"*A +"0"*(W-A))
##mod,nについての制約は自分でいかに記入する
mod=10**9+7
def find_power(n,mod):
    # 0!からn!までのびっくりを出してくれる関数(ただし、modで割った値に対してである）
    powlist=[0]*(n+1)
    powlist[0]=1
    powlist[1]=1
    for i in range(2,n+1):
        powlist[i]=powlist[i-1]*i%(mod)
    return powlist
 #あるかずxのn乗をmodで割ったあまりを返す関数pow_cal(x,n,mod)
def pow_cal(x,n,mod):
    if n==0:
        return 1
    elif n==1:
        return x%mod
    elif n>=2:
        if n%2==0:
            return (pow_cal(x,n//2,mod)**2)%mod
        else:
            return (x*pow_cal(x,n//2,mod)**2)%mod

def find_inv_power(n,mod):
    #0!からn!までの逆元を素数modで割ったあまりリストを作る関数
    c=1
    uselist=[0 for i in range(n+1)]
    for i in range(1,n+1):
        c*=i
        c%=mod
    first=pow_cal(c,mod-2,mod)
    uselist[n]=first
    for i in range(n,0,-1):
        uselist[i-1]=(uselist[i]*i)%(mod)
    return uselist
    
A=find_power(2*10**6,mod)
B=find_inv_power(2*10**6,mod)

def combi(n,r,mod):
    if n<r:
        return 0
    elif n>=r:
        return (A[n]*B[r]*B[n-r])%(mod)
    
r1,c1,r2,c2=map(int,input().split())

mod=10**9+7     

K=combi(r2+c2+2,c2+1,mod)-combi(r2+c1+1,c1,mod)-combi(r1+c2+1,r1,mod)+combi(r1+c1,c1,mod)

print(K%mod)


### FIXED CODE ###


##mod,nについての制約は自分でいかに記入する
mod=10**9+7
def find_power(n,mod):
    # 0!からn!までのびっくりを出してくれる関数(ただし、modで割った値に対してである）
    powlist=[0]*(n+1)
    powlist[0]=1
    powlist[1]=1
    for i in range(2,n+1):
        powlist[i]=powlist[i-1]*i%(mod)
    return powlist
 #あるかずxのn乗をmodで割ったあまりを返す関数pow_cal(x,n,mod)
def pow_cal(x,n,mod):
    if n==0:
        return 1
    elif n==1:
        return x%mod
    elif n>=2:
        if n%2==0:
            return (pow_cal(x,n//2,mod)**2)%mod
        else:
            return (x*pow_cal(x,n//2,mod)**2)%mod

def find_inv_power(n,mod):
    #0!からn!までの逆元を素数modで割ったあまりリストを作る関数
    c=1
    uselist=[0 for i in range(n+1)]
    for i in range(1,n+1):
        c*=i
        c%=mod
    first=pow_cal(c,mod-2,mod)
    uselist[n]=first
    for i in range(n,0,-1):
        uselist[i-1]=(uselist[i]*i)%(mod)
    return uselist
    
A=find_power(2*10**6+10,mod)
B=find_inv_power(2*10**6+10,mod)

def combi(n,r,mod):
    if n<r:
        return 0
    elif n>=r:
        return (A[n]*B[r]*B[n-r])%(mod)
    
r1,c1,r2,c2=map(int,input().split())

mod=10**9+7     

K=combi(r2+c2+2,c2+1,mod)-combi(r2+c1+1,c1,mod)-combi(r1+c2+1,r1,mod)+combi(r1+c1,c1,mod)

print(K%mod)
N = int(input())
S = sorted([int(input()) for _ in range(N)])

non_10s = None
for s in S:
    if s % 10 != 0:
        non_10s = s
        break

answer = sum(S)

if answer % 10 ==0 and non_10s != None:
  answer -= non_10s
elif answer % 10 == 0:
  answer -= non_10s
else:
  answer = answer
print(answer)

### FIXED CODE ###

N = int(input())
S = sorted([int(input()) for _ in range(N)])

non_10s = None
for s in S:
    if s % 10 != 0:
        non_10s = s
        break

answer = sum(S)

if answer % 10 == 0 and non_10s != None:
  answer -= non_10s
elif answer % 10 == 0:
  answer = 0
else:
  answer = answer
print(answer)
a = list(map(int, input().split(' ')))
result = sum(a)
b_ = {}
for i in range(m):
    b, c = map(int, input().split(' '))
    b_[c] = b_.get(c, 0)
    b_[c] += b
if max(b_.keys()) < min(a):
    print(result)
else:
    a.sort()
    for j in range((len(a)-1)//2 + 2):
        t = max(b_.keys())
        if a[j] < t:
            a[j] = t
            b_[t] -= 1
        if b_[t] == 0:
            b_.pop(t)
        if b_ == {}:
            break
        t = max(b_.keys())        
        if a[n - j -1] < t:
            a[n-j-1] = t
            b_[t] -= 1
        if b_[t] == 0:
            b_.pop(t)
        if b_ == {}:
            break
    print(sum(a))

### FIXED CODE ###


n, m = map(int, input().split(' '))
a = list(map(int, input().split(' ')))
result = sum(a)
b_ = []
for i in range(m):
    b, c = map(int, input().split(' '))
    b_ += [(b,c)]
for i in range(n):
    b_ += [(1, a[i])]

from operator import itemgetter
b_.sort(key=itemgetter(1), reverse=True)

count = n
res = 0
for j, k in b_:
    if count > j:
        res += k * j
        count -= j
    elif count <= j:
        res += k * count
        break
print(res)
S = input()
if S == 'Sunny':
  print 'Cloudy'
else if S == 'Cloudy':
  print 'Rainy'
else:
  print 'Sunny'

### FIXED CODE ###

s=input()
if s=='Sunny':
  print('Cloudy')
elif s=='Cloudy':
  print('Rainy')
else:
  print('Sunny')
n=int(input())
ls = map(int,input().split())
ls.sort()
ls.reverse()
ans=0
t = 1
for i in range(n) :
 ans += t * ls[i]
 t *= -1
print(ans)

### FIXED CODE ###

n=int(input())
ls = list(map(int,input().split()))
ls.sort()
ls.reverse()
ans=0
t = 1
for i in range(n) :
 ans += t * ls[i]
 t *= -1
print(ans)
data_ls = []
for i in range(5):
  data_ls.append(int(input()))
k = int(input())
sort(data_ls)
if data_ls[-1] - data_ls[0] > k:
  print("Yay!")
else:
  print(":(")

### FIXED CODE ###

data_ls = []
for i in range(5):
  data_ls.append(int(input()))
k = int(input())
data_ls.sort()
if data_ls[-1] - data_ls[0] > k:
  print(":(")
else:
  print("Yay!")
A = int(input())
B = int(input())
if ((A < 9) and (B < 9)):
    print('Yay!')
else:
    print(':(')


### FIXED CODE ###

A, B = map(int, input().split())
if A <= 8 and B <= 8:
    print('Yay!')
else:
    print(':(')
K=int(input())
S=input()

if len(S) > K:
    print(S[:K]+"..."
else:
    print(S)

### FIXED CODE ###

K=int(input())
S=input()

if len(S) > K:
    print(S[:K]+"...")
else:
    print(S)
N=int(input())
c=0
INF=2000000
x=[]
y=[]

rN=int(N**0.5)

for i in range(rN):
    if (i>1)&(i%2==1) : continue
    xi = rN - i
    for j in range(rN-i) :
        yj= rN - j
        if ((xi)*(yj))==N:
            x=xi
            y=yj
            C=1
            break
    if c==1:break


d=x+y-2
print(d)

### FIXED CODE ###

N=int(input())
c=0
d=10000000000000
rN=int(N**0.5)

for i in range(rN):
    if (N%(i+1)==0) :
        x=i+1
        y=int(N/(i+1))
        if d>(x+y):
            d=x+y

print(d-2)
N = int(raw_input())
A = map(int,raw_input().split())

all_count = 0
for i in range(N):
	a_x = A[i]
	a_s = A[i]
	count=1
	flag = True
	for j in range(N-i-1):
		if flag:
			a_x = a_x ^ A[i+j+1]
			a_s = a_x | A[i+j+1]
			if a_x == a_s:
				count+=1
			else:
				flag=False
	all_count += count
	
print all_count

### FIXED CODE ###

A, B = map(int,raw_input().split())

M = max([A+B,A-B,A*B])
print M
n=1000000
p=[1]*(n+1)
p[0],p[1]=0,0
for i in range(2,int(n**0.5)+1):
    if p[i]:        
        for j in range(i*i,n+1,i):
            p[j]=0
p=[i for i in range(n+1) if p[i]==1]
while 1:
    try:n=int(input())
    except:break
    i=p.index(n)
    print(p[i-1],p[i+1])

### FIXED CODE ###

n=1000000
p=[1]*(n+1)
p[0],p[1]=0,0
for i in range(2,int(n**0.5)+1):
    if p[i]:        
        for j in range(i*i,n+1,i):
            p[j]=0
p=[i for i in range(n+1) if p[i]==1]
while 1:
    try:n=int(input())
    except:break
    for i in range(len(p)):
        if p[i]==n:
            print(p[i-1],p[i+1])
            break 
        elif p[i]>n:
            print(p[i-1],p[i])
            break
import sys
s=input()
t=input()
s=sorted(list(s))
t=sorted(list(t))[::-1]
sum=0
for i in range(len(s)):
    if chr(s[i])<chr(s[t]):
        print("Yes")
        sys.exit()
print("No")



### FIXED CODE ###

s=input()
t=input()
s="".join(sorted(list(s)))
t="".join(sorted(list(t))[::-1])
if s<t:
    print("Yes")
else:
    print("No")
R, G = map(int, input().split())
print(2*G-R)

### FIXED CODE ###

R = int(input())
G = int(input())
print(2*G-R)
import bisect
n,m=map(int,input().split())
a=list(map(int, input().split()))
if len(a)==1:
  print(int(a[0]/(2**m)))
  exit(0)
a=sorted(a)
while 0<m:
  x=a.pop(-1)
  y=x//a[-1]
  if y>m:
    y=m
  x=int(x/(2**y))
  bisect.insort_right(a, x)
  m-=y
print(sum(a))

### FIXED CODE ###

import heapq

n, m = map(int, input().split())
a = list(map(lambda x: int(x)*(-1), input().split()))
heapq.heapify(a)
for _ in range(m):
  tmp_min = heapq.heappop(a)
  heapq.heappush(a, (-1)*(-tmp_min//2))
print(-sum(a))
x = input()
youbi = {
  'SUN': 7
  , 'MON': 6
  , 'TUE': 5
  , 'WED': 4
  , 'THU': 3
  , 'TRI': 2
  , 'SAT': 1
}
print(youbi[x])

### FIXED CODE ###

x = input()
youbi = {
  'SUN': 7
  , 'MON': 6
  , 'TUE': 5
  , 'WED': 4
  , 'THU': 3
  , 'FRI': 2
  , 'SAT': 1
}
print(youbi[x])
x

### FIXED CODE ###



import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
##############################

# http://mkan-0141.hatenablog.com/entry/2018/02/18/224008


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

if(C[0][0] - C[0][1] == C[1][0] - C[1][1] and # a1のb1<>b2 と a2のb1<>b2の比較
   C[1][0] - C[1][1] == C[2][0] - C[2][1] and # a2のとa3の b1<>b2の比較
   C[0][1] - C[0][2] == C[1][1] - C[1][2] and # a0のとa1のb2<>b3の比較
   C[1][1] - C[1][2] == C[2][1] - C[2][2]):   # a2のとa3のb2<>b3の比較
    print('Yes')
else:
    print('No')
#c.py
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
def lcm(a, b):
    return a * b / gcd(a,b)
a,b,c,d = map(int,input().split())
canC = int(b//c) -int((a-1)//c)
canD = int(b//d) - int((a-1)//d))
dbCD = int(b//lcm(c,d)) -int((a-1)//lcm(c,d))
print((b-a+1) -canC - canD + dbCD)


### FIXED CODE ###

#c.py
def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)
def lcm(a, b):
    return a * b // gcd(a,b)
a,b,c,d = map(int,input().split())
canC = int(b//c) -int((a-1)//c)
canD = int(b//d) - int((a-1)//d)
dbCD = int(b//lcm(c,d)) -int((a-1)//lcm(c,d))
print((b-a+1) -canC - canD + dbCD)
A = [list(map(int, input().split())) for i in range(3)]

n = int(input())

for j in range(n):
    b = int(input())
    for l in range(3):
        if A[l][0] == b:
            A[l][0] = 0
        if A[l][1] == b:
            A[l][1] = 0
        if A[l][2] == b:
            A[l][2] = 0

if A[0][0]==A[1][1]==A[2][2]==0:
    print("Yes")
elif A[0][2]==A[1][1]==A[2][0]==0:
    print("Yes")     
elif for k in range(3):
    if A[k][0]==A[k][1]==A[k][2]==0:
        print("Yes")
    elif A[0][k]==A[1][k]==A[2][k]==0:
        print("Yes")
else:
    print("No")

### FIXED CODE ###

A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))
A3 = list(map(int, input().split()))
n = int(input())

for i in range(n):
    b = int(input())
    for j in range(3):
        if A1[j] == b:
            A1[j] = 0
        if A2[j] == b:
            A2[j] = 0
        if A3[j] == b:
            A3[j] = 0

if A1[0]==A1[1]==A1[2]==0:
    print("Yes")
    exit
elif A2[0]==A2[1]==A2[2]==0:
    print("Yes")
    exit
elif A3[0]==A3[1]==A3[2]==0:
    print("Yes")
    exit

elif A1[0]==A2[0]==A3[0]==0:
    print("Yes")
    exit
elif A1[1]==A2[1]==A3[1]==0:
    print("Yes")
    exit
elif A1[2]==A2[2]==A3[2]==0:
    print("Yes")
    exit
    
elif A1[0]==A2[1]==A3[2]==0:
    print("Yes")
    exit
elif A1[2]==A2[1]==A3[0]==0:
    print("Yes")
    exit
else:
    print("No")
N,K=map(int,input().split())
L=list(map(int,input().split()))
R=list()
if K>=N:
  sums=0
  c=[0]*K
  for i in range(N):
    sums+=L[i]
    sums%=K
    a=(sums-i-1)%K
    R.append(a)
    c[a]+=1
  ans=0
  for i in range(N):
    ans+=(c[i]-1)*c[i]//2
  print(ans+c[0])
else:
  ans=0
  c=[0]*K
  sums=0
  for i in range(N):
    sums+=L[i]
    sums%=K
    a=(sums-i-1)%K
    R.append(a)
  for i in range(K-1):
    c[R[i]]+=1
  ans+=c[0]
  c[R[K-1]]+=1
  for i in range(N):
    if i<N-K:
      ans+=c[R[i]]-1
      c[R[i]]-=1
      c[R[i+K]]+=1
    else:
      ans+=c[R[i]]-1
      c[R[i]]-=1
  print(ans)

### FIXED CODE ###

N,K=map(int,input().split())
L=list(map(int,input().split()))
R=list()
if K>=N:
  sums=0
  c=dict()
  for i in range(N):
    sums+=L[i]
    sums%=K
    a=(sums-i-1)%K
    if a in c:
      c[a]+=1
    else:
      c[a]=1
  ans=0
  for i in c:
    ans+=(c[i]-1)*c[i]//2
  if 0 in c:
    print(ans+c[0])
  else:
    print(ans)
else:
  ans=0
  c=[0]*K
  sums=0
  for i in range(N):
    sums+=L[i]
    sums%=K
    a=(sums-i-1)%K
    R.append(a)
  for i in range(K-1):
    c[R[i]]+=1
  ans+=c[0]
  c[R[K-1]]+=1
  for i in range(N):
    if i<N-K:
      ans+=c[R[i]]-1
      c[R[i]]-=1
      c[R[i+K]]+=1
    else:
      ans+=c[R[i]]-1
      c[R[i]]-=1
  print(ans)
L=input()
mod=10**9+7



N=[int(i) for i in L]
keta=len(N)
dp=[[0 for i in range(2)] for j in range(101)]
dp[0][0] = 1
#dp[0][0][1] =0
#dp[0][1][0] =0
#dp[0][1][1] =0

for i in range(keta):
    for smaller in [0,1]:
        if 1:
            for x in range(2 if smaller else (N[i]+1)):
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))]+= dp[i][smaller]*(2 if x==1 else 1)
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))] %=mod
print((dp[keta][0]+ dp[keta][1])%mod)


### FIXED CODE ###

L=input()
mod=10**9+7



N=[int(i) for i in L]
keta=len(N)
dp=[[0 for i in range(2)] for j in range(keta+1)]
dp[0][0] = 1
#dp[0][0][1] =0
#dp[0][1][0] =0
#dp[0][1][1] =0

for i in range(keta):
    for smaller in [0,1]:
        if 1:
            for x in range(2 if smaller else (N[i]+1)):
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))]+= dp[i][smaller]*(2 if x==1 else 1)
                dp[i + 1][smaller | ((x == 0)&(N[i]==1))] %=mod
print((dp[keta][0]+ dp[keta][1])%mod)
N, K = map(int,input().split())
ls_pass = list(map(int,input().split()))
ls_pass.insert(0,0)
a=1
b=0
ls_past=[1]
for i in range(1,N+1):
  b=a
  a=ls_pass[a]
  if b==a:
    print(a)
    break
  elif a in ls_past:
    c=ls_past.index(a)
    ls_cicle=ls_past[c:i]
    print(ls_cicle[(K-i)%(i-c)])
    break
  elif i=K:
    print(a)
    break
  else:
    ls_past.append(a)

### FIXED CODE ###

N, K = map(int,input().split())
ls_pass = [0]+list(map(int,input().split()))
a=1
b=0

ls=["ンゴ"]+[0]+["ンゴ"]*(N-1)
ls_past=[1]
for i in range(1,N*3):
  b=a
  a=ls_pass[a]
  if ls[a]!="ンゴ":
    ls_cicle=ls_past[ls[a]:i]
    print(ls_cicle[(K-i)%len(ls_cicle)])
    break
  elif i==K:
    print(a)
    break  
  else:
    ls_past.append(a)
    ls[a]=i
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
  elif i >= n:
    return False
  else:
    res = solve( i+1 , m ) | solve( i+1 , m-A[i] )
    return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"
   

### FIXED CODE ###

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

def solve(i, m):
  if m == 0:
    return True
  elif i >= n or m > sum(A):
    return False

  res = solve( i+1 , m ) or solve( i+1 , m-A[i] )
  return res

for m in mi:
  if solve( 0 , m ): print "yes"
  else: print "no"
s = input().strip()
t = input().strip()

print "Yes" if s == t[:len(s)] and len(t) == len(s) + 1 else "No"

### FIXED CODE ###

s = input().strip()
t = input().strip()

if s == t[:len(s)] and len(t) == len(s) + 1:
    print("Yes")
else:
    print("No")
r, g, b = input()

num = r + g + b
num = int(num)

if num % 4== 0:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

r, g, b = input().split(" ")
num = int(r + g + b)
if num % 4 == 0:
  print("YES")
else:
  print("NO")
def cal(lst1, lst2, lst3):
    for i in range(3):
        if lst1[i] in lst3:
            lst2[i] = 1

def judge(a, b, c):
    if a == 1 and (a == b == c):
        return True
    else:
        return False

A_1 = list(map(int, input().split()))
A_2 = list(map(int, input().split()))
A_3 = list(map(int, input().split()))
N = int(input())
b = [int(input()) for _ in range(N)]
C_1 = [0, 0, 0]
C_2 = [0, 0, 0]
C_3 = [0, 0, 0]
cal(A_1, C_1, b)
cal(A_2, C_2, b)
cal(A_3, C_3, b)

a, b, c, d, e, f, g, h = False
# 縦
a = judge(C_1[0], C_2[0], C_3[0])
b = judge(C_1[1], C_2[1], C_3[1])
c = judge(C_1[2], C_2[2], C_3[2])

# 横
d = judge(C_1[0], C_1[1], C_1[2])
e = judge(C_2[0], C_2[1], C_2[2])
f = judge(C_3[0], C_3[1], C_3[2])

g = judge(C_1[0], C_2[1], C_3[2])
h = judge(C_1[2], C_2[1], C_3[0])

lst = [a, b, c, d, e, f, g]

if True in lst:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

def cal(lst1, lst2):
    lst3 = [0, 0, 0]
    for i in range(3):
        if lst1[i] in lst2:
            lst3[i] = 1
    return lst3

def judge(a, b, c):
    if (a == 1) and (a == b == c):
        return True
    else:
        return False

A_1 = list(map(int, input().split()))
A_2 = list(map(int, input().split()))
A_3 = list(map(int, input().split()))
N = int(input())
b = [int(input()) for _ in range(N)]

C_1 = []
C_2 = []
C_3 = []

C_1 = cal(A_1, b)
C_2 = cal(A_2, b)
C_3 = cal(A_3, b)

a = judge(C_1[0], C_2[0], C_3[0])
b = judge(C_1[1], C_2[1], C_3[1])
c = judge(C_1[2], C_2[2], C_3[2])

d = judge(C_1[0], C_1[1], C_1[2])
e = judge(C_2[0], C_2[1], C_2[2])
f = judge(C_3[0], C_3[1], C_3[2])

g = judge(C_1[0], C_2[1], C_3[2])
h = judge(C_1[2], C_2[1], C_3[0])

lst = [a, b, c, d, e, f, g, h]

if True in lst:
    print('Yes')
else:
    print('No')
# -*- coding: utf-8 -*-
        N=int(input())
        for i in range(N+1):
          i+=i
        print(i)

### FIXED CODE ###

# -*- coding: utf-8 -*-
N=int(input())
s=0
for i in range(N+1):
    s += i
print(s)
N, M = map(int, input().split())
A = list(map(int, input().split()))
cost = [-1, 2, 5, 5, 4, 5, 6, 3, 7, 6]
can_cost = sorted([cost[a] for a in A])
D = {}
for a in A:
    c = cost[a]
    D[c] = max(a, D.setdefault(c, -1))

min_cost = can_cost[0]
min_cost_num = D[min_cost]


def f2(v, l, num):
    L = list(str(v))
    min_cost = cost[int(num)]
    num = D.setdefault(min_cost + l, -1)
    if num == -1:
        return -1

    min_cost_num = D[min_cost]
    L[L.index(str(min_cost_num))] = str(num)
    L.sort(reverse=True)
    return int("".join(L))


def f(v, l):
    L = list(str(v))
    set_L = set(L)
    L2 = [f2(v, l, num) for num in set_L]
    return max(L2)

def g(K, r)

    temp = int("".join([str(min_cost_num)] * K))
    dp = [[-1 for _ in range(min(r, K) + 1)] for __ in range(r + 1)]
    dp[0][0] = temp

    for k in range(min(r, K)):
        for n in range(r):
            v = dp[n][k]
            if v == -1:
                continue
            for l in range(1, r - n + 1):
                dp[n + l][k + 1] = max(dp[n + l][k + 1], f(v, l))
    return max(dp[r])

K = N // min_cost
r = N - K * min_cost
res = g(K, r)
if g(K, r) == -1:
    res = g(K - 1, r + min_cost)
print(res)

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
cost = [-1, 2, 5, 5, 4, 5, 6, 3, 7, 6]
can_cost = sorted([cost[a] for a in A])
D = {}
for a in A:
    c = cost[a]
    D[c] = max(a, D.setdefault(c, -1))

min_cost = can_cost[0]
min_cost_num = D[min_cost]


def f2(v, l, num):
    L = list(str(v))
    min_cost = cost[int(num)]
    num = D.setdefault(min_cost + l, -1)
    if num == -1:
        return -1

    min_cost_num = D[min_cost]
    L[L.index(str(min_cost_num))] = str(num)
    L.sort(reverse=True)
    return int("".join(L))


def f(v, l):
    L = list(str(v))
    set_L = set(L)
    L2 = [f2(v, l, num) for num in set_L]
    return max(L2)

def g(K, r):
    temp = int("".join([str(min_cost_num)] * K))
    dp = [[-1 for _ in range(min(r, K) + 1)] for __ in range(r + 1)]
    dp[0][0] = temp

    for k in range(min(r, K)):
        for n in range(r):
            v = dp[n][k]
            if v == -1:
                continue
            for l in range(1, r - n + 1):
                dp[n + l][k + 1] = max(dp[n + l][k + 1], f(v, l))
    return max(dp[r])

K = N // min_cost
r = N - K * min_cost
res = g(K, r)
if g(K, r) == -1:
    res = g(K - 1, r + min_cost)
print(res)
def transfer(a,b,B):
    a -= 1
    b += 1
    ans.append(B)
n,A,B,C = map(int,input().split())
flag = True
ans = []
s = []
for i in range(n):
    s.append(input())
for i in range(n):
    if s[i] == "AB":
        if A == 0 and B == 0:
            flag = False
        elif A == 1 and B == 1:
            if s[i+1] == "BC":
                transfer(A,B,"B")
            else:
                transfer(B,A,"A")
        elif A >= B:
            transfer(A,B,"B")
        else:
            transfer(B,A,"A")
    if s[i] == "AC":
        if A == 0 and C == 0:
            flag = False
        elif A == 1 and C == 1:
            if s[i+1] == "BC":
                transfer(A,C,"C")
            else:
                transfer(C,A,"A")
        elif A >= C:
            transfer(A,C,"C")
        else:
            transfer(C,A,"A")
    if s[i] == "BC":
        if B == 0 and C == 0:
            flag = False
        elif B == 1 and C == 1:
            if s[i+1] == "AC":
                transfer(B,C,"C")
            else:
                transfer(C,B,"B")
        elif B >= C:
            transfer(B,C,"C")
        else:
            transfer(C,B,"B")
if flag:
    print("Yes")
    for i in ans:
        print(i)
else:
    print("No")

### FIXED CODE ###

n,A,B,C = map(int,input().split())
flag = True
ans = []
s = []
for i in range(n):
    s.append(input())
s.append("")
for i in range(n):
    if s[i] == "AB":
        if A == 0 and B == 0:
            flag = False
        elif A == 1 and B == 1:
            if s[i+1] == "BC":
                A -= 1
                B += 1
                ans.append("B")
            else:
                B -= 1
                A += 1
                ans.append("A")
        elif A >= B:
            A -= 1
            B += 1
            ans.append("B")
        else:
            B -= 1
            A += 1
            ans.append("A")
    if s[i] == "AC":
        if A == 0 and C == 0:
            flag = False
        elif A == 1 and C == 1:
            if s[i+1] == "BC":
                A -= 1
                C += 1
                ans.append("C")
            else:
                C -= 1
                A += 1
                ans.append("A")
        elif A >= C:
            A -= 1
            C += 1
            ans.append("C")
        else:
            C -= 1
            A += 1
            ans.append("A")
    if s[i] == "BC":
        if B == 0 and C == 0:
            flag = False
        elif B == 1 and C == 1:
            if s[i+1] == "AC":
                B -= 1
                C += 1
                ans.append("C")
            else:
                C -= 1
                B += 1
                ans.append("B")
        elif B >= C:
            B -= 1
            C += 1
            ans.append("C")
        else:
            C -= 1
            B += 1
            ans.append("B")
if flag:
    print("Yes")
    for i in ans:
        print(i)
else:
    print("No")
import collections

# def get_lim(n):
#     # for i in range(n):
#     #     if i * i > n:
#     #         return i + 1
#     return pow(10, int((len(str(n)) / 2)))

def prime_factor(n, length):
    ass = collections.defaultdict(int)
    # break_num = pow()
    # for i in range(2,int(n**0.5)+1):
    # lim = get_lim(n)
    for i in range(2, n):
        # print(pow(i, length),  n)
        # if pow(i, length) > n:
        #     break
        if i > n or n == 1:
            break
        print(n, i)
        # i = pow(i, num)
        while n % i==0:
            ass[i] += 1
            n = n//i

    if n != 1:
        ass[n] += 1
    return ass

if __name__ == '__main__':
    length, num = list(map(int, input().split()))

    if length == 1:
        print(num)
    else:

        soinnsuu = prime_factor(num, length)
        ans = 1
        # print(soinnsuu)
        for data in soinnsuu.keys():
            if soinnsuu[data] >= length:
               ans *= data
        print(ans)

### FIXED CODE ###

print(input().count('2'))
N = input()
if a,e,i,o,u in N
	print("vowel")
else
	print("consonant")
  

### FIXED CODE ###

N = input()
if N in "aiueo":
	print("vowel")
else:
	print("consonant")