Harryxun/stf_run huggingface dataset:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
X = 0
for i in range(N):
    if(V[i]-C[i] > 0):
        X += V[i] - C[i]
print(int(X))

### FIXED CODE ###

A,B,T=map(int, input().split())
t_max = int((T+0.5)/A)
print(t_max*B)
import copy
import math
n, k = map(int, input().split())
a=[]
a=list(map(int, input().split()))
b=copy.copy(a)
ans=0
b.extend(a)
#print(b)
#print(b[n])

def fact(i):
    sum=1
    for j in range(1,k):
        sum*=j
    return j
        
    """
    if i==1:
        return 1
    else:
        return i*fact(i-1)
    """

for i in range(len(b)):
    tmp=0
    for j in range(i+1,len(b)):
        if j<n:
            if b[i]>b[j]:
                #print("B["+str(i)+"]:" + str(b[i])+" B["+str(j)+"]:"+str(b[j]))
                ans+=1
        else:
            if b[i]>b[j]:
                #print("B["+str(i)+"]:" + str(b[i])+" B["+str(j)+"]:"+str(b[j])+"#")
                tmp+=1
    tmp=int((tmp*sum(list(range(1,k))))%(1e+9+7))
    ans=int((ans+tmp)%(1e+9+7))
print(ans)

#ans=int((ans+1)%(1e+9+7))

### FIXED CODE ###

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

ans_mono=0
ans_di=0
for i in range(n):
    for j in range(i+1,n):
        if a[i]>a[j]:ans_mono+=1
for i in range(n):
    for j in range(n):
        if a[i]>a[j]:ans_di+=1
print((ans_mono*k+ans_di*(k*(k-1)//2))%int(1e+9+7))
N=int(input())
A=int(input())
B=int(input())
t1=N*A
t2=B
if t1<B:
      tmin=t1
      print(tmin)
else:
      tmin=B
      print(tmin)
      


### FIXED CODE ###

n,a,b=map(int,input().split())
if(n*a>=b):
    print(b)
else:
    print(n*a)
import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

n, m = map(int, input().split())
if n % 2 == 0:
    n -= 1
ans = []
if m % 2 == 0:
    right_range = n//2
    left_range = n//2 - 1
else:
    left_range = n//2
    right_range = n//2 - 1
left1 = 1
right1 = 1 + left_range
left2 = right1 + 1
right2 = left2 + right_range

for i in range(left_range):
    left1 += i
    right1 -= i
    if left1 >= right1:
        break
    ans.append([left1, right1])

for i in range(right_range):
    left2 += i
    right2 -= i
    if left2 >= right2:
        break
    ans.append([left2, right2])
    
for i in range(m):
    print(*ans[i])    




### FIXED CODE ###

import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")

n, m = map(int, input().split())
if n % 2 == 0:
    n -= 1
ans = []
left_range = n//2
right_range = n//2 - 1
left1 = 1
right1 = 1 + left_range
left2 = right1 + 1
right2 = left2 + right_range

while True:
    if left1 >= right1:
        break
    ans.append([left1, right1])
    left1 += 1
    right1 -= 1

while True:
    if left2 >= right2:
        break
    ans.append([left2, right2])
    left2 += 1
    right2 -= 1
    
for i in range(m):
    print(*ans[i])
s = input()
s[1] = "R"
print(s)

### FIXED CODE ###

s = input()
if s == "ABC":
  print("ARC")
else:
  print("ABC")
from collections import defaultdict
n, k = map(int, input().split())
dic = defaultdict(int)
for _ in range(n):
  a, b = map(int, input().split())
  dic[a] += b
dic = sorted(dic, key = lambda x: x[0])
cnt = 0
for key in dic:
  if cnt + dic[key] < k:
    cnt += dic[key]
  else:
    print(key)
    break
    

### FIXED CODE ###

from collections import defaultdict
n, k = map(int, input().split())
dic = defaultdict(int)
for _ in range(n):
  a, b = map(int, input().split())
  dic[a] += b
cnt = 0
for key in sorted(dic):
  if cnt + dic[key] < k:
    cnt += dic[key]
  else:
    print(key)
    break
import numpy as np
n = int(input())
v = list(map(int, input().split()))
v_odd = []
v_even = []
for i in range(n):
  if i%2 == 0:
    v_odd.append(v[i])
  else:
    v_even.append(v[i])

vs_odd = np.array(v_odd)
vs_even = np.array(v_even)
count_odd = np.bincount(vs_odd)
count_even = np.bincount(vs_even)
mode_odd = np.argmax(count_odd)
mode_even = np.argmax(count_even)
a = v_odd.count(mode_odd)
b = v_even.count(mode_even)
if mode_odd != mode_even:
  print(n-a-b)
else:
  if len(v_odd) != v_odd.count(mode_odd):
    v_odd2 = [i for i in v_odd if i != mode_odd]
    vs_odd2 = np.array(v_odd2)
    count_odd2 = np.bincount(vs_odd2)
    mode_odd2 = np.argmax(count_odd2)
    a2 = v_odd.count(mode_odd2)
  else:
    a2 = 0
    if len(v_even) != v_even.count(mode_even):
      v_even2 = [i for i in v_even if i != mode_even]
      vs_even2 = np.array(v_even2)
      count_even2 = np.bincount(vs_even2)
      mode_even2 = np.argmax(count_even2)
      b2 = v_even.count(mode_even2)
    else:
      b2 = 0
  if a2 > b2:
    print(n-a2-b)
  else:
    print(n-a-b2)

### FIXED CODE ###

import numpy as np
n = int(input())
v = list(map(int, input().split()))
v_odd = []
v_even = []
for i in range(n):
  if i%2 == 0:
    v_odd.append(v[i])
  else:
    v_even.append(v[i])

vs_odd = np.array(v_odd)
vs_even = np.array(v_even)
count_odd = np.bincount(vs_odd)
count_even = np.bincount(vs_even)
mode_odd = np.argmax(count_odd)
mode_even = np.argmax(count_even)
a = v_odd.count(mode_odd)
b = v_even.count(mode_even)
if mode_odd != mode_even:
  print(n-a-b)
else:
  if len(v_odd) != v_odd.count(mode_odd):
    v_odd2 = [i for i in v_odd if i != mode_odd]
    vs_odd2 = np.array(v_odd2)
    count_odd2 = np.bincount(vs_odd2)
    mode_odd2 = np.argmax(count_odd2)
    a2 = v_odd.count(mode_odd2)
  else:
    a2 = 0
  if len(v_even) != v_even.count(mode_even):
    v_even2 = [i for i in v_even if i != mode_even]
    vs_even2 = np.array(v_even2)
    count_even2 = np.bincount(vs_even2)
    mode_even2 = np.argmax(count_even2)
    b2 = v_even.count(mode_even2)
  else:
    b2 = 0
  if a2 > b2:
    print(n-a2-b)
  else:
    print(n-a-b2)
p, q, r = map(int, input().split())
p + q = a
q + r = b
r + p = c
print(min(a,min(b,c)))

### FIXED CODE ###

p, q, r = map(int, input().split())
a = p + q  
b = q + r
c = r + p 
print(min(a,min(b,c)))
i = 1
while True:
  n = input()
  if n == 0:
    break
  print("Case {0}: {1}").format(i,n)
  i++

### FIXED CODE ###

i = 1
while True:
  n = input()
  if n == "0":
    break
  print("Case {0}: {1}".format(i,n))
  i += 1
n=int(input())
s=list(map(int,input()))
for i in range(n):
  print(s.count(i+1))

### FIXED CODE ###

n=int(input())
s=list(map(int,input().split()))
k=[0]*n
for i in s:
  k[i-1]+=1
for i in k:
  print(i)
S = int(input())

if S < 3:
    print(0)
    exit()

ans = [0 for _ in range(S+1)]

ans[3] = 1
ans[4] = 1
ans[5] = 1

for i in range(6, S+1):
    ans[i] = ans[i-3] + ans[i-1]

print(ans[S] % 1000000007)


### FIXED CODE ###

S = int(input())

if S < 3:
    print(0)
    exit()

ans = [0 for _ in range(2001)]

ans[3] = 1
ans[4] = 1
ans[5] = 1

for i in range(6, S+1):
    ans[i] = ans[i-3] + ans[i-1]

print(ans[S] % 1000000007)
import sys
sys.setrecursionlimit(100000)
N, Q = map(int, input().split())
paths = [list() for _ in range(N+1)]
for _ in range(N-1):
    a, b = map(int, input().split())
    paths[a].append(b)
# ab = [list(map(int, input().split())) for _ in range(N-1)]
px = [list(map(int, input().split())) for _ in range(Q)]

nodes = [0]*(N+1)
childs = [list() for _ in range(N+1)]

def dfs(root, node, arr):
    arr[root].append(node)
    for loof in paths[node]:
        dfs(root, loof, arr)

for i in range(1, N+1):
    dfs(i, i, childs)


for op in px:
    for child in childs[op[0]]:
        nodes[child] += op[1]

for i in range(1, N+1):
    print(nodes[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(400000)
N, Q = map(int, input().split())
paths = [list() for _ in range(N+1)] # paths[i] : 頂点iと繋がってる点を全て表す
for _ in range(N-1):
    a, b = map(int, input().split())
    paths[a].append(b)
    paths[b].append(a)
# ab = [list(map(int, input().split())) for _ in range(N-1)]
px = [list(map(int, input().split())) for _ in range(Q)]

ans = [0]*(N+1) # ans[i] : 頂点iについて答える値を格納

counters = [0]*(N+1) # そのノードの部分木に与える点数の総和を格納
for x in px:
    counters[x[0]] += x[1]

visit = [0]*(N+1) #dfsをする時に一度訪れた点に再訪しないための確認
def dfs(node, score, ans):
    visit[node] = 1 # 訪問したことを記録
    score += counters[node] # 自分の部分木に加点する分を加えて後世に残す
    ans[node] = score # 点数の記録
    for loof in paths[node]: # 自分と繋がってる各ノードについて
        if visit[loof] == 0: # まだ探索していなければ
            dfs(loof, score, ans) # 探索

dfs(1, 0, ans)
    

for i in range(1, N+1):
    print(ans[i])
n = int(input())
x = input()

x_1 = x.count('1')
flag = 0
if(x_1 == 0):
    flag = 1
if(x_1 == 1):
    flag = 2

data = [0 for i in range(n+1)]
data[0] = 0
for i in range(1,n+1):
    i_str = format(i,'b')
    ne = i % (i_str.count('1'))
    data[i] = data[ne] + 1

up = [0 for i in range(n)]
do = [0 for i in range(n)]

d = 1
for i in range(n):
    up[i] = d % (x_1 + 1)
    d *= 2
d = 1
if(flag == 0):
    for i in range(n):
        do[i] = d % (x_1 - 1)
        d *= 2

upp = 0
dow = 0

for i in range(n):
    if(x[n-i-1] == '1'):
        upp += up[i]
        upp %= (x_1+1)
        dow += do[i]
        dow %= (x_1-1)


for i in range(n):
    if(x[i] == '0'):
        sam = upp + up[n-i-1]
        sam %= (x_1+1)
        print(data[sam]+1)
    elif(flag == 0):
        sam = dow - do[n-i-1]
        sam %= (x_1-1)
        print(data[sam]+1)
    elif(flag == 2):
        print('0')

### FIXED CODE ###

n = int(input())
x = input()

x_1 = x.count('1')
flag = 0
if(x_1 == 0):
    flag = 1
if(x_1 == 1):
    flag = 2

data = [0 for i in range(n+1)]
data[0] = 0
for i in range(1,n+1):
    i_str = format(i,'b')
    ne = i % (i_str.count('1'))
    data[i] = data[ne] + 1

up = [0 for i in range(n)]
do = [0 for i in range(n)]

d = 1
upp = 0
for i in range(n):
    up[i] = d
    if(x[n-i-1] == '1'):
        upp += d
        upp %= (x_1+1)
    d *= 2
    d %= (x_1 + 1)
d = 1
dow = 0
if(flag == 0):
    for i in range(n):
        do[i] = d
        if(x[n-i-1] == '1'):
            dow += d
            dow %= (x_1-1)
        d *= 2
        d %= (x_1 - 1)


for i in range(n):
    if(x[i] == '0'):
        sam = upp + up[n-i-1]
        sam %= (x_1+1)
        print(data[sam]+1)
    elif(flag == 0):
        sam = dow - do[n-i-1]
        sam %= (x_1-1)
        print(data[sam]+1)
    elif(flag == 2):
        print('0')
n, x = map(int, input().split())
if (n == x == 0) :
    break
count = 0
for a in range (1, n) :
    for b in range (2, n) :
        for c in range (3, n) :
            Sum = a + b + c
            if (Sum == x) :
                count += 1
print(count)

### FIXED CODE ###

while True:
    n, x = map(int, input().split())
    if (n == x == 0):
        break

    count = 0
    for a in range(1, x // 3):
        for b in range(a + 1, x // 2):
            for c in range(b + 1, n + 1):
                Sum = a + b + c
                if (Sum == x):
                    count += 1 
    print(count)
s = input()

a = list('abcdefghijklmnopqrstuvwxyz')

if s == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)
elif len(s) < 26:
    for x in a:
        if s.count(x) == 0:
            print(s + x)
            break
else:
    print(c)
    #for i in range(len(s)):
    #    if a[i] != s[i]:
    #        ans = s[:i-1] + chr(ord(s[i-1])+1)
    #        break
    #print(ans)

### FIXED CODE ###

s = input()

a = list('abcdefghijklmnopqrstuvwxyz')

if s == "zyxwvutsrqponmlkjihgfedcba":
    print(-1)
elif len(s) < 26:
    for x in a:
        if s.count(x) == 0:
            print(s + x)
            break
else:
    end = False
    for i in range(25)[::-1]:
        if end:
            break
        for j in range(i+1,26)[::-1]:
            if s[i] < s[j]:
                print(s[:i]+s[j])
                end = True
                break
a,b,c = list(map(int,input().split()))
a1 = a//c if a%x else a//c-1
a2 = b//c
print(a2-a1)

### FIXED CODE ###

l = list(map(str,input().split()))
v = ''
for i in range(len(l)):
    v = v + l[i][0]
print(v)
I = 0
L = 1
R = 2
P = 3
B = 4
D = 5
H = 6

def search(N, A, B, num):
    """ N ??? Nodes A???Preorder?????? B???Inorder??????
        ??????????????????????????§??? root ??? index ????????? """
#    print(A)
#    print(B)
    root = A[0]
    ld = num
    for i in range(num):
        if B[i] == root:
            ld = i
            break
    if ld > 0:
        N[root][L] = search(N,A[1:ld+1],B[:ld],ld)
    rt = ld + 1
    if rt < num:
        N[root][R] = search(N,A[rt:],B[rt:],num - rt)
    return root

def getroot(A, id):
    if A[id][P] > -1:
        return getroot(A,A[id][P])
    return A[id][I]

def preorder(N,id,A):
    if id < 0:
        return
    A.append(id)
    preorder(N,N[id][L],A)
    preorder(N,N[id][R],A)

def inorder(N,id,A):
    if id < 0:
        return
    inorder(N,N[id][L],A)
    A.append(id)
    inorder(N,N[id][R],A)

def postorder(N,id,A):
    if id < 0:
        return
    postorder(N,N[id][L],A)
    postorder(N,N[id][R],A)
    A.append(id)


def main():

    """ ????????? """
    num = int(input().strip())
    plist = list(map(int,input().split()))
    ilist = list(map(int,input().split()))
    pos = []
    
    nodes = [[i, -1, -1, -1, -1, 0, 0] for i in range(num)]

    search(nodes,plist,ilist,num)
#    pre = [""]
#    ino = [""]
    pos = []

#    preorder(nodes,plist[0],pre)
#    inorder(nodes,plist[0],ino)
    postorder(nodes,plist[0],pos)

#    print("Preorder")
#    print(" ".join(map(str,pre)))
#    print("Inorder")
#    print(" ".join(map(str,ino)))
#    print("Postorder")
    print(" ".join(map(str,pos)))

if __name__ == '__main__':
    main()

### FIXED CODE ###

I = 0
L = 1
R = 2
P = 3
B = 4
D = 5
H = 6

def getidx(Tree,value):
    idx = -1
    for i in range(len(Tree)):
        if Tree[i][I] == value:
            idx = i
            break
    return idx

def search(Tree, A, B, num):
    root = A[0]
    rootidx = getidx(Tree,root)
    ld = num
    for i in range(num):
        if B[i] == root:
            ld = i
            break
    if ld > 0:
        left,lidx = search(Tree,A[1:ld+1],B[:ld],ld)
        Tree[rootidx][L] = lidx
    rt = ld + 1
    if rt < num:
        right,ridx = search(Tree,A[rt:],B[rt:],num - rt)
        Tree[rootidx][R] = ridx
    return (root,rootidx)

def postorder(Tree, nidx, A):
    if nidx < 0:
        return
    postorder(Tree,Tree[nidx][L],A)
    postorder(Tree,Tree[nidx][R],A)
    A.append(Tree[nidx][I])


def main():

    """ ????????? """
    num = int(input().strip())
    plist = list(map(int,input().split()))
    ilist = list(map(int,input().split()))
    tree = []
    for i in plist:
        tree.append([i, -1, -1, -1, -1, 0, 0])

    root,ridx = search(tree, plist, ilist, num)

    pos = []

    postorder(tree, ridx, pos)
    print(" ".join(map(str,pos)))

if __name__ == '__main__':
    main()
n=int(input())
high=list(map(int,input().split()))
ans=[]
i=0
while i<=n-1:
    count=0
    k=i
    while k<=n-1:
        if high[k]>=high[k+1]:
            count+=1
        else:
            break
        k+=1
    ans.append(count)
    i+=count
print(max(ans))

### FIXED CODE ###

n=int(input())
high=list(map(int,input().split()))
ans=[]
count=0
MaxC=0
for k in range(n-1):
    if high[k]>=high[k+1]:
        count+=1
        MaxC=max(MaxC,count)
    else:
        count=0
print(MaxC)
mod=1000000007

k=int(input())

counter = 0
primes = [2, 3]

for n in range(5, k+1, 2):
    isprime = True
    for i in range(0, len(primes)):
        counter+=1
        if primes[i]**2 > n:
            break
        counter += 1
        if n % primes[i] == 0:
            isprime = False
            break
    if isprime:
        primes.append(n)    

#print(primes)
num=[0]*(k+1)

for i in range(1,k+1):
    for a in primes:
        b=i
        while b>1:
            if b%a==0:
                num[a]+=1
                b=b//a
            else:
                break

ans=1
        
for a in primes:
    if num[a]>0:
        ans=ans*(num[a]+1)%mod
        
#print(num)
print(ans)

### FIXED CODE ###

mod=1000000007

k=int(input())

if k==1:
    print(1)
    exit()
elif k==2:
    print(2)
    exit()
    
counter = 0
primes = [2, 3]

for n in range(5, k+1, 2):
    isprime = True
    for i in range(0, len(primes)):
        counter+=1
        if primes[i]**2 > n:
            break
        counter += 1
        if n % primes[i] == 0:
            isprime = False
            break
    if isprime:
        primes.append(n)    

#print(primes)
num=[0]*(k+1)

for i in range(1,k+1):
    for a in primes:
        b=i
        while b>1:
            if b%a==0:
                num[a]+=1
                b=b//a
            else:
                break

ans=1
        
for a in primes:
    if num[a]>0:
        ans=ans*(num[a]+1)%mod
        
#print(num)
print(ans)
a, b, m = map(int, input().split())
A = [int(ae) for ae in input().split()]
B = [int(be) for be in input().split()]

amin = min(A)
bmin = min(B)
smin = amin + bmin

for i in range(m):
  x, y, c= map(int, input().split())
  th = smin -c
  apmin = A[x]
  if apmin > th:
    pass
  else:
    bpmin = B[y]
    spmin = apmin + bpmin -c
    if spmin < smin:
      smin = spmin
    else:
      pass
print(smin)


### FIXED CODE ###

a, b, m = map(int, input().split())
A = [int(ae) for ae in input().split()]
B = [int(be) for be in input().split()]

amin = min(A)
bmin = min(B)
smin = amin + bmin

for i in range(m):
  x, y, c= map(int, input().split())
  th = smin + c
  apmin = A[x-1]
  if apmin > th:
    pass
  else:
    bpmin = B[y-1]
    spmin = apmin + bpmin -c
    if spmin < smin:
      smin = spmin
    else:
      pass
print(smin)
h, w, m = map(int, input().split())
boms = [[] for i in range(m)]
Hs = [0] * m
Ws = [0] * m
for i in range(m):
  _h, _w = map(int, input().split())
  boms[i] = [_h-1, _w-1]
  Hs[_h - 1] += 1
  Ws[_w - 1] += 1

### FIXED CODE ###

h, w, m = map(int, input().split())
boms = set()
Hs = [0] * h
Ws = [0] * w
for i in range(m):
  _h, _w = map(int, input().split())
  boms.add((_h - 1, _w - 1))
  Hs[_h - 1] += 1
  Ws[_w - 1] += 1
Hmax = max(Hs)
Hcount = Hs.count(Hmax)
Wmax = max(Ws)
Wcount = Ws.count(Wmax)
Hindexs = [0] * Hcount
Windexs = [0] * Wcount
hcount = 0
wcount = 0
for i in range(h):
  if Hs[i] == Hmax:
    Hindexs[hcount] = i
    hcount += 1
for i in range(w):
  if Ws[i] == Wmax:
    Windexs[wcount] = i
    wcount += 1
if m < len(Hindexs) * len(Windexs):
  print(Hmax + Wmax)
  exit()
for hindex in Hindexs:
  for windex in Windexs:
    if (hindex,windex) not in boms: 
      print(Hmax + Wmax)
      exit()
print(Hmax + Wmax -1)
n=int(input())
ac, wa, tle, re=0, 0, 0, 0
for i in range(n):
  str=input(str())
  if str=='AC':
    ac=ac+1
  elif str=='WA':
    wa=wa+1
  elif str=='TLE':
    tle=tle+1
  elif str=='RE':
    re=re+1

print('AC x ', ac)
print('WA x ', wa)
print('TLE x ', tle)
print('RE x ', re)

### FIXED CODE ###

n=int(input())
ac, wa, tle, re=0, 0, 0, 0
for i in range(n):
  s=input(str())
  if s=='AC':
    ac=ac+1
  elif s=='WA':
    wa=wa+1
  elif s=='TLE':
    tle=tle+1
  elif s=='RE':
    re=re+1

print('AC x ', ac)
print('WA x ', wa)
print('TLE x ', tle)
print('RE x ', re)
import numpy as np

input_str  = list(input())
count = 0

if input_str[0] == '?':
    if input_str[1] == 'P':
        input_str[0] == 'D'
    else:
        input_str[0] = 'P'

if input_str[-1] == '?':
    input_str[-1] = 'D'


for i in range(1,len(input_str)-1):
    if input_str[i] == '?':
        if input_str[i-1] == 'P':
            input_str[i] = 'D'
        elif input_str[i+1] == 'P':
            input_str[i] = 'D'
        elif input_str[i+1] == 'D':
            input_str[i] = 'P'
        elif input_str[i+1] == '?':
            if input_str[i-1] == 'P':
                input_str[i] = 'D'
            else:
                input_str[i] = 'P'
        elif input_str[i+1] == 'D':
            input_str[i] = 'D'

for i in range(len(input_str)-1):
    if input_str[i] == 'D':
        count = count + 1
    if input_str[i] == 'P' and input_str[i+1] == 'D':
        count = count + 1
if input_str[-1] == 'D':
    count = count + 1
ans = ''.join(input_str)

print(ans)


### FIXED CODE ###

import numpy as np

input_str  = list(input())
count = 0



if len(input_str) == 1:
    input_str[0] = 'D'
else:
    if input_str[0] == '?':
        if input_str[1] == 'P':
            input_str[0] = 'D'
        else:
            input_str[0] = 'P'

    if input_str[-1] == '?':
        input_str[-1] = 'D'

    for i in range(1,len(input_str)-1):
        if input_str[i] == '?':
            if input_str[i-1] == 'P':
                input_str[i] = 'D'
            elif input_str[i+1] == 'D':
                input_str[i] = 'P'
            elif input_str[i+1] == '?':
                if input_str[i-1] == 'P':
                    input_str[i] = 'D'
                else:
                    input_str[i] = 'P'
            else:
                input_str[i] = 'D'

ans = ''.join(input_str)

print(ans)
import sys
sys.setrecursionlimit(10 ** 6)

inputs = [int(x) for x in input().split()]
n, m = inputs[0], inputs[1]
conditions = {}
for i in range(n):
  inputs = [int(x) for x in input().split()]
  if inputs[0] in conditions.keys():
    conditions[inputs[0]].append(inputs[1])
  else:
    conditions[inputs[0]] = [inputs[1]]

for day in conditions.keys():
  conditions[day].sort(reverse=True)

ans = 0
candidates = []
for reversed_day in range(1, m + 1):
  if reversed_day in conditions.keys():
    candidates.append(conditions[reversed_day])

  cand_len = len(candidates)
  if cand_len == 0:
    continue
  maxval, maxidx = 0, 0
  for i in range(cand_len):
    if candidates[i][0] > maxval:
      maxval = candidates[i][0]
      maxidx = i
  ans += candidates[maxidx].pop(0)
print(ans)


### FIXED CODE ###


import collections
import heapq

inputs = [int(x) for x in input().split()]
n, m = inputs[0], inputs[1]
conditions = collections.deque([])
for i in range(n):
  conditions.append([int(x) for x in input().split()])

conditions = sorted(conditions)

cnt, ans = 0, 0
candidates = []
for reversed_day in range(1, m + 1):
  while cnt < len(conditions) and conditions[cnt][0] <= reversed_day:
    heapq.heappush(candidates, -conditions[cnt][1])
    cnt += 1

  if len(candidates) == 0:
    continue
  ans -= heapq.heappop(candidates)

print(ans)
import fractions

def list_gcd(l):
    if len(l) == 0:
      return 0
    elif len(l) == 1:
      return l[0]
    elif len(l) == 2:
      return fractions.gcd(l[0], l[1])
    else:
      m = l[1:]
      return fractions.gcd(l[0],list_gcd(m))

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

if N == 2:
  print(max(A))
else:
  m = -1
  for i in range(N):
    L = [A[j] for j in range(0, i)]
    R = [A[j] for j in range(i+1, N)]
    m = max(m, fractions.gcd(list_gcd(L),list_gcd(R)))
  print(m)

### FIXED CODE ###


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


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

if N == 2:
  print(max(A))
else:

  L = [0 for j in range(N+1)]
  R = [0 for j in range(N+1)]
  
  for j in range(N):
    L[j+1] = gcd(L[j], A[j])
  for j in reversed(range(N)):
    R[j] = gcd(R[j+1], A[j])

    m = -1
  for j in range(N):
    m = max(m, gcd(L[j], R[j+1]))
  print(m)
a = int(input())

b = []

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

res = 0

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

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)