Harryxun/stf_run huggingface dataset:
import numpy as np

a_list = list(map(int, input().split()))
a_list_2 = list(map(int, input().split()))
a_list_3 = list(map(int, input().split()))

a_total_list = np.array([a_list, a_list_2, a_list_3])
bingo_array = np.zeros((3, 3))

N = int(input())

b_list = []

for i in range(N):
    b = int(input())
    if b in a_total_list:
        bingo_array[np.where(a_total_list == b)[0][0]][np.where(a_total_list == b)[1][0]] = 1

bingo_x_y = 0
break_flag = False
for i in range(3):
    bingo_x = 0
    bingo_y = 0
    if break_flag is True:
        break
    for j in range(3):
        if bingo_array[i][j] == 1:
            bingo_x += 1
        if bingo_x == 3:
            break_flag = True
            break
        if i == 0:
            if bingo_array[j][i] == 1:
                bingo_y += 1
            if bingo_y == 3:
                break_flag = True
                break
        if i == j:
            if bingo_array[i][j] == 1:
                bingo_x_y += 1
            if bingo_x_y == 3:
                break_flag = True
                break

if bingo_x == 3:
    print("Yes")
elif bingo_y == 3:
    print("Yes")
elif bingo_x_y == 3:
    print("Yes")
elif bingo_array[0][2] == 1 and bingo_array[1][1] == 1 and bingo_array[2][0] == 1:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

import numpy as np

a_list = list(map(int, input().split()))
a_list_2 = list(map(int, input().split()))
a_list_3 = list(map(int, input().split()))

a_total_list = np.array([a_list, a_list_2, a_list_3])
bingo_array = np.zeros((3, 3))

N = int(input())

b_list = []

for i in range(N):
    b = int(input())
    if b in a_total_list:
        bingo_array[np.where(a_total_list == b)[0][0]][np.where(a_total_list == b)[1][0]] = 1

bingo_x_y = 0
break_flag = False
for i in range(3):
    if break_flag is True:
        break
    else:
        bingo_x = 0
        bingo_y = 0
    for j in range(3):
        if bingo_array[i][j] == 1:
            bingo_x += 1
            if bingo_x == 3:
                break_flag = True
                break
        if bingo_array[j][i] == 1:
            bingo_y += 1
            if bingo_y == 3:
                break_flag = True
                break
        if i == j:
            if bingo_array[i][j] == 1:
                bingo_x_y += 1
                if bingo_x_y == 3:
                    break_flag = True
                    break

if bingo_x >= 3:
    print("Yes")
    exit()
elif bingo_y >= 3:
    print("Yes")
    exit()
elif bingo_x_y >= 3:
    print("Yes")
    exit()
elif bingo_array[0][2] == 1 and bingo_array[1][1] == 1 and bingo_array[2][0] == 1:
    print("Yes")
    exit()
else:
    print("No")
    exit()
n = int(input())
l = list(map(int,input().split()))
m = []
for i in range(n):
  if i%2==0 and l[i]%2!=0:
    m.append(l[i])
print(count(m))

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
count = 0
for i in range(n):
  if i%2==0 and l[i]%2!=0:
    count = count + 1

print(count)
x = int(input())
if x =3 or x = 5 or x = 7:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

x = int(input())
if x ==3 or x == 5 or x == 7:
  print('YES')
else:
  print('NO')
import math
n = input()
a = list(map(int, input().split()))
flag = 0


for t in range(40):

    for i,j in enumerate(a):
        if j%2 == 0:
            a[i] = j/2

        else:
            flag = 1
            break

    if flag == 1:
        break

print(t)

### FIXED CODE ###

print(input().count("1"))
from collections import Counter
import sys

H,W,M,*hw = map(int,open(0).read().split())

h = hw[::2]
w = hw[1::2]

bomb = [[0]*W for _ in range(H)]
for hi,wi in zip(h,w):
    bomb[hi-1][wi-1] = 1


raw_count = Counter(h)
col_count = Counter(w)

raw_max = raw_count.most_common()[0][1]
col_max = col_count.most_common()[0][1]

ans = 0
for hi, rcount in raw_count.most_common():
    if rcount<raw_max:break
    for wi, ccount in col_count.most_common():
        if ccount<col_max: break
        
        if bomb[hi-1,wi-1]==1:
            ans = raw_max + col_max - 1
        else:
            print(raw_max + col_max)
            sys.exit()

print(ans)


### FIXED CODE ###

from collections import Counter
import sys

H,W,M,*hw = map(int,open(0).read().split())

h = hw[::2]
w = hw[1::2]

hw_set = set((hi,wi) for hi,wi in zip(h,w))


raw_count = Counter(h).most_common()
col_count = Counter(w).most_common()


raw_max = raw_count[0][1]
col_max = col_count[0][1]

ans = 0
for hi, rcount in raw_count:
    if rcount<raw_max:break
    for wi, ccount in col_count:
        if ccount<col_max: break
        
        if (hi,wi) in hw_set:
            ans = raw_max + col_max - 1
        else:
            print(raw_max + col_max)
            sys.exit()

print(ans)
mt = []

for i in range(10):
        mt.append(int(input().strip()))

mt.sort().reverse()

print( mt[0] )
print( mt[1] )
print( mt[2] )

### FIXED CODE ###

mt = []

for i in range(10):
        mt.append(int(input()))

mt.sort()
print( mt[9] )
print( mt[8] )
print( mt[7] )
n=int(input())
a=[int(i) for i in input().split()]

ans=0
def plus_minus(i):
    while True:
        if a[i]==a[i+1]:
            i+=1
            continue
        if a[i]<a[i+1]:
            return 1
        if a[i]>a[i+1]:
            return -1

check=plus_minus(0)            
ans=1
for j in range(n-1):
    if check==1:
        if a[j] <= a[j+1]:
            continue
        else:
            ans+=1
            check=plus_minus(j+1)
    else:
        if a[j]>=a[j+1]:
            continue
        else:
            ans+=1
            check=plus_minus(j+1)
print(ans)

### FIXED CODE ###

n=int(input())
a=[int(i) for i in input().split()]

ans=0
def plus_minus(i):
    while True:
        if i==n-1:
            break
        if a[i]==a[i+1]:
            i+=1
            continue
        if a[i]<a[i+1]:
            return 1
        if a[i]>a[i+1]:
            return -1

check=plus_minus(0)            
ans=1
for j in range(n-1):
    if check==1:
        if a[j] <= a[j+1]:
            continue
        else:
            ans+=1
            check=plus_minus(j+1)
    else:
        if a[j]>=a[j+1]:
            continue
        else:
            ans+=1
            check=plus_minus(j+1)
print(ans)
import sys
import math
sys.setrecursionlimit(10**8)
stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces


N, K = na()
A_array = na()

min_length = 0
max_length = 2 * 10 ** 9

while(max_length - min_length > 0.01):
    mid = (min_length + max_length) / 2
    cut_cnt = 0
    for a in A_array:
        c = a // mid
        if a - mid * c > 0:
            c += 1
        cut_cnt += (c - 1)
    # print(mid, cut_cnt)
    if cut_cnt <= K:
        max_length = mid
    else:
        min_length = mid

# print(max_length)


ans1 = math.floor(max_length)
ans2 = math.ceil(max_length)


cut_cnt = 0
for a in A_array:
    c = a // ans1
    if a - ans1 * c > 0:
        c += 1
    cut_cnt += (c - 1)

if cut_cnt <= K:
    print(ans1)
else:
    print(ans2)


### FIXED CODE ###

import sys
import math
sys.setrecursionlimit(10**8)
stdin = sys.stdin


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


def naa(N): return [na() for _ in range(N)]


def ns(): return stdin.readline().rstrip()  # ignore trailing spaces


N, K = na()
A_array = na()

min_length = 0
max_length = 2 * 10 ** 9

while(max_length - min_length > 0.01):
    mid = (min_length + max_length) / 2
    cut_cnt = 0
    for a in A_array:
        c = a // mid
        if a - mid * c > 0:
            c += 1
        cut_cnt += (c - 1)
    # print(mid, cut_cnt)
    if cut_cnt <= K:
        max_length = mid
    else:
        min_length = mid

# print(max_length)


ans1 = math.floor(max_length)
ans2 = math.ceil(max_length)

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

cut_cnt = 0
for a in A_array:
    c = a // ans1
    if a - ans1 * c > 0:
        c += 1
    cut_cnt += (c - 1)

if cut_cnt <= K:
    print(ans1)
else:
    print(ans2)
class UNION_FIND(object):
    def __init__(self,n):
        #親の番号を格納する。親だった場合は-(その集合のサイズ)
        #作るときはParentの値を全て-1にする
        #こうすると全てバラバラになる
        self.parent=[-1 for i in range(n)]
        
    def root(self,x):
        #Aがどのグループに属しているか調べる
        if self.parent[x]<0:
            return x
        else:
            self.parent[x]=self.root(self.parent[x])  #親を再帰で探知 再帰は最後に上のifにひっかかる
            return self.parent[x]
 
    def size(self,x):
        #自分のいるグループの頂点数を調べる
        return -self.parent[self.root(x)]   #親をとってきたい
        
    def union(self,x,y):
        #AとBをくっ付ける
        #AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        #print(self.parent)
        x=self.root(x)
        y=self.root(y)
        #print(x,y)
        if x==y:   #すでにくっついてるからくっ付けない
            return False
            
        #大きい方(A)に小さいほう(B)をくっ付けたい
        #大小が逆だったらひっくり返しちゃう。
        if self.size(x)<self.size(y):
            x,y=y,x
        self.parent[x]+=self.parent[y]  #Aのサイズを更新する
        self.parent[y]=x   #Bの親をAに変更する
        return True


a,b=map(int,input().split())
*p,=map(int,input().split())
u=UNION_FIND(a)
d=defaultdict(list)

p=array(p)
for i in range(b):
    x,y=map(int,input().split())
    u.union(x-1,y-1)
for i in range(a):
    ans+=(u.root(i)==u.root(p[i]))
print(ans)


### FIXED CODE ###

from numpy import*
from collections import*
class UNION_FIND(object):
    def __init__(self,n):
        #親の番号を格納する。親だった場合は-(その集合のサイズ)
        #作るときはParentの値を全て-1にする
        #こうすると全てバラバラになる
        self.parent=[-1 for i in range(n)]
        
    def root(self,x):
        #Aがどのグループに属しているか調べる
        if self.parent[x]<0:
            return x
        else:
            self.parent[x]=self.root(self.parent[x])  #親を再帰で探知 再帰は最後に上のifにひっかかる
            return self.parent[x]
 
    def size(self,x):
        #自分のいるグループの頂点数を調べる
        return -self.parent[self.root(x)]   #親をとってきたい
        
    def union(self,x,y):
        #AとBをくっ付ける
        #AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        #print(self.parent)
        x=self.root(x)
        y=self.root(y)
        #print(x,y)
        if x==y:   #すでにくっついてるからくっ付けない
            return False
            
        #大きい方(A)に小さいほう(B)をくっ付けたい
        #大小が逆だったらひっくり返しちゃう。
        if self.size(x)<self.size(y):
            x,y=y,x
        self.parent[x]+=self.parent[y]  #Aのサイズを更新する
        self.parent[y]=x   #Bの親をAに変更する
        return True


a,b=map(int,input().split())
*p,=map(int,input().split())
u=UNION_FIND(a)
d=defaultdict(list)

p=array(p)
for i in range(b):
    x,y=map(int,input().split())
    u.union(x-1,y-1)
for k,v in enumerate(u.root(i)for i in range(a)):
    d[v].append(k)
ans=0
for i in d.values():
    i=array(i)
    ans+=len(set(i+1)&set(p[i]))
print(ans)
import math
ans=-1
nums=input().split(" ")
t8,t10=int(nums[0]),int(nums[1])
value_f=max(round(t8*100/8),round(t10*100/10))+1
while value_f>=0:
	tax8,tax10=value_f*8/100,value_f*10/100
	if tax8>=t8 and tax8<t8+1 and tax10>=t10 and tax10<t10+1:
		ans=value_f
	elif tax8<t8 or tax10<t10:
		print(ans)
		break
	value_f-=1

### FIXED CODE ###

letter=input()
if "A" not in letter:
  print("No")
elif "B" not in letter:
  print("No")
else:
  print("Yes")
N, M = map(int, input().split())
X = list(map(int, input().split()))

X.sort()
X.reverse()

if N > M:
    print(0)
else:
    temp = []
    for i in range(M):
        if i < M - 1:
            temp.append(X[i] - X[i+1])
    temp.sort()
    result = 0
    for i in range(N+1):
        result += temp[i]
    print(result)


### FIXED CODE ###

N, M = map(int, input().split())
X = list(map(int, input().split()))

X.sort()

result = 0
temp = []
if M <= N:
    print(0)
else:
    for i in range(M-1):
        temp.append(-(X[i] - X[i+1]))
    temp.sort()
    for i in range(M-N):
        result += temp[i]
    print(result)
from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    x, n = map(int, input().split())
    p = list(map(int, input().split()))
    arr = []
    for i in range(1, 101):
        if not i in p:
            arr.append(i)
    ans = arr[0]
    for ai in arr:
        if abs(ai - x) < abs(ans - x):
            ans = ai
    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()


### FIXED CODE ###

from sys import stdin, setrecursionlimit


def main():
    input = stdin.buffer.readline
    x, n = map(int, input().split())
    p = list(map(int, input().split()))
    arr = []
    for i in range(-100, 201):
        if not i in p:
            arr.append(i)
    ans = arr[0]
    for ai in arr:
        if abs(ai - x) < abs(ans - x):
            ans = ai
    print(ans)


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()
N=int(input())
L=[str(i) for i in [11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,
  881,911,941,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361,1381,1451]]

print('',join(L[:N]))

### FIXED CODE ###

N=int(input())
L=[str(i) for i in [11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,
  881,911,941,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361,1381,1451]]

print(" ".join(L[:N]))
h, w=map(int, input().split())
ch, cw=map(int, input().split())
dh, dw=map(int, input().split())

grid=["0"]*(h+2)
grid[0]="0"*(w+2)
grid[h+1]="0"*(w+2)

for i in range(1, h+1):
    s=input()
    grid[i]= "0"+s+"0"

p=1
road=[[0] * (w+2) for i in range(h+2)]

for i in range(1, h+1):
    for j in range(1, w+1):
        if grid[i][j] == ".":
            for k in range(5):
                flag=0
                if flag == 0 and road[i][j]==0:
                    road[i][j]=p
                if grid[i][j+1] == "." and flag == 1 and road[i][j+1]==0:
                    road[i][j+1]=p
                    flag+=1

                if grid[i][j-1] == "." and flag == 2 and road[i][j-1]==0:
                    road[i][j-1]=p
                    flag+=1

                if grid[i+1][j] == "." and flag == 3 and road[i+1][j]==0:
                    road[i+1][j]=p
                    flag+=1

                if grid[i-1][j] == "." and flag == 4 and road[i-1][j]==0:
                    road[i-1][j]=p
                    flag+=1

    p+=1

print(road)

### FIXED CODE ###

n, x, t=map(int, input().split())

cnt=0

while n > x*cnt:
    cnt+=1

print(t*cnt)
o = input()
e = input()
ans = ''
for i in range(len(o)):
    ans +=o[i]+e[i]
if len(o) != len(e):
    ans +=e[-1]
print(ans)


### FIXED CODE ###

o = input()
e = input()
ans = ''
for i in range(len(e)):
    ans +=o[i]+e[i]
if len(o) != len(e):
    ans +=o[-1]
print(ans)
N = int(input())
W = [int(input()) for _ in range(N)]
D = [W[0]]

for  i  in  range ( 1 , N ):
    b = W[i]
    if max(D) < b:
        D.append(b)
    else:
        for  j  in  range ( len ( D )):
            if D[j] >= b:
                D[j] = b
                break

print ( len ( D ))

### FIXED CODE ###

N, M = map(int, input().split())
H = list(map(int, input().split()))

all_tenbo = list(range(1, N+1))
not_good = []

for i in range(M):
    A, B = map(int, input().split())
    if H[A-1] <= H[B-1]:
        not_good.append(A)
    if H[B-1] <= H[A-1]:
        not_good.append(B)

print(len(list(set(all_tenbo)-set(not_good))))
#ABC117 B
N = int(input())
Ln = list(map(int, input().split()))
Ln.sort()
max = L[0]
sum = sum(ln)
    
if max < max - sum:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

#ABC117 B
N = int(input())
Ln = list(map(int, input().split()))
Ln.sort(reverse=True)
max = Ln[0]
sum = sum(Ln)
    
if max < sum - max:
    print("Yes")
else:
    print("No")
x=input().rstrip.split(" ")
z=[]
for i in range(2):
	z.append(x[i-2]*x[0])
    z.append(x[i-2]*x[1])
print(max(z))


### FIXED CODE ###

x=input().split(" ")
z=[]
for i in range(2):
	z.append(int(x[i-2])*int(x[0]))
for i in range(2):
    z.append(int(x[i-2])*int(x[1]))
print(max(z))
a,b = int(input())

if a*b % 2 == 0:
    print('Odd')
else:
    print('Even')

### FIXED CODE ###

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

if a*b % 2 != 0:
    print('Odd')
else:
    print('Even')
from fractions import gcd
n = int(input())
times = [int(input()) for _ in range(n)]

prev_lcm = times[0]
for t in times[1:]:
    tmp = gcd(prev_lcm, t)
    lcm = int(prev_lcm * t / tmp)
    prev_lcm = lcm
print(lcm)


### FIXED CODE ###

from fractions import gcd
n = int(input())
times = [int(input()) for _ in range(n)]

if n == 1:
    print(times[0])
else:
    prev_lcm = times[0]
    for t in times[1:]:
        tmp = gcd(prev_lcm, t)
        lcm = prev_lcm * (t // tmp)
        prev_lcm = lcm
    print(lcm)
N , i = map( int input( ) )
x = (N - i) + 1
print ( x )


### FIXED CODE ###

N,i=map(int,input().split( ))
count=0

while N>=i:
    count+=1
    N-=1


print(count)
s = list(input())
s1 = []
s2 = []
for i in range(len(s)):
    if i % 2 == 0:
        s1.append('0')
        s2.append('1')
    else:
        s1.append('1')
        s2.append('0')
print(min(min_1, min_2))

### FIXED CODE ###

s = list(input())
s1 = []
s2 = []
for i in range(len(s)):
    if i % 2 == 0:
        s1.append('0')
        s2.append('1')
    else:
        s1.append('1')
        s2.append('0')
min_1 = 0
#for i in range(2):
for i in range(len(s)):
    if s[i] != s1[i]:
        min_1 += 1
        
min_2 = 0
for i in range(len(s)):
    if s[i] != s2[i]:
        min_2 += 1
print(min(min_1, min_2))
while True:
  count = input()
  if count == 0: break
  previous_cube = [1, 2, 3, 4, 5, 6]
  operation = {'North':[1, 5, 2, 3, 0, 4], 'East':[3, 1, 0, 5, 4, 2], 'West': [2, 1, 5, 0, 4, 3], 'South':[4, 0, 2, 3, 5, 1], 'Right':[0, 2, 4, 1, 3, 5], 'Left':[0, 3, 1, 4, 2, 5]}
  sum = 1
  for i in xrange(count):
    new_cube = []
    for e in xrange(5):
      new_cube.append(previous_cube[operation[raw_input().strip()][e]])
    sum += new_cube[0]
    previous_cube = new_cube
  print sum

### FIXED CODE ###

while 1:
  n = input()
  if n == 0:  break
  d = range(1, 7)
  ans = 1
  for i in range(n):
    c = raw_input()[0]
    if c == 'N': S = [1,5,2,3,0,4]
    elif c == "S": S = [4,0,2,3,5,1]
    elif c == "E": S = [3,1,0,5,4,2]
    elif c == "W": S = [2,1,5,0,4,3]
    elif c == "R": S = [0,2,4,1,3,5]
    elif c == "L": S = [0,3,1,4,2,5]
    d = [d[s] for s in S]
    ans += d[0]
  print ans
import sympy
if i % 2 == 0 and len(sympy.divisors(int(input())))==8:
    print(1)
else:
    print(0)

### FIXED CODE ###

def make_divisors(n):
    a,b =[],[]
    i = 1
    while i*i<=n:
        if n%i == 0:
            a.append(i)
            if i != n//i:
                b.append(n//i)
        i+= 1
    return a+b[::-1]

n = int(input())
c = 0
for i in range(1,n+1):
    if len(make_divisors(i))== 8 and i%2==1:
        c+=1
print(c)
S,T = map(string, input().split())
print('{}{}'.format(T, S))

          
          

### FIXED CODE ###

S,T = input().split()
#print('{}{}'.format(T, S))
print(T+S)
n = input()
int_n = int(n)
len_n = len(n)
ans = 0

if n[0] == '1' and n[1:] == '0'*(len_n-1):
    print(9 * (len_n - 1))
    exit()

for i in range(len_n):
    target = int(n[:i+1][-1]) -1
    tmp_n = n[:i] + str(target) + '9'* (len_n - i - 1)
    tmp_n_ans = sum([int(i) for i in tmp_n])
    ans = max(tmp_n_ans, ans)
print(ans)

### FIXED CODE ###

n = input()
int_n = int(n)
len_n = len(n)
ans = sum([int(i) for i in n])

for i in range(len_n):
    target = int(n[:i+1][-1]) -1
    if target < 0:
        continue
    tmp_n = n[:i] + str(target) + '9'* (len_n - i - 1)
    tmp_n_ans = sum([int(i) for i in tmp_n])
    ans = max(tmp_n_ans, ans)
print(ans)
from bisect import bisect_left, bisect_right
from collections import deque

N = int(input())
A = list(map(int, input().split(" ")))
A.sort()
A = deque(A)
ans = 0
t_max = len(bin(A[-1])) - 2
for t in range(t_max, 0, -1):
    while len(bin(A[-1])) - 2 > t:
        A.pop()
        if len(A) < 2: break
    if len(A) < 2: break
    pow2 = 1 << t
    A_tmp = deque()
    while t == len(bin(A[-1])) - 2:
        r = A.pop()
        idx = bisect_left(A, pow2 - r)
        for _ in range(idx):
            A_tmp.appendleft(A.popleft())
        if len(A) == 0: break
        if A[0] + r == pow2:
            A.popleft()
            ans += 1
        if len(A) < 2: break
    A.extendleft(A_tmp)
                    
print(ans)
N = int(input())
A = list(map(int, input().split(" ")))
A.sort()
A = deque(A)
ans = 0
t_max = len(bin(A[-1])) - 2
for t in range(t_max, 0, -1):
    while len(bin(A[-1])) - 2 > t:
        A.pop()
        if len(A) < 2: break
    if len(A) < 2: break
    pow2 = 1 << t
    A_tmp = deque()
    while t == len(bin(A[-1])) - 2:
        r = A.pop()
        idx = bisect_left(A, pow2 - r)
        for _ in range(idx):
            A_tmp.appendleft(A.popleft())
        if len(A) == 0: break
        if A[0] + r == pow2:
            A.popleft()
            ans += 1
        if len(A) < 2: break
    A.extendleft(A_tmp)
                    
print(ans)

### FIXED CODE ###

from bisect import bisect_left, bisect_right
from collections import deque

N = int(input())
A = list(map(int, input().split(" ")))
A.sort()
A = deque(A)
ans = 0
t_max = len(bin(A[-1])) - 2
for t in range(t_max, 0, -1):
    if len(A) < 2: break
    while len(bin(A[-1])) - 2 > t:
        A.pop()
        if len(A) < 2: break
    if len(A) < 2: break
    pow2 = 1 << t
    A_tmp = deque()
    while t == len(bin(A[-1])) - 2:
        r = A.pop()
        idx = bisect_left(A, pow2 - r)
        for _ in range(idx):
            A_tmp.appendleft(A.popleft())
        if len(A) == 0: break
        if A[0] + r == pow2:
            A.popleft()
            ans += 1
        if len(A) < 2: break
    A.extendleft(A_tmp)
                    
print(ans)
#config:utf-8
x = input()

if 5 * int(x[0:-2]) >= int(x[-2:]):
    print(1)
else:
    print(0)


### FIXED CODE ###

#config:utf-8
x = input()

if int(x) < 100:
    print(0)
elif 5 * int(x[0:-2]) >= int(x[-2:]):
    print(1)
else:
    print(0)
A, B = input().split()
S1, S2 = input().split("-")
print("Yes" if len(S1) == A and len(S2) == B else "No")


### FIXED CODE ###

A, B = map(int, input().split())
S = input().split("-")
print("Yes" if len(S) == 2 and len(S[0]) == A and len(S[1]) == B else "No")
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a_max = max(a)
for i in range(n):
    if a[i] == a_max:
        a.pop(i)
        print(max(a))
    else:
        print(a_max)

### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
a_max = max(a)
ind_M = a.index(a_max)
tmpl = a
tmpl.pop(ind_M)
for i in range(n):
    if i != ind_M:
        print(a_max)
    else:
        print(max(tmpl))
H,N=map(int,input().split())
L=[]
for i in range(N):
    T=[0,0,0]
    T[1],T[2]=map(int,input().split())
    T[0]=T[2]/T[1]
    L.append(T)
L=sorted(L)
n=1+H//L[0][1]
m=n*L[0][2]

def DP(MAX,minN,minM,i,T,M):
    t=T
    m=M
    if(T>=MAX):
        return M
    if(T<MAX):
        t+=L[i][1]
        m+=L[i][2]
        if(m<minM):        
            tm=DP(MAX,minN,minM,i,t,m)
            if(minM>tm):
                minM=tm
    if(len(L)-1 > i):
        t=T
        m=M
        if(m<minM):
            tm=DP(MAX,minN,minM,i+1,t,m)
            if(minN>tm):
                minM=tm
    return minM

tm=DP(H,10**10,m,0,0,0)

print(tm)



### FIXED CODE ###

H,N=map(int,input().split())
L=[]
m=0
for i in range(N):
    T=[0,0]
    T[0],T[1]=map(int,input().split())
    L.append(T)
    m=max(m,T[0])
L=sorted(L,reverse=True)
L.insert(0,[0,0])
m+=1
DP=[[10**10 for i in range(H+1+m)] for j in range(N+1)]
DP[0][0]=0

for i in range(1,N+1):
    t=0
    DP[i][0]=0
    for j in range(H+1):
        DP[i][j]=min(DP[i][j],DP[i-1][j])
        t=min(DP[i][j],DP[i-1][j])+L[i][1]
        DP[i][j+L[i][0]]=min(DP[i][j+L[i][0]],t)
    DP[i][H]=min(DP[i][H:-1])
print(min(DP[N][H:-1]))