Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n = int(input())
l = []
for i in range(n):
    x,y = map(int,input().split())
    l.append([x,y,i])

lx = sorted(l)
ly = sorted(l, key=lambda x: x[1])

e = []
for i in range(n-1):
    e.append([lx[i+1][0]-lx[i][0],lx[i+1][2],lx[i][2]])
    e.append([ly[i+1][1]-ly[i][1],ly[i+1][2],ly[i][2]])


class Unionfind:
    
    def __init__(self,n):
        self.uf = [-1]*n

    def find(self,x):
        if self.uf[x] < 0:
            return x
        else:
            self.uf[x] = self.find(self.uf[x])
            return self.uf[x]

    def same(self,x,y):
        return self.find(x) == self.find(y)

    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return 
        if self.uf[x] > self.uf[y]:
            x,y = y,x
        self.uf[x] += self.uf[y]
        self.uf[y] = x

    def size(self,x):
        x = self.find(x)
        return -self.uf[x]

u = Unionfind(n)
count = 0
e.sort()
for i in e:
    if u.find(i[1]) != u.find(i[2]):
        u.union(i[1],i[2])
        count += i[0]
print(count)

### FIXED CODE ###

n = int(input())
l = []
for i in range(n):
    x,y = map(int,input().split())
    l.append([x,y,i])

lx = sorted(l)
ly = sorted(l, key=lambda x: x[1])

e = []
for i in range(n-1):
    e.append([lx[i+1][0]-lx[i][0],lx[i+1][2],lx[i][2]])
    e.append([ly[i+1][1]-ly[i][1],ly[i+1][2],ly[i][2]])


class Unionfind:
    
    def __init__(self,n):
        self.uf = [-1]*n

    def find(self,x):
        if self.uf[x] < 0:
            return x
        else:
            self.uf[x] = self.find(self.uf[x])
            return self.uf[x]

    def same(self,x,y):
        return self.find(x) == self.find(y)

    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return 
        if self.uf[x] > self.uf[y]:
            x,y = y,x
        self.uf[x] += self.uf[y]
        self.uf[y] = x

    def size(self,x):
        x = self.find(x)
        return -self.uf[x]
s = set()
u = Unionfind(n)
count = 0
e.sort()
for i in e:
    if not u.same(i[1],i[2]):
        u.union(i[1],i[2])
        s.add(i[1])
        s.add(i[2])
        count += i[0]
print(count)
### BUGGY CODE ###

L, R = map(int, input().split())
ans = 2019
for i in range(L, R+1):
  for j in range(i+1, R+1):
    ans = min(ans, i * j % 2019)
print(ans)

### FIXED CODE ###

L, R = map(int, input().split())
ans = 2019
for i in range(L, R+1):
  for j in range(i+1, R+1):
    ans = min(ans, i * j % 2019)
    if i * j % 2019 == 0:
      break
  else:
    continue
  break
print(ans)
### BUGGY CODE ###

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

if n % k == 0:
  print(0)
  exit()

min = 10**18

while True:
  n = abs(n-k)
  if min > n:
    min = n
  else:
    break

print(min)






### FIXED CODE ###

n,k = map(int, input().split())
n = n % k
a = abs(n-k)
if n <= a:
  print(n)
else:
  print(a)
### BUGGY CODE ###

def solve(k):
    dp = [[0] * (h + 1) for i in range(h + 1)]
    for i in range(h):
        for diff in range(h - i):
            dp[i + 1][i + 1 + diff] = dp[i][i + diff] + (s[i + diff][k] == s[i][k + 1])
            dp[i + 1 + diff][i + 1] = dp[i + diff][i] + (s[i][k] == s[i + diff][k + 1])
    
    min_cost = {}
    def solve_cost(i, j):
        if i * offset + j in min_cost:
            return min_cost[i * offset + j]
        if i == 0 or j == 0:
            return 0
        min_cost[i * offset + j] = min(solve_cost(i, j - 1), solve_cost(i - 1, j)) + dp[i][j]
        return min_cost[i * offset + j]
    
    return solve_cost(h, h)


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

ans = 0
for i in range(w - 1):
    ans += solve(i)
    
print(ans)

### FIXED CODE ###

def solve(k):
    dp = [[0] * (h + 1) for i in range(h + 1)]
    for i in range(h):
        for diff in range(h - i):
            dp[i + 1][i + 1 + diff] = dp[i][i + diff] + (s[i + diff][k] == s[i][k + 1])
            dp[i + 1 + diff][i + 1] = dp[i + diff][i] + (s[i][k] == s[i + diff][k + 1])

    dq = [[INF] * (h + 1) for i in range(h + 1)]
    dq[0][0] = 0
    for i in range(h):
        dq[i + 1][0] = dq[i][0] + dp[h - i][h]
        dq[0][i + 1] = dq[0][i] + dp[h][h - i]  
    for i in range(h):
        for j in range(h):
            dq[i + 1][j + 1] = min(dq[i + 1][j] + dp[h - (i + 1)][h - j],
                                   dq[i][j + 1] + dp[h - i][h - (j + 1)])

    return dq[h][h]


h, w = map(int, input().split())
s = [input() for i in range(h)]
INF = 10 ** 5
OFFSET = 500

ans = 0
for i in range(w - 1):
    ans += solve(i)
    
print(ans)
### BUGGY CODE ###

import sys
import collections
input = sys.stdin.readline

def main():
    S = input().strip()

    a = [[] for _ in range(26)]

    for i, s in enumerate(S):
        a[ord(s) - ord('a')].append(i)

    ans = []
    f = False
    for i in range(26):
        for j in range(len(a[i])):
            for k in range(j + 1, len(a[i])):
                if (a[i][k] - a[i][j] + 1) < (k - j + 1) * 2:
                    ans.append(a[i][j])
                    ans.append(a[i][k])
                    f = True
                    break
            if f:
                break
        if f:
            break

    if f:
        print(ans[0] + 1, ans[1] + 1)
    else:
        print(-1, -1)







    

if __name__ == '__main__':
    main()




### FIXED CODE ###

import sys
import collections
input = sys.stdin.readline

def main():
    S = input().strip()

    a = [[] for _ in range(26)]

    for i, s in enumerate(S):
        a[ord(s) - ord('a')].append(i)

    ans = []
    f = False
    for i in range(26):
        for j in range(len(a[i]) - 1):
            if (a[i][j + 1] - a[i][j] + 1) < 4:
                ans.append(a[i][j])
                ans.append(a[i][j + 1])
                f = True
                break
        if f:
            break

    if f:
        print(ans[0] + 1, ans[1] + 1)
    else:
        print(-1, -1)







    

if __name__ == '__main__':
    main()
### BUGGY CODE ###

from decimal import Decimal
N = int(input())
#numlist = [0] * (N + 1)
log2 = [0] * (N + 1)
log5 = [0] * (N + 1)
acc = [[0 for i in range(19)] for j in range(19)]
Ans = 0

for i in range(1,N+1):
  #numlist[i] = Decimal(input()) * 1000000000
  wk = Decimal(input()) * 1000000000

  #wk = numlist[i]
  for cnt in range(1,19):
    if wk % 2 == 0:
      log2[i] += 1
      wk = wk // 2
    else:
      break

  for cnt in range(1,19):
    if wk % 5 == 0:
      log5[i] += 1
      wk = wk // 5
    else:
      break

  acc[log2[i]][log5[i]] += 1
    
for i in range(0,19):
  for j in range(0,19): 
    for k in range(i,19):
      for l in range(0,19):
        if (i + k) >= 18 and (j + l) >= 18 and (i < k or (i == k and j <= l)):
          if acc[i][j] > 0 and acc[k][l] > 0:
            Ans += acc[i][j] * acc[k][l]
            if i >= 9 and j >= 9 and i == k and j == l:
              Ans -= int((acc[i][j] * (acc[i][j] + 1)) / 2)

print(int(Ans))


### FIXED CODE ###

from decimal import Decimal
N = int(input())
#numlist = [0] * (N + 1)
log2 = [0] * (N + 1)
log5 = [0] * (N + 1)
acc = [[0 for i in range(19)] for j in range(19)]
Ans = 0

for i in range(1,N+1):
  #numlist[i] = Decimal(input()) * 1000000000
  wk = Decimal(input())
  wk = int(wk * 1000000000)

  #wk = numlist[i]
  for cnt in range(1,19):
    if wk % 2 == 0:
      log2[i] += 1
      wk = wk // 2
    else:
      break

  for cnt in range(1,19):
    if wk % 5 == 0:
      log5[i] += 1
      wk = wk // 5
    else:
      break

  acc[log2[i]][log5[i]] += 1
    
for i in range(0,19):
  for j in range(0,19): 
    for k in range(i,19):
      for l in range(0,19):
        if (i + k) >= 18 and (j + l) >= 18 and (i < k or (i == k and j <= l)):
          if acc[i][j] > 0 and acc[k][l] > 0:
            Ans += acc[i][j] * acc[k][l]
            if i >= 9 and j >= 9 and i == k and j == l:
              Ans -= int((acc[i][j] * (acc[i][j] + 1)) / 2)

print(int(Ans))
### BUGGY CODE ###

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

A.sort()
tmp = A.pop(-1)
index = 0
for _ in range(M):
  tmp //= 2
  if N > 1 and tmp < A[-1]:
    A.append(tmp)
    tmp = A.pop(-2)
    A.sort()
A.append(tmp)

print(sum(A))

### FIXED CODE ###

import heapq

def minus_int(s):
  return -1 * int(s)

N, M = map(int, input().split())
A = list(map(minus_int, input().split()))
heapq.heapify(A)
for _ in range(M):
  tmp = int(heapq.heappop(A) / 2)
  heapq.heappush(A, tmp)

print(sum(A) * (-1))
### BUGGY CODE ###

R, G, B, N = map(int, input().split())
r = 0
g = 0
X = N - r*R - g*G
num = 0
while X >= 0:
	while X >= 0:
			if X % B == 0:
				num += 1
			r += 1
			X = N - r*R - g*G
	g += 1
	r = 0
	X = N - r * R - g * G
 
print(num)

### FIXED CODE ###

R,G,B,N = map(int, input().split())
count = 0
for r in range(N // R + 1) :
    for g in range((N - r*R) // G + 1) :
        if (N - r*R - g*G) %B == 0 :
            count += 1
print(count)
### BUGGY CODE ###

from numpy.linalg import solve

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

mountains = [[0 for i in range(N)] for j in range(N)]

for i, mount in enumerate(mountains):
    if i != N - 1:
        mount[i] = 0.5
        mount[i+1] = 0.5
    else:
        mount[0] = 0.5
        mount[i] = 0.5

ans = solve(mountains, dam)

print(' '.join([str(int(x)) for x in solve(mountains, dam)]))


### FIXED CODE ###

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

mountains = [0] * N

x2 = 0
for i in range(N):
    if i % 2:
        x2 -= dam[i]
    else:
        x2 += dam[i]

mountains[0] = x2 // 2
for i in range(N-1):
    mountains[i+1] = dam[i] - mountains[i]

print(' '.join([str(x*2) for x in mountains]))
### BUGGY CODE ###

K = int(input())
S = input()
n = len(S)
MOD = 10 ** 9 + 7
MAX = 2 * 10 ** 6 + 5

fac = [0] * MAX
finv = [0] * MAX
inv = [0] * MAX
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD

def nCk(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

A = 0
for i in range(K + 1):
    A1 = (26 ** (K - i)) % MOD
    A2 = (((25 ** i) % MOD) * nCk(i + n - 1, n - 1)) % MOD
    A += (A1 * A2) % MOD
    A %= MOD

print(A % MOD)

### FIXED CODE ###

K = int(input())
S = input()
n = len(S)
MOD = 10 ** 9 + 7
MAX = 2 * 10 ** 6 + 5

fac = [0] * MAX
finv = [0] * MAX
inv = [0] * MAX
fac[0] = fac[1] = 1
finv[0] = finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
    fac[i] = fac[i - 1] * i % MOD
    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
    finv[i] = finv[i - 1] * inv[i] % MOD

def nCk(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD

A = 0
for i in range(K + 1):
    A1 = pow(26, K - i, MOD)
    A2 = (pow(25, i, MOD) * nCk(i + n - 1, n - 1)) % MOD
    A = (A + (A1 * A2) % MOD) % MOD

print(A % MOD)
### BUGGY CODE ###

N = int(input())
A = map(int, input().split())
MOD = 10**9 + 7

# p[n]: 最下位ビットからnビット目が1になっている数字の個数
p=[0] * 60
for a in A:
  for i in range(60):
    p[i] += (a>>i)&1

#print(p)
ans = 0
for i in range(60):
  # nビット目同士を足したときの合計
  sn = (N-p[i]) * p[i]
  ans = (ans + (sn << i)) % MOD

print(ans)

### FIXED CODE ###

N = int(input())
A = map(int, input().split())
MOD = 10**9 + 7

# p[n]: 最下位ビットからnビット目が1になっている数字の個数
p=[0] * 60
for a in A:
  for i in range(60):
    p[i] += (a>>i)&1

#print(p)
ans = 0
for i in range(60):
  # nビット目同士を足したときの合計
  sn = (N-p[i]) * p[i]
  ans = (ans + (sn << i)) % MOD

print(ans)
### BUGGY CODE ###

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

import math

if N%2==0:
    for i in range(math.ceil(N/2)):
        B+=str(A.index(i+1)+1)+' '
        C+=str(A.index(N//2+i+1)+1)+' '
    print(B+C[0:-1])
else:
    for i in range(math.ceil(N/2)):
        B+=str(A.index(i+1)+1)+' '
        C+=str(A.index(N//2+i+1)+1)+' '
    print(B+C[2:-1])    

### FIXED CODE ###

N=int(input())
A=list(map(int, input().split()))
B=[0]*N
C=''
 
for i in range(N):
    B[A[i]-1]=i+1
 
for i in range(N):
    C+=str(B[i])+' '
 
print(C[0:-1])
### BUGGY CODE ###

def compose():
    N = int( input() )
    t_list = list( map( int, input().split() ) )
    t_list.sort()
    t_list.reverse()
    counter = 0
    a = 0
    for i in t_list:
        a += 1
        b = a
        for j in t_list[a:]:
            b += 1
            new_list = [ k for k in t_list[b:] if k > i - j ]
            counter += len(new_list)
    return counter

def main():
    print(compose())
    
main()

### FIXED CODE ###

from bisect import bisect_left
N = int ( input() )
t_list = list ( map ( int, input().split() ) )
t_list.sort()
ans = 0

for i in range ( N - 2 ):
  a = t_list[i]
  for j in range ( i + 1, N - 1 ):
    b = t_list[j]
    c = bisect_left ( t_list , a + b)
    ans += c - j - 1
    
print(ans)
### BUGGY CODE ###

n = int(input())
x = list(map(int, input().strip().split()))
sum=0
for i in range(0,n-1):
    minsum=0
    for j in range(i+1,n):
        minsum += x[j]
        if(minsum>=1000000007):
            minsum-=1000000007
    sum += x[i]*minsum
sum%=1000000007
print(sum)

### FIXED CODE ###

n = int(input())
x = list(map(int, input().strip().split()))
sum=0
minsum=0
for i in range(0,n):
    minsum += x[i]
for i in range(0,n-1):
    minsum-=x[i]
    sum += x[i]*minsum
    if(sum>10**9+7):
        sum%=(10**9+7)
print(sum)
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
A = list(set(a))
flag = True
if n%2==0:
  if a.count(0)>0:
    flag=False
  else:
    for i in A:
      if a.count(i)!=2:
        flag=False
else:
  if a.count(0)!=1:
    flag=False
  else:
    A.pop(A.index(0))
    for j in A:
      if a.count(j)!=2:
        flag=False
if flag==True:
    print((2**(n//2))%(10**9+7))
else:
  print(0)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
A = list(set(a))
flag = True
if n%2==0:
  if a.count(0)>0 or len(A)!=len(a)//2:
    flag=False
else:
  if a.count(0)!=1 or len(A)!=len(a)//2+1:
    flag=False
if flag==True:
    print((2**(n//2))%(10**9+7))
else:
  print(0)
### BUGGY CODE ###

n, m = map(int,input().split())
s = input()
a = [0 for _ in range(m)]
for i in range(m):
    x, y = map(int,input().split())
    a[i] = s[x-1:y].count("AC")
print(*a,sep="\n")

### FIXED CODE ###

n, m = map(int,input().split())
dp = [0 for _ in range(n+1)]
S = input()
a = [0 for _ in range(m)]
for i in range(1,n):
    if S[i-1:i+1] == "AC":
        dp[i] = dp[i-1]+1
    else:dp[i] = dp[i-1]
for i in range(m):
    x, y = map(int,input().split())
    a[i] = dp[y-1] - dp[x-1]
print(*a,sep="\n")
### BUGGY CODE ###

#coding:utf-8
n, x, y = map(int, input().split())
anslist = []
for i in range(n-1):
    anslist.append(0)

for s in range(1,n):
    for p in range(s+1,n+1):
        dsp = abs(p - s)
        dsxp = abs(x - s) + abs(p - x)
        dsyp = abs(y - s) + abs(p - y)
        dsxyp = abs(x - s) + 1 + abs(p - y)
        dsyxp = abs(y - s) + 1 + abs(p - x)
        distance = min(dsp,dsxp,dsyp,dsxyp,dsyxp)
        anslist[distance - 1] += 1

for k in range(len(anslist)):
    print("{}".format(anslist[k]))

### FIXED CODE ###

#coding:utf-8
n, x, y = map(int, input().split())
anslist = []
for i in range(n-1):
    anslist.append(0)

for s in range(1,n):
    for p in range(s+1,n+1):
        distance = min(abs(p - s),abs(x - s) + 1 + abs(p - y),abs(y - s) + 1 + abs(p - x))
        anslist[distance - 1] += 1

for k in range(len(anslist)):
    print("{}".format(anslist[k]))
### BUGGY CODE ###

_ = input()
_list = input()
 
num_list = _list.split(' ')
 
for num in num_list:
  if num_list.count(num) > 1:
    print('NO')
    break
else:
  print('YES') 

### FIXED CODE ###

import collections

_ = input()
_list = input()
 
num_list = _list.split(' ')
 
c = collections.Counter(num_list)
if c.most_common()[0][1] > 1:
  print('NO')
else:
  print('YES')
### BUGGY CODE ###

s = input()[::-1]

n = len(s)
cnt = [0] * 2019
cnt[0] = 1
total = 0
ans = 0
x = 1

for i in range(n):
    total += int(s[i]) * x
    total %= 2019
    x *= 10
    ans += cnt[total]
    cnt[total] += 1

print(ans)


### FIXED CODE ###

s = input()[::-1]

n = len(s)
cnt = [0] * 2019
cnt[0] = 1
total = 0
ans = 0
x = 1

for i in range(n):
    total += int(s[i]) * x
    total %= 2019
    x *= 10
    x %= 2019
    ans += cnt[total]
    cnt[total] += 1

print(ans)
### BUGGY CODE ###

T = input()
out = []
i = 0
while(i < len(T)):
  if T[i] == "?":
    if (i+1 != len(T)) & (i-1 != -1):
      if T[i+1]=="D": 
        out.append("P")
        i += 1
      elif T[i-1]=="P": 
        out.append("D")
        i += 1
      elif T[i+1]=="?":
        out.append("PD")
        i += 2

    elif (i+1 == len(T)):
      out.append("D")
      i += 1

    elif (i-1 == -1):
      if T[i+1]=="D": 
        out.append("P")
        i += 1
      elif T[i+1]=="P": 
        out.append("D")
        i += 1
      elif T[i+1]=="?":
        out.append("PD")
        i += 2

  else:
    out.append(T[i])
    i += 1

  #print(out)

print("".join(out))


### FIXED CODE ###

T = input()
T_l = [t for t in T]

for i in range(len(T_l)):
  if T[i] =="?": T_l[i] = "D"

print("".join(T_l))
### BUGGY CODE ###

from collections import deque
from collections import Counter

def main():
    N,X,Y = list(map(int,input().split()))

    counter = Counter()
    for i in range(1,N+1):
        distance = [float("inf")]*(N+1)
        q = deque()
        q.append(i)
        distance[i] = 0
        while q:
            p = q.popleft()
            if p != 1 and p != N:
                if distance[p+1] == float("inf"):
                    if distance[p]+1 < distance[p+1]:
                        distance[p+1] = distance[p]+1
                        q.append(p+1)
                        counter[distance[p]+1] += 1
                if distance[p-1] == float("inf"):
                    if distance[p]+1 < distance[p-1]:
                        distance[p-1] = distance[p]+1
                        q.append(p-1)
                        counter[distance[p]+1] += 1
            elif p == 1:
                if distance[p+1] == float("inf"):
                    if distance[p]+1 < distance[p+1]:
                        distance[p+1] = distance[p]+1
                        q.append(p+1)
                        counter[distance[p]+1] += 1
            else:
                if distance[p-1] == float("inf"):
                    if distance[p]+1 < distance[p-1]:
                        distance[p-1] = distance[p]+1
                        q.append(p-1)
                        counter[distance[p]+1] += 1
            if p == X:
                if distance[p]+1 < distance[Y]:
                    distance[Y] = distance[p]+1
                    q.append(Y)
                    counter[distance[p]+1] += 1
            if p == Y:
                if distance[p]+1 < distance[X]:
                    distance[X] = distance[p]+1
                    q.append(X)
                    counter[distance[p]+1] += 1

    for i in range(1,N):
        print(counter[i]//2)

if __name__ == "__main__":
    main()

### FIXED CODE ###

from collections import Counter

def main():
    N,X,Y = list(map(int,input().split()))

    counter = Counter()
    for i in range(1,N):
        for j in range(i+1,N+1):
            d = min(j-i,abs(X-i)+abs(Y-j)+1)
            counter[d]+=1
    for i in range(1,N):
        print(counter[i])

if __name__ == "__main__":
    main()
### BUGGY CODE ###

N=int(input())
P=list(map(int,input().split()))
count=0
for index in range(N):
    P_new=P[:index+1]
    P_new.sort()
    if P_new[0]==P[index]:
        count+=1
print(count)

### FIXED CODE ###

N=int(input())
P=list(map(int,input().split()))
count=0
P_new=[]
for index in range(N):
    P_new.append(P[index])
    if P_new[0]>P_new[index]:
        P_new[0]=P_new[index]
    if P_new[0]==P[index]:
        count+=1
print(count)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(100000)

#%%
def dfs(gr,li,pt,n,fr):
    li[n] += pt
    if(len(gr[n])==1 and gr[n][0]==fr):
        return True
    else:
        for i in gr[n]:
            if(i==fr):continue
            dfs(gr,li,li[n],i,n)
        return True
#%%
N,Q = [int(x) for x in input().split()]
li = [0]*N
gp = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = [int(x) for x in input().split()]
    gp[a-1].append(b-1)
    gp[b-1].append(a-1)

for _ in range(Q):
    p,x = [int(x) for x in input().split()]
    li[p-1] += x

dfs(gp,li,0,0,-1)
print(*li)


### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    N,Q = [int(x) for x in input().split()]
    li = [0]*N
    gp = [[] for _ in range(N)]
    for _ in range(N-1):
        a,b = input().split()
        a = int(a)
        b = int(b)
        gp[a-1].append(b-1)
        gp[b-1].append(a-1)

    for _ in range(Q):
        p,x = input().split()
        li[int(p)-1] += int(x)

    st = []
    seen = set()
    st.append(0)
    while(st):
        x = st.pop()
        if(x in seen):continue
        seen.add(x)
        for i in gp[x]:
            if(i in seen):continue
            li[i]+=li[x]
            st.append(i)
    print(*li)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

m = 10**9
def score(point = 0, n = 0, now=-1, done=[]):
    global m
    if m <= n: return
    elif point >= g:
        if m > n: m = n
    elif point+100*(now+1)*P[now] >= g:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    else:
        done.append(now)
        if now == -1:
            for i in range(d):
                score(point, n, d-1-i, done[:])
        elif m <= n+P[now]: return
        else:
            for i in range(d):
                if not d-1-i in done:
                    score(point+P[now]*100*(now+1) + C[now], n + P[now], d-1-i, done[:])

score()
print(m)

### FIXED CODE ###

import math
 
d,g = [int(i) for i in input().split()]
P = []
C = []
for i in range(d):
    p,c = [int(i) for i in input().split()]
    P.append(p)
    C.append(c)

# cnt = 0
# def count():
#     global cnt
#     cnt+=1
#     print(cnt)

def flag(point,P,now):
    if point+100*(now+1)*(P-1) >= g: return 1
    elif point+100*(now+1)*P + C[now] >= g: return 2
    else: return 0

m = 10**9
def score(point = 0, n = 0, now=-1, remain = list(range(d))):
    global m
    if m <= n: return
    elif now == -1:
        for i in remain:
            score(point, n, i, remain)
    elif point >= g: m = n
    elif flag(point,P[now],now) == 1:
        n += math.ceil((g-point)/(100*(now+1)))
        if m > n: m = n
    elif flag(point,P[now],now) == 2:
        n += P[now]
        if m > n: m = n
    else:
        if m <= n+P[now]: return
        else:
            remain = remain[:]
            remain.remove(now)
            nxtp = point + P[now]*100*(now+1) + C[now]
            for i in remain:
                score(nxtp, n + P[now], i, remain)

score()
print(m)