peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
o = input()
e = input()
x = []
o = list(o)
e = list(e)

for i in range(0,max(len(o),len(e))):
  #print(x)
  if(len(o) != 0 and len(e) != 0):
    x.append(o[0])
    del o[0]
    x.append(e[0])
    del e[0]
  elif(len(o) != 0 and len(e) == 0):
    x.append(o[0])
    del o[0]
  elif(len(o) == 0 and len(e) != 0):
    x.append(e[0])
    del e[0]
print(''.join(x))
# Judge status: Wrong Answer
import math

N = int(input())
num_list = [0] + [0] * int(math.sqrt(N))  # 0~N
pn_list = []
for i in range(2, int(math.sqrt(N))+1):
    if num_list[i] == 0:
        pn_list.append(i)
        num_list[i::i] = [1] * len(num_list[i::i])

count = 0
for pn in pn_list:
    e = 1
    while N%(pn**e)==0 and N//(pn**e)>=1:
        N //= (pn**e)
        e += 1
        count += 1
print(count)
# Judge status: Accepted
a, b, c = map(int, input().split())

if (c >= a) and (c <= b):
    print('Yes')
else:
    print('No')
# 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
from collections import defaultdict
import sys
buf = sys.stdin.buffer


def main():
    n, k = map(int, buf.readline().split())
    AB = map(int, buf.read().split())

    count = defaultdict(int)
    for a, b in zip(AB, AB):
        count[a] += b

    idx = 0
    for num in sorted(count.keys()):
        idx += count[num]
        if idx >= k:
            print(num)
            break


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
s = int(input())
A = [s]
ans = 1
while True:
    ans = +1
    s = (s/2 if s%2==0 else 3*s+1)
    if s in A:
        break
    A.append(s)

print(ans+1)
# Judge status: Accepted
n, m = map(int, input().split())
stu = []
for i in range(n):
    stu.append(list(map(int, input().split())))
chk = []
for i in range(m):
    chk.append(list(map(int, input().split())))
    
for i in range(n):
    near = 10**10
    for j in range(m):
        mht = abs(stu[i][0]-chk[j][0])+abs(stu[i][1]-chk[j][1])
        if near > mht:
            near = mht
            idx = j
    print(idx+1)
# Judge status: Accepted
import fractions
n = int(input())
l = list(map(int,input().split()))

left = []
right = []
left.append(1)
right.append(1)
left.append(l[0])
right.append(l[-1])
le = l[0]
ri = l[-1]
for i in range(1,n-1):
    le = fractions.gcd(le,l[i])
    left.append(le)
    ri = fractions.gcd(ri,l[-i-1])
    right.append(ri)
m = []
for i in range(1,n-1):
    m.append(fractions.gcd(left[i],right[-i-1]))
m.append(left[-1])
m.append(right[-1])
print(max(m))
# Judge status: Wrong Answer
S = str(input())
if S[2] == S[3] and S[4] == S[5]:
    print('Yes')
else:
    print('no')
# Judge status: Accepted
def resolve():
    N, M = map(int, input().split())
    arr = sorted(list(map(int, input().split())), reverse=True)
    s = sum(arr)
    th = s / 4 / M
    ans = 'Yes'
    for i in range(M):
        if arr[i] < th:
            ans = 'No'
            break
    print(ans)

resolve()
# Judge status: Wrong Answer
s = input().strip()
ans = 0
tmp = 0
for _, x in enumerate(s):
    if x == "A" or x == "C" or x == "G" or x == "T":
        tmp += 1
    else:
        ans = max(ans, tmp)
        tmp = 0
print(ans)
# Judge status: Accepted
K = int(input())
S = input()
if len(S)<=K:
    print(S)
else:
    s_list = list(S)[0:K]
    print("".join(s_list)+"...")
# Judge status: Accepted
#!/usr/bin/env python3
N = int(input())
a = [int(input()) for i in range(N)]

x = 1
ans = 0
for i in range(N):
    ans += 1
    x = a[x - 1]
    if x == 2:
        print(ans)
        exit()
print(-1)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print('YES' if b - a and c - b else 'NO')
# Judge status: Wrong Answer
a,b,x = map(int, input().split())

import math

if x==a*a*b:
    print(0)
    exit()

if x > (a*a*b)/2:
    theta = math.atan((a*b*b)/(2*(a*a*b - x)))
else:
    theta = math.atan((2*x) / (a*b*b))

print(90-math.degrees(theta))
# Judge status: Accepted
a, b, c, k=map(int, input().split())
sub=a-b
if k%2==1:
  sub*=-1
print(sub)
# Judge status: Accepted
ans = []
for c in input():
    if c == "B":
        if len(ans) > 0:
            ans.pop()
    else:
        ans.append(c)
print("".join(ans))
# Judge status: Accepted
n, d = map(int, input().split())
if n % (2 * d + 1) == 0:
    print(n // (2 * d + 1))
else:
    print(n // (2 * d + 1) + 1)
# Judge status: Accepted
r, g, b = list(map(str, input().split()))
if int(r + g + b) % 4 == 0:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
str1 = list(map(int, input().split()))

print(str1[2], str1[0], str1[1])
# Judge status: Wrong Answer
a = int(input().replace(" ", ""))
for i in range(1,201):
  if i * i == a:
    print("Yes")
    break
else:
  print("No")
# Judge status: Accepted
N, R = map(int, input().split())

if N >= 10:
    print(R)
else:
    print(R+(100*(10-N)))
# Judge status: Accepted
A,B,C = map(int,input().split())

K = int(input())

# a < b < c

c = 0
while A >= B:
    B *= 2
    c += 1
while B >= C:
    C *= 2
    c += 1

print('Yes' if c <= K else 'No')
# Judge status: Accepted
import fractions
n = int(input())
a = list(map(int,input().split()))
m = []
l = [0]
r = [0]
for i in range(n):
  l.append(fractions.gcd(l[i],a[i]))
  r.append(fractions.gcd(r[i],a[-i-1]))
r.reverse()
for i in range(n):
  m.append(fractions.gcd(l[i],r[i+1]))
print(max(m))
# Judge status: Accepted
l = int(input())
l = l/3
print(l**3)
# Judge status: Accepted
s = input()
n = len(s)
sl = s[:n//2]
sr = s[n//2+1:]
if sl == sr and sr ==  sr[::-1]:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))
zero,one,two = 0,0,0
for i in a:
    if i%4 == 0:
        two += 1
    elif i%2 == 0:
        one += 1
    else:
        zero += 1
if one == 1:
    print("Yes" if two+(two) >= zero+1 else "No")
    exit()
print("Yes" if two+(two) >= zero else "No")
# Judge status: Wrong Answer
n,m=map(int,input().split())
for i in range(m):
  print(1+i, n-i)
# Judge status: Accepted
import copy

a = int(input())
l = list(map(int, input().split()))
l2 = sorted(copy.deepcopy(l))

#print(l2)

for i in l:
  if i < l2[a//2]:
    print(l2[a//2])
  else:
    print(l2[a//2 - 1])
# Judge status: Wrong Answer
K=int(input())
n=1
c=0
while 1:
  j=True
  n_str=str(n)
  for i in range(len(n_str)-1):
    if abs(int(n_str[i]) - int(n_str[i+1])) > 1:
      j=False
  if j:
    c+=1
  if c==K:
    print(n)
    break
  if len(n_str) > 1 and abs(int(n_str[0]) - int(n_str[1])) > 1:
    n = (int(str(int(n_str[0])+1)+str(int(n_str[0]))))*(10**(len(n_str)-2))
  else:
    n+=1
# Judge status: Accepted
x,y = map(int,input().split())
res = 10**12

#0,0
if x<=y:
    res = min(res, y-x)

#0,1
if x <= -y:
    res = min(res, -y-x+1)

#1,0
if -x<=y:
    res = min(res, y+x+1)

#1,1
if -x <= -y:
    res = min(res, -y+x+2)

print(res)
# Judge status: Wrong Answer
def main():
    n = int(input())
    absl = []
    for _ in range(n):
        a, b = map(int, input().split()) 
        s = b-a
        absl.append([a,b,s])

    absl.sort(key=lambda x:x[2])
    # print(absl)
    curr_time = 0
    for curr_abs in absl:
        a,b,s = curr_abs
        curr_time += a
        if curr_time > b:
            print('No')
            return
    print('Yes')


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n,k,s=map(int,input().split())
print(s,end=" ")
for i in range(k-1):
    print(0,end=" ")
if s==10**9:
    for i in range(n-k):
        print(1,end=" ")
else:
    for i in range(n-k):
        print(1000000000,end=" ")
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
O = [i for i in range(N) if(i%2==0 and A[i]%2==1)]
print(len(O))
# Judge status: Accepted
import collections

n = int(input())
a = list(map(int, input().split()))
c = collections.Counter(a)
for i in range(1, n+1):
    if c[i]:
        print(c[i])
    else:
        print(0)
# Judge status: Wrong Answer
a,b = map(int, input().split())
if(a % 2 == 0 and b % 2 == 0):
  print("Even")
else:
  print("Odd")
# Judge status: Wrong Answer
n = int(input())
a = tuple(map(int, input().split()))

i = 0
ans = 0
while i < n-1:
    j = a[i] + 1
    t = 1
    while j<n:
        if t == a[i] + a[j]:
            ans += 1
        j += 1
        t += 1
    i += 1

print(ans)
# Judge status: Accepted
mod = int(1e9+7)
n,m = map(int,input().split())
if abs(n-m) > 1:
    print(0)
    exit()
if n != m:
    ans = 1
    ans2 = 1
    for i in range(1, m+1):
        ans *= i
        ans %= mod
    for i in range(1,n+1):
        ans2 *= i
        ans2 %= mod
    print(ans*ans2%mod)
else:
    ans = 1
    for i in range(1, n+1):
        ans *= i
        ans %= mod
    print(ans*ans*2%mod)
# Judge status: Accepted
a, b, c = map(int, input().split())
 
print((a-c)//(b+c))
# Judge status: Accepted
n = list(map(int,input().split()))
scores = list(map(int,input().split()))
cards = input()
cards = list(cards)
ans = 0

for i in range(n[0]):
    if i < n[1] or cards[i-n[1]] != cards[i]:
        if cards[i] == 'r':
            ans += scores[2]
        elif cards[i] == 's':
            ans += scores[0]
        else:
            ans += scores[1]
    else:
        cards[i] = 'k'

print(ans)
# Judge status: Accepted
K = int(input())
A, B = map(int, input().split(" "))

if B // K > (A-1) // K:
  print("OK")
else:
  print("NG")
# Judge status: Accepted
n,k,x,y = [int(input()) for i in range(4)]
print(x*min(k,n)+y*max(0,n-k))
# Judge status: Accepted
data = input().rstrip().split(" ")
data2 = input().rstrip().split(" ")
price = []
for i in data2:
    price.append(int(i))
price.sort()
ans = 0
for i in range(int(data[1])):
    ans += price[i]
print(ans)
# Judge status: Wrong Answer
s = [i for i in range(2,14)] + [1]
a, b = map(int, input().split())
print('Alice' if s.index(a)>s.index(b) else 'Bob')
# Judge status: Accepted
S = input()
S = S[::-1]
T = ['dream', 'dreamer', 'erase', 'eraser']

T_rev = []

for i in range(len(T)):
	T_rev.append(T[i][::-1])

flag = True
i = 0
while i < len(S):
	for j in range(len(T)):
		ed = i + len(T_rev[j])
		# print(S[i:ed])
		if (S[i:(i + len(T_rev[j]))] == T_rev[j]):
			i += len(T[j])
			flag = True
			break
		else:
			flag = False

	if(flag == False):
		break

if(flag):
	print('YES')
else:
	print('NO')
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if max(a,b,c)==a and a%2==0:
  print(0)
elif max(a,b,c)==a and a%2==1:
  print(b*c)
elif max(a,b,c)==b and b%2==0:
  print(0)
elif max(a,b,c)==a and b%2==1:
  print(a*c)
elif max(a,b,c)==c and c%2==1: 
  print(b*a)
elif max(a,b,c)==c and c%2==0:
  print(0)
# Judge status: Wrong Answer
S = int(input())
a = S//3
b = a * 0.8
c = a * 1.2
ans = a * b * c
ans = ans * (1/0.96)
print("{0:.6f}".format(ans))
# Judge status: Accepted
n = int(input())

s = set()

for _ in range(n):
  s.add(input())

print(len(s))
# Judge status: Accepted
# -*- coding: utf-8 -*-
dx = [0, 0, 1, -1, 1, -1, -1, 1]
dy = [1, -1, 0, 0, 1, -1, 1, -1]

x, y = map(int,input().split())
ans = [x]
while ans[-1] < y:
    ans.append(ans[-1] * 2)
    #print(ans)
if ans[-1] > y:
    print(len(ans) - 1)
else:
    print(len(ans))
# Judge status: Accepted
S = list(map(int, input().split()))

if S.count(5) == 2 and S.count(7):
  print("YES")
else:
  print("NO")
# Judge status: Accepted
from fractions import gcd

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

def prime_decomposition(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

g = gcd(A, B)

print(len(set(prime_decomposition(g)))+1)
# Judge status: Wrong Answer
import math
N = int(input())

p = []
i = 2
while i <= int(math.sqrt(N))+1:
  if N%i == 0:
    p.append(i)
    N = int(N/i)
    i += 1
  else:
    i += 1
if N != 1:
  p.append(N)
print(len(p))
# Judge status: Accepted
a,b=map(int,input().split())
if a%3!=0 and b%3!=0 and (a+b)%3!=0:
  print('Impossible')
else:
  print('Possible')
# Judge status: Wrong Answer
a,b= list(map(int,input().split()))
if 0 < a:
    print("Positive")
elif b < 0:
    if (b-a+1)%2==1:
        print("Negative")
    else:
        print("Positive")
elif a <= 0 <= b:
	print("zero")
# Judge status: Accepted
x, a, b = map(int, raw_input() .split())
c = abs(a-x)
d = abs(b-x)
if c < d and d > c:
    print "A"
else:
    print "B"
# Judge status: Accepted
n,k=map(int,input().split())
nm=[0 for i in range(200010)]
a=list(map(int,input().split()))
for i in a:
  nm[i]+=1
nm.sort(reverse=True)
for i in range(k):
  n-=nm[i]
print(n)
# Judge status: Accepted
N=int(input())
if N%2==0:
  print((N//2)**2)
else:
  print((N//2)*((N//2)+1))
# Judge status: Accepted
o = input()
e = input()

ans_li = ['#']*(len(o)+len(e))
for i,s in enumerate(o):
    ans_li[i*2]=s
for i,s in enumerate(e):
    ans_li[i*2+1]=s
print(''.join(ans_li))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
d = {}
for ai in a:
  if ai in d:
    d[ai] += 1
  else:
    d[ai] = 1
ans = 0
for ai in d:
  ans += max(0, d[ai] - ai)
print(ans)
# Judge status: Accepted
def resolve():
    N, M = list(map(int, input().split()))
    A = sorted(list(map(int, input().split())), reverse=True)
    total = sum(A)
    choose = 0
    th = total/(4*M)
    for a in A:
        if a < th:
            continue
        choose += 1
    print("Yes" if choose >= M else "No")



if '__main__' == __name__:
    resolve()
# Judge status: Wrong Answer
n = int(input())

s_L = []
for i in range(n):
    s_L.append(int(input()))

ans = sum(s_L)
if ans % 10 != 0:
    print(ans)

s_L = sorted(s_L)

for i in range(n):
    if s_L[i]%10 != 0:
        print(ans-s_L[i])
        exit()

print(0)
# Judge status: Accepted
def main():
    s = list(input())

    n = len(s)
    start = -1
    for i in range(n):
        if s[i] == 'A' and start == -1:
            start = i
        if s[i] == 'Z':
            end = i

    ans = end - start + 1
    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Accepted
n,m = map(int, input().split())
x = sorted(list(map(int, input().split())))

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

nums = [0]*(m-1)
for i in range(m-1): nums[i] = x[i+1] - x[i]
nums = sorted(nums)
print(sum(nums[:m-1-(n-1)]))
# Judge status: Accepted
n,a,b=map(int,input().split())
print(n//(a+b)*a+min(a,n%(a+b)))
# Judge status: Accepted
import math

n, x, t = [int(x) for x in input().split()]

ans = math.ceil(n / x) * t
print(ans)
# Judge status: Accepted
A,s,C = map(str, input().split())

print(A[0] + s[0] + C[0])
# Judge status: Accepted
d=int(input())

a="Christmas"
b=" Eve"

print(a+b*(25-d))
# Judge status: Accepted
n = int(input())
A = [0]*n
B = [0]*n

for i in range(n):
    a, b = map(int, input().split())
    A[i], B[i] = a, b

ans = 0
temp = 0
for i in reversed(range(n)):
    if (A[i]+temp)%B[i] != 0:
        j = (A[i]+temp)//B[i]
        ans += B[i]*(j+1)-(A[i]+temp)
        temp += B[i]*(j+1)-(A[i]+temp)
print(ans)
# Judge status: Accepted
S = input()

while True:
  S = S[:-1]
  if len(S) % 2 != 0:
    continue
  else:
    if S[:len(S)//2] == S[len(S)//2 : ]:
      print(len(S))
      exit()
# Judge status: Wrong Answer
l,r,d=map(int,input().split())
print(r//d-l//d)
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))

ans = 1
inc = False
dec = False
before = A[0]
for a in A:
    if not inc and not dec:
        if a > before:
            inc = True
        if a < before:
            dec = True
    elif inc:
        if a < before:
            ans += 1
            inc = False
    elif dec:
        if a > before:
            ans += 1
            dec = False
    before = a
print(ans)
# Judge status: Accepted
a,b=map(int,input().split());print(a+b//2)
# Judge status: Wrong Answer
num = int(input())
lista=[]
ans = 0
for i in range(num):
  j= list(map(int, input().split()))
  a=j[0]-j[1]
  b=j[0]+j[1]
  lista.append([a,b])
lista.sort(key=lambda x: x[1])
print(lista)

def list_func(x):
  global ans
  xa=[i for i in x if i[0]>=x[0][1]]
  ans+=1
  return xa
while(len(lista)):
  lista=list_func(lista)
print(ans)
# Judge status: Accepted
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7 # 998244353
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    n = int(input())
    res = []
    coef = 1
    while n:
        if n & 1:
            res.append('1')
            n -= coef
        else:
            res.append('0')
        coef *= -1
        n >>= 1
    res = ''.join(res[::-1]) if res else '0'
    print(res)
resolve()
# Judge status: Wrong Answer
n = int(input())
a = sorted(list(map(int, input().split())))
b = set(a)
count = 0
z = 0
for i in b:
    if i <= 10**5:    
        j = a.count(i)
        if j < i:
            count += j
            z += j
        else:
            k = j - i
            count += k
            z += j
    else:
        f = len(a) - z
        count += z
        break

print(count)
# Judge status: Wrong Answer
d,t,s=map(int,input().split())
print("Yes" if t/s<=t else "No")
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))
prev = 10**9+1
stair = "Yes"
hlen = len(h)
for i in range(n):
  hgt = h[hlen-1-i]
  if hgt>prev+1:
    stair = "No"
    break
  elif hgt==prev+1:
    prev = hgt-1
  else:
    prev = hgt
print(stair)
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))

lmax = max(L)
L.remove(lmax)
tot = sum(L)

if lmax < tot:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a,b,c,x=[int(input()) for i in range(4)]
ans=0
for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500*i+100*j+50*k==x:
        ans += 1
print(ans)
# Judge status: Wrong Answer
N,X=map(int,input().split())
import math
a=list(map(int,input().split()))
a.append(X)
a.sort()
S=[]
for i in range(N):
    S.append(a[i+1]-a[i])
    
ans=S[0]
for j in range(1,N):
    math.gcd(ans,S[j])

print(ans)
# Judge status: Accepted
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    A, B, C = map(int, readline().split())
    if A + B >= C:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()
# Judge status: Accepted
a, b, c = map(int, input().split())

if a == b and b == c and c == a:
    print("No")

elif a != b and b != c and c != a:
    print("No")

else:
    print("Yes")
# Judge status: Accepted
n = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(n-1):
    dif = A[i] - A[i+1]
    if dif > 0:
        A[i+1] += dif
        ans += dif
print(ans)
# Judge status: Wrong Answer
w, a, b = map(int, input().split())
if a < b:
  print(abs(a+w-b))
else:
  print(abs(b+w-a))
# Judge status: Wrong Answer
import math

a,b,x = map(int,input().split())
if (a**2)*b == x:
    print(90)
else:    
    if 2*(a**2)*b <= 2*(a**2)*x:
        print(math.degrees(math.atan2(2*((a**2)*b-x), a**3)))
    else:
        print(math.degrees(math.atan2(a*(b**2), 2*x)))
# Judge status: Wrong Answer
n = int(input())
A=[0]*n
maxd = 0
smax = 0
for i in range(n):
	A[i] = int(input())
	if A[i] > maxd:
		smax = maxd
		maxd =A[i]
for i in range(n):
	if A[i]==maxd:
		print(smax)
	else:
		print(maxd)
# Judge status: Accepted
n=int(input())
*p,=map(int, input().split())
ans=0
for i in range(1,n-1):
    if (p[i-1] < p[i] < p[i+1]) or (p[i-1] > p[i] > p[i+1]): ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
s = list(input() for _ in range(n))
print(len(set(s)))
# Judge status: Accepted
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop

import collections

a,b = map(int,input().split())
if a>=9  or b>=9:
    print(":(")
else:
    print("Yay!")
# Judge status: Accepted
from collections import Counter
n = int(input())
d = list(map(int,input().split()))
c = Counter(d)
mod=998244353
if d[0]==1:
    print(0)
else:
    D = 1
    for i in d[1:]:
        D = (D*c[i-1])%mod
    print(D)
# Judge status: Accepted
n, k = map(int, input().split())
s = input()
a = 'A'
s = s+'B'
cnt = -1
for i in s:
  if a != i:
    a = i
    cnt += 1
print(n-max(1,cnt-2*k))
# Judge status: Accepted
in_set = set(input())
if '7' in in_set:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
k,x=map(int,input().split())
for i in range(x-(k-1),x+k):
  print(i,end=' ')
# Judge status: Accepted
x=int(input())
# 何もしないの全探索
ans,i=0,0
while True:
    if ans>=x:
        break
    ans+=i
    i+=1
print(i-1)
# Judge status: Accepted
c = input()
b = ['a', 'i', 'u', 'e', 'o']
if c in b:
  print('vowel')
else:
  print('consonant')
# Judge status: Accepted
from math import ceil
N,H=map(int, input().split())

A=[0]*N
B=[0]*N
for i in range(N):
    a,b=map(int, input().split())
    A[i]=a
    B[i]=b

A=sorted(A)
B=sorted(B, reverse=True)
amax=max(A)

ans=0

for i in range(N):
    b=B[i]
    if b>amax:
        H-=b
        ans+=1
        if H<=0:
            break
    else:
        break
if H>0:
    ans+=ceil(H/amax)
print(ans)
# Judge status: Accepted
day = int(input())
posreday= int(input())
price = int(input())
posreprice = int(input())
if day<= posreday:
  print(day * price)
elif day > posreday:
  print(posreday * price + (day - posreday) * posreprice)
# Judge status: Accepted
n = input()
S = input()
x = xmax = 0
for s in S:
  x += 1 if s == 'I' else -1
  xmax = max(x, xmax)
print(xmax)
# Judge status: Accepted
#ABC045 A
a=int(input())
b=int(input())
h=int(input())
print(int((a+b)*h/2))
# Judge status: Wrong Answer
n,k=map(int,input().split())
print((n+k+1)//k)
# Judge status: Accepted
n = int(input())
print(n+n**2+n**3)
# Judge status: Wrong Answer
n = int(input())
x_y = [[] for i in range(n)]
for i in range(n):
	x_y[i] = list(map(int, input().split()))

x_ = sorted(x_y, key=lambda x: x[0])

#print(x_)
ans = 0
for l in range(n):
	for r in range(n-1,l,-1):
#		print(l,r)
		kyori = (x_[r][0] - x_[l][0]) + (x_[r][1] - x_[l][1])
		if kyori < 0:
			kyori = -kyori
		print(kyori)
		if kyori > ans:
			ans = kyori
print(ans)
# Judge status: Accepted
N, K, S = map(int, input().split())
if S > 2:
    print(*([S]*K+[S-1]*(N-K)))
else:
    print(*([S]*K+[S+10**6]*(N-K)))
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**8)

s = int(input())
mod = pow(10, 9)+7
d = dict()

def solve(n):
    if n in d.keys():
        return d[n]
    cnt = 0
    for i in range(3, n+1):
        if n-i >= 3:
            cnt += solve(n-i)
        else:
            if n-i == 0:
                cnt += 1
    d[n] = cnt%mod
    return d[n]

print(solve(s)%mod)
# Judge status: Accepted
import heapq
from collections import defaultdict

n, m = map(int, input().split())
ans = 0
jobs = defaultdict(list)
to_do = []
heapq.heapify(to_do)
for i in range(n):
    array = list(map(int, input().split()))
    array[1] *= -1
    jobs[array[0]].append(array[1])

for i in range(1, m+1):
    if len(jobs[i]) > 0:
        for j in jobs[i]:
            heapq.heappush(to_do, j)
    if len(to_do) > 0:
        ans += -1 * heapq.heappop(to_do)

print(ans)
# Judge status: Accepted
N=int(input())
S=input()
ans=0
for i in range(1,N+1):
    count=0
    for s in set(S[:i]):
        if s in S[i:]:
            count+=1
    ans=max(ans,count)
print(ans)
# Judge status: Accepted
from collections import Counter
w = input()
counts = Counter(w).values()
flag = True
for count in counts:
    if count % 2 != 0:
        flag = False
        break
print('Yes' if flag else 'No')
# Judge status: Accepted
import decimal
import math

N, K = map(int, input().split())
#coin = [decimal.Decimal('0.5')**k for k in range(10**4)]
ans = 0

for i in range(1,N+1):
    tmp = math.log(K/i, 2)
    x = int(math.log(K/i,2))
    if i >= K:
        ans += 1/N
    else:
        if tmp - x != 0:
            x += 1
        ans += 1/N * (0.5)**x

print(ans)
# Judge status: Accepted
A, B, C = map(int, input().split())

if (A == B and B != C) or (A == C and A != B) or (B == C and C != A):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import bisect
N=int(input())
A=[int(input()) for _ in range(N)]
color=[-1]*(N)
for a in A:
    i=bisect.bisect_left(color,a)
    color[i-1]=a
print(N-bisect.bisect_right(color,-1))
# Judge status: Accepted
a,b=[int(i) for i in input().split()]

x=(a+b)/2

import math

print(math.ceil(x))
# Judge status: Accepted
a,b,c=map(int,input().split())
s = [a,b,c]
s = sorted(s)
print('Yes' if s[0]+s[1]==s[2] else 'No')