Harryxun/stf_run huggingface dataset:
from collections import deque
H,W = map(int,input().split())
maze = []
dx = [1,0,-1,0]
dy = [0,1,0,-1]
for i in range(H):
    maze.append(list(input()))
def bfs(sx,sy):
    INF = -1
    cost = [[INF]*W for _ in range(H)]
    P = deque()
    P.append([sx,sy])
    cost[sx][sy] = 0
    while len(P) != 0:
        p = P.popleft()
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] != "#" and cost[nx][ny] == INF:
                P.append([nx,ny])
                cost[nx][ny] = cost[p[0]][p[1]]+1
    return cost
def solve():
    ans = 0
    for i in range(H):
        for j in range(W):
            if maze[i][j] != "#"
                sx,sy = i,j
                cs = bfs(sx,sy)
                for k in range(len(cs)):
                    if max(cs[k]) > ans:
                        ans = max(cs[k])
    return ans
print(solve())

### FIXED CODE ###

from collections import deque
H,W = map(int,input().split())
maze = []
dx = [1,0,-1,0]
dy = [0,1,0,-1]
for i in range(H):
    maze.append(list(input()))
def bfs(sx,sy):
    INF = -1
    cost = [[INF]*W for _ in range(H)]
    P = deque()
    P.append([sx,sy])
    cost[sx][sy] = 0
    while len(P) != 0:
        p = P.popleft()
        for i in range(4):
            nx = p[0] + dx[i]
            ny = p[1] + dy[i]
            if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] != "#" and cost[nx][ny] == INF:
                P.append([nx,ny])
                cost[nx][ny] = cost[p[0]][p[1]]+1
    return cost
def solve():
    ans = 0
    for i in range(H):
        for j in range(W):
            if maze[i][j] != "#":
                sx,sy = i,j
                cs = bfs(sx,sy)
                for k in range(len(cs)):
                    if max(cs[k]) > ans:
                        ans = max(cs[k])
    return ans
print(solve())
H, A = input().split()

n = round((int(H)/int(A)) + 0.5)

print(n)10

### FIXED CODE ###

H, A = input().split()

n = (int(H)/int(A)) +(int(H)%int(A)>0)

print(int(n))
import math

n = int(input())

faccs = [0 for i in range(int(n**0.5))]

while n % 2 == 0: 
    faccs[2] += 1
    n = n / 2

for i in range(3,int(math.sqrt(n))+1,2): 

    while n % i== 0: 
        faccs[i] += 1 
        n = n / i 

if n > 2: 
    faccs[int(n)] += 1 

count = 0

for i in faccs:
    if i > 0:
        temp = 1
        while (i-temp)>=0:
            i -= temp
            temp +=1
            count += 1
print(count)
        


### FIXED CODE ###


import math

n = int(input())

#faccs = [0 for i in range(int(n/2) +1)]
faccs = {}


def isPrime(n) : 
  
    if (n <= 1) : 
        return False
    if (n <= 3) :
        return True

    if (n % 2 == 0 or n % 3 == 0) : 
        return False
  
    i = 5
    while(i * i <= n) : 
        if (n % i == 0 or n % (i + 2) == 0) : 
            return False
        i = i + 6
  
    return True

if isPrime(n):
    print(1)
else:
    while n % 2 == 0:
        if 2 in faccs:
            faccs[2] += 1
        else:
            faccs[2] = 1
        n = n / 2

    for i in range(3,int(math.sqrt(n))+1,2): 
          

        while n % i== 0:
            if i in faccs:
                faccs[i] += 1
            else:
                faccs[i] = 1
            n = n / i 

    if n > 2:
        faccs[math.floor(n)] = 1 

    count = 0

    for i in faccs.values():
        if i > 0:
            temp = 1
            while (i-temp)>=0:
                i -= temp
                temp +=1
                count += 1
    print(count)
from collections import Counter
N, M = (list)(map(int, input().split()))
A = (list)(map(int, input().split()))
A[0] %= M

for i in range(1, N):
    A[i] += A[i-1]
    A[i] %= M

ans = 0

C = Counter(A)
for num, val in C:
    if num == 0:
        ans += val
    if val >= 2:
        ans += val*(val-1)//2
print(ans)


### FIXED CODE ###

from collections import Counter
N, M = (list)(map(int, input().split()))
A = (list)(map(int, input().split()))
A[0] %= M

for i in range(1, N):
    A[i] += A[i-1]
    A[i] %= M

ans = 0

C = Counter(A)
for num, val in C.items():
    if num == 0:
        ans += val
    if val >= 2:
        ans += val*(val-1)//2
print(ans)
from collections import deque

H, W = map(int, input().split())
score = H * W
S = [[] for i in range(W)]
for i in range(H):
    for s in input():
        if s == "#":
            score -= 1
        S[i].append(s)


ls = deque([[0, 0, 0]])
while len(ls) > 0:
    x, y, depth = ls.popleft()

    if x == H-1 and y == W-1:
        print(score-depth-1)
        break
    
    S[x][y] = "#"

    if 0 <= x+1 <= H-1 and 0 <= y <= W-1:
        if S[x+1][y] == ".":
            ls.append([x+1, y, depth+1])
    if 0 <= x <= H-1 and 0 <= y+1 <= W-1:
        if S[x][y+1] == ".":
            ls.append([x, y+1, depth+1])
    if 0 <= x <= H-1 and 0 <= y-1 <= W-1:
        if S[x][y-1] == ".":
            ls.append([x, y-1, depth+1])
    if 0 <= x-1 <= H-1 and 0 <= y <= W-1:
        if S[x-1][y] == ".":
            ls.append([x-1, y, depth+1])

else:
    print(-1)

### FIXED CODE ###

from collections import deque

H, W = map(int, input().split())
score = H * W
S = [[] for i in range(H)]
for i in range(H):
    for s in input():
        if s == "#":
            score -= 1
        S[i].append(s)


ls = deque([[0, 0]])
dir = [[1,0], [-1,0], [0,1], [0,-1]]
dp = [[float("inf") for i in range(W)] for j in range(H)]
dp[0][0] = 0
while len(ls) > 0:
    x, y = ls.popleft()

    if x == H-1 and y == W-1:
        print(score-dp[H-1][W-1]-1)
        break

    for dx, dy in dir:
        if (x+dx < 0) or (x+dx > H-1) or (y+dy < 0) or (y+dy > W-1):
            continue
        else:
            if S[x+dx][y+dy] == "." and dp[x][y]+1 < dp[x+dx][y+dy]:
                dp[x+dx][y+dy] = dp[x][y] + 1
                ls.append([x+dx, y+dy])

else:
    print(-1)
S=list(input())
K=int(input())

if K==1:
  print(sorted(S)[0])
  exit()

ans=[]
if K<len(S):
  s0=sorted(S[:-K+1])[0]
  for j,e in enumerate(S[:-K+1]):
    if e==s0:
      for i in range(1,K+1):
        a="".join(S[j:j+i])
        if a not in ans:
          ans.append(a)
      
sl=S[-K+1:]
for i in range(K-1):
  for j in range(i+1,K):
    a="".join(sl[i:j])
    if a not in ans:
      ans.append(a)

ans.sort()
print(ans[K-1])

### FIXED CODE ###

S=list(input())
K=int(input())

if K==1:
  print(sorted(S)[0])
  exit()

ans=[]
if K<=len(S):
  s0=sorted(S[:-K+1])[0]
  for j,e in enumerate(S[:-K+1]):
    if e==s0:
      for i in range(1,K+1):
        a="".join(S[j:j+i])
        if a not in ans:
          ans.append(a)
      
sl=S[-K+1:]
for i in range(K-1):
  for j in range(i+1,K):
    a="".join(sl[i:j])
    if a not in ans:
      ans.append(a)

ans.sort()
print(ans[K-1])
N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(h,x,y)]


ans = []
for i in range(101):
  for j in range(101):
    ans += [(i,j)]

H = 0
pH = -1
ansh = 0
log = []
na = []
for a in ans:
  i, j = a
  pH = -1
  for l in ls:
    h, x, y = l
    if h>0:
      H = h+abs(x-i)+abs(y-j)
      if pH==-1:
        pH = H
      elif not H==pH:
        break
    else:
      log += [a]
  else:
    na += [(a,H)]
ans = 0
for a in na:
  i,j = a[0]
  H = a[1]
  for l in log:
    h,x,y = l
    h = H-abs(x-i)-abs(y-j)
    if max(h,0)>0:
      break
  else:
    ans = a
    break
x, y = ans
print(x, y, H)

### FIXED CODE ###

N = int(input())
ls = []
for i in range(N):
  x,y,h = map(int, input().split())
  ls += [(x,y,h)]
ls.sort(key=lambda x:x[2])
px, py, ph = ls[-1]

ans = []
flag = False
for i in range(101):
  for j in range(101):
    H = ph+abs(px-i)+abs(py-j)
    for l in ls:
      x, y, h = l
      u = max(H - abs(x-i) - abs(y-j), 0)
      if not u==h:
        break
    else:
      ans = (i,j,H)
      flag = True
      break
  if flag:
    break
print(*ans)
n = int(input())
for i in range(10):
    if 100*i + 10*i + i => n:
        print(100*i + 10*i + i)

### FIXED CODE ###

n = int(input())
for i in range(1, 10):
    if (100*i + 10*i + i ) >= n:
        print(100*i + 10*i + i)
        exit()
KX=input().split()
K,X=int(KX[0]),int(KX[1])

lis = list(range(X-K+1,X+K)
print(*lis)

### FIXED CODE ###

KX=input().split()
K,X=int(KX[0]),int(KX[1])
 
lis = list(range(X-K+1,X+K))
print(*lis)
a,b,c = list(map(int,input().split()))

def swap(x,y):
  tmp=x
  x=y
  y=temp
  return(x,y)

a,b = swap(a,b)
a,c = swap(a,c)
print(x,b,c)


### FIXED CODE ###

x,y,z = list(map(int,input().split()))
 
def swap(a,b):
    tmp = a
    a = b
    b = tmp
    return (a,b)
 
x,y = swap(x,y)
x, z = swap(x, z)
print(x,y,z)
N = int(input())
S = input()

count[0] = S.count('.')
for i in range(1, len(S)+1):
    count[i] = count[i-1] + (1 if S[i-1]=='#' else 0) - (1 if S[i-1]=='.' else 0)

print(min(count))

### FIXED CODE ###

N = int(input())
S = input()

count = [0]*(len(S)+1)
count[0] = S.count('.')
for i in range(1, len(S)+1):
    count[i] = count[i-1] + (1 if S[i-1]=='#' else 0) - (1 if S[i-1]=='.' else 0)

print(min(count))
n = int(input())

d = []
for i in range(n):
    d.append(int(input()))

d_2 = sorted(d, reverse=True)
ans = 1
for i in range(1, n):
    if d_2[i] < d_2[i-1]:
        ans += 1
    else:
        continue

print(ans)

### FIXED CODE ###

print(input().replace("2017", "2018"))
N, P = map(int,input().split())
 
output=1
 
if P==1:
  
else:
  for num in range(2,round(P**(1/N))+1):
    if P%(num**N) == 0:
      output = num
 
print(output)

### FIXED CODE ###

N, P = map(int,input().split())
 
output=1
 
if P==1:
  output=1
elif N==1:
  output=P
else:
  for num in range(2,round(P**(1/N))+1):
    if P%(num**N) == 0:
      output = num
 
print(output)
s1 = raw_input()
s2 = raw_input()
ans = ''
for i in range(min(len(s1), len(s2))):
    ans += s1[i] + s2[i]
if len(s2) < len(s1):
    ans += s1[-1]
print ans

### FIXED CODE ###

a, b, c = map(int, raw_input().split())
print ['NO', 'YES'][b - a == c - b]
N = int(raw_input())

s = [int(raw_input()) for _ in xrange(N)] 
s.sort()

ans = sum(s)
k = 0

for i in range(N):
    if S[i] % 10 != 0:
        k = S[i]
        break

if ans % 10 == 0 and k == 0:
    print 0
elif ans % 10 != 0:
    print ans
else:
    print ans-k

### FIXED CODE ###

N = int(raw_input())

s = []

for i in range(N):
    s.append(int(raw_input()))

s.sort()

ans = sum(s)

for i in range(N):
    if ans % 10 == 0:
        if s[i] % 10 == 0:
            pass
        else:
            ans -= s[i]
    else:
        break

if ans % 10 == 0:
    print 0
else:
    print ans
a,b,n = map(int,input().split())
print(max(a*x//b - a*(x//b) for x in list(range(b-1, n+1, b))[:1] + [n]))


### FIXED CODE ###

a,b,n = map(int,input().split())
if b-1 <= n:
    cand = [b-1, n]
else:
    cand = [n]
print(max(a*x//b - a*(x//b) for x in cand))
n=int(input())
count=0
ans=0
for j in range(1,n+1,2):
  count=0
  for i in range(1,int(j**0.5)):
    if j%i==0 and j**0.5)==i:
      count+=1
    elif j%i==0 and j**0.5!=i:
      count+=2
  if count==8:
    ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
count=0
ans=0
for j in range(1,n+1,2):
  count=0
  for i in range(1,int(j**0.5)+1):
    if j%i==0:
      if j//i!=i:
        count+=2
      else:
        count+=1
  if count==8:
    ans+=1
print(ans)
n,k=map(int,input().split())
A=list(map(int,input().split()))
C=[n for _ range(n)]

while k!=0:
    B=[0 for _ in range(n+1)]
    for i,j in enumerate(A):
        B[max(0,i-j)] +=1
        B[min(n,i+j+1)] -=1
    for i in range(1,n):
        B[i] +=B[i-1]
    A=B[:n]
    k -=1
    if A==C:break
print(*A)

### FIXED CODE ###

n,k=map(int,input().split())
A=list(map(int,input().split()))
C=[n for i in range(n)]

for m in range(k):
    B=[0 for _ in range(n)]
    for i in range(n):
        l,r=max(0,i-A[i]),min(n-1,i+A[i])
        B[l] +=1
        if r+1<n:B[r+1] -=1
    for i in range(n-1):
        B[i+1]=B[i]+B[i+1]
    A=B
    if A==C:break
print(*A)
a=int(inupt())
print(a+a*a+a*a*a)

### FIXED CODE ###

a=int(input())
print(a+a**2+a**3)
n,l=map(int,open(0).read().split())
sum_n=sum(l)
for i in range(n):
	if 2*l[i]>=sum_n
		print('No')
		import sys
		sys.exit()
print('Yes')

### FIXED CODE ###

n,*l=map(int,open(0).read().split())
sum_n=sum(l)
for i in range(n):
	if 2*l[i]>=sum_n:
		print('No')
		import sys
		sys.exit()
print('Yes')
a=input()
list=["Sunny";0,"Cloudy";1,"Rainy";2]
if a=list[0,1]:
  print(list[a+=1])
else:
  print(list[0])

### FIXED CODE ###

a=input()
if a=="Sunny":
  print("Cloudy")
elif a=="Cloudy":
  print("Rainy")
else:
  print("Sunny")
n,m=map(int,input().split())
a=list(map(int,input().split()))
 
toku = sum(a) // (4*m)
 
a.sort(reverse=True)
if a[m-1] >= toku:
  print("Yes")
  else:
  print("No")

### FIXED CODE ###

x,y,z=map(int,input().split())
v=0

v=x
x=y
y=v

v=x
x=z
z=v
print(x,y,z)
# ABC073D - joisino's travel
from heapq import heappop, heappush
from itertools import permutations
from typing import List, Tuple

INF = 1 << 30


def dijkstra(source: int, edges: List[Tuple[int, int]]) -> List[int]:
    """
    Compute the distance of the shortest path from V_source to each vertex.

    Args:
        source: V_source
        edges: Edges info
    Returns:
        dist: A list of distance from V_source
    """
    edges_count = len(edges)
    dist = [INF] * edges_count
    dist[source] = 0
    undetermined = edges_count - 1  # V_0 is determined in 1-idx graph
    queue = [(0, source)]
    while queue:
        cost, v = heappop(queue)
        if cost > dist[v]:
            continue
        for next_cost, u in edges[v]:
            if cost + next_cost < dist[u]:
                dist[u] = cost + next_cost
                heappush(queue, (dist[u], u))
        undetermined -= 1
        if not undetermined:
            break
    return dist  # There may be no path from V_source to some vertices.


def main():
    N, M, R, *RABC = map(int, open(0).read().split())
    visit, ABC = RABC[:R], RABC[R:]
    edges = [[] for _ in range(N + 1)]
    for v, u, cost in zip(*[iter(ABC)] * 3):
        edges[v].append((cost, u)), edges[u].append((cost, v))
    dist = {v: dijkstra(v, edges) for v in visit}
    ans = INF
    for perm in permutations(visit):
        cur = sum(dist[v][u] for v, u in zip(perm, perm[1:]))
        ans = min(ans, cur)
    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

# ABC073D - joisino's travel
from itertools import permutations
from scipy.sparse.csgraph import floyd_warshall


def main():
    N, M, R, *RABC = map(int, open(0).read().split())
    visit, ABC = RABC[:R], RABC[R:]
    G = [[float("inf")] * (N + 1) for _ in range(N + 1)]
    for v, u, c in zip(*[iter(ABC)] * 3):
        G[v][u] = G[u][v] = c
    dist = floyd_warshall(G, directed=0)
    ans = float("inf")
    for perm in permutations(visit):
        cur = sum(dist[v][u] for v, u in zip(perm, perm[1:]))
        ans = min(ans, cur)
    print(int(ans))


if __name__ == "__main__":
    main()
#!/usr/bin/env python3
import sys
import numpy as np

MOD = 1000000007  # type: int


def solve(N: int, A: "List[int]"):
    lcm=np.lcm.reduce(A)
    ans=0
    for i in range(N):
        ans+=lcm//A[i]
    print(ans%MOD)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import fractions as f

MOD = 1000000007  # type: int


def solve(N: int, A: "List[int]"):
    #lcm=np.lcm.reduce(A)
    lcm=A[0]
    for i in range(1,N):
        lcm=lcm*A[i]//f.gcd(lcm,A[i])

    ans=0
    for i in range(N):
        ans+=lcm//A[i]
    print(ans%MOD)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()
n = int(input())
h = list(map(int, input().split()))
h = h[::-1]
ans = []
x = 0
if n > 1:
    for i in range(1,n):
        if h[i-1] <= h[i]:
            x += 1
        else:
            ans.append(x)
            x = 0
else:
    ans = 0
print(max(ans))

### FIXED CODE ###

n = int(input())
h = list(map(int, input().split()))
h = h[::-1]
ans = []
x = 0
if n > 1:
    for i in range(1,n):
        if h[i-1] <= h[i]:
            x += 1
        else:
            ans.append(x)
            x = 0
    ans.append(x)
else:
    ans.append(0)
print(max(ans))
A, B, C, D, E, F = map(int, input().split())

water = []
for i in range(F//(A*100) + 1):
    for j in range(F//(B*100) + 1):
        n = (i*A + j*B)*100
        if n <= F:
            water.append(n)
water = sorted(list(set(water)))

result = {}
noud = []
for i in water:
    suger_limit = E*(i//100)
    for j in range(suger_limit//C + 1):
        for k in range(suger_limit//D + 1):
            n = j*C + k*D
            if n <= suger_limit and i + n <= F and n != 0:
                noudo = 100*n/(i+n)
                noud.append(noudo)
                
                result[str(noudo)] = [i+n,n]

a = 0
b = 0
a,b = map(int,result[str(max(noud))])

print(a,b)

### FIXED CODE ###

A, B, C, D, E, F = map(int, input().split())

water = []
for i in range(F//(A*100) + 1):
    for j in range(F//(B*100) + 1):
        n = (i*A + j*B)*100
        if n <= F:
            water.append(n)
water = sorted(list(set(water)))

density_d = {}
density = []

for i in water:
    suger_limit = E*(i//100)

    suger = []

    for j in range(suger_limit//C + 1):
        for k in range(suger_limit//D + 1):
            n = j*C + k*D
            if n <= suger_limit and n + i <= F:
                suger.append(n)
    suger = max(suger)
    if i+suger == 0:
        continue
    else:
        density.append(100*suger/(i+suger))
        density_d[100*suger/(i+suger)] = [i + suger, suger]
density = list(set(density))
a, b = map(int, density_d[max(density)])
print(a,b)
nCr = {}
def cmb(n, r):
    if r == 0 or r == n: return 1
    if r == 1: return n
    if (n,r) in nCr: return nCr[(n,r)]
    nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)
    return nCr[(n,r)]

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

p = 10 ** 9 + 7

print((2 ** n - cmb(n, a) - cmb(n, b)) % p - 1)

### FIXED CODE ###

k = 2 *10**5
mod = 10**9+7

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

modinv_table = [-1]*(k+1)
for i in range(1,k+1):
    modinv_table[i] = pow(i,-1,mod)

def binomial_coefficients(n,k):
    ans = 1
    for i in range(k):
        ans *= n-i
        ans *= modinv_table[i+1]
        ans %= mod
    return ans
print((pow(2,n,mod)-binomial_coefficients(n,a)-binomial_coefficients(n,b)-1)%mod)
s=input()
d=[]
for i in range(len(s)-2):
	d.append(int(s[i:i+3]))
ans=[abs(j-753) for j in d]
print(min(ans))

### FIXED CODE ###

n=int(input())
t,a=map(int,input().split())
*h,=map(int,input().split())
tmp=[]
for i in h:
	tmp.append(t-i*0.006)
tmp_abs=[abs(j-a) for j in tmp]
print(tmp_abs.index(min(tmp_abs))+1)
from functools import reduce
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
def gcd_list(numbers):
    return reduce(gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
L = []
if n == 2:
  print(max(a))
else:
  for i in range(n):
    b = [_ for _ in a if _ != a[i]]
    L.append(gcd_list(b))

  print(max(L))

### FIXED CODE ###

from functools import reduce
def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)
def gcd_list(numbers):
    return reduce(gcd, numbers)

n = int(input())
a = list(map(int, input().split()))
if n == 2:
  print(max(a))
else:
  p = gcd_list(a[:3])
  q = max([gcd(a[0], a[1]), gcd(a[0], a[2]), gcd(a[1], a[2])])
  for i in range(3, n):
    q = max([p, gcd(q, a[i])])
    p = gcd(p, a[i])
    
  print(q)
a, b, c= map(input().split())
num= int(input())
cot=0
for x in range(num):
    if a >= b and c >= a:
        b=b*2
    else:
        c=c*2
if b > a and c > b:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

a, b, c= map(int, input().split())
num= int(input())
for x in range(num):
    if a >= b and c >= a:
        b=b*2
    else:
        c=c*2
if b > a and c > b:
    print("Yes")
else:
    print("No")
N = int(input())
li = list(map(int, input().split()))
mireru = []
highest = 0
for i in li:
    if li[i] >= highest:
        mireru.append(1)
        highest = li[i]
print(sum(mireru))

### FIXED CODE ###

N = int(input())
li = list(map(int, input().split()))
mireru = []
highest = 0
for i in li:
    if i >= highest:
        mireru.append(1)
        highest = i
print(sum(mireru))
N = int(input())
S = N % 10
if(S == 0||1||8||6):
  print("pon")
elif(S == 3):
  print("bon")
else:
  print("hon")

### FIXED CODE ###

N = int(input())
S = N % 10
if(S == 0):
  print("pon")
elif(S == 1):
  print("pon")
elif(S == 6):
  print("pon")
elif(S == 8):
  print("pon")
elif(S == 3):
  print("bon")
else:
  print("hon")
s = input()
ans = []

for i in range(len(s)):
  if len(s) < 2 and (s[i] == 'C' or s[i] == 'F'):
    ans.append(s)

if ans[0] == 'C' and ans[1] == 'F':
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s = input()
ans = []

for i in range(len(s)):
  if len(ans) == 0 and s[i] == 'C':
    ans.append(s[i])
  elif len(ans) == 1 and s[i] == 'F':
    ans.append(s[i])

if len(ans) == 2 and ans[0] == 'C' and ans[1] == 'F':
  print('Yes')
else:
  print('No')
import numpy as np
import functools
import math
import scipy
import fractions
import itertools
 
def solve():
    n, h = map(int, input().split())
    a, b = [0]*n, [0]*n
    for i in range(n):
        a[i],b[i] = map(int, input().split())
    a.sort(reverse = True)
    ans = 0
    m = max(a)
    for i in range(n):
        if b[i] > m:
            h -= b[i]
            ans += 1
        if h <= 0:
            print(ans)
            exit()
    ans += math.ceil(h/m)
    print(ans)
    return 0
 
if __name__ == "__main__":
    solve()
import numpy as np
import functools
import math
import scipy
import fractions
import itertools

def solve():
    n, h = map(int, input().split())
    a, b = [0]*n, [0]*n
    for i in range(n):
        a[i],b[i] = map(int, input().split())
    a.sort(reverse = True)
    print(a)
    ans = 0
    m = max(a)
    for i in range(n):
        if b[i] >= m:
            h -= b[i]
            ans += 1
        if h <= 0:
            print(ans)
            exit()
    ans += math.ceil(h/m)
    print(ans)
    return 0

if __name__ == "__main__":
    solve()


### FIXED CODE ###

import numpy as np
import functools
import math
import scipy
import fractions
import itertools

def solve():
    n, h = map(int, input().split())
    a, b = [0]*n, [0]*n
    for i in range(n):
        a[i],b[i] = map(int, input().split())
    a.sort(reverse = True)
    b.sort(reverse = True)
    ans = 0
    m = max(a)
    bit = 0
    for i in range(n):
        if b[i] > m:
            h -= b[i]
            ans += 1
        if h <= 0:
            print(ans)
            bit = 1
            break
    if bit == 0:
        ans += math.ceil(h/m)
        print(ans)
    return 0
 
if __name__ == "__main__":
    solve()