Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

k,q = map(int, input().split())
d = list(map(int, input().split()))

def query(n,x,m):
  x %= m
  ans = n-1
  n -= 1
  s1 = 0
  t1 = 0
  for i in range(k):
    s1 += d[i] % m
    if d[i] % m == 0:
      t1 += 1
  s2 = 0
  t2 = 0
  for i in range(n%k):
    s2 += d[i] % m
    if d[i] % m == 0:
      t2 += 1
  x += s1 * (n//k) + s2
  ans -= x//m
  ans -= t1 * (n//k) + t2
  
  print(ans)
  
    

for _ in range(q):
  n,x,m = map(int, input().split())
  query(n,x,m)


### FIXED CODE ###

# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import math

#############
# Constants #
#############

MOD = 10**9 +7
INF = float('inf')

#############
# Functions #
#############

kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

#############
# Main Code #
#############

k,q = map(int, input().split())
d = list(map(int, input().split()))

def query(n,x,m):
  x %= m
  ans = n-1
  n -= 1
  s1 = 0
  t1 = 0
  for i in range(k):
    s1 += d[i] % m
    if d[i] % m == 0:
      t1 += 1
  s2 = 0
  t2 = 0
  for i in range(n%k):
    s2 += d[i] % m
    if d[i] % m == 0:
      t2 += 1
  x += s1 * (n//k) + s2
  ans -= x//m
  ans -= t1 * (n//k) + t2
  
  print(ans)
  
    

for _ in range(q):
  n,x,m = map(int, input().split())
  query(n,x,m)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
result = []
for i in range(1, N+1):
  result.append(A.count(i))
for i in range(len(result)):
  print(result[i])

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
result = {}
for i in range(N):
  result[i+1] = 0
for i in range(N-1):
  if A[i] in result:
    result[A[i]] += 1
for i in result.values():
  print(i)
### BUGGY CODE ###

n, ma, mb = map(int,input().split())
A = [0]*n
B = [0]*n
C = [0]*n
for i in range(n) :
    A[i], B[i], C[i] = map(int,input().split())

INF = 10**9

# dp[i][ca][cb] := i番目までの(ca, cb)の最小費用
dp = [[[INF]*401 for j in range(401)] for i in range(n+1)]

dp[0][0][0] = 0
for i in range(1, n+1) :
    dp[i][A[i-1]][B[i-1]] = C[i-1]

for i in range(1, n+1) :
    for ca in range(1, 401) :
        for cb in range(1, 401) :
            if not (ca-A[i-1] >= 0 and cb-B[i-1] >= 0) :
                dp[i][ca][cb] = min(dp[i][ca][cb], dp[i-1][ca][cb])
            else :
                dp[i][ca][cb] = min(dp[i][ca][cb], dp[i-1][ca][cb], dp[i-1][ca-A[i-1]][cb-B[i-1]]+C[i-1])

ans = INF

for ca in range(1, 401) :
    for cb in range(1, 401) :
        if mb*ca == ma*cb :
            ans = min(ans, dp[n][ca][cb])

if ans == INF :
    ans = -1

print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline

n, ma, mb = map(int,input().split())
A = [0]*n
B = [0]*n
C = [0]*n
for i in range(n) :
    A[i], B[i], C[i] = map(int,input().split())

INF = 10**9

# dp[i][ca][cb] := i番目までの(ca, cb)の最小費用
dp = [[[INF]*401 for j in range(401)] for i in range(n+1)]

dp[0][0][0] = 0
for i in range(1, n+1) :
    dp[i][A[i-1]][B[i-1]] = C[i-1]

for i in range(1, n+1) :
    for ca in range(1, 401) :
        for cb in range(1, 401) :
            if not (ca-A[i-1] >= 0 and cb-B[i-1] >= 0) :
                dp[i][ca][cb] = min(dp[i][ca][cb], dp[i-1][ca][cb])
            else :
                dp[i][ca][cb] = min(dp[i][ca][cb], dp[i-1][ca][cb], dp[i-1][ca-A[i-1]][cb-B[i-1]]+C[i-1])

ans = INF

for ca in range(1, 401) :
    for cb in range(1, 401) :
        if mb*ca == ma*cb :
            ans = min(ans, dp[n][ca][cb])

if ans == INF :
    ans = -1

print(ans)
### BUGGY CODE ###

#!/usr/bin/python3
from operator import attrgetter
import sys
class Point:
    pass

class Node:
    pass

def kdtree(points, depth=0):
    if not points:
        return
    # dimension
    if depth % 2 == 0:
        points.sort(key=attrgetter('x'))
    else:
        points.sort(key=attrgetter('y'))

    median = len(points)//2

    node = Node()
    node.location = points[median]
    node.left = kdtree(points[:median], depth + 1)
    node.right = kdtree(points[median + 1:], depth + 1)
    return node

def find(sx, tx, sy, ty, node, depth):
    if node == None:
        return []
    result = []
    x = node.location.x
    y = node.location.y
    if sx <= x <= tx and sy <= y <= ty:
        result.append(node.location.id)

    if depth % 2 == 0:
        if sx <= x:
            result.extend(find(sx, tx, sy, ty, node.left, depth + 1))
        if x <= tx:
            result.extend(find(sx, tx, sy, ty, node.right, depth + 1))
    else:
        if sy <= y:
            result.extend(find(sx, tx, sy, ty, node.left, depth + 1))
        if y <= ty:
            result.extend(find(sx, tx, sy, ty, node.right, depth + 1))
    return result

# main
n = int(input())
points = []
for i in range(n):
    point = Point()
    point.id = i
    point.x, point.y = map(int, sys.stdin.readline().split())
    points.append(point)
tree = kdtree(points)
q = int(input())
for i in range(q):
    sx, tx, sy, ty = map(int, input().split())
    result = find(sx, tx, sy, ty, tree, 0)
    result.sort()
    for i in result:
        print(i)
    print()

### FIXED CODE ###

#!/usr/bin/python3
from sys import stdin
import math
from operator import itemgetter
from bisect import bisect_left, bisect_right
readline = stdin.readline

def main():
    n = int(readline())
    xy = [tuple(map(int, readline().split())) + (i,) for i in range(n)]
    # [..., (x_i, y_i, i), ...]
    # sort by x
    xy.sort()

    root = int(math.sqrt(len(xy)))

    low = [x for x, y, i in xy[::root]]
    high = [x for x, y, i in xy[root - 1::root]] + [float('inf')]

    xy = [sorted(xy[i:i + root], key=itemgetter(1)) for i in range(0, len(xy), root)]
    xy = [([y for x, y, i in xyi], xyi) for xyi in xy]
    for sx, tx, sy, ty in (map(int, readline().split()) for _ in range(int(readline()))):
        ret = []
        for i in range(bisect_left(high, sx), bisect_right(low, tx)):
            k, v = xy[i]
            for i in range(bisect_left(k, sy), bisect_right(k, ty)):
                if sx <= v[i][0] <=tx:
                    ret.append(v[i][2])
        if ret:
            ret.sort()
            print('\n'.join(map(str,ret)))
        print()

main()
### BUGGY CODE ###

n=int(input())
b=[bin(int(i))[2:] for i in input().split()]
ind=0
i=0
l=[0]*20
ans=0
tmp=0
for i in range(n):
    if i>0 and ind<n:
        for j in range(len(b[i-1]))[::-1]:
            if b[i-1][j]=="1":
                l[j-len(b[i-1])]-=1
        for j in range(len(b[ind]))[::-1]:
            if b[ind][j]=="1":
                l[j-len(b[ind])]-=1
    ans+=ind-i
    while ind<n:
        for j in range(len(b[ind]))[::-1]:
            if b[ind][j]=="1":
                l[j-len(b[ind])]+=1
        if 2 in l:
            break
        else:
            ind+=1
            ans+=1
print(ans)

    










### FIXED CODE ###

n=int(input())
b=[bin(int(i))[2:] for i in input().split()]
ind=0
i=0
l=[0]*20
ans=0
tmp=0
for i in range(n):
    if i>0 and ind<n:
        for j in range(len(b[i-1]))[::-1]:
            if b[i-1][j]=="1":
                l[j-len(b[i-1])]-=1
        for j in range(len(b[ind]))[::-1]:
            if b[ind][j]=="1":
                l[j-len(b[ind])]-=1
    ans+=ind-i
    while ind<n:
        for j in range(len(b[ind]))[::-1]:
            if b[ind][j]=="1":
                l[j-len(b[ind])]+=1
        if 2 in l:
            break
        else:
            ind+=1
            ans+=1
print(ans)
### BUGGY CODE ###

import numpy as np
def poly_divide(f, g):
    n = len(g)
    a, b = f
    q = np.zeros(n-1, dtype = np.int64)
    r = 0
    q[-1] = g[-1]*inv[b%p]%p
    for i in range(n-2)[::-1]:
        q[i] = (g[i+1]-q[i+1]*a)*inv[b%p]%p
    r = g[0]-q[0]
    return q, r
  
def poly_product(f, g):
    n, m = len(f), len(g)
    res = np.zeros(n+m-1, dtype = np.int64)
    for i in range(n):
        res[i:i+m]+=g*f[i]
        res%=p
    return res
def assign(f, x):
    tmp = 1
    res = 0
    n = len(f)
    for i in range(n):
        res+=f[i]*tmp
        tmp*=x
        tmp%=p
        res%=p
    return res


p = int(input())
a = list(map(int, input().split()))
inv = [0]*p
P = np.ones(1, dtype = np.int64)
for i in range(p):
    inv[i] = pow(i, p-2, p)
for i in range(p):
    b = np.array([-i, 1], dtype = np.int64)
    P = poly_product(b, P)
R = np.zeros(p, dtype = np.int64)
for i in range(p):
    b = np.array([-i, 1], dtype = np.int64)
    Q, _ = poly_divide(b, P)
    v = assign(Q, i)
    R+=Q*inv[v%p]*a[i]
    R%=p
print(*R)
    
    







### FIXED CODE ###


def poly_divide(f, g):
    n = len(g)
    a, b = f
    q = [0]*(n-1)
    r = 0
    q[-1] = g[-1]*inv[b%p]%p
    for i in range(n-2)[::-1]:
        q[i] = (g[i+1]-q[i+1]*a)*inv[b%p]%p
    r = g[0]-q[0]
    return q, r
  
def poly_product(f, g):
    n, m = len(f), len(g)
    res = [0]*(n+m-1)
    for i in range(n):
        for j in range(m):
            res[i+j]+=g[j]*f[i]
            res[i+j]%=p
    return res
def assign(f, x):
    tmp = 1
    res = 0
    n = len(f)
    for i in range(n):
        res+=f[i]*tmp
        tmp*=x
        tmp%=p
        res%=p
    return res
def c_mul(c, f):
    n = len(f)
    for i in range(n):
        f[i]*=c
        f[i]%=p
    return f
def poly_add(f, g):
    n = len(g)
    for i in range(n):
        f[i]+=g[i]
        f[i]%=p
    return f


p = int(input())
a = list(map(int, input().split()))
inv = [0]*p
P = [1]
for i in range(p):
    inv[i] = pow(i, p-2, p)
for i in range(p):
    b = [-i, 1]
    P = poly_product(b, P)
R = [0]*p
for i in range(p):
    b = [-i, 1]
    Q, _ = poly_divide(b, P)
    v = assign(Q, i)
    Q=c_mul(inv[v%p]*a[i], Q)
    R = poly_add(R, Q)
print(*R)
### BUGGY CODE ###

s = input()
t = input()

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

# dp = [[None] * lent for _ in range(lens)]
# def dfs(aindex=0, bindex=0):
#     if aindex >= lens:
#         return 0
#     if bindex >= lent:
#         return 0
#
#     if dp[aindex][bindex] is not None:
#         return dp[aindex][bindex]
#
#     if s[aindex] == t[bindex]:
#         r = dfs(aindex + 1, bindex + 1) + 1
#     else:
#         r = max(dfs(aindex + 1, bindex), dfs(aindex, bindex + 1))
#     dp[aindex][bindex] = r
#     return r
#
# print(dfs())

shift = [1 << x for x in range(3000 + 1)]

dp = [[0] * (lent + 1) for _ in range(lens + 1)]
# pattern = [[0] * (lent + 1) for _ in range(lens + 1)]
pattern = [[[0] * 3000 for _ in range(lent + 1)] for _ in range(lens + 1)]
# dp = [[(0, 0) for _ in range(lent + 1)] for _ in range(lens + 1)]
for aindex in range(lens - 1, -1, -1):
    for bindex in range(lent - 1, -1, -1):
        if s[aindex] == t[bindex]:
            r = dp[aindex + 1][bindex + 1] + 1
            # p = s[aindex] + pattern[aindex + 1][bindex + 1]
            # p = (1 << aindex) + pattern[aindex + 1][bindex + 1]
            p = pattern[aindex + 1][bindex + 1][:]
            p[aindex] += 1
        else:
            if dp[aindex + 1][bindex] > dp[aindex][bindex + 1]:
                r = dp[aindex + 1][bindex]
                p = pattern[aindex + 1][bindex]
            else:
                r = dp[aindex][bindex + 1]
                p = pattern[aindex][bindex + 1]
            # r = max(dp[aindex + 1][bindex], dp[aindex][bindex + 1])
        dp[aindex][bindex] = r
        pattern[aindex][bindex] = p
for aindex in range(lens):
    if pattern[0][0][aindex]:
        print(s[aindex], end="")


### FIXED CODE ###

s = input()
t = input()

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

# dp = [[None] * lent for _ in range(lens)]
# def dfs(aindex=0, bindex=0):
#     if aindex >= lens:
#         return 0
#     if bindex >= lent:
#         return 0
#
#     if dp[aindex][bindex] is not None:
#         return dp[aindex][bindex]
#
#     if s[aindex] == t[bindex]:
#         r = dfs(aindex + 1, bindex + 1) + 1
#     else:
#         r = max(dfs(aindex + 1, bindex), dfs(aindex, bindex + 1))
#     dp[aindex][bindex] = r
#     return r
#
# print(dfs())

shift = [1 << x for x in range(3000 + 1)]

dp = [[0] * (lent + 1) for _ in range(lens + 1)]
for aindex in range(lens - 1, -1, -1):
    for bindex in range(lent - 1, -1, -1):
        if s[aindex] == t[bindex]:
            r = dp[aindex + 1][bindex + 1] + 1
        else:
            r = max(dp[aindex + 1][bindex], dp[aindex][bindex + 1])
        dp[aindex][bindex] = r

ans = ""
ls = len(s)
lt = len(t)
ls = 0
lt = 0
while ls < lens and lt < lent:
    if dp[ls][lt] == dp[ls + 1][lt]:
        ls += 1
    elif dp[ls][lt] == dp[ls][lt + 1]:
        lt += 1
    else:
        ans += t[lt]
        ls += 1
        lt += 1
print(ans)
### BUGGY CODE ###

n,x,y = map(int,input().split())

for i in range(1,n):
	ans = 0
	for j in range(1,n-i+1):
		if i+j <= x:
			ans += 1
			continue
		elif j >= y and i+j < n:
			ans += 1
			continue
		else:
			# x-j+1 = jからyまでの距離
			# y-i-j = yからi+j(目的地)までの距離
			#print(abs(x-j)+1+abs(y-i-j))
			if min(abs(x-j)+1+abs(y-i-j),i) == i:
				ans += 1
		num = i-(abs(x-j)+1)
		if num >= 0:
			d1 = y+num
			d2 = y-num
			if i+j < d1 and d1 <= n:
				ans += 1
			if i+j < d2 and d1 != d2:
				ans += 1
		#print(i,j,ans)
	print(ans)


### FIXED CODE ###

from scipy.sparse.csgraph import dijkstra
import sys
def main():
	input = sys.stdin.readline

	n,x,y = map(int,input().split())

	route = [[0 for _ in range(n)]for _ in range(n)]
	for i in range(n-1):
		route[i][i+1] = 1

	route[x-1][y-1] = 1
	route[y-1][x-1] = 1
	route = tuple(route)
	#res = shortest_path(route, unweighted=False,directed=False)
	res = tuple(dijkstra(route, directed=False))

	ans = [0 for _ in range(n)]
	for i in range(n):
		for j in range(i,n):
			ans[int(res[i][j])] += 1

	for i in range(1,n):
		print(ans[i])
if __name__ == '__main__':
    main()
### BUGGY CODE ###

s = input()
ans = 0
while s.count("BW") > 0 :
    ans += s.count("BW")
    s = s.replace("BW", "WB")

print(ans)


### FIXED CODE ###

from scipy.misc import comb
s = input()
n = len(s)
r = s.count("B")
ans = 0
for i in range(r):
  ans += n-i

for i in range(len(s)):
  if s[i] == "B":
    ans -= i+1
  
print(ans)
### BUGGY CODE ###

n=int(input())
ans=0
for x in range(1,n+1):
  b=n//x
  c=x*b
  ans1=(x+c)*b//2
  ans+=ans1

print(ans)

### FIXED CODE ###

n=int(input())
ans=0
for x in range(1,n+1):
  b=n//x
  c=x*b
  ans1=(x+c)*b//2
  ans+=ans1

print(ans)
### BUGGY CODE ###

from collections import deque
def bfs(maze, visited, l,n_w):
    queue = deque(l)
    for i in queue:
        visited[i[0]][i[1]] = 0
    while queue:
        y, x = queue.popleft()
        if n_w==0:
            s=set()
            tmp=0
            for i in visited:
                if max(i)>tmp:tmp=max(i)
            return(tmp)
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_y, new_x = y+j, x+k
            if maze[new_y][new_x] == "." and visited[new_y][new_x] == -1:
                visited[new_y][new_x] = visited[y][x] + 1
                queue.append([new_y, new_x])
                n_w-=1

R, C = map(int, input().split())


maze = ["$"*(C+2)]+["$"+input()+"$" for i in range(R)]+["$"*(C+2)]
visited = [[-2]*(C+2)]+[[-2]+[-1]*(C)+[-2] for j in range(R)]+[[-2]*(C+2)]
l_b=[]
for i in range(R+2):
    for j in range(C+2):
        if maze[i][j]=="#":
            l_b.append([i,j])
n_w=R*C-len(l_b)

print(bfs(maze, visited,l_b,n_w))

### FIXED CODE ###

from collections import deque
def bfs(maze, visited, l,n_w):
    queue = deque(l)
    for i in queue:
        visited[i[0]][i[1]] = 0
    while queue:
        y, x = queue.popleft()
        if n_w==0:
            s=set()
            tmp=0
            for i in visited:
                if max(i)>tmp:tmp=max(i)
            return(tmp)
        for j, k in ([1, 0], [-1, 0], [0, 1], [0, -1]):
            new_y, new_x = y+j, x+k
            if maze[new_y][new_x] == "." and visited[new_y][new_x] == -1:
                visited[new_y][new_x] = visited[y][x] + 1
                queue.append([new_y, new_x])
                n_w-=1

R, C = map(int, input().split())


maze = ["$"*(C+2)]+["$"+input()+"$" for i in range(R)]+["$"*(C+2)]
visited = [[-2]*(C+2)]+[[-2]+[-1]*(C)+[-2] for j in range(R)]+[[-2]*(C+2)]
l_b=[]
for i in range(R+2):
    for j in range(C+2):
        if maze[i][j]=="#":
            l_b.append([i,j])
n_w=R*C-len(l_b)

print(bfs(maze, visited,l_b,n_w))
### BUGGY CODE ###

import math
X = int(input())
time = X
for i in range(X+1):
    if i > time: continue
    n = - 1 + math.sqrt(1+8*(X-i))
    if n < 2*i and math.floor(n) == n:
        time = min(time, i)
print(time)

### FIXED CODE ###

import math
X = int(input())
n =  math.ceil((math.sqrt(1+8*X) - 1)/2)
ans = n
print(ans)
### BUGGY CODE ###

def main():
    N,K=map(int, input().split())
    A = list(map(int, input().split()))
    B=0
    for i in range(N-K+1):
        S = (sum(A[i:i+K])+K)/2
        if B<S:
            B=S
    print(B)

main()

### FIXED CODE ###

def main():
    N,K=map(int, input().split())
    A = list(map(int, input().split()))
    S = (sum(A[0:K])+K)/2
    S_max=S
    for i in range(K,N):
        S +=  A[i]/2
        S -= A[i-K]/2
        if S_max<S:
            S_max=S
    print(S_max)

main()
### BUGGY CODE ###

from itertools import product

N = int(input())
XYP = [tuple(map(int, input().split())) for _ in range(N)]
X = [x for x, _, _ in XYP]
Y = [y for _, y, _ in XYP]
P = [p for _, _, p in XYP]
INF = 10**18

def calcCost(AP, A):
    ret = [[INF] * N for _ in range(1 << N)]
    for state in range(1 << N):
        useA = [a for i, a in enumerate(A) if (state & (1 << i)) != 0]
        for i, (a, p) in enumerate(AP):
            cost = abs(a)
            for z in useA:
                cost = min(cost, abs(a - z))
            ret[state][i] = cost * p
    return ret

costX = calcCost([(x, p) for x, _, p in XYP], X)
costY = calcCost([(y, p) for _, y, p in XYP], Y)

ans = [INF] * (N + 1)
for state in product((0, 1, 2), repeat=N):
    stateX = 0
    stateY = 0
    M = N
    for s in state:
        stateX <<= 1
        stateY <<= 1
        if s == 0: M -= 1
        if s == 1: stateX |= 1
        if s == 2: stateY |= 1

    cost = 0
    for i in range(N):
        cost += min(costX[stateX][i], costY[stateY][i])

    if ans[M] > cost:
        ans[M] = cost

print(*ans, sep='\n')


### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
from numba import njit
import numpy as np
INF = 10**18

@njit('(i8, i8[:,:])')
def solve(N, XYP):
    X = XYP[:, 0]
    Y = XYP[:, 1]

    def calcCost(sign, A):
        ret = np.ones((1 << N, N), dtype=np.int64) * INF
        for state in range(1 << N):
            useA = [a for i, a in enumerate(A) if (state & (1 << i)) != 0]
            for i in range(N):
                xyp = XYP[i]
                cost = abs(xyp[sign])
                for z in useA:
                    cost = min(cost, abs(xyp[sign] - z))
                ret[state][i] = cost * xyp[2]
        return ret

    costX = calcCost(0, X)
    costY = calcCost(1, Y)
    ans = np.ones(N + 1, dtype=np.int64) * INF

    for state in range(pow(3, N)):
        stateX = 0
        stateY = 0
        M = N
        for _ in range(N):
            state, r = divmod(state, 3)
            stateX <<= 1
            stateY <<= 1
            if r == 0: M -= 1
            if r == 1: stateX |= 1
            if r == 2: stateY |= 1

        cx, cy = costX[stateX], costY[stateY]
        cost = 0
        for i in range(N):
            cost += min(cx[i], cy[i])
        ans[M] = min(ans[M], cost)

    for a in ans:
        print(a)

def sol():
    N = int(input())
    XYP = np.asarray([list(map(int, input().split())) for _ in range(N)])
    solve(N, XYP)

sol()
### BUGGY CODE ###

N, K = map(int,input().split( ))
l = []
for i in range(N):
	a, b = map(int, input().split( ))
	for i in range(b):
		l.append(a)
l.sort()
print(l[K-1])

### FIXED CODE ###

from collections import defaultdict

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

a = []
b = []

for i in range(N):
	a_i, b_i = map(int, input().split( ))
	a.append(a_i)
	b.append(b_i)

d = defaultdict(int)

for i in range(N):
    if a[i] in d:
        d[a[i]] += b[i]
    else:
        d[a[i]] = b[i]

d_sorted = sorted(d.items())

l = 0

for i in range(N):
	a_i = d_sorted[i][0]
	b_i = d_sorted[i][1]
	l += b_i
	if l >= K:
		print(a_i)
		break
### BUGGY CODE ###

N = int(input())

ans = 0

for i in range(1, N+1):
  for j in range(N//i):
    ans += i*(j+1)

print(ans)


### FIXED CODE ###

N = int(input())

ans = 0

for i in range(1, N+1):
  for j in range(N//i):
    ans += i*(j+1)

print(ans)
### BUGGY CODE ###

N,K = [int(x) for x in input().split()]
count = [0]*(K+1)
for i in range(K,0,-1):
    count[i] = (K//i)**N
ans = 0
for i in range(K,0,-1):
    kosuu = count[i]
    if K // i >= 2:
        for j in range(K//i,1,-1):
            kosuu -= count[j*i]
    ans += (i*kosuu)%1000000007
    count[i] = kosuu
print(ans%1000000007)

### FIXED CODE ###

N,K = [int(x) for x in input().split()]
count = [0]*(K+1)
ans = 0
mod = 1000000007
for i in range(K,0,-1):
    kosuu = pow(K//i,N,mod)
    if K // i >= 2:
        for j in range(K//i,1,-1):
            kosuu -= count[j*i]
    ans += i*kosuu
    count[i] = kosuu
print(ans%mod)
### BUGGY CODE ###

def d_no_need(N, K, A):
    from bisect import bisect_left
    # 値がK以上の要素は単体で不必要でない要素になれる
    a_sorted = sorted(A)
    a_sorted = a_sorted[:bisect_left(a_sorted, K)]
    ans = len(a_sorted)  # a_sortedの要素は不必要となりうる

    dp = [False] * K  # dp[k]:a_sortedの一部の和を取った値をKにできるか？
    dp[0] = True
    current_max = 0
    for idx, a in list(enumerate(a_sorted))[::-1]:
        if current_max + a >= K:
            ans = idx
        for j in range(min(current_max, K - a) + 1):
            if dp[j] and j + a < K:
                current_max = max(current_max, j + a)
                dp[j + a] = True
    return ans

N, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
print(d_no_need(N, K, A))

### FIXED CODE ###

def d_NoNeed(N, K, A):
    a = sorted(A)
    s = t = 0
    # aのうち要素が大きいものから見ていったとき、
    # その要素を入れても総和がK未満のものだけ加えていく
    # 最後に連続して加えた要素の個数が解となる
    # (それら以外の要素の組み合わせでK以上にでき、かつ、
    #  それらの総和がK未満になるため)
    for i in range(N - 1, -1, -1):
        if s + a[i] < K:
            s += a[i]
            t += 1
        else:
            t = 0
    return t

N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
print(d_NoNeed(N, K, A))
### BUGGY CODE ###

s = input()
t = input()
ls = len(s)
lt = len(t)
dp = [[[0, ""] for _ in range(lt + 1)] for _ in range(ls + 1)]
ans = [0, ""]
for i in range(ls):
    for j in range(lt):
        if s[i] == t[j]:
            dp[i][j][0] = dp[i - 1][j - 1][0] + 1
            dp[i][j][1] = dp[i - 1][j - 1][1] + s[i]
            if dp[i][j][0] > ans[0]:
                ans = dp[i][j]
        elif dp[i - 1][j][0] > dp[i][j - 1][0]:
            dp[i][j] = dp[i - 1][j]
        else:
            dp[i][j] = dp[i][j - 1]

print(dp[i][j][1])

### FIXED CODE ###

s = input()
t = input()
ls = len(s)
lt = len(t)
dp = [[0 for _ in range(lt + 1)] for _ in range(ls + 1)]
ans = 0
for i in range(ls):
    for j in range(lt):
        if s[i] == t[j]:
            dp[i][j] = dp[i - 1][j - 1] + 1
            if dp[i][j] > ans:
                ans = dp[i][j]
        else:
            dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
            
l = dp[i][j]
ans = ""
while l > 0:
    if s[i] == t[j]:
        ans += s[i]
        i -= 1
        j -= 1
        l -= 1
    elif dp[i][j] == dp[i - 1][j]:
        i -= 1
    else:
        j -= 1
print(ans[::-1])