peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n,x = list(map(int,input().split()))
a = list(map(int,input().split()))
op=0
for i in range(len(a)-1):
    s = a[i]+a[i+1]
    if (s < x):
        continue
    else:
        diff = s - x
        op += diff
        a[i+1] -= diff
print(op)
# Judge status: Accepted
a,b,c = map(int,input().split())
n = a + b + c
if n >= 22 : print("bust")
else:print("win")
# Judge status: Wrong Answer
S = list(input())
maxIndex = len(S)

result = 0
for index in range(len(S)):
    counter = 0
    for tmp in range(index, maxIndex):
        if S[tmp] in ["A", "C", "G", "T"]:
            counter += 1
            if tmp == maxIndex:
                if counter > result:
                    result = counter
                    break
            continue
        if counter > result:
            result = counter
            break
    if result == maxIndex: break

print(result)
# Judge status: Accepted
import math
N = int(input())
ans = int((-1+math.sqrt(1+8*N))/2)

if (ans*(ans+1))//2<N:
  ans += 1

k = (ans*(ans+1))//2-N

if k == 0:
  for i in range(ans):
    print(i+1)
else:
  for i in range(ans):
    if i+1 != k:
      print(i+1)
# Judge status: Accepted
X, Y = map(int, input().split())
print(int(X+(Y/2)))
# Judge status: Accepted
#

import sys
input=sys.stdin.readline

def main():
    a=int(input())
    print(a+a**2+a**3)
    
    
    
if __name__=="__main__":
    main()
# Judge status: Wrong Answer
p,q,r=map(int,input().split())
if p+q<q+r and p+q<p+r:
    print(p+q)
if p+r<p+q and p+r<q+r:
    print(p+r)
if q+r<p+r and q+r<p+q:
    print(q+r)
if p+r==q+r and p+r<p+q:
    print(p+r)
if p+q==q+r and p+q<p+r:
    print(p+q)
if r+q==p+r and r+q<p+q:
    print(r+q)
if p==q==r:
    print(p+q)
# Judge status: Wrong Answer
N=int(input())



print(N//2+1)
# Judge status: Wrong Answer
import math
x, y, z = list(map(int, input().split()))
print(x*y*math.ceil(z/2) - x*y*math.floor(z/2))
# Judge status: Wrong Answer
N = int(input())
Ar =list(map(int,input().split()))

cnt=1
for i in range(N):
  if Ar[i]==cnt:
    cnt+=1
print(N-cnt+1)
# Judge status: Accepted
from fractions import gcd
from functools import reduce

n = int(input())
lst = list(map(int, input().split()))
ans = 0
mod = 10**9+7
lcd = reduce(lambda x,y : x*y//gcd(x,y), lst)
for i in lst:
    ans += lcd//i

print(ans%mod)
# Judge status: Accepted
def resolve():
    a, b = map(int, input().split())

    ans = str()
    if a % 3 == 0 or b % 3 == 0 or (a+b) % 3 == 0:
        ans = "Possible"
    else:
        ans = "Impossible"
    
    print(ans)
resolve()
# Judge status: Accepted
n = int(input())
s = input()


def judge(s):
    if len(s) % 2 == 1:
        print("No")
        return
    for i in range(0, len(s)//2):
        if(s[i] != s[len(s)//2 + i]):
            print("No")
            return
    print("Yes")
    return


judge(s)
# Judge status: Accepted
n = int(input())
l = sorted(list(map(int, input().split())), reverse=True)
cnt = 0
for i in l[1:]:
  cnt += i
if cnt > l[0]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N = int(input())
S = str(input())

M = 0
Sum = 0

for x in S:
    if x == 'I':
        Sum += 1
    else:
        Sum -= 1
    M = max(M, Sum)

print(M)
# Judge status: Accepted
N = int(input())
ans = 1
for i in range(1,N+1):
  ans *= i
  if ans > 10**9 + 7:
    ans %= 10**9 + 7
print(ans)
# Judge status: Accepted
N, K = map(int, input().split())
fruits = map(int, input().split())

print(sum(sorted(fruits)[:K]))
# Judge status: Wrong Answer
import collections

count = input()

l = []
for i in range(int(count)):
    l.append(input())
c = collections.Counter(l)
#print(l)
#print(c)
#print(c.most_common()[0][1])
max_count = c.most_common()[0][1]
for i in c.most_common():
    if i[1] != max_count:
        exit()
    print(i[0])
# Judge status: Accepted
from math import gcd

N, M = map(int, input().split())
A = list(map(int, input().split()))
B = [a//2 for a in A]
LCM = 1
for i in range(N):
    LCM = LCM * B[i] // gcd(LCM, B[i])
for i in range(N):
    if LCM // B[i] % 2 == 0:
        print(0)
        exit()
print((M//LCM + 1)//2)
# Judge status: Accepted
S=int(input())
X1=0
Y1=0
X2=10**9
Y2=1
X3=-S%X2
Y3=(X3+S)//X2
ans=[X1,Y1,X2,Y2,X3,Y3]
print(*ans)
# Judge status: Accepted
import queue
from collections import defaultdict
n,m = map(int,input().split())
g = defaultdict(set)
ans = [0]*n
for _ in range(m):
    a,b = map(int,input().split())
    a -= 1
    b -= 1
    g[a].add(b)
    g[b].add(a)

visited = [False]*n
visited[0] = True
q = queue.Queue()
q.put(0)
while not q.empty():
    v = q.get()
    for p in g[v]:
        if not visited[p]:
            ans[p] = v
            q.put(p)
            visited[p] = True
print('Yes')
for x in ans[1:]:
    print(x+1)
# Judge status: Accepted
n,h,*d=map(int,open(0).read().split());a=max(d[::2]);b=sorted(d[1::2]);c=0
while b and(h>0)*(b[-1]>a):h-=b.pop();c+=1
while b and b[-1]>a>0<h:h-=b.pop();c+=1
print(c-(-h//a)*(h>0))
# Judge status: Accepted
S,W = map(int,input().split())
if (S > W):
    print("safe")
else:
    print("unsafe")
# Judge status: Wrong Answer
import math
n=int(input())
t=[int(input()) for i in range(5)]
ans=0
ans+=math.ceil(n/t[0])
time=math.ceil(n/t[0])
for i in range(4):
  if t[i+1]>=t[i]:
    ans+=1
  else:
    ans+=abs(math.ceil(n/t[i+1])-math.ceil(n/t[i]))+1
print(ans)
# Judge status: Accepted
n,x=map(int,input().split())

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

a.sort()

count=0
 
if x<a[0]:
    print(0)
    exit()


for i in range(n):
    if x>=a[i]:
        x-=a[i]
        count+=1
    else:
        print(count)
        exit()

if x>0:
    print(count-1)
else:
    print(count)
# Judge status: Accepted
a,b,c = map(int,input().split())
if b//a >= c:
  print(c)
else:
  print(b//a)
# Judge status: Accepted
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
b=Counter(a)
count=0
for i in b:
    if b[i]<i:
        count+=b[i]
    else:
        count+=(b[i]-i)
print(count)
# Judge status: Wrong Answer
N=int(input())
L=list(map(int,input().split()))
ans=0
c=[0]*2101
for i in L:c[i]+=1
for i in range(2100):c[i+1]=c[i]+c[i+1]
for i in range(N):
    for j in range(N):
        if i!=j:
            l,r=abs(L[i]-L[j])+1,L[i]+L[j]
            s=c[r]-c[l]
            if l<=L[i] and L[i]<r:s-=1
            if l<=L[j] and L[j]<r:s-=1
            ans+=max(s,0)
print(ans//6)
# Judge status: Wrong Answer
h=int(input())
c=0
while h==0:
  h==h//2
  c=+1
print(c*2-1)
# Judge status: Wrong Answer
a, b, c = (int(i) for i in input().split())
print(max(0, c - (b - c)))
# Judge status: Wrong Answer
n,m,k = map(int,input().split())
ans = 'No'
for i in range(m+1):
  for j in range(n+1):
    if i*n + j*m - i*j == k:
       ans = 'Yes'
print(ans)
# Judge status: Wrong Answer
n = int(input())
A = list(map(int, input().split()))
dic = {}
ans = 0
for i, a in enumerate(A):
    L = i + a
    if L not in dic:
        dic[L] = 1
    else:
        dic[L] += 1
for j in range(n):
    R = j - a
    if R in dic:
        ans += dic[R]
print(ans)
# Judge status: Accepted
n=int(input())
print(['NO','YES'][n==3 or n==5 or n==7])
# Judge status: Accepted
import copy
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from math import floor, ceil, sqrt, factorial, log
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
from itertools import product
import sys
stdin = sys.stdin
mod = 10**9 + 7


def ns(): return stdin.readline().rstrip()


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


K, A, B = na()
if B - A > 1:
    print(1 + (B - A) * ((K - A + 1) // 2) + (A - 1) + ((K - A + 1) % 2))
else:
    print(1 + K)
# Judge status: Accepted
a,b,x = map(int,input().split())
print(b//x -(a-1)//x)
# Judge status: Accepted
ans = 0
N = int(input())

if(N%2):
    ans = N//2 +1
else:
    ans = N//2
print(ans)
# Judge status: Wrong Answer
A,B = map(int,input().split())

k = (A + B) / 2

answer = 0
if A - k >= 0 and -B + k >=0 :
	answer = 1
    
elif -A + k >=0 and B - k >= 0 :
	answer = 1 
    
if answer == 1 and (A + B) % 2 == 0  :
	print(k)
else :
	print("IMPOSSIBLE")
# Judge status: Accepted
A,B=map(int,input().split())
print("Impossible" if (A+B)%3!=0 and A%3!=0 and B%3!=0 else "Possible")
# Judge status: Wrong Answer
A,B=map(int,input().split())
if A<=5:
    print(0)
elif A>=6 and A<=12:
    print(B/2)
elif A>=13:
    print(B)
# Judge status: Wrong Answer
x, y = map(int,input().split())
li = list(map(int,input().split()))

a = li.index(1) #1より前にある数
b = x-1-a #1より後にある数

if a%(y-1) == 0 and b%(y-1) == 0:
    print(a//(y-1)+b//(y-1))
elif a%(y-1) == 0 or b%(y-1) == 0:
    print(a//(y-1)+b//(y-1)+1)
else:
    print(a//(y-1)+b//(y-1)+2)
# Judge status: Accepted
N = int(input())
n = list(map(int, input().split()))

n4 = len(list(filter(lambda x: x % 4 == 0, n)))
no = len(list(filter(lambda x: x % 2 == 1, n)))
if n4 + no < N:
    no += 1

if no <= n4 + 1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
d,n = map(int,input().split())
ans = n * 100**d
if n == 100:
    ans += 100**d
print(ans)
# Judge status: Wrong Answer
import math
X, Y = map(int, input().split())

print(int(math.log2(Y/X))+1)
# Judge status: Accepted
a, b, k = map(int, input().split())

if k > a + b:
    ans_a = 0
    ans_b = 0
elif a >= k:
    ans_a = a - k
    ans_b = b
else:
    ans_a = 0
    ans_b = b - (k - a)

print(ans_a, ans_b)
# Judge status: Wrong Answer
n,a,b = map(int,input().split())
k = a - b + 2 + n
ans = 1
for i in range(n):
  ans *= (k-i)
for i in range(n):
  ans  = ans//(n-i)
print(ans)
# Judge status: Accepted
A=list(map(int,input().split()))
print(min(A[0]+A[1],A[1]+A[2],A[2]+A[0]))
# Judge status: Accepted
a,b,c = map(int,input().split())
print(c if a*c<=b else b//a)
# Judge status: Accepted
import math

n = int(input())
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

x = min(a, b, c, d, e)
print(int(math.ceil(n/x) + 4))
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())

ans = x * min(n, k) + y * max(0, n-k)
print(ans)
# Judge status: Wrong Answer
a,b,c=map(int,input().split());print('YNEOS'[a+c!=b::2])
# Judge status: Wrong Answer
n=int(input())
li = list(map(int,input().split()))
a=0
for i in range(n):
  for j in range(n):
    if li[i] + li[j] and abs(i-j):
      a+=1
print(a/2)
# Judge status: Accepted
a,b,c = map(int, input().split())

sum = (a+b+c)

if a == b == c:
    print(0)
    exit()
else:
    for i in range(max(a,b,c)*3, 200, 3):
        if (i - sum) % 2 == 0:
            print((i - sum)//2)
            exit()
# Judge status: Accepted
import sys
import math


N = int(input())

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

timelis = sorted(timelis,key=lambda x: x[1])

sum_time = 0
for i in timelis:
    need = i[0]
    deadline = i[1]

    sum_time = sum_time + need

    if sum_time > deadline:
        print("No")
        sys.exit()

print("Yes")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

odd, four = 0, 0 
for x in a:
    if x % 2 == 1:
        odd += 1
    if x % 4 == 0:
        four += 1

two = n - odd - four
if two > 0:
    odd += 1
    
if four + 1 >= odd:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def li():
    return [int(x) for x in input().split()]

N = int(input())
A = li()
d = 10**9 + 7
B = [A[i] % d for i in range(len(A))]

s = 0
s2 = 0
for i in range(len(B)):
    s += B[i]
    s = s
    s2 += B[i] ** 2
    s2 = s2

ans = ((s**2 - s2) // 2) % d

print(ans)
# Judge status: Accepted
def main():
    s = list(input())

    if set(s) == {"a", "b", "c"}:
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
import collections
import sys
N,M = map(int,input().split())
P = []
S = []
for i in range(M):
    p, s = map(str, input().split())
    P.append(int(p))
    S.append(s)
if M == 0:
    print(0,0)
    sys.exit()
c = collections.Counter(P)
values, counts = zip(*c.most_common())
result = [0]*len(values)
penalty = 0
d  = dict(zip(values,result))
for i in range(M):
    if S[i] == 'WA' and d[P[i]] == 0:
        penalty += 1
    elif S[i] == 'AC':
        d[P[i]] = 1
sum = 0
for i in values:
    sum += d[i]

print(sum,penalty)
# Judge status: Accepted
n, x = map(int, input().split())
l = list(map(int, input().split()))
L = [0]
a = 0;b = 0
for i in l:
    a += i
    L.append(a)
for j in L:
    if j<=x:
        b += 1
print(b)
# Judge status: Wrong Answer
N,A,B,C,D = map(int,input().split())
S = ['#']+list(input())
CanReach = True
CanChange = False
for i in range(A,C):
    if S[i] == '#' and S[i+1] == '#':
        Canreach = False
for i in range(B,D):
    if S[i] == '#' and S[i+1] == '#':
        Canreach = False
if C < D:
    CanChange = True
for i in range(B,D-1):
    if S[i] == '.' and S[i+1] == '.' and S[i+2] == '.':
        CanChange = True
if CanReach and CanChange:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
S=input()

flag =0
ans =0

for i in range(len(S)):
    for j in range(len(S)-i):
        if S[i+j] == 'A' or S[i+j] == 'G' or S[i+j] == 'T' or S[i+j] == 'C':
            flag +=1
        else:
            ans = max(ans,flag)
            flag =0
            break       

print(ans)
# Judge status: Wrong Answer
x,y, a, b, c= map(int,input().split())
red = list(map(int,input().split()))
green = list(map(int,input().split()))
trans = list(map(int,input().split()))

fr = sorted(red, reverse= True)
fg = sorted(green, reverse= True)
candidate = fr + fg + trans
candidate = sorted(candidate, reverse= True)
candidate = candidate[:x+y]
print(sum(candidate))
# Judge status: Wrong Answer
from collections import Counter

def undivisible(A):
    m = max(A)
    dp = [True] * (m+1)
    A.sort()
    for a in A:
        if dp[a]:
            k = a * 2
            while k <= m:
                dp[k] = False
                k += a
    cnt = Counter(A)
    ans = 0
    for a in A:
        if dp[a] and cnt[a] == 1:
            ans += 1
    return ans

n = int(input())
A = list(map(int, input().split()))
undivisible(A)
# Judge status: Accepted
def resolve():
	n = int(input())
	a = list(map(int, input().split()))
	t = dict()
	for i in a:
		if t.get(i):
			t[i] += 1
		else:
			t[i] = 1
	a, b = 0, 0
	for k in t:
		if t[k] >= 4:
				a = max(a, k)
				b = max(b, k)
		elif t[k] >= 2:
			if k > a:
				b = a
				a = k
	print(a*b)
resolve()
# Judge status: Accepted
H = int(input())
W = int(input())
N = int(input())

max_h_w = max([H, W])
min_h_w = max([H, W])

count = 0
for i in range(min_h_w):
    N -= max_h_w
    count += 1
    if N <= 0:
        break
print(count)
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
print(C - (A-B) )
# Judge status: Wrong Answer
s = int(input())
print(0,0,10**9,1,s//(10**9),s%(10**9))
# Judge status: Accepted
import math
x = int(input())

L = []
for i in range(2,int(math.floor(math.sqrt(x)))+1):
  for j in range(x//i + 1):
    if i ** j <= x:
      L.append(i ** j)
      
if L == []:
  print("1")
else:
  print(max(L))
# Judge status: Accepted
from collections import Counter
S=input()
d = {'a':0,'b':0,'c':0}
for i in S:
    d[i] += 1
if max(d.values())-min(d.values()) <=1:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
X = input()

for i in range(len(X)):
  if X[i] == "S":
    ans = i * 2
    break

for i in range(len(X)):
  if X[-1 -i] == "T":
    ans = max(ans, i * 2)
    break

print(ans)
# Judge status: Wrong Answer
s=int(input())
t=[]
for i in range(s):
    u,l=map(int,input().split())
    t.append((u-l,u+l-1))
t.sort(key=lambda x: x[1])
d=-10*10
ans=0
for i in range(s):
  if d<t[i][0]:
    ans+=1
    d=t[i][1]
print(ans)
# Judge status: Accepted
#X = int(input())
#S = str(input())
A, B, C = map(int, input().split())
#C = list(map(int, input().split()))
ans = 0
while A >= B:
  B *= 2
  ans += 1
#print(A, B, C, ans)  
while B >= C:
  C *= 2
  ans += 1
  
K = int(input())
#print(ans)
if ans <= K:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
A,B=map(int,input().split())
if (A+B)%2==0:
    print(A+B//2)
else:
    print('IMPOSSIBLE')
# Judge status: Accepted
from bisect import bisect_left,bisect_right
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(n-2):
    for j in range(i+1,n-1):
        bc=l[i]+l[j]
        idx=bisect_left(l,bc)
        ans+=idx-j-1
print(ans)
# Judge status: Accepted
S=input()
if S=="RRR":
    print(3)
elif S=="RRS" or S=="SRR":
    print(2)
elif S.count("R")>0:
    print(1)
else:
    print(0)
# Judge status: Accepted
n=int(input())
k=int(input())
x=int(input())
y=int(input())
if n>=k:
  b=n-k
  print(k*x+b*y)
else:
  print(n*x)
# Judge status: Accepted
n,a,b,c,d=map(int,input().split())
s=input()
print('YNeos'['##' in s[a-1:max(c,d)] or not(c<d or '...' in s[b-2:d+1])::2])
# Judge status: Accepted
a,b,t=map(int,input().split())
print(int(((t+0.5)//a)*b))
# Judge status: Wrong Answer
N, x = map(int, input().split())
a = list(map(int, input().split()))

a = sorted(a)
ans = 0

for i in range(N):
    if a[i] <= x:
        x -= a[i]
        ans += 1

if x > 0 and ans > 0:
    ans -= 1
    print(ans)
elif x == 0:
    print(ans)
else:
    print(0)
# Judge status: Accepted
w,a,b=map(int,input().split())
print(max(0,max(a,b)-w-min(a,b)))
# Judge status: Accepted
d = int(input())
cl = list(map(int, input().split()))
sl = []
for _ in range(d):
    sl.append(list(map(int, input().split())))

for i in range(d):
    print(i%26 + 1)
# Judge status: Accepted
n=int(input())
s=input()
r=s.count("R")
g=s.count("G")
b=s.count("B")
ans=r*g*b
for i in range(n-2):
  for j in range(i+1,n):
    k=2*j-i
    if k>(n-1):
      break
    if s[i]!=s[j]!=s[k]!=s[i]:
      ans-=1
print(ans)
# Judge status: Accepted
K, S = map(int, input().split())
Sum = 0

for i in range(K + 1):
    for j in range(K + 1):
        if 0 <= S - i - j <= K:
            Sum += 1

print(Sum)
# Judge status: Accepted
import sys
input = sys.stdin.readline

n, k, q = [int(w) for w in input().split()]


score = [0] * n

for i in range(q):
    a = int(input())
    score[a - 1] += 1


for s in score:
    print('Yes' if s + k - q > 0 else 'No')
# Judge status: Accepted
MOD = 10**9+7

s = int(input())
a = [0 for i in range(s+1)]
a[0] = 1
for i in range(3, s+1):
    a[i] = sum(a[:i-2]) % MOD
print(a[s])
# Judge status: Accepted
line = [int(s) for s in input().split()]

if line[0] > line[1]:
    print('safe')
else:
    print('unsafe')
# Judge status: Accepted
# abc163
import math

r = int(input())
ans = r*2*math.pi

print(ans)
# Judge status: Accepted
w,h,x,y = map(int,input().split())
sq = w*(1/2)*h
if x==(w/2) and y==(h/2):
    print(sq,1)
else:
    print(sq,0)
# Judge status: Accepted
import re
firststr = input()

result = re.findall(r'1',firststr)
print(len(result))
# Judge status: Accepted
n = int(input())
d = [list(map(int, input().split())) for i in range(n)]

t, x, y = 0, 0, 0

flag = True
for ti, xi, yi in d:
  if ti >= xi + yi:
    if (ti - t) % 2 != (abs(xi - x) + abs(yi - y)) % 2:
    	flag = False
    	break
    t = ti
    x = xi
    y = yi
    
  else:
    flag = False
    break
    
print("Yes" if flag else "No")
# Judge status: Wrong Answer
N, K = map(int, input().split())
S = input()
S = S.replace(S[K - 1],S[K - 1].lower())
print(S)
# Judge status: Wrong Answer
a,b = map(int,input().split())
num = input()

if len(num) == a+b+1 and num[:a].isdecimal() and num[a]== "-" and num[b:].isdecimal():
	print("Yes")
else:
	print("No")
# Judge status: Accepted
import sys
from itertools import combinations
def input(): return sys.stdin.readline().strip()


def main():
    N = int(input())
    A = list(map(int, input().split()))
    for i in range(N):
        A[i] -= i + 1
    A.sort()
    ans = 0
    for a in A: ans += abs(a - A[N // 2])
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
b = [0]*(N+1)
for i in range(N, 0, -1):
    if sum(b[i::i])%2 != a[i-1]:
        b[i] = 1
print (sum(b))
ans = []
for i, j in enumerate(b):
    if j == 1:
        ans.append(i)
print (*ans)
# Judge status: Accepted
f=lambda:map(int,input().split());n,x=f();t=a=0
for i in f():t=min(i,x-t);a+=i-t
print(a)
# Judge status: Wrong Answer
n = int(input())
a = [0]*n
for i in range(n):
    a[i] = int(input())
b = sorted(a,reverse=True)
if b[0] == b[1] and b[0] == max(a):
    for i in range(n):
        print(max(a))
else:
    for i in range(n):
        if a[i] == max(a):
            print(max(a)-1)
        else:
            print(max(a))
# Judge status: Wrong Answer
i = list(map(int, input().split()))
while i[0] <= 0 or i[2] <= 0:
    i[2] -= i[1]
    if i[2] <= 0:
        break
    i[0] -= i[3]
    if i[0] <= 0:
        break
if i[0] <= 0:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

cnt4 = 0
cnt2 = 0
for a in A:
    if a % 4 == 0:
        cnt4 += 1
    elif a % 2 == 0:
        cnt2 += 1

ans = "No"

if N - cnt4*2 <= 1:
    ans =  "Yes"
elif N - cnt4*2 > 1:
    if N - cnt4*2 <= cnt2:
        ans = "Yes"
elif N - cnt4*2 == N:
    if N == cnt2*2:
        ans = "Yes"

print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
N,M = [int(i) for i in input().split()]
nes = [0] * (N+1)
for i in range(1,N+1) :
    nes[i] = []
for i in range(M) :
    a,b = [int(i) for i in input().split()]
    nes[a].append(b)
    nes[b].append(a)
ans = "IMPOSSIBLE"
for i in nes[1] :
    for j in nes[i] :
        if j == N :
            ans = "POSSIBLE"
            break
print(ans)
# Judge status: Wrong Answer
n=int(input())
AB=[]
A=[]
B=[]
for _ in range(n):
    a,b = map(int,input().split())
    AB.append((a,b))
    A.append(a)
    B.append(b)
#AB = sorted(AB,key=lambda x: x[1])
med = n//2
if n%2 != 0:
    print(B[n//2]-A[n//2]+1)
else:
    p = (A[n//2] + A[n//2-1])/2
    q = (B[n//2] + B[n//2-1])/2
    print(int((q-p)*2+1))
# Judge status: Accepted
#a,b
a,b=(int(x) for x in input().split())
i = 1

if  a == b:
    while (i<=a):
        print(a, end="")
        i += 1
elif a>b:
    while (i<=a):
        print(b, end="")
        i += 1
elif a<b:
    while (i<=b):
        print(a, end="")
        i += 1

print()
# Judge status: Wrong Answer
x = int(input())
x11 = x/11
num = [1,2,3,4,5,6]
num2= [7,8,9,10]

if x in num:
  print(1)
elif x in num2:
  print(2)

elif int(x11) == x11:
  print(int(x11)*2)
elif x+5 >int(x11)*2 + 6 >= x:
  print(1+int(x11)*2)
else:
  print(2+int(x11)*2)
# Judge status: Accepted
a,b,c = map(int, input().split())
print("Yes" if a + b == c or a + c == b or b + c == a else "No")
# Judge status: Wrong Answer
#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N, *A = map(int, read().split())

A = sorted(A)
A = A[N:-N]

print(sum(A))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))

joutai = "nasi"
m = 1000
k = 0

for i in range(n-1):
    if joutai == "nasi":
        if a[i] < a[i+1]:
            k = m // a[i]
            m -= k * a[i]
            joutai = "ari"
    else:
        if a[i] > a[i+1]:
            m += k * a[i]
            k = 0
            joutai = "nasi"

m += k * a[n-1]

print(m)
# Judge status: Wrong Answer
# abc120_b.py
A, B, K = map(int,input().split())
cnt = 0
for i in range(1,10000):
    if A%i==0 or B%i==0:
        cnt += 1
        if cnt == K:
            print(i)
            exit()
# Judge status: Accepted
N, M = list(map(int,input().strip().split(" ")))

if N == M:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n,m=map(int,input().split())
if  n<=2 and m<=2:
    if n==m==1:
        print(1)
    else:
        print(0)
elif n==1 or m==1:
    print(max(n,m)-2)
elif n==2 or m==2:
    print(0)
else:
    print((n-2)*(m-2))
# Judge status: Wrong Answer
import sys
s = input()
target = "keyence"

for i in range(len(target)):
    sbst1 = target[0:i]
    sbst2 = target[i:]
    ind = s.find(sbst1)
    indx = s.find(sbst2)

    if ind != -1 and ind < indx:
        print("YES")
        sys.exit()

print("NO")