Harryxun/stf_run huggingface dataset:
import sys
def input(): return sys.stdin.readline().rstrip()
import math
def main():
    a,b,x=map(int,input().split())
    if x==a**2/b:
        print(90)
        sys.exit()
    if x<=a**2*b/2:
        print(90.0-math.degrees(math.atan((2*x)/(a*b**2))))
    else:
        z=2*x/a**2-b
        print(90.0-math.degrees(math.atan(a/(b-z))))

if __name__=='__main__':
    main()

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()
import math
def main():
    a,b,x=map(int,input().split())
    if x==a**2*b:
        print(0)
        sys.exit()
    if x<=a**2*b/2:
        print(90.0-math.degrees(math.atan((2*x)/(a*b**2))))
    else:
        z=2*x/a**2-b
        print(90.0-math.degrees(math.atan(a/(b-z))))

if __name__=='__main__':
    main()
N = int(input())
a = list(map(int, input().split())
print(max(a) - min(a))

### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))
print(max(a) - min(a))
n=int(input())
s=input().split()
q=int(input())
t=input().split()
cnt=0

left=0
right=n
for i in range(t):
    while left<right:
        mid=(left+right)/2
        if s[mid]==t[i]:
            cnt+=1
        elif s[mid]>t[i]:
            right=mid
        else:
            left=mid+1
            
            
print(cnt)


### FIXED CODE ###

n=int(input())
S=input().split()
q=int(input())
T=input().split()

S=list(map(int,S))
T=list(map(int,T))

cnt=0

for i in range(q):
	left=0
	right=n-1
	while left<=right:
		mid=int((left+right)/2)
		if S[left]>T[i] and S[right]<T[i]:
			break
		if S[mid]==T[i]:
			cnt+=1
			break
		elif S[mid]>T[i]:
			right=mid-1
		elif S[mid]<T[i]:
			left=mid+1

print(cnt)
n = int(input())
v = list(map(int, input().split()))
k = [0] * 100000
g = [0] * 100000

num = 1
for i in v:
    if num % 2 == 1:
        k[i] += 1
    else:
        g[i] += 1
    num += 1

max_k = max(k)
max_g = max(g)
print(n - (max_k+max_g))

### FIXED CODE ###

from collections import Counter as C
n = int(input())
v = list(map(int, input().split()))

#偶数番と奇数番の同じ数字の数
evens = C(v[::2]).most_common()
odds = C(v[1::2]).most_common()
#[('数字', 出現数), ('数字', 出現数)...]

#偶数番と奇数番の数字が違うならそのままans
if evens[0][0] != odds[0][0]:
    ans = n - (evens[0][1] + odds[0][1])
#同じ時は各[0][1]と[1][1]の合計を比べて
# 出現数が多いほうがans
else:
    #oddsの長さが1より大きければ
    # rにevensの1番目の出現数とoddsの2番目の出現数の和を代入
    #  そうでなければevensの1番目の出現数を代入（oddsを全換えするため）
    r = evens[0][1] + odds[1][1] if len(odds) > 1 else evens[0][1]
    s = evens[1][1] + odds[0][1] if len(evens) > 1 else odds[0][1]
    if r > s:
        ans = n - r
    else:
        ans = n - s

print(ans)
n = int(input())
point = []
for i in range(n):
    x_, y_ = map(int, input().split())
    point.append([x_, y_])

point.sort()
ans = 0
x = point[:][0]
y = point[:][1]
for i in range(n):
    for j in range(i+1, n):
        count = 0
        p = x[j] - x[i]
        q = y[j] - y[i]
        for k in range(n):
            for l in range(k+1, n):
                if (x[l] - x[k] == p) and (y[l] - y[k] == q):
                    count += 1
        ans = max(ans, count)

print(n - ans)


### FIXED CODE ###

n = int(input())
point = []
for i in range(n):
    x_, y_ = map(int, input().split())
    point.append([x_, y_])

point.sort(key=lambda x: x[1])
point.sort(key=lambda x: x[0])
ans = 0
x = []
y = []
for i in range(n):
    x.append(point[i][0])
    y.append(point[i][1])

for i in range(n):
    for j in range(i+1, n):
        count = 0
        p = x[j] - x[i]
        q = y[j] - y[i]
        for k in range(n):
            for l in range(k+1, n):
                if (x[l] - x[k] == p) and (y[l] - y[k] == q):
                    count += 1
        ans = max(ans, count)

print(n - ans)
a=input()
a.sort()
if a[0]==a[1] and a[2]==a[3]:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

a=input()
if a[0]==a[1] and a[2]==a[3] and a[0]!=a[2]:
  print("Yes")
elif a[0]==a[2] and a[1]==a[3] and a[0]!=a[1]:
  print("Yes")
elif a[0]==a[3] and a[1]==a[2] and a[0]!=a[1]:
  print("Yes")
else:
  print("No")
def main14():
    strbuf = input('');
    num = int(strbuf);
    kari = num;
    peku = 0;
    while(True):
        iti = int(kari % 10);
        peku = iti;
        if(iti<10):
            break;
        kari = (kari - iti) / 10;
    if((int(num % peku) == 0)):
        print("Yes");
    else:
        print("No");

def main15():
    strbuf1 = input('');
    strbuf2 = input('');
    buf1 = [];
    buf2 = []
    for i in range(2):


if __name__ == '__main__':
    main14()

### FIXED CODE ###

def main14():
    strbuf = input('');
    num = int(strbuf);
    kari = num;
    peku = 0;
    while(True):
        iti = int(kari % 10);
        peku = peku + iti;
        if(kari<10):
            break;
        kari = (kari - iti) / 10;
    if((int(num % peku) == 0)):
        print("Yes");
    else:
        print("No");

def main15():
    strbuf1 = input('');
    strbuf2 = input('');
    buf1 = [];
    buf2 = [];
    for i in range(2):
        buf1.append(int(strbuf1[i]));
    for i in range(buf1[0]):
        buf2.append(int(strbuf2[i]));


if __name__ == '__main__':
    main14()
import numpy as np

N = int(input())
A = np.matrix([int(x) for x in input().split()], dtype='int64')
Pm = np.matrix([[1, -1], [-1, 1]], dtype='int64')
P = np.tile(Pm, ((N + 1) // 2, (N + 1) // 2))[:-1, :-1]
P = -np.triu(P) + np.tril(P) + np.eye(N)
print(*np.array(A * P).flatten().astype(np.int64).tolist())


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = [sum((-1) ** i * A[i] for i in range(N))]
for i in range(N - 1):
    ans.append(2 * A[i] - ans[i])
print(*ans)
a,b,c=map(int(input().split()))
if a==b and a!=c:
  print("Yes")
elif b==c and b!=a:
  print("Yes")
elif c==a and c!=b:
  print("Yes")
else:
  print("No")
  


### FIXED CODE ###

a,b,c=map(int,input().split())
if a==b and a!=c:
  print("Yes")
elif b==c and b!=a:
  print("Yes")
elif c==a and c!=b:
  print("Yes")
else:
  print("No")
N, X = map(int, input().split())
L = [x for x in map(int, input().split())]

D, count = 0, 0
while D<=X:
    D = D+L[count]
    count += 1
print(count)

### FIXED CODE ###

N, X = map(int, input().split())
L = [x for x in map(int, input().split())]

D, count = 0, 1
for i in range(0, N):
    D = D+L[i]
    if D > X:
        break
    count += 1
print(count)
n, x = (int(i) for i in input().split(' '))
a = [int(i) for i in input().split(' ')]

ch = 0 # 満足した子供の数

while x != 0: # お菓子がある間ループする
    if x - a[i] < 0: # a[i]個は渡せない
        x = 0
    else:
        x -= a[i]
        ch += 1

print(ch)        
    
    

### FIXED CODE ###

n, x = (int(i) for i in input().split(' '))
a = sorted([int(i) for i in input().split(' ')])

ch = 0 # 満足した子供の数
s = 0
for i in range(n):
    if x < a[i]:
        x = 0
    elif x >= a[i]:
        x -= a[i]
        ch += 1
        
if x > 0:
    ch = ch -1

print(ch)
a,b,k=map(int,input().split())
 
for a,b in range(k):
	if a >=  1:
      a -= 1
  
	elif a < 1 and b >= 1:
      b -= 1
	else:
      break
        
print (a,b,end=" ")

### FIXED CODE ###

s = input().split()
print(s[1] + s[0])
x,N=map(int,input().split())
p=list(map(int,input().split()))
ans=101
if x in p:
    for i in range(102):
        if i in p:
            continue
        ans=min(ans,abs(p[i]-x))
    if x+ans in p:
        ans*=-1
else:
    ans=0
print(x+ans)


### FIXED CODE ###

x,N=map(int,input().split())
p=list(map(int,input().split()))
p_set=set(p)
flag=0
if x not in p_set:
    ans=x
else:
    count=0
    while flag==0:
        count+=1
        if x+count not in p_set:
            ans=x+count
            flag=1
        if x-count not in p_set:
            ans=x-count
            flag=1
print(ans)
n = int(input())
cnt = [[0 for _ in range(15)] for _ in range(15)]
ans = 0
for _ in range(n):
	a = input()
	x, y = 0, 0
	if "." in a:
		i = len(a)-1
		while a[i] != ".":
			i -= 1
			x, y = x-1, y-1
		b = int(a[:i] + a[i+1:])
	else:
		b = int(a)
	while b%2 == 0:
		x += 1
		b //= 2
	while b%5 == 0:
		y += 1
		b //= 5
	#print(x, y)
	x, y = x+9, y+9
	for i in range(18-x, 15):
		for j in range(18-y, 15):
			ans += cnt[i][j]
	cnt[x][y] += 1
print(ans)


### FIXED CODE ###

import sys
def input():
	return sys.stdin.readline()[:-1]

n = int(input())
cnt = [[0 for _ in range(20)] for _ in range(20)]
ans = 0
for _ in range(n):
	a = input()
	x, y = 0, 0
	if "." in a:
		i = len(a)-1
		while a[i] != ".":
			i -= 1
			x, y = x-1, y-1
		b = int(a[:i] + a[i+1:])
	else:
		b = int(a)
	#print(b)
	while b%2 == 0 and x < 9:
		x += 1
		b //= 2
	while b%5 == 0 and y < 9:
		y += 1
		b //= 5
	#print(x, y)
	x, y = x+9, y+9
	for i in range(18-x, 20):
		for j in range(18-y, 20):
			ans += cnt[i][j]
	cnt[x][y] += 1
print(ans)
lin = input()
l = lin.split(" ")
a = int(l[0])
b = int(l[1])
c = int(l[2])

l = [a,b,c]
l.sort()

print(str(l[0])+" "+str(l[1])+" "+str(l[2]))

### FIXED CODE ###

lin = input()
l = lin.split(" ")
a = int(l[0])
b = int(l[1])
c = int(l[2])

l = [a,b,c]
l.sort()

print(str(l[0])+" "+str(l[1])+" "+str(l[2]))
n = int(input())

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

ans = [0]*n
for i in range(n):
    li2 = li
    del li2[i]
    for j in range(n-1):
        for k in range(j+1, n-1):
            if li2[j] == li2[k]:
                ans[i] += 1
for l in range(len(ans)):
    print(ans[l])
 


### FIXED CODE ###

N=int(input())
K=list(map(int, input().split()))
from collections import Counter
ans = 0
C = Counter(K)
for k, v in C.items():
    ans += v*(v-1)//2

for a in K:
    e = C[a]
    print(ans-e*(e-1)//2+(e-1)*(e-2)//2)
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [A, B, K] = [int(input_raw[0]), int(input_raw[1]), int(input_raw[2])]
    count = 0

    if max(A, B) == 1:
        print 1
        return

    num_list = []
    for x in range(1, max(A, B)):
        if A%x == 0 and B%x == 0:
            num_list.append(x)
    num_list.sort(reverse = True)
    print num_list[K - 1]

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [A, B, K] = [int(input_raw[0]), int(input_raw[1]), int(input_raw[2])]
    count = 0

    if max(A, B) == 1:
        print 1
        return

    num_list = []
    for x in range(1, max(A, B) + 1):
        if A%x == 0 and B%x == 0:
            num_list.append(x)
    num_list.sort(reverse = True)
    print num_list[K - 1]

if __name__ == '__main__':
    main()
S = input()
print(S.replace(7, 8, 1))

### FIXED CODE ###

S = input()
print(S.replace('7', '8', 1))
n , k = map(int,input().split())
d = set(list(map(int,input().split())))
kouho =list({0,1,2,3,4,5,6,7,8,9} - d)
kouho.sort()

def f(now):
    if now >= n:
        print(now)
        exit()
    for i in kouho:
        f(now*10 + i)

f(0)

### FIXED CODE ###

from collections import deque
n , k = map(int,input().split())
d = set(list(map(int,input().split())))
kouho =list({0,1,2,3,4,5,6,7,8,9} - d)
kouho.sort()

p = deque()
p.append(0)

while p:
    now = p.popleft()
    if now >= n:
        print(now)
        exit()
    for i in kouho:
        p.append(now*10+i)
from math import atan, radians, degrees

a, b, x = map(int, input().split())
h = x/(a**2)
he = b - h

if 2*h >= b:
    ans = degrees(atan((2*b-2*h)/a))
    print(ans)

else 2*he >= a:
    ans = degrees(atan(b**2/(2*h*a)))
    print(ans)


### FIXED CODE ###

from math import atan, radians, degrees

a, b, x = map(int, input().split())
h = x/(a**2)
he = b - h

if 2*h >= b:
    ans = degrees(atan((2*b-2*h)/a))
    print(ans)

else:
    ans = degrees(atan(b**2/(2*h*a)))
    print(ans)
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N - 1)]
# N = 9
# AB = [[1, 2], [2, 3], [9, 8], [8, 3], [3, 4], [4, 5], [3, 6], [6, 7]]
if N == 2:
    print(1, 2)
    exit()


class Node:
    def __init__(self, v):
        self.linked = set()
        self.v = v

    def add_node(self, node):
        self.linked.add(node)

    def set_rank(self, parent, rank):
        self.rank = rank
        for node in self.linked:
            if node is parent:
                continue
            node.set_rank(parent=self, rank=rank + 1)

    def __repr__(self):
        return '{}'.format(self.rank)


nodes = {v: Node(v) for v in range(1, N + 1)}
for a, b in AB:
    nodes[a].add_node(nodes[b])
    nodes[b].add_node(nodes[a])

# usokaihou
import random

root = nodes[random.randint(1, N)]
root.set_rank(None, 1)

group = [[], []]
for node in nodes.values():
    group[node.rank % 2].append(node)
group.sort(key=len)
result = {}
x1 = set()
x2 = set()
x3 = set()

for i in range(1, N + 1):
    if i % 3 == 1:
        x1.add(i)
    elif i % 3 == 2:
        x2.add(i)
    else:
        x3.add(i)

for node in group[0]:
    if x1:
        result[node.v] = x1.pop()
    else:
        result[node.v] = x3.pop()

for node in group[1]:
    if x2:
        result[node.v] = x2.pop()
    else :
        result[node.v] = x3.pop()


print(' '.join(str(result[i]) for i in range(1, N + 1)))


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)
N = int(input())
AB = [list(map(int, input().split())) for _ in range(N - 1)]


class Tree:
    def __init__(self, v):
        self.v = v
        self.neighbors = []

    def set_rank(self, rank, parent):
        self.rank = rank
        for neighbor in self.neighbors:
            if neighbor is parent:
                continue
            neighbor.set_rank(rank=rank + 1, parent=self)


trees = {i: Tree(i) for i in range(1, N + 1)}

for a, b in AB:
    trees[a].neighbors.append(trees[b])
    trees[b].neighbors.append(trees[a])
try:
    trees[1].set_rank(1, None)
except:
    print(-1)
    exit()

group0 = [node.v for node in trees.values() if node.rank % 2 == 0]
group1 = [node.v for node in trees.values() if node.rank % 2]
x = [set(), set(), set()]
for i in range(1, N + 1):
    x[i % 3].add(i)
if len(group1) < len(group0):
    group1, group0 = group0, group1
result = {}
if len(group0) <= len(x[0]):
    while group0 and x[0]:
        result[group0.pop()] = x[0].pop()
    y = x[0] | x[1] | x[2]
    while group1 and y:
        result[group1.pop()] = y.pop()
else:
    while x[2] and group0:
        result[group0.pop()] = x[2].pop()
    while x[1] and group1:
        result[group1.pop()] = x[1].pop()
    while group0 and x[0]:
        result[group0.pop()] = x[0].pop()
    while group1 and x[0]:
        result[group1.pop()] = x[0].pop()
    if group0 or group1:
        print(-1)
        exit()

print(' '.join(str(result[i]) for i in range(1, N + 1)))
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

# import fractions

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)
# lcm = lambda x, y: (x * y) // fractions.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N, M, K = il()
    A = il()
    SA = [0] * (N + 1)
    for n in range(N):
        SA[n + 1] = A[n] + SA[n]
    B = il()
    SB = [0] * (M + 1)
    for m in range(M):
        SB[m + 1] = B[m] + SB[m]
        
    ret = 0
    for n in range(N+1):
        for m in range(M+1):
            if SA[n] + SB[m] <= K:
                ret = max(ret, n + m)
    print(ret)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys, os, math, bisect, itertools, collections, heapq, queue, copy, array

# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
# from decimal import Decimal
# from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
INF = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    N = ii()
    ans = 0
    for x in range(1, N + 1):
        n = N // x  # Nのうちにxがいくつ含まれるか（等差数列の項数）
        ans += (n * (2 * x + (n - 1) * x)) // 2  # 初項と公差がxでn項の等差数列の和
    print(ans)


if __name__ == '__main__':
    main()
import numpy as np
from numba import njit

@njit
def main(n,ma,mb,abc):
    inf=10**5
    cost=inf*np.ones((401,401))
    maxa=np.sum(np.transpose[abc][0])
    maxb=np.sum(np.transpose[abc][1])

    left=4*n//8
    right=n
    cnt=right-left

    for i in range(2**cnt):
        ta=0
        tb=0
        tc=0
        for j in range(cnt):
            if (i>>j)&1==1:
                a,b,c=abc[left+j]
                ta+=a
                tb+=b
                tc+=c
        
        cost[ta,tb]=min(cost[ta,tb],tc)
    
    ans=inf

    for i in range(1,401):
        targeta=ma*i
        targetb=mb*i
        if targeta>maxa or targetb>maxb:
            break

        for j in range(2**left):
            ta=0
            tb=0
            tc=0
            for k in range(left):
                if (j>>k)&1==1:
                    a,b,c=abc[k]
                    ta+=a
                    tb+=b
                    tc+=c
        
            ua=targeta-ta
            ub=targetb-tb

            if 0<=ua<=400 and 0<=ub<=400 and cost[ua,ub]!=inf:
                ans=min(ans,tc+cost[ua,ub])
    
    if ans==inf:
        return -1
    else:
        return int(ans)

n,ma,mb=map(int,input().split())
abc=np.array([list(map(int,input().split())) for _ in range(n)])
print(main(n,ma,mb,abc))

### FIXED CODE ###

n,ma,mb=map(int,input().split())
abc=[list(map(int,input().split())) for _ in range(n)]

wmax=400
inf=10**10
dp=[[[inf]*(wmax+1) for _ in range(wmax+1)] for _ in range(n+1)]
dp[0][0][0]=0

for i in range(n):
    a,b,c=abc[i]
    for j in range(wmax+1):
        for k in range(wmax+1):
            dp[i+1][j][k]=dp[i][j][k]

            if j>=a and k>=b:
                dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j-a][k-b]+c)

ans=inf

for j in range(1,wmax+1):
    for k in range(1,wmax+1):
        if dp[n][j][k]>=inf:
            continue

        if ma*k==mb*j:
            ans=min(ans,dp[n][j][k])

if ans==inf:
    print(-1)
else:
    print(ans)
data = [
    [[0 for r in range(10)]for f in range(3)] for b in range(4)
]


count = int(input())
for c in range(count):
    b, f, r, v = [int(i) for i in input().split()]
    data[b-1[f-1][r-1] += v

for b in enumerate(data):
    for f in b:
        for r in f:
            print(' {0}'.format(r), end='')

        print()

    if bi < 3:
    ??????print('#'* 20)

### FIXED CODE ###

data = [
    [[0 for r in range(10)] for f in range(3)] for b in range(4)
]
 
count =int(input())
for c in range(count):
    b, f, r, v = [int(i) for i in input().split()]
    data[b-1][f-1][r-1] += v
 
for bi, b in enumerate(data):
    for f in b:
        for r in f:
            print(' {0}'.format(r), end='')
 
        print()
    if bi < 3:
        print('#' * 20)
N, K, Q = map(int, input().split())
A = []
for _ in range(Q):
    A.append(input())
    
a = 1 - (K - Q)
score = [0] * N

for i in range(len(A)):
  b = A[i]
  score[b-1] += 1

for j in range(len(score)):
  if score[j] >= a:
    print('Yes')
  else:
    print('No')

### FIXED CODE ###

N, K, Q = map(int, input().split())
A = []
for _ in range(Q):
    A.append(int(input()))
    
a = 1 - (K - Q)
score = [0] * N

for i in range(len(A)):
  b = A[i]
  score[b-1] += 1

for j in range(len(score)):
  if score[j] >= a:
    print('Yes')
  else:
    print('No')
import collections
n,s = int(raw_input()), raw_input()

def f(k, s):	
 	cc,q = collections.Counter(), collections.deque()
	for j in range(k - 1, len(s)):
		q.append(s[j - k + 1:j+1])
		if len(q) == k:
			u = q.popleft()
			cc[u] += 1
		if q[-1] in cc: return True	
	return False
	
lo,hi = 0, n/2
while(lo < hi):
	med = (lo + hi + 1) / 2
	if f(med, s):  lo = med
	else:hi = med - 1

### FIXED CODE ###

import collections
n = int(raw_input())
s = raw_input()

def f(k, s):	
	if k == 0:
		return True
 	cc = collections.Counter()
	q = collections.deque()
	for j in range(k - 1, len(s)):
		q.append(s[j - k + 1:j+1])
		if len(q) == k + 1:
			u = q.popleft()
			cc[u] += 1
		if s[j- k+1:j+1] in cc:
			return True	
	return False
lo,hi = 0, n
while(lo < hi):
	med = (lo + hi + 1) / 2
	if f(med, s):
		lo = med
	else:
		hi = med - 1

print lo
from sys import stdin
import numpy as np

def main(args):
    r = int(args[0])
    d = int(args[1])
    x = int(args[2])
    ar = np.zeros([10], dtype=int)

    ar[0] = r*x-d
    for i in range(1,len(ar)):
        ar[i] = r*ar[i-1]-d

    for i in ar:
        print(i)

if __name__ == "__main__":
    main(stdin.readline().rstrip().split())

### FIXED CODE ###

import numpy as np
from sys import stdin
#sys.setrecursionlimit(10**6) 

def main():
    a, b = [int(x) for x in stdin.readline().rstrip().split()]
    if 6 <= a and a <= 12:
        v = b//2
    elif a <= 5:
        v = 0
    else:
        v = b
    print(v)

if __name__ == "__main__":
    main()
import sys
input = sys.stdin.readline

def main()
    h,w,m = map(int,input().split())

    h_array = [ 0 for _ in range(h) ]
    w_array = [ 0 for _ in range(w) ]
    ps = set()
    for i in range(m):
        hi,wi = map( lambda x : int(x) - 1 , input().split() )
        h_array[hi] += 1
        w_array[wi] += 1
        ps.add( (hi,wi) )

    h_great = max(h_array)
    w_great = max(w_array)
    h_greats = list()
    w_greats = list()
    for i , hi in enumerate(h_array):
        if hi == h_great:
            h_greats.append(i)
    for i , wi in enumerate(w_array):
        if wi == w_great:
            w_greats.append(i)

    ans = h_great + w_great


    for _h in h_greats:
        for _w in w_greats:
            if (_h,_w) in ps:
                continue
            print(ans)
            exit()

    print(ans-1)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import queue
h,w,m = ( int(x) for x in input().split() )

h_array = [ 0 for i in range(h) ]
w_array = [ 0 for i in range(w) ]
ps = set()
for i in range(m):
    hi,wi = ( int(x)-1 for x in input().split() )
    h_array[hi] += 1
    w_array[wi] += 1
    ps.add( (hi,wi) )
h_great = max(h_array)
w_great = max(w_array)
h_greats = list()
w_greats = list()
for i in range( h ):
    if h_array[i] == h_great:
        h_greats.append(i)
for i in range( w ):
    if w_array[i] == w_great:
        w_greats.append(i)

ans = h_great + w_great - 1

escaper = False

for i in range( len(h_greats) ):
    hi = h_greats[i]
    for j in range( len(w_greats) ):
        wi = w_greats[j]
        if (hi,wi) not in ps:
            ans += 1
            escaper = True
            break
    if escaper:
        break

print(ans)