Harryxun/stf_run huggingface dataset:
from collections import deque
h, w = map(int, input().split())
maze = []
for _ in range(h):
    maze.append(list(input()))

def clear_maze(sx, sy, maze):
    INF = -float('infinity')
    field_x_length = len(maze)
    field_y_length = len(maze[0])
    distance = [[INF for i in range(field_y_length)] for j in range(field_x_length)]

    queue = deque([(sx, sy)])
    distance[sx][sy] = 0
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    while queue:
        x, y = queue.pop()
        # if x == gx and y == gy:
        #     break
        for i in range(0, 4):
            nx, ny = x + dx[i], y + dy[i]
            if (0 <= nx < field_x_length) and (0 <= ny < field_y_length):
                if maze[nx][ny] != '#' and distance[nx][ny] == INF:
                    queue.appendleft((nx, ny))
                    distance[nx][ny] = distance[x][y] + 1
    MAX = 0
    for row in range(len(distance)):
        for col in range(len(distance)):
            MAX = max(MAX, distance[row][col])
    return MAX
    # return distance[gx][gy]

pairs = []
for i in range(h):
    for j in range(w):
        if maze[i][j] == '.':
            pairs.append([i, j])

MAX = 0
for sx, sy in pairs:
    r = clear_maze(sx, sy, maze)
    MAX = max(MAX, r)
print(MAX)

### FIXED CODE ###

from collections import deque
h, w = map(int, input().split())
maze = []
for _ in range(h):
    maze.append(list(input()))

def clear_maze(sx, sy, maze):
    INF = -float('infinity')
    field_x_length = len(maze)
    field_y_length = len(maze[0])
    distance = [[INF for i in range(field_y_length)] for j in range(field_x_length)]

    queue = deque([(sx, sy)])
    distance[sx][sy] = 0
    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]
    while queue:
        x, y = queue.pop()
        # if x == gx and y == gy:
        #     break
        for i in range(0, 4):
            nx, ny = x + dx[i], y + dy[i]
            if (0 <= nx < field_x_length) and (0 <= ny < field_y_length):
                if maze[nx][ny] != '#' and distance[nx][ny] == INF:
                    queue.appendleft((nx, ny))
                    distance[nx][ny] = distance[x][y] + 1
    MAX = 0
    for row in range(field_x_length):
        for col in range(field_y_length):
            MAX = max(MAX, distance[row][col])
    return MAX
    # return distance[gx][gy]

pairs = []
for i in range(h):
    for j in range(w):
        if maze[i][j] == '.':
            pairs.append([i, j])

MAX = 0
for sx, sy in pairs:
    r = clear_maze(sx, sy, maze)
    MAX = max(MAX, r)
print(MAX)
n,m=map(int,input().split())
a = []
for i in range(n):
    a.append(input())
b = []
for i in range(m):
    b.append(input())

ok=False
cf=[]
for i in range(n-m+1):
    for j in range(n-m+1):
        for l in range(m):
            cf.append(a[i+l][j:j+m])
            #print(cf)
    if cf==b:
        ok=True
    cf=[]
print("Yes"if ok else "No")

### FIXED CODE ###

a,b=map(int,input().split())
J=0
if (a==1 and b!=1):
    J=1
elif (b==1 and a!=1):
    J=2
elif a<b:
    J=2
elif a>b:
    J=1
print("Alice" if J==1 else "Bob" if J==2 else "Draw")
s = [input() for i in range(3)]
A = s[0]
B = s[1]
K = s[2]
 
for j in range(K):
  if A >0:
    A -= 1
  elif B >0:
    B -= 1
  else:
    break
 
print(A)
print(B)

### FIXED CODE ###

i = list(map(int, input().split()))
A = i[0]
B = i[1]
K = i[2]

if K <= A :
    A -= K
elif K <= A + B :
    B -= K - A
    A = 0
else :
    A = 0
    B = 0

print(A, B)
L,R = map(int,input().split())

if R - L >2019:
  print(2)
else:
  ans = 2019
  for i in range(L,R-1):
    a = ((i%2019)*((i%2019)+1))%2019
    ans = min(ans,a)
  print(a)

### FIXED CODE ###

L,R = map(int,input().split())
ans = float('inf')
for i in range(L,R):
  for j in range(i+1,R+1):
    if (i*j)%2019==0:
      print(0)
      exit()
    ans = min(ans,(i*j)%2019)
print(ans)
# ==================================================-
# 二分探索
# functionを満たす,search_listの最大の要素を出力
# 【注意点】searchリストの初めの方はfunctionを満たし、後ろに行くにつれて満たさなくなるべき
import math
import sys

sys.setrecursionlimit(10 ** 9)


def binary_research(start, end, search_list, function):
    if start == end:
        return search_list[start]
    middle = math.ceil((start + end) / 2)
    if function(search_list[middle], k, a_sum, b_sum):
        start = middle
    else:
        end = middle - 1
    return binary_research(start, end, search_list, function)


# ==================================================-

n, m, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
a_sum = [0]
b_sum = [0]
for book in a:
    a_sum.append(a_sum[-1] + book)
for book in b:
    b_sum.append(b_sum[-1] + book)


def can_read(num, k, a_sum, b_sum):
    min_read_time = 1000000000000
    for i in range(max(0, num - m), n + 1):
        a_num = i
        b_num = num - i
        min_read_time = min(min_read_time, a_sum[a_num] + b_sum[b_num])
    if min_read_time <= k:
        return True
    return False


search_list = list(range(n + m + 1))
start = 0
end = n + m

print(binary_research(start, end, search_list, can_read))

### FIXED CODE ###

n,m,k=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]

def make_sumlist(book_list):
    sumnum=0
    container=[0]
    for i in book_list:
        container.append(sumnum+i)
        sumnum+=i
    return container

total_a=make_sumlist(a)
total_b=make_sumlist(b)

# print(n,m,k)
# print(total_a)
# print(total_b)


#r個読めるか
def readable(r):
    #全部読んでも無理
    if r>n+m:
        return False
    if r==0:
        return True
    max_book=100000000000
    for a_n in range(max(0,r-m),min(n,r)+1):
        b_n=r-a_n
        # print(a_n,b_n)
        book_sum=total_a[a_n]+total_b[b_n]
        # print(book_sum)
        max_book=min(max_book,book_sum)
    if max_book<=k:
        return True
    return False

def nibuntansaku(start,end):
    if start==end:
        return start
    middle=(start+end)//2+1
    if readable(middle):
        start=middle
    else:
        end=middle-1
    return nibuntansaku(start,end)

print(nibuntansaku(0,k))
import collections
    
n, m = map(int, input().split())
A = list(map(int, input().split()))
ans_list = [0] * (n + 1)
for i in range(1, n + 1):
  A[i - 1] %= m
  ans_list[i] = (ans_list[i - 1] + A[i - 1]) % m
ans_list.pop(ans_list[0])
ans_list = dict(collections.Counter(ans_list))
  
#print(A)
#print(ans_list)
count = ans_list[0]
#print(count)
for v in ans_list.values():
  #print(v)
  if v != 1:
    count +=  v * (v - 1) / 2
    
print(int(count))   
    
    


### FIXED CODE ###

import collections
    
n, m = map(int, input().split())
A = list(map(int, input().split()))
ans_list = [0] * (n + 1)
for i in range(1, n + 1):
  A[i - 1] %= m
  ans_list[i] = (ans_list[i - 1] + A[i - 1]) % m
ans_list.pop(ans_list[0])
ans_list = dict(collections.Counter(ans_list))
  
#print(A)
#print(ans_list)
count = 0
if 0 in ans_list:
  count = ans_list[0]
#print(count)
for v in ans_list.values():
  #print(v)
  if v != 1:
    count +=  v * (v - 1) / 2
    
print(int(count))
N = list(int(input()))
cnt = 0
ans = []
for i in range(len(N)-1):
    if N[i] == N[i+1]:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
for i in ans:
    if i >= 3:
        print('Yes')
        exit()
print('No')  

### FIXED CODE ###

import collections
N = list(input())
cnt = 0
ans = []
for i in range(len(N)-1):
    if N[i] == N[i+1]:
        cnt += 1
    else:
        ans.append(cnt)
        cnt = 0
ans.append(cnt)
for i in ans:
    if i >= 2:
        print('Yes')
        exit()
print('No')
a = int(input())
b = int(input())
if 1 <= a <= 100 and 1 <= b <= 100:
    c = a * b
    d = 2(a + b)
    print(c''d)  

### FIXED CODE ###

a,b = map(int,input().split())
x = a * b
y = 2 * a + 2 * b
print('{} {}'.format(x,y))
VS = [(Y, Y*(2/q), q) for Y, q in ((int(input()), q) for q in (0.25, 0.5, 1, 2))]
N = int(input())
tanka = 0
for Y, _, q in sorted(VS, key=lambda x:x[1], reverse=True):
  u = N // q
  N -= q * u
  tanka += Y * u
  if N <= 0:
    break

print(tanka)


### FIXED CODE ###

VS = [(Y, Y*(2//q), q) for Y, q in zip(map(int, input().split()), (0.25, 0.5, 1, 2))]
N = int(input())
#print(VS)
tanka = 0
for Y, _, q in sorted(VS, key=lambda x:x[1], reverse=False):
  u = N // q
  N -= q * u
  #print((q, u))
  tanka += Y * int(u)
  if N <= 0:
    break
 
print(tanka)
a = [int(s) for s in raw_input().split()]
if a > b > c:
  print "Yes"
else 
  print "No"

### FIXED CODE ###


a = [int(s) for s in raw_input().split()]
if a[0] <  a[1] < a[2]:
  print "Yes"
else:
  print "No"
import copy
def main():
    [N,W]=input().split(" ")
    '''read from keyboard and put all the item to box'''
    N=int(N)
    W=int(W)
    box=[]
    for i in range(N):
        [vi,wi]=input().split(" ")
        box.append([float(vi),float(wi)])
        
    assemblebox=[]
    '''creat a set of full permutation of input. using recursion'''
    assemblebox=permutations(N,box,assemblebox,[])

    maximum=0
    '''optimization'''
    for i in range(len(assemblebox)):
        weight=0
        value=0
        for j in range(N):
            weight=weight+assemblebox[i][j][1]
            if(weight>W):
                break
            value=value+assemblebox[i][j][0]
        if(maximum<value):
            maximum=value
            
    print(maximum)
    '''output'''
        

    return 0

def permutations(N,box,assemblebox,record):
    for i in range(N):
        Np=N
        boxp=copy.deepcopy(box)
        recordp=copy.deepcopy(record)
        recordp.append(box[i])
        boxp.pop(i)
        Np=Np-1
        if(Np==0):
            assemblebox.append(recordp)
        else:
            result=permutations(Np,boxp,assemblebox,recordp)
    return assemblebox

main()

### FIXED CODE ###

def main():
    [N,W]=input().split(" ")
    N=int(N)
    W=int(W)
    inputset=[]
    for i in range(N):
        [vi,wi]=input().split(" ")
        inputset.append([int(vi),int(wi)])

    graph=[]
    for i in range(N+1):
        graph.append([])
        for j in range(W+1):
            graph[i].append(0)

    for i in range(N):
        for j in range(W+1):
            if(inputset[i][1]>j):
                graph[i+1][j]=graph[i][j]
            else:
                rest=j-inputset[i][1]
                choosevalue=graph[i][rest]+inputset[i][0]
                nonchoosevalue=graph[i][j]
                if(choosevalue>nonchoosevalue):
                    graph[i+1][j]=choosevalue
                else:
                    graph[i+1][j]=nonchoosevalue

    print(graph[N][W])

main()
while True:
    try:
        x1,y1,x2,y2,x3,y3,xp,yp = map(float, raw_input().split())
        a = (x1-x2)**2+(y1-y2)**2
        b = (x1-x3)**2+(y1-y3)**2
        c = (x2-x3)**2+(y2-y3)**2
        xa = (x3-xp)**2+(y3-yp)**2
        xb = (x2-xp)**2+(y2-yp)**2
        xc = (x1-xp)**2+(y1-yp)**2
        cosa = (a-b+c)/(2*math.sqrt(b)*math.sqrt(c))
        cosb = (b-a+c)/(2*math.sqrt(a)*math.sqrt(c))
        cosc = (c-a+b)/(2*math.sqrt(a)*math.sqrt(b))
        cos1 = (xc-xa+xc)/(2*math.sqrt(xa)*math.sqrt(b))
        cos2 = (xa-c+xb)/(2*math.sqrt(xb)*math.sqrt(c))
        cos3 = (xb-a+xc)/(2*math.sqrt(xc)*math.sqrt(a))
#       cos4 = (a-b+c)/(2*math.sqrt(xa)*math.sqrt(c))
#      cos5 = (a-b+c)/(2*math.sqrt(xb)*math.sqrt(a))
#      cos6 = (a-b+c)/(2*math.sqrt(xc)*math.sqrt(b))
        
        if cos1<cosa or cos2<cosb or cos3<cosc:
            print "YES"
        print "YES"
        else:
            print "NO"
    except:
        break

### FIXED CODE ###

import math

def L(x1,y1,x2,y2):
	return math.sqrt((x1-x2)**2+(y1-y2)**2)
	
def S(a,b,c):
	s=(a+b+c)/2
	return math.sqrt(s*(s-a)*(s-b)*(s-c))
	
while True:
    try:
        x1,y1,x2,y2,x3,y3,xp,yp = map(float, raw_input().split())
        a  = L(x1,y1,x2,y2)
        b  = L(x1,y1,x3,y3)
        c  = L(x2,y2,x3,y3)
        pa = L(x3,y3,xp,yp)
        pb = L(x2,y2,xp,yp)
        pc = L(x1,y1,xp,yp)
        if S(a,pb,pc)+S(b,pc,pa)+S(c,pa,pb)-S(a,b,c) > 0.0000001:
            print "NO"
        else:
            print "YES"
    except:
        break
n, m, l = (int(i) for i in input().split())
A = []
B = []
#C = [[0] * n] * l
C = [[0 for i in range(n)] for j in range(l)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)

#????????????????¨????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
#for i in range(n):
#    for j in range(l):
#        print("{0}".format(C[i][j]), end="\b")
#    print("")
for i in range(n):
    print(" ".join(map(str, C[i][:])))

### FIXED CODE ###

n, m, l = (int(i) for i in input().split())
A = []
B = []
C = [[0 for i in range(l)] for j in range(n)]
#??\?????????????????????????´?
for i in range(n):
    swap_list = input().split()
    A.append(swap_list)
    #A.append([int(i) for i in input().split()])
for i in range(m):
    swap_list = input().split()
    B.append(swap_list)
    #B.append([int(i) for i in input().split()])
#????????????????¨????
for i in range(n):
    for j in range(l):
        for k in range(m):
            C[i][j] += int(A[i][k]) * int(B[k][j])
#?????????????????????
#for i in range(n):
#    for j in range(l):
#        print("{0}".format(C[i][j]), end="\b")
#    print("")
for i in range(n):
    print(" ".join(map(str, C[i][:])))
#for r in C:
#    print(" ".join([str(d) for d in r]))
A, B = map(int, input().split())
S = input()

if S[A] == '-' and isdigit(S[0:A]) and isdigit(S[A+1:A+B+1]):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

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

if S[A] == '-' and S[0:A].isdigit() and S[A+1:A+B+1].isdigit():
  print("Yes")
else:
  print("No")
s = str(input())

print('Yes' if s.count('a')==1 and c.count('b')==1 else 'No')

### FIXED CODE ###

s = str(input())

print('Yes' if s.count('a')==1 and s.count('b')==1 else 'No')
from collections import deque
H,W=map(int,input().split())
s=[list(input()) for i in range(H)]
def dfs(h,w):
    q=deque()
    q.append((h,w))
    s[h][w]='.'

    dx=[0,1,0,-1]
    dy=[1,0,-1,0]
    cnt=0
    while q:
        task=q[-1]
        for i in range(4):
            nx=task[0]+dx[i]
            ny=task[1]+dy[i]
            if not(0<=nx<W and 0<=ny<H):continue
            if s[nx][ny]!='#':continue
            q.append((nx,ny))
            s[nx][ny]='.'
            cnt+=1
            break
        else:
            if cnt==0:
                print('No')
                exit()
            q.pop()

for i in range(H):
    for j in range(W):
        if s[i][j]=='#':
            dfs(i,j)
"""
for i in s:
    for j in i:
        if j=='#':
            print('No')
            exit()
"""
print('Yes')

### FIXED CODE ###

h,w=map(int,input().split())
s=[input() for i in range(h)]

dx=[0,1,0,-1]
dy=[1,0,-1,0]
for i in range(h):
    for j in range(w):
        if s[i][j]=='#':
            cnt=0
            for k in range(4):
                nx=i+dx[k]
                ny=j+dy[k]

                if 0<=nx<=h-1 and 0<=ny<=w-1:
                    if s[nx][ny]=='#':
                        cnt=1
            if cnt!=1:
                print('No')
                exit()

print('Yes')
n,a,b = map(int,input().split())
ans = 0

for i in range(n+1):
    if a<= sum(map(int,list(str(i))) <=b:
        ans += i
print(ans)


### 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)
N, Q = map(int, input().split())
S=list(input())
list=[0]*N
for i in range(N-1):
    if S[i] == "A" and S[i+1] == "C":
        list[i]+=1
count=0
for j in range(Q):
    l, r = map(int, input().split())
    print(list[l-1:r-1]).count(1))

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()

ans = [0]*N
for i in range(N-1):
    if S[i] == "A" and S[i+1] == "C":
        ans[i+1] += (ans[i]+1)
    else:
        ans[i+1] = ans[i] 

for i in range(Q):
    l, r = map(int, input().split())
    print(ans[r-1] - ans[l-1])
def main():
    n, m = map(int, input().split())
    ans = [0]*n
    for _ in range(m):
        s, c = map(int, input().split())
        if ans[s-1] == 0:
            ans[s-1] = c
        elif ans[s-1] != 0 and ans[s-1] != c:
            print(-1)
            exit()

    if len(ans[0]) == 1:
        print(ans[0])
    if ans[0] == 0:
        print(-1)
    else:
        print(*ans, sep="")


if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    n, m = map(int, input().split())
    ans = [-1]*n
    for _ in range(m):
        s, c = map(int, input().split())
        if ans[s-1] == -1:
            ans[s-1] = c
        elif ans[s-1] != -1 and ans[s-1] != c:
            print(-1)
            exit()

    if n == 1:
        if ans[0] == -1:
            ans[0] = 0
    else:
        if ans[0] == 0:
            print(-1)
            exit()

        if ans[0] == -1:
            ans[0] = 1

        for i in range(1, n):
            if ans[i] == -1:
                ans[i] = 0
    print(*ans, sep="")


if __name__ == "__main__":
    main()
from collections import Counter
from bisect import bisect_left

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

ans = 0
C = []
for x, num in dict(Counter(A)).items():
    C.append([x, num])
C.sort()

for i in range(N):
    for t in range(33, 0, -1):
        target = 2 ** t - A[i]
        if target < 0:
            continue
        target_t = bisect_left(C, [target, 0])

        if target_t >= N:
            continue

        x, num = C[target_t]
        if x == target and num > 0 and i != target_t:
            ans += 1
            C[i][1] -= 1
            C[target_t][1] -= 1
            break

print(ans)


### FIXED CODE ###

from collections import Counter

N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
C = Counter(A)
keys = set(A)

ans = 0
for a in A:
    target_2_pow = 2 ** a.bit_length()
    b = target_2_pow - a
    if b not in keys:
        continue

    if a != b:
        if C[a] == 0 or C[b] == 0:
            continue
    else:
        if C[b] < 2:
            continue
    ans += 1
    C[a] -= 1
    C[b] -= 1

print(ans)
l = raw_input().split()
print l[0] * l[1]

### FIXED CODE ###

i = list(map(int, input().split()))

print(i[0]*i[1], i[0]*2+i[1]*2)
import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
inp = sys.stdin.buffer.readline
def inpS(): return inp().rstrip().decode()
readlines = sys.stdin.buffer.readlines 
MOD = 10**9+7

N, a, b = map(int, inp().split())
ball = ""
while len(ball) < N:
  ball += "b"*a
  ball += "r"*b
  
ans = ball[:N].count("b")
print(ans)  
  

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)
read = sys.stdin.buffer.read 
inp = sys.stdin.buffer.readline
def inpS(): return inp().rstrip().decode()
readlines = sys.stdin.buffer.readlines 
MOD = 10**9+7

N, a, b = map(int, inp().split())
ans = N//(a+b) * a
rest = N%(a+b)
ans += min(a, rest)
print(ans)
a,b=[int(i) for i in input().split()]
if a < b:
	print("a < b"
elif a > b:
	print("a > b"
else:
	print("a == b")

### FIXED CODE ###

a,b=[int(i) for i in input().split()]
if a < b:
	print("a < b")
elif a > b:
	print("a > b")
else:
	print("a == b")
s = raw_input()
k = int(raw_input())

ans = '1'

for i in range(0, k):
	if s[i] != '1':
		ans = s[i]
		break

print ans

### FIXED CODE ###

s = raw_input()
k = int(raw_input())

ans = '1'
i = 0
while i < k and i < len(s):
	if s[i] != '1':
		ans = s[i]
		break
	i = i + 1

print ans
n = int(input())
a = [int(k) for k in input().split()]
cnt = 0
for i in range(n):
  if a[i] != i+1:cnt += 1
print("YES" if k <= 2 else "NO")

### FIXED CODE ###

n = int(input())
a = [int(k) for k in input().split()]
cnt = 0
for i in range(n):
  if a[i] != i+1:cnt += 1
print("YES" if cnt <= 2 else "NO")
import math
import fractions

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

# A以上B以下の数でXの倍数の個数
def countX(X) :
    if X > B :
        return 0
    minX = max(math.ceil(A / X),0)
    maxX = max(math.floor(B / X),0)
    return maxX - minX + 1

if C == 1 or D == 1 :
    print(0)
elif min(C,D) > B :
    print(A - B + 1)
elif max(C,D) % min(C,D) == 0 :
    Z = min(C,D)
    ans = B - A + 1 - countX(Z)
    print(ans + 1)
elif A % C == 0 or A % C == 0 :
    print(z)
else :
    ans = B - A + 1

    # 最小公倍数
    Z = int(C * D / fractions.gcd(C,D))

    ans -= countX(C)
    ans -= countX(D)
    ans += countX(Z)

    print(ans)



### FIXED CODE ###

import math
import fractions

# A以上B以下の数でXの倍数の個数
def countX(X) :
    if X > B :
        return 0

    minX = (A - 1) // X
    maxX = B // X

    return maxX - minX

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

ans = B - A + 1

# 最小公倍数
Z = int(C * D / fractions.gcd(C,D))

ans -= countX(C)
ans -= countX(D)
ans += countX(Z)

print(int(ans))
def dfs(i, total, S, remain):
    global ans
    if i == D:
        if S < G:
           use = max(remain)
           N = min(L[use-1][0], (G-S)//(100*use)
           S += 100 * N * use
           total += N
           
        if S >= G:
           ans = min(ans, total)
    else:
        dfs(i+1, total, S, remain)
        dfs(i+1, total + L[i][0], S + 100 * (i+1) * L[i][0] + L[i][1], remain - {i+1})

D, G = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(D)]
ans = 10 ** 9

dfs(0, 0, 0, set(range(1, D+1)))

print(ans)

### FIXED CODE ###

# まだ解いてない配点を nokori として持つ
def dfs(i, sum, count, nokori):
    global ans
    if i == d:
        # G 点に満たなければ nokori のうち一番大きいものを解く
        if sum < g:
            use = max(nokori)
            # 解く問題が問題数を超えないように注意
            n = min(pc[use - 1][0], -(-(g - sum) // (use * 100)))
            count += n
            sum += n * use * 100

        if sum >= g:
            ans = min(ans, count)
    else:
        # 総合スコア、解いた問題数、まだ解いてない問題を更新
        dfs(i + 1, sum, count, nokori)
        dfs(i + 1, sum + pc[i][0] * (i + 1) * 100 + pc[i][1], count + pc[i][0], nokori - {i + 1})


d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]

ans = float("inf")

dfs(0, 0, 0, set(range(1, d + 1)))
print(ans)
s = list(map(int,input()))
a = s[0]
b = s[1]
c = s[2]
if a + b >= c:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = list(map(int,input().split()))
a = s[0]
b = s[1]
c = s[2]
if a + b >= c:
    print("Yes")
else:
    print("No")
N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
print(sum(A[1::2][N]))

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
A.sort(reverse=True)
print(sum(A[1::2][:N]))
#3.7.3 -> import math
from fractions import gcd

# [0,--list--,0]
N = int(input())
A = [0]+list(map(int,input().split()))+[0]
L = [0]*(N+2)
R = [0]*(N+2)
#0,A[1]->L[i-1],A[i]->L[N-1],A[N]
for i in range(1,N+1):
    L[i] = math.gcd(L[i-1],A[i])
#0,A[N]->R[i+1],A[i]->R[2],A[1]
for i in range(N,0,-1):
    R[i] = math.gcd(R[i+1],A[i])
#A[i]を含めないL,Rのgcdをすべて並べてmaxをとる
print(max(math.gcd(L[i-1],R[i+1]) for i in range(1,N+1)))

### FIXED CODE ###

#3.7.3 -> import math
from fractions import gcd

# [0,--list--,0]
N = int(input())
A = [0]+list(map(int,input().split()))+[0]
L = [0]*(N+2)
R = [0]*(N+2)
#0,A[1]->L[i-1],A[i]->L[N-1],A[N]
for i in range(1,N+1):
    L[i] =gcd(L[i-1],A[i])
#0,A[N]->R[i+1],A[i]->R[2],A[1]
for i in range(N,0,-1):
    R[i] = gcd(R[i+1],A[i])
#A[i]を含めないL,Rのgcdをすべて並べてmaxをとる
print(max(gcd(L[i-1],R[i+1]) for i in range(1,N+1)))