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

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

def main():
    S = input()
    n = len(S)+1
    ret = 0
    for i in range(n):
        left = S[:i]
        l = left[::-1].find('>')
        if l==-1:
            l=len(left)
        right = S[i:]
        r = right.find('<')
        if r==-1:
            r=len(right)
#        print(i,l,r)
#        print(left,right)
        ret += max(l,r)
    print(ret)

if __name__ == '__main__':
    main()

### FIXED CODE ###

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

def main():
    S = input()
    n = len(S)+1
    left=[0]*n
    right=[0]*n
    for i,s in enumerate(S):
        if s=='<':
            left[i+1]=left[i]+1
    for i,s in enumerate(S[::-1]):
        if s=='>':
            right[n-i-2]=right[n-i-1]+1
    ret =0
    for i in range(n):
        ret+= max(left[i],right[i])
    print(ret)

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

r,c,k=map(int,input().split())
v=[[0]*c for _ in range(r)]
for _ in range(k):
    ri,ci,a=map(int,input().split())
    ri-=1
    ci-=1
    v[ri][ci]=a
dp=[[[0]*4 for _ in range(c)] for i in range(r)]
#print(dp)
if v[0][0]>0:
    dp[0][0][1]=v[0][0]
for i in range(r):
    for j in range(c):
        if i>0:
            if v[i][j]>0:
                for k in range(min(3,j+1)+1):
                    dp[i][j][1]=max(dp[i][j][1],dp[i-1][j][k]+v[i][j])
            for k in range(4):
                dp[i][j][k]=max(dp[i][j][k],dp[i-1][j][k])
        if j>0:
            if v[i][j]>0:
                for k in range(min(3,j+1)+1):
                    if k>0:
                        dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k-1]+v[i][j])
            for k in range(4):
                dp[i][j][k]=max(dp[i][j][k],dp[i][j-1][k])
#print(dp)
print(max(dp[r-1][c-1]))

### FIXED CODE ###

import sys
input=sys.stdin.readline
def main():
    r,c,k=map(int,input().split())
    v=[[0]*c for _ in range(r)]
    for _ in range(k):
        ri,ci,a=map(int,input().split())
        ri-=1
        ci-=1
        v[ri][ci]=a
    dp=[[[0]*c for _ in range(r)] for i in range(4)]
    #print(dp)
    if v[0][0]>0:
        dp[1][0][0]=v[0][0]
    for i in range(r):
        for j in range(c):
            for k in range(4):
                if i>0:
                    dp[1][i][j]=max(dp[1][i][j],dp[k][i-1][j]+v[i][j])
                    dp[0][i][j]=max(dp[0][i][j],dp[k][i-1][j])
                if j>0:
                    if k>0:
                        dp[k][i][j]=max(dp[k][i][j],dp[k-1][i][j-1]+v[i][j])
                    dp[k][i][j]=max(dp[k][i][j],dp[k][i][j-1])
    #print(dp)
    ans=0
    for i in range(4):
        ans=max(dp[i][r-1][c-1],ans)
    return print(ans)
if __name__=="__main__":
    main()
### BUGGY CODE ###

import sys
sys.setrecursionlimit(200000)


def read():
    N, Q = list(map(int, input().strip().split()))
    G = [list() for i in range(N+1)]
    PX = list()
    for i in range(N-1):
        a, b = list(map(int, input().strip().split()))
        G[a].append(b)
        G[b].append(a)
    for i in range(Q):
        px = list(map(int, input().strip().split()))
        PX.append(px)
    return N, Q, G, PX


def dfs(parent, G, C, V):
    V[parent] = True
    for child in G[parent]:
        if not V[child]:
            C[child] += C[parent]
            dfs(child, G, C, V)
    

def solve(N, Q, G, PX):
    C = [0 for i in range(N+1)]
    V = [False for i in range(N+1)]
    for p, x in PX:
        C[p] += x
    dfs(1, G, C, V)
    return ' '.join(map(str, C[1:]))
    

if __name__ == '__main__':
    inputs = read()
    print("{}".format(solve(*inputs)))


### FIXED CODE ###

import sys
sys.setrecursionlimit(200000)
from collections import deque


def read():
    N, Q = list(map(int, input().strip().split()))
    G = [list() for i in range(N+1)]
    PX = list()
    for i in range(N-1):
        a, b = list(map(int, input().strip().split()))
        G[a].append(b)
        G[b].append(a)
    for i in range(Q):
        px = list(map(int, input().strip().split()))
        PX.append(px)
    return N, Q, G, PX


def bfs(parent, G, C, V):
    q = deque()
    q.append(1)
    while len(q) > 0:
        parent = q.pop()
        V[parent] = True
        for child in G[parent]:
            if not V[child]:
                C[child] += C[parent]
                q.append(child)
    

def solve(N, Q, G, PX):
    C = [0 for i in range(N+1)]
    V = [False for i in range(N+1)]
    for p, x in PX:
        C[p] += x
    bfs(1, G, C, V)
    return ' '.join(map(str, C[1:]))
    

if __name__ == '__main__':
    inputs = read()
    print("{}".format(solve(*inputs)))
### BUGGY CODE ###

import numpy as np
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**8)

num_str = input()

num = int(num_str)

num_list = []
# num_list = [int(num_str[i]) for i in range(len(num_str))]

while num>0:
  num_list.append(num%10)
  num //= 10
num_list.reverse()

num_sum = sum(num_list)

if num_sum%9 == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

import numpy as np
import sys
# input = sys.stdin.readline
# sys.setrecursionlimit(10**8)
 
num_str = input()

num_sum = 0
for i in range(len(num_str)):
  num_sum+=int(num_str[i])
 
if num_sum%9 == 0:
  print("Yes")
else:
  print("No")
### BUGGY CODE ###

from time import*
from fractions import*
start=time()
M=10**9+7
lcm=lambda x,y:x//gcd(x,y)*y
n,*a=map(int,open(0).read().split())
if n==1:
    print(1)
    exit()
s=a[0]
for t in a[1:]:
    if time()-start>1:
        s=max(a)
        break
    else:
        s=lcm(s,t)
c=0
for i in a:
    c+=s//i
    c%=M
print(c)

### FIXED CODE ###

from fractions import*
from functools import*
M=10**9+7
_,a=open(0)
*a,=map(int,a.split())
s=reduce(lambda x,y:x//gcd(x,y)*y,a)%M
c=0
for i in a:
    c+=s*pow(i,M-2,M)
    c%=M
print(c)
### BUGGY CODE ###

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

import sys
from fractions import gcd

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

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

N = INT()
A = LIST()

l = 1
for a in A:
    l = lcm(l, a)

B = [0] * N
for i, a in enumerate(A):
    B[i] = l // a

ans = 0
for b in B:
    ans += b
print(ans%MOD)


### FIXED CODE ###

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

import sys
from fractions import gcd

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

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

N = INT()
A = LIST()

l = 1
for a in A:
    l = lcm(l, a)

ans = 0
for i, a in enumerate(A):
    ans += l // a
print(ans%MOD)
### BUGGY CODE ###

import numpy as np
 
s=input()
n=len(s)
MOD=1000000007
wayA=np.array([0,0,0,0],dtype=np.int32)
wayB=np.array([0,0,0,0],dtype=np.int32)
wayC=np.array([0,0,0,0],dtype=np.int32)
MOD2=np.array([MOD,MOD,MOD,MOD],dtype=np.int32)
hatena=0
for c in s:
	if c=="A":
		wayA[0]+=1
	if c=="B":
		wayB+=wayA
	if c=='C':
		wayC+=wayB
	if c=='?':
		wayC+=np.roll(wayB,1)
		wayB+=np.roll(wayA,1)
		wayA[1]+=1
		hatena+=1
	wayA%=MOD2
	wayB%=MOD2
	wayC%=MOD2
ans=0
for i in range(0,4):
	p3=1
	for j in range(hatena-i):
		p3*=3
		p3%=MOD
	ans+=p3*wayC[i]
	ans=ans%MOD
print(int(ans))

### FIXED CODE ###

#a,b=map(int,input().split())
import numpy as np

s=input()
n=len(s)
wayA=np.array([0,0,0,0],dtype=np.int64)
wayB=np.array([0,0,0,0],dtype=np.int64)
wayC=np.array([0,0,0,0],dtype=np.int64)
hatena=0
MOD=1000000007
for c in s:
	if c=="A":
		wayA[0]=wayA[0]+1
	if c=="B":
		wayB+=wayA;
	if c=='C':
		wayC=wayC+wayB
	if c=='?':
		wayC[1]=wayC[1]+wayB[0]
		wayC[2]=wayC[2]+wayB[1]
		wayC[3]=wayC[3]+wayB[2]
		wayB[1]=wayB[1]+wayA[0]
		wayB[2]=wayB[2]+wayA[1]
		wayA[1]=wayA[1]+1
		hatena=hatena+1
	for z in range(0,4):
		wayA[z]=wayA[z]%MOD
		wayB[z]=wayB[z]%MOD
		wayC[z]=wayC[z]%MOD
ans=0
for i in range(0,4):
	p3=1
	if wayC[i]<=0:
		continue
	for k in range(0,hatena-i):
		p3=p3*3
		p3=p3%MOD
	ans=ans+p3*wayC[i]
	ans=ans%MOD
print(int(ans))
### BUGGY CODE ###

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

l.sort()
ans = 0
for i in range(n-2):
  for j in reversed(range(i+2,n)):
    k = i+1
    while(k < j):
      if l[j] < l[i]+l[k]:
        ans += j - k
        break
      else:
        k += 1
print(ans)

### FIXED CODE ###

from bisect import bisect_left#(sorted_list,x)で昇順ソート位置

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

l.sort()
ans = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    s = l[i]+l[j]
    ans += bisect_left(l,s,j+1)-j-1
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n = int(input())
a = [int(x) for x in input().split()]

m = max(a)
primes = list(range(m+1))
primes[1] = 0
for i in range(2, m+1, 2): primes[i] = 2

for i in range(3, int(m ** 0.5)+1):
    for j in range(i, m+1, i):
        if primes[j] > i: primes[j] = i

b = [0] * (m + 1)
def factorization(n):
    aset = set()
    temp = n
    while temp != 1:
        aset.add(primes[temp])
        temp = temp // primes[temp]
    for i in aset:
        b[i] += 1

for aa in a:
    factorization(aa)
maxb = max(b)
if maxb <= 1: print('pairwise coprime')
elif maxb < n: print('setwise coprime')
else: print('not coprime')

### FIXED CODE ###

import sys, math
input = sys.stdin.readline
n = int(input())
a = [int(x) for x in input().split()]

m = max(a)
primes = list(range(m+1))
primes[1] = 0
for i in range(2, m+1, 2): primes[i] = 2

for i in range(3, int(m ** 0.5)+1):
    for j in range(i, m+1, i):
        if primes[j] > i: primes[j] = i

b = [0] * (m + 1)
jdg_p = True
for aa in a:
    aset = set()
    while aa != 1:
        aset.add(primes[aa])
        aa //= primes[aa]
    for aaset in aset:
        b[aaset] += 1
        if b[aaset] >= 2:
            jdg_p = False
            break
        else:
            b[aaset] += 1
    if not jdg_p: break

x = a[0]
jdg_s = True
for aa in a[1:]:
    x = math.gcd(x, aa)
if x != 1: 
    jdg_s = False

if jdg_p: print('pairwise coprime')
elif jdg_s: print('setwise coprime')
else: print('not coprime')
### BUGGY CODE ###

import sys
def input():
	return sys.stdin.buffer.readline()[:-1]
sys.setrecursionlimit(10 ** 6)

class UnionFind():
	def __init__(self, lis):
		self.table = [-1 for _ in range(len(lis))]
		self.size = [x for x in lis]

	def find(self, x):
		if self.table[x] < 0:
			return x
		else:
			self.table[x] = self.find(self.table[x])
			return self.table[x]

	def unite(self, x, y):
		s1 = self.find(x)
		s2 = self.find(y)
		if s1 != s2:
			if self.table[s1] > self.table[s2]:
				self.table[s2] = s1
				self.table[s1] -= 1
				self.size[s1] += self.size[s2]
				self.size[s2] = 0
			else:
				self.table[s1] = s2
				self.table[s2] -= 1
				self.size[s2] += self.size[s1]
				self.size[s1] = 0
		return

n, m = map(int, input().split())
x = list(map(int, input().split()))
adj = [[] for _ in range(n)]
e = []
for i in range(m):
	a, b, y = map(int, input().split())
	a, b = a-1, b-1
	e.append((y, a, b))

used = [False for _ in range(m)]
candidate = [False for _ in range(m)]
e.sort()
uf = UnionFind(x)
for i in range(m):
	y, a, b = e[i]
	adj[a].append((b, y, i))
	adj[b].append((a, y, i))
	uf.unite(a, b)
	if uf.size[uf.find(a)] >= y:
		candidate[i] = True

ans = 0
for i in range(m-1, -1, -1):
	if used[i]:
		continue
	if not candidate[i]:
		ans += 1
	else:
		used[i] = True
		y, a, b = e[i]
		stack = [a, b]
		while stack:
			l = stack.pop()
			for v, z, j in adj[l]:
				if used[j]:
					continue
				if z <= y:
					stack.append(v)
					used[j] = True

print(ans)

### FIXED CODE ###

import sys
def input():
	return sys.stdin.buffer.readline()[:-1]
sys.setrecursionlimit(10 ** 6)

class UnionFind():
	def __init__(self, lis):
		self.table = [-1 for _ in range(len(lis))]
		self.size = [x for x in lis]

	def find(self, x):
		if self.table[x] < 0:
			return x
		else:
			self.table[x] = self.find(self.table[x])
			return self.table[x]

	def unite(self, x, y):
		s1 = self.find(x)
		s2 = self.find(y)
		if s1 != s2:
			if self.table[s1] > self.table[s2]:
				self.table[s2] = s1
				self.table[s1] -= 1
				self.size[s1] += self.size[s2]
				self.size[s2] = 0
			else:
				self.table[s1] = s2
				self.table[s2] -= 1
				self.size[s2] += self.size[s1]
				self.size[s1] = 0
		return

n, m = map(int, input().split())
x = list(map(int, input().split()))
adj = [[] for _ in range(n)]
e = []
for i in range(m):
	a, b, y = map(int, input().split())
	a, b = a-1, b-1
	e.append((y, a, b))

used = [False for _ in range(m)]
candidate = [False for _ in range(m)]
e.sort()
uf = UnionFind(x)
for i in range(m):
	y, a, b = e[i]
	adj[a].append((b, y, i))
	adj[b].append((a, y, i))
	uf.unite(a, b)
	if uf.size[uf.find(a)] >= y:
		candidate[i] = True

ans = 0
for i in range(m-1, -1, -1):
	if used[i]:
		continue
	if not candidate[i]:
		ans += 1
	else:
		used[i] = True
		y, a, b = e[i]
		stack = [a, b]
		while stack:
			l = stack.pop()
			for v, z, j in adj[l]:
				if used[j]:
					continue
				if z <= y:
					stack.append(v)
					used[j] = True

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

import sys
sys.setrecursionlimit(100000000)

def mult(A, B, mod): #行列A, Bの内積を求める。
    D = [[0, 0, 0] for i in range(3)]
    D[0][0] = (A[0][0] * B[0][0]) % mod
    D[1][0] = (A[1][0] * B[0][0] + A[1][1] * B[1][0]) % mod
    D[1][1] = 1
    D[2][0] = (A[2][0]*B[0][0]+A[2][1]*B[1][0]+A[2][2]*B[2][0]) % mod
    D[2][1] = (A[2][1]*B[1][1]+A[2][2]*B[2][1]) % mod
    D[2][2] = 1
    return D


def Cpow(C, n, mod):
    if n == 1: return C
    else:
        D = mult(C, C, mod)
        if n % 2 == 0:
            return Cpow(D, n // 2, mod)
        else:
            return mult(Cpow(D, n // 2, mod), C, mod)

def solve():
    L, a, b, M = map(int, input().split())
    X = "0"
    s = a
    nd = -1
    ne = 0
    for d in range(1, 19):
        ne = min((pow(10, d) - a - 1) // b, L-1)
        if nd == ne and ne == L - 1: break
        elif nd == ne: continue
        C = [[pow(10, d, M), 0, 0], [1, 1, 0], [0, b % M, 1]]
        D = Cpow(C, ne - nd, M)
        X = str((int(X) * D[0][0] + D[1][0] * s + D[2][0]) % M)
        s += D[2][1]
        nd = ne
    print(X)
    return

if __name__ == "__main__":
    solve()

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000000)

def mult(A, B, mod): #行列A, Bの内積を求める。
    D = [[(A[0][0] * B[0][0]) % mod, 0, 0], [0, 1, 0], [0, 0, 1]]
    D[1][0] = (A[1][0] * B[0][0] + A[1][1] * B[1][0]) % mod
    D[2][0] = (A[2][0]*B[0][0]+A[2][1]*B[1][0]+A[2][2]*B[2][0]) % mod
    D[2][1] = (A[2][1]*B[1][1]+A[2][2]*B[2][1]) % mod
    return D

def double(C, mod):
    D = [[pow(C[0][0], 2, mod), 0, 0], [(C[1][0] * C[0][0] + C[1][0]) % mod, 1, 0], [(C[2][0] * C[0][0] + C[2][1] * C[1][0] + C[2][0]) % mod, (C[2][1] * 2) % mod, 1]]
    return D

def Cpow(C, n, mod):
    if n == 1: return C
    else:
        D = double(C, mod)
        if n % 2 == 0:
            return Cpow(D, n // 2, mod)
        else:
            return mult(Cpow(D, n // 2, mod), C, mod)

def solve():
    L, a, b, M = map(int, input().split())
    X = 0
    s = a
    nd = -1
    ne = 0
    for d in range(1, 19):
        ne = min((pow(10, d) - a - 1) // b, L-1)
        if ne < 0: continue
        elif ne == nd: continue
        C = [[pow(10, d, M), 0, 0], [1, 1, 0], [0, b % M, 1]]
        D = Cpow(C, ne - nd, M)
        X = (X * D[0][0] + D[1][0] * s + D[2][0]) % M
        s += D[2][1]
        if ne == L - 1: break
        nd = ne
    print(X)
    return

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

# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n = int(input())
a = [int(i) for i in readline().split()]
b = [int(i) for i in readline().split()]


def op(b,i):
    global ans
    if i == n-1:
        res = (b[i]-a[i])//(b[i-1]+b[0])
        b[i] -= (b[i-1]+b[0])*res
    else:
        res = (b[i]-a[i])//(b[i-1]+b[(i+1)])
        b[i] -= (b[i-1]+b[(i+1)])*res
    ans += res
    if res >= 0:
        return res
    else: return 0

def check(b,c):#c からチェック 操作ができる最初のi
#    print(b,c)
    for i in range(c,c+n):
        if op(b,i%n) > 0: return i
    else:
        return(-1)

def rev(b,i):#iから逆向きに操作
    for j in range(i-1,-n,-1):
#        print(b,j)
        if op(b,j%n) == 0: break

    
c = 0
ans = 0
while True:
    i = check(b,c)
    if i == -1: break
    rev(b,i)
    c += 1
    if c >= n: c -= n


if a == b:
    print(ans)
else:
    print(-1)












### FIXED CODE ###

# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline #文字列入力のときは注意

n = int(input())
a = [int(i) for i in readline().split()]
b = [int(i) for i in readline().split()]


def op(b,i):
    global ans
    if i == n-1:
        res = (b[i]-a[i])//(b[i-1]+b[0])
        if res < 0: return 0
        b[i] -= (b[i-1]+b[0])*res
    else:
        res = (b[i]-a[i])//(b[i-1]+b[(i+1)])
        if res < 0: return 0
        b[i] -= (b[i-1]+b[(i+1)])*res
    ans += res
    return res

def check(b,c):#c からチェック 操作ができる最初のi
#    print(b,c)
    for i in range(c,c+n):
        if op(b,i%n) > 0: return i
    else:
        return(-1)

def rev(b,i):#iから逆向きに操作
    for j in range(i-1,-n,-1):
#        print(b,j)
        if op(b,j%n) == 0: break

    
c = 0
ans = 0
"""
while True:
    i = check(b,c)
    if i == -1: break
    rev(b,i)
    c += 1
    if c >= n: c -= n
"""

s = set(range(n))

while s:
    i = s.pop()
    if op(b,i) > 0:
        s.add((i-1)%n)
        s.add((i+1)%n)

if a == b:
    print(ans)
else:
    print(-1)
### BUGGY CODE ###

S = str(input())
ans = 0
while True:
    S = S.replace("01", "R")
    S = S.replace("10", "L")
    if S.count("R") + S.count("L") > 0:
        ans +=(S.count("R") + S.count("L"))*2
        S = S.replace("R", "")
        S = S.replace("L","")
    else:
        break
print(ans)

### FIXED CODE ###

S = input()
ans = 2*min(S.count("0"), S.count("1"))
print(ans)
### BUGGY CODE ###

def dijkstra(s,n,w,cost):
    #始点sから各頂点への最短距離
    #n:頂点数,　w:辺の数, cost[u][v] : 辺uvのコスト(存在しないときはinf)
    d = [float("inf")] * n
    used = [False] * n
    d[s] = 0

    while True:
        v = -1
        #まだ使われてない頂点の中から最小の距離のものを探す
        for i in range(n):
            if (not used[i]) and (v == -1):
                v = i
            elif (not used[i]) and d[i] < d[v]:
                v = i
        if v == -1:
            break
        used[v] = True

        for j in range(n):
            d[j] = min(d[j],d[v]+cost[v][j])
    return tuple(d)

n,x,y = map(int,input().split())

#cost[u][v] : 辺uvのコスト(存在しないときはinf この場合は10**10)
cost = [[float("inf") for i in range(n)] for i in range(n)]

for i in range(n-1):
    cost[i][i+1] = 1
    cost[i+1][i] = 1
cost[x-1][y-1] = 1
cost[y-1][x-1] = 1

ans = [0 for _ in range(n)]
for i in range(n):
    #nは頂点数、wは辺の数
    res = dijkstra(i,n,n,cost)
    for j in range(i+1,n):
        ans[res[j]] += 1

for i in range(1,n):
    print(ans[i])


### FIXED CODE ###

from scipy.sparse.csgraph import dijkstra
import sys
def main():
	input = sys.stdin.readline

	n,x,y = map(int,input().split())

	route = [[0 for _ in range(n)]for _ in range(n)]
	for i in range(n-1):
		route[i][i+1] = 1

	route[x-1][y-1] = 1
	route[y-1][x-1] = 1
	route = tuple(route)
	#res = shortest_path(route, unweighted=False,directed=False)
	res = tuple(dijkstra(route, directed=False))

	ans = [0 for _ in range(n)]
	for i in range(n):
		for j in range(i,n):
			ans[int(res[i][j])] += 1

	for i in range(1,n):
		print(ans[i])
if __name__ == '__main__':
    main()
### BUGGY CODE ###

H, N = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N)]

dp = [float("INF")] * 10 ** 5
dp[0] = 0

for h in range(H):
    for a, b in AB:
        dp[h+a] = min(dp[h] + b, dp[h+a])

print(min(dp[H:]))

### FIXED CODE ###

H, N = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N)]

dp = [float("INF")] * (H+1)
dp[0] = 0  # 添字：敵HP、　配列の中身：敵HPを削るのに必要な最小のMP

# 配るDP
for h in range(H):
    for a, b in ab:
        target = min(H, h + a)  # target: DPのうち、書き換える部分の添字。Hを超えた部分は考察する必要なし
        dp[target] = min(dp[target], dp[h] + b)

print(dp[-1])
### BUGGY CODE ###

#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
H,W,M = readInts()

dic1 = defaultdict(int)
dic2 = defaultdict(int)
s = set()
for i in range(M):
    h,w = map(lambda x:int(x)-1, input().split())
    dic1[h] += 1
    dic2[w] += 1
    s.add((h,w))
# print(dic)
ans = 0


# 辞書の値が最大・最小となるキーを取得
max1 = max(dic1.values())
max2 = max(dic2.values())
for k1,v1 in dic1.items():
    if v1 < max1:
        continue
    for k2,v2 in dic2.items():
        if v2 < max2:
            continue
        if (k1,k2) in s:
            ans = max(ans,dic1[k1] + dic2[k2] - 1)
        else:
            ans = max(ans,dic1[k1] + dic2[k2])
print(ans)


### FIXED CODE ###

#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from math import gcd
from itertools import combinations,permutations,accumulate, product # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
import decimal
import re
import math
import bisect
import heapq
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#
# my_round_int = lambda x:np.round((x*2 + 1)//2)
# 四捨五入g
#
# インデックス系
# int min_y = max(0, i - 2), max_y = min(h - 1, i + 2);
# int min_x = max(0, j - 2), max_x = min(w - 1, j + 2);
#
#
import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
#mod = 998244353
INF = float('inf')
from sys import stdin
readline = stdin.readline
def readInts():
  return list(map(int,readline().split()))
def readTuples():
    return tuple(map(int,readline().split()))
def I():
    return int(readline())
H,W,M = readInts()

dic1 = Counter()
dic2 = Counter()
s = set()
for i in range(M):
    h,w = map(lambda x:int(x)-1, input().split())
    dic1[h] += 1
    dic2[w] += 1
    s.add((h,w))
# print(dic)
ans = 0

# 重なっているもので最大値がある時もあれば
# 行、列の交差点でボムなしが一番大きいものがある
for h,w in s:
    ans = max(ans, dic1[h] + dic2[w] - 1)

dic1 = dic1.most_common()
dic2 = dic2.most_common()
max1 = dic1[0][1]
max2 = dic2[0][1]

for k1,v1 in dic1:
    if v1 < max1:
        break # continueする必要がない most_commonで大きい方から集めてるので
    for k2,v2 in dic2:
        if v2 < max2:
            break # 同じく
        if (k1,k2) in s: # 一度計算したもの
            continue
        # 両方とも最大であればok
        ans = max(ans, v1 + v2)
        break
print(ans)