Harryxun/stf_run huggingface dataset:
count = int(input())
Tpoint = 0
Hpoint = 0
for i in range(count):
    Twrite,Hwrite = map(str,input().split())
    if Twrite == Hwrite:
        Tpoint = Tpoint + 1
        Hpoint = Hpoint + 1
    elif Twrite > Hwrite:
        Tpoint = Tpoiny + 3
    else:
        Hpoint = Hpoint + 3
print('{0} {1}'.format(Tpoint,Hpoint))


### FIXED CODE ###

count = int(input())
Tpoint = 0
Hpoint = 0
for i in range(count):
    Twrite,Hwrite = map(str,input().split())
    if Twrite == Hwrite:
        Tpoint = Tpoint + 1
        Hpoint = Hpoint + 1
    elif Twrite > Hwrite:
        Tpoint = Tpoint + 3
    else:
        Hpoint = Hpoint + 3
print('{0} {1}'.format(Tpoint,Hpoint))
n = int(input())
s = input()
ans = s.count('.')
tmp = ans
for i in s:
    if i == '.':
        tmp -= 1
    else:
        tmp += 1
    ans = min(ans,tmp)
print(ans)

### FIXED CODE ###

s = [int(i) for i in input().split(' ')]
if s[2] > s[0] and s[2] < s[1]:
    print("Yes")
elif s[2] < s[0] and s[2] > s[1]:
    print("Yes")
else:
    print("No")
from collections import deque
import math
mod = 10**9+7
N,K = map(int,input().split())

#KPxの計算用。一回だけ使う
def Perm(n,r):#aPb
    return math.factorial(n) // math.factorial(n - r)

#K-2Pxの計算のメモ化
K_2perm =[1,K-2]
pres = K-2
for i in range(2,K-1):
    pres = (pres*(K-1-i))%mod
    K_2perm.append(pres)

child = [[] for i in range(N)]
for hoge in range(N-1):
    a,b = [int(i)-1 for i in input().split()]#点を0-indexedになおす
    child[a].append(b)
    child[b].append(a)


ans = Perm(K,len(child[0])+1)%mod
#DFSしながら塗る
went = [False] * N
queue = deque()
queue.append(0)
went[0] = True
while queue:
    cur = queue.pop()
    if cur!=0:
        ans *= K_2perm[len(child[cur])-1]
        ans %= mod
    for togo in child[cur]:
        if not went[togo]:
            went[togo] = True
            queue.append(togo)
print(ans)



### FIXED CODE ###

from collections import deque
import math
import sys
mod = 10**9+7
N,K = map(int,input().split())

#k
Kperm =[1,K]
pre = K
for i in range(2,K+1):
    pre = (pre*(K+1-i))%mod
    Kperm.append(pre)


#K-2Pxの計算のメモ化
K_2perm =[1,K-2]
pres = K-2
for i in range(2,K-1):
    pres = (pres*(K-1-i))%mod
    K_2perm.append(pres)

child = [[] for i in range(N)]
for hoge in range(N-1):
    a,b = [int(i)-1 for i in input().split()]#点を0-indexedになおす
    child[a].append(b)
    child[b].append(a)

if len(child[0])>=K:
    print(0);sys.exit()
ans = Kperm[len(child[0])+1]
#DFSしながら塗る
went = [False] * N
queue = deque()
queue.append(0)
went[0] = True
while queue:
    cur = queue.pop()
    if cur!=0 and len(child[cur])>=K:
        print(0)
        sys.exit()
    if cur!=0:
        ans *= K_2perm[len(child[cur])-1]
        ans %= mod
    for togo in child[cur]:
        if not went[togo]:
            went[togo] = True
            queue.append(togo)
print(ans)
if a*b%2==0 :
    print('odd'):

else:
    print('Even')

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2==0:
    print("Even")
else: 
    print("Odd")
# -*- coding: utf-8 -*-


N = int(input())
S = input()

count = 0

for i, s in enumerate(S):
    if s != 'A':
        continue
    else:
        if N >= i + 2 and S[i+1] == 'B' and S[i+2] == 'C':
            count += 1

print(count)

### FIXED CODE ###

# -*- coding: utf-8 -*-


N = int(input())
S = input()

count = 0

for i, s in enumerate(S[:-2]):
    if s != 'A':
        continue
    else:
        if N >= i + 2 and S[i+1] == 'B' and S[i+2] == 'C':
            count += 1

print(count)
r1,c1,r2,c2 = map(int, input().split())

def nCr_mod_p(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 2*10 ** 6 +   # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p), 0! = 1! = 1
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p), 0! = 1! = 1
inv = [0, 1]  # inv[n] = n^(-1) mod p, 0! = 1　だけど便宜上inv[0]=0にしてる

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

sum22 = nCr_mod_p(r2+1+c2+1,r2+1,p) - 1
sum21 = nCr_mod_p(r2+1+c1,r2+1,p) - 1
sum12 = nCr_mod_p(r1+c2+1,c2+1,p) - 1
sum11 = nCr_mod_p(r1+c1,c1,p) - 1

ans = sum22 - sum21 - sum12 + sum11
ans %= p

print(ans)

### FIXED CODE ###

r1,c1,r2,c2 = map(int, input().split())

def nCr_mod_p(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 2*10 ** 6 + 10  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p), 0! = 1! = 1
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p), 0! = 1! = 1
inv = [0, 1]  # inv[n] = n^(-1) mod p, 0! = 1　だけど便宜上inv[0]=0にしてる

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

sum22 = nCr_mod_p(r2+1+c2+1,r2+1,p) - 1
sum21 = nCr_mod_p(r2+1+c1,r2+1,p) - 1
sum12 = nCr_mod_p(r1+c2+1,c2+1,p) - 1
sum11 = nCr_mod_p(r1+c1,c1,p) - 1

ans = sum22 - sum21 - sum12 + sum11
ans %= p

print(ans)
h, w, k = map(int, input().split())
c = [input(i) for i in range(h)]
ans = 0
for p_h in range(2**h):
    for p_w in range(2**w):
        black = 0
        for i in range(h):
            for j in range(w):
                if (p_h>>i)&1==0 and (p_w>>j)&1==0:
                    if c[i][j]=='#'
                        black +=1
        if black == k:
            ans += 1
print(ans)

### FIXED CODE ###

h,w,k=map(int,input().split())
board=[list(input()) for _ in range(h)]
ans=0
for paint_h in range(2**h): #すべての行の塗りつぶし方を2進数で列挙する
 for paint_w in range(2**w): #すべての列の塗りつぶし方を2進数で列挙する
   cnt=0
   for i in range(h): #すべてのi行目j列目の要素についてみる
     for j in range(w):
       if (paint_h>>i)&1==0 and (paint_w>>j)&1==0: #各行のi番目のビットと各列のj番目のビットがともに0であればそのマスは塗りつぶされない
         if board[i][j]=='#': #塗りつぶされないマスが黒マスであれば個数を+1する
           cnt+=1
   if cnt==k: #塗りつぶされない黒マスの個数がKに等しければ答えを+1する
     ans+=1
print(ans)
x = input().split(" ")
n = int(x[0])
m = int(x[1])

probInit = set([])
probEnd  = set([])

for i in range(m):
    edge = input().split(" ")
    if edge[0] == 0:
        probInit.add(edge[1])

    if edge[1] == n - 1:
        probEnd.add(edge[0])

sec = probEnd.intercection(probInit)
if (len(sec) == 0):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")



### FIXED CODE ###

x = input().split(" ")
n = int(x[0])
m = int(x[1])

probInit = set([])
probEnd  = set([])

for i in range(m):
    edge = input().split(" ")
    if edge[0] == "1":
        probInit.add(edge[1])

    if edge[1] == str(n):
        probEnd.add(edge[0])

sec = probEnd.intersection(probInit)
if (len(sec) == 0):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
c=str(input())
list=[a,i,u,o,e]
if c in list:
  print("vowel")
else:
  print("consonant")

### FIXED CODE ###

c=str(input())
list=["a","i","u","o","e"]
if c in list:
  print("vowel")
else:
  print("consonant")
S = input()
hitachi = 'hi'
i = 1
 
while True:
  corect = hitachi * i
  if S == hitachi:
  	print('Yes')
    break
  i += 1
  if i == 20:
    print('No')
    break

### FIXED CODE ###

S = input()
hitachi = 'hi'
i = 1
 
while True:
    corect = hitachi * i
    if S == corect:
        print('Yes')
        break
    i += 1
    if i == 20:
        print('No')
        break
a,b,c = map(int,input().split())

x = b // a

if x <= c:
	print(x)

else:
	print(c)


### FIXED CODE ###

S = list(map(int,input().split('/')))

if S[1] > 4 :
  print('TBD')
else:
  print('Heisei')
import ceil from math
h,w = map(int,input().split())

print(ceil(w/2)*(h%2) + w*(h//2))

### FIXED CODE ###

h,w = map(int,input().split())

if h==1 or w==1:
  print(1)
  exit()

print((w+1)//2*(h%2) + w*(h//2))
a, b = input.split(' ')

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


### FIXED CODE ###

a, b = map(int, input().split())
print('Even' if a * b % 2 == 0 else 'Odd')
def mincost(h, m, i):
  if i == len(m) - 1:
    return (1 + (h - 1) // m[i][0]) * m[i][1]
  return min((1 + (h - 1) // m[i][0]) * m[i][1],
            mincost(h % m[i][0], m, i+1))

h, n = list(map(int, input().rstrip().split()))
m = [tuple(map(int, input().rstrip().split())) for _ in range(n)]

m.sort(key = lambda x: x[0])
m.sort(key = lambda x: x[0] / x[1], reversed = True)

print(mincost(h, m, 0))

### FIXED CODE ###

def dp(H, N, ab):
  max_a = max([ab[i][0] for i in range(N)])
  d = [INF for _ in range(H + max_a)]
  d[0] = 0
  for h in range(1, H + max_a):
    d[h] = min(d[h - a] + b for a, b in ab)
  return min(d[H:])
INF = 10 ** 10
H, N = map(int, input().split())
ab = [tuple(map(int, input().split())) for _ in range(N)]
print(dp(H, N, ab))
vimport sys
def input():
    return sys.stdin.readline()[:-1]
a,b=map(int,input().split())
print((a-1)*(b-1))

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
a,b=map(int,input().split())
print((a-1)*(b-1))
n, p = map(int,input().split())
a = list(map(int,input().split()))
 
o = 0
for i in a:
    if  i % 2:
        o += 1 
e = n-o
if o != 0:
    print((2**e)*int(2**(o-1)))
else:
    if P == 0:
        print(2**n)
    else:
        print(0)

### FIXED CODE ###

n, p = map(int,input().split())
a = list(map(int,input().split()))
 
o = 0
for i in a:
    if  i % 2:
        o += 1 
e = n-o
if o != 0:
    print((2**e)*int(2**(o-1)))
else:
    if p == 0:
        print(2**n)
    else:
        print(0)
s = input()

if s[2] == s[3] & s[4] == s[5]:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s = input()
 
if s[2] == s[3] and s[4] == s[5]:
  print('Yes')
else:
  print('No')
from sys import stdin

n, m = list(map(int, input().split()))
h_n = list(map(int, input().split()))
a_b_m = stdin.readlines()

res = 0
omit_s = []
for i in range(1, n+1):
    count_omit = 0
    for k in range(len(omit_s)):
        if omit_s[k] == i:
            count_omit = 1
            break
    if count_omit == 0:
        count = 0
        count_higher = 0
        for j in range(m):
            a, b = [int(x) for x in a_b_m[j].rstrip().split()]
            if a == i:
                count = 1
                if h_n[b-1] >= h_n[a-1]:
                    count_higher = 1
                elif h_n[a-1] > h_n[b-1]:
                    ommit_s.append(b-1)
                    break
            elif b == i:
                count = 1
                if h_n[a-1] >= h_n[b-1]:
                    count_higher = 1
                    break
        if count == 1 and count_higher == 0:
            res += 1
        elif count == 0:
            res += 1
print(res)


### FIXED CODE ###

s = str(input())

if s == 'ABC':
    print('ARC')
else:
    print('ABC')
S = input()
if S<4:
    list_s = list(S)
    count = 0
    for i in range(3):
        if list_s[i] == 'R':
            count +=1
        elif list_s[i] == 'S':
            count = 0
    print(count)

### FIXED CODE ###

S = input()
list_s = list(S)
count = 0
x = []
for i in range(3):
    if list_s[i] == 'R':
        count +=1
    elif list_s[i] == 'S':
        x.append(count)
        count = 0
x.append(count)
print(max(x))
n=int(input())
a=[int(input()) for i in range(n)]
b=a
b.sort(reverse=True)
m=set(b)
M=m[0]
indexes=[j for j,x in enumerate(a) if x==M]
for k in range(n):
  if a[k]==M and len(indexes)==1:
    print(m[1])
  else:
    print(M)



### FIXED CODE ###

import collections
n=int(input())
a=[]
for i in range(n):
  a.append(int(input()))
b=collections.Counter(a)
d=list(b.items())
d.sort(key=lambda x:-int(x[0]))
if d[0][1]==1:
  for i in range(n):
    if a[i]==int(d[0][0]):
      print(int(d[1][0]))
    else:
      print(int(d[0][0]))
else:
  for i in range(n):
    print(int(d[0][0]))
a = list(map(int, input.split()))
res = 0

num = a.pop(0) * 2

for i in range(num):
    if (i == 'BTC'):
        b = a[i-1] * 380000
        res += b
    elif (i == 'JPY'):
        res += a[i-1]
    else:
        pass

print(res) 

### FIXED CODE ###

a = int(input())

b = []

for i in range(a):
    b.append(input().split())

res = 0

for i in b:
    if (i[1] == 'BTC'):
        res += float(i[0])*380000
    else:
        res += int(i[0])

print(res)
N = int(input())
nums = list(map(int, input().split()))

cumul = 1
for i in range(N):
  	cumul *= nums[i]
    if cumul > 10**18:
    	print(-1)
        break

if cumul < 10**18: print(cumul)

### FIXED CODE ###

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

cumul = 1
if 0 in nums:
    print(0)
else:
    for i in range(N):
        cumul *= nums[i]
        if cumul > 10 ** 18:
            print(-1)
            break
    if cumul <= 10 ** 18: print(cumul)
n = int(input())

a = []
m = 0
for i in range(1, n):
    if m >= n: break
    a.append(i)
    m += i

if m == n:
    print(*a)
else:
    a.remove(m-n)
    print(*a)

### FIXED CODE ###

n = int(input())

a = []
m = 0
for i in range(n):
    if m >= n: break
    a.append(i+1)
    m += i+1
    
if m == n:
    print(*a)
else:
    a.remove(m-n)
    print(*a)
X, N = map(int, input().split(' '))
if N == 0:
    print(X)
else:
    P_ls = list(map(int, input().split(' ')))
    P_ls.sort(reverse=True)
    diff = -1
    for i in range(100, 0, -1):
        if i not in P_ls:
            if diff == -1:
                diff = abs(X - i)
            else:
                diff = min(diff, abs(X - i))
                if diff == abs(X-i):
                    rst = i
    print(rst)

### FIXED CODE ###

x, n = map(int, input().split(' '))
min_num = 100

ls = [0] * 201
for i in range(0, 201):
    ls[i] = i

ls_in = [0] * n
if n > 0:
    ls_in = list(map(int, input().split(' ')))
    for i in ls_in:
        ls.remove(i)
    ls.reverse()
    for i in ls:
        min_num = min(abs(x-i), min_num)
        if abs(x-i) == min_num:
            ans = i 
    print(ans)
else:
    print(x)
def floorsqrt(x):
  max_ok = 0
  min_ng = x
  while min_ng-max_ok>1:
    tgt = (max_ok+min_ng)//2
    if tgt*tgt<=x:
      max_ok = tgt
    else:
      min_ng = tgt
  return max_ok

def K1(C, r):
  max_ok = 0
  min_ng = C
  while min_ng-max_ok>1:
    tgt = (max_ok+min_ng)//2
    if C-tgt>r+tgt*tgt:
      max_ok = tgt
    else:
      min_ng = tgt
  return max_ok

def K2(C, r):
  max_ok = 0
  min_ng = C
  while min_ng-max_ok>1:
    tgt = (max_ok+min_ng)//2
    if C-tgt>r+tgt*(tgt+1):
      max_ok = tgt
    else:
      min_ng = tgt
  return max_ok

Q = int(input())
for _ in range(Q):
  A, B = map(int, input().split())
  if B<A: A,B = B,A
  
  C = floorsqrt(A*B-1)
  #print(A, B, C, C*C, A*B-1, C*C+2*C+1)
  
  # C:= floor(sqrt(AB-1))
  
  q = (A*B-1)//C
  r = (A*B-1)%C

  if q==C:
    # Case 1: (AB-1)//C == C ... r
    # a :    1 ... C     AB-1
    # b : AB-1     C ...    1
    #
    # (AB-1)//(C-k) == C+k ... r+k*k
    # K = max{k | C-k>r+k*k}
    K = K1(C, r)
    ans = 2*C-3 if B<=C+K else 2*C-2
    #print(K, B, C+K)
  
  elif q==C+1:
    # Case 2: (AB-1)//C == C+1 ... r
    # a :    1 ... C   C+1     AB-1
    # b : AB-1     C+1   C...     1
    #
    # (AB-1)//(C-k) == C+k+1 ... r+k*(k+1)
    # K = max{k | C-k>r+k*(k+1)}
    K = K2(C, r)
    ans = 2*C-2 if B<=C+K+1 else 2*C-1
 
  else:
    # Case 3: (AB-1)//C == C+2
    # a :    1 ... C   C+2     AB-1
    # b : AB-1     C+2   C...     1
    ans = 2*C if A==B else 2*C-1
    
  print(ans)

### FIXED CODE ###

def floorsqrt(x):
  max_ok = 0
  min_ng = x+1
  while min_ng-max_ok>1:
    tgt = (max_ok+min_ng)//2
    if tgt*tgt<=x:
      max_ok = tgt
    else:
      min_ng = tgt
  return max_ok

def K1(C, r):
  max_ok = 0
  min_ng = C
  while min_ng-max_ok>1:
    tgt = (max_ok+min_ng)//2
    if C-tgt>r+tgt*tgt:
      max_ok = tgt
    else:
      min_ng = tgt
  return max_ok

def K2(C, r):
  max_ok = 0
  min_ng = C
  while min_ng-max_ok>1:
    tgt = (max_ok+min_ng)//2
    if C-tgt>r+tgt*(tgt+1):
      max_ok = tgt
    else:
      min_ng = tgt
  return max_ok

Q = int(input())
for _ in range(Q):
  A, B = map(int, input().split())
  if A*B==1:
    print(0)
    continue
  if B<A: A,B = B,A
  
  C = floorsqrt(A*B-1)
  #print(A, B, C, C*C, A*B-1, C*C+2*C+1)
  
  # C:= floor(sqrt(AB-1))
  
  q = (A*B-1)//C
  r = (A*B-1)%C

  if q==C:
    # Case 1: (AB-1)//C == C ... r
    # a :    1 ... C     AB-1
    # b : AB-1     C ...    1
    #
    # (AB-1)//(C-k) == C+k ... r+k*k
    # K = max{k | C-k>r+k*k}
    K = K1(C, r)
    ans = 2*C-3 if B<=C+K else 2*C-2
    #print(K, B, C+K)
  
  elif q==C+1:
    # Case 2: (AB-1)//C == C+1 ... r
    # a :    1 ... C   C+1     AB-1
    # b : AB-1     C+1   C...     1
    #
    # (AB-1)//(C-k) == C+k+1 ... r+k*(k+1)
    # K = max{k | C-k>r+k*(k+1)}
    K = K2(C, r)
    ans = 2*C-2 if B<=C+K+1 else 2*C-1
 
  else:
    # Case 3: (AB-1)//C == C+2
    # a :    1 ... C   C+2     AB-1
    # b : AB-1     C+2   C...     1
    ans = 2*C if A==B else 2*C-1
    
  print(ans)
def main():
    N, M = map(int, input().split())
    AB = [[] for _ in range(N)]

    for _ in range(M):
        a,b = map(lambda x: int(x)-1, input().split())
        AB[a].append(b)
        AB[b].append(a)

    def dfs(v):
        if visited[v]:
            return
        visited[v] = 1
        for i in AB[v]:
            dfs(i)

    visited = [0]*N
    cnt = 0
    for i in range(N):
        if visited[i]:
            continue
        dfs(i)
        cnt += 1
    print(N-cnt)

if __name__ == "__main__":
    main()


### FIXED CODE ###

from collections import deque

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

AB = [[] for _ in range(N)]

for _ in range(M):
    a,b = map(lambda x: int(x)-1, input().split())
    AB[a].append(b)
    AB[b].append(a)

visited = [0] * N
ans = []
for i in range(N):
    if visited[i]:
        continue
    group = [i]
    d = deque(AB[i])
    while d:
        s = d.popleft()
        if visited[s]:
            continue
        visited[s] = 1
        group.append(s)
        for k in AB[s]:
            d.append(k)
    ans.append(len(group))

print(len(ans)-1)
N = int(input())
T = [int(input()) for _ in range(N)]

def GCD(a,b):
    x1 = max(a,b)
    x2 = min(a,b)
    x3 = x1 % x2
    if x3 == 0:
        return x2
    N = GCD(x2,x3)
    return N
        
ans = T[0]
tmp = ans
for i in range(1,N):
    ans = tmp * T[i] / GCD(tmp,T[i])
    tmp = ans

print(int(ans))
    

### FIXED CODE ###

N = int(input())
T = [int(input()) for _ in range(N)]

def GCD(a,b):
    x3 = a % b
    if x3 == 0:
        return min(a,b)
    N = GCD(b,x3)
    return N

def lcm(a,b):
    return a*b // GCD(a,b)
        
ans = T[0]
for i in range(1,N):
    ans = lcm(ans,T[i]) 

print(int(ans))
s = input()

s[3] = '8'
print(s)

### FIXED CODE ###

s = list(input()) 
s[3] = '8'
print(''.join(s))
def swap(a, b):
    tmp = a
    a = b
    b = tmp
    return a, b


def solve(): # 072D- Derangement
    N = int(input())
    p = list(map(int, input().split(" ")))
    p.insert(0, 1)
    cnt = 0

    for i in range(1, N+1):
        if i == p[i]:
            p[i], p[i+1] = swap(p[i], p[i+1])
            cnt += 1
            print(p, i)
        elif i == N and i == p[i]:
            p[i-1], p[i] = swap(p[i-1], p[i])
            cnt += 1
            print(p)
        else:
            pass

    print(cnt)
    
    
solve()

### FIXED CODE ###

def swap(a, b):
    tmp = a
    a = b
    b = tmp
    return a, b


def solve(): # 072D- Derangement
    N = int(input())
    p = list(map(int, input().split(" ")))
    p.insert(0, 0)
    cnt = 0

    for i in range(1, N+1):
        if i == p[i] and i != N:
            p[i], p[i+1] = swap(p[i], p[i+1])
            cnt += 1
        elif i == N and i == p[i]:
            p[i-1], p[i] = swap(p[i-1], p[i])
            cnt += 1
        else:
            pass

    print(cnt)
    
    
solve()
d,g = map(int,input().split())
li = []

for i in range(d):
    p,c = map(int,input().split())
    li.append([p,c])

ans = 10**9
for i in range(1<<d):
    ttl = 0
    cnt = 0
    memo = [0 for i in range(d)]
    for j in range(d):
        if (i>>j)&1:
            ttl += li[j][1]+(j+1)*li[j][0]*100
            cnt += li[j][0]
            memo[j] = 1
    #print(memo,ttl)
    if ttl < g:
        memo2 = g- ttl
        for j in range(d-1,-1,-1):
            if memo[j] == 0:
                if memo2%(100*(j+1)) == 0:
                    cnt2 = min(memo2//(100*(j+1)),li[j][0]-1)
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                    #print(44444444)
                else:
                    cnt2 = min(memo2//(100*(j+1)+1),li[j][0]-1)
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                break
    if ttl >= g:
        ans = min(ans,cnt)
    
    if ans == cnt:
        #print(memo,ttl,111111)
    
    

print(ans)



### FIXED CODE ###

d,g = map(int,input().split())
li = []

for i in range(d):
    p,c = map(int,input().split())
    li.append([p,c])

ans = 10**9
for i in range(1<<d):
    ttl = 0
    cnt = 0
    memo = [0 for i in range(d)]
    for j in range(d):
        if (i>>j)&1:
            ttl += li[j][1]+(j+1)*li[j][0]*100
            cnt += li[j][0]
            memo[j] = 1
    #print(memo,ttl)
    if ttl < g:
        memo2 = g- ttl
        for j in range(d-1,-1,-1):
            if memo[j] == 0:
                if memo2%(100*(j+1)) == 0:
                    cnt2 = min(memo2//(100*(j+1)),li[j][0]-1)
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                    #print(44444444)
                else:
                    cnt2 = min(((memo2//(100*(j+1)))+1),li[j][0]-1)
                    #print(((memo2//(100*(j+1)))+1))
                    cnt += cnt2
                    ttl += cnt2*(100*(j+1))
                break
    if ttl >= g:
        ans = min(ans,cnt)
"""   
    if ans == cnt:
        print(memo,ttl,111111)
"""   
    

print(ans)
r = int(input().split()[0])
g = int(input().split()[0])

next = g * 2 - r
print(next

### FIXED CODE ###

# https://atcoder.jp/contests/abc076/tasks/abc076_a
# A - Rating Goal

r = int(input().split()[0])
g = int(input().split()[0])

next = g * 2 - r
print(next)
import collections

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

L = [i+j for i, j in enumerate(A)]
R = [i-j for i, j in enumerate(A)]

l = collections.Counter(L)
r = collections.Counter(L)

for i in l.keys():
    ans += l[i]*r[i]

print(ans)

### FIXED CODE ###

import collections

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

L = [i+j for i, j in enumerate(A)]
R = [i-j for i, j in enumerate(A)]

l = collections.Counter(L)
r = collections.Counter(R)

ans = 0
for i in l.keys():
    ans += l[i]*r[i]

print(ans)
dp =[0 for j in range(n)]


for j in range(n):
    t=0
    if s[j]=="C" and j!=0:
        if s[j-1]=="A":
            t=1

    dp[j]=dp[j-1]+t
        

for i in range(q):
    l,r=map(int,input().split())
    print(dp[r-1]-dp[l-1])

### FIXED CODE ###

n,q=map(int,input().split())
s=input()
    
dp =[0 for j in range(n)]


for j in range(n):
    t=0
    if s[j]=="C" and j!=0:
        if s[j-1]=="A":
            t=1

    dp[j]=dp[j-1]+t
        

for i in range(q):
    l,r=map(int,input().split())
    print(dp[r-1]-dp[l-1])
def rot(s):
    x=""
    for c in s:
        tmp = ord(c)-ord("a")
        if "a"<=c<="z":
            x += chr((tmp+1) % 26 + ord("a"))
        else:
            x += c
    return x
    
def check(s):
    for word in s.split():
        if word=="the" or word=="this" or word=="that":
            return True
    else return False

while True:
    try:
        s = raw_input()
        f = False
        for i in range(26):
            if check(s):break
            else: s=rot(s)
        print s
    except:
        break

### FIXED CODE ###

import sys,string
A="abcdefghijklmnopqrstuvwxyza"
tbl=string.maketrans(A[:-1],A[1:])
for s in sys.stdin:
    while not("the" in s or "that" in s or "this" in s):
        s=s.translate(tbl)
    print s[:-1]
A,B=map(int,input().split())
a,b=map(int,input().split())

A-a=x
B-b=y

print(int(x*y))

### FIXED CODE ###

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

x=A-a
y=B-b

print(int(x*y))
import sys

x, y = sys.stdin
z=x*y
a=(x+y)*2
print(z,a)

### FIXED CODE ###

x = map(int,raw_input().split())
z=x[0]*x[1]
a=(x[0]+x[1])*2
print z,a