Harryxun/stf_run huggingface dataset:
n = int(input())
a = [int(_) for _ in input().split()]
ans = []
a.append(0)
a.sort()

if a.index(0) == 0:
    x = a.pop(1)
    y = a.pop()
    tmp = x-y
    ans.append([x,y])
    a.append(tmp)
    a.sort()
elif a.index(0) == n-1:
    x = a.pop(-2)
    y = a.pop(0)
    tmp = x-y
    ans.append([x,y])
    a.append(tmp)
    a.sort()

a.remove(0)

maximum = a.pop()
minimum = a.pop(0)
while len(a) > 0:
    x = a.pop()
    if x > 0:
        ans.append([minimum, x])
        minimum -= x
    else:
        ans.append([maximum, x])
        maximum -= x

m = maximum-minimum
print(m)
ans.append([maximum, minimum])
for i in ans:
    print(i[0], i[1])


### FIXED CODE ###

n = int(input())
a = [int(_) for _ in input().split()]
ans = []
a.append(0)
a.sort()

if a.index(0) == 0:
    x = a.pop(1)
    y = a.pop()
    tmp = x-y
    ans.append([x,y])
    a.append(tmp)
    a.sort()
elif a.index(0) == n:
    x = a.pop(-2)
    y = a.pop(0)
    tmp = x-y
    ans.append([x,y])
    a.append(tmp)
    a.sort()

a.remove(0)
if len(a) == 1:
    print(a[0])
    print(ans[0][0], ans[0][1])
else:
    maximum = a.pop()
    minimum = a.pop(0)
    while len(a) > 0:
        x = a.pop()
        if x > 0:
            ans.append([minimum, x])
            minimum -= x
        else:
            ans.append([maximum, x])
            maximum -= x

    m = maximum-minimum
    print(m)
    ans.append([maximum, minimum])
    for i in ans:
        print(i[0], i[1])
s = input()
c = Counter(s)
v = list(c.values())
if max(v) - min(v) > 1: 
  print("NO")
else:
  print("YES")

### FIXED CODE ###

s = input()
a = [s.count("a"), s.count("b"), s.count("c")]
a.sort(reverse=True)
if a[0] <= a[2] + 1:
    print("YES")
else:
    print("NO")
import numpy as np

# 初期入力
N,M = (int(x) for x in input().split())
A = np.array( list(map(int, input().split())) )

#
a_waribiki = np.zeros((N,M+1),dtype=np.int64)
a_waribiki[:,0] =A # 割引しない場合を代入

# 各商品を１からM回割引券使った場合の金額
for i in range(1,M+1): 
    a_waribiki[:,i] =a_waribiki[:,i-1] //2

# 各商品に何枚割引券使うか
from itertools import combinations
n_waribiki = [i for i in range(M+N-1)]
x_list_2 =[]
if N-1 ==0:
    x_list_2.append([M])
else:
    for t in combinations(n_waribiki, N-1):
        t_list = list(t)
        t_list.append(M+N-1)
        x_list=[]
        for i in range(1,len(t_list)):
            x= t_list[i] -t_list[i-1]-1
            x_list.append(x)
        x_list.append(t[0])
        x_list_2.append(x_list)
        #print(t_list)
        #print(t,end=" ")

#[割引券を何枚使うか」を利用し、金額計算
x_np = np.array(x_list_2)
kotae = []
for i in x_np:
    a_sum =0
    for j,v in enumerate(i):
        a_sum += a_waribiki[j,v]
    kotae.append(a_sum)
print(min(kotae))

### FIXED CODE ###

# 初期入力
N,M = (int(x) for x in input().split())
A = list(map(int, input().split()))
A =list(map(lambda x:x*(-1),A))     #最大値を取り出すため―１を掛ける
import heapq  # heapqライブラリのimport
heapq.heapify(A)  #         リストを優先度付きキューへ
m=0
for i in range(M):
    a=heapq.heappop(A)  #       最大値の取り出し
    a //=-2             # 負の値を2で割り切り捨てると、絶対値が大きくなる。
    heapq.heappush(A, -a) #正の値で2で割り、戻すとき負にする
    #print(A)

A_sum =sum(A)
A_sum *=(-1)
print(A_sum)
from collections import deque
from collections import defaultdict
N = int(input())
XY = list(sorted([tuple(map(int, input().split())) for _ in range(N)]))
PQ = []
for i in range(N-1):
    for j in range(i, N):
        PQ.append((XY[j][0]-XY[i][0], XY[j][1]-XY[i][1]))
PQ = list(set(PQ))
ans = N
for p, q in PQ:
    tmp1 = 1
    check = defaultdict(int)
    T = deque(XY.copy())
    for x, y in T:
        check[(x, y)] += 1
    x, y = T.popleft()
    cnt = 1
    while cnt < N:
        tmp2 = 1
        for s, t in T:
            if check[(s, t)] == 0:
                continue
            else:
                if s - p == x and t - q == y:
                    check[(s, t)] -= 1
                    tmp2 = 0
                    break
        if tmp2:
            x, y = T.popleft()
        else:
            x, y = s, t
        tmp1 += tmp2
        cnt += 1      
    ans = min(ans, tmp1)
print(ans)


        


    


### FIXED CODE ###

N = int(input())
XY = sorted([tuple(map(int, input().split())) for _ in range(N)])
PQ = []
for i in range(N-1):
    for j in range(i, N):
        PQ.append((XY[j][0]-XY[i][0], XY[j][1]-XY[i][1]))
PQ = list(set(PQ))
ans = N
for p, q in PQ:
    tmp1 = 1
    check=[0]*N
    for i in range(N-1):
        if check[i]:
            continue
        else:
            check[i] = 1
            tmp2 = 1
        for j in range(i, N):
            if check[j]:
                continue
            else:
                if XY[j][0] - p == XY[i][0] and XY[j][1] - q == XY[i][1]:
                    check[j] == 1
                    tmp2 = 0
                    break
        tmp1 += tmp2        
    ans = min(ans, tmp1)
print(ans)
3
3 1 2

### FIXED CODE ###

# coding: utf-8
# Your code here!


import sys
#sys.setrecursionlimit(10**6)
readline = sys.stdin.readline 

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

ans = 0
for i in range(n):
    for j in range(i+1,n):
        ans += d[i]*d[j]
        

print(ans)
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = 0

if A > B:
	E += B
elif :
	E += A
if C > D:
	E += D
elif :
	E += C
	
print(E)


### FIXED CODE ###

A = int(input())
B = int(input())
C = int(input())
D = int(input())
sum = 0

if A > B:
	sum += B
else:
	sum += A
if C > D:
	sum += D
else :
	sum += C
	
print(sum)
import numpy as np

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

### FIXED CODE ###

import numpy as np

MOD = 10**9+7

n = int(input())
arr = np.zeros((n+1,n+1), dtype=int)
for i in np.arange(3,n+1):
    arr[0,i] = 1

for i in np.arange(1,n+1):
    sum_ = 0
    for j in np.arange(3*i,n+1):
        sum_ += arr[i-1,j]
        sum_ %= MOD
        if j+3 >= n + 1:
            break
        arr[i,j+3] = sum_

ans = 0
for i in range(n+1):
    ans += arr[i,n]
    ans %= MOD
print(ans)
import copy
n = int(input())
a = list(map(int, input().split()))
a.sort()
flag = True
if n % 2 == 1:
    if a[0] != 0:
        print(0)
    else:
        ans = [i for i in range(2, n, 2) for j in range(2)]
        ans.insert(0, 0)
        if ans != a:
            print(0)
            flag = False
    if flag:
        print(int((2**((n - 1) // 2)) % (1e9 + 7)))

else:
    ans = [i for i in range(1, n, 2) for j in range(2)]
    if ans != a:
        print(0)
        flag = False
    if flag:
        print(int((2**(n // 2)) % (1e9 + 7)))


### FIXED CODE ###

import copy
n = int(input())
a = list(map(int, input().split()))
a.sort()
flag = True
if n % 2 == 1:
    if a[0] != 0:
        print(0)
    else:
        ans = [i for i in range(2, n, 2) for j in range(2)]
        ans.insert(0, 0)
        if ans != a:
            print(0)
            flag = False
    if flag:
        print((2**((n - 1) // 2)) % (10**9 + 7))

else:
    ans = [i for i in range(1, n, 2) for j in range(2)]
    if ans != a:
        print(0)
        flag = False
    if flag:
        print((2**(n // 2)) % (10**9 + 7))
import math


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


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

"""
# A以上B以下でCで割り切れる数の個数
x1 = (A-1) // C
x2 = B // C
x = x2 - x1
#print("x:", x)

# A以上B以下でDで割り切れる数の個数
y1 = (A-1) // D
y2 = B // D
y = y2 - y1
#print("y", y)

# A以上B以下でC,Dで割り切れる数の個数
z1 = (A-1) // lcm(C, D)
z2 = B // lcm(C, D)
z = z2 - z1
#print("lcm:{}".format(lcm(C, D)))
#print("z", z)

# A~B間の整数 - Cの倍数とDの倍数の個数 + CでもDでも割り切れる個数
not_d = B - (A+1) - (x + y - z)
print(int(not_d))
 """


bsep = (b // c) + (b // d) - (b // lcm(c, d))
asep = (a-1) // c + (a-1) // d - (a-1) // lcm(c, d)

ans = b - a+1 - bsep + asep
print(ans)


### FIXED CODE ###

""" import math


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


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

# A以上B以下でCで割り切れる数の個数
x1 = (A-1) // C
x2 = B // C
x = x2 - x1
#print("x:", x)

# A以上B以下でDで割り切れる数の個数
y1 = (A-1) // D
y2 = B // D
y = y2 - y1
#print("y", y)

# A以上B以下でC,Dで割り切れる数の個数
z1 = (A-1) // lcm(C, D)
z2 = B // lcm(C, D)
z = z2 - z1
#print("lcm:{}".format(lcm(C, D)))
#print("z", z)

# A~B間の整数 - Cの倍数とDの倍数の個数 + CでもDでも割り切れる個数
not_d = B - (A+1) - (x + y - z)
print(int(not_d))
 """

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

total = b - a + 1


def lem(A, B):
	AB = A * B
	while B != 0:
		A, B = B, A % B
	return AB // A


bsep = (b // c) + (b // d) - (b // lem(c, d))
asep = (a-1) // c + (a-1) // d - (a-1) // lem(c, d)

ans = total - bsep + asep
print(ans)
A, B = map(int,input().split())

def make_divisors(n):
    divisors = set()
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.add(i)
            divisors.add(n//i)
    return divisors

lst_A = make_divisors(A)
lst_B = make_divisors(B)
cmn_lst = lst_A & lst_B
m = max(cmn_lst)

hurui = [1] * (m+1)
hurui[0] = 0
for j in range(2, m//2+1):
    for k in range(j, m+1, j):
        if k == j:
            continue
        hurui[k] += 1

cand = set()
for i, v in enumerate(hurui):
    if v == 1:
        cand.add(i)
print(len(cand & cmn_lst))

### FIXED CODE ###

from math import gcd
A, B = map(int,input().split())
max_cmn_div = gcd(A, B)

# 約数列挙関数
def make_divisor(n):
    divisor = []
    for i in range(1, int(n**(1/2))+1):
        if n % i == 0:
            divisor.append(i)
            if i != n//i:
                divisor.append(n//i)
    return divisor

def check_prime(n):
    for i in range(2, int(n**(1/2))+1):
        if n % i == 0:
            return 0
    return 1

cmn_div = make_divisor(max_cmn_div)
ans = 0
for i in cmn_div:
    if check_prime(i):
        ans += 1
print(ans)
import collections
N,M=map(int,input().split())
tree=[[] for _ in range(N)]
for _ in range(M):
    u,v=map(int,input().split())
    tree[u-1].append(v-1)
S,T=map(int,input().split())
s=S-1
t=T-1
ischecked=[[0]*3 for _ in range(N)]
ischecked[s][0]=1
ans=-1
q=collections.deque()
q.append([s,0])
while q:
    v,c=q.pop(0)
    if v==t and c%3==0:
        ans=c//3
        break
    for i in tree[v]:
        if ischecked[i][(c+1)%3]==0:
            q.append([i,c+1])
            ischecked[i][(c+1)%3]==1
print(ans)

### FIXED CODE ###

import collections
N,M=map(int,input().split())
tree=[[] for _ in range(N)]
for _ in range(M):
    u,v=map(int,input().split())
    tree[u-1].append(v-1)
S,T=map(int,input().split())
s=S-1
t=T-1
ischecked=[[0]*3 for _ in range(N)]
ischecked[s][0]=1
ans=-1
q=collections.deque()
q.append([s,0])
while q:
    v,c=q.popleft()
    if v==t and c%3==0:
        ans=c//3
        break
    for i in tree[v]:
        if ischecked[i][(c+1)%3]==0:
            q.append([i,c+1])
            ischecked[i][(c+1)%3]=1
print(ans)
N = int(input())
x = list(input())[::-1]
print(len(x))
num = 0
pop_num = 0
for i in range(N):
    if x[i] == "1":
        pop_num += 1
for i in range(N):
    if x[i] == "1":
        num += 2 ** i
        num %= pop_num 



def popcnt(n):
    c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
    return c

x = x[::-1]
def calc(i,depth,n):
    if depth == 0:
        if x[i] == "1":
            tmp = (num - 2 ** (N - i - 1)) % (pop_num - 1)
            return calc(i,depth+1,tmp)
        else:
            tmp = (num + 2 ** (N - i - 1)) % (pop_num + 1)
            return calc(i,depth+1,tmp)
    else:
        if n == 0: return depth
        return calc(i,depth+1, n % popcnt(n))
        

for i in range(N):
    print(calc(i,0,0))



### FIXED CODE ###

N = int(input())
x = list(input())[::-1]
num = 0
nump = 0
numm = 0
pop_num = 0
for i in range(N):
        if x[i] == "1":
            pop_num += 1
for i in range(N):
    if x[i] == "1":
        num += pow(2,i,pop_num)
        num %= pop_num 
        nump += pow(2,i,pop_num+1)
        nump %= pop_num  + 1
        if pop_num-1 != 0:
            numm += pow(2,i,pop_num - 1)
            numm %= pop_num - 1



def popcnt(n):
    c = (n & 0x5555555555555555) + ((n>>1) & 0x5555555555555555)
    c = (c & 0x3333333333333333) + ((c>>2) & 0x3333333333333333)
    c = (c & 0x0f0f0f0f0f0f0f0f) + ((c>>4) & 0x0f0f0f0f0f0f0f0f)
    c = (c & 0x00ff00ff00ff00ff) + ((c>>8) & 0x00ff00ff00ff00ff)
    c = (c & 0x0000ffff0000ffff) + ((c>>16) & 0x0000ffff0000ffff)
    c = (c & 0x00000000ffffffff) + ((c>>32) & 0x00000000ffffffff)
    return c

x = x[::-1]
def calc(i,depth,n):
    if depth == 0:
        if x[i] == "1":
            tmp = numm
            if pop_num - 1 != 0:
                tmp -= pow(2,N-i-1,pop_num-1)
                tmp %= (pop_num - 1)
            else:
                return 0
            return calc(i,depth+1,tmp)
        else:
            tmp = nump
            tmp += pow(2,N-i-1,pop_num+1)
            tmp %= (pop_num + 1)
            return calc(i,depth+1,tmp)
    else:
        if n == 0: return depth
        return calc(i,depth+1, n % popcnt(n))
        

for i in range(N):
    print(calc(i,0,0))
import numpy as np

def solve():
    ret = np.array([[1 for _ in range(W)] for _ in range(H)])
    row_groups = np.array([0 for _ in range(H)])
    row_group_set = set()
    prev_row = 0
    for row in range(H):
        if '#' in s[row]:
            row_groups[prev_row: row + 1] = row
            row_group_set.add(row)
            prev_row = row + 1
    row_groups[prev_row: ] = prev_row - 1

    cur_group_num = 1
    for row in row_group_set:
        prev_col = 0
        for col in range(W):
            if s[row][col] == '#':
                ret[row][prev_col: col + 1] = cur_group_num
                cur_group_num += 1
                prev_col = col + 1
            ret[row][prev_col: ] = cur_group_num - 1

    for row, row_group_num in enumerate(row_groups):
        if row in row_group_set:
            continue
        for col in range(W):
            ret[row][col] = ret[row_group_num][col]

    for row in ret:
        print(' '.join(map(str, row.tolist())))

if __name__ == "__main__":
    H, W, K = map(int, input().split())
    s = []
    for row in range(H):
        s.append(list(input()))
    solve()

### FIXED CODE ###

import numpy as np

def solve():
    ret = np.array([[1 for _ in range(W)] for _ in range(H)])
    row_groups = np.array([0 for _ in range(H)])
    row_group_set = set()
    prev_row = 0
    for row in range(H):
        if '#' in s[row]:
            row_groups[prev_row: row + 1] = row
            row_group_set.add(row)
            prev_row = row + 1
    row_groups[prev_row: ] = prev_row - 1

    cur_group_num = 1
    for row in row_group_set:
        prev_col = 0
        for col in range(W):
            if s[row][col] == '#':
                ret[row][prev_col: col + 1] = cur_group_num
                cur_group_num += 1
                prev_col = col + 1
            ret[row][prev_col: ] = cur_group_num - 1

    for row, row_group_num in enumerate(row_groups):
        if row in row_group_set:
            continue
        for col in range(W):
            ret[row][col] = ret[row_group_num][col]

    for row in ret:
        print(' '.join(map(str, row.tolist())))

if __name__ == "__main__":
    H, W, K = map(int, input().split())
    s = []
    for row in range(H):
        s.append(list(input()))
    solve()
import fractions
import numpy as np
from functools import reduce
from operator import mul

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

mod = 10**9+7

def sieve(n):
    is_prime = [True for _ in range(n+1)]
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5)+1):
        for j in range(i*2, n+1):
            if j%i == 0:
                is_prime[j] = False
    return [i for i in range(n+1) if is_prime[i]]

primes = sieve(max(A))

def primeFactorization(n):
    temp = n
    ans = [0 for _ in range(len(primes))]
    for i in range(len(primes)):
        while temp%primes[i] == 0:
            temp /= primes[i]
            ans[i] += 1
    return ans

AFactorized = list(map(primeFactorization, A))

lcm = [0 for _ in range(len(primes))]
for i in AFactorized:
    lcm = np.maximum(lcm, i)

B = [lcm-a for a in AFactorized]

ans = 0
for b in B:
    ans += reduce(mul, primes**b%mod)
    ans %= mod

print(ans)

### FIXED CODE ###

import fractions
from functools import reduce

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

p = 10**9+7

def lcm_base(x, y):
    return (x * y) // fractions.gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)

lcm = lcm_list(A)

B = [lcm//i for i in A]

print(sum(B)%p)
m = map(int,raw_input().split())
for i in range(1):
 if(m[i-1]==0):
  break
 print"Case %s* %s",%(i,m[i-1])

### FIXED CODE ###

i=0

while True:
    a = int(input())
    if(a==0):
      break
    i = i+1
    print "Case %d: %d" %  (i,a)
S = list(str(input()))

count = [0] * len(S)

for i in range(0, len(S)):
  current = i
  for j in range(0, 10 **100)
	  if S[current] == "R" and S[current+1] == "R":
        current += 1
      if S[current] == "R" and S[current+1] == "L":
        if j % 2 == 1:
          current += 1
          break:
      if S[current] == "L" and S[current-1] == "R":
        if j % 2 == 1:
          current -= 1
          break:
      if S[current] == "L" and S[current+1] == "L":
        current -= 1
  count[current] += 1
  
print(count)

### FIXED CODE ###

S = list(str(input()))
result_position = [0] * len(S)
count = [0] * len(S)

# 最も左の計算
current = 0
for j in range(0, pow(10, 100)):
  if S[current + 1] == "L":
    if j % 2 == 1:
      current += 1
    break
  else:
    current += 1
result_position[0] = current
count[current] += 1

for i in range(1, len(S)):
  if (S[i - 1] == "R") or (S[i - 1] == "L" and S[i] == "L"):
    if S[result_position[i - 1]] == "R":
      result_position[i] = result_position[i - 1] + 1
    else:
      result_position[i] = result_position[i - 1] - 1
    count[result_position[i]] += 1
  else:
    current = i
    for j in range(0, pow(10, 100)):
      if S[current+1] == "L":
        if j % 2 == 1:
          current += 1
        break
      else:
        current += 1
    result_position[i] = current
    count[current] += 1
  
result = " ".join(map(str, count))

print(result)
from bisect import bisect_right
from math import ceil
N,K=map(int, input().split())
A=list(map(int, input().split()))
if K==0:
    print(max(A))
    exit()

A=sorted(A)
# 最小値で二分探索 してまだ行けるかどうか
# 回数で二分探索
left=0
right=max(A)

ans=float("INF")
pre=ans
flag=False
count=0
while True:
    now=0
    mid=(left+right)/2
    idx=bisect_right(A, mid)
    for i in range(idx, N):
        now+=ceil(A[i]/mid)-1
    if now==K:
        if ans!=float("INF"):
            if int(ans)==int(mid):
                flag=True
        ans=min(ans, mid)
        right=mid
        
        if flag:
            break
        pre=ans
    if now>K:
        left=mid
        pre=mid
    if now<K:
        ans=min(ans, mid)
        right=mid
        pre=mid
    count+=1
    if count>=10**6:
        
        
if ans==float("INF"):
    ans=max(A)
print(ceil(ans))


### FIXED CODE ###

from bisect import bisect_right
from math import ceil
N,K=map(int, input().split())
A=list(map(int, input().split()))
if K==0:
    print(max(A))
    exit()

A=sorted(A)
# 最小値で二分探索 してまだ行けるかどうか
# 回数で二分探索
left=0
right=max(A)

ans=float("INF")
pre=ans
flag=False
count=0
while True:
    now=0
    mid=(left+right)/2
    idx=bisect_right(A, mid)
    for i in range(idx, N):
        now+=ceil(A[i]/mid)-1
    if now==K:
        if ans!=float("INF"):
            if ans==ceil(mid):
                flag=True
        ans=min(ans, ceil(mid))
        right=mid
        
        #if flag:
        #    break
        pre=ans
    if now>K:
        left=mid
        pre=mid
    if now<K:
        ans=min(ans, ceil(mid))
        right=mid
        pre=mid
    count+=1
    if count>=10**2:
        break
    


if ans==float("INF"):
    ans=max(A)
print(ceil(ans))
x.t = map(int,input().split())
print(x/t)

### FIXED CODE ###

t,x = map(int,input().split())
print(t/x)
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
import math
from math import gcd

#inf = 10**17
#mod = 10**9 + 7

n = int(input())
a = list(map(int, input().split()))
a.sort()
res = 0
for i in range(n, 3*n, 2):
    res += a[i]
print(res)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
#from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
import math

#inf = 10**17
#mod = 10**9 + 7

n = int(input())
a = list(map(int, input().split()))
a.sort()
res = 0
for i in range(n, 3*n, 2):
    res += a[i]
print(res)
d, g = map(int, input().split())
g = g // 100
tmp = 0
cands = []
for i in range(1, d + 1):
  p, c = map(int, input().split())
  cand = [i for _ in range(p)]
  cand[-1] += c
  tmp += sum(cands)
  cands.append(cand)
  
while True:
  if tmp <= g:
    print(sum([len(cand) for cand in cands]))
    break
  lasts = [cand[-1] for cand in cands]
  index = lasts.index(min(lasts))
  tmp -= lasts[index]
  cands[index] = cands[index][:-1]

### FIXED CODE ###

import sys
input = sys.stdin.readline
d, g = map(int, input().split())
pc = []
for i in range(d):
    p, c = map(int, input().split())
    pc.append([p, c // 100])
g = g // 100
ans = 1000
for i in range(2 ** d):
    rem = g
    cost = 0
    for j in reversed(range(d)):
        if ((i >> j) & 1):
            p, c = pc[j]
            rem -= c + p * (j + 1)
            cost += p
    for j in reversed(range(d)):
        if  not ((i >> j) & 1):
            p, c = pc[j]
            p -= 1
            if rem >= p * (j + 1):
                rem -= p * (j + 1)
                cost += p
            else:
                while rem > 0:
                    rem -= j +1
                    cost += 1
                break
    if rem <= 0:
        ans = min(cost, ans)
print(ans)
if gets()=="ABC"
  puts "ARC"
else
  puts "ABC"
end

### FIXED CODE ###

s=input()
print('ARC' if s=='ABC' else 'ABC')
import sys
input = sys.stdin.readline

import numpy as np

def main():
    n = int(input())
    a_list = list(map(int, input().split()))

    ans = ''
    for i in range(1, n+1):
        ans += str(a_list.index(i)+1)

    print(' '.join([*ans]))

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline

import numpy as np

def main():
    n = int(input())
    a_list = np.array(list(map(int, input().split())))

    print(*np.argsort(a_list)+1)


if __name__ == '__main__':
    main()
ans=0
n=int(input())
for _ in range(n):
    x,u=input().split()
    ans+=int(u) if x=='JPY' else int(u)*380000
print(ans)

### FIXED CODE ###

ans=0
n=int(input())
for _ in range(n):
    x,u=input().split()
    if u=='JPY':
        ans+=int(x)
    else:
        ans+=(float(x)*380000.0)
print(ans)
X, Y = map(int, input().split())

if (Y%2 == 1):
  print("No")
elif (Y > (X*4)):
  print("No")
else:
  yes = False
  for i in range(1,X+1):
    fNum = i
    tNum = X-i
    if ((fNum*4)+(tNum*2)==Y):
      print("Yes")
      yes = True
  if not (false):
    print("No")
  

### FIXED CODE ###

X, Y = map(int, input().split())

if (Y%2 == 1):
  print("No")
elif (Y > (X*4)):
  print("No")
else:
  yes = False
  for i in range(0,X+1):
    fNum = i
    tNum = X-i
    if ((fNum*4)+(tNum*2)==Y):
      print("Yes")
      yes = True
  if not (yes):
    print("No")
print((int(input())+int(input()))*int(input())//2) 

### FIXED CODE ###

meal_fee=800
cash_back=200
cash_back_count=15
N=int(input())
x=N*meal_fee
y=int(N/cash_back_count) * cash_back
print(x-y)
[print(s) for s in map(lambda x:x[0]+x[1]==x[2]　and 'YES' or 'NO', [sorted(int(x)**2 for x in raw_input().split(' ') for i in range(int(raw_input()))])]

### FIXED CODE ###

print "\n".join(s for s in map(lambda x:x[0]+x[1]==x[2] and 'YES' or 'NO', [sorted(int(x)**2 for x in raw_input().split(' ')) for i in range(int(raw_input()))]))