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

class Node:
    def __init__(self):
        self.label = None
        self.left = None
        self.right = None

    def searchORinsert(self,num):
        #もしなければ、新しいノードを作る
        if self.label==None:
            self.label=num
            
            return 1

        elif  self.label>num:
                if self.left!=None:
                    return((self.left).searchORinsert(num))
                else :
                    self.left=Node()
                    return((self.left).searchORinsert(num))
                



        elif  self.label<num:
                if self.right!=None:
                    return((self.right).searchORinsert(num))
                else :
                    self.right=Node()
                   
                    return((self.right).searchORinsert(num))

                
    #あったら、警告する

        else :
            return 0






N =int(input())


l=list(map(int, input().split())) 


No=Node()
f=1
for i in l:
    
    if No.searchORinsert(i)!=1:
        f=0
        break


if f!=0:
        print("YES")

else:
        print("NO")

### FIXED CODE ###



N =int(input())


l=list(map(int, input().split())) 

l.sort()
f=1
for i in range(0,N-1):
    
    if l[i]==l[i+1]:
        f=0
        break


if f!=0:
        print("YES")

else:
        print("NO")
### BUGGY CODE ###

if __name__ == '__main__':
    N = int(input())
    order_list = list(map(int, input().split()))
    present_num_list = list(range(1, (N+1)))

    for i in range(1, (N+1)):
        print(order_list.index(i) + 1, end=" ")

### FIXED CODE ###

if __name__ == '__main__':
    N = int(input())
    order_list = list(map(int, input().split()))
    present_list = list(range(1, N+1))
    temp = zip(order_list, present_list)
    temp = sorted(temp)
    order_list, present_list = zip(*temp)
    print(' '.join(map(str,present_list)))
### BUGGY CODE ###

#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 2019
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

S = input()
nS = int(S)
N = len(S)

nums = [0]
for i in range(N):
    m = 10**(N-i-1)
    val = nS//m * m
    val %= MOD
    nums.append(val)
    nS %= m
# nums.append(0)
# nums.reverse()
# print(nums)

d = defaultdict(int)
d[0] += 1
cnt = 0
for i in range(N):
    nums[i+1] += nums[i]
    nums[i+1] %= MOD
    # print(nums[i+1])
    cnt += d[nums[i+1]]
    # print(d[nums[i+1]])
    d[nums[i+1]] += 1
# print(nums)
print(cnt)

### FIXED CODE ###

#import numpy as np
import sys, math
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial#, gcd
from bisect import bisect_left, bisect_right #bisect_left(list, value)
sys.setrecursionlimit(10**7)
enu = enumerate
MOD = 2019
def input(): return sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep='\n')

S = input()
N = len(S)

d = defaultdict(int)
d[0] += 1
# nums = [0]*(N+1)
m = 0
last = 0
dd = 1
for i in range(N):
    m += int(S[N-i-1])*dd
    m %= MOD
    # val = (int(S[i])*m + nums[i])%MOD
    # cnt += d[val]
    dd = (dd*10)%MOD
    d[m] += 1

cnt = 0
for i, v in d.items():
    cnt += v*(v-1)//2
print(cnt)
### BUGGY CODE ###

L =int(input())

if L == 1:
    print('0.037036926')
elif L==2:
     print('0.296296074')
else:
    ans =0
    for i in range(2000):
        for j in range(2000):
            ans =max(ans, i/2*j/2*(L-(i/2+j/2)))
    print(ans)

### FIXED CODE ###

L =int(input())

if L == 1:
    print('0.037036926')
elif L==2:
     print('0.296296074')
else:
    ans =0
    for i in range(100000):
        ans =max(ans, i/100*i/100*(L-(i/100+i/100)))
    print(ans)
### BUGGY CODE ###

import numpy as np
N = int(input())
A_lis = [int(input()) for _ in range(N)]

A_lis = np.array(A_lis)
for i in range(N):
    ind = np.ones(N, dtype=bool)
    ind[i] = False
    print(max(A_lis[ind]))

### FIXED CODE ###

import numpy as np
N = int(input())
A_lis = [int(input()) for _ in range(N)]

num = sorted(A_lis, reverse=True)[:2]
for i in A_lis:
    if i != num[0]:
        print(num[0])
    else:
        print(num[1])
### BUGGY CODE ###

n  = int(input())
li = list(map(int,input().split()))
ok = set()
ng = set()
mul = set()

ans = 0

for i in li:
    if i not in ok:
        ok.add(i)
    else:
        ng.add(i)

for i in ok:
    for j in range(2,10**6):
        if i*j > 10**6:
            break
        else:
            mul.add(i*j)

for i in ok:
    if i not in mul:
        if i not in ng:
            ans+=1

print(ans)

### FIXED CODE ###

n  = int(input())
li = list(map(int,input().split()))
ok = set()
ng = set()
mul = set()

ans = 0

for i in li:
    if i not in ok:
        ok.add(i)
    else:
        ng.add(i)

for i in ok:
    for j in range(2,10**6):
        if i*j > 10**6:
            break
        else:
            mul.add(i*j)

for i in ok:
    if i not in mul:
        if i not in ng:
            ans+=1

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

num =int(input())

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

_len = len(val)
sort_val = sorted(val)
set_val = set(sort_val)

res = True

if len(val) %2 != 0 and sort_val.count(0) != 1:
    res = False
elif len(val) %2 != 0 and sort_val.count(0) == 1:
    val = val[1:]
    set_val.remove(0)

for i in set_val:
    if sort_val.count(i) != 2:
        res = False
        break
    else:
        sort_val = sort_val[2:]

cnt = 1
if res:
    for i in range(0, _len//2):
        cnt = cnt*2 % 1000000007

print(0 if not res else cnt)


### FIXED CODE ###

num =int(input())

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

_len = len(val)
sort_val = sorted(val)
res = False

if len(sort_val) %2 == 0:
    tmp = sort_val[1::2]
    tmp2 = sort_val[::2]
    if sorted(tmp) == sorted(tmp2):
        res = True
else:
    if sort_val.count(0) != 1:
        pass
    else:
        del sort_val[0]
        tmp = sort_val[::2]
        tmp2 = sort_val[1::2]
        if sorted(tmp) == sorted(tmp2):
            res = True

cnt = 1
if res:
    for i in range(0, _len//2):
        cnt = cnt*2 % 1000000007

print(0 if not res else cnt)
### BUGGY CODE ###

n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
b=10**10
c=[b]*n
c[0]=0
c[1]=abs(a[1]-a[0])
for i in range(n-1):
    for j in range(i+1,min(n,i+k+1)):
        c[j]=min(c[j],c[i]+abs(a[j]-a[i]))
c[-1]=min(c[-1],c[-2]+abs(a[-2]-a[-1]))
print(c[-1])

### FIXED CODE ###

n,k=list(map(int,input().split()))
a=list(map(int,input().split()))
b=10**10
c=[b]*n
c[0]=0
c[1]=abs(a[1]-a[0])
for i in range(n-1):
    for j in range(i+1,min(n,i+k+1)):
        c[j]=min(c[j],c[i]+abs(a[j]-a[i]))
c[-1]=min(c[-1],c[-2]+abs(a[-2]-a[-1]))
print(c[-1])
### BUGGY CODE ###

R, G, B, N = map(int, input().split())
ans = 0
for r in range((N//R)+1):
    for g in range((N//G)+1):
        if (N - r*R - g*G) % B == 0 and (N - r*R - g*G) >= 0:
            ans += 1
print(ans)

### FIXED CODE ###

R, G, B, N = map(int, input().split())
ans = 0
for r in range((N//R)+1):
    for g in range((N//G)+1):
        if r*R + g*G <= N and (N - r*R - g*G) % B == 0:
            ans += 1
print(ans)
### BUGGY CODE ###

def main():
    N, Q = input().split()
    S = input()

    for i in range(int(Q)):
        a, b = (int(x) for x in input().split())
        sss = S[a - 1: b]
        count = sss.count("AC")
        print(count)

    return 0


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    N, Q = map(int, input().split())
    S = input()

    list = [0] * (N + 1)

    for i in range(N):
        list[i + 1] = list[i] + (1 if S[i:i + 2] == "AC" else 0)

    for i in range(Q):
        a, b = map(int, input().split())
        output = list[b - 1] - list[a - 1]
        print(output)


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

import sys

N = list(input())
D_li = list(map(int,input().split()))
M = list(input())
T_li = list(map(int,input().split()))

for i in T_li:
	if i in D_li:
		D_li.remove(i)
	else:
		print('NO')
		sys.exit()

print('YES')

### FIXED CODE ###

import sys
from collections import defaultdict

dict = defaultdict(int) #lamda:0

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

for key in D_li:
	dict[key] += 1
	
M = list(input())
T_li = list(map(int,input().split()))

for key in T_li:
	dict[key] -= 1
	if dict[key] < 0:
		print('NO')
		sys.exit()

print('YES')
### BUGGY CODE ###

#!/usr/bin/env python3
def main():
    import sys

    input = sys.stdin.readline

    N = int(input())
    A = [int(x) for x in input().split()]
    Q = int(input())

    lst = [0 for _ in [0] * (10 ** 5 + 1)]
    sum_lst = 0
    for n in range(10 ** 5 + 1):
        lst[n] = A.count(n)
        sum_lst += n * lst[n]

    for _ in range(Q):
        B, C = map(int, input().split())

        sum_lst += (C - B) * lst[B]
        print(sum_lst)
        lst[C] += lst[B]
        lst[B] = 0


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
def main():
    import sys

    input = sys.stdin.readline

    _ = int(input())
    lst = [0 for _ in [0] * (10 ** 5 + 1)]
    sum_lst = 0
    for a in [int(x) for x in input().split()]:
        sum_lst += a
        lst[a] += 1
    Q = int(input())

    for _ in range(Q):
        B, C = map(int, input().split())

        sum_lst += (C - B) * lst[B]
        print(sum_lst)
        lst[C] += lst[B]
        lst[B] = 0


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

s=input()
d=s.split()
n=int(d[0])
q=int(d[1])
end_t=0
processes=[]
for i in range(n):
    processes.append([])
    s=input()
    d=s.split()
    processes[i].append(d[0])
    processes[i].append(int(d[1]))

cnt=0
i=0
while True:
    if processes[i][1]<=q:
       if processes[i][1]==0:
           i=(i+1)%n
           continue
       end_t+=processes[i][1]
       processes[i][1]=0
       print(processes[i][0],end_t)
       i=(i+1)%n
       cnt+=1
       if cnt==n:
           break
   
    else:
       processes[i][1]-=q
       end_t+=q
       i=(i+1)%n


### FIXED CODE ###

s=input()
d=s.split()
n=int(d[0])
q=int(d[1])
end_t=0
processes=[]
for i in range(n):
    processes.append([])
    s=input()
    d=s.split()
    processes[i].append(d[0])
    processes[i].append(int(d[1]))

cnt=0
i=0
while True:
    if processes[0][1]<=q:
       end_t+=processes[0][1]
       print(processes[0][0],end_t)
       processes.pop(0)
       cnt+=1
       if cnt==n:
           break
   
    else:
       processes[0][1]-=q
       end_t+=q
       processes.append(processes[0])
       processes.pop(0)
       i+=1
### BUGGY CODE ###

from collections import defaultdict
N = int(input())
s = [input() for _ in range(N)]

dicts = [defaultdict(int) for _ in range(N)]

for i in range(N):
    for j in range(10):
        dicts[i][s[i][j]] += 1
#print(dicts)
cnt = 0
for i in range(N):
    for j in range(i+1, N):
        #print(dicts[i], dicts[j])
        if dicts[i] == dicts[j]:
            cnt += 1
print(cnt)

### FIXED CODE ###

from collections import defaultdict
N = int(input())
s = [input() for _ in range(N)]
dic = defaultdict(int)

for i in range(N):
    os = "".join(sorted(s[i]))
    dic[os] += 1
#print(os)
cnt = 0
for s, c in dic.items():
    #print(s, c)
    cnt += c * (c-1) // 2
    #print(c* (c - 1) // 2)
print(cnt)
### BUGGY CODE ###

X,Y,A,B,C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
P = P[:X]
Q.sort(reverse=True)
Q = Q[:Y]
sp = sum(P)
sq = sum(Q)
ans = sp+sq
R.sort(reverse=True)
import heapq  # heapqライブラリのimport
heapq.heapify(P)  # リストを優先度付きキューへ
heapq.heapify(Q)
p = heapq.heappop(P) # 最小値の取り出し
q = heapq.heappop(Q)
r = R.pop(0)
while p<r or q<r:
  #print(p,q,r,ans)
  if r-p > r-q:
    heapq.heappush(P, r)
    ans += r-p
    p = heapq.heappop(P)
  else:
    heapq.heappush(Q, r)
    ans += r-q
    q = heapq.heappop(Q)
  if len(R)==0:
    break
  r = R.pop(0)
  #print(p,q,r,ans)
print(ans)

#print(*ans[1:], sep='\n')


### FIXED CODE ###

X,Y,A,B,C = map(int, input().split())
P = list(map(int, input().split()))
Q = list(map(int, input().split()))
R = list(map(int, input().split()))
P.sort(reverse=True)
P = P[:X]
Q.sort(reverse=True)
Q = Q[:Y]
sp = sum(P)
sq = sum(Q)
ans = sp+sq
R.sort(reverse=True)
import heapq  # heapqライブラリのimport
heapq.heapify(P)  # リストを優先度付きキューへ
heapq.heapify(Q)
p = heapq.heappop(P) # 最小値の取り出し
q = heapq.heappop(Q)
r = R.pop(0)
while p<r or q<r:
  #print(p,q,r,ans)
  if r-p > r-q:
    heapq.heappush(P, r)
    ans += r-p
    p = heapq.heappop(P)
  else:
    heapq.heappush(Q, r)
    ans += r-q
    q = heapq.heappop(Q)
  if len(R)==0:
    break
  r = R.pop(0)
  #print(p,q,r,ans)
print(ans)

#print(*ans[1:], sep='\n')
### BUGGY CODE ###

import sys
input = sys.stdin.readline
# import sympy
from collections import defaultdict, Counter
# def factors(N): #約数を全て求める。ただし、順不同
#     from collections import deque
#     ret = deque()
#     middle = int( N**(1/2))
#     for i in range(1, middle):
#         if N%i == 0:
#             ret.append(i)
#             ret.append(N//i)
            
#     if N%middle == 0:
#         ret.append(middle)
#         if middle != N//middle:
#             ret.append(N//middle)
#     return ret

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    divisors.sort()
    return divisors


def main():
    N = int( input())
    A = list( map( int, input().split()))
    CA = Counter(A)
    d = defaultdict( lambda : False)
    for a in A:
        d[a] = True
    ans = 0
    for a in A:
        if CA[a] > 1:
            continue
        for p in make_divisors(a):
            if p == a:
                continue
            if d[p]:
                break
        else:
            ans += 1
    print(ans)
if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import Counter, defaultdict
def main():
    N = int( input())
    A = list( map( int, input().split()))
    CA = Counter(A)
    d = defaultdict( lambda : False)
    T = [False]*(10**6+1)
    A.sort()
    Z = [False]*(10**6+1)
    ans = 0
    for a in A:
        if CA[a] == 1 and not T[a]:
            ans += 1
        if not Z[a]:
            Z[a] = True
            for i in range(1, 10**6+1):
                if i*a > 10**6:
                    break
                T[i*a] = True
    print(ans)
if __name__ == '__main__':
    main()
### BUGGY CODE ###

N = int(input())
arr = list(map(int, input().split()))
result = 1
for i in range(N):
    result *= arr[i]
if result > 10**18:
    print(-1)
else:
    print(result)


### FIXED CODE ###

N = int(input())
arr = list(map(int, input().split()))
result = 1
if 0 in arr:
    result = 0
else:
    for i in arr:
        result *= i
        if result > 10**18:
            result = -1
            break
print(result)
### BUGGY CODE ###

from itertools import accumulate
N,K=map(int,input().split())
A=list(map(int,input().split()))
imos=[0 for i in range(N+1)]
ANS=[str(N)]*N
if K>=40:
  ans=" ".join(ANS)
  print(ans)
else:
  for t in range(K):
    for i in range(N):
      l=max(0,i-A[i])
      r=min(N,i+A[i]+1)
      imos[l]+=1
      imos[r]-=1
    imos=list(accumulate(imos))
    for i in range(0,N):
      A[i]=imos[i]
    imos=[0 for i in range(N+1)]
  for i in range(N):
    A[i]=str(A[i])
  ans=" ".join(A)
  print(ans)  

### FIXED CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
imos=[0 for i in range(N+1)]
ANS=[str(N)]*N
if K>=50:
  ans=" ".join(ANS)
  print(ans)
else:
  for t in range(K):
    for i in range(N):
      l=max(0,i-A[i])
      r=min(N,i+A[i]+1)
      imos[l]+=1
      imos[r]-=1
    for i in range(0,N):
      imos[i+1]+=imos[i]
      A[i]=imos[i]
    imos=[0 for i in range(N+1)]
  for i in range(N):
    A[i]=str(A[i])
  ans=" ".join(A)
  print(ans)
### BUGGY CODE ###

### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

mod = 10**9+7

def modinv(a, mod):
    return pow_mod(a, mod-2, mod)

def pow_mod(a, b, mod):
    x = 1
    while b > 0:
        if b & 1:
            x = (x*a)%mod
        a = (a**2)%mod
        b //= 2
 
    return x

def comb(n,r,mod):
    combsum=1
    for i in range(n-r+1,n+1):
        combsum = (combsum * i)%mod
    for i in range(1,r+1):
        combsum = (combsum * inv[i])%mod
    return combsum

inv=[modinv(i,mod) for i in range(0,2*10**5)]

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    n,k=map(int, readline().rstrip().split())

    a=0
    z=0
    ans=0
    n+=1
    for i in range(1,n+1):
        a+=i
        z+=(n-i+1)
        cnt=z-a+1
        if i>=k:
            ans+=cnt
            ans%=mod
    print(ans)
    #arr=list(map(int, readline().rstrip().split()))
    #n=int(readline())
    #ss=readline().rstrip()
    #yn(1)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------

### FIXED CODE ###

### ----------------
### ここから
### ----------------

import sys
from io import StringIO
import unittest

def yn(b):
    print("Yes" if b==1 else "No")
    return

def resolve():
    readline=sys.stdin.readline

    n,k=map(int, readline().rstrip().split())

    mod = 10**9+7
    a=0
    z=0
    ans=0
    n+=1
    for i in range(1,n+1):
        a+=i
        z+=(n-i+1)
        cnt=z-a+1
        if i>=k:
            ans=(ans+cnt)%mod
    print(ans)

    return

if 'doTest' not in globals():
    resolve()
    sys.exit()

### ----------------
### ここまで 
### ----------------
### BUGGY CODE ###

def main():
    N, M = map(int, input().split())
    A = [int(x) for x in input().split()]
    list_ = []
    for m in range(0, M):
        tmp = [int(x) for x in input().split()]
        list_.append(tmp)

    for i in range(0, M):
        for j in range(0, list_[i][0]):
            A.append(list_[i][1])

    A.sort()
    A.reverse()
    A = A[:N]

    print(sum(A))


if __name__ == "__main__":
    main()


### FIXED CODE ###

from heapq import heappush, heappop, heapify

def main():
    N, M = map(int, input().split())
    A_card = [-int(x) for x in input().split()]

    change_list = []
    for i in range(M):
        B, C = [int(x) for x in input().split()]
        change_list.append(((-1) * C, B))

    hq = []
    for i in range(N):
        heappush(hq, (A_card[i], 1))

    for i in range(M):
        heappush(hq, change_list[i])

    result_sum = 0
    count = 0
    while True:
        if count == N:
            break
        tmp = heappop(hq)
        if count + tmp[1] <= N:
            result_sum += (tmp[0] * tmp[1])
            count += tmp[1]
        else:
            result_sum += (tmp[0] * (N - count))
            break

    print(result_sum * (-1))

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

import sys
from functools import lru_cache
def input(): return sys.stdin.readline().strip()
sys.setrecursionlimit(10**7)

def main():
    N, Z, W = map(int, input().split())
    A = list(map(int, input().split()))
    """
    O(N^2)dpでも行けるそうです。以下写経：
    https://atcoder.jp/contests/abc078/submissions/14886969
    dpテーブルが訳分からなくなったら@lru_cache使うのが楽。
    """
    @lru_cache(maxsize=None)
    def dfs(turn, top, x, y): # turn: 0 => x, 1 => y
        if top == N: return abs(x - y)
        if turn == 1:
            """
            yのターンは、top以降を取ってなるべくスコアが低くなるようなiを選ぶ
            """
            ret = 10**9
            for i in range(top, N): ret = min(ret, dfs(0, i + 1, x, A[i]))
            return ret
        else:
            """
            xのターンは、top以降を取ってなるべくスコアが高くなるようなiを選ぶ
            """
            ret = 0
            for i in range(top, N): ret = max(ret, dfs(1, i + 1, A[i], y))
            return ret
    
    print(dfs(0, 0, Z, W))

if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()


def main():
    N, z, w = map(int, input().split())
    A = list(map(int, input().split()))
    """
    dpかと思ってずっとウンウン唸ってたのに、解説見て唖然。。。
    """
    if N == 1: print(abs(A[0] - w))
    else: print(max(abs(A[-1] - w), abs(A[-1] - A[-2])))


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

n=int(input())
a=[int(j) for j in input().split()]
t=1
mod=10**9+7
def gcd(x,y):
    if y==0:
        return x
    else:
        return gcd(y,x%y)
for i in a:
    t*=i//gcd(t,i)
print(sum(t//i for i in a)%mod)

### FIXED CODE ###

n=int(input())
a=[int(j) for j in input().split()]
t=1
mod=10**9+7
def gcd(x,y):
    if y==0:
        return x
    else:
        return gcd(y,x%y)
for i in a:
    t*=i//gcd(t,i)
print(sum(t//i for i in a)%mod)
### BUGGY CODE ###

import sys
from collections import defaultdict

h,w,m = map(int, sys.stdin.readline().split())
targets = [list(map(lambda x: int(x)-1, sys.stdin.readline().split())) for _ in range(m)]

num_in_h = defaultdict(int)
num_in_w = defaultdict(int)
for t in targets:
    num_in_h[t[0]] += 1
    num_in_w[t[1]] += 1

max_h_list = [kv[0] for kv in num_in_h.items() if kv[1] == max(num_in_h.values())]
max_w_list = [kv[0] for kv in num_in_w.items() if kv[1] == max(num_in_w.values())]
ans = max(num_in_h.values()) + max(num_in_w.values())

#print(max_h_list, max_w_list)
point = 0
comb = len(max_h_list) * len(max_w_list)
for t in targets:
    if t[0] in max_h_list and t[1] in max_w_list:
        point += 1 # 爆破地点に爆破対象あり

print(ans if comb != point else ans-1)


### FIXED CODE ###

import sys

h,w,m = map(int, sys.stdin.readline().split())
num_in_h = [0] * h
num_in_w = [0] * w
targets = set()
for _ in range(m):
    t_h, t_w = map(lambda x: int(x)-1, sys.stdin.readline().split())
    num_in_h[t_h] += 1
    num_in_w[t_w] += 1
    targets.add((t_h, t_w))

max_h = max(num_in_h)
max_w = max(num_in_w)
max_h_set = set([i for i, v in enumerate(num_in_h) if v == max_h])
max_w_set = set([i for i, v in enumerate(num_in_w) if v == max_w])
ans = max_h + max_w - 1

flag = False
for i in max_h_set:
    for j in max_w_set:
        if (i, j) not in targets:
            flag = True
            break
    if flag: break

print(ans+1 if flag else ans)
### BUGGY CODE ###

h, w = map(int, input().split())
s = ['']*(h+2)
s[0] = '#'*(w+2)
for i in range(1, h+1):
  s[i] = '#'+input()+'#'
s[h+1] = '#'*(w+2)
m=0
for i in range(1, h+1):
  for j in range(1, w+1):
    if s[i][j]=='.':
      c=1
      px, nx=0, 0
      while s[i][j+px+1]=='.':
        px+=1
      while s[i][j-nx-1]=='.':
        nx+=1
      py, ny=0, 0
      while s[i+py+1][j]=='.':
        py+=1
      while s[i-ny-1][j]=='.':
        ny+=1
      c+=px+py+nx+ny
      if c>m:
        m=c
    if m==h+w-1:
      break
      break
print(m) 

### FIXED CODE ###

h, w = map(int, input().split())
s = ['']*(h+2)
s[0] = '#'*(w+2)
for i in range(1, h+1):
  s[i] = '#'+input()+'#'
s[h+1] = '#'*(w+2)

l=[[0]*(w+2) for _ in range(h+2)]
r=[[0]*(w+2) for _ in range(h+2)]
u=[[0]*(w+2) for _ in range(h+2)]
d=[[0]*(w+2) for _ in range(h+2)]
for i in range(1, h+1):
  for j in range(1, w+1):
    if s[i][j]=='.':
      l[i][j]=l[i][j-1]+1
  for j in range(w, 0, -1):
    if s[i][j]=='.':
      r[i][j]=r[i][j+1]+1
for j in range(1, w+1):
  for i in range(1, h+1):
    if s[i][j]=='.':
      u[i][j]=u[i-1][j]+1
  for i in range(h, 0, -1):
    if s[i][j]=='.':
      d[i][j]=d[i+1][j]+1
m=0
for i in range(1, h+1):
  for j in range(1, w+1):
    c=l[i][j]+r[i][j]+u[i][j]+d[i][j]-3
    if m<c:
      m=c
print(m)
### BUGGY CODE ###

import math

k = int(input())
sum = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        for c in range(1,k+1):
            sum += math.gcd(math.gcd(a,b),c)
print(sum)

### FIXED CODE ###

import math

k = int(input())
sum = 0
for a in range(1,k+1):
    for b in range(1,k+1):
        ab = math.gcd(a,b)
        for c in range(1,k+1):
            sum += math.gcd(ab,c)
print(sum)