peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
s=input();ans='NO'
if s == 'keyence':
    ans = 'YES'
l = len(s)
if len(s) >= 8:
    i = 0
    while i < 8:
        s0 = s[:i]+s[i+(len(s)-7):]
        if s0 == 'keyence':
            ans = 'YES'
            break
        i += 1
print(ans)
# Judge status: Accepted
S = input()

direct = set()
for s in S:
    direct.add(s)

if len(direct) == 4:
    print("Yes")
elif (len(direct) == 2) and ('N' in direct) and ('S' in direct):
    print("Yes")
elif (len(direct) == 2) and ('E' in direct) and ('W' in direct):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    ABC = list(map(int, input().split()))
    print(len(set(ABC)))


if __name__ == '__main__':
    resolve()
# Judge status: Wrong Answer
N, K = map(int, input().split())
A_ = list(map(int, input().split()))

count = [0] * N

for _ in range(0, K):
  count = [0] * N
  for i in range(0, N):
    a_min = int(i - A_[i] - 0.5 + 1)
    a_max = int(i + A_[i] + 0.5)
    
    if(a_min < 0):
      a_min = 0
    
    if(a_max > N - 1):
      a_max = N -1 
      
    for j in range(a_min, a_max + 1):
      count[j] += 1

  A_ = count
  
print(A_)
# Judge status: Accepted
N = int(input())
d = list(map(int,input().split()))
k = 0
d.sort()
if len(d) % 2 == 1:
    k = 0
elif d[int(len(d) / 2)] == d[int((len(d) / 2) - 1)]:
    k = 0
else:
    k = d[int(len(d) / 2)] - d[int((len(d) / 2) - 1)]

print(k)
# Judge status: Accepted
MOD = 10 ** 9 + 7
INF = 10 ** 10
import sys
sys.setrecursionlimit(100000000)
dy = (-1,0,1,0)
dx = (0,1,0,-1)

def main():
    n,T = map(int,input().split())
    ans = INF
    for _ in range(n):
        c,t = map(int,input().split())
        if t <= T:
            ans = min(ans,c)
    
    if ans == INF:
        print('TLE')
    else:
        print(ans)
if __name__ =='__main__':
    main()
# Judge status: Wrong Answer
A,B,C,X,Y = map(int, input().split())
ans = 0
if A >= C:
    ans += 2*C*X
    Y -= X
    if Y > 0:
        if B >= C:
            ans += 2*C*Y
        else:
            ans += B*Y
else:
    if B >= C:
        ans += 2*C*Y
        X -= Y
    else:
        ans += B*Y
    if X > 0:
        ans += A*X
print(ans)
# Judge status: Wrong Answer
def solve():
    x = int(input())
    n = x // 11
    if x == n * 11:
        return 2 * n
    elif n * 11 < x <= n * 11 + 5:
        return 2 * n + 1
    elif n * 11 + 5 < x <= n * 11 + 11:
        return 2 * n + 2

print(solve())
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline

n,m = map(int, input().split())
li = [list(map(int, input().split())) for _ in range(n)]

s = 0
for i in sorted(li):
    if i[1] <= m:
        m -= i[1]
        s += i[0] * i[1]
    else:
        s += i[0] * m
        break
print(s)
# Judge status: Wrong Answer
def ok(hs):
    m = 0
    for h in hs:
        if h > m + 1:
            return False
        m = max(m, h)
    return True

n = int(input())
print('Yes' if ok(map(int, input().split())) else 'No')
# Judge status: Accepted
import numpy as np
n, k = map(int, input().split())
dice = np.arange(1, n+1)

m = np.ceil(np.log2(k) - np.log2(dice))
for i in range(n):
    if m[i] <= 0:
        m[i:] = 0
        break
p = (0.5**m)
print(sum(p)/n)
# Judge status: Accepted
import math
import sys

n = int(input())
l = [0] * n
if n < 6:
    for i in range(n):
        print(0)
    sys.exit()
y = int(math.sqrt(n-3))
if n <= 5:
    for i in range(n):
        print(0)
for i in range(1,y):
    for j in range(1, y):
        for k in range(1, y):
            x = i ** 2 + j ** 2 + k ** 2 + i*j + i*k + j*k
            if x % 1 == 0 and x <= n:
                l[x-1] += 1
for i in l:
    print(i)
# Judge status: Accepted
def mtx2vec(mtx):
    tmp = ''
    for s in mtx:
        tmp += s
    return tmp
N, M = map(int, input().split())
A = []
B = []
for _ in range(N):
    A.append(input())
for _ in range(M):
    B.append(input())

b = ''
for s in B:
    b += s
ans = 'No'
for i in range(N-M+1):
    for j in range(N-M+1):
        tmp = ''
        for k in range(M):
            tmp += A[i+k][j:j+M]
        if tmp == b:
            ans =  'Yes'
            break
print(ans)
# Judge status: Accepted
n = int(input())
 
lines = []
for i in range(n):
  x,l = map(int,input().split())
  lines.append([x-l,x+l])
lines = sorted(lines,key=lambda x:x[1])
count = 0
kari = -9999999999999
for i in range(n):
  if lines[i][0] >= kari:
    count += 1
    kari = lines[i][1]
print(count)
# Judge status: Accepted
n = int(input())
li_a = list(map(int,input().split()))
li_a.sort(reverse=True)

ans = li_a[0]
if n % 2 == 0:
    for i in range(1,n//2):
        ans += 2*li_a[i]
else:
    for i in range(1,n//2):
        ans += 2*li_a[i]
    ans += li_a[n//2]

print(ans)
# Judge status: Accepted
import bisect

N=int(input())
L=list(map(int,input().split()))

L=sorted(L)

ans=0
for i in range(N-1):
    for k in range(i+1,N-1):
        a=L[i]+L[k]
        b=bisect.bisect_left(L,a)
        ans=ans+(b-k-1)

print(ans)
# Judge status: Wrong Answer
l,r=map(int,input().split())
lmod673=l%673
rmod673=r%673
lmod2019=l%2019
rmod2019=r%2019

if lmod2019==0 or lmod2019>rmod2019:
    print(0)
elif rmod2019-lmod2019>=673:
    print(0)
elif lmod673>rmod673 or lmod673==0:
    if r-l>=2:
        print(0)
    elif (lmod2019*rmod2019)%3==0:
        print(0)
    else:
        print(lmod2019*(lmod2019+1))
else:
    print(lmod2019*(lmod2019+1))
# Judge status: Accepted
h1, m1, h2, m2, k = map(int, input().split())

t = (m2 - m1) + (h2 - h1) * 60
ans = t - k

print(ans)
# Judge status: Accepted
n , k = map(int,input().split())
s = input()
cou = 0
for i in range(1,n):
    if s[i-1] != s[i]:
        cou += 1
print(n-1-max(0,cou-2*k))
# Judge status: Wrong Answer
a,b=map(int,input().split())
k=[]
o=[]
p=[]
for i in range(1,101):
    if int(i*0.08)==a:
        k.append(i)
for j in range(1,101):
    if int(j*0.1)==b:
        o.append(j)
for t in range(len(k)):
    for u in range(len(o)):
        if k[t]==o[u]:
            p.append(k[t])
if p==[]:
    print(-1)
else:
    print(min(p))
# Judge status: Accepted
n = int(input())
s = input()

w = s.count('.')
b = n - w
ans = min(w, b)
r = 0
l = w
for si in s:
    if si == '#':
        r += 1
    else:
        l -= 1
    if ans > r + l:
        ans = r + l
print(ans)
# Judge status: Accepted
import fractions

def div(n):
  l =[]
  for i in range(1,n+1):
    if n%i ==0:
      l.append(i)
  return l

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      if i not in table:
        table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

A,B = list(map(int,input().split()))
maxy = fractions.gcd(A,B)

l2 = prime_decomposition(maxy)
print(len(l2) + 1)
# Judge status: Accepted
X, K, D = map(int, input().split())

num = abs(X)//D
if num >= K:
    X = abs(X) - K*D

else:
    if num%2 == K%2:
        X = abs(X) - D*num
    else:
        X = abs(X) - D*(num+1)
        
print(abs(X))
# Judge status: Wrong Answer
n,l=map(int,input().split())
s=[input() for _ in range(n)]
t=[]
t.append(s[0])
for i in range(1,n):
  t.append(s[i])
  for j in reversed(range(len(t)-1)):
    for k in range(l):
      if not t[j][:k+1]==t[j+1][:k+1]:
        if ord(t[j][k])>ord(t[j+1][k]):
          t[j],t[j+1]=t[j+1],t[j]
        else:
          break
print("".join(t))
# Judge status: Accepted

MOD = 1000000007

def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)

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

n = int(input())
a = list(map(int,input().split()))
all_lcm = 1
for i in range(n):
    all_lcm = lcm(all_lcm, a[i])
ans = 0
for i in range(n):
    ans += all_lcm//a[i]
print(ans%MOD)
# Judge status: Accepted
from collections import defaultdict as dfd

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

d = dfd(int)
ans = 0

for i, a_i in enumerate(a, 1):
    ans += d[i - a_i]
    d[i + a_i] += 1


print(ans)
# Judge status: Wrong Answer
A,B,C = map(int,input().split())
if A%2==0 or B%2==0 or C%2==0:
    print(0)
else:
    cmin = B*C
    cmin = min(cmin,A*C)
    Cmin = min(cmin,B*A)
    print(cmin)
# Judge status: Accepted
import collections

N = int(input())

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


s = 0
for k,v in c.items():
    if v - k >= 0:
        s += v - k
    else:
        s += v
    
print(s)
# Judge status: Accepted
n = int(input())

ans = 0
for i in range(1, n+1):
    if 0 == i % 3 or 0 == i % 5:
        pass
    else:
        ans += i
print(ans)
# Judge status: Accepted
a=int(input())
b=int(input())
a%=500
if a<=b:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
alst = list(map(int, input().split()))
blst = list(map(int, input().split()))
ans = 0
car = 0
for i in range(n):
  plus = min(blst[i] + car, alst[i])
  ans += plus
  if plus == alst[i]:
    car = blst[i] + car - alst[i]
    car = min(car, blst[i])
  else:
    car = 0
ans += min(car, alst[-1])
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
n = int(input())
a = [int(input()) for _ in range(n)]
a.sort()
cnt = 1
ans = 0
for i in range(n-1):
    if a[i] == a[i+1]:
        cnt += 1
    else:
        if cnt %2: ans+= 1
        cnt = 1
print(ans+cnt%2)
# Judge status: Accepted
n = int(input())
height = list(map(int,input().split()))
cost = []

for i in range(n):
  if i == 0:
    cost.append(0)
  elif i == 1:
    cost.append(abs(height[i]-height[0]))
  else:
    a = cost[-1] + abs(height[i]-height[i-1])
    b = cost[-2] + abs(height[i]-height[i-2])
    cost.append(min([a,b]))
print(cost[-1])
# Judge status: Accepted
a,p = map(int,input().split())
if a >= 13 :
  print(p)
elif a >= 6 :
  print(p//2)
else :
  print(0)
# Judge status: Accepted
n, m = map(int, input().split())
AC = [0] * n
WA = [0] * n
w = 0

for i in range(m):
    p, s = input().split()
    p = int(p) - 1
    if s == 'AC' and AC[p] == 0:
        AC[p] += 1
        w += WA[p]
    elif s == 'WA' and AC[p] == 0:
        WA[p] += 1

print(sum(AC), w)
# Judge status: Accepted
N=int(input())

l=["a"]

a=ord("a")

for i in range(N-1):
    la=[]
    for j in l:
        b=ord(max(j))
        for k in range(a,b+2):
            la.append(j+chr(k))
    l=la

for i in l:
    print(i)
# Judge status: Accepted
A, B = map(int, input().split())
print("Possible" if A%3==0 or B%3==0 or (A+B)%3==0 else "Impossible")
# Judge status: Wrong Answer
S, W = input().split()
 
if int(S)<=int(W)*2:
  print("unsafe")
else:
  print("safe")
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

ans = 0

for i in range(0, N - 1):
    ans += max(0, A[i+1] - A[i])

print(ans)
# Judge status: Accepted
def main():
    import sys
    sys.setrecursionlimit(10 ** 6)
    input = sys.stdin.readline
    N = input().strip()
    if '7' in N:
        print('Yes')
    else:
        print('No')
    

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
n,l = map(int, input().split())
L = [0]*n
#l+i-1
for i in range(n):
  L[i] += l+i

if(l < 0 and n + l < 0):
  print(sum(L) - L[n-1])
elif(l <= 0 and n + l >= 0):
  print(sum(L))
else:
  print(sum(L) - L[0])
# Judge status: Wrong Answer
n = input()
d = len(n)

s = 0
for i in range(1, d):
    s += 9 * 10 ** (i - 1) if i % 2 else 0
s += int(n) - 10 ** (d - 1) if d % 2 else int(0)

print(s)
# Judge status: Wrong Answer
n = int(input())
a = sorted(list(map(int, input().split())))
b = set(a)
count = 0
z = 0
for i in b:
    if i <= 10**5:    
        j = a.count(i)
        if j < i:
            count += j
            z += j
        else:
            k = j - i
            count += k
            z += j
    else:
        f = len(a) - z
        count += f
        break

print(count)
# Judge status: Accepted
import collections

N, K, Q = map(int, input().split())
A = [int(input()) - 1 for i in range(Q)]
A_count = collections.Counter(A)
A_sum = sum(A_count.values())
for i in range(N):
    if K - (A_sum - A_count[i]) <= 0:
        print('No')
    else:
        print('Yes')
# Judge status: Accepted
n,k = map(int, input().split())
a = list(map(int, input().split()))
if (n==k):
    print(1)
else:
    print(1+(n-k-1)//(k-1)+1)
# Judge status: Wrong Answer
mod = 10**9+7
n = int(input())

ans = int((n*(n-1)* 10**(n-2))) %  mod
print(ans)
# Judge status: Accepted
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

A, B, C, D = map(int, read().split())
taka = (A + D-1) // D
ao = (C+B-1) // B

if taka >= ao:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
lst = [int(s) for s in input().split()]
print(str(lst.index(0)))
# Judge status: Accepted
n=int(input())
r=n**(1/2)
w=0
for i in range(1,int(r)+1):
  if n%i==0:
    w=i
x,y=w,n//w
if x!=1 and y!=1:
  print(x+y-2)
else:
  print(max(x,y)-1)
# Judge status: Wrong Answer
input_num = int(input())
input_list = list(map(int, input().split()))

sum = 0

for i in range(input_num):
    for j in range(input_num - i - 1):
        print(input_list[i], input_list[input_num -1-j])
        sum += input_list[i] * input_list[input_num -1 - j]

print(sum % 1000000007)
# Judge status: Wrong Answer
n = int(input())
min_k = 10000000000
for i in range(1,n//2):
    sum_k = 0
    a = str(i)
    b = str(n-i)
    for j in a:
        sum_k += int(j)
    for j in b:
        sum_k += int(j)
    min_k = min(min_k,sum_k)
print(min_k)
# Judge status: Accepted
import heapq

n,m = map(int,input().split())
a = list(map(int,input().split()))
a = list(map(lambda x: -x, a))
heapq.heapify(a)

#print(a)

for i in range(m):
    x = heapq.heappop(a)
    x = (-x)//2
    heapq.heappush(a,-x)
print(-sum(a))
# Judge status: Accepted
S = input()

if S == "Sunny":
    print("Cloudy")
elif S =="Cloudy":
    print("Rainy")
else:
    print("Sunny")
# Judge status: Wrong Answer
N, M=map(int, input().split())

a=0
b=N-1
for i in range(M):
  L,R=map(int, input().split())
  a=max(a,L)
  b=min(b,R)
print(b-a+1)
# Judge status: Accepted
N,K = map(int,input().split())
S = list(input())


for i in range(N):
    if(i+1 == K):
        S[i] = chr(ord(S[i]) + 32)
print(''.join(S))
# Judge status: Wrong Answer
n = int(input())

price = {1}
for i in range(1, 100):
    tmp = 6**i
    if tmp > 10**5:
        break
    price.add(tmp)

for i in range(1, 100):
    tmp = 9**i
    if tmp > 10**5:
        break
    price.add(tmp)

price = list(price)
price.sort(reverse=True)

INF = 1 << 60

dp = [INF] * 2 * 10**5
dp[1] = 1

for i in range(1, n + 1):
    for p in price:
        dp[i + p] = min(dp[i] + 1, dp[i + p])

print(dp[n])
# Judge status: Accepted
n, m = map(int, input(). split())
x = list(map(int, input(). split()))
x.sort()
l = [x[i+1]-x[i] for i in range(m-1)]
l.sort()
L = l[:-(n-1)]
if n == 1:
  print(sum(l))
else:
  print(sum(L))
# Judge status: Wrong Answer
N = list(input())

sum_N = 0
for i in range(len(N)):
    sum_N += int(N[i])

if sum_N%9 == 0:
    print('yes')
else:
    print('no')
# Judge status: Wrong Answer
import math
X = int(input())
price = 100
count = 0
while price<=X:
  price = int(price*1.01)
  count += 1
print(count)
# Judge status: Accepted
A, B = map(int, input().split())
if A % 3 == 0 or B % 3 == 0 or (A+B) % 3 == 0:
  print("Possible")
else:
  print("Impossible")
# Judge status: Accepted
n,k,s=map(int,input().split())
for i in range(k):
  print(s,end=" ")
for i in range(k,n):
  if s==10**9:
    print(s-1,end=" ")
  else:
    print(s+1,end=" ")
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
x = int(input())

c_nums = set(50 * i for i in range(c + 1))
res = 0
for i in range(a + 1):
    for j in range(b + 1):
        tmp = x - 500 * i - 100 * j
        if tmp in c_nums:
            res += 1

print(res)
# Judge status: Accepted
# -*- coding: utf-8 -*-
X, Y, A, B, C = map(int, input().split())
p_list = list(map(int, input().split()))
p_list.sort(reverse=True)

q_list = list(map(int, input().split()))
q_list.sort(reverse=True)

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

red_list = p_list[:X]
green_list = q_list[:Y]
min_num = min(red_list[-1], green_list[-1])
white_list = [i for i in r_list if i > min_num]

ans_list = red_list + green_list + white_list
ans_list.sort(reverse=True)
ans_list = ans_list[:X + Y]
print(sum(ans_list))
# Judge status: Accepted
N = int(input())
H = [int(i) for i in input().split()]

dp = [float("inf")] * N
dp[0], dp[1] = 0, abs(H[1]-H[0])
for i in range(2, N):
    dp[i] = min(dp[i], dp[i-1]+abs(H[i]-H[i-1]), dp[i-2]+abs(H[i]-H[i-2]))
    
print(dp[N-1])
# Judge status: Wrong Answer
import numpy as np

N, D = [int(i) for i in input().split()]
X = np.zeros((N,D))
for i in range(N):
    X[i] = [int(i) for i in input().split()]
    
count_dummy=0
for i in range(N):
    for j in range(i+1,N):
        dist = (np.sum((X[i] - X[j])**2))**0.5
        if dist.is_integer():
            count_dummy+=1
            
count_dummy
# Judge status: Accepted
s1 = input()
s2 = input()

if s1[0] == s2[2] and s1[1] == s2[1] and s1[2] == s2[0]:
  print('YES')
else:
  print('NO')
# Judge status: Accepted
n, m = map(int,input().split())
nums = [[int(i),1] for i in input().split()]

for i in range(m):
    b,c = map(int,input().split())
    nums.append([c,b])

nums.sort(reverse=True)

sum = 0
for i in nums:
    if i[1] > n:
        sum += i[0]*n
        break
    else:
        sum += i[0]*i[1]
        n -= i[1]

print(sum)
# Judge status: Accepted
n=int(input())
s=input()
count=0
for i in range(n):
  str_1=s[0:i-1]
  str_2=s[i-1:n]
  if count<len(set(str_1)&set(str_2)):
    count=len(set(str_1)&set(str_2))
print(count)
# Judge status: Wrong Answer
N = int(input())
H = list(map(int,input().split()))

ans = 0
tmp = 0
for n in range(N-1):
  l = H[n]
  r = H[n+1]
  if l >= r:
    tmp += 1
  else:
    tmp = 0
    ans = max(ans,tmp)
ans = max(ans,tmp)
print(ans)
# Judge status: Wrong Answer
N = int(input())
if N % 9 == 0:
  print('yes')
else:
  print('no')
# Judge status: Accepted

def main():
    N, M = map(int, input().split())
    if N >= 2 and M >= 2:
        ans = (N-2)*(M-2)
    else:
        if N == M:
            ans = 1
        else:
            ans = max(N, M) - 2
    print(ans)

main()
# Judge status: Wrong Answer
li = input().split()
print('AtCoder,li[2][0],Contest')
# Judge status: Wrong Answer
# スペース区切りの整数の入力
N, *d = map(int, open(0).read().split())

if N > 0:
	A = 1
	for O in d:
		A = A * O
		print(O)
		if A > 10 ** 18:
			A = -1
			break
else:
	A = 0

print(A)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
X = [0 for i in range(10**5+10)]
for i in A:
    X[i-1] += 1
    X[i] += 1
    X[i+1] += 1
ans = max(X)
print(ans)
# Judge status: Accepted
a,b,c=map(int,input().split())
ans=3
if a==b:
    ans-=1
    if b==c:
        ans-=1
elif a==c:
    ans-=1
    if b==a:
        ans-=1
elif c==b:
    ans-=1
    if a==c:
        ans-=1
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
B = [None for _ in range(N)]
sB = [None for _ in range(N)]
for i in range(N):
  for j in range(1,N+1):
    if A[i] == j:
      B[i] = j
    sB[i] = str(B[i])
ans = ' '.join(str(a) for a in sB)
print(ans)
# Judge status: Accepted
#n=int(input())
n,m=map(int,input().split())
xl=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
cuml=[]
if n>=m:
    print(0)
else:
    xl.sort()
    rng=xl[m-1]-xl[0]
    ans=rng
    for i in range(1,m):
        cuml.append(xl[i]-xl[i-1])
    cuml.sort()
    for i in range(n-1):
        ans-=cuml[m-2-i]
    print(ans)
# Judge status: Accepted
D,T,S=map(int,input().split())

if T >= D/S:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
s=input()
fdl=s.find("A")
fdr=s.rfind("Z")

print((fdr-fdl)+1)
# Judge status: Accepted
N = int(input())
A = [int(input()) for i in range(N)]
dicta = {}
for i in A:
    if i not in dicta:
        dicta[i] = 1
    else:
        dicta[i] += 1
ans = 0
for v in dicta.values():
    if v%2 == 1:
        ans += 1
print(ans)
# Judge status: Wrong Answer
n=int(input())
a=list(input().split())
if n > 3:
    ans=''
    ans += ' '.join(a[::-2])
    ans += ' ' + ' '.join(a[::2])
    print(ans)
else:
    ans=[]
    for i in range(n):
        ans.append(a[i])
        ans.reverse()
    print(' '.join(ans))
# Judge status: Wrong Answer
n = int(input())
s = [input() for _ in range(n)]
ac, wa, tle, re = 0, 0, 0, 0

for i in range(n):
    if "AC" in s[i]:
        ac += 1
    elif "WA" in s[i]:
        wa += 1
    elif "TLE" in s[i]:
        tle += 1
    elif "RE" in s[i]:
        re += 1
print("AC × ",ac)
print("WA × ",wa)
print("TLE × ",tle)
print("RE × ",re)
# Judge status: Wrong Answer
n, m = map(int, input().split())
cnt = 0
l_max= 0
r_min = float('inf')
for i in range(m):
    l, r = map(int, input().split())
    l_max = max(l_max, l)
    r_min = min(r_min, r)
print(r_min - l_max + 1)
# Judge status: Accepted
import sys
N=int(input())

for i in range(1,10):
  for j in range(1,10):
    if N == i*j:
      print('Yes')
      sys.exit()

print('No')
# Judge status: Accepted
# A - Christmas Eve Eve Eve / 

D = int(input())

if D == 25:
    print('Christmas')
elif D == 24:
    print('Christmas Eve')
elif D == 23:
    print('Christmas Eve Eve')
elif D == 22:
    print('Christmas Eve Eve Eve')
else:
    print('')
# Judge status: Accepted
s = list(input())
if s[0] == 'A':
    if 'C'in s[2:len(s) - 1]:
        s.remove('A')
        s.remove('C')
        s = ''.join(s)
        if s.islower() == True:
            print('AC')
        else:
            print('WA')
    else:
        print('WA')
else:
    print('WA')
# Judge status: Wrong Answer
    
S = input()
    
s = sorted(S)
    
if [s[0]==s[1] and s[2]==s[3]] and [s[1] != s[2]]:
    print("Yes")
   
else:
    print("No")
# Judge status: Accepted
import math
h,w = map(int,input().split())

#
if h==1 or w==1:
    print(1)
else:
    print((h*w+1)//2)
# Judge status: Accepted
n=input()
z=[0]*(n+1)
z[0]=1
for i in xrange(1,n+1):
  for j in xrange(i-3+1):
    z[i]=(z[i]+z[j])%(pow(10,9)+7)
print z[-1]
# Judge status: Accepted
A = int(input())
B = int(input())
X = [1, 2, 3]
X.remove(A)
X.remove(B)
print(X[0])
# Judge status: Wrong Answer
N = int(input())
counter = 0
ans = 0
for i in range(1,N+1):
    for j in range(1, N+1):
        if i % j == 0:
            counter += 1
    
    if counter == 8:
        ans += 1

    counter = 0


print(ans)
# Judge status: Accepted
def main():
    n = int(input())
    a = list(map(int, input().split()))

    a.sort()
    tf = [0] * (a[-1] + 1)
    for ea in a:
        tf[ea] = 1
    for i1 in range(n - 1):
        if a[i1] == a[i1 + 1]:
            tf[a[i1]] = 0

        for i2 in range(2, a[-1]//a[i1] + 1):
            tf[a[i1] * i2] = 0
    r = sum(tf)
    print(r)


if __name__ == '__main__':
    main()
# Judge status: Accepted
x,y = map(int,input().split())
ans = 1
while x <= y:
         x = x*2
         ans += 1
print(ans-1)
# Judge status: Accepted
n = int(input())
abc = []
for i in range(n):
    abc.append(list(map(int,input().split())))
dp = [[0]*3 for i in range(n)]
dp[0][0] = abc[0][0]
dp[0][1] = abc[0][1]
dp[0][2] = abc[0][2]
for i in range(1,n):
    for j in range(3):
        for k in [1,2]:#j以外を選ぶ
            dp[i][j] = max(dp[i][j],\
            dp[i-1][(j+k)%3] +abc[i][j])
print(max(dp[-1]))
# Judge status: Accepted
A,B,C,K = map(int,input().split())
ans = 0

if A >= K:
    ans = 1*K
else:
    ans += 1*A
    K = K - A
    if B >= K:
        ans += 0*K
    else:
        ans += 0*B
        K = K - B
        ans += (-1)*K
        
print(ans)
# Judge status: Accepted
import numpy as np

def main():
    n = int(input())
    a = list(map(int, input().split()))
    A = np.array(a)
    B = np.where(A < 0, A * -1, A)
    cnt = np.count_nonzero(A < 0)
    #print(B)
    s = B.sum()
    if cnt % 2 == 0:
        print(s)
    else:
        m = np.amin(B)
        print(s - m * 2)
        

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

N, x = map(int, input().split())
A = [int(i) for i in input().split()]

A.sort()
ans = []
for i in A:
	x -= i
	#print(ans, x)
	if x >= 0:
		ans.append(i)
	else:
		break
	
if x > 0:
	print(len(ans)-1)
else:
	print(len(ans))