Harryxun/stf_run huggingface dataset:
from sys import stdin

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]

for k in range(N):
    A[k] -= k

A.sort()


def get_pity_sum(x):
    pity_sum = 0
    for l in A:
        if A[x] - l >= 0:
            pity_sum += A[x] - l
        else:
            pity_sum += l - A[x]
    return pity_sum


if N % 2 == 1:
    print(min(get_pity_sum(int((N - 1) / 2)), get_pity_sum(int((N - 1) / 2 - 1)), get_pity_sum(int((N - 1) / 2 + 1))))
else:
    print(min(get_pity_sum(int(N / 2)), get_pity_sum(int(N / 2 - 1)), get_pity_sum(int(N / 2 - 2))))


### FIXED CODE ###

from sys import stdin

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]

for k in range(N):
    A[k] -= k

A.sort()


def get_pity_sum(x):
    pity_sum = 0
    for l in A:
        if A[x] - l >= 0:
            pity_sum += A[x] - l
        else:
            pity_sum += l - A[x]
    return pity_sum


if N % 2 == 1:
    c = get_pity_sum(int((N - 1) / 2))
    if N == 1:
        print(c)
    else:
        print(min(c, get_pity_sum(int((N - 1) / 2 - 1)), c + (A[int((N - 1) / 2) + 1] - A[int((N - 1) / 2)]) * 2, c + (A[int((N - 1) / 2)] - A[int((N - 1) / 2 - 1)]) * 2))
else:
    d = get_pity_sum(int(N / 2))
    print(min(get_pity_sum(int(N / 2)), d + (A[int(N / 2) + 1] - A[int(N / 2)]) * 2))
import math
n=int(input())
print(math.factorial(n)%(1e9+7))n=int(input())
ans=1
for i in range(1,n+1):
    ans=(ans*i)%(1e9+7)
print(int(ans))

### FIXED CODE ###

n=int(input())
ans=1
for i in range(1,n+1):
    ans=(ans*i)%(1e9+7)
print(int(ans))
H, W = map(int, input().rstrip().split())
s =[list(input().rstrip()) for _ in range(W)]
colors = [['.' for _ in range(W)] for _ in range(H)] 
search = [[-1, 0], [0, -1], [0, 1], [1, 0]]

judge = True
for i in range(H):
    for j in range(W):
        if s[i][j] =='#':
            flag = 0
            for k in range(len(search)):
                x = i + search[k][0]
                y = j + search[k][1]
                if 0 <= x < H and 0 <= y < W and s[x][y] == '#':
                    colors[i][j] = colors[x][y] = '#'
                    flag = 1
                    if flag == 0:
                        judge = False
                        
if s != colors:
    judge = False

if judge:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

H, W = map(int, input().rstrip().split())
s =[list(input().rstrip()) for _ in range(H)]

for i in range(H):
    for j in range(W):
        if s[i][j] =='#':
            flag = 0
            if i-1 >= 0 and s[i-1][j] == '#':
                flag = 1
            if j-1 >= 0 and s[i][j-1] == '#':
                flag = 1
            if j+1 < W and s[i][j+1] == '#':
                flag = 1
            if i+1 < H and s[i+1][j] == '#':
                flag = 1
            if flag == 0:
                print('No')
                exit()
                
print('Yes')
R,G,B=map(int,input().split())
K=int(input())
#print(R,G,B,K)

for i in range(K):
  #print(R,G,B,K)
  if(B<=G):
    B*=2
    continue
  if(G<=R):
    G*=2
    continue
#print(R,G,B,K)
if(R<G and G<B):
  print('Yes')
else:
  print('No')

### FIXED CODE ###

x=int(input())
if(400<=x and x<=599):
	print(8)
if(600<=x and x<=799):
	print(7)
if(800<=x and x<=999):
	print(6)
if(1000<=x and x<=1199):
	print(5)
if(1200<=x and x<=1399):
	print(4)
if(1400<=x and x<=1599):
	print(3)
if(1600<=x and x<=1799):
	print(2)
if(1800<=x and x<=1999):
	print(1)
from math import factorial

def choose(n, k):
    if n <= 0:
        return 0
    else:
        return factorial(n) // factorial(k) // factorial(n - k)

n, m = map(int, input().split())
print(choose(n, 2) + choose(m, 2))


### FIXED CODE ###

from math import factorial

def choose(n, k):
    if n < k:
        return 0
    else:
        return factorial(n) // factorial(k) // factorial(n - k)

n, m = map(int, input().split())
print(choose(n, 2) + choose(m, 2))
R = input()
if R < 1200:
	print('ABC')
elif R < 2800:
	print('ARC')
else:
	print('AGC')


### FIXED CODE ###

R = int(input())
if R < 1200:
	print('ABC')
elif R < 2800:
	print('ARC')
else:
	print('AGC')
N, *L = map(int, open('0').read().split())
inf = []
ls = []
rs = []
fl = 0
fr = float('inf')
for i,x in enumerate(zip(*[iter(L)]*2)):
  l,r = x
  ls.append((l,i))
  rs.append((r,i))
  inf.append((l,r))
ls.sort()
rs.sort(reverse=True)
m = 0
used = [False]*N
l1 = -1
l2 = -2
r1 = -1
r2 = -2
while True:
  while l1>=-N:
    i = ls[l1][1]
    if not used[i]:
      break
    l1 -= 1
  else:
    break
  while r1>=-N:
    i = rs[r1][1]
    if not used[i]:
      break
    r1 -= 1
  else:
    break
  while l2>=-N:
    i = ls[l2][1]
    if (not used[i]) and l1>l2:
      break
    l2 -= 1
  else:
    break
  while r2>=-N:
    i = rs[r2][1]
    if (not used[i]) and r1>r2:
      break
    r2 -= 1
  else:
    break
  x = rs[r1][0]-ls[l1][0]+1
  fa = m+x
  
  ll, i = ls[l1]
  rr, j= rs[r1]
  if i==j:
    lr = inf[i][1]
    a,b = max(ll,fl),min(lr,fr)
    p,q = a,b
    lm = b-a+1
    lx = rs[r1][0]-ls[l2][0]+1
    la = lm+lx
    rm = lm
    ra = la
  else:
    lr = inf[i][1]
    a = max(ll,fl)
    b = min(lr,fr)
    lm = b-a+1
    lx = rs[r1][0]-ls[l2][0]+1
    la = lm+lx
  
    rl = inf[j][0]
    p = max(rl,fl)
    q = min(rr,fr)
    rm = q-p+1
    rx = rs[r2][0]-ls[l1][0]+1
    ra = rm+rx
  if la>ra:
    if la>fa:
      fl = a
      fr = b
      m = lm
      used[i] = True
    else:
      break
  else:
    if ra>fa:
      fl = p
      fr = q
      m = rm
      used[j] = True
    else:
      break
first = [0,float('inf')]
second = [0,float('inf')]
for i,flag in enumerate(used):
  if flag:
    first[0] = max(first[0], inf[i][0])
    first[1] = min(first[1], inf[i][1])
  else:
    second[0] = max(second[0], inf[i][0])
    second[1] = min(second[1], inf[i][1])
if float('inf') in first or float('inf') in second:
  print(0)
else:
  ans = first[1]-first[0]+1 + second[1]-second[0]+1
  print(max(0,ans))

### FIXED CODE ###

import sys
from itertools import accumulate
N,*L = map(int, open(0).read().split())
ls = [0]*N
ml = -1
nr = -1
li = -1
mr = 10**9
nl = -1
ri = -1
for i,(a,b) in enumerate(zip(*[iter(L)]*2)):
  ls[i] = a,b
  if ml<a:
    ml = a
    nr = b
    li = i
  if b<mr:
    mr = b
    nl = a
    ri = i

if ri!=li:
  a,b = min(li,ri),max(li,ri)
  ls.pop(b)
  ls.pop(a)
  N -= 2
else:
  ls.pop(li)
  N -= 1
if N==0:
  ans = max(mr-nl+1,0)+max(nr-ml+1,0)
  print(ans)
  sys.exit()
ls.sort()
length = max(c[1]-c[0]+1 for c in ls)
ans = max(mr-ml+1,0)+length
r = list(accumulate((c[1] for c in ls[::-1]), min))[::-1]
l = list(c[0] for c in ls)
ans = max(ans, max(mr-nl+1,0)+max(r[0]-ml+1,0))
for i in range(N-1):
  xl = max(nl,l[i])
  xr = min(nr,r[i+1])
  ans = max(ans, max(mr-xl+1,0)+max(xr-ml+1,0))
xl = max(nl,l[N-1])
ans = max(ans, max(mr-xl+1,0)+nr-ml+1)
print(ans)
N = int(input())
V = list(map(int, input().split()))

even_idx_cnt = {}
odd_idx_cnt = {}
for idx, v in enumerate(V):
    if idx % 2 == 0:
        if v not in even_idx_cnt:
            even_idx_cnt[v] = 0
        even_idx_cnt[v] += 1
    else:
        if v not in odd_idx_cnt:
            odd_idx_cnt[v] = 0
        odd_idx_cnt[v] += 1

if len(even_idx_cnt) == 1 and len(odd_idx_cnt) == 1:
    if even_idx_cnt.keys() == odd_idx_cnt.keys():
        print(N - even_idx_cnt[V[0]])
    else:
        print(0)
    exit()

even_idx_cnt = sorted(even_idx_cnt.items(), key=lambda  x:x[1], reverse=True)
odd_idx_cnt = sorted(odd_idx_cnt.items(), key=lambda  x:x[1], reverse=True)

if even_idx_cnt[0][0] != odd_idx_cnt[0][0]:
    print(N - even_idx_cnt[0][1] - odd_idx_cnt[0][1])
elif len(even_idx_cnt[0][0]) == 1:
    print(N - even_idx_cnt[0][1] - odd_idx_cnt[1][1])
elif len(odd_idx_cnt[0][0]) == 1:
    print(N - even_idx_cnt[1][1] - odd_idx_cnt[0][1])
else:
    if even_idx_cnt[1][0] > odd_idx_cnt[1][0]:
        print(N - even_idx_cnt[0][1] - odd_idx_cnt[1][1])
    else:
        print(N - even_idx_cnt[1][1] - odd_idx_cnt[0][1])


### FIXED CODE ###

from collections import Counter
import heapq

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

if len(set(Vs)) == 1:
  print(N//2)
  exit()

Veve, Vodd = [],[]
idx = 0
for v in Vs:
  if idx%2 == 0: Veve.append(v)
  else: Vodd.append(v)
  idx += 1

Veve_cnt, Vodd_cnt = [], []
[heapq.heappush(Veve_cnt, [-num,val]) for val, num in Counter(Veve).items()]
[heapq.heappush(Vodd_cnt, [-num,val]) for val, num in Counter(Vodd).items()]

neg_num, val = heapq.heappop(Veve_cnt)
eve_val = val
eve_num = -neg_num

neg_num, val = heapq.heappop(Vodd_cnt)
odd_val = val
odd_num = -neg_num

if eve_val != odd_val:
  print(N-eve_num-odd_num)
else:
  if len(Vodd_cnt) != 0:odd_num2 = -heapq.heappop(Vodd_cnt)[0]
  else:odd_num2 = -float('inf')

  if len(Veve_cnt) != 0:eve_num2 = -heapq.heappop(Veve_cnt)[0]
  else:eve_num2 = -float('inf')

  print(min(N-eve_num2-odd_num,N-eve_num-odd_num2))
N = int(input())
a = []
for i in range(N):
  a.append(input())
for i in range(N):
  if i < N:
    if int(a[N-i-1]) >= int(a[N-i-2]):
      continue
    elif int(a[N-i-1]) + 1 == int(a[N-i-2]):
      int(a[N-i-2]) -= 1
      continue
    else:
      print('No')
      break
  else:
    print('Yes')

### FIXED CODE ###

N = int(input())
a = input().split()
for l in range(N):
    a[l] = int(a[l])
for i in range(N):
  if i < N-1:
    if a[N-i-1] >= a[N-i-2]:
      continue
    elif a[N-i-1] + 1 == a[N-i-2]:
      a[N-i-2] -= 1
    else:
      print('No')
      break
  else:
    print('Yes')
from functools import lru_cache

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

@lru_cache(maxsize=4)
def f(n):
    if n == 0:
        return 0
    elif n == 1:
        return abs(h[1] - h[0])
    return min(f(n-2) + abs(h[n] - h[n-2]), f(n-1) + abs(h[n] - h[n-1]))

print(f(n-1))

### FIXED CODE ###

import sys
from functools import lru_cache

sys.setrecursionlimit(10 ** 7)

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

@lru_cache(maxsize=None)
def f(n):
    if n == 0:
        return 0
    elif n == 1:
        return abs(h[1] - h[0])
    return min(f(n-2) + abs(h[n] - h[n-2]), f(n-1) + abs(h[n] - h[n-1]))

print(f(n-1))
n = int(input())
l = [int(input()) for i in range(n)][::-1]
maximum = l[0] - min(l[1:])
if maximum > 0:
    x = [i for i in l if l[0] <= i]
for j in range(len(x)-1):
    if maximum < l[j] - min(l[j+1:]):
        maximum = l[j] - min(l[j+1:])
input(maximum)

### FIXED CODE ###

n = int(input())
r = [int(input()) for i in range(n)]
start = r[0]
score = r[1] - r[0]
for i in range(1,n):
    if r[i] - start > score: score = r[i] - start
    if r[i] < start: start = r[i]
print(score)
N = int(input())
S = input()
R, G, B = [],[],[]
for i,s in enumerate(S):
    if s=='R':
        R.append(i)
    elif s=='G':
        G.append(i)
    else:
        B.append(i)

R.sort()
G.sort()
B.sort()

from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
 
ans = len(R)*len(G)*len(B)
for r in R:
    for g in G:
        for p in [r*2-g,g*2-r,(r+g)/2]:
            if p<=B[-1] and p>=B[0]:
                ind = bisect_left(B,p)
                if p == B[ind]:
                    ans -= 1

print(ans)



### FIXED CODE ###

N = int(input())
S = input()
R, G, B = [],[],[]
for i,s in enumerate(S):
    if s=='R':
        R.append(i)
    elif s=='G':
        G.append(i)
    else:
        B.append(i)

R.sort()
G.sort()
B.sort()

from bisect import bisect_left, bisect_right, bisect, insort_left, insort_right, insort
 
ans = len(R)*len(G)*len(B)
if ans > 0:
    for r in R:
        for g in G:
            for p in [r*2-g,g*2-r,(r+g)/2]:
                if p<=B[-1] and p>=B[0]:
                    ind = bisect_left(B,p)
                    if p == B[ind]:
                        ans -= 1

print(ans)
import numpy as np
import itertools
 
H, W, K = list(map(int, input().split())) 
c = [input().split() for l in range(H)]
b=[]
d=[]
for m in range(len(c)):
  for item in c[m]:
    item_mod = item.replace("."  , "0")
    item_mod = item_mod.replace("#" , "1")
    b.append(item_mod)
  d.append(b)
  b=[]

C_arr = np.array(d , dtype = "int")
 
In = np.array(list(itertools.product([0,1] , repeat=H)))
Out = np.array(list(itertools.product([0,1] , repeat=W)))
 
ans = 0
for i in range(2**H):
  In_matrix = np.diag(In[i])
  for j in range(2**W):
    Out_matrix = np.diag(Out[j])
    
    In_C = np.dot(In_matrix , C_arr)
    In_C_Out = np.dot(In_C , Out_matrix)
    
    ICO = In_C_Out.flatten()
    ICO = ICO.tolist()
    
    if ICO.count(1) == K:
      ans += 1
      
print(ans)

### FIXED CODE ###

H, W, K = list(map(int, input().split()))
 
c = [list(input()) for i in range(H)]
 
cnt = 0
for i in range(2**H):
    for j in range(2**W):
        cnt_black = 0
        for k in range(H):
            if (i >> k) & 1:
                continue
            for l in range(W):
                if (j >> l) & 1:
                    continue
                if c[k][l] == '#':
                    cnt_black += 1
        if cnt_black == K:
            cnt += 1
 
print(cnt)
n, m = list(map(int, input().split()))
a = [input() for i in range(m)]
b = []
c = []
total_act = 0
total_act2 = 1
total = 1
# for i in range(n + 1):
#     if str(i) in a:
#         total *= total_act
#         total_act = 0
#         total_act2 = 1
#     else:
#         total_act3 = total_act2 + total_act
#         total_act2 = total_act
#         total_act = total_act3
# total *= total_act
# print(total % 1000000007)
b.append(int(a[0]))
for i in range(len(a) - 1):
    b.append(int(a[i + 1]) - int(a[i]) - 1)
    if int(a[i + 1]) - int(a[i]) - 1 == 0:
        print(0)
        exit()
b.append(n - int(a[-1]))

for i in range(max(b)):
    total_act3 = total_act2 + total_act
    total_act2 = total_act
    total_act = total_act3
    c.append(total_act)

for i in b:
    total *= c[i - 1]

print(total % 1000000007)


### FIXED CODE ###

n, m = list(map(int, input().split()))
a = [input() for i in range(m)]
b = []
c = []
total_act = 0
total_act2 = 1
total = 1
if m == 0:
    for i in range(n + 1):
        if str(i) in a:
            total *= total_act
            total_act = 0
            total_act2 = 1
        else:
            total_act3 = total_act2 + total_act
            total_act2 = total_act
            total_act = total_act3
    total *= total_act
    print(total % 1000000007)
else:
    b.append(int(a[0]))
    for i in range(len(a) - 1):
        b.append(int(a[i + 1]) - int(a[i]) - 1)
        if int(a[i + 1]) - int(a[i]) - 1 == 0:
            print(0)
            exit()
    b.append(n - int(a[-1]))

    for i in range(max(b)):
        total_act3 = total_act2 + total_act
        total_act2 = total_act
        total_act = total_act3
        c.append(total_act)

    for i in b:
        total *= c[i - 1]
    print(total % 1000000007)
N = int input()
sen = N / 1000:
 
for N in 10000:
  if N % 1000 == 0：
  print(0)
else:
  atai = N - sen
  print(sen + atai )

### FIXED CODE ###

#! /usr/bin/python3

N = int(input())
1 <= N <= 10000

if N % 1000 == 0:
 print(0)
else:
  sen = N//1000
  sen2 = sen*1000
  atai = N-sen2
  atai2 = 1000-atai
  print(atai2)
n = input()
print(" ".join(n[:4], n[4:]))

### FIXED CODE ###

n = input()
print(n[:4], n[4:])
import math
import sys


def main():
	tate = int(raw_input())
	result = []
	for i in range(1, tate+1):
		result.append(i)

	print result

	yoko = int(raw_input())

	for line in sys.stdin.readlines():
		x1, x2 = map(int, line.split(","))
		x1 -= 1
		x2 -= 1
		temp = result[x2]
		result[x2] = result[x1]
		result[x1] = temp

	for num in result:
		print num
	


if __name__ == '__main__':
	main()
import math
import sys


def main():
	tate = int(raw_input())
	result = []
	for i in range(1, tate+1):
		result.append(i)

	print result

	yoko = int(raw_input())

	for line in sys.stdin.readlines():
		x1, x2 = map(int, line.split(","))
		x1 -= 1
		x2 -= 1
		temp = result[x2]
		result[x2] = result[x1]
		result[x1] = temp

	for num in result:
		print num
	


if __name__ == '__main__':
	main()

### FIXED CODE ###

import sys

def main():
	tate = int(raw_input())
	result = []
	for i in range(1, tate+1):
		result.append(i)

	yoko = int(raw_input())

	for line in sys.stdin.readlines():
		x1, x2 = map(int, line.split(","))
		x1 -= 1
		x2 -= 1
		temp = result[x2]
		result[x2] = result[x1]
		result[x1] = temp

	for num in result:
		print num
	


if __name__ == '__main__':
	main()
import math
A,B=map(int,input().split())
print(return(A*B)//math.gcd(A,B))


### FIXED CODE ###

import math
A,B=map(int,input().split())
def lcm(A, B):
    return (A * B) // math.gcd(A, B)
print(lcm(A,B))
import sys
lines = sys.stdin.readlines()    
# 1行ずつ取り出し
KN = input().strip(" ")
A = input().strip(" ")

K=int(KN[0])

X = K - int(A[-1])
temp = 0
for Ai in A:
  Y = int(Ai) - temp
  if Y > X:
    X = Y
  temp = int(Ai)

print(K-X)
  


### FIXED CODE ###

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

ans = K - A[-1] + A[0]
for n in range(N-1):
  dis = A[n+1] - A[n]
  ans = max(ans, dis)
  
print(K-ans)
n = int(input())
a = sum(list(map(str(n), int)))
if a%9==0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

n = int(input())
a = sum(list(map(int,str(n))))
if a%9==0:
  print("Yes")
else:
  print("No")
n, m, q = list(map(int, input().split()))
abcd = [list(map(int, input().split())) for _ in range(q)]

import itertools
anses = []
# for A in itertools.product(sum(([i]*n for i in range(1,m+1)),[]), repeat=n):

# for A in itertools.product(range(1, m + 1), repeat=n):


def f(i, A):
  for ai in range(A[-1], m + 1):
    if len(A) < m:
      f(ai, A + [ai])
    else:
      p = 0
      for a, b, c, d in abcd:
        a -= 1
        b -= 1
        if A[b] - A[a] == c:
          p += d
      anses.append(p)


f(0, [1])
print(max(anses))


### FIXED CODE ###

n, m, q = list(map(int, input().split()))
abcd = [list(map(int, input().split())) for _ in range(q)]

import itertools
anses = []
# for A in itertools.product(sum(([i]*n for i in range(1,m+1)),[]), repeat=n):
# for A in itertools.product(range(1, m + 1), repeat=n):

def f(A):
  for ai in range(A[-1], m + 1):
    if len(A) < n:
      f(A + [ai])
    else:
      p = 0
      for a, b, c, d in abcd:
        a -= 1
        b -= 1
        if A[b] - A[a] == c:
          p += d
      anses.append(p)

f([1])
print(max(anses))
N, M = map(int, input().split())

def bf(links, n, st=1):
    inf = float('inf')
    dj = [inf] * (n + 1)
    dj[st] = 0
    for i in range(N):
        updated = False
        for link in links:
            fn, tn, lc = link
            lc *= -1
            if dj[fn] + lc < dj[tn]:
                dj[tn] = dj[fn] + lc
                updated = True
        if not updated: break
    else:
        pn = dj[-1]
        for i in range(N):
            updated = False
            for link in links:
                fn, tn, lc = link
                lc *= -1
                if dj[fn] + lc < dj[tn]:
                    dj[tn] = dj[fn] + lc
                    updated = True
            if not updated: break
        return inf if pn != dj[-1] else -dj[-1]
    return -dj[-1]

links = []
for _ in range(M):
    links.append([int(x) for x in input().split()])

print(bf(links, N, 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)))
from operator import mul
from functools import reduce
from collections import Counter
from copy import deepcopy

def main():
    nCr = {}
    def cmb(n, r):
        if r == 0 or r == n: return 1
        if r == 1: return n
        if (n,r) in nCr: return nCr[(n,r)]
        nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
        return nCr[(n,r)]

    n = int(input())
    A = [int(x) for x in input().split()]
    a_c= Counter(A)
    cnt = 0
    for a in A:
        a_c_c = deepcopy(a_c)
        a_c_c[a] = a_c_c[a] - 1
        values = a_c_c.values()
        val_cnt = Counter(values)
        cnt = {cmb(k, 2) * v  if k > 1 else 0 for k, v in val_cnt.items()}
        print(sum(cnt))
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import Counter
 
def main():
    n = int(input())
    A = [int(x) for x in input().split()]
    a_c = Counter(A)
    res = [int(v*(v-1)/2) for v in a_c.values()]
    cnt = sum(res)
    for a in A:
        ans = (cnt - (a_c[a]-1))
        print(ans)
 
if __name__ == '__main__':
    main()
X, A = matp(int,input().split())

if X < A:
	print(0)
else:
	print(10)

### FIXED CODE ###

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

if X < A:
	print(0)
else:
	print(10)
import copy
K=int(input)
primes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199]
yakusuu_array=[]
for i in range(200):
  i+=1
  tmp=[]
  while i!=1:
    for prime in primes:
      if i % prime ==0:
        tmp.append(prime)
        i//=prime
  yakusuu_array.append(tmp)


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

ans=0
for i in range(1,K+1):
    for j in range(1,K+1):
        x=gcd(i,j)
        for k in range(1,K+1):
            ans+=gcd(x,k)
print(ans)


### FIXED CODE ###

n = int(input())
 
from math import gcd
 
y = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        x = gcd(i, j)
        for k in range(1, n+1):
            y += gcd(x,k)
 
print(y)
N = int(input())
S = input()

if len(set(S)) == 1:
    print(0)
    quit()

a = S.count(".")
b = S.count("#")
ans2 = min(a,b)

ans = 0

if S[0] == "#":
    i = 1
    while True:
        if S[i] == ".":
            ans = i
            S = S[i:]
            break
        else:
            i += 1
else:
    flag = False
    for i in S:
        if i == "#":
            flag = True
        elif flag :
            break
    else:
        print(0)
        quit()

# if len(set(S)) == 1:
#     print(ans2)
#     quit()

if S[-1] == ".":
    i = 2
    while True:
        if S[-i] == "#":
            ans += (i-1)
            S = S[:-i+1]
            break
        else:
            i += 1


for i in range(len(S)):
    if S[i] == "#":
        S = S[i:]
        break
for i in range(1, len(S)+1):
    if S[-i] == ".":
        S = S[:-(i-1)]
        break

print(min(min(S.count("."), S.count("#")) + ans, ans2))

### FIXED CODE ###

N = int(input())
S = input()
 
left = 0
right = S.count(".")
ans = right

for i in range(len(S)):
    if S[i] == ".":
        right -= 1
    else:
        left += 1

    ans = min(ans, left + right)
  
print(ans)
import math
x,y = map(int,input().split())
mod = 10**9+7

if (2*x-y)%3 != 0 or (-x+2*y)%3 != 0 or y>2*x or x>2*y:
  print(0)
  exit()
  
a = ((2*x-y)//3)%mod
b = ((-x+2*y)//3)%mod


def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

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

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

    return result

print(cmb(a+b,a)%mod)


### FIXED CODE ###

r = int(input())

print(r*r)
N=int(input())
if N>81:
    print("No")
else: 
    if N in (1,2,3,4,5,6,7,8,9,10,12,14,15,16,18,20,21,24,25,27,28,30,32,35,36,40,42,45,48,54,56,63,64,72,81):
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

A,B=map(int, input().split())
if A>9 or A<1:
    print("{}".format(-1))
else:
    if B>9 or B<1:
        print("{}".format(-1))
    else:
        print("{}".format(A*B))
n,a,b = map(int().split())
print(min(n*a,b))

### FIXED CODE ###

n,a,b = map(int,input().split())
print(min(n*a,b))