peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import sys
 
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

n, k = na()
h = [ni() for i in range(n)]
h.sort()
d = [h[i] - h[i - 1] for i in range(1, n)]
d.sort()
ans = 0
for i in range(k - 1):
    ans += d[i]
print(ans)
# Judge status: Wrong Answer
N,A,B=map(int, input().split())
def find(N,A,B):
  if (A+B)%2==0:
    return int((B-A)/2)
  
  elif B-A==3:
    if (A-1)<=(N-B):
      A=1-A
      return int((B-A)/2)

    if (A-1)>(N-B):
      B=2*N-B
      return int((B-A)/2)
    
  else:
    return int((B-A)/2+2)
print(find(N,A,B))
# Judge status: Accepted
def solve():
    n = int(input())
    a = []
    b = []
    for _ in range(n):
        x,y = map(int,input().split())
        a.append(x)
        b.append(y)
    ans = 0
    for i in range(n)[::-1]:
        if (a[i]+ans)%b[i]:
            ans+=b[i]-(a[i]+ans)%b[i]
    print(ans)
if __name__=='__main__':
    solve()
# Judge status: Accepted
import random
def main():
    D = int(input())
    c = list(map(int,input().split()))
    s = []
    for d in range(D):
        s.append(list(map(int,input().split())))
    
    last = [0 for i in range(26)]
    
    v = 0
    
    for d in range(D):
        print(random.randint(1,26))
    
if __name__ == '__main__':
    main()
# Judge status: Accepted
#B
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

cnt = 0
for i in range(n):
    cnt += b[a[i]-1]
    if i < n-1:
        if a[i] + 1 == a[i+1]:
            cnt += c[a[i] - 1]
            
print(cnt)
# Judge status: Accepted
S = s = input()
s = set(s)

if len(S) == len(s):
    print('yes')
else:
    print('no')
# Judge status: Accepted
import math
a,b,x = map(int, input().split())
if x <= a*a*b/2:
    print((180/math.pi)*math.atan(a*b*b/(2*x)))
else:
    r = a*a*b-x
    print((180/math.pi)*math.atan(2*r/(a**3)))
# Judge status: Wrong Answer
from sys import stdin

K = int(stdin.readline().rstrip())
[A, B] = [int(x) for x in input().rstrip().split()]


flag=0
K_temp=K
while(True):
    if(K_temp>B):
        break
    if(K_temp>=A and K_temp<=B):
        flag=2
        break
    else:
        K_temp+=K

if flag==1:
    print("OK")
else:
    print("NG")
# Judge status: Accepted
a,b,c,x,y=map(int,input().split())
ans=10**9
for i in range(max(x,y)+1):
    ans=min(ans,i*2*c+max(0,x-i)*a+max(0,y-i)*b)
print(ans)
# Judge status: Wrong Answer
from collections import defaultdict
import math
def divisors(n):
	i = 1
	div = []
	while i <= math.sqrt(n):
		if (n % i == 0):
			if (n //i == i) : 
				div+=[i] 
			else:
				div+=[i,n//i]
		i+=1
	return div
	
n = int(input())
arr = list(map(int,input().split()))
d = defaultdict(int)
for i in arr:
	d[i]+=1
ans = 0
for i in arr:
	if d[i]!=1:
		continue
	temp = divisors(i)
	f = 0
	for j in temp:
		if j!=i:
			if d[j]==1:
				f = 1
				break
	if f==0:
		ans+=1
print(ans)
# Judge status: Accepted
n=int(input(""))
list1=list(map(int,input("").split(" ")))

list2=[i for i in list1]

    
list1.sort()

count=0

for i in range(n):
    if(list1[i]!=list2[i]):
        count+=1
 
if(count>2):
    print("NO")
else:
    print("YES")
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

print(b//c - a //c)
# Judge status: Accepted
W, H, N = map(int, input().split())
x = [0, W]
y = [0, H]
a = []

for i in range(N):
  A = list(map(int, input().split()))
  a.append(A)

for j in a:
  if j[2] == 1:
    x[0] = max(x[0], j[0])
  elif j[2] == 2:
    x[1] = min(x[1], j[0])
  elif j[2] == 3:
    y[0] = max(y[0], j[1])
  else:
    y[1] = min(y[1], j[1])
    
if x[0] >= x[1] or y[0] >= y[1]:
  print('0')
else:
  ans = (x[1] - x[0]) * (y[1] - y[0])
  print(int(ans))
# Judge status: Accepted
n = int(input())
c = 0
a = [105,165,195]
if (n<105):
    print(0)
elif (105<=n and n<135):
    print(1)
elif (n >= 195):
    print(5)
elif (135<=n and n<165):    
    print(2)
elif (165<=n and n<189):
    print(3)
else:
    print(4)
# Judge status: Accepted
import math

N = int(input())
print(math.ceil(N/2))
# Judge status: Accepted
def main():
    _ = int(input())
    a = [int(an) for an in input().split()]
    a.sort()
    half_val = -(-a[-1] // 2)
    dist_list = [abs(half_val - an) for an in a[:-1]]
    min_index = dist_list.index(min(dist_list))
    print(f'{a[-1]} {a[min_index]}')


if __name__ == '__main__':
    main()
# Judge status: Accepted
print('bust' if sum(list(map(int, input().split()))) >= 22 else 'win')
# Judge status: Wrong Answer
import numpy as np
N,K = map(int,input().split())
p = list(map(int,input().split()))

l = []
for i in range(N):
    l.append((1+p[i])/2)

a = [0] * N
a[0] = l[0]
for i in range(1,len(l)):
    a[i] = a[i-1] + l[i]

x = a.index(max(a))
print(max(a) - a[x-K],a,l)
# Judge status: Accepted
n=list(input())
x=[]
for i in n:
  x.append(int(i))
out=int(n[0])-1+(len(n)-1)*9

if x[1:]==[9]*(len(n)-1) or len(n)==1:
  out=sum(x)
print(out)
# Judge status: Accepted
import sys
from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
import collections
from collections import deque 

input = sys.stdin.readline

def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
def _dbg(obj):
    print(obj, file=sys.stderr)

# ---------------------------------------

N, K = inpl()
h = inpl()

INF = 10**10

dp = [INF] * N
dp[0] = 0

for j in range(1, N):
    for step in range(1, min(K, j)+1):
        dp[j] = min(dp[j], dp[j-step] + abs(h[j] - h[j-step]))
    _dbg(dp[1])

print(dp[N-1])
# Judge status: Wrong Answer
n = int(input())
flag = 0
ans = 0
if len(str(n)) > 2:
    ans += (len(str(n)) - 2) * 9
    X = n // 10 ** (len(str(n)) - 2)
    if str(n % 10 ** (len(str(n)) - 2)).count('9') == len(str(n)) - 2:
        flag = 1
else:
    X = n
if len(str(X)) == 1:
    ans += X
else:
    if X == 10:
        ans += 9
        flag = 0
    else:
        ans += (X // 10 - 1) + 9
if flag:
    ans += 1
print(ans)
# Judge status: Wrong Answer
N, L = map(int, input().split())
S = []
for x in range(N):
    S.append(input())

S = sorted(S)
print(" ".join(S))
# Judge status: Wrong Answer
import math

def distance(a, b):
    return math.sqrt((a[0] - b[0]) ** 2 + (a[1] - b[1]) ** 2)

def recursive(pos):
    if len(pos) == 1:
        return 0
    dist = 0
    for p in range(len(pos) - 1):
        dist += distance(pos[0], pos[p + 1])
    return dist

N = int(input())
pos = []
for i in range(int(N)):
    p = input().split(" ")
    pos.append([int(p[0]), int(p[1])])

print(recursive(pos))
# Judge status: Accepted
import collections
n=int(input())
a=list(map(int,input().split()))
c = collections.Counter(a)
b=[0,0]
d=[0,0]
for i in c:
    if c[i]>=4:
        b.append(i)
    elif c[i]>=2:
        d.append(i)
b.sort(reverse=True)
d.sort(reverse=True)
if b[0]>d[0]:
    print(b[0]*b[0])
elif b[0]<d[1]:
    print(d[0]*d[1])
else:
    print(b[0]*d[0])
# Judge status: Accepted
s=input()
if s[-1]=='s':
	print(s+'es')
else:
	print(s+'s')
# Judge status: Accepted
from collections import Counter

N = int(input())
A_array = list(map(int, input().split()))
Ai_dict = Counter(A_array)


def calc_comb(dct):
    num = 0
    for k,v in dct.items():
        num += v*(v-1)/2
    return int(num)


res_dict = dict([])
TotalComb = calc_comb(Ai_dict)

for n in A_array:
    if not n in res_dict.keys():
        res_dict[n] = TotalComb - Ai_dict[n]+1
    print(res_dict[n])
# Judge status: Accepted
import sys,math,collections,itertools
input = sys.stdin.readline

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

for i in range(K):
    imo = [0]*(N+1)
    flag = 1
    for j in range(N):
        imo[max(0,j-A[j])] += 1
        imo[min(N,j+A[j]+1)] -= 1
        if j-A[j]>0 or j+A[j]+1<N:
            flag = 0
    A = list(itertools.accumulate(imo))[:-1]
    if flag == 1:
        break
print(*A)
# Judge status: Accepted
[A,B,N] = list(map(int,input().split()))

W = N//B
dammy=[]
x=N
dammy.append((A*x)//B - A * int(x/B))
x=(B * W)-1
dammy.append((A*x)//B - A * int(x/B))


print(max(dammy))
# Judge status: Wrong Answer
n=int(input())
l=[list(map(int,input().split())) for i in range(n-1)]

for i in range(n-1):
  t=l[i][1]
  t+=l[i][0]
  for j in range(i+1,n-1):
    temp_t=t-l[j][1]
    if temp_t<0:
      t=l[j][1]
    elif temp_t%l[j][2]!=0:
      t+=temp_t%l[j][2]
    t+=l[j][0]

  print(t)
print(0)
# Judge status: Accepted
a,b=map(int,input().split())

ans=0

for i in range(a,b+1):
    buf=str(i)
    #print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])
    str1=buf[0:int(len(buf)/2)]
    str2=buf[int(len(buf)/2+1):]
    if str1[0]==str2[1] and str1[1]==str2[0]:
        ans+=1

print(ans)
# Judge status: Accepted
a, b, k = map(int, input().split())
for i in range(a, min(b, a+k-1)+1):
    print(i)
for i in range(max(b-k+1, a+k), b+1):
    print(i)
# Judge status: Accepted
N=int(input())
W = [int(x) for x in input().split()]
for i in W:
    if i%2==0:
        if i%10==0 or i%6==0:
            pass
        else:
            print("DENIED")
            exit()
print("APPROVED")
# Judge status: Accepted
import sys
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]

N, M = ri_()
if N == 1 and M == 1:
    print(1)
elif N == 1:
    print(M - 2)
elif M == 1:
    print(N - 2)
else:
    print((N - 2) * (M - 2))
# Judge status: Accepted
n,k = map(int, input().split())
hl = list(map(int, input().split()))

hl.sort(reverse=True)

if k >= n:
    print(0)
    exit()

rem_hl = hl[k:]
rem_sum = sum(rem_hl)
print(rem_sum)
# Judge status: Accepted
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)
N = int(input())
A = list(map(int,input().split()))
print(gcd(*A))
# Judge status: Accepted
import heapq
l,r = map(int,input().split())
mod = 2019
ans = 2018
if r-l>=2018:
    print(0)
else:
    for i in range(l,r+1):
        for j in range(i+1,r+1):
            ans = min(ans,(i*j)%mod)
    print(ans)
# Judge status: Accepted
from sys import stdin
n,a,b = [int(x) for x in stdin.readline().rstrip().split()]

saisyou = a*(n-1)+b
saidai = b*(n-1)+a

if n == 1 and a!= b:
    print(0)
    exit()
elif a > b:
    print(0)
    exit()
else:
    print(saidai-saisyou+1)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

def main():
   N, K = map(int, input().split()) 
   NUM = [i for i in range(N+1)]
   LOWER = 0
   UPPER = 0
   CNT = 0
   for j in range(K):
       LOWER += NUM[j]
       UPPER += NUM[N-j]
   for i in range(N+1):
       if i + K >= N+1:
           CNT += 1
           break
       CNT += UPPER -LOWER + 1
       LOWER += NUM[K+i]
       UPPER += NUM[N-(K+i)]
   print(CNT)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n,k=map(int,input().split())
d=set([int(x) for x in input().split()])
for i in range(n,100001):
    flag=True
    for j in str(d):
        if j in str(i):
            flag=False
            break
    if flag==True:
        print(i)
        exit()
# Judge status: Accepted
a,b=map(int,input().split())
if a==b:
    print('Draw')
elif a==1 :
    print('Alice')
elif b==1:
    print('Bob')
elif a>b:
    print('Alice')
else:
    print('Bob')
# Judge status: Accepted
n = int(input())
a = [0 for i in range(13)]
for i in map(int, input().split()):
    a[i // 400] += 1
ans = 0
add = 0
for i in range(8):
    if a[i]:
        ans += 1
for i in range(8,13):
    if a[i]:
        add += a[i]
if ans == 0:
    print(1, add)
else:
    print(ans, ans+add)
# Judge status: Accepted
N,K = map(int,input().split())
ruiseki = [0]*(N+1)
now = 0
maximum = -999999999
ans = 0
p = list(map(int,input().split()))
for i in range(N):
    now += p[i]
    ruiseki[i+1] = now
for i in range(0,N-K+1):
    P = ruiseki[i+K]-ruiseki[i]
    if P > maximum:
        maximum = P
        Q = p[i:i+K]
for i in range(len(Q)):
    ans += (0.5*Q[i]*(Q[i]+1))/Q[i]
print(ans)
# Judge status: Wrong Answer
A,B,C,X,Y=map(int,input().split())
ans_2=A*X+B*Y
ans=min(X,Y)*2*C
mindelta=10**20
for i in range(1,max(X,Y)+1-min(X,Y)):
    delta=0
    if X>Y:
        delta=2*C*i+A*(max(X,Y)-min(X,Y)-i)
        if delta<mindelta:
            mindelta=delta
    if Y>X:
        delta=2*C*i+B*(max(X,Y)-min(X,Y)-i)
    if delta<mindelta:
        mindelta=delta
val=min([ans+mindelta,ans_2])
print(val)
# Judge status: Accepted
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
  
n,m = map(int,input().split())

su = combinations_count(n+m, 2)
mm = n*m
ans = su-mm

print(str(ans))
# Judge status: Accepted
s = input()
op = ['+', '-']
for i in range(2):
    for j in range(2):
        for k in range(2):
            t = ''.join([s[0], op[i], s[1], op[j], s[2], op[k], s[3]])
            if eval(t) == 7:
                print(t + '=7')
                quit()
# Judge status: Wrong Answer
a,b=map(int,input().split())
print (a,b);
# Judge status: Wrong Answer
a, b = map(int, input().split())
i = 1
c = 2
while i <= b:
    i += c
    c += 1
print(i-b)
# Judge status: Accepted
import sys
x,a,b = map(int,input().split())
if x < 0 or a < 0 or b < 0 or x > 1000 or a > 1000 or b > 1000:
    sys.exit()

if abs(x-a) > abs(x-b):
    print("B")
if abs(x-a) < abs(x-b):
    print("A")
# Judge status: Accepted
N = int(input())
A = []
B = []
a_max = -float("inf")
a_min = float("inf")
b_max = -float("inf")
b_min = float("inf")
for _ in range(N):
    x, y = map(int, input().split())
    a_max = max(a_max, x-y)
    a_min = min(a_min, x-y)
    b_max = max(b_max, x+y)
    b_min = min(b_min, x+y)
print(max(a_max-a_min, b_max-b_min))
# Judge status: Wrong Answer
N=int(input())
S=input()
ans=0
max_ans=0
for i in range(N):
  if i=='I':
    ans+=1
    if max_ans<ans:
      max_ans=ans
  else:
    ans-=1
print(max_ans)
# Judge status: Wrong Answer
import sys
import math

N = int(input())
print(math.ceil((N+1)/11*2))
# Judge status: Accepted
#abc061 a 
a,b,c=map(int,input().split())
if a<=c<=b:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, m = map(int, input().split())
d = {}
for i in range(m):
    p, s = input().split()
    d.setdefault(p, [])
    d[p].append(s)

cnt = 0; correct = 0
for v in d.values():
    if "AC" not in v:
        continue
    correct += 1
    cnt += v.index("AC") 

print(correct, cnt)
# Judge status: Accepted
N, K = map(int, input().split())
p = sorted(list(map(int, input().split())))

print(sum(p[:K]))
# Judge status: Wrong Answer
N = input()
fizz = list()
for i in range(int(N)):
    if not i // 3==0 and not i//5==0:
        fizz.append(i)
print(sum(fizz))
# Judge status: Accepted
a,b,c = map(int,input().split())

if a + b == c:
    print('Yes')
elif a + c == b:
    print('Yes')
elif b + c == a:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n=int(input())
if (n==1):
    print(1)
    exit()
if (n%2==0) :
    print(n//2-1)
    print(n//2+1)
else :
    print(n//2)
    print(n//2+1)
# Judge status: Accepted
s = input()
ans = 0
for i in range(len(s) // 2):
  if s[i] != s[len(s)-i-1]:
    ans += 1
print(ans)
# Judge status: Accepted
n,m=map(int,input().split())

if m>=2 and n>=2:
    print((n-2)*(m-2))
elif m==1 and n>=2:
    print(n-2)
elif n==1 and m>=2:
    print(m-2)
else:
    print(1)
# Judge status: Wrong Answer
N,W = map(int,input().split())
w = []
v = []
for i in range(N):
    x,y = map(int,input().split())
    w.append(x)
    v.append(y)

dp = [[0]*(W+1) for j in range(N+1)]

for i in range(N):
    for j in range(W+1):
        if j < w[i]:
            dp[i][j] = dp[i+1][j]
        else:
            dp[i][j] = max(dp[i+1][j],dp[i+1][j-w[i]]+v[i])
print(dp[0][W])
# Judge status: Accepted

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

if a >= 13:
    print(b)
elif 6 <= a <= 12:
    b = int(b/2)
    print(b)
elif a <= 5:
    print(0)
# Judge status: Wrong Answer
import collections
a = input().strip().split()
number = a.pop(0)
clist = collections.Counter(a)
print(len(clist))
# Judge status: Wrong Answer
s = input()

arr = []

for i in range(0, len(s) - 2):
    arr.append(753 - int(str(s[i]) + str(s[i + 1]) + str(s[i + 2])))

print(min(arr))
# Judge status: Accepted
x = int(input())
d = x%100
c = 0
for i in [5,4,3,2,1]:
    c += d//i
    d = d%i
if c*100 + x%100 > x:
    print(0)
else:
    print(1)
# Judge status: Accepted
import math
import sys
import itertools
from math import gcd
from math import sqrt
from sys import stdin
def input() : return stdin.readline().rstrip()
def mips():
    return map(int,input().split())
def ii():
    return int(input())
sys.setrecursionlimit(10**9)

X,Y = mips()
#X = tsuru + kame
#Y = 2 * tsuru + 4 * kame
for t in range(0,100):
    kame = X-t
    if kame < 0:
        break
    if 2 * t + 4 * kame == Y:
        print("Yes")
        sys.exit(0)
print("No")
# Judge status: Wrong Answer
s = input()
K = int(input())

for i,c in enumerate(s):
	x = ord('z')-ord(c)+1
	if x <= K:
		s = s[:i]+'a'+s[i+1:]
		K -= x

print(s[:-1]+chr((ord(s[-1])-ord('a')+K)%26+ord('a')))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range(n):
    if b[i]<=a[i]: ans+=b[i]
    elif b[i]>a[i]+a[i+1]:
        ans+=a[i]+a[i+1]
        a[i+1]=0
    else:
        ans+=b[i]
        a[i+1]+a[i]-b[i]
print(ans)
# Judge status: Wrong Answer
import math
import sys
import collections
import bisect
readline = sys.stdin.readline


def main():
    keyence = "keyence"
    s = list(readline().rstrip())
    lenS = len(s)
    cnt = 0
    for i in range(lenS):
        if keyence[cnt] == s[i]:
            cnt += 1
        if cnt == 7:
            print("YES")
            return
    print("NO")


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a, b = map(int, input().split())
s = min(a, b)
cnt = 0
print(s)

for i in (str(s+1)):
  if a == i and b == i:
    cnt += 1
# Judge status: Wrong Answer
l,r = map(int, input().split())
d,e = map(lambda x: x%2019, (l,r))
print((d*(d+1))%2019) if d < e else print(0)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
import fractions
ans=A[0]
for i in range(1,N):
  ans=ans*A[i]//fractions.gcd(ans,A[i])

w=0
for i in A:
  w+=(ans//i)%(10**9+7)
  
print(w)
# Judge status: Accepted
A,B,K = map(int,input().split())
if (2*K)<(B-A+2):
  for i in range(A,A+K):
    print(i)
  for i in range(B-K+1,B+1):
    print(i)
else:
  for i in range(A,B+1):
    print(i)
# Judge status: Accepted
def main():
    import sys
    def input():
        return sys.stdin.readline()[:-1]
    X=int(input())
    A=[399.99+200*i for i in range(8)]
    A.append(X)
    A.sort()
    print(9-A.index(X)) 




if __name__ == '__main__':
    main()
# Judge status: Accepted
#!/usr/bin/env python
# coding: utf-8

# In[71]:


s = input()
t = input()


# In[74]:


s_list = "".join(sorted(s))
t_list = "".join(sorted(t, reverse=True))
if s_list < t_list:
    print("Yes")
else:
    print("No")


# In[ ]:
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = 0
for i in range(1,n-1):
    if a[i-1] < a[i] < a[i+1] or a[i-1] > a[i] > a[i+1]:
        ans += 1
print(ans)
# Judge status: Wrong Answer
print("Christmas", "Eve"*(25-int(input())))
# Judge status: Accepted
n = int(input())
w = [input()]
for i in range(n-1):
  s = input()
  if s in w or w[i][-1] != s[0]:
    print("No")
    exit()
  w.append(s)
print("Yes")
# Judge status: Accepted
S = input()
l = list(set(S))
if len(l) == 0:
    print("Yes")
elif len(l) % 2 == 1 :
    print("No")
else :
    if ("N" in l and "S" in l) or ("W" in l and "E" in l) :
        print("Yes")
    else :
        print("No")
# Judge status: Accepted
import fractions as math

n,x = map(int,input().split())
s = list(map(int,input().split()))

a = []
for i in s:
    a.append(abs(i-x))

tmp = a[0]
for i in range(1,len(a)):
    tmp = math.gcd(tmp,a[i])

print(tmp)
# Judge status: Accepted
n = int(input())
d = {}
for ai in input().split():
  ai = int(ai)
  if ai not in d:
    d[ai] = 0
  d[ai] += 1

n2 = [k for k in d if d[k] > 1]
n4 = [k for k in d if d[k] > 3]

n2.sort(reverse = True)
n4.sort(reverse = True)

ans = 0

if n4:
  ans = n4[0] ** 2

if len(n2) > 1:
  ans = max(ans, n2[0] * n2[1])

print(ans)
# Judge status: Wrong Answer
N, K = map(int, input().split())
li = sorted([tuple(map(int, input().split())) for _ in range(N)], key=lambda x: x[1])
print(li)
cnt = 0
for a, b in li:
    cnt += b
    if cnt >= K:
        print(a)
        break
# Judge status: Wrong Answer
n=int(input())
a=[int(x) for x in input().split()]
b=[int(x) for x in input().split()]
c=[int(x) for x in input().split()]
ans=b[a[0]-1]
for i in range(1,n):
    ans+=b[a[i]-1]
    if a[i-1]+1 == a[i]:
        ans+=c[i-1]
print(ans)
# Judge status: Wrong Answer
def test(a, b):
    if a > 0:
        return 'Positive'
    if a <= 0 and b >= 0:
        return 'Zero'
    else:
        if (b - a + 1) % 2 == 0:
            return 'Positive'
        else:
            return 'Negative'
# Judge status: Accepted
W,H,x,y=map(int,input().split())
if W/2==x and H/2==y:
 lst=[W*H/2,1]
else:
 lst=[W*H/2,0]
print(*lst)
# Judge status: Wrong Answer
a,b,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
lists = [list(map(int,input().split())) for i in range(m)]
a.sort()
b.sort()
Min = min(a) + min(b)
for x,y,c in lists:
    Min = min(Min,a[x-1] + b[y-1] - c)
print(Min)
# Judge status: Accepted
import sys

if __name__ == "__main__":
    N = int(input())
    X = []
    for _ in range(N):
        x, l = [int(x) for x in input().split(" ")]
        X.append((x - l, x + l))

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

    count = 0
    max_high = -sys.maxsize
    for low, high in X:
        if max_high <= low:

            count += 1
            max_high = high
    print(count)
# Judge status: Accepted
a,b,c = map(int,input().split())

print('YES' if b-a == c-b else 'NO')
# Judge status: Accepted
N = int(input())
S = [int(input()) for _ in range(N)]
S.sort()
total = sum(S)
if total%10 != 0:
  print(total)
  exit()
else:
  for i in S:
    if i %10 != 0:
      print(total-i)
      exit()
print(0)
# Judge status: Accepted
a = int(input())

if a<3200:
  print("red")
else:
  print(input())
# Judge status: Wrong Answer
N = int(input())
L = []
light = [0]*N
light[0] = 1
cnt = []

for i in range(N):
    a = int(input())
    L.append(a)

for i in range(N):
    if light[i] == 1:
        if light[i] != light[L[i]-1]:
            light[i], light[L[i]-1] = 0, 1
            cnt.append(i)
    if light[1] == 1:
        print(len(set(cnt)))
        exit()

print(-1)
# Judge status: Accepted
x,y=map(int,input().split())
if x==1 and x*4>=y and y%2==0 and x*2<=y:
  print('Yes')
elif x*4>= y and y%2==0 and x*2<=y:
    print('Yes')
else:
  print('No')
# Judge status: Accepted
S=input()
T=input()
if len(T)-len(S)==1 and S==T[:-1]:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
def make_divisors(n):
    lower_divisors , upper_divisors = [], []
    i = 1
    while i*i <= n:
        if n % i == 0:
            lower_divisors.append(i)
            if i != n // i:
                upper_divisors.append(n//i)
        i += 1
    return lower_divisors + upper_divisors[::-1]


n,m=map(int,input().split())

mlis=make_divisors(m)

I=1
for i in mlis:
    if m<i*n:
        break
    else:
        I=i
    
print(I)
# Judge status: Wrong Answer
from math import ceil
from math import floor
a,b = map(int,input().split())
l1 = ceil((a-0.50001)/0.08)
r1 = floor((a+0.5)/0.08)
l2 = ceil((b-0.50001)/0.1)
r2 = floor((b+0.5)/0.1)
l3 = max(l1,l2)
r3 = min(r2,r1)
if(l3<=r3):
    print(l3)
else:
    print(-1)
# Judge status: Accepted
s = input()

z_g = 0
z_k = 0
o_g = 0
o_k = 0

for i in range(len(s)):
    if i % 2 == 0:
        if s[i] == "0":
            z_g += 1
        else:
            o_g += 1
    else:
        if s[i] == "0":
            z_k += 1
        else:
            o_k += 1

if (z_g + o_k) > (z_k + o_g):
    print(z_k + o_g)
else:
    print(z_g + o_k)
# Judge status: Wrong Answer
a, b = map(int, input().split())

count = 0

for kk in range(a, b):
    if str(kk)[0] == str(kk)[4] and str(kk)[1] == str(kk)[3]:
        count += 1
        
print(count)