Harryxun/stf_run huggingface dataset:
from collections import defaultdict
from operator import sub

def main():
    N = int(input())
    balls = [tuple(map(int,input().split())) for _ in range(N)]
    d = defaultdict(int)
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            d[tuple(map(sub, balls[i], balls[j]))] += 1
    try:
        mmax = max(d.values())
        mmax = int(N - mmax)
    except:
        print(100)
    print(N)
    print(mmax)


if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import defaultdict
from operator import sub

def main():
    N = int(input())
    balls = [tuple(map(int,input().split())) for _ in range(N)]
    d = defaultdict(int)
    for i in range(N):
        for j in range(N):
            if i == j:
                continue
            d[tuple(map(sub, balls[i], balls[j]))] += 1
    try:
        mmax = N - max(d.values(), default=0)
        print(mmax)
    except ValueError:
        print(100)

if __name__ == '__main__':
    main()
h, w, m = map(int, input().split())
s = [[False] * w for _ in range(h)]
num_h = [0] * h
num_w = [0] * w
for _ in range(m):
    hi, wi = map(int, input().split())
    hi -= 1
    wi -= 1
    s[hi][wi] = True
    num_h[hi] += 1
    num_w[wi] += 1
max_h_list = []
max_h_val = 0
max_w_list = []
max_w_val = 0
for hi in range(h):
    if num_h[hi] > max_h_val:
        max_h_list = [hi]
        max_h_val = num_h[hi]
    elif num_h[hi] == max_h_val:
        max_h_list.append(hi)
for wi in range(w):
    if num_w[wi] > max_w_val:
        max_w_list = [wi]
        max_w_val = num_w[wi]
    elif num_w[wi] == max_w_val:
        max_w_list.append(wi)

for max_hi in max_h_list:
    for max_wi in max_w_list:
        if s[max_hi][max_wi] == False:
            print(max_h_val + max_w_val)
            exit()
print(max_h_val + max_w_val - 1)


### FIXED CODE ###

h, w, m = map(int, input().split())
s = dict()
num_h = [0] * h
num_w = [0] * w
for _ in range(m):
    hi, wi = map(int, input().split())
    hi -= 1
    wi -= 1
    s[(hi, wi)] = True
    num_h[hi] += 1
    num_w[wi] += 1
max_h_list = []
max_h_val = 0
max_w_list = []
max_w_val = 0
for hi in range(h):
    if num_h[hi] > max_h_val:
        max_h_list = [hi]
        max_h_val = num_h[hi]
    elif num_h[hi] == max_h_val:
        max_h_list.append(hi)
for wi in range(w):
    if num_w[wi] > max_w_val:
        max_w_list = [wi]
        max_w_val = num_w[wi]
    elif num_w[wi] == max_w_val:
        max_w_list.append(wi)

if len(max_h_list) * len(max_w_list) > m:
    print(max_h_val + max_w_val)
    exit()
for max_hi in max_h_list:
    for max_wi in max_w_list:
        if s.get((max_hi, max_wi), False) == False:
            print(max_h_val + max_w_val)
            exit()
print(max_h_val + max_w_val - 1)
n,k=map(int,raw_input().split())
a=map(int,raw_input().split())
aa=len(set(a))

div=max(0,int(aa)-k)
res = [(a.count(e),e) for e in aa if a.count(e) > 0]
resl=sorted(res,key=lambda x:x[0],reverse=True)
ans=0
while div>0:
    ans+=resl[-1][0]
    resl.pop()
    div=div-1

print ans


### FIXED CODE ###

import heapq

n,k=map(int,raw_input().split())
a=map(int,raw_input().split())



d={}
for i in a:
    if i in d:
        d[i]+=1
    else:
        d[i]=1
l=d.values()
div=max(0,len(l)-k)
if div==0:
    print 0
    exit()


heapq.heapify(l)

ans=0
while div>0:
    ans+=heapq.heappop(l)
    div-=1
print ans
import sys
import os
sys.setrecursionlimit(100000000)
def lcm(x,y):
    return (x*y)//gcd(x,y)

def gcd(x,y):
    if y <= 0:
        return x
    else:
        return gcd(y,x%y)

N = int(input())
T = [int(input()) for _ in range(N)]
ans = lcm(T[0],T[1])
for i in range(2,N):
    ans = lcm(ans,T[i])
print(ans)


### FIXED CODE ###

import sys
import os
sys.setrecursionlimit(100000000)

def lcm(x,y):
    return (x*y)//gcd(x,y)

def gcd(x,y):
    if y <= 0:
        return x
    else:
        return gcd(y,x%y)

N = int(input())
T = [int(input()) for _ in range(N)]
if N == 1:
    print(T[0])
    sys.exit()

ans = lcm(T[0],T[1])
for i in range(2,N):
    ans = lcm(ans,T[i])
print(ans)
def main():
    n = int(input())
    
    if n//100 == 7:
        return "Yes"
    
    n %= 100
    if n // 10 == 7:
        return "Yes"
    
    n %= 10
    if n == 7:
        return "Yes"
    
    return "No"


if __name__ == '__main__':
    print main()

### FIXED CODE ###

def qqq(n):

    a = int(n/100)
    if a == 7: 
        return "Yes" 
    
    n %= 100
    b = int(n/10)
    if b == 7:
        return "Yes"
    
    n %= 10
    if n == 7:
        return "Yes"

    return "No"

if __name__ == '__main__':
    N = int(raw_input())
    print qqq(N)
# coding: utf-8
import math
H, W = (int(x) for x in input().split())

convert = [[int(x) for x in input().split()] for _ in range(10)]
table = [[int(x) for x in input().split()] for _ in range(H)]

conv_to_one = [0] * 10
for i in [x for x in range(10) if (x != 1)]:
    distance = [math.inf for _ in range(10)]
    distance[i] = 0
    not_reached = list(range(10))
    
    while (1 in not_reached):
        min_distance = math.inf
        new_reached = None
        for num in not_reached:
            if (distance[num] < min_distance):
                min_distance = distance[num]
                new_reached = num
        not_reached.remove(new_reached)

        for num in not_reached:
            if min_distance + convert[new_reached][num] < distance[num]:
                distance[num] = min_distance + convert[new_reached][num]
    conv_to_one[i] = distance[1]

count = [0] * 10
for row in table:
    for elem in row:
        if elem != -1:
            count[elem] += 1


result = sum([cnt * cnv for cnt,cnv in zip(count, conv_to_one)])
print(result)

### FIXED CODE ###

    # coding: utf-8
H, W = (int(x) for x in input().split())
 
convert = [[int(x) for x in input().split()] for _ in range(10)]
table = [[int(x) for x in input().split()] for _ in range(H)]
 
conv_to_one = [0] * 10
for i in [x for x in range(10) if (x != 1)]:
    distance = [float("inf") for _ in range(10)]
    distance[i] = 0
    not_reached = list(range(10))
    
    while (1 in not_reached):
        min_distance = float("inf")
        new_reached = None
        for num in not_reached:
            if (distance[num] < min_distance):
                min_distance = distance[num]
                new_reached = num
        not_reached.remove(new_reached)
 
        for num in not_reached:
            if min_distance + convert[new_reached][num] < distance[num]:
                distance[num] = min_distance + convert[new_reached][num]
    conv_to_one[i] = distance[1]
 
count = [0] * 10
for row in table:
    for elem in row:
        if elem != -1:
            count[elem] += 1
 
 
result = sum([cnt * cnv for cnt,cnv in zip(count, conv_to_one)])
print(result)
a

### FIXED CODE ###

N = int(input())
n = []
for i in range(N):
  n.append(int(input()))

a = 1
c = -1

for i in range(N):
  a = n[a-1]
  if a == 2:
    if c < 0:
      c = (i+1)

print(c)
cards = ([False in i in range(13)] for j in range(4))
pattern = ['S','H','C','D']

n = int(input())

for i in range(n):
  x, y = input().split()
  y = int(y)
  cards = [patterrn.index(x)][y-1]
  
for i in range(4):
  for j in range(13):
    if cards[i][j] == False:
      print(pattern[i][j-1])


### FIXED CODE ###

n = int(input())
card =[i+" "+str(j) for i in ["S","H","C","D"] for j in range(1,14)]
for i in range(n):
    card.remove(input())
for i in card:
    print(i)
input()
from collections import *
c=Counter(map(int,input().split()))
a=sorted(-k for k,v in c.items() if v>3)
if a: s=a[0]**2
l=sorted(-k for k,v in c.items() if v>1)
print(0 if len(l)<2 else max(s,l[0]*l[1]))

### FIXED CODE ###

input()
from collections import *
c=Counter(map(int,input().split()))
a=0
r=sorted(-k for k,v in c.items() if v>1)
if len(r)>1: a=r[0]*r[1]
s=sorted(-k for k,v in c.items() if v>3)
if s: a=max(a,s[0]**2)
print(a)
S = input()
T = input()

print(S+T)

### FIXED CODE ###

S, T = input().split()
print(T+S)
import math
import sys

for line in sys.stdin:
	x,y = [int(s) for s in line.split(' ')]
	G = math.gcd(x,y)
	L = int(x*y/G)
	print(G,L)

### FIXED CODE ###

def pd(n):
    i = 2
    ans = []
    while i ** 2 <= n:
        while n % i == 0:
            n /= i
            ans.append(i)
        i += 1
    if n > 1:
        ans.append(n)
    return ans

def gcd(a, b):
    gcd = 1
    pd_a = pd(a)
    pd_b = pd(b)
    for i in pd_a:
        if i in pd_b:
            pd_b.remove(i)
            gcd *= i
    return int(gcd)

def lcm(a, b):
    lcm = a
    pd_a = pd(a)
    pd_b = pd(b)
    for i in pd_a:
        if i in pd_b:
            pd_b.remove(i)
    for j in pd_b:
        lcm *= j
    return int(lcm)

while True:
    try:
        s = input()
        a,b = [int(i) for i in s.split(' ')]
    except:
        break
    print(gcd(a, b), lcm(a, b))
import sys
N=int(input())
# N=50

p = []
for n in range(N):
    x,y = map(int,input().split())
    # x,y = n,n
    p.append( (x,y) )

#空のリストを用意
e = set()  #部分最小木
av = set()  #部分最小木に含まれる頂点
pv = set(p)  #その他の頂点

used = {}
for pp in p:
    used[pp] = 1
used[p[0]] += 1

#始点は任意
av.add(p[0])
pv.remove(p[0])

costs = 0
while 1:
    #比較のための初期値として十分大きい数を用意
    shortestlen = sys.float_info.max
    #部分最小木に追加する辺を為す2点の初期化
    kav = None  #部分最小木に含まれる頂点からの候補
    kpv = None  #その他の頂点からの候補
    for v1 in av:
        for v2 in pv:
            #重みの計算（ここでは距離）
            dist = 1 if (v1[0]==v2[0] or v1[1] == v2[1]) else 0
            # dist = math.sqrt(  (v1[0]-v2[0])**2 + ( v1[1]-v2[1] )**2 )
            if shortestlen > dist and used[v1] > 0:
                shortestlen = dist
                #候補の更新
                kav = v1
                kpv = v2
    if shortestlen >= 0:
        #部分最小木に追加
        costs += shortestlen
        e.add((kav , kpv))
        used[kav] -= 1
    #確定した頂点を移す
    av.add(kpv)
    pv.remove(kpv)
    #全頂点に対する判定を終えたら終了
    if len(pv) == 0:
        break

print(costs+1)
# print(e)

### FIXED CODE ###

import sys
N=int(input())
# N=50

p = []
for n in range(N):
    x,y = map(int,input().split())
    # x,y = n,n
    p.append( (x,y) )

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

p = list(sorted(p))

diffs = {}
for i,pi in enumerate(p):
    for j,pj in enumerate(p):
        if i < j:
            diff = (pi[0]-pj[0], pi[1]-pj[1])
            if diff not in diffs:
                diffs[diff] = 0
            diffs[diff] += 1

mxdiff = 0
for k in diffs:
    mxdiff = max(mxdiff, diffs[k])
print(N-mxdiff)
a,b=map(int, input().split())
if (a%3 == 0) or (b%3 == 0) or (sum(a,b)%3== 0):
  print("Possible")
else:
  print("Impossible")

### FIXED CODE ###

a,b=map(int, input().split())
if ((a%3 == 0) or (b%3 == 0)) or ((a + b)%3== 0):
  print("Possible")
else:
  print("Impossible")
n = int(input())
book=[]
for i in range(n):
    a,b=input().split()
    temp=[a,int(b),i+1]
    book.append(temp)

book.reverse(key = lambda x:x[1])
book.sort(key = lambda x:x[0])

for j in range(len(book)):
    print(book[j][2])

### FIXED CODE ###

n = int(input())
l = [input().split()+[i+1] for i in range(n)]
for i in range(n):
    l[i][1] = int(l[i][1])
l = sorted(l, key=lambda x : x[1], reverse=True)
l = sorted(l, key=lambda x : x[0])
for i in range(n):
    print(l[i][2])
N, T = map(int,input().split())
mincost = 1001
for i in range(1, N+1):
    c, t = map(int,input().split())
    if t <= T:
        cost = c
        if cost < mincost:
            mincost = cost

if mincost == 1001:
  print('TLE')
if mincost < 1001:
  print(mincost)


### FIXED CODE ###

N = int(input())

if N == 1:
    print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A+B)
H,W=map(int,input().split())
h,w–map(int,input().split())
print(H*W-H*w-h*W+h*w)

### FIXED CODE ###

H,W=map(int,input().split())
h,w=map(int,input().split())
print(H*W-H*w-h*W+h*w)
ソースコード 拡げる

Copy
Copy
N = int(input())
count = 0
for i in range(N):
    c = 2**count
    if c > N:
        print(c//2)
        exit()
    else:
        count +=1

### FIXED CODE ###

c = str(input())
print("ABC"+c)
s=input()
n=int(input())
for i in range(n):
    k= input().split()
    if k=="1":
        s = s[::-1] 
    else:
        if k[1]=="2":
            s=s+k[2]
        else:
            s=k[2]+s
print(s)

### FIXED CODE ###

S = input()
Q = int(input())
reverseCount = 0
pre = ""
pro = ""
for _ in range(Q):
    query = input()
    if len(query) == 1:
        reverseCount += 1
    else:
        _, F, C = query.split(" ")
        if (int(F) + reverseCount) % 2 == 1:
            pre = C + pre
        else:
            pro = pro + C
S = pre + S + pro
if reverseCount % 2 == 0:
    print(S)
else:
    print(S[::-1])
a,b,c = int(input().split())

if a == b == c:
  print('No')
elif a != b and b != c and a != c:
  print('No')
elif a == b and a != c:
  print('Yes')
elif a == c and a != b:
  print('Yes')
elif b == c and a != b:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a,b,c = input().split()

if a == b == c:
  print('No')
elif a != b and b != c and a != c:
  print('No')
elif a == b and a != c:
  print('Yes')
elif a == c and a != b:
  print('Yes')
elif b == c and a != b:
  print('Yes')
else:
  print('No')
n, k, m = map(int, input().split())
l = list(map(int, input().split()))

A = n*m - sum(l)

print(max(0, A) if A <= k else -1)

### FIXED CODE ###

print(chr(ord(input())+1))
print(x ** 3)

### FIXED CODE ###

x = input()
print(int(x) ** 3)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

from collections import deque
import bisect
import sys

# 準備
idx = 0
charcode_mapper = {}
for ch in "abcdefghijklmnopqrstuvwxyz":
    charcode_mapper[ch] = idx
    idx += 1

s = input().strip()  # e.g., "contest"
t = input().strip()  # e.g., "son"
# s = "contest"
# t = "son"
# t = "programming"
# t = "sentence"

# s 中の文字の出現順序を保持する (本当は一行でできそう)
# こういうリストを作る (イメージ)
# [
#     [x, y],  # a の出現位置
#     [z],     # b の出現位置
#     ...,
#     [i, j]   # z の出現位置
# ]
char_idx = 0
char_positions = [[] for _ in range(26)]  # 26文字分


def extend_char_positions():
    global char_idx
    for ch in s:
        char_positions[charcode_mapper[ch]].append(char_idx)
        char_idx += 1


extend_char_positions()
extend_char_positions()

# print(charcode_mapper)
# print(char_positions)

# idx を 0 とする
# t の文字をなめていき、char_positions の idx より先にその文字が存在するかどうか確認する
#   あれば)
#     idx をそこまで進める
#     `(len(s)  - idx) < len(t)` であれば char_positions を伸ばす
#   なければ)
#     return -1

idx = 0
for ch in t:
    charcode = charcode_mapper[ch]
    idx = bisect.bisect_left(
        char_positions[charcode],
        idx,
        0,
        len(char_positions[charcode])
    )
    # print(ch)  # s
    # print(char_positions[charcode])  # [5, 12]
    try:
        idx = char_positions[charcode][idx]
    except IndexError:
        print('-1')
        sys.exit(1)
    # print(idx)
    if len(s) - idx < len(t):
        extend_char_positions()


print(idx + 1)


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
from bisect import bisect_left

s = input().strip()  # e.g., "contest"
t = input().strip()  # e.g., "son"
# s = "contest"
# t = "son"
# t = "programming"
# t = "sentence"

# 文字列 s 二周分の文字の出現位置マップを作る
s_map = [[] for _ in range(26)]
for i, ch in enumerate((s + s)):
    s_map[ord(ch) - ord('a')].append(i)

# t を舐めながら回答を作る
p = ans = 0
for ch in t:
    ch_position_list = s_map[ord(ch) - ord('a')]
    if len(ch_position_list) == 0:
        print('-1')
        sys.exit()

    p = ch_position_list[bisect_left(ch_position_list, p)] + 1
    if len(s) <= p:
        ans += len(s)
        p -= len(s)

ans += p
print(ans)
import sys
input = sys.stdin.readline

def topological_sort(graph):
  in_cnt = {k:0 for k in nodes}
  for x in nodes:
    for y in graph[x]:
      in_cnt[y] += 1
  ret = []
  q = deque([i for i in nodes if not in_cnt[i]])
  while q:
    x = q.popleft()
    ret.append(x)
    for y in graph[x]:
      in_cnt[y] -= 1
      if not in_cnt[y]:
        q.append(y)
  if [i for i in nodes if in_cnt[i]]:
    return None
  return ret

N = int(input().strip())
from itertools import combinations
nodes = list(combinations(range(N), 2))
graph = {i:set() for i in nodes}
for x in range(N):
  l = list(map(int,input().split()))
  y = l[0]-1
  prev = (min(x,y),max(x,y))
  for y in l[1:]:
    y -= 1
    now = (min(x,y),max(x,y))
    graph[prev].add(now)
    prev = now

ans = topological_sort(graph)
if not ans:
  print(-1)
else:
  d = {i:1 for i in nodes}
  for x in ans:
    for y in graph[x]:
      d[y] = max(d[x]+1,d[y])
  print(max(d[i] for i in nodes))

### FIXED CODE ###

import sys
input = sys.stdin.readline

N = int(input().strip())
M = N*(N-1)//2

graph = [[] for i in range(M)]
in_cnt = [0 for i in range(M)]
for x in range(1,N+1):
  l = list(map(int,input().split()))
  y = l[0]
  b,s = max(x,y),min(x,y)
  prev = (b-1)*(b-2)//2+s-1
  for y in l[1:]:
    b,s = max(x,y),min(x,y)
    now = (b-1)*(b-2)//2+s-1
    graph[prev].append(now)
    in_cnt[now] += 1 
    prev = now

d = [1 for k in range(M)]
q = [i for i in range(M) if not in_cnt[i]]

if not q:
  print(-1)
  exit()
ans = 0
while q:
  x = q.pop()
  for y in graph[x]:
    d[y] = max(d[y],d[x]+1)
    ans = max(ans,d[y])
    in_cnt[y] -= 1
    if not in_cnt[y]:
      q.append(y)
if [i for i in range(M) if in_cnt[i]]:
  print(-1)
  exit()

print(ans)
from itertools import combinations
import numpy as np

def resolve():
  N, M, X = map(int, input().split(" "))

  books = []
  for i in range(N):
    CA = [int(x) for x in input().split(" ")]
    books.append(CA)

  books = np.array(books)

  books_index_pattarns = [list(x) for i in range(1, N) for x in combinations(range(0, N), i)]
  books_result = np.array([np.sum(books[x], axis=0) for x in books_index_pattarns])
  books_result = books_result[np.all(books_result[:,1:] >= X, axis=1)][:,:1]
  if len(books_result) == 0:
    print("-1")
    return True
  else:
    print(books_result.min())

if __name__ == "__main__":
    resolve()

### FIXED CODE ###

from itertools import product
from itertools import combinations
import numpy as np

def resolve():
  N, M, X = map(int, input().split(" "))

  books = []
  for i in range(N):
    CA = [int(x) for x in input().split(" ")]
    books.append(CA)

  books = np.array(books)


  if N == 1:
    if np.all(books[:, 1:] >= X):
      print(books[0][0])
    else:
      print(-1)
    return True
  books_index_pattarns = [list(x) for i in range(1, N+1) for x in combinations(range(0, N), i)]
  books_result = np.array([np.sum(books[x], axis=0) for x in books_index_pattarns])
  books_result = books_result[np.all(books_result[:,1:] >= X, axis=1)]

  if len(books_result) == 0:
    print(-1)
    return True
  elif len(books_result) == 1:
    print(books_result[0][0])
    return True
  else:
    # print(books_result)
    print(books_result[:,:1].min())
    return True

if __name__ == "__main__":
    resolve()
ls = lisr(input())
c = ls.count('1')
print(c)

### FIXED CODE ###

ls = list(input())
c = ls.count('1')
print(c)
a,b = map(int,input().split())
if a<10 nad b<10:
  print(a*b)
else:
  print("-1")

### FIXED CODE ###

a,b = map(int,input().split())
if a<10 and b<10:
  print(a*b)
else:
  print("-1")
from collections import Counter
n = int(input())
v = list(map(int,input().split()))
odd = v[::2 ]
even = v[1::2]
# def count(aaa):
#     if len(set(aaa))!=1:
#         aaa_max = Counter(aaa).most_common(1)[0][1]
#         aaa_min = len(aaa)-aaa_max
#         most_aaa = Counter(aaa).most_common(1)[0][0]
#     else:
#         aaa_min = 0
#         most_aaa = set(aaa)[0]
#     return int(aaa_min),most_aaa
if len(set(v))==1:
    print(int(n/2))
else:
    if len(set(even))!=1:
        even_max = Counter(even).most_common(1)[0][1]
        even_min = len(even)-even_max
        even_most = Counter(even).most_common(1)[0][0]
    else:
        even_min = 0
        even_most = even[0]
    if len(set(odd))!=1:
        odd_most = Counter(odd).most_common()
        for key in odd_most:
            if key[0]!=even_most:
                odd_max = key[1]
                dd_min = len(odd)-odd_max
                break
    else:
        odd_most = odd[0]
        if odd_most != even_most:
            odd_min = 0
        else:
            odd_min = len(odd)
    print(even_min+odd_min)

### FIXED CODE ###

from collections import Counter
 
n = int(input())
v = list(map(int,input().split()))
ac = Counter(v[::2]).most_common(2)
bc = Counter(v[1::2]).most_common(2)


if ac[0][0] != bc[0][0]:           
    ans =  n - ac[0][1] - bc[0][1] 
else:                               
    if len(bc) == 1 or len(ac) == 1:
        ans = n // 2
    else: 
        ans = n - max(ac[0][1] + bc[1][1], ac[1][1] + bc[0][1])
print(ans)
from collections import Counter

N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
two = []
four = []

for i, cnt in Counter(A).items():
    if cnt >= 4:
        four.append(i)
    if 4 > cnt >= 2:
        two.append(i)
    if len(two) >= 2:
        break

if two:
    if four:
        print(max(two[0]*two[1], four[0]*four[0]))
    else:
        print(two[0]*two[1])
else:
    print(0)

### FIXED CODE ###

from collections import Counter

N = int(input())
A = list(map(int, input().split()))
h = w = 0

for i, cnt in Counter(A).items():
    if cnt >= 2 and i > w:
        if i > h:
            if cnt >= 4:
                h = i
                w = i
            else:
                w = h
                h = i
        else:
            w = i
            
print(w * h)
n=int(input())
s=[''.join(sorted(input())) for i in range(n)]
ans=0
dict={}
for i in s:
    if i in dict:
        ans+=dict[s]
        dict[s]+=1
    else:
        dict[s]=1
print(ans)

### FIXED CODE ###

n=int(input())
s=[''.join(sorted(input())) for i in range(n)]
ans=0
dict={}
for i in s:
    if i in dict:
        ans+=dict[i]
        dict[i]+=1
    else:
        dict[i]=1
print(ans)
A = int(input())
B = int(input())
C = int(input())
X = int(input())
a = X//(500*A)
b = X//(100*B)
c = X//(50*C)
ans = 0
for l in range(a+1):
    for m in range(b+1):
        for n in range(c+1):
            if 500*l+100*m+50*n ==X:
                ans += 1
print(ans)

### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for l in range(A+1):
    for m in range(B+1):
        for n in range(C+1):
            if 500*l+100*m+50*n ==X:
                ans += 1
print(ans)
import numpy as np
N = int(input())
A = list(map(int, input().split()))

x = np.identity(N)
y = np.identity(N)
y0 = y[0]
y = np.reshape(np.append(np.delete(y, 0, 0), y0), (N, N))
a = (x + y) / 2

b = np.array(A)
b = b.reshape((1, N))
b = b.transpose()

ans = np.linalg.solve(a, b)
ans = [int(n) for n in ans]

print(" ".join(map(str, ans)))


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
X = [0] * N

X[0] = sum(A) - 2 * (sum([A[i] for i in range(N) if i % 2 == 1]))

for i in range(N - 1):
	X[i + 1] = 2 * A[i] - X[i]

print(" ".join(map(str, X)))
S = set(input())
def i():
  if S = [AAA]
  print('No')
  elif S = [BBB]
  print('No')
  else:
    print('Yes')
  return

def i()

### FIXED CODE ###

input_line = input()
X = str(input_line)
if (X) == ('AAA'):
  print('No')
elif (X) == ('BBB'):
    print('No')
else:
	print('Yes')
# 初期入力
import sys
from collections import defaultdict
import numpy as np
input = sys.stdin.readline  #文字列では使わない
H,W,M = map(int, input().split())
bomb =np.zeros((H,W))
posision =defaultdict(int)

for i in range(M):
    h,w = map(int, input().split())
    bomb[h-1,:] +=1
    bomb[:,w-1] +=1
    bomb[h-1,w-1] -=1
    posision[(h-1,w-1)] =1

#index =np.unravel_index(np.argmax(bomb), bomb.shape)
bom_max =np.max(bomb)
print(int(bom_max))

### FIXED CODE ###

import sys


H, W, M = map(int, input().split())
bomb = [tuple(map(lambda x: int(x) - 1, s.split())) for s in sys.stdin.readlines()]
X = [0] * H  # X:各行の爆破対象の個数
Y = [0] * W  # Y:各列の爆破対象の個数
for h, w in bomb:
    X[h] += 1
    Y[w] += 1
maxX = max(X)
maxY = max(Y)

R = [h for h, x in enumerate(X) if x == maxX]  # R:爆破対象の数が最大となる行の番号
C = [w for w, y in enumerate(Y) if y == maxY]  # C:爆破対象の数が最大となる列の番号

bomb = set(bomb)
for r in R:
    for c in C:
        # (r, c)に爆破対象が存在しないとき, maxX + maxY が答えとなることが確定するため, 
        # 即座に探索を終了する.
        if (r, c) not in bomb:
            print(maxX + maxY)
            exit()
print(maxX + maxY - 1)