peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
from operator import mul
from functools import reduce

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

Nans = 0
Mans = 0

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

if N == 0 or N == 1:
    Nans = 0
else:
    Nans = cmb(N, 2)

if M == 0 or M == 1:
    Mans = 0
else:
    Mans = cmb(M, 2)

print(Nans + Mans)
# Judge status: Accepted
S = list(input())

cnt = 0
res = 0
for s in S:
    if s == 'A' or s == 'T' or s == 'C' or s == 'G':
        cnt += 1
        res = max(cnt, res)
    else:
        cnt = 0

print(res)
# Judge status: Accepted
N = int(input())
ans = (N/3)**3
print(ans)
# Judge status: Wrong Answer
n, m  = map(int,input().split())
ans = set(list(range(1, m+1)))
for i in range(n):
  k, *a = map(int, input().split())
  ans &= set(a)
  
print(ans)
# Judge status: Accepted
x,y = map(int, input().split())
if x%y==0:
  print(-1)
else:
  print(x)
# Judge status: Accepted
def euclid(a, b):
  if b == 0:
    return a
  else:
    return euclid(b, a%b)
A,B,C,D=map(int,input().split())
if A%C==0:
  k=A//C
else:
  k=(A//C)+1
if B%C==0:
  t=B//C
else:
  t=(B//C)
n=t-k+1
if A%D==0:
  a=A//D
else:
  a=(A//D)+1
b=B//D
m=b-a+1
mi=(C*D)//euclid(C, D)
if A%(C*D)==0:
  c=A//mi
else:
  c=(A//mi)+1
d=(B//mi)
r=d-c+1
s=n+m-r
print(B-A+1-s)
# Judge status: Wrong Answer
a=int(input())
b=list(map(int,input().split()))
c=0
for i in range(a):
  if b[i]%2==0:
    if b[i]%3==0 or b[i]%5==0:
      c=c+1
if c==a:
  print("APPROVED")
else:
  print("DENIED")
# Judge status: Accepted
import sys
#input = sys.stdin.buffer.readline

def main():
    N,K = map(int,input().split())
    s = str(input())
    
    count = 0
    change = 0
    for i in range(N-1):
        if s[i+1] == s[i]:
            count += 1
        else:
            change += 1

    if change//2 >= K:
        print(count+2*K)
    else:
        print(N-1)

if __name__ == "__main__":
    main()
# Judge status: Accepted
# B - Bingo
def is_winnable(player: int) -> bool:
    winnable_conditions = \
        {0b111000000, 0b000111000, 0b000000111, 0b100100100, 0b010010010, 0b001001001, 0b100010001, 0b001010100}
    return any(player & condition == condition for condition in winnable_conditions)


def main():
    *ANB, = map(int, open(0).read().split())
    A, B = ANB[:9], set(ANB[10:])
    player = 0b000000000
    for i, a in enumerate(A):
        if a in B:
            player |= 1 << i
    print("Yes" if is_winnable(player) else "No")


if __name__ == "__main__":
    main()
# Judge status: Accepted
from collections import Counter
n = int(input())
a = list(map(int, input().split()))

count = Counter(a)
ans = [0]*2
t = 0
for i in sorted(count.items(), reverse=True):
  if i[1] >= 4:
    if t == 0:
      ans[0],ans[1] = i[0],i[0]
      t = 2
    elif t == 1:
      ans[t] = i[0]
      t += 1
  elif i[1] >= 2:
    ans[t] = i[0]
    t += 1
  if t == 2: break
print(ans[0]*ans[1])
# Judge status: Accepted
N,M=map(int,input().split())
ans=0
if 2*N<=M:
  ans+=N
  M-=2*N
else:
  ans+=(M//2)
  M-=(M//2)*2
ans+=(M//4)
print(ans)
# Judge status: Accepted
import math

n = int(input())
print(math.ceil(n/2))
# Judge status: Accepted
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

max_A = A + V*T
min_A = A - V*T
max_B = B + W*T
min_B = B - W*T

if max_A >= max_B and min_A <= min_B:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n=int(input())
s=""
while n!=0:
    s+=str(abs(n%(-2)))
    n=(n-n%2)//(-2)
print(s[::-1] if s else 0)
# Judge status: Accepted

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

a = set(a)
a = list(a)
print(len(a))
# Judge status: Wrong Answer
N = int(input())
W = list(map(int, input().split()))

S1 = sum([w for w in W if w < N])
S2 = sum([w for w in W if w >= N])
print(abs(S1 - S2))
# Judge status: Accepted
S = list(input())
lst = [chr(i) for i in range(97, 97+26)]
res = sorted(list(set(lst) - set(S)))

if res == []:
    print("None")
else:
    print(res[0])
# Judge status: Wrong Answer
n,k=map(int,input().split())
a=list(map(int,input().split()))
import copy
temp=[0]*n
tu=0
td=0
for j in range(k):
  for i in range(n):
    td=max(i+1-a[i],1)
    tu=min(i+1+a[i],n)
    for m in range(td-1,tu):
      temp[m]=temp[m]+1
  a=copy.copy(temp)
L=[str(t) for t in a]
L=" ".join(L)
print(L)
# Judge status: Wrong Answer
# abc061_b.py

N, M = map(int,input().split())
ab = []
for i in range(M):
    a,b = map(int,input().split())
    ab.append(a)
    ab.append(b)
ab.sort()
pre = 0
cnt = 0
for i in ab:
    if pre == i:
        cnt += 1
    else:
        if pre != 0:
            cnt += 1
            print(cnt)
            cnt = 0
    pre = i
cnt += 1
print(cnt)
# Judge status: Wrong Answer
x = int(input())
a = x - 1
for i in range(0, a + 1):
    if pow(i, 5) == a:
        print(str(i) + " " + "-1")
# Judge status: Accepted
import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

operation_num = sum(b) - sum(a)
x = 0 # 操作回数
y = 0
z = 0
for i in range(n):
    x += b[i]-a[i]
    y += max(a[i]-b[i], 0)
    z += max(math.ceil((b[i]-a[i])/2), 0)
# print(x, y)
if x - y < 0 or x - z < 0:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
n, k = list(map(int, input().split()))
d = list(input().split())
ans = n
find = False
while find == False:
    p = str(ans)
    find = True
    for i in range(len(p)):
        if p[i] in d:
            find = False
            break
    if find == False:
        ans += 1

print(ans)
# Judge status: Wrong Answer
n,k=map(int,input().split())
k-=1
r=list(map(int,input().split()))
a=r.index(1)
b=n-a-1
print((a+k-1)//k+(b+k-1)//k)
# Judge status: Wrong Answer
s,t=input().split()
a,b=map(int,input().split())
u=input()
if s==u:
  print(a-1,b)
elif t==u:
  print(b-1,a)
# Judge status: Accepted
def main():
    s, t = list(input().split())
    a, b = list(map(int, input().split()))
    u = input()

    if u == s:
        a -= 1
    else:
        b -= 1
    print(a, b)

if __name__ == '__main__':
    main()
# Judge status: Accepted
a = list(input())

if a[2] == a[3] and a[4] == a[5]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import sys
input = sys.stdin.readline
S = list(input().strip())
count = 0
for i in range(3):
    if S[i%3] != S[(i+1)%3]:
        count += 1
if count == 3:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
i_plus_A = Counter([i + A[i] for i in range(N)])
i_minus_A = [i - A[i] for i in range(N)]
print(sum(i_plus_A[x] for x in i_minus_A))
# Judge status: Accepted
x,a,b = map(int, input().split())
if b - a <=0:
    print("delicious")
elif b-a <= x:
    print("safe")
else:
    print("dangerous")
# Judge status: Accepted
n = int(input())
c = input()
print(c[:c.count("R")].count("W"))
# Judge status: Wrong Answer
from collections import deque

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


if n % 2 == 0:
    for i in range(n):
        if i % 2 != 0:  # 偶数なら前
            b.appendleft(a[i])
        else:
            b.append(a[i])
else:
    for j in range(n):
        if j % 2 == 0:  # 偶数なら後ろ
            b.appendleft(a[j])
        else:
            b.append(a[j])
# Judge status: Wrong Answer
n = int(input())
if n<29:
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
from collections import defaultdict
N = int(input())
A = list(map(int,input().split()))
hashmap = defaultdict(int)
for a in A:
  hashmap[a]+=1
ans = 0
for k, v in hashmap.items():
  ans+=min(v,k-v)
print(ans)
# Judge status: Accepted
A,B,C = map(int,input().split())
cou = 0
if(A % 2 == 1 or B % 2 == 1 or C % 2 == 1):
  print("0")
  exit()
while(cou < 10**6):
  cou += 1
  a = A
  b = B
  c = C
  A = b/2 + c/2
  B = a/2 + c/2
  C = a/2 + b/2
  if(A % 2 == 1 or B % 2 == 1 or C % 2 == 1):
    print(str(cou))
    exit()
  else:
    pass
print("-1")
# Judge status: Wrong Answer
s = input()
K = int(input())

for i in range(len(s)-1):
    z2a = ord('z') + 1 - ord(s[i])
    if z2a <= K:
        s = s[:i] + 'a' + s[i+1:]
        K -= z2a

print(s[:len(s)-1] + chr(((ord(s[len(s)-1]) - ord('a')) + K % 26) % 26 + ord('a')))
# Judge status: Accepted
N = int(input())
AB = [[int(hoge) for hoge in input().split()] for j in range(N)]

ans = 0
for a,b in reversed(AB):
    a += ans
    ans += -a % b
print(ans)
# Judge status: Wrong Answer
from itertools import permutations
n = int(input())
p_list = list(map(int,input().split()))
q_list = list(map(int,input().split()))
dum_list = [i for i in range(1,n+1)]
count = 0
ans = 0
for i in permutations(dum_list,n):
    count += 1
    if p_list == list(i):
        ans += count
    elif q_list == list(i):
        ans -= count


print(abs(ans))
# Judge status: Accepted
A = int(input())
B = int(input())

if abs(A - B) == 2:
    print('2')

elif A + B == 3:
    print('3')

else:
    print('1')
# Judge status: Wrong Answer
N = int(input())

for i in range(N):
  x, y = map(int, input().split())
  if i==0:
    x1, y1, x2, y2, x3, y3, x4, y4 = x, y, x, y, x, y, x, y
  else:
    if x<x1 and y<y1:
      x1, y1 = x, y
    elif x<x2 and y>y2:
      x2, y2 = x, y
    elif x>x3 and y>y3:
      x3, y3 = x, y
    elif x>x4 and y<y4:
      x4, y4 = x, y
print(max(abs(x1-x3)+abs(y1-y3),abs(x2-x4)+abs(y2-y4)))
# Judge status: Wrong Answer
A, B, C = map(int, input().split())

if A <= B <= C:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
ab, bc, ca = map(int, input().split())

print(ab * bc // 2)
# Judge status: Accepted
S = input()
T = input()

min_val = len(S)
for i in range(0,len(S)-len(T)+1):
  count = 0
  for j in range(i, i+len(T)):
    if S[j] == T[j-i]:
      count += 1
  min_val = min(min_val, len(T)-count)
print(min_val)
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
d2 = 0
d4 = 0
for i in range(n):
    if A[i]%2==0 and A[i]%4!=0:
        d2 += 1
    elif A[i]%4==0:
        d4 += 1
n -= int(d2/2)*2
if n-1-d4<=d4:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
x=int(input())

d=-(-x//11)
r=x%11
if r<=6:
  print(2*d-1)
else:
  print(2*d)
# Judge status: Wrong Answer
a,b,c,d=input()
print("Yes" if a==b==c else "No")
# Judge status: Accepted
A, B = map(int, input().split())

if (A%3==0) or (B%3==0) or ((A+B)%3==0):
  print('Possible')
else:
  print('Impossible')
# Judge status: Wrong Answer
import sys

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

loop = 0

while (1):
  for i in l:
    if (i % (2 * (loop + 1)) != 0):
      print(loop)
      sys.exit(0)
  loop = loop + 1
# Judge status: Wrong Answer
a,b = map(int, input().split())

str_a = [a] * b
str_b = [b] * a

if str_a > str_b:
    print(*str_b)
else:
    print(*str_a)
# Judge status: Accepted
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
a=lnii()+[0]

money=1000
kabu=0
for i in range(n):
  if a[i]<a[i+1]:
    t_kabu=money//a[i]
    kabu+=t_kabu
    money-=t_kabu*a[i]
  elif a[i]>a[i+1]:
    money+=kabu*a[i]
    kabu=0

print(money)
# Judge status: Wrong Answer
S = input()
ans = 0
count = 0

for i in S:
    if i == "R":
        count += 1

if count >= 3:
    ans = 3

elif count >= 1 :
    if S[1] == "S":
        ans = 1
    else:
        ans = 2
else:
    ans = 0

print(ans)
# Judge status: Wrong Answer
import math
import sys
n, m = map(int, input().split())

def combinations_count(n, r):
    C = math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
    return C

if n <= 1 and m >= 2:
    print(combinations_count(m, 2))
    sys.exit()
elif n >= 2 and m <= 1:
    print(combinations_count(n, 2))
    sys.exit()
elif n == m == 1:
    print(1)
    sys.exit()
elif n == m == 0:
    print(0)
    sys.exit()
else:
    print(combinations_count(n, 2) + combinations_count(m, 2))
# Judge status: Wrong Answer
n=int(input())
CSF=[list(map(int,input().split())) for _ in range(n-1)]

for i in range(n-1):
    time=0
    for j in range(i,n-1):
        c,s,f=CSF[j]
        if time<s:time +=s-time
        if time%f==0:time +=c
        else:time +=c+(time%f)
    print(time)
print(0)
# Judge status: Accepted
n = int(input())
s = input()

flag = True
if n % 2 != 0:
    flag = False
else:
    for i in range(n // 2):
        if s[i] != s[(n // 2) + i]:
            flag = False
            break

if flag:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import math
N = int(input())
result = N
for i in range(1, int(math.sqrt(N))+3):
    if N % i == 0:
        result = min(result, i - 1 + N//i + 1)
print(result-2)
# Judge status: Wrong Answer
N,M=map(int, input().split())
ans=0
if min(N,M)==1:
    print(max(0,max(N,M)-2))
    exit()
ans=(N-2)*(M-2)
print(ans)
# Judge status: Wrong Answer
S = input()
ans = 0
nd = 1
mod1 = 0
listmod = [0]*2019
for i in S[::-1]:
    mod1 = (int(i)*nd + mod1)%2019
    listmod[mod1] += 1
    nd = (nd*10)%2019
for i in range(2019):
    n = listmod[i]
    if(n>0):
        ans += ((n-1)*n)//2
print(ans)
# Judge status: Accepted
from collections import defaultdict


def main():
    N = int(input())
    d = defaultdict(int)
    s = 0
    for i in range(N):
        d["".join(sorted(input()))] += 1

    for k in d.keys():
        s += d[k]*(d[k]-1)/2

    print(int(s))


if __name__ == '__main__':
    main()
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
import copy
import itertools
n = int(readline())

lst1 = [i for i in range(1,n+1)]
lst2 = copy.deepcopy(lst1)
lst3 = copy.deepcopy(lst1)

def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)
def lcm(a,b):
    return (a//gcd(a,b)*b)
ans = 0
for i,j,k in itertools.product(lst1,lst2,lst3):
    ans += gcd(i,gcd(j,k))
print(ans)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
a,b,c=max(a,b,c),a+b+c,min(a,b,c)
b-=a+c
print(a-b+(b-c+1)//2)
# Judge status: Accepted
a,b = map(int,input().split())
if a<=0 and b>=0:
  print("Zero")
elif a>0 and b>0:
  print("Positive")
elif a<0 and b<0:
  t = b-a
  if t%2==0:
    print("Negative")
  else:
    print("Positive")
# Judge status: Accepted
colors = list(map(int, input().split()))

kinds = len(set(colors))
print(kinds)
# Judge status: Accepted
y, m, d = map(int, input().split("/"))

print("TBD" if y >= 2019 and m >= 5 and d >= 1 else "Heisei")
# Judge status: Accepted
from collections import defaultdict
N,M = map(int,input().split())
SCs = [list(map(int,input().split())) for _ in range(M) ]

if N == 1:
    bottom = 0
else:
    bottom = 10 ** (N -1)
top = 10 ** (N)
ans = -1
for i in range(bottom,top):
    str_i = str(i)
    flag =True #条件を満たしていればTrue
    for q in SCs:
        s,c = q
        if int(str_i[s - 1]) != c:
            flag = False
    if flag:
        ans = i
        break
print(ans)
# Judge status: Accepted
s = input()
t = input()

ans = 10 ** 10
for i in range(len(s) - len(t) + 1):
    cnt = 0
    for j in range(len(t)):
        if t[j] != s[i + j]:
            cnt += 1
    ans = min(cnt, ans)
print(ans)
# Judge status: Accepted
from random import *
d=int(input())
c=list(map(int,input().split()))
s=[list(map(int,input().split())) for i in range(d)]
for i in range(d):
    cand=0
    for j in range(26):
        if s[i][cand]<s[i][j]:
            cand=j
    print(randrange(1,26))
# Judge status: Accepted
n = int(input())
aa = list(map(int, input().split()))
amax = aa[0]
total = 0
for a in aa:
    amax = max(amax,a)
    total += (amax - a)
print(total)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
cnt=0
for i in range(1,n):
    if a[i-1]>a[i]:
        cnt+=(a[i-1]-a[i])
        a[i]=a[i-1]
print(cnt)
# Judge status: Accepted
S = input()
k = False
for i, s in enumerate(S):
    if (i+1) % 2 == 0:
        if s == "L" or s == "U" or s == "D":
            k = True
        else:
            k = False
            break
    else:
        if s == "R" or s == "U" or s == "D":
            k = True
        else:
            k = False
            break

if k:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n, k = map(int, input().split())
a = 1
ans = 1

while n >= k**a:
    ans += 1
    a += 1

print(ans)
# Judge status: Accepted
K = int(input())
A, B = map(int, input().split())
"""
if(B-A+1 >= K):
  print("OK")
else:
  print("NG")
"""
flag = False
for i in range(A, B+1):
  if i%K == 0:
    flag = True
if flag:
  print("OK")
else:
  print("NG")
# Judge status: Wrong Answer
N = int(input())
A = int(input())

_, m = divmod(N, 500)

print('Yes' if m < A else 'No')
# Judge status: Wrong Answer
a,b,c,k=map(int,input().split())
d=(b+c)-(c+a)
print(d if d<10**18 else "unfair")
# Judge status: Accepted
alphabet = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"]

key = dict()
for a in alphabet:
  key[a] = 50

n = int(input())
for i in range(n):
  x = input()
  for a in alphabet:
    key[a] = min(key[a], x.count(a))

for k, v in key.items():
  for _ in range(v):
    print(k, end="") 
print()
# Judge status: Accepted
N, K = map(int, input().split())
A = list(map(int, input().split()))

ans = 1
N -= K

if N > 0:
    ans += -(-N // (K - 1))

print(ans)
# Judge status: Accepted
s = input()
a = s.count("a")
b = s.count("b")
c = s.count("c")
print("YES" if max(a, b, c) - min(a, b, c) <= 1 else "NO")
# Judge status: Accepted
d=[i*(i+1)//2 for i in range(1,1000)]
a,b=map(int,input().split())
for j in range(998):
  if d[j+1]-d[j]==b-a:
    print(d[j]-a)
    break
# Judge status: Wrong Answer
import numpy as np

N = int(input())

counter = 0

lead = np.zeros((9, 9))

for i in range(N):
    if (i % 10 != 0):
        moji = str(i)
        lead[int(moji[0]) - 1][int(moji[-1]) - 1] += 1

for i in range(N):
    if (i % 10 != 0):
        moji = str(i)
        tmp = moji[-1]
        counter += lead[int(moji[-1]) - 1][int(moji[0]) - 1]

print(int(counter))
# Judge status: Accepted
import bisect
n = int(input())
alist=list(map(int,input().split()))
blist=list(map(int,input().split()))
clist=list(map(int,input().split()))

alist.sort()
blist.sort()
clist.sort()

ans = 0

for i in blist:
    a = bisect.bisect_left(alist,i)
    b = len(clist) - bisect.bisect_right(clist,i)
    ans += a*b
print(ans)
# Judge status: Accepted
import sys

n, *a = map(int, sys.stdin.read().split())

def main():
    a.sort()
    y = x = 0
    i = n - 1
    while i > 0:
        if a[i] == a[i-1]:
            if not y:
                y = a[i]
                i -= 1
            else:
                x = a[i]
                break
        i -= 1
    print(y * x)

if __name__ ==  '__main__':
    main()
# Judge status: Accepted
#ABC063
s = input()
print("yes" if len(set(s))==len(s) else "no")
# Judge status: Wrong Answer
N = int(input())
A = int(input())


if N % 500 <  A:
    print('YES')

else:
    print('NO')
# Judge status: Accepted
from fractions import gcd

a, b, c, d = [int(x) for x in input().split()]

c_num = b // c - (a - 1) // c
d_num = b // d - (a - 1) // d

c_d_lcm = c * d // gcd(c, d)
c_d_num = b // c_d_lcm - (a - 1) // c_d_lcm

ans = b - a + 1 - c_num - d_num + c_d_num
print(ans)
# Judge status: Wrong Answer
s = input()
n1 = int(s[:2])
n2 = int(s[2:])
if 1 <= n1 <= 12 and 1 <= n2 <= 12:
    print("AMBIGUOUS")
elif n1 > 12 and 1 <= n2 <= 12:
    print("YYMM")
elif 1 <= n1 <= 12 and n2 > 12:
    print("MMYY")
else:
    print("NA")
# Judge status: Accepted
import math


def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


S = int(input())
mod = 10 ** 9 + 7

if S < 3:
    print(0)
    exit()

res = 1
for i in range(2, S+1):
    if i * 3 > S:
        continue
    n = S - i * 3 + (i-1)
    r = i - 1
    res += combinations_count(n, r)

print(res % mod)
# Judge status: Wrong Answer
N = int(input())
P = list(map(int, input().split()))
ans = 0
maximum = 0
for p in P:
  if p >= maximum:
    maximum = p
    ans += 1
print(ans)
# Judge status: Wrong Answer
s=input()
t=input()
a=0
while(s!=t):
	s =s[-1]+s[:-1]
	a+=1
	if a==len(s):
		print("NO")
		break
if s==t:
	print("YES")
# Judge status: Accepted
s = input()
u = list(set(list(s)))
if len(u) == 2 and s.count(u[0]) == 2 and s.count(u[1]) == 2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
ALPHABET = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
N, S = int(input()), input()
newline = ""
for s in S:
  idx = (ALPHABET.index(s) + N) % 26
  newline += ALPHABET[idx]
print(newline)
# Judge status: Accepted
n, k = map(int, input().split())
query = [tuple(map(int, input().split())) for _ in range(n)]

count = [0] * (10 ** 5 + 2)
for a, b in query:
    count[a] += b

for i, c in enumerate(count):
    k -= c
    if k <= 0:
        print(i)
        exit()
# Judge status: Accepted
n = int(input())
a, b = [], []
for _ in range(n):
    tmp = list(map(int, input().split()))
    a.append(tmp[0])
    b.append(tmp[1])

a.sort()
b.sort()

if n%2:
    print(b[(n+1)//2-1]-a[(n+1)//2-1]+1)
else:
    print(b[n//2-1]+b[n//2]-a[n//2-1]-a[n//2]+1)
# Judge status: Wrong Answer
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

n = int(input())
a = list(map(int,input().split()))
c = collections.Counter(a)
li2 = [0,0]
li4 = [0]
for key,value in c.items():
    if value>=4:
        li4.append(key)
    elif value>=2:
        li2.append(key)
li2.sort()
li4.sort()
ans1 = li2[-1]*li2[-2]
ans2 = li4[-1]**2
print(max(ans1,ans2))
# Judge status: Wrong Answer
import numpy as np
N, M, X = map(int, input().split())

D = np.array([])
for i in range(N):
    D = np.append(D,list(map(int, input().split())))
D = D.reshape(N,M+1)

S = D.sum(axis=0)

if all(s >= X for s in S[1:]):
    D = D[np.argsort(D[:, 0])[::-1]]
    for i in range(N):
        newS = S - D[i]
        if all(j>=X for j in newS[1:]):
            S = newS
    print(int(S[0]))
else:
    print(-1)
# Judge status: Wrong Answer
N = int( input() )
s = input()
numbers = s.split()
 
def getCost(target):
  cost = 0
  for n in numbers:
    number = int(n)
    cost += (number - target)**2
  return cost
 
minCost = 0
for i in range(-100, 101):
  cost2 = getCost(i)
  if( cost2 < minCost ):
    minCost = cost2
print(minCost)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

cap = [1]*(N+1)#0-N

if A[0] > 1 or (A[0]==1 and N !=0):
    print(-1)
    exit()

for i in range(1,N+1,1):#1-N
    cap[i]=cap[i-1]*2 - A[i]
    if cap[i] < 0 or (cap[i]==0 and i!=N):
        print(-1)
        exit()

T = [0]*(N+1)
T[N]=A[N]#ここのキャパオーバーは上ではじけるはず
for i in range(N-1,-1,-1):
    T[i]=A[i]+min(T[i+1],cap[i])

print(sum(T))
# Judge status: Wrong Answer
s = input()

n = len(s) - 1
i = 1
while i != n:
    if s[i] == s[i - 1]:
        print('bad')
        exit()
    i += 1
print('Good')
# Judge status: Accepted
n = int(input())
ans = 0
d = 2

while d * d <= n:
    if n % d != 0:
        d +=1
    z = d
    while n % z ==0: 
        n = n/z
        z *=d
        ans+=1
        
    while n%d == 0: #残った素因数を消化
        n /= d

if n !=1:
    ans+=1

print(ans)
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
print('Yes'if max(l)<sum(l)-max(l) else 'No')
# Judge status: Wrong Answer
a,b = map(int,input().split())
if (b-a)%2==0:
  print(int((b-a)/2))
else:
  print('IMPOSSIBLE')
# Judge status: Accepted
import collections as c

n = int(input())
co = c.Counter(list(map(int, input().split())))
cm = sorted(co.items(), key=lambda x:x[0], reverse=True)
a = 0
b = 0
for v,m in cm:
  if m >= 4:
    if a == 0:
      a = b = v
    else:
      b = v
    break
  elif m >= 2 and a == 0:
    a = v
  elif m >= 2 and a != 0:
    b = v
    break
print(a*b)
# Judge status: Wrong Answer
a,b=input().split()
a=int(a)
b=int(b)
print((b-a)*(b-a-1)/2-a)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
S1 = A[0]
S2 = sum(A)-A[0]
B = [S1-S2]

for i in range(N-2):
  S1 += A[i+1]
  S2 -= A[i+1]
  B.append(abs(S1-S2))

print(min(B))
# Judge status: Wrong Answer
S = str(input())
if S == 'Sunny':
  my_result = 'Cloudy'
elif S == 'Clouudy':
  my_result = 'Rainy'
else:
  my_result = 'Sunny'
print(my_result)