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())) # コスト


X = 0 # 価値
Y = 0 # コスト

def dfs(index, x, y):
    buff = 0
    buff1 = 0
    if (index >= N):
        return x - y
    buff = dfs(index+1, x+V[index], y+C[index])
    buff1 = dfs(index+1, x, y)
    return max(buff, buff1)



ans = dfs(0, 0, 0)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
ans=0
li = list(map(int,input().split()))
li2 = list(map(int,input().split()))
for i in range(n):
  if li[i] > li2[i]:
    ans+=li[i]-li2[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()))
t = 0
T = 0
for i in range(N):
	t = V[i] - C[i]
	if t > 0:
		T += t
print(T)

Submission status: Accepted

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

diff = [v - c for v, c in zip(V, C)]
diff = filter(lambda x: x > 0, diff)
print(sum(diff))

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 = [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_list[i] - c_list[i]) > 0:
  	    ans += (v_list[i] - c_list[i])

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

items = (u - v for u, v in zip(vs, cs))
print(sum([item for item in items if item >0]))

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

Submission status: Accepted

Solution code:
num = int(input())
V = list(input().split(" "))
C = list(input().split(" "))
result = 0

for i in range(num):
    Vi = int(V[i])
    Ci = int(C[i])
    if Vi <= Ci:
        continue
    result += (Vi - Ci )

print(result)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
num = input()
kati = input().split()
cost = input().split()
get = 0

for i in range(int(num)):
    if int(kati[i]) - int(cost[i]) >= 0:
        get = int(get) + int(kati[i]) -int(cost[i])
print(get)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
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(0,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
dif = [0] * N

for i in range(N):
    dif[i] = V[i] - C[i]
    if dif[i] > 0:
        ans += dif[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):
    if V[i] - C[i] >= 0:
        result += V[i] - C[i]
    else:
        pass

print(result)

Submission status: Accepted

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

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]:
        calc = v[i] - c[i]
        ans += calc

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

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

print(result)

Submission status: Accepted

Solution code:
num = int(input())
value = tuple( map (int,input().split()))
price = tuple(map (int,input().split()))
ans = 0
for i in range(num):
  if value[i] > price[i] :
      income = value[i] - price[i]
      ans += income
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8

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

profits = [v - c for v, c in zip(V, C) if v - c > 0]
print(sum(profits))

Submission status: Accepted

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

Submission status: Accepted

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

    D = [V[i] - C[i] for i in range(N)]
    f = [d for d in D if d > 0]

    if len(f) == 0:
        print(0)
    else:
        print(sum(f))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
Z = [V[i]-C[i] for i in range(N)]
z = [i for i in Z 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()))#コスト
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:
import math
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]]))

Submission status: Accepted

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

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

print(profit)

Submission status: Accepted

Solution code:
import sys

def parse(inp):
    n=int(next(inp))
    v=list(map(int,next(inp).split()))
    c=list(map(int,next(inp).split()))    
    return n,v,c
  
def main(inp):
    n,v,c=inp    
    ans = 0
    for i in range(n):
        if(v[i]-c[i]>0): ans +=  v[i]-c[i]            
    return ans
  
print(main(parse(sys.stdin)))

Submission status: Accepted

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime,random
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())

N = int(input())
VV = inpl()
CC = inpl()

ans = 0
for i in range(N):
    tmp = VV[i] - CC[i]
    if tmp > 0:
        ans += tmp
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()]

V_C = []
for i in range(len(V)):
    V_C.append(V[i] - C[i])

result = 0
for i in range(len(V_C)):
    if V_C[i] > 0:
        result += V_C[i]

print(result)

Submission status: Accepted

Solution code:
N = int(input())
VV = [int(i) for i in input().split()]
CC = [int(i) for i in input().split()]
result = 0
for i in range(N):
    Vi,Ci = VV[i],CC[i]
    if Vi - Ci > 0:
        result += Vi-Ci

print(result)

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_c = v -c
v =np.sort(v_c)[::-1]
ans = 0
for i in range(n):
    if v[i]>=0:
        ans += v[i]

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
rieki = []
#print(x,y)
for i in range(n):
  rieki.append(x[i]-y[i])

count = 0  
for i in rieki:
  if i >0:
    count+=i

print(count)

Submission status: Accepted

Solution code:
import numpy as np

n=int(input())
v_array=[]
c_array=[]
v_array=map(int,input().split())
c_array=map(int,input().split())


d_array = np.array(list(v_array))-np.array(list(c_array))

plus_array = d_array[d_array > 0]
plus_array = np.array(plus_array)
print(np.sum(plus_array))

Submission status: Accepted

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

Submission status: Accepted

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

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

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:
N = input(); V = map(int, input().split()); C = map(int, input().split());
VC = [v-c for v, c in zip(V, C) if v > c]
VC.append(0)
print(sum(VC))

Submission status: Accepted

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

Submission status: Accepted

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

xpy = 0

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

print(xpy)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))
x = int(0)
y = int(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 = map(int, input().split())
C = map(int, input().split())

VC = sorted(zip(V, C), key=lambda x:x[0])[::-1]

vsum = csum = 0
dmax = 0
for i in range(N):
	if VC[i][1] < VC[i][0]:
		vsum += VC[i][0]
		csum += VC[i][1]
		dmax = max(dmax, vsum - csum)
print(dmax)

Submission status: Accepted

Solution code:
N = int(input())
V= list(map(int,input().split()))
C= list(map(int,input().split()))
v_c = [v-c for v,c in  zip(V,C)]
v_c = sorted(v_c)[::-1]
cand = [sum(v_c[:i] )for i in range(N+1)]

print(max(cand))

Submission status: Accepted

Solution code:
num = int(input())
valuation = list(map(int,input().split()))
cost = list(map(int,input().split()))

div = []
ans = 0

for i in range(len(valuation)):
    div.append(valuation[i] - cost[i])

for j in div:
    if j > 0:
        ans += j

print(ans)

Submission status: Accepted

Solution code:
import itertools


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

for kati,nedan in zip(v,c):
	dif.append(kati-nedan)

max = -1

for L in range(len(dif)+1):
	for subset in itertools.combinations(dif, L):
		s = sum(subset)
		if(max < s):
			max = s

print(max)

Submission status: Accepted

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

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

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=R+V[i]-C[i]
        
print(R)

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) if v[i]-c[i] > 0]
print(sum(p))

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()))
total =0
for i in range(n):
    next = a[i]-b[i]
    if next >0:
        total+=next
print(total)

Submission status: Accepted

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

Submission status: Accepted

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

summ = 0
for vi, ci in zip(v,c):
    div = vi-ci
    if div >=0:
        summ += div
print(summ)

Submission status: Accepted

Solution code:
# Vi-Ci> 0である限り足していく
inputs = [input() for i in range(3)]
N = int(inputs[0])
V = inputs[1].split()
C = inputs[2].split()

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

print(TR)

Submission status: Accepted

Solution code:
# https://atcoder.jp/contests/abc125/tasks/abc125_b

import itertools
from collections import Counter
from collections import defaultdict
import bisect

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

if __name__ == '__main__':
    main()

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] > 0:
        l.append(v[i] - c[i])
    else:
        pass
print(sum(l))

Submission status: Accepted

Solution code:
S = int(input())
import numpy as np
values = list(map(int, input().split()))
values2 = np.array(values)
costs = list(map(int, input().split()))
cost2 = np.array(costs)
tes=values2-cost2
kotae=0
for i in range(S):
  value=tes[i]
  if value >= 0:
    kotae=kotae+tes[i]


print(kotae)

Submission status: Accepted

Solution code:
N  = int(input())
valueList = list(map(int, input().split()))
costList = list(map(int, input().split()))
S = 0
total = 0

for i in range(N):
    S = valueList[i]-costList[i]
    if S >0:
        total += S
print(total)

Submission status: Accepted

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

ans = 0
for i, v in enumerate(vlist):
  netV = vlist[i] - clist[i]
  if netV >= 0:
    ans += netV

print("{}".format(ans))

Submission status: Accepted

Solution code:
n = int(input())
size = list(map(int, input().split()))
price = list(map(int, input().split()))

ans = 0

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

print(ans)

Submission status: Accepted

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

ans()

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

print(x)

Submission status: Accepted

Solution code:
n = int(input())
value = input().split()
cost = input().split()

count = 0
i = 0
for i in range(n):
  a = int(value[i])
  b = int(cost[i])
  if a > b:
    count += (a-b)
print(count)

Submission status: Accepted

Solution code:
N=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
t=0
ans=[0]*N
while t<N:
    ans[t]=v[t]-c[t]
    t=t+1
kotae=0
s=0
while s<N:
    if ans[s]>=0:
        kotae=kotae+ans[s]
    s=s+1
print(kotae)

Submission status: Accepted

Solution code:
N = int(input())

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

vsum = 0
csum = 0

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

print(vsum - csum)

Submission status: Accepted

Solution code:
ans = 0
n = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
for i in range(n):
    if x[i] - y[i] >= 0:
        ans += x[i] - y[i]
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, j in zip(v, c):
    if i - j >= 0:
        v_c.append(i-j)

print(sum(v_c))

Submission status: Accepted

Solution code:
N = input();
V = map(int, raw_input().split())
C = map(int, raw_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:
# 整数の入力
a = int(input())
# 数値のリスト化
xList = [int(i) for i in input().split()]
cList = [int(i) for i in input().split()]
kati = 0
for i in range(a):
    if(xList[i] > cList[i]):
        kati = kati + (xList[i] - cList[i])

print(kati)

Submission status: Accepted

Solution code:
import math
from sys import stdin
import numpy as np

n = int(stdin.readline().rstrip())

data = [stdin.readline().rstrip().split() for _ in range(2)]
V = np.array(list(map(lambda x: int(x), data[0])))
C = np.array(list(map(lambda x: int(x), data[1])))
difference = V- C
difference[difference < 0.] = 0
print(np.sum(difference))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())

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

a=0
b1=0
b2=0
while a<n:
    if (v[a]-c[a])>0:
        b1+=int(v[a])
        b2+=int(c[a])
    a+=1
#    print(b1,b2)
#print(b1,b2)
print(b1-b2)

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

print(ans)

Submission status: Accepted

Solution code:
def main():
    input()

    total = 0

    for g in zip(map(int, input().split()), map(int, input().split())):
        if g[0] > g[1]:
            total += (g[0] - g[1])
    print(total)


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
V = list()
C = list()
plus = list()

for i, j in zip(range(N), input().split()):
    V.append(int(j))
for i, j in zip(range(N), input().split()):
    C.append(int(j))

for i, j in zip(V, C):
    if i-j > 0:
        plus.append(i-j)

print(sum(plus))

Submission status: Accepted

Solution code:
N = int(raw_input())

Vi = map(int, raw_input().split(" "))
Ci = map(int, raw_input().split(" "))

maxV = 0
for i in range(N):
    tmp = Vi[i] - Ci[i]
    maxV += tmp if tmp>0 else 0

print maxV

Submission status: Accepted

Solution code:
N  = int(input())

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

import numpy as np
V = np.array(V)
C = np.array(C)
Z = V - C

Z.sort()
Z = Z[Z > 0]
print(sum(Z))

Submission status: Accepted

Solution code:
import numpy as np

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


A = list(np.array(Vs) - np.array(Cs))

sum_ = 0
for i in A:
    if i>0:
        sum_+=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()))
v_list = [i-j  for(i,j) in zip(v_list,c_list)]
s=[x for x in v_list if x>0]

print(sum(s))


#print(mount_list[1]*(mount_list[2]//mount_list[0]))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# input
n = int(input())
value = [int(a) for a in input().split()]
cost = [int(a) for a in input().split()]

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

print(profit)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=[]
ans=0
for i in range(n):
    c.append(a[i]-b[i])

for i in c:
    if i>=0:
        ans+=i
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
vl = input().split()
cl = input().split()
i = 0
sum = 0

for i in range(n):
    if int(vl[i]) < int(cl[i]):
        continue
    else:
        sum += int(vl[i]) - int(cl[i])

print(sum)

Submission status: Accepted

Solution code:
import sys
import io
import math
import re

datalist = input().split()
num_summit = int(datalist[0])

array_1=[]
array_2=[]

array_1 = input().split()
array_2 = input().split()

sum=0

for num in range(num_summit):
    if int(array_1[num])-int(array_2[num]) > 0:
        sum += int(array_1[num])-int(array_2[num])
print(sum)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import re
import math

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

a = 0

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

print(a)

Submission status: Accepted

Solution code:
#ABC125B-Resale.py

from sys import stdin

input = stdin.readline

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.sort(reverse=True)

result = 0

for x_y in X_Y:
    if x_y >= 0:
        result += x_y
    else:
        break

print(result)

Submission status: Accepted

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

print(sum)

Submission status: Accepted

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

x = []
 
for i in range(n):
    x.append(int(v[i]-c[i]))
 
x.sort()
 
y = 0
 
i = n-1
 
while x[i] >= 0 and i >= 0 :
    y += x[i]
    i += -1
 
print(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):
    re = V[i] - C[i]
    if re > 0:
        ans += re
print(ans)

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):
    if V[i]-C[i]>0:
        A.append(V[i]-C[i])

print(sum(A))

Submission status: Accepted

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

profit = 0
for i in range(number):
    if value[i] - cost[i] > 0:
        profit += value[i] - cost[i]
        
print(profit)

Submission status: Accepted

Solution code:
import itertools

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

sub = [v[i] - c[i] for i in range(n)]

max = 0

for s in sub:
    if s > 0:
        max += s

print(max)

Submission status: Accepted

Solution code:
n = input()
v = raw_input().split()
c = raw_input().split()
a = 0

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

print a

Submission status: Accepted

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

Submission status: Accepted

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

N=int(input())
X=list(map(int,input().split()))
Y=list(map(int,input().split()))

ans=0

for i in range(N):
    if(X[i]-Y[i])>0:
        ans+=X[i]-Y[i]
    
print(ans)

Submission status: Accepted

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

def wa(i):
    return v[i] - c[i]

x = [wa(i) for i in range(n)]
x.sort(reverse=True)
res = 0
for e in x:
    if e > 0:
        res += e
    else:
        break

print(res)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

diff = [max(v-c,0) for v,c in zip(Vs,Cs)]
print(sum(diff))

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

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split(" ")))
C = list(map(int, input().split(" ")))
print(sum(list(filter(lambda x: x > 0, [V[i] - C[i] for i in range(N)]))))

Submission status: Accepted

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

    diff = [vv - cc for vv, cc in zip(v, c) if vv - cc > 0]
    print(sum(diff))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
v = list(int(n) for n in input().split())
c = list(int(n) for n in input().split())
sum = 0
vc = [v - c for (v, c) in zip(v, c)]

# print(vc)

for i in range(n):
    if 0 < vc[i]:
        sum += vc[i]

print(sum)

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

Submission status: Accepted

Solution code:
from itertools import product

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

L = []
for i in range(N) :
    L.append([V[i],C[i]])
L = sorted(L, key=lambda x: x[0])

ans = 0
for i in range(N) :
    if L[i][0] > L[i][1] :
        ans += L[i][0] - L[i][1]
print(ans)

Submission status: Accepted

Solution code:
import numpy as np

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

result = 0;

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

Submission status: Accepted

Solution code:
from sys import stdin
input=[]
for i in range(3):
  input.append(stdin.readline().rstrip().split())

#print(input)
N=int(input[0][0])
V=[]
for i in input[1]:
    V.append(int(i))
C=[]
for i in input[2]:
    C.append(int(i))

#print(N,V,C)
diff=[]
for i in range(len(V)):
    diff.append(V[i]-C[i])

output=0
for i in diff:
    if i>0:
        output+=i

print(output)

Submission status: Accepted

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

sa = [0] * N

for i in range(N) :
  sa[i] = V[i] - C[i]
sa.sort()
sa.reverse()

ans = 0
for i in sa :
  if i < 0 :
    break
  ans += 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
li = []
for i in range(N):
    tmp = V[i] - C[i]
    li.append(tmp)
for i in range(N):
    if li[i] > 0:
        ans += li[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 v, c in zip(V, C):

    if v > c:

        ans += (v-c)

print(ans)

Submission status: Accepted

Solution code:
listA=[]
while True:
    try:
        listA.append(list(map(int,input().split())))

    except:
        break;
N = listA[0]
V = listA[1]
C = listA[2]

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