Harryxun/stf_run huggingface dataset:
import itertools
import sys
import math
import numpy as np
import fractions
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
sys.setrecursionlimit(10**9)

def main():
    K = int(input())
    if 0<=K<=10:
        print(K)
        exit()

    lunlun = [i for i in range(1,10)]
    m = 0

    while len(lunlun) < K:
        x = lunlun[m]
        btm = x % 10

        if btm - 1 >= 0:
            lunlun.append(10*x+btm-1)

        lunlun.append(10*x+btm)

        if btm + 1 < 10:
            lunlun.append(10*x+btm+1)

        m += 1

    print(lunlun[::-1][len(lunlun)-K])

if __name__ == "__main__":
  main()


### FIXED CODE ###

import itertools
import sys
import math
import numpy as np
import fractions
from collections import deque
from itertools import combinations
from functools import reduce
from functools import lru_cache
sys.setrecursionlimit(10**9)

def get_lcm(num):
    return reduce(lambda x,y:(x * y) // fractions.gcd(x, y), num, 1)

def main():
    K = int(input())
    if 0<=K<=10:
        print(K)
        exit()

    lunlun = [i for i in range(1,10)]
    m = 0

    while len(lunlun) < K:
        x = lunlun[m]
        btm = x % 10

        if btm - 1 >= 0:
            lunlun.append(10*x+btm-1)

        lunlun.append(10*x+btm)

        if btm + 1 < 10:
            lunlun.append(10*x+btm+1)

        m += 1

    print(lunlun[::-1][len(lunlun)-K])

if __name__ == "__main__":
  main()
import heapq
def main():
  N, Q = list(map(int, input().split()))
  STX = tuple(list(map(int, input().split())) for _ in range(N))
  D = tuple([int(input()) for _ in range(Q)])

  L = []
  for s, t, x in STX:
    L.append((x, s - x, t - x))

  L.sort(key = lambda x: x[1])
  q = []
  cnt = 0
  push = heapq.heappush
  pop = heapq.heappop
  t = []
  for i in range(Q):
    while cnt < len(L) and D[i] >= L[cnt][1]:
      if t != []:
        push(t)
      push(q, L[cnt])
      cnt += 1
    if t != [] and t[2] > D[i]:
      print(t[0])
    else:
      while q != []:
        t = pop(q)
        if t[2] > D[i]:
          print(t[0])
          break
      else:
        t = []
        print(-1)

main()


### FIXED CODE ###

import heapq
def main():
  N, Q = list(map(int, input().split()))
  STX = tuple(list(map(int, input().split())) for _ in range(N))
  D = tuple([int(input()) for _ in range(Q)])

  L = []
  for s, t, x in STX:
    L.append((x, s - x, t - x))

  L.sort(key = lambda x: x[1])
  q = []
  cnt = 0
  push = heapq.heappush
  pop = heapq.heappop
  t = []
  for i in range(Q):
    while cnt < len(L) and D[i] >= L[cnt][1]:
      if t != []:
        push(q, t)
        t = []
      push(q, L[cnt])
      cnt += 1
    if t != [] and t[2] > D[i]:
      print(t[0])
    else:
      while q != []:
        t = pop(q)
        if t[2] > D[i]:
          print(t[0])
          break
      else:
        t = []
        print(-1)

main()
n,m = map(int,input().split())
A = list(map(int,input().split()))

s = sum(A)
A.sort(reverse=True)

if A[m] >= s*1/(4*m):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

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

s = sum(A)
A.sort(reverse=True)

if A[m-1] >= s*1/(4*m):
    print('Yes')
else:
    print('No')
X = raw_input()
cnt = 0
cnt_max = cnt
for i in range(len(X)):
   if X[i] = 'T':
      cnt += 1
   else:
      cnt -= 1
   if cnt > cnt_max: 
        cnt_max = cnt

return cnt_max * 2 

### FIXED CODE ###

X = raw_input()
cnt = 0
cnt_max = cnt
L = len(X)

for i in range(L):
   if X[i] == 'T':
      cnt += 1
   else:
      cnt -= 1
      
   if cnt > cnt_max: 
      cnt_max = cnt

print cnt_max * 2
# -*- coding: utf-8 -*-
N,K = map(int,input().split())
a = [int(i) for i in range(N)]
L = sorted(a)
M = a.reverse()
b = []
for j in range(K):
  b.append(L(j))
print(sum(b))

### FIXED CODE ###

N , K = map(int,input().split())
l = list(map(int,input().split()))
asc_lst = sorted(l)
ans = []
for i in range(K):
    ans.append(asc_lst[-(i+1)])

A = sum(ans)
print(A)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

S = input()

def nleft(S, c):
    """各位置について，それより左の文字列に含まれる文字 c の総数.
       左に'?'が含まれるときは，それらに文字を入れて得られるすべての
       文字列に渡って，文字 c の個数を合計する. """

    def _left(S, c):
        """各位置より左にある c の個数. """
        n = [0 for c in S]
        for i in range(1, len(n)):
            n[i] = n[i-1] + (1 if S[i-1] == c else 0)
        return n

    # c の個数, '?'の個数
    n = _left(S, c)
    q = _left(S, '?')

    for i in range(len(n)):
        n[i] *= 3 ** q[i]                 # ?の埋め方の数だけ増やす
        n[i] += (3 ** (q[i] - 1)) * q[i]  # ?に入る'C'の個数
    return n

def nright(S, c):
    n = nleft(list(reversed(S)), c)
    n.reverse()
    return n

left  = nleft (S, 'A')
right = nright(S, 'C')

# 各文字が'B'のときのABC数を計算
abc = 0
for i in range(0, len(S)):
    if S[i] in 'B?':
        abc += left[i] * right[i]

abc = int(abc) % (10 ** 9 + 7)
print(abc)


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
 
modulo = 10 ** 9 + 7
 
S = input()
 
def nleft(S, c):
    """各位置について，それより左の文字列に含まれる文字 c の総数.
       左に'?'が含まれるときは，それらに文字を入れて得られるすべての
       文字列に渡って，文字 c の個数を合計する. """
 
    # c の個数
    n = [0 for c in S]
    for i in range(1, len(S)):
        n[i] = n[i-1] + (1 if S[i-1] == c else 0)
 
    q = 0      # '?'の個数
    pow3q = 1  # 3 ** q
    for i in range(len(n)):
        if q > 0:
            n[i] *= pow3q         # ?の埋め方の数だけ増やす
            n[i] += pow3q1 * q    # ?に入る'C'の個数
            n[i] %= modulo
        if S[i] == '?':
            q += 1
            pow3q1 = pow3q
            pow3q  = pow3q * 3 % modulo
    return n
 
def nright(S, c):
    # c の個数
    n = [0 for c in S]
    for i in range(len(S) - 1, 0, -1):
        n[i-1] = n[i] + (1 if S[i] == c else 0)
 
    q = 0      # '?'の個数
    pow3q = 1  # 3 ** q
    for i in range(len(n) - 1, -1, -1):
        if q > 0:
            n[i] *= pow3q         # ?の埋め方の数だけ増やす
            n[i] += pow3q1 * q    # ?に入る'C'の個数
            n[i] %= modulo
        if S[i] == '?':
            q += 1
            pow3q1 = pow3q
            pow3q  = pow3q * 3 % modulo
    return n
 
 
left  = nleft (S, 'A')
right = nright(S, 'C')
 
# 各文字が'B'のときのABC数を計算
abc = 0
for i in range(0, len(S)):
    if S[i] in 'B?':
        abc += left[i] * right[i]
 
abc = int(abc) % modulo
print(abc)
N, M = map(int, input().split())
UV = [list(map(int, input().split())) for _ in range(M)]
S, T = map(int, input().split())

if 0 == M:
	print(-1)
	exit()

s, t = S - 1, T - 1

graph = [[] for _ in range(M)]
for u, v in UV:
	graph[u - 1] += [v - 1]

INF = 10 ** 12
cost = [[INF, INF, INF] for _ in range(M)]
def print_cost(cost):
	for line in cost:
		for cell in line:
			print("  INF" if cell == INF else " {:4d}".format(cell), end="")
		print()
	print()

def dfs(graph, cost, c, d):
	if cost[c][d % 3] <= d:
		return
	cost[c][d % 3] = d
	#print_cost(cost)
	for n in graph[c]:
		dfs(graph, cost, n, d + 1)

dfs(graph, cost, 0, 0)

print(cost[T - 1][0] // 3 if 0 == cost[T - 1][0] % 3 else -1)


### FIXED CODE ###

N, M = map(int, input().split())
UV = [list(map(int, input().split())) for _ in range(M)]
S, T = map(int, input().split())

if 0 == M:
	print(-1)
	exit()

graph = [set() for _ in range(N)]
for u, v in UV:
	graph[u - 1] |= {v - 1}

INF = 10 ** 12
depths = [[INF, INF, INF] for _ in range(N)]

def bfs(start, end):
	depth = 0
	nodes = {start}
	while nodes:
		if (0 == depth % 3) and (end in nodes):
			return depth // 3
		next_nodes = set()
		for node in nodes:
			if depths[node][depth % 3] <= depth:
				continue
			depths[node][depth % 3] = depth
			next_nodes |= graph[node]
		nodes = next_nodes
		depth += 1
	return -1

print(bfs(S - 1, T - 1))
n, m = [int(i) for i in input().split()]
fibo_l = [1, 1] + [None] * (n - 2)
a = [int(input()) for i in range(m)]

def fibo(x):
    if x not in a and x >= 0:
            if fibo_l[x] is None:
                fibo_l[x] = fibo(x - 1) + fibo(x - 2)
            return fibo_l[x]
    else: return 0
    
print(fibo(n) % 1000000007)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)

n, m = [int(i) for i in input().split()]
fibo_l = [1] + [None] * n
a = set([int(input()) for i in range(m)])

def fibo(x):
    if x not in a and x >= 0:
            if fibo_l[x] is None:
                fibo_l[x] = fibo(x-1) % 1000000007 + fibo(x-2) % 1000000007
            return fibo_l[x]
    else: return 0
    
print(fibo(n) % 1000000007)
def DFS(num,pre):
    global point
    if color[num]=="white":
        A[num]=C.pop()
        point +=min(A[num],pre)
        color[num]="black"
        for i in tree[num]:
            DFS(i,A[num])


n=int(input())
AB=[list(map(int,input().split())) for _ in range(n-1)]
C=sorted(list(map(int,input().split())))

color=["white" for _ in range(n+1)]
tree=[[] for _ in range(n+1)]
for a,b in AB:
    tree[a].append(b)
    tree[b].append(a)

A=[0 for _ in range(n+1)]
point=0
DFS(1,0)

print(point)
print(*A[1:])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)


def DFS(num,pre):
    global point
    if color[num]=="white":
        ans[num]=C.pop()
        point +=min(ans[num],pre)
        color[num]="black"
        for i in T[num]:
            DFS(i,ans[num])


n=int(input())
AB=[list(map(int,input().split())) for _ in range(n-1)]
C=sorted(list(map(int,input().split())))
color=["white" for _ in range(n)]

T=[[] for _ in range(n)]
for a,b in AB:
    T[a-1].append(b-1)
    T[b-1].append(a-1)

ans=[0 for _ in range(n)]
point=0
DFS(0,0)

print(point)
print(*ans)
N = int(input())
As = [[]]
for i in range(N):
    As.append(list(map(int, input().split())))

Cs = [0] * (N + 1)
Ks = [False] * (N + 1)
d = 1
ms = 0
msMax = N * (N - 1) // 2
sw = True
tab = set()
while sw:
    c = 0
    wa = []
    for i in range(1, N + 1):
        if Ks[i]:
            continue
        if Cs[i] == N - 1:
            continue
        a = 0
        b = 0
        if i > As[i][Cs[i]]:
            a = As[i][Cs[i]]
            b = i
        else:
            a = i
            b = As[i][Cs[i]]
        T = a * 10000 + b
        if T in tab:
            ms = ms + 1
            c = c + 1
            if ms == msMax:
                sw = False
                print(d)
                break
            Cs[a] += 1
            Cs[b] += 1
            tab.remove(T)
            wa.append(a)
            wa.append(b)
        else:
            tab.add(T)
            Ks[i] = True
    for i in wa:
        Ks[i] = False
    d += 1
    if c == 0:
        print(-1)
        break

### FIXED CODE ###

S = input()
T = input()

c = 0
for i in range(3):
    if S[i] == T[i]:
        c += 1

print(c)
S=input()
if S[2]==S[3]andS[4]==S[5]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S=input()
if S[2]==S[3] and S[4]==S[5]:
  print("Yes")
else:
  print("No")
import sys
input = lambda: sys.stdin.readline().rstrip()

n = int(input())
a = [int(x) for x in input().split()]

a.sort()

if a[0] == 0:
    print(0)
else:
    m = 1
    i = 0
    while m < 10**18:
        m *= a[i]
        if m > 10**18:
            print(-1)
            sys.exit()
        i += 1
    print(m)

### FIXED CODE ###

import sys
input = sys.stdin.readline
n = int(input())
a = [int(x) for x in input().split()]
ans = 1
if 0 in a:
    print(0)
    sys.exit()
for i in a:
    ans *= i
    if ans > 10**18:
        print(-1)
        sys.exit()
print(ans)
while(1):
	m, f, r = map(int, input().split())
	if m == -1 and f == -1 and r == -1:
		break
	
	if m == -1 or f = -1:
		print("F")
	elif m + f >= 80:
		print("A")
	elif m + f >= 65:
		print("B")
	elif m + f >= 50:
		print("C")
	elif m + f >= 30:
		if r >= 50:
			print("C")
		else:
			print("D")
	else:
		print("F")

### FIXED CODE ###

while(1):
	m, f, r = map(int, input().split())
	if m == -1 and f == -1 and r == -1:
		break
	
	if m == -1 or f == -1:
		print('F')
	elif m + f >= 80:
		print('A')
	elif m + f >= 65:
		print('B')
	elif m + f >= 50:
		print('C')
	elif m + f >= 30:
		if r >= 50:
			print('C')
		else:
			print('D')
	else:
		print('F')
mv=((2,0),(2,1),(2,-1),(-2,0),(-2,1),(-2,-1),
    (0,2),(1,2),(-1,2),(0,-2),(1,-2),(-1,-2))

while True:
    x,y=map(int,raw_input().split())
    if x==y==0:break
    n=input()
    pos=map(int,raw_input().split())
    pos=[(pos[2*i],pos[2*i+1]) for i in range(n)]

    que=[(x,y,0)]
    while que!=[]:
        X,Y,p=que[0][0],que[0][1],que[0][2]
        del que[0]
        S=set()
        if p>=10:
            print "OK"
            break
        for k in range(-1,2):
            for l in range(-1,2):
                S.add((pos[p][0]+k,pos[p][1]+l,p+1))
        for dx,dy in mv:
            mx=X+dx
            my=Y+dy
            if 0<=mx<10 and 0<=my<10 and (mx,my,p+1) in S:
                que.append((mx,my,p+1))
    else:
        print "NA"

### FIXED CODE ###

mv=((2,0),(2,1),(2,-1),(-2,0),(-2,1),(-2,-1),
    (0,2),(1,2),(-1,2),(0,-2),(1,-2),(-1,-2))

while True:
    x,y=map(int,raw_input().split())
    if x==y==0:break
    n=input()
    pos=map(int,raw_input().split())
    pos=[(pos[2*i],pos[2*i+1]) for i in range(n)]

    que=[(x,y,0)]
    while que!=[]:
        X,Y,p=que[0][0],que[0][1],que[0][2]
        del que[0]
        S=set()
        if p>=n:
            print "OK"
            break
        for k in range(-1,2):
            for l in range(-1,2):
                S.add((pos[p][0]+k,pos[p][1]+l,p+1))
        for dx,dy in mv:
            mx=X+dx
            my=Y+dy
            if 0<=mx<10 and 0<=my<10 and (mx,my,p+1) in S:
                que.append((mx,my,p+1))
    else:
        print "NA"
D,G=list(map(int,input().split()))
pc = [[int(i) for i in input().split()] for m in range(2)]

#print(pc)
minn=10000
flug=[]
def func(D,G,pc,flug,i=0,summ=0,num=0):
    global minn
    if i==D:
        #print(flug,summ,num)
        if summ>=G:
            minn=min(minn,num)
            return 0
        else:
            for j,bit in enumerate(reversed(flug)):
                if bit==0:
                    for k in range(pc[D-1-j][0]):
                        summ+=(D-j)*100
                        if summ>=G:
                            num+=(k+1)
                            minn=min(minn,num)
        return 0

    return func(D,G,pc,flug+[1],i+1,summ+pc[i][0]*100*(i+1)+pc[i][1],num+pc[i][0]) + func(D,G,pc,flug+[0],i+1,summ,num)


func(D,G,pc,flug)
print(minn)

### FIXED CODE ###

D,G=list(map(int,input().split()))
pc = [[int(i) for i in input().split()] for m in range(D)]

#print(pc)
minn=10000
flug=[]
def func(D,G,pc,flug,i=0,summ=0,num=0):
    global minn
    if i==D:
        #print(flug,summ,num)
        if summ>=G:
            minn=min(minn,num)
            return 0
        else:
            for j,bit in enumerate(reversed(flug)):
                if bit==0:
                    for k in range(pc[D-1-j][0]):
                        summ+=(D-j)*100
                        num+=1
                        if summ>=G:
                            minn=min(minn,num)
        return 0

    return func(D,G,pc,flug+[1],i+1,summ+pc[i][0]*100*(i+1)+pc[i][1],num+pc[i][0]) + func(D,G,pc,flug+[0],i+1,summ,num)


func(D,G,pc,flug)
print(minn)
import sys
sys.setrecursionlimit(10**6)

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

if k==0:
    print(max(a))
    sys.exit()

def rf(mm):
    icnt=0
    for i in range(n):
        icnt+=(a[i]-1)//mm+1
    return icnt

asum=sum(a)
m=asum//(n+k)
um=asum
lm=1
for ii in range(200):
    if rf(m)>(n+k):
        lm=m
        m=int((um+lm)//2)
    elif rf(m)<(n+k):
        um=m
        m=int((um+lm)//2)
    else:
        um=m-1
        m=int((um+lm)//2)
    if rf(m)==(n+k) and um-lm<5:
        break

for mi in range(m+5,m-10,-1):
    if rf(mi)==(n+k) and rf(mi-1)>(n+k):
        break

print(mi)


### FIXED CODE ###

import sys

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

if k==0:
    print(max(a))
    sys.exit()

def rf(mm):
    if mm==0:
        mm=1
    icnt=0
    for i in range(n):
        icnt+=(a[i]-1)//mm+1
    return icnt

asum=sum(a)
m=asum//(n+k)
um=asum
lm=1
for ii in range(60):
    if m==1:
        break
    if rf(m)<=(n+k) and rf(m-1)>(n+k):
        break
    if um-lm<5:
        break
    if rf(m)>(n+k):
        lm=m
        m=(um+lm)//2-1
    elif rf(m)<(n+k):
        um=m
        m=(um+lm)//2-1
    else:
        um=m-1
        m=(um+lm)//2-1
#    if rf(m)==(n+k) and um-lm<5:

if um<1:
    print(1)
    sys.exit()
    
for mi in range(um,max(0,lm-1),-1):
    if rf(mi)<=(n+k) and rf(mi-1)>(n+k):
        break

print(mi)
n = int(input())
i = 1
ret = ""
while True:
    x = i
    if  x % 3 == 0:
        ret += " " + str(i)
    elif x % 10 == 3:
        ret += " " + str(i)
    else:
        x /= 10
        while x > 0:
        if x % 10 == 3:
            ret += " " + str(i)
            x /= 10
    i+=1
    if i > n:
        break

print(ret)



### FIXED CODE ###

#
# 5d
#

def main():
    n = int(input())
    s = ""
    for i in range(1, n+1):
        x = i
        if x % 3 == 0 or x % 10 == 3:
            s += " " + str(i)
        else:
            x //= 10
            while x:
                if x % 10 == 3:
                    s += " " + str(i)
                    break
                x //= 10
    print(s)


if __name__ == '__main__':
    main()
import heapq


N, Q = map(int, input().split())
event_list = []
for i in range(N):
  s, t, x = map(int, input().split())
  event_list.append([s-x, 1, x])
  event_list.append([t-x, -1, x])

event_list.sort()
event_list.append([10**10, 1, 10**10])
i = 0
x_set = set()
x_list = []
time = 0
for q in range(Q):
  d = int(input())
  while time <= d:
    time, event, x = event_list[i]
    if time <= d:
      if event == 1:
        x_set.add(x)
        heapq.heappush(x_list, x)
      else:
        x_set.remove(x)
      i += 1
  
  while x_list and x_list[0] not in x_set:
    _ = heapq.heappop(x_list)
  if x_list:
    prin(x_list[0])
  else:
    print(-1)

### FIXED CODE ###

import sys
from heapq import heappop, heappush

input = sys.stdin.readline
N, Q = map(int, input().split())
event_list = []
for i in range(N):
  s, t, x = map(int, input().split())
  event_list.append([s-x, 1, x])
  event_list.append([t-x, -1, x])

for i in range(Q):
  event_list.append([int(input()), 2, 0])

ans = []
event_list.sort()
x_set = set()
x_list = []
for time, event, x in event_list:
  if event == 1:
    x_set.add(x)
    heappush(x_list, x)
  elif event == -1:
    x_set.remove(x)
  else:
    while x_list and x_list[0] not in x_set:
      heappop(x_list)
    if x_list:
      ans.append(x_list[0])
    else:
      ans.append(-1)

print(*ans, sep='\n')
n= int(input())
task = [list(map(int,input().split()))for i in range(n)]

task.sort(key= lambda x: x[1])
time = 0
for i in task:
    time += task[i][0]
    if time > task[i][1]:
        print("No")
        break
else:
    print("Yes")

### FIXED CODE ###

n= int(input())
task = [list(map(int,input().split()))for i in range(n)]

task.sort(key= lambda x: x[1])
time = 0
for i in range(n):
    time += task[i][0]
    if time > task[i][1]:
        print("No")
        break
else:
    print("Yes")
n = int(input())
d = map(int, input().split())
 
result = 0
 
for x in range(1, n + 1):
  for y in range(x + 1, n + 1):
    result += d[x-1] * d[y-1]
    
print(result)

### FIXED CODE ###

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

result = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        result += d[i] * d[j]
print(result)
n = int(input())
a = list(map(int, input().split()))
print(max(a)-min(b))

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
print(max(a)-min(a))
s = input()

if(s[1]==s[2]):
    if(s[1]==s[4] or s[1]==s[0]):
        print('Yes')
    else:
        print('No')
else:
    print('No')

### FIXED CODE ###

s = input()

if(s[1]==s[2]):
    if(s[1]==s[3] or s[1]==s[0]):
        print('Yes')
    else:
        print('No')
else:
    print('No')
i=1
j=1
while i<10:
    j=1
    while j<10:
                print i,'x',j,'=',i*j,"\n"
                j=j+1

    i=i+1

### FIXED CODE ###

x = range(1,10)
for i in x:
  for j in x:
    print u"%dx%d=%d"%(i, j, i*j)
r, g, b = map(int, input().split())
if (100 * r + 10 * g + b) % 4 = 0:
	print("YES")
else:
	print("NO")


### FIXED CODE ###

r, g, b = map(int, input().split())
if (100 * r + 10 * g + b) % 4 == 0:
	print("YES")
else:
	print("NO")
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
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 pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    xy = sorted([LI() for _ in range(n)])
    d = collections.defaultdict(int)
    for i in range(n):
        x,y = xy[i]
        for j in range(i+1,n):
            x2,y2 = xy[j]
            d[(x-x2,y-y2)] += 1

    return n - max(d.values())


print(main())



### FIXED CODE ###

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

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
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 pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    xy = sorted([LI() for _ in range(n)])
    if n == 1:
        return 1
    d = collections.defaultdict(int)
    for i in range(n):
        x,y = xy[i]
        for j in range(i+1,n):
            x2,y2 = xy[j]
            d[(x-x2,y-y2)] += 1

    return n - max(d.values())


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

flag = True
for i in range(n,0,-1):
  if h[i]>=h[i-1]:
    continue
  elif h[i-1]-h[i]==1:
    h[i-1] -= 1
  else:
    flag = False
    break
    
if flag:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

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

flag = True
for i in range(n-1,0,-1):
  if h[i]>=h[i-1]:
    continue
  elif h[i-1]-h[i]==1:
    h[i-1] -= 1
  else:
    flag = False
    break
    
if flag:
  print('Yes')
else:
  print('No')
N, A, B = map(int, input().split())
H = sorted(int(input()) for _ in range(N))

import bisect, math
def f(ll, ul):
    if ul - ll == 1: return ll
    cur = (ll + ul) // 2
    r = H[bisect.bisect_right(H, B * cur):]
    p = sum(math.ceil((x - B * cur) / (A - B)) for x in r)

    if p == cur:
        return cur
    elif p < cur:
        return f(ll, cur)
    else:
        return f(cur + 1, ul)

print(f(0, math.ceil((H[-1]) / B) + 1))

### FIXED CODE ###

N, A, B = map(int, input().split())
H = sorted(int(input()) for _ in range(N))

import bisect, math
def f(ll, ul):
    if ul == ll: return ll
    cur = (ll + ul) // 2
    r = H[bisect.bisect_right(H, B * cur):]
    p = sum(math.ceil((x - B * cur) / (A - B)) for x in r)

    if p == cur:
        return cur
    elif p < cur:
        return f(ll, cur)
    else:
        return f(cur + 1, ul)

print(f(0, math.ceil((H[-1]) / B)))