peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n=int(input())
b=list(map(int,input().split()))

result = b[0] + b[n-2]
for i in range(n-2):
  result += min(b[i],b[i+1])
print(result)
# Judge status: Wrong Answer
l = [[0.25],[0.5],[1],[2]]
tmp = list(map(int,input().split()))
for i in range(4):
    l[i].append(tmp[i])

for i in range(4):
    l[i].append(l[i][1]*4//(l[i][0]*4))
print(l)

from operator import itemgetter
l = sorted(l, key=itemgetter(2))

ans = 0
n = int(input())
for i in range(4):
    tmp = n//l[i][0]
    if tmp > 0:
        ans += tmp * l[i][1]
        n -= tmp*l[i][0]

print(int(ans))
# Judge status: Accepted
K,N=map(int,input().split())
n=list(map(int,input().split()))
if n[N-1]-n[0] < (K-n[1])+n[0]:
  dist=n[N-1]-n[0]
else:
  dist=(K-n[1])+n[0]
for i in range(1,N-1):
  if dist > (K-n[i-1])+n[i]:
    dist= (K-n[i-1])+n[i]
  if dist > (K-n[i+1])+(n[i]-0):
    dist= (K-n[i+1])+(n[i]-0)
print(dist)
# Judge status: Accepted
N, K = map(int, input().split())
print((N-2)//(K-1)+1)
# Judge status: Accepted
n = int(input())
x = list(map(int, input().split()))
x.sort()
ans = 10**9+7
for i in range(x[0], x[n-1]+1):
    res = []
    for j in range(n):
        res.append((i-x[j])**2)
    ans = min(sum(res), ans)
print(ans)
# Judge status: Accepted
import sys
import os


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M = list(map(int, sys.stdin.readline().split()))
    FOODS = set(range(1, M + 1))

    for n in range(N):
        K, *A = list(map(int, sys.stdin.readline().split()))
        FOODS &= set(A)

    print(len(FOODS))


if __name__ == '__main__':
    main()
# Judge status: Accepted
MOD = 10**9 + 7


def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    from collections import Counter
    c = Counter()
    for a in A:
        s = "{:0>63b}".format(a)[::-1]
        for i, s in enumerate(s):
            c[i] += int(s)
    ans = sum(A) * (N-1)
    for k, v in c.items():
        if v > 1:
            ans -= 2*(2**k)*(v*(v-1)//2)
    print(ans % MOD)


if __name__ == '__main__':
    main()
# Judge status: Accepted
a = int(input())
b = int(input())
h = int(input())
print((a+b)*h//2)
# Judge status: Accepted
n,k=map(int,input().split())
p=[int(i) for i in input().split()]
ans=chk=0
w=[0]*(n+1)
for i in range(n):
    w[i+1]=w[i]+p[i]
for i in range(k,n+1):
    chk=max(chk,w[i]-w[i-k])
print((chk+k)/2)
# Judge status: Wrong Answer
N = int(input())
AB = [0] * N
for n in range(N):
  AB[-1-n] = [int(x) for x in input().strip().split()]
ans = 0
cnt = 0
for (a, b) in AB:
  if b == 1:
    if a + cnt == 0:
      cnt += 1
      ans += 1
  else:
    t = b - ((a + cnt) % b)
    cnt += t
    ans += t
print(ans)
# Judge status: Wrong Answer
N = int(input())
t = 0
if N % 4 == 0 or N % 7 == 0:
  ans = "Yes"
elif N == 0:
  ans = "No"
else:
  t = 0
  for i in range(1,N//7):
    x = (N-7*i)/4
    if x == int(x):
      t += 1
    else:
      continue
  if t > 0:
    ans = "Yes"
  else:
    ans = "No"
print(ans)
# Judge status: Accepted
import numpy as np
N,D=map(int,input().split())
X=[np.array(input().split(),dtype=np.int64) for _ in range(N)]
ans=0
for i in range(N):
    for j in range(i+1,N):
        d=((X[i]-X[j])*(X[i]-X[j])).sum()
        dd=int(round(d**.5))
        if d==dd*dd:
            ans +=1
print(ans)
# Judge status: Accepted
nums = list(map(int, input().split()))
fives = nums.count(5)
sevens = nums.count(7)
print("YES") if (fives == 2 and sevens == 1) else print("NO")
# Judge status: Accepted
X,A,B =map(int,input().split())
if A-B>=0:
    print('delicious')
elif A-B<0 and B-A <= X:
    print('safe')
else:
    print('dangerous')
# Judge status: Accepted
N=int(input())
A=[0]*N
B=[0]*N
for i in range(N):
  A[i],B[i] = map(int,input().split())
  
cnt=0
for i in range(N-1,-1,-1):
  A[i] += cnt
  s=A[i]%B[i]
  if s!=0:
    cnt +=B[i]-s
  #print(i,A,cnt)

print(cnt)
# Judge status: Wrong Answer
from collections import defaultdict
def readInt():
	return int(input())
def readInts():
	return list(map(int, input().split()))
def readChar():
	return input()
def readChars():
	return input().split()

from math import log2

x,y = readInts()
print(int(log2(y)-log2(x)+1))
# Judge status: Wrong Answer
N, K = map(int, input().split())
A = list(map(int, input().split()))

for _ in range(min(K, 50)):
    lamp = [0 for i in range(N + 1)]
    for i in range(N):
        lamp[max(0, i - A[i])] += 1
        lamp[min(N, i + A[i] + 1)] -= 1

    print(lamp)
    for i in range(1, N + 1):
        lamp[i] += lamp[i - 1]
    A = lamp

[print(A[i], end=' ') for i in range(N)]
print()
# Judge status: Wrong Answer
n,k=map(int,input().split())
a,b=map(int,input().split())
d=[0]*(10**5+1)
for i in range(n-1):
  a,b=map(int,input().split())
  d[a]+=b
for i in range(10**5+1):
  if d[i]>=k:
    print(i)
    break
  else:k-=d[i]
# Judge status: Wrong Answer
n = int(input())
l = list(map(int, input().split()))
dic = {}
count = 0

for i in range(n):
  dic.setdefault(l[i],0)
  dic[l[i]] += 1
print(dic)
for x,y in dic.items():
  if x <= y:
    count += y - x
  else:
    count += y
print(count)
# Judge status: Accepted
def solve(XL, N):
    XL.sort(key=lambda x:x[1])
    count = N
    for i in range(1, N):
        if XL[i][0] < XL[i-1][1]:
            XL[i][1] = XL[i-1][1]
            count -= 1
    return count
N = int(input())
XL = []
for i in range(N):
    x, l = map(int, input().split(' '))
    XL.append([x-l, x+l])
print(solve(XL, N))
# Judge status: Accepted
A,B,C = map(int,input().split())
if A == B or A == C or B == C:
  if A == B and B ==C:
    print("No")
  else:
    print("Yes")
else:
  print("No")
# Judge status: Accepted
N = int(input())
A = [int(input()) for _ in range(N)]

mls = [-1 for _ in range(N+1)]
for i, a in enumerate(A, 1):
    mls[i] = max(mls[i-1], a)

mrs = [-1 for _ in range(N+1)]
for i, a in enumerate(A[::-1], 1):
    mrs[i] = max(mrs[i-1], a)
mrs = mrs[::-1]

for i in range(N):
    print(max(mls[i], mrs[i+1]))
# Judge status: Accepted
a, b, c, x, y = map(int, input().split())

p2 = 0
for i in range(max(x, y)):
    ai = a * (x - i) if i < x else 0
    bi = b * (y - i) if i < y else 0
    abi = 2 * i * c
    p1 = ai + bi + abi

    ai1 = a * (x - i - 1) if i < x else 0
    bi1 = b * (y - i - 1) if i < y else 0
    abi1 = 2 * (i + 1) * c
    p2 = ai1 + bi1 + abi1
    if p1 < p2:
        print(p1)
        exit()

print(p2)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))

cnt = 0
for i in range(N):

    if a[i] % 2 == 1 and (i+1)%2 == 1:
        cnt += 1

print(cnt)
# Judge status: Accepted
n,k = map(int, input().split())
s = 1
c = 0
while n//s > 0:
  s *= k
  c += 1
print(c)
# Judge status: Accepted
n,*a=map(int,open(0).read().split())
t=sum(a);v=w=1
for q in a:
  w=min(2*(w-q),t:=t-q);(v:=v+w)
  if w<0:print(-1);exit()
print(v)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
N = int(input())
S = input()
Ans = 0
for i in range(1, 1 + N):
    for j in range(1, 1 + N):
        for k in range(1, 1 + N):
            if i < j and j < k:
                if S[i-1] != S[j-1] and S[j-1] != S[k-1]:
                    if (j-i) != (k-j):
                        Ans += 1
print(Ans)
# Judge status: Accepted
#ABC 130 B
N,X=map(int,input().split())
L= [int(j) for j in input().split()]
cnt=0
import numpy as np
jump = list(np.cumsum(L))
for j in jump:
    if j <= X:
        cnt+=1
print(cnt+1)
# Judge status: Accepted
N = input()
if N[:3].count(N[0]) == 3 or N[1:].count(N[1]) == 3:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
def resolve():
    N, R = map(int, input().split())
    if N >= 10:
        print(R)
    else:
        print(R+100*(10-N))
resolve()
# Judge status: Wrong Answer

s=str(input())


def n1():
    for i in range(len(s)):
        if i%2 == 0:
            if "L" and "U" and "D" in s[i]:
                return True
def n2():
    for i in range(len(s)):
        if i%2 != 0:
            if "R" and "U" and "D" in s[i]:
                return True

if n1() and n2() ==True:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n = int(input())
a_input = input()
a = a_input.split(" ")
b_input = input()
b = b_input.split(" ")
c_input = input()
c = c_input.split(" ")

b_sum = 0
for i in range(n):
    b_sum += int(b[i])

c_sum = 0
for i in range(n-1):
    if int(a[i]) != n:
        c_sum += int(c[int(a[i])-1])

sum = b_sum + c_sum
print(sum)
# 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
s = input()
n = len(s)
for i in range((n//2)):
  if(s[i] != s[-(i+1)]):
    print("No")
    exit()
for i in range(((n//2)//2)):
  print(s[i],s[((n//2)-1)-i])
  if((s[i] != s[((n//2)-1)-i]) and s[((n+3)/2) != s[-(i+1)]]):
    print("No")
    exit()
print("Yes")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

cnt=[0,0]#2,4の倍数の個数
for i in a:
    if i%4==0:
        cnt[1]+=1
    elif i%2==0:
        cnt[0]+=1

ans=n-cnt[0]-cnt[1]+1 if cnt[0]!=0 else n-cnt[1]
print('Yes' if ans<=cnt[1]+1 else 'No')
# Judge status: Wrong Answer
from collections import deque

N, M = map(int, input().split())
graph = [[] for _ in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    print(a, b)
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)
# print(graph)

res = [-1] * (N)
que = deque()
que.append(0)

while que:
    i = que.popleft()
    for j in graph[i]:
        if res[j] == -1:
            res[j] = i
            que.append(j)

print("Yes")
for i in res[1:]:
    print(i+1)
# Judge status: Accepted
N, M, K = map(int, input().split())
A = [0] + list(map(int, input().split()))
B = [0] + list(map(int, input().split()))

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

for i in range(1, M+1):
  B[i] += B[i-1]


ans = 0
b_count = M
for a_count in range(N+1):
  if A[a_count] > K:
    continue

  while A[a_count] + B[b_count] > K:
    b_count -= 1

  ans = max(ans, a_count + b_count)
print(ans)
# Judge status: Wrong Answer
X,N = map(int,input().split())
if N == 0 :
    print(X)
else :
    P = list(map(int,input().split()))
    a = list(range(0,10000000))
    ab = 100
    an = []
    for i in range(N):
        a.remove(P[i])
        a = a
    for j in range(101 - N):
        ab = min(ab,abs(X - a[j]))
    if X - ab in a :
        print(X - ab)
    elif X + ab in a:
        print(X + ab)
# Judge status: Accepted
n=int(input())
b=list(map(int,input().split()))
ans=b[0]+b[n-2]
for i in range(n-2):
    ans+=min(b[i],b[i+1])
print(ans)
# Judge status: Accepted
S = input().strip()
if S[2]==S[3] and S[4]==S[5]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from fractions import gcd
N,X = map(int,input().split())
XS = list(map(int,input().split()))

DIST = [abs(X-x) for x in XS]

ans = DIST[0]
for d in DIST:
  ans = gcd(ans,d)
  
print(ans)
# Judge status: Accepted
n=int(input())
w=[]
w.append(input())
t=1
for i in range(1,n):
    word=input()
    if word in w:
        t=0
        break
    if word[0]!=w[i-1][-1]:
        t=0
        break
    w.append(word)
if t==1:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
n,k=map(int,input().split())
a=input().split()
l=[]
for i in a:
	l.append(int(i))
print(l[l[0]-1])
# Judge status: Accepted
s1 = list(input())
s2 = list(input())
n = len(s1)
ans = ""
for i in range(n):
  try:
  	ans += s1[i]+s2[i]
  except:
    ans += s1[i]
print(ans)
# Judge status: Accepted
#abc078 b 
x,y,z=map(int,input().split())
print((x-z)//(y+z))
# Judge status: Wrong Answer
import itertools
import sys

N = int(input())
T = []
T.append(tuple(map(int, input().split())))
T.append(tuple(map(int, input().split())))

if T[0] == T[1]:
    sys.exit(0)

M = [0]*N
for i in range(N):
    M[i] = i+1

ans = []
for i, v in enumerate(itertools.permutations(M, N)):
    if v in T:
        ans.append(i)

print(abs(ans[0] - ans[1]))
# Judge status: Wrong Answer
import sys
s = str(sys.stdin.readline())
Q = int(sys.stdin.readline())

for _ in range(Q):
	qu = input()
	if qu == '1':
		s = s[::-1]
	else:
		_, fi, ci = qu.split()
		if fi == '1':
			s = ci + s
		if fi == '2':
			s += ci
print(s)
# Judge status: Accepted
import heapq

N, M = map(int, input().split())
A = list(map(lambda x : int(x)*(-1), input().split()))
heapq.heapify(A)

for _ in range(M):
    t = heapq.heappop(A)
    heapq.heappush(A, (-1)*(-t//2))

print(-sum(A))
# Judge status: Wrong Answer
N = int(input())
ans = ""

while N:
    ans = str(N % 2)+ans
    N = -(N//2)

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


def log(*args):
    print(*args, file=sys.stderr)


def main():
    n, m = map(int, input().rstrip().split())
    if abs(n - m) >= 2:
        print("0")
        return
    if n == m:
        print(math.factorial(n) * math.factorial(m) * 2 % (pow(10, 9) + 7))
    else:
        print(math.factorial(n) * math.factorial(m) % (pow(10, 9) + 7))


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

print(math.ceil((a+b)/2))
# Judge status: Accepted
n, m = map(int, input().split())
broken = [0]*(n+1)
#m個階段が壊れているからそれをbrokenに入れる
for i in range(m):
    a = int(input())
    broken[a] = 1
dp = [0]*(n+1)
dp[0] = 1
mod = 1000000007
for i in range(1, n+1):
    if broken[i]:
        continue
    #dp[-1]は0だから上手く回る
    dp[i] = (dp[i-1] + dp[i-2]) % mod
print(dp[n])
# Judge status: Accepted
N,K = map(int,input().split());
p = [int(x) for x in input().split()];
p.sort();
sum = 0;
for i in range(0,K) :
    sum = sum + p[i];
print(sum);
# Judge status: Accepted
N,L=map(int,input().split())
ans=""
S=[]
for i in range(N):
    S.append(str(input()))

S=sorted(S)
for j in range(N):
    ans+=S[j]
print(ans)
# Judge status: Accepted
X, N = map(int, input().split())
P = list(map(int, input().split()))

min_val = -1
for i in range(-1000, 1000):
    if i in P:
        continue
    if abs(min_val - X) > abs(X - i):
        min_val = i
if len(P) == 0:
    print(X)
else:
    print(min_val)
# Judge status: Accepted
n,k=map(int,input().split())
li=[0]*n

for _ in range(k):
  d=int(input())
  a=list(map(int,input().split()))
  
  for i in a:
    li[i-1]+=1
    
print(li.count(0))
# Judge status: Wrong Answer
def main():
  N = int(input())
  a = list(map(int, input().split()))

  c = [0] * (max(a)+1)

  for v in a:
    c[v] += 1

  ans = 0

  for i in range(len(c) - 2):
    x = c[i] + c[i+1] + c[i+2]
    ans = max(ans, x)

  print(ans)

if __name__ == "__main__":
  main()
# Judge status: Accepted
a,b,c = [int(x) for x in input().split()]
print(max(0, c-(a-b)))
# Judge status: Wrong Answer
X, Y = map(int, input().split())
import math

print(1 + math.floor(math.log2(Y/X)))
# Judge status: Accepted
n,m=map(int,input().split())
road=[0]*n
for i in range(m):
    a,b=map(int,input().split())
    road[a-1]+=1
    road[b-1]+=1
for i in road:
    print(i)
# Judge status: Accepted
d,t,s = [int(x) for x in input().split(' ')]
if d / s > t:
  print('No')
else:
  print('Yes')
# Judge status: Accepted
#!/usr/bin/env python3

# from numba import njit
from collections import Counter

# input = stdin.readline

# @njit
def solve(n,l):
  l_dash = ["".join(sorted(s)) for s in l]
  d = Counter(l_dash)
  return sum(v*(v-1)//2 for v in d.values())


def main():
  N = int(input())
  l = [input() for _ in range(N)]
  print(solve(N,l))
  return

if __name__ == '__main__':
  main()
# Judge status: Accepted
def bunkai(x):
    x_set = set()
    for i in range(1, int(x**0.5)+2):
        if x % i == 0:
            x_set.add(i)
            x_set.add(x//i)
    return x_set

def is_prime(x):
    for i in range(2, int(x**0.5)+1):
        if x % i == 0:
            return None
    ans.add(x)

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

A_set = bunkai(A)
B_Set = bunkai(B)
kari = A_set & B_Set

ans = set()
for x in kari:
    is_prime(x)
print(len(ans))
# Judge status: Wrong Answer
a = input()
if a.islower():
    answer = a
else:
    answer = a.lower()
print(answer)
# Judge status: Accepted
num = int(input())
sumList = [0] * num
minusList = [0] * num
for id in range(num):
    x, y = map(int, input().split())
    sumList[id-1] = x + y
    minusList[id-1] = x - y
sumMax = max(sumList) - min(sumList)
minusMax = max(minusList) - min(minusList)
print(max(sumMax, minusMax))
# Judge status: Accepted
import math
S = int(input())
v = 10**9
x3 = (v-S%v)%v
y3 = (S+x3)//v
print("0 0 %d 1 %d %d"%(10**9, x3, y3))
# Judge status: Accepted
x=int(input())
ans=0
if x%11==0:
  print(2*(x//11))
else:
  if x%11<=6:
    print(2*(x//11)+1)
  else:
    print(2*(x//11)+2)
# Judge status: Accepted
from fractions import gcd

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

LCM = 1

for i in A_List:
    LCM = LCM * i // gcd(LCM, i)

ans = 0

for i in A_List:
    ans += LCM // i

print(ans%(10**9+7))
# Judge status: Wrong Answer
c = input()

if c == ("a" or "e" or "i" or "o" or "u"):
  print("vowel")
else:
  print("consonant")
# Judge status: Accepted
#n = int(input())
x, a, b = map(int, input().split())
#l = list(map(int,input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

if a >= b:
    ans = 'delicious'
elif a+x >= b:
    ans = 'safe'
else:
    ans = 'dangerous'
print(ans)
# Judge status: Accepted
# 初期入力
import sys
input = sys.stdin.readline  #文字列では使わない
N = int(input())
renzoku =0
ans ="No"
for _ in range(N):
    d1,d2 = map(int, input().split())
    if d1 ==d2:
        renzoku +=1
        if renzoku ==3:
            print("Yes")
            sys.exit()
    else:
        renzoku =0
print(ans)
# Judge status: Accepted
a=int(input())
print(int(a*(a+1)/2))
# Judge status: Wrong Answer
from collections import deque
import bisect
import sys

input = sys.stdin.readline
N = int(input())
A = [int(input()) for _ in range(N)]
A = A[::-1]

col = [A.pop()]
col = deque(col)

while A:
    a = A.pop()
    if a <= col[0]:
        col.appendleft(a)
    else:
        x = bisect.bisect_right(col, a)
        col[x - 1] = a

ans = len(col)
print(ans)
# Judge status: Accepted
def modd(x, y):
    mod(x, y)

n, k = map(int, input().split())
count = 0
while n >= k:
    shou = n//k
    n = shou
    count += 1
print(count+1)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=[0]*(n)
for i in range(n):
    x=a[i]
    ans[x-1]+=(i+1)
ans2=[str(s) for s in ans]
print(" ".join(ans2))
# Judge status: Accepted
N = int(input())

def kaidan(k):
    return k * (k + 1) // 2

print(kaidan(N-1))
# Judge status: Accepted
#A, B = map(int,input().split())
S = input()
if S == "AAA" or S == "BBB":
    print("No")
else:
    print("Yes")
# Judge status: Accepted
n = int(input())
lst = []

tmp = 0
x = 1
while tmp<= n:
    tmp += x
    lst.append(x)
    x += 1
if tmp==n:
    pass
else:
    dif = tmp - n
    lst.remove(dif)
for l in lst:
    print(l)
# Judge status: Wrong Answer
N = int(input())

X = []
d = {}

for _ in range(N):
    x,l = map(int, input().split())
    X.append(x)
    d[x] = l
X.sort()
count = 0
for i in range(len(X)-1):

    I = (X[i]+d[X[i]]-1)
    J = (X[i+1]-d[X[i+1]]+1)
    if I>=J:
        count = count + 1
        i = i + 1
        if i>=N:
            break
        continue
print(N-count)
# Judge status: Wrong Answer
x = list(map(int, input().split(' ')))
if x[0] == x[1] + x[2]:
    print('yes')
elif x[0] + x[1] == x[2]:
    print('yes')
elif x[0] + x[2] == x[1]:
    print('yes')
else:
    print('no')
# Judge status: Accepted
A = list(map(int, input().split()))
A.sort()
if A[0] % 2 == 0 or A[1] % 2 == 0 or A[2] % 2 == 0:
  print(0)
else:
  print(A[0] * A[1])
# Judge status: Accepted
N,M = map(int,input().split())
A = input().split()
for i in range(M):
    N -= int(A[i])
if N >= 0:
    print(N)
else:
    print(-1)
# Judge status: Wrong Answer
A,B,K=map(int,input().split())
for i in range(A,B+1) :
  if i<=A+K or i>=B-K :
    print(i)
# Judge status: Accepted
import re
s = input()
a = []
a += [re.match(r'.*keyence$', s)]
a += [re.match(r'k.*eyence$', s)]
a += [re.match(r'ke.*yence$', s)]
a += [re.match(r'key.*ence$', s)]
a += [re.match(r'keye.*nce$', s)]
a += [re.match(r'keyen.*ce$', s)]
a += [re.match(r'keyenc.*e$', s)]
a += [re.match(r'keyence.*$', s)]
print('YES' if any(a) else 'NO')
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if b+c>=a:
  print(0)
else:
  print(c-(a-b))
# Judge status: Accepted
D, N = map(int, input().split())

if N == 100:
    print(101 * 100**D)
else:
    print(N * 100**D)
# Judge status: Wrong Answer
k,s= map(int,input().split())
cnt=0
for x in range(s+1):
    for y in range(s+1):
        if 0 <= s-x-y <= k:
            cnt+=1
print(cnt)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
A = sorted(A,reverse = True)
ans = 0
for i in range(0,N-1,2):
	ans += (A[i] - A[i+1])
print(ans)
# Judge status: Wrong Answer
n,k=map(int,input().split())
x=k-n+1
out=""
for i in range(2*n+1):
  out+=str(x+i)+" "
print(out[:-1])
# Judge status: Accepted
A = input()
Alist = list(A)
j=0
for i in range(3):
    if Alist[i] == '7':
        j+=1
if j>=1:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
S = input()
n, s, w, e = 0, 0, 0, 0
if 'N' in S:
    n = 1
if 'S' in S:
    s = 1
if 'W' in S:
    w = 1
if 'E' in S:
    e = 1
if n == s and w == e:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
if a <= c <= b:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
K,X = map(int,input().split())

if 500 * K >= X:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
c,d=dict(),dict()
for i in range(n):
    if a[i]-i-1 in c:
        c[a[i]-i-1]+=1
    else:
        c[a[i]-i-1]=1
    if a[i]+i+1 in d:
        d[a[i]+i+1]+=1
    else:
        d[a[i]+i+1]=1
ans=0
for i in c:
    if i in d:
        ans+=(c[i]*d[i])
print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
if N == 1 or M == 1:
  if N == M: print(1); exit()
  elif N == 2 or M == 2: print(0); exit()
  else: print(max(N, M) - 2); exit()
elif N == 2 or M == 2: print(0); exit()
else: print((N-2)*(M-2))
# Judge status: Accepted
import itertools
N = int(input())
First_List = list(map(int,input().split()))
Second_List = list(map(int,input().split()))
Num_List = sorted(First_List)
F_Flg = 0
S_Flg = 0
Loop_Num = 1
for Sorted_Pair in itertools.permutations(Num_List, N):
    Search_Pair = list(Sorted_Pair)
    if (Search_Pair == First_List) & (F_Flg == 0):
        F_Flg = Loop_Num
    if (Search_Pair == Second_List) & (S_Flg == 0):
        S_Flg = Loop_Num
        
    
    Loop_Num += 1

print(abs(F_Flg-S_Flg))
# Judge status: Accepted
k = int(input())
a = k//2
b = k-a
print(a*b)
# Judge status: Accepted
day = {'SUN': 7, 'MON':6, 'TUE':5, 'WED': 4, 'THU':3, 'FRI':2, 'SAT':1}
s = input()
print(day[s])
# Judge status: Accepted
s = input()
min_abs = 1000
for i in range(len(s) - 2):
    if abs(753 - int(s[i: i + 3])) < min_abs:
        min_abs = abs(753 - int(s[i: i + 3]))
print(min_abs)
# Judge status: Accepted
n = int(input())
a = n%10

if a == 3:
  print("bon")
elif (a == 0) | (a == 1) | (a == 6) | (a == 8):
  print("pon")
else:
  print("hon")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

ret = 0
now = a[0]
for i in range(1, n):
    if now > a[i]:
        ret += now - a[i]
        a[i] = now
    now = a[i]

print(ret)
# Judge status: Wrong Answer
colors = list(map(str, input().split()))
print(colors)
numbers = list(map(int, input().split()))
target_color = input() 

for index, color in enumerate(colors):
  if color == target_color:
    numbers[index] = numbers[index] - 1
    
 
for num in numbers:
  print(str(num) + " ", end="")
# Judge status: Wrong Answer
N = int(input())
a = list(map(int, input().split()))
count = 1
broke = 0
while True:
    if count in a:
        print(a.index(count))
        broke += a.index(count)
        a = a[a.index(count) + 1:]
        count += 1
    else:
        break
if broke == 0:
    print(-1)
else:
    print(broke)
# Judge status: Accepted
A,B,K=map(int,input().split())
if A>K:print(A-K,B)
elif A+B>K:print(0,A+B-K)
else:print(0,0)
# Judge status: Accepted
N=int(input())
ans=1
for i in range(N+1):
    if i*i<=N:
        ans=i
    else:
        break
print(ans**2)