peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
N=int(input())
if N>=1000:
    print('ABD')
else:
    print('ABC')
# Judge status: Accepted
N, M = map(int, input().split())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]
flag = False
for i in range(N-M+1):
  for j in range(N-M+1):
    tmp = True
    for k in range(i,i+M):
      if A[k][j:j+M] != B[k-i]:
        tmp = False
    if tmp:
      flag = True
      break
  if flag:
    break
if flag:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
N, M = map(int, input().split())
c = [0]*(N+1)
for i in range(M):
    a, b = map(int, input().split())
    c[a] += 1
    c[b] += 1
for i in range(N):
    print(c[i+1])
# Judge status: Accepted
s = input()
lis = ['Sunny', 'Cloudy', 'Rainy']
if s == lis[0]:
    print(lis[1])
if s == lis[1]:
    print(lis[2])
if s == lis[2]:
    print(lis[0])
# Judge status: Wrong Answer
n,k,s=map(int,input().split())
li=[]
for i in range(k):
    li.append(s)
for i in range(n-k):
    li.append(s+1)
print(li)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

res = 0
tmp = 0
for i, a in enumerate(A):
    if a == i + 1:
        tmp += 1
    else:
        res += (tmp - 1) // 2 + 1
        tmp = 0
res += (tmp - 1) // 2 + 1
print(res)
# Judge status: Accepted
a,b=map(int,input().split())
if a>=13:
    print(b)
elif 6<=a<=12:
    print(b//2)
elif a<=5:
    print(0)
# Judge status: Wrong Answer
import sys
N = input()
s = N[-1]
if s in ['2','4','5','7','9']:
  print('hon')
  sys.exit(0)
if s in ['0','1','6','8']:
  print('pon')
  sys.exit(0)
if s == '3':
  print('bon')
# Judge status: Accepted
s,w=map(int,input().split())
if s <= w:print("unsafe")
else:print("safe")
# Judge status: Accepted
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N = I()
a = LI()

s,t = 0,0  # 4の倍数の個数、4の倍数でない偶数の個数
for i in range(N):
    if a[i] % 4 == 0:
        s += 1
    elif a[i] % 2 == 0:
        t += 1

if s >= N//2 or t >= N-2*s:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())

max_1 = 0
max_2 = 0
max_index = 0

for i in range(n):
    item = int(input())
    if item >= max_1:
        max_1, max_2 = item, max_1
        max_index = i
    elif item > max_2:
        max_2 = item

for i in range(n):
    ans = max_2 if i == max_index else max_1
    print(ans)
# Judge status: Accepted
import bisect
import math
N, H = map(int, input().split())
A = []
B = []
for i in range(N):
  a, b = map(int, input().split())
  A.append(a)
  B.append(b)
am = max(A)
B.sort()
idx = bisect.bisect_right(B, am)
ans = 0
for i in range(1, N-idx+1):
  H -= B[-i]
  ans += 1
  if H <= 0:
    print(ans)
    exit()
print(ans + math.ceil(H/am))
# Judge status: Accepted
ordA = ord('A')

N = int(input())
Ss = input().rstrip()

anss = ''
for S in Ss:
    S = ord(S) - ordA
    anss += chr(ordA + (S+N)%26)

print(anss)
# Judge status: Wrong Answer
a, b =map(int, input().split())

for x in range(0,10001):
    print('---')
    print(x)
    ax = (8*x)//100
    bx = (10*x)//100
    print(ax,bx)
    if ax == a and bx == b:
        print(x)
        break
else:
    print(-1)
# Judge status: Accepted

n=int(input())
p=list(map(int,input().split()))
count=0
for i in range(1,n-1):
    if (p[i-1]<p[i] and p[i]<p[i+1]) or (p[i-1]>p[i] and p[i]>p[i+1]):
        count+=1
    else:
        continue
print(count)
# Judge status: Accepted
n,m = map(int,input().split())
import math
mod  = 10**9+7
if abs(m-n) >= 2:
    print(0)
elif abs(m-n) == 1:
    print((math.factorial(m)*math.factorial(n))%mod)
else:
    print((2*math.factorial(m)*math.factorial(n))%mod)
# Judge status: Accepted
n=int(input())
c=list(map(int,input().split()))
minimum=100000000
count=0
for i in range(len(c)):
    if c[i]<minimum:
        minimum=c[i]
    if c[i]<=minimum:
        count+=1
print(count)
# Judge status: Wrong Answer
N = int(input()) #1行目のNを取得する
A = list(map(int,input().split())) 

result = 0

for i in range(N):
    if i % 2 == 1 and A[i] % 2 == 1:
        result += 1

print(result)
# Judge status: Accepted
A = input()
A = list(A.split())
sum = 0

for i in A:
  sum += int(i)

if sum >= 22:
  print('bust')
else:
  print('win')
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    S = input()
    ans = 1000
    for i in range(len(S) - 2):
        ans = min(ans, abs(753 - int(S[i:i+3])))
    print(ans)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N = int(input())
x = [0] * N
y = [0] * N
for i in range(N):
    x[i], y[i] = map(int, input().split())
          


n = 0
for i in range(N-1):
    if x[i] == y[i]:
        n = n+1
    elif n >=3:
        break
    else:
        n = 0

if n >= 3:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def solve():
    n = int(input())
    a = list(map(int, input().split()))

    b = a[1::2]
    c = a[::2]
    
    if len(a)%2 == 0:
        return b[::-1] + c
    else:
        return c[::-1] + b
    

print(*solve())
# Judge status: Accepted
N, K = map(int, input().split())
S = list(input())
S[K-1] = S[K-1].lower()
print(''.join(S))
# Judge status: Accepted
A, B, C, D = map(int, input().split())

while True:
  C -= B
  if C <= 0:
    print('Yes')
    exit()
  A -= D
  if A <= 0:
    print('No')
    exit()
# Judge status: Accepted
N, D = map(int, input().split())
D = D * D
A = 0
for _ in range(N):
  X, Y = map(int, input().split())
  if X * X + Y * Y <= D: A += 1
print(A)
# Judge status: Accepted
s = int(input())
mod = 10**9+7
def inv(x):
  y = 1
  while x != 1:
    y *= mod //x + 1
    y %= mod
    x -= mod % x
  return y
#print(inv(5))
ans = 0
for l in range(1,1000000):
  if s - 3*l < 0:
    print(ans)
    exit()
  tmp = 1
  for i in range(l-1):
    tmp *= s-2*l-1-i
    tmp *= inv(i+1)
    tmp %= mod
  #print(tmp)
  ans += tmp
  ans %= mod
#print(tmp)
# Judge status: Accepted
A, B = map(int, input().split())

if A == 1:
  A = 14
if B == 1:
  B = 14

if A > B:
  print("Alice")
elif A < B:
  print("Bob")
else:
  print("Draw")
# Judge status: Accepted
# A - 753

X = int(input())

if X == 3 or X == 5 or X == 7:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
import sys
from collections import Counter
from collections import deque
import math
def input(): return sys.stdin.readline().strip()
def mp(): return map(int,input().split())
def lmp(): return list(map(int,input().split()))

n,m=mp()
for i in range(m//n,0,-1):
    s,a=divmod(m,i)
    if a%s==0:
        print(i)
        exit()
# Judge status: Wrong Answer
A, B, C = sorted(list(map(int, input().split())))
print(A, B, C)
r = C-B
B += r
A += r
print(A, B, C)
s = C-A
if s % 2 == 0:
    s = s//2
else:
    s = (s//2) + 2
print(r+s)
# Judge status: Accepted
import itertools

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

for i in itertools.combinations(L, 3):
    if i[0] != i[1] and i[0] != i[2] and i[2] != i[1]:
        if i[0] + i[1] > i[2] and i[1] + i[2] > i[0] and i[2] + i[0] > i[1]:
            cnt += 1


print(cnt)
# Judge status: Accepted
s = input()
rev_s = s[::-1]

key = "keyence"
label = [[key[:i], key[i:][::-1]] for i in range(len(key)+1)]

flag = False
for i, l in enumerate(label):
  if s[:i] == l[0] and rev_s[:len(l[1])] == l[1]:
    flag = True
    break
print("YES" if flag else "NO")
# Judge status: Wrong Answer
from collections import Counter

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

l = []
counter = 0

for k in range(K):
    d = int(input())
    A = map(int, input().split())
    l.extend(A)

for i in range(1,K+1):
    if Counter(l)[i]==0:
        counter += 1
    else:
        continue
        
print(counter)
# Judge status: Wrong Answer
N, P = map(int, input().split())
biscuits = list(map(int, input().split()))
gu = 0
ki = 0
for i in range(N):
    if biscuits[i] % 2 == 0:
        gu += 1
    else:
        ki += 1
if (P == 1 and ki == 0) or (P == 0 and gu == 0):
    print(0)
elif gu == N:
    print(pow(2,N))
else:
    print(pow(2,N-1))
# Judge status: Wrong Answer
x = str(input())
a =x[0]
b=x[1]
c=x[2]


print(a+b+c)
# Judge status: Accepted
S = int(input())
M = 10 ** 9
X3 = -S % M
print(0, 0, M, 1, X3, (S + X3) // M)
# Judge status: Wrong Answer
n,m = map(int,input().split())
ls = []
for i in range(m):
    p,m = map(str,input().split())
    ls.append([p,m])
    
ac = 0
wa = 0
now = ""
for i in ls:
    if now == i[0]:
        continue
    if i[1] == "AC":
        now = i[0]
        ac += 1
    elif i[1] == "WA":
        wa += 1
        
print(ac,wa)
# Judge status: Accepted
N = int( input() )
A = list( map( int, input().split() ))

ret = 0
bafore = A[0]
for a in A:
  if bafore > a:
    ret += bafore - a
  bafore = max( a, bafore )
    
print( ret )
# Judge status: Accepted
n = int(input())
a = input().split()

if n & 1:
  print(' '.join(a[::-2]+a[1::2]))
else:
  print(' '.join(a[-1:0:-2]+a[::2]))
# Judge status: Wrong Answer
a,b = map(int,input().split())
if a+b > 24:
    print((a+b)%24)
else:
    print(a+b)
# Judge status: Accepted
import math

N = int(input())
T = [0] * 5
for i in range(5):
    T[i] = int(input())
ans = math.ceil(N / min(T)) + 4
print(ans)
# Judge status: Accepted
N = int(input())
ans = [0 for i in range(N)]
import math
for i in range(N-1):
  c, s, f = map(int, input().split())
  for j in range(i+1):
    if ans[j]>=s:
      x = math.ceil((ans[j]-s)/f)
      ans[j] = s+f*x+c
    else:
      ans[j] = s+c
for i in range(N):
  print(ans[i])
# Judge status: Wrong Answer
from sys import stdin

list(stdin.readline())

[int(x) for x in list(stdin.readline())]
# Judge status: Wrong Answer
n = int(input())
s = input()

# 左側の黒の個数, 右側の白の個数
ans = n
b, w = 0, s.count('.')
for i in range(n):
    if s[i] == '#':
        b += 1
    elif s[i] == '.':
        w -= 1
    ans = min(ans, b+w)
print(ans)
# Judge status: Accepted
n, m, x, y = map(int, input().split())

x_list = list(map(int, input().split()))
y_list = list(map(int, input().split()))

x_max = max(x_list)
y_min = min(y_list)

if (x_max < y_min) and (x_max+1 > x and y_min <= y):
    print('No War')
else:
    print('War')
# Judge status: Wrong Answer
import math
n,k=map(int,input().split())

x=0
ans=0
for i in range(1,n+1):
    if k/i<=1:
        x=0
    else:
        x=int(math.log2(k/i))+1
    ans+=(1/n)*(1/2)**x
print(ans)
# Judge status: Wrong Answer
import math
import sys
MOD = 1000000007

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

if n == 1:
    print(m)
    sys.exit()

ans = 1
for i in range(1, int(math.sqrt(m))):
    if i > m/n:
        break
    if m % i == 0:
        ans = i

print(ans)
# Judge status: Accepted
from collections import Counter
import sys
MOD = 998244353

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

aa = Counter(a)
ma = max(aa)

def po(x,n):
    k = 1
    for i in range(n):
        k = k*x % MOD
    return k

if aa[0] != 1 or a[0] != 0:
    print(0)
    sys.exit()
    
ans = 1
for i in range(ma):
    c,d = aa[i],aa[i+1]
    if c == 0 or d == 0:
        print(0)
        sys.exit()
    else:
        ans = ans * po(c,d) % MOD
        
print(ans)
# Judge status: Accepted
n = int(input())
As = sorted(map(int, input().split()), reverse=True)
print(sum(As[::2])-sum(As[1::2]))
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

even = [a[i] for i in range(1,n,2)]
odd = [a[i] for i in range(0,n,2)]

if n % 2 == 0:
  print(*(even[::-1]+odd))
else:
  print(*(odd[::-1]+even))
# Judge status: Accepted
A = int(input())
if A == 1:
  print(0)
else :
  print(1)
# Judge status: Accepted
n = int(input())
X = list(map(int,input().split()))
h = int(n/2)
Xs = sorted(X)
m1 = Xs[h-1]
m2 = Xs[h]

for i in range(n):
  if X[i] <= m1:
    print(m2)
  else:
    print(m1)
# Judge status: Accepted
n,k = map(int,input().split())
s = input()
flag = [0]*n
f = s[0]
cnt  = 0
for i,t in enumerate(s):
    if t == 'L':
        if i != 0 and s[i-1] == 'L':
            flag[i] = 1
    if t == 'R':
        if i != n-1 and s[i+1] == 'R':
            flag[i] = 1
    if t == f and i != n-1 and s[i+1] != f:
        cnt += 1
ans = sum(flag)
if s[-1] == f:
    ans += min(k,cnt)*2
else:
    ans += 2*cnt - 1 if cnt <= k else 2*k
print(ans)
# Judge status: Accepted
n = int(input())
c = input()

count = c.count('R')
ans = 0

for i in range(n):
    if c[i] == 'R' and i >= count:
        ans += 1
print(ans)
# Judge status: Wrong Answer
N,M = map(int,input().split())
X =[]
for i in range(N):
    a,b = map(int,input().split())
    X.append([a,b])
X.sort(key=lambda x: x[0])
count = 0
ans = 0
for i in X:
    if M - count > i[1]:
        count += i[1]
        ans += i[0] * i[1]
        print(ans,count)
    else:
        x = M - count
        ans += i[0] * x
        break
print(ans)
# Judge status: Wrong Answer
import collections
n = int(input())
a = list(map(int, input().split()))
l = collections.Counter(a)
#print(l)
v = list(l.keys())
#print(v)
ans = 0
for i in v:
    ans += min(abs(l.get(i)-i),l.get(i))
print(ans)
# Judge status: Accepted
n = int(input())
l = list(map(int, input().split()))

L = [0]*n

for i, order in enumerate(l, 1):
    L[order-1] = i

print(*L)
# Judge status: Wrong Answer
N=int(input())
A=list(map(int,input().split()))
list=[]
for i in range(100):
    list.append(0)
ans=0
mod=(10**9)+7

print(list)
# Judge status: Accepted
s = input()
l = len(s)
ans = 0
search = l-1

if search < 2:
    print(0)
    exit()

while search >= 2:
    if search % 2 == 0:
        if s[0:search//2] == s[search//2:search]:
            ans = max(ans, search)
    else:
        pass
    search -= 1
print(ans)
# Judge status: Accepted
n, m = map(int, input().split())
road = [[] for _ in range(n)]
for _ in range(m):
    i, j = map(int, input().split())
    road[i-1].append(j-1)
    road[j-1].append(i-1)

# BFS
from collections import deque
ans = [-1] * n
todo = deque()
todo.append(0)
while len(todo) > 0:
    i = todo.popleft()
    for j in road[i]:
        if ans[j] > -1:
            continue
        ans[j] = i
        todo.append(j)

print('Yes')
for i in range(1, n):
    print(ans[i] + 1)
# Judge status: Accepted
# 前から順番に後ろに向けてswap
n = int(input())
ps = list(map(int, input().split()))

cnt = 0
for i in range(n-1):
    if i + 1 == ps[i]:
        tmp = ps[i]
        ps[i] = ps[i+1]
        ps[i+1] = tmp
        cnt += 1
# 最後残っていたら直前とswap
if ps[n-1] == n:
    cnt += 1

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

# A - Candy Distribution Again
N, x = map(int, input().split())
a = list(map(int, input().split()))

a.sort()
candies = 0
ans = 0

for ai in a:
	if candies < x:
		candies += ai
		ans += 1
	else:
		break

if candies != x:
	ans -= 1

print(ans)
# Judge status: Accepted
c11 ,c12, c13 = map(int,input().split())
c21 ,c22, c23 = map(int,input().split())
c31 ,c32, c33 = map(int,input().split())

if c11 - c12 == c21 -c22 == c31-c32 and c12 - c13 == c22 -c23 == c32-c33 and c11 - c21 == c12 -c22 == c13-c23 and c21 - c31 == c22 -c32 == c23-c33 :
    print('Yes')
else :
    print('No')
# Judge status: Wrong Answer
n,k = map(int,input().split())
print(n % k) if n >= k else print(1)
# Judge status: Accepted
N=int(input())
H=list(map(int,input().split()))
s=0
t=0
for i in range(N-1):
  if H[i]>=H[i+1]:
    s+=1
  else:
    t=max(s,t)
    s=0
t=max(s,t)
print(t)
# Judge status: Accepted
a = input()
b = ['hi','hihi','hihihi','hihihihi','hihihihihi']

if a in b:
	print("Yes")
else:
	print("No")
# Judge status: Accepted
l=[int(input()) for i in range(3)]

print((l[0]+l[1])*l[2]//2)
# Judge status: Accepted
n=int(input())
s=input()
ais1=ord("A")
res=""
for i in range(0,len(s)):
  res = res + chr((ord(s[i])+n-65)%26+65)
print(res)
# Judge status: Accepted
a,b,c=map(int, input().split())
d=int(input())
ans="No"
k=0
for i in range(d+1):
    b2=b*(2**(d-k))
    c2=c*(2**(k))
    if(a<b2<c2):
        ans="Yes"
    k+=1
print(ans)
# Judge status: Accepted
def factmod(n):
    tmp = 1
    for i in range(1,n+1):
        tmp *= i
        tmp %= (10**9+7)
    return tmp   
N,M = list(map(int,input().split()))
if abs(N-M) > 1:
    print(0)
    exit()
if N == M:
    print((2*(factmod(N)*factmod(M))%(10**9+7)))
else:
    print(factmod(N)*factmod(M)%(10**9+7))
# Judge status: Wrong Answer
n = input()
k = int(input())

if n.count("1") == k:
  print(1)
  exit()

for i in range(k):
  
  if n[i] != "1":
    print(n[i])
    exit()
# Judge status: Accepted
import math
def lcm(x,y):
    return (x*y)//math.gcd(x,y)
a,b,c,d=map(int,input().split())
bc=b//c
bd=b//d
bcd=b//lcm(c,d)
x=b-(bc+bd-bcd)
a=a-1
ac=a//c
ad=a//d
acd=a//lcm(c,d)
y=a-(ac+ad-acd)
print(x-y)
# Judge status: Accepted
def check():
    N,M = map(int, input().split())
    A = [input() for _ in range(N)]
    B = [input() for _ in range(M)]
    
    for i in range(N-M+1):
        for j in range(N-M+1):
            flag = True
            for k in range(M):
                if A[i+k][j:j+M] != B[k]:
                    flag = False
            if flag:
                return 'Yes'
    return 'No'
print(check())
# Judge status: Accepted
import itertools
import fractions
def main():
  S = ['Sunny','Cloudy','Rainy']
  s = input()
  i = 0
  while True:
    if s == S[i]:
      break
    i += 1
  print(S[(i+1)%3])
if __name__ == '__main__':
  main()
# Judge status: Accepted
h,n = map(int,input().split())
a = [int(i) for i in input().split()]

sum_a = sum(a)
if h > sum_a:
    ans = 'No'
else:
    ans = 'Yes'
print(ans)
# Judge status: Wrong Answer
a = int(input())
input_s = input()



if 3200 <= a:
    output_s = ("pink")
elif a <3200:
    output_s = ("red")

print(output_s)
# Judge status: Wrong Answer
import itertools

N = int(input())

permu = [i+1 for i in range(N)]
s = 0
flag = False

P = tuple([int(i) for i in input().split(" ")])
Q = tuple([int(i) for i in input().split(" ")])

print(P)
for i, value in enumerate(itertools.permutations(permu)):
    

    if value == P or value == Q:
        # print(i)
        if flag:
            s -= i
        else:
            s += i
            flag = True

print(abs(s))
# 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[N-1]==N:
    ans+=1
print(ans)
# Judge status: Accepted
s=list(input())
for i in range(len(s)):
    s[i]="x"
print("".join(s))
# Judge status: Accepted
from math import gcd
def readinput():
    n=int(input())
    a=list(map(int,input().split()))
    return n,a

def main(n,a):
    ans=gcd(a[0],a[1])
    for i in range(2,n):
        ans=gcd(ans,a[i])
    return ans

if __name__=='__main__':
    n,a=readinput()
    ans=main(n,a)
    print(ans)
# Judge status: Wrong Answer
n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
sum_a = sum(A)
sum_b = sum(B)
ans = 'No'
if sum_a % 3 == 0 and sum_b % 3 == 0:
    if abs(sum_a - sum_b) // 3 <= 2:
        ans = 'Yes'
print(ans)
# Judge status: Accepted
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse=True)
q.sort(reverse=True)
r.sort(reverse=True)

p = p[:X]
q = q[:Y]

all = p + q + r
all.sort(reverse=True)
ans = sum(all[:X + Y])
print(ans)
# Judge status: Accepted
S = list(input())
S.sort()
ans = True
for i in range(len(S)-1):
  if S[i] == S[i + 1]:
    ans = False
    break
if ans:
  print("yes")
else:
  print("no")
# Judge status: Wrong Answer
N,M = map(str,input().split())
NN,MM = map(int,input().split())
ress = input()
if(ress == N):
  NN = NN-1
elif(ress == M):
  MM == MM-1
print(MM,NN)
# Judge status: Wrong Answer
#agc041 a
n,a,b=map(int,input().split())
ans=0
if (b-a)%2==0:
    ans=(b-a)/2
else:
    left=b-1
    right=n-a
    ans=min(left,right)
print(int(ans))
# Judge status: Accepted
import math
s=list(input())
N=len(s)
x=0
for i in range(0,N):
    if s[i]!=s[N-1-i]:
        x+=1
x=math.ceil(x/2)
print(x)
# Judge status: Wrong Answer
s = input()
a = 'x'
print('a' * len(s))
# Judge status: Wrong Answer
s = input()
print(s[1:-1])
r_s = s[::-1]

if r_s.index("Z")==0:
    print(len(s[s.index("A"):]))
else:
    print(len(s[s.index("A"):-r_s.index("Z")]))
# Judge status: Accepted
n, m = map(int, input().split())

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

good = [1 for j in range(n)] 


for i in range(m):
    a,b  = map(int, input().split())
    
    if height[a-1] >= height[b-1]:
        good[b-1] = 0
    if height[a-1] <= height[b-1]:
        good[a-1] = 0

ans = good.count(1)
print(ans)
# Judge status: Wrong Answer
l = int(input())
ans = 0
for i in range(l+1):
    for j in range(l-i+1):
        k = l-i-j
        ans = max(ans,i*j*k)
print(ans)
# Judge status: Wrong Answer
A,B,N=map(int,input().split())
x=min(B,N)
ans=(A*x)//B-(A)*(x//B)
for i in range(B,10**12+1,B):
    if i>N:
        break
    ans=max(ans,(A*i)//B-A*(i//B))
print(ans)
# Judge status: Accepted
import math
h = int(input())
hp = h
c = 0
ans = 0

while hp > 1:
    hp = math.floor(hp/2)
    c += 1
for i in range(0,c+1):
    ans += 2 ** i
print(ans)
# Judge status: Accepted
n = int(input())
a = int(input())
if n%500<=a:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
K = int(input())

for i in range(K):
    if A > B:
        B *= 2
    elif B > C:
        C *= 2
    else:
        break

if C > B > A:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
from itertools import accumulate
from collections import defaultdict
S = list(input().rstrip())
r = 1
i=len(S)
acc=0
dd = defaultdict(int)
for s in S[::-1]:
    acc+=r*int(s)
    acc%=2019
    r%=2019
    r*=10
    dd[acc]+=1
    i-=1
ans=0
for i in dd.values():
    ans+=(i*(i-1))//2
print(ans)
# Judge status: Accepted
l, r, d = map(int, input().split())
count = 0
for i in range(l, r + 1):
    if i % d == 0:
        count += 1
print(count)
# Judge status: Wrong Answer
s = list(input())
t = list(input())
n = len(s)

s_par = [i for i in range(n + 1)]
t_par = [i for i in range(n + 1)]

def operation(x, par):
    for i in range(n):
        for j in range(i):
            if x[i] == x[j]:
                par[i] = par[j]
                return par

if operation(s, s_par) == operation(t, t_par):
    print('yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
x = 0
y = 0
for i in range(1, n+1):
  x += 800
  if i % 15 == 0:
    y += 200
    
print(x - y)
# Judge status: Accepted
S=input()

num=int(S[:4]+S[5:7]+S[8:])


if num<=20190430:
	print("Heisei")
else:
	print("TBD")
# Judge status: Accepted
n,m,x=map(int,input().split())
ans=999999999999999999
a=[0]*n
for i in range(n):
  a[i]=list(map(int,input().split()))
for i in range(2**n):
  t=[0]*m
  temp=0
  for j in range(n):
    if (i>>j)&1:
      temp=temp+a[j][0]
      for k in range(m):
        t[k]=t[k]+a[j][k+1]
  if min(t)>=x:
    ans=min(ans,temp)
if ans==999999999999999999:
  print(-1)
else:
  print(ans)
# Judge status: Accepted
#!/usr/bin/env python3
from collections import Counter
import sys
sys.setrecursionlimit(10**6)


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

c = Counter(a)

c = list(c.most_common())
# c = c.most_common()
len_c = len(c)
# print(len_c)
# print(c)
ans = 0
while(len_c-k > 0):
    # print(len_c-k)
    # print()
    # print(k)
    i, j = c.pop()
    len_c -= 1
    ans += j
print(ans)
# Judge status: Wrong Answer
N=int(input())
power=1
for i in range(1,N+1):
  power=power*i
print(power%(10*9+7))
# Judge status: Accepted
from bisect import bisect_right
n, m, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

def ruisekiwa(List):
    for i in range(1, len(List)):
        List[i] += List[i - 1]
    return List

arui = ruisekiwa(a)
brui = ruisekiwa(b)
arui.insert(0, 0)
brui.insert(0, 0)
ans = 0

for i in range(n + 1):
    if arui[i] > k:
        break
    j = bisect_right(brui, k - arui[i])
    ans = max(ans, i + j - 1)
print(ans)
# Judge status: Accepted
import sys
import math

def resolve():
    N = int(input())
    A = list(map(int, input().split(" ")))
    Adiff = sorted([a - i for i, a in enumerate(A)])
    if N % 2 == 0:
        print(min(
            sum([abs(ad - Adiff[N//2]) for ad in Adiff]),
            sum([abs(ad - Adiff[N//2+1]) for ad in Adiff])
        ))
    else:
        print(sum([abs(ad - Adiff[N//2]) for ad in Adiff]))

if '__main__' == __name__:
    resolve()