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()))
l=[]
for i in range(n):
        if v[i]>c[i]:
                j=v[i]-c[i]
                l.append(j)
print(sum(l))

Submission status: Accepted

Solution code:
n=int(input())

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

Submission status: Accepted

Solution code:
def main():
    n=int(input())
    x=list(map(int,input().split(' ')))
    y=list(map(int,input().split(' ')))
    ans = 0
    for i,j in zip(x,y):
        if i-j > 0:
            ans += i-j
    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()))

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

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:
import numpy as np
N = int(input())

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

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


C   = V-C

sum = 0

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

print(sum)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
sys.setrecursionlimit(10 ** 7)


def solve(N: int, V: "List[int]", C: "List[int]"):
    ans = 0
    for i in range(len(V)):
        ans += max(V[i] - C[i], 0)
    print(ans)
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools
# (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    V = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    C = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, V, C)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

s=[ v[i] - c[i] for i in range(n) if v[i] - c[i] >= 0]
print(sum(s))

Submission status: Accepted

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

s = [v[i]-c[i] for i in range(n) if v[i]-c[i] >= 0]
print(sum(s))

Submission status: Accepted

Solution code:
N = int(input())
Vs = list(map(int, input().split()))
Cs = list(map(int, input().split()))
ans = 0
for v, c in zip(Vs, Cs):
  if v - c > 0:
    ans += v-c

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()))

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

print(g)

Submission status: Accepted

Solution code:
N = int(input())
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
ans = [l-p for l,p in zip(v,c)]
ans1 = 0
for i in ans :
  ans1 += i if i>0 else 0
print(ans1)

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:
from collections import Counter,defaultdict
import sys,bisect,math,itertools,string,queue
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

n = inp()
v = inpl()
c = inpl()
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()))
cnt = 0
for i in range(N):
    if V[i]>C[i]:
        cnt += V[i]-C[i]
print(cnt)

Submission status: Accepted

Solution code:
n = int(input())
v_lst = map(int, input().split())
c_lst = map(int, input().split())
i = 0
res = 0
for v, c in zip(v_lst, c_lst):
  value = v - c
  if value > 0:
    res += value
  i += 1
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]:
        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()))
tot = 0
for i in range(N):
	if V[i] > C[i]:
		tot += V[i] - C[i]
print(tot)

Submission status: Accepted

Solution code:
N = int(input())
v_l = list(map(int, input().split()))
c_l = list(map(int, input().split()))
net = [v_l[i] - c_l[i] for i in range(N)]
max = 0
for i in range(N):
  if net[i] > 0:
    max = max + net[i]
  else:
    max = max
print(max)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
benefit = [v[i] - c[i] for i in range(n)]
benefit.sort(reverse=True)
ans = 0
for b in benefit:
  if b > 0:
    ans += b
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()]

v2 = [i-j for i,j in zip(v,c) if i -j > 0]

print(sum(v2))

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:
N=int(input())
l_v=list(map(int,input().split()))
l_c=list(map(int,input().split()))
ans=0
for i in range(N):
  if l_v[i] >= l_c[i]:
    ans+=l_v[i]-l_c[i]
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-


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

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


if __name__ == "__main__":
    main()

Submission status: Accepted

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

value = [v - c for v, c in zip(v, c)]
print(sum([i for i in value if i > 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()]

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

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))
    profit = 0
    for v, c in zip(V, C):
        if v-c > 0:
            profit += v-c
    print(profit)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
va = list(map(int,input().split()))
co = list(map(int,input().split()))
su = 0
for i in range(N):
    if su < su + va[i] - co[i]:
        su += va[i] - co[i]
        
        
print(su)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split(" ")))
c = list(map(int,input().split(" ")))
ans = []
for i in range(n):
    tmp = v[i] -c[i]
    if tmp > 0:
        ans.append(tmp)
print(sum(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:
        ans += 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 in range(N):
  temp=V[i]-C[i]
  if temp>0:
    ans+=temp
    
print(int(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())
lv = list(map(int, input().split()))
lc = list(map(int, input().split()))

ans = 0
for i in range(n):
    ans += max(lv[i] - lc[i], 0)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
N = int(input())
V_array = list(map(int, input().split()))
C_array = list(map(int, input().split()))
ans = 0

for i in range(N):
	if V_array[i] - C_array[i] >= 0:
		ans += V_array[i] - C_array[i]


print(ans)

Submission status: Accepted

Solution code:
n = int(input())
lv = list(map(int, input().split()))
lc = list(map(int, input().split()))

ans = 0

for i in range(n):
    ans += max(lv[i] - lc[i], 0)

print(ans)

Submission status: Accepted

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

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] > 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()))
import numpy as np
x = np.array(v)
y = np.array(c)
z = [i for i in x-y if i>=0]
print(sum(z))

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):
    data = V[i]-C[i]
    if data >= 0:
        R.append(data)
        
print(sum(R))

Submission status: Accepted

Solution code:
num = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
sums=0
for t in range(num):
  values = v[t] - c[t]
  if values > 0:
    sums += values
print(sums)

Submission status: Accepted

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

sa = [v-c if v-c>0 else 0 for v,c in zip(V,C)]

print(sum(sa))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
values = list(map(int, input().split()))
costs = list(map(int, input().split()))
profits = [v - c for v, c in zip(values, costs)]
res = 0
for value, cost in zip(values, costs):
    x = value - cost
    if x > 0:
        res += x
print(res)

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())))

diff = v - c
diff = np.sort(diff)[::-1]

ans = 0
for i in range(n):
    if diff[i] <= 0:
        break
    ans += diff[i]

print(ans)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10000000)
from functools import lru_cache

@lru_cache(maxsize=None)
def dfs(i,cost):
    if i == N:
        return 0

    res1 = dfs(i+1,cost)
    res2 = dfs(i+1,cost+C[i]) + V[i] - C[i]

    return max(res1,res2)

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

print(dfs(0,0))

Submission status: Accepted

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

Submission status: Accepted

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

s = 0
for i in range(N):
  s += max(V[i]-C[i], 0)
print(s)

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 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())
V = map(int, input().split())
C = map(int, input().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_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))
score_list = [max(0, V_list[i]-C_list[i]) for i in range(N)]
print(sum(score_list))

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()))
vc = []
m = 0
for i in range(n):
    vc.append(v[i]-c[i])
for j in range(n):
    if vc[j] > 0:
        m += vc[j]
print(m)

Submission status: Accepted

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

max_values = 0
for value, cost in zip(values, costs):
  diff = value - cost
  if diff > 0:
    max_values += diff
print(max_values)

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=input().split()
c=input().split()
ans=0
for i in range(n):
  if int(v[i])-int(c[i]) > 0:
    ans += int(v[i])-int(c[i])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
lst1 = list(map(int, input().split()))
lst2 = list(map(int, input().split()))
cnt = 0
for (i, j) in zip(lst1, lst2):
    if i - j > 0:
        cnt += i-j
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
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))

Submission status: Accepted

Solution code:
import numpy as np
N=int(input())
v=list(map(int, input().split()))
c=list(map(int, input().split()))
v=np.array(v)
c=np.array(c)
s=(v-c)
s=s.tolist()
s=[x if x>0 else 0 for x in s]
print(sum(s))

Submission status: Accepted

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

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

Submission status: Accepted

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

count=0
for i in range(n):
    count+=max(0, v[i]-c[i])
print(count)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def MAP(): return map(int,input().split())

n = int(input())
*v, = MAP()
*c, = MAP()

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())
Vs = list(map(int, input().split()))
Cs = list(map(int, input().split()))

ans = 0
for i in range(N):
    if Vs[i] - Cs[i] > 0:
        ans += 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 i in range(N):
    #for文の中では三項演算子ダメ？
     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()))
result = 0
for i in range(n):
    x = 0
    x = v[i]-c[i]
    if x > 0:
        result += x
print(result)

Submission status: Accepted

Solution code:
n = int(input())
vs = [int(i) for i in input().split()]
cs = [int(i) for i in input().split()]
ds = [vs[i]-cs[i] for i in range(n) if vs[i]-cs[i] > 0]
print(sum(ds))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
vs = list(map(int, input().split()))
cs = list(map(int, input().split()))

# ret = - float('inf')
# for i in range((2 ** n)):
#     total_cost = 0
#     total_value = 0
#     j = 0
#     while i > 0:
#         if i & 1:
#             total_cost += cs[j]
#             total_value += vs[j]
#         i >>= 1
#         j += 1
#     ret = max(ret, total_value - total_cost)
# print(ret)

x = 0
y = 0
for i in range(n):
    if vs[i] > cs[i]:
        x += vs[i]
        y += cs[i]
print(x - y)

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
V = np.array([int(v) for v in input().split()])
C = np.array([int(c) for c in input().split()])
R = V - C
print(R[R > 0].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):
    diff = V[i] - C[i]
    if diff > 0:
        ans += diff

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
V_list = list(map(int,input().split()))
C_list = list(map(int,input().split()))
Answer = 0
for i in range(N):
  if V_list[i] > C_list[i]:
    Answer += V_list[i] -C_list[i]

print(Answer)

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):
    diff = v[i] - c[i]
    if diff > 0:
        ans += diff

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))
result = []
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()))
sv=[0]
for i in range(n):
    if v[i]-c[i]>0:
        sv.append(int(v[i]-c[i]))
print(sum(sv))

Submission status: Accepted

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

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())))

V = V-C
ans = 0
for v in V:
    if v <= 0:
        continue
    ans += v

print(ans)

Submission status: Accepted

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

sum_v = []
ans = 0
for i in range(N):
    sum_v.append(V[i]-C[i])
sum_v.sort(reverse=True)

for j in range(N):
    if sum_v[j] > 0:
        ans += sum_v[j]
    else:
        break

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

v = list(map(int,input().split()))
c = list(map(int,input().split()))

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

Submission status: Accepted

Solution code:
N = int(input())
vs = list(map(int, input().split()))
cs = list(map(int, input().split()))

res = 0
for i in range(N):
    res += max(0, vs[i] - cs[i])

print(res)

Submission status: Accepted

Solution code:
N = int(input())
v = list(int(i) for i in input().split())
c = list(int(i) for i in input().split())

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

print(result)

Submission status: Accepted

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

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

print(VC)

Submission status: Accepted

Solution code:
n = int (input())
liv = list(map(int,input().split()))
lic = list(map(int,input().split()))
ans = sum([liv[i]-lic[i] for i in range(n) if liv[i]-lic[i]>0])
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):
    d = V[i] - C[i]
    if d > 0:
        ans += d

print(ans)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
V = np.array([int(_) for _ in input().split()])
C = np.array([int(_) for _ in input().split()])

arr = np.array(sorted(V - C, reverse=True))

ans = sum(arr[arr > 0])

print(ans)

Submission status: Accepted

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

X_Y = []
for i in range(N):
    X_Y.append(V[i] - C[i])
X_Y_pos = [x for x in X_Y if x > 0]
print(sum(X_Y_pos))

Submission status: Accepted

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

answer = 0

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline

sys.setrecursionlimit(1000000)

def main(): 

    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)
        



if __name__ == "__main__":
    main()

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())
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 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()))
print (sum([V[i]-C[i] for i in range(N) if V[i]-C[i] > 0]))

Submission status: Accepted

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

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):
  a+=max(v[i]-c[i],0)
print(a)

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):
    a = V[i] - C[i]
    if a > 0:
        ans += a

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())

vlist = list(map(int, input().split())) 
clist = list(map(int, input().split())) 

money=0

for i in range(n):
    if vlist[i]>=clist[i]:
        money+=vlist[i]-clist[i]

print(money)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
greedy = sorted([V[i] - C[i] for i in range(N)], reverse = True)
res = 0
for i in range(N):
  if greedy[i] <= 0:
    break
  res += greedy[i]
print(res)

Submission status: Accepted

Solution code:
N=int(input())
A=[list(map(int, input().split())) for i in range(2)]
s=0
for i in range(N):
    if A[0][i]>A[1][i]:
        s+=A[0][i]-A[1][i]
print(s)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline

def main():
    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)

if __name__ == '__main__':
    main()

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):
    sum += v[i] - c[i] if v[i] - c[i] > 0 else 0
print(sum)

Submission status: Accepted

Solution code:
#!/usr/bin/env python

def main():
    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])
    return ans

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    V = [int(v) for v in input().split()]
    C = [int(c) for c in input().split()]

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


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

Submission status: Accepted

Solution code:
import numpy as np
N=input()
V=list(map(int,input().split()))
C=list(map(int,input().split()))
G=np.array(V)-np.array(C)

A=0
for i in range(len(G)):
    if G[i]>0:
        A+=G[i]

print(A)

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()))
value = 0
for i in range(n):
    if v[i]-c[i] > 0:
        value+=v[i]-c[i]

print (value)

Submission status: Accepted

Solution code:
#B - Resale(ABC125)
N=int(input())
V=list(map(int, input().split()))
C=list(map(int, input().split()))
M=[]
X=0
for i in range(N):
    M.append(V[i]-C[i])
for i in range(N):
    if M[i]>0:
        X+=M[i]
print(X)

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())))
XY = V - C

ans = 0

for i in range(len(XY)):
    if XY[i] > 0:
        ans += XY[i]

print(ans)

Submission status: Accepted

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

for i in range(0,n):
  if a[i] > b[i]:
    c = c + a[i] - b[i]
  else:
    continue
    
print(c)

Submission status: Accepted

Solution code:
N = int(input())
V = [int(_) for _ in input().rstrip().split()]
C = [int(_) for _ in input().rstrip().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_seq = list(map(int, input().split()))
c_seq = list(map(int, input().split()))

r_seq = [v_seq[i] - c_seq[i] for i in range(n)]
r_seq.sort(reverse = True)

ans = 0
for r in r_seq:
    if r <= 0:
        break
    ans += r

print(ans)