peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(4100000)
import math
import itertools
INF = float('inf')
from heapq import heapify, heappop, heappush

def main():
    x,y = map(int, input().split())
    print(int(math.log(y/x,2))+1)


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
q,h,s,d=map(int,input().split())
n=int(input())
ans=0
a=min(4*q,2*h,s)
b=min(4*q,2*h,s,0.5*d)

if n%2==0:
	ans=b*n
else:
	ans=b*(n-1)+a

print(int(ans))
# Judge status: Accepted
N = int(input())
AB = [[int(i) for i in input().split()] for _ in range(N)]

A, B = map(list, zip(*AB))
A.sort()
B.sort()

if N % 2 == 0 :
  print(B[N//2] + B[N//2-1] - A[N//2] - A[N//2-1] + 1)
else :
  print(B[N//2] - A[N//2] + 1)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
ans_l = [0]*n
print(ans_l)
for i in reversed(range(1,n)):
    print(i)
    print(sum(ans_l[(i)::(i+1)]))
    if sum(ans_l[(i)::(i+1)])%2 != a[i]:
        ans_l[i] += 1
if sum(ans_l)%2 != a[0]:
    ans_l[0] += 1
ans = []
for i in range(n):
    if ans_l[i]==1:
        ans.append(i+1)
print(len(ans))
if len(ans)>0:
    print(" ".join(map(str, ans)))
# Judge status: Wrong Answer
X = int(input())
result = False

while result == False:
  for i in range(2, -(-X//2)+1):
    if X % 2 == 0:
      result = False
      X += 1
      break
    else:
      result = True

print(X)
# Judge status: Wrong Answer
A, B, C = map(int, input().split())
X = (A|B|C)^(A&B&C)
ans = (X&-X).bit_length()-1
print(ans)
# Judge status: Accepted
n,x,t = map(int,input().split())
ans = -(-n//x)*t
print(ans)
# Judge status: Accepted
N=str(input())
if int(N[0])==7 or int(N[1])==7 or int(N[2])==7:print('Yes')
else:print('No')
# Judge status: Wrong Answer
N = input()
ret = 0
for c in N:
  ret += (ret + int(c)) % 9
  
if ret  == 0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush
from fractions import gcd
from math import ceil, floor, sqrt
from copy import deepcopy

def main():
    a,b = map(int, input().split())
    num = b - a
    if num%2 == 0:
        print(b - (num//2))
    else:
        print("IMPOSSIBLE")

if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
from collections import Counter

N = int(input())

A = list(map(int, input().split()))
c = Counter(A)
S = sum(A)

Q = int(input())
for _ in range(Q):
    x, y = map(int, input().split())
    S += (c[x]*(y-x))
    print(S)
    c[y] = c[x]
    c[x] = 0
# Judge status: Wrong Answer
n,k = map(int,input().split())
r,s,p = map(int,input().split())
t = [p if l=='r' else r if l=='s' else s for l in list(input())]

for i in range(k,n):
    if t[i-k]==t[i]:
        t[i]=0
print(sum(t))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
for i in range(N):
    a = min(A[i], B[i])
    ans += a
    B[i] -= a
    b = min(A[i + 1], B[i])
    A[i + 1] -= b
    ans += b
print(ans)
# Judge status: Wrong Answer
n=int(input())
t=[int(input()) for _ in range(n)]  

mt=t[0]
mx=t[0]
for i in t:
  if mt!=1:
    for j in range(min(i,mx),0,-1):
      if i%j==0 and mx%j==0:
        mt=j
        break
  mx=i*mx//mt

print(mx)
# Judge status: Accepted
import sys
sys.setrecursionlimit(4100000)
import math
INF = 10**9

def main():
    S = input()

    ans = 0
    for i in range(len(S)//2):
        if S[i] != S[-(i+1)]:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
import heapq
N, M = map(int, input().split())
jobs = [[] for _ in range(M)]
for _ in range(N):
    A, B = map(int, input().split())
    if A > M:
        continue
    jobs[M-A].append(B)
ans = 0
q = []
heapq.heapify(q)
for i in range(M-1, -1, -1):
    for item in jobs[i]:
        heapq.heappush(q, item * (-1))
    if q:
        ans += heapq.heappop(q) * (-1)
print(ans)
# Judge status: Wrong Answer
k = int(input(''))
s = str(input(''))

while not 1 <= k <= 100:
    print('out of range! enter again')
    k = int(input(''))

while not s.islower():
    print('must be lowercase! enter again')
    s = str(input(''))

    
if k > len(s):
    print(s)

else:
    out = s[:k] + '...'
    print(out)
# Judge status: Accepted
x=int(input())
f=0
if x == 2:
	print(2)
else:
	for i in range(x,10**6):
		for j in range(2,i//2+2):
			if i%j == 0:
				break
		else:
			f=i
			break
	print(f)
# Judge status: Wrong Answer
N = int(input())
answer = int(N*(N+1)/2)

print(answer)
# Judge status: Accepted
n,k=map(int,input().split())

d={}
for i in range(n):
  a,b=map(int,input().split())
  if a in d:
    d[a]+=b
  else:
    d[a]=b

d_keys=sorted(d.keys())
cnt=0
for i in d_keys:
  cnt+=d[i]
  if cnt>=k:
    print(i)
    exit()
# Judge status: Wrong Answer
n = int(input())
ans = 0
n -= 1
if n % 2 == 0:
  ans = (n+1)*n//2
else:
  ans = (n+1)*n//2 + n//2
print(ans)
# Judge status: Wrong Answer
N, K = map(int, input().split())

m = 10 ** 9 + 7

def foo(x):
  r=1
  for i in range(1,x):
    r *= i
    r %= m
  return r

def in_foo(x):
  return pow( foo(x), m-2, m)

def bn(x, y):
  r = foo(x)
  r *= in_foo(y)
  r *= in_foo(x-y)
  return r % m

ans = 0
for i in range(K, N+2):
  ans += bn(N+1, i)
  ans %= m

print(ans)
# Judge status: Wrong Answer
O=input()
E=input()
print(*[o+e for o,e in zip(O,E)],sep="")
# Judge status: Wrong Answer
if sum(map(int,str(input())))==9:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
a,b=map(int,input().split())
if 0<a<10 and 0<b<10:
    print(a*b)
else:
    print(-1)
# Judge status: Accepted
#ABC063.B
S = input()
cnt = 0
for i in S:
    if S.count(i) != 1:
        cnt +=1
if cnt == 0:
    print('yes')
else:
    print('no')
# Judge status: Accepted
N=int(input())
if N%2==0:
  print(0.5)
else:
  print(float((N-1)/2+1)/N)
# Judge status: Accepted
n=int(input())
s=input()
t=input()
cnt=0
for i in range(min(len(s),len(t))+1):
    #print(s[len(s)-i:],t[:i])
    if s[len(s)-i:]==t[:i]:
        cnt=i
    

print(len(s)+len(t)-cnt)
# Judge status: Wrong Answer
N, M = map(int, input().split())
a = []
b = []
for i in range(N):
    a.append(input())
c, d = 0, 0
for i in range(M):
    b.append(input())
for i in range(N-M+1):
    for j in range(N-M+1):
        for k in range(M):
            if a[i+k][j:j+M] == b[k]:
                c += 1
        if c == M:
            d = 1
            break
print("Yes" if d == 1 else "No")
# Judge status: Accepted
n = int(input())
print(((n % 2 != 0) + n // 2) / n)
# Judge status: Accepted
x = int(input())
print((x//500)*1000 +(x%500//5)*5)
# Judge status: Accepted
n,k=[int(i) for i in input().split()]

if n%k==0:
    print(0)
else:
    print(1)
# Judge status: Accepted
S = input()
d = {"SUN":0, "MON":1, "TUE":2, "WED":3, "THU":4, "FRI":5, "SAT":6}
print(7 - d[S])
# Judge status: Wrong Answer
A,B,C = map(int,input().split())
ans = 0
if(A>B and A>C):
    ans = max(A*10+B+C,ans)
if(B>A and B>C):
    ans = max(B*10+A+C,ans)
else:
    ans = max(C*10+A+B,ans)
print(str(ans))
# Judge status: Wrong Answer
A, B = map(int, input().split())
S = input()

if S[:A].isdigit() and S[A] == '-' and S[A+2:A+B+1].isdigit():
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
a,b,c = map(int, input().split())
if a!=b!=c:
  print(3)
elif a!=b==c or a==c!=b or a==b!=c:
  print(2)
else:
  print(1)
# Judge status: Accepted
# A - Serval vs Monster
# https://atcoder.jp/contests/abc153/tasks/abc153_a?lang=en
# s[0],[1]
# a = input().split()strs
def main():
  s = list(map(int,input().split()))
  hp = s[0]
  ad = s[1]
  ans = int(hp / ad)
  if(ans * ad < hp):ans = ans + 1
  print(ans)
if __name__ == '__main__':
  main()
# Judge status: Accepted
n, k = map(int, input().split())
a = list(map(int, input().split()))

if n == k:
  print(1)
else:
  print(-(-(n-1)//(k-1)))
# Judge status: Accepted
x,y = map(int,input().split())
point = 0
while x <= y:
    point += 1
    x *= 2
print(point)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
_A = [0] * (N + 1)
L = sum(A)
res = 1_000_000_000_000_000_000
for i in range(N - 1):
    _A[i + 1] = _A[i] + A[i]
    res = min(res, abs(_A[i + 1] - L + _A[i + 1]))
print(res)
# Judge status: Accepted
#!/usr/bin/env python3
N = int(input())
S = [sorted(input()) for _ in range(N)]
S = sorted(S)
cnt = 0
x = S[0]
cnt_all = 0
for s in S[1:]:
    if x == s:
        cnt += 1
    elif cnt > 0:
        cnt += 1
        cnt_all += int(cnt*(cnt - 1)/2)
        cnt = 0
        x = s
    else:
        x = s

cnt += 1
cnt_all += int(cnt*(cnt - 1)/2)

print(cnt_all)
# Judge status: Wrong Answer
d, n = map(int, input().split())
if (d == 0 or d == 1) and n == 100:
    print(100 ** d * 101)
else:
    print(100 ** d ** n)
# Judge status: Accepted
n=int(input())
a = list(map(int, input().strip().split()))
a.sort()
lim=10**6+1
ans=0
multiples=[False]*lim

for i in range(n):
    if multiples[a[i]]==True:
        continue
    elif i!=n-1 and a[i]==a[i+1]:
        pass
    else:
        ans+=1
    for j in range(a[i],lim,a[i]):
        multiples[j]=True

print(ans)
# Judge status: Wrong Answer
x,y = map(int,input().split())
m_x = x*(-1)

if x<y:
    print(y-x)
elif m_x<=y and x>=y:
    print(abs(y-m_x)+1)
else:
    print(abs(y-x)+2)
# Judge status: Accepted
def fib(n):
    if n == 1:
        return 1
    if n == 2:
        return 2
    else:
        a,b = 0,1
        for i in range(n):
            a,b = b,a+b
        return b

n,m = map(int,input().split())
mod = 10**9+7
ans = 1
a = -1
for i in range(m):
    b = int(input())
    if a != -1 and b-a == 1:
        print(0)
        break
    ans *= fib(b-a-2)
    a = b
else:
    ans *= fib(n-a-1)
    print(ans%mod)
# Judge status: Wrong Answer
N, x = map(int, input().split())
A = sorted(map(int, input().split()))

if sum(A) == x:
    print(x)

else:
    c = 0
    for ai in A:
        x -= ai
        if x <= 0:
            break
        c += 1

    print(c + 1 if x == 0 else c)
# Judge status: Accepted
N = int(input())
#print(N)

print(N*800-N//15*200) #除算(切り捨て)
# Judge status: Accepted
n = int(input())
items = [input() for _ in range(n)]

print(len(list(set(items))))
# Judge status: Accepted
n=int(input())
d=list(map(int,input().split()))

if d[0]!=0:
  print(0)
  exit(0)
  
m=max(d)
counts=[0]*(m+1)

import collections
counter=collections.Counter(d)

for key,val in counter.items():
  counts[key]=val
if counts[0]!=1:
  print(0)
  exit(0)
ans=1
div=998244353
for i in range(1,len(counts)):
  ans*=pow(counts[i-1],counts[i],div)
  ans%=div
  
print(ans)
# Judge status: Accepted
s = set(input())

if len(s) == 2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
d = int(input())
ans = ["Christmas"]
for i in range(d, 25):
    ans.append("Eve")
print(" ".join(ans))
# Judge status: Wrong Answer
a, b = map(int, input().split())
c = min(a,b)
s = [1]
t = []
i = 2
while i <= c**0.5+1:
  if a%i==0 and b%i==0:
    a //= i
    b //= i
    if not(i in s):
      s.append(i)
    c = min(a,b)
  else:
    i += 1
if c!=1 and max(a,b)%c==0 and all([i==1 or c%i>0 for i in s]):
  s.append(c)
print(len(s))
# Judge status: Accepted
def main():
    a, b = map(int, input().split())
    if b == 1:
        print(0)
    else:
        cnt = 0
        target = a
        while True:
            cnt += 1
            if target >= b:
                break
            target += a -1
        print(cnt)

if __name__ == "__main__":
    main()
# Judge status: Accepted
n = int(input())

den = int(1e9 + 7)
print((10**n - 2 * 9**n + 8**n) % den)
# Judge status: Accepted
A, B, X = map(int, input().split())
if A <= X <= A + B:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
N, K = map(int, input().split())
h = list(map(int,input().split()))

dp = [float("INF")] * N
dp[0] = 0
K = min(N-1, K)
for i in range(1, K+1):
  dp[i] = abs(h[i] - h[0])

for i in range(K, N):
  c = [float("INF")] * (K+1)
  for j in range(1, K+1):
    c[j] = dp[i-j] + abs(h[i] - h[i-j])
  dp[i] = min(c)
  
print(dp[N-1])
# Judge status: Accepted
A,B = map(int,input().split())
if(A % B == 0):
	print(-1)
	exit()
else:
	print(A)
# Judge status: Accepted
h, n = map(int, input().split())
ab = list(list(map(int, input().split())) for _ in range(n) )

dp = [0] * (h + max(list( node[0] for node in ab )))

for i in range(1, len(dp)):
  dp[i] = min(list(dp[i - a] + b for a, b in ab))
print(dp[h])
# Judge status: Wrong Answer
import math
A, B = map(float, input().split())
print(math.floor(A * B))
# Judge status: Accepted
n = int(input())
a=list(map(int,input().split()))
cnt,cnt2,cnt4=0,0,0
for val in a:
    if val%4==0:
        cnt4+=1
    elif val%2==0:
        cnt2+=1
    else:
        cnt+=1
if cnt2==n: print("Yes")
elif cnt2==0:
    if cnt4>=cnt-1: print("Yes")
    else: print("No")
else:
    if cnt4>=cnt: print("Yes")
    else: print("No")
# Judge status: Accepted
d=int(input())
if d==25:
  print("Christmas")
elif d==24:
  print("Christmas Eve")
elif d==23:
  print("Christmas Eve Eve")
else:
  print("Christmas Eve Eve Eve")
# Judge status: Accepted
x, k, d = map(int, input().split())
x = abs(x)
straight = min(k, x // d)
k -= straight
x -= straight * d
if k % 2 == 0:
  print(x)
else:
  print(d - x)
# Judge status: Wrong Answer
s, t = input().split()
print(s + t)
# Judge status: Accepted
N, M = map(int, input().split())
if N == 1 and M == 1:
    print(1)
elif N == 1:
    print(M - 2)
elif M == 1:
    print(N - 2)
else:
    print(N * M - 2 * (N + M - 2))
# Judge status: Accepted
if __name__=="__main__":
    w,h,x,y=[int(x) for x in input().split()]

    a=(w*h)/2

    print(a,end=' ')
    
    if x/1==w/2 and y/1==h/2:
        print(1)
    else: print(0)
# Judge status: Accepted
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys


def get_ints():
    return map(int, sys.stdin.readline().strip().split())


def std_in():
    return sys.stdin.readline().strip()


def main():
    n, d = get_ints()
    d2 = d ** 2
    counter = 0
    for i in range(n):
        x, y = get_ints()
        if d2 >= (x**2 + y**2):
            counter += 1

    print(counter)


if __name__ == "__main__":
    main()
# Judge status: Accepted
import numpy as np

Product_Num, Limit_of_the_weight = map(int, input().split())

dp = np.zeros(Limit_of_the_weight + 1)

for i in range(Product_Num):
    w, v = map(int, input().split())
    dp[w:] = np.maximum(dp[:-w] + v, dp[w:])

print(int(np.max(dp)))
# Judge status: Accepted
INF = float("inf")

H, N, *AB = map(int, open(0).read().split())

dp = [0] + [INF] * H

for a, b in zip(*[iter(AB)] * 2):
    for i in range(H + 1):
        idx = min(i + a, H)
        dp[idx] = min(dp[idx], dp[i] + b)

print(dp[H])
# Judge status: Accepted
def main():
    S = input()
    K = int(input())
    ans = "1"
    for i, s in enumerate(S):
        if s == "1":
            continue
        else:
            if i+1 <= K:
                ans = s
            break
    print(ans)


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


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    packs = read_ints()
    S = sum(packs)
    for pack in packs:
        if pack == S-pack:
            return 'Yes'
    return 'No'


if __name__ == '__main__':
    print(solve())
# Judge status: Accepted
n,x = map(int,input().split())
a_list = list(map(int,input().split()))
a_list.sort()
count = 0
for i in range(n):
    x = x - a_list[i]
    count += 1
    if x <= 0:
        break


if x == 0:
    print(count)
else:
    print(count-1)
# Judge status: Accepted
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

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

if m >= n*2:
    ans = n
    m -= n*2
    n = 0
else:
    ans = m//2
    m = 0

#print(ans,n,m)
if m:
    ans += m//4

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

for i in range(n):
    if a[i] % 2 == 0:
        if a[i] % 3 == 0 or a[i] % 5 == 0:
            continue
        else:
            print('DENIED')
            exit(0)
print('APPROVED')
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
from bisect import bisect_left, bisect_right

N = int(input())
AB = [[int(i) for i in input().split()] for _ in range(N)]

A, B = map(list, zip(*AB))
A.sort()
B.sort()

ng, ok = 0, 10 ** 9 + 10
while ok - ng > 1 :
  mid = (ok + ng) // 2
  if N - bisect_right(A, mid) >= N // 2 + 1 :
    ng = mid
  else :
    ok = mid

ret = -ok

ok, ng = 0, 10 ** 9 + 10
while ng - ok > 1 :
  mid = (ok + ng) // 2
  if bisect_left(B, mid) >= N // 2 + 1 :
    ng = mid
  else :
    ok = mid
    
ret += ok + 1

print(max(0, ret))
# Judge status: Accepted
S = input()
N = len(S)
A = S[:int((N-1)/2)]
B = S[int((N+3)/2)-1:]
out = 0

for i in range(N):
    if S[i]!=S[N-i-1]:
        out = 1
for i in range(len(A)):
    if A[i]!=A[len(A)-i-1]:
        out = 1
for i in range(len(B)):
    if B[i]!=B[len(B)-i-1]:
        out = 1

if out==0:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N=int(input())
 
a=1
 
for i in range(N):
  a*=i+1
  a%=1000000007
 
print(a)
# Judge status: Wrong Answer
x, y = map(int, input().split())

import math
p = int(math.log(y/x, 2))
#print(p)

print(p+1)
# Judge status: Wrong Answer
from collections import defaultdict,deque
import math
def main():
    n,h=map(int, input().split())
    ab = [list(map(int, input().split())) for i in range(n)]
    tmp = max([int(i[0]) for i in ab])
    bs = [int(i[1]) for i in ab]
    bs.sort(reverse = True)
    i = 0
    while(bs[i] > tmp):
        h-=bs[i]
        i+=1
        if(h<=0 or i==n or bs[i] < tmp):
            break

    print(i+math.ceil(h/tmp))





if __name__ == '__main__':
    main()
# Judge status: Accepted
n=int(input())
a=[int(i) for i in input().split()]
d=1
c=0
for i in range(0,len(a)):
    if(a[i]==d):
        d=d+1
        c=c+1
if(c==0):
    print(-1)
else:
    print(len(a)-c)
# Judge status: Accepted
from collections import Counter

def solve():
    N = int(input())
    S = input()
    
    c = Counter(S)
    
    ans = 1
    for v in c.values():
        ans = ans*(v+1) % (10**9+7)
    return (ans-1) % (10**9+7)

print(solve())
# Judge status: Wrong Answer
a = int(input())
b = input().split()
total = 0
max_case = 0
for i in range(len(b)-1):
    if b[i] >= b[i+1]:
        total += 1
    else:
        total=0
    if max_case < total:
        max_case = total
print(max_case)
# Judge status: Accepted
s=input()

def idx_z(s, key):
    for i in range(len(s)-1,0,-1):
        if s[i]==key: return i

pos_Z = idx_z(s,'Z')
pos_A = s.index('A')
print(int(pos_Z)-int(pos_A)+1)
# Judge status: Wrong Answer
S = input()
count_a = 0
count_b = 0
for i in range(len(S)//2):
  if S[2*i] =='0':
    count_a +=1
  if S[2*i + 1]=='1':
    count_a +=1
  if S[2*i] =='1':
    count_b +=1
  if S[2*i + 1]=='0':
    count_b +=1
print(min(count_a, count_b))
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
n=len([i for i in range(1,c) if i%a==0])
print(b*n)
# Judge status: Accepted
n,k = map(int,input().split())
s = list(str(input()))
s[k-1] = str.lower(s[k-1])
print(''.join(s))
# Judge status: Wrong Answer
import sys
readline = sys.stdin.readline
N,K = map(int,readline().split())
A = [0] + list(map(int,readline().split()))
c = 1
while K:
  if K & 1:
    c = A[c]
  A = [A[i] for i in range(len(A))]
  K >>= 1
print(c)
# Judge status: Wrong Answer
s = input()
if s != "0":
  print("1");
else:
  print("0");
# Judge status: Accepted
i = input().split()
 
if ((int(i[0])*int(i[1]))%2)==0:
  print('Even')
else:
  print('Odd')
# Judge status: Accepted
n = int(input())
a = n % 10
if a in [2,4,5,7,9]:
  print("hon")
elif a in [0,1,6,8]:
  print("pon")
elif a in [3]:
  print("bon")
# Judge status: Accepted
K, N = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
m = 0
for i in range(1, len(A)):
    if A[i]-A[i-1]>m:
        m=A[i]-A[i-1]
if K-A[-1]+A[0]>m:
    print(A[-1]-A[0])
else:
    print(K-m)
# Judge status: Accepted
a,b=map(int,input().split())
print((a+b)//2 if (a+b)%2==0 else 'IMPOSSIBLE')
# Judge status: Wrong Answer
n,m=map(int,input().split())
dp=[1]*(n+1)
for i in range(m):
  dp[int(input())]=0
for i in range(2,n+1):
  if dp[i]>0:
    dp[i]=dp[i-1]+dp[i-2]
print(dp[n])
# Judge status: Wrong Answer
n,k=map(int,input().split())
a,ans=[],[]
for i in range(n):
    v,b=map(int,input().split())
    a=[v for j in range(b)]
    ans+=a
    
print(ans[k-1])
# Judge status: Wrong Answer
def main():
  word = input()
  if (word[2]==word[3]) and (word[4]==word[5]):
    print("Yes")
  else:
    print("No")
# Judge status: Wrong Answer
x,y,z = map(int,input().split())
count = 0
t = 0

for i in range(10**6):
  t += y
  if t<=x:
    count += 1
  else:
    break
  t += z
  
print(count)
# Judge status: Accepted

w,a,b = map(int,input().split())
if a+w < b:
    print(b-a-w)
elif b+w < a:
    print(a-b-w)
else:
    print(0)
# Judge status: Accepted
import itertools
def main():
  x,a,b = map(int,input().split())
  print("A" if (abs(a - x) < abs(b - x)) else "B")
if __name__ == '__main__':
  main()
# Judge status: Accepted
N = int(input())
D = list(map(int,input().split()))
if D[0] != 0:
    print(0)
    exit()
from collections import Counter
ctr = Counter(D)
if ctr[0] > 1:
    print(0)
    exit()

MOD = 998244353
ans = 1
for i in range(len(ctr)-1):
    ans *= pow(ctr[i], ctr[i+1], MOD)
    ans %= MOD
print(ans)
# Judge status: Wrong Answer
from collections import defaultdict

def check():
    N,M = map(int, input().split())
    B = []
    hune = defaultdict(list)
    for _ in range(M):
        a,b = map(int, input().split())
        if a == 1:
            B.append(b)
        hune[a].append(b)
    print(hune[1])
    
    for b in B:
        for goal in hune[b]:
            if goal == N:
                print('POSSIBLE')
                return
    print('IMPOSSIBLE ')
    
check()
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

def gcd(a,b):
    while b:
        a, b = b, a%b
    return a

s1 = [a[0]]
s2 = [a[-1]]
for i in range(1, len(a)-1):
    s1.append(gcd(s1[-1], a[i]))
    s2 = [gcd(s2[-1], a[-(i+1)])] + s2
s1 = [a[-1]] + s1
s2 = s2 + [a[0]]


s3 = []
for i in range(len(s1)):
    s3.append(gcd(s1[i], s2[i]))

print(max(s3))
# Judge status: Wrong Answer
x = int(input())
if x == 1:
    print(1)
else:
    print(int(max((x ** (1 / i) // 1) ** i for i in range(2, x + 1))))
# Judge status: Wrong Answer
import math
X = int(input())
Z = 100
res = 0
while (X >= Z):
     Z += Z*0.01
     Z = math.floor(Z)
     res += 1 
print(res)
# Judge status: Wrong Answer
w,h,x,y=map(int,input().split())
print(w*h/2,1if 2*w==x and 2*h==y else 0)
# Judge status: Accepted
N,H=list(map(int,input().split()))
a=[0]*N
b=[0]*N

for i in range(N):
    ta,tb=list(map(int,input().split()))
    a[i]=ta
    b[i]=tb

amax=max(a)
b.sort(reverse=True)

res=10**10
csum=0
for i in range(N+1):
    cnt=i
    ch=H
    csum+=b[i-1] if i>0 else 0
    ch-=csum

    if ch>0:
        cnt+=-(-ch//amax)

    res=min(res,cnt)

print(res)
# Judge status: Accepted
N = int(input())
L = list(map(int,input().split()))
L.sort()

ans = 0
for i in range(N):
  for j in range(i+1, N-1):
    k = L[i]+L[j]
    l,r = 0,N
    while (r-l) > 1:
      m = (l+r)//2
      if L[m] >= k:
        r = m
      else:
        l = m

    ans += r-j-1

print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
dict = {}
b = []
for i in a:
	if i in dict:
		dict[i] += 1
	else:
		dict[i] = 1
	if dict[i] == 2:
		b.append(i)
b.sort(reverse=True)
if len(b) < 2:
	print (0)
else:
	print (b[0] * b[1])
# Judge status: Accepted
n = int(input())
time = [int(input()) for _ in range(5)]
count = 0
if all([i >= n for i in time]):
    print(5)
else:
    smallest = min(time)
    smallest_index = time.index(smallest)
    count += n // smallest
    if n % smallest != 0:
        count += 1
    print(count + 4)
# Judge status: Accepted
s, t = input().split()
a, b = map(int, input().split())
u = input()
if s == u:
    print(a-1, b)
if t == u:
    print(a, b-1)
# Judge status: Accepted
A,B=map(int,input().split())
if A==B:
    print("Draw")
elif A==1:
    print("Alice")
elif B==1:
    print("Bob")
elif A>B:
    print("Alice")
else:
    print("Bob")