peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N, K = map(int, input().split())
p = [int(a) for a in input().split()]

B = [0]*(N-K+1)
B[0] = sum(p[0:K])
for i in range(1, N-K+1):
    B[i] = B[i-1] - p[i-1] + p[i+K-1]
    
max_ind = B.index(max(B))

ep = 0
for i in range(K):
    ep += (p[max_ind+i]*(p[max_ind+i]+1))/(2*p[max_ind+i])

print(ep)
# Judge status: Accepted
L=0
R=0
X=list(input())
A=len(X)
for i in range(A):
  if X[i]=="S":
    R=R+1
  elif X[i]=="T":
    if R!=0:
      L=L+1
      R=R-1
print(A-2*L)
# Judge status: Accepted
MOD = 10 ** 9 + 7

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

ans = 0
total = pow(2, n, MOD)


def comb(n, k):
    bunshi = 1
    bunbo = 1
    for i in range(k):
        bunshi *= n - i
        bunbo *= i+1
        bunshi %= MOD
        bunbo %= MOD
    return (bunshi * pow(bunbo, MOD-2, MOD)) % MOD


ans = total - (comb(n, a) + comb(n, b)) - 1
print(ans % MOD)
# Judge status: Accepted
n = int(input())
alst = list(map(int, input().split()))
cnt = [0 for _ in range(n)]
for a in alst:
    if a > n:
        continue
    cnt[a - 1] += 1

rem = 0
for i, num in enumerate(cnt, start = 1):
    if num >= i:
        rem += i
        
print(n - rem)
# Judge status: Accepted
S=input()
if S=="Sunny":
    print("Cloudy")
elif S=="Cloudy":
    print("Rainy")
else:
    print("Sunny")
# Judge status: Accepted
A,B = map(int,input().split())
if A > B:
    print(A-1)
else:
    print(A)
# Judge status: Accepted
s = input()

s1 = s.replace("eraser", 'xxx')
s2 = s1.replace("erase", 'xxx')
s3 = s2.replace("dreamer", 'xxx')
s4 = s3.replace("dream", 'xxx')

s5 = s4.strip('x')

if (s5 == ''):
    print('YES')
else:
    print('NO')
# Judge status: Accepted
s=input()
t=input()
n=len(s)
m=len(t)
ans='UNRESTORABLE'
a=[]
for i in range(n-m+1):
  if s[i]==t[0] or s[i]=='?':
    for j in range(m):
      if s[i+j]!=t[j] and s[i+j]!='?':
        break
    else:
      an=list(s[:i]+t+s[i+j+1:])
      for k in range(n):
        if an[k]=='?':
          an[k]='a'
      an=''.join(an)
      a.append(an)
if len(a):
  print(min(a))
else:print(ans)
# Judge status: Accepted
from bisect import bisect_left
n, x = map(int, input().split())
a = list(map(int, input().split()))
a.sort()

a_cs = [0] * (n + 1)
for i in range(n):
    a_cs[i + 1] = a_cs[i] + a[i]

idx = bisect_left(a_cs, x)
if idx == n + 1:
    ans = n - 1
elif a_cs[idx] > x:
    ans = idx - 1
else:
    ans = idx
print(ans)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
cnt = 0

for i in range(1, n-1):
    if (p[i - 1] < p[i]) and (p[i] < p[i + 1]):
        cnt += 1
    elif (p[i - 1] > p[i]) and (p[i] > p[i + 1]):
        cnt += 1

print(cnt)
# Judge status: Accepted
N = int(input())
A = sorted(list(map(int,input().split())))
cnt = 0
cur = 0
for i in range(3*N-1,-1,-2):
    a,b = A[i],A[i-1]
    cnt += b
    cur += 1
    if cur==i-1:break
print(cnt)
# Judge status: Accepted
string = input()
kai = int(input())
data = [input().split(' ') for i in range(kai)]
key = 0  #0 start
former = []
latter = []

for i in range(kai):
    if(data[i][0] == '1'):
        key = (key + 1) % 2
    elif((int(data[i][1]) + key) % 2 == 1):
        former.append(data[i][2])
    else:
        latter.append(data[i][2])

string = ''.join(former[::-1]) + string + ''.join(latter)
if(key == 0):
    print(string)
else:
    print(string[::-1])
# Judge status: Wrong Answer
import sys
a1=sys.stdin.readline()
t=a1.isupper()
a2=list(a1)
b=[ord(x) for x in a2]
b.sort()
if len(a2)==4 and t==True:
    if b[0]==b[1] and b[2]==b[3] and b[0]!=b[3] and b[1]!=b[2]:
        print("Yes")
    else:
        print("No")
else:
    print("Error")
# Judge status: Wrong Answer
K,A,B=map(int,input().split())
bis=1
if K==1:
  bis+=1
elif A>=B-1 or K-A+1<=0:
  bis+=K
else:
  if int((K-(A-1)))%2==0:
    bis=A+(B-A)*(K-(A-1))//2
  else:
    bis=A+(B-A)*(K-(A-1))//2+1
print(bis)
# Judge status: Accepted
# B
a, b, c, d = map(int, input().split())

while True:
    c = c - b
    if c <= 0:
        print('Yes')
        break
    a = a - d
    if a <= 0:
        print('No')
        break
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
ans=1
temp=0
cnt=0
for i in range(1,n):
  cnt=cnt+1
  if a[i-1]<a[i] and temp==0:
    temp=1
  elif a[i-1]>a[i] and temp==0:
    temp=2
  elif a[i-1]>a[i] and temp==1:
    temp=2
    if cnt>1:
      ans=ans+1
      cnt=0
  elif a[i-1]<a[i] and temp==2:
    temp=1
    if cnt>1:
      ans=ans+1
      cnt=0
print(ans)
# Judge status: Accepted
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n, m = map(int, input().split())
h_list = list(map(int, input().split()))
ten_list = [1] * n
for i in range(0, m):
    a, b = map(int, input().split())
    if h_list[a - 1] <= h_list[b - 1]:
        ten_list[a - 1] = 0
    if h_list[a - 1] >= h_list[b - 1]:
        ten_list[b - 1] = 0
print(sum(ten_list))
# Judge status: Accepted
# -*- coding: utf-8 -*-
X,K,D=map(int,input().split())

X=abs(X)
ii=int(X/D)
if K<=ii:
    X-=K*D
else:
    X-=ii*D
    if (K-ii)%2==1:
        X-=D

print(abs(X))
# Judge status: Accepted
A, B, C = map(int, input().split())
K = int(input())

for i in range(K):
  for ii in range(K - i):
    iii = K - i - ii
    a = A * (2 ** i)
    b = B * (2 ** ii)
    c = C * (2 ** iii)
    if a < b < c:
      print('Yes')
      exit(0)
print('No')
# Judge status: Accepted
s = list(input())
if (s[2] == s[3]) and (s[4] == s[5]):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
#!python3

import sys
sys.setrecursionlimit(200000)


# input
N = int(input())
l = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]


def solve(s, m):
    if len(s) == N:
        print(s)
    else:
        for i in range(m + 1):
            solve(s + l[i], max(i + 1, m))


def main():
    solve("a", 1)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n = int(input())
ans = int((n-1)*n*0.5)
print(ans)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

x = max(a * c, a * d)
y = max(b * c, b * d)
z = max(x, y)

print(z)
# Judge status: Accepted
from math import floor
A, B = map(int, input().split())
tax_A = 0.08
tax_B = 0.1
i = 1
A_list = []
while(floor(i*tax_A)<=A):
    if floor(i*tax_A)==A:
        A_list.append(i)
    i += 1
i = 1
B_list = []
while(floor(i*tax_B)<=B):
    if floor(i*tax_B)==B:
        B_list.append(i)
    i += 1
if max(min(A_list), min(B_list)) in A_list and max(min(A_list), min(B_list)) in B_list:
    print(max(min(A_list), min(B_list)))
else:
    print(-1)
# Judge status: Accepted
#!/usr/bin/env python3


def main():
    S = input()
    if S[0] == S[1]:
        print('Bad')
    elif S[1] == S[2]:
        print('Bad')
    elif S[2] == S[3]:
        print('Bad')
    else:
        print('Good')


if __name__ == '__main__':
    main()
# Judge status: Accepted
atcoder,s,contest = map(str,input().split())
print(atcoder[0]+s[0]+contest[0])
# Judge status: Wrong Answer
(K, X) = list(map(int, input().split()))

if (K * 500) >= K:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
def check():
    N,M = map(int, input().split())
    hune = sorted([list(map(int, input().split())) for _ in range(M)], key=lambda x:x[0])
    
    for a,b in hune:
        if a == 1:
            for c,d in hune:
                if c == b and d == N:
                    print('POSSIBLE')
                    return
        if a == 2:
            break
    print('POSSIBLE')
    
check()
# Judge status: Wrong Answer
s=input()
t=input()
ans=0
for i in range(len(s)):
  if s[i]==t[i]:
    ans+=1
print(ans)
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())
if a != 0:
    xc = int((a-1)/c)
    yc = int(b/c)
    xd = int((a-1)/d)
    yd = int(b/d)
    xcd = int((a - 1) / (c * d))
    ycd = int(b / (c * d))
else:
    xc = int((a)/c)
    yc = int(b/c)
    xd = int((a)/d)
    yd = int(b/d)
    xcd = int((a) / (c * d))
    ycd = int(b / (c * d))
print(b - a + 1 -((yc - xc) + (yd - xd) - (ycd - xcd)))
# Judge status: Wrong Answer
for t in range(1,27):
  print(t)
# Judge status: Wrong Answer
a , b = map(int, input().split())
for i in range(1 , 10100) :
  a1 = int(i*0.08)
  b1 = int(i*0.10)
  if a1 == a and b1 == b :
    print(i)
  else :
    print(-1)
# Judge status: Accepted
import collections
N=int(input())
S=list(input())
l=[]
c=collections.Counter(S)
num=1
p=10**9+7
values=list(c.values())	#aのCollectionのvalue値のリスト(n_1こ、n_2こ…)
key=list(c.keys())	#先のvalue値に相当する要素のリスト(要素1,要素2,…)
for i in range(len(key)):
    l.append([key[i],values[i]])#lは[要素i,n_i]の情報を詰めたmatrix
#print(l)
for i in range(len(l)):
    num=num*(l[i][1]+1)
print((num-1)%p)
# Judge status: Accepted
def main():
    N = int(input())
    A = list(map(int, input().split()))
    b, h, s, = 0, 0, 1000

    for a in A:
        n_b, n_h = b % a, h + (b // a)
        if s // a == n_h:
            n_b = max(n_b, s % a)
        if s // a > n_h:
            n_h = s // a
            n_b = s % a
        s = max(s, b + h * a)
        b, h = n_b, n_h

    return s

print(main())
# Judge status: Accepted
import re
S=str(input())
k=int(input())

if set(S)=={'1'}:
  print(1)
  
else:
  x=re.search(r'[2-9]',S).start()
      
  if S[0]=='1':
    if k<=x:
      print(S[0])
    else:
      print(S[x])     
  else:
    print(S[0])
# Judge status: Accepted
import math
a,b,x = map(int,input().split())
if x <= b*a*a*1/2:
    dum = 2*x/(a*b)
    ans = 90-(math.degrees(math.atan(dum/b)))
else:
    x -= b*a*a*1/2
    dum = b-(x*2/(a*a))
    ans = math.degrees(math.atan(dum / a))
print(ans)
# Judge status: Accepted
N,Y=map(int,input().split())

for i in range(N+1):
    for j in range(N+1-i):
        k=N-i-j
        if 10000*i+5000*j+1000*k==Y:
            print(i,j,k)
            exit()

print(-1,-1,-1)
# Judge status: Wrong Answer
import math

X, Y =  map(int, input().split())
YdX = Y/X
math.log(YdX, 2)
print(int(math.log(YdX, 2))+1)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

cnt=0
margin=0
for i in range(n):
  x=a[i]
  y=b[i]
  if x>y:
    cnt+=x-y
  elif x<y:
    margin+=(y-x)//2

print('Yes' if margin>=cnt else 'No')
# Judge status: Wrong Answer

a, b, c = map(int, input().split())
if a ** 0.5 + b ** 0.5 < c ** 0.5:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
def DigitsSUM(Num):
    sumN = 0
    while Num > 0:
        sumN += Num % 10
        Num/=10
    return int(sumN)


N,A,B = input().split()
LowerLimit=int(A)
UpperLimit=int(B)
num = int(N)
sumary = []
counter = 0
for i in range(1,num+1):
    sumN = DigitsSUM(i)
    if LowerLimit <= sumN and sumN <= UpperLimit+1:
        print(i, sumN)
        counter+=int(i)
        
print(counter)
# Judge status: Accepted
N = int(input())
a = list(map(int,input().split()))

ans = 0

for i in range (N):
    ans = ans ^ a[i]

for i in range (N):
    print(ans ^ a[i])
# Judge status: Accepted
n = int(input())
s = [""]*n
for i in range(n):
  s[i] = input()
ac,wa,tle,re = 0,0,0,0
for i in range(n):
  if s[i] == "AC":
    ac += 1
  elif s[i] == "WA":
    wa += 1
  elif s[i] == "TLE":
    tle += 1
  else:
    re += 1
print("AC x %d\nWA x %d\nTLE x %d\nRE x %d" % (ac,wa,tle,re))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
s = []

for i in range(n):
    if i%2==1:
        s.insert(0,' ')
        s.insert(0, a[i])
    else:
        s.append(a[i])
        s.append(' ')

s.pop(-1)
print(s)
s = ''.join(map(str,s))
print(s)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = 0

for i in range(n):
  if i % 2 == 0 and a[i] % 2 != 0:
    ans += 1
    
print(ans)
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))

l = 0
r = max(a)

while r - l > 1:
    cnt = 0
    mid = (r + l) // 2
    for i in range(n):
        d = (a[i] // mid) + (a[i] % mid != 0) - 1
        cnt += d
    if cnt <= k: r = mid
    else: l = mid 

print(r)
# Judge status: Accepted
a, b = input().split()
N = int(a+b)
for n in range(N):
    if n*n == N:
        print("Yes")
        break
else:
    print("No")
# Judge status: Accepted
S = list(input())

if S[0] == S[1]:
  print("Bad")
elif S[1] == S[2]:
  print("Bad")
elif S[2] == S[3]:
  print("Bad")
else:
  print("Good")
# Judge status: Accepted
n,k = map(int,input().split())
s = input()

s += 'x'
l = list()
cnt = 1
for i in range(1,n+1):
  if s[i]!=s[i-1]:
    l.append(cnt)
    cnt = 1
  else:
    cnt += 1

m = min(2*k+1, len(l))
ans = sum(l[0:m]) - 1 

for j in range(m,len(l)):
  ans += l[j] - 1

print(ans)
# Judge status: Accepted
N = int(input())
a = sorted(list(map(int, input().split())), reverse=True)
A = 0
B = 0
for i in range(0, N, 2):
    A += a[i]
for i in range(1, N, 2):
    B += a[i]
print(A - B)
# Judge status: Accepted
N = list(map(int,list(input())))
ans = 0
skfl = 0
nf = 0
for i in range(1, len(N) + 1):
    if i != len(N):
        if N[-(i+1)] >= 5:
            nf = 1
    if N[-i] + skfl + nf > 5:
        ans += 10 - N[-i] - skfl
        skfl = 1
    else:
        ans += N[-i] + skfl
        skfl = 0
    nf = 0
print(ans+skfl)
# Judge status: Accepted
N = int(input())

count = 0
for i in range(1,N):
    if i*2>=N:
        break
    j = N//i
    if i*j == N:
        j -= 1
    count += j
count += N-i

print(count)
# Judge status: Wrong Answer
x, y = map(int, input().split())

if x*y < 0:
    print(abs(abs(x)-abs(y))+1)
else:
    if x < y:
        print(y-x)
    else:
        print(x-y+2)
# Judge status: Wrong Answer
i = list(map(int,input().split()))
person = i[1] + i[2]
B = i[2]
rank = input()
passp = 0
bp = 0
for i,r in enumerate(rank):
	if r == "a" and passp < person:
		print("Yes")
		passp += 1
	elif r == "b":
		bp += 1
		if passp < person and bp <=B:
			print("Yes")
			passp += 1
	else:
		print("No")
# Judge status: Accepted
def modinv(a,m):
    return pow(a,m-2,m)

x,y = map(int,input().split())
if (x+y)%3 != 0 or 2*y-x < 0 or 2*x-y < 0:
    print(0)
else:
    a = (2*y-x)//3
    b = (2*x-y)//3
    ans = 1
    mod = 10**9+7
    for i in range(1,a+1):
        ans = ans*(i+b)*modinv(i,mod)%mod
    print(ans)
# Judge status: Accepted
sa = input()
sb = input()
sc = input()

next = "a"
while True:
    if next == "a":
        if sa == "": break
        next = sa[0]
        sa = sa[1:]
    elif next == "b":
        if sb == "": break
        next = sb[0]
        sb = sb[1:]
    else:
        if sc == "": break
        next = sc[0]
        sc = sc[1:]
if next == "a":
    print("A")
elif next == "b":
    print("B")
else:
    print("C")
# Judge status: Accepted
N = int(input())
data = [input() for x in range(N)]

keys_list = ['AC','WA','TLE','RE']
check_list = {'AC':0,'WA':0,'TLE':0,'RE':0}

for x in data:
    check_list[x] = check_list[x] + 1

for x in keys_list:
    print('{} x {}'.format(x,check_list[x]))
# Judge status: Wrong Answer
import itertools
N = int(input())
L1 = tuple(map(int,input().split()))
a = 0
L2 = tuple(map(int,input().split()))
b = 0
L = [i for i in range(1,N+1)]
Base = list(itertools.permutations(L))
print(Base)
for i in range(len(Base)):
    if Base[i] == L1:
        a = i+1
for i in range(len(Base)):
    if Base[i] == L2:
        b = i+1
print(abs(a-b))
# Judge status: Accepted
n, m = map(int, input().split())
if n == 1 and m == 1:
    ans = 1
elif n == 1:
    ans = m - 2
elif m == 1:
    ans = n - 2
else:
    ans = (n - 2) * (m - 2)
print(ans)
# Judge status: Accepted
a = sum(list(map(int,input().split())))
print("bust") if a >= 22 else print("win")
# Judge status: Accepted
import re
S,T=open(0)
S=S.replace('?','.')
T=T[:-1]
s=len(S)
t=len(T)
for i in range(s-t,-1,-1):
 if re.match(S[i:i+t],T):print((S[:i]+T+S[i+t:]).replace('.','a'));exit()
print('UNRESTORABLE')
# Judge status: Accepted
import numpy as np
from fractions import gcd
n, x = map(int, input().split())
X = np.array(list(map(int, input().split())))

X = np.abs(X - x)
X = np.sort(X)

ans = X[0]
for i in range(1,n):
    ans = gcd(ans, X[i])
print(ans)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

if a ** 0.5 + b ** 0.5 < c ** 0.5:
    ans = "Yes"
else:
    ans = "No"


print(ans)
# Judge status: Accepted
n = int(input())
s = []
for i in range(n):
    s.append(input())

dic = {}

for x in s:
    if x in dic.keys():
        dic[x] += 1
    else:
        dic[x] = 1

max_v = max(dic.values())
a = []
for k, v in dic.items():
    if v == max_v:
        a.append(k)

ans = sorted(a)
for a in ans:
    print(a)
# Judge status: Accepted
N = int(input())
c = list(input())
from collections import Counter
dic = Counter(c)
left = c[:dic["R"]]
print(left.count("W"))
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
from bisect import bisect_left


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

bc = [tuple(map(int,input().split())) for i in range(m)]
bc = sorted(bc, reverse=True, key=lambda x: x[1])

i = 0
c_card = []
for b, c in bc:
    c_card.extend([c]*b)
    if len(c_card)+b >= n:
        break

ans = 0
for i in range(n):
    if i >= len(c_card):
        ans += a[i]
    else:
        ans += max(a[i], c_card[i])

print(ans)
# Judge status: Accepted
from collections import Counter
def solve():
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    counter = Counter(A)
    sorted_cnter = sorted(list(counter.items()), key=lambda x: x[1])
    will_rewrite = sorted_cnter[:-K]

    ans = 0
    for t in will_rewrite:
        ans += t[1]
    
    print(ans)

if __name__ == '__main__':
    solve()
# Judge status: Accepted
from collections import deque

def resolve():
  n = int(input())
  a = list(map(int, input().split()))
  d = deque()
  for i in range(n):
    if i % 2 == 0:
      d.append(a[i])
    else:
      d.appendleft(a[i])
  while len(d) > 0:
    if n % 2 == 0:
      print(d.popleft(), end=' ')
    else:
      print(d.pop(), end=' ')
  print('')
  return

if __name__ == "__main__":
  resolve()
# Judge status: Accepted
h,n,*L=map(int,open(0).read().split())
dp=[0]*(h+10100)
for i in range(1,h+1):dp[i]=min(dp[i-a]+b for a,b in zip(*[iter(L)]*2))
print(dp[h])
# Judge status: Wrong Answer
c = int(input())
j =  [0]*4
for i in range(c):
  i = input()
  if i == "AC":
    j[0] += 1
  elif i == "WA":
    j[1] += 1
  elif i == "TLE":
    j[2] += 1
  else:
    j[3] += 1
    
print("AC x "+ str(j[0]))
print("WA × "+ str(j[1]))
print("TLE × "+ str(j[2]))
print("RE × "+ str(j[3]))
# Judge status: Wrong Answer
#!/usr/bin/env python3


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    N, K = list(map(int, input().split()))
    ans = [0] * N
    for i in range(K-1):
        d = int(input())
        A = list(map(int, input().split()))
        for j in A:
            ans[j-1] += 1

    a = 0
    for i in ans:
        if i==0:
            a += 1
    print(a)
    return

if __name__ == '__main__':
    main()
# Judge status: Accepted
a=input().split()
b=input().split()
c=input().split()
lista=[int(d) for d in a]
listb=[int(e) for e in b]
listc=[int(f) for f in c]
b1=lista[0]
b2=lista[1]
b3=lista[2]
a2=listb[0]-b1
a3=listc[0]-b1
if a2+b2==listb[1] and a2+b3==listb[2] and a3+b2==listc[1] and a3+b3==listc[2]:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())

if abs((a-b)) + abs(v-w)*t >= 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n, r = map(int, input().split())

if n >= 10:
    print(r)
else:
    print(r + 100 * (10 - n))
# Judge status: Wrong Answer
import sys
import math

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

if N == K:
    print(1)
    sys.exit()
for i in range(N):
    if A[i] == 1:
        print(math.ceil(i/(K-1)) + math.ceil((N-i-1)/(K-1)))
        break
# Judge status: Accepted
s=input()
t=list(set(s))
if len(t)==2:
  cnt1=0
  cnt2=0
  for i in s:
    if i==t[0]:
      cnt1+=1
      
    elif i==t[1]:
      cnt2+=1
      
  if cnt1==2 and cnt2==2:
    print('Yes')
    exit()
    
print('No')
# Judge status: Accepted
A,B = map(int,input().split())
print(A + B//2)
# Judge status: Wrong Answer
def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort(reverse=True)
    l = a[0]
    r = 0
    chk = 10**9+1
    for x in a:
        if abs(x-l//2) < chk:
            r = x
            chk = abs(x-l//2)
    print(l, r)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
s = input()

if 'a' <= s <= 'z':
    print(s.upper())

else:
    print(s.lower())
# Judge status: Accepted
import sys
N = int(input())
A = sorted(list(map(int,input().split())))

res = 1
for i in A:
    if res > 10**18:
        print(-1)
        sys.exit()
    res *= i

if res > 10**18:
    print(-1)
else:
    print(res)
# Judge status: Accepted
q,h,s,d = map(int, input().split())
n = int(input())

if 2*q < h: h = 2*q
if h*2 < s: s = h*2
if s*2 < d: d = s*2

print(n//2*d + n%2*s)
# Judge status: Accepted
n, m = map(int, input().split())
a = [input() for _ in range(n)]
b = [input() for _ in range(m)]

r = n - m + 1
for i_r in range(r):
    for j_r in range(r):
        ok = True
        for i in range(m):
            for j in range(m):
                if a[i_r + i][j_r + j] != b[i][j]:
                    ok = False
        if ok:
            print('Yes')
            exit(0)

print('No')
# Judge status: Accepted
x = int(input())
pr = [1]
for i in range(2,32):
    for j in range(2,10):
        if (i**j <= 1000)&(i**j not in pr):
            pr.append(i**j)
print(max([k for k in pr if k <= x]))
# Judge status: Wrong Answer
n, k = map(int, input().split())

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

sum = 0
ans = 0
a.sort()

for i in range(n):
    sum += a[i]
    if sum <= k:
        ans += 1
    else:
        break

print(ans)
# Judge status: Accepted
import math
#print(math.cos(math.radians(90)))
#exit()
x = int(input())
print(360//math.gcd(360,x))
# Judge status: Accepted
n, x = map(int, input().split())
l = list(int(i) for i in input().split())
d = 0
cnt = 1
for i in range(n):
    d += l[i]
    if d <= x:
        cnt += 1
print(cnt)
# Judge status: Accepted
str = input()

if str.isupper()==True:
  print("A")
else:
  print("a")
# Judge status: Accepted
from itertools import permutations

C = [list(map(int, input().split())) for _ in range(3)]
A = [0, 1, 2]

ans = []

for x in permutations(A, 3):
  temp = 0
  for j in range(3):
    temp += C[j][x[j]]
  ans.append(temp)
    
if len(set(ans)) == 1:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N=int(input())
ls=[int(s) for s in input().split()]
dicA={}
dicB={}
for i in range(N):
  a=i+ls[i]
  if a in dicA:
    dicA[a]+=1
  else:
    dicA[a]=1
  b=i-ls[i]
  if b in dicB:
    dicB[b]+=1
  else:
    dicB[b]=1
ans=0
for a,na in dicA.items():
  if a in dicB:
    ans+=na*dicB[a]
print(ans)
# Judge status: Accepted
n=int(input())
l = [input() for i in range(n)]
L = [[0]*26 for i in range(n)]
s = ''

for i in range(n):
    for j in l[i]:
        L[i][ord(j)-97] += 1

M = L[0]
for k in range(1,n):
    for g in range(26):
        M[g] = min(L[k][g],M[g])

for a in range(26):
    for b in range(M[a]):
        s += chr(a+97)
print(s)
# Judge status: Accepted
def ncr(n, r, p): 
    num = den = 1 
    for i in range(r): 
        num = (num * (n - i)) % p 
        den = (den * (i + 1)) % p 
    return (num * pow(den,  
            p - 2, p)) % p 

s = int(input())
mod = 10**9+7

if s<3:
    res =0
elif s==3:
    res = 1
else:
    res = 0
    for i in range(1, s//3+1):
        n = s-2*i-1
        r = i-1
        res = (res%mod + ncr(n, r, mod)%mod)%mod

print(res)
# Judge status: Wrong Answer
c1 = input()
c2 = input()
if c1[0] == c2[2] and c1[1] == c2[1] and c1[2] == c2[0]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import numpy as np
n, k = map(int, input().split())
points = list(map(int, input().split()))

base = 1
for i, point in enumerate(points[k:]):
  if point>points[i]:
    print('Yes')
  else:
    print('No')
# Judge status: Accepted
from sys import *

n = int(stdin.readline())
ans = 0
for i in range(1, n + 1):
	s = str(i)
	if len(s) % 2 is 1:
		ans += 1 
print(ans)
# Judge status: Accepted
x=int(input())
happy=0

while(x-500>=0):
    x-=500
    happy+=1000
while(x-5>=0):
    x-=5
    happy+=5
print(happy)