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

import sys


sys.setrecursionlimit(10 ** 6)

N = int(input())
edge = [[] for _ in range(N)]
for i in range(N - 1):
    a, b = map(int, input().split())
    edge[a - 1].append((b - 1, i))
    edge[b - 1].append((a - 1, i))
ec = [0] * (N - 1)


def dfs(node, pc):
    colors = set()
    colors.add(pc)

    for to, idx in edge[node]:
        if ec[idx] == 0:
            for c in range(1, N):
                if c not in colors:
                    ec[idx] = c
                    colors.add(c)
                    break

            dfs(to, c)


dfs(0, 0)
print(max(ec))
for c in ec:
    print(c)


### FIXED CODE ###

import sys


sys.setrecursionlimit(10 ** 6)

N = int(input())
edge = [[] for _ in range(N)]
for i in range(N - 1):
    a, b = map(int, input().split())
    edge[a - 1].append((b - 1, i))
    edge[b - 1].append((a - 1, i))
ec = [0] * (N - 1)


def dfs(node, pc):
    color = 1

    for to, idx in edge[node]:
        if ec[idx] == 0:
            if color == pc:
                color += 1
            ec[idx] = color

            dfs(to, color)
            color += 1


dfs(0, -1)
print(max(ec))
for c in ec:
    print(c)
### BUGGY CODE ###

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

exp = [(x+1)/2 for x in p]

ans = 0
for n in range(N-K+1):
  if ans < sum(exp[n:n+K]):
    ans = sum(exp[n:n+K])
    
print(ans)

### FIXED CODE ###

N, K = map(int,input().split())
p = list(map(int,input().split()))
 
exp = [(x+1)/2 for x in p]
 
sums = 0
ls =[0]

for n in range(N):
  sums += exp[n]
  ls.append(sums)

ans = 0
for n in range(N-K+1):

  ans_candidate = ls[n+K]-ls[n]

  if ans < ans_candidate:
    ans = ans_candidate 
print(ans)
### BUGGY CODE ###

def main():
    N = int(input())
    a = [list(map(int, input().split())) for i in range(N)]

    now = [0] * N
    day = 0
    MAX = (N*(N-1)) // 2
    gamed_day = [-1] * N
    finished = 0
    while True:
        if day > MAX:
            print(-1)
            break
        had_game = False
        all_finish = True
        for i in range(N-1, -1, -1):
            if now[i] < N-1 and gamed_day[i] != day:
                all_finish = False
                want = a[i][now[i]] - 1
                if gamed_day[want] != day:# 今日試合していない
                    if a[want][now[want]] - 1 == i:# 相手の試合相手が自分
                        now[want] += 1
                        now[i] += 1
                        if now[want] >= N-1:
                            finished += 1
                        if now[i] >= N-1:
                            finished += 1
                        gamed_day[i] = day
                        gamed_day[want] = day
                        had_game = True
                        # print(day+1, i+1, want+1)
        if all_finish or finished == N:
            if had_game:
                print(day+1)
            else:
                print(day)
            break
        if not had_game:
            print(-1)
            break
        day += 1
    # print(now)

if __name__ == "__main__":
    main()


### FIXED CODE ###

import time
def main():
    N = int(input())
    a = [list(map(int, input().split())) for i in range(N)]
    start = time.time()
    now = [0] * N
    day = 0
    gamed_day = [-1] * N
    finished = 0
    while True:
        if time.time() - start > 1.6:
            print((N*(N-1))//2)
            break
        had_game = False
        all_finish = True
        for i in range(N-1, -1, -1):
            if now[i] < N-1 and gamed_day[i] != day:
                all_finish = False
                want = a[i][now[i]] - 1
                if gamed_day[want] != day:# 今日試合していない
                    if a[want][now[want]] - 1 == i:# 相手の試合相手が自分
                        now[want] += 1
                        now[i] += 1
                        if now[want] >= N-1:
                            finished += 1
                        if now[i] >= N-1:
                            finished += 1
                        gamed_day[i] = day
                        gamed_day[want] = day
                        had_game = True
                        # print(day+1, i+1, want+1)
        if all_finish or finished == N:
            if had_game:
                print(day+1)
            else:
                print(day)
            break
        if not had_game:
            print(-1)
            break
        day += 1
    # print(now)

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

import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# import numpy as np
def resolve():
    N = ir()
    # A = np.array(lr(), np.int32)
    A = lr()
    A = [[A[i], i] for i in range(N)]
    A.append([2*10**5+1, N+1])
    A = sorted(A, key=lambda x: x[0])
    c = []
    d = []
    e = []
    tmp = 1
    st = 0
    for i in range(N+1):
        if tmp == A[i][0]:
            st += 1
        else:
            if st > 1:
                c.append(tmp)
                d.append(st)
                e.append(st*(st-1)//2)
            else:
                c.append(tmp)
                d.append(st)
                e.append(0)
            tmp = A[i][0]
            st = 1
    ans = []
    tmp = 0
    # print(c, d, e)
    for i in range(N):
        if A[i][0] > c[tmp]:
            tmp += 1
        num = d[tmp]
        plu = 0
        if num > 2:
            plu = (num-1)*(num-2)//2
        ans.append([sum(e)-e[tmp]+plu, A[i][1]])
    # print(ans)
    # print(iA)
    ans = sorted(ans, key=lambda x: x[1])
    for i in range(N):
        print(ans[i][0])

resolve()

### FIXED CODE ###

import sys
sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# import numpy as np
def resolve():
    N = ir()
    # A = np.array(lr(), np.int32)
    A = lr()
    A = [[A[i], i] for i in range(N)]
    A.append([2*10**5+1, N+1])
    A = sorted(A, key=lambda x: x[0])
    c = []
    d = []
    e = []
    tmp = 1
    st = 0
    for i in range(N+1):
        if tmp == A[i][0]:
            st += 1
        else:
            if st > 1:
                c.append(tmp)
                d.append(st)
                e.append(st*(st-1)//2)
            else:
                c.append(tmp)
                d.append(st)
                e.append(0)
            tmp = A[i][0]
            st = 1
    ans = []
    tmp = 0
    # print(c, d, e)
    se = sum(e)
    for i in range(N):
        if A[i][0] > c[tmp]:
            tmp += 1
        num = d[tmp]
        plu = 0
        if num > 2:
            plu = (num-1)*(num-2)//2
        ans.append([se-e[tmp]+plu, A[i][1]])
    # print(ans)
    # print(iA)
    ans = sorted(ans, key=lambda x: x[1])
    for i in range(N):
        print(ans[i][0])

resolve()
### BUGGY CODE ###

nums = [1, 1]
def step_div(n):
	i = len(nums)
	while i <= n:
		nums.append(nums[i-1] * i)
		i += 1
	return nums[n]

n, m = map(int, input().split(" "))

remain = abs(n-m)
if remain <= 1:
	print((step_div(n % (10**9+7)) * step_div(m % (10**9+7)) * (2 if remain==0 else 1)) % (10**9+7))
else:
	print(0)

### FIXED CODE ###

import math

n, m = map(int, input().split(" "))

remain = abs(n-m)
if remain <= 1:
	print((math.factorial(n) * math.factorial(m) * (2 if remain==0 else 1)) % (10**9+7))
else:
	print(0)
### BUGGY CODE ###

import numpy as np


### 解答
N, K = map(int, input().split())
A = np.asarray(list(map(int, input().split())), dtype=np.int)

#B = [0]*N                                 # 記録用のリスト

def imos(A):      
  B = np.zeros(N)
  for i in range(N):                      # 各電球によって照らされる範囲を考える
    start = max(0, i-A[i])                # 始点のインデックスは0かi-A[i]
    end = min(N, i+A[i]+1)
    #print(start, end)                # 終点のインデックスはNかi+A[i]+1
    B[start] += 1                         # 始点に+1を記録する
    if end <= N - 1:
      B[end] -= 1                         # 終点に電球が存在する場合は-1を記録する
  A = np.cumsum(B).astype(np.int)
  return A




for k in range(K):                        # 以降の操作をK回繰り返す
  A = imos(A)
  if np.min(A) == N:
    break
print(*A)                                 # リストAの中身を順に表示


### FIXED CODE ###

import numpy as np
from numba import njit
 
n, k = map(int, input().split())
a = np.array(list(map(int, input().split())), dtype=np.int64)
 
@njit
def loop1(a):
  b = np.zeros(n+1, dtype=np.int64)
  for i in range(n):
    l = max(0, i-a[i])
    r = min(i+a[i]+1, n)
    b[l] += 1
    if r <= n-1: b[r] -= 1
  
  b = np.cumsum(b)[:-1]
  return b
 
for q in range(min(42, k)):
  a = loop1(a)
    
print(*a)
### BUGGY CODE ###

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

import numpy as np
from scipy.sparse.csgraph import shortest_path
graph = np.zeros((n,n))
for i in range(n-1):
    graph[i][i+1] = 1
    graph[i+1][i] =1
graph[x-1][y-1] = graph[y-1][x-1] = 1
s = shortest_path(graph)
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 ###

x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ab = [ai + bi for bi in b for ai in a]
s = [ci + abi for abi in ab for ci in c]
s.sort(reverse=True)

for si in s[:k]:
    print(si)

### FIXED CODE ###

import sys
input = sys.stdin.readline

x, y, z, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

ab = [ai + bi for bi in b[:k] for ai in a[:k]]
ab.sort(reverse=True)

s = [ci + abi for abi in ab[:k] for ci in c[:k]]
s.sort(reverse=True)

for si in s[:k]:
    print(si)
### BUGGY CODE ###

import sys
#import numpy as np

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

A = list(rs())
answer = 1
for i in range(len(A)-1):
    for j in range(i, len(A)):
        if A[i] != A[j]:
            answer += 1

print(answer)
# 53

### FIXED CODE ###

import sys
#import numpy as np
from collections import Counter

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split())) # applies to numbers only
rs = lambda: stdin.readline().rstrip()  # ignore trailing spaces

A = list(rs())
answer = 1
c = Counter(A)
for i in range(len(A)):
    answer += len(A) - i - c[A[i]]
    c[A[i]] -= 1

print(answer)
# 53
### BUGGY CODE ###

A = input()
B = input()
C = input()

def milen(a,b,c):
    aa = len(a)
    bb = len(b)
    cc = len(c)

    minlen = aa + bb + cc
    s = '?'*(bb+cc) + a + '?'*(bb+cc)
    for i in range(-bb,aa+1):
        start = min(0,i)
        end = max(aa,i+bb)
        t = '?'*(bb+cc+i) + b + '?'*(aa+cc-i)
        for j in range(start-cc,end+1):
            sta = min(start,j)
            en = max(end,j+cc)
            u = '?'*(bb+cc+j) + c + '?'*(aa+bb-j)
            flag = 1
            for k in range(sta+bb+cc,en+bb+cc):
                if(s[k] == '?'):
                    if(t[k] != '?' and u[k] != '?' and t[k] != u[k]):
                        flag = 0
                        break
                elif(t[k] == '?'):
                    if(u[k] != '?' and s[k] != u[k]):
                        flag = 0
                        break
                else:
                    if(s[k] != t[k]):
                        flag = 0
                        break
                    else:
                        if(u[k] != '?' and s[k]!= u[k]):
                            flag = 0
                            break
            if(flag == 1):
                minlen = min(minlen,en-sta)
    return minlen



print(min(milen(A,B,C),milen(A,C,B)))

### FIXED CODE ###

a = input()
b = input()
c = input()

aa = len(a)
bb = len(b)
cc = len(c)

lensum = aa + bb + cc # 文字列の長さの最大値
ab = [0]*(lensum+cc+1) # 相対的位置に対して合わさるかどうかを記録
ac = [0]*(lensum+bb+1)
bc = [0]*(lensum+aa+1)

def match(v,w): # 2つの文字を合わせられるかどうかを調べる
    if(v != '?' and w != '?' and v != w):
        return 0
    else:
        return 1

def match2(A,B,k): # 2つの文字列とその相対的位置に対して合わさるかチェック
    AA = len(A)
    BB = len(B)
    if(k>=AA):
        return 1
    elif(k<-BB):
        return 1
    else:
        flg = 1
        st = max(0,k)
        la = min(AA,BB+k)
        for i in range(st,la):
            if(match(A[i],B[i-k])==0):
                flg = 0
                break
        return flg

#ab,ac,bcに対して計算する
for i in range(lensum+cc+1):
    ab[i] = match2(a,b,i-bb-cc)
for i in range(lensum+bb+1):
    ac[i] = match2(a,c,i-bb-cc)
for i in range(lensum+aa+1):
    bc[i] = match2(b,c,i-aa-cc)

def milen(a,b,c):
    minlen = lensum # 文字列の長さの最大値
    for i in range(-bb-cc,aa+cc+1): # iが文字列Bの開始位置
        for j in range(-bb-cc,aa+bb+1): # jが文字列Cの開始位置
            if(ab[i+bb+cc] == 0): 
                continue
            elif(ac[j+bb+cc] == 0):
                continue
            elif(j-i+aa+cc < 0 or j-i+aa+cc >= lensum+aa+1): #BとCが離れすぎている場合を除く
                continue  
            elif(bc[j-i+aa+cc] == 0):
                continue   
            else:
                sta = min(0,i,j) #文字列の中で一番左にある開始位置
                en = max(aa,i+bb,j+cc) #文字列の中で一番右にある終了位置
                minlen = min(minlen,en-sta) #更新
    return minlen

print(milen(a,b,c))
### BUGGY CODE ###

n = int(input())
L = list(map(int,input().split()))
c = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        for k in range(j+1,n):
            if L[i] + L[j] > L[k] and abs(L[i] - L[j]) < L[k]:
                c += 1
print (c)

### FIXED CODE ###

import math
from bisect import bisect_right
from bisect import bisect_left

n = int(input())
L = list(map(int,input().split()))
L.sort()
c = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        lg = L[i] + L[j]
        st = L[j] - L[i]
        if lg > L[j+1] and st < L[n-1]:
            if lg > L[n-1]:
                m1 = n - (j+1)
            else:
                m1 = bisect_left(L[j+1:],lg)
            c += max(0,m1)
print (c)
### BUGGY CODE ###

a, b, x = map(int, input().split())
ans = 0

for i in range(a, b + 1):
    if i % x == 0:
        ans += 1
print(ans)


### FIXED CODE ###

a, b, x = map(int, input().split())
print(b//x-(a-1)//x)
### BUGGY CODE ###

N = int(input())
num_list = list(map(int, input().split()))
 
length = N
amount = 0
for i in range(length-1):
  for j in range(i+1, length):
    num1 = num_list[i]
    num2 = num_list[j]
    num = num1 ^ num2
    amount += num

print(amount % (10**9 + 7))

### FIXED CODE ###

import numpy as np
N = int(input())
num_list = np.array(input().split(), dtype="int")

max_num = max(num_list)
max_bit_num = format(max_num, "b")
max_bit_num_length = len(max_bit_num)
ans = 0
radix = 1
for i in range(max_bit_num_length):
  new_num_list = (num_list >> i) & 1
  one_amount = np.count_nonzero(new_num_list == 1)
  zero_amount = len(num_list) - one_amount
  ans += (one_amount*zero_amount)*radix
  radix *= 2
print(ans%(10**9+7))
### BUGGY CODE ###

import itertools



N = int(input().strip())
L = [int(str) for str in input().split()]

L.sort()

ans = 0

for c_i in range(2, N):
    min_a_i = 0
    while L[c_i] >= L[min_a_i] + L[c_i - 1] and min_a_i < c_i - 1:
        min_a_i += 1
    
    for b_i in range(min_a_i + 1, c_i):
        a_i = min_a_i
        while L[a_i] + L[b_i] <= L[c_i] and a_i < b_i:
            a_i += 1
        
        ans += b_i - a_i

print(ans)

### FIXED CODE ###

N = int(input().strip())
L = [int(str) for str in input().split()]

L.sort()

ans = 0

for a in range(N - 2):
    c = a + 1
    for b in range(a + 1, N - 1):
        while c < N - 1 and L[c + 1] < L[a] + L[b]:
            c += 1
        ans += c - b

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

import numpy as np
n,m = map(int,input().split())

li = np.array([i for i in range(1,n+1)])
for i in range(m):
  l,r = map(int,input().split())
  li = li[l <= li]
  li = li[li <= r]
  if len(li)==0:
    break
else:
  print(len(li))
  exit()
print(0)


### FIXED CODE ###

n,m = map(int,input().split())

lans = 1
rans = n
for i in range(m):
  l,r = map(int,input().split())
  lans = max(lans,l)
  rans = min(rans,r)
if lans <= rans:
  print(len(list(range(lans,rans+1))))
else:
  print(0)
### BUGGY CODE ###

a = input()
q = int(input())
i=0
for i in range(q):
    qi=input()
    if qi==str(1):
        a = a[::-1]
    else:
        qi = qi.split()
        if qi[1]==str(1):
            a = qi[2]+a
        elif qi[1]==str(2):
            a = a + qi[2]
print(a)

### FIXED CODE ###

import collections
 
s = collections.deque(list(input()))
q = int(input())
rev = 0
for i in range(q):
    tfc = list(input().split())
    if tfc[0]=='1':
        rev = abs(rev-1)
    else:
        t,f,c = tfc
        if rev:
            if f=='1':
                s.append(c)
            else:
                s.appendleft(c)
        else:
            if f=='1':
                s.appendleft(c)
            else:
                s.append(c)
if rev:
    t = []
    for i in range(len(s)):
        t.append(s.pop())
    print(''.join(t))
else:
    print(''.join(s))
### BUGGY CODE ###

N = int(input())
import math
n = math.floor(N**0.5)
P = []
for i in range(2,n+1):
    J = 1
    for j in range(len(P)):
        if i % P[j] != 0:
            J = 0
            break
    if J == 1:
        P.append(i)
A = [1]
for i in range(len(P)):
    p = P[i]
    x = 1
    j = 1
    while x**j <= N :
        if x**j <= N:
            A.append(x**j)
            j += 1
ans = max(A)
print(ans)


### FIXED CODE ###

N = int(input())
import math
n = math.floor(N**0.5)

A = [1]
for i in range(2,n+1):
    j = 2
    while i**j <= N :
        A.append(i**j)
        j += 1
ans = max(A)
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
import functools
INF = float("inf")

MOD = 2  # type: int


@functools.lru_cache(maxsize=None)
def cmb(n, r):
    r = min(r, n-r)
    if r == 0:
        return 1
    if r == 1:
        return n

    numer = [n - r + k + 1 for k in range(r)]
    denom = [k + 1 for k in range(r)]

    for p in range(2, r+1):
        pivot = denom[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1, r, p):
                numer[k - offset] /= pivot
                denom[k] /= pivot

    result = 1
    for k in range(r):
        if numer[k] > 1:
            result *= int(numer[k])

    return result


def solve(p: int, a: "List[int]"):
    b = [0]*p
    for ai, av in enumerate(a):
        if av == 1:
            for i in range(p):
                b[i] += -cmb(p-1, i) * (-ai)**(p-i-1)
                b[i] %= p
            b[0] += 1
            b[0] %= p
    print(*b, sep=" ")
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    p = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(p-1-0+1)]  # type: "List[int]"
    solve(p, a)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import functools
INF = float("inf")


def solve(p: int, a: "List[int]"):
    N = p+1
    MOD = p

    inv = [0]*N
    inv[1] = 1
    for i in range(2, N):
        inv[i] = -inv[MOD % i]*(MOD//i) % MOD

    b = [0]*p
    for ai, av in enumerate(a):
        if av == 0:
            continue

        c = 1
        d = 1
        for i in range(p-1, -1, -1):
            b[i] += - c * d
            b[i] %= p
            c = c * i * inv[p-i] % p
            d = -d*ai % p
        b[0] += 1
        b[0] %= p
    print(*b, sep=" ")
    return


def main():

    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    p = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(p-1-0+1)]  # type: "List[int]"
    solve(p, a)


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

s = input()
K = int(input())

substr_map = {}

for i in range(len(s) + 1):
    for j in range(i + 1, len(s) + 1):
        substr_map[s[i:j]] = 1

print(list(sorted(substr_map.items(), key = lambda x: x[0]))[K - 1][0])

### FIXED CODE ###

s = input()
K = int(input())

substr_set = set()

for i in range(len(s)):
    for j in range(1, K + 1):
        substr_set.add(s[i:i+j])

print(sorted(substr_set)[K - 1])
### BUGGY CODE ###

"""
タグ：区間
"""

N, P = map(int, input().split())
S = input()

if P == 5:
    res = 0
    i = 0
    for s in reversed(S):
        if int(s)%5==0:
            res += N-i
        i += 1
    print(res)
elif P == 2:
    res = 0
    i = 0
    for s in reversed(S):
        if int(s)%2==0:
            res += N-i
        i += 1
    print(res)
else:
    T = [0]
    p = 1
    for s in reversed(S):
        T.append(int(s)*p + T[-1])
        p *= 10

    cnt = [0]*P
    for i in range(N+1):
        cnt[T[i]%P] += 1

    res = 0
    for c in cnt:
        res += c*(c-1)//2
    print(res)

### FIXED CODE ###

"""
タグ：区間
"""
import sys
input = sys.stdin.readline
N, P = map(int, input().split())
S = input().strip()

if P == 5:
    res = 0
    i = 0
    for s in reversed(S):
        if int(s)%5==0:
            res += N-i
        i += 1
    print(res)
elif P == 2:
    res = 0
    i = 0
    for s in reversed(S):
        if int(s)%2==0:
            res += N-i
        i += 1
    print(res)
else:
    T = [0]
    p = 1
    for s in reversed(S):
        T.append(int(s)*p + T[-1])
        p = p*10%P

    cnt = [0]*P
    for i in range(N+1):
        cnt[T[i]%P] += 1

    res = 0
    for c in cnt:
        res += c*(c-1)//2
    print(res)
### BUGGY CODE ###

from itertools import combinations
N, K, *L = map(int, open(0).read().split())
L = [(x,y) for x,y in zip(*[iter(L)]*2)]
ans = float('inf')
for m in combinations(L,2):
  for n in combinations(L,2):
    mx = min(m,key=lambda x:x[0])[0]
    Mx = max(m,key=lambda x:x[0])[0]
    my = min(n,key=lambda x:x[1])[1]
    My = max(n,key=lambda x:x[1])[1]
    cnt = 0
    for x,y in L:
      if mx<=x<=Mx and my<=y<=My:
        cnt += 1
    if cnt>=K:
      ans = min(ans, (Mx-mx)*(My-my))
print(ans)

### FIXED CODE ###

N, K = map(int, input().split())
ls = []
for i in range(N):
  x, y = map(int, input().split())
  ls += [(x,y)]
m = -1
for i in range(N):
  for j in range(i+1,N):
    for p in range(N):
      for q in range(p+1,N):
        
        x1, y1 = ls[i]
        x2, y2 = ls[j]
        x3, y3 = ls[p]
        x4, y4 = ls[q]
        cnt = 0
        flag = False
        X1 = min(x1, x2)
        X2 = max(x1, x2)
        Y1 = min(y3, y4)
        Y2 = max(y3, y4)
        for a in range(N):
          x, y = ls[a]
          """
          print('"""""""')
          print(cnt)
          print(X1,X2,x)
          print(Y1,Y2,y)
          """
          if X1<=x<=X2 and Y1<=y<=Y2:
            cnt += 1
          if cnt>=K:
            n = (X2-X1)*(Y2-Y1)
            if m==-1 or n<m:
              m = n
            break
print(m)
### BUGGY CODE ###

K = int(input())
 
import math
 
ans = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      first = int(math.gcd(a, b))
      plus = int(math.gcd(first, c))
      ans += plus
      
print(ans)

### FIXED CODE ###

K = int(input())
 
import math
 
ans = 0
for a in range(1, K+1):
  for b in range(1, K+1):
    for c in range(1, K+1):
      first = int(math.gcd(a, b))
      plus = int(math.gcd(first, c))
      ans += plus
      
print(ans)