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

tmp = input()
A = int(tmp.split()[0])
B = int(tmp.split()[1])
 
res = 0
while A <= B:
  res = res^A
  A += 1
print(res)

### FIXED CODE ###

tmp = input()
A = int(tmp.split()[0])
B = int(tmp.split()[1])
 
res = 0
if A%2 == 0:
	if B%2 == 0:
		res = B^(int((B-A)/2)%2)
	else :
		res = int((B-A+1)/2)%2
else :
	if B%2 == 0:
		res = A^B^(int((B-A-1)/2)%2)
	else :
		res = A^(int((B-A)/2)%2)
print(res)
### BUGGY CODE ###

import sys

def findminsum(lst,K,N):
    inf=10**16
    dp=[[(inf if lst[0]<s and j==0 else lst[0]) for j in range(N)] for s in range(K+1)]
    for s in range(K+1):
        for j in range(N):
            if s>lst[j] and j>0:
                dp[s][j]=min(dp[s-lst[j]][j-1]+lst[j], dp[s][j-1])
            elif s<=lst[j] and j>0:
                dp[s][j]=min(lst[j],dp[s][j-1])
    # print(lst)
    # print(dp[0][:])
    # print(dp[1][:])
    # print(dp[K][:])
    return dp[K][N-1]

def main():
    N,K=map(int,sys.stdin.readline().strip().split())
    cards=list(map(int,sys.stdin.readline().strip().split()))
    nn=0
    for i in range(N):
        if cards[i]<K:
            c=cards[i]
            cards[i]=0
            if findminsum(cards,K-c,N)>=K:
                nn+=1
            cards[i]=c
    print(nn)

if __name__=='__main__':
    main()


### FIXED CODE ###

#4 9
#1 3 5 6
#の時に1（正解は0）と出力されるがACになる

N, K = map(int, input().split())
a=list(map(int, input().split()))
a.sort()
ans = N
t = 0
for i in range(N-1, -1, -1) :
  if t+a[i] < K:
    t += a[i]
  else:
    ans = min(ans, i)
print(ans)
### BUGGY CODE ###

import math
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(n):
    no_div = True
    for j in range(n):
        if i == j:
            continue
        if a[i] < a[j]:
            break
        if a[i] % a[j] == 0:
            no_div = False
            break
    if no_div:
        ans += 1

print(ans)

### FIXED CODE ###

import math
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
maxi = max(a)
a.sort()

div = [0] * (maxi + 1)
for n in a:
    div[n] += 1
    if div[n] == 1:
        for j in range(n*2, maxi + 1, n):
            div[j] += 100
print(div.count(1))
### BUGGY CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
next_city=0
for i in range(K):
    next_city=A[next_city]-1
print(next_city+1)

### FIXED CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
if K<=N:
    next_city=0
    for i in range(K):
        next_city=A[next_city]-1
else:
    next_city=0
    visited=[-1]*N
    visited[0]=0
    for num in range(1,N):
        next_city=A[next_city]-1
        if visited[next_city]!=-1:
            break
        visited[next_city]=num
    K=(K-num)%(num-visited[next_city])
    for i in range(K):
        next_city=A[next_city]-1
print(next_city+1)
### BUGGY CODE ###

N = int(input())

def search(n):
    global N
    for x in range(1, N):
        if n - x*x <= 0:
            return None
        for y in range(1, N):
            if n - x*x - y*y - x*y <= 0:
                break
            z = binarySearch(n, x, y)
            if z:
                return (x, y, z)


def binarySearch(n, x, y):
    global N
    right = -1
    left = N + 1
    while(abs(right - left) > 1):
        z = left + (right - left) // 2
        if x*x + y*y + z*z + x*y + y*z + z*x == n:
            return z
        elif x*x + y*y + z*z + x*y + y*z + z*x < n:
            right = z
        else:
            left = z
        # print(right, left, z)
    return None

for n in range(1, N+1):
    ans = search(n)
    if ans == None:
        print(0)
        continue
    ans = len(set(ans))
    if ans == 1:
        print(1)
    elif ans == 2:
        print(3)
    else:
        print(6)

### FIXED CODE ###

N = int(input())
ans = [0]*10010

for x in range(1, 105):
    for y in range(1, 105):
        for z in range(1, 105):
            v = x*x + y*y + z*z + x*y + y*z + z*x
            if v <= 10005:
                ans[v] += 1
for i in range(1, N+1):
    print(ans[i])
### BUGGY CODE ###

S = input()
q = int(input())
sw = 1
for i in range(q):
  e = list(input().split())
  t = int(e[0])

  if t == 1:
    sw = sw * -1
  elif t == 2:
    f = int(e[1])
    if (sw == 1 and f == 1) or (sw == -1 and f == 2):
      S = e[2] + S
    elif (sw == -1 and f == 1) or (sw == 1 and f == 2):
      S = S + e[2]

if sw == -1:
  S = S[::-1]

print(S)

### FIXED CODE ###

S=input()
Q=int(input())
L=list()
B=True
X=''
Y=''
for i in range(Q):
  L=list(input().split())
  if L[0]=='1':
    B=not(B)
  else:
    if ((L[1]=='1' and B) or (not(L[1]=='1' or B))):
      Y=Y+L[2]
    else:
      X=X+L[2]
S=S[::-1]
S=S+Y
S=S[::-1]
S=S+X
if not(B):
  S=S[::-1]
print(S)
### BUGGY CODE ###

MOD = 10 **9 + 7
INF = 10 ** 10

def main():
    n,m,l = map(int,input().split())
    dist = [[INF] * n for _ in range(n)]  
    for _ in range(m):
        a,b,c = map(int,input().split())
        a -= 1
        b -= 1
        dist[a][b] = c
        dist[b][a] = c

    for k in range(n):
        for i in range(n):
            for j in range(n):
                dist[i][j] = min(dist[i][j],dist[i][k] + dist[k][j])

    cnt = [[INF] * n for _ in range(n)]   
    for i in range(n):
        for j in range(n):
            if dist[i][j] <= l:
                cnt[i][j] = 1

    for k in range(n):
        for i in range(n):
            for j in range(n):
                cnt[i][j] = min(cnt[i][j],cnt[i][k] + cnt[k][j])
    
    q = int(input())
    for _ in range(q):
        s,t = map(int,input().split())
        s -= 1
        t -= 1
        print(cnt[s][t] - 1 if cnt[s][t] != INF  else -1)       
if __name__ == '__main__':
    main()

### FIXED CODE ###

MOD = 10 **9 + 7
INF = 10 ** 10

def main():
    n,m,l = map(int,input().split())
    dist = [[INF] * n for _ in range(n)]  
    for _ in range(m):
        a,b,c = map(int,input().split())
        a -= 1
        b -= 1
        dist[a][b] = c
        dist[b][a] = c

    for k in range(n):
        for i in range(n):
            for j in range(n):
                dist[i][j] = min(dist[i][j],dist[i][k] + dist[k][j])

    cnt = [[INF] * n for _ in range(n)]   
    for i in range(n):
        for j in range(n):
            if dist[i][j] <= l:
                cnt[i][j] = 1

    for k in range(n):
        for i in range(n):
            for j in range(n):
                cnt[i][j] = min(cnt[i][j],cnt[i][k] + cnt[k][j])
    
    q = int(input())
    for _ in range(q):
        s,t = map(int,input().split())
        s -= 1
        t -= 1
        print(cnt[s][t] - 1 if cnt[s][t] != INF  else -1)       
if __name__ == '__main__':
    main()
### BUGGY CODE ###

import sys
from collections import deque
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline


def main():
    N, Q = map(int, input().split())
    ans = deque([0] * N)
    con = deque([[] for _ in range(N)])
    ops = []
    for _ in range(N - 1):
        p, c = map(int, input().split())
        con[p-1].append(c-1)
        con[c-1].append(p-1)

    for _ in range(Q):
        ops.append(tuple(map(int, input().split())))

    for op in ops:
        node = op[0] - 1
        pnt = op[1]
        ans[node] += pnt
    # for _ in range(Q):
    #     p, v = map(int, input().split())
    #     ans[p-1] += v

    stacks = deque()
    stacks.append((0, -1))

    while stacks:
        stack = stacks.pop()
        node, parent = stack[0], stack[1]

        children = con[node]
        for child in children:
            if child == parent:
                continue
            ans[child] += ans[node]
            stacks.append((child, node))

    print(*ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import deque

N, Q = map(int, input().split())
edge = [[] for i in range(N)]
ops = []
ans = [0] * N

for _ in range(N - 1):
    a, b = map(int, input().split())
    edge[a - 1].append(b - 1)
    edge[b - 1].append(a - 1)
for _ in range(Q):
    ops.append(tuple(map(int, input().split())))

for op in ops:
    node = op[0] - 1
    pnt = op[1]
    ans[node] += pnt

stack = deque()
stack.append((0, -1))

while stack:
    st = stack.pop()
    node, parent = st[0], st[1]
    children = edge[node]
    for child in children:
        if child == parent:
            continue
        ans[child] += ans[node]
        stack.append((child, node))

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

def resolve():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))

    A = [[]] * N
    for i in range(M):
        pp, ss = map(int, input().split())
        ss -= 1
        pp -= 1
        A[pp] = A[pp] + [H[ss]]
        A[ss] = A[ss] + [H[pp]]

    ans = 0
    for j in range(N):
        if not A[j]:
            ans += 1
            continue

        now = H[j]
        if (now > max(A[j])):
            ans += 1

    print(ans)


resolve()

### FIXED CODE ###

def resolve():
    n, m = map(int, input().split())
    hhh = list(map(int, input().split()))
    nice = [1] * n

    for _ in range(m):
        a, b = map(int, input().split())
        a -= 1
        b -= 1
        ha = hhh[a]
        hb = hhh[b]
        if ha <= hb:
            nice[a] = False
        if ha >= hb:
            nice[b] = False

    print(sum(nice))


resolve()
### BUGGY CODE ###

from statistics import median

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

def naive(x):
    return [median(x[:i] + x[i+1:]) for i in range(len(x))]

for i in naive(x):
    print(i)

### FIXED CODE ###

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

y = sorted(x)
a = y[len(x)//2]
b = y[(len(x)//2) - 1]

for i in range(n):
    if x[i] <= b:
        print(a)
    else:
        print(b)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
n = int(input())
s = [0]*n
count = 0

for i in range(n):
    tmp = list(str(input()))
    tmp.sort()
    s[i] = "".join(tmp)

for i in range(n):
    for j in range(i+1, n):
        if s[i] == s[j]:
            count += 1

print(count)


### FIXED CODE ###

# -*- coding: utf-8 -*-
n = int(input())
s = [0]*n
count = 0
each_count = {}

for i in range(n):
    tmp = list(str(input()))
    tmp.sort()
    s[i] = "".join(tmp)

for si in s:
    if each_count.setdefault(si, 0) == 0:
        each_count[si] = 1
    else:
        count += each_count[si]
        each_count[si] += 1

print(count)
### BUGGY CODE ###

def f(h, w):
    dt = [[-1, 0], [0, -1], [0, 1], [1, 0]]
    t = [[True] * (w + 2)]
    for _ in range(h):
        t += [[True] + [(c == "#") for c in input()] + [True]]
    t += [[True] * (w + 2)]
    kuro = []
    for i, ti in enumerate(t[1:-1]):
        for j, tij in enumerate(ti[1:-1]):
            if tij:
                kuro+=[(i + 1, j + 1)]
    cnt = -1
    while kuro:
        cnt += 1
        nxt = []
        for i, j in kuro:
            t[i][j] = True
            for di, dj in dt:
                ni, nj = i + di, j + dj
                if t[ni][nj] == False:
                    nxt+=[(ni, nj)]
        kuro = nxt
    print(cnt)


h, w = map(int, input().split())
f(h, w)


### FIXED CODE ###

def f(h, w):
    dt = [[-1, 0], [0, -1], [0, 1], [1, 0]]
    t = [[True] * (w + 2)]
    for _ in range(h):
        t += [[True] + [(c == "#") for c in input()] + [True]]
    t += [[True] * (w + 2)]
    kuro = []
    for i, ti in enumerate(t[1:-1]):
        for j, tij in enumerate(ti[1:-1]):
            if tij:
                kuro+=[(i + 1, j + 1)]
    cnt = -1
    while kuro:
        cnt += 1
        nxt = []
        for i, j in kuro:
            ti=t[i]
            if not ti[j+1]:
                ti[j + 1]=True
                nxt += [(i, j+1)]
            if not ti[j-1]:
                ti[j - 1]=True
                nxt += [(i, j-1)]
            if not t[i - 1][j]:
                t[i - 1][j]=True
                nxt += [(i - 1, j)]
            if not t[i + 1][j]:
                t[i + 1][j]=True
                nxt += [(i + 1, j)]
        kuro = nxt
    print(cnt)


h, w = map(int, input().split())
f(h, w)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(6009)
s=input()
n=len(s)
t=input()
m=len(t)
dp=[[0 for i in range(m)] for j in range(n)]
def lcs(x,y):
	
	if min(x,y)<=-1:
		return ""
	if dp[x][y]!=0:
		return dp[x][y]
	if s[x]==t[y]:
		dp[x][y]=lcs(x-1,y-1)+s[x]
		return dp[x][y]
	a=lcs(x-1,y)
	b=lcs(x,y-1)
	if len(a)>len(b):
		dp[x][y]=a
		return a
	else:
		dp[x][y]=b
		return b
print(lcs(n-1,m-1))

### FIXED CODE ###

s=input()
t=input()
n=len(s)
m=len(t)
dp=[[0 for j in range(m+1)] for i in range(n+1)]
for i in range(1,n+1):
	for j in range(1,m+1):
		if s[i-1]==t[j-1]:
			dp[i][j]=dp[i-1][j-1]+1
		else:
			dp[i][j]=max(dp[i-1][j],dp[i][j-1])
i=n
j=m
st=""
while dp[i][j]:
	while dp[i-1][j]==dp[i][j]:
		i-=1
	while dp[i][j-1]==dp[i][j]:
		j=j-1
	j-=1
	st+=s[i-1]
	i-=1
print(st[::-1])
### BUGGY CODE ###

n,k = map(int,input().split())
l = list(map(int,input().split()))
dp = [0]*n
dp[0] = 0
dp[1] = abs(l[1]-l[0])+dp[0]
for i in range(2,n):
    r = i-k
    if r < 0:
        r = 0

    mi = 9999999999
    for j in range(r,i):
        t = dp[j]+abs(l[j]-l[i])
        if t < mi:
            mi = t

    dp[i] = mi

print(dp[-1])

### FIXED CODE ###

n,k = map(int,input().split())
l = list(map(int,input().split()))
dp = [0]*n
dp[0] = 0
dp[1] = abs(l[1]-l[0])+dp[0]
for i in range(2,n):
    r = i-k
    if r < 0:
        r = 0

    mi = 9999999999
    for j in range(r,i):
        t = dp[j]+abs(l[j]-l[i])
        if t < mi:
            mi = t

    dp[i] = mi

print(dp[-1])
### BUGGY CODE ###

def inv(a, mod):
    b = mod
    p, q = 1, 0
    while b > 0:
        c = a//b
        d = a; a = b; b = d % b
        d = p; p = q; q = d-c*q
    return p+mod if p < 0 else p

def comb(n, r, mod):
    if n < 0 or r < 0 or r > n: return 0
    nu = 1
    de = 1
    for i in range(r):
        nu = nu * (n-i) % mod
        de = de * (i+1) % mod
    return nu * inv(de, mod) % mod


lim=998244353
n,m,k=map(int,input().split())
def f(n,k):
    ans = m %lim
    ans = (ans *pow(m-1,n-k-1,lim)) % lim
    ans = (ans * comb(n-1,k,lim)) % lim
    return ans

#n,m,k = 60522, 114575, 7559
sum_ = 0
for j in range(k+1):
    ans = m %lim
    #print(m-j-1,n,j)
    ans = (ans *pow(m-1,n-j-1,lim)) % lim
    ans = (ans * comb(n-1,j,lim)) % lim
    #print(ans)
    sum_ = (sum_+ans) % lim
print(sum_)

### FIXED CODE ###

class Combination():
    def __init__(self, n, mod):
        self.n = n
        self.mod = mod
        self.fact = self.make_fact(n)
        self.fact_inv = self.make_fact_inv(n)
    def make_fact(self, n):#0~nの階乗を求める
        res = [1]*(n+1)
        for i in range(1, n+1):
            res[i] = res[i-1]*i%self.mod
        return res
    def make_fact_inv(self, n):#0~nの階乗のmodに関する逆元を求める
        fact_inv = [1]*(n+1)
        fact_inv[n] = pow(self.fact[n], self.mod-2, self.mod)#フェルマーの小定理
        for i in range(n, 0, -1):
            fact_inv[i-1] = fact_inv[i]*i%self.mod
        return fact_inv
    def comb(self, m, k):
        return self.fact[m]*self.fact_inv[k]*self.fact_inv[m-k]%self.mod
    


lim=998244353
n,m,k=map(int,input().split())

#n,m,k = 60522, 114575, 7559
sum_ = 0
comb=Combination(n,lim)
for j in range(k+1):
    ans = m %lim
    #print(m-j-1,n,j)
    ans = (ans *pow(m-1,n-j-1,lim)) % lim
    ans = (ans * comb.comb(n-1,j)) % lim
    #print(ans)
    sum_ = (sum_+ans) % lim
print(sum_)
### BUGGY CODE ###

from sys import stdin
from queue import Queue


def main():
    n, x, y = [int(x) for x in stdin.readline().rstrip().split()]
    x -= 1
    y -= 1
    ans = [0] * n
    for i in range(n):
        dist = [None] * n
        q = Queue()

        def push(d, v):
            if v < 0 or n <= v:
                return
            if dist[v] is not None:
                return
            dist[v] = d
            q.put(v)

        push(0, i)
        while not q.empty():
            v = q.get()
            d = dist[v]
            push(d + 1, v - 1)
            push(d + 1, v + 1)
            if v == x:
                push(d + 1, y)
            if v == y:
                push(d + 1, x)

        for d in dist:
            ans[d] += 1

    ans = [x // 2 for x in ans]
    print(*ans[1:], sep='\n')


if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import stdin


def main():
    N, X, Y = [int(x) for x in stdin.readline().rstrip().split()]
    result = [0] * (N - 1)
    for left in range(1, N):
        for right in range(left + 1, N + 1):
            if (left <= X) and (Y <= right):
                x = (X - left) + 1 + (right - Y)
            elif (left <= X) and (X <= right <= Y):
                x = (X - left) + min((right - X), (Y - right) + 1)
            elif (X <= left <= Y) and (Y <= right):
                x = min((Y - left), (left - X) + 1) + (right - Y)
            elif (X <= left <= Y) and (X <= right <= Y):
                x = min((right - left), (left - X) + (Y - right) + 1)
            else:
                x = right - left
            result[x - 1] += 1
    print(*result, sep='\n')


if __name__ == "__main__":
    main()
### BUGGY CODE ###

from sys import stdin
import sys
import math

n = int(input())
a = list(map(int, stdin.readline().rstrip().split()))

pair = 0
odd = 0


for i in range(0, len(a), 2):
    pair += a[i]

for i in range(1, len(a), 2):
    odd += a[i]

#print(odd)
#print(pair)


count = 0
current_sum = 0
for i in range(len(a)):
    ## odd
    if i % 2 == 1 and odd > pair:
        while current_sum + a[i] < 1:
            a[i] += 1
            count += 1
    ## odd
    elif i % 2 == 1 and odd < pair:
        while current_sum + a[i] > -1:
            a[i] -= 1
            count += 1
    ## pair
    elif i % 2 == 0 and odd > pair:
        while current_sum + a[i] > -1:
            a[i] -= 1
            count += 1
    elif i % 2 == 0 and odd < pair:
        while current_sum + a[i] < 1:
            a[i] += 1
            count += 1
    else:
        print("error")

    current_sum += a[i]


print(count)


### FIXED CODE ###

from sys import stdin
import sys
import math

n = int(input())
a = list(map(int, stdin.readline().rstrip().split()))

#print(odd)
#print(pair)


## pair > odd
count_pair = 0
current_sum = 0
diff = 0
for i in range(len(a)):
    if i % 2 == 0:
        if current_sum + a[i] < 1:
            diff = 1 - (current_sum + a[i])
            count_pair += diff
        else:
            diff = 0
    elif i % 2 == 1:
        if current_sum + a[i] > -1:
            diff = -1 - (current_sum + a[i])
            count_pair += -1 * diff
        else:
            diff = 0

    current_sum += a[i] + diff
    if current_sum == 0:
        print("Error")

# odd > pair
count_odd = 0
current_sum = 0
diff = 0
i=0
for i in range(len(a)):
    if i % 2 == 1:
        if current_sum + a[i] < 1:
            diff = 1 - (current_sum + a[i])
            count_odd += diff
        else:
            diff = 0
    elif i % 2 == 0:
        if current_sum + a[i] > -1:
            diff = -1 - (current_sum + a[i])
            count_odd += -1 * diff
        else:
            diff = 0


    current_sum += a[i] + diff
    if current_sum == 0:
        print("Error")


print(min(count_odd, count_pair))
### BUGGY CODE ###

import itertools
N,M,X = map(int,input().split())
book =[]
for x in range(N):
    A_list =  list(map(int, input().split()))
    book.append(A_list)
conbination =[]
for i, _ in enumerate(book, 1):     
    for j in itertools.permutations(book, r=i):  # rには1、2、3と渡される
        conbination.append(j)
minn =100000000
for x in conbination:
    A = [0]*M
    m = 0
    for y in x:
        for z in range(len(y)):
            if z ==0:
                m +=y[z]
            else:
                A[z-1] +=y[z]
    if minn >m and X<=min(A):
        
        minn =m
        
if minn != 100000000:
    print(minn)
else:
    print(-1)

### FIXED CODE ###

import itertools
N,M,X = map(int,input().split())
book =[]
for x in range(N):
    A_list =  list(map(int, input().split()))
    book.append(A_list)
conbination =[]
for i, _ in enumerate(book, 1):     
    for j in itertools.combinations(book, r=i):  # rには1、2、3と渡される
        conbination.append(j)
minn =100000000
for x in conbination:
    A = [0]*M
    m = 0
    for y in x:
        for z in range(len(y)):
            if z ==0:
                m +=y[z]
            else:
                A[z-1] +=y[z]
    if minn >m and X<=min(A):
        minn =m
        
if minn != 100000000:
    print(minn)
else:
    print(-1)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
x=[0]
a_sum=[0]
for i in a:
    xi=x[-1]^i
    x.append(xi)
    ai=a_sum[-1]+i
    a_sum.append(ai)
ans=0
for i in range(n):
    for j in range(i,n):
        xij=x[i]^x[j+1]
        aij=a_sum[j+1]-a_sum[i]
        if xij==aij:
            ans+=1

print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
a.append(0)
x=a[0]
xi=1
ans=0
x_s=0
x_e=0
a_sum=a[0]
while x_e<n:
    if x_s==x_e:
        x_e+=1
        ans+=1
        xi=2
        x^=a[x_e]
        a_sum+=a[x_e]
    elif x==a_sum:
        ans+=xi
        xi+=1
        x_e+=1
        x=x^a[x_e]
        a_sum=a_sum+a[x_e]
    else:
        xi-=1
        x=x^a[x_s]
        a_sum=a_sum-a[x_s]
        x_s+=1

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

from collections import defaultdict
n,k=map(int,input().split())
xy=[list(map(int,input().split())) for _ in range(n)]
xwl=dict((c[0],i) for i,c in enumerate(xy))
ywl=dict((c[1],i) for i,c in enumerate(xy))
x=list(xwl.keys())
y=list(ywl.keys())
x.sort()
y.sort()

xdict=dict()
ydict=dict()
xdict[x[0]]=[1<<xwl[x[0]],0]
ydict[y[0]]=[1<<ywl[y[0]],0]
size=lambda x:sum(x>>i&1 for i in range(n))
minus=lambda x,y:(x|y)^y
for i in range(1,n):
  xdict[x[i]]=[xdict[x[i-1]][0]|(1<<xwl[x[i]]), xdict[x[i-1]][1]|(1<<xwl[x[i-1]])]
  ydict[y[i]]=[ydict[y[i-1]][0]|(1<<ywl[y[i]]), ydict[y[i-1]][1]|(1<<ywl[y[i-1]])]
ans=float('inf')
for s in range(n):
  for t in range(s+1,n):
    for u in range(n):
      for v in range(u+1,n):
        if size(minus(xdict[x[t]][0],xdict[x[s]][1])&\
                minus(ydict[y[v]][0],ydict[y[u]][1]))>=k:
          ans=min(ans,(x[t]-x[s])*(y[v]-y[u]))
print(ans)

### FIXED CODE ###

from collections import defaultdict
def main():
  n,k=map(int,input().split())
  xy=[list(map(int,input().split())) for _ in range(n)]
  x=[p[0] for p in xy]
  y=[p[1] for p in xy]
  x.sort()
  y.sort()
  
  s1=[[0]*n for _ in range(n)]
  s2=[[0]*n for _ in range(n)]
  s3=[[0]*n for _ in range(n)]
  s4=[[0]*n for _ in range(n)]
  for i in range(n):
    for j in range(n):
        for p in xy:
            if p[0]<=x[i] and p[1]<=y[j]:
              s1[i][j]+=1
              s2[i][j]+=(p[0]<x[i])
              s3[i][j]+=(p[1]<y[j])
              s4[i][j]+=(p[0]<x[i])*(p[1]<y[j])
  ans=float('inf')
  for s in range(n):
    for t in range(s+1,n):
      for u in range(n):
        for v in range(u+1,n):
          if s1[t][v]-s3[t][u]-s2[s][v]+s4[s][u]>=k:
            ans=min(ans,(x[t]-x[s])*(y[v]-y[u]))
  print(ans)

if __name__=='__main__':
  main()