Harryxun/stf_run huggingface dataset:
N, K = map(int, input().split())
P = list(map(int, input().split()))
for i in range(N):
  P[i] -= 1
C = list(map(int, input().split()))

cycle = [[] for i in range(N)]
loop = [0 for i in range(N)]
imax = [0 for i in range(N)]

for i in range(N):
  loop[i] += C[i]
  j = P[i]
  cycle[i] += [j]
  while(j != i):
    loop[i] += C[j]
    j = P[j]
    cycle[i] += [j]

for i in range(N):
  if K > len(cycle[i]) and loop[i] > 0:
    q = int(K/len(cycle[i]))
    r = K % len(cycle[i])
    iscore = [0 for k in range(len(cycle[i]))]
    for j in range(len(cycle[i])):
      for k in range(len(cycle[i]))[j:]:
        iscore[k] += C[cycle[i][j]]
    imax[i] = max(max(iscore), max(iscore[:r])+loop[i]) + loop[i]*(q-1)
  else:
    iscore = [0 for i in range(len(cycle[i]))]
    for j in range(len(cycle[i])):
      for k in range(len(cycle[i]))[j:]:
        iscore[k] += C[cycle[i][j]]
    imax[i] = max(iscore)
print(max(imax))

### FIXED CODE ###

n,k = map(int, input().split())
p = list(map(int, input().split())) 
c = list(map(int, input().split()))
r = -10**9
for i in range(n):
  ans=c[i]
  e =[ans]
  f = i
  a = 1
  while a<k:
    i = p[i]-1
    if i == f:
      break
    a+=1
    ans+=c[i]
    e.append(ans)
  if e[-1]>0 and a<k:
    w = k%len(e)
    if w!=0:
      y = k//len(e)*e[-1]+max(e[:w])
    else:
      y =( k//len(e)-1)*e[-1]+max(e)
    g=y
  else:
    g=max(e)
  r = max(r,g)
print(r)
a,b=map(int,input())
print((a**-1+b**-1)**-1)

### FIXED CODE ###

a,b=map(int,input().split())
print((a**-1+b**-1)**-1)
n=int(input())
x=[int(n) for n in input().split()]
a=[0]*n
for i in range(1,n):
  if x[i-1]>=x[i]:
    a[i]=1
m=0
c=0
for i in a:
  if i==1:
    c+=1
  else:
    m=max(c,m)
    c=0
print(m)

### FIXED CODE ###

x=input()
y=input()
c=0
for i in range (len(x)):
  if x[i]==y[i]:
    c+=1
print(c)
def prod(array):
    res = 1
    for a, _ in array:
        res *= a
        res %= MOD
    return res

MOD = 10**9 + 7
N, K = map(int, input().split())
A = []
for a in map(int, input().split()):
    A.append((abs(a), a < 0))
A.sort(reverse=True)
sgn = 0
s0 = -1
lastA = -1
for i, p in enumerate(A[:K]):
    a, s = p
    sgn += s
    if s != s0:
        lastA = i-1
    s0 = s
if sgn%2==0:
    print(prod(A[:K])%MOD)
    exit()
if sgn + sum(s for _, s in A[K:])==N:
    print(-prod(A[-K:])%MOD)
    exit()
lasts = s
if lasts != A[K][1]:
    res = prod(A[:K-1])*A[K][0]
else:
    firstA = None
    for i, p in enumerate(A[K:],start=K):
        a, s = p
        if s != lasts:
            firstA = i
            break
    res1 = prod(A[:K-1])*A[firstA][0] if firstA is not None else -float("inf")
    res2 = prod(A[:lastA])*prod(A[lastA+1:K+1]) if lastA != -1 else -float("inf")
    res = max(res1, res2)
    print(firstA)
print(res%MOD)


### FIXED CODE ###

def prod(array):
    res = 1
    for a, _ in array:
        res *= a
        res %= MOD
    return res

MOD = 10**9 + 7
N, K = map(int, input().split())
if N==K:
    res = 1
    for a in map(int, input().split()):
        res *= a
        res %= MOD
    print(res)
    exit()
A = []
allsgn = 0
for a in map(int, input().split()):
    A.append((abs(a), a < 0))
    allsgn += a<0
A.sort(reverse=True)
sgn = 0
s0 = -1
lastA = -1
for i, p in enumerate(A[:K]):
    a, s = p
    sgn += s
    if s != s0:
        lastA = i-1
    s0 = s
lasts = s0
if allsgn==N:
    if K%2==1:
        print((-prod(A[-K:]))%MOD)
        exit()
    else:
        print(prod(A[:K])%MOD)
        exit()
if sgn%2==0:
    print(prod(A[:K])%MOD)
    exit()
if lasts != A[K][1]:
    res = prod(A[:K-1])*A[K][0]
else:
    firstA = None
    for i, p in enumerate(A[K:],start=K):
        a, s = p
        if s != lasts:
            firstA = i
            break
    if lastA == -1 or (firstA is not None and A[K][0]/A[lastA][0] < A[firstA][0]/A[K-1][0]):
        res = prod(A[:K - 1]) * A[firstA][0]
    else:
        res = prod(A[:lastA]) * prod(A[lastA + 1:K + 1])
print(res%MOD)
"""
6 3
5 -3 -3 -3 -3 -2

10 7
-10 -10 -10 -10 10 10 10 10 10 10
"""
S=input()
l=len(S)
t=0
p=0
m=[0] * l

for i in range(l):
    m[i]=int(S[i])*(10**(l-1-i))%2019

for i in range(l):
    p=0
    for j in range(l-i):
        p=(p+m[i+j])%2019
        if p==0:
            t+=1
print(t)

S=input()
l=len(S)
t=0
p=0
m=[0] * l

for i in range(l):
    m[i]=int(S[i])*(10**(l-1-i))%2019

for i in range(l):
    p=0
    for j in range(l-i):
        p=(p+m[i+j])%2019
        if p==0:
            t+=1
print(t)



### FIXED CODE ###

s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d%= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力
S = input()
print(S)
stack = []
ans = 0
for c in S:
    if stack and stack[0] != c:
        print("stack={}, c={} pop!".format(stack, c))
        stack.pop()
        ans += 2
    else:
        print("stack={}, c={} append!".format(stack, c))
        stack.append(c)
#     print("c={0}, st={1}".format(c, stack))
print(ans)

### FIXED CODE ###

S = input()
# print(S)
stack = []
ans = 0
for c in S:
    if stack and stack[0] != c:
#         print("stack={}, c={} pop!".format(stack, c))
        stack.pop()
        ans += 2
    else:
#         print("stack={}, c={} append!".format(stack, c))
        stack.append(c)
#     print("c={0}, st={1}".format(c, stack))
print(ans)
N = int(input())
S = list(map(int,input().split())) 
result_list = [] 
for i in range(N): 
    X = S[:i] 
    Y = S[i:] 
    counter = 0 
    old_list = [] 
    for j in X: 
        if j in Y and not(j in old_list): 
            counter += 1 
            old_list.append(j) 
            result_list.append(counter) 
print (max(result_list))

### FIXED CODE ###

N = int(input())
S = list(input()) 
result_list = [] 
for i in range(N): 
    X = S[:i] 
    Y = S[i:] 
    counter = 0 
    old_list = [] 
    for j in X: 
        if j in Y and not(j in old_list): 
            counter += 1 
            old_list.append(j) 
            result_list.append(counter) 
if result_list == []:
    print(0)
else:
    print (max(result_list))
N=int(input())

for i in range(N):
 t,x,y=list(map(int,input().split()))
 a=[(x+y)%2]
 b=[t%2]

if a==b and (x+y)<=t:
  print("Yes")
else :
  print("No")

### FIXED CODE ###

a,b=map(int, input().split())
c=a*b%2
if c==0:
  print("Even")

else :
  print("Odd")
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N-1)]
con = [set() for _ in range(N+1)]

for ab in AB:
    con[ab[0]].add(ab[1])
    con[ab[1]].add(ab[0])

max_len = 0
for i, c in enumerate(con):
    if max_len <= len(c):
        max_len = len(c)
        max_ind = i

colors = [set() for i in range(N+1)]
all_colors = set([i for i in range(1, max_len+1)])
res = [0] * (N - 1)


for i, ab in enumerate(AB):
    res[i] = list(all_colors.difference(colors[ab[0]].union(colors[ab[1]])))[0]
    colors[ab[0]].add(res[i])
    colors[ab[1]].add(res[i])

print(max_len)
for r in res:
    print(r)

### FIXED CODE ###

N = int(input())
AB = [list(map(int, input().split())) for _ in range(N-1)]
sortedAB = sorted(AB)
con = {i: [] for i in range(1, N+1)}
color = [0] * (N + 1)
for a, b in sortedAB:
    con[a].append(b)

for i in range(1, N + 1):
    now_c = 1
    for c in con[i]:
        if color[i] == now_c:
            now_c += 1
        color[c] = now_c
        now_c += 1

print(max(color))
for i in range(N-1):
    print(color[AB[i][1]])

a = 0
#coding: utf-8
import math
import heapq
import bisect

MOD = 10**9+7

def dfs(x,node,edge):
    for i in edge[x]:
        node[i]+=node[x]
        dfs(i,node,edge)

N,Q = map(int, input().split())

node = [0]*N
edge = [[] for _ in range(N)]

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

for i in range(Q):
    p,x = map(int, input().split())
    node[p-1] += x

dfs(0,node,edge)

for n in node:
    print(n)

### FIXED CODE ###

#coding: utf-8
import math
import heapq
import bisect

MOD = 10**9+7

N,Q = map(int, input().split())

node = [0]*N
edge = [[] for _ in range(N)]
color = [0]*N

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

for i in range(Q):
    p,x = map(int, input().split())
    node[p-1] += x

stack = [0]
while stack:
    s = stack.pop()
    color[s] = 1
    for t in edge[s]:
        if color[t]==0:
            stack.append(t)
            node[t] += node[s]
    color[s]=2

for n in node:
    print(n)
import sys

def solve():
    input = sys.stdin.readline
    M = int(input())
    N = ""
    for _ in range(M):
        d, c = map(int, input().split())
        N += str(d) * c

    count = 0
    while len(N) >= 2:
        #print(N)
        N = str(int(N[0]) + int(N[1])) + N[2:]
        count += 1

    print(count)
    
    return 0

if __name__ == "__main__":
    solve()

### FIXED CODE ###

import sys
from collections import deque

def q(d, c): #dは9以下、cは桁数
    digsum = d * c
    add = c - 1 + (digsum - 1) // 9
    rem = digsum - 9 * ((digsum - 1) // 9)
    return add, rem

def solve():
    input = sys.stdin.readline
    M = int(input())
    count = -1
    ans = 0
    for _ in range(M):
        d, c = map(int, input().split())
        add, rem = q(d, c)
        count += add
        ans += rem
        count += 1
        if ans > 9:
            ans -= 9
            count += 1

    print(count)
    
    return 0

if __name__ == "__main__":
    solve()
i = 0
while 1:
    sum = input()
    sum_list = sum.split(" ")
    print(len(str(int(sum_list[0]) + int(sum_list[1]))))
    except EOFError:
        break


### FIXED CODE ###

while 1:
    try:
        sum = input()
        sum_list = sum.split()
        print(len(str(int(sum_list[0]) + int(sum_list[1]))))
    except EOFError:
        break
a,b,c=input().split
if b=="-":
  print(int(a)-int(b))
else:
  print(int(a)+int(b))

### FIXED CODE ###

print(eval(input()))
import math
import sys
if sys.version[0] == '2':
    range, input = xrange, raw_input


class FenwickTree:
    def __init__(self, a_list, f, default):
        # 0-indexed
        self.N = len(a_list)
        self.bit = a_list[:]
        self.f = f
        self.default = default
        for _ in range(self.N, 1 << (math.ceil(math.log(self.N, 2)))):
            self.bit.append(self.default)
        for i in range(self.N - 1):
            self.bit[i | (i + 1)] = self.f(self.bit[i | (i + 1)], self.bit[i])

    def update(self, i, val):
        while i < self.N:
            self.bit[i] = self.f(self.bit[i], val)
            i |= i + 1

    def query(self, n):
        # [0, n]
        ret = 0
        while n >= 0:
            ret = self.f(ret, self.bit[n])
            n = (n & (n + 1)) - 1
        return ret


N = int(input())
X = [int(x) for x in input().split()]
dp = FenwickTree([0] * N, lambda x, y: max(x, y), 0)
for x, i in sorted((x, i) for i, x in enumerate(X)):
    dp.update(i, dp.query(i) + x)
print(N * (N + 1) // 2 - dp.query(N - 1))

### FIXED CODE ###

import math
import sys
if sys.version[0] == '2':
    range, input = xrange, raw_input


class FenwickTree:
    def __init__(self, a_list, f, default):
        # 0-indexed
        self.N = len(a_list)
        self.bit = a_list[:]
        self.f = f
        self.default = default
        for _ in range(self.N, 1 << int(math.ceil(math.log(self.N, 2)))):
            self.bit.append(self.default)
        for i in range(self.N - 1):
            self.bit[i | (i + 1)] = self.f(self.bit[i | (i + 1)], self.bit[i])

    def update(self, i, val):
        while i < self.N:
            self.bit[i] = self.f(self.bit[i], val)
            i |= i + 1

    def query(self, n):
        # [0, n]
        ret = 0
        while n >= 0:
            ret = self.f(ret, self.bit[n])
            n = (n & (n + 1)) - 1
        return ret


N = int(input())
X = [int(x) for x in input().split()]
dp = FenwickTree([0] * N, lambda x, y: max(x, y), 0)
for x in X:
    dp.update(x - 1, dp.query(x - 1) + x)
print(N * (N + 1) // 2 - dp.query(N - 1))
H, W = map(int, input().split())

S = [list(input()) for i in range(H)]
for i in range(1,H-1):
  for j in range(1,W-1):
    if S[i][j] == '.':
      x = [S[i-1][j-1], S[i-1][j], S[i-1][j+1], S[i][j-1], S[i][j+1],S[i+1][j-1], S[i+1][j],S[i+1][j+1]]
      S[i][j] = x.count('#')

for j in range(1,W-1):
  if S[0][j] == '.':
    x = [S[0][j-1], S[0][j+1], S[1][j-1], S[1][j], S[1][j+1]]
    S[0][j] = x.count('#')
    
  if S[H-1][j] == '.':
    x = [S[H-1][j-1], S[H-1][j+1], S[H-2][j-1], S[H-2][j], S[H-2][j+1]]
    S[H-1][j] = x.count('#')

for i in range(1, H-1):
  if S[i][0] == '.':
    x =[S[i-1][0],S[i-1][1],  S[i][1], S[i+1][0], S[i+1][1]]
    S[i][0] = x.count('#')
  if S[i][W-1] == '.':
    x =[S[i-1][W-1],S[i-1][W-2],  S[i][W-2], S[i+1][W-1], S[i+1][W-2]]
    S[i][W-1] = x.count('#')

if S[0][0] == '.':
  x = [S[0][1], S[1][0], S[1][1]]
  S[0][0] =x.count('#')
if S[H-1][0] == '.':
  x = [S[H-1][1], S[H-2][0], S[H-2][1]]
  S[H-1][0] = x.count('#')
if S[0][W-1] == '.':
  x = [S[0][W-2], S[1][W-1], S[1][W-2]]
  S[0][W-1] = x.count('#')
if S[H-1][W-1] == '.':
  x = [S[H-1][W-2], S[H-2][W-1], S[H-2][W-2]]
  S[H-1][W-1] = x.count('#')

for i in range(len(S)):
  S[i] = [str(x) for x in S[i]]
  print(''.join(S[i]))

### FIXED CODE ###

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

s = [['.']*(w+2)]+ [list('.'+ input() + '.') for i in range(h)] + [['.']*(w+2)]
a = [[0]*w for i in range(h)]


for i in range(1, h+1):
  for j in range(1,w+1):
    if s[i][j] == '#':
      a[i-1][j-1] = '#'
    else:
      b = [s[i-1][j-1],s[i-1][j], s[i-1][j+1], s[i][j-1], s[i][j+1], s[i+1][j-1], s[i+1][j], s[i+1][j+1]]
      c = b.count('#')
           
      a[i-1][j-1] = c

for i in range(h):
  a[i] = [str(x) for x in a[i]]
  print(''.join(a[i]))
X,Y = map(int, input().split())
if hex(X)<hex(Y):
  print("<")
elif hex(X)>hex(Y):
  print(">")
else:
  print("=")

### FIXED CODE ###

x,y = map(str, input().split())
if int(x,16) > int(y,16):
  print(">")
elif int(x,16) < int(y,16):
  print("<")
else:
  print("=")
n = int(input())
a = list(map(int, input().split()))

for i in range(n):
    ans = 0
    for j in range(n - 1):
        if i + 1 == a[j]:
            ans += 1
    print(ans)


### FIXED CODE ###

r = int(input())
print(r * 3.14159 * 2)
import sys
x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
  sys.exit()
n=(x+y)//3
fac=[1 for i in range(n+1)]#fac[i]=i!. fac[0]=1
for i in range(n+1):
  fac[i]=fac[i-1]*i

print(fac[n]//fac[x-n]//fac[y-n])

### FIXED CODE ###

import sys
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

x,y=map(int,input().split())
if (x+y)%3!=0:
  print(0)
  sys.exit()
n=(x+y)//3

mod = 10**9+7 #出力の制限
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, n + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

print(cmb(n,x-n,mod))
# ANSHUL GAUTAM
# IIIT-D

from math import *

'''

'''

def solve(a,b):
	g = gcd(a,b)
	return a*b//g

a,b = map(int, input().split())
ans = solve(a,b)
print(ans)


### FIXED CODE ###

# ANSHUL GAUTAM
# IIIT-D

from copy import *
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from sys import stdin
from sys import maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)


'''

'''

def gcd(a,b):
	if(b == 0):
		return a
	else:
		return gcd(b,a%b)

def solve(a,b):
	g = gcd(a,b)
	return a*b//g

a,b = list(map(int, stdin.readline().rstrip().split()))
ans = solve(a,b)
print(ans)
m=[]
minimam = float("inf")
sum_ = 0

N,X = map(int(),input().split())
 
for i in range(N):
  m = int(input())
  sum_ += m
  if m < minimam:
    minimam = m
    
n = N
X_1 = X-sum_
n += X_1 // minimam
 
print(n)

### FIXED CODE ###

minimam = float("inf")
sum_ = 0
     
N,X = map(int,input().split())
     
for i in range(N):
  m = int(input())
  sum_ += m
  if m < minimam:
    minimam = m
        
n = N
X_1 = X-sum_
n += X_1 // minimam
     
print(n)
n,m=map(int,input().split())
X=list()
Y=list()
Z=list()
for i in range(n):
    x,y,z=map(int,input().split())
    X.append(x)
    Y.append(y)
    Z.append(z)
A=list()
B=list()
C=list()
D=list()
for i in range(n):
    A.append(X[i]+Y[i]+Z[i])
    B.append(-X[i]+Y[i]+Z[i])
    C.append(X[i]-Y[i]+Z[i])
    D.append(X[i]+Y[i]-Z[i])
import functools
A.sort()
B.sort()
C.sort()
D.sort()
x1=functools.reduce(lambda x,y:x+y,[A[i] for i in range(m)])
x2=functools.reduce(lambda x,y:x+y,[A[-i] for i in range(1,m+1)])
y1=functools.reduce(lambda x,y:x+y,[B[i] for i in range(m)])
y2=functools.reduce(lambda x,y:x+y,[B[-i] for i in range(1,m+1)])
z1=functools.reduce(lambda x,y:x+y,[C[i] for i in range(m)])
z2=functools.reduce(lambda x,y:x+y,[C[-i] for i in range(1,m+1)])
w1=functools.reduce(lambda x,y:x+y,[D[i] for i in range(m)])
w2=functools.reduce(lambda x,y:x+y,[D[-i] for i in range(1,m+1)])
print(max(abs(x1),abs(x2),abs(y1),abs(y2),abs(z1),abs(z2),abs(w1),abs(w2)))



### FIXED CODE ###

n,m=map(int,input().split())
X=list()
Y=list()
Z=list()
for i in range(n):
    x,y,z=map(int,input().split())
    X.append(x)
    Y.append(y)
    Z.append(z)
A=list()
B=list()
C=list()
D=list()
for i in range(n):
    A.append(X[i]+Y[i]+Z[i])
    B.append(-X[i]+Y[i]+Z[i])
    C.append(X[i]-Y[i]+Z[i])
    D.append(X[i]+Y[i]-Z[i])
import functools
A.sort()
B.sort()
C.sort()
D.sort()
if m==0:
    print(0)
else:
    x1=functools.reduce(lambda x,y:x+y,[A[i] for i in range(m)])
    x2=functools.reduce(lambda x,y:x+y,[A[-i] for i in range(1,m+1)])
    y1=functools.reduce(lambda x,y:x+y,[B[i] for i in range(m)])
    y2=functools.reduce(lambda x,y:x+y,[B[-i] for i in range(1,m+1)])
    z1=functools.reduce(lambda x,y:x+y,[C[i] for i in range(m)])
    z2=functools.reduce(lambda x,y:x+y,[C[-i] for i in range(1,m+1)])
    w1=functools.reduce(lambda x,y:x+y,[D[i] for i in range(m)])
    w2=functools.reduce(lambda x,y:x+y,[D[-i] for i in range(1,m+1)])
    print(max(abs(x1),abs(x2),abs(y1),abs(y2),abs(z1),abs(z2),abs(w1),abs(w2)))
N = int(input())
inputs = [[int(i) for i in input().split()] for _ in range(N)]

ans = 1
rates = {}
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        vector = (inputs[i][0] - inputs[j][0], inputs[i][1] - inputs[j][1])
        rates[vector] = rates.get(vector, 0) + 1

print(N - max(rates.values()))


### FIXED CODE ###

N = int(input())
inputs = [[int(i) for i in input().split()] for _ in range(N)]

ans = 1
rates = {0: 0}
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        vector = (inputs[i][0] - inputs[j][0], inputs[i][1] - inputs[j][1])
        rates[vector] = rates.get(vector, 0) + 1

print(N - max(rates.values()))
a  = list(map(int.input().split()))
a.sort();
print(a[0]+a[1])

### FIXED CODE ###

a = list(map(int,input().split()))
a.sort()
print(a[0]+a[1])
X, Y = map(int, input().split())

if (-X + 2*Y) % 3 or (2*X - Y) % 3:
    print(0)
else:
    a = (-X + 2*Y) // 3
    b = (2*X - Y) // 3
    P = 10**9 + 7
    fa = [1]
    for i in range(1, a + b + 100):
        fa.append(fa[-1] * i % P)    
    print(fa[a+b] * pow(fa[a]*fa[b], P-2, P) % P)

### FIXED CODE ###

X, Y = map(int, input().split())


if (-X + 2*Y) % 3 or (2*X - Y) % 3 or (-X + 2*Y) < 0 or (2*X - Y) < 0:
    print(0)
else:
    a = (-X + 2*Y) // 3
    b = (2*X - Y) // 3
    P = 10**9 + 7
    fa = [1]
    for i in range(1, a + b + 100):
        fa.append(fa[-1] * i % P)    
    print(fa[a+b] * pow(fa[a]*fa[b], P-2, P) % P)
import itertools

N = int(input())
balls = []

for i in range(N):
    x, y = map(int, input().split(' '))
    balls.append([x,y])

ans_list = []
for pat in list(itertools.permutations(balls)):
    dic = {}
    l = list(pat)
    px = l[0][0]
    py = l[0][1]
    for i in range(1,len(l)):
        dx = l[i][0] - px
        dy = l[i][1] - py
        px = l[i][0]
        py = l[i][1]
        if (0>dx):
            dx *= -1
            dy *= -1
        if (dx,dy) not in dic.keys():
            dic[(dx,dy)] = 1
        else:
            dic[(dx,dy)] += 1
    d_max = max(dic.values())
    ans_list.append(N - d_max)

print(min(ans_list))


### FIXED CODE ###

N = int(input())
balls = []
for i in range(N):
    x, y = map(int, input().split(' '))
    balls.append((x,y))

if N == 1:
    print("1")
    exit()

dic = {}
for i in range(N):
    for j in range(i+1,N):
        dx = balls[j][0] - balls[i][0]
        dy = balls[j][1] - balls[i][1]
        if (dx,dy) not in dic.keys():
            dic[(dx,dy)] = 1
        else:
            dic[(dx,dy)] += 1
        dx *= -1
        dy *= -1
        if (dx,dy) not in dic.keys():
            dic[(dx,dy)] = 1
        else:
            dic[(dx,dy)] += 1

d_max = max(dic.values())
print(N - d_max)
a,b,c=int(input().split())
if (b-a)==(c-b):
    print("YES")
else:
    print("NO")


### FIXED CODE ###

a,b,c=map(int,input().split())
if b-a==c-b:
    print("YES")
else:
    print("NO")
import sys

z = 0
for line in sys.stdin:
  xs = [float(x) for x in line.split()]
  if len(xs) == 1: 
    continue
  z += 380000 * xs[0] if xs[1] == 'BTC' else xs[0]
print(z)


### FIXED CODE ###

import sys

z = 0
for line in sys.stdin:
  xs = line.split()
  if len(xs) < 2:
    continue
  if xs[1] == 'BTC':
    z += 380000 * float(xs[0])
  else: 
    z += float(xs[0])
print(z)
# utf-8:
import math as np


def main():
    n = int(raw_input())
    for i in range(n, 0, -1):
        sqrt = np.sqrt(i)
        if sqrt - int(sqrt) == 0:
            print(i)
            break


if __name__ == '__main__':
    main()


### FIXED CODE ###

# utf-8:
import math as np


def main():
    n = int(raw_input())
    a = int(np.sqrt(n))
    print(a * a)


if __name__ == '__main__':
    main()
s = input()

print("Yes" s.count("a") == 1 and s.count("b") == 1 and s.count("c") == 1 else "No")

### FIXED CODE ###

s = input()

print("Yes" if s.count("a") == 1
            and s.count("b") == 1 
            and s.count("c") == 1
            else "No")
try:
  p = list(map(int, input().split()))
except:
  p = []


l = [0]*100

for i in range(N):
  l[abs(p[i] - X)] += 1

#print(p.index(9))
if N == 0:
  print(X)
else:
  for i in range(N):
    if i == 0:
      if l[0] == 1:
        continue
      else:
        print(X)
        break
    else:
      if l[i] == 0:
        print(X-i)
        break
      elif l[i] == 1:
        try:
          p_index = p.index(X-i)
          print(X+i)
        except:
          print(X-i)
        break

### FIXED CODE ###

X, N = map(int, input().split())
try:
  p = list(map(int, input().split()))
except:
  p = []


l = [0]*200

for i in range(N):
  l[abs(p[i] - X)] += 1

#print(p.index(9))

if N == 0:
  print(X)
else:
  for i in range(N+1):
    if i == 0:
      if l[0] == 1:
        continue
      else:
        print(X)
        break
    else:
      if l[i] == 0:
        print(X-i)
        break
      elif l[i] == 1:
        try:
          p_index = p.index(X-i)
          print(X+i)
        except:
          print(X-i)
        break
n=int(input())
m=int(input())
rate=2*n*m/((n+m)*(n+m-1))
print(int((n+m)*rate))

### FIXED CODE ###

n,m=(input().split())
n=int(n)
m=int(m)
print(int(((n*(n-1))+(m*(m-1)))/2))
import numpy as np
N=int(raw_input())
AN=map(int, raw_input().split())
BN=[0 for i in xrange(N)]
for i in AN:
    BN[i-1] += 1
BN=[i for i in BN if i > 0]
BN.sort(reverse=True)

for K in xrange(1, N+1):
    x = np.zeros(K)
    for i in BN:
        x[x.argmin()] += i

    print (int(x.min()))


### FIXED CODE ###

N=int(raw_input())
AN=map(int, raw_input().split())

BN=[0 for i in xrange(N)]
for i in AN:
    BN[i-1] += 1
BN.sort()

LN = [0 for i in xrange(N)]
s = 0
j = 0
try:
    for X in xrange(1, N+1):
        while j<N and  BN[j] < X:
            s += BN[j]
            j += 1
        LN[X-1] = (s + X*(N - j)) / X
except IndexError:
    pass

KN = [0 for i in xrange(N)]
for i in xrange(len(LN)):
    KN[LN[i]-1] = i+1

for i in xrange(len(KN)-2, -1, -1):
    if KN[i] == 0:
        KN[i] = KN[i+1]

for i in KN:
    print (str(i))