peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
def main():
    p,q,r = map(int, input().split())
    min_time = min([p, q, r])
    print(min_time)

if __name__ == '__main__':
	main()
# Judge status: Accepted
n,k = map(int,input().split())
s = [int(input()) for i in range(n)]

s.sort()
d = []
for i in range(n-1):
    d.append(s[i+1]-s[i])


ans = 0
for i in range(k-1):
    ans += d[i]

tmp = ans
for i in range(n-k):
    tmp -= d[i]
    tmp += d[i+k-1]
    ans = min(tmp,ans)

print(ans)
# Judge status: Accepted
from math import sqrt
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a
def hoge(c):
    return int((-1+sqrt(1+8*c))/2)
n = int(input())
a = prime_factorize(n)
b = set(a)
print(sum([hoge(a.count(e)) for e in b]))
# Judge status: Accepted
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    b = [int(i) for i in input().split()]

    c = [int(i) for i in input().split()]

    print(((a[0]+b[0])*c[0])//2)
# Judge status: Accepted
from scipy.special import comb
n, p, *A = map(int, open(0).read().split())
odd = sum(a%2 for a in A)
even = n - odd

if p:
  s = 0
  for i in range(1, odd+1, 2):
    s += comb(odd, i, exact=True)
  s *= pow(2, even)
  print(s)
else:
  s = 0
  for i in range(0, odd+1, 2):
    s += comb(odd, i, exact=True)
  s *= pow(2, even)
  print(s)
# Judge status: Accepted
n = int(input())
s = input()
a = [0]*26
al = 'abcdefghijklmnopqrstuvwxyz'
for i in range(n):
  a[al.index(s[i])] += 1
b = [0]*26
res = 0
for i in range(n):
  b[al.index(s[i])] += 1
  tmp = 0
  for j in range(26):
    if b[j] >= 1 and a[j] - b[j] >= 1:
      tmp += 1
  res = max(res, tmp)
print(res)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

a_i = max(a)
half = a_i/2

best = a_i*2
for j in a:
    if j==a_i:
        continue

    diff = abs(j-half)
    if diff < best:
        best = diff
        a_j = j

print(a_i, a_j)
# Judge status: Wrong Answer
n = int(input())
a = int(input())
r = n % 500
if a < r:
    print("NO")
else:
    print("YES")
# Judge status: Accepted
from collections import Counter

S = input()
c = Counter(S)

if abs(c['a'] - c['b']) <= 1 and abs(c['b'] - c['c']) <= 1 and abs(c['c'] - c['a']) <= 1:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
N = int(input())
A = [int(input()) for i in range(N)]

max_num = max(A)
a = sorted(A)
second = a[-2]

for i in range(N):
    if A[i] == max_num:
        print(second)
    else:
        print(max_num)
# Judge status: Accepted
def check():
  S = input()
  n = len(S)
  dp = [False]*(n+10)
  dp[0] = True
  for i in range(n+1):
    if S[i:i+5]=='dream':
      dp[i+5] |= dp[i]
    if S[i:i+7]=='dreamer':
      dp[i+7] |= dp[i]
    if S[i:i+5]=='erase':
      dp[i+5] |= dp[i]
    if S[i:i+6]=='eraser':
      dp[i+6] |= dp[i]
  if dp[n]==True:
    return 'YES'
  return 'NO'
print(check())
# Judge status: Accepted
import bisect

X, N = map(int, input().split())
if N > 0:
  Ps = list(map(int, input().split()))
else:
  Ps = []

Pst = set(Ps)

ab = 200
tmp = 200
rlt = -1
for i in range(102):
  if i in Pst:
    continue
  else:
    tmp = abs(i-X)
    if ab > tmp:
      ab = tmp
      rlt = i
      
print(rlt)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())

if (c-a-b)<0:
    print("No")

h = 4*a*b
m = (c-a-b)**2

if h<m:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys
from heapq import heappush, heappop
#input = sys.stdin.readline

def main():
    n=int(input())
    ba=[]
    for i in range(n):
        a,b=map(int,input().split())
        ba.append((b,a))
    ba.sort()
    asum=0
    ans='Yes'
    for b,a in ba:
        asum+=a
        if asum>b:
            ans='No'
            break
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
s=list(input())
if s[0] != s[1] or s[1] != s[2]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a,b=map(int,input().split())
if a<0 and 0<b:
    print('Zero')
    exit()
minus_num=0
if a<0:
    minus_num=abs(a)
if b<0:
    minus_num=abs(a-b+1)
print('Negative' if minus_num&1 else 'Positive')
# Judge status: Accepted
k,x = list(map(int, input().split()))
if 500*k >= x:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N, K = map(int, input().split())
hn = []
for i in range(N):
  hn.append(int(input()))
hn = sorted(hn,reverse=True)
min = 99999999
for i in range(N-K+1):
  if min > (hn[i]-hn[K+i-1]):
    min = hn[i]-hn[K+i-1]
print(min)
# Judge status: Wrong Answer
li = input().split()
print('A,li[1][0],C')
# Judge status: Accepted
N = int(input())
v = sorted(list(map(int, input().split())))
for i in range(N-1):
    a = (v[i]+v[i+1])/2
    v[i+1] = float(a)
print(v[-1])
# Judge status: Accepted
N = int(input())
S = input()
x = 0
A = [0]
for i in range(N):
    if S[i] == "I":
        x += 1
    else:
        x -= 1
    A.append(x)
print(max(A))
# Judge status: Wrong Answer
n = int(input())
k = int(input())
x = int(input())
y = int(input())

ans = x*k + y*(n-k)
print(ans)
# Judge status: Wrong Answer
x,y,a,b,c = map(int,input().split())
pl = list(map(int,input().split()))
ql = list(map(int,input().split()))
rl = list(map(int,input().split()))

pp = sorted(pl,reverse=True)[:x-1]
qq = sorted(pl,reverse=True)[:y-1]
all = pp + qq + rl
print(sum(sorted(pl,reverse=True)[:x+y-1]))
# Judge status: Accepted
N,Q = map(int, input().split())
S = input()
range_list = [list(map(int, input().split())) for _ in range(Q)]
 
ac_counter = [0]
# acという文字列をカウントしておくlistを作成
for i in range(1,N):
    ac_counter.append(ac_counter[i-1]+1 if S[i-1:i+1] == 'AC' else ac_counter[i-1])
# 上で作ったリストを使い範囲内に何個あるのか確認
for range_list in range_list:
    print(ac_counter[range_list[1]-1] - ac_counter[range_list[0]-1])
# Judge status: Accepted
import math
import itertools

def get_length(p1, p2):
    x1 = p1[0]
    x2 = p2[0]
    y1 = p1[1]
    y2 = p2[1]

    return ((x1 - x2)**2 + (y1- y2)**2)**0.5

N = int(input())
xy = [[0, 0] for _ in range(N)]
for i in range(N):
    xy[i][0], xy[i][1] = map(int, input().split())

total_len = 0
pattern = 0
for i in itertools.permutations(list(range(N))):
    pattern += 1
    for j in range(N-1):
        total_len += get_length(xy[i[j]], xy[i[j+1]])

print(total_len / pattern)
# Judge status: Accepted
n, m = map(int, input().split())
a = [i for i in map(int, input().split())]

if n-sum(a)>=0:
    print(n-sum(a))
else:
    print(-1)
# Judge status: Accepted
import sys
s = input()
ans = 'AC'
c = 0
if s[0] != 'A':
    ans = "WA"
for i in range(2,len(s)-1):
    if "C" == s[i]:
        c += 1
if c != 1:
    ans = "WA"
c = 0
for i in range(len(s)):
    a = ord(s[i])
    if 65 <= a and a <= 96:
        c += 1
if c != 2:
    ans = "WA"
print(ans)
# Judge status: Wrong Answer
S=[int(input()) for i in range(5)]
R=list(S)
for i in range(5):
    R[i]=R[i]%10
L=sorted(R)[::-1]

total=S[0]+S[1]+S[2]+S[3]+S[4]
mati=(10-L[0])+(10-L[1])+(10-L[2])+(10-L[3])
print(total+mati)
# Judge status: Accepted
if int(input().replace(' ',''))%4==0:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if abs(b-a)==abs(c-b):
  print('YES')
else:
  print('NO')
# Judge status: Accepted
def main():
    W, H, x, y = map(int, input().split())

    if x * 2 == W and y * 2 == H:
        print(W * H / 2, 1)
        exit()

    print(W * H / 2, 0)


main()
# Judge status: Wrong Answer
N = int(input().strip())
 
 
 
a = []
c = []
f = 0
s="No"
for i in range(N):
    array = list(map(int, input().strip().split()))
    a.append(array)
 
    
for i in range(N):
	if(f == 0 or f == i-1):
		if(a[i][0] == a[i][1]):
			f+=1
		else:
			if(f >=3):
				s="Yes"
			f=0
if(f >=3):
	s="Yes" 
 
if(s=="Yes"):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n, k = map(int, input().split())
A = list(map(int, input().split()))

l = 1
r = 10**9+1

while l < r:
    mid = (l+r)//2
    count = 0
    for i in range(n):
        if A[i] > mid:
            count += A[i]//mid

    if count <= k:
        r = mid
    else:
        l = mid+1


print(l)
# Judge status: Accepted
N, M = list(map(int, input().split()))
PS = [input().split() for _ in range(M)]

ps = [(int(p)-1, s) for p, s in PS]

ac = [0]*N
wa = [0]*N
for p, s in ps:
    if s == "AC":
        ac[p] = 1
    else:
        if ac[p] == 0:
            wa[p] += 1

print(sum(ac), sum([a*w for a, w in zip(ac, wa)]))
# Judge status: Accepted
N=int(input())
T,A=map(int,input().split())
M=list(map(int,input().split()))
S=[]
for i in range(N):
  S.append(abs(T-M[i]*0.006-A))

print(S.index(min(S))+1)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))

ans = 0
for i in range(n-1):
  if p[i] == i+1:
    p[i],p[i+1] = p[i+1],p[i]
    ans += 1
if p[n-1] == n: ans += 1 # 順列最後の値を確認
print(ans)
# Judge status: Accepted
X = int(input())
A = 0
B = 0

A = X - X % 500#A:500
A500 = A / 500 * 1000
#A5 = (X % 500) % 5 * 5
A5 = X % 500 - (X % 500) % 5#495
A5 = A5 / 5 * 5
A = int(A500) + int(A5)
B = (X - X % 5)
B = int(B / 5 * 5)

print(int(max(A, B)))
# Judge status: Accepted
a,b,c,d=map(int,input().split())
if abs(a-b)<=d and abs(b-c)<=d:
    print('Yes')
elif abs(a-c)<=d:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N, M = map(int, input().split())

if N % 2:
    for a in range(1, M + 1):
        b = N - a
        print(a, b)
else:
    even = min(N // 4, M)
    odd = M - even
    for a in range(1, 1 + even):
        b = N + 1 - a
        print(a, b)
    for a in range(even + 1, M + 1):
        b = N - a
        print(a, b)
# Judge status: Accepted
a=int(input())
s=input()
print(s if a >= 3200 else 'red')
# Judge status: Accepted
n=int(input())
a=[]
for i in range(n):
  x,l=map(int,input().split())
  a.append((x+l,2*l))
a.sort()
ans=1
x,l=a[0]
for i in range(1,n):
  xx,ll=a[i]
  if x<=xx-ll:
    ans+=1
    x,l=xx,ll
print(ans)
# Judge status: Accepted
#貪欲法(greedy)
#ABC076C - Dubious Document 2
#https://atcoder.jp/contests/abc076/tasks/abc076_c
##自己考察
import sys

s = list(input())
sl = len(s)
t = list(input())
tl = len(t)

for i in range(sl-tl,-1,-1):
    count = 0
    for j in range(tl):
        if s[i+j] == "?" or s[i+j] == t[j]:
            count +=1
    if count == tl:
        ans = (''.join((s[0:i] + t + s[i+tl:]))).replace("?","a")
        print(ans)
        sys.exit()

print("UNRESTORABLE")
# Judge status: Accepted
N,K = map(int,input().split())
S = input()

h = 0
for i in range(len(S)-1):
  if S[i] == S[i+1]:
    h += 1
h += 2*K
print(min(N-1, h))
# Judge status: Accepted
L = set(map(int, input().split()))
print(len(L))
# Judge status: Accepted
a,b = map(int,input().split())
x = a*b
if x % 2 == 0:
    print('Even')
else:
    print('Odd')
# Judge status: Wrong Answer
N = list(map(int,input()))
ans = 0
ans1 = 0
if N[0] == 1:
  for i in range(len(N)-1):
    ans1 += 9
  print(max(ans,ans1))
else:
  for i in range(len(N)):
    if i == 0:
      ans1 += N[i]-1
    else:
      ans1 += 9
  print(max(ans, ans1))
# Judge status: Accepted
n = int(input()) # 入力が1つ
t, a = map(int, input().split()) # 入力が複数
h = [int(i) for i in input().split()] # 配列で数字

ans = 0
nearest = abs(t - h[0] * 0.006 - a)
for i in range(n):
    temp = abs(t - h[i] * 0.006 - a)
    if temp < nearest:
        nearest = temp
        ans = i
print(ans + 1)
# Judge status: Accepted
def main():
    N = int(input())
    if N < 10:
        print(N)
    elif str(N)[1:] == "9"*(len(str(N))-1):
        print(sum(list(map(int,list(str(N))))))
    else:
        ans = sum([9]*(len(str(N))-1))
        if int(str(N)[0]) >= 2:
            ans += int(str(N)[0])-1
        print(ans)

if __name__ == '__main__':
    main()
# Judge status: Accepted
import fractions
n,x=map(int,input().split())
a=list(map(int,input().split()))
a[0]=abs(a[0]-x)
g=a[0]
for i in range(1,n):
  a[i]=abs(a[i]-x)
  g=fractions.gcd(g,a[i])
print(g)
# Judge status: Accepted
from heapq import *
import sys
from collections import *
from itertools import *
from decimal import *
import copy
from bisect import *
import math
sys.setrecursionlimit(4100000)
def gcd(a,b):
    if(a%b==0):return(b)
    return (gcd(b,a%b))
input=lambda :sys.stdin.readline().rstrip()

N,K=map(int,input().split())
A=list(map(int,input().split()))
for i in  range(K,N):
    print("Yes" if A[i]>A[i-K] else "No")
# Judge status: Wrong Answer
N, M=input().split()
A=list(map(int,input().strip().split()))
ls=[]
for Ai in A:
    if int(Ai)>(1/(4*int(M)))*sum(A):
        ls.append(Ai)
if len(ls)>int(M):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def main():
    s = input().rstrip()
    t = [-1]*len(s)
    for i in range(len(s)):
        if s[i] == "T":
            t[i] = 1
    for i in range(1, len(s)):
        t[i] += t[i-1]
    print(2*max(t))

if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())

c = 0
d = 0

for i in range(100):
  for j in range(100):
    if i*4 + j*7 == n:
      print("Yes")
      exit()
print("No")
# Judge status: Accepted
import itertools

N, M, Q = map(int, input().split())
comb = list(itertools.combinations_with_replacement(range(1,M+1), N))

ans = [0]*len(comb)
if ans == []:
    print(0)
else:
    for i in range(Q):
        a,b,c,d = map(int, input().split())
        for j in range(len(comb)):
            if comb[j][b-1] - comb[j][a-1] == c:
                ans[j] += d
    print(max(ans))
# Judge status: Accepted
from collections import deque

n = int(input())
q = deque(range(1, 10))
for _ in range(n - 1):
    x = q.popleft()
    r = x % 10
    y = 10 * x
    if r == 0:
        q.extend([y, y+1])
    elif r == 9:
        q.extend([y+8, y+9])
    else:
        q.extend([y+r-1, y+r, y+r+1])
print(q.popleft())
# Judge status: Accepted
S = list(input())

ans = min(S.count("1"), S.count("0"))

print(ans*2)
# Judge status: Accepted
w=list(input())
w.sort()
tmp=w[0]
cnt=1
flag=0
if len(w)%2==1:
    print("No")
    exit()
for i in range(1,len(w)):
    if tmp==w[i]:
        cnt+=1
    else:
        if cnt%2==0:
            tmp=w[i]
            cnt=1
        else:
            flag=1
            print("No")
            break
if flag==0:
    print("Yes")
# Judge status: Wrong Answer
N=int(input())
B=list(map(int,input().split()))
S=0
for i in range(1,N-1):
  S+=min(B[i],B[i-1])
S+=min(B[0],B[-1])+B[-1]
print(S)
# Judge status: Accepted
a, b = map(int, input().split())
ans = 0
ans1 = 0

for i in range(1, 1000):
    ans += i
    ans1 += i-1
    
    if(ans-ans1 == b-a):
        print(ans-b)
        break
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
w,h,n=map(int,input().split())
x1=0
x2=w
y1=0
y2=h
for i in range(n):
    x,y,a=map(int,input().split())
    if a==1:
        x1=max(x1,x)
    if a==2:
        x2=max(x2,x)
    if a==3:
        y1=max(y1,y)
    if a==2:
        y2=max(y2,y)
print(max((x2-x1)*(y2-y1),0))
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    s = input()
    t = input()

    s_list = sorted(s)
    t_list = sorted(t, reverse=True)
    S = ''.join(s_list)
    T = ''.join(t_list)
    print(S < T)


if __name__ == '__main__':
    main()
# Judge status: Accepted
N, K = map(int, input().split())
arr = list(map(int, input().split()))

ans =[]
if arr[0]>0:
    ans.append(arr[K-1])

if arr[-1]<0:
    ans.append(abs(arr[-1*(K)]))

for i in range(N-K+1):
    if arr[i]*arr[i+K-1]<=0:
        left =2*abs(arr[i])+abs(arr[i+K-1])
        right=2*abs(arr[i+K-1])+abs(arr[i])
        ans.append(min(left,right))

print(min(ans))
# Judge status: Wrong Answer
s=input()
num=len(s)
for i in range(1,len(s)):
    s=s[:-1]
    a=s[:int(len(s)/2)]
    b=s[int(len(s)/2):]
    if a==b:
        num=min(num,len(s))
print(num)
# Judge status: Accepted
x = int(input())
import math

def sosu(x):
    for i in range(2, math.floor(x**0.5)):
        if x%i ==0:
            return True

    return False

while sosu(x):
    x +=1

print(x)
# Judge status: Wrong Answer
A, B, K = map(int, input().split())
c = 0
for i in range(1, min(A,B) + 1):
  if A % i == 0 and B % i == 0:
    c += 1
    if c == K:
      ans = i
print(ans)
# Judge status: Accepted
# coding: utf-8
# Your code here!
n = int(input())
x = list(map(int,input().split()))
x.sort(reverse=True)
count = 0
for i in range(n-1):
    count += x[int((i+1)/2)]
print(count)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort()
a.reverse()
# slice操作 --> [start:stop:step]
# 奇数番目の要素の和 - 偶数番目の要素の和
print(sum(a[::2]) - sum(a[1::2]))
# Judge status: Accepted

def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    x=0
    N=I()
    S=input()
    
    ans=0
    for i in range(N):
        if S[i]=="I":
            x+=1
        else:
            x-=1
            
        ans=max(ans,x)
        
    print(ans)

main()
# Judge status: Wrong Answer
S = list(input())
print("Yes" if "S" in S == "N" and "E" in S == "W" in S else "No")
# Judge status: Accepted
import sys
f=lambda:map(int,sys.stdin.readline().split())
h,n=f()
INF=10**9
dp=[[INF]*(h+1) for _ in range(n+1)]
dp[0][0]=0
for i in range(n):
  a,b=f()
  for j in range(h+1):
    dp[i+1][j]=min(dp[i][j],dp[i+1][max(j-a,0)]+b)
print(dp[n][h])
# Judge status: Accepted
N, K = map(int, input().split())
h = [0] * N
for i in range(N):
    h[i] = int(input())
h = sorted(h, reverse=True)

ans = float("inf")
for i in range(N - K + 1):
    ans = min(ans, h[i] - h[i + K - 1])
print(ans)
# Judge status: Accepted
n = int(input())
d = list(list(input().split())+[i+1] for i in range(n))
a = sorted(d, key=lambda x:(x[0],-int(x[1])))
for v in a:
  print(v[2])
# Judge status: Accepted
#!/usr/bin/env python3
import sys

input = sys.stdin.readline


def ST():
    return input().rstrip()


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


X = I()

for a in range(-118, 120):
    for b in range(-119, 119):
        if a ** 5 - b ** 5 == X:
            print(a, b)
            exit()
# Judge status: Accepted
A = [0,0,0,1,1,1]
s = int(input())
if s < 6:
    print(A[s])
else:
    for i in range(6,s+1):
        a = 1
        for j in range(3,i-2):
            a += A[j]
        A.append(a)
    print(A[s]%(10**9 + 7))
# Judge status: Accepted
# A - A+...+B Problem

N, A, B = map(int, input().split())

if A>B or (N==1 and A!=B):
    print(0)
else:
    print((N-2)*(B-A)+1)
# 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
n = int(input())
s=[]
for i in range(n):
    s.append(input())
from collections import Counter
cs = Counter(s)
m = int(input())
for i in range(m):
    t = input()
    if cs[t]:
        cs[t] -= 1
print(cs.most_common(1)[0][1], flush=True)
# Judge status: Wrong Answer
n = int(input())

n1 = input()

i = len(n1)

n2 = '...'

if n > i:
    print(n1)
else:
    print(n1[:n] + n2)
# Judge status: Accepted
# https://atcoder.jp/contests/abc088/tasks/abc088_c

matrix = []

for _ in range(3):
    row = [int(i) for i in input().split()]
    matrix.append(row)

a1 = matrix[1][0] - matrix[0][0]
a2 = matrix[2][0] - matrix[0][0]
b1 = matrix[0][1] - matrix[0][0]
b2 = matrix[0][2] - matrix[0][0]

if a1 + b1 == matrix[1][1] - matrix[0][0] and a2 + b2 == matrix[2][2] - matrix[0][0] and a1 + b2 == matrix[1][2] - matrix[0][0] and a2 + b1 == matrix[2][1] - matrix[0][0]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(1, n + 1):
    if len(str(i)) % 2 == 1:
        ans += 1
print(ans)
# Judge status: Wrong Answer
S = input()

N = len(S)
def isPalindrome(S, i, j):
    i = int(i)
    j = int(j)
    while S[i] == S[j]:
        i+=1
        j-=1
        if i == j or j == i - 1:
            return True
        elif i > j:
            return False

if isPalindrome(S, 0, N-1) and isPalindrome(S, 0, (N-1)/2-1) and isPalindrome(S, (N+3)/2-1, N-1):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n, k = (int(x) for x in input().split())
ab = []
for _ in range(n):
    a, b = (int(x) for x in input().split())
    ab.append([a, b])
ans= 0
ab = sorted(ab, key=lambda x: x[0])

for i,j in ab:
    ans+=j
    if k<=ans:
        print(i)
        break
# Judge status: Accepted
N = int(input())

if N % 111:
    print(111*(N//111 + 1))

else:
    print(111*int((N/111)))
# Judge status: Accepted
import math
N = int(input())
List = list(map(int,input().split()))
L=[0]*N
R=[0]*N
for i in range(1,N):
  L[i] = math.gcd(L[i-1],List[i-1])
  R[-i-1] = math.gcd(R[-i],List[-i])
ans = 0
for i in range(N):
  ans = max(ans,math.gcd(L[i],R[i]))
print(ans)
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())
while c >0:
  a -= d
  c -= b
  
if c < 0:
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
c = Counter(A)
l = sorted(filter(lambda x:x[1] > 1,c.items()),reverse=True)

if len(l) == 0:
  print(0)
else:
  print(l[0][0]*l[1][0])
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a.append(0)
b.append(0)
b.append(0)
ans = 0
for i in range(n+1):
    if a[i]-b[i] > 0:
        ans += b[i]
    elif a[i]-b[i] <= 0 and a[i] + a[i+1] >= b[i]:
        b[i+1] += b[i]-a[i]
        ans += a[i]
    else:
        b[i+1] += a[i+1]
        ans += a[i]
print(ans)
# Judge status: Accepted
from collections import defaultdict

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

for _ in range(N):
    A, B = map(int, input().split())
    drinks[A] += B

drinks = sorted(drinks.items(), key = lambda x : x[0])
cnt = 0
price = 0

for k, v in drinks:
    purchases = min(v, M - cnt)
    cnt += purchases
    price += purchases * k

print(price)
# Judge status: Accepted
n = int(input())

def calc(n):
    a,b = 2, 1
    if n == 0:
        return a
    elif n == 1:
        return b
    else:
        for i in range(n-1):
            a,b = b, a+b
        return b
ans = calc(n)
print(ans)
# Judge status: Accepted
n,k = map(int,input().split())
X = list(map(int,input().split()))
Xp = [x for x in X if x>=0]
Xm = [-x for x in X if x<0]
Xm.sort()
Xp.insert(0,0)
Xm.insert(0,0)
lp = len(Xp)
lm = len(Xm)
ans = 10**9
for p in range(k+1):
    m = k-p
    if p>lp-1 or m>lm-1:continue
    ans= min(ans,2*Xm[m] +Xp[p],Xm[m] +2*Xp[p] )
print(ans)
# Judge status: Accepted
D, N=map(int, input().split())
a=0
if N==100:
  a=100**D
print((100**D)*N+a)
# Judge status: Wrong Answer
# encoding: utf-8
max_, request = map(int, input().split())
amounts = list(map(int, input().split()))
amounts.sort()
print(amounts[:request])
# Judge status: Wrong Answer
# -*- coding : utf - 8 -*-

w = str(input())

for i in w:
  if w.count(i) % 2 == 1:
    print("NO")
    exit()
    
print("Yes")
# Judge status: Accepted
s = input()

if s == "Sunny":
    print("Cloudy")
elif s == "Cloudy":
    print("Rainy")
else:
    print("Sunny")
# Judge status: Accepted
b=[]
a=input()
b=map(int,input().split())
ans=[]
f_ans=0
for i in b:
 d=0
 while i % 2 == 0:
   i=i/2
   d+=1
 ans.append(d)
 f_ans=min(ans)
print(f_ans)
# Judge status: Accepted
def main():
    a, b, c = map(int, input().split())
    x = b*c*((a-a//2)-a//2)
    y = a*c*((b-b//2)-b//2)
    z = a*b*((c-c//2)-c//2)
    print(min(x, y, z))

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
S = input()
print(S[:2]+"8"+S[4:])
# Judge status: Accepted
q,h,s,d=map(int,input().split())
n=int(input())
h=min(h,q*2)
s=min(s,h*2)
d=min(d,s*2)
print((n//2)*d + (n%2)*s)
# Judge status: Wrong Answer
a, b = map(int,input().split())

if (a + b) < 25:
  print(a + b)

else:
  print((a + b) - 24)
# Judge status: Accepted
#-*-coding:utf-8-*-
import numpy as np

def main():
    n,k = map(int,(input().split()))
    ashiba=np.array((input().split()),int)
    dp=np.zeros(n,dtype=int)
    for i in range(1,n):
        start=max(0,i-k)
        dp[i]=min(dp[start:i]+abs(ashiba[i]-ashiba[start:i]))
    print(dp[n-1])

if __name__ == "__main__":
    main()