Harryxun/stf_run huggingface dataset:
import networkx as nx
import collections

def bfs(G):
    V = [ v for v in G.nodes() ]
    Q = collections.deque([V[0]])
    searched = { v: False for v in G.nodes() }
    searched[V[0]] = True
    n=1
    H={v:None for v in G.nodes()}

    while len(Q) != 0:
        v = Q.popleft()
        edges = [ (v, i ) for (v, i) in G.edges(v) if not searched[i] ]
        for edge in edges:
            v, i = edge
            Q.append(i)
            searched[i] = True

            if H[i]==None:
                H[i]=v
                n+=1
                
    return (H,n)

G=nx.Graph()
N,M=map(int,input().split())
G.add_nodes_from(range(1,N+1))

for i in range(M):
    v,w=map(int,input().split())
    G.add_edge(v,w)

(H,n)=bfs(G)
if n!=N:
    print("No")
else:
    print("Yes")
    for i in range(2,N+1):
        print(H[i])



### FIXED CODE ###

import copy
import collections

#メイン部
N,M=map(int,input().split())

V=list(range(1,N+1))
H={v:set() for v in V}
L={v:None for v in V}

for i in range(M):
    v,w=map(int,input().split())
    H[v].add(w)
    H[w].add(v)

Q=collections.deque()
Q.append(V[0])

L[1]=1
n=1

while Q:
    x=Q.popleft()
    for v in H[x]:
        if L[v]!=None:
            continue
        L[v]=x
        n+=1
        Q.append(v)

if n==N:
    print("Yes")
    for i in range(2,N+1):
        print(L[i])
else:
    print("No")
n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse=True)
costs = [(ai * fi, fi) for ai, fi in zip(a, f)]
costs.sort(reverse=True)
# l impossible, r ok
l, r = -1, costs[0][0]
while(r - l > 1):
    c = (l + r) // 2
    train = 0
    for cost, step in costs:
        if cost > c:
            train += (cost - c + step - 1) // step
    if train <= k:
        r = c
    else:
        l = c
print(r)


### FIXED CODE ###

from math import atan, pi
a, b, x = map(int, input().split())
if 2*x <= a**2*b:
    print(180 * atan(a * b ** 2 / (2 * x)) / pi)
else:
    print(180 * atan(2*(a**2*b-x)/a**3)/pi)
N,Q = map(int, input().split())
childlist = [[] for _ in range(N+1)]

for _ in range(N-1):
    a, b = map(int, input().split())
    childlist[a].append(b)

pointlist = [0]*(N+1)
for _ in range(Q):
    p, x = map(int, input().split())
    pointlist[p] += x

def DFS(v):
    if not checkedlist[v]:
        checkedlist[v] = True
        
        global point
        point += pointlist[v]
        for child in childlist[v]:
            DFS(child)
        
        totallist[v] = point
        point -= pointlist[v]
        
totallist = [0]*(N+1)
checkedlist = [False]*(N+1)
point = 0
for i in range(1,N+1):
    if not checkedlist[i]:
        DFS(i)

print(*totallist[1:])

### FIXED CODE ###

from sys import stdin, setrecursionlimit
input = stdin.readline

setrecursionlimit(10**6)

N,Q = map(int, input().split())
neighborlist = [[] for _ in range(N+1)]

for _ in range(N-1):
    a, b = map(int, input().split())
    neighborlist[a].append(b)
    neighborlist[b].append(a)

pointlist = [0]*(N+1)
for _ in range(Q):
    p, x = map(int, input().split())
    pointlist[p] += x

def DFS(v):
    if not checkedlist[v]:
        checkedlist[v] = True
        
        global point
        point += pointlist[v]
        for neighbor in neighborlist[v]:
            DFS(neighbor)
        
        totallist[v] = point
        point -= pointlist[v]
        
totallist = [0]*(N+1)
checkedlist = [False]*(N+1)
point = 0
for i in range(1,N+1):
    if not checkedlist[i]:
        DFS(i)

print(*totallist[1:])
x,y=map(int,input().split())
MOD = 10**9+7

def inv_mod(a, p=MOD):
    def inv_mod_sub(a, p):
        if a == 1:
            return 1, 0
        else:
            d, r = p//a, p%a
            x, y = inv_mod_sub(r, a)
            return y-d*x, x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n, k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD
f_mod=[1]*(n+1)
f_mod_inverse=[1]*(n+1)
for i in range(1,n+1):
  f_mod[i]=f_mod[i-1]*i%MOD
  f_mod_inverse[i]=f_mod_inverse[i-1]*inv_mod(i)%MOD

if x+y%3!=0:print(0)
else:
  n=(x+y)//3
  dif=abs(x-y)
  ele=(n-dif)//2
  print(comb_mod(n,ele))

### FIXED CODE ###

x,y=map(int,input().split())
MOD = 10**9+7
if (x+y)%3!=0:print(0);exit()
def inv_mod(a, p=MOD):
    def inv_mod_sub(a, p):
        if a == 1:
            return 1, 0
        else:
            d, r = p//a, p%a
            x, y = inv_mod_sub(r, a)
            return y-d*x, x
    if p < 0: p = -p
    a %= p
    return inv_mod_sub(a,p)[0] % p

def comb_mod(n, k):
    if k < 0 or k > n:
        return 0
    else:
        return f_mod[n]*f_mod_inverse[k]*f_mod_inverse[n-k] % MOD
f_mod=[1]*(10**6)
f_mod_inverse=[1]*(10**6)
for i in range(1,10**6):
  f_mod[i]=f_mod[i-1]*i%MOD
  f_mod_inverse[i]=f_mod_inverse[i-1]*inv_mod(i)%MOD
cnt=(x+y)//3
dif=abs(x-y)
ele=(cnt-dif)//2
print(comb_mod(cnt,ele))
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

n = int(input())
p = tuple([int(i) for i in readline().split()])
q = tuple([int(i) for i in readline().split()])


from itertools import permutations
L = list(range(1,n+1))
for i,c in enumerate(permutations(L)):
    if c == p:
        a = i
    elif c == q:
        b = i

print(abs(a-b))










### FIXED CODE ###

# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline
read = sys.stdin.read

n = int(input())
p = tuple([int(i) for i in readline().split()])
q = tuple([int(i) for i in readline().split()])

if p == q:
    print(0)
    exit()

from itertools import permutations
L = list(range(1,n+1))
for i,c in enumerate(permutations(L)):
    if c == p:
        a = i
    elif c == q:
        b = i

print(abs(a-b))
H, W, N = map(int, raw_input().split())
    dx = [-1, 0, 1, -1, 0, 1, -1, 0, 1]
    dy = [-1, -1, -1, 0, 0, 0, 1, 1, 1]
    board = {}
     
    for i in xrange(N):
        a, b = map(int, raw_input().split())
        for j in xrange(9):
            x, y = a+dx[j], b+dy[j]
            if x <= 1 or x >= H or y <= 1 or y >= W:
                continue
            if (x, y) in board:
                board[(x, y)] += 1
            else:
                board[(x, y)] = 1
    ans = [0] * 10
    for v in board.values():
        ans[v] += 1
    ans[0] = (H-2)*(W-2)-sum(ans)
    for a in ans:
        print a

### FIXED CODE ###

H, W, N = map(int, raw_input().split())
dx = [-1, 0, 1, -1, 0, 1, -1, 0, 1]
dy = [-1, -1, -1, 0, 0, 0, 1, 1, 1]
board = {}

for i in xrange(N):
    a, b = map(int, raw_input().split())
    for j in xrange(9):
        x, y = a+dx[j], b+dy[j]
        if x <= 1 or x >= H or y <= 1 or y >= W:
            continue
        if (x, y) in board:
            board[(x, y)] += 1
        else:
            board[(x, y)] = 1
ans = [0] * 10
for v in board.values():
    ans[v] += 1
ans[0] = (H-2)*(W-2)-sum(ans)
for a in ans:
    print a
N=int(input())
a=[int(i) for i in input().split()]
count=0
for j in range(N):
    for i in range(N-1):
        if(a[i]==j+1):
            count=count+1
    print(count)
    count=0


### FIXED CODE ###

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

d = {}

for i in range(N - 1):
    if A[i] in d:
        d[A[i]].append(i + 2)
    else:
        d[A[i]] = [i + 2]

for i in range(1, N + 1):
    if i in d:
        print(len(d[i]))
    else:
        print(0)
n = int(input())
p = list(map(int, input().split()))
count = 0
for idx,i in enumerate(p):
  if i == idx+1:
    p[idx],p[idx+1] = p[idx+1],i
    count += 1
    
print(count)

### FIXED CODE ###

n = int(input())
p = list(map(int, input().split()))
count = 0
for idx,i in enumerate(p):
  if i == idx+1:
    try:
      p[idx],p[idx+1] = p[idx+1],i
      count += 1
    except:
      count += 1
    
print(count)
N,D= map(int, input().split())
xy = [map(int, input().split()) for _ in range(N)]
x, y = [list(i) for i in zip(*xy)]

def f(x,y,D):
  s=0
  for i in range(N)
  　　if (a[i]*a[i] + b[i]*b[i])<= c*c:
     　　s=s+1
  return s

print(s)

### FIXED CODE ###

N,D = map(int, input().split())
XY = [map(int, input().split()) for _ in range(N)]
X,Y = [list(i) for i in zip(*XY)]

s=0
for i in range (N):
  if X[i]*X[i]+Y[i]*Y[i]<=D*D:
    s=s+1
print(s)
INF=float('inf')
import numpy as np

n=int(input())
P=list(map(float,input().split()))#0

dp=np.zeros([n+1,n+1], dtype='float128')

for i in range(n+1):
  if i==0:
    dp[0][0]=1
  else:
    dp[i][0]=(1-P[i-1])*dp[i-1][0]

    
for j in range(1,n+1):
  for i in range(1,n+1):
    if i<j:
      continue
    dp[i][j]=P[i-1]*(dp[i-1][j-1])+(1-P[i-1])*(dp[i-1][j])

ans=0
for i in range(1,n+1):
  if i>=(n+1)//2:
    ans+=dp[n][i]
    
print(ans)

### FIXED CODE ###

INF=float('inf')

n=int(input())
P=list(map(float,input().split()))#0

dp=[[0 for i in range(n+1)] for j in range(n+1)]

for i in range(n+1):
  if i==0:
    dp[0][0]=1
  else:
    dp[i][0]=(1-P[i-1])*dp[i-1][0]

    
for j in range(1,n+1):
  for i in range(1,n+1):
    if i<j:
      continue
    dp[i][j]=P[i-1]*(dp[i-1][j-1])+(1-P[i-1])*(dp[i-1][j])

ans=0
for i in range(1,n+1):
  if i>=(n+1)//2:
    ans+=dp[n][i]
    
print(ans)
n,x,m=map(int,input().split())
a=[0]*(m+2)
cnt=[0]*(m+2)
a[1],f=x,x
cnt[f]=1
for i in range(2,m+1):
  f=f*f%m
  a[i]=f
  if cnt[f]==0:
    cnt[f]=1
  else:
    break
ind=a[1:].index(f)+1
ans=sum(a[:ind])+sum(a[ind:i])*((n-ind+1)//(i-ind))
p=(n-ind+1)%(i-ind)
ans+=sum(a[ind:ind+p])
print(ans)

### FIXED CODE ###

import sys
n,x,m=map(int,input().split())
a=[0]*(m+2)
cnt=[0]*(m+2)
a[1],f=x,x
cnt[f]=1
if x==0:
  print(0)
  sys.exit()
for i in range(2,m+1):
  f=f*f%m
  a[i]=f
  if cnt[f]==0:
    cnt[f]=1
  else:
    break
ind=a[1:].index(f)+1
ans=sum(a[:ind])+sum(a[ind:i])*((n-ind+1)//(i-ind))
p=(n-ind+1)%(i-ind)
ans+=sum(a[ind:ind+p])
print(ans)
N = map(int, input().split())
count = 0

while N % 2 == 0:
  N / 2
  count ++
print(count)

### FIXED CODE ###

N = int(input())
k = 0
while 1:
  if 2**k > N:
    break
  ans = 2**k
  k += 1
print(ans)
import sys
Input = sys.stdin.readline

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

for i in range(int(math.sqrt(M))+1, 1, -1):
    if M % i == 0:
        if M >= N*i:
            print(i)
            sys.exit()

### FIXED CODE ###

import sys
import math
Input = sys.stdin.readline
 
N, M = map(int, Input().split())
D = []
 
for i in range(int(math.sqrt(M)), 0, -1):
    if M % i == 0:
      D.append(i)
      D.append(M // i)

D.sort(reverse=True)
for d in D:
    if M >= N*d:
        print(d)
        break
count=0
while True:
    count=count+1
    a=input()
    b=len(a)
    if b==0:
        break
    else:
        print("Case "+str(count)+": "+str*(a))



### FIXED CODE ###

count=0
while True:
    count=count+1
    a=input()
    if int(a)==0:
        break
    else:
        print("Case "+str(count)+": "+str(a))
s = input()
 
s = s[::-1]
 
dp = [0 for _ in range(13)]
 
if s[0] == '?':
    for j in range(10):
        dp[j] = 1
else:
    dp[int(s[0])] = 1

m = 1
MOD = 10**9 +7
 
s = s[1:]

for w in s:
    m = m*10 % 13
    ans = [0 for _ in range(13)]
 
    if w == '?':
        for k in range(13):
            for j in range(10):
                ans[(j*m+k)%13] += dp[k]
                ans[k] % MOD
    else:
        for k in range(13):
            ans[(int(w)*m + k) %13] += dp[k]
            ans[k] % MOD
    for k in range(13):
        dp[k] = ans[k]
        ans[k] = ans[k] % MOD
 
print(ans[5] % MOD )

### FIXED CODE ###

s = input()
 
s = s[::-1]
 
dp = [[0 for _ in range(13)] for __ in range(len(s)+1)]
 
l = len(s)
 
 
if s[0] == '?':
    for j in range(10):
        dp[0][j] = 1
else:
    dp[0][int(s[0])] = 1
 
m = 1
MOD = 10**9 +7
 
for i in range(1,len(s)):
    m = m*10 % 13
 
    if s[i] == '?':
        for k in range(13):
            for j in range(10):
                dp[i][(j*m+k)%13] += dp[i-1][k]
                dp[i][k] %= MOD
    else:
        for k in range(13):
            dp[i][(int(s[i])*m + k) %13] += dp[i-1][k]
            dp[i][k] %= MOD
 
print(dp[len(s)-1][5] % MOD )
p, q = map(int, input().split())
import fraction

def lcm(a, b):
    return (a * b) // fraction.gcd(a, b)

print(lcm(p, q))

### FIXED CODE ###

p, q = map(int, input().split())
import fractions
 
def lcm(a, b):
    return (a * b) // fractions.gcd(a, b)

print(lcm(p, q))
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
  int n,m;
  vector<string> s(n),t(m),o(n);
  cin>>n;
  rep(i,n){
    cin>>s.at(i);
  }
  cin>>m;
  rep(j,m){
    cin>>t.at(j)
  }
  rep(i,n){
    int sss=0, ttt=0;
      rep(j,n){
        if(s.at(i)==s.at(j)){
          sss++;
        }
      }
  rep(k,m){
    if(s.at(i)==t.at(k)){
      ttt++;
    }
  }
    o.at(i) = sss - ttt;
 }
  int max=0;
  rep(i,n){
    if(max<o.at(i)){
      max = o.at(i);
    }
  }
  cout<<max;
}
  

### FIXED CODE ###

n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
l =[0]*n
for j in range(n):
  a = s.count(s[j])
  b = t.count(s[j])
  l[j] = a-b
print(max(max(l),0))
s = input()
ans=[]
for i in range(len(s)):
  if s[i]==0 or s[i]==1:
    ans.append(i)
  else:
    try;ans.pop()
    except:pass
print("".join(ans))


### FIXED CODE ###

s=input()
ans=[]
for i in range(len(s)):
  if s[i]=="0" or s[i]=="1":
    ans.append(s[i])
  else:
    try:ans.pop()
    except:pass
print("".join(ans))
x = input()
 ans = int(x)**3
 print ans

### FIXED CODE ###

x = input()
ans = x**3
print ans
def main():
  S=input()
  N=len(S)
  s=0
  for i in range(N//2):
      if S[i]!=S[-i-1]:
        S[-i-1]=S[i]
        s+=1
  print(s)
main()

### FIXED CODE ###

def main():
  S=input()
  s=0
  N=len(S)
  for i in range(N//2):
    if S[i]!=S[N-1-i]:
      s+=1
  print(s)
main()
from collections import Counter

def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    if x!=1:
      retlist.append(x)
    return retlist

N=int(input())

cnt=Counter()
for i in range(N):
  a=get_factors(i+1)
  acounter=Counter(a)
  cnt=cnt+acounter
values,counts=zip(*cnt.most_common())
ans=0
five=0
three=0
sevfou=0
twofou=0
fourteen=0
for c in counts:
  if c>=74:
    sevfou+=1
  if c>=24:
    twofou+=1
  if c>=14:
    fourteen+=1
  if c>=4:
    five+=1
  if c>=2:
    three+=1
ans+=(five*(five-1)/2)*(three-2)
ans+=(fourteen*(five-1))
ans+=(twofou*(three-1))
ans+=(sevfou)
print(ans)

### FIXED CODE ###

from collections import Counter

def get_factors(x):
    retlist = []
    for i in range(2, int(x**0.5) + 3):
        while x % i == 0:
            retlist.append(i)
            x = x // i
    if x!=1:
      retlist.append(x)
    return retlist

N=int(input())

if N==1:
  print(0)
  exit()

cnt=Counter()
for i in range(N):
  a=get_factors(i+1)
  acounter=Counter(a)
  cnt=cnt+acounter
values,counts=zip(*cnt.most_common())
ans=0
five=0
three=0
sevfou=0
twofou=0
fourteen=0
for c in counts:
  if c>=74:
    sevfou+=1
  if c>=24:
    twofou+=1
  if c>=14:
    fourteen+=1
  if c>=4:
    five+=1
  if c>=2:
    three+=1
ans+=(five*(five-1)/2)*(three-2)
ans+=(fourteen*(five-1))
ans+=(twofou*(three-1))
ans+=(sevfou)
print(int(ans))
n, q = map(int, input().split())
to = [[] for i in range(n)]
ans = [0 for i in range(n)]
def dfs(v, p = -1):
    for u in to[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)
for i in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)
for i in range(q):
    p, x = map(int, input().split())
    p -= 1
    ans[p] += x
dfs(0)
print(" ".join(map(str, ans)))

### FIXED CODE ###

import sys
sys.setrecursionlimit(200005) 
input = sys.stdin.readline
n, q = map(int, input().split())
to = [[] for i in range(n)]
ans = [0 for i in range(n)]
def dfs(v, p = -1):
    for u in to[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)
for i in range(n - 1):
    a, b = map(int, input().split())
    to[a - 1].append(b - 1)
    to[b - 1].append(a - 1)
for i in range(q):
    p, x = map(int, input().split())
    ans[p - 1] += x
dfs(0)
print(*ans)
N, Y = map(int, input().split())
for x in range(0,N+1)
	for y in range(0,N+1-x)
		for z in range(0,N+1-x-y)			
   			if Y==10000*x+5000*y+1000*z:
    			print(x,y,z)
    			exit()
            else:
print(-1,-1,-1)

### FIXED CODE ###

N, Y = map(int, input().split())
 
for x in range(N+1):
  for y in range(N-x+1):
    z = N - x - y
    if 10000 * x + 5000 * y + 1000 * z == Y:
      print(x,y,z)
      exit()
print(-1,-1,-1)
# your code goes here
#binary
n=int(input())
S=[int(i) for i in input().split()]
q=int(input())
T=[int(i) for i in input().split()]
C=0
for i in range(q):
    j=n//2
    b=n//2
    while T[i]!=S[j] and b>1:
        if b%2==1:
            b+=1
        b//=2
        if T[i]>S[j]:
            j+=b
        elif T[i]<S[j]:
            j-=b
    if T[i]==S[j]:
        C+=1
    else:
        if T[i]>S[j]:
            j+=b
        else:
            j-=b
        if T[i]==S[j]:
            C+=1
 #   print(j)
print(C)

### FIXED CODE ###

# your code goes here
#binary search function
def bi(B0,bA,BI):
    bm=bA[1]+bA[2]
    bm//=2
    if BI[bA[1]]<=B0<=BI[bm]:
        bA=[0,bA[1],bm]
    else:
        bA=[0,bm,bA[2]]
   # print(bA)
    return bA
def bs(B0,BI):
    if B0<BI[0]:
        bA=[0,0,0]
    elif B0>BI[-1]:
        bA=[0,-1,-1]
    else:
        bA=[0,0,len(BI)-1]
        while bA[2]-bA[1]>1:
            bA=bi(B0,bA,BI)
        if B0==BI[bA[1]]:
            bA=[1,bA[1]]
        elif B0==BI[bA[2]]:
            bA=[1,bA[2]]
        else:
            bA=[0,bA[1],bA[2]]
   # print(bA)
    return bA
n=int(input())
S=[int(i) for i in input().split()]
q=int(input())
T=[int(i) for i in input().split()]
c=0
for i in range(q):
    bA=bs(T[i],S)
    if bA[0]==1:
        c+=1
print(c)
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,k = map(int,input().split())
mod = 10**9 + 7
for i in range(1,k+1):
    print((combinations_count(n-k+1,i)*i**(k-i) ) % mod)

### FIXED CODE ###

import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n,k = map(int,input().split())
mod = 10**9 + 7
for i in range(1,k+1):
    if n-k+1 < i:
        print(0)
    elif k-i== 0:
        print(combinations_count(n-k+1,i)% mod)
    else:
        a = math.factorial(k-1)//(math.factorial(k-i)*math.factorial(i-1))
        print((combinations_count(n-k+1,i)*a) % mod)
s = str(input())

alphabet = "abcdefghijklmnopqrstuvwxyz"
for i in range(alphabet):
  if alphabet[i] not in s:
    print(i)
    break
    
    
    

### FIXED CODE ###

s = str(input())
     
alphabet = "abcdefghijklmnopqrstuvwxyz"
     
ans ='None' 
for i in range(len(alphabet)):
        if not alphabet[i] in s:
                ans = alphabet[i]
                break
print(ans)
S = input()
f,e = int(S[:2]),int(S[2:])
if f==0 of e==0 or (f>12 and e>12):
  print('NA')
  exit()
if 1<=f<=12:
  if e>12:
    print('MMYY')
  elif 1<=e<=12
    print('AMBIGUOUS')
elif f>12:
  if 1<=e<=12:
    print('YYMM')

### FIXED CODE ###

S = input()
f,e = int(S[:2]),int(S[2:])
if (f > 12 or f == 0) and 0 < e <= 12:
   print('YYMM')
elif 0 < f <= 12 and (e > 12 or e == 0):
   print('MMYY')
elif 0 < f <= 12 and 0 < e <= 12:
   print('AMBIGUOUS')
else:
    print('NA')
n=int(input())
r=[list(map(int,input().split())) for _ in range(N)]
r.sort(key=lambda x:x[2])
x,y,h=r[-1]

for X in range(101):
  for Y in range(101):
    H = h + abs(X-x) + abs(Y-y)
    if all(k==max(H-abs(X-i)-abs(Y-j),0) for i,j,k in r):
      print(i,j,k)
      exit()

### FIXED CODE ###

n=int(input())
#(x,y,h)
r=sorted([list(map(int,input().split()))[::-1] for _ in range(n)])[::-1]

for i in range(101):
  for j in range(101):
    h1=r[0][0]+abs(r[0][1]-i)+abs(r[0][2]-j)
    flag=0
    for item in r[1:]:
      if item[0]>0:
        if item[0]+abs(item[1]-i)+abs(item[2]-j)!=h1:
          flag=1
          break
      else:
        if h1-abs(item[1]-i)-abs(item[2]-j)>0:
          flag=1
          break
    if flag==0:
      print(j,i,h1)
      exit()
from math import ceil


def solve(string):
    n, h, * ab = map(int, string.split())
    max_a = max(ab[::2])
    cnt = 0
    b = sorted([b for b in ab[1::2] if b > max_a], reverse=True)
    if sum(b) < h:
        cnt = len(b) + ceil((h-sum(b)) / max_a)
    else:
        for _b in b:
            cnt += 1
            h -= _b
            if h <= 0:
                break
    return str(cnt)


if __name__ == '__main__':
    print(solve(input()))


### FIXED CODE ###

#!/usr/bin/env python3
# coding=utf-8

import sys
import math
import numpy as np
n, h = map(int, sys.stdin.readline().strip().split(" "))
a = []
b = []
for _ in range(n):
    _a, _b = map(int, sys.stdin.readline().strip().split(" "))
    a.append(_a)
    b.append(_b)
max_a = max(a)
cnt = 0
b = np.asarray(sorted(b))
b = b[b > max_a]
while h > 0 and len(b) > 0:
    cnt += 1
    h -= b[-1]
    b = b[:-1]
if h > 0:
    cnt += math.ceil(h / max_a)
print(cnt)
N, K = map(int, imput().split())
p = K*((K-1)**(N-1))
print(p)


### FIXED CODE ###

N, K = map(int, input().split())
p = K*((K-1)**(N-1))
print(p)
s_i = [int(s_v) for s_v in input().split()]
sum_cost = abs(s_i[1] - s_i[2])
a = abs(s_i[0] - s_i[1])
b = abs(s_i[0] - s_i[2])
if(a >= b):
	sum_cost += b
else:
	sum_cost += c
print(sum_cost)

### FIXED CODE ###

a_l = [int(a_v) for a_v in input().split()]
a_l.sort()
print(abs(a_l[0]-a_l[1])+abs(a_l[1]-a_l[2]))
// template
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<long long, long long> LP;
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define REP_AB(i, a, b) for (ll i = ll(a); i <= ll(b); ++i)
#define ALL(v) v.begin(), v.end()
#define SORT(v) sort(ALL(v))
#define UNIQUE(v) sort(ALL(v));v.erase(unique(ALL(v)), v.end());
#define SIZE(x) ((ll)(x).size())
#define REVERSE(v) reverse(ALL(v))
// true / false
#define BIN_SEARCH(v, a) binary_search(ALL(v), a)
// index
#define BIN_LEFT(v, a) (lower_bound(ALL(v), a) - v.begin())
#define BIN_RIGHT(v, a) (upper_bound(ALL(v), a) - v.begin())
#define BIN_INSERT(v, a) (v.insert(v.begin() + BIN_LEFT(v, a), a))
#define DEL(v, i) v.erase(v.begin() + i)
#define INSERT(v, i, a) v.insert(v.begin() + i, a)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a / gcd(a, b)) * b;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
#define out cout
#define in cin
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
// template end
 
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    ll N, max, f = 0;
    in >> N;
    vector<ll> H(N);
    REP(i,N){
        in >> H[i];
    }

    max = H[0];
    REP_AB(i,1,N-1){
        if(max < H[i]){
            max = H[i] - 1;
        }
        if(max > H[i]){
            f = 1;
            break;
        }
    }


    if(f == 0){
           out << "Yes" << endl;
    }else if(f == 1){
           out << "No" << endl;
    }


 

 

}


### FIXED CODE ###

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

v = 1
flag = True
for i in range(n):
    if v < h[i]:
        v = h[i] - 1
    elif v == h[i]:
        pass
    else:
        flag = False
        break

if flag:
    print("Yes")
else:
    print("No")
# 最大公約数を計算
# ユークリッドの互除法を用いる
def gcd(x, y):
    # 大きい方をaに
    a, b = (x,y) if x>y else (y,x)
    if a == b:
        return a
    else:
        return gcd(a-b,b)

# N個の整数に対する最大公約数の計算
def calc(n, an):
    if n == 2:
        return gcd(an[0], an[1])
    else:
        return gcd(an[0], calc(n-1, an[1:]))


n = int(input())
an = [int(x) for x in input().split(' ')]

if n == 2:
    print(max(an))
else:
    #N-1個の組み合わせに対する最大公約数で最大のものを選ぶ
    # N-1個の組み合わせ
    bn = [[an[j] for j in range(n) if i != j] for i in range(n)]
    gcds = [calc(n-1, ary) for ary in bn]
    print(max(gcds))

### FIXED CODE ###

hoge = input()

a, b, t = [int(x) for x in hoge.split(' ')]

print(int(((t+0.5)//a)*b))
r, d, x = [int(x) for x in input().split()]
for i in range(2001, 2011):
  x = r * x - D
  print(x)

### FIXED CODE ###

r, d, x = [int(x) for x in input().split()]
for i in range(2001, 2011):
  x = r * x - d
  print(x)