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

def nPr(n, r):
  ans = 1
  for i in range(n,n-r,-1):
    ans *= i
  return ans

def nCr(n, r):
  tmp = 1
  for i in range(r,1,-1):
    tmp *= i
  return int(nPr(n, r) / tmp)

n = int(input())
a = list(map(int,input().split()))
count = len(a)
d = {}
x = {}

for i in a:
  if i not in d:
    d[i] = 1
  else:
    d[i] += 1

for i in d:
  x[i] = nCr(d[i], 2)

for i in a:
  ans = 0
  for j in d:
    if i == j:
      if d[j] > 2:
        ans += nCr(d[j]-1, 2)
    else:
      if d[j] > 1:
        ans += x[j]
  print(ans)
      

### FIXED CODE ###

def nPr(n, r):
  ans = 1
  for i in range(n,n-r,-1):
    ans *= i
  return ans

def nCr(n, r):
  tmp = 1
  for i in range(r,1,-1):
    tmp *= i
  return int(nPr(n, r) / tmp)

n = int(input())
a = list(map(int,input().split()))
count = len(a)
d = {}
x = 0

for i in a:
  if i not in d:
    d[i] = 1
  else:
    d[i] += 1

for i in d:
  x += nCr(d[i], 2)

for i in a:
  ans = x - d[i] + 1
  print(ans)
### BUGGY CODE ###

arr = [0 for i in range(2019)]
arr[0] = 1

s = input()
n = len(s)

num = 0
for i,ele in enumerate(s[::-1]):
    num += int(ele) * pow(10,i)
    arr[num%2019] += 1


ans = 0
for m in arr:
    if m==0: continue
    ans += m*(m-1)//2

print(ans)



### FIXED CODE ###

arr = [0 for i in range(2019)]
arr[0] = 1

s = input()
n = len(s)

num = 0
for i,ele in enumerate(s[::-1]):
    num += int(ele) * pow(10, i, 2019)
    arr[num%2019] += 1


ans = 0
for m in arr:
    if m==0: continue
    ans += m*(m-1)//2

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

# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
cura, curb = MAP()
for i in range(N-1):
    a, b = MAP()
    tmpa, tmpb = a, b
    # 比をそのままで、現在の票数より大きくする
    while a < cura or b < curb:
        a += tmpa
        b += tmpb
    cura, curb = a, b
ans = cura + curb
print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-

N = int(input())

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

for i in range(N-1):
    t,a = map(int, input().split())
    tmp1,tmp2 = 1,1
    # ループで足していくより、1回で出せる方法にする
    if t < T:
        # 切り上げはmath.ceilより演算子のみのが速い
        tmp1 = -(-T // t)
    if a < A:
        tmp2 = -(-A // a)
    # 多く増やす必要のある方に合わせて、同じ比で両方増やす
    T = t * max(tmp1,tmp2)
    A = a * max(tmp1,tmp2)

print(T + A)
### BUGGY CODE ###

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

score = [1] * (n - k + 1)
for i in range(k):
    score[0] *= A[i]

for i in range(1, n - k + 1):
    score[i] = score[i - 1] // A[i - 1]
    # score[i] //= A[i]
    score[i] *= A[i + k - 1]
    
# print(score)


for i in range(1, len(score)):
    pre = score[i - 1]
    now = score[i]
    if now > pre:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

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

for i in range(k, n):
    if A[i] > A[i - k]:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

from collections import deque


h, w = map(int, input().split())
a = []
d = deque([])
memo = [[-1] * w for j in range(h)]
for i in range(h):
    a.append(list(input()))
    for j, s in enumerate(a[i]):
        if s == '#':
            d.append([i, j])
            memo[i][j] = 0


def d_list_update(d, hmax, wmax):
    move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
    dh, dw = d.popleft()
    for i, j in move:
        if (0 <= dh + i < hmax) and (0 <= dw + j < wmax):
            if memo[dh + i][dw + j] == -1:
                memo[dh + i][dw + j] = memo[dh][dw] + 1
                d.append([dh + i, dw + j])
    return d


while(d):
    d = d_list_update(d, h, w)
ans = max([max(e) for e in memo])
print(ans)

### FIXED CODE ###

from collections import deque
 
 
h, w = map(int, input().split())
hs, ws = set(range(h)), set(range(w))
d = deque()
memo = [[-1] * w for j in hs]
move = [[1, 0], [0, 1], [-1, 0], [0, -1]]
a = tuple(input() for _ in hs)
b = [[i, j] for i in hs for j in ws if a[i][j] == '#']
for i, j in b:
    d.append((i, j))
    memo[i][j] = 0
while d:
    dh, dw = d.popleft()
    for i, j in move:
        dhn, dwn = dh + i, dw + j
        if (0 <= dhn < h) and (0 <= dwn < w) and (memo[dhn][dwn] < 0):
            d.append((dhn, dwn))
            memo[dhn][dwn] = memo[dh][dw] + 1
ans = max([max(e) for e in memo])
print(ans)
### BUGGY CODE ###

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

d = {}

for i in range(N):
    d[i+1] = set()

for i in range(M):
    a, b = map(int,input().split())
    d[a].add(b)
    d[b].add(a)

que = [1]
checked = set()
ans = {1:-1}

while que:
    now = que.pop(0)
    for h in d[now]:
        if not h in ans:
            ans[h] = now
            que.append(h)
    if len(ans) == N:
        break
    
if len(ans) == N:
    print('Yes')
    for i in range(N-1):
        print(ans[i+2]) 
else:
    print('No')



### FIXED CODE ###

from collections import deque

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

d = {}

for i in range(N):
    d[i+1] = set()

for i in range(M):
    a, b = map(int,input().split())
    d[a].add(b)
    d[b].add(a)

que = deque([1])
checked = set()
ans = {1:-1}

while que:
    now = que.popleft()
    for h in d[now]:
        if not h in ans:
            ans[h] = now
            que.append(h)
    if len(ans) == N:
        break
    
if len(ans) == N:
    print('Yes')
    for i in range(N-1):
        print(ans[i+2]) 
else:
    print('No')
### BUGGY CODE ###

import sys
    
global distance

def shortest_path(GRAPH):
    global distance
    
    nodes2=range(len(distance))
    p1 = 0
    distance[p1] = 0;

    while True:
        nodes2.remove(p1)
        for p2 in nodes2:
            if GRAPH[p1].has_key(p2):
                tmp = distance[p1] + GRAPH[p1][p2]
                if tmp < distance[p2]:
                    distance[p2] = tmp

        p1 = -1
        mini = 1000000
        for p2 in nodes2:
            if distance[p2]<mini:
                p1 = p2
                mini = distance[p2]
        if mini == 1000000:
            break
    return

def resultout():
    for i in range(len(distance)):
        print "%d %d" %(i, distance[i])
    return

n = int(raw_input())
x = [{} for i in range(n)]
distance = [1000000 for i in range(n)]

for i in range(n):
    seq = map(int,raw_input().split())
    i2 = seq.pop(0)
    n2 = seq.pop(0)
    for j in range(n2):
        j2 = seq.pop(0)
        weight = seq.pop(0)
        x[i2][j2] = weight

shortest_path(x)
resultout()

### FIXED CODE ###

import sys
    
def shortest_path(GRAPH, distance):
    
    nodes = set()
    p1 = 0
    distance[p1] = 0

    while True:
        dp1 = distance[p1]
        gp1 = GRAPH[p1]
        status[p1]=1
        for p2 in gp1.keys():
            tmp = gp1[p2] + dp1
            if status[p2]==0 and tmp < distance[p2]:
                distance[p2] = tmp
                nodes.add(p2)

        p1 = -1
        mini = 1000000
            
        for p2 in nodes:
            if distance[p2]<mini:
                p1 = p2
                mini = distance[p2]
        if mini == 1000000:
            break
        nodes.remove(p1)
    return

def resultout(distance):
    for i in xrange(len(distance)):
        print "%d %d" %(i, distance[i])
    return

n = int(raw_input())
x = [{} for i in xrange(n)]
status = [0 for i in xrange(n)]
distance = [1000000 for i in xrange(n)]

for i in xrange(n):
    seq = map(int, raw_input().split())
    tmp={}
    for j in xrange(2, len(seq), 2):
        j2, weight = seq[j:j+2]
        tmp[j2] = weight
    x[seq[0]] = tmp
    status[i] = 0

shortest_path(x, distance)
resultout(distance)
### BUGGY CODE ###

import itertools

s = str(input())

n = len(s)
dp = [[0]*13 for i in range(n)]
      
for i in range(n):
  if i != 0:
    if s[i] == '?':
      for k, j in itertools.product(range(10), range(13)):
        x = (j+k*10**(n-1-i))%13
        dp[i][x] += dp[i-1][j]
    else:
      for j in range(13):
        x = (j+int(s[i])*10**(n-1-i))%13
        dp[i][x] += dp[i-1][j]
  else:
    if s[i] == '?':
      for k in range(10):
        x = (k*10**(n-1-i))%13
        dp[i][x] += 1
    else:
      x = (int(s[i])*10**(n-1-i))%13
      dp[i][x] += 1

print(dp[-1][5]%(10**9+7))    

  

### FIXED CODE ###

import itertools
 
s = str(input())
 
n = len(s)
dp = [[0]*13 for i in range(n+1)]
dp[0][0] = 1

M = 1
INF = 10 ** 9 + 7
      
for i in range(n):
  if s[n-1-i] == '?':
    for k, j in itertools.product(range(10), range(13)):
      x = (j+k*M)%13
      dp[i+1][x] += dp[i][j]
      dp[i+1][x] %= INF
  else:
    for j in range(13):
      x = (j+int(s[n-1-i])*M)%13
      dp[i+1][x] += dp[i][j]
      dp[i+1][x] %= INF
  M = (M*10)%13

print(dp[-1][5])
#print(dp[-1][5]%(10**9+7))
#print(dp)
### BUGGY CODE ###

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

count =[0 for i in range(N)]
for i in range(N):
    count[A_n[i]-1] +=1
ans =[count[i]*(count[i]-1)//2 for i in range(N)]

for i in range(N):
    old = count[A_n[i]-1]*(count[A_n[i]-1]-1)//2
    count[A_n[i]-1] -= 1
    new = count[A_n[i]-1]*(count[A_n[i]-1]-1)//2
    print(sum(ans)-old+new)
    count[A_n[i]-1] += 1

### FIXED CODE ###

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

count =[0 for i in range(N)]
for i in range(N):
    count[A_n[i]-1] +=1
ans =[count[i]*(count[i]-1)//2 for i in range(N)]
a1=sum(ans)
for i in range(N):
    print(a1-count[A_n[i]-1]+1)
### BUGGY CODE ###

n = int(input())
x = int(input(),2)

def popcount2(n):
    return bin(n).count("1")

def popcount(n):
    ans = 0
    while n:
        ans += n % 2
        n //= 2
    return ans

pops = popcount(x)
x_pop_p = x%(pops + 1)
try:
    x_pop_m = x%(pops - 1)
except:
    x_pop_m = 0
#print(x_pop_p)
#print(x_pop_m)
#print()
pows_of_2 = [0]*(n)
pows_of_2[0] = 1
for i in range(1,n):
    pows_of_2[i] = pows_of_2[i-1] * 2
for i in reversed(range(0,n)):
    bit = x^(1<<i)
    #print(bin(bit))
    #print(bit)
    #print(popcount(bit))
    if bit == 0:
        print(0)
        continue
    if x&(1<<i):
        tmp = (x_pop_m - pows_of_2[i])%(pops - 1)
    else:
        tmp = (x_pop_p + pows_of_2[i]) % (pops + 1)
    #print(tmp)
    if tmp == 0:
        print(1)
        continue
    cnt = 2
    tmp_pop = popcount(tmp)
    if tmp_pop == 0:
        print(cnt-1)
        continue
    tmp = tmp % tmp_pop
    while tmp > 0:
        cnt += 1
        tmp_pop = popcount(tmp)
        if tmp_pop == 0:
            print(cnt-1)
            continue
        tmp %= tmp_pop
    print(cnt)
    #print()

### FIXED CODE ###

n = int(input())
s = input()
x = int(s, 2)
pcx = s.count("1")
pc1 = x % (pcx - 1) if pcx > 1 else 0
pc2 = x % (pcx + 1)

def f(j):
    cnt = 0
    while j:
        j %= bin(j).count("1")
        cnt += 1
    return cnt

for i, y in enumerate(s):
    k = n - 1 - i
    if y == "0":
        print(f((pc2 + pow(2, k, pcx + 1)) % (pcx + 1)) + 1)
    elif pcx > 1:
        print(f((pc1 - pow(2, k, pcx - 1)) % (pcx - 1)) + 1)
    else:
        print(0)
### BUGGY CODE ###

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

ans = 0

for i in range(N):
    check = P[:i+1]
    if min(check) == P[i]:
        ans += 1

print(ans)

### FIXED CODE ###

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

ans = 0
check = 10**9 + 7

for i in range(N):
    if check > P[i]:
        ans += 1
        check = P[i]

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

import copy

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

for i in range(N):
        tmp = copy.copy(sequences)
        tmp.pop(i)
        print(max(tmp))

### FIXED CODE ###

import copy
import numpy as np
N = int(input())
sequences = [int(input()) for _ in range(N)]
np_sequences = np.array(sequences)
max_index = np_sequences.argmax()
for i in range(N):
        if i != max_index:
            print(sequences[max_index])
        else:
            tmp = copy.copy(sequences)
            tmp.pop(i)
            tmp_set = set(tmp)
            print(max(tmp_set))
### BUGGY CODE ###

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


set1 = set(list1)


listans = []

for i in set1:
  if list1.count(i) > 1 and list1.count(i) < 4:
    listans.append(i)
  elif list1.count(i) >3:
    listans.append(i)
    listans.append(i)


if len(listans) < 2:
  print(0)
else:
  print(sorted(listans)[-1]*sorted(listans)[-2])

### FIXED CODE ###

n = int(input())
list1 = [int(x) for x in input().split()]
list2 = list(reversed(sorted(list1)))

fflag = 0
ans = []
for i in range(len(list2) - 1):
  if fflag ==0:
    if list2[i] == list2[i + 1]:
      ans.append(list2[i])
      fflag = 1
  elif fflag == 1:
    fflag = 0
    continue
  if len(ans) == 2:
    break

if len(ans) == 2:
  print(ans[0] * ans[1])
else:
  print(0)
### BUGGY CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

H, W = MAP()
maze = [list(input()) for _ in range(H)]
dp = [[INF]*W*H for _ in range(W*H)]

for i in range(H*W):
	for j in range(H*W):
		if maze[i//W][i%W] == "#":
			continue
		if maze[j//W][j%W] == "#":
			continue
		if i == j:
			dp[i][j] = 0
		if i + W == j:
			dp[i][j] = 1
		if i + 1 == j:
			if i%W == W - 1:
				continue
			dp[i][j] = 1
		if i - W == j:
			dp[i][j] = 1
		if i - 1 == j:
			if i%W == 0:
				continue
			dp[i][j] = 1

for i in range(W*H):
	for s in range(W*H):
		for e in range(W*H):
			if maze[i//W][i%W] == "#":
				continue
			if maze[s//W][s%W] == "#":
				continue
			if maze[e//W][e%W] == "#":
				continue
			dp[s][e] = min(dp[s][e], dp[s][i] + dp[i][e]);

ma = 0
for i in range(len(dp)):
	for j in range(len(dp[i])):
		if dp[i][j] == INF:
			continue
		ma = max(ma, dp[i][j])

print(int(ma))

### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

def main():
	H, W = MAP()
	maze = [list(input()) for _ in range(H)]
	dp = [[INF]*W*H for _ in range(W*H)]

	for i in range(H*W):
		for j in range(H*W):
			if maze[i//W][i%W] == "#":
				continue
			if maze[j//W][j%W] == "#":
				continue
			if i == j:
				dp[i][j] = 0
			if i + W == j:
				dp[i][j] = 1
			if i + 1 == j:
				if i%W == W - 1:
					continue
				dp[i][j] = 1
			if i - W == j:
				dp[i][j] = 1
			if i - 1 == j:
				if i%W == 0:
					continue
				dp[i][j] = 1

	for i in range(W*H):
	    for j, c2 in enumerate(row[i] for row in dp):
	           for k, (c1, c3) in enumerate(zip(dp[j], dp[i])):
	               if c1 > c2+c3:
	                   dp[j][k] = c2+c3

	ma = 0
	for i in range(len(dp)):
		for j in range(len(dp[i])):
			if dp[i][j] == INF:
				continue
			ma = ma if ma > dp[i][j] else dp[i][j]

	print(int(ma))

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

from collections import deque
N,Q=map(int,input().split())
nondirtree=[[] for _ in range(N)]
dirtree=[[] for _ in range(N)]
rootflag=[0]*N
rootflag[0]=1
for i in range(N-1):
    a,b=map(int,input().split())
    nondirtree[a-1].append(b-1)
    nondirtree[b - 1].append(a - 1)
points=[list(map(int,input().split())) for _ in range(Q)]
#print(points)
v=0
d=deque()
d.append(v)
seen=[0]*N
seen[0]=1
score=[0]*N
ans=[0]*N
while len(d)!=0:
    v=d.popleft()
    for j in nondirtree[v]:
        if seen[j]==0:
            dirtree[v].append(j)
            seen[j]=1
            d.append(j)
    #print(d,seen,dirtree)
    #input(
#print(dirtree)
for i in range(Q):
    score[points[i][0]-1]=score[points[i][0]-1]+points[i][1]
#print(score)
v=0
d=deque()
d.append(v)
for i in range(N):
    dirtree[i]=tuple(dirtree[i])
dirtree=tuple(dirtree)
#print(dirtree)
ans[0]=score[0]
while len(d)!=0:
    v=d.popleft()
    for j in dirtree[v]:
        ans[j]=ans[v]+score[j]
        d.append(j)
    #input()
    #print(ans)
print(*ans,sep=" ")


### FIXED CODE ###

from collections import deque
N,Q=map(int,input().split())
nondirtree=[[] for _ in range(N)]
dirtree=[[] for _ in range(N)]
rootflag=[0]*N
rootflag[0]=1
for i in range(N-1):
    a,b=map(int,input().split())
    nondirtree[a-1].append(b-1)
    nondirtree[b - 1].append(a - 1)
points=[list(map(int,input().split())) for _ in range(Q)]
#print(points)
v=0
d=deque()
d.append(v)
seen=[0]*N
seen[0]=1
score=[0]*N
ans=[0]*N
while len(d)!=0:
    v=d.popleft()
    for j in nondirtree[v]:
        if seen[j]==0:
            dirtree[v].append(j)
            seen[j]=1
            d.append(j)
    #print(d,seen,dirtree)
    #input(
#print(dirtree)
for i in range(Q):
    score[points[i][0]-1]=score[points[i][0]-1]+points[i][1]
#print(score)
v=0
d=deque()
d.append(v)
ans[0]=score[0]
while len(d)!=0:
    v=d.popleft()
    for j in dirtree[v]:
        ans[j]=ans[v]+score[j]
        d.append(j)
    #input()
    #print(ans)
print(*ans,sep=" ")
### BUGGY CODE ###

N, K = map(int,input().split())
t = []

for _ in range(N):
    a,b = map(int,input().split())
    for j in range(b):
        t.append(a)
t.sort()

print(t[K-1])

### FIXED CODE ###

N, K = map(int,input().split())
a_max = 100000
t = [0 for _ in range(a_max)]

for _ in range(N):
    a, b = map(int,input().split())
    t[a-1] += b

cnt = 0
for i in range(a_max):
    cnt += t[i]
    if cnt >= K:
        ans = i+1
        break

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

n = int(input())
nums = list(map(int, input().split()))
meds = []
for i in range(n):
    temp = list(nums)
    temp.pop(i)
    temp = sorted(temp)
    meds.append(temp[(n+1)//2-1])
for i in meds:
    print(i)


### FIXED CODE ###

n = int(input())
a = [int(x) for x in input().split()]
x = sorted(a)
m1 = x[n // 2]
m2 = x[n // 2 - 1]
for i in range(n):
    if a[i] < m1: print(m1)
    else: print(m2)
### BUGGY CODE ###

# 想定解法1

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()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

AB = []
for a in A:
  for b in B:
    AB.append(a+b)

AB.sort(reverse=True)
AB = AB[:K]

ABC = []
for ab in AB:
  for c in C:
    ABC.append(ab+c)

ABC.sort(reverse=True)
ABC = ABC[:K]

for ans in ABC:
  print(ans)

### FIXED CODE ###

import bisect

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()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

YZ = Y*Z
BC = []
for b in B:
  for c in C:
    BC.append(b+c)

BC.sort()
def check(S):
  count = 0
  left = X*Y*Z
  for a in A:
    count += YZ - bisect.bisect_left(BC, S-a)
    left -= YZ
    if count >= K or count+left < K:
      break
  
  return count >= K



Sl = 0
Sr = A[0]+B[0]+C[0]+1

while Sr - Sl > 1:
  mid = (Sl + Sr) // 2
  if check(mid):
    Sl = mid
  else:
    Sr = mid

Ans = []
for a in A:
  for b in B:
    if a + b + C[0] < Sr:
      break
    for c in C:
      if a + b + c >= Sr:
        Ans.append(a+b+c)
      else:
        break

Ans.sort(reverse=True)
Ans = Ans + [Sl]*(K-len(Ans))
for ans in Ans:
  print(ans)
### BUGGY CODE ###

import copy
n = int(input())
integer = list(map(int, input().split()))
length = len(integer)
count = 0
for i in range(length):
  tmp = copy.copy(integer)
  del(tmp[i])
  for j in range(length-2):
    for k in range(j+1, length-1):
      if tmp[j] == tmp[k]:
        count += 1      
  print(count)
  count = 0

### FIXED CODE ###

from collections import Counter

n = int(input())
integer = list(map(int, input().split()))
length = len(integer)
counter = Counter(integer)
keys = counter.keys()
total = 0
for key in keys:
  total += counter[key] * ( counter[key] -1 ) / 2
total = int(total)

for i in integer:
  tmp = total
  tmp -= counter[i] - 1
  print(tmp)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

A,B,N = map(int, input().split())
z = 0

for x in range(1,B+1):
    ans = (x % B) / B * A
    if ans > z:
        z = ans
    if x > N-1:
        break
print(int(z))

### FIXED CODE ###

# -*- coding: utf-8 -*-

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

if N >= B:
    x  = B - 1
    z = (A * x) // B - A * (x // B)
else:
    x = N
    z = (A * x) // B - A * (x // B)

print(int(z))
### BUGGY CODE ###

n=int(input())
a=[[0]*n]*n
s=set()

for i in range(n):
  a[i]=[int(x)-1 for x in input().split()]

t=0
f=True
while f==True:
  f=False
  s.clear()
  for i in range(n):
    if len(a[i])==0:
      continue
    f=True
    if len(a[a[i][0]])==0:
      continue
    if i==a[a[i][0]][0]:
      s.add(i)
      s.add(a[i][0])

  if f==False:
    break

  if len(s)!=0:
    t+=1
    l = list(s)
    for i in range(len(l)):
      a[l[i]].pop(0)
  else:
    t = -1
    break
print(t)


### FIXED CODE ###

from collections import deque

def main():
  N=int(input())
  A=[deque(int(a)-1 for a in input().split()) for _ in range(N)]

  P,W=[0]*N,[-1]*N
  c=deque(range(N))

  while c:
    i=c.popleft()
    j=A[i].popleft()
    W[i]=j

    if W[j]==i:
      P[i]=P[j]=max(P[i],P[j])+1
      if A[i]:
        c.append(i)
      if A[j]:
        c.append(j)

  print(-1 if any(len(a) for a in A) else max(P))

main()
### BUGGY CODE ###

h,w,m=map(int,input().split())
h_=[0]*(h+1)
w_=[0]*(w+1)
plot=[]
for _ in range(m):
    x,y=map(int,input().split())
    h_[x]+=1
    w_[y]+=1
    plot.append((x,y))
x=max(h_)
y=max(w_)
a=[i for i,v in enumerate(h_) if v==x]
b=[j for j,q in enumerate(w_) if q==y]
ans=x+y-1
c=False
for i in a:
    for j in b:
        if (i,j) not in plot:
          c=True
          break
    if c:
      break
if c:
  print(ans+1)
else:
  print(ans)
          
        
        


### FIXED CODE ###

h,w,m=map(int,input().split())
h_=[0]*(h+1)
w_=[0]*(w+1)
plot=set()
for _ in range(m):
    x,y=map(int,input().split())
    h_[x]+=1
    w_[y]+=1
    plot.add((x,y))
x=max(h_)
y=max(w_)
a=[i for i,v in enumerate(h_) if v==x]
b=[j for j,q in enumerate(w_) if q==y]
ans=x+y-1
c=False
for i in a:
    for j in b:
        if (i,j) not in plot:
          c=True
          break
    if c:
      break
if c:
  print(ans+1)
else:
  print(ans)