AtCoder Beginner Contest 125 - Resale

There are N gems. The value of the i-th gem is V_i.
You will choose some of these gems, possibly all or none, and get them.
However, you need to pay a cost of C_i to get the i-th gem.
Let X be the sum of the values of the gems obtained, and Y be the sum of the costs paid.
Find the maximum possible value of X-Y.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N \leq 20
 - 1 \leq C_i, V_i \leq 50

-----Input-----
Input is given from Standard Input in the following format:
N
V_1 V_2 ... V_N
C_1 C_2 ... C_N

-----Output-----
Print the maximum possible value of X-Y.

-----Sample Input-----
3
10 2 5
6 3 4

-----Sample Output-----
5

If we choose the first and third gems, X = 10 + 5 = 15 and Y = 6 + 4 = 10.
We have X-Y = 5 here, which is the maximum possible value.

Difficulty: EASY

Starter code:

Solutions:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
T = [v - c for (v, c) in zip(V, C) if v - c > 0]
print(sum(T))


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
	ans += max(0, a[i] - b[i])
print(ans)


N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
print(sum([max(0, V[i] - C[i]) for i in range(N)]))


N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
l = []
for i in range(N):
	if V[i] - C[i] > 0:
		l.append(V[i] - C[i])
print(sum(l))


n = input()
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for (i, j) in zip(v, c):
	if i - j > 0:
		ans += i - j
print(ans)


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
print(sum([i - j for (i, j) in zip(v, c) if i > j]))


N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
li = []
for i in range(N):
	li.append(V[i] - C[i])
for j in range(N):
	if li[j] > 0:
		ans += li[j]
print(ans)


n = int(input())
v = input().split()
c = input().split()
co = 0
for i in range(n):
	if int(v[i]) > int(c[i]):
		co += int(v[i]) - int(c[i])
print(co)


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
a = []
for i in range(n):
	b = v[i] - c[i]
	a.append(b)
d = 0
for j in range(n):
	if a[j] > 0:
		d += a[j]
print(d)


n = int(input())
A = tuple(map(int, input().split()))
B = tuple(map(int, input().split()))
ans = 0
for i in range(n):
	ans += max(A[i] - B[i], 0)
print(ans)


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
cost = []
for i in range(n):
	if v[i] - c[i] > 0:
		cost.append(v[i] - c[i])
print(sum(cost))


N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
D = [0] * N
for i in range(N):
	t = V[i] - C[i]
	if t > 0:
		D[i] = t
print(sum(D))


N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for i in range(N):
	if V[i] - C[i] > 0:
		ans += V[i] - C[i]
print(ans)


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
x = 0
y = 0
for i in range(n):
	if v[i] - c[i] > 0:
		x += v[i]
		y += c[i]
print(x - y)


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
vc = [0] * n
for i in range(n):
	vc[i] = v[i] - c[i]
vc2 = sorted(vc)
import bisect
print(sum(vc2[bisect.bisect_left(vc2, 0):]))


n = int(input())
V = [int(_) for _ in input().split()]
C = [int(_) for _ in input().split()]
X_Y = [x - y for (x, y) in zip(V, C) if x - y > 0]
print(sum(X_Y))


N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
print(sum((max(0, v - c) for (v, c) in zip(V, C))))


n = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
print(sum([v - c for (v, c) in zip(V, C) if v - c > 0]))


N = int(input())
V = [int(i) for i in input().split()]
C = [V[i] - int(j) for (i, j) in enumerate(input().split())]
print(sum([c for c in C if c > 0]))


import sys
lines = [s.rstrip('\n') for s in sys.stdin.readlines()]
n = int(lines.pop(0))
v_list = [int(num) for num in lines.pop(0).split(' ')]
c_list = [int(num) for num in lines.pop(0).split(' ')]
ans = 0
for (v, c) in zip(v_list, c_list):
	if v > c:
		ans += v - c
print(ans)


N = int(input())
V = [int(i) for i in input().split()]
C = [int(c) for c in input().split()]
ans = 0
for (v, c) in zip(V, C):
	if v > c:
		ans += v - c
print(ans)


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
li = [v[i] - c[i] for i in range(n) if v[i] - c[i] > 0]
print(sum(li))


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(n):
	if v[i] - c[i] > 0:
		ans += v[i] - c[i]
print(ans)


n = input()
V = map(int, input().split())
C = map(int, input().split())
print(sum((max(0, v - c) for (v, c) in zip(V, C))))


n = int(input())
values = list(map(int, input().split()))
costs = list(map(int, input().split()))
sum = 0
for i in range(n):
	if values[i] - costs[i] < 0:
		continue
	else:
		sum += values[i] - costs[i]
print(sum)


n = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
Ans = 0
for i in range(n):
	if V[i] > C[i]:
		Ans += V[i] - C[i]
print(Ans)


_ = input()
Vs = map(int, input().split())
Cs = map(int, input().split())
sub = []
for (v, c) in zip(Vs, Cs):
	if v > c:
		sub.append(v - c)
print(sum(sub))


N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
Z = [V[i] - C[i] for i in range(N) if V[i] - C[i] > 0]
print(sum(Z))


n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
ans = 0
for (i, j) in zip(x, y):
	ans += i - j if i - j > 0 else 0
print(ans)


N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
print(sum((vi - ci for (vi, ci) in zip(V, C) if vi > ci)))


N = int(input())
V = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
print(sum([v - c for (v, c) in zip(V, C) if v - c > 0]))


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
print(sum((max(0, i - j) for (i, j) in zip(v, c))))


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
print(sum((vi - ci for (vi, ci) in zip(v, c) if vi > ci)))


N = input()
VS = [int(i) for i in input().split()]
CS = [int(i) for i in input().split()]
print(sum([a - b for (a, b) in zip(VS, CS) if a - b > 0]))


(n, *d) = map(int, open(0).read().split())
print(sum([max(d[i] - d[i + n], 0) for i in range(n)]))


n = input()
vs = map(int, input().split())
cs = map(int, input().split())
print(sum([v - c for (v, c) in zip(vs, cs) if v - c > 0]))


input()
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for (v, c) in zip(V, C):
	if v > c:
		ans += v - c
print(ans)


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
print(sum([max(0, vv - cc) for (vv, cc) in zip(v, c)]))


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m = 0
for i in range(n):
	if a[i] > b[i]:
		m += a[i] - b[i]
print(m)


import numpy
N = int(input().strip())
V_array = []
C_array = []
V_array = [int(x) for x in input().split()]
C_array = [int(x) for x in input().split()]
ans = 0
for j in range(N):
	ans += V_array[j] - C_array[j] if V_array[j] > C_array[j] else 0
print(ans)


n = input()
v = map(int, input().split())
c = map(int, input().split())
answer = 0
for (a, b) in zip(v, c):
	answer += max(0, a - b)
print(answer)


n = int(input())
(*v,) = map(int, input().split())
(*c,) = map(int, input().split())
s = [v[i] - c[i] for i in range(n)]
print(sum((i for i in s if i > 0)))


N = input()
V = map(int, input().split())
C = map(int, input().split())
ans = 0
for (x, y) in zip(V, C):
	if x - y > 0:
		ans += x - y
print(ans)


(N, *A) = map(int, open(0).read().split())
print(sum(((x - y) * (x > y) for (x, y) in zip(A[:N], A[N:]))))


n = int(input())
V = map(int, input().split())
C = map(int, input().split())
(x, y) = (0, 0)
for (v, c) in zip(V, C):
	if v > c:
		x += v
		y += c
print(x - y)


n = int(input())
vlst = list(map(int, input().split()))
clst = list(map(int, input().split()))
ans = 0
for (v, c) in zip(vlst, clst):
	ans += max(0, v - c)
print(ans)


a = int(input())
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(a):
	if b[i] > c[i]:
		ans += b[i] - c[i]
print(ans)


input()
f = lambda : map(int, input().split())
print(sum((max(x - y, 0) for (x, y) in zip(f(), f()))))


N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for (i, j) in zip(V, C):
	ans += max(0, i - j)
print(ans)


import numpy as np
n = int(input())
v = np.array(list(map(int, input().split())))
c = np.array(list(map(int, input().split())))
a = v - c
print(a[a >= 0].sum())


n = int(input())
v = [int(s) for s in input().split()]
c = [int(s) for s in input().split()]
sum_ = 0
for i in range(n):
	if v[i] - c[i] > 0:
		sum_ += v[i] - c[i]
print(sum_)


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
nl = []
for i in range(len(v)):
	if v[i] - c[i] > 0:
		nl.append(v[i] - c[i])
nl.sort(reverse=True)
print(sum(nl[:n]))


N = int(input())
vs = list(map(int, input().split()))
cs = list(map(int, input().split()))
s = [v - c for (v, c) in zip(vs, cs) if v - c > 0]
print(sum(s))


n = int(input())
ans = 0
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
for i in range(n):
	if v[i] > c[i]:
		ans += v[i] - c[i]
print(ans)


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
r = 0
xy = [0] * n
for ii in range(n):
	xy[ii] = v[ii] - c[ii]
	if xy[ii] < 0:
		xy[ii] = 0
print(sum(xy))


N = int(input())
V = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
result = 0
for i in range(N):
	result += max(0, V[i] - C[i])
print(result)


N = int(input())
V = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
Y = 0
for x in range(N):
	Y += max(0, V[x] - C[x])
print(Y)


def main():
	g = []
	n = int(input())
	v = list(map(int, input().split()))
	c = list(map(int, input().split()))
	for i in range(n):
		gain = v[i] - c[i]
		if gain > 0:
			g.append(gain)
	print(sum(g))

def __starting_point():
	main()
__starting_point()


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
print(sum([max(v[i] - c[i], 0) for i in range(n)]))


n = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
L = []
for i in range(n):
	if V[i] - C[i] >= 0:
		L.append(V[i] - C[i])
print(sum(L))


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = sum([v - c for (v, c) in zip(v, c) if v - c > 0])
print(ans)


input()
print(sum((max(int(x) - int(y), 0) for (x, y) in zip(input().split(), input().split()))))


(N, *V) = map(int, open(0).read().split())
s = 0
for i in range(N):
	v = V[i]
	c = V[i + N]
	s += v - c if v - c > 0 else 0
print(s)


from typing import List

def answer(n: int, c: List[int], v: List[int]) -> int:
	return sum(list((j for j in (c[i] - v[i] for i in range(n)) if 0 < j)))

def main():
	n = int(input())
	c = list(map(int, input().split()))
	v = list(map(int, input().split()))
	print(answer(n, c, v))

def __starting_point():
	main()
__starting_point()


N = int(input())
V = map(int, input().split())
C = map(int, input().split())
D = [v - c for (v, c) in zip(V, C) if v - c > 0]
print(sum(D))


n = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for i in range(n):
	ans += max(0, V[i] - C[i])
print(ans)


n = int(input())
Vi = map(int, input().split())
Ci = map(int, input().split())
print(sum([max(0, v - c) for (v, c) in zip(Vi, Ci)]))


N = int(input())
V = map(int, input().split())
C = map(int, input().split())
S = 0
for (v, c) in zip(V, C):
	if v > c:
		S = S + (v - c)
print(S)


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
l = [x - y for (x, y) in zip(v, c)]
print(sum([x for x in l if x > 0]))


n = int(input())
v = map(int, input().split())
c = map(int, input().split())
b = [x - y for (x, y) in zip(v, c)]
print(sum(filter(lambda x: x > 0, b)))


import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

def I():
	return int(input())

def F():
	return float(input())

def SS():
	return input()

def LI():
	return [int(x) for x in input().split()]

def LI_():
	return [int(x) - 1 for x in input().split()]

def LF():
	return [float(x) for x in input().split()]

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

def resolve():
	N = I()
	V = LI()
	C = LI()
	ans = sum([V[i] - C[i] for i in range(N) if V[i] - C[i] > 0])
	print(ans)

def __starting_point():
	resolve()
__starting_point()


input()
VC = [v - c for (v, c) in zip(map(int, input().split()), map(int, input().split())) if v > c]
VC.append(0)
print(sum(VC))


n = int(input())
v = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
print(sum((_v - _c for (_v, _c) in zip(v, c) if _v > _c)))


n = int(input())
(v, c) = [list(map(int, input().split())) for _ in range(2)]
print(sum((v[i] - c[i] for i in range(n) if v[i] > c[i])))


N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
D = []
a = 0
for i in range(len(C)):
	D.append(V[i] - C[i])
for i in range(len(D)):
	if D[i] >= 1:
		a += D[i]
print(a)


N = int(input())
Vs = map(int, input().split())
Cs = map(int, input().split())
print(sum([v - c for (v, c) in zip(Vs, Cs) if v >= c]))


input()
a = list(map(int, input().split()))
b = list(map(int, input().split()))
m = 0
for (c, d) in zip(a, b):
	if c > d:
		m += c - d
print(m)


[print(sum(filter(lambda x: x > 0, map(lambda x: x[0] - x[1], zip(c, v))))) for (_, c, v) in [[input(), map(int, input().split()), map(int, input().split())]]]


(n, *t) = map(int, open(0).read().split())
print(sum(((x - y) * (x > y) for (x, y) in zip(t[:n], t[n:]))))


input()
(V, C) = [[int(x) for x in input().split(' ')] for _ in range(2)]
ans = 0
for (v, c) in zip(V, C):
	ans += max(v - c, 0)
print(ans)


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
m = [v[i] - c[i] for i in range(n) if v[i] > c[i]]
print(sum(m))


n = input()
v = list(map(int, input().split()))
c = list(map(int, input().split()))
t = [i - j if i - j > 0 else 0 for (i, j) in zip(v, c)]
print(sum(t))


n = int(input())
l = [i - j for (i, j) in zip(map(int, input().split()), map(int, input().split())) if i - j > 0]
print(sum(l))


N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
diff = [V[i] - C[i] for i in range(N)]
diff.sort(reverse=True)
x = 0
for i in range(N):
	if diff[i] < 0:
		break
	x += diff[i]
print(x)


N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
print(sum([a - b if a - b > 0 else 0 for (a, b) in zip(V, C)]))


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = sum((max(0, x - y) for (x, y) in zip(v, c)))
print(ans)


N = input()
V = map(int, input().split())
C = map(int, input().split())
VC = [v - c for (v, c) in zip(V, C) if v > c]
VC.append(0)
print(sum(VC))


N = int(input())
V = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
vc = 0
for j in range(N):
	if V[j] - C[j] > 0:
		vc = vc + (V[j] - C[j])
print(vc)


(_, *t) = [map(int, t.split()) for t in open(0)]
print(sum(((x - y) * (x > y) for (x, y) in zip(*t))))


n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
s = 0
for (i, j) in zip(a, b):
	s += max(i - j, 0)
print(s)


n = int(input())
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
l = [0] * n
for i in range(n):
	l[i] = v[i] - c[i]
	if l[i] < 0:
		l[i] = 0
print(sum(l))


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
x = 0
for (i, j) in zip(v, c):
	a = i - j
	if a > 0:
		x += a
print(x)


_ = input()
V = map(int, input().strip().split(' '))
C = map(int, input().strip().split(' '))
print(sum([v - c for (v, c) in zip(V, C) if v - c > 0]))


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
d = 0
for (a, b) in zip(v, c):
	if a - b > 0:
		d += a - b
print(d)


N = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(len(v)):
	if v[i] - c[i] >= 0:
		ans = ans + v[i] - c[i]
print(ans)


def solve():
	n = int(input())
	v = list(map(int, input().split()))
	c = list(map(int, input().split()))
	res = 0
	for i in range(n):
		x = v[i] - c[i]
		if x > 0:
			res += x
	print(res)
solve()


N = int(input())
R = input().split()
C = input().split()
P = 0
for i in range(N):
	if int(R[i]) - int(C[i]) >= 0:
		P += int(R[i]) - int(C[i])
print(P)


n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
print(sum([max(0, xx - yy) for (xx, yy) in zip(x, y)]))


N = int(input())
V = map(int, input().split())
C = map(int, input().split())
score = [v - c for (v, c) in zip(V, C) if v > c]
print(sum(score))


n = int(input())
v_list = [int(i) for i in input().split()]
c_list = [int(i) for i in input().split()]
total_list = []
for i in range(n):
	total_list.append(v_list[i] - c_list[i])
total_list.sort(reverse=True)
sum = 0
for i in total_list:
	if i > 0:
		sum += i
	else:
		break
print(sum)


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
li = []
su = 0
for i in range(n):
	li.append(v[i] - c[i])
for i in li:
	if i > 0:
		su += i
print(su)


num = int(input())
str1 = input().split()
str2 = input().split()
str3 = []
for i in range(num):
	str3.append(int(str1[i]) - int(str2[i]))
total = 0
count = 0
for i in range(num):
	if str3[i] > 0:
		total += str3[i]
		count += 1
if count == 0:
	print(0)
else:
	print(total)


n = int(input())
(a, b) = [list(map(int, input().split())) for i in range(2)]
s = 0
for (v, c) in zip(a, b):
	if v - c > 0:
		s += v - c
print(s)


N = input()
V = [int(X) for X in input().split()]
C = [int(X) for X in input().split()]
print(sum((X - Y if X - Y > 0 else 0 for (X, Y) in zip(V, C))))


n = int(input())
vl = list(map(int, input().split()))
cl = list(map(int, input().split()))
a = 0
for (v, c) in zip(vl, cl):
	if v > c:
		a += v - c
print(a)


n = int(input())
aa = list(map(int, input().split()))
bb = list(map(int, input().split()))
ans = 0
for (a, b) in zip(aa, bb):
	if a - b > 0:
		ans += a - b
print(ans)


n = int(input())
v1 = input().split()
c1 = input().split()
k = 0
for i in range(n):
	l = int(v1[i]) - int(c1[i])
	if l > 0:
		k += l
print(k)


print(sum((max(x - y, 0) for (x, y) in zip(*[map(int, t.split()) for t in open(0)][1:]))))


N = input()
vs = [int(x) for x in input().split()]
cs = [int(x) for x in input().split()]
m = sum([v - c for (v, c) in zip(vs, cs) if v - c > 0])
print(m)


n = int(input())
(v, c) = (list(map(int, input().split())), list(map(int, input().split())))
x = [a - b for (a, b) in zip(v, c)]
s = sum((i for i in x if i > 0))
print(s)


import itertools
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
xy = 0
for i in range(1, n + 1):
	for h in itertools.combinations(range(0, n), i):
		x = 0
		y = 0
		for j in h:
			x += v[j]
			y += c[j]
		if xy < x - y:
			xy = x - y
print(xy)


N = int(input())
cost = [int(c) - int(v) for (c, v) in zip(input().split(), input().split())]
print(sum([c if c > 0 else 0 for c in cost]))


n = int(input())
lv = list(map(int, input().split()))
lc = list(map(int, input().split()))
print(sum((max(v - c, 0) for (v, c) in zip(lv, lc))))


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
vc = []
for (i, j) in zip(v, c):
	vc.append(i - j)
vc = sorted(vc, reverse=True)
ans = 0
for i in vc:
	if i <= 0:
		break
	ans += i
print(ans)


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
a = []
for i in range(n):
	if v[i] > c[i]:
		a.append(v[i] - c[i])
print(sum(a))


n = int(input())
list_v = [int(i) for i in input().split()]
list_c = [int(j) for j in input().split()]
ans = 0
for i in range(0, n):
	if list_v[i] - list_c[i] > 0:
		ans += list_v[i] - list_c[i]
print(ans)


N = int(input())
V = input().split(' ')
C = input().split(' ')
ans = 0
for i in range(N):
	ans += max(0, int(V[i]) - int(C[i]))
print(int(ans))


u = 0
n = int(input())
(v, c) = [list(map(int, input().split())) for i in range(2)]
for i in range(n):
	if v[i] - c[i] > 0:
		u += v[i] - c[i]
print(u)


N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
Z = [x - y for (x, y) in zip(V, C) if x - y > 0]
print(sum(Z))


input()
print(sum([max(int(v) - int(c), 0) for (v, c) in zip(input().split(), input().split())]))


N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
total = 0
for (i, j) in zip(V, C):
	s = i - j
	if s > 0:
		total += s
print(total)


import sys
import numpy as np
n = int(input())
vList = list(map(int, input().split()))
cList = list(map(int, input().split()))
ans = 0
for (v, c) in zip(vList, cList):
	ans += max(v - c, 0)
print(ans)


input()
V = list(map(int, input().split()))
C = list(map(int, input().split()))
S = 0
for (v, c) in zip(V, C):
	s = v - c
	if s > 0:
		S += s
print(S)


def main():
	n = int(input())
	V = [int(x) for x in input().split()]
	C = [int(x) for x in input().split()]
	ans = 0
	for (v, c) in zip(V, C):
		if v - c > 0:
			ans += v - c
		else:
			ans += 0
	print(ans)

def __starting_point():
	main()
__starting_point()


import itertools
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
diff_VC = list((i - j for (i, j) in zip(V, C)))
c = []
for i in range(N):
	c += [sum(comb) for comb in itertools.combinations(diff_VC, i + 1)]
print(max(max(c), 0))


n = int(input())
v = [int(_) for _ in input().split()]
c = [int(_) for _ in input().split()]
print(sum([max(x[0] - x[1], 0) for x in zip(v, c)]))


_ = input()
V = list(map(int, input().split()))
C = list(map(int, input().split()))
print(sum(map(lambda p: max(0, p[0] - p[1]), zip(V, C))))


N = int(input())
v = map(int, input().split())
c = map(int, input().split())
ans = 0
for (vv, cc) in zip(v, c):
	ans += max(vv - cc, 0)
print(ans)


f = lambda : list(map(int, input().split()))
f()
print(sum((max(0, a - b) for (a, b) in zip(f(), f()))))


import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007

def main():
	N = int(readline())
	V = list(map(int, readline().split()))
	C = list(map(int, readline().split()))
	ans = 0
	for (v, c) in zip(V, C):
		if v > c:
			ans += v - c
	print(ans)
	return

def __starting_point():
	main()
__starting_point()


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
m = 0
for i in range(len(v)):
	if v[i] > c[i]:
		m += v[i] - c[i]
print(m)


N = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
L = [max(v[i] - c[i], 0) for i in range(N)]
print(sum(L))


N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
print(sum([max(0, A[i] - B[i]) for i in range(N)]))


N = input()
X = list(map(int, input().split(' ')))
Y = list(map(int, input().split(' ')))
s = 0
for (i, it) in enumerate(X):
	if it > Y[i]:
		s += it - Y[i]
print(s)


I = lambda : map(int, input().split())
N = int(input())
(*V,) = I()
(*C,) = I()
print(sum([x - y for (x, y) in zip(V, C) if x - y > 0]))


l = input()
V = map(int, input().split())
C = map(int, input().split())
r = 0
for (v, c) in zip(V, C):
	if v - c > 0:
		r += v - c
print(r)


n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for (x, y) in zip(v, c):
	if x - y > 0:
		ans += x - y
print(ans)


N = int(input())
V = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
W = [max(V[i] - C[i], 0) for i in range(N)]
print(sum(W))


N = int(input())
V = list(map(lambda v: int(v), input().split(' ')))
C = list(map(lambda c: int(c), input().split(' ')))
s = 0
for i in range(N):
	d = V[i] - C[i]
	s += max([d, 0])
print(s)


import numpy as np
N = int(input())
V = np.array(list(map(int, input().split())))
C = np.array(list(map(int, input().split())))
P = V - C
ans = 0
for i in P:
	if i >= 0:
		ans += i
print(ans)


a = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
s = 0
for (i, j) in zip(x, y):
	if i > j:
		s += i - j
print(s)


N = int(input())
A = map(int, input().split())
B = map(int, input().split())
ans = 0
for (a, b) in zip(A, B):
	ans += max(0, a - b)
print(ans)


n = int(input())
a = 0
V = list(map(int, input().split()))
C = list(map(int, input().split()))
for (v, c) in zip(V, C):
	b = v - c
	if b > 0:
		a += b
print(a)


n = int(input())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
ans = 0
for (p, q) in zip(x, y):
	if p - q > 0:
		ans += p - q
print(ans)


n = int(input())
V = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
print(sum([v - c for (v, c) in zip(V, C) if v > c]))


R = lambda : map(int, input().split())
input()
print(sum((x - y for (x, y) in zip(R(), R()) if x > y)))


n = int(input())
(*vl,) = map(int, input().split())
(*cl,) = map(int, input().split())
for i in range(n):
	vl[i] = max(0, vl[i] - cl[i])
print(sum(vl))


n = int(input())
v = input().split()
c = input().split()
a = 0
for i in range(n):
	k = int(v[i]) - int(c[i])
	if k > 0:
		a += k
print(a)


LI = lambda : list(map(int, input().split()))
N = int(input())
V = LI()
C = LI()

def main():
	ans = 0
	for (v, c) in zip(V, C):
		if v > c:
			ans += v - c
	print(ans)

def __starting_point():
	main()
__starting_point()


n = int(input())
V = list(map(int, input().split()))
P = list(map(int, input().split()))
ans = 0
for (v, p) in zip(V, P):
	ans += max(0, v - p)
print(ans)


N = list(map(int, open(0).read().split()))
v = 0
for i in range(N[0]):
	d = N[1 + i] - N[1 + i + N[0]]
	if d > 0:
		v += d
print(v)


n = int(input())
v = list(map(int, input().strip().split()))
c = list(map(int, input().strip().split()))
res = 0
for i in range(n):
	eco = v[i] - c[i]
	if eco > 0:
		res += eco
print(res)


N = int(input())
values = list(map(int, input().split()))
costs = list(map(int, input().split()))
ans = 0
for i in range(N):
	if values[i] - costs[i] > 0:
		ans += values[i] - costs[i]
print(ans)