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

ns = len(s)
nt = len(t)

for i in range(ns-nt, -1, -1):
   x = s[i:i+nt]
   for j in range(nt+1):
      if (j == nt):
         ss = s[:i] + t + s[i+nt:]
         print(ss.replace('?', 'a'))
         exit()

      if (x[j] == '?'):
         continue
      elif (x[j] != t[j]):
         break

print('UNRESTORABLE')
# Judge status: Accepted
N,A,B,C,D=map(int,input().split())
S=input()
E=min(C,D)
F=max(C,D)
if S.find('##',A,F)>0:
  print('No')
else:
  if C<D:
    print('Yes')
  else:
    if S.find('...',B-2,E+1)>0:
      print('Yes')
    else:
      print('No')
# Judge status: Wrong Answer
s = list(input())
t = list(input())

s.sort()
t.sort()

for i in range(min(len(s), len(t))):
    if s[i] < t[i]:
        print('Yes')
        exit()
    elif s[i] > t[i]:
        print('No')
        exit()
  
if s == t:
    print('No')
    exit()

if ''.join(s) in ''.join(t):
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
if x < a[0]:
    print(0)
else:
    for i in range(n):
        x = x - a[i]
        if x > 0:
            continue
        elif x == 0:
            print(i+1)
            break
        else:
            print(i-2)
            break
if x > 0 and x > a[0]:
    print(n-1)
# Judge status: Accepted
import sys
K = int(sys.stdin.readline())
A, B = map(int, sys.stdin.readline().split())
print("OK" if (A <= (B // K) * K) else "NG")
# Judge status: Accepted
MOD = 10**9+7
n = int(input())
A = list(map(int, input().split()))
n_bit = 60
bit_cnt = [0]*n_bit
for i in range(n):
    for d in range(n_bit):
        if (A[i] >> d) & 1:
            bit_cnt[d] += 1

ans = 0
for d, one_cnt in enumerate(bit_cnt):
    ans = ans + one_cnt*(n-one_cnt)*pow(2, d, MOD) % MOD
print(ans % MOD)
# Judge status: Accepted
#最大公約数
def gcd(a, b):
    while b != 0:
        a, b = b, a % b
    return a


#最小公倍数
def lcm(a,b):
    return a * b // gcd(a, b)


n = int(input())
T = list(int(input()) for _ in range(n))

res = T[0]
for i in range(1, n):
    res = lcm(res, T[i])
print(res)
# Judge status: Wrong Answer
n,m = map(int,input().split())
py = []
for i in range(m):
    num = i+1
    p,y = map(int,input().split())
    py.append([num,p,y])
py = sorted(py, key = lambda x:x[1]**10+x[2])
x = 0
b = '000000'
ans = []
for pyi in py:
    if pyi[1] != x:
        x = pyi[1]
        cnt = 1
    else:
        cnt += 1
    ans.append([pyi[0], (b+str(pyi[1]))[-6:], (b+str(cnt))[-6:]])
ans = sorted(ans, key = lambda x: x[0])
for ansi in ans:
    print(ansi[1]+ansi[2])
# Judge status: Wrong Answer
def shift_only(array):
    tmp = []
    counter = 0
    while True:
        flag = True
        # 全て偶数かを確認
        for num in array:
            if num%2 != 0:
                flag = False
        if flag == False:
            break
        array = [i/2 for i in array]
        counter +=1
    print(counter)
n = int(input())
array = [i for i in range(n)]
# Judge status: Accepted
x = int(input())

ans = 0
y = 100
while y < x:
    y = y * 101 // 100
    ans += 1

print(ans)
# Judge status: Accepted
n,h = map(int,input().split())
AB = [list(map(int,input().split())) for _ in range(n)]

a_max = max(a for a,b in AB)
B = [b for a,b in AB if b>a_max]
B.sort(reverse=True)
ans = 0

for b in B:
    if h<=0:
        break
    ans+=1
    h-=b
if h>0:
    ans+=(h+a_max-1)//a_max
print(ans)
# Judge status: Wrong Answer
n = input()
if n[-1] == 2 or n[-1] == 4 or n[-1] == 5 or n[-1] == 7 or n[-1] ==9:
    print("hon")
elif n[-1] == 3:
    print("bon")
else:
    print("pon")
# Judge status: Wrong Answer
N = int(input("何食食べた？："))
x = N * 800
y = (N // 15) * 200

print(x - y)
# Judge status: Accepted
n = int(input())
a = []
cnt = 0
for i in range(n):
  a.append(int(input()))
stack = -1
for i in range(n):
  if i+1 - stack <= 1 and a[i] > 0:
    cnt += 1
    a[i] -= 1
    stack = -1
  cnt += a[i] // 2
  if a[i] % 2 == 1:
    stack = i+1
  else:
    stack = -1
print(cnt)
# Judge status: Accepted
N, A, B = map(int, input().split())

dist = abs(A - B)
if dist % 2 == 0:
    print(dist//2)
else:  
    print(min(A - 1, N - B) + 1 + (dist - 1)//2)
# Judge status: Wrong Answer
s=input()
x=0;y=0
for i in range(len(s)):
  if s[i]=="A":
    x=i+1
    break
for i in range(len(s)):
  if s[-i]=="Z":
    y=len(s)-i+1
    break
#print(x,y)
print(y-x+1)
# Judge status: Accepted
import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()

    for i in range(1, len(S) - 1):
        T = S[:-i]
        N = len(T)
        if N % 2 == 1:
            continue
        if T[:N // 2] == T[N // 2:]:
            ans = N
            break

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
N, M = map(int, input().split())

ID = list()
for i in range(M):
    ID.append(list(map(int, input().split())))

nega = 0
posi = N

check = 1
for (L, R) in ID:
    if L > nega:
        nega = L
    if R < posi:
        posi = R
    if R < nega or posi < L:
        check = 0

if check == 1:
    print(posi-nega+1)
else:
    print(0)
# Judge status: Accepted
a, b, c = map(int,input().split())
if a<=c and c<=b:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from collections import Counter
N=int(input())
S=input()
ans=1
s=Counter(S)
for key,value in s.items():
    ans*=value+1
print((ans-1)%(10**9+7))
# Judge status: Wrong Answer
num_list = [int(i) for i in input().split()]
min_list = []

if num_list[0] < num_list[1]:
    print(num_list[0])
elif num_list[0] == num_list[1]:
    print(0)
elif num_list[1] % num_list[0] == 0:
    print(0)
else:
    kake_num = num_list[0] // num_list[1]
    check_num = num_list[0] - (num_list[1]*kake_num)
    min_list.append(check_num)
    min_list.append((num_list[1] - check_num))
    print(min(min_list))
# Judge status: Wrong Answer
def main():
    N, K = (int(i) for i in input().split())
    X = [int(i) for i in input().split()]
    ans = 10**12
    for i in range(N-K+1):
        u = X[i]
        v = X[i+K-1]
        if u*v >= 0:
            ans = min(ans, max(abs(u), abs(v)))
        else:
            ans = min(ans, min(abs(u), v))*2+max(abs(u), v)
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
a, b, c, d = map(int, input().split())
if (abs(a - b) <= d and abs(b - c) <= d) or abs(a - c) <= d:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
S=raw_input()
T=raw_input()
ans=0
for s,t in zip(S,T):
    if s!=t:
        ans+=1
print ans
# Judge status: Accepted
A,B,C=sorted(map(int,input().split()))
print(10*C+B+A)
# Judge status: Wrong Answer
s = input()

l = 0
for i in range(0, len(s) - 2, 2):
    if s[i] != '1':
        l += 1
    if s[i + 1] != '0':
        l += 1

r = 0
for i in range(0, len(s) - 2, 2):
    if s[i] != '0':
        r += 1
    if s[i + 1] != '1':
        r += 1

ans = min(l, r)
print(ans)
# Judge status: Wrong Answer
n, m = map(int, input().split())
A = []
B = []
for i in range(n):
    A.append(input())
for i in range(m):
    B.append(input())

ok = 0
for i in range(n - m + 1):
    for j in range(n - m + 1):
        from_n = [l[i:i+m] for l in A[i:i+m]]
        ok += from_n == B
print('Yes' if ok > 0 else 'No')
# Judge status: Wrong Answer
import sys
import math

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

rad_B = M * 6
rad_A = H * 30 + M * 0.5

if rad_A < rad_B:
    rad_C = rad_A - rad_B
elif rad_A > rad_B:
    rad_C = rad_B - rad_A
elif rad_A == rad_B:
    rad_C = 0

rad_C = abs(rad_C)

if rad_C > 180:
    rad_C = 360 - rad_C

#print(rad_A,rad_B,rad_C)

cos_C = math.cos(math.radians(rad_C))

C_2 = A ** 2 + B ** 2 + 2 * A * B * cos_C

C = math.sqrt(C_2)

#print(rad_A,rad_B,rad_C)
print(C)
# Judge status: Accepted
a,b,c = map(int,input().split())

if a == b+c or b == a+c or c == a+b:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
LI = lambda: list(map(int,input().split()))
MI = lambda: map(int,input().split())
yes = lambda: print("Yes")
no = lambda: print("No")
I = lambda: list(input())
J = lambda x: "".join(x)
II = lambda: int(input())
SI = lambda: input()
#---khan17---template
a,b,c,d = MI()
while(a == 0 and c == 0):
	c-=b
	if c<=0:
		yes()
		break
	a-=d
	if a<=0:
		no()
		break
# Judge status: Accepted
k = int(input())

if k % 2 == 0 or k % 5 == 0:
  print(-1)
else:
  ans = 7
  cnt = 1
  while 1:
    if ans % k == 0:
      break
    else:
      cnt += 1
      ans *= 10
      ans += 7
      ans %= k

  print(cnt)
# Judge status: Wrong Answer
def main():
    a, b = map(int, input().split())
    ans = (b-a)//100
    if int(str(a)[-2:]) <= int(str(a)[:1]) and int(str(b)[-2:]) <= int(str(b)[1:]):
        ans += 1
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
s = input()
if len(s) == 6 and s[2] == s[3] and s[4] == s[5]:
    print('Yse')
else:
    print('No')
# Judge status: Wrong Answer
from sys import stdin

s = stdin.readline().rstrip()
N = len(s)

if N == 1:
    print(1)
    exit()
elif N == 2:
    if s[0] == s[1]:
        print(1)
        exit()
    else:
        print(2)
        exit()

dp = [0]*N

for i in range(2,N):
    if s[i] == s[i-1]:
        dp[i] = dp[i-3] + 2
    else:
        dp[i] = dp[i-1] + 1

print(dp[N-1]+1)
# Judge status: Wrong Answer
X = int(input())
print(X if 360 % X else 360 // X)
# Judge status: Accepted
N=int(input())
S=list(map(int,input().split()))

count=0
for i in range(1,N-1):
  if S[i-1]<S[i]<S[i+1] or S[i-1]>S[i]>S[i+1]:
    count+=1
print(count)
# Judge status: Wrong Answer
A, B, K = list(map(int, input().split()))
left = set(list(range(A, A + K)))
right = set(list(range(B - K + 1, B + 1)))
[print(i) for i in sorted(list((left | right)))]
# Judge status: Accepted
S = input()
T = input()
count = 0
for i in range(len(S)):
    if S[i] != T[i]:
        count += 1
print(count)
# Judge status: Accepted
N, K = map(int,input().split())
H = list(map(int, input().split()))

if N <= K:
    print('0')
else:
    H.sort()
    if K > 0:
        del H[-K:]
    print(sum(H))
# Judge status: Accepted
N,K = map(int,input().split())
p=0
for i in range(1,N+1):
    jo = 0
    while True:
        if i*(2**jo) >= K:
            break
        jo += 1
    p += (1/N) * (1/2)**jo
print(p)
# Judge status: Wrong Answer
N = int(input())

for i in range(1, 1000000):
    if (N / i).is_integer():
        a = N // i
        b = N // a
        break

print(a+b-2)
# Judge status: Accepted
s = list(input())

res1, res2 = len(s), len(s)
for i in range(len(s)):
    if i % 2 == 0:
        if int(s[i]) == 0:
            res1 -= 1
        if int(s[i]) == 1:
            res2 -= 1
    else:
        if int(s[i]) == 1:
            res1 -= 1
        if int(s[i]) == 0:
            res2 -= 1

ans = min(res1, res2)
print(ans)
# Judge status: Wrong Answer
n, l = map(int, input().split())
string_list = []
for i in range(n):
    string_list.append(input())
string_list.sort()
print(string_list)
# Judge status: Accepted
#ABC109C
from functools import reduce
from fractions import gcd
n,x=map(int,input().split())
L=[abs(x-int(i)) for i in input().split()]
print(reduce(gcd,L))
# Judge status: Accepted
a = input()
def p(s,n):
    for i in range(n//2):
        if s[i] != s[-(i+1)]:
            return 0
    return 1
r = len(a)
if p(a,r) == 1 and p(a[:((r-1)//2)],(r-1)//2) == 1 and p(a[(r+3)//2-1:],r-(r+3)//2+1)== 1:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n,k=list(map(int,input().split()))
print((-2+k-n)*(-6-2*k+2*k**2-n-k*n-n**2)//6%(10**9+7))
# Judge status: Accepted
import sys
x = input()
y = input()

for i in range(3):
  if x[i] != y[2-i]:
    print("NO")
    sys.exit()
print("YES")
# Judge status: Accepted
# coding: utf-8
# Your code here!
N = int(input())
A = list(map(int,input().split()))
n = len(list(A))
m = len(set(A))
if n == m:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n = int(input())
Ds = sorted(list(map(int, input().split())))
print(Ds[n // 2] - Ds[n // 2 - 1])
# Judge status: Accepted
import math
k = int(input())
a, b = list(map(int,input().split()))

if math.ceil(a/k)<=math.floor(b/k):
    print('OK')
else:
    print('NG')
# Judge status: Accepted
import numpy as np

N = int(input())
a = np.array([list(map(int,input().split())) for _ in range(N)])
dp=np.zeros([N+1,3])

for i in range(1,N+1):
    for j in range(3):
        dp[i][j] = a[i-1][j]+max(dp[i-1][(1+j)%3],dp[i-1][(2+j)%3])
print(int(max(dp[N])))
# Judge status: Accepted
s = input()
l = ["Sunny", "Cloudy", "Rainy", "Sunny"]
print(l[l.index(s)+1])
# Judge status: Accepted
N = int(input())
S = input()

dic = {'(':1, ')':-1}

rlt = ''
cnt = 0
for s in S:
  cnt += dic[s]
  rlt += s
  if cnt < 0:
    rlt = '(' + rlt
    cnt = 0
  
if cnt > 0:
  rlt += ')'*cnt
  
print(rlt)
# Judge status: Accepted
A, B = map(int, input().split())

def f(n):
    r = []
    import math
    max_i = int(math.sqrt(n))
    for i in range(2, max_i + 1):
        while n % i == 0:
            n /= i
            r.append(i)
    if n != 1:
        r.append(n)
    return r
    

a = set(f(A))
b = set(f(B))

a_and_b = a & b
# print(a_and_b)
print(len(a_and_b) + 1)
# Judge status: Accepted
from collections import Counter

n = int(input())
a = [int(x) for x in input().split()]
c = Counter(a)
ans = 0
for v, c in c.items():
  if v < c:
    ans += c-v
  if v > c:
    ans += c

print(ans)
# Judge status: Wrong Answer
n,a,b = map(int,input().split())
ans = 0

if a>n:
  print(a)
else:
  temp = n//(a+b)
  ans = temp*a
  temp2 = n- temp*(a+b)
  
  if temp2 < a:
    print(ans+temp2)
  else:
    print(ans+a)
# Judge status: Accepted
a = map(int,input().split())
b = sorted(a)
if b[0] != 0 and b[1] != 0 and b[2] != 0:
    if b[2] == b[0] + b[1]:
        print("Yes")
    else:
        print("No")
else:
    print("No")
# Judge status: Accepted

N=input()

if N[0]==N[1]==N[2]:
	print("Yes")
elif N[1]==N[2]==N[3]:
	print("Yes")
else:
	print("No")
# Judge status: Wrong Answer
import bisect


def main():
    n = int(input())
    ls = sorted(list(map(int, input().split())))

    ans = 0
    for i in range(n-1):
        for j in range(i+1, n):
            a = ls[i]
            b = ls[j]
            k = bisect.bisect_left(ls, a+b)
            if k > j:
                ans += 1
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())
s = input()
t = input()

ans = N
for i in range(N):
  if s[i:] == t[:N-i]:
     print(ans)
     exit()
  else:
    ans += 1
  
print(ans)
# Judge status: Accepted
N,A,B,C,D = map(int,input().split())
S = input()

if "##" in S[A-1:max(C,D)-1]:
  print("No")
  exit()
if C < D:
  print("Yes")
  exit()

count = 0
for i in range(B-1,D):
  if D != len(S): 
    if S[i] == "." and S[i-1] == "." and S[i+1] == ".":
      print("Yes")
      exit()
print("No")
# Judge status: Accepted
N=int(input())
A=list(map(int, input().split()))

odd=0
ev=0
evev=0
for i in range(N):
  if A[i]%2==0:
    if A[i]%4==0:
      evev+=1
    else:
      ev+=1
  else:
    odd+=1
if evev+1>odd or (evev+1==odd and ev==0):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
S = input()
T = input()

if S == T[:-1] and len(S)+1 == len(T):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
    if a[i] == i + 1:
        a[i], a[i + 1] = a[i + 1], a[i]
        ans += 1
        
if a[n - 1] == n:
    ans += 1
print(ans)
# Judge status: Accepted
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def main():
    w, h, x, y = MII()
    print((w*h)/2, end=' ')
    if w/2 == x and h/2 == y: print(1)
    else: print(0)

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

x=a*(a-1)/2
y=b*(b-1)/2

ans=x+y

print(int(ans))
# Judge status: Accepted
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

n,k=l_in()
A=l_in()

cnt=0
current = 0

memo={0: 0}

while cnt < k:
    n = A[current]-1
    cnt += 1

    if n in memo:
        delta = cnt - memo[n]

        p = (k-cnt)//delta
        cnt += p*delta
    else:
        memo[n] = cnt
    current = n
    
print(current+1)
# Judge status: Accepted
get_num=int(input())
get_list=[]
count=0

for i in range(get_num):
    tmp=input()
    get_list.append(tmp)

list=list(set(get_list))
    
print(len(list))
# Judge status: Accepted
N = int(input())
lis = list(map(int, input().split()))

half = sum(lis)
left, right, dif = 0, half, half

for i in range(N):
    dif_before = dif
    left += lis[i]
    right = half - left
    dif = abs(right - left)
    if dif >= dif_before:
        break

print(dif_before)
# Judge status: Accepted
N = int(input())
plus_max = -10**10
plus_min = 10**10
minus_max = -10**10
minus_min = 10**10
for i in range(N):
    x,y = map(int,input().split())
    plus_max = max(plus_max,x+y)
    plus_min = min(plus_min,x+y)
    minus_max = max(minus_max,x-y)
    minus_min = min(minus_min,x-y)
print(max(plus_max-plus_min,minus_max-minus_min))
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

cnt = [0] * 10 ** 5
for v in a:
    cnt[v-1] += 1

res = [sum(a)]
q = int(input())
for _ in range(q):
    b, c = map(int, input().split())
    res.append(res[-1] + cnt[b-1] * (c - b))
    cnt[c-1] += cnt[b-1]
    cnt[b-1] = 0

for v in res[1:]:
    print(v)
# Judge status: Wrong Answer
import math


def readints():
    return list(map(int, input().split()))


n = int(input())
a = readints()


for i in range(n):
    if a[i] % 2 == 0:
        # print(a[i])
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            print("APPROVED")
            exit()
    else:
        print("DENIED")
        exit()
# Judge status: Accepted
n = input()
li = list(map(int, input().split())) 

total = 1
li.sort()
for a in li:
    if a == 0:
        total = 0
        break
    total *= a
    if 10 ** 18 < total:
        total = -1
        break
print(total)
# Judge status: Accepted
s = int(input())

n = s
a = [s]
while True:
    if n % 2 == 0:
        n /= 2
        a.append(n)
    else:
        n = n * 3 + 1
        a.append(n)

    if n in a[:len(a) - 1]:
        break

print(len(a))
# Judge status: Accepted
h1,m1,h2,m2,k=map(int,input().split())
print((h2-h1)*60+(m2-m1)-k)
# Judge status: Wrong Answer
n,d = map(int, input().split())
z = [list(map(int, input().split())) for _ in range(n)]
ans = 0

for i in z:
    distance = i[0]*i[0] + i[1]*i[1]
    if distance <= d**2:
        ans += 1
        print(i, distance)

print(ans)
# Judge status: Wrong Answer
N,K = list(map(int, input().split()))

ans = []
a = N

if N < K:
    print(N)
elif N == K or K == 1:
    print(0)
else:
    ans2 = N % K
    ans1 =  (N % K ) - K
    if abs(ans2) > abs(ans1):
        print(abs(ans1))
    else:
        print(abs(ans2))
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())

    n = 1
    while (n + 1) * (n + 1) <= N:
        n += 1

    print(n * n)

    return


if __name__ == '__main__':
    main()
# Judge status: Accepted
import bisect
n = int(input())
l = list(sorted(map(int,input().split())))
count = 0
for i in range(n):
    for j in range(i+1,n):
        count += bisect.bisect_left(l, l[i] + l[j]) - (j + 1)
print(count)
# Judge status: Accepted
s = list(input())
ans = 0
for i in range(len(s)//2):
    if s[i] != s[-1-i]:
        ans += 1
print(ans)
# Judge status: Wrong Answer
r=int(input())

pie=3.14159

print(r*pie)
# Judge status: Accepted
import sys
n, k, s = [int(i) for i in sys.stdin.readline().split()]
if s == 10**9:
    ls = [s] * k + [s - 1] * (n - k)
else:
    ls = [s] * k + [s + 1] * (n - k)
print(" ".join([str(i) for i in ls]))
# Judge status: Accepted
D, N = map(int,input().split())
if N==100:
  print(101*(100**D))
else:
  print(N*(100**D))
# Judge status: Accepted
x,y,z=map(int,input().split())
n=[i for i in range(z,x-z,y+z)]
if n[-1]+y+z<=x:
  print(len(n))
else:
  print(len(n)-1)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
b = [0]*n
for i in range(n):
    b[i] = str(a[a[i]-1])

b = ' '.join(b)
print(b)
# Judge status: Wrong Answer
from statistics import median
N=int(input())
A=list(map(int,input().split()))
B=[0]*N
for i in range(N):
  B[i]=A[i]-i
b=median(B)
ans=0
for i in range(N):
  ans+=abs(B[i]-b)
print(ans)
# Judge status: Accepted
s = input()
rs = s[::-1]
if s != rs:
  print("No")
  exit()
n = len(s)
m = int((n-1)/2)
l = int((n+1)/2)
if s[:m] != rs[l:]:
  print("No")
  exit()
if s[l:] != rs[:m]:
  print("No")
  exit()
print("Yes")
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))
for i in range(min(K,41)):
    imos = [0]*(N+1)
    for i, ai in enumerate(A):
        imos[max(0, i-ai)] += 1
        imos[min(N, i+ai+1)] -= 1
    A = [imos[0]]
    for i in range(1, N):
        A += [imos[i]+A[i-1]]
print(' '.join(map(str, A)))
# Judge status: Wrong Answer
n = int(input())
ans = n//11*2
if 0 < n%11 <= 6:
    ans += 1
else:
    ans += 2

print(ans)
# Judge status: Accepted
s = list(input())
cnt = 0
if s[0] == "1":
  cnt +=1
if s[1] == "1":
  cnt +=1
if s[2] == "1":
  cnt +=1
print(cnt)
# Judge status: Accepted
S = input()

former = int(S[:2])
latter = int(S[2:])

if((former >= 13 or former == 0) and 1 <= latter <= 12):
    print("YYMM")
if((latter >= 13 or latter == 0) and 1 <= former <= 12):
    print("MMYY")
if(1 <= former <= 12 and 1 <= latter <= 12):
    print("AMBIGUOUS")
if((former >= 13 or former == 0) and (latter >= 13 or latter == 0)):
    print("NA")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

if n == 2:
  print(abs(a[0]-a[1]))
  exit()
l = [0]*(n+1)
for i in range(1,n+1):
  l[i] = l[i-1] + a[i-1]

ans = float("INF")
for i in range(1,n):
  if abs(l[i]-abs(l[i]-l[-1])) < ans: ans = abs(l[i]-abs(l[i]-l[-1]))
print(ans)
# Judge status: Accepted
import math
a,b=map(int,input().split())
print(math.ceil(a/b))
# Judge status: Accepted
q, h, s, d = map(int, input().split())
n = int(input())
L1=min(q*4,h*2,s)
L2=min(L1*2,d)
print(n//2*L2+n%2*L1)
# Judge status: Accepted
N, K = map(int, input().split())
Xn = list(map(int, input().split()))

Ln = [0] * N
for i in range(N-1):
    Ln[i+1] = abs(Xn[i+1] - Xn[i]) + Ln[i]

Rn = [0] * N
for i in range(1, N)[::-1]:
    Rn[i-1] = abs(Xn[i] - Xn[i-1]) + Rn[i]

ans = float("inf")
for i in range(N-K+1):
    ans = min(ans, abs(Xn[i]) + Ln[i+K-1] - Ln[i])

for i in range(K-1, N)[::-1]:
    ans = min(ans, abs(Xn[i]) + Rn[i-K+1] - Rn[i])

print(ans)
# Judge status: Accepted
n = int(input())
alist = [input() for i in range(n)]
 
if len(set(alist))==n:
  if all(alist[i][-1]==alist[i+1][0] for i in range(n-1)):
    print("Yes")
    exit()
print("No")
# Judge status: Accepted
n = int(input())

alp = [chr(v) for v in range(ord("a"), ord("z") + 1)]

def bitcount(v):
    cnt = 0
    for i in range(n + 1):
        cnt += bool(v & (1 << i))
    return cnt

results = []
def f(i=0, s=""):
    if len(s) == n:
        results.append(s)
        return

    for j in range(i + 1):
        if i != j:
            f(i, s + alp[j])
    f(i + 1, s + alp[i])
f()
print(*results, sep="\n")
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
x = max(a)
half = x/2
y = sorted(a, key=lambda x: abs(half-x))[0]
print("{} {}".format(x,y))
# Judge status: Wrong Answer
n,m= map(int, input().split())
l = list(map(int, input().split()))

l.sort()
# print(l)
list=[]
if n != m:
    for i in range(m - 1):
        list.append(abs(l[i + 1] - l[i]))

    list.sort()
    # print(list)
    print(sum(list[0:(m - n)]))
else:
    print(0)
# Judge status: Wrong Answer
N, K = map(int, input().split())
L = list(map(int, input().split()))

L.sort()
print(sum(L[:N-K]), + K)
# Judge status: Accepted
x,y = map(int,input().split())
mod =10**9+7
 
a=(-x+2*y)//3
b=(2*x-y)//3
n=a+b
 
def fact(x,p):
    ret=1
    for i in range(1,x+1):
        ret*=i
        ret%=p
    return ret
 
 
if a+2*b==x and b+2*a==y and a>=0 and b>=0:
    ans=fact(n,mod) * pow(fact(b,mod),mod-2,mod)*pow(fact(a,mod),mod-2,mod)
    print(ans%mod)
else:
    print("0")