Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10**7)

def find(x):#xの親を見つける
  if par[x] < 0:
    return x
  else:
    par[x] = find(par[x])
    return par[x]

def unite(x,y):#要素xとｙを併合させる
  x,y=find(x),find(y)#xとyの親の検索
  if x!=y:#親が異なる場合併合させる
    if x>y:
        x,y=y,x#小さい方をxとする. これにより要素の値が小さいものを優先して木の根とする. 
    par[x]+=par[y] #値を無向木の要素数の和にする.
    par[y]=x #枝側は根の位置を格納

def same(x, y):#要素xと要素yが同じ無向木に所属しているかを判定する
  return find(x) == find(y)#同じ値を持つか否か

def size(x):#要素xが所属する無向木の大きさを返す
  return-par[find(x)]

n, m = map(int, input().split()) #要素の数
par = [-1] * n #
import numpy as np
path = []
par = np.array(par)
for i in range(m):
  a, b = map(int, input().split())
  path.append([a-1, b-1])
ans_l = [n*(n-1)//2]
for i in range(m-1, 0, -1):
  unite(path[i][0], path[i][1])
  if len(par[par < 0]) == 0:
    ans_l.append(0)
  ans = np.dot(np.array([par[par < 0]]).T, np.array([par[par < 0]]))
  ans_l.append((np.sum(ans)-np.trace(ans))//2)
for i in range(m-1, -1, -1):
  print(ans_l[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

def find(x):#xの親を見つける
  if par[x] < 0:
    return x
  else:
    par[x] = find(par[x])
    return par[x]

def unite(x,y):#要素xとｙを併合させる
  x,y=find(x),find(y)#xとyの親の検索
  if x!=y:#親が異なる場合併合させる
    if x>y:
        x,y=y,x#小さい方をxとする. これにより要素の値が小さいものを優先して木の根とする. 
    par[x]+=par[y] #値を無向木の要素数の和にする.
    par[y]=x #枝側は根の位置を格納

def same(x, y):#要素xと要素yが同じ無向木に所属しているかを判定する
  return find(x) == find(y)#同じ値を持つか否か

def size(x):#要素xが所属する無向木の大きさを返す
  return-par[find(x)]

n, m = map(int, input().split()) #要素の数
par = [-1] * n #
path = []
for i in range(m):
  a, b = map(int, input().split())
  path.append([a-1, b-1])
ans_l = [n*(n-1)//2]
for i in range(m-1, 0, -1):
  if same(path[i][0], path[i][1]):
    ans_l.append(ans_l[-1])
    unite(path[i][0], path[i][1])
  else:
    ans_l.append(ans_l[-1] - size(path[i][0])*size(path[i][1]))
    unite(path[i][0], path[i][1])
for i in range(m-1, -1, -1):
  print(ans_l[i])
import math
N, K = map(int, input().split())

cnt_list = []
for i in range(K):
  C1 = int(math.factorial(N-K+1))/int((math.factorial(i+1)*math.factorial(N-K+1-i-1)))
  C2 = int(math.factorial(K-1))/int((math.factorial(i+1-1)*math.factorial(K-1-i+1-1)))
  cnt = int(C1*C2)
  cnt_list.append(cnt%(10**9+7))

for i in range(len(cnt_list)):
    print(cnt_list[i])

### FIXED CODE ###

import math

def combi(n ,k):
    return math.factorial(n)//(math.factorial(k)*math.factorial(n-k))

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

cnt_list = []
for i in range(1,K+1):
    if N-K+1 >= i:
        cnt = int(combi(N-K+1,i)*combi(K-1,i-1))
    else:
        cnt =0
    cnt_list.append(cnt%(10**9+7))

for i in range(len(cnt_list)):
    print(cnt_list[i])
N,R = map(int,input().split)
if N < 10:
  R = 100 * (10 - N)
  print(R)
else:
  print(R)

### FIXED CODE ###

N,R = map(int,input().split())
if N < 10:
  R = R + 100 * (10 - N)
  print(R)
else:
  print(R)
n = int(input())
d = sorted(list(map(int, input().split())) + [0])

bit, cnt = [0] * 24, 1
for num in d:
    bit[(num - 12) * cnt + 12] += 1
    cnt *= -1

if any(i > 1 for i in bit):
    print(0)
    exit()
ans = [i for i, li in enumerate(bit * 2) if li == 1]
s = min(ans[i] - ans[i - 1] for i in range(1, len(ans)))
print(s)


### FIXED CODE ###

from collections import Counter
from itertools import product


def solve(LIST):
    S = 24
    slvtmp = [i for i, li in enumerate(LIST * 2) if li == 1]
    for i in range(1, len(slvtmp)):
        S = min(S, slvtmp[i] - slvtmp[i - 1])
    return S


n = int(input())
d = Counter(list(map(int, input().split())) + [0])

if any(d[num] > (2 - (num in {0, 12})) for num in d):
    print(0)
    exit()

ans, cnt = [0] * 24, []
for num in d:
    if (num in {0, 12}) and d[num] == 1:
        ans[num] = 1 
    elif d[num] == 2:
        ans[num], ans[24 - num] = 1, 1
    elif d[num] == 1:
        cnt.append(num)

s = 0
if len(cnt) == 0:
    s = max(s, solve(ans))
for bit in product([1, -1], repeat=len(cnt)):
    tmp = ans[:]
    for bi, ci in zip(bit, cnt):
        tmp[(ci - 12) * bi + 12] = 1
    s = max(s, solve(tmp))
print(s)
N = int(input())
As = [int(x) for x in input().split()]
S = sum(As)

print(S)
for i in range(1,N):
    subs = sum(As[:i])
    temp = abs(2 * subs - S)
    if ans is None or temp < ans:
        ans = temp
print(ans)


### FIXED CODE ###

N = int(input())
As = [int(x) for x in input().split()]
S = sum(As)

ans = None
subsum = 0
for i in range(1,N):
    subsum += As[i-1]
    temp = abs(2 * subsum - S)
    if ans is None or temp < ans:
        ans = temp
print(ans)
N = input()

if N[0] == 7:
  print("Yes")
else if N[1] == 7:
  print("Yes")
else if N[2] == 7:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = input()

if N[0] == "7":
  print("Yes")
elif N[1] == "7":
  print("Yes")
elif N[2] == "7":
  print("Yes")
else:
  print("No")
from collections import deque
n,k= map(int,input().split())
td=[]
for i in range(n):
    td.append(list(map(int,input().split())))
td.sort(key=lambda x:x[1],reverse=True)
select=[]
noselect=[]
cat=[]
for tdi in td:
    if tdi[0] in cat:
        noselect.append(tdi)
        continue
    select.append(tdi)
    cat.append(tdi[0])
    if len(select)==k:
        break
i=0
while len(select) < k:
    select.append(noselect[i])
    i+=1
noselect=noselect[i:]

print(8)


### FIXED CODE ###

a,b,c=map(int,input().split())
print((a*b)//2)
N=int(input())
A=[int(i) for i in input().split()]
def Check(K):
  stack=[]
  n=A[0]
  for i in range(1,N):
    if A[i-1]<A[i]:
      n=A[i]
    else:
      while n>A[i]:
        if stack:
          if stack[-1][0]==n:
            stack.pop()
        n-=1
      r=1
      while True:
        if not stack:
          if K==1:
            return False
          stack.append([n+1-r,1])
          break
        elif r==n:
          if stack[0][1]==K-1:
            return False
          else:
            stack[0][0]+=1
            break
        elif stack[(-1)*r][0]<n+1-r:
          if K==1:
            return False
          stack.append([n+1-r,1])
          break
        elif stack[(-1)*r][1]<K-1:
          stack[(-1)*r][1]+=1
          break
        elif stack[(-1)*r][1]==K-1:
          stack.pop()
          r+=1
  return True
l,r=1,N
while l<r:
  m=(l+r)//2
  if Check(m):
    r=m
  else:
    l=m+1
print(l)
          
          
          
      

### FIXED CODE ###

N=int(input())
A=[int(i) for i in input().split()]
def Check(K):
  stack=[]
  n=A[0]
  for i in range(1,N):
    if A[i-1]<A[i]:
      n=A[i]
    else:
      if K==1:
        return False
      n=A[i]
      while True:
        l=0
        if stack:
          l=stack[-1][0]
        if l>n:
          stack.pop()
        else:
          break       
      k=n
      while k>=1:
        if not stack:
          stack.append([k,1])
          break
        if stack[-1][0]==k:
          if stack[-1][1]==K-1:
            if k!=1:
              stack.pop()
              k-=1
            else:
              return False
          else:
            stack[-1][1]+=1
            break
        else:
          stack.append([k,1])
          break
  return True
l,r=1,N
while l<r:
  m=(l+r)//2
  if Check(m):
    r=m
  else:
    l=m+1
print(l)
def spaceinput():
    return list(map(int,input().split(" ")))


N=int(input())
a=spaceinput()


sa=sorted(a,reverse=True)
x=[]
i=0
while True:
    ssa=sa[i]
    if sa[i]==sa[i+1]:
        x.append(ssa)
        i+=2
        if len(x)==2:
            break

    i+=1
    if i>=len(sa):
        break

x.extend([0,0])

print(x[0]*x[1])


### FIXED CODE ###

def spaceinput():
    return list(map(int,input().split(" ")))


N=int(input())
a=spaceinput()


sa=sorted(a,reverse=True)
x=[]
i=0
while True:
    if i>=len(sa)-1:
        break
    ssa=sa[i]
    if sa[i]==sa[i+1]:
        x.append(ssa)
        i+=2
        if len(x)==2:
            break
        continue

    else:
        i+=1


x.extend([0,0])

print(x[0]*x[1])
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import queue
import math


def inputIntList():
  return [int(s) for s in input().split()]


def inputInt():
  return int(input())


def main():
  H, W = inputIntList()
  S = [[s for s in input()] for _ in range(H)]

  ans = 0
  for i in range(W):
    for j in range(H):
      dist = [[-1 for _ in range(W)] for _ in range(H)]
      if S[i][j] == '#':
        continue
      start = (i, j)
      q = queue.Queue()

      def update(pos, num):
        i, j = pos
        if dist[i][j] != -1:
          return
        dist[i][j] = num
        q.put(pos)
      update(start, 0)
      while not q.empty():
        qi, qj = q.get()
        for di, dj in zip([-1, 0, 1, 0], [0, -1, 0, 1]):
          ni = qi + di
          nj = qj + dj
          if ni < 0 or ni >= W:
            continue
          if nj < 0 or nj >= H:
            continue
          if S[ni][nj] == '#':
            continue
          update((ni, nj), dist[qi][qj]+1)
      ans = max(ans, max(max(x) for x in dist))
    return ans


if __name__ == "__main__":
  print(main())


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from collections import deque
import math


def inputIntList():
  return [int(s) for s in input().split()]


def inputInt():
  return int(input())


def main():
  H, W = inputIntList()
  S = [[s for s in input()] for _ in range(H)]

  ans = 0
  for si in range(H):
    for sj in range(W):
      if S[si][sj] == '#':
        continue

      dist = [[-1 for _ in range(W)] for _ in range(H)]
      q = deque()

      start = (si, sj)
      if dist[si][sj] == -1:
        dist[si][sj] = 0
        q.append(start)

      while q:
        qi, qj = q.popleft()
        for di, dj in (-1, 0), (0, -1), (1, 0), (0, 1):
          ni = qi + di
          nj = qj + dj
          if ni < 0 or ni >= H:
            continue
          if nj < 0 or nj >= W:
            continue
          if S[ni][nj] == '#':
            continue
          if dist[ni][nj] == -1:
            dist[ni][nj] = dist[qi][qj]+1
            q.append((ni, nj))
            ans = max(ans, dist[ni][nj])
  return ans


if __name__ == "__main__":
  print(main())
n,k=map(int,input().split())
lst=list(map(int,input().split()))
mod=10**9+7

plst=sorted([x for x in lst if x>=0],reverse=True)
nlst=sorted([abs(x) for x in lst if x<0],reverse=True)
out=[None for _ in range(k)]
lenn=len(nlst)
lenp=len(plst)



if lenp==0 and k%2==1:
    sm=1
    for i in range(lenn-1,lenn-k-1,-1):
        sm*=-nlst[i]
        sm%=mod
    print(sm)
    exit()


ptoken=0
ntoken=0
token=0
pm=0



while token<k:
    if ptoken==lenp:
        out[token]=nlst[ntoken]
        pm=(pm+1)%2
        ntoken+=1
    elif ntoken==lenn:
        out[token]=plst[ptoken]
        ptoken+=1
    elif plst[ptoken]>nlst[ntoken]:
        out[token]=plst[ptoken]
        ptoken+=1
    else :
        out[token]=nlst[ntoken]
        pm=(pm+1)%2
        ntoken+=1
    token+=1

if pm==1:
    if n!=k:
        if ptoken==lenp:          
            out.remove(plst[ptoken-1])
            out.append(nlst[ntoken])
        elif ntoken==lenn:
            out.remove(nlst[ntoken-1])
            out.append(plst[ptoken])
        else : 
            if nlst[ntoken-1]*nlst[ntoken]>=plst[ptoken-1]*plst[ptoken]:
                out.remove(plst[ptoken-1])
                out.append(nlst[ntoken])
            else :
                out.remove(nlst[ntoken-1])
                out.append(plst[ptoken])               

sm=1
for x in out:
    sm*=x
    sm%=mod

print(sm)

### FIXED CODE ###

n,k=map(int,input().split())
lst=list(map(int,input().split()))
mod=10**9+7

plst=sorted([x for x in lst if x>=0],reverse=True)
nlst=sorted([abs(x) for x in lst if x<0],reverse=True)
out=[None for _ in range(k)]
lenn=len(nlst)
lenp=len(plst)



if lenp==0 and k%2==1:
    sm=1
    for i in range(lenn-1,lenn-k-1,-1):
        sm*=-nlst[i]
        sm%=mod
    print(sm)
    exit()

if n==k:
    sm=1
    for x in lst:
        sm*=x
        sm%=mod
    print(sm)
    exit()



ptoken=0
ntoken=0
token=0
pm=0



while token<k:
    if ptoken==lenp:
        out[token]=nlst[ntoken]
        pm=(pm+1)%2
        ntoken+=1
    elif ntoken==lenn:
        out[token]=plst[ptoken]
        ptoken+=1
    elif plst[ptoken]>nlst[ntoken]:
        out[token]=plst[ptoken]
        ptoken+=1
    else :
        out[token]=nlst[ntoken]
        pm=(pm+1)%2
        ntoken+=1
    token+=1

if pm==1:
    if ptoken==lenp:          
        out.remove(plst[ptoken-1])
        out.append(nlst[ntoken])
    elif ntoken==lenn:
        out.remove(nlst[ntoken-1])
        out.append(plst[ptoken])
    elif ptoken==0 : 
        out.remove(nlst[ntoken-1])
        out.append(plst[ptoken])
    else : 
        if nlst[ntoken-1]*nlst[ntoken]>=plst[ptoken-1]*plst[ptoken]:
            out.remove(plst[ptoken-1])
            out.append(nlst[ntoken])
        else :
            out.remove(nlst[ntoken-1])
            out.append(plst[ptoken])               

sm=1
for x in out:
    sm*=x
    sm%=mod

print(sm)
def sumDigit(n):
        sum = 0
        while(n > 0):
            sum += n % 10
            n //= 10
        return sum


n = int(input())
a = int(input())
b = int(input())
total = 0
    
for i in range(1, n+1):
    sum = sumDigit(i)
    if(a<= sumDigit(i) <=b):
        total += i

print(total)




### FIXED CODE ###

n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
  if a <= sum(list(map(int, list(str(i))))) <= b:
    ans += i
print(ans)
import math
import numpy

A = input()
B = input()
H = input()
M = input()

theta = abs(int(H)*30 - int(M)*6)
cos = math.cos(math.radians(theta))

res = math.sqrt(int(A)**2 + int(B)**2 - 2 * int(A) * int(B) * cos)
print(res)

### FIXED CODE ###

import math

A, B, H, M = (float(x) for x in input().split())

theta = H*30 + (M/60)*30 - M*6
cos = math.cos(math.radians(theta))
res = math.sqrt(A**2 + B**2 - 2*A*B*cos)
print(res)
import numpy as np

h , w = map(int, input().split())
visited = np.zeros((h,w))

for y in range(h):
    _in = input()
    for x, value in enumerate(_in):
        if value == '.':
            visited[y][x] = 10**9
for i in range(1,h):
    visited[i,:] = np.minimum(visited[i,:],visited[i-1,:]+1)
for i in reversed(range(h-1)):
    visited[i,:] = np.minimum(visited[i,:],visited[i+1,:]+1)
for j in range(1,h):
    visited[:,j] = np.minimum(visited[:,j],visited[:,j-1]+1)
for j in reversed(range(h-1)):
    visited[:,j] = np.minimum(visited[:,j],visited[:,j+1]+1)
print(np.max(visited))

### FIXED CODE ###

import numpy as np

H,W = map(int,input().split())
use = np.zeros((H,W),dtype=int)
for i in range(H):
    s = input()
    for j,st in enumerate(s):
        if st == ".":
            use[i][j] = 10**10
        else:
            use[i][j] = 0

for i in range(1,H):
    use[i,:] = np.minimum(use[i,:],use[i-1,:]+1)
for i in reversed(range(H-1)):
    use[i,:] = np.minimum(use[i,:],use[i+1,:]+1)
for j in range(1,W):
    use[:,j] = np.minimum(use[:,j],use[:,j-1]+1)
for j in reversed(range(W-1)):
    use[:,j] = np.minimum(use[:,j],use[:,j+1]+1)

print(np.max(use))
while True:
    inp = input()
    if inp == '0': break

    num = 1
    for i in range(1, int(inp)+1):
        num = num * i

    cnt = 0
    strnum = str(num)
    while True:
        if strnum[-1] == '0':
            cnt = cnt + 1
            strnum = strnum[:-1]
        else:
            break

    print(cnt)

### FIXED CODE ###

while True:
    inp = input()
    if inp == '0': break

    num = 1
    for i in range(1, int(inp)+1):
        num = num * i

    cnt = 0
    strnum = str(num)
    while True:
        if strnum[-1] == '0':
            cnt = cnt + 1
            strnum = strnum[:-1]
        else:
            break

    print(cnt)
import copy
import functools
import math

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

C = []
for k in range(N):
    B = copy.copy(A)
    del B[k]
    C.append(functools.reduce(math.gcd, B))

print(max(C))

### FIXED CODE ###

A, B, T = map(int,input().split())

ans = T // A * B

print(ans)
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

n,x = map(int,input().split())
y = list(map(int,input().split()))
dist = []
for b in y:
    dist.append(abs(b-x))
print(gcd_list(dist))

### FIXED CODE ###

import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n,x = map(int,input().split())
y = list(map(int,input().split()))
dist = []
for b in y:
    dist.append(abs(b-x))
print(gcd_list(dist))
N = input()
T, X, Y = 0, 0, 0
for i in range(N):
  t, x, y = map(int, input().split())
  if t % 2 == (x+y) % 2 and abs(x-X)+abs(y-Y) <= t-T:
    count += 1
  T, X, Y = t, x, y
  
 print('Yes' if count==N else 'No')
  

### FIXED CODE ###

N = int(input())
count = 0
T, X, Y = 0, 0, 0
for i in range(N):
  t, x, y = map(int, input().split())
  if abs(x-X)+abs(y-Y) <= t-T and t % 2 == (x+y) % 2:
    count += 1
  T, X, Y = t, x, y
  
print('Yes' if count == N else 'No')
a, b, n = map(int, input().split())

temp_prev = 0
temp_curr = 0
x = min(n, b-1)

while x <= n:
    temp_prev = temp_curr
    temp_curr = int(a * x / b) - a * int(x / b)
    x += 1.0

    if temp_curr <= temp_prev:
        break

print(max(temp_curr, temp_prev))

### FIXED CODE ###

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

flag = 0

i = 1
while i * k <= b:
    if i*k >= a and i*k <=b:
        flag = 1
    
    i += 1

if flag:
    print("OK")
else:
    print("NG")
a = input()
b = input()

for _a, _b in zip(a, b):
    print(_a, _b, sep='', end='')
if len(a) > len(b):
    print(a[-1])

### FIXED CODE ###

numbers = list(map(int, input().split(' ')))
if numbers[2] - numbers[1] == numbers[1] - numbers[0]:
    print('YES')
else:
    print('NO')
N, L = input().split()
string_list = [input() for i in range(int(N))]
string_list.soted()
ans = ''
for i in string_list:
    ans += i

print(ans)


### FIXED CODE ###

N, L = map(int, input().split())
S = sorted([input() for i in range(N)])

print(''.join(S))
import math
math.ceil(n/2)

### FIXED CODE ###

n = int(input())
if n % 2 == 0:
  print(n//2)
else:
  print((n//2) + 1)
print(((int(input()))-1) *((int(input()))-1) )

### FIXED CODE ###


a,b=map(int,input().split())
print((a-1)*(b-1))
n, k = map(int, input().split())
v = list(map(int, input().split()))
mini = min(n, k)
value = 0
for a in range(mini + 1):
  for b in range(mini - a + 1):
    c = k - a - b
    j = v[:a] + v[n-b:]
    j.sort(reverse=True)
    for _ in range(c):
      if j[-1] < 0:
        j.pop()
      else:
        break
    value = max(value, sum(j))
print(value)

### FIXED CODE ###

n, k = map(int, input().split())
v = list(map(int, input().split()))
mini = min(n, k)
value = 0
for a in range(mini + 1):
  for b in range(mini - a + 1):
    c = k - a - b
    j = v[:a] + v[n-b:]
    j.sort(reverse=True)
    for _ in range(c):
      if j and j[-1] < 0:
        j.pop()
      else:
        break
    value = max(value, sum(j))
print(value)
n, k = map(int, input().split())
edges = []
for _ in range(n-1):
  edges.append(list(map(int, input().split())))


mod = 10**9+7
edge_dict = {}
for i in range(1, n+1):
  edge_dict[i] = set()

for edge in edges:
  edge_dict[edge[0]].add(edge[1])
  edge_dict[edge[1]].add(edge[0])

visited = set()

def visit(node, parent):
  num_children = len(edge_dict[node])
  num_available_colors = k-2 if parent is not None else k-1
  
  if k < num_children:
    return 0
  
  ans = 1
  for child in edge_dict[node]:
    if child is parent:
      continue
    
    ans *= num_available_colors
    num_available_colors -= 1
    ans %= mod
  
  for child in edge_dict[node]:
    if child is parent:
      continue
    
    ans *= visit(child, node)
    ans %= mod
  
  return ans

print((k*visit(1, None))%mod)

### FIXED CODE ###

import queue

n, k = map(int, input().split())
edges = []
for _ in range(n-1):
  edges.append(list(map(int, input().split())))
mod = 10**9+7

edge_dict = {}
for i in range(1, n+1):
  edge_dict[i] = set()

for edge in edges:
  edge_dict[edge[0]].add(edge[1])
  edge_dict[edge[1]].add(edge[0])

visited = set()
q = queue.LifoQueue()
q.put(1)

num_cases = 1
while not q.empty():
  node = q.get()
  
  visited.add(node)
  num_available_colors = k -2 if node is not 1 else k -1
  
  for child in (edge_dict[node] - visited):
    num_cases *= num_available_colors
    num_available_colors -= 1
    num_cases %= mod
    q.put(child)

print((k*num_cases)%mod)
N = int(intput())
print(N * (N-1) // 2)


### FIXED CODE ###

N = int(input())
print(N * (N-1) // 2)
s = input()
count = []
num = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "T" or s[i] == "C" or s[i] == "G":
        num += 1
    else:
        count.append(num)
        num = 0
print(max(count))

### FIXED CODE ###

s = input()
count = []
num = 0
for i in range(len(s)):
    if s[i] == "A" or s[i] == "T" or s[i] == "C" or s[i] == "G":
        num += 1
    else:
        count.append(num)
        num = 0
count.append(num)
print(max(count))
n, h = map(int, input().split())
A, B = [], []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)


throw_a = max(A)
B = sorted(B, reverse=True)
count = 0

while h > 0:
    count += 1
    if throw_a > max(B):
        h -= a
    else:
        h -= max(B)
        B.remove(max(B))

print(count)

### FIXED CODE ###

n, h = map(int, input().split())
A, B = [], []
for _ in range(n):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

B = sorted(B, reverse=True)
a_max = max(A)

bigger = [x for x in B if x >= a_max]
throw_b = len(bigger)

throw = 0
check = 0

while check == 0:
    if throw >= throw_b:
        break
    h = h - B[throw]
    throw += 1
    if h <= 0:
        break

if h <= 0:
    ans = throw
else:
    ans = throw + -(-h//max(A))

print(ans)
n=int(input())
for i in range(1,3501):
    for j in range(1,3501):
        if (n*i*j)%(4*i*j-n*i-n*j)==0:
            w=(n*i*j)//(4*i*j-n*i-n*j)
            print(i,j,w)
            exit()

### FIXED CODE ###

n=int(input())
for i in range(1,3501):
    for j in range(1,3501):
        if (4*i*j-n*i-n*j)>0 and (n*i*j)%(4*i*j-n*i-n*j)==0:
            w=(n*i*j)//(4*i*j-n*i-n*j)
            print(i,j,w)
            exit()
n, m, c = list(map(int ,input().split()))
b = list(map(int ,input().split()))
A = []
for i in range(n):
    A.appened(list(map(int ,input().split())))
count = 0
for i in range(n):
    sum = 0
    for j in range(m):
        sum += (b[m] * A[n][m])
    if sum + c > 0:
        count += 1
print(count)

### FIXED CODE ###

n, m, c = list(map(int ,input().split()))
b = list(map(int ,input().split()))
A = []
for i in range(n):
    A.append(list(map(int ,input().split())))
count = 0
for i in range(n):
    sum = 0
    for j in range(m):
        sum += (b[j] * A[i][j])
    if sum + c > 0:
        count += 1
print(count)
return int(input())*int(input())

### FIXED CODE ###

A, B = map(int,input().split())
print(A*B)
import numpy as np
from math import gcd
from functools import reduce

N, M = map(int,input().split())
a = list(map(int,input().split()))
a = np.array(a)
a = a // 2

def solve(p, q):
    cnt = 1
    while p % 2 == 0 and q % 2 == 0:
        cnt <<= 1
        p >>= 1
        q >>= 1
    if (p - q) % 2 != 0:
        return 0
    return p * q * cnt // gcd(p, q)
k = reduce(solve, a)
if k == 0:
    print(0)
else:
    ans = int((M / k + 1) / 2)
    print(ans)

### FIXED CODE ###

from fractions import gcd
from functools import reduce

N, M = map(int,input().split())
a = list(map(int,input().split()))
a = [x // 2 for x in a]

def solve(p, q):
    g = gcd(p, q)
    p //= g
    q //= g
    if (p - q) % 2 == 1:
        return 0
    return p * q * g

k = reduce(solve, a)
if k == 0:
    print(0)
else:
    print(M // k - M // (k * 2))
N = std(input())

a = N.split()

if 7 in a:
  print("Yes")
else:
  print("No")

  

### FIXED CODE ###

N = str(input())

list = [N[0], N[1], N[2]]
if "7" in list:
  print("Yes")
else:
  print("No")
import math
N,K = map(int,input().split())
if K > 50000:
  raise IndexError
cnt = 0
for n in range(1,N+1):
    if K/n <= 1:
        x = 0
    elif math.log(K/n)%math.log(2)<=0.00001:
        x = (math.log(K)-math.log(n))//math.log(2)
    else:
        x = (math.log(K)-math.log(n))//math.log(2)+1
    cnt += (0.5)**x
 
print(cnt/N)

### FIXED CODE ###

import math
N,K = map(int,input().split())
cnt = 0
for n in range(1,N+1):
    x = 0
    while n*(2**x) < K:
        x += 1
    cnt += (0.5)**x

print(cnt/N)