peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
# -*- coding: utf-8 -*-
a, b = map(int, input().split())
if a < b:
    print("".join([str(a)]*b))
else:
    print("".join([str(b)] * a))
# Judge status: Accepted
import itertools
import numpy as np
import copy

N, M, X = map(int, input().split())
CA = [list(map(int, input().split())) for _ in range(N)]
CA = np.array(CA)

ans = 10 ** 7
for i in itertools.product([0, 1], repeat=N):
    tCA = copy.copy(CA)
    for j in range(N):
        if i[j] == 0:
            tCA[j] = np.zeros(CA.shape[1])
    s = np.sum(tCA, axis=0)
    l = sum(k >= X for k in s[1:])
    if s[0] < ans and l == M:
        ans = s[0]

if ans == 10 ** 7:
    print(-1)
else:
    print(ans)
# Judge status: Wrong Answer
n = int(input())
abc = [list(map(int, input().split())) for _ in range(n)]

last_index = -1
value = 0
for i in range(n):
    sorted_lst = sorted(abc[i], reverse=True)
    for j in range(3):
        if j == last_index:
            continue
        last_index = j
        value += sorted_lst[j]
        break
print(value)
# Judge status: Accepted
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
if a < b and b < c:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
a,b=input().split()
a=int(a)
b.replace('.','')
b=int(b)
print((a*b)//100)
# Judge status: Wrong Answer
S = input()
l = len(S)// 2
ans= 0 

for i in range(l):
    if  S[i] != S[l-i]:
        ans += 1

print(ans)
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())
if(a+b>=c+d):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
x,y = map(int,input().split())
print((x+y)%24)
# Judge status: Wrong Answer
n = int(input())
a_lst = list(map(int,input().split()))
a_str = ''
for i in range(n):
    a_str += str(a_lst[i])
seq_lst = [0]*n

for i, seq in enumerate(a_str):
    seq_lst[int(seq)-1] = i+1

for i in range(n):
    print(seq_lst[i], end=' ')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = 0
while True:
    for i in range(n):
        if a[i] % 2 == 0:
            a[i] //= 2
        else:
            break
    else:
        ans += 1
        continue
    break
print(ans)
# Judge status: Accepted
x =int(input())
print("Christmas" + " Eve" *(25 - x) )
# Judge status: Accepted
N = int(input())
print(sum([i for i in range(1, N + 1)]))
# Judge status: Accepted
n,k=map(int,input().split())
print(int(not(not n%k) ))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
A_e = []

for i in range(N):
    if A[i]%2 == 0:
        A_e.append(A[i])


cnt = 0
for j in range(len(A_e)):
    if (A_e[j]%3 == 0) or (A_e[j]%5 == 0):
        cnt += 1
    else:
        cnt = cnt

if cnt == len(A_e):
    print('APPROVED')
else:
    print('DENIED')
# Judge status: Wrong Answer
import collections
from math import factorial

def combinations_count(n, r): #組み合わせ
    return factorial(n) // (factorial(n - r) * factorial(r))

n = int(input())
li = []
ans = 0

for i in range(n):
    s = list(input())
    s.sort()
    li.append(''.join(s))

c = list(collections.Counter(li).values())

for i in c:
    if i == 1:
        break
    ans += combinations_count(i, 2)

print(ans)
# Judge status: Wrong Answer
a, b, c, d = list(map(int, input().split()))
h = [a, b, c]
maxvalue = -1
minvalue = 101
for i in range(len(h)):
    if h[i] > maxvalue:
        maxvalue = h[i]
for i in range(len(h)):
    if h[i] < minvalue:
        minvalue = h[i]
x, y, z = minvalue, a+b+c-maxvalue-minvalue, maxvalue
if y - x > d or z - y > d:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
N = int(input())
MOD = 10**9 + 7

ans = pow(10, N, MOD) - 2*pow(9, N, MOD) + pow(8, N, MOD)
ans %= MOD

print(ans)
# Judge status: Wrong Answer
S = input().replace("eraser","").replace("erase","").replace("dream","").replace("dreamer","")

if S =="":
    print("YES")
else:
    print("NO")
# Judge status: Wrong Answer
n = int(input())
w = list(map(int, input().split()))

a = 0
b = sum(w)
for i in w:
  a += i
  b -= i
  if a >= b:
    break
print(abs(a-b))
# Judge status: Accepted
n=int(input())
cnt=0;
for i in range(1,10):
  if n%i==0:
    if n/i<10:
      print('Yes')
      exit()
print('No')
# Judge status: Wrong Answer
S = input()
T = input()
lenS = len(S)
lenT = len(T)
maxcnt = 0
for l in range(lenT):
    for r in range(l,lenT):
        if T[l:r+1] in S[l:lenS-lenT+r+1]:
            maxcnt = max(maxcnt, r - l + 1)
print(lenT - maxcnt)
# Judge status: Accepted
import bisect
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(lambda x: -int(x), input().split()))

a.sort()
c.sort()

ans = 0
for bi in b:
    na = bisect.bisect_left(a, bi)
    nb = bisect.bisect_left(c, -bi)
    ans += na * nb
print(ans)
# Judge status: Accepted
import sys
from math import gcd

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    X = int(rl())
    
    ans = X * 360 // gcd(X, 360) // X
    print(ans)


if __name__ == '__main__':
    solve()
# Judge status: Wrong Answer
import numpy as np
from itertools import product
import sys
read = sys.stdin.buffer.read


C = np.array(read().split(), np.int32).reshape(3, 3)
i, j, k = np.max(C + 2, axis=1) // 2
flag = 0
for i, j, k in product(range(i), range(j), range(k)):
    x = C[0, :] - i
    y = C[1, :] - j
    z = C[2, :] - k

    if np.all((x == y) & (y == z)):
        flag = 1
        break

print(['No', 'Yes'][flag])
# Judge status: Accepted
def main():
    n = int(input())
    p = list(map(int,input().split()))
    minp = p[0]
    cnt = 0
    for i in range(n):
        if p[i]<=minp:cnt+=1
        minp = min(minp,p[i])
    print(cnt)
main()
# Judge status: Accepted
import sys

t = set('dream, dreamer, erase, eraser'.split(', '))

def obtainable(s):
  while True:
    for i in range(5, 8):
      if s[-i:] in t:
        s = s[:-i]
        break
    else:
      return False
    if not s:
      return True
    
s = sys.stdin.readline().rstrip()

def main():
  print("YES" if obtainable(s) else "NO")

if __name__ ==  '__main__':
  main()
# Judge status: Accepted
W,a,b=map(int,input().split())
if a+W<=b:
    print(b-(a+W))
elif a>=b+W:
    print(a-(b+W))
else:
    print(0)
# Judge status: Accepted
a,b,c = map(int,input().split())
if a+b+c>= 22:
  print('bust')
else:
  print('win')
# Judge status: Wrong Answer
import math
x, y = [int(x) for x in input("").split()]
a = math.log(x,y)
b=x%y
if(b==0):
    print (math.ceil(a)+1) 
else:
    print (math.ceil(a))
# Judge status: Accepted
N,T = map(int, input().split())

min_cost = float('inf')
for i in range(N):
    c,t = map(int, input().split())
    if (t <= T) and (c < min_cost):
        min_cost = c

if min_cost == float('inf'):
    print('TLE')
else:
    print(min_cost)
# Judge status: Wrong Answer
x,y = list(map(int,input().split(" ")))
a = (2*x - y)//3
b = (2*y - x)//3

mod = 10**9+7

g1 = [1, 1]
g2 = [1, 1]
inv = [0, 1]
for i in range(2, 666667):
    g1.append((g1[-1] * i) % mod)
    inv.append((-inv[mod%i] * (mod//i)) % mod)
    g2.append((g2[-1] * inv[-1]) % mod)


def nChoosem(n,m):
    if n < 0 or m < 0 or n < m: return 0
    m = min(m, n-m)
    return g1[n] * g2[n-m] * g2[m] % mod

res = nChoosem(a+b,a)
print(res)
# Judge status: Accepted
# -*- coding: utf-8 -*-

H1,M1,H2,M2,K = map(int, input().split())

print((H2*60+M2)-(H1*60+M1)-K)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
print('Yes' if c<=a+b*2 else 'No')
# Judge status: Wrong Answer
s='0abcdefghijklmnopqrstuvwxyz'
n=int(input())
def number_of_alphabets(n):
    i=1
    g=0
    while g<n:
        g+=26**i
        i+=1
    return(i-1)
i=number_of_alphabets(n)-1
name=''
for i in range(i,-1,-1):
    o=n//26**i
    if o>26:
        o=26
    name+=s[o]
    n=n-o*26**i
print(name)
# Judge status: Accepted
r, g, b = map(int,input().split())

if (r*100 + g*10 + b) % 4 ==0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n = int(input())
h = list(map(int, input().split()))

step_max = 0
r_step = 0
for i in reversed(range(n-1)):
    if h[i] >= h[i+1]:
        r_step += 1
    else:
        r_step = 0

    if r_step > step_max:
        step_max = r_step

print(step_max)
# Judge status: Accepted
L, R = map(int,input().split())
Dif = abs(L-R)+1
if Dif >= 2020:
    Ans = 0
else:
    Box = []
    for i in range(L,R+1):
        Box.append(i%2019)
    Box.sort()
    Ans = 2020*2020
    for i in range(len(Box)-1):
        B1 = Box[i]
        for j in range(i+1,len(Box)):
            B2 = Box[j]
            Ans = min((B1*B2)%2019, Ans)
print(Ans%2019)
# Judge status: Accepted
l = float(input())
print((l/3)** 3)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
k=int(input())
if c>a/(2**k):
	for x in range(k+1):
		if b>a/(2**x):
			break
	else:
		print("No")
	y=k-x
	if c>b/(2**y):
		print("Yes")
	else: print("No")
else:
		print("Yes")
# Judge status: Wrong Answer
h, a = map(int, input().split())

print(h//a+1)
# Judge status: Accepted
from bisect import bisect_left
from collections import deque

def main():
    N = int(input())
    A = [int(input()) for _ in range(N)]
    ans = deque([A[0]])
    for i in range(1,N):
        index = bisect_left(ans,A[i])
        if index == 0:
            ans.appendleft(A[i])
        else:
            ans[index-1] = A[i]

    print(len(ans))



if __name__ == "__main__":
    main()
# Judge status: Accepted
from collections import Counter
 
N = input()
A = list(map(int, input().split()))
 
counter = Counter(A)
 
cnt = 0
for k, v in counter.items():
    if v < k:
        cnt += v
    elif v > k:
        cnt += v - k
 
 
print(cnt)
# Judge status: Wrong Answer
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
ans=0
for i in range(n):
    m=min(a[i],b[i])
    ans+=m
    a[i]-=m
    b[i]-=m
    m=min(a[i+1],b[i])
    a[i]-=m
    b[i]-=m
    ans+=m
print(ans)
# Judge status: Wrong Answer
def main():
    A, B = map(int, input().split())
    p = A * B
    if p >= 82:
        print(-1)
    else:
        print(p)
main()
# Judge status: Wrong Answer
import math

inputLine = input()
tempStr = inputLine.split(' ')

a = int(tempStr[0])
b = int(tempStr[1])
h = int(tempStr[2])
m = int(tempStr[3])

minDeg = 360 * (m / 60)
hourDeg = h * 30 + (30 * (m / 60))

finalValue = hourDeg - minDeg if hourDeg >= minDeg else minDeg - hourDeg
finalValue = 360 - finalValue if finalValue >= 180 else finalValue

if finalValue == 90 or finalValue == 180 :
	print(math.sqrt((a * a) + (b * b)))
elif finalValue == 0 :
	print(0)
else :
	print(math.sqrt((a * a) + (b * b) - (2 * a * b * math.cos(math.pi * (finalValue / 180)))))
# Judge status: Accepted
s=input()
ans="No"

if s=="hi":
    ans="Yes"
if s=="hihi":
    ans="Yes"
if s=="hihihi":
    ans="Yes"
if s=="hihihihi":
    ans="Yes"
if s=="hihihihihi":
    ans="Yes"
print(ans)
# Judge status: Wrong Answer
x,a,b=map(int,input().split())
b -= a
if b < 0:
    print('delicious')
    
else:
    if b > x:
        print('dangerous')
    else:
        print('safe')
# Judge status: Accepted
a, b, c = map(int, input().split())

if a < c < b or b < c < a:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def main():
    N = int(input())
    ans = 0
    for n in range(1, N + 1):
        ans += n * (N // n + 1) * (N // n) // 2
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
A,B,K=map(int,input().split())

S=[]
for i in range(1,B+1):
  if A % i==0 and B%i==0:

    S.append(i)

print(S[K-1])
# Judge status: Accepted
A, B, C = map(int,input().split())
print("Yes" if A <= C <= B else "No")
# Judge status: Accepted
def C():
    n = int(input())
    ret = [None]*12
    q = n
    for i in range(12):
        q,mod = divmod(q,26)
        if mod == 0:
            ret[i] = "z"
            q -= 1
        else:
            ret[i] = chr(mod+96)
        if q == 0:
            break
    ret = ret[:i+1]
    ret.reverse()
    print("".join(ret))
C()
# Judge status: Wrong Answer
n = list(map(int, input().split()))
result = "YES" if sum(n) % 9 == 0 else "NO"
print(result)
# Judge status: Accepted
s = input()
if (s == "a" or s == "i" or s == "u" or s == "e" or s == "o") :
  print("vowel")
else : 
  print("consonant")
# Judge status: Accepted
N = int(input())
nums = list(map(int, input().split()))
nums.sort()
checked = [0 for _ in range(nums[-1]+1)]
answer = 0
for i in range(N-1):
  if checked[nums[i]] == 1:
    continue
  else:
    if nums[i] != nums[i+1]:
      answer += 1
    count = 1
    temp = nums[i]
    while(temp <= nums[-1]):
      checked[temp] = 1
      count += 1
      temp= nums[i]*count
if checked[nums[-1]] == 0:
  answer += 1
print(answer)
# Judge status: Accepted
from sys import stdin
import sys
import math
from functools import reduce
import functools
import itertools
from collections import deque,Counter,defaultdict
from operator import mul
import copy
# ! /usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
sys.setrecursionlimit(10**6)
INF =  float("inf")
import bisect

S = input()

if S == "SUN":
    print(7)
elif S == "MON":
    print(6)
elif S == "TUE":
    print(5)
elif S == "WED":
    print(4)
elif S == "THU":
    print(3)
elif S == "FRI":
    print(2)
elif S == "SAT":
    print(1)
# Judge status: Accepted
A, B, C=map(int,input().split())
if A+B >= C:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
import math

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

print(math.ceil(a+b))
# Judge status: Accepted
import math

x = int(input())

deposit = 100
ans = 0
while deposit < x:
    deposit = math.floor(deposit * 1.01)
    ans += 1

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

if a <= 8 and b <= 8:
    print("Yay!")
else:
    print(":(")
# Judge status: Wrong Answer
N = int(input())

print((N + 1) // 2)
# Judge status: Wrong Answer
A = list(map(int,input().split()))
for i in range(A[3]):
    A[0] = A[1] + A[2]
    A[1] = A[0] + A[2]
    A[2] = A[0] + A[1]
if abs(A[0]-A[1]) > 10**18:
    print('unfair')
else:
    print(A[0]-A[1])
# Judge status: Wrong Answer
n , d = map(int, input().split())
count = 0

for i in range(n):
    if n > 2*d+1:
        count += 1
        n = 2*d+1
        if n != 0:
            count += 1
print(count)
# Judge status: Wrong Answer
a = input()
a_l = 'abcdefghijklmnopqrstuvwxyz'
for i in range(26):
  if a.count(a_l[i])>=1:
    continue
  else:
    print(a_l[i])
    break
# Judge status: Accepted
n = int(input())
if n <= 999:
    print("ABC")
else:
    print("ABD")
# Judge status: Accepted
N = int(input())
S = list(input())

row = [0]*(N+2)
for i in range(N):
    if S[i] =='E':
        row[i+1] = row[i] + 1
    else:
        row[i+1] = row[i]
answer = [0]*N
for i in range(N):
    answer[i] += (i - row[i])
    a = row [N] - row[i+1]
    answer[i] += a
#print(S)
#print(row)
#print(answer)
print(min(answer))
# Judge status: Wrong Answer
N = int(input())

height = input()
height = height.split()
height = [int(s) for s in height]

count = 0

for i in range(N):
  for j in range(i+1, N):
    if j-1 == height[i] + height[j]:
      count += 1

print(count)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline

# from collections import deque

def linput(_t=int, cnv=list):
    return cnv(map(_t, input().split()))

def gcd(n,m):
    while m: n,m = m, n%m
    return n

def lcm(n,m): return n*m//gcd(n,m)

def main():
    N = int(input())
    vA = [int(input()) for _ in [0,]*N]

    res = 0
    odd = 0

    for a in vA:
        x = (a+odd)//2
        res += x
        odd = a - 2*x

    print(res)
    # print("No Yes".split()[res])

main()
# Judge status: Accepted
a, b, c = map(int, input().split())
d = a % b
A = {d}
while d != 0:
  d += a
  d %= b
  A.add(d)
print('YES' if c in A else 'NO')
# Judge status: Accepted
N= int(input())
N = str(N)
n = N[-1]
if n == "3":
    print("bon")
elif n == "0" or n == "1" or n =="6" or n == "8":
    print("pon")
else:
    print("hon")
# Judge status: Accepted
N, M = map(int, input().split())
A = map(int, input().split())

result = N-sum(A)
if result < 0:
    result = -1
print(result)
# Judge status: Accepted
n, m = map(int,input().split())
people = []
points = []
for i in range(n):
  person = list(map(int,input().split()))
  people.append(person)
for i in range(m):
  point = list(map(int,input().split()))
  points.append(point)

for person in people:
  mini = 1000000000
  minIndex = 0
  for i in range(m):
    distance = abs(person[0]-points[i][0]) + abs(person[1]-points[i][1])
    
    if mini > distance:
      mini = distance
      minIndex = i
  print(minIndex+1)
# Judge status: Accepted
a,b,c,d=map(int,input().split())
X=c-a
Y=d-b
ans1='R'*X+'U'*Y
ans2='L'*X+'D'*Y
ans3='D'+'R'*(X+1)+'U'*(Y+1)+'L'
ans4='U'+'L'*(X+1)+'D'*(Y+1)+'R'
print(ans1+ans2+ans3+ans4)
# Judge status: Accepted
import math
X = int(input())
t = math.ceil((-1 + (1 + 8 * X) ** 0.5)/2)
print (t)
# Judge status: Wrong Answer
s=input().split()
print(s[0]+s[1])
# Judge status: Accepted
s = input()
if s[0] == "S":
    print("Cloudy")
elif s[0] == "C":
    print("Rainy")
else:
    print("Sunny")
# Judge status: Wrong Answer
L = [0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1]
A, B = map(int, input().split())
print('Draw') if L[A] == L[B] else print('Alice' if L[A] > L[B] else 'Bob')
# Judge status: Accepted
n, k = map(int, input().split())
*H, = map(int, input().split())
X = [0]
for i in range(1, n):
    x = 1 << 30
    for j in range(1, k+1):
        if i-j >= 0:
            x = min(x, X[i-j]+abs(H[i]-H[i-j]))
    X.append(x)
print(X[n-1])
# Judge status: Accepted
from sys import stdin
from decimal import Decimal
def main():
    #入力
    readline=stdin.readline
    li=readline().strip().split()
    a=Decimal(str(li[0]))
    b=Decimal(str(li[1]))
    ans=int(a*b)
    print(ans)

if __name__=="__main__":
    main()
# Judge status: Wrong Answer
l, r, d = map(int, input().split())

print((r-l+1) // d)
# Judge status: Wrong Answer
a = int(input())
b = int(input())
if a+b == 3:
    print(3)
else:
    print(2)
# Judge status: Accepted
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(1, n - 1):
    if sorted([p[i - 1], p[i], p[i + 1]])[1] == p[i]:
        count += 1
print(count)
# Judge status: Accepted
# coding: utf-8
A,B,C=map(int,input().split())
l=[A,B,C]

if len(set(l))==2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
ans=0
mp=[[0]*10 for _ in range(10)]
for i in range(1,n+1):
    a=int(str(i)[0])
    b=int(str(i)[-1])
    mp[a][b]+=1

for i in range(10):
    for j in range(10):
        ans+=mp[i][j]*mp[j][i]
    


print(ans)
# Judge status: Accepted
N,A,B=map(int,input().split())
ans=0
 
if (B-A)%2==0:
  ans=(B-A)//2
else:
  if A-1<N-B:
    if B-A==1:
      ans=B-1
    else:
      ans=A+(B-A-1)//2
  else:
    if B-A==1:
      ans=N-A
    else:
      ans=N-B+1+(N-(A+N-B+1))//2
print(ans)
# Judge status: Accepted
import sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = 10**20
def I(): return int(input())
def F(): return float(input())
def S(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LS(): return input().split()

def resolve():
    s = S()
    t = S()

    if s==t[:-1]:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    resolve()
# Judge status: Wrong Answer
S = input()
d = int(S[0])
T = []
U = []
for i in range(len(S)):
  T.append(d)
  d = (d + 1) % 2
  U.append(d)
count1 = 0
count2 = 0
for i in range(len(S)):
  if S[i] != T[i]:
    count1 += 1
  if S[i] != U[i]:
    count2 += 1
print(min(count1, count2))
# Judge status: Accepted
n, k = map(int, input().split())
answer = 0
while True:
    if n // k != 0:
        n = n // k
        answer += 1
    else:
        break
print(answer + 1)
# Judge status: Wrong Answer
a,b,c,d = map(int,input().split())
if c >= b:
    print(0)
else:
    if b >= d:
        print(d-c)
    else:
        print(b-c)
# Judge status: Accepted
def task(h1, m1, h2, m2, k):
    t1 = h1 * 60 + m1
    t2 = h2 * 60 + m2
    t = t2 - t1
    print(max(0, t - k))
    #print(h1, m1, h2, m2, k)


h1, m1, h2, m2, k = map(int, input().split())
task(h1, m1, h2, m2, k)
# Judge status: Wrong Answer
a,b = map(int,input().split())
print("Possible" if a % 3 == 0 or b % 3 == 0 or a+b % 3 == 0 else "Impossible")
# Judge status: Wrong Answer
input_num=input()
n=input_num.split()
num = list(map(int,n))

N=sum(num[2:])

if num[0]<=N:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n, y = map(int, input().split())
for i in range(n+1):
    for j in range(n+1-i):
        if 10000*i + 5000*j + 1000*(n-i-j) == y:
            print(i, j, n-i-j)
            exit()

print(-1, -1, -1)
# Judge status: Wrong Answer
def op(x):
    return '+' if x==0 else '-'
# -*- coding: utf-8 -*-
N = int(input())
a=N//1000
b=N%1000//100
c=N%100//10
d=N%10
for i in range(2**3):
    total=0
    for j,num in zip(range(3),[b,c,d]):
        if (i>>j)&1==0:
            total+=num
        else:
            total-=num
    if a+total==7:
        print('{}{}{}{}{}{}{}=7'.format(a,op(i>>0&1),b,op(i>>1&1),c,op(i>>2&1),d))
# Judge status: Accepted
A, B, C, D=map(int,input().split())

while C or A >= 0:
    C -= B
    A -= D
    if C <= 0:
        print("Yes")
        break
    if A <= 0:
        print("No")
        break
# Judge status: Accepted
n, a, b = map(int, input().split())
s_l  = input()
ca = 0
cb = 0
for s in s_l:
  if s == 'a' and ca + cb < a+b:
    ca += 1
    print('Yes')
  elif s == 'b' and ca + cb < a+b and cb < b:
    cb += 1
    print('Yes')
  else:
    print('No')
# Judge status: Wrong Answer
K,A,B=map(int,input().split())
bis=1
if A>=B-1:
  bis=K+1
else:
  if (K-(A-1))%2==0:
    bis=int(A+(B-A)*(K-(A-1))/2)
  else:
    bis=A+(B-A)*((K-(A-1))//2)+1
print(bis)
# Judge status: Wrong Answer
n = input()
#print(n)
n = ''.join(sorted(n))

m = input()
#print(m)
m = ''.join(sorted(m))

#print(n)
#print(m)

if n < m:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, D = map(int, input().split())
print(-(-N//(1+2*D)))
# Judge status: Accepted
n,l=map(int,input().split())
A=[]
for i in range(n):
    A.append(l+i)
B=A.copy()
for j in range(len(B)):
    B[j]=abs(B[j])
print(sum(A)-A[B.index(min(B))])
# Judge status: Accepted
A,B = map(int,input().split())
if A > 8 or B > 8:
  print(':(')
else:
  print('Yay!')
# Judge status: Wrong Answer
x = list(input())

print(len(set(x)))
# Judge status: Wrong Answer
word = input()

if word[-1] == "s":
  print(word + "es")
else:
  print(word)
# Judge status: Accepted
from heapq import *
import math
import io
import sys

n, m = map(int, input().split())
pay = []
for _ in range(n):
    a, b = map(int, input().split())
    pay.append((a, b))
pay = sorted(pay, reverse=True)
q = []
ans = 0
for i in range(1, m+1):
    while pay and pay[-1][0] <= i:
        a, b = pay.pop()
        heappush(q, -b)
    if q:
        b = -heappop(q)
        ans += b
print(ans)
# Judge status: Accepted
n = int(input())
A = [0]*n
for i in range(n):
    A[i] = int(input())-1

i = 0
d = 0
c = 0
for _ in range(n):
    c += 1
    d = A[i]
    if d==1:
        break
    else:
        i = d
print(c if c!=n else -1)
# Judge status: Accepted
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

S = input()
T = input()
 
for i in reversed(range(len(S)-len(T)+1)):
    flag = 1
    for j in range(len(T)) :
        if S[i+j] != T[j] and S[i+j] != "?":
            flag = 0
    if flag:
        ans = S[:i] + T + S[i+len(T):]
        print(ans.replace("?", "a"))
        exit()
 
print("UNRESTORABLE")
# Judge status: Wrong Answer
from math import log
def calc_log2_int(n):
  """
  calc maximum integer m, such that 2 ^ m <= n 
  """
  candidate = int(log(n, 2))
  if pow(2, candidate + 1) == n:
      return candidate + 1
  elif pow(2, candidate - 1) == n:
      raise RuntimeError
    #   return candidate - 1
  else:
      return candidate


x, y = map(int, input().split())
n = y // x
print(calc_log2_int(n) + 1)
# Judge status: Accepted
s = int(input().replace('/', ''))
print(('Heisei','TBD')[s>20190430])
# Judge status: Accepted
x=list(map(int,input().split()))
for i in range(len(x)):
    if x[i]==0:
        print(i+1)