Harryxun/stf_run huggingface dataset:
D,G=map(int,raw_input().split())

A=[map(int,raw_input().split()) for i in range(D)]

N=1000
dp=[ [ float("-inf") for i in range(N+100)]  for j in range(D) ] 

p=A[0][0]
c=A[0][1]


for i in range(1,p+1):
	if i==p: dp[0][i]=i*100+c
aa	else: dp[0][i]=i*100

for i in range(D):
	dp[i][0]=0



for k in range(1,D):
	p=A[k][0]    # number of problems per line
	c=A[k][1]    # bonus

	for i in range(N):		         #dp[k][i]
		for j in range(1,p+1):    #number of problems per line
			dp[k][i+j]=max( dp[k][i+j], dp[k-1][i]+j*(k+1)*100, dp[k-1][i+j] )
		dp[k][i+j]=max( dp[k][i+j], dp[k-1][i]+j*(k+1)*100+ac,dp[k-1][i+j] )



for idx,i in enumerate(dp[D-1]):
	if i>=G:
		print idx
		quit()
		


### FIXED CODE ###

D,G=map(int,raw_input().split())

A=[map(int,raw_input().split()) for i in range(D)]

N=1000
dp=[ [ float("-inf") for i in range(N+100)]  for j in range(D) ] 

p=A[0][0]
c=A[0][1]


for i in range(1,p+1):
	if i==p: dp[0][i]=i*100+c
	else: dp[0][i]=i*100

for i in range(D):
	dp[i][0]=0



for k in range(1,D):
	p=A[k][0]    # number of problems per line
	c=A[k][1]    # bonus

	for i in range(N):		         #dp[k][i]
		for j in range(1,p+1):    #number of problems per line
			dp[k][i+j]=max( dp[k][i+j], dp[k-1][i]+j*(k+1)*100, dp[k-1][i+j] )
		dp[k][i+j]=max( dp[k][i+j], dp[k-1][i]+j*(k+1)*100+c,dp[k-1][i+j] )



for idx,i in enumerate(dp[D-1]):
	if i>=G:
		print idx
		quit()
n,m=map(int,input().split())
if abs(n-m)>1: print(0)
else:
    mod=10**9+7
    fac=[0]*(n+1)
    fac[0]=1
    fac[1]=1
    def fact(k):
        if fac[k]>0: return fac[k]
        fac[k]=k*fact(k-1)%mod
        return fac[k]
    
    ans=(fact(n)*fact(m))%mod
    if n==m: print((2*ans)%mod)
    else: print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
if abs(n-m)>1: print(0)
else:
    mod=10**9+7
    def fact(n):
        ans=1
        for i in range(n):
            ans*=(i+1)
            ans%=mod
        return ans

    ans=(fact(n)*fact(m))%mod
    if n==m: print((2*ans)%mod)
    else: print(ans)
N = int(input())
a = (int(x) for x in input().split())
number =1

for i in a:
    if i==0:
        print(0)
        exit(0)
    number *= i
    if number>10**18:
            print(-1)
            exit(0)

print(number)

### FIXED CODE ###

A,B =(int(x) for x in input().split())
print(A*B)
N,M=input().strip().split()
l1=[]
while True:
    try:
        l1.append(list(map(int,input().split())))
    except:
        break;
l2=l1[-1]
del l1[-1]
n=0
tate=0
yoko=1
count1=0
count2=0
count3=0
while True:
    while True:        
        sw=str(bin(n))
        del sw[0]
        a=l1[tate][yoko]
        if int(sw[a])==1:
            count1=count1+1
        yoko=yoko+1
        if yoko==l1[tate][0]:
            yoko=1
            if count1%2==l2[tate]:
                count2=count2+1
            break
    tate=tate+1
    if tate==M:
        if count2==N:
            count3=1
        n=n=1
        break
        

### FIXED CODE ###

n,m=map(int,input().split())
a,c=[],0
for i in range(m):
    a.append(list(map(int,input().split())))
p=list(map(int,input().split()))
for i in range(2**n):
    i,b='0'*(n-len(bin(i))+2)+bin(i)[2:],0
    for j in range(m):
        f=0
        for k in range(a[j][0]):
            f+=int(i[a[j][k+1]-1])
        if f%2==p[j]:
            b+=1
    if b==m:
        c+=1
print(c)
n = input()
x = n%10
if x == 3 :
  print("bon")
else x == 0 || x == 1 || x == 6 || x == 8 :
  print("pon")
else :
  print("hon")

### FIXED CODE ###

n = int(input())
d = int(str(n)[-1])
t = {'bon':[3], 'pon':[0,1,6,8], 'hon':[2,4,5,7,9]}
for s in t:
  if d in t[s]:
    print(s)
def fib(n):
    a, b = 1, 1
    if n == 1:
        return a
    elif n == 2:
        return b
    else:
        for i in range(n-2):
            a, b = b, a + b
        return b

n,m = map(int,input().split())
if m != 0:
  a = [int(input()) for i in range(m)]
  ans = fib(a[0])
  for j in range(1,m):
    if m == 1:
        continue
    elif a[j] == a[j-1]+1:
        ans = 0
    else:
        ans *= fib(a[j]-a[j-1]-1)
  ans *= fib(n-a[m-1])
else:
  ans = fib(n+1)
print(ans%1000000007)


### FIXED CODE ###

a,b,c = map(int, input().split())
print(min(a+b,b+c,c+a))
S = input()
S.sort()
if S = "abc":
  print("Yes")
else:
  print("No")

### FIXED CODE ###

S = sorted(input())
if S == sorted('abc'):
    print('Yes')
else:
    print('No')
from functools import reduce

def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a

def solve(N, As):
    init_gcd = reduce(gcd, As, 0)
    Bs = list(map(lambda x: x // init_gcd, As))
    x = 1

    if N == 2:
        print(max(As[0], As[1]))
        raise "hoge"
    else:
        for idx, (b1, b2) in enumerate(zip(Bs, Bs[1:])):
            if gcd(b1, b2) == 1:
                gcd1 = reduce(gcd, Bs[:idx] + [b2] + Bs[idx + 1:], 0)
                gcd2 = reduce(gcd, Bs[:idx + 1] + [b1] + Bs[idx + 2:], 0)
                x = max(gcd1, gcd2)
                break
        print(init_gcd * x)
        return


if __name__ == '__main__':
    N = int(input()) # ignore
    As = list(map(int, input().split()))
    solve(N, As)


### FIXED CODE ###

from functools import reduce

def gcd(a, b):
    while b > 0:
        a, b = b, a % b
    return a

def solve(N, As):
    Lgcd = [0 for _ in range(len(As) + 1)]
    Rgcd = [0 for _ in range(len(As) + 1)]
    for i in range(len(As)):
        Lgcd[i + 1] = gcd(Lgcd[i], As[i])
    for i in reversed(range(len(As))):
        Rgcd[i] = gcd(Rgcd[i + 1], As[i])
    ans = 1
    for i in range(len(As)):
        ans = max(ans, gcd(Lgcd[i], Rgcd[i + 1]))
    print(ans)


if __name__ == '__main__':
    N = int(input()) # ignore
    As = list(map(int, input().split()))
    solve(N, As)
A, B = map(int, input().split())

if A => 13:
  print(B)
elif A => 6:
  print(B/2)
else:
  print(0)

### FIXED CODE ###

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

if A >= 13:
  print(B)
elif 12 >= A >= 6:
  print(int(B/2))
elif 5 >= A >= 0:
  print(0)
s = input()

def solve(i):
    if i == 1:
        if s[i - 1] == s[i]:
            return 1
        else:
            return 2
    if i == 0:
        return 0

    if s[i] != s[i - 1]:
        return solve(i - 1) + 1
    else:
        return solve(i - 3) + 2


print(solve(len(s) - 1))


### FIXED CODE ###

import sys

sys.setrecursionlimit(2000000)

s = input()

def solve(i):
    if i == 2:
        if s[i - 1] == s[i]:
            return 2
        else:
            return solve(i - 1) + 1
    if i == 1:
        if s[i - 1] == s[i]:
            return 1
        else:
            return 2
    if i == 0:
        return 1

    if s[i] != s[i - 1]:
        return solve(i - 1) + 1
    else:
        return solve(i - 3) + 2


print(solve(len(s) - 1))
a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min[a,b] + min[c,d])

### FIXED CODE ###

a = int(input())
b = int(input())
c = int(input())
d = int(input())

print(min([a,b]) + min([c,d]))
n=int(input())
a=int(input())
b=int(input())
print("Hello World" if n==1 else a+b)


### FIXED CODE ###

n=int(input())

print("Hello World" if n==1 else int(input())+int(input()))
N,K=map(int,input().split())

sweet=[0 for i in range(N+1)]

d=[]
A=[]
for i in range(K):
    d.append(int(input()))
    A.append(list(map(int,input().split())))

for i in d:
    for j in range(i):
        for k in range(len(A[j])):
            sweet[A[j][k]]=1

num=0
for i in range(1,N):
    if sweet[i]==0:
        num+=1

print(num)

### FIXED CODE ###

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

sweet=[0 for i in range(N+1)]

d=[]
A=[]
for i in range(K):
    d.append(int(input()))
    A.append(list(map(int,input().split())))

for i in range(len(d)):
    for j in range(d[i]):
        sweet[A[i][j]]+=1

num=0
for i in range(1,len(sweet)):
    if sweet[i]==0:
        num+=1
print(num)
l,r = map(int, input().split())
if (r - l >= 2019):
  print(0)
else:
  res = []
  for i in range(l, r + 1):
    res.append(i % 2019)
  res.sort()
  ans = 2019 * 2019
  for hoge in res:
    for fuga in res:
      if(ans > ((res[hoge] * res[fuga]) % 2019):
        ans = (res[hoge] * res[fuga]) % 2019
  print(ans)

### FIXED CODE ###

l,r = map(int, input().split())
if (r - l >= 2019):
  print(0)
else:
  res = []
  for i in range(l, r + 1):
    res.append(i % 2019)
  res.sort()
  ans = 2019 * 2019
  for hoge in res:
    for fuga in res:
      if(hoge != fuga and ans > ((hoge * fuga) % 2019)):
        ans = (hoge * fuga) % 2019
  print(ans)
def tenth(int a):
  temp = a
  if temp % 10 == 0:
    return temp
  else:
    temp += 1

a = tenth(int(input()))
b = tenth(int(input()))
c = tenth(int(input()))
d = tenth(int(input()))
e = int(input())

print(a + b + c + d + e)


### FIXED CODE ###

def tenth(a):
  temp = a
  while True:
    if temp % 10 == 0:
      return temp
    else:
      temp += 1

li = list()
ans = 0

for i in range(5):
  li.append(int(input()))
  ans += tenth(li[i])
  li[i] = tenth(li[i]) - li[i]
  
ans -= max(li)

print(ans)
import math
def main():
    r = int(input())
    s = math.pi * r ** 2
    l = r * 2 * math.pi
    print(s, l)


if __name__ == "__main__":
    main()

### FIXED CODE ###

import math
def main():
    r = float(input())
    s = math.pi * r ** 2
    l = r * 2 * math.pi
    print(format(s, ".6f"), format(l, ".6f"))


if __name__ == "__main__":
    main()
print(max(0,a-b*2))

### FIXED CODE ###

a,b=map(int,input().split())
print(max(0,a-b*2))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline

MATCH_NUM = [-1, 2, 5, 5, 4, 5, 6, 3, 7, 6]

def main():
    N, M = [int(e) for e in input().split()]
    A = [int(e) for e in input().split()]

    # N 本で作れる桁の数
    dp = [-1 for _ in range(N+1)]
    dp[0] = 0
    dp[1] = 0
    for i in range(N+1):
        for a in A:
            dp[i] = max(dp[i], dp[i-MATCH_NUM[a]] + 1)

    max_digit_num = dp[N]

    A.sort(reverse=True)

    min_cost = 10
    for a in A:
        if MATCH_NUM[a] < min_cost:
            min_cost = MATCH_NUM[a]

    res = ''
    for i in range(max_digit_num):
        for a in A:
            if dp[N-MATCH_NUM[a]] == dp[N]-1:
                if N-MATCH_NUM[a] < min_cost and N-MATCH_NUM[a] != 0:
                    continue
                res += str(a)
                N -= MATCH_NUM[a]
                break
    print(res)
main()


### FIXED CODE ###

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

import sys

input = sys.stdin.readline

MATCH_NUM = [-1, 2, 5, 5, 4, 5, 6, 3, 7, 6]

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

    # N 本で作れる桁の数
    dp = [-1 for _ in range(N+1)]
    dp[0] = 0
    for i in range(N+1):
        for a in A:
            if i < MATCH_NUM[a]:
                continue
            dp[i] = max(dp[i], dp[i-MATCH_NUM[a]] + 1)

    max_digit_num = dp[N]

    res = ''
    for _ in range(max_digit_num):
        m = -1
        for a in A:
            if N < MATCH_NUM[a]:
                continue
            if dp[N-MATCH_NUM[a]] == dp[N]-1:
                if a > m:
                    m = a
        res += str(m)
        N -= MATCH_NUM[m]
    print(res)
main()
import sys

n = int(input())

a = []
for i in range(n):
  v = list(map(int, input().split(' ')))
  a.append(v)

f = True
day = 1
while(f):
  done = []
  nokori_games = []
  
  for m in range(n):
    nokori_games[m] = len(a[m])
    if m in done:
      pass
    elif nokori_games[m]:
      teki = a[m][0]
      jibun = m + 1
      if not len(a[teki - 1]):
        print(-1)
        sys.exit()
      elif a[teki - 1][0] == jibun and teki - 1 not in done:
        a[m].pop(0)
        a[teki - 1].pop(0)
        done.append(m)
        done.append(teki - 1)
        nokori_games[m] -= 1
  if not sum(nokori_games):
    print(day)
    sys.exit()
  else:
    if not len(done):
      print(-1)
      sys.exit()
  day += 1

### FIXED CODE ###

import sys
import time
from collections import deque

start = time.time()

input = sys.stdin.readline

n = int(input())
a = [deque([x for x in list(map(int, input().split()))]) for _ in range(n)]
nokori_games = n * (n - 1) / 2 
day = 1
r5000 = range(5000)
player_in_this_game = set()
rn = range(n)
for _ in r5000:
  for m in rn: #選手ごとに判定
    #整合性のある対戦組み合わせがあれば配列から消す
    #全員の判定が終わって試合が残っていたら1日増やす
    if m in player_in_this_game:
      #自分が既に試合が組まれている
      continue

    la = len(a[m])      
    if la: #選手に試合予定が残っている
      teki = a[m][0] #対戦相手
      jibun = m + 1 #自分
      teki_idx = teki - 1
      if teki_idx in player_in_this_game:
        #相手が既に試合に組まれている
        continue

      if a[teki_idx][0] == jibun: #対戦相手の予定も自分でかつ相手がこのターンで試合中ではない
        a[m].popleft() #自分の予定を消す
        a[teki_idx].popleft() #相手の予定を消す
        player_in_this_game.add(m) #自分を試合中にする
        player_in_this_game.add(teki_idx) #相手を試合中にする
        nokori_games -= 1 #残り試合予定を1つ減らす

  if nokori_games: #残り試合があるのに
    if not len(player_in_this_game): #今回対戦が組まれなければ残りの予定が不整合なのでエラー
      print(-1)
      sys.exit()
  else: #誰も残り試合予定がなければ終了
    print(day)
    sys.exit()
  day += 1
  player_in_this_game.clear()
  elapsed_time = time.time() - start
  if elapsed_time > 1:
    print(n*(n-1)//2)
    exit()
n,t = int(input().split())
m = 10000
for i in range(n):
    c,d = int(input().split())
    if d <= t:
        if m > c:
            m = c
if m = 10000:
    print('TLE')
else:
    print(m)

### FIXED CODE ###

n,t = map(int,input().split())
m = 10000
for i in range(n):
    c,d = map(int,input().split())
    if d <= t:
        if m > c:
            m = c
if m == 10000:
    print('TLE')
else:
    print(m)
def main():
	n = int(input())
	l = [str(input()) for i in range(n)]
	
	import collections

	c = collections.Counter(l)
	lc = sorted(list(c.items()), key = lambda x:x[1] , reverse = True)
	print(lc)
	ans = []
	checker = 0
	i = 0
	while checker == 0:
		if lc[i][1] == lc[0][1]:
			ans.append(lc[i][0])
		else:
			checker += 1
		i += 1

	ans.sort()
	print('\n'.join(map(str, ans)))

	
	
 
if __name__ == '__main__':
	main()

### FIXED CODE ###

def main():
	# n,m = map(int,input().split())
	n = int(input())
	l = [str(input()) for i in range(n)]
	
	import collections

	c = collections.Counter(l)
	lc = sorted(list(c.items()), key = lambda x:x[1] , reverse = True)
	# print(lc[0][0])
	ans = []
	checker = 0
	i = 0
	while checker == 0 and i < len(lc):
		if lc[i][1] == lc[0][1]:
			ans.append(lc[i][0])
		else:
			checker += 1
		i += 1

	# keys = [k for k, v in c.items() if v == max(c.values())]
	# print(list(c.items())[0][0])
	# checker = 0
	# while checker == 0:
	# 	if c.items() == max(c.values()):
	ans.sort()
	print('\n'.join(map(str, ans)))

	
	
 
if __name__ == '__main__':
	main()
H,W = list(map(int,input().split()))
a = [input() for i in range(H)]

for i in range(H+2):
  if i==0 or i==H+1:
    print("#"*(W+2))
  else:
    print("#"+a[i-1]+"#")


### FIXED CODE ###

a = list(map(int,input().split()))
b = [1,3,5,7,8,10,12]
c = [4,6,9,11]
d = [2]
e = 0

if a[0] in b and a[1] in b:
  e += 1
elif a[0] in c and a[1] in c:
  e += 1

if e == 1:
  print("Yes")
else:
  print("No")
s=input()
a=["SUN","MON","TUE","WED","THU","FRI","SAT"]
print(7-a.index(a))


### FIXED CODE ###

s=input()
a=["SUN","MON","TUE","WED","THU","FRI","SAT"]
print(7-a.index(s))
N = int(input())
A = list(map(int,input().split(' ')))
num = 0
X = []
for i,j in enumerate(A):
  B = j-(i+1)
  X.append(B)
X.sort()
median = 0
if N % 2 == 0:
  median = (X[N/2] + X[N/2-1])/2
else:
  median = X[int((N-1)/2)] 

for x in X:
  num += abs(x-median)
print(num)         

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split(' ')))
num = 0
X = []
for i,j in enumerate(A):
  B = j-(i+1)
  X.append(B)
X.sort()
median = 0
if N % 2 == 0:
  median = (X[int(N/2)] + X[int(N/2-1)])/2
else:
  median = X[int((N-1)/2)] 

for x in X:
  num += abs(x-median)
print(int(num))
x = int(input())
if x > 30:
  print("Yes")
else
  print("No")

### FIXED CODE ###

x = int(input())
if x >= 30:
  print("Yes")
else:
  print("No")
h,a=map(int,input.split())
cnt=0
while True:
    h-=a
    cnt+=1
    if h<=0:
        break
print(cnt)

### FIXED CODE ###

h,a=map(int,input().split())
cnt=0
while True:
    h-=a
    cnt+=1
    if h<=0:
        break
print(cnt)
x = input()
i = list(map(int,x))
??
i.sort
print(i)

### FIXED CODE ###

x = input().split()
i = list(map(int,x))
 
i.sort()
print('{} {} {}'.format(i[0],i[1],i[2]))
from fractions import gcd
from functools import reduce

N = int(input())
A = [int(x) for x in input().split()]

memo = set()


def __gcd(a, b):
    if (a, b) in memo:
        return memo[a, b]
    else:
        if a < b:
            a, b = b, a
        memo.add((a, b))
        return gcd(a, b)


def _gcd(*A):
    return reduce(__gcd, A)


ans = 0
for i in range(N):
    B = A[:i] + A[i + 1:]
    x = _gcd(*B)
    ans = max(ans, x)
print(ans)


### FIXED CODE ###

from fractions import gcd

N = int(input())
A = [int(x) for x in input().split()]

L = [0] * (N + 1)
R = [0] * (N + 1)
for i in range(N):
    L[i + 1] = gcd(L[i], A[i])
for i in range(N - 1, 0, -1):
    R[i] = gcd(R[i + 1], A[i])

ans = 0
for i in range(N):
    ans = max(ans, gcd(L[i], R[i + 1]))
print(ans)
a,b,c,d = map(int,list(input()))
for i in range(2):
    if i==0:
        ans=a+b
    else:
        ans=a-b
    for j in range(2):
        if j==0:
            ans+=c
        else:
            ans-=c
        for k in range(2):
            if k==0:
                ans+=d
            else:
                ans-=d
            if ans==7:
                ret=[i,j,k]
for i in range(len(ret)):
    if ret[i]==0:
        ret[i]='+'
    else:
        ret[i]='-'
print('{}{}{}{}{}{}{}=7'.format(a,ret[0],b,ret[1],c,ret[2],d))


### FIXED CODE ###

a,b,c,d = map(int,list(input()))
for i in range(2):
    if i==0:
        ans=a+b
    else:
        ans=a-b
    r1=ans
    for j in range(2):
        ans=r1
        if j==0:
            ans+=c
        else:
            ans-=c
        r2=ans
        for k in range(2):
            ans=r2
            if k==0:
                ans+=d
            else:
                ans-=d
            if ans==7:
                ret=[i,j,k]
                for i in range(len(ret)):
                    if ret[i]==0:
                        ret[i]='+'
                    else:
                        ret[i]='-'
                print('{}{}{}{}{}{}{}=7'.format(a,ret[0],b,ret[1],c,ret[2],d))
                exit()
N = int(input())
S = [list(input()) for i in range(N)]
T = []

for l in range(N):
  S[l].sort()
  T[l] = T[l].append(''.join(S[l]))

ans = 0
for j in range(N):
  for k in range(j+1,N):
    if S[j][0] == S[k][0]:
      if S[j][N-1] == S[k][N-1]:
        if T[j] == T[k]:
          ans += 1


          
print(ans)

### FIXED CODE ###

from operator import itemgetter
N = int(input())
S = [list(input()) for i in range(N)]

for l in range(N):
  S[l].sort()
  S[l] = ''.join(S[l]) 

S.sort()

X = []
p = 1

for j in range(N-1):
  if S[j] == S[j+1]:
    p +=1
  else:
    X.append(p)
    p = 1
X.append(p)


def comb(n):
  if n == 2: return 1
  else:
    return int(n*(n-1)/2)

ans = 0

for k in range(len(X)):
  ans += comb(X[k])

print(ans)
import collections
 
n = int(input())
v = [int(i) for i in input().split()]
 
v1 = [v[i] for i in range(0,n,2)]
v2 = [v[i] for i in range(1,n,2)]
 
count1 = collections.Counter(v1).most_common(2)
count2 = collections.Counter(v2).most_common(2)

if max(count1.values()) != max(count2.values()):
    res = len(v1) - max(count1.values()) + len(v2) - max(count2.values())
    print(res)
else:
    if len(count1) == 1:
        print(len(v1))
    else:
        res1 = len(v1) - count1[0][1] + len(v2) - count2[1][1]
        res2 = len(v1) - count1[1][1] + len(v2) - count2[0][1]
        print(min(res1,res2))


### FIXED CODE ###

import collections
 
n = int(input())
v = [int(i) for i in input().split()]
 
v1 = [v[i] for i in range(0,n,2)]
v2 = [v[i] for i in range(1,n,2)]
 
count1 = collections.Counter(v1).most_common(2)
count2 = collections.Counter(v2).most_common(2)

if count1[0][0] != count2[0][0]:
    res = len(v1) - count1[0][1] + len(v2) - count2[0][1]
    print(res)
else:
    if len(count1) == 1:
        print(len(v1))
    else:
        res1 = len(v1) - count1[0][1] + len(v2) - count2[1][1]
        res2 = len(v1) - count1[1][1] + len(v2) - count2[0][1]
        print(min(res1,res2))
a,b,c,d,e,k=map(int,input())
if e-a>k:
  print(':(')
else:
  print('Yay!')

### FIXED CODE ###

# coding: utf-8
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
k=int(input())
if e-a>k:
  print(':(')
else:
  print('Yay!')
n = int(input())
if n==1:
  print(int(input()))
else:
  ab = [[0] * n for i in range(3)]
  for i in range(n):
    ab[0][i], ab[1][i] = map(int, input().split())
    ab[2][i] = ab[0][i] + ab[1][i]
  sorted(ab, key=lambda x: x[2])
  print(sum(ab[0][0::2])-sum(ab[1][1::2]))


### FIXED CODE ###

# C
n = int(input())
if n==1:
    a, b =map(int, input().split())
    print(a)
else:
    def return_a(n):
        return n[0]
    def return_b(n):
        return n[1]
    ab = [[0] * 3 for i in range(n)]
    for i in range(n):
        ab[i][0], ab[i][1] = map(int, input().split())
        ab[i][2] = ab[i][0] + ab[i][1]
    ab = sorted(ab, key=lambda x: x[2], reverse=True)
    print(sum(map(return_a, ab[0::2])) - sum(map(return_b, ab[1::2])))
N = int(input())
T, A = map(int, input().split())
H = list(map(int,input().split()))
ans = 100
for i in N:
    s = T - i*0.006
    ans = min(A-s,ans) 
print(ans)

### FIXED CODE ###

N = int(input())
T, A = map(int, input().split())
H = list(map(int,input().split()))
ans= 0
tmp = 100000
for i in range(N):
    s = T - H[i]*0.006
    if tmp > abs(A - s):
        tmp = abs(A - s )
        ans = i + 1
print(ans)
N,Q = map(int,input().split())
event = []
for i in range(N):
    s,t,x = map(int,input().split())
    event.append((s-x,x,1))
    event.append((t-x,x,-1))

s = set()

event.sort()
event.reverse()


for i in range(Q):
    D = int(input())
    f = False
    while event:
        t,x,e = event.pop()
        if D < t:
            f = True
            break
        if e == 1:
            s.add(x)
        else:
            s.remove(x)
    if len(s)==0:
        print(-1)
    else:
        print(min(s))
    if f:
        if e == 1:
            s.add(x)
        else:
            s.remove(x)

### FIXED CODE ###

from bisect import bisect_left as bisect
N,Q = map(int,input().split())
event = [tuple(map(int,input().split())) for i in range(N)]
D = [int(input()) for i in range(Q)]

event.sort(key=lambda x:x[2])

ans = [-1]*Q
neg = [-1]*Q

for s,t,x in event:
    l = bisect(D,s-x)
    r = bisect(D,t-x)
    t = l
    while t < r:
        if neg[t] == -1:
            ans[t] = x
            neg[t] = r
            t += 1
        else:
            t = neg[t]

for i in range(Q):
    print(ans[i])
n = int(input())

l = [0]*(n+1)
for i in range(2, n+1):
  cur = i
  for j in range(2, i+1):
    while cur % j == 0:
      cur //= j
      l[j] == 1

def num(s):
  return len(list(filter(lambda x: m-1 > x, l)))

print(num(75)+num(25)*(num(3)-1)+num(15)*(num(5)-1)+(num(5)*(num(5)-1)*(num(3)-2))//2)

### FIXED CODE ###

n = int(input())

l = [0]*(n+1)
for i in range(2, n+1):
  cur = i
  for j in range(2, i+1):
    while cur % j == 0:
      cur //= j
      l[j] += 1

def num(s):
  return len(list(filter(lambda x: x >= s-1, l)))

print(num(75)+num(25)*(num(3)-1)+num(15)*(num(5)-1)+num(5)*(num(5)-1)*(num(3)-2)//2)
#ABC154A
import sys
from collections import OrderedDict
d = OrderedDict()
s,t = sys.stdin.readline().split()
n1, n2 = map(int, sys.stdin.readline().split())
d[s] = n1
d[t] = n2

d[sys.stdin.readline()] -=1

print(*d.values())

### FIXED CODE ###

#ABC154A
import sys
from collections import OrderedDict
d = OrderedDict()
s,t = sys.stdin.readline().split()
n1, n2 = map(int, sys.stdin.readline().split())
d[s] = n1
d[t] = n2

d[sys.stdin.readline().rstrip()] -=1

print(*d.values())
import math
a,b=input().split()
n=int(a+b)
pritn("Yes" if math.sqrt(n)%1==0 else "No")

### FIXED CODE ###

import math
a,b=input().split()
n=int(a+b)
print("Yes" if math.sqrt(n).is_integer() else "No")