Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n,m=mii()

arr=limii()

mat=[1]*n
for i in range(m):
    a,b=mii()
    if arr[a-1] < arr[b-1]:
        mat[a-1] =0
    elif: arr[b-1]<arr[a-1]:
        mat[b-1] =0
print(sum(mat))






### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)
from math import floor,ceil,sqrt,factorial,log
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from operator import itemgetter
from fractions import gcd
mod = 10 ** 9 + 7
inf = float('inf')
ninf = -float('inf')
 
#整数input
def ii(): return int(sys.stdin.readline().rstrip()) #int(input())
def mii(): return map(int,sys.stdin.readline().rstrip().split())
def limii(): return list(mii()) #list(map(int,input().split()))
def lin(n:int): return [ii() for _ in range(n)]
def llint(n: int): return [limii() for _ in range(n)]
#文字列input
def ss(): return sys.stdin.readline().rstrip() #input()
def mss(): return sys.stdin.readline().rstrip().split()
def limss(): return list(mss()) #list(input().split())
def lst(n:int): return [ss() for _ in range(n)]
def llstr(n: int): return [limss() for _ in range(n)]

#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？
#本当に貪欲法か？ DP法では？？

n,m=mii()

arr=limii()

mat=[[0] for _ in range(n)]
for i in range(m):
    a,b=mii()
    mat[a-1].append(arr[b-1])
    mat[b-1].append(arr[a-1])
chk=0
for i in range(n):
    if arr[i]>max(mat[i]):
        chk+=1

print(chk)
from sys import stdin
from operator import mul
from functools import reduce


def cmb(n, r):
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N, K = [int(x) for x in stdin.readline().rstrip().split()]
for i in range(1, K+1):
    ans = cmb(N-K+1, i) * cmb(K-1, i-1)
    if i == N:
        ans = 0
    print(ans % (10**9+7))

### FIXED CODE ###

from sys import stdin
from operator import mul
from functools import reduce


def cmb(n, r):
    r = min(n-r, r)
    if r == 0:
        return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1, r + 1))
    return over // under


N, K = [int(x) for x in stdin.readline().rstrip().split()]
for i in range(1, K+1):
    if i <= (N - K) + 1 :
        ans = cmb(N-K+1, i) * cmb(K-1, i-1)
    else:
        ans = 0
    print(ans % (10**9+7))
N,Q = map(int,input().split(" "))
s_lst = list(input().rstrip())

pos_cnt=[1 for _ in range(N+2)]
c_ind_dict = {c:[] for c in set(s_lst)}
for i,c in enumerate(s_lst):
	c_ind_dict[c].append(i+1)

for _ in range(Q):
	c,d = input().split(" ")
	if c not in c_ind_dict.keys():
		continue
	for ind in  c_ind_dict[c]:
		if d == "L":
			pos_cnt[ind - 1] += pos_cnt[ind]
			pos_cnt[ind] = 0
		else:
			pos_cnt[ind + 1] += pos_cnt[ind]
			pos_cnt[ind] = 0

print(sum(pos_cnt[1:N+1]))

### FIXED CODE ###

A,B,C = map(int,input().split(" "))
if A == B and B == C:
	print("Yes")
else:
	print("No")
N=int(input())
S=[input() for _ in range(N)]

S=sorted(S)
T=[]
m=S.count(S[0])
T.append(S[0])
c=1
for i in range(1,N):
    if i==N-1:
        if S[i]==S[i-1]:
            c+=1
            if c>m:
                T.clear()
                T.append(S[i])
            elif c==m:
                T.append(S[i])
        else:
            if m==1:
                T.appned(S[i])
    
    elif S[i]==S[i-1]:
        c+=1
    else:
        if c>m:
            T.clear()
            T.append(S[i-1])
            m=c
            c=1
        elif c==m:
            T.append(S[i-1])
            m=c
            c=1

for j in range(len(T)):
    print(T[j])

### FIXED CODE ###

from collections import Counter
N=int(input())
S=[input() for _ in range(N)]

C=Counter(S)
A=[]
B=[]
T=[]

for i,j in C.most_common():
    A.append(i)
    B.append(j)
for k in range(len(A)):
    if B[k]==B[0]:
        T.append(A[k])
T=sorted(T)
for m in range(len(T)):
  print(T[m])
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
M = list(map(int, input().split()))

def solve(idx, target):
    if target == 0:
        return True
    if idx >= N:
        return False
    if solve(idx+1, target) or solve(idx+1, target-A[idx]):
        return True
    return False


for target in M:
    if solve(0, target):
        print("yes")
    else:
        print("no")


### FIXED CODE ###

def solve(dp, a, i, m):
  if m in dp[i]:
    return dp[i][m]

  if m == 0:
    dp[i][m] = True
  elif i >= len(a):
    dp[i][m] = False
  elif solve(dp, a, i+1, m):
    dp[i][m] = True
  elif solve(dp, a, i+1, m-a[i]):
    dp[i][m] = True
  else:
    dp[i][m] = False

  return dp[i][m]

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

dp = {}
for i in range(N+1):
  dp[i] = {}

for m in M:
  if solve(dp, A, 0, m):
    print('yes')
  else:
    print('no')
int a = input()
  int b = input()
  
  if a * b % 2 == 0:
    print("Even")
  else:
  	print("Odd")


### FIXED CODE ###

a, b = map(int, input().split())
print("Odd" if a * b % 2 else "Even")
P = int(input())
Q = int(input())
R = int(input())

list = []

list = P,Q,R
newlist = sorted(list)

a = newlist[0] + newlist[1]
print(a)




### FIXED CODE ###

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


newlist = sorted(A)

sum = newlist[0] + newlist[1]

print(sum)
s=input()
t=input()
l=list()
for _ in list(t):
  if [i for i,x in enumerate(list(s)) if x==_] != list():
    l.append([i for i,x in enumerate(list(s)) if x==_])
  else:
    print(-1)
    exit()
if len(t)==1:
  print(s.index(t)+1)
  exit()
ed=l[0][0]
cd=0
for i in range(len(t))[1:-1]:
  k=l[i]
  if max(k+[ed])==ed :
    cd+=1
    ed=k[0]
  else:
    ex=sorted(k+[ed])
    exex=ex.index()
    ed=k[exex]
k=l[len(t)-1]
if max(k+[ed])==ed :
  print((cd+1)*len(s)+min(k)+1)
else:
  ex=sorted(k+[ed])
  exex=ex.index(ed)
  ed=k[exex]
  print((cd)*len(s)+ed+1)

### FIXED CODE ###

def f():
    s,t=input(),input()
    n,m=len(s),len(t)
    table=[[]for i in  range(26)]
    d={'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}

    for j in range(n):
        table[d[s[j]]].append(j)
    now=0
    ind=0
    if set(list(t))-set(list(s)):print(-1);exit()
    from bisect import bisect_left as bl
    for p in t:
        if ind>table[d[p]][-1]:now+=1;ind=0
        ind=table[d[p]][bl(table[d[p]],ind)]+1

    print(now*n+ind)
if __name__ == "__main__":
    f()
from collections import defaultdict
n=int(input())
p=[list(map(int,input().split())) for i in range(n)]
dic=defaultdict(int)
for i, (x,y)in enumerate(p):
  for j, (u,v) in enumerate(p):
    if i==j:
      continue
    dic[(x-u,y-v)]+=1
print(n-max(dic,key=lambda z:z[1])[1])

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10000000)
from collections import defaultdict
mod = 10**9+7

N = int(input())
xy = [list(map(int, input().split())) for i in range(N)]
xy.sort()
Ans = N
for i in range(N):
    for j in range(i+1, N):
        a, b = xy[j][0]-xy[i][0], xy[j][1]-xy[i][1]
        ans = N
        for k in range(N):
            for l in range(k+1, N):
                if xy[k][0]+a == xy[l][0] and xy[k][1]+b == xy[l][1]:
                    ans -= 1
        Ans = min(Ans, ans)
print(Ans)
import math
a,b,n = map(int,input().split())
#li = []
 
#for x in range(n+1):
ans = (math.floor((a*(n))/b) - (a * math.floor(n/b)))

 
#print(max(li))
if max(li) > n:
    print(0)
else:
    print(max(li))


### FIXED CODE ###

import math
 
A, B, N = map(int, input().split())
 
 
ans1 = 0
 
if N > B - 1:
    x = B-1
    print(int((A * x) / B) - A * int(x / B))
elif N <= B - 1:
    x = N
    print(int((A * x) / B) - A * int(x / B))
n, x = map(int, input().split())
l = list(map(int, input().split()))
d = 0
cnt = 0
i = 0
while d <= x:
    cnt += 1
    d += l[i]
    i += 1
print(cnt)

### FIXED CODE ###

n, x = map(int, input().split())
L = list(map(int, input().split()))
d = 0
bound = 1
for l in L:
	d = d + l
	if d > x:
		break
	bound += 1
print(bound)
# coding: utf-8
import os
import time
import re
import math

def main():
    s=input().replace("BC","D")
    max=0
    acount=0
    for a in len(s):
        if s[a]=='D':
            max+=acount
        elif s[a]=='A':
            acount+=1
        else:
            acount=0
    print(max)



start=time.time();
main()
#print(time.time()*1000-start*1000)

### FIXED CODE ###

# coding: utf-8
import os
import time
import re
import math

def main():
    s=input().replace("BC","D")
    max=0
    acount=0
    for a in s:
        if a=='D':
            max+=acount
        elif a=='A':
            acount+=1
        else:
            acount=0
    print(max)
start=time.time();
main()
#print(time.time()*1000-start*1000)
n,k,s=list(map(int,input().split())),0
for i in range(k,n+2):
	s+=i*(n+n-(i-1))//2+1-(i*(i-1))//2
print(s%(1000000007))

### FIXED CODE ###

import math
import queue

def readInt():
	return int(input())

def readInts():
	return list(map(int, input().split()))

def readChars():
	return input().split()



x = readInts()
n = x[0]
k = x[1]

def ts(l):
	return int((l*(l-1))/2)

def ts2(l):
	return int(l*(n+n-(l-1))/2)


#for i in range(k,n):
#	for j in range(0,n-i+1):
#iは個数

#a = range(0+1,n+n-1 +1) #2
#b = range(0+1+2,n+n-1+n-2 +1) #3

s = 0

for i in range(k,n+2):
	#x = range(ts(i),ts2(i)+1)
	#print(ts2(i)+1-ts(i))
	#print(x)
	s += ts2(i)+1-ts(i)

print(s%(1000000007))
# author:  Taichicchi
# created: 19.09.2020 00:14:21

from collections import Counter
import sys
from math import prod

N = int(input())

S = input()


c = Counter(S)

ans = prod(list(c.values()))

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        for k in range(j + 1, N):
            if j - i == k - j:
                if (S[i] != S[j]) & (S[j] != S[k]) & (S[k] != S[i]):
                    ans -= 1

print(ans)


### FIXED CODE ###

# author:  Taichicchi
# created: 19.09.2020 00:14:21

import sys

N = int(input())

S = input()

ans = S.count("R") * S.count("G") * S.count("B")


for i in range(N - 2):
    for j in range(i + 1, N - 1):
        try:
            k = 2 * j - i
            if (S[i] != S[j]) & (S[j] != S[k]) & (S[k] != S[i]):
                ans -= 1
        except:
            continue

print(ans)
a, b = map(int, input().split(' '))
cnt += 0
avi = 1
while 1:
    cnt += 1
    avi += a - 1
    if avi >= b:
        break
print(cnt)


### FIXED CODE ###

a, b = map(int, input().split(' '))
cnt = 0
avi = 1
while 1:
    if avi >= b:
        break

    cnt += 1
    avi += a - 1

print(cnt)
p(int, input().split())

if abs(a-c) <= d:
    print('Yes')
elif abs(a-b) <= d and abs(b-c) <= d:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

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

if abs(a-c) <= d:
    print('Yes')
elif abs(a-b) <= d and abs(b-c) <= d:
    print('Yes')
else:
    print('No')
S=input()
T=input()
ans=len(T)
for i in range(len(S)-len(T)+1):
  _ans=0
  for j in range(len(T)):
    if S[i+j]!=T[i+j]:
      _ans+=1
  ans=min(ans,_ans)
print(ans)

### FIXED CODE ###

S=input()
T=input()
ans=len(T)
for i in range(len(S)-len(T)+1):
  _ans=0
  for j in range(len(T)):
    if S[i+j]!=T[j]:
      _ans+=1
  ans=min(ans,_ans)
print(ans)
s = list(input())
for i in range(len(s)):
    if s[i] =="?":
        if i == 0:
            if s[1]=="D" or s[1]=="?":
                s[i] ="P"
            else:
                s[i] ="D"
        else:
            if s[i-1] =="P":
                s[i]= "D"
            else:
                if i == len(s)-1:
                    s[i] ="D"
                else:
                    if s[i+1] =="?" or "D":
                        s[i]="P"
                    else:
                        s[i]= "D"
print(''.join(s))
            

### FIXED CODE ###

s = list(input())
if len(s) < 2:
    print("D")
    exit()
for i in range(len(s)):
    if s[i] =="?":
        if i == 0:
            if s[1]=="D" or s[1]=="?":
                s[i] ="D"
            else:
                s[i] ="D"
        else:
            if s[i-1] =="P":
                s[i]= "D"
            else:
                if i == len(s)-1:
                    s[i] ="D"
                else:
                    if s[i+1] =="?" or "D":
                        s[i]="D"
                    else:
                        s[i]= "D"
print(''.join(s))
a,b=map(int,input().split())
print("10"[1 if a<b else 2])

### FIXED CODE ###

a,b=map(int,input().split())
print("10"[1 if a<b else 0:])
N, Q=map(int, input().split())
ab=[list(map(int, input().split())) for i in range(N-1)]
px=[list(map(int, input().split())) for i in range(Q)]

link=[[] for i in range(N+1)]
for i in range(N-1):
  link[ab[i][0]].append(ab[i][1])
  link[ab[i][1]].append(ab[i][0])

counter=[0 for i in range(N+1)]
for i in range(Q):
  counter[px[i][0]]+=px[i][1]
  
def f(num, prenum=-1, p=0):
  counter[num]+=p
  for postnum in link[num]:
    if postnum==prenum:
      continue
    f(postnum, num, counter[num])
    
f(1)

print(*counter[1:])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

def input():
  return sys.stdin.readline()[:-1]

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

link=[[] for i in range(N+1)]
for i in range(N-1):
  a, b=map(int, input().split())
  link[a].append(b)
  link[b].append(a)

px=[list(map(int, input().split())) for i in range(Q)]

counter=[0]*(N+1)
for i in range(Q):
  counter[px[i][0]]+=px[i][1]
  
def f(num, prenum=-1, p=0):
  counter[num]+=p
  for postnum in link[num]:
    if postnum==prenum:
      continue
    f(postnum, num, counter[num])
    
f(1)

print(*counter[1:])
print('YNEOS'[if input()[:4]!='YAKI'::2])

### FIXED CODE ###

print('YNeos'[input()[:4]!='YAKI'::2])
n,k=map(int,input().split())
x=[0]
for xi in input().split():
    xi=int(xi)
    if xi==0:
        k-=1
    else:
        x.append(xi)
x.sort(x)
ans=float("INF")
zero=x.index(0)
for i in range(max(0,zero-k-1),min(zero+1,n-k+1)):
    if x[i+k]<0 or x[i]>0:
        continue
    jogen=abs(x[i+k])
    kagen=abs(x[i])
    ans=min(ans,jogen*2+kagen,kagen*2+jogen)
print(ans)


### FIXED CODE ###

n,k=map(int,input().split())
x=[0]
for xi in input().split():
    xi=int(xi)
    if xi==0:
        k-=1
    else:
        x.append(xi)
x.sort()
ans=float("INF")
zero=x.index(0)
for i in range(max(0,zero-k-1),min(zero+1,n-k+1)):
    if x[i+k]<0 or x[i]>0:
        continue
    jogen=abs(x[i+k])
    kagen=abs(x[i])
    ans=min(ans,jogen*2+kagen,kagen*2+jogen)
print(ans)
import sys
from collections import deque
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
def input(): return sys.stdin.readline().rstrip()

def main():
    S=input()
    T=input()
    dp=[[0]*(len(T)+1) for _ in range(len(S)+1)]
    dp2=[[()]*(len(T)+1) for _ in range(len(S)+1)]
    for s in range(len(S)):
        for t in range(len(T)):
            if S[s]==T[t]:
                dp[s+1][t+1]=dp[s][t]+1
                dp2[s+1][t+1]=(s,t)
            else:
                if dp[s+1][t]>dp[s][t+1]:
                    dp[s+1][t+1]=dp[s+1][t]
                    dp2[s+1][t+1]=dp2[s+1][t]
                else:
                    dp[s+1][t+1]=dp[s][t+1]
                    dp2[s+1][t+1]=dp2[s][t+1]
    tmp=dp2[len(S)][len(T)]
    ans=deque()
    ans.appendleft(S[tmp[0]])
    for _ in range(dp[len(S)][len(T)]-1):
        tmp=dp2[tmp[0]][tmp[1]]
        ans.appendleft(S[tmp[0]])
    print(''.join(ans))

if __name__ == '__main__':
    main()


### FIXED CODE ###

S=list(input())
T=list(input())

dp = [[0]*(len(T)+1) for i in (range(len(S)+1))]

for s in range(len(S)):
    for t in range(len(T)):
        if S[s] == T[t]:
            dp[s+1][t+1] = max(dp[s][t]+1,dp[s][t+1],dp[s+1][t])
        else:
            dp[s+1][t+1] = max(dp[s][t+1],dp[s+1][t])

def checkdpn(x,y):
    if dp[x][y] == dp[x-1][y] + 1 and dp[x][y] == dp[x][y-1] + 1:
        return True
    else:
        return False

x = len(S)
y = len(T)
str = ''

while(True):
    if checkdpn(x,y):
        str = S[x-1] + str
        x -= 1
    else:
        if dp[x][y] == dp[x][y-1] + 1:
            x -= 1
        else:
            y -= 1
    if dp[x][y] == 0:
        break
print(str)
import math
import itertools
from scipy.special import comb
n = int(input())

dic = {}
for i in range(n):
    string = input()
    sortStr = "".join(sorted(string))
    if sortStr in dic:
        dic[sortStr] += 1
    else:
        dic[sortStr] = 1

sum = 0
for num in dic.values():
    if num == 1:
        sum += 0
    else:
        sum += comb(num, 2)
print(math.floor(sum))

### FIXED CODE ###

import math
n = int(input())

dic = {}


def twoKimuawaseSum(num):
    result = 0
    for i in range(1, num):
        result += i
    return result


for i in range(n):
    string = input()
    sortStr = "".join(sorted(string))
    if sortStr in dic:
        dic[sortStr] += 1
    else:
        dic[sortStr] = 1
sum = 0
for num in dic.values():
    if num == 1:
        sum += 0
    else:
        sum += twoKimuawaseSum(num)
print(math.floor(sum))
import math

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

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

_ac = (a-1) // c # a以下のcの倍数の数
_bc = b // c # b以下のcの倍数の数

_ad = (a-1) // d # a以下のdの倍数の数
_bd = b // d # b以下のdの倍数の数

_acd = (a-1) // lcm(c,d) # a以下のcdの倍数の数
_bcd = b // lcm(c,d) # b以下のcdの倍数の数

m = (b-a+1) - ((_bc-_ac) + (_bd-_ad) - (_bcd-_acd))
print(m)

### FIXED CODE ###

from fractions import gcd

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

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

_ac = (a-1) // c # a以下のcの倍数の数
_bc = b // c # b以下のcの倍数の数

_ad = (a-1) // d # a以下のdの倍数の数
_bd = b // d # b以下のdの倍数の数

_acd = (a-1) // lcm(c,d) # a以下のcdの倍数の数
_bcd = b // lcm(c,d) # b以下のcdの倍数の数

m = (b-a+1) - ((_bc-_ac) + (_bd-_ad) - (_bcd-_acd))
print(m)
import math
n=int(input())
ans = len(str(n))
# print(int(math.sqrt(n)))
for a in range(1,int(math.sqrt(n)+1)):
    # print(a,n/a,n % a)
    if n % a == 0 and ans > max(len(str(a)),len(str(int(n / a))))
        ans = max(len(str(a)),len(str(int(n / a))))
print(ans)

### FIXED CODE ###

import math
n=int(input())
k = math.floor(math.sqrt(n))
for a in range(k+1,0,-1):
    if n % a == 0:
        print(max(len(str(a)),len(str(n//a))))
        break
import math

a,b=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
s=abs(x[-1]-b)
d=set()
for i in range(a-1):
    s=min(s,abs(x[i]-b))
    d.add(x[i+1]-x[i])
if a==1:
    print(abs(b-x[0]))
    exit()
ans=s
while d:
    ans=math.gcd(ans,d.pop())
print(ans)


### FIXED CODE ###

import fractions
a,b=map(int,input().split())
x=list(map(int,input().split()))
x.sort()
s=abs(x[-1]-b)
d=set()
for i in range(a-1):
    s=min(s,abs(x[i]-b))
    d.add(x[i+1]-x[i])
if a==1:
    print(abs(b-x[0]))
    exit()
ans=s
while d:
    ans=fractions.gcd(ans,d.pop())
print(ans)
n , k = map(int,input().split())
lis = list(map(int,input().split()))
lis = sorted(lis,reverse = True)
ans = 0
for i in range(k):
  ans += lis[i]
print(ans)

### FIXED CODE ###

a , b = map(int,input().split())
if a%3 == 0 or b%3 == 0 or (a+b)%3 == 0:
 print("Possible")
else:
 print("Impossible")
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
d = 0
for i range(n):
    d = v[i] - c[i]
    if 0 < d:
        ans += d
print(int(ans))

### FIXED CODE ###

n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(n):
    d = v[i] - c[i]
    if 0 < d:
        ans += d
print(int(ans))
import sys
from functools import lru_cache


fin = sys.stdin.readline
num_matches_required = {n: nmatches for n, nmatches 
    in zip(range(1, 10), (2, 5, 5, 4, 5, 6, 3, 7, 6))}

N, M = map(int, fin().split())
nums = sorted(map(int, fin().split()), reverse=True)

@lru_cache(None)
def rec(i):
    if i < 0: 
        return float('-inf')
    elif i == 0: 
        return 0
    else:
        return max(
            rec(i - num_matches_required[num]) for num in nums
        ) + 1


num_digits = rec(N)
cur_num_matches = N
result = []
while cur_num_matches:
    for num in nums:
        if rec(cur_num_matches - num_matches_required[num]) == num_digits - len(result) - 1:
            result.append(str(num))
            cur_num_matches -= num_matches_required[num]
            break

print("".join(result))


### FIXED CODE ###

import sys
from functools import lru_cache


sys.setrecursionlimit(200000)
fin = sys.stdin.readline
num_matches_required = {n: nmatches for n, nmatches 
    in zip(range(1, 10), (2, 5, 5, 4, 5, 6, 3, 7, 6))}

N, M = map(int, fin().split())
nums = sorted(map(int, fin().split()), reverse=True)

@lru_cache(None)
def rec(i):
    if i < 0: 
        return float('-inf')
    elif i == 0: 
        return 0
    else:
        return max(
            rec(i - num_matches_required[num]) for num in nums
        ) + 1


num_digits = rec(N)
cur_num_matches = N
result = []
while cur_num_matches:
    for num in nums:
        if rec(cur_num_matches - num_matches_required[num]) == num_digits - len(result) - 1:
            result.append(str(num))
            cur_num_matches -= num_matches_required[num]
            break

print("".join(result))
n, q = map(int, input().split())
tree = [[] for _ in range(n)]
for _ in range(n-1):
    a, b = map(int, input().split())
    tree[a-1].append(b-1)
    tree[b-1].append(a-1)
ans = [0] * n
for _ in range(q):
    p, x = map(int, input().split())
    ans[p-1] += x
def dfs(c, parent):
    for child in tree[c]:
        if child == parent:
            continue
        ans[child] += ans[c]
        dfs(child, c)
dfs(0, -1)
print(*ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline #for input speed
sys.setrecursionlimit(10**6) #for deep recursion
n, q = map(int, input().split())

tree_index = [[] for _ in range(n)]
for i in range(n-1):
  a,b = map(int, input().split())
  a -= 1
  b -= 1
  tree_index[a].append(b) # a<bとは限らないため、双方向にする
  tree_index[b].append(a)
ans = [0] * n
for i in range(q):
  p, x = map(int, input().split())
  ans[p-1] += x
def dfs(cur, par):
    for chl in tree_index[cur]:
      if chl == par: #parentとchildが等しい時はスキップ
        continue
      ans[chl] += ans[cur] 
      dfs(chl, cur)
dfs(0, -1)
print(*ans)
n = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(n):
  if i+1 == A[A[i]]:
    ans += 1
print(ans//2)
  


### FIXED CODE ###

n = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range(n):
    if A[A[i]-1] == i+1:
        ans += 1
print(ans//2)