Harryxun/stf_run huggingface dataset:
import sys

def use_dp():
    max_a = max([ab[0] for ab in AB])
    dp = [sys.maxsize for i in range(H+max_a)]
    dp[0] = 0

    # 各ダメージ段階の最小値を求める
    for i in range(H):
        if dp[i] == sys.maxsize:
            continue
        # 各魔法を使って最小値なら更新
        for j in range(N):
            a = i + AB[j][0]
            b = dp[i] + AB[j][1]
            if dp[a] > b:
                dp[a] = b

    # H < i < H+max(Ai)の範囲で最小値を求める
    min_mp = sys.maxsize
    for i in range(H, H+max_a):
        min_mp = min(dp[i], min_mp)

    print(min_mp)


if __name__ == '__main__':
    H, N = list(map(int, input().split()))
    AB = []
    for n in range(N):
        AB.append(list(map(int, input().split())))

    use_dp()

### FIXED CODE ###

import math

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

N = math.ceil(H/A)

print(N)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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

ls = []
A = sum(ax[:1])
B = sum(ax[1:])

for i in range(2, N):
    sub = abs(A-B)
    print(sub)
    ls.append(sub)
    if(sub is 0):
        break
    A -= ax[i]
    B += ax[i]

print(sorted(ls)[0])


### FIXED CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

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

ls = []
A = sum(ax[:1])
B = sum(ax[1:])

for i in range(1, N):
    sub = abs(A-B)
    ls.append(sub)
    if(sub is 0):
        break
    A += ax[i]
    B -= ax[i]

print(sorted(ls)[0])
#!python3

LI = lambda: list(map(int, input().split()))

# input
N, Ma, Mb = LI()
ABC = [LI() for _ in range(N)]

INF = 10 ** 5


def main():
    w = [[INF] * 401 for _ in range(401)]
    w[0][0] = 0
    for a, b, c in ABC:
        l = w.copy()
        for j in range(a, 401):
            for k in range(b, 401):
                l[j][k] = min(l[j][k], w[j - a][k - b] + c)
        w = l

    ans = INF
    n = 400 // max(Ma, Mb) + 1
    for i in range(1, n):
        ans = min(ans, w[Ma * i][Mb * i])
    ans = -1 if ans == INF else ans
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

#!python3

import copy

LI = lambda: list(map(int, input().split()))

# input
N, Ma, Mb = LI()
ABC = [LI() for _ in range(N)]

INF = 10 ** 5


def main():
    w = [[INF] * 401 for _ in range(401)]
    w[0][0] = 0
    for a, b, c in ABC:
        l = copy.deepcopy(w)
        for j in range(a, 401):
            for k in range(b, 401):
                l[j][k] = min(w[j][k], w[j - a][k - b] + c)
        w = l

    ans = INF
    n = 400 // max(Ma, Mb) + 1
    for i in range(1, n):
        ans = min(ans, w[Ma * i][Mb * i])
    ans = -1 if ans == INF else ans
    print(ans)


if __name__ == "__main__":
    main()
n=int(input())
A=[int,input() for i in range(n)]
cnt=0

for i in range(n):
  cnt+=A[i]
cnt-=max(A)*0.5
print(cnt)

### FIXED CODE ###

n=int(input())
A=[int(input()) for i in range(n)]
cnt=0

for i in range(n):
  cnt+=A[i]
cnt-=max(A)*0.5
print(int(cnt))
values = input()
height, width = [int(x) for x in values.split()]
print(' '.join(height * width, height * 2 + width * 2))

### FIXED CODE ###

values = input()
height, width = [int(x) for x in values.split()]
print(height * width,  height * 2 + width * 2)
X, Y, A, B, C = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R = sorted(list(map(int, input().split())), reverse=True)

ans = sorted(P[:X] + Q[:Y])

for i in range(C):
    if R[i] > ans[i]:
        ans[i] = R[i]

print(sum(ans))

### FIXED CODE ###

X, Y, A, B, C = map(int, input().split())
P = sorted(list(map(int, input().split())), reverse=True)
Q = sorted(list(map(int, input().split())), reverse=True)
R = sorted(list(map(int, input().split())), reverse=True)

ans = sorted(P[:X] + Q[:Y])

for i in range(min(C, X+Y)):
    if R[i] > ans[i]:
        ans[i] = R[i]

print(sum(ans))
H,W=map(int,input().split()))
if H == 1 or W == 1:
  print(0)
else:
  print((H*W+1)//2)

### FIXED CODE ###

H,W=map(int,input().split())
if H == 1 or W == 1:
  print(1)
else:
  print((H*W+1)//2)
import numpy as np
n,avea=tuple(map(lambda x:int(x),input().split()))
x=np.array(list(map(lambda x:int(x),input().split())))
dp=np.zeros((n+1,n+1,max(x)*n+1), dtype=int)
dp[:,0,0]=1
c=0
for i in range(n):
    for j in range(i):
        for k in range(max(x)*(i+1)):
            if k-x[i]>=0:
                dp[i+1,j,k]=dp[i,j,k]+dp[i,j-1,k-x[i]]
            else:
                dp[i+1,j,k]=dp[i,j,k]
        c+=dp[i+1,j,j*avea]
print(c)


### FIXED CODE ###

import numpy as np
n,avea=tuple(map(lambda x:int(x),input().split()))
x=list(map(lambda x:int(x), input().split()))
x=np.array(x)
x=x-avea
w=max(abs(min(x)),abs(max(x)))*n
dp=np.zeros((n+1,2*w+1),dtype=int)
dp[0,w]=1
for i in range(n):
    for j in range(2*w+1):
        if 0<=j-x[i]<=2*w:
            dp[i+1,j]=dp[i,j]+dp[i,j-x[i]]
        else:
            dp[i+1,j]=dp[i,j]
print(dp[n,w]-1)
S = [i for i in input()]
T = [j for j in input()] 

x = sorted(S)
y = sorted(T)
k = None

if x == y:
  for i in range(len(S)):
    O = S.copy()
    S.pop()
    S.insert(0,O[-1])
    if S == T:
      print("Yes")
      break
  else:
    print("NO")
else:
  print("No")



### FIXED CODE ###

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

x.sort()
print((x[1]-x[0])+(x[2]-x[1]))
from itertools import groupby

def fivefunction(num):
    if num>=5:
        return 1
    else:
        return 0

N=input()
A=[int(N[i]) for i in range(0,len(N))]
fiveonlyzone=0
for i in range(0,len(N)):
    if i==0:
        if A[i]==5 and A[i+1]<5:
            fiveonlyzone+=1
    elif i==len(N)-1:
        if A[i-1]<5 and A[i]==5:
            fiveonlyzone+=1
    else:
        if A[i-1]<5 and A[i]==5 and A[i+1]<5:
            fiveonlyzone+=1

Ndigitsum=sum(A)
data=[fivefunction(A[i]) for i in range(0,len(N))]
Adigitsum=0
for i in range(0,len(N)):
    if fivefunction(A[i])==0:
        Adigitsum+=A[i]
    else:
        A[i]=0
X=groupby(data)
zone=0
digit=0
for key,group in X:
    g=len(list(group))
    if key==1:
        zone+=1
        digit+=g
print(zone,digit,A)
print(9*digit+2*zone+2*Adigitsum-Ndigitsum-fiveonlyzone)

### FIXED CODE ###

def main():
    N=input()
    X=len(N)
    INF=10**100
    dp=[[INF,INF] for i in range(0,X+1)]
    dp[0][0]=0
    dp[0][1]=1
    for j in range(1,X+1):
        dp[j][0]=min(dp[j-1][0]+int(N[j-1])%10,dp[j-1][1]+10-int(N[j-1])%10)
        if int(N[j-1])%10!=9:
            dp[j][1]=min(dp[j-1][1]+9-int(N[j-1])%10,dp[j-1][0]+int(N[j-1])%10+1)
        else:
            dp[j][1]=dp[j-1][1]+9-int(N[j-1])%10
    print(dp[X][0])

if __name__ == '__main__':
    main()
N = int(input())
S=sorted(list(map(input())))
cnt=0
for i in range(N-1):
  if S[i]==S[i+1]:
    cnt+=1
    
print(cnt)

### FIXED CODE ###

import copy

N = int(input())
S = list(input())
l = copy.deepcopy(S)

for i in range(N-1):
  if S[i] == S[i+1]:
    l[i]=0
  
l_=[i for i in l if i!=0]
print(len(l_))
from scipy.sparse.csgraph import csgraph_from_dense, dijkstra
import numpy as np

N = int(input())

G = np.full((N, N), 10**12)

if N==1:
    print(1)
else:
    for i in range(N-1):
        u, v, w = map(int, input().split())
        G[u-1][v-1] = w
        G[v-1][u-1] = w

    G2 = csgraph_from_dense(G, null_value=10**12)
    d = dijkstra(G2, indices=0)

    # for dist in d:
    #     if dist % 2 == 0:
    #         print(1)
    #     else:
    #         print(0)


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000)


N = int(input())
G = [[] for i in range(N)]

for i in range(N-1):
    u, v, w = map(int, input().split())
    if w % 2 == 0:
        G[u-1].append((v-1, 1))
        G[v-1].append((u-1, 1))
    else:
        G[u-1].append((v-1, -1))
        G[v-1].append((u-1, -1))

color = [None for i in range(N)]


def set_color(v, c):
    color[v] = c
    for next_v, d in G[v]:
        if color[next_v] is None:
            set_color(next_v, d*c)


set_color(0, 1)

for c in color:
    if c == 1:
        print(1)
    else:
        print(0)
import math
a, b = map(int, input().split())

print(int(a*b/math.gcd(a,b)))

### FIXED CODE ###

a, b = map(int, input().split())
m,n=max(a,b),min(a,b)
if m%n==0:
    print(m)
else:
    while m%n!=0 and n!=1:
        m%=n
        m,n=max(m,n),min(m,n)
    print(int(a*b/n))
a = [list(map(int, input().split())) for i in range(3)]
 
num = int(input())
for i in range(num):
  now = int(input())
  for i in range(3):
    for j in range(3):
      if(a[i][j] == now):
        a[i][j] = 0
str = 'No'
for j in range(3):
  a1, a2 = 0, 0
  for i in range(3):
    if(a[i][j] != 0):
      a1 = -1
    if(a[j][i] != 0):
      a2 = -1
    if(a1 == -1 and a2 == -1 and a3 == -1 and a4 == -1):
      print('No')
      exit()
  if(a[j][j] != 0):
    a3 = -1
  if(a[j][2-j] != 0):
    a4 = -1
if(a1 == -1 and a2 == -1 and a3 == -1 and a4 == -1):
  print('No')
else:
  print('Yes')

### FIXED CODE ###

a = [list(map(int, input().split())) for i in range(3)]
 
num = int(input())
for i in range(num):
  now = int(input())
  for i in range(3):
    for j in range(3):
      if(a[i][j] == now):
        a[i][j] = 0
ans = 'No'        
for i in range(3):
  if(a[i][0] == 0 and a[i][1] == 0 and a[i][2] == 0):
    ans = 'Yes'
  if(a[0][i] == 0 and a[1][i] == 0 and a[2][i] == 0):
    ans = 'Yes'
    
if(a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0):
  ans = 'Yes'
if(a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0):
  ans = 'Yes'

print(ans)
n = int(input())

a = [-1 for i in range(n)]

a[0] = 1
a[1] = 3
a[2] = 2

if n <= 10000:
    for i in range(3, n):
        a[i] = (i-1) * 3
    print(*a)
else:
    if n<20000:
        for i in range(3, 10000):
            a[i] = (i - 1) * 3
        if n % 2 == 0:
            for i in range((n - 10000) // 2):
                a[10000 + 2 * i] = i * 6 + 4
                a[10000 + 2 * i + 1] = i * 6 + 8
        if n % 2 == 1:
            for i in range((n - 10000) // 2):
                a[10000 + 2 * i] = i * 6 + 4
                a[10000 + 2 * i + 1] = i * 6 + 8
            a[10000 + 2 * (((n - 10000) // 2) + 1)] = (((n - 10000) // 2) + 1) * 6 + 4
            a[3] = (((n - 10000) // 2) + 1) * 6 + 8
    else:
        for i in range(3, 10000):
            a[i] = (i - 1) * 3
        if n % 2 == 0:
            for i in range((n - 10000) // 2-1):
                a[10000 + 2 * i] = i * 6 + 4
                a[10000 + 2 * i + 1] = i * 6 + 8
            a[n-2] = 5
            a[n-1] = 7
    print(*a)

### FIXED CODE ###

n = int(input())

if n == 3:
    print(2, 5, 63)
elif n == 4:
    print(2, 5, 20, 63)
elif n == 5:
    print(2, 5, 20, 30, 63)
else:
    a = []
    count = 0
    for i in range(2, 30001):
        if i % 2 == 0 or i % 3 == 0:
            a.append(i)
            count += 1
        if count == n:
            break
    sum_a = sum(a)
    if sum_a % 6 == 0:
        print(*a)
    elif sum_a % 6 == 2:
        a[4] = 30000
        print(*a)
    elif sum_a % 6 == 3:
        a[5] = 30000
        print(*a)
    else:
        a[5] = 29998
        print(*a)
import sys
sys.setrecursionlimit(10100)
n=int(input())
route=[[] for i in range(n)]
for i in range(n-1):
	u,v,w=map(int,input().split())
	route[u-1].append((v-1,w))
	route[v-1].append((u-1,w))
ans=[-1]*n
def dfs(p,d):
	ans[p]=d
	for i,j in route[p]:
		if ans[i]<0:dfs(i,(d+j)%2)
dfs(0,0)
for i in range(n):
	print(ans[i])
				

### FIXED CODE ###

import sys
sys.setrecursionlimit(100100)
n=int(input())
route=[[] for i in range(n)]
for i in range(n-1):
	u,v,w=map(int,input().split())
	route[u-1].append((v-1,w))
	route[v-1].append((u-1,w))
ans=[-1]*n
def dfs(p,d):
	ans[p]=d
	for i,j in route[p]:
		if ans[i]<0:dfs(i,(d+j)%2)
dfs(0,0)
for i in range(n):
	print(ans[i])
n = int(input())
dic = {}
for x in range(n):
  dic[x+1] = input().split()
ls = sorted(dic.items(), key=lambda x:x[1][0])

for y in range(1,n-1):
  
  if ls[y][1][0] == ls[y+1][1][0]:
    
    if ls[y][1][1] < ls[y+1][1][1]:
      
      ls[y+1],ls[y] = ls[y],ls[y+1]
    
    
for b in range(len(ls)):
  print(ls[b][0])


### FIXED CODE ###

a,p = map(int,input().split())
print((3*a+p)//2)
import sys
sys.setrecursionlimit(10000)
n,m = map(int,input().split())
diff = abs(n-m)
def saiki(n):
    if n<=1:
        return 1
    return n * saiki(n-1)
if diff >= 2:
    print(0)
elif diff == 1:
    print((saiki(max(n,m))*saiki(min(n,m)))%(10**9+7))
else:
    print((saiki(n)*saiki(m)*2)%(10**9+7))


### FIXED CODE ###

import math
n,m = map(int,input().split())
diff = abs(n-m)
count1 = 1
count2 = 1
a = 1

if diff >= 2:
    print(0)
elif diff == 1:
    ans = math.factorial(max(n,m))
    print(ans*(ans//max(n,m))%(10**9+7))
else:
    ans = math.factorial(n)
    print(ans*ans*2%(10**9+7))
a,b=map(int,input().split())
if 1=<a<=9 AND 1=<b<=9:
  print(a*b)
else:
  print("-1")


### FIXED CODE ###

a,b=map(int,input().split())
if 1<=a<=9 and 1<=b<=9:
  print(a*b)
else:
  print("-1")
N=int(input())
T=list(map(int,input().split()))
M=int(input())
total=0
for i in range(N):
    total+=T[i]
for i in range(M):
    K=total
    P,X=map(int,input().split())
    K=K-T[i]
    K+=X
    print(K)

### FIXED CODE ###

N=int(input())
T=list(map(int,input().split()))
M=int(input())
total=0
for i in range(N):
    total+=T[i]
for i in range(M):
    K=total
    P,X=map(int,input().split())
    K=K-T[P-1]
    K+=X
    print(K)
n, m = map(int, input().split())
num = ['x'] * n
flag = 0

if n == 1:
    for i in range(m):
        s, c = map(int, input().split())
        if num[s-1] == 'x':
            num[s-1] = c
        else:
            if num[s-1] != c:
                print(-1)
                break
        print(num[s-1])

else:
    for i in range(m):
        s, c = map(int, input().split())
        if num[s-1] == 'x':
            num[s-1] = c
            if s == 1 and c == 0:
                print(-1)
                flag = 1
                break
        else:
            if num[s-1] != c:
                print(-1)
                flag = 1
                break
    if flag == 0:
        if num[0] == 'x':
            num[0] = 1
        elif num[1] == 'x':
            num[1] = 0
        elif num[2] == 'x':
            num[2] = 0
        str_num = map(str, num)
        print(''.join(str_num))

### FIXED CODE ###

n, m = map(int, input().split())
num = ['x'] * n
flag = 0

if n == 1:
    if m == 0:
        print(0)
    else:
        for i in range(m):
            s, c = map(int, input().split())
            if num[s-1] == 'x':
                num[s-1] = c
            else:
                if num[s-1] != c:
                    print(-1)
                    flag = 1
                    break
        if flag == 0:
            print(num[s-1])

else:
    for i in range(m):
        s, c = map(int, input().split())
        if num[s-1] == 'x':
            num[s-1] = c
            if s == 1 and c == 0:
                print(-1)
                flag = 1
                break
                
        else:
            if num[s-1] != c:
                print(-1)
                flag = 1
                break
    if flag == 0:
        if num[0] == 'x':
            num[0] = 1
        for j in range(1, n):
            if num[j] == 'x':
                num[j] = 0 
        str_num = map(str, num)
        print(''.join(str_num))
a,b,c,x=map(int,input().split())
i=0
for s in range(1,a+1):
    for t in range(1,b+1):
         for r in range(1,c+1):
            if (500*s+100*t+50*r)==x:
                i+=1
print(i)

### FIXED CODE ###

a,b,c,x=[int(input()) for i in range(4)]
i=0
for _ in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if 500*_+100*j+50*k==x:
                i+=1
print(i)
import math

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

print((A * B) // math.gcd(A, B))

### FIXED CODE ###

import fractions

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

print((A * B) // fractions.gcd(A, B))
N, S = map(int,input.split())
A = list(map(int, input.split()))
mod = 998244353
dp = [[0 for j in range(S+1)] for i in range(N+1)]
dp[0][0] = 1
for i in range(N):
	for j in range(S+1):
		dp[i + 1][j] += 2 * dp[i][j]
		dp[i + 1][j] %= mod 
		if j + A[i] <= S : 
			dp[i + 1][j + A[i]] += dp[i][j]
			dp[i + 1][j + A[i]] %= mod
print(dp[N][S])


### FIXED CODE ###

N, S = map(int,input().split())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0 for j in range(S + 1)] for i in range(N + 1)]
dp[0][0] = 1
for i in range(N) : 
    for j in range(S + 1) : 
        dp[i + 1][j] += 2 * dp[i][j]
        dp[i + 1][j] %= mod 
        if j + A[i] <= S : 
            dp[i + 1][j + A[i]] += dp[i][j]
            dp[i + 1][j + A[i]] %= mod
print(dp[N][S])
import numpy as np

S=input()
T=input()

max_score = 0
for i in range(len(list(S))-len(list(T))):
    tmp_T = np.array(list(T))
    tmp_S = np.array(list(S))[i:i+len(tmp_T)]
    score = np.zeros(len(tmp_T))
    score[tmp_T==tmp_S]=1
    score = np.sum(score)
    if max_score < score:
        max_score=score
print(int(len(tmp_T)-max_score))


### FIXED CODE ###

import numpy as np

S=input()
T=input()

length = len(list(T))
S_length = len(list(S))

max_score = 0
for i in range(len(list(S))-len(list(T))):
    tmp_T = np.array(list(T))
    tmp_S = np.array(list(S))[i:i+len(tmp_T)]
    score = np.zeros(len(tmp_T))
    score[tmp_T==tmp_S]=1
    score = np.sum(score)
    if max_score < score:
        max_score=score

if S_length==length:
    tmp_T = np.array(list(T))
    tmp_S = np.array(list(S))
    score = np.zeros(len(tmp_T))
    score[tmp_T==tmp_S]=1
    max_score = np.sum(score)
print(int(length-max_score))
N = int(input())
S = input()
 
ans = 1
for i in range(N - 1):
    if S[i] != S[i + 1]:
        ans = ans + 1
print(ans)

### FIXED CODE ###

A, B = map(int, input().split())
if A - 2 * B < 0 or A-2*B == 0:
    print(0)
else:
    print(A - 2 * B)
N,K = map(int, input().split())

min_num = 10**18+1
flag = True

while flag:
  N = abs(N-K)
  if N < min_num: min_num = N
  else: break
    
return min_num


### FIXED CODE ###

n,k = map(int, input().split())

print(min(n%k, abs(n%k-k)))
N, M = (int(i) for i in input().split())
ans = 1

if N == (M + 1) or N == (M - 1):
    for n in range(1, N+1):
        ans *= n
        ans %= 1e9 + 7
    for m in range(1, M+1):
        ans *= m
        ans %= 1e9 + 7
elif N == M:
    for n in range(1, N+1):
        ans *= n
        ans %= 1e9 + 7
    for m in range(1, M+1):
        ans *= m
        ans %= 1e9 + 7
    ans *= 2
    ans %= 1e9 + 7
else:
    ans = 0

print int(ans)

### FIXED CODE ###

import sys

N, M = (int(i) for i in raw_input().split())
ans = 1                                                                                                                                                                                                                                                                     

if __name__ == '__main__':
    if N == (M + 1) or N == (M - 1):
        for n in range(1, N+1):
            ans *= n
            ans %= 1e9 + 7
        for m in range(1, M+1):
            ans *= m
            ans %= 1e9 + 7
    elif N == M:
        for n in range(1, N+1):
            ans *= n
            ans %= 1e9 + 7
        for m in range(1, M+1):
            ans *= m
            ans %= 1e9 + 7
        ans *= 2
        ans %= 1e9 + 7
    else:
        ans = 0

    print int(ans)
# https://atcoder.jp/contests/keyence2019/tasks/keyence2019_c

import sys
# sys.setrecursionlimit(100000)
import heapq


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    n = input_int()
    A = input_int_list()
    B = input_int_list()

    if sum(A) < sum(B):
        print(-1)
        return
    plus = []
    minus = []

    # a < b はすべて調整の必要あり
    # a < b の補填は それぞれの b > a のうち b-a が大きいところから貪欲に補填する
    for i in range(n):
        d = B[i] - A[i]
        if d > 0:
            minus.append(d)
        else:
            heapq.heappush(plus, d)

    ans = 0
    charge = 0
    for d in minus:
        while d > 0:
            if charge == 0:
                if heapq:
                    charge = -heapq.heappop(plus)
                    ans += 1
                else:
                    print(-1)
                    return
            if d <= charge:
                charge -= d
                d = 0
            else:
                charge = 0
                d -= charge

    print(len(minus) + ans)
    return


if __name__ == "__main__":
    main()


### FIXED CODE ###

# https://atcoder.jp/contests/keyence2019/tasks/keyence2019_c

import sys
# sys.setrecursionlimit(100000)
import heapq


def input():
    return sys.stdin.readline().strip()


def input_int():
    return int(input())


def input_int_list():
    return [int(i) for i in input().split()]


def main():
    n = input_int()
    A = input_int_list()
    B = input_int_list()
    plus = []
    minus = 0
    cnt = 0

    # a < b はすべて調整の必要あり
    # a < b の補填は それぞれの b > a のうち b-a が大きいところから貪欲に補填する
    for i in range(n):
        d = B[i] - A[i]
        if d > 0:
            minus += d
            cnt += 1
        else:
            heapq.heappush(plus, d)

    while minus > 0 and plus:
        minus -= -heapq.heappop(plus)
        cnt += 1

    if minus <= 0:
        print(cnt)
    else:
        print(-1)
    return


if __name__ == "__main__":
    main()
from math import factorial
def cmb(n,r):
  if n<0 or r<0:
    return 0
  else:
    return factorial(n)//factorial(n-r)//factorial(r)
n,a,b=map(int,input().split())
x = list(map(int,input().split()))
ans=0
x.sort(reverse=True)
print(sum(x[:a])/a)
if x[0]==x[a]:
  for i in range(n):
    if x[0] != x[i]:
      k=i
      break
  else:
    k=n
  for i in range(a,b+1):
    ans+=cmb(k,i)
  print(ans)
else:
  print(1)

### FIXED CODE ###

from math import factorial
import bisect
def cmb(n,r):
  if n<0 or r<0:
    return 0
  else:
    return factorial(n)//factorial(n-r)//factorial(r)
n,a,b=map(int,input().split())
x = list(map(int,input().split()))
ans=0
x.sort(reverse=True)
print(sum(x[:a])/a)
if n==a:
  print(1)
elif x[0]==x[a]:
  for i in range(n):
    if x[0] != x[i]:
      k=i
      break
  else:
    k=n
  for i in range(a,min(k+1,b+1)):
    ans+=cmb(k,i)
  print(ans)
elif x[a-1] == x[a]:
  y=sorted(x)
  x1=bisect.bisect_left(y,x[a])
  x2=bisect.bisect_right(y,x[a])
  print(cmb(x2-x1,a-(n-x2)))
else:
  print(1)
N = int(input())
S = input()
min = N
if S.find('#') == -1 or S.find('.') == -1:
    min = 0
else:
    for i in range(S.find('#'),N - 1):
        if S[i] == '.' and S[i+1] == '#':
            left = S.count('#',0,i)
            right = S.count('.',i+1)
        elif S[i] == '#' and S[i+1] =='.':
            left = S.count('#',0,i)
            right = S.count('.',i)
        if left + right < min:
            min = left + right
print(min)

### FIXED CODE ###

N = int(input())
S = input()
min = N
clm_sum = [0]
for s in S:
    if s == '#':
        clm_sum.append(clm_sum[-1] + 1)
    else:
        clm_sum.append(clm_sum[-1])
for i in range(1,len(clm_sum)):
    if clm_sum[i-1] + ((N - i) - (clm_sum[-1] - clm_sum[i])) < min:
        min = clm_sum[i-1] + ((N - i) - (clm_sum[-1] - clm_sum[i]))
print(min)
x = int(input())
a = list(map(int,input().split()))
count = 0
flag = 0
while flag == 0:
    count += 1
    for i in range(x):
        if a[i]%2 == 0:
            a[i] = a[i]/2
        
        else:
            flag = flag+1
            break
print(count-1)

### FIXED CODE ###

S = list(input())

print(S.count('1'))