peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
from bisect import bisect_left, bisect_right

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

ans = 0
for b in B:
    max_index_A = bisect_left(A, b)
    max_index_C = N - bisect_right(C, b)
    ans += (max_index_A) * (max_index_C)

print(ans)
# Judge status: Accepted
N, C, K = map(int, input().split())
T = [int(input()) for i in range(N)]
T.sort()

ans = 1
bus = C
time = T[0] + K
for i in T:
    # バスの定員に空きがあり、かつ、乗車1人目の許容時間内の場合同じバスに乗る
    if (bus > 0) & (i <= time):
        bus -= 1
    # バスが定員、または、乗車1人目の許容時間外の場合新しいバスに乗る
    else:
        bus = C - 1
        time = i + K
        ans += 1

print(ans)
# Judge status: Accepted
# -*- coding: utf-8 -*-
X, Y = map(int, input().split())
results = list()
num = X
while num <= Y:
    results.append(num)
    num += num
print(len(results))
# Judge status: Wrong Answer
from collections import deque
n,k = map(int,input().split())
a = list(map(int,input().split()))
anslist = deque(a)
while len(anslist) > k:
    if abs(anslist[0]) > abs(anslist[-1]):
        anslist.popleft()
    else:
        anslist.pop()
if anslist[0] >= 0 and anslist[-1] >= 0:
    print(anslist[-1])

elif anslist[0] <= 0 and anslist[-1] <= 0:
    print(-anslist[0])

else:
    if anslist[-1] > -anslist[0]:
        print(-2*anslist[0] + anslist[-1])
    else:
        print(2*anslist[-1] - anslist[0])
# Judge status: Accepted
n, m = map(int, input().split())
X = list(map(int, input().split()))
X.sort()
C = []
if m <= n:
	print(0)
	exit()
for i in range(1, m):
	C.append(abs(X[i] - X[i-1]))
C.sort()
for i in range(n-1):
	C[m-2-i] = 0
print(sum(C))
# Judge status: Accepted
# solution
# solution

import fractions
import math
import io

nim, mike = map(int, input().split())
are1 = list(map(int, input().split()))
are2, result = [abs(x - mike) for x in are1], 0

for i in are2:
    result = fractions.gcd(result, i)
print(result)
# Judge status: Wrong Answer
n, p = map(int, input().split())
a = list(map(int, input().split()))

length = len(a)
even = len([i for i in a if i % 2 == 0])
odd = len([i for i in a if i % 2 == 1])

if length == even and p == 1 or length == odd and p == 0 and odd % 2 == 1:
    print(0)
else:
    print(2 ** n // 2)
# Judge status: Accepted
n = int("".join(input().split()))
x = n**(1/2)
if x%1 != 0:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
n,k = map(int,input().split())
a = list(map(int,input().split()))

l = 0
r = 10**10

while r > l + 1:
    m = (r+l)//2
    count = 0
    for i in a:
        if i <= m:
            continue
        count += (i)//m
        
    if count > k:
        l = m
    else:
        r = m
    
print(r)
# Judge status: Accepted
N = int(input())
*A, = map(int, input().split())

def gcd(a,b):
    if a > b: a,b=b,a
    while a: a,b=b%a,a
    return b

L = [0]*(N)
R = [0]*(N)
L[0] = A[0]
R[-1] = A[-1]
for i in range(1,N):
    L[i] = gcd(L[i-1],A[i])
    R[-1-i] = gcd(R[-i],A[-1-i])

ans=R[1]
for i in range(1,N-1):
    ans = max(ans, gcd(L[i-1],R[i+1]))
ans = max(ans, L[N-2])

print(ans)
# Judge status: Wrong Answer
inpo=input(),
for i in inpo:
  if i=="B":
    print("R",end="")
  elif i=="R":
    print("B",end="")
  else:
    print(i,end="")
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
d = {}

A.sort()
irregular_cnt=0
reg_cnt = 0
for i in range(n):
    a = A[i]
    a //= 400
    if a>7:
        irregular_cnt += 1
    else:
        d[a] = d.get(a, 0)+1

maxi, mini = 0, 0
for i in d:
    if d[i]>0:
        maxi += 1
        mini += 1
if irregular_cnt:
    maxi += irregular_cnt
    if not mini:
        mini += 1
print(mini, maxi)
# Judge status: Accepted
N, M, K = map(int, input().split())

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

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N+1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)

print(ans)
# Judge status: Accepted
s = input()
t = s.replace('hi', '*')
if set(t) == {'*'}:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import queue

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

graph = [[] for i in range(N)]

for i in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    graph[A].append(B)
    graph[B].append(A)

dist = [-1 for i in range(N)]
que = queue.Queue()

dist[0] = 0
que.put(0)


while not que.empty():
    v = que.get()
    for nv in graph[v]:
        if dist[nv] != -1:
            continue

        dist[nv] = v
        que.put(nv)


print("Yes")
for i in range(1, N):
    print(dist[i] + 1)
# Judge status: Accepted
from sys import stdin
N = int(stdin.readline().rstrip())
ans = ''
while N > 0:
    N -= 1
    ans += chr(ord('a')+N%26)
    N //= 26
print(ans[::-1])
# Judge status: Accepted
n = int(input())

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


before_max = a[0]
humidai = 0
humidai_sum = 0
for i in range(1,n):
    humidai = 0
    if(before_max >= a[i]):
        humidai = before_max - a[i]
        humidai_sum += humidai

    if(before_max < a[i]):
        before_max = a[i]
        

    #print(humidai,before_max,before_max)
print(humidai_sum)
# Judge status: Accepted
n,m = map(int,input().split())
a = list(map(int,input().split()))

if n-sum(a)<0:
  print("-1")
else:
  print(n-sum(a))
# Judge status: Accepted
from collections import Counter
N = int(input())
D = list(map(int, input().split()))

ans = 0
cnt = 0
if (D[0]==0) and (D.count(0)==1):
  D = Counter(D)
  cnt = 1
  ans = 1
  for i in range(1, max(D)+1):
    if D[i] == 0:
      ans = 0
      break
    else:
      ans *= cnt ** D[i]
      cnt = D[i]
ans = ans % 998244353
print(ans)
# Judge status: Accepted
s,c=map(int,input().split())

cnt=0
p=min(s,c//2)
s-=p
c-=2*p
cnt+=p
q=0
if c<2:
    print(cnt)

else:
    q=c//4
    cnt+=q
    print(cnt)
# Judge status: Wrong Answer
n = int(input())

ab = [[0]*2 for i in range(n)]

for i in range(n):
	ab[i][0], ab[i][1] = map(int, input().split())

ab.sort(key=lambda x: x[1])

print(ab)

ws = 0

for i in range(n):
	ws += ab[i][0]
	if ws > ab[i][1]:
		print('No')
		break
else:
	print('Yes')
# Judge status: Accepted
A = list(map(int,input().split()))
for i in range(5):
    if(A[i]==0):
        print(i+1)
# Judge status: Accepted
N = int(input())
L = [[int(l) for l in input().split()] for _ in range(N)]

L1 = [0]*N
L2 = [0]*N
for i in range(N):
    L1[i] = L[i][0]+L[i][1]
    L2[i] = L[i][0]-L[i][1]

L1.sort()
L2.sort()
print(max(L1[-1]-L1[0], L2[-1]-L2[0]))
# Judge status: Accepted
s = input()
t = input()
lt = len(t)
ls = len(s)
A = []
for i in range(ls-lt+1):
    cou = 0
    for j in range(lt):
        if s[i+j] == t[j]:
            cou += 1
    A.append(cou)
print(lt-max(A))
# Judge status: Accepted
S = input()
if S[0]=='A' and (S[2:len(S)-1].count('C')==1) and S[1:2].islower() and S[len(S)-1:].islower():
  print('AC')
else:
  print('WA')
# Judge status: Accepted
N = input()
N = int(N)

c=[[0 for i in range(10)] for j in range(10)]

c[0][0]
for x in range(1,N+1):
    X=str(x)
    c[int(X[0])][int(X[-1])]+=1

score = 0
for i in range(10):
    for j in range(10):
        score += c[i][j]*c[j][i]
        
print(score)
# Judge status: Accepted
a=list(input())
if a[2]==a[3] and a[4]==a[5]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
def main():
    s = input()
    t = input()
    sum = 0
    for i, j in zip(s, t):
        if i != j:
            sum+=1
    print(sum)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
a=input()
b=''
for i in a:
    if i=='0':
        b+='0'
    elif i=='1':
        b+='0'
    else:
        b=b[:-1]
print(b)
# Judge status: Accepted
n=int(input())
print((10**n-9**n*2+8**n)%(10**9+7))
# Judge status: Wrong Answer
str_in = input()
ans = "No"
if(str_in[2] == str_in[3] and str_in[2] == str_in[3]):
  ans = "Yes"
print(ans)
# Judge status: Wrong Answer
x, y = (int(x) for x in input().split())
ans = 0
if abs(x) < abs(y):
    if x < 0 and y > 0:
        ans += 1
    if x < 0 and y < 0:
        ans += 2
    ans += abs(y) - abs(x)
elif abs(x) == abs(y): ans += 1
else:
    if x > 0 and y > 0:
        ans += 2
    if x < 0 and y > 0:
        ans += 1
    ans += abs(x) - abs(y)
print(ans)
# Judge status: Accepted
import numpy as np

w, h, n = map(int, input().split())
area = np.zeros((w, h))

for i in range(n):
    x, y, a = map(int, input().split())
    if a==1:
        area[:x, :] = 1
    elif a==2:
        area[x:, :] = 1
    elif a==3:
        area[:, :y] = 1
    else:
        area[:, y:] = 1

print((w*h) - int(area.sum()))
# Judge status: Wrong Answer
import math

N = int(input())
cnt = 0
root = int(math.sqrt(N))
for a in range(1,root+1):
    cnt += (N-1)//a - (a-1)
if root<2:
    print(cnt*2-root)
else:
    print(cnt*2-root+1)
# Judge status: Accepted
n,*a = map(int,open(0).read().split())
total = sum(a)
ans = 10**18
dt = 0
for i in range(n-1):
  dt += a[i]
  ans = min(ans,abs(total-dt-dt))
print(ans)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
n,m=map(int,input().split())
print(n+(m-2*n)//4)
# Judge status: Accepted
d = int(input())
if d==22:
    print("Christmas Eve Eve Eve")
elif d==23:
    print("Christmas Eve Eve")
elif d==24:
    print("Christmas Eve")
else:
    print("Christmas")
# Judge status: Accepted
a, b = map(int, input().split())
if (a - b) % 2 == 0:
    print(((max(a, b) - min(a, b)) // 2) + min(a, b))
else:
    print('IMPOSSIBLE')
# Judge status: Wrong Answer
n = int(input())

ans = 10000

for i in range(1,n//2):
  d_n = n-i
  count_a = 0
  count_b = 0
  
  while i > 0:
    count_a += i % 10
    i //= 10
  
  while d_n >0:
    count_b += d_n % 10
    d_n //= 10
  
  if ans >= count_a + count_b:
    ans = count_a + count_b
    
print(ans)
# Judge status: Accepted
N = int(input())
S = input()
cnt = 0
ans = [0]
for i in S:
    if i =='I':
        cnt+=1
        ans.append(cnt)
    if i == 'D':
        cnt-=1
        ans.append(cnt)
print(max(ans))
# Judge status: Accepted
O= input()
E= input()
p = ""

for i in range(len(O)):
    p = p + O[i]
    if i < len(E):
        p = p + E[i]

print(p)
# Judge status: Wrong Answer
W,H,x,y = (int(x) for x in input().split())
if x == W // 2 and y == H // 2:
    ans = [W*H/2, 1]
    print(*ans)
else:
    ans = [W*H/2, 0]
    print(*ans)
# Judge status: Wrong Answer
import sys

input = sys.stdin.readline


def main():
    a, b, c = map(int, input().split())

    ans = 3
    if a == b:
        ans -= 1
    if b == c:
        ans -= 1
    if c == a:
        ans -= 1
    print(ans)


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

s = [""] * n
t = [""] * n

cnt = 0
flg = 0

for i in range(n):
    s[i] = input()
    t[i] = sorted(s[i])

t = sorted(t)

for i in range(n - 1):
    if t[i] == t[i + 1]:
        flg += 1
        cnt += flg
    else:
        flg = 0

print(cnt)
# Judge status: Wrong Answer
n,k = input().split()
k = int(k)
n =int(n)

healths = input().split()
res = 0

healths.sort()
for i in range(n-k):
    res = res + int(healths[i])

print(res)
# Judge status: Wrong Answer
S = input()
ans = 'No'

if len(S)%2 == 0:
    for i in range(len(S)//2):
        if S[i]+S[i+1] != 'hi':
            break
        elif i == (len(S)//2)-1:
            ans = 'Yes'
print(ans)
# Judge status: Accepted
n,ng = map(int,input().split())

MOD    = 10**9+7 
nglist = [0]*(n+1)
dp     = [0]*(n+1)
dp[0]  = 1

for i in range(ng):
  x = int(input())
  nglist[x] = 1
 
for i in range(1,n+1):

  if nglist[i]==1:
    dp[i] = 0
    continue

  if i==1:
    dp[1] = dp[0]
    continue
  
  dp[i] = (dp[i-2] + dp[i-1]) % MOD

print(dp[n])
# Judge status: Accepted
AA = input()
A =list(AA)
BB = input()
B = list(BB)
CC = input()
C = list(CC)

X ='a'

while True:
  
  if X  == 'a':
    if len(A) == 0:
        break
    else:
        X = A.pop(0)  
  elif X =='b':
    if len(B) ==0:
        break
    else:
        X = B.pop(0)
  else:
    if len(C) == 0:
        break
    else:
        X = C.pop(0)
print(X.upper())
# Judge status: Wrong Answer
n = int(input())


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


l = make_divisors(n)
x = l[len(l) // 2] + l[len(l) // 2 - 1] - 2

print(x)
# Judge status: Accepted
x, y = map(int, input().split())
ans = 0
w = x
while w <= y:
    ans += 1
    w *= 2
print(ans)
# Judge status: Accepted
N = int(input())
S = list(input())

ans = [0] * N
#リーダーより東の東向きの人
ans[0] = S[1:].count("E")

#リーダーを東にずらしていく
for i in range(1, N):
    ans[i] = ans[i-1]
    if S[i-1] == "W":
        ans[i] += 1
    if S[i] == "E":
        ans[i] -= 1

#print("ans : {}".format(ans))
print(min(ans))
# Judge status: Wrong Answer
from collections import Counter
n = int(input())
s = input()

c = Counter(list(s))
ans = 1
for i in list(c.values()):
    ans *= i
for i in range(n-2):
    for j in range(i+1, n-1):
        k = j + (j-i)
        if k >= n:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            ans -= 1
print(ans)
# Judge status: Accepted
import math

A, B = map(int, input().split())
gcd_ab = math.gcd(A, B)
factors = set()
i = 2
while i <= math.ceil(math.sqrt(gcd_ab)):
    if gcd_ab%i == 0:
        factors.add(i)
        gcd_ab = gcd_ab // i
    else:
        i += 1
factors.add(gcd_ab)
factors.add(1)
print(len(factors))
# Judge status: Accepted
def main():
    A, B = input().replace('.','').split(' ')
    print(int(A)*int(B)//100)

if __name__ == "__main__":
    main()
# Judge status: Accepted
n,m=map(int,input().split())
L=[]
R=[]
for i in range(m):
    l,r=map(int,input().split())
    L.append(l)
    R.append(r)
a=max(L)
b=min(R)
li=[i for i in range(a,b+1)]
print(len(li))
# Judge status: Accepted
import collections
N,K=map(int,input().split())
a=[]
d=[]
while K>0:
  K=K-1
  d.append(int(input()))
  b=list(map(int,input().split()))
  a.extend(b)
e=collections.Counter(a)
print(N-len(e))
# Judge status: Accepted

import numpy as np
import sys

input = sys.stdin.readline

s = int(input())

if s == 1 :
    n = 2
elif s == 2:
    n = 1
else:
    n = 3

ans = 1

while s != 4:
    if s%2 == 0 :
        s = s/2
    else:
        s = 3*s + 1
    
    
    ans+=1


print(ans+n)
# Judge status: Accepted
N = int(input())
dp = [0,0,0]
for _ in range(N):
    a, b, c = map(int, input().split())
    ndp = [0,0,0]
    ndp[0] = max(dp[1], dp[2]) + a
    ndp[1] = max(dp[0], dp[2]) + b
    ndp[2] = max(dp[0], dp[1]) + c
    dp = ndp
print(max(dp))
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
ans = 0
for i in range(n - 1):
    if p[i] == i + 1:
        p[i], p[i + 1] = p[i + 1], p[i]
        ans += 1
if p[-1] == n:
    ans += 1
print(ans)
# Judge status: Wrong Answer
sx,sy,tx,ty = map(int,input().split())
ans = 'R'*(tx-sx)+'U'*(ty-sy) + 'L'*(tx-sx) +'D'*(ty-sy) + 'D' + 'R'*(tx-sx+1) + 'U'*(ty-tx+1)+ 'L' + 'U' + 'L'*(tx-sx+1) + 'D'*(ty-tx+1) + 'R'
print(ans)
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
K = int(input())
cnt = 0

while A > B and cnt <= K:
    B = B*2
    cnt += 1

if cnt >= K and B > C:
    print("No")
else:
    while B > C and cnt < K:
        C = C*2
        cnt += 1

if C > B:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def dist(x, y):
    d = 0.0
    for i in range(len(x)):
        d += (x[i] - y[i]) ** 2
    return d ** 0.5

n, d = map(int, input().split())
x = []
for i in range(n):
    x.append(tuple(map(int, input().split())))

ans = 0
for i in range(n):
    for j in range(i + 1, n):
        d = dist(x[i], x[j])
        if abs(d - int(d)) < 1e-6:
            ans += 1
print(ans)
# Judge status: Wrong Answer
a_n = list(map(int, input().split()))

if sum(a_n) >= 22:
    print("win")
else:
    print("bust")
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
import math
from decimal import *
a,b,c = map(int,readline().split())

if Decimal(a).sqrt() + Decimal(b).sqrt() < Decimal(c).sqrt():
    print("Yes")
else:
    print("No")
# Judge status: Accepted
A, B, K = map(int, input().split())
ans = set([_ for _ in range(A, min(A + K, B+1))])
ans |= set([_ for _ in range(B, max(A, B-K), -1)])
for num in sorted(list(ans)):
    print(num)
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    a, b, x = map(int, readline().split())
    ans = b//x - (a-1)//x
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
H, _ = map(int, input().split())
if sum(map(int, input().split())) > H:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N,M=map(int, input().split())
ans=0
if min(N,M)==1:
    print(max(N,M)-2)
    exit()
for h in range(N):
    for w in range(M):
        count=0
        if 1<=h<N-1 and 1<=w<M-1:
            count+=9
        else:
            count+=4
        if count%2==1:
            ans+=1
print(ans)
# Judge status: Accepted
X,Y=map(int,input().split())
if Y % 2 != 0:
  print('No')
elif (Y//2 -X >=0 and 2*X-Y//2>=0):
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N,M = map(int,input().split())
sc = [list(map(int, input().split())) for _ in range(M)]
dic = {}
if sc == [] and N == 1:
  print(0)
  exit()
if sc == [[1,0]] and N == 1:
  print(0)
  exit()
for k in sc:
  if k[0] in dic:
    if dic[k[0]] != k[1]:
      print(-1)
      exit()
  else:
    dic[k[0]] = k[1]
ans = 0
if 1 in dic and dic[1] == 0:
  print(-1)
  exit()
for k in dic:
  ans += 10**(N-k) * dic[k]
if ans < 10**(N-1):
  ans += 10**(N-1)
print(ans)
# Judge status: Accepted
def main():
    s = input()
    w = ["dream", "dreamer", "erase", "eraser"]
    last = len(s)
    for _ in range(len(s)):
        if last < 1:
            break
        for ww in w:
            if s[last - len(ww):] == ww:
                s = s[:last - len(ww)]
                last -= len(ww)
    print("YES" if last < 1 else "NO")


if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys
input = sys.stdin.readline

N, K = map(int, input().split())
x = list(map(int, input().split()))
ans = 10**18

for i in range(N-K+1):
    if x[i]<x[i+K-1]<0:
        ans = min(ans, -x[i])
    elif 0<x[i]<x[i+K-1]:
        ans = min(ans, x[i+K-1])
    else:
        ans = min(ans, -2*x[i]+x[i+K-1], -x[i]+2*x[i+K-1])

print(ans)
# Judge status: Accepted
import itertools
import math
N=int(input())
z=[]
for _ in range(N):
    z.append(list(map(int,input().split())))
sum=0
for per in itertools.permutations(list(range(N))):
    for i in range(N-1):
        sum+=math.sqrt((z[per[i]][0]-z[per[i+1]][0])**2+(z[per[i]][1]-z[per[i+1]][1])**2)
ans=sum/math.factorial(N)
print(ans)
# Judge status: Accepted
A, B = input().split()
X = int(A + B)
ans = "No"
for i in range(1000):
  if (i * i) == X:
    ans = "Yes"
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

a.sort()
minus, plus = [], []

for x in a:
    if x < 0:
        minus.append(x)
    else:
        plus.append(x)

tmp = sum([abs(x) for x in a])

if len(minus) % 2 == 0:
    print(tmp)
else:
    if plus == [] or abs(minus[-1]) < plus[0]:
        print(tmp + minus[-1] * 2)
    else:
        print(tmp - plus[0] * 2)
# Judge status: Wrong Answer

n = int(input())
l = list(map(int,input().split()))

l.sort()
"""
print(l)
print(sum(l) - l[-1])
print(l[-1])
"""
if (sum(l) - l[-1]) < l[-1]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
X = int(input())
S = set([1])
for i in range(2,X):
  b = 2
  while(i**b<=X):
    S.add(i**b)
    b += 1

ans = max(S)
print(ans)
# Judge status: Accepted
import math

a=input()
b=input()

c=sorted(a)
d=sorted(b,reverse=True)

print("Yes" if c<d else  "No")
# Judge status: Accepted
N = int(input())

i = 0
res = False

for _ in range(N):  
    a, b = map(int,input().split())

    if a == b:
        i += 1
    else:
        i = 0
        
    if i >= 3:
        res = True

print("Yes" if res else "No")
# Judge status: Wrong Answer
N, L = map(int, input().split())
tastes = [ L+x for x in range(N) ] 

if 0 in tastes:
    print(sum(tastes))

if L<0:
    absmin = max(tastes)
    print(sum(tastes)-absmin)
elif L>0:
    absmin = min(tastes)
    print(sum(tastes)-absmin)
# Judge status: Wrong Answer
a, b = map(int, input('整数を入力してね > ').split())
#print(a,b)
answer = a * b
print(answer)
if answer % 2==0:
    print('Even')
else:
    print('Odd')
# Judge status: Accepted
# https://atcoder.jp/contests/abc119/tasks/abc119_a
y, m, d = map(int, input().split('/'))
if y > 2019:
    print('TBD')
elif m >= 5:
    print('TBD')
else:
    print('Heisei')
# Judge status: Wrong Answer
w,h,x,y = map(int,input().split())

if x == int(w/2) and y == int(h/2):
    print(w*h/2,1)
else:
    print(w*h/2,0)
# Judge status: Wrong Answer
a,b=map(int,input().split())
cnt=0
for l in range(a,b):
            l_i=list(str(l))
            if l_i[0]==l_i[-1] and l_i[1]==l_i[-2]:
                        cnt+=1
print(cnt)
# Judge status: Accepted
N = int(input())
S = input()
char = ''

for i in range(len(S)):
    char += chr((ord(S[i]) + N - 65) % 26 + 65)

print(char)
# Judge status: Accepted
N = int(input())
no = [i for i in range(N)]
A = list(map(int, input().split()))

no_minus_height = {}
#no_plus_height = {}
total = 0
for i in range(N-1,-1,-1):
    no_plus_height = no[i]+A[i]
    try:
        total += no_minus_height[no_plus_height]
    except:
        pass
    
    try:
        no_minus_height[no[i]-A[i]] += 1
    except:
        no_minus_height[no[i]-A[i]] = 1
print(total)
# Judge status: Wrong Answer
N,K = [int(i) for i in input().rstrip().split(' ')]
R,S,P = [int(i) for i in input().rstrip().split(' ')]
r = 0
T = input()
te = ["p","r","s"]
point = {"p":P,"r":R,"s":S}
Play = []
for i,t in enumerate(T):
    best = te[te.index(t)-1]
    if Play[i-K] != best if i >= K else True:
        Play += [best]
        r += point[best]
    else:
        Play += [t]
print(r)
# Judge status: Accepted
n,*l=map(int,open(0).read().split())
from collections import*
d=defaultdict(int)
a=0
for i in range(n): d[i+l[i]]+=1; a+=d[i-l[i]]*(i>l[i])
print(a)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

ans = 1
x = 0

for i in range(n-1):
    if a[i] < a[i+1]:
        if x == -1:
            ans += 1
            x = 0
        elif x == 0:
            x = 1
    elif a[i] > a[i+1]:
        if x == 1:
            ans += 1
            x = 0
        elif x == 0:
            x = -1
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
cnt_1 = 0
cnt_2 = 0
cnt_4 = 0
for i in range(N):
	if A[i] % 2 == 0:
		if A[i] % 4 == 0:
			cnt_4 += 1
		else:
			cnt_2 += 1
	else:
		cnt_1 += 1
#print(cnt_1,cnt_2,cnt_4)
if cnt_2 == 0:
	if cnt_1 <= cnt_4 + 1:
		print("Yes")
	else:
		print("No")
else:
	if cnt_1 <= cnt_4:
		print("Yes")
	else:
		print("No")
# Judge status: Accepted
s = input()
t = input()

if s == t[0:-1]:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
import sys
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())
antena = [a,b,c,d,e]
for i in range(len(antena)):
    for j in range(i+1,len(antena)):
        if antena[j]-antena[i]<k:
            state = 1
        else:
            state = 0
            break
    if state == 0:
        print(":(")
        sys.exit()
print("Yay!")
# Judge status: Accepted
S = input()

HI = ['hi','hihi','hihihi','hihihihi','hihihihihi',]
if S in HI:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n,m=map(int,input().split())
h=list(map(int,input().split()))
x=[1]*n
for i in range(m):
    a,b=map(int,input().split())
    if h[a-1]>=h[b-1]:
        x[b-1]=0
    if h[a-1]<=h[b-1]:
        x[a-1]=0
print(sum(x))
# Judge status: Accepted
a,b=map(int, input().split())
print(sum([x for x in range(b-a)])-a)
# Judge status: Wrong Answer
N = int(input())
s = ''
s2 = ''
while N != 0:
  if N % 2 == 0:
    s += '0'
    N //= (-2)
  if N % 2 == -1 or N % 2 == 1:
    s += '1'
    N //= (-2)
    N += 1
s2 = s[::1]
print(s2)
# Judge status: Accepted
k,a,b=map(int,input().split())

if k<=a: print(1+k)
else:
    print(max(1+k, b+(k-a-1)//2*(b-a) + (k-a-1)%2))