peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): 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 LSS(): return input().split()

def resolve():
    X, Y = LI()

    if X % Y > 0:
        print(X)
    else:
        print(-1)

if __name__ == '__main__':
    resolve()
# Judge status: Accepted
def main():
    array = []
    a = int(input())
    for _ in range(4):
        array.append(int(input()))
    k = int(input())

    for p in array:
        if p - a > k:
            print(":(")
            exit()
    print("Yay!")


if __name__ == "__main__":
    main()
# Judge status: Accepted
s = input()
t = input()

lens = len(s)
lent = len(t)

total = 100000000
for i in range(lens-lent+1):
    count = 0
    for j in range(lent):
        if s[i+j]!=t[j]:
            count+=1
    total = min(total,count)

if total == 100000000:
    print(lent)
else:
    print(total)
# Judge status: Wrong Answer
n,m = map(int,input().split())
mn = 10**9
mx = -1

for i in range(m):
    l,r = map(int,input().split())
    if l > mx:
        mx = l
    if r < mn:
        mn = r

print(abs(mx-mn)+1)
# Judge status: Accepted
x = int(input())

num = 0
i = 0
while num < x:
    i += 1
    num += i
if (num - x) < i:
    print(i)
# Judge status: Accepted
n = int(input())
L = [list(map(int, input().split())) for _ in range(n-1)]
for i in range(n-1):
    t = 0
    for j in range(i, n-1):
        if t <= L[j][1]:
            s = L[j][1]
        else:
            if t % L[j][2]:
                s = t + L[j][2] - (t % L[j][2])
            else:
                s = t
        t = s + L[j][0]
    print(t)
print(0)
# Judge status: Accepted
N,M=map(int,input().split())

ps_dic={}
for i in range(M):
  pi,si=input().split()
  if pi not in ps_dic:
    ps_dic[pi]=[si]
  else:
    ps_dic[pi].append(si)
  
#print(ps_dic)
total_ac=0
total_wa=0
for p in ps_dic:
  num_wa=0
  for s in ps_dic[p]:
    if s == "WA":
      num_wa+=1
    elif s == "AC":
      total_ac+=1
      total_wa+=num_wa
      break

print(str(total_ac) + " " + str(total_wa))
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)

a = [0] * 2
i = j = 0
while i < N - 1:
    if A[i] == A[i + 1]:
        a[j] = A[i]
        i += 1
        j += 1
    if j == 2:
        break
    i += 1
print(a[0] * a[1])
# Judge status: Accepted
#Frog1
n=int(input())
h=list(map(int,input().split()))
Min=0
dp={}
for val in range(n):
    if(val==0):
        dp[val]=0
    if(val==1):
        dp[val]=abs(h[0]-h[1])
    elif(val>=2):
        dp[val]=min(abs(h[val]-h[val-1])+dp[val-1],abs(h[val]-h[val-2])+dp[val-2])
print(dp[n-1])
# Judge status: Accepted
s = input()
t = input()

ds = {}
dt = {}

ret = True
for i in range(len(s)):
  cs = s[i]
  ct = t[i]
  ccs = ds.get(cs, 0)
  cct = dt.get(ct, 0)
  if ccs == 0:
      ds[cs] = ct
  elif ccs == ct:
      pass
  else:
      ret = False
      break
  
  if cct == 0:
      dt[ct] = cs
  elif cct == cs:
      pass
  else:
      ret = False
      break

if ret == True:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer

def main():
    n, m = map(int, input().split())
    aa = list(map(int, input().split()))

    from fractions import gcd
    from functools import reduce

    def lcm(x, y):
        return x * y // gcd(x, y)

    l = reduce(lcm, aa)
    count = (m - l//2 + 1) // l + 1

    print(count)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
N, K = map(int, input().split())
S = list(input()+"X")

temp = S[0]
cnt = 1
c_cnt = 1
ans = 0

for i in range(1, N+1):
  if temp == S[i]:
    cnt += 1
  else:
    ans += cnt - 1
    cnt = 1
    c_cnt += 1
    temp = S[i]
  #print(ans, cnt, c_cnt, temp)

#最後の余計な分
c_cnt -= 1

if c_cnt//2 < K:
  ans += (c_cnt//2) * 2
elif c_cnt//2 == K:
  ans += (c_cnt//2) * 2 - 1
else:
  ans += K * 2

print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

ans = 10**8 
for i in range(N-1):
  bar1 = (A[0:i+1])
  bar2 = (A[i+1:])
  
  if abs(sum(bar2) - sum(bar1)) <= ans:
    ans = abs(sum(bar2) - sum(bar1))

print(ans)
# Judge status: Accepted
a=input()
b=input()
c=input()
s="a"
for i in range(len(a)+len(b)+len(c)):
  if s=="a" and len(a)>0:
    s=a[0]
    a=a[1:]
  elif s=="a" and len(a)==0:
    print("A")
    exit()
  elif s=="b" and len(b)>0:
    s=b[0]
    b=b[1:]
  elif s=="b" and len(b)==0:
    print("B")
    exit()
  elif s=="c" and len(c)>0:
    s=c[0]
    c=c[1:]
  else:
    print("C")
    exit()
# Judge status: Wrong Answer
a,b,c = map(int, raw_input().split(' '))
print max(10*a + b, 10*b + c)
# Judge status: Wrong Answer
a, b, c, d = map(int, input().split())

if b < c :
	print(0)
	exit()

if a == 0 and b > c and b < d:
	print(b - c)
	exit()

if a < c and  d < b:
	print(d - c)
	exit()
# Judge status: Accepted
import sys

sys.setrecursionlimit(1000000)

import bisect
import math
import collections
import heapq


def solve(N, K, As):
    ans = []
    for i in range(N-K):
        left_a = As[i]
        right_a = As[i+K]
        if left_a < right_a:
            ans.append("Yes")
        else:
            ans.append("No")

    return "\n".join(ans)


if __name__ == "__main__":
    N, K = tuple(map(int, input().split(" ")))
    As = list(map(int, input().split(" ")))
    print(solve(N, K, As))
# Judge status: Wrong Answer
w = input()
for i in range(ord('a'), ord('z') + 1):
  c = str(i)
  if w.count(c) % 2 == 1:
    print('No')
    break
else:
  print('Yes')
# Judge status: Accepted
min_x = 123
max_x = 0

for _ in range(5):
    x = int(input())
    if x <= min_x:
        min_x = x
    if x >= max_x:
        max_x = x

k = int(input())
if k < max_x-min_x:
    print(":(")
else:
    print("Yay!")
# Judge status: Accepted
a, b, c, k = map(int, input().split())

sum = 0
if k > a:
    sum += a
    k -= a
    if k > b:
        k -= b
        if k > c:
            sum -= c
        else:
            sum -= k      
else:
    sum += k

print(sum)
# Judge status: Wrong Answer
N=int(input())
d=[int(s) for s in input().split(" ")]

d.sort()

if (N//2)%2==0:
    print(0)
else:
    K=d[(N//2)]-d[N//2-1]
    print(K)
# Judge status: Wrong Answer
N=int(input())
a=list(map(int,input().split()))
ans=0
l=1
for i in a:
  if i!=l:
    ans+=1
  else:
    l+=1
if ans==0:
  print("-1")
else:
  print(ans)
# Judge status: Accepted
n=int(input())
s=list(input() for i in range(n))
m=int(input())
t=list(input() for j in range(m))
l=list(set(s))
ans=max(0,max(s.count(l[k])-t.count(l[k]) for k in range(len(l))))
print(ans)
# Judge status: Accepted
N,M = map(int,input().split())
l = [list(map(int,input().split())) for i
     in range(N)]
for i in range(N):
  del l[i][0]

for i in range(N-1):
    a = set(l[i])&set(l[i+1])
    l[i+1] = a
if N==1:
  print(len(l[0])) 
else:
  print(len(a))
# Judge status: Accepted
import collections


def main():
    s = list(input())
    c = collections.Counter(s)
    keys = list(c.keys())
    print("Yes" if ((keys.count("S") == 0 and keys.count("N") == 0) or (keys.count("S") == 1 and keys.count("N") == 1)) and (
        (keys.count("E") == 0 and keys.count("W") == 0) or (keys.count("E") == 1 and keys.count("W") == 1)) else "No")


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
NM =input().split()
N = int(NM[0])
M = int(NM[1])
H = input().split()
Nout = [1] * N
for i in range(M):
	road = input().split()
	if float(H[int(road[0]) - 1]) < float(H[int(road[1]) - 1]):
		Nout[int(road[0]) - 1] = 0
	else:
		Nout[int(road[1]) - 1] = 0
def calc():
	j = 0
	for i in Nout:
		j += i
	return j
print(calc())
# Judge status: Accepted
c=[list(map(int,input().split())) for _ in range(3)]
for i in range(3):
  for j in range(3):
    if c[i][j]!=c[i][(j+1)%3]+c[(i+1)%3][j]-c[(i+1)%3][(j+1)%3]:
      print('No')
      exit()
print('Yes')
# Judge status: Wrong Answer
S = input()
T = input()

ans = []

for index, s in enumerate(S):
  if s == '?' or s == T[0]:
    if index+len(T)-1 > len(S)-1:
        break

    for indexs, t in enumerate(T):
      if S[index+indexs] != t and S[index+indexs] != '?':
        break
    else:
      ans.append(S[0:index]+T+S[index+len(T):])

print(ans)
if len(ans) == 0:
  print("UNRESTORABLE")
else:
  ans.sort()
  print(ans[0].replace('?', 'a'))
# Judge status: Accepted
import math
# A, B, H, M = 3, 4, 9, 0
A, B, H, M = map(int, input().split())

deg = 0
deg += 5.5 * M
deg -= 30 * H

print(math.sqrt(A**2 + B**2 - 2*A*B* math.cos(math.radians(abs(deg)))))
# Judge status: Wrong Answer
r = int(input())
x = int (3.14 * (r ** 2) / 3.14)
print(x)
# Judge status: Accepted
S=list(input())
ans=0

for i in range(len(S)):
    if ans==0 and S[i]=="R":
        ans=1
for i in range(len(S)-1):
    if S[i]=="R" and S[i+1]=="R":
        ans+=1

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

if a+b>=c:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N,A,B=map(int,input().split())
if((A-B)%2==0):
 print(abs(A-B)//2)
else:
 print(min(B-1,N-A-1))
# Judge status: Wrong Answer
n,k = map(int,input().split())
if k == 0:
  print(n)
  exit()
dislike = list(map(int,input().split()))

ref = [0,1,2,3,4,5,6,7,8,9,0]
for i in range(10):
  while ref[i] in dislike:
    ref[i] = (ref[i]+1)%10

ans = ''
for i in str(n):
  ans += str(ref[int(i)])

if int(ans)<n:
  ans = str(ref[1])+str(ref[0])*len(str(n))
print(ans)
# Judge status: Accepted
a,b=map(int,input().split())
c=0
for i in range(2):
  if a>=b:
    c+=a
    a-=1
  else:
    c+=b
    b-=1
print(c)
# Judge status: Accepted
import sys
from pprint import pprint

def solve(n):
    c = [[0 for i in range(10)] for j in range(10)]
    for i in range(1, n+1):
        str_i = str(i)
        len_i = len(str_i)
        c[int(str_i[len_i-1])][int(str_i[0])] += 1
    ans = 0
    for i in range(10):
        for j in range(10):
            ans += c[i][j] * c[j][i]
        
    print(ans)

if __name__ == '__main__':
    n = int(sys.stdin.readline().strip())
    solve(n)
# Judge status: Accepted
a,b,c,d=map(int,input().split())
flag=False
if abs(a-c)<=d:
    flag=True
elif abs(a-b)<=d and abs(c-b)<=d:
    flag=True

if flag:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
l = list(set(list(map(int, input().split()))))
print(len(l))
# Judge status: Accepted
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(input())
s = input()
from collections import Counter
c = Counter(s)
M = 10**9+7
ans = 1
for k,v in c.items():
    ans *= (v+1)
    ans %= M
ans -= 1
print(ans%M)
# Judge status: Accepted
n = int(input())
s = list(str(n))

if s[0]=="7" or s[1]=="7" or s[2]=="7":
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
D = list(map(int, input().split()))

if D[0] != 0:
    print(0)
    exit()

A = [0]*n

for i in range(n):
    A[D[i]] += 1

#print(A)

if A[0] != 1:
    print(0)
    exit()

ans = 1
mod = 998244353
for i in range(1, n):
    ans *= A[i-1]**A[i]
    ans %= mod
print(ans)
# Judge status: Wrong Answer
N = int(input())
X = list(map(int, input().split()))
X_sort = sorted(X)

# print(X_sort)

middle_left = X_sort[N//2-1]
middle_right = X_sort[N//2]
# print(middle_left, middle_right)

for idx, x in enumerate(X):
    if idx <= N//2-1:
        if middle_right != x:
            print(middle_right)
        else:
            print(middle_left)
    else:
        if middle_left != x:
            print(middle_left)
        else:
            print(middle_right)
# Judge status: Accepted
a=int(input())
an=[int(i) for i in input().split()]
count=0
for i in an:
  if i%2==0:
    count+=1
  if i%4==0:
    count+=1
if a%2==1:
  a-=1
if count>=a:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n , l = map(int , input().split())
s = [input() for i in range(n)]
s.sort()
print(''.join(s))
# Judge status: Wrong Answer
s = str(input())
L = [753]
for i in range(len(s) - 2):
  a = int(s[i:i + 3])
  L.append(a)
L.sort()
for j in range(len(L)):
  if L[j] == 753:
    if j == len(L) - 1:
      print(L[j] - L[j - i])
      break
    if j == 0:
      print(L[j + 1] - L[j])
      break
    else:
      if L[j + 1] - L[j] <= L[j] - L[j - 1]:
        print(L[j + 1] - L[j])
      else:
        print(L[j] - L[j - 1])
      break
# Judge status: Accepted
from collections import Counter

N = int(input())
strings = [input() for _ in range(N)]
ctypes = set(''.join(strings))
counters = [Counter(s) for s in strings]

s = ''

for c in ctypes:
    s += c * min([counter[c] for counter in counters])

print(''.join(sorted(s)))
# Judge status: Accepted
Q,H,S,D = map(int, input().split())
N = int(input())
Q *= 4
H *= 2
min_cost = min(Q,H,S)
res = 0
if N%2:
    N -= 1
    res += min_cost
if N != 0:
    res += N//2*min(2*min_cost,D)
print(res)
# Judge status: Wrong Answer
w = input()
beau = {}
for i in range(len(w)):
    if not w[i] in beau:
        beau[w[i]] = 1
    else:
        beau[w[i]] += 1
num = sum(list(beau.values()))%2
if num == 0:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
a4 = 0
a2 = 0
a0 = 0
for i in a:
    if i % 4 == 0:
        a4 += 1
    elif i % 2 == 0:
        a2 = 1
    elif i % 2 != 0:
        a0 += 1
if a4 + 1 - a2 < a0:
    print('No')
else:
    print('Yes')
# Judge status: Accepted
n = int(input())

x = 800 * n
y = int(n // 15) * 200
print(x-y)
# Judge status: Accepted
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    total = 0
    for a in A:
        total ^= a
    ans = []
    for a in A:
        ans.append(total^a)
    return ans
print(*solve())
# Judge status: Accepted
from bisect import bisect, bisect_left
N = int(input())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

ans = 0
for i in B:
    max_A = bisect(A, i-1)
    min_C = bisect_left(C, i+1)
    # print("m_A", max_A, "m_C", min_C)
    ans += (max_A)* (len(C) - min_C)
print(ans)
# Judge status: Accepted
n = int(input())
ans = 0

for i in range(30):
    for j in range(15):
        if i*4 + j*7 == n:
            ans += 1

print("Yes" if ans >= 1 else "No")
# Judge status: Accepted
n=int(input())

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

ans = 10000000000

for i in range(-100, 101):
    memo = 0
    for j in t:
        memo += (i-j)**2
    ans = min(ans, memo)
print(ans)
# Judge status: Wrong Answer
import bisect
n=int(input())
a=sorted(list(map(int,input().split())))
ind=bisect.bisect_left(a,0)


if ind==0 :
  print(sum(a))
  
elif ind==n:
  print(-sum(a)+2*a[-1])

elif ind%2==0:

  print(-sum(a[:ind])+sum(a[ind:]))
else:
  print(-sum(a[:ind])+sum(a[ind:])-2*min(abs(a[ind]),abs(a[ind-1])))
# Judge status: Accepted
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N, D = map(int, input().split())
points = []
for _ in range(N):
    point = list(map(int, input().split()))
    points.append(point)

ans = 0
for i in range(N):
    for j in range(i+1, N):
        dis = 0
        for y, z in zip(points[i], points[j]):
            dis += (y - z) ** 2
        dis = dis ** 0.5
        if dis.is_integer():
            ans += 1
print(ans)
# Judge status: Wrong Answer
import sys
import math

line = input()
N = line.split(' ')[0]
D = line.split(' ')[1]

count = 0

for i in range(1,int(N)):
  inputs = input()
  X = int(inputs.split(' ')[0])
  Y = int(inputs.split(' ')[1])
  if(math.sqrt(pow(X,2) + pow(Y,2)) <= int(D) ):
    count = count + 1

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

begin = 0

t = 0
cap = 0

L = []
for i in range(n):
    L.append(int(input()))
L = sorted(L)
for i in range(n):
    a = L[i]
    if begin == 0:
        begin = a
    if a <= begin + k and cap < c:
        cap += 1
    else:
        t += 1
        begin = a
        cap = 1
print(t +1)
# Judge status: Wrong Answer
import sys
n = int(input())
a = list(map(int,input().split()))

for i in range(0,n-1):
    if a[i]%2 == 0:
        if a[i]%3 != 0 and a[i]%5 != 0:
            print("DENIED")
            sys.exit()
    
print("APPROVED")
# Judge status: Wrong Answer
N = int(input())
L = map(int, input().split())
L = list(set(L))
L.sort()
ret = 0
N_ = len(L)
if N_ >= 3:
  for i in range(N_ - 2):
    for j in range(i + 1, N_ - 1):
      for k in range(j + 1, N_):
        if L[i] + L[j] > L[k]:
          ret += 1
print(ret)
# Judge status: Accepted
A = sorted(list(map(int, input().split())))
if any(a % 2 == 0 for a in A):
	print(0)
else:
	print(A[0] * A[1])
# Judge status: Wrong Answer
N = input()

N = sorted(N)

if (N[0] == N[1] == N[2]) or (N[1] == N[2] == N[3]):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
r,g,b=map(int,input().split())
rgb=r*100+g*10+b
print('YES' if rgb%4==0 else 'NO')
# Judge status: Wrong Answer
N = int(input())
record = [0] * 1000000

for i in range(1,N+1):
    for j in range(1,N+1):
        sum = i**2 + i**2 + j**2 + i*i + i*j +j*i
        if sum >= N: break
        # print(i,j)
        record[sum] += 3

for num in record[1:N+1]:
    print(num)
# Judge status: Wrong Answer
a,b = map(int, input().split())
def getPrime(a):
  prime=[]
  for i in range(2,int(min(a,b)**0.5)+1):
    if a%i == 0:
      for j in prime:
        if i%j == 0:
          break
      else:
        prime+=[i]
  return prime
a_prime=getPrime(a)
b_prime=getPrime(b)
print(len(set(a_prime) & set(b_prime))+1)
# Judge status: Accepted
import sys
input = sys.stdin.readline

import heapq
N,M = (int(x) for x in input().split())
pref = [[] for _ in range(N)]
ans = [0] * M
prefnumber = 0
for i in range(M):
    P,Y = (int(x) for x in input().split())
    pref[P-1].append((Y,i))
for p in pref:
    prefnumber += 1
    count = 1
    if p:
        heapq.heapify(p)
        while p:
            temp = heapq.heappop(p)
            ans[temp[1]] = ''.join([str(prefnumber).zfill(6),str(count).zfill(6)])
            count += 1
print('\n'.join(ans))
# Judge status: Wrong Answer
x = int(input())
if x==1:
  print(0)
else:
  print(0)
# Judge status: Accepted
N, Q = map(int,input().split())
S = input()
acc = [0]*N
for i in range(N-1):
    if S[i:i+2] == "AC":
        acc[i+1] += acc[i]+1
    else:
        acc[i+1] = acc[i]
ans = 0
for i in range(Q):
    l,r = map(int,input().split())
    print(acc[r-1]-acc[l-1])
# Judge status: Wrong Answer
n = int(input())
s = input()
cou = 0
if "#" not in s:
  print(0)
else:
  a = s.index("#")
  s1 = s[a:]
  b = s1.count(".")
  c = s1.count("#")
  print(min(b,c))
# Judge status: Accepted
n,m=map(int,input().split())
r=[[] for x in range(n)]
for c in range(m):
    a,b=map(int,input().split())
    r[a-1].append(b-1)
    r[b-1].append(a-1)
s=[-1]*n
u=[0]
v=[]
k=1
while k<n:
    for d in u:
        for e in r[d]:
            if s[e]==-1:
                s[e]=d
                k+=1
                v.append(e)
    u=v
print('Yes')
for c in range(n-1):
    print(s[c+1]+1)
# Judge status: Wrong Answer
a,b=map(int,input().split())#整数を複数の変数に格納

if a^b > b^a:
    print(a^b)
else:
    print(b^a)
# Judge status: Wrong Answer
N, K = map(int, input().split())
h = [int(input()) for _ in range(N)]
h = sorted(h, reverse=True)
h = h[:K]
print(h)
print(max(h) - min(h))
# Judge status: Accepted
n=int(input()) 
lis=list(map(int,input().split()))
m=min(lis)
new=lis
num=0
while True:
  for i in range(n+num):
    new[i]%=m
  if all(nn==0 for nn in new):
    print(m)
    exit()
  new.append(m)
  sl={m}
  for i in range(n+num):
    if new[i]!=0:
      sl.add(new[i])
  m=min(sl)
  num+=1
# Judge status: Wrong Answer
data = list(map(int, input().split()))
k = int(input())
if k == 1:
    print( sum(data) + max(data) )
else:
    print( sum(data) + max(data) ** k - max(data) )
# Judge status: Accepted
n,m=map(int,input().split())
a=list(map(int,input().split()))
bc=[list(map(int,input().split())) for i in range(m)]
bc.sort(key=lambda x:x[1])
for b,c in bc[::-1]:
  a.extend([c]*b)
  if len(a) > 2*n:
    break
a.sort(reverse=True)
print(sum(a[:n]))
# Judge status: Wrong Answer
n,a,b,c,d=map(int,input().split())
s="0"+input()
x=s[a:c+1]
y=s[b:d+1]
if "##" in s[a:c+1]:
    print("No")
    exit()

if "##" in s[b:d+1]:
    print("No")
    exit()

if c>d:
    if not "..." in s[b:d+1]:
        print("No")
        exit()
    
print("Yes")
# Judge status: Accepted
def main():
  n,k=map(int,input().split())
  ab=sorted([list(map(int,input().split())) for _ in [0]*n],key=lambda x:x[0])
  count=0
  for i in range(n):
    count+=ab[i][1]
    if count>=k:
      print(ab[i][0])
      exit()  
if __name__=='__main__':
  main()
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

cnt=0
for i in range(n):
  x=a[i]
  y=b[i]
  if x>y:
    cnt-=x-y
  elif x<y:
    cnt+=(y-x)//2

print('Yes' if cnt>=0 else 'No')
# Judge status: Wrong Answer

import numpy as np
import sys

input = sys.stdin.readline

s = int(input())

ans = 1

while s != 4:
    if s%2 == 0 :
        s = s/2
    else:
        s = 3*s + 1
    
    ans+=1
    print(s)
    if ans == 10:
        break


print(ans+3)
# Judge status: Accepted
a,b,c=input()
if a=='7' or b=='7' or c=='7':
    print('Yes')
else:
    print('No')
# Judge status: Accepted
x, n = map(int, input().split())
plist = list(map(int, input().split()))

if n == 0:
    print(x)
    exit()

for i in range(100):
    if (x - i) not in plist:
        print(x - i)
        exit()
    if (x + i) not in plist:
        print(x + i)
        exit()
# Judge status: Accepted
N = int(input())
list_a = [int(x) for x in input().split(' ')]

# sum_a = sum(list_a) % (10**9+7)
# sum_a2 = sum([(x**2) % (10**9+7) for x in list_a])
sum_a = sum(list_a)
sum_a2 = sum([x**2 for x in list_a])

print(((sum_a ** 2 - sum_a2) // 2) % (10**9+7))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
Answer = []

for i in range(N):
    Answer.append(0)

for i in range(N):
    Answer[A[i]-1] = i + 1

print(Answer)
# Judge status: Wrong Answer
a=input()
b=list(map(int,input().split()))
b.sort()
if sum(b)-max(b)-max(b)<0:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
import math
n = int(input())

coord_list = [list(map(int, input().split())) for _ in range(n)]
all_distances = 0

# 順列計算
for i in range(n-1):
    for j in range(i+1, n):
        distance = math.sqrt((coord_list[i][0] - coord_list[j][0]) ** 2 + (coord_list[i][1] - coord_list[j][1]) ** 2)      
        all_distances += distance
        print("i:{}, j:{} distance:{}".format(i, j, distance))

print(all_distances * 2 / n)
# Judge status: Accepted
n,m = map(int,input().split())
X = list(map(int,input().split()))
X.sort()
diff = [X[i+1]-X[i] for i in range(m-1)]
diff.sort()
if n >= m:
  print(0)
else:
  print(sum(diff[:m-n]))
# Judge status: Accepted
n, k = map(int, input().split())

import math
ans = 0
for i in range(1,n+1):
  if i < k:
    t = math.log10(k/i)/math.log10(2)
    if t == int(t):
      ans += 1/(2**t)
    else:
      ans += 1/(2**(int(t+1)))
  else:
    ans += 1
  
print(ans/n)
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))

ok=1
for i in range(N):
    if a[i]==ok:
        ok += 1
if ok==1:
    print(-1)
else:
    print(N-ok+1)
# Judge status: Wrong Answer
x,y=map(int,input().split())
ans=0
ans=max(ans,x+x+1)
ans=max(ans,x+y)
ans=max(ans,x+y+1)
print(ans)
# Judge status: Accepted
if sorted(list(map(int,input().split())))==[5,5,7]:
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
l = map(int, input().split())

if len(set(l)):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n,m=map(int,input().split())
import bisect
l=[[] for _ in range(n)]
l2=[]

for i in range(m):
  p,y=map(int,input().split())
  l[p-1].append(y)
  l2.append([p,y])

for m in l:
  m.sort()
for m in l2:
  print("{:06d}".format(m[0]) +"{:06d}".format(bisect.bisect_left(l[m[0]-1],m[1])+1))
# Judge status: Accepted
A, B = map(int, input().split())

if A == B:
    print('Draw')
elif A > B != 1 or (A < B and A == 1):
    print('Alice')
else:
    print('Bob')