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

n = int(input())
v = list(map(int, input().split()))
v1 = []
v2 = []
ans = 0

for i in range(n):
    if i % 2 == 0:
        v1.append(v[i])
    else:
        v2.append(v[i])

mostCount1 = 0
mostChar1 = 0
dp1 = [None] * 100000

for i in range(n//2):
    count = 0
    if dp1[v1[i]] is not None:
        count = dp1[v1[i]]
    else:
        dp1[v1[i]] = v1.count(v1[i])
        count = dp1[v1[i]]
#    count = v1.count(v1[i])
    if count > mostCount1:
        mostCount1 = count
        mostChar1 = v1[i]
        if mostCount1 > n//2:
            break

mostCount2 = 0
mostChar2 = 0
dp2 = [None] * 100000

for i in range(n//2):
#    count = v2.count(v2[i])
    count = 0
    if dp2[v2[i]] is not None:
        count = dp2[v2[i]]
    else:
        dp2[v2[i]] = v2.count(v2[i])
        count = dp2[v2[i]]

    if count > mostCount2:
        mostCount2 = count
        mostChar2 = v2[i]
        if mostCount2 > n//2:
            break

if mostChar1 == mostChar2:
    ans = n//2
else:
    ans = n - mostCount1 - mostCount2

print(ans)

### FIXED CODE ###

import collections

n = int(input())
v = list(map(int, input().split()))
v1 = []
v2 = []
ans = 0

for i in range(n):
    if i % 2 == 0:
        v1.append(v[i])
    else:
        v2.append(v[i])

c1 = collections.Counter(v1)
mostChar1, mostCount1 = c1.most_common()[0]
#ndChar1, ndCount1 = c1.most_common()[1]

c2 = collections.Counter(v2)
mostChar2, mostCount2 = c2.most_common()[0]
#ndChar2, ndCount2 = c2.most_common()[1]

if mostChar1 == mostChar2:
    if len(c1.most_common()) == 1 and len(c1.most_common()) == 1:
        ans = n // 2
    elif len(c1.most_common()) == 1:
        ndChar2, ndCount2 = c2.most_common()[1]
        ans = n - mostCount1 - ndCount2
    elif len(c2.most_common()) == 1:
        ndChar1, ndCount1 = c1.most_common()[1]
        ans = n - mostCount2 - ndCount1
    else:
        ndChar1, ndCount1 = c1.most_common()[1]
        ndChar2, ndCount2 = c2.most_common()[1]
        temp1 = n - mostCount1 - ndCount2
        temp2 = n - mostCount2 - ndCount1
        ans = min(temp1, temp2)
else:
    ans = n - mostCount1 - mostCount2

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

import numpy as np

MOD = 10**9 + 7
def solve(n, a, p=64):
    s = np.zeros(p, dtype=int)
    a = a[::-1]
    res = 0
    for i in range(n):
        mask = bin(a[i])[2:].zfill(p)[::-1]
        mask = np.asarray(list(map(int, mask)), dtype=int)
        s += mask
        for j in range(p):
            if mask[j] == 1:
                res += (i - int(s[j]) + 1) * (2**j)
            else:
                res += int(s[j]) * (2**j)
        res %= MOD
    return res % MOD

n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))

### FIXED CODE ###

MOD = 10**9 + 7
def solve(n, a, p=60):
    res, m = 0, 1
    for i in range(p):
        y = sum(x & m for x in a) // m
        res += y * (n-y) * m
        m *= 2
    return res % MOD

n = int(input())
a = list(map(int, input().split()))
print(solve(n, a))
### BUGGY CODE ###

import sys,time
sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    start = time.time()
    n,m = LI()
    a = [LI() for _ in range(m)]
    e = [[] for _ in range(n)]
    for l,r,d in a:
        e[l-1].append((r-1,d))
        e[r-1].append((l-1,-d))

    b = [False] * n
    def g(i,c):
        if time.time() - start > 0.9:
            return True
        if c == False:
            c = 0
        b[i] = c
        for r,d in e[i]:
            if b[r] != False:
                if b[r] != c+d:
                    return False
            else:
                if not g(r,c+d):
                    return False
        return True

    for i in range(n):
        if b[i] != False:
            continue
        if not g(i,False):
            return 'No'
    return 'Yes'


print(main())





### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**15
mod = 10**9+7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,m = LI()
    e = [[] for _ in range(n)]
    if m > 0:
        for _ in range(m):
            l,r,d = LI()
            e[l-1].append((r-1,d))
            e[r-1].append((l-1,-d))

    b = [None] * n

    for i in range(n):
        if not b[i] is None:
            continue
        b[i] = 0
        q = [i]
        qi = 0
        nq = []
        while True:
            if len(q) == qi:
                if not nq:
                    break
                q = nq
                qi = 0
                nq = []
            j = q[qi]
            qi += 1
            c = b[j]
            for r,d in e[j]:
                if b[r] is None:
                    b[r] = c+d
                    nq.append(r)
                else:
                    if b[r] != c+d:
                        return 'No'

    return 'Yes'


print(main())
### BUGGY CODE ###

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

import numpy as np
from scipy.sparse.csgraph import floyd_warshall
graph = np.zeros((n,n))
for i in range(n-1):
    graph[i][i+1] = 1
graph[x-1][y-1] = 1
s = floyd_warshall(graph,directed=False)
dst = {}
for i in range(n-1):
    for j in range(i+1,n):
        if not s[i][j] in dst.keys():
            dst[s[i][j]] = int(1)
        else:
            dst[s[i][j]] += int(1)
for i in range(1,n):
    if not i in dst.keys():
        print(0)
    else:
        print(dst[i])

### FIXED CODE ###

def main():
    n,x,y = map(int,input().split())
    dst = {}
    for i in range(1,n):
        dst[i]=0
    for i in range(1,n):
        for j in range(i+1,n+1):
            d = min(j-i,abs(x-i)+1+abs(y-j))
            dst[d]+=1
    for i in range(1,n):
        print(dst[i])

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

import fractions

def return_prime(aa):
    a_list = [1]
    prime_list = []
    if aa % 2 == 0:
        a_list.append(2)
    for i in range(3, aa + 1, 2):
        if len([i % prime for prime in prime_list if i % prime == 0]) == 0:
            prime_list.append(i)
            if aa % i == 0:
                a_list.append(i)
    return a_list

a, b = map(int, input().split())
a_list = return_prime(fractions.gcd(a, b))
print(len(set(a_list)))

### FIXED CODE ###

import fractions

def return_prime(aa):
    a_list = [1]
    for i in range(2, int(aa ** 0.5) + 2):
        while aa % i == 0:
            a_list.append(i)
            aa = aa // i
    if aa != 1:
        a_list.append(aa)
    return a_list

a, b = map(int, input().split())
a_list = return_prime(fractions.gcd(a, b))
print(len(set(a_list)))
### BUGGY CODE ###

m = 10**9+7
#モジュロ逆数
def inv(x):
  m = 10**9+7
  t = x
  y = 1
  while True:
    if t == 1:
      break
    y *= m // t
    t = m % t
    y *= -1
    y %= m
  return y
def f(x):
  nn = x
  y = 1
  while True:
    if nn == 1:
      break
    y *= nn
    nn -= 1
  return y
def cc(x,y):
  return f(x) // f(y) // f(x-y)
n,a,b,c = map(int,input().split())
d = 100 - c
awin = a * inv(d)
bwin = b * inv(d)
asc = 0
bsc = 0
for i in range(n):
  p = cc(n-1,i) * awin**(n-1) * bwin**i
  asc += p
  asc %= m
for i in range(n):
  p = cc(n-1,i) * awin**i * bwin**(n-1)
  bsc += p
  bsc %= m
sc0 = asc * awin + bsc * bwin
sc0 %= m
sc1 = sc0 * 100 * inv(d)
sc1 %= m
print(sc1)

### FIXED CODE ###

#18:04
n,a,b,c = map(int,input().split())
mod = 10 ** 9 + 7
def inv(x):
  ans = 1
  now = x
  while now != 1:
    ans *= mod // now + 1
    ans %= mod
    now = now - mod % now
  return ans
p = (a * inv(a+b)) % mod
q = (b * inv(a+b)) % mod
taka = 0
aoki = 0
tcom = 1
acom = 1
for i in range(n):
  taka += tcom * (n+i)
  tcom *= n+i
  tcom *= inv(i+1)
  tcom *= q
  tcom %= mod
  aoki += acom * (n+i)
  acom *= n+i
  acom *= inv(i+1)
  acom *= p
  acom %= mod
for _ in range(n):
  taka *= p
  taka %= mod
  aoki *= q
  aoki %= mod
ans = taka + aoki
ans *= 100
ans *= inv(a+b)
ans %= mod
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n = II()
    print(0)
    s = S()
    if s == "Vacant":
        return
    x = s
    ok = 0
    ng = n
    while 1:
        mid = (ok + ng) // 2
        print(mid)
        s = S()
        if s == "Vacant":
            return
        if mid & 1 == ok & 1:
            if s == x:
                ok = mid
            else:
                ng = mid
        else:
            if s == x:
                ng = mid
            else:
                ok = mid

    return


#main
if __name__ == '__main__':
    solve()


### FIXED CODE ###

#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    n = II()
    print(0,flush = True)
    s = S()
    if s == "Vacant":
        return
    x = s
    ok = 0
    ng = n
    while 1:
        mid = (ok + ng) // 2
        print(mid, flush=True)
        s = S()
        if s == "Vacant":
            return
        if mid & 1 == ok & 1:
            if s == x:
                ok = mid
            else:
                ng = mid
        else:
            if s == x:
                ng = mid
            else:
                ok = mid
                x = s

    return


#main
if __name__ == '__main__':
    solve()
### BUGGY CODE ###

count = int(raw_input())
k = [int(raw_input()) for i in range(count)]
temp = []
for i in range(len(k)):
    if k[i] not in temp:
        temp.append(k[i])
    elif k[i] in temp:
        temp.remove(k[i])

print len(temp)


### FIXED CODE ###

from collections import Counter

count = int(raw_input())
k = [int(raw_input()) for i in xrange(count)]
temp = Counter(k)
counter = 0
for key, value in temp.iteritems():
    if value % 2 != 0:
        counter += 1

print counter
### BUGGY CODE ###


N = int(input())

cnt_dict = {}

for i in range(N):
    s_str = "".join(sorted(input()))
    if s_str not in cnt_dict.keys():
        cnt_dict[s_str] = 1
        continue
    cnt_dict[s_str] += 1

import itertools
comb = itertools.combinations

total = 0
for key in cnt_dict.keys():
    cnt = cnt_dict[key]
    if cnt < 2:
        continue
    total += len(list(comb(range(cnt), 2)))

print(total)


### FIXED CODE ###


N = int(input())

cnt_dict = {}

for i in range(N):
    s_list = list(input())
    s_list.sort()
    s_str = "".join(s_list)
    if s_str not in cnt_dict.keys():
        cnt_dict[s_str] = 1
        continue
    cnt_dict[s_str] += 1

import itertools
comb = itertools.combinations

total = 0
for key in cnt_dict.keys():
    cnt = cnt_dict[key]
    if cnt < 2:
        continue
    total += cnt * (cnt - 1) // 2

print(total)
### BUGGY CODE ###

N, K = map(int, input().split())
p = list(map(int, input().split()))
ans = []
f = N-K+1
for i in range(f):
    ans.append(sum(p[i : i + K]))
print((max(ans) + K) / 2)

### FIXED CODE ###

N, K = map(int, input().split())
p = [int(x) for x in input().split()]
s = sum(p[0 : K])
ans = sum(p[0 : K])
f = N-K+1
for i in range(1, f):
    s = s - p[i-1] + p[i + K - 1]
    if ans <= s:
        ans = s
print((ans + K) / 2)
### BUGGY CODE ###

def gcd(n,m):
    while n:
        m,n = [n,m%n]
    return m

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

S = gcd(A,B)

s = 1
i = 2
while S != 1:
    hoge = 0
    while S % i == 0:
        hoge += 1
        S //= i
    if hoge:
        s += 1
    i += 1

print(s)

### FIXED CODE ###

def gcd(n,m):
    while n:
        m,n = [n,m%n]
    return m

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

S = gcd(A,B)

s = 1
i = 2
while True:
    if S == 1:
        break
    if i ** 2 >= S:
        break
    hoge = 0
    while S % i == 0:
        hoge += 1
        S //= i
    if hoge:
        s += 1
    i += 1

print(s + (S != 1))
### BUGGY CODE ###

def main():
    from collections import deque
    n,x,y = map(int,input().split())
    ans = [0]*(n)
    E = [[] for i in range(n)]
    E[0].append(1)
    E[n-1].append(n-2)
    for i in range(1,n-1):
        E[i].append(i-1)
        E[i].append(i+1)
    E[x-1].append(y-1)
    E[y-1].append(x-1)
    ans = [0]*(n)
    def search(x):
        d = [float("INF")]*n
        d[x] = 0
        q = deque([])
        q.append((x,0))
        while q:
            bef,l = q.popleft()

            for nex in E[bef]:
                if d[nex] > l+1:
                    d[nex] = l+1
                    q.append((nex,l+1))
        
        d = d[x:]
        for j in range(n):
            ans[j] += d.count(j)
    for i in range(n-1):
        search(i)

    for i in ans[1:]:
        print(i)
if __name__ == "__main__":
    main()



### FIXED CODE ###

n,x,y = map(int,input().split())
ans = [0]*(n)

for i in range(1,n):
    for j in range(i+1,n+1):
        d = min(j-i,abs(x-i)+abs(y-j)+1)
        ans[d] += 1
for i in ans[1:]:
    print(i)
### BUGGY CODE ###

S = input()
N = len(S)
while True:
  temp_S = S.replace('01', '').replace('10', '')
  if temp_S == S:
    break
  S = temp_S

print(N - len(S))

### FIXED CODE ###

S = input()
C0, C1 = S.count('0'), S.count('1')
print(2 * min(C0, C1))
### BUGGY CODE ###

from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

def culcC(num):
    if num  < 2:
        return 1
    ret = 1
    minus2 = 1
    while(True):
        ret += cmb(num - minus2,minus2 if minus2 >0 else 1)
        minus2 += 1
        if num - 2 * minus2 < 0:
            break
    return ret
            
n,m = map(int,input().split())
aa = [int(input()) for i in range(m)]

if n == 1:
    print(1)
elif m == 0:
    print(culcC(n) % 1000000007)
else:
    ans = 1
    stand = 0
    for i,a in enumerate(aa):
#        連続穴
        if stand == a:
            ans = 0
            break
        step_num = a - stand - 1
        ans *= culcC(step_num)
        stand = a + 1
        
    # 最後のaからnまでで計算
    ans *= culcC(n - aa[-1] - 1)
    
    print(ans % 1000000007)

### FIXED CODE ###

def fib(num):
    a, b = 0, 1 
    for _ in range(num - 1):
#         print(a)
        a, b = a + b, a
    return a + b

def culcC(num):
    if num  < 2:
         return 1
    return fib(num) + fib(num-1)
            
n,m = map(int,input().split())
aa = [int(input()) for i in range(m)]

if n == 1:
    print(1)
elif m == 0:
    print(culcC(n) % 1000000007)
else:
    ans = 1
    stand = 0
    for i,a in enumerate(aa):
#        連続穴
        if stand == a:
            ans = 0
            break
        step_num = a - stand - 1
        c = culcC(step_num)
        ans *= c if c > 0 else 1
        stand = a + 1
        
    # 最後のaからnまでで計算
    ans *= culcC(n - aa[-1] - 1)
    
    print(ans % 1000000007)
### BUGGY CODE ###

import time
mem = {}
def gcd(a, b):
    global mem
    if (a, b) not in mem and (b, a) not in mem:
        mem[(a, b)] = a if b == 0 else gcd(b, a%b)
        mem[(b, a)] = mem[(a, b)]
    return mem[(a, b)]

K = int(input())
res = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        gcd(i, j)
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            res += mem[(mem[i, j], k)]
print(res)

### FIXED CODE ###

from math import gcd
K = int(input())
res = 0
for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            res += gcd(gcd(i, j), k)
print(res)
### BUGGY CODE ###

from itertools import accumulate

mod = 10 ** 9 + 7

N, K = map(int, input().split())
A = sorted([int(x) for x in input().split()])

table = [tuple([1] * K)]
for _ in range(N - K):
    tmp = accumulate(table[-1])
    table.append(tuple(x % mod for x in tmp))

comb = [table[i][K - 1] for i in range(N - K + 1)]
ans = 0
for i in range(N - K + 1):
    ans += comb[i] * (A[i + K - 1] - A[N - i - K])
    ans %= mod
print(ans)


### FIXED CODE ###

from itertools import accumulate

mod = 10 ** 9 + 7

N, K = map(int, input().split())
A = sorted([int(x) for x in input().split()])

f = [1 for _ in range(N + 1)]
inv = [1 for _ in range(N + 1)]
finv = [1 for _ in range(N + 1)]

for i in range(2, N + 1):
    f[i] = f[i - 1] * i % mod
    inv[i] = mod - inv[mod % i] * (mod // i) % mod
    finv[i] = finv[i - 1] * inv[i] % mod
comb = [f[n] * (finv[K - 1] * finv[n - (K - 1)] % mod) % mod for n in range(K - 1, N)]

ans = 0
for i in range(N - K + 1):
    ans += comb[i] * (A[i + K - 1] - A[N - i - K])
    ans %= mod
print(ans)
### BUGGY CODE ###

import numpy as np
from operator import add
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))
    except:
        break;
N=listA[0]
lis_0=[0]*N[0]
lis=listA[1]
arr=np.array(lis)
for idx1,i in enumerate(lis):
    arr_=arr/i
    lis_=arr_.tolist()
    
    for idx,num in enumerate(lis_):
        if idx!=idx1:
            if num.is_integer(): lis_[idx]=1
            else: lis_[idx]=0
        else:lis_[idx]=0
    lis_0 = list(map(add, lis_, lis_0))
        
print(lis_0.count(0))

### FIXED CODE ###

## 動画見てアルゴリズムを知った
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))
    except:
        break;

lis=listA[1]
m=max(lis)
lis0=[0]*(m+1)
for i in lis:
    if lis0[i]!=2: 
        j=1
        while i*j<=m:
            lis0[i*j]+=1
            j+=1
            
count=0
for i in lis:
    if lis0[i]==1: count+=1
print(count)
### BUGGY CODE ###

S = input()
K = 13
MOD = 10**9 + 7

dp = [0] * K
dp[0] = 1

for s in S:
    newDp = [0] * K
    if s == '?':
        for i in range(10):
            for j in range(K):
                newDp[(j * 10 + i) % K] += dp[j]
    else:
        i = int(s)
        for j in range(K):
            newDp[(j * 10 + i) % K] += dp[j]
    dp = newDp

print(dp[5] % MOD)


### FIXED CODE ###

S = input()
MOD = 10**9 + 7
lenS = len(S)

dp = [[0 for _ in range(13)] for _ in range(lenS + 1)]  # dp[digit][d] = digit桁までの mod=d の数
dp[0][0] = 1

digitMask = 1

for digit in range(1, lenS + 1) :
    if(S[-digit] == '?') :
        for d in range(13) :
            for k in range(10) :
                dp[digit][d] = (dp[digit][d] + dp[digit - 1][(d - k * digitMask) % 13]) % MOD
    else :
        a = int(S[-digit])
        for d in range(13) :
            dp[digit][d] = (dp[digit][d] + dp[digit - 1][(d - a * digitMask) % 13]) % MOD
    digitMask *= 10
    digitMask %= 13

ans = (dp[len(S)][5]) % MOD
print(ans)
### BUGGY CODE ###

import numpy as np


def c(A):
    N = len(A)
    B = np.zeros_like(A)
    for i, a in enumerate(A):
        l = max(0, i - a)
        r = min(N - 1, i + a)
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1

    B = np.cumsum(B)
    return B


N, K = map(int, input().split())
A = np.array(list(map(int, input().split())))


K = min(K, 50)
for _ in range(K):
    A = c(A)

print(' '.join(A.astype(str)))

### FIXED CODE ###

import sys
import numpy as np
from numba import njit


read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

@njit('(i8[::1],)', cache=True)
def c(A):
    N = len(A)
    B = np.zeros_like(A)
    for i, a in enumerate(A):
        l = max(0, i - a)
        r = min(N - 1, i + a)
        B[l] += 1
        if r + 1 < N:
            B[r + 1] -= 1

    B = np.cumsum(B)
    return B


def main():
    N, K = map(int, readline().split())
    A = np.array(readline().split(), np.int64)


    K = min(K, 50)
    for _ in range(K):
        A = c(A)

    print(' '.join(A.astype(str)))


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

import sys
import itertools

input = sys.stdin.readline


def main():
    N, K = [int(x) for x in input().split()]
    XY = [[int(x) for x in input().split()] for _ in range(N)]

    xset = set()
    yset = set()

    for x, y in XY:
        xset.add(x)
        yset.add(y)

    xlist = list(xset)
    ylist = list(yset)

    ans = float("inf")

    for a, b in itertools.combinations(range(len(xlist)), 2):
        maxx = max(xlist[a], xlist[b])
        minx = min(xlist[a], xlist[b])

        for c, d in itertools.combinations(range(len(ylist)), 2):
            maxy = max(ylist[c], ylist[d])
            miny = min(ylist[c], ylist[d])

            cnt = 0
            for x, y in XY:
                if minx <= x <= maxx and miny <= y <= maxy:
                    cnt += 1

            if cnt >= K:
                ans = min(ans, (maxx - minx) * (maxy - miny))

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import itertools

input = sys.stdin.readline


def main():
    N, K = [int(x) for x in input().split()]
    XY = [[int(x) for x in input().split()] for _ in range(N)]

    xset = set()
    yset = set()

    for x, y in XY:
        xset.add(x)
        yset.add(y)

    xlist = list(xset)
    ylist = list(yset)

    ans = float("inf")

    for a, b in itertools.combinations(range(len(xlist)), 2):
        maxx = max(xlist[a], xlist[b])
        minx = min(xlist[a], xlist[b])

        for c, d in itertools.combinations(range(len(ylist)), 2):
            maxy = max(ylist[c], ylist[d])
            miny = min(ylist[c], ylist[d])

            cnt = 0
            for x, y in XY:
                if minx <= x <= maxx and miny <= y <= maxy:
                    cnt += 1

            if cnt >= K:
                ans = min(ans, (maxx - minx) * (maxy - miny))

    print(ans)


if __name__ == '__main__':
    main()