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

import bisect

n = int(input())
a = list(map(int, input().split()))
a.sort()
k = len(a)
ok = [0] * k
for i in range(k):
    if i < k - 1 and a[i] == a[i + 1]:
        ok[i] = 1
        ok[i+1] = 1;
        continue

    if a[i] < 2 * 10:
        for j in range(i + 1, k):
            if a[j] % a[i] == 0:
                ok[j] = 1
    else:   
        times = 2
        while a[i] * times <= a[-1]:
            r = bisect.bisect_left(a, a[i] * times + 1)
            l = bisect.bisect_left(a, a[i] * times)
            if r != l:
                for idx in range(l, r):
                    ok[idx] = 1
            times += 1
print(len([i for i in ok if i == 0]))
# print(ok) WAはどこ？


### FIXED CODE ###

import bisect

n = int(input())
a = list(map(int, input().split()))
a.sort()
k = len(a)
ok = [0] * k
for i in range(k):
    if i < k - 1 and a[i] == a[i + 1]:
        ok[i] = 1
        ok[i+1] = 1;
        continue

    if a[i] < 2 * 100:
        for j in range(i + 1, k):
            if a[j] % a[i] == 0:
                ok[j] = 1
    else:   
        times = 2
        while a[i] * times <= a[-1]:
            r = bisect.bisect_left(a, a[i] * times + 1)
            l = bisect.bisect_left(a, a[i] * times)
            if r != l:
                for idx in range(l, r):
                    ok[idx] = 1
            times += 1
print(len([i for i in ok if i == 0]))
# print(ok) WAはどこ？
### BUGGY CODE ###

#155 Poll
n = int(input())
words = {}
for i in range(n):
    name = input()
    if name not in words:
        words[name] = 1
    elif name in words:
        words[name] += 1
        
max_k_list = [kv[0] for kv in words.items() if kv[1] == max(words.values())]
max_k_list.sort()
print('\n'.join(max_k_list))

### FIXED CODE ###

#155 Poll
n = int(input())
words = {}
for i in range(n):
    name = input()
    if name not in words:
        words[name] = 1
    elif name in words:
        words[name] += 1

num = max(words.values())
max_k_list = [kv[0] for kv in words.items() if kv[1] == num]
max_k_list.sort()
print('\n'.join(max_k_list))
### BUGGY CODE ###

N = int(input())
As = [int(input()) for _ in range(N)]

list_ = [As[0]]
for a in As[1:]:
    if a > list_[0]:
        list_[0] = a
    elif a <= list_[-1]:
        list_.append(a)
    else:
        for i, l in enumerate(list_):
            if a > l:
                list_[i] = a
                break
print(len(list_))

### FIXED CODE ###

from bisect import bisect_left
from collections import deque

N = int(input())
As = [int(input()) for _ in range(N)]

list_ = deque([As[0]])
for a in As[1:]:
    i = bisect_left(list_, a) - 1
    if i < 0:
        list_.appendleft(a)
    else:
        list_[i] = a
print(len(list_))
### BUGGY CODE ###

import math

def max_price(price):
    res = -math.inf
    for idx_j, j in enumerate(price):
        for i in range(idx_j):
            if j - price[i] > res:
                res = j - price[i]
    return res

def run():
    n = int(input())
    price = [int(input()) for _ in range(n)]
    print(max_price(price))

if __name__ == '__main__':
    run()


### FIXED CODE ###

import math

class MaxPrice(object):
    
    def __init__(self):
        self.min_price = math.inf
        self.max_price = -math.inf
        self.max_diff = -math.inf

    def set_price(self, p):
        if self.max_price < p:
            self.max_price = p
        else:
            if self.max_diff < p - self.max_price:
                self.max_diff = p - self.max_price

        if p < self.min_price:
            self.min_price = p
        else:
            if self.max_diff < p - self.min_price:
                self.max_diff = p - self.min_price

def run():
    n = int(input())
    mp = MaxPrice()
    for i in range(n):
        p = int(input())
        mp.set_price(p)
    print(mp.max_diff)

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

import sys
from bisect import bisect, bisect_left

class SquareDiv(): #区間の最大値を求める
    def __init__(self, N, V):
        k = 1
        while k ** 2 < N: k += 1
        self.array = [V] * k
        self.size = k
        self.indivisual = [V] * N

    def update(self, i, v): #i番目をvに更新する
        self.indivisual[i] = v
        self.array[i // self.size] = max(self.array[i // self.size], v)

    def search(self, left, right): #[left, right]の最大値を求める
        lk, rk = left // self.size, right // self.size
        if lk == rk:
            maxN = 0
            for i in range(left, right + 1): maxN = max(maxN, self.indivisual[i])
            return maxN
        else:
            maxN = self.search(left, (lk + 1) * self.size - 1)
            for k in range(lk + 1, rk): maxN = max(maxN, self.array[k])
            maxN = max(maxN, self.search(rk * self.size, right))
            return maxN

def solve():
    input = sys.stdin.readline
    N = int(input())
    R = [[int(i) for i in input().split()] for _ in range(N)]
    R.sort()
    mod = 998244353
    X = [R[i][0] for i in range(N)]
    Connect = SquareDiv(N, 0)
    DP = dict()
    DP[N] = 1
    for i in reversed(range(N)):
        right = max(i, Connect.search(i, bisect_left(X, sum(R[i])) - 1))
        Connect.update(i, right)
        DP[i] = (DP[right + 1] + DP[i + 1]) % mod
    print(DP[0])
    

    return 0

if __name__ == "__main__":
    solve()


### FIXED CODE ###

import sys
from bisect import bisect, bisect_left

class SquareDiv(): #区間の最大値を求める
    def __init__(self, N, V):
        k = 1
        while k ** 2 < N: k += 1
        self.array = [V] * k
        self.size = k
        self.indivisual = [V] * N

    def update(self, i, v): #i番目をvに更新する
        self.indivisual[i] = v
        self.array[i // self.size] = max(self.array[i // self.size], v)

    def search(self, left, right): #[left, right]の最大値を求める
        lk, rk = left // self.size, right // self.size
        if lk == rk:
            maxN = 0
            for i in range(left, right + 1): maxN = max(maxN, self.indivisual[i])
            return maxN
        else:
            maxN = self.search(left, (lk + 1) * self.size - 1)
            for k in range(lk + 1, rk): maxN = max(maxN, self.array[k])
            maxN = max(maxN, self.search(rk * self.size, right))
            return maxN

def solve():
    input = sys.stdin.readline
    N = int(input())
    R = [[int(i) for i in input().split()] for _ in range(N)]
    R.sort()
    mod = 998244353
    X = [R[i][0] for i in range(N)]
    Connect = SquareDiv(N, 0)
    DP = dict()
    DP[N] = 1
    for i in reversed(range(N)):
        right = max(i, Connect.search(i, bisect_left(X, sum(R[i])) - 1))
        Connect.update(i, right)
        DP[i] = (DP[right + 1] + DP[i + 1]) % mod
    print(DP[0])
    

    return 0

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

R,G,B,n=map(int,input().split())
r=n//R
g=n//G
b=n//B
ans=0
if max(r,g,b)==b:
  for i in range(r+1):
    for j in range(g+1):
      if (n-R*i-G*j)%B==0 and n-R*i-G*j>=0:
        ans+=1
elif max(r,g,b)==g:
  for i in range(r+1):
    for j in range(b+1):
      if (n-R*i-B*j)%G==0 and n-R*i-B*j>=0:
        ans+=1
elif max(r,g,b)==r:
  for i in range(b+1):
    for j in range(g+1):
      if (n-B*i-G*j)%R==0 and n-B*i-G*j>=0:
        ans+=1
print(ans)

### FIXED CODE ###

R,G,B,n=map(int,input().split())
r=n//R
g=n//G
b=n//B
ans=0
for i in range(r+1):
  for j in range((n-R*i)//G+1):
    if (n-i*R-j*G)%B==0:
      ans+=1
print(ans)
### BUGGY CODE ###

def main():
  
  n,k = map(int,input().split())
  a = list(map(int,input().split()))
  mod = 10**9+7
  rng = 10100
  fctr = [1]
  finv = [1]
  for i in range(1,rng):
    fctr.append(fctr[-1]*i%mod)
  for i in range(1,rng):
    finv.append(pow(fctr[i],mod-2,mod))
  def cmb(n,k):
    if n<0 or k<0:
      return 0
    else:
      return fctr[n]*finv[n-k]*finv[k]
  dp = [[0 for i in range(n+1)] for j in range(k+1)]
  dp[0][0] = 1
  ans = 0
  for i in range(1,k+1):
    x = a[i-1]
    for j in range(n+1):
      for t in range(min(n-j,x)+1):
        dp[i][j+t] = (dp[i][j+t]+dp[i-1][j]*cmb(n-j,t)*cmb(n-t,x-t))%mod
  print(dp[k][n])
  
main()

### FIXED CODE ###

n,k = map(int,input().split())
a = tuple(map(int,input().split()))
mod = 10**9+7
rng = 1001
fctr = [1]
finv = [1]
for i in range(1,rng):
  fctr.append(fctr[-1]*i%mod)
  finv.append(pow(fctr[i],mod-2,mod))
dp = [[0 for i in range(n+1)] for j in range(k+1)]
dp[0][0] = 1
for i in range(1,k+1):
  x = a[i-1]
  for j in range(n+1):
    if dp[i-1][j] == 0:
      continue
    y = dp[i-1][j]*fctr[n-j]*finv[n-x]%mod
    for t in range(min(n-j,x)+1):
      dp[i][j+t]=(dp[i][j+t]+y*fctr[n-t]*finv[n-j-t]*finv[t]*finv[x-t])%mod
print(dp[k][n])
### BUGGY CODE ###



def main():
    import collections

    N = int(input())
    A = list(map(int, input().split()))
    cc = collections.Counter
    # c = collections.Counter(A)
    # iglist = [x for x in c if c[x] == 1]

    # for x in iglist:
    #     A.remove(x)

    for i in range(N):
        x = A[i]
        A[i] = 0
        tmp_A = cc(A)
        su = 0
        for pairs in sorted(tmp_A.values(), reverse=True):
            if pairs >= 2:
                su += pairs*(pairs-1)//2
            else:
                break
        A[i] = x
        print(su)


if __name__ == '__main__':
    main()


### FIXED CODE ###



def main():
    import collections

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

    allc = collections.Counter(A)
    # all_list = [0]*N
    allsu = 0
    for pairs in sorted(allc.values(), reverse=True):
        allsu += pairs*(pairs-1)//2

    for a in A:
        num = allc[a]
        print(allsu - (num-1))

    # for i in range(N):
    #     x = A[i]
    #     A[i] = 0
    #     tmp_A = cc(A)
    #     su = 0
    #     for pairs in sorted(tmp_A.values(), reverse=True):
    #         if pairs >= 2:
    #             su += pairs*(pairs-1)//2
    #         else:
    #             break
    #     A[i] = x
    #     print(su)


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

# -*- coding: utf-8 -*-
import sys
import bisect
input = sys.stdin.readline


def main():
    n = int(input())
    l = list(map(int, input().split()))
    l = sorted(l)

    result = 0
    # print(l)
    for i in range(n-2):
        for j in range(i + 1, n - 1):
            c_target_index = bisect.bisect_left(l[j + 1:], l[i] + l[j])
            result += c_target_index

    print(result)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import bisect
import sys
input = sys.stdin.readline


def main():
    n = int(input())
    l = list(map(int, input().split()))
    l.sort()

    result = 0
    for i in range(n-2):
        for j in range(i + 1, n - 1):
            result += bisect.bisect_left(l, l[i] + l[j]) - (j + 1)

    print(result)


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

import sys
import functools
import operator

L = []
for l in sys.stdin:
  L.append(l) 
A = list(map(int, L[1].split()))

answer = functools.reduce(operator.mul, A)
if answer <= 1000000000000000000:
  print(answer)
else:
  print(-1)

### FIXED CODE ###

import sys

L = []
for l in sys.stdin:
  L.append(l) 
A = list(map(int, L[1].split()))

if 0 in A:
  print(0)
else:
  answer = 1
  for a in A:
    answer = answer * a
    if answer > 1000000000000000000:
      print(-1)
      break
  if answer <= 1000000000000000000:
    print(answer)
### BUGGY CODE ###

# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

# bit毎で１と０の多い方の値、K以下でdfs
N, K = lr()
A = lr()
limit = max(max(A), K).bit_length()
X = [0] * (limit)
for a in A:
    for i in range(limit):
        if (a >> i) & 1:
            X[i] += 1

def dfs(index, sum, y):
    if index == limit:
        return sum
    i = limit - 1 - index
    ret = dfs(index+1, sum + X[i] * 2 ** i, y)
    if y + 2 ** i <= K:
        ret = max(ret, dfs(index+1, sum + (N-X[i]) * 2 ** i, y + 2 ** i))
    return ret

answer = dfs(0, 0, 0)
print(answer)


### FIXED CODE ###

import numpy as np

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

max_len = max(len(bin(K)[2:]), len(bin(max(A))[2:]))
bit_cnt = [((A>>k)&1).sum() for k in range(max_len)]

x = 0
for i in range(max_len-1, -1, -1):
    if x+2**i <= K and bit_cnt[i] < (N+1)//2:
        x += 2**i

answer = 0
for a in A:
    answer += a^x
print(answer)
### BUGGY CODE ###

import sys
import numpy as np 

n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = np.zeros((n))

for i in range(1, n):
    min_value = sys.maxsize 
    for j in range(max(i-k, 0), i):
        min_value = min(min_value, dp[j] + abs(h[i] - h[j]))
    dp[i] = min_value


print(int(dp[-1]))

### FIXED CODE ###

import sys
import numpy as np 

n, k = map(int, input().split())
h = np.array(list(map(int, input().split())))

dp = np.full_like(h, fill_value=sys.maxsize, dtype=int)
dp[0] = 0
# print(dp)

for i in range(1, n):
    start = max(i-k, 0)
    # print(f'start={start}, i={i}, np.absolute(h[start:i] - h[i])={np.absolute(h[start:i] - h[i])}, dp[start:i]={dp[start:i]}')
    # print(f'dp, h[i]={h[i]}')
    dp[i] = np.min(dp[start:i] + np.abs(h[start:i] - h[i]))
     

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

import numpy as np

N,M = list(map(int,input().split()))
Hlist = list(map(int,input().split()))
Mlist = [list(map(int,input().split())) for _ in range(M)]

adj = [[0 for _ in range(N)] for _ in range(N)]

for line in Mlist:
    adj[line[0]-1][line[1]-1] = 1
    adj[line[1]-1][line[0]-1] = 1

# for i in range(N):
#     adj[i][i] = 1

Hmatrix = [Hlist for _ in range(N)]
target = np.array(Hmatrix)*np.array(adj)

count = 0
for i in range(len(target)):
    if max(target[i]) < Hlist[i]:
        count += 1
print(count)

### FIXED CODE ###

import numpy as np

N,M   = list(map(int,input().split()))
Hlist = list(map(int,input().split()))
Hdict = {i:Hlist[i] for i in range(len(Hlist))}
# adj = [[0 for _ in range(N)] for _ in range(N)]

# for line in Mlist:
bad_set = set()
for _ in range(M):
    line = list(map(int,input().split()))
    if Hdict[line[0]-1] <= Hdict[line[1]-1]:
        bad_set.add(line[0])
    if Hdict[line[1]-1] <= Hdict[line[0]-1]:
        bad_set.add(line[1])
print(N-len(bad_set))
### BUGGY CODE ###

import sys
import heapq as hq
input = sys.stdin.readline
n = int(input())
xy = [list(map(int,input().split()))+[i+1] for i in range(n)]
x_xy = sorted(xy)
y_xy = sorted(xy,key = lambda x:x[1])
edge = [[] for i in range(n+1)]
for i in range(1,n):
  xf,yf,v2 = x_xy[i]
  xi,yi,v1 = x_xy[i-1]
  edge[v1].append([abs(xf-xi),v2])
  edge[v2].append([abs(xf-xi),v1])
  xf,yf,v2 = y_xy[i]
  xi,yi,v1 = y_xy[i-1]
  edge[v1].append([abs(yf-yi),v2])
  edge[v2].append([abs(yf-yi),v1])
edges = edge[1]
hq.heapify(edges)
connect = [0 for i in range(n+1)]
connect[1] = 1
ans = 0
while edges:
  cost,v2 = hq.heappop(edges)
  if connect[v2] == 1:
    continue
  ans += cost
  connect[v2] = 1
  for e in edge[v2]:
    hq.heappush(edges,e)
print(ans)

### FIXED CODE ###

import sys
from scipy.sparse.csgraph import minimum_spanning_tree
from scipy.sparse import csr_matrix
input = sys.stdin.readline
n = int(input())
xy = [list(map(int,input().split()))+[i] for i in range(n)]
evv = set()
for Key in range(2):
  xy_s = sorted(xy,key = lambda x:x[Key])
  for i in range(1,n):
    evv.add((xy_s[i][2],xy_s[i-1][2],min(abs(xy_s[i-1][0]-xy_s[i][0]),abs(xy_s[i-1][1]-xy_s[i][1]))))
v1,v2,edge = zip(*evv)
csr = csr_matrix((edge,(v1,v2)),shape = (n,n))
mst = minimum_spanning_tree(csr)
print(int(mst.sum()))
### BUGGY CODE ###

n=int(input())
import math
mod=10**9+7
ans = math.factorial(n)
x=0
for i in range(1,ans+1):
    if ans%i==0:
        x+=1
print(x%mod)




### FIXED CODE ###

n=int(input())
mod=10**9+7
arr = {}
def factorization(k):
    temp=k
    for i in range(2,int(-(-k**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp//=i
            if i in arr:
                arr[i]+=cnt
            else:
                arr[i]=cnt
    if temp!=1:
        if temp in arr:
                arr[temp]+=1
        else:
            arr[temp]=1
    if arr==[]:
        if k in arr:
                arr[k]+=1
        else:
            arr[k]=1
for i in range(1,n+1):
    factorization(i)
ans=1

for value in arr.values():
    ans*=(value+1)
    
# print(arr)
print(ans%mod)




# x=0
# k = ans
# for i in range(1,int(k**0.5)+1):
#     if k%i==0:
#         x+=1
#         if i!=n//i:
#             x+=1
# print(x%mod)
### BUGGY CODE ###

import numpy as np
H, W = map(int, input().split())
m = 10**9+7
index_lst = []
grid_0 = [0] * (W+1)
grid_0[1] = 1
for _ in range(1, H+1):
    index_lst = [i for i, j in enumerate(input(), 1) if j == '#']
    grid_1 = [0] * (W+1)
    for w in range(1, W+1):
      if w not in index_lst:
      	grid_1[w] = (grid_1[w-1] + grid_0[w]) % m
    grid_0 = grid_1

print(grid_0[-1])


### FIXED CODE ###

H, W = map(int, input().split())
m = 10**9+7
index_lst = []
grid_0 = [0] * (W+1)
grid_0[1] = 1
for _ in range(1, H+1):
  grid_1 = [0] * (W+1)
  for i, j in enumerate(input(), 1):
    if j == '.':
      grid_1[i] = (grid_0[i] + grid_1[i-1]) % m
  grid_0 = grid_1
    
print(grid_0[-1])
### BUGGY CODE ###

import sys
X = int(input())

for i in range(X+1):
    for j in range(X):
        k = -j
        if (i - j) * (i ** 4 + i ** 3 * j + i ** 2 * j ** 2 + i * j ** 3 + j ** 4) == X:
            print(i,j)
            sys.exit()
        elif (i - k) * (i ** 4 + i ** 3 * k + i ** 2 * k ** 2 + i * k ** 3 + k ** 4) == X:
            print(i,k)
            sys.exit()


### FIXED CODE ###

import sys
X = int(input())
# for i in range(1000):
#     for j in range(1000):
#         a = i ** 2
#         b = j ** 2
#         c = i * j
#         if (i - j) * (a * (a ** 2 + c + b) + b * (c + b)) == X:
#             print(i,j)
#             sys.exit()
#         elif (i + j) * (a * (a ** 2 - c + b) + b * (-c + b)) == X:
#             print(i,-j)
#             sys.exit()

for i in range(-118,120):
    for j in range(-118,120):
        if i ** 5 - j ** 5 == X:
            print(i,j)
            sys.exit()
### BUGGY CODE ###

N = int(input())
A = tuple(map(lambda n: int(n) - 1, input().split()))

minlen = 10**9
for k in range(1, N+1):
    # kは残す数
    A_ = A[:]
    for j in range(k):
        if j in A_:
            nf = A_.index(j)
            A_ = A_[nf:]
        else:
            break
    else:
        minlen = min(minlen, N - k)

if minlen >= N:
    print(-1)
else:
    print(minlen)


### FIXED CODE ###

N = int(input())
A = tuple(map(lambda n: int(n) - 1, input().split()))

rem = 0
bk = 0
for a in A:
    if a == rem:
        rem += 1
    else:
        bk += 1

if bk == N:
    print(-1)
else:
    print(bk)
### BUGGY CODE ###

from collections import defaultdict, deque, Counter
import sys
import heapq
import math

# input = sys.stdin.readline

sys.setrecursionlimit(1000000000)

MIN = -10 ** 9
MOD = 10 ** 9 + 7


def main():
    N = int(input())
    # A,B = [int(a) for a in input().split()]
    L = sorted([int(a) for a in input().split()])
    # xy = [
    #     [int(a) for a in input().split()]
    #     for _ in range(N)
    # ]

    r = 0
    for a in range(N):
        for b in range(a + 1, N):
            for c in range(N-1,b,-1):
                if L[a] + L[b] > L[c]:
                    r += (c-b)
                    break

    print(r)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import defaultdict, deque, Counter
import sys
import bisect
import heapq
import math

# input = sys.stdin.readline

sys.setrecursionlimit(1000000000)

MIN = -10 ** 9
MOD = 10 ** 9 + 7


def main():
    N = int(input())
    # A,B = [int(a) for a in input().split()]
    L = sorted([int(a) for a in input().split()])
    # xy = [
    #     [int(a) for a in input().split()]
    #     for _ in range(N)
    # ]

    r = 0
    for a in range(N):
        for b in range(a + 1, N):
            p = bisect.bisect_left(L, L[a] + L[b])
            r += (p - 1 - b)

            # for c in range(N-1,b,-1):
            #     if L[a] + L[b] > L[c]:
            #         r += (c-b)
            #         break

    print(r)


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

import bisect
N = int(input())  # N<= 4000 6*10^10なので、削減しないとだめ
S = list(input())


# Si Sj Skがどれも別のもの。ただしi<j<k
# また、j-i != k-j
# 1,2,3はだめ1,2,4はok
# 1,3,5もだめ
# この組の数を求める

# count = 0
# for i in range(N):
#     for j in range(i + 1, N):
#         for k in range(j + 1, N):
#             if j - i != k - j:
#                 if S[i] != S[j] and S[j] != S[k] and S[i] != S[k]:
#                     count += 1


R_indexes = []
G_indexes = []
B_indexes = []
for i, char in enumerate(S):
    if char == 'R':
        R_indexes.append(i + 1)
    elif char == 'G':
        G_indexes.append(i + 1)
    else:
        B_indexes.append(i + 1)
# print(permutation_hash)
count = 0
R_indexes_count = len(R_indexes)
G_indexes_count = len(G_indexes)
B_indexes_count = len(B_indexes)
for R_index in R_indexes:
    for G_index in G_indexes:
        middle_index = (R_index + G_index) / 2
        remove_conut = 0
        if middle_index != R_index and middle_index != G_index:
            if middle_index in B_indexes:
                remove_conut += 1
        div = abs(G_index - R_index)
        if G_index < R_index:
            if G_index - div in B_indexes:
                remove_conut += 1
            if R_index + div in B_indexes:
                remove_conut += 1
        else:
            if G_index + div in B_indexes:
                remove_conut += 1
            if R_index - div in B_indexes:
                remove_conut += 1
        count += (B_indexes_count - remove_conut)

print(count)


### FIXED CODE ###

N = int(input())
S = input()
r = 0
g = 0
b = 0
for i in range(N):
    if S[i] == "R":
        r += 1
    elif S[i] == "G":
        g += 1
    else:
        b += 1
ans = r * g * b

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        x = j + j - i
        if S[i] != S[j] and x <= N - 1:
            if S[i] != S[x] and S[x] != S[j]:
                ans -= 1

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

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

    def count(x_min, x_max, y_min, y_max, i, j):
        OK = 0
        # NG = 0
        a = j - i + 1 - K
        for m in XY[i:j + 1]:
            if y_min <= m[1] <= y_max:
                OK += 1
        if OK >= K:
            return True
        return False

    ans = 10 ** 20
    for i, val_i in enumerate(XY[:N - 1]):
        a = val_i[0]
        for j, val_j in enumerate(XY[i + K - 1:N]):
            b = val_j[0]
            e = b - a
            # print (e, i, j)
            for k in range(N):
                c = XY[k][1]
                for l in range(N):
                    d = XY[l][1]
                    if c < d:
                        if count(a, b, c, d, i, j + i + K - 1):
                            # print ('A')
                            ans = min(ans, e * (d - c))
    print (ans)
    return

if __name__ == '__main__':
    main()


### FIXED CODE ###

#PythonだとTLEする
N, K = map(int, input().split())
X = [0] * N
Y = [0] * N
for i in range(N):
    x, y = map(int, input().split())
    X[i] = x
    Y[i] = y

def count(x_min, x_max, y_min, y_max):
    cnt = 0
    for i in range(N):
        if x_min <= X[i] <= x_max and y_min <= Y[i] <= y_max:
            cnt += 1
    return cnt

ans = 10 ** 20
for i in range(N):
    for j in range(N):
        for k in range(N):
            for l in range(N):
                # print ('i, j , k, l = ', i, j, k, l)
                if X[i] < X[j] and Y[k] < Y[l]:
                    if count(X[i], X[j], Y[k], Y[l]) >= K:
                        # print ('A')
                        ans = min(ans, (X[j] - X[i]) * (Y[l] - Y[k]))
print (ans)