Harryxun/stf_run huggingface dataset:
H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))
 
i = 0

for x in range(H):
    c = []
    for y in range(W):
        c.append(i + 1)
        a[i] -= 1
        if a[i] == 0:
            i += 1
            
    if x % 2 == 0:
        print(*c)
    else:
        print(*c[::-1])

### FIXED CODE ###

n, m =map(int, input().split())
print((n-1) * (m-1))
N = int(input())
num = 0
for i in range(1,int(N**0.5)+1):
  m = N//i-1
#  print(i,m)
  if (N//m) == (N % m):num += m
print(num)


### FIXED CODE ###

N = int(input())
num = 0
for i in range(1,int(N**0.5)+1):
  m = N//i-1
  if m!=0 :
#  print(i,m)
    if (N//m) == (N % m):num += m
print(num)
n = int(input())
l = [int(input()) for _ in range(n)]
print("Yes" if max(l) > sum(l) - max(l) else "No")

### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
print("Yes" if max(l) < sum(l) - max(l) else "No")
a = input()
cnt = 0
while 1:
    c = input().lower()
    if c = 'end_of_text':
        break
    cnt += c.split().count(a)
print(cnt)


### FIXED CODE ###

a = input().lower()
cnt = 0
while 1:
    c = input()
    if c == 'END_OF_TEXT':
        break
    cnt += c.lower().split().count(a)
print(cnt)
n, q = map(int,input().split())
s = input()

l = [0] * q
r = [0] * q

for i in range(0,q):
    l[i], r[i] = map(int,input().split())
    l[i] = l[i] -1
    r[i] = r[i] -1

s_list = list(s)

ac_list = [0] * (n-1)

for i in range(0,n-1):
    if s_list[i] == "A" and s_list[i+1] == "C":
        ac_list[i] = 1

for i in range(0,q):

### FIXED CODE ###

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

l = [0] * q
r = [0] * q

for i in range(0,q):
    l[i], r[i] = map(int,input().split())
    l[i] = l[i] -1
    r[i] = r[i] -1

s_list = list(s)

ac_list = [0] * (n-1)

for i in range(0,n-1):
    if s_list[i] == "A" and s_list[i+1] == "C":
        ac_list[i] = 1

#print(ac_list)

w = [0] * (n-1)

w[0] = ac_list[0]

for i in range(1,n-1):
    w[i] = w[i-1] + ac_list[i]

#print(w)

for i in range(0,q):
    if l[i] == 0:
        print(w[r[i]-1])
    else:
        print(w[r[i]-1]-w[l[i]-1])
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from itertools import product

n, m, q = map(int, readline().split())
abcd = [list(map(int, readline().split())) for _ in range(q)]
ans = 0
for bit in product([1, 0], repeat=q):
    cnt = 0
    aaa = []
    aaaa = set()
    for i, (a, b, c, d) in enumerate(abcd):
        if bit[i] == 1:
            aaa.append([a, b, c])
            cnt += d
    if ans < cnt:
        for a, b, c in aaa:
            for aa, bb, cc in aaa:
                if aa == a and b < bb:
                    aaaa.add([b, bb, cc - c])
                elif aa == a and b > bb:
                    aaaa.add([bb, b, c - cc])
                if b == bb and aa > a:
                    aaaa.add([a, aa, cc - c])
                elif b == bb and aa < a:
                    aaaa.add([aa, a, c - cc])
        aaa += list(aaaa)
        flag = True
        for i, (a, b, c, d) in enumerate(abcd):
            if bit[i] == 1:
                for aa, bb, cc in aaa:
                    if (aa <= a < b <= bb and c > cc) or (a <= aa < bb <= b and c < cc):
                        if aa == a and bb == b and c == cc:
                            continue
                        else:
                            flag = False
                            break
                if not flag:
                    cnt = 0
                    break
        if ans < cnt:
            ans = cnt
print(ans)


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from itertools import combinations_with_replacement

n, m, q = map(int, readline().split())
abcd = [list(map(int, readline().split())) for _ in range(q)]
ans = 0
for seq in combinations_with_replacement(range(m), n):
    cnt = 0
    for a, b, c, d in abcd:
        if seq[b - 1] - seq[a - 1] == c:
            cnt += d
    ans = max(ans, cnt)
print(ans)
import math
N = int(input()) 
factor = []
tmp = int(math.sqrt(N)) + 1
list = range(2,tmp)
for num in list[::-1]:
    while N % num == 0:
        N //= num
        factor.append(num)
        factor.append(N)
    if not factor:
        factor.append(N)
        factor.append(0)
    else:
        pass
    break
f=sum(factor)-1
print(f)

### FIXED CODE ###

A,B = map(int,input().split())
if (A <= 9) and (B <=9):
    print(A*B)
else:
    print(-1)
N,L=map(int,input().split())
S=[input() for i in range(N)]
print(''.join(S.sort))

### FIXED CODE ###

N,L=map(int,input().split())
S=list(input() for i in range(N))
S_sort=sorted(S)
print(''.join(S_sort))
N,K,*A = map(int, open(0).read().split())

def left(i, d):
    if i < 0:
        return 0
    if i >= N:
        return 0
    v = A[i] - d + 0.5
    if v <= 0:
        return 0
    else:
        return 1 + left(i - 1, d + 1)

def right(i, d):
    if i < 0:
        return 0
    if i >= N:
        return 0
    v = A[i] - d + 0.5
    if v <= 0:
        return 0
    else:
        return 1 + right(i + 1, d + 1)

for _ in range(K):
    X = [0 for _ in range(N)]
    for i, d in enumerate(A):
        l = left(i-1, 1)
        r = right(i+1, 1)
        c = 1 + l + r
        X[i] = c
    A = X

print(" ".join(map(str, A)))

### FIXED CODE ###

N,K,*A = map(int, open(0).read().split())
                                         
for _ in range(K):                       
    b = [0] * N                          
    for i, d in enumerate(A):            
        b[max(0, i-d)] += 1              
        if i+d+1 < N:                    
            b[i+d+1] -= 1                
    for i in range(1, N):                
        b[i] += b[i-1]                   
    if A == b:                           
        break                            
    A = b                                
                                         
print(" ".join(map(str, A)))
temp = input()
if temp > 30:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

if int(input()) >= 30:
    print('Yes')
else:
    print('No')
import sys
input = lambda:sys.stdin.readline().rstrip()

def Warshall_Floyd(d):
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k]+d[k][j])
    return d
############################
n, m, l = map(int, input().split())
f_inf = float('inf')
dist = [[f_inf]*n for _ in range(n)]
for i in range(m): dist[i][i] = 0

for _ in range(m):
    a, b, c = map(int, input().split())
    if c > l: continue
    dist[a-1][b-1] = c
    dist[b-1][a-1] = c

dist = Warshall_Floyd(dist)

dist2 = [[f_inf]*n for _ in range(n)]
for i in range(n):
    for j in range(n):
        if dist[i][j] <= l:
            dist2[i][j] = 1

dist2 = Warshall_Floyd(dist2)

q = int(input())
for _ in range(q):
    s, t = map(int, input().split())
    ans = dist2[s-1][t-1]
    if dist2[s-1][t-1] == f_inf:
        print(-1)
    else:
        print(ans-1)

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N, M, L = map(int, input().split())
    dist = [[float('inf')] * N for _ in range(N)]
    for _ in range(M):
        A, B, C = map(int, input().split())
        if C > L:
            continue
        A -= 1
        B -= 1
        dist[A][B] = C
        dist[B][A] = C

    for k in range(N):
        for i in range(N):
            for j in range(N):
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j])

    e = [[float('inf')] * N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            if dist[i][j] <= L:
                e[i][j] = 1
    
    for k in range(N):
        for i in range(N):
            for j in range(N):
                e[i][j] = min(e[i][j], e[i][k] + e[k][j])


    Q = int(input())
    for _ in range(Q):
        s, t = map(int, input().split())
        s -= 1
        t -= 1
        if e[s][t] == float('inf'):
            print(-1)
            continue
        ans = e[s][t]
        print(ans-1)


if __name__ == "__main__":
    main()
a , b = map(int,input().split())
print("#"*(3+2))
for i in range(1,b):
    tmp = input()
    print("#"+tmp+"#")
print("#"*(3+2))

### FIXED CODE ###

h,w = map(int,input().split())
s = []
for i in range(h):
    s.append("#"+input()+"#")
print("#"*(w+2))
for i in s:
    print(i)
print("#"*(w+2))
s = input()
ans = 0
for i in s:
  if i = "+":
    ans += 1
  else:
    ans -= 1
print(ans)

### FIXED CODE ###

s = input()
ans = 0
for i in s:
  if i == "+":
    ans += 1
  else:
    ans -= 1
print(ans)
N,M=map(int,input().split())
s=[]
c=[]
x=dict()
for i in range(M):
    a,b=map(int,input().split())
    s.append(a)
    c.append(b)
    if a in x:
        if b!=x[a]:
            print(-1)
            exit()
    else:
        x[a]=b
if M==0:
    ans=""
    for i in range(N):
        if i==0:
            ans="1"
        else:
            ans=ans+"0"
    print(ans)
    exit()
l=[]
if N!=1:
    for i in range(N):
        if s[i]==1:
            if c[i]==0:
                print(-1)
                exit()
                

for i in range(N):
    if i==0:
        l.append(1)
    else:
        l.append(0)

for i in range(M):
    l[s[i]-1]=c[i]
ans=""
#print(l)

for i in range(N):
    ans=ans+str(l[i])
print(ans)

### FIXED CODE ###

N,M=map(int,input().split())
s=[]
c=[]
x=dict()
for i in range(M):
    a,b=map(int,input().split())
    s.append(a)
    c.append(b)

for i in range(M):
    if s[i] in x:
        if c[i]!=x[s[i]]:
            print(-1)
            exit()
    else:
        x[s[i]]=c[i]

if M==0:
    ans=""
    for i in range(N):
        if i==0:
            ans="1"
        else:
            ans=ans+"0"
    if N==1:
        print(0)
        exit()
    print(ans)
    exit()
l=[]
if N!=1:
    for i in range(M):
        if s[i]==1:
            if c[i]==0:
                print(-1)
                exit()


for i in range(N):
    if i==0:
        l.append(1)
    else:
        l.append(0)
if N==1:
    l=[]
    l.append(0)
for i in range(M):
    l[s[i]-1]=c[i]
ans=""
#print(l)

for i in range(N):
    ans=ans+str(l[i])
print(ans)
import math
class segment_tree:
    
    # self.table is 1-indexed
    def __init__(self, dat, query, default=0):
        self.offset = 2 ** math.ceil(math.log2(len(dat)))
        self.table = [default] * self.offset + dat + [default] * (self.offset - len(dat))
        self.query = query
        for i in reversed(range(1, self.offset)):
            self.table[i] = self.query(self.table[2 * i], self.table[2 * i + 1])

    # [l, r] closed-interval
    def find(self, l, r):
        return self.query(self.__range(l,r))

    def __range(self, l, r):
        l += self.offset
        r += self.offset
        while l <= r:
            if l & 1:
                yield self.table[l]
                l += 1
            l >>= 1
            if r & 1 == 0:
                yield self.table[r]
                r -= 1
            r >>= 1
        
    def update(self, i, x):
        i += self.offset
        self.table[i] = x
        while 1 < i:
            i >>= 1
            self.table[i] = self.query(self.table[2 * i], self.table[2 * i + 1])

import sys
f = sys.stdin


n, q = map(int, f.readline().split())

rmq = segment_tree([(1 << 31) - 1] * n, min, float('inf'))

function = (rmq.update, lambda x, y:print(rmq.find(x, y)))
for com, x, y in (map(int, f.readline().split()) for _ in range(q)):
    function[com](x, y)

### FIXED CODE ###

import math
class segment_tree:
    
    # self.table is 1-indexed
    # math.log2 not implemented 3.2.3
    def __init__(self, dat, query, default=0):
        self.offset = 2 ** math.ceil(math.log(len(dat), 2))
        self.table = [default] * self.offset + dat + [default] * (self.offset - len(dat))
        self.query = query
        for i in reversed(range(1, self.offset)):
            self.table[i] = self.query(self.table[2 * i], self.table[2 * i + 1])

    # [l, r] closed-interval
    def find(self, l, r):
        return self.query(self.__range(l,r))

    def __range(self, l, r):
        l += self.offset
        r += self.offset
        while l <= r:
            if l & 1:
                yield self.table[l]
                l += 1
            l >>= 1
            if r & 1 == 0:
                yield self.table[r]
                r -= 1
            r >>= 1
        
    def update(self, i, x):
        i += self.offset
        self.table[i] = x
        while 1 < i:
            i >>= 1
            self.table[i] = self.query(self.table[2 * i], self.table[2 * i + 1])

import sys
f = sys.stdin

n, q = map(int, f.readline().split())

rmq = segment_tree([(1 << 31) - 1] * n, min, float('inf'))

function = (rmq.update, lambda x, y:print(rmq.find(x, y)))
for com, x, y in (map(int, f.readline().split()) for _ in range(q)):
    function[com](x, y)
n = int(input())
a_i = list(map(int,input().split(" ")))

def count_howmany_divide(val):
  result = 0

  while(True):
    if val % 2 != 0:
      break
    else:
      val /= 2
      result += 1

  return result
    

a_i_divided = list(map(count_howmany_divide, a_i))

print(min(a_i_divided))

### FIXED CODE ###

a = input()
a_list = list(a)
print(a_list.count("1"))
H,W=map(int, input().split())
S=[input() for _ in range(H)]

U=[[-1]*W for _ in range(H)]
D=[[-1]*W for _ in range(H)]
L=[[-1]*W for _ in range(H)]
R=[[-1]*W for _ in range(H)]

def u(i,j):
    if U[i][j]==-1:
        if S[i][j]=='#':
            U[i][j]==-2
        elif i==0:
            U[i][j]=0
        elif U[i-1][j]==-1:
            u(i-1,j)
            if U[i-1][j]==-2:
                U[i][j]=0
            else:
                U[i][j]=U[i-1][j]+1
        elif U[i-1][j]==-2:
            U[i][j]=0
        else:
            U[i][j]=U[i-1][j]+1

def d(i,j):
    if D[i][j]==-1:
        if S[i][j]=='#':
            D[i][j]==-2
        elif i==H-1:
            D[i][j]=0
        elif D[i+1][j]==-1:
            d(i+1,j)
            if D[i+1][j]==-2:
                D[i][j]=0
            else:
                D[i][j]=D[i+1][j]+1
        elif D[i+1][j]==-2:
            D[i][j]=0
        else:
            D[i][j]=D[i+1][j]+1

def l(i,j):
    if L[i][j]==-1:
        if S[i][j]=='#':
            L[i][j]==-2
        elif j==0:
            L[i][j]=0
        elif L[i][j-1]==-1:
            l(i,j-1)
            if L[i][j-1]==-2:
                L[i][j]=0
            else:
                L[i][j]=L[i][j-1]+1
        elif L[i][j-1]==-2:
            L[i][j]=0
        else:
            L[i][j]=L[i][j-1]+1

def r(i,j):
    if R[i][j]==-1:
        if S[i][j]=='#':
            R[i][j]==-2
        elif j==W-1:
            R[i][j]=0
        elif R[i][j+1]==-1:
            r(i,j+1)
            if R[i][j+1]==-2:
                R[i][j]=0
            else:
                R[i][j]=R[i][j+1]+1
        elif R[i][j+1]==-2:
            R[i][j]=0
        else:
            R[i][j]=R[i][j+1]+1

def udlr(i,j):
    if S[i][j]=='#':
        U[i][j]=D[i][j]=L[i][j]=R[i][j]=-2
        return 0
    else:
        u(i,j);d(i,j);l(i,j);r(i,j);
        return U[i][j]+D[i][j]+L[i][j]+R[i][j]+1

x=0
for i in range(H):
    for j in range(W):
        x=max(x,max(x,udlr(i,j)))
print(x)



### FIXED CODE ###

H,W = map(int,input().split())
G=[input() for _ in range(H)]
A_u=[[0 for _ in range(W)] for _ in range(H)]
A_d=[[0 for _ in range(W)] for _ in range(H)]
A_r=[[0 for _ in range(W)] for _ in range(H)]
A_l=[[0 for _ in range(W)] for _ in range(H)]
for h in range(H):
  for w in range(1,W):
    if G[h][w-1] == '.':
      A_r[h][w] = A_r[h][w-1]+1
  for w in range(W-2,-1,-1):
    if G[h][w+1] == '.':
      A_l[h][w] = A_l[h][w+1]+1
for w in range(W):
  for h in range(1,H):
    if G[h-1][w] == '.':
      A_d[h][w] = A_d[h-1][w]+1
  for h in range(H-2,-1,-1):
    if G[h+1][w] == '.':
      A_u[h][w] = A_u[h+1][w]+1
ans=0
for h in range(H):
  for w in range(W):
    if G[h][w] == '.':
      ans = max(ans,A_r[h][w]+A_l[h][w]+A_d[h][w]+A_u[h][w]+1)
print(ans)
N,K= map(int, input().split())

A=[]

for i range(K):
    d = int(input())
    A[i] = [int(x) for x in input().split()]

print(3)

### FIXED CODE ###

Sunuke=[]

N, K = map(int, input().split()) 
for i in range(K):
    d = int(input())
    A = list(map(int, input().split()))

    Sunuke.extend(A)

print(N-(len(set(Sunuke))))
from sys import stdin
from math import factorial

n, k = [int(x) for x in stdin.readline().rstrip().split()]
MOD = 1000000007


def combination(x, y):
    return factorial(x) // (factorial(x-y) * factorial(y))


for i in range(1, k+1):
    blue = combination(k-1, i-1)
    red = combination(n-k+1, i)
    ans = blue * red
    print(ans % MOD)


### FIXED CODE ###

from sys import stdin
from math import factorial

n, k = [int(x) for x in stdin.readline().rstrip().split()]
MOD = 1000000007


def combination(x, y):
    return factorial(x) // (factorial(x-y) * factorial(y))


for i in range(1, k+1):
    if n - k + 1 < i:
        ans = 0
    else:
        blue = combination(k-1, i-1)
        red = combination(n-k+1, i)
        ans = blue * red
    print(ans % MOD)
# -*- coding: utf-8 -*-
# D_ans.pyからコメントなど不要部分削除したもの

class UnionFindbySize:
    def __init__(self, n):
        self.parent = [-1 for i in range(n)]

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

    def issame(self, x, y):
        return self.root(x) == self.root(y)

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        else:
            self.parent[y] += self.parent[x]    # yの要素数を増やす
            self.parent[x] = y
            return True

    def size(self, x):
        return -self.parent[self.root(x)]

N, M = map(int, input().split())
A = [0] * M
B = [0] * M
for i in range(M):
    A[i], B[i] = map(int, input().split())
    A[i] -= 1
    B[i] -= 1

uf = UnionFindbySize(N)
res = [0] * (M+1)
res[-1] = N*(N-1)//2

i = 1
for a, b in zip(A[::-1], B[::-1]):
    if uf.issame(a, b):
        res[-1-i] = res[-i]
    else:
        sa = uf.size(a)
        sb = uf.size(b)
        res[-1-i] = res[-i] - sa*sb
        uf.unite(a, b)
    i+=1

for r in res[1:]:
    print(r)


### FIXED CODE ###

# -*- coding: utf-8 -*-
# D_ans.pyからコメントなど不要部分削除したもの
import sys
sys.setrecursionlimit(10**6) 

class UnionFindbySize:
    def __init__(self, n):
        self.parent = [-1 for i in range(n)]

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

    def issame(self, x, y):
        return self.root(x) == self.root(y)

    def unite(self, x, y):
        x = self.root(x)
        y = self.root(y)
        if x == y:
            return False
        else:
            self.parent[y] += self.parent[x]    # yの要素数を増やす
            self.parent[x] = y
            return True

    def size(self, x):
        return -self.parent[self.root(x)]

N, M = map(int, input().split())
A = [0] * M
B = [0] * M
for i in range(M):
    A[i], B[i] = map(int, input().split())
    A[i] -= 1
    B[i] -= 1

uf = UnionFindbySize(N)
res = [0] * (M)
res[-1] = N*(N-1)//2

i = 1
for a, b in zip(A[::-1], B[::-1]):
    id = M - 1 - i
    if id < 0:
        break
    if uf.issame(a, b):
        res[id] = res[id+1]
    else:
        sa = uf.size(a)
        sb = uf.size(b)
        res[id] = res[id+1] - sa*sb
        uf.unite(a, b)
    i+=1

for r in res:
    print(r)
import sys
import sympy
from fractions import gcd
A, B = map(int, input().split())

glst = []
tmp = gcd(A, B)

print(len(sympy.factorint(tmp)) + 1)


### FIXED CODE ###

import sys
from fractions import gcd
A, B = map(int, input().split())

glst = []
tmp = gcd(A, B)
for i in range(1, int(tmp ** 0.5) + 1):
    if tmp % i == 0:
        glst.append(i)
        if i != tmp // i:
            glst.append(tmp // i)

glst.sort()
cnt = 0
for i in range(1, len(glst) + 1):
    cntF = True
    for j in range(i + 1, len(glst) + 1):
        if gcd(glst[-i], glst[-j]) != 1:
            cntF = False
            break

    if cntF:
        cnt += 1

print(cnt)
s = input()

if s[1] == 'B':
  s[1] = 'R'
else: 
  s[1] = 'B'
  
print(s)

### FIXED CODE ###

s = list(input())
 
if s[1] == 'B':
  s[1] = 'R'
else: 
  s[1] = 'B'
  
print("".join(s))
X,Y = map(int,input().split())
if 2*X == Y or 4*X == Y or 3*X == Y or Y%X ==1 or Y%X == 2:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

a,b,c,d,e = map(int,input().split())
if a == 0 :
  print('1')
elif b == 0 :
  print('2')
elif c == 0 :
  print('3')
elif d == 0 :
  print('4')  
else:
  print('5')
import collections
import sys
sys.setrecursionlimit(10**9)
cache,edge={},collections.defaultdict(list)
def dp(node):
  if node in cache:
    return cache[node]
  lcl_max=0
  for child in edge[node]:
    
    lcl_max=max(lcl_max,1+dp(child))
  cache[node]=lcl_max
  return lcl_max
 
max_dis=0

n,m=map(int,input().split())
for _ in range(m):
  a,b=map(int,input().split())
  edge[a].append(b)
for node in range(1,n+1):
  max_dis=max(max_dis,dp(node,cache,edge))
print(max_dis)

### FIXED CODE ###

import collections
import sys
sys.setrecursionlimit(10**9)
cache,edge={},collections.defaultdict(list)
def dp(node):
  if node in cache:
    return cache[node]
  lcl_max=0
  for child in edge[node]:
    
    lcl_max=max(lcl_max,1+dp(child))
  cache[node]=lcl_max
  return lcl_max
 
max_dis=0

n,m=map(int,input().split())
for _ in range(m):
  a,b=map(int,input().split())
  edge[a].append(b)
for node in range(1,n+1):
  max_dis=max(max_dis,dp(node))
print(max_dis)
a, b = map(int, input().split())

s = a-1
t = b-1
ans = int((s+t-1)/t)
        
print(ans)

### FIXED CODE ###

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

s = a-1
t = b-1
ans = int((s+t-1)/s)
        
print(ans)
n = int(input())
r = []
b = []
c = 0
for i in range(n):
  r.append(list(map(int,input().split())))
for i in range(n):
  b.append(list(map(int,input().split())))
r.sort(key = itemgetter(1),reverse = True)
b.sort(key = itemgetter(0))
for i in range(n):
  for j in range(n):
    if b[i][0] > r[j][0] and b[i][1] > r[j][1]:
      r[j] = [10**6,10**6]
      c += 1
      break
print(c)
    

### FIXED CODE ###

from operator import itemgetter

n = int(input())
r = []
b = []
c = 0
for i in range(n):
  r.append(list(map(int,input().split())))
for i in range(n):
  b.append(list(map(int,input().split())))
r.sort(key = itemgetter(1),reverse = True)
b.sort(key = itemgetter(0))
for i in range(n):
  for j in range(n):
    if b[i][0] > r[j][0] and b[i][1] > r[j][1]:
      r[j] = [10**6,10**6]
      c += 1
      break
print(c)
n = int(input())
s = [2,3,4,5,6,7,8,9]
frag = False

for i in s:
  if n % s[i] == 0:
    print("Yes")
    flag = True
    break
if not flag:
  print("No")

### FIXED CODE ###

n = int(input())
s = [2,3,4,5,6,7,8,9]
flag = True
 
if 1<= n <=9:
    print("Yes")
    flag = False
else:
    for i in s:
        if n % i == 0 and n/i <= 9:
            flag = False
            print("Yes")
            break
if flag:
    print("No")
n = int(input())
s = list(map(int, input().split()))

  if s == "AC":
    a = sum(s)
  elif s== "WA":
    w = sum(s)
  elif s== "TLE":
    t = sum(s)
  else:
    e = sum(s)
  
  print("AC × ",a)
  print("WA × ",w)
  print("TLE × ",t)
  print("RE × ",r)

### FIXED CODE ###

n = int(input())
s = list(input() for i in range(n))
  
print("AC x ",s.count("AC"))
print("WA x ",s.count("WA"))
print("TLE x ",s.count("TLE"))
print("RE x ",s.count("RE"))
import math
from functools import reduce

N, X = map(int, input().split())
if N == 1:
    x = abs(X - int(input()))
    print(x)
else:
    x = list(map(int, input().split()))
    x = list(map(lambda i: abs(X - i), x))
    print(reduce(math.gcd, x))

### FIXED CODE ###

import fractions
from functools import reduce

N, X = map(int, input().split())
if N == 1:
    x = abs(X - int(input()))
    print(x)
else:
    x = list(map(int, input().split()))
    x = list(map(lambda i: abs(X - i), x))
    print(reduce(fractions.gcd, x))
i = input()
out = input()
n = 1

while (int(i)*n-(n-1)) < int(out):
    n += 1

else:
    print(n)



### FIXED CODE ###






inp = input().split()
for a in inp:
    out = int(a)
inp.pop(1)
for a in inp:
    i = int(a)
    
n = 1
while (i*n-(n-1)) < out:
    n += 1

else:
    if out == 1:
        print(0)
    else:
        print(n)