Harryxun/stf_run huggingface dataset:
N=int(input())

X=[]
for i in range(N):
  a=input().split()
  X.append([int(a[0]),int(a[1])])


def ceil(x):
  if int(x)==x:
    return int(x)
  else:
    return int(x//1+1)


a=X[0][0]
b=X[0][1]

def f(a,b,i):
  c=X[i+1][0]
  d=X[i+1][1]

  x=ceil(a/c)
  y=ceil(b/d)
  ans=1000000000000
  if i!=N-2:
    if c*y-a>=0:
      a=c*y
      b=d*y
      ans=min(ans,f(a,b,i+1))
    
    if d*x-b>=0:
      a=c*x
      b=d*x
      ans=min(ans,f(a,b,i+1))

  elif i==N-2:
    
    if c*y-a>=0:
      a=c*y
      b=d*y
      ans=min(ans,a+b)
    
    if d*x-b>=0:
      a=c*x
      b=d*x
      ans=min(ans,a+b)

  return ans



print(f(a,b,0))





### FIXED CODE ###

N=int(input())
 
X=[]
for i in range(N):
  a=input().split()
  X.append([int(a[0]),int(a[1])])
 
 
a=X[0][0]
b=X[0][1]
 
for i in range(1,N):
  c=X[i][0]
  d=X[i][1]
 

  x= (a + (c - 1)) // c
  y= (b + (d -1)) // d
  
  a1=1000000000000000000
  b1=1000000000000000000
  a2=1000000000000000000
  b2=1000000000000000000
  if d*x-b>=0:
    a1=c*x
    b1=d*x
 
  
  if c*y-a>=0:
    a2=c*y
    b2=d*y
  if (a1+b1)<(a2+b2):
    a=a1
    b=b1
  else:
    a=a2
    b=b2
 
  #print("i = "+str(i)+" a = "+str(a)+" b = "+str(b)+" a1 = "+str(a1)+" b1 = "+str(b1)+" a2 = "+str(a2)+" b2 = "+str(b2)+" c = "+str(c)+" d = "+str(d))
  
 
 
 
 
  
print(a+b)
import heapq

tmp = list(map(int, input().split()))
x = tmp[0]
y = tmp[1]
z = tmp[2]
k = tmp[3]
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)

#log = [[[False for _ in range(z)] for _ in range(y)] for _ in range(x)]
log = [False] * x * y * z
h = []
heapq.heappush(h, (-(a[0]+b[0]+c[0]), 0, 0, 0))
for i in range(k): 
  tmp = heapq.heappop(h)
  print(-tmp[0])
  if tmp[1]+1 < x and log[(tmp[1]+1) * y * z + tmp[2] * z + tmp[3]] == False:
    heapq.heappush(h, (-(a[tmp[1]+1]+b[tmp[2]]+c[tmp[3]]), tmp[1]+1, tmp[2], tmp[3]))
    log[(tmp[1]+1) * y * z + tmp[2] * z + tmp[3]] = True
  if tmp[2]+1 < y and log[tmp[1] * y * z + (tmp[2]+1) * z + tmp[3]] == False:
    heapq.heappush(h, (-(a[tmp[1]]+b[tmp[2]+1]+c[tmp[3]]), tmp[1], tmp[2]+1, tmp[3]))
    log[tmp[1] * y * z + (tmp[2]+1) * z + tmp[3]] = True
  if tmp[3]+1 < z and log[tmp[1] * y * z + tmp[2] * z + tmp[3]+1] == False:
    heapq.heappush(h, (-(a[tmp[1]]+b[tmp[2]]+c[tmp[3]+1]), tmp[1], tmp[2], tmp[3]+1))
    log[tmp[1] * y * z + tmp[2] * z + tmp[3]+1] = True

### FIXED CODE ###

tmp = list(map(int, input().split()))
x = tmp[0]
y = tmp[1]
z = tmp[2]
k = tmp[3]
a = sorted(list(map(int, input().split())), reverse=True)
b = sorted(list(map(int, input().split())), reverse=True)
c = sorted(list(map(int, input().split())), reverse=True)

ansl = []
for p in range(x):
  if p > k:
    break
  for q in range(y):
    if p * q > k:
      break
    for r in range(z):
      if p * q * r > k:
        break
      ansl.append(a[p] + b[q] + c[r])

ansl.sort(reverse=True)

for i in range(k):
  print(ansl[i])
a=input()
b=input()
ans=0
if(a[0]==b[2]):
  if(a[1]==b[1]):
    if(a[2]==b[0]):
      print("YES")
      ans=1
      
if(ans=0):
  print("NO")

### FIXED CODE ###

a=input()
b=input()
ans=0
if(a[0]==b[2]):
  if(a[1]==b[1]):
    if(a[2]==b[0]):
      print("YES")
      ans=1
      
if(ans==0):
  print("NO")
from sys import stdin
import fractions
from collections import deque
 
 
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
#A = deque(A)
 
res = []
 
for i in range(N):
    B = A[:]
    del B[i]
    B.sort()

    res.append(fractions.gcd(B[0], B[1]))

 
print(max(res))

### FIXED CODE ###

from sys import stdin
import fractions

N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
# インデックスを直感で使えるように先頭にダミーを入れる
A = [0] + A

"""
L(i) := A_1, A_2, ..., A_i-1 の最大公約数
R(i) := A_i, A_i+1, ..., A_N の最大公約数
Aiを書き換えることにした場合の最大公約数をM_iとすると
M_i = gcd(L(i), R(i+1))

ただし L(0)=0, R(N+1)=0
"""

L = [0 for _ in range(N+1)]
R = [0 for _ in range(N+2)]

for i in range(N):
    L[i+1] = fractions.gcd(L[i], A[i])


for i in range(N, 0, -1):
    R[i] = fractions.gcd(R[i+1], A[i])

M = []

for i in range(1, N+1):
    M_i = fractions.gcd(L[i], R[i+1])
    M.append(M_i) 

print(max(M))
import sys
input = sys.stdin.readline
n = int(input())
ab = [list(map(int,input().split())) for i in range(n-1)]

tree = {}
for i in ab:
    if tree.get(i[0],-1) == -1:
        tree[i[0]] = [i[1]]
    else:
        tree[i[0]].append(i[1])
    if tree.get(i[1],-1) == -1:
        tree[i[1]] = [i[0]]
    else:
        tree[i[1]].append(i[0])

def maxdegree(tree,n):
    a = 0
    for i in range(1,n+1):
        a = max(a,len(tree[i]))
    return a

print(maxdegree(tree,n))

abmap = [[-1]*(n+1) for i in range(n+1)]

def coloring(self_num,parent,used_color):
    global tree
    global abmap
    num = self_num
    color = 1
    nodes = tree[num]
    for i in nodes:
        if i == parent:
            continue
        else:
            if color == used_color:
                color += 1
            abmap[num][i] = color
            abmap[i][num] = color
            coloring(i,num,color)
            color += 1

coloring(1,0,0)

for i in ab:
    print(abmap[i[0]][i[1]])


### FIXED CODE ###

from collections import deque

N = int(input())
edges = [[] for _ in range(N)]
edge_index = {}
ab = [tuple(map(lambda x: int(x)-1, input().split())) for _ in range(N-1)]
for i, (a, b) in enumerate(ab):
    edges[a].append(b)
    edges[b].append(a)
    edge_index[(a, b)] = edge_index[(b, a)] = i
# print(edges)

max_degree = 0
root = 0
for i in range(N):
    if len(edges[i]) > max_degree:
        max_degree = len(edges[i])
        root = i

color = [-1]*(N-1)
visited = [False]*N
visited[root] = True

stack = deque()  # (vertex, color_index)
for i, to in enumerate(edges[root]):
    color[edge_index[(root, to)]] = i+1
    visited[to] = True
    stack.append((to, i+1))

while stack:
    v, v_col = stack.pop()
    color_condidate = 0
    for to in edges[v]:
        assert color_condidate <= max_degree, "hello"
        if visited[to]:
            continue
        visited[to] = True
        color_condidate += 1
        if color_condidate == v_col:
            color_condidate += 1
        idx = edge_index[(v, to)]
        color[idx] = color_condidate
        stack.append((to, color_condidate))

print(max_degree)
print(*color, sep='\n')
[a,b] = int(input(),split())
 if a < b:
   print(" a < b ")
 elif a > b:
   print(" b < a ")
 else:
   print(" a == b ")

### FIXED CODE ###

a,b = map(int,input().split())

if a < b:
    print("a < b")
elif a > b:
    print("a > b")
else:
    print("a == b")
N = int(input())

kmax = math.floor((-1+math.sqrt(1+4*N))/2)
acc = 0
for k in range(1, kmax+1):
    if((N-k)%k==0):
        acc+=(N-k)/k
print(int(acc))

### FIXED CODE ###

N = int(input())

kmax = (N+1/4)**(1/2)-1/2

acc = 0
for k in range(1, int(kmax+1)):
    m = (N-k)//k
    if(((N-k)%k==0)&(k<m)):
        acc+=m
print(int(acc))
a=int(input()) 
b=int(input())
print(a*b,(a+b)*2)


### FIXED CODE ###

a,b = map(int,input().split())
print(a*b,(a+b)*2)
import sys
input=sys.stdin.readline

ans=0
N,M=map(int,input().split())
Ar=[[] for _ in range(M)]
for _ in range(N):
      A,B=map(int,input().split())
      if A <= M:
          Ar[A-1].append(B)
An=[]
for i in range(M):
      An += Ar[i]
      if len(An)>0:
          An = An.sort()
          ans += pop(len(An))
print(ans)


### FIXED CODE ###

import heapq
N , M = map(int , input().split())
jobs = [list(map(int , input().split())) for _ in range(N)]
jobs.sort()

q = []
index = 0
ans = 0
for limit in range(1 , M + 1):
    while index < N:
        time =jobs[index][0]
        reward = jobs[index][1]
        if limit >= time:
            heapq.heappush(q , -reward)
            index += 1
        else:
            break
    #print(q)
    if len(q) != 0:
        tmp = heapq.heappop(q)
        ans -= tmp

print(ans)
from collections import deque

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

for i in range(1, len(A)):
    A[i] += A[i-1]
for i in range(1, len(B)):
    B[i] += B[i-1]

indexB = len(B) - 1
results = []
for i in range(len(A)):
    time = A[i]
    if time > K:
        break
    while(indexB >= 0 and time + B[indexB] > K):
        indexB -= 1
    results.append(i+1 + indexB+1)

print(max(results))

### FIXED CODE ###

from bisect import bisect
from collections import deque

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

for i in range(1, len(A)):
    A[i] += A[i-1]
for i in range(1, len(B)):
    B[i] += B[i-1]
A.insert(0, 0)
indexB = len(B) - 1
results = [0]
for i in range(len(A)):
    time = A[i]
    if time > K:
        break
    enable_for_b = K - time
    results.append(i + bisect(B, enable_for_b))

print(max(results))
File Edit Options Buffers Tools Python Help
def island(f,x,y,m):
    if f[y][x] == 1:
        f[y][x] = m
        for i in [-1,1]:
            if 0 <= x+i <= 11:
                f = island(f,x+i,y,m)
            if 0 <= y+i <= 11:
                f = island(f,x,y+i,m)
    return f
while True:
    f = []; m = 2
    for i in range(12):
        f.append(map(int, list(raw_input())))
    for y in range(12):
        for x in range(12):
            if f[y][x]:
                f = island(f,x,y,m)
                m += 1
    ans = []
    for i in range(12):
        for j in range(12):
            ans.append(f[i][j])
    ans = list(set(ans))
    print len(ans) - 1*ans.count(0)
    try:raw_input()
    except: break

### FIXED CODE ###

W,H = 12,12
dxy = [[1,0],[0,1],[-1,0],[0,-1]]
def solve(field,w,h):
	if 0 <= w < W and 0 <= h < H and field[h][w] == "1":
		field[h][w] = "0"
		for dx,dy in dxy:
			solve(field,w+dx,h+dy)

while 1:
	try:
		field = [list(raw_input()) for i in range(H)]
		ans = 0
		for h in range(H):
			for w in range(W):
				if field[h][w] == "1":
					solve(field,w,h)
					ans += 1
		print ans
		raw_input()
	except:
		break
N, M = map(int, input().split())
dp = [-1] * (10 ** 5 + 7)

def rec(v):
    if dp[v] != -1:
        return dp[v]
    res = 0
    for u in E[v]:
        res = max(res, rec(u) + 1)
    dp[v] = res
    return dp[v]

E = [[] for _ in range(N)]
for _ in range(M):
    x, y = map(int, input().split())
    E[x-1].append(y-1)

ans = 0
for v in range(N):
    ans = max(ans, rec(v))

print(ans)

### FIXED CODE ###

from collections import deque

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

dp = [0] * N
E = [[] for _ in range(N)]
deg = [0] * N
for _ in range(M):
    x, y = map(int, input().split())
    E[x-1].append(y-1)
    deg[y-1] += 1

que = deque(v for v in range(N) if deg[v] == 0)
while que:
    v = que.pop()
    for u in E[v]:
        deg[u] -= 1
        if deg[u] == 0:
            que.appendleft(u)
            dp[u] = max(dp[u], dp[v] + 1)

print(max(dp))
a,b,c,k-map(inat,input().split())
ans=0
ans+=min(k,a)
k-=min(k,a)
k-=min(k,b)
ans-=min(k,c)
print(ans)

### FIXED CODE ###

a,b,c,k=map(int,input().split())
if k<=a:print(k)
elif k<=a+b:print(a)
else:print(2*a-k+b)
n,k=map(int,input().split())
td=[list(map(int,input().split()))[::-1]for _ in range(n)]
td.sort(reverse=1)
s=set()
ss=set()
a=[]
b=[]
c=[]
for i in range(n):
  if i<k:
    d,t=td[i]
    if t in s:
      b.append(d)
    else:
      a.append(d)
      s.add(t)
      ss.add(t)
  else:
    d,t=td[i]
    if t not in ss:
      c.append(d)
      ss.add(t)
c=c[::-1]
ls=len(s)
su=sum(a)+sum(b)
ans=ls*ls+su
for i in range(len(ss)-len(s)):
  ls+=1
  su-=b.pop()
  su+=c.pop()
  ans=max(ans,ls*ls+su)
print(ans)


### FIXED CODE ###

n,k=map(int,input().split())
a=[]
for _ in range(n):a.append(tuple(list(map(int,input().split()))[::-1]))
a.sort(reverse=1)
x,y=[],[]
s=set()
for i in range(k):
  d,t= a[i]
  if t in s:
    x.append(d)
  else:
    y.append(d)
    s.add(t)
xx,yy,v=sum(x),sum(y),len(y)
ans=xx+yy+v**2
for i in range(k,n):
    if len(x)==0:break
    d,t=a[i]
    if t in s:continue
    s.add(t)
    xx-=x.pop()
    yy+=d
    v+=1
    ans=max(ans,xx+yy+v**2)
print(ans)
x = input()
if x < 1200:
    print('ABC')
else:
    print('ARC')
    

### FIXED CODE ###

x = int(input())
if x < 1200:
    print('ABC')
else:
    print('ARC')
a, b = [int(n) for n in src.readline().split()]
print('%s %s %.5f' % (a//b, a%b, a/b))


### FIXED CODE ###

a, b = [int(n) for n in input().split()]
print('%s %s %.5f' % (a//b, a%b, a/b))
import numpy as np

def calc(n):
    if n < 2:
        return 0
    lim1 = int((n - 2) ** 0.5 - 1) + 1
    lim2 = int((-2 + (4 - 12 * (1 - n)) ** 0.5) / 6) + 1
    lim3 = int(n / 6) + 1

    result=np.zeros(n+1,dtype=int)
    for x in range(1, lim3):
        for y in range(1, lim2):
            if x > y:
                continue
            for z in range(1, lim1):
                if y > z:
                    continue
                index = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if index>n:continue
                s = set([x, y, z])
                if len(s) == 1:
                    result[index] += 1
                elif len(s) == 2:
                    result[index] += 3
                else:
                    result[index] += 6

    return result[1:]

for i in calc(int(input())):
    print(i)

### FIXED CODE ###

import numpy as np


def calc(n):
    #     lim = int((n - 2) ** 0.5 - 1) + 1
    lim = 130

    result = np.zeros(n + 1, dtype=int)
    for x in range(1, lim):
        for y in range(1, lim):
            if x > y:
                continue
            for z in range(1, lim):
                if y > z:
                    continue
                index = x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x
                if index > n:
                    continue
                s = set([x, y, z])
                if len(s) == 1:
                    result[index] += 1
                elif len(s) == 2:
                    result[index] += 3
                else:
                    result[index] += 6

    return result[1:]


for i in calc(int(input())):
    print(i)
import math
r = int(input))
print(math.pi * 2 * r)

### FIXED CODE ###

import math
r = int(input())
print(math.pi * 2 * r)
# -*- coding: utf-8 -*-
import sys
# INPUT
input = list(map(int, input().split()))

s = input[0]
t = input[1]

ans = t
print(t+s)


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
# INPUT
input = list(map(str, input().split()))

s = input[0]
t = input[1]

print(t+s)
N, M = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(M)]

connect_list = [set() for _ in range(N)]    #繋がっているリスト
ranking = [set() for _ in range(N)]     #入口に近い順
ranked_set = set()
full_set = {i for i in range(1, N+1)}
root_list = [0]*N
root_list[0] = "Yes"


def do_ranking(now_set):
    global connect_list, root_list
    if len(now_set) == 0:
        return 0
    next_set = set()
    for j in list(now_set):
        if j-1 >= N:
            break
        for i in list(connect_list[j-1]):
            if i-1 >= N:
                break
            if root_list[i-1] == 0:
                root_list[i-1] = j
                next_set.add(i)
    do_ranking(next_set)


for A, B in AB:
    connect_list[A-1].add(B)
    connect_list[B-1].add(A)
for i in list(connect_list[0]):
    if i - 1 < N:
        root_list[i-1] = 1
do_ranking(connect_list[0])   #道しるべ作成

for i in root_list:
    print(i)


### FIXED CODE ###

N, M = map(int, input().split())
connect_list = [set() for _ in range(N)]    #繋がっているリスト
for _ in range(M):
    A, B = map(int, input().split())
    connect_list[A-1].add(B)
    connect_list[B-1].add(A)

root_list = [0]*N
root_list[0] = "Yes"

for i in list(connect_list[0]):
    root_list[i-1] = 1
now_set = connect_list[0]
while len(now_set) != 0:
    for j in list(now_set):
        for i in list(connect_list[j-1]):
            if root_list[i-1] == 0:
                root_list[i-1] = j
                now_set.add(i)
        now_set.remove(j)

for i in root_list:
    print(i)
n,c=map(int,input().split())
x=[0]
v=[]
for i in range(n):
    a,b=map(int,input().split())
    x.append(a)
    v.append(b)
x1=[x[i+1]-x[i] for i in range(len(x)-1)]
x2=[c-x[-1]]+x1[:0:-1]
h=[0]
for i,j in zip(x2,reversed(v)):
    h.append(h[-1]+j+-i)
t=[0]
for i,j in zip(x1,v):
    t.append(t[-1]+j-i)
hi=h.index(max(h[0:-1]))
ti=t.index(max(t[0:-1]))
tm=max(t[0:-1])
hm=max(h[0:-ti])
h2=[h[i]-x[i] for i in range(len(h))]
t2=[t[i]-x[-i-1] for i in range(1,len(h))]
#print(h2,t2)

#print(ti,hi)
print(max( hm, tm, hm+max(t2[0:-ti]),tm+max(h2[:-ti])))


### FIXED CODE ###

n,c=map(int, input().split())
a=[[0,0]]+[list(map(int, input().split())) for i in range(n)]+[[c,0]]
m=[0]
h=[0]
mb=[0]
hb=[0]
for i in range(n+1):
    m.append(m[-1]-a[i+1][0]+a[i][0]+a[i+1][1])
    mb.append(m[-2]-a[i+1][0]+a[i][0]+a[i+1][1]-a[i+1][0])
    h.append(h[-1]-a[-i-1][0]+a[-i-2][0]+a[-i-2][1])
    hb.append(h[-2]-a[-i-1][0]+a[-i-2][0]+a[-i-2][1]-c+a[-i-2][0])

mm=[0]
for i in range(n):
    mm.append(max(mm[-1],m[i+1]))
hm=[0]
for i in range(n):
    hm.append(max(hm[-1],h[i+1]))
    
ans=max(hm[-1],mm[-1])
for i in range(1,n):
    ans=max(hb[i]+mm[-i-1], mb[i]+hm[-i-1],ans)
print(ans)
from math import gcd

# 最小公倍数を求める関数
def lcm(a,b):
    return int((a*b)/gcd(a,b))

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


m = lcm(a[0],a[1])
for i in range(1,len(a)):
    m = lcm(m,a[i])

res = int(sum([(m-1) % e for e in a]))
print(res)

### FIXED CODE ###

n = int(input())
res = sum(list(map(int, input().split()))) - n
print(res)
N = int(input())
arr = list(map(int, input().split()))
 
ans = []
 
for idx1 in range(1, N+1):
	for idx2 in range(len(arr), 0, -1):
		if arr[idx2-1] == idx2:
			tmp = arr.pop(idx2-1)
            ans.append(tmp)
			break
		elif idx2 == 1:
			print(-1)
			exit()

for idx in range(0, N):
	tmp = ans.pop(-1)
    print(tmp)
  	print("\n")


### FIXED CODE ###

N = int(input())
arr = list(map(int, input().split()))
 
ans = []
 
for idx1 in range(1, N+1):
	for idx2 in range(len(arr), 0, -1):
		if arr[idx2-1] == idx2:
			tmp = arr.pop(idx2-1)
			ans.append(tmp)
			break
		elif idx2 == 1:
			print(-1)
			exit()

for idx in range(0, N):
	tmp = ans.pop(-1)
	print(tmp)
n, k = map(int, input().split())

t = n%k
if t > k-t:
  print(k-t)
else:
  print(t)

### FIXED CODE ###

a, b, c = map(int, input().split())
hoge = a 
a = b
b = hoge
hoge = a
a = c
c = hoge

print(a,b,c)
import math

n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
lcm = (a[0] * a[1]) // math.gcd(a[0], a[1])
for i in range(2, n):
  lcm = (lcm * a[i]) // math.gcd(lcm, a[i])
print(lcm)


### FIXED CODE ###

import math

n = int(input())
a = []  
for i in range(n):
  a.append(int(input()))
if n == 1:
  print(a[0])
else:
  lcm = (a[0] * a[1]) // math.gcd(a[0], a[1])
  for i in range(2, n):
    lcm = (lcm * a[i]) // math.gcd(lcm, a[i])
  print(lcm)
N,M =map(int, input().split())
L,R =[],[]

for i in range(M+1):
  x,y = map(int,input().split())
  L.append(x)
  R.append(y)

print(max(0,min(R)-max(L))

### FIXED CODE ###

N,M =map(int, input().split())
L,R =[],[]
 
for i in range(M):
  x,y = map(int,input().split())
  L.append(x)
  R.append(y)
 
print(max(0,min(R)-max(L)+1))
s = input()
k = int(input())
l = len(s)

first = ''
for i in range(l):
	if s[i] != '1':
		first = s[i]
		pos = i
		break

print('1' if k <= pos else first)


### FIXED CODE ###

s = input()
k = int(input())
l = len(s)

first = ''
pos = l
for i in range(l):
	if s[i] != '1':
		first = s[i]
		pos = i
		break

print('1' if k <= pos else first)
import itertools
def my_index(l, x):
    return [i for i, _x in enumerate(l) if _x == x]

H,W,M=map(int,input().split())
P=list()
P_X=[0]*(H+1)
P_Y=[0]*(W+1)
for m  in range(M):
    P.append(list(map(int,input().split())))
    P_X[P[m][0]]+=1
    P_Y[P[m][1]]+=1
Max_X=max(P_X)
Max_Y=max(P_Y)
#max_X=my_index(P_X,Max_X)
#max_Y=my_index(P_Y,Max_Y)
m_count=0
for k in P:
    if  P_X[k[0]] == Max_X and P_Y[k [1]] == Max_Y:
        m_count += 1
if m_count==len(max_X)*len(max_Y):
    answer=Max_X+Max_Y-1
else:
     answer=Max_X+Max_Y
    
print(answer)

### FIXED CODE ###


def my_index(l, x):
    return [i for i, _x in enumerate(l) if _x == x]

H,W,M=map(int,input().split())
P=list()
P_X=[0]*(H+1)
P_Y=[0]*(W+1)
for m  in range(M):
    P.append(list(map(int,input().split())))
    P_X[P[m][0]]+=1
    P_Y[P[m][1]]+=1
Max_X=max(P_X)
Max_Y=max(P_Y)
max_X=my_index(P_X,Max_X)
max_Y=my_index(P_Y,Max_Y)
m_count=0
for k in P:
    if  P_X[k[0]] == Max_X and P_Y[k [1]] == Max_Y:
        m_count += 1
if m_count==len(max_X)*len(max_Y):
    answer=Max_X+Max_Y-1
else:
     answer=Max_X+Max_Y
    
print(answer)
n, m = map(int, input().split())
aL = [int(input()) for _ in range(m)]
mod = 10**9+7
cant = 0
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 0 if aL[0] == 1 else 1
pos = 1 if aL[0] == 1 else 0
for i in range(n-1):
    if pos < len(aL):
        if i+2 == aL[pos]:
            dp[i+2] = 0
            pos += 1
        else:
            dp[i+2] += (dp[i] + dp[i+1]) % mod
    else:
        dp[i+2] += (dp[i] + dp[i+1]) % mod

print(dp[-1])

### FIXED CODE ###

n, m = map(int, input().split())
a_pos = [0]*(n+1)
for i in range(m):
    a_pos[int(input())] = 1
mod = 10**9+7
dp = [0]*(n+1)
dp[0] = 1
dp[1] = 0 if a_pos[1] else 1
for i in range(2, n+1):
    if a_pos[i] == 1:
        dp[i] = 0
    else:
        dp[i] = (dp[i-2] + dp[i-1]) % mod

print(dp[-1])
def read():
    return int(input())

def reads(sep=None):
    return list(map(int, input().split(sep)))

def main():
    n, m = reads();
    g = [set() for _ in range(m)]
    for _ in range(m):
        a, b = reads()
        g[a - 1].add(b - 1)
        g[b - 1].add(a - 1)
    
    count = 0
    q = [(0, [])]
    while q:
        i, p = q.pop(0)
        if len(p) == (n-1):
            count += 1
        for e in g[i]:
            if e in p:
                continue
            pp = p[:]
            pp.append(i)
            q.append((e, pp))
    print(count)
 
main()


### FIXED CODE ###

def read():
    return int(input())

def reads(sep=None):
    return list(map(int, input().split(sep)))

def main():
    n, m = reads();
    g = [set() for _ in range(n+1)]
    for _ in range(m):
        a, b = reads()
        g[a - 1].add(b - 1)
        g[b - 1].add(a - 1)
    
    count = 0
    q = [(0, [])]
    while q:
        i, p = q.pop(0)
        if len(p) == (n-1):
            count += 1
        for e in g[i]:
            if e in p:
                continue
            pp = p[:]
            pp.append(i)
            q.append((e, pp))
    print(count)
 
main()
A, B=map(int, input(). split())
if A%2==1 and B%2==1:
	print(‘Yes’)
else:
	print(‘No’)


### FIXED CODE ###

A, B=map(int, input(). split())
if A%2==1 and B%2==1:
	print("Yes")
else:
	print("No")
import bisect

n, m = list(map(int, input().split()))
cl = list(map(int, input().split()))
cl.sort()
ql=[]
for _ in range(m):
    b, c = list(map(int, input().split()))
    for _ in range(b):
        ql.append(c)
ql.sort()
ql.reverse()
ans=0
i = 0
for c in cl:
    if i >len(cl):
        break
    if c < ql[i]:
        ans+=ql[i]
        i+=1
    else:
        ans+=c
print(ans)

### FIXED CODE ###

n, m = list(map(int, input().split()))
cl = list(map(int, input().split()))
cl.sort()
ql=[]
for _ in range(m):
    b, c = list(map(int, input().split()))
    ql.append([b,c])
ql.sort(key=lambda x: x[1],reverse=True)
i, j = 0,0
while i < len(cl) and j < len(ql):
    if cl[i] < ql[j][1]:
        cl[i] = ql[j][1]
        ql[j][0] -=1
        if ql[j][0] == 0:
            j+=1
    i+=1
print(sum(cl))
s = sys.stdin.readline().rstrip()
t = sys.stdin.readline().rstrip()

count = 0
for i in range(len(s)):
  if s[i] != s[t]:
    count += 1
print(count)

### FIXED CODE ###

import sys

s = sys.stdin.readline().rstrip()
t = sys.stdin.readline().rstrip()

count = 0
for i in range(len(s)):
  if s[i] != t[i]:
    count += 1
print(count)