Problem:


Score : 200 points

Problem Statement

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 1

3
10 2 5
6 3 4

Sample Output 1

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.

Sample Input 2

4
13 21 6 19
11 30 6 15

Sample Output 2

6

Sample Input 3

1
1
50

Sample Output 3

0



Sample input:
3
10 2 5
6 3 4


Sample output:
5

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
R = []
for i in range(N):
  l = V[i] - C[i]
  R.append(l)
cost = 0
for r in R:
  if r > 0:
    cost += r
print(cost)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
n = int(input())
v = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
ans = 0

for i, j in zip(v,c):
	if i - j > 0:
		ans += (i - j)

print(ans)

Submission status: Accepted

Solution code:
import sys
import numpy as np
input = sys.stdin.readline
n = int(input())
value = np.array(tuple(map(int, input().split())))
cost = np.array(tuple(map(int, input().split())))
np.maximum(value - cost, 0, out=value)
print(np.sum(value))

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
value = np.array(tuple(map(int, input().split())))
cost = np.array(tuple(map(int, input().split())))
np.maximum(value - cost, 0, out=value)
print(np.sum(value))

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
value = np.array(tuple(map(int, input().split())))
cost = np.array(tuple(map(int, input().split())))
xy = value - cost
np.maximum(xy, 0, out=xy)
print(np.sum(xy))

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
value = np.array(tuple(map(int, input().split())))
cost = np.array(tuple(map(int, input().split())))
xy = value - cost
aa = np.zeros(n, dtype=int)
np.maximum(xy, aa, out=xy)
print(int(sum(xy)))

Submission status: Accepted

Solution code:
n = int(input())
value = tuple(map(int, input().split()))
cost = tuple(map(int, input().split()))
# iこめまでのxーyの最大値
inf = -100
dp = [inf] * (n+1)
dp[1] = max(0, value[0]-cost[0])
for i in range(2, n+1):
    dp[i] = max(dp[i-1], dp[i-1]+value[i-1]-cost[i-1])

print(dp[n])

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
value = np.array(tuple(map(int, input().split())))
cost = np.array(tuple(map(int, input().split())))
xy = value - cost
ans = 0
for i in range(n):
    if xy[i] < 0:
        continue
    else:
        ans += xy[i]
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

value = 0
cost = 0
for i in range(n):
  if v[i] - c[i] > 0:
    value += v[i]
    cost += c[i]

print(value - cost)

Submission status: Accepted

Solution code:
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(ans,ans + i - j)
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
v=list(int(x) for x in input().split())
c=list(int(y) for y in input().split())
e=[]
for i in range(n):
	if (v[i]-c[i])>0:
		e.append(v[i]-c[i])
ans=sum(e)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

diff = [x - y for (x, y) in zip(v, c)]
ans = sum([x for x in diff if x > 0])
print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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))

Submission status: Accepted

Solution code:
n=int(input())
*a,=map(int,input().split())
*b,=map(int,input().split())
ans=0
sum = 0
for i in range(n):
  v = a[i]
  c = b[i]
  if v>c:
    sum += v-c
 
print(sum)

Submission status: Accepted

Solution code:
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] :
        x += v[i]
        y += c[i]

print(x - y)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
n = int(input())

value = map(int,input().split())
cost = map(int,input().split())
value = list(value)
cost = list(cost)

sum = 0
for i in range(n):
  v = value[i]
  c = cost[i]
  if v > c:
    sum += v-c

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int, input().split(' ')))
b=list(map(int, input().split(' ')))

ans = 0
for i, j in zip(a,b):
	ans += max(0, i-j)
print(ans)

Submission status: Accepted

Solution code:
import sys
 
stdin = sys.stdin

mod = 1000000007
inf = 1 << 60
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()
nas = lambda: stdin.readline().split()

n = ni()
v = na()
c = na()

d = [v[i] - c[i] for i in range(n)]
ans = 0
for i in range(n):
    if d[i] > 0:
        ans += d[i]

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = [int(i) for i in input().split()]
C = [int(j) for j in input().split()]

ans = 0
for i, j in zip(V, C):
    if i > j:
        ans += i - j
print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
dif=[]
count=0
for i in range(N):
    dif.append(int(V[i]-C[i]))

dif.sort(reverse=True)

i=0
for i in range(N):
    if dif[i]>=0:
        count=count+dif[i]
    else:
        break

print(count)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))

z=0
for i in range(n):
	if v[i]-c[i]>0:
		z+=v[i]-c[i]
print(z)

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    N = int(input())
    V = tuple(map(int, input().split()))
    C = tuple(map(int, input().split()))

    ans = 0
    for v, c in zip(V, C):
        ans += max(v-c, 0)
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

answer = 0
for v, c in zip(V, C):
    if v > c:
        answer += v - c

print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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(x)

Submission status: Accepted

Solution code:

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

ans = 0
for i in range(N):
    x = V[i] - C[i]
    if x > 0:
        ans += x
print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
import sys
import numpy as np

I = np.array(sys.stdin.read().split(), dtype=np.int64)
n = I[0]
v, c = I[1:].reshape(2, n)

def main():
    return np.sum(np.maximum(v - c, 0))

if __name__ == '__main__':
    ans = main()
    print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math

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)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
n = int(input())
val_j = list(map(int, input().split()))
cost = list(map(int, input().split()))
profit = [0]*n
total_p = 0
for i in range(0, n):
    profit[i] = val_j[i] - cost[i]
for i in profit:
    if i > 0:
        total_p += i
print(total_p)

Submission status: Accepted

Solution code:
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)))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
N = int(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)

Submission status: Accepted

Solution code:
N = int(input())
V = map(int,input().split())
C = map(int,input().split())

ans = 0

for i,j in zip(V,C):
    if i-j>0:
        ans += i-j

print(ans)

Submission status: Accepted

Solution code:
import numpy as np 

N = int(input())
V = map(int,input().split())
C = map(int,input().split())

ans = 0

for i,j in zip(V,C):
    if i-j>0:
        ans += i-j

print(ans)

Submission status: Accepted

Solution code:
import numpy as np 

N = int(input())
V = map(int,input().split())
C = map(int,input().split())

A = []

for i,j in zip(V,C):
    A.append(i-j)

A = np.array(A)

print(np.sum(A[A>0]))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

D = [v-c for v, c in zip(V, C)]

take = [d for d in D if d > 0]
print(sum(take))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
n = int(input())
vList = list(map(int,input().split()))
pList = list(map(int,input().split()))

for i in range(n):
  vList[i] -= pList[i]

resultList = sorted(vList,reverse = True)

count = 0
for i in resultList:
  if i > 0:
    count += i
  else:
    break

print(count)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

profit =  0

for i in range(n):
    if v[i] - c[i] > 0:
        profit += v[i] - c[i]

print(profit)

Submission status: Accepted

Solution code:
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)))

Submission status: Accepted

Solution code:

n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = 0
diff = 0

for i in range(n):
    if v[i] - c[i] > 0:
#        diff = v[i] - c[i]
#        print(diff)
        ans += v[i] - c[i]

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
Vs = [int(s) for s in input().split(' ')]
Cs = [int(s) for s in input().split(' ')]
cost = 0
for v, c in zip(Vs, Cs):
    cost += max(0, v - c)

print(cost)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
n = int(input())
v = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
print(sum([a - b if a > b else 0 for a, b in zip(v, c)]))

Submission status: Accepted

Solution code:
import os, sys, re, math

N = int(input())
V = [int(n) for n in input().split()]
C = [int(n) for n in input().split()]

d = 0
for i in range(N):
    if V[i] > C[i]:
        d += V[i] - C[i]
print(d)

Submission status: Accepted

Solution code:
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)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
*v, = map(int, input().split())
*c, = map(int, input().split())

dp = [[0]*(n+1) for _ in range(n+1)]

for i in range(n+1):
    for j in range(n):
        dp[i][j+1] = dp[i][j]
        dp[i][j+1] = max(dp[i][j], dp[i][j]+v[j]-c[j])

print(dp[n][n])

Submission status: Accepted

Solution code:
from itertools import combinations
n=int(input())
v=list(map(int, input().split()))
c=list(map(int, input().split()))
v_c=[v[i]-c[i] for i in range(n)]

x_y=0
for i in range(n):
	if v_c[i]>=0:
		x_y+=v_c[i]

print(x_y)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))

x = []
for i in range(n):
    if v[i] - c[i] > 0:
        x.append(v[i] - c[i])
print(sum(x))

Submission status: Accepted

Solution code:
N = int(input())

V_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))

cnt = 0
for i in range(N):
  cnt += max(0, V_list[i]-C_list[i])
  
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

gain = [0]*n

for i in range(n):
    if v[i]-c[i] > 0:
        gain[i] = v[i]-c[i]


print(sum(gain))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
total = 0

for v, c in zip(V, C):
    if v > c:
        total += v - c

print(total)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
n = int(input())
v = [int(x) for x in input().split()]
c = [y - int(x) for x, y in zip(input().split(), v)]

p = 0
for i in range(n):
   if (c[i] > 0):
      p += c[i]
print(p)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))

ans = 0
for vv,cc in zip(v,c):
  if vv - cc > 0:
    ans += vv-cc
print(ans)

Submission status: Accepted

Solution code:
"""
author : halo2halo
date : 12, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    V = list(map(int, input().split(" ")))
    C = list(map(int, input().split(" ")))
    L = []
    for v, c in zip(V, C):
        L.append(max(v - c, 0))
    print(sum(L))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
vl=list(map(int,input().split()))
cl=list(map(int,input().split()))

val=0

for i in range(n):
    dif=vl[i]-cl[i]
    if dif>=0:
        val+=dif
print(val)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
#S = str(input())
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

sum = 0
for i in range(N) :
  if V[i] - C[i] > 0 :
    sum += V[i] - C[i]
  
print (sum)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
X = 0
Y = 0
for i in range(N):
  if ans < (X + V[i]) - (Y + C[i]):
      X += V[i]
      Y += C[i]
      ans = X - Y

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=[]
sum_v=0
sum_c=0
for i in range(n):
	if v[i]-c[i]>=0:
		sum_v+=v[i]
		sum_c+=c[i]
		ans.append(sum_v-sum_c)
try:
	print(max(ans))
except ValueError:
	print("0")

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
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]
    else:
        ans = ans

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))

ans = 0
for i in range(n):
  if a[i] > b[i]:
    ans += a[i]-b[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
p = int(input())
count = 0
V = list(map(int,input().split()))
C = list(map(int,input().split()))
for i in range(p):
  if V[i] - C[i] > 0:
    count += V[i] - C[i]
  else:
    pass
print(count)

Submission status: Accepted

Solution code:
N = int(input())
values = [int(i) for i in input().split()]
costs = [int(i) for i in input().split()]

ans = 0
for v, c in zip(values, costs):
    if v >= c:
        ans += v - c
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

res = 0

for i in range(n):
    if v[i] - c[i] >= 0:
        res += v[i] - c[i]
print(res)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
N = int(input())
values = list(map(int, input().split()))
costs =list(map(int, input().split()))

max_value = 0

for i in range(N):
    diff = values[i] - costs[i]
    if diff > 0:
        max_value += diff

print(max_value)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=[]
v=list(map(int,input().split()))
c=list(map(int,input().split()))

for i in range(n):
    if v[i]-c[i]>0:
        a.append(v[i]-c[i])
print(sum(a))

Submission status: Accepted

Solution code:
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)]))

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))

sumX = 0
sumC = 0

for i in range(N):
    if (V[i] - C[i]) > 0 :
        sumX += V[i]
        sumC += C[i]

print(sumX - sumC)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Resale

# libraries
import numpy as np

# input
N = int(input())
V = np.array(list(map(int, input().split())))
C = np.array(list(map(int, input().split())))

# solve
res = sum([max(0, v - c) for v, c in zip(V, C)])

# output
print(res)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))

ans = 0
for x,y in zip(v,c):
    ans += max(0,x-y)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
vi = list(map(int, input().split()))
ci = list(map(int, input().split()))

prof = 0

for i in range(n):
    if vi[i] - ci[i] > 0:
        prof += vi[i] - ci[i]

print(prof)

Submission status: Accepted

Solution code:
n=int(input())
v_list=list(map(int,input().split()))
c_list=list(map(int,input().split()))

diff_list = [v_list[i]-c_list[i] for i in range(n) if v_list[i] - c_list[i] > 0]
diff_list.append(0)
print(sum(diff_list))

Submission status: Accepted

Solution code:
N = int(input())
V_list = list(map(int,input().split()))
C_list = list(map(int,input().split()))
value_list = [x-y for (x,y) in zip(V_list,C_list)]

ans = 0
for i in value_list:
    if i>0:
        ans += i

print(ans)

Submission status: Accepted

Solution code:
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) if v[i]-c[i] > 0]
diff.append(0)
print(sum(diff))

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
N = int(input())

V = list(map(int,input().split()))
C = list(map(int,input().split()))

a = 0
for i in range(N):
    if V[i] > C[i]:
        a += V[i]-C[i]

print(a)

Submission status: Accepted

Solution code:
n = int(input())

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

total = 0
for i in range(n):
    if A[i] - B[i] > 0:
        total += A[i] - B[i]
print(total)

Submission status: Accepted

Solution code:
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)))

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
A = []

for i in range(N):
    A.append(V[i] - C[i])
tmp = 0
for v in A:
    if v > 0:
        tmp += v
print(tmp)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

sum = 0
for n in range(N):
  if V[n] > C[n]:
    sum += V[n] - C[n]
    
print(sum)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
V = str(input())
C = str(input())
V = V.split()
C = C.split()
V_list = []
C_list = []
diff_list = []
for i in range(N):
    V_list.append(int(V[i]))
    C_list.append(int(C[i]))
for i in range(N):
    diff_list.append(V_list[i] - C_list[i])

diff_list.sort()
diff_list.reverse()
result = 0
for i in range(N):
    if diff_list[i] >= 0:
        result = result + diff_list[i]
    else:
        break

print(result)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))

cal = []
for i in range(0,n):
    cal.append(v[i]-c[i])
cal.sort(reverse=True)
ans = 0
for j in range(0,n):
    if cal[j] < 0:
        break
    ans += cal[j]
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = [i for i in map(int, input().split())]
C = [i for i in map(int, input().split())]

max_value = 0
for i in range(N):
  if V[i] > C[i]:
    max_value += V[i] - C[i]
    
print(max_value)

Submission status: Accepted

Solution code:
n = int(input())
v = list(input().split())
c = list(input().split())
tmp = 0

for i in range(n):
    if int(v[i])-int(c[i]) > 0:
        tmp += int(v[i])-int(c[i])

print(tmp)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from functools import reduce
from operator import add
n=int(input())
v=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
l=[v[i]-c[i] for i in range(n) if v[i]>c[i]]
print(reduce(add,l) if l else 0)

Submission status: Accepted

Solution code:
n=int(input())
v=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
dif=[]
for i in range(n):
  if v[i]>c[i]:
    dif.append(v[i]-c[i])
print(sum(dif))

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
mx=0
for i in range(n):
    s=0
    for j in range(i,n):
        if v[j]>c[j]:
            s+=v[j]-c[j]
    mx=max(mx,s)
print(mx)

Submission status: Accepted

Solution code:
#ABC-125-B
import numpy as np
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

VminusC = np.array(V) - np.array(C)

ans = 0
for item in VminusC:
    if item > 0:
        ans += item
        
print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
N = int(input())
V = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]

ans = 0
for v, c in zip(V, C):
    ans += max(v - c, 0)

print(ans)

Submission status: Accepted

Solution code:
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)

Submission status: Accepted

Solution code:
N, *L,  = [list(map(int, s.split())) for s in open(0)]
N = N[0]
value = 0
for i in range(N):
    if L[0][i] > L[1][i]:
        value += L[0][i] - L[1][i]
print(value)

Submission status: Accepted

Solution code:
def solve():
    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)


if __name__ == '__main__':
    solve()