peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n = int(input())
s = input()
t = input()


ans = []

for i in range(n):
    if (s[i] == t[0]):
        for j in range(0, n - i):
            if (s[i + j] != t[j]):
                break
        else:
            ans+=t
            #print(t)
            break

    #else:
    ans.append(s[i])
#        print(s[i],end="")
else:
    ans+=t
    #print(t)
#print(ans)
print(len(ans))
# Judge status: Accepted
N,M=map(int,input().split())

a=[list(map(int, input().split())) for i in range(N)]
c=[list(map(int, input().split())) for i in range(M)]
ans=[]

for i in range(N):
  dmin=2*10**8
  cnum=0
  for j in range(M):
    d=abs(a[i][0]-c[j][0])+abs(a[i][1]-c[j][1])
    if d<dmin:
      dmin=d
      cnum=j
  ans.append(cnum+1)
print(*ans)
# Judge status: Accepted
a, b = map(int, input().split())

if a <= b:
    print(str(a)*b)
else:
    print(str(b)*a)
# Judge status: Accepted
import math

N = int(input())

X = math.ceil(N / 1.08)

if math.floor(X * 1.08) == N:
    print(X)
else:
    print(':(')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

b = [0] * n
c = []
for i in range(n-1, -1, -1):
    v = i + 1
    s = 0
    for j in range(1, 10**6):
        if v*j > n:
            break    
        s += b[v*j-1]
    if s % 2 != a[i]:
        b[i] = 1
        c.append(v)
print(len(c))
for i in reversed(c):
    print(i)
# Judge status: Wrong Answer
s,c = map(int,input().split())
c += s*2

res = c//4

print(res)
# Judge status: Accepted
a,b,c,x,y = map(int,input().split())
p = max(x,y)
q = min(x,y)
ans = 0
if a+b>=2*c:
    if p == x:
        ans += 2*c*q + min(a,2*c)*(p-q)
    else:
        ans += 2*c*q + min(b,2*c)*(p-q)
else:
    if p == x:
        ans += (a+b)*q + min(a,2*c)*(p-q)
    else:
        ans += (a+b)*q + min(b,2*c)*(p-q)
         
print(ans)
# print(a,b,c,x,y)
# Judge status: Accepted
# 入力
S = str(input())

# 処理
if S[0] == S[1] or S[1] == S[2] or S[2] == S[3]:
    result = "Bad"
else:
    result = "Good"

# 出力
print(result)
# Judge status: Accepted
n = int(input())
b = list(map(int,input().split()))
a = [-1]*n
a[0] = b[0]
a[-1:] = b[-1:]
for i in range(n-2):
    a[i+1] = min(b[i],b[i+1])
print(sum(a))
# Judge status: Accepted
N = str(input())

for x in N:
    if x == "7":
        print("Yes")
        exit()

print("No")
# Judge status: Wrong Answer
X, Y = map(int, input().split())
if Y % X == 0 or Y == 1:
  print(-1)
else:
  print(X)
# Judge status: Wrong Answer
a, b = map (int, input().split())
if a%2 != 0 and b&2 != 0:
  print("Odd")
else:
  print("Even")
# Judge status: Wrong Answer
listA = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
C = input()
for i in range(24):
  if C == listA[i]:
    print(listA[i+1])
# Judge status: Accepted
S=input()
if S[0]=='A' and S[2:-1].count('C')==1:
    s=list(S)
    s.remove('C')
    S=''.join(s)
    if S.istitle()==True:
        print('AC')
        exit()
print('WA')
# Judge status: Wrong Answer
K = int(input())
S = input()
if len(S) <= K:
    print(S)
else:
    print(S[:K],'...')
# Judge status: Accepted
n=input()
if n[0]==n[1]==n[2] or n[1]==n[2]==n[3]:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N, K, Q = map(int, input().split())
A = [int(input()) for i in range(Q)]
N_array = [K] * N
for x in A:
    for y in range(len(N_array)):
        if y != x - 1:
            N_array[y] -= 1
for z in N_array:
    if z > 0:
        print("YES")
    else:
        print("NO")
# Judge status: Accepted
import fractions

def lcm(a, b):
    return a * b // fractions.gcd(a, b)

N = int(input())
A = [int(i) for i in input().split()]
mod = 10**9+7
ll = A[0]
for i in A:
    ll = lcm(ll, i)
ans = 0
for i in A:
    ans += ll // i
print(int(ans%mod))
# Judge status: Wrong Answer
n=int(input())
w = [int(_) for _ in input().split()]
l=[999]*n
for i in range(1,n-1):
    l[i] = abs(sum(w[:i]) - sum(w[i:]))
print(min(l))
# Judge status: Wrong Answer
x,k,d = map(int,input().split())
flag = False
x -= k*d
# print(x)
if x>=0:
    print(x)
else:
    while x<0:
        if len(str(x))>6:
            x = x+(k*d)
        else:
            x+=d
        #print(x)
    # if x == 1000000000000000:
    #     print('ok')
    print(x)
# Judge status: Accepted
H, N = map(int, input().split())
AB = [tuple(map(int, input().split())) for _ in range(N)]

dp = [0] * (H + 1)
for h in range(1, H + 1):
    dp[h] = min([dp[max(h - a, 0)] + b for a, b in AB])

print(dp[-1])
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = [0 for i in range(a[n-1]+2)]
for i in a:
    ans[i] += 1
    ans[i+1] += 1
    if i-1 > 0:
        ans[i-1] += 1
ans.sort()
print(ans[len(ans)-1])
# Judge status: Wrong Answer
N, Y = list(map(int, input().split()))

ans = 0
for y in range(N +1):
    for w in range(N +1):
        if y*10000+w*5000+(N-y-w)*1000 == Y:
            ans = str(y)+" "+str(w)+" "+str(N-y-w)

if ans == 0:
    print(-1, -1, -1)
else:
    print(ans)
# Judge status: Accepted

#lst = list(map(str,input().split()))
st = str(input())
if st in ['a','e','i','o','u']:
    print('vowel')
else:
    print('consonant')
# Judge status: Accepted
N, K = map(int, input().split())
*A, = map(int, input().split())

def f(t):
    return sum(i//t if i!=t else 0 for i in A)<=K if t else all(i<=t for i in A)

l, r = -1, 10**10
while r-l>1:
    m = (r+l)//2
    if f(m):
        r = m
    else:
        l = m

print(r)
# Judge status: Wrong Answer
n = int(input())
c = list(input())#ciが R のとき赤、W のとき白
count = 0


for i in range(n-1):
  #print(c)
  if c[i] == "W" and c[i+1] == "R":
    c[i] = "R"
    count += 1
print(count)
# Judge status: Wrong Answer
n,k=map(int,input().split())
p=list(map(int,input().split()))

an=0
an2=0
an3=0
flug=0
t=0

if k==1:
    print(int(max(p))*0.5+0.5)
    exit()

for i in range(n):
    if i<k:
        an+=p[i]
    else:
        t=p[i-k]
        if an+p[i]-t>an:
            an2=an+p[i]-t
            flug=(i-k)
        an=an+p[i]-t
            
print((an2*0.5)+(k*0.5))
# Judge status: Wrong Answer
import numpy as np
import math 
N, K=map(int,input().split())
A2 = np.zeros(N)
A = list(map(int,input().split()))
A = list(map(lambda x: x -1 , A))
current_town = 0



i=0
while i<K:
    current_town = A[current_town]
    i=i+1
    if  A2[current_town] != 0:
        cycle = i - A2[current_town] 
        i = K - (K-i) % cycle
        break
    else:
        A2[current_town] = i


while i<K:
    current_town = A[current_town]
    i=i+1

print(current_town+1)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
s, d = [], []
for i in range(n):
    s.append(a[i] + i + 1)
    d.append(i + 1 - a[i])
cnt = dict()
ans = 0
for i in reversed(range(n)):
    if i < n - 1:
        if s[i] in cnt:
            ans += cnt[s[i]]
    if d[i] in cnt:
        cnt[d[i]] += 1
    else:
        cnt[d[i]] = 1
print(ans)
# Judge status: Accepted
L=int(input())
print(pow(L/3,3))
# Judge status: Accepted
a, b = map(int, input().split())
s = input()
flag = 0
for i in range(a):
    if s[i]>='0' and s[i]<='9': pass
    else: flag=1
if s[a]!='-': flag=1
for i in range(a+1, len(s)):
    if s[i]>='0' and s[i]<='9': pass
    else: flag=1
if flag==1: print("No")
else: print("Yes")
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
ans=0
p=10**9 + 7 
l=[0]*60
ans=0
for i in range(60):
    for j in a:
        l[i]+=(j>>i)&1
    ans+=(2**i*l[i]*(n-l[i]))%p
print(ans)
# Judge status: Accepted
import math
import itertools
n=int(input())

a=list(map(str,input().split()))
b=list(map(str,input().split()))

a_str = [''.join(v) for v in itertools.permutations(a)]
a_int = [int(i) for i in a_str]
a_int.sort()

x="".join(a)
y="".join(b)

p=a_int.index(int(x))+1
q=a_int.index(int(y))+1

print(abs(p-q))
# Judge status: Wrong Answer
n,m=map(int,input().split())
li=[]
if n==1:
    score="0"
else:
    score="1"+"0"*(n-1)
for i in range(m):
    s,c=map(int,input().split())
    if n!=1 and (s,c)==(0,0):
        print("-1")
        quit()
    li.append([s,c])
    for j in range(len(li)):
        if li[j][0]==s and li[j][1]!=c:
            print("-1")
            quit()
    score=score[:s-1]+str(c)+score[s:]
print(int(score))
# Judge status: Accepted
X = int(input())

for A in range(1000):
    for B in range(-1000, 1000):
        if A**5 - B**5 == X:
            print(A, B)
            break
    else:
        continue
    break
# Judge status: Accepted
#!/usr/bin/env python3

import numpy as np

n, k = map(int, input().split())
p = list(map(int, input().split()))
exps = []

for i in range(n):
    #exps.append(sum(list(range(1, p[i]+1)))/p[i])
    exps.append((1+p[i])/2)

exps = np.array(exps)
cumexps = exps.cumsum()
cumexps = np.insert(cumexps, 0, 0)

#print(exps)
#print(cumexps)

ans = -1
for i in range(n-k+1):
    tmp = -cumexps[i] + cumexps[i+k]
    if ans <= tmp:
        ans = tmp 

print(ans)
# Judge status: Accepted
import copy
import math
import string
import heapq
import bisect
import sys
sys.setrecursionlimit(10**7)

N = int(input())
A = set(map(int,input().split()))
if N == len(A):
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
import sys
n,y=map(int,input().split())
if n*10000<y:
    print("-1 -1 -1")
    sys.exit()
if y//1000<n:
    print("-1 -1 -1")
    sys.exit()
m=y//10000
for i in range(m+1):
    g=(y-m*10000)//5000
    for j in range(g+1):
        s=(y-10000*i-5000*j)//1000
        if i+j+s==n and s>=0:
            print(i,j,s)
            sys.exit()
print("-1 -1 -1")
# Judge status: Wrong Answer
A,B,C = input().strip().split()
if A == B or B == C or C == A:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
K = int(input())
m = 7 % K
for i in range(1, K + 1):
    if m % K == 0:
        print(i)
        break
    m = (10 * m + 7) % K
else:
    print(-1)
# Judge status: Wrong Answer

#a,b = map(int, input().split())
import math
if __name__ == "__main__":

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

    allAttack = 0
    for i in A:
        allAttack += i
    
    if allAttack > H:
        print ("Yse")
    else:
        print ("No")
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))
count4 = 0
count2 = 0
count0 = 0
for i in range(N):
  if a[i]%4 == 0:
    count4 += 1
  elif a[i]%2 == 0:
    count2 += 1
  else:
    count0 += 1


if count2 == 0:
  if count0 <= count4 + 1:
    print("Yes")
  else:
    print("NO")
else:
  if count0 <= count4:
    print("Yes")
  else:
    print("NO")
# Judge status: Accepted
S=list(input())
if ('N' in S and 'S' not in S) or ('S' in S and 'N' not in S) or ('W' in S and 'E' not in S) or ('E' in S and 'W' not in S):
    print('No') 
else:
    print('Yes')
# Judge status: Wrong Answer
K = int(input())

q = [1,2,3,4,5,6,7,8,9]
i = 0
n = 0
while n < K:
    x = q[i]
    if x % 10 > 0:
        q.append(x * 10 + x - 1)
        n += 1
    q.append(x * 10 + x)
    n += 1
    if x % 10 < 9:
        q.append(x * 10 + x + 1)
        n += 1
    i += 1
print(q[K])
# Judge status: Wrong Answer
from collections import Counter
N = int(input())
l = list(map(int, input().split()))
counter = Counter(l)
for i in counter.values():
    print(i)
for i in range(N-len(counter)):
    print(0)
# Judge status: Wrong Answer
n = int(input())
mod = 10**9+7
a = pow(10,n,mod)
a -= pow(9,n,mod)*2
a += pow(8,n,mod)
print(a)
# Judge status: Wrong Answer
N,M= list(map(int,input().split()))
print(N*(N-1)/2+M*(M-1)/2)
# Judge status: Accepted
x = int(input())
if 30<=x:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
# -*- coding: utf-8 -*-
import math

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

ans = 0

for i in range(n):
    x, y = map(int, list(input().split()))
    z = math.sqrt(x ** 2 + y ** 2)
    if z <= d:
        ans += 1
print(ans)
# Judge status: Wrong Answer
n=int(input())
dp=[0 for i in range(100010)]
dp[0]=0
for i in range(100000):
  dp[i]=200000
  power=1
  while(power<=n):
    dp[n]=min(dp[n],dp[n-power]+1)
    power*=6
  while(power<=n):
    dp[n]=min(dp[n],dp[n-power]+1)
    power*=9

print(dp[n])
# Judge status: Accepted
print("Yes" if input()==input()[:-1] else "No")
# Judge status: Accepted
import math
N=int(input())
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
print(math.ceil(N/min(A,B,C,D,E))+4)
# Judge status: Accepted
a = [int(i) for i in input().split()]
print(len(set(a)))
# Judge status: Accepted
l = ["Sunny", "Cloudy", "Rainy"]
s = input()
idx = l.index(s)
print(l[(idx+1)%3])
# Judge status: Wrong Answer
a = float(input())
b = float(input())
h = float(input())
 
print((a + b) * h / 2)
# Judge status: Wrong Answer
n,x=map(int,input().split())
a=sorted(list(map(int,input().split())))
ans=0
for i in a:
    if i>x:
        break
    else:
        n-=i
        ans+=1
print(ans)
# Judge status: Wrong Answer
from math import sqrt
a, b, c = map(int, input().split())
route_a, route_b, route_c = sqrt(a), sqrt(b), sqrt(c)
if route_a + route_b < route_c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys 
input = sys.stdin.readline
MOD = 10**9 +7
INF = 10**9

def main():
    a,b,c = map(int,input().split())
    
    if c-a-b <= 0:
        print('No')
        exit()
    if (c-a-b)**2 > 4*a*b:
        print('Yes')
        exit()
    print('No')
if __name__=='__main__':
    main()
# Judge status: Wrong Answer
K,X=map(int,input().split())
a=[]
for i in range(0,K):
  a.append(X-i)
for i in range(1,K):
  a.append(X+i)
print(sorted(a))
# Judge status: Accepted
# -*- coding: utf-8 -*-
# スペース区切りの整数の入力
A,B,C = map(int, input().split())

#内部レーティング
if A+B+C>=22:
    print("bust")
else:
    print("win")
# Judge status: Accepted
n = int(input())
slist=[]

for i in range(n):
    slist.append(input())

print(len(list(set(slist))))
# Judge status: Accepted
n=int(input())
ans=''
while n>0:
    x=n%26
    if x!=0:
        ans+=chr(x+96)
    else:
        ans+='z'
        n-=1
    n=n//26
print(ans[::-1])
# Judge status: Accepted
s = set(input())

if 'N' in s:
    if not 'S' in s:
        print('No')
        exit()

if 'S' in s:
    if not 'N' in s:
        print('No')
        exit()

if 'W' in s:
    if not 'E' in s:
        print('No')
        exit()

if 'E' in s:
    if not 'W' in s:
        print('No')
        exit()

print('Yes')
# Judge status: Wrong Answer
N=int(input())
a= list(map(int,input().split()))
n = max(a)
lis = [0]*(n+1)

for i in range(N):
    lis[a[i]-1]+=1
ans = 0
for i in range(n):
    if i== 0:
        ans = lis[i] +lis[i+1]
    else:
        if ans <= lis[i-1]+lis[i]+lis[i+1]:
            ans= lis[i-1]+lis[i]+lis[i+1]

print(ans)
# Judge status: Accepted

a,b = map(int,input().split())
d = b - a
wa = 0

for i in range(1,d+1):
    wa += i
print(wa - b)
# Judge status: Accepted
N,M=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(M)]
l_1=[]
l_n=set()
for l in A:
    if 1 in l:
        l_1.append(sum(l)-1)
for l in A:
    if N in l:
        l_n.add(sum(l)-N)
for x in l_1:
    if x in l_n:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')
# Judge status: Wrong Answer
S = int(input())

L = S//3
mod = 10**9+7

res = 0
from scipy.special import comb

for l in range(1,L+1):
    s = S - l*3
    a = comb(s+l-1, l-1)
    res += a

print(res%mod)
# Judge status: Wrong Answer
x,k,d = map(int, input().split())

if abs(x) >= d*k:
    if x > 0: x -= d*k
    else: x += d*k
    ans = x
else:
    k = x//d
    x %= d
    if k%2 != 0:
        if abs(x+d) < abs(x-d): ans = x+d
        else: ans = x-d
    else: ans = x
print(abs(ans))
# Judge status: Wrong Answer
a, b = [int(x) for x in input().strip().split()]
if a <= 0 and 0 <= b:
  print('Zero')
elif a > 0:
  print('Positive')
else:
  if a == b:
    print('Netative')
  elif b - a % 2:
    print('Positive')
  else:
    print('Negative')
# Judge status: Accepted
ans = [int(n) for n in input().split()]
print(sum(ans)-max(ans))
# Judge status: Accepted
S,T=input().split()
a,b=input().split()
A,B=int(a),int(b)
U=input()

if U==S:
    print(A-1,B)
else:
    print(A,B-1)
# Judge status: Accepted
x,n = map(int, input().split())
if n > 0:
	l = list(map(int,input().split()))
else:
	l = []
tl = []
for i in range(0,102):
	if i not in l:
		tl.append(i)
tlabs = []
for i in tl:
	tlabs.append(abs(x - i))
ans = tl[tlabs.index(min(tlabs))]
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
A = []
for _ in range(N):
    s = list(map(int, input().split()))
    k = s[0]
    A.append(s[1:])

foods = [0] * M
for row in A:
    for a in row:
        foods[a-1] += 1
count = 0
for f in foods:
    if f == N:
        count += 1
print(count)
# Judge status: Wrong Answer
li = [0]*9

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

for i in a:
    if i//400 > 7:
        li[8] += 1
    else:
        li[i//400] = 1

print(sum(li[:-1]),sum(li))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
ans1 = max(a)
diff = min(ans1//2, ans1//2 + 1)
ans2 = ans1
for x in a:
  d = min(abs(ans1//2 - x), abs(ans1//2 + 1 - x))
  if d < diff:
    diff = d
    ans2 = x
print('{} {}'.format(ans1, ans2))
# Judge status: Accepted
n = int(input())

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

mi = 10**15
for i in make_divisors(n):
    a = i;b = n//i
    mi = min(mi,a+b-2)

print(mi)
# Judge status: Accepted
X = input()

ans = 0
t = 0
for x in X:
  if x == "S":
    t -= 1
  else:
    t += 1
  ans = max(ans, t)

print(ans * 2)
# Judge status: Accepted
s=input()
for i in range(len(s)):
    if i==3:
        print('8',end="")
        continue
    print(s[i],end="")
print()
# Judge status: Accepted
N=int(input())
A=map(int,input().split())

T=[0,0,0]
for a in A:
    if a%2:
        T[0]+=1
    elif a%4:
        T[1]+=1
    else:
        T[2]+=1

if T[1]==0:
    if T[0]<=T[2]+1:
        print("Yes")
    else:
        print("No")
else:
    if T[0]<=T[2]:
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
a,b,c = map(str,input().split())

print(a[0]+b[0]+c[0])
# Judge status: Wrong Answer
S=input()
s=0
t=0
for i in range(len(S)):
  if i%2==0:
    if S[i]==0:
      s+=1
  else:
    if S[i]==1:
      s+=1
for j in range(len(S)):
  if j%2==0:
    if S[j]==1:
      t+=1
  else:
    if S[j]==0:
      t+=1
print(min(s,t))
# Judge status: Accepted
def solve(a, b, h):
    ans = (a+b)*h//2
    return ans


if __name__ == "__main__":
    a = int(input())
    b = int(input())
    h = int(input())
    print(solve(a, b, h))
# Judge status: Accepted
N = int(input())
P = {2,4,5,7,9}
H = {0,1,6,8}
if N%10 in P:
    print("hon")
elif N%10 in H:
    print("pon")
else:
    print("bon")
# Judge status: Accepted
n, m = map(int, input().split())
submit = {}

for _ in range(m):
  p, s = input().split()
  if submit.get(p, -1) == -1:
    submit[p] = [0, 0]
  if (submit[p])[0] == 0:
    if s == 'AC':
      (submit[p])[0] += 1
    else:
      (submit[p])[1] += 1
      
ac = 0
wa = 0
for i in submit.values():
  if i[0] > 0:
    ac += i[0]
    wa += i[1]

print(ac, wa)
# Judge status: Accepted
def solve(a,b,c,x,y):
  l = []
  for i in range(10**6):
    s = a*max(x-i,0)+b*max(y-i,0)+c*i*2
    l.append(s)
  return min(l)

        

A,B,C,X,Y = map(int,input().split())
print(solve(A,B,C,X,Y))
# Judge status: Wrong Answer
N = int(input())
X = [0]*N
A = list(map(int,input().split()))
for i in A:
    X[i] +=1
print(*X,sep="\n")
# Judge status: Accepted
s = int(input())

l = list()
l.append(s)

num = s

while 1:
    if num % 2 == 0:
        num = num // 2
    else:
        num = 3*num + 1
    if num in l:
        break
    l.append(num)

print(len(l)+1)
# Judge status: Wrong Answer
import itertools

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

s=[0]+list(itertools.accumulate(a))

dp=[[10**20]*(n+1) for _ in range(n)]
for l in range(n):
    dp[l][l+1]=0
for d in range(2,n+1): 
    for k in range(1,d):
        for i in range(n-d+1):
            j=i+d
            S=s[j]-s[i]
            dp[i][j]=min(dp[i][i+k]+dp[i+k][j],dp[i][j])+S

print(dp[0][n])
# Judge status: Accepted
n, k, s = map(int, input().split())
if k == 0:
    if s == 10**9:
        print(' '.join([str(s - 1)]*n))
    else:
        print(' '.join([str(s + 1)]*n))
else:
  first = [str(s)]*k
  if s == 1:
    second = [str(2)]*(n - k)
  else:
    second = [str(max(1, s - 1))]*(n - k)
  print(' '.join(first + second))
# Judge status: Accepted
n,a,b= map(int, input().split())
s=input()

allcnt=0
b_cnt=0

for i in range(n):
  if s[i]=="c":
    print("No")
  elif s[i]=="a":
    if allcnt<a+b:
      print("Yes")
      allcnt+=1
    else:
      print("No")
  else:
    if allcnt<a+b and b_cnt<b:
      print("Yes")
      b_cnt+=1
      allcnt+=1
    else:
      print("No")
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
if a + b + c >22:
  print('bust')
else:
  print('win')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if a * c >= b:
  ans = b
else:
  ans = b // a

print(ans)
# Judge status: Wrong Answer
a,b,c = sorted(input().split())
d=b+c
print(int(a)+int(d))
# Judge status: Accepted
from fractions import gcd
from functools import reduce


def main():
    n = int(input())
    numbers_gcd = reduce(gcd, list(map(int, input().split())))
    answer = 0
    while numbers_gcd > 0:
        if numbers_gcd % 2:
            break
        else:
            numbers_gcd //= 2
            answer += 1
    print(answer)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
x, a, b = map(int, input().split())

print(min(abs(x-a),abs(x-b)))
# Judge status: Wrong Answer
a,b,k=map(int,input().split())
count=0
s=[]
for i in range(1,100):
  if a%i==0 and b%i==0:
    s.append(i)
    
print(s[-k])
# Judge status: Accepted
K = int(input()); k = int(K / 2)
print(k * (k + 1)) if K % 2 else print(k * k)
# Judge status: Accepted
t = list(input())
ans = 0
for i in range(len(t)):
    if t[i] == '?':
        t[i] = 'D'
print(''.join(t))
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split(' ')))

def gcd(a, b):
    return b if a % b == 0 else gcd(b, a % b)
def lcm(a, b):
    return a * b // gcd(a, b)
hoge = 1
for p in l:
    hoge = lcm(hoge, p)
ans = 0
for p in l:
    ans += hoge // p
print(ans % int(1e9 + 7))  # TLE ????
# Judge status: Accepted
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
sorted_T = sorted(T)

first = sorted_T[0]
cap = C-1
limit = first + K
ans = 1

for i in range(1, N):
    if (cap > 0) and (sorted_T[i] < limit):
        cap -= 1
    elif (cap == 0) or ((cap > 0) and (sorted_T[i] > limit)):
        cap = C-1
        first = sorted_T[i]
        limit = first + K
        ans += 1

print(ans)
# Judge status: Accepted
a,b = input().split()
uni_a = ord(a)
uni_b = ord(b)
if uni_a<uni_b:
    print(a*int(b))
else:
    print(b*int(a))
# Judge status: Wrong Answer
n, x = map(int, input().split())
l = list(map(int, input().split()))

ans = 1
d = 0
for i in range(1, n):
  d = d + l[i-1]
  if d > x:
    break
  ans += 1

print(ans)
# Judge status: Accepted
n = int(input())
from collections import Counter

c = Counter(input())
for i in range(1, n):
    tmp = Counter(input())
    c = c & tmp
print("".join(sorted(c.elements())))
# Judge status: Wrong Answer
n,x=map(int,input().split())
a=[int(i)for i in input().split()]
b=a[0]
c=0
for i in range(1,len(a)):
  if b+a[i]>x:
    c+=(b+a[i]-x)
    b=b-x
  else:
    b=a[i]
print(c)
# Judge status: Wrong Answer
A,B=map(int,input().split())
if A>=B:print(B)
if A<=12 and A>=6:print(B//2)
if A<=5:print(0)
# Judge status: Accepted
print('Yes' if input()==input()[:-1] else 'No')
# Judge status: Accepted
def good_contest(num):
  return len(set(str(num))) == 1


def find_good_contest(next_contest):
  while not good_contest(next_contest):
    next_contest += 1
  return next_contest


def main():
  print(find_good_contest(int(input())))
  
  
if __name__ == '__main__':
  main()
# Judge status: Wrong Answer
X, Y = map(int, input().split())
a = 2*Y-X
b = 2*X-Y

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def combination(n, r, mod=10**9+7):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

if a%3==0 and b%3==0 and a>0 and b>0:
    a //= 3 
    b //= 3
    print(combination(a+b, a))
else:
    print(0)