Harryxun/stf_run huggingface dataset:
N = int(input())
S = [input() for _ in range(N)]

D = [[0] * 2 for _ in range(N)]

for i in range(N):
  s = S[i]
  ma = 0
  l = 0
  r = 0
  for j in s:
    if j == ")":
      r += 1
    else:
      l += 1
    ma = max(ma, r - l)
  D[i] = [l - r, ma, s]

cnt = 0
P = []
M = []
for x, y ,s in D:
  if x >= 0:
    if y <= 0:
      cnt += x
    else:
      P.append([x, y])
  else:
    M.append([x, y, s])

P.sort(key = lambda x:x[1])

for x, y in P:
  if y > cnt:
    print("No")
    exit()
  cnt += x

if len(M) == 0:
  if cnt == 0:
    print("Yes")
  else:
    print("No")
  exit()

M.sort(key = lambda x:x[1], reverse = True)

for i in range(len(M) -1, -1, -1):
  x, y, s= M[i]
  if x == -y:
    g = x
    M[i] = [0, 0, ""]
    break
else:
  print("No")
  exit()

for x, y, s in M:
  if cnt < y:
    x = 10 / 0
    print("No")
    exit()
  cnt += x

if cnt + g == 0:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

N = int(input())
S = [input() for _ in range(N)]

D = [[0] * 2 for _ in range(N)]

for i in range(N):
  s = S[i]
  ma = 0
  l = 0
  r = 0
  for j in s:
    if j == ")":
      r += 1
    else:
      l += 1
    ma = max(ma, r - l)
  D[i] = [l - r, ma, s]

cnt = 0
P = []
M = []
for x, y ,s in D:
  if x >= 0:
    if y <= 0:
      cnt += x
    else:
      P.append([x, y])
  else:
    M.append([x, y, s])

P.sort(key = lambda x:x[1])

for x, y in P:
  if y > cnt:
    print("No")
    exit()
  cnt += x

if len(M) == 0:
  if cnt == 0:
    print("Yes")
  else:
    print("No")
  exit()

M.sort(reverse = True)
M.sort(key = lambda x:x[1], reverse = True)

for i in range(len(M)):
  x, y, s = M[i]
  if x == -y:
    g = x
    M[i] = [0, 0, ""]
    break
else:
  print("No")
  exit()

for x, y, s in M:
  if cnt < y:
    print("No")
    exit()
  cnt += x

if cnt + g == 0:
  print("Yes")
else:
  print("No")
D = int(intput())

if D == 25 :
  print('Christmas')
elif D == 24 :
  print('Christmas Eve')
elif D == 23 :
  print('Christmas Eve Eve')
elif D == 22 :
  print('Christmas Eve Eve Eve')


### FIXED CODE ###

D = int(input())

if D == 25 :
  print('Christmas')
elif D == 24 :
  print('Christmas Eve')
elif D == 23 :
  print('Christmas Eve Eve')
elif D == 22 :
  print('Christmas Eve Eve Eve')
n = int(input())
alst = list(map(int, input().split()))
alst.sort()
tmp = [0 for _ in range(10 ** 6 + 1)]
ans = 0
if alst[0] == 1:
    if n == 1:
        print(1)
    elif alst[1] == 1:
        print(0)
    else:
        print(1)
    exit()
for num in alst:
    if tmp[num] == 2:
        if flg:
            ans -= 1
            flg = False
        continue
    flg = True
    if tmp[num] == 1:
        continue
    ans += 1
    tmp[num] = 2
    xx = num * 2
    while xx <= 10 **  6 + 1:
        tmp[xx] = 1
        xx += num
print(ans)

### FIXED CODE ###

n = int(input())
alst = list(map(int, input().split()))
alst.sort()
tmp = [0 for _ in range(10 ** 6 + 10)]
ans = 0
flg = True
if n == 1:
    print(1)
    exit()
if alst[0] == 1:
    if alst[1] == 1:
        print(0)
    else:
        print(1)
    exit()
for num in alst:
    if tmp[num] == 2:
        if flg:
            ans -= 1
            flg = False
        continue
    flg = True
    if tmp[num] == 1:
        continue
    ans += 1
    tmp[num] = 2
    xx = num * 2
    while xx < 10 **  6 + 1:
        tmp[xx] = 1
        xx += num
print(ans)
S = input()
T = input()
A = len(T)  
for i in range(len(S)):
    diff = 0
    for j in range(len(T)):
        if T[j] != S[i + j]:
            diff = diff +1;
    A = min(A,diff)
print(A)

### FIXED CODE ###

s = input()
t = input()
ls = []
for i in range(len(s) - len(t) + 1):
    ls.append(s[i:i+len(t)])
now = 0
minimum = len(t)
for i in range(len(ls)):
    now = 0
    for j in range(len(t)):
        if t[j] == ls[i][j]:
            now += 1
    if len(t) - now < minimum:
        minimum = len(t) - now
print(minimum)
x, a, b = map(int, input().split())
 
x1 = x - a
result  = x1 % b
 
print(result)

### FIXED CODE ###

x = int(input())
a = int(input())
b = int(input())
 
x1 = x - a
result  = x1 % b
 
print(result)
import cmath
import numpy as np
import sys

INF=10**18
MOD=10**9+7
MAX=10**5+7

def main():
    N=int(input())
    dp=[0, 0, 0]
    for line in sys.stdin.readlines():
        a,b,c=map(int, line.split())
        ndp=[0, 0, 0]
        ndp[0]=max(dp[1], dp[2])+a
        ndp[1]=max(dp[2], dp[0])+b
        ndp[2]=max(dp[0], dp[1])+c
        dp=ndp[:]
    print(max(dp))

if __name__=='__main__':
    main()


### FIXED CODE ###

import cmath
import numpy as np
import sys

INF=10**18
MOD=10**9+7
MAX=10**5+7

def main():
    N=int(input())
    dp=[0, 0, 0]
    for _ in range(N):
        a,b,c=map(int, input().split())
        ndp=[0, 0, 0]
        ndp[0]=max(dp[1], dp[2])+a
        ndp[1]=max(dp[2], dp[0])+b
        ndp[2]=max(dp[0], dp[1])+c
        dp=ndp
    print(max(dp))

if __name__=='__main__':
    main()
x = input()
if x => 30:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

x = int(input())
if x >= 30:
  print("Yes")
else:
  print("No")
a,b=int(input().split())
if a<10 and b<10:
    print(a*b)
else:
    print(-1)


### FIXED CODE ###

a,b=map(int,(input().split()))
if a<10 and b<10:
    print(a*b)
else:
    print(-1)
N = int(input())
power_r = 1
for n in range(2,N+1):
    power_r = power_r*n % (10**9+7)
print(factorial(N))

### FIXED CODE ###

import math
N = int(input())
print(math.factorial(N)%(10**9+7))
n,m=map(int,input().split())
A=[[] for i in range(n)]
for i in range(m) :
    a,b=map(int,input().split())
    A[b-1].append(a-1)
    A[a-1].append(b-1)
depth=[0 for i in range(n)]


def search(now,sum) :
    if depth[now]!=0 : #すでに訪れていた場合
        sum+=1
        if sum<depth[now] :
            depth[now]=sum
            for i in A[now] :
                now=i
                search(now,sum)

    if depth[now]==0 :
        sum+=1
        depth[now]=sum
        for i in A[now] :
            now=i
            search(now,sum)
 
    return depth

B=search(0,0)
if B.count(0)==0 :
    print("Yes")
    for i in B[1:] :
        print(i-1)

else :
    print("No")

### FIXED CODE ###

from collections import deque
n,m=map(int,input().split())
A=[[] for i in range(n)]
for i in range(m) :
    a,b=map(int,input().split())
    A[b-1].append(a-1)
    A[a-1].append(b-1)
depth=[-1]*n
visit=deque([0])

while True :
    if len(visit)==0 :
        break
    x=visit.popleft()
    for i in A[x] :
        if depth[i]==-1 :
            depth[i]=x+1
            visit.append(i)

print("Yes")
[print(i) for i in depth[1:]]
import sys
input=sys.stdin.readline
n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
num=[0,2,5,5,4,5,6,3,7,6]
inf=float("inf")
dp=[-1*inf]*(n+1)
dp[0]=0
for i in range(1,n+1):
    for j in range(m):
        dp[i]=max(dp[i],dp[i-num[a[j]]]+1)
ans=[]
for i in range(dp[n]):
    for j in range(m):
        if dp[n-num[a[j]]]==dp[n]-1:
            ans.append(a[j])
            n-=num[a[j]]
            break
print("".join(list(map(str,ans))))


### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort(reverse=True)
nums=[0,2,5,5,4,5,6,3,7,6]
dp=[-1]*(n+1)
dp[0]=0
for i in range(1,n+1):
    for x in a:
        if i-nums[x]>=0:
            dp[i]=max(dp[i-nums[x]]+1,dp[i])
k=dp[n]
ans=[]
for i in range(k):
    for x in a:
        if n-nums[x]<0:
            continue
        if dp[n-nums[x]]==dp[n]-1:
            n-=nums[x]
            ans.append(x)
            break
print("".join(list(map(str,ans))))
x=int(input())
a=[]
for i in range(220):
  a.append[i**5]
for i in range(220):
  y=x-a[i]
  if y in a:
    print(i,a.index(y))
    break
  elif -y in a:
    print(i,-a.index(y))

### FIXED CODE ###

x=int(input())
a=[]
for i in range(220):
  a.append(i**5)
for i in range(220):
  y=a[i]-x
  if y in a:
    print(i,a.index(y))
    break
  elif -y in a:
    print(i,-a.index(-y))
    break
#138_D
n, q = map(int, input().split())

edges = [[] for _ in range(n)]
cnt = [0 for _ in range(n)]

for _ in range(n-1):
    a, b = map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
    
for _ in range(q):
    p, x = map(int, input().split())
    cnt[p-1] += x
    
used = [True for _ in range(n)]
def dfs(s):
    used[s] = False
    for idx in edges[s]:
        if used[idx]:
            cnt[idx] += cnt[s]
            dfs(idx)
dfs(0)          
print(*cnt)

### FIXED CODE ###

#138_D
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 6)

n, q = map(int, input().split())

edges = [[] for _ in range(n)]
cnt = [0 for _ in range(n)]

for _ in range(n-1):
    a, b = map(int, input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
    
for _ in range(q):
    p, x = map(int, input().split())
    cnt[p-1] += x
    
def dfs(frm, cur):
    for to in edges[cur]:
        if to != frm:
            cnt[to] += cnt[cur]
            dfs(cur, to)
dfs(-1, 0)          
print(*cnt)
# ABC 075 B

# H, W = 4, 3
# S = "#.."\
#     "..#"\
#     ".#."\
#     ".#."

H, W = map(int, input().split())
S = ''
for _ in range(H):
    S += input()
    

def cell_of(x, y):
    return S[W*x + y]

def neighbor_indice_of(x, y):
    return [
        (x+m, y+n)
        for m in range(-1, 2)
        for n in range(-1, 2)
        if 0 <= x+m < H and 0 <= y+n < W
    ]

def neighbors_of(x, y):
    return [
        cell_of(i, j)
        for i, j in neighbor_indice(x, y)
    ]

def mine(x, y):
    cell = cell_of(x, y)
    if cell != '.':
        return cell
    return str(neighbors_of(x, y).count('#'))


for x in range(H):
    print(''.join([mine(x, y) for y in range(W)]))

### FIXED CODE ###

# ABC 075 B

# H, W = 4, 3
# S = "#.."\
#     "..#"\
#     ".#."\
#     ".#."

H, W = map(int, input().split())
S = ''
for _ in range(H):
    S += input()
    

def cell_of(x, y):
    return S[W*x + y]

def neighbor_indice_of(x, y):
    return [
        (x+m, y+n)
        for m in range(-1, 2)
        for n in range(-1, 2)
        if 0 <= x+m < H and 0 <= y+n < W
    ]

def neighbors_of(x, y):
    return [cell_of(i, j) for i, j in neighbor_indice_of(x, y)]

def mine(x, y):
    cell = cell_of(x, y)
    if cell != '.':
        return cell
    return str(neighbors_of(x, y).count('#'))


for x in range(H):
    print(''.join([mine(x, y) for y in range(W)]))
import sys
s=input()

s_nox=[]
x=[]
xcount=0
for si in list(s):
    if(si!='x'):
        x.append(xcount)
        xcount=0
        s_nox.append(si)
    else:
        xcount+=1
else:
    x.append(xcount)


for i in range((len(s_nox)//2)+1):
    j=-1*i -1
    if(s_nox[i] != s_nox[j]):
        print(-1)
        sys.exit()


ans=0
for i in range(len(x)//2):
    j=-1*i -1
    ans+=abs(x[i]-x[j])

if(len(x)%2==1 and x[len(x)//2]%2==1):
    ans+=1

print(ans)

### FIXED CODE ###

import sys
s=input()
ans=0
i=0
j=len(s)-1
xi=0
yj=0
while(i<j):

    while(i<len(s)-1 and s[i]=='x'):
        i+=1
        xi+=1
#        print(i,xi)

    while(j>0 and s[j]=='x'):
        j-=1
        yj+=1
#        print(j,yj)

#    print(i,xi,j,yj)
    if(s[i]!=s[j]):
        print(-1)
        sys.exit()
    else:
        ans+=abs(xi-yj)
        xi=0
        yj=0
        i+=1
        j-=1

print(ans)
N = input()
result = "NO"
if i in N:
    if i == '9':
        result = "YES"
print(result)

### FIXED CODE ###

N = input()
result = "No"
for i in N:
    if i == '9':
        result = "Yes"
print(result)
import numpy as np
N,M,C = map(int,input().split())
B = list(int,input().split())
for i in range(1,N)
    Ai = list(int,input().split())
    ai = np.array(Ai)
b = np.array(B)
bt = b.reshape([N,1])
cnt = 0
for i in range(1,N)
    if (np.dot(ai,bt) + C >0)
         cnt += 1
print(cnt)




### FIXED CODE ###

import numpy as np
N,M,C = map(int,input().split())
B = [int(k) for k in input().split()]
A = [[int(j) for j in input().split()] for i in range(N)] 
b = np.array(B)
cnt = 0
for i in range(N):
    if (np.dot(np.array(A[i]),b) + C >0):
        cnt += 1
    else:
        cnt = cnt
        
print(cnt)
import numpy as np
a = input ()
input = np.array(map(int,raw_input().split()))
print np.delete(input, 0).min(axis=0),input.max(axis=0),input.sum(axis=0)

### FIXED CODE ###

a = input ()
numbers = map(int,raw_input().split())
print min(numbers),max(numbers),sum(numbers)
s=input()
print(char(ord(s)+1))

### FIXED CODE ###

s=input()
print(chr(ord(s)+1))
import sys
from itertools import combinations, permutations, product, combinations_with_replacement, accumulate
from heapq import heapify, heappop, heappush, heappushpop
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from math import sqrt, log, floor, ceil, factorial, cos, sin, pi #, gcd
from fractions import gcd
from operator import mul
from functools import reduce
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
INF = float('inf')
LINF = 2**63-1
NIL = -LINF
MOD = 10**9+7
MGN = 4
def II(): return int(input())
def IF(): return float(input())
def IS(): return input().replace('\n', '')
def ILCI(n: int): return [II() for _ in range(n)]
def ILCF(n: int): return [IF() for _ in range(n)]
def ILI(): return list(map(int, input().split()))
def ILLI(n: int): return [[int(j) for j in input().split()] for i in range(n)]
def ILF(): return list(map(float, input().split()))
def ILLF(n: int): return [[float(j) for j in input().split()] for i in range(n)]
def LTOS(lst: list, sep: str = ' '): return sep.join(map(str, lst))
def DEC(lst: list): return list(map(lambda x: x-1, lst))
def INC(lst: list): return list(map(lambda x: x+1, lst))


def main():
    A,B,C = ILI()

    ans = "No"
    # A + 2sqrt(AB) + B < C
    assert C - A -B > 0, "C - A - B > 0"
    if C - A - B  > 0 and  4 * A * B < (C- A - B) ** 2:
        ans = "Yes"

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from itertools import combinations, permutations, product, combinations_with_replacement, accumulate
from heapq import heapify, heappop, heappush, heappushpop
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from math import sqrt, log, floor, ceil, factorial, cos, sin, pi #, gcd
from fractions import gcd
from operator import mul
from functools import reduce
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
INF = float('inf')
LINF = 2**63-1
NIL = -LINF
MOD = 10**9+7
MGN = 4
def II(): return int(input())
def IF(): return float(input())
def IS(): return input().replace('\n', '')
def ILCI(n: int): return [II() for _ in range(n)]
def ILCF(n: int): return [IF() for _ in range(n)]
def ILI(): return list(map(int, input().split()))
def ILLI(n: int): return [[int(j) for j in input().split()] for i in range(n)]
def ILF(): return list(map(float, input().split()))
def ILLF(n: int): return [[float(j) for j in input().split()] for i in range(n)]
def LTOS(lst: list, sep: str = ' '): return sep.join(map(str, lst))
def DEC(lst: list): return list(map(lambda x: x-1, lst))
def INC(lst: list): return list(map(lambda x: x+1, lst))


def main():
    A,B,C = ILI()

    ans = "No"
    # A + 2sqrt(AB) + B < C
    if C - A - B  > 0 and  4 * A * B < (C- A - B) ** 2:
        ans = "Yes"

    print(ans)


if __name__ == '__main__':
    main()
h,w,k=map(int, input().split())
mat = []
for i in range(h):
  s = input()
  mat.append(s)
total = 0
for y in range(2**h):
  for x in range(2**w):
    mat2 = mat.copy()
    y_bin = bin(y)[2:]
    x_bin = bin(x)[2:]
    for r in y_bin:
      if r == "1":
        mat2[r] = "."*w
    for c in x_bin:
      if c == "1":
        for r in range(h):
          mat2[r][c] = "."
    count = 0
    for r in range(h):
      for c in range(w):
        if mat2[r][c] == "#":
          count += 1
    if count == k:
      total += 1
print(total)

### FIXED CODE ###

import copy
h,w,k=map(int, input().split())
mat = []
for i in range(h):
  s = list(input())
  mat.append(s)
total = 0
for y in range(2**h):
  for x in range(2**w):
    mat2 = copy.deepcopy(mat)
    y_bin = bin(y)[2:].zfill(h)
    x_bin = bin(x)[2:].zfill(w)
    # print(y_bin, x_bin)
    for r in range(len(y_bin)):
      if y_bin[r] == "1":
        for c in range(w):
          mat2[r][c] = "."
    for c in range(len(x_bin)):
      if x_bin[c] == "1":
        for r in range(h):
          mat2[r][c] = "."
    count = 0
    for r in range(h):
      for c in range(w):
        if mat2[r][c] == "#":
          count += 1
          # print(r, c)
    if count == k:
      total += 1
print(total)
import math
N = int(input())
# A, B = [i for i in input().split()]
def is_prime(n):
    if n == 1:
        return False
    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True
cands = []
for i in range(2, int(math.sqrt(N))+1):
    if N % i == 0:
        cands.append(i)
        cands.append(N%i)

if is_prime(N):
    print(1)
else:
    count = 0
    n = N
    for c in cands:
        if c > n:
            break
        if n % c == 0:
            n //= c
            count += 1
    print(count)

### FIXED CODE ###

import math
N = int(input())
# A, B = [i for i in input().split()]


def prime_factorization(n):
    # n = p1**e1 * p2**e2... pm**emのように素因数分解を行う。リストが空の場合は素数ということ
    fact_list = []
    for p in range(2, int(math.sqrt(n)) + 1):
        e = 0
        while n % p == 0:
            n //= p
            e += 1
        if e > 0:
            fact_list.append((p, e))
    if n != 1:
        fact_list.append((n, 1))
    return fact_list


prime_list = prime_factorization(N)
if len(prime_list) == 0:
    print(0)
else:
    count = 0
    for p, e in prime_list:
        a = 1
        sum_a = 0
        while True:
            sum_a += a
            if e < sum_a:
                break
            a += 1
        count += a - 1
    print(count)
def SsSl(): return list(map(lambda x: x, input()))

n = int(input())
#List = [s for s in input().split()]
List = SsSl()

if n%2==1:
    print('No')
else:
    if List[0:(n/2)]==List[(n/2):]:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

def SsSl(): return list(map(lambda x: x, input()))

n = int(input())
#List = [s for s in input().split()]
List = SsSl()

if n%2==1:
    print("No")
else:
    if List[0:(n//2)]==List[(n//2):]:
        print("Yes")
    else:
        #print(List[0:(n/2)])
        #print(List[(n/2):])
        print("No")
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>

typedef char Board[10];
Board ini_board, board;
const Board target = "123456780";

Board *history;
int nhistories=0;

typedef enum { U, D, L, R } Direction;

typedef struct {
  int pos;
  Direction dir;
} Motion;

int minstep = INT_MAX;

const Motion candidate[9][5] =
  {{{1,L},{3,U},{-1}}, {{0,R},{2,L},{4,U},{-1}}, {{1,R},{5,U},{-1}},
   {{0,D},{4,L},{6,U},{-1}}, {{1,D},{5,L},{7,U},{3,R},{-1}},
   {{2,D},{8,U},{4,R},{-1}},
   {{3,D},{7,L},{-1}}, {{4,D},{8,L},{6,R},{-1}}, {{5,D},{7,R},{-1}}  };

int move(Motion m)
{
  if (m.pos==0 && board[0]=='1') return -1;
  if ((m.pos==1||m.pos==2) && board[0]=='1'&&board[1]=='2'&&board[2]=='3') return -1;

  switch (m.dir) {
  case U:
    if (m.pos<3) return -1;
    
    board[m.pos-3] = board[m.pos];
    break;
  case D:
    if (m.pos>5) return -1;

    board[m.pos+3] = board[m.pos];
    break;
  case L:
    if (m.pos%3==0) return -1;

    board[m.pos-1] = board[m.pos];
    break;
  case R:
    if (m.pos%3==2) return -1;

    board[m.pos+1] = board[m.pos];
    break;
  }
  board[m.pos] = '0';
  return m.pos;
}

void search_path(int step, int space)
{
  int i, j;
  if (strcmp(board, "123456780")==0) {
    //    printf("STEP=%d\n", step);
    if (step==1) {
      printf("1\n");
      exit(0);
    }
    if (step<minstep) minstep=step;
    
  } else {

    int s2;
    if (step>=minstep) return;
    if (step>0 && strcmp(board, ini_board)==0) return;
    
    Board board_bak;
    strcpy(board_bak, board);
    int nhistories_bak=nhistories;
    
    for (i=0; candidate[space][i].pos>=0; i++) {

      if ((s2 = move(candidate[space][i]))<0) continue;
      for (j=0; j<nhistories; j++) {
	if (strcmp(board, history[j])==0)
	  break;
      }
      if (j==nhistories) {
	strcpy(history[nhistories++], board); 
	search_path(step+1, s2);
      }
      nhistories = nhistories_bak;
      strcpy(board, board_bak);
    }
  }
}

int main()
{
  fscanf(stdin, "%c %c %c\n", &board[0],&board[1],&board[2]);
  fscanf(stdin, "%c %c %c\n", &board[3],&board[4],&board[5]);
  fscanf(stdin, "%c %c %c\n", &board[6],&board[7],&board[8]);
  strcpy(ini_board, board);
  int space = strchr(board, '0')-board;
  
  history = (Board*)malloc(sizeof(Board)*100000);
  search_path(0, space);
  printf("%d\n", minstep);
  return 0;
}



### FIXED CODE ###

import sys
import queue

N = 3

f = ''.join(sys.stdin.readline().split())
f += ''.join(sys.stdin.readline().split())
f += ''.join(sys.stdin.readline().split())

dd = [[-1, 0], [0, -1], [1, 0], [0, 1]]

Q = [[f,f.index('0'),0]]
V = { f: True }

while len(Q)>0:
    u = Q.pop(0)
    if u[0] == '123456780':  break
    sx, sy = u[1]//N, u[1]%N
    for dx, dy in dd:
        tx, ty = sx+dx, sy+dy
        if tx<0 or ty<0 or tx>=N or ty>=N: continue
        v = u[:]
        n1, n2 = u[1], tx*N+ty
        v[1] = n2
        if n1>n2: n1, n2 = n2, n1
        v[0] = v[0][0:n1]+v[0][n2]+v[0][n1+1:n2]+v[0][n1]+v[0][n2+1:]
        if not V.get(v[0], False):
            V[v[0]] = True
            v[2] += 1 # dir[r]                                                       
            Q.append(v)

print(u[2])
a=int(input())

print(a[1])

### FIXED CODE ###

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

print(c,a,b)
n,a,b=map(int,input().split())
min_=min(a,b)
max_=max(a,b)

k=max_-min_-1
if k%2!=0:#間の卓が奇数
    if k==1:
        print(k)
    else:
        ans=(k-1)//2+""
        print(ans)
else:#偶数
    ans=min(max_-1,n-min_)
    print(ans)

### FIXED CODE ###

n,a,b=map(int,input().split())
k=b-a-1
if k%2!=0:#間の卓が奇数
    ans=(k+1)//2
    print(ans)    
else:#偶数
    ans=min(b-1,n-a)
    ans1=min(a-1,n-b)+1+k//2
    print(min(ans,ans1))
import sys
sys.setrecursionlimit(12)
n, k =map(int, input().split())
d = int(input())

n_meajor = [0 for i in range(0,n)]

sunuke=[]
count=0

# for i in sys.stdin:
#     sunuke.append(int(input()))

for a in range(0,100):
    sunuke.append(int(input()))

for j in range(0,n):
    if j in sunuke:
        n_meajor[j]=1


sunuke_people = sum(n_meajor)

if sunuke_people<d:
    print(n-d)

else:
    print(n-sunuke_people)





### FIXED CODE ###

n, k =map(int, input().split())

sunuke = []

for i in range(0,k):
    d = int(input())
    a = list(map(int,input().split()))
    sunuke +=a

print(n-len(set(sunuke)))
from math import gcd


def find(n, k):

    if n == 0:
        return 0
    
    return n // k

def interval(l, r, k):
    return find(r, k) - find(l - 1, k)

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

print((b - a + 1) - interval(a, b, c) - interval(a, b, d) + interval(a, b, (c * d) // gcd(c, d)))


### FIXED CODE ###

def nod(a, b):
    if a == 0:
        return b
    elif a > b:
        return nod(a % b, b)
    return nod(b % a, a)


a, b, c, d = map(int, input().split())
ac = a + (c - a % c) % c
ad = a + (d - a % d) % d
bc = b - b % c
bd = b - b % d
dc = c*d//nod(c,d)
acd=a + (dc - a % dc) % dc
bcd = b - b % dc
print(b-a+1-(max(0,(bc-ac)//c+1)+max(0,(bd-ad)//d+1)-max(0,(bcd-acd)//dc+1)))
import sys
import numpy as np

read = sys.stdin.buffer.read

H,W,M = list(map(int, input().split()))

hw = []
# w = np.zeros(3*10**5,dtype=np.int64)
# h = np.zeros(3*10**5,dtype=np.int64)
w = [0] * 3*10**5
h = [0] * 3*10**5

for i in range(M):
    h_i, w_j = map(int, input().split())
    hw.append([h_i-1, w_j-1])
    h[h_i-1] += 1
    w[w_j-1] += 1

a = 0
d = 1
mxh_v = max(h)
mxw_v = max(w)

x = [i for i,j in enumerate(h) if j == mxh_v]
y = [i for i,j in enumerate(w) if j == mxw_v]

for i in x:
    for j in y:
        if not([i,j] in hw):
            d = 0
    if d == 0:
        break
print(mxh_v+mxw_v-d)

### FIXED CODE ###

H,W,M = list(map(int, input().split()))

hw = set()
w = [0] * 3*10**5
h = [0] * 3*10**5

for i in range(M):
    h_i, w_j = map(int, input().split())
    hw.add((h_i-1) + (w_j-1)*3*10**6)
    h[h_i-1] += 1
    w[w_j-1] += 1

a = 0
d = 1
mxh_v = max(h)
mxw_v = max(w)

x = [i for i,j in enumerate(h) if j == mxh_v]
y = [i for i,j in enumerate(w) if j == mxw_v]

for i in x:
    for j in y:
        if not(i + j*3*10**6 in hw):
            print(mxh_v+mxw_v)
            exit()
print(mxh_v+mxw_v-d)