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

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())
V = input().split()
C = input().split()

ans = 0

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

print(ans)

Submission status: Accepted

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

r = 0
for x in range(n):
    y = v[x] - c[x]
    if y > 0:
        r += y

print(r)

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 a in range(N):
    b = V_LIST[a] - C_LIST[a]
    if b > 0:
        ans += b

print(ans)

Submission status: Accepted

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

t = [ x-y for (x, y) in zip(v, c) ]

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!


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

t_v = 0
t_c = 0

for i in range(N):
    v = int(V[i])
    c = int(C[i])

    if v - c > 0:
        t_v += v
        t_c += c
    elif c - v < 0:
        t_v += v

print(t_v - t_c)

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

Submission status: Accepted

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

ans = 0

for a, b in zip(g, c):
	if a > b:
		ans += (a - b)

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 x in range(N):
    P = V[x] - C[x]
    if P > 0 :
        ans += P
print(ans)

Submission status: Accepted

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

xy = 0

for v, c in zip(V, C):
    if c < v:
        xy += v - c

print(xy)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


def parse(file):
    n = int(file.readline())
    vs = map(int, file.readline().split())
    cs = map(int, file.readline().split())
    return n, vs, cs


def main(n, vs, cs):
    ans = 0
    for v, c in zip(vs, cs):
        if v - c > 0:
            ans += v - c
    return ans


if __name__ == '__main__':
    print(main(*parse(sys.stdin)))

Submission status: Accepted

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

bene = []

for i in range(N):
    if vals[i] - costs[i] > 0:
        bene.append(vals[i]-costs[i])

print(sum(bene))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
v_l = list(map(int, input().split()))
c_l = list(map(int, input().split()))

sa = []
sum = 0
for i in range(n):
    xy = v_l[i]-c_l[i]
    if xy >0:
        sum = sum+xy

print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
Vs = list(map(int, input().split()))
Cs = list(map(int, input().split()))

diff = []
for i in range(N):
    diff.append(Vs[i]-Cs[i])
ans = 0
for i in range(N):
    if diff[i] > 0:
        ans += diff[i]
    else:
        pass
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(n):
  a[i] = a[i] - b[i]
  if a[i] >= 0:
    c += a[i]
print(c)

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

Submission status: Accepted

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

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())]
ans = 0
XY = []
for i in range(N):
    XY.append(V[i] - C[i])
XY.sort(reverse=True)
for xy in XY:
    if xy > 0:
        ans += xy
    else:
        break
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]>0:
        a+=V[i]-C[i]
print(a)

Submission status: Accepted

Solution code:
from sys import stdin
from collections import deque, defaultdict as ddic
from itertools import combinations, permutations, product
import bisect
import heapq


rs = lambda: stdin.readline().strip()
ri = lambda: int(rs())
rsl = lambda: stdin.readline().split()
rim = lambda: map(int, rsl())
ril = lambda: list(rim())

N = ri()
values = list(rim())
costs = list(rim())
maximum = 0
for i in range(len(values)):
    psum = values[i] - costs[i]
    if psum > 0:
        maximum += psum

print(maximum)

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):
    result += max(0, 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()))
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())
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:
# -*- coding: utf-8 -*-

# input


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

diff = []

for v, c in zip(V, C):
    if v-c < 0:
        continue
    diff.append(v-c)

print(sum(diff))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
V = [int(v) for v in input().split()]
C = [int(c) for c in 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:
def input_from_console():
    n = int(input())

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


def main():
    n, v, c = input_from_console()
    # print(n, v, c)
    diff_list = sorted([v[i] - c[i] for i in range(len(v)) if v[i] - c[i] > 0], reverse=True)
    # print(diff_list, n)
    print(sum([diff_list[i] for i in range(len(diff_list))]))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
cost=[0]
for i in range(n):
  if V[i]>C[i]:
    cost.append(V[i]-C[i])
print(sum(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:
def solve(N, V, C):
    val = 0
    for i in range(N):
        if V[i] - C[i] > 0:
            val += V[i] - C[i]
    return val

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


print(solve(N, V, C))

Submission status: Accepted

Solution code:
N = int(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 > 0:
    ans += v - c
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V_list = input().split()
C_list = input().split()
dif_list = []
maxim = 0

for i in range(N):
    dif_list.append(int(V_list[i]) - int(C_list[i]))

dif_list.sort(reverse=True)

for i in range(N):
    if dif_list[i]>0:
        maxim += dif_list[i]
    else:
        break;
        
print(maxim)

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)

X = V - C
T = 0

for i in range(N):
	if X[i] > 0:
		T += X[i]
	else:
		pass

print(T)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num=input()
price=list(map(int,input().split()))
cost=list(map(int,input().split()))
list=[x-y for x,y in zip(price,cost) if x>y ]+[0]
print(sum(list))

Submission status: Accepted

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

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

print(goukei)

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(0,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()))
x = []
for i in range(N):
  x.append(int(V[i]-C[i]))
listo = [j for j in x if j > 0]
print(sum(listo))

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

Submission status: Accepted

Solution code:
n = input()
A = int(n)


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

ans = 0
for i in range(A):
    if C[i] < V[i]:
        ans += V[i] - C[i]
print(ans)

Submission status: Accepted

Solution code:
#conding utf-8
N = int(input())
V = input().split()
C = input().split()
ans = 0
for i in range(N):
  p = int(V[i])-int(C[i])
  if p>0:
    ans +=p
print(ans)

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 = 0
for v,c in zip(V,C):
  x = v-c
  if x > 0:
    ans += x
    
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
list_V = [int(i) for i in input().split()]
list_C = [int(i) for i in input().split()]
total = 0

for i in range(N):
    income = list_V[i] - list_C[i]
    if income > 0:
        total += income

print(total)

Submission status: Accepted

Solution code:
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] > 0:
            ans += V[i] - C[i]
    
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
value = list(map(int, input().split(' ')))
cost = list(map(int, input().split(' ')))

result = 0

for x, y in zip(value,cost):
    if x-y > 0:
        result += x-y
        
print(result)

Submission status: Accepted

Solution code:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

sum=0
for value,cost in zip(A,B):
  if value>cost:
    sum +=value-cost
  else:
    pass
print(sum)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
diff = []
for i in range(N):
    diff.append(V[i]-C[i])
sum = 0
for i in range(N):
    if diff[i] > 0:
        sum += diff[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
for i in range(N):
    wa=V[i]-C[i]
    if wa > 0:
        ans+=wa
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
u=list(input().split())
b=list(input().split())
v=[int(i) for i in u]
c=[int(j) for j in b]
ans=0
for i in range(len(v)):
  if v[i]>c[i]:
    roy=v[i]-c[i]
    ans+=roy
    
print(ans)

Submission status: Accepted

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

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


print(ans)

Submission status: Accepted

Solution code:
def main():
  can_get_cnt = int(input())
  jewel_values = list(map(int, input().split(" ")))
  jewel_costs = list(map(int, input().split(" ")))
  
  jewel_profits = []
  
  for i in range(0, len(jewel_values)):
    jewel_profits.append(jewel_values[i] - jewel_costs[i])
  
  sorted_jewel_profits = sorted(jewel_profits, reverse=True)
  
  ret = 0
  
  for i in range(0, can_get_cnt):
    if sorted_jewel_profits[i] > 0:
      ret = ret + sorted_jewel_profits[i]
    else:
      break
  
  
  print (ret)


main()

Submission status: Accepted

Solution code:
N = int(input())
v_list = list(map(int,input().split()))
c_list = list(map(int,input().split()))
ans = []
for i in range(N):
    if v_list[i] > c_list[i]:
        ans.append(v_list[i]-c_list[i])
print(sum(ans))

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
s = 0
for v,c in zip(V,C):
  if v>c:
    s+= v-c
    
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 v,c in zip(V,C):
    if v>c:
        ans += (v-c)
print(ans)

Submission status: Accepted

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

for i in range(len(v)):
    if v[i] > c[i]:
        rtn += v[i] - c[i]

print(rtn)

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 += max(0, V[i]-C[i])
print(ans)

Submission status: Accepted

Solution code:
n=int(input())
list_v=list(map(int, input().split()))
list_c=list(map(int, input().split()))
ans = 0
for i in range(n):
  ans_p = list_v[i] - list_c[i]
  if ans_p > 0:
    ans += ans_p
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 v,c in zip(V,C):
    if v-c > 0:
        ans += v-c

print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy


def main():
  input()
  values = numpy.array(list(map(int, input().split())))
  values -= numpy.array(list(map(int, input().split())))

  print(sum(values[values > 0]), flush=True)


if __name__ == '__main__':
  main()

Submission status: Accepted

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

dif = [V[i]-C[i] for i in range(N)]
dif.sort(reverse=True)
ans = 0
for i in range(N):
    if dif[i] > 0:
        ans += dif[i]
    else:
        break

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
li = []
for i in range(2):
    tmp = list(map(int, input().split()))
    li.append(tmp)

ret = 0
for i in range(n):
    cost = li[0][i] - li[1][i]
    if cost > 0:
        ret += cost

print(ret)

Submission status: Accepted

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

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:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

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

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

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

n = int(input())
v = [int]*n
c = [int]*n
v = input().split()
c = input().split()

sum = 0

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

Submission status: Accepted

Solution code:
N = int(input())
data_v = list(map(int, input().split()))
data_c = list(map(int, input().split()))

data = [0] * N
ans = 0
for i in range(N):
    data[i] = data_v[i] - data_c[i]
    if data[i] >= 0:
        ans += data[i] 

print(ans)

Submission status: Accepted

Solution code:
from sys import stdin
N = int(stdin.readline().rstrip())
V = [int(_) for _ in stdin.readline().rstrip().split()]
C = [int(_) for _ in stdin.readline().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:
import sys
import collections
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())
nsl = lambda: map(str, sys.stdin.readline().split())

n = ni()
v = nl()
c = nl()
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]:
        ans = ans + (v[i] - c[i])

print(ans)

Submission status: Accepted

Solution code:
N= input()
V= input().split() 
C= input().split() 
ans=0
for i in range(int(N)):
    if int(V[i])>=int(C[i]):
        ans=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):
    e=v[i]-c[i]
    if(e>=0):
        count+=e
    else:
        continue
print(count)

Submission status: Accepted

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

for i in range(N):
    sums.append(V[i]-C[i])

sums.sort()
sums.reverse()
cost = sums[0]
for i in range(1, N):
    if sums[i] < 0:
        break
    cost += sums[i]

print(max(0, cost))

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

print(score)

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]):
        ans = ans + int(v[i]) - int(c[i])
print(ans)

Submission status: Accepted

Solution code:
n = input()
V = input().split(" ")
C = input().split(" ")

n = int(n)
V_tmp = []
for v in V:
    V_tmp.append(int(v))
V = V_tmp
C_tmp = []
for c in C:
    C_tmp.append(int(c))
C = C_tmp
SA = []
for i in range(n):
    SA.append(V[i]-C[i])
max_ = 0
for i in range(n):
    if SA[i] >= 0:
        max_ += SA[i]
print(max_)

Submission status: Accepted

Solution code:
def main():
    _ = int(input())
    v = list(map(int, input().split()))
    c = list(map(int, input().split()))
    u = [v - c for v, c in zip(v, c) if v - c > 0]
    print(sum(u))


main()

Submission status: Accepted

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

X = [max(0, V[i]-C[i]) for i in range(N)]
print(sum(X))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
Value = list(map(int,input().split()))
Cost = list(map(int,input().split()))
count = 0
for i in range(len(Value)):
    if Value[i]-Cost[i] >= 0:
        count += Value[i]- Cost[i]

print(count)

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

print(score)

Submission status: Accepted

Solution code:
import sys

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())
li = list(map(int,input().split()))
co = list(map(int,input().split()))
ans = 0

for i in range(n):
    if((li[i] - co[i]) > 0):
        ans += (li[i] - co[i])

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())))
A=V-C
print(sum(A*(A>0)))

Submission status: Accepted

Solution code:
N = int(input())
V_lst = list(map(int, input().split()))
C_lst = list(map(int, input().split()))


P_lst = []
for i in range(N):
    P_lst.append(V_lst[i] - C_lst[i])
    
ans = 0    
for i in range(N):
    if P_lst[i] > 0:
        ans += P_lst[i]
        
print(ans)

Submission status: Accepted

Solution code:
def getInt(): return int(input())
def getIntList(): return [int(x) for x in input().split()]
def zeros(n): return [0]*n

class Debug():
    def __init__(self):
        self.debug = True
 
    def off(self):
        self.debug = False
 
    def dmp(self, x, cmt=''):
        if self.debug:
            if cmt != '':
                w = cmt + ': ' + str(x)
            else:
                w = str(x)
            print(w)
        return x

def prob():
    d = Debug()
    d.off()
    N = getInt()
    V = getIntList()
    C = getIntList()
    d.dmp((N),'N')
    d.dmp((V),'V')
    d.dmp((C),'C')
    smMarg = 0
    for i in range(N):
        marg = V[i]-C[i]
        if marg > 0:
            smMarg += marg
            #d.dmp((i,marg,smMarg),'(i,marg,smMarg)')
    return smMarg

ans = prob()
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

value_lst = input().split()
for i in range(N):
    value_lst[i] = int(value_lst[i])

cost_lst = input().split()
for i in range(N):
    cost_lst[i] = int(cost_lst[i])

plofit_lst = []
for i in range(N):
    plofit_lst.append(value_lst[i] - cost_lst[i])

plofit_lst.sort(reverse=True)

plofit_max = 0
for i in range(N):
    if plofit_lst[i] <= 0:
        break
    plofit_max += plofit_lst[i]

print(plofit_max)

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()))
print(sum(max(v[i]-c[i],0) for i in range(n)))

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

Submission status: Accepted

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

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(int(i) for i in (input().split()))
C = list(int(i) for i in (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, = map(int, input().split())
*C, = 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())
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())
v_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))
ans = 0

for v, c in zip(v_list, c_list):
    diff = v - c
    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()))
ans=0

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

sa = list()
for v, c in zip(V, C):
    sa.append(v-c)

sa_p = [i for i in sa if i > 0]
print(sum(sa_p))

Submission status: Accepted

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

Submission status: Accepted

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

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

ans = sum(max(x - y, 0) for x, y in zip(v, c))

print(ans)

Submission status: Accepted

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

a = []

N = input()
N = int(N)
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()))

x = 0
y = 0
mx = 0
l = [V[i]-C[i] for i in range(N)]
print(sum([ i for i in l if i>0 ]))

Submission status: Accepted

Solution code:
from sys import stdin
import math

n = stdin.readline().rstrip()

v = [int(x) for x in stdin.readline().rstrip().split()]
c = [int(x) for x in stdin.readline().rstrip().split()]

# print(n)
# print(v)
# print(c)

sum = 0
for i in range(len(v)):
    # print(i)
    if c[i] < v[i]:
        sum += v[i] - c[i]

print(sum)

Submission status: Accepted

Solution code:
from collections import defaultdict
from string import ascii_uppercase
import sys, bisect, math
stdin = sys.stdin
read_int = lambda : list(map(int,stdin.readline().split()))
read_str = lambda : stdin.readline().rstrip()

N = read_int()[0]
V = read_int()
C = read_int()
diff = [V[i] - C[i] for i in range(N)]
diff.sort(reverse=True)

def solve():
    ans = 0
    for i in range(N):
        if diff[i] >= 0:
            ans += diff[i]
        else: break
    return ans

if __name__ == "__main__":
    print(solve())

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)]
diff.sort(reverse=True)
M = 0
for i in range(n):
  if diff[i] > 0:
    M+=diff[i]
print(M)

Submission status: Accepted

Solution code:
import sys
 
N = map(int, raw_input().strip().split(" "))
V = map(int, raw_input().strip().split(" "))
C = map(int, raw_input().strip().split(" "))
a = 0

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

v_c = []
for i in range(len(v)):
    v_c.append(v[i] - c[i])

s = 0
for vc in v_c:
    if vc > 0:
        s += vc

print(s)

Submission status: Accepted

Solution code:
#resale
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
benefit=0
for value, cost in zip(V, C):
    bene=value-cost
    if bene >0:
        benefit=bene+benefit
print(benefit)

Submission status: Accepted

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

diff = [V[i] - C[i] for i in range(N)]

for i in range(N):
    if diff[i] < 0:
        diff[i] = 0

print(sum(diff))

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

a=v-c

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

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())))
d=V-C
plus=np.sum(d[d>0])
print(plus)

Submission status: Accepted

Solution code:
n = int(input())
value = list(map(int, input().split(' ')))
cost = list(map(int, input().split(' ')))
ans = 0
vc = []
for v,c in zip(value, cost):
  if v-c > 0:
    vc.append(v-c)
  else:
    pass
print(sum(vc))

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 = input().split()
C = input().split()
diff = [int(V[i]) - int(C[i]) for i in range(N) if int(V[i]) > int(C[i])]
if len(diff) != 0:
  print(sum(diff))
else:
  print(0)