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


def calc(v_sum,c_sum,index):
    if index == N:
        return v_sum - c_sum

    return max(calc(v_sum + Vs[index], c_sum + Cs[index], index + 1),calc(v_sum, c_sum, index + 1))


print(calc(0,0,0))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
input()
Values = list(map(int, input().split()))
Costs = list(map(int, input().split()))
total = 0
for (value, cost) in zip(Values, Costs):
    if value > cost:
        total += value - cost
    
print(total)

Submission status: Accepted

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

Rec = []
Chk = []

# (V-C)＋(V-C)..の結果を１つずつ見て一番高いものを記録
# 宝石ループ
work = None
for i in range(0, N):
    for j in range(0, N):
        if not(j in Chk) and (work == None or work < V[j] - C[j]):
            work = V[j] - C[j]
            work2 = j
    Chk.append(work2)
    if len(Rec) > 0:
        Rec.append(Rec[i - 1] + work)
    else:
        Rec.append(work)
    work = None

if max(Rec) > 0:
    print(max(Rec))
else:
    print('0')

Submission status: Accepted

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

Submission status: Accepted

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

for vnum,cnum in zip(v,c):
    ans += (vnum-cnum) if vnum>cnum else 0

print(ans)

Submission status: Accepted

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

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

print(ans)

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

Submission status: Accepted

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

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

print(res)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
V_array = [int(V_i_str) for V_i_str in input().split()]
C_array = [int(C_i_str) for C_i_str in input().split()]
ans = sum([max(0, V_array[i] - C_array[i]) for i in range(N)])
print(ans)

Submission status: Accepted

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

for i in range(N):
        P.append(V[i]-C[i])
         
result = list(filter(lambda x:x>=1,P))
print(sum(result))

Submission status: Accepted

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

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

result = list(filter(lambda x:x>=1,P))
print(sum(result))

Submission status: Accepted

Solution code:
N = raw_input()
V = raw_input()
C = raw_input()

Va = V.split(" ")
Ca = C.split(" ")

Va = map(lambda x: int(x), Va)
Ca = map(lambda x: int(x), Ca)


X = 0
Y = 0
for v, c in zip(Va, Ca):
  if v > c:
    X += v
    Y += c

print(X - Y)

Submission status: Accepted

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

if N < 0 or 20 < N: raise()
for v in V:
    if v < 0 or 50 < v: raise()
for c in C:
    if c < 0 or 50 < c: raise()

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

Submission status: Accepted

Solution code:
def solve():
    N = int(input())
    V = [int(k) for k in input().split()]
    C = [int(k) for k in input().split()]
    
    ans = 0
    
    for i in range(N):
        if V[i] > C[i]:
            ans += (V[i] - C[i])
    
    print (ans)
    
if __name__ == "__main__":
    solve()

Submission status: Accepted

Solution code:
n=int(input())
a=input().split()#価格
b=input().split()#価値
d=[]#価格差
total_d=[]
s=0
for i in range(n):
    a[i]=int(a[i])
    b[i]=int(b[i])
for i in range(n):
    x=a[i]-b[i]
    d.append(x)
for k in range(n):
    if d[k]>0:
        total_d.append(d[k])
print(sum(total_d))

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

Submission status: Accepted

Solution code:
n = int(input())
v,c = list(map(int,input().split())),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())
Vn = list(map(int, input().split()))
Cn = list(map(int, input().split()))
 
X = 0
Y = 0
for i, d in enumerate([v - c for v, c in zip(Vn, Cn)]):
    
    if(d >= 0):
        X += Vn[i]
        Y += Cn[i]
print(X - Y)

Submission status: Accepted

Solution code:
N = int(input())
Vn = list(map(int, input().split()))
Cn = list(map(int, input().split()))

X = 0
Y = 0
for i, d in enumerate([v - c for v, c in zip(Vn, Cn)]):
    
    if(d >= 0):
        X += Vn[i]
        Y += Cn[i]
print(X - Y)

Submission status: Accepted

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

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

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

print(SUM)

Submission status: Accepted

Solution code:
num = int(input())
value = list(map(int, input().split()))
cost = list(map(int, input().split()))
result = 0

for i in range(num):
    if value[i] > cost[i]:
        result = result + value[i] - cost[i]

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

Submission status: Accepted

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

ans = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

import sys
input = sys.stdin.readline

def io_generator():
	return input()

#+++++++++++++++++++

def main(io):
	n=int(io())
	v = list(map(int, io().split()))
	c = list(map(int, io().split()))
	t=[vi-ci for vi,ci in zip(v,c) if vi-ci>0]
	ret = sum(t)
	return ret

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

Submission status: Accepted

Solution code:
import math
number = input().split()
value_list= input().split()
cost_list= input().split()

answer = 0

for i, value in enumerate(value_list):
    if int(value) > int(cost_list[i]):
        answer = answer + (int(value)-int(cost_list[i]))
    else:
        answer = answer

print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
len_lst = input()
val = input()
cos = input()
value = list(map(int, val.split(" ")))
cost = list(map(int, cos.split(" ")))
diff = [value[i] - cost[i] for i in range(int(len_lst))]
plus = [i for i in diff if i>0]
print(sum(plus))

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
dia_num = int(input())
diamond = list(map(int,input().split()))
dia_cost = list(map(int,input().split()))
profit = 0

for i in range(dia_num):
    if diamond[i]-dia_cost[i]>0:
        profit += diamond[i]-dia_cost[i]

print(profit)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
'''input
1
1
50
'''

N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
D=[0]*N
ans=0

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


print(ans)

Submission status: Accepted

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

"""
Vi - Ci > 0 ならばその宝石を手に入れることで利益は増える
したがって全ての差を計算して0より大きいもので総和をとれば良い
たかだか N <= 20　回 なのでループで確認する
"""

P = V - C # Profit

ret = 0
for i in range( N ):
    if P[i] > 0:
        ret += P[i]

print( ret )

Submission status: Accepted

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

for i in range(N):
    if(V[i]<=C[i]):
        continue
    else:
        sum += V[i]-C[i]
        
print(sum)

Submission status: Accepted

Solution code:
import numpy as np

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

list = np.array(V) - np.array(C)
print(int(0 + sum(list[list > 0])))

Submission status: Accepted

Solution code:
N = int(input())
liv = [ int(it) for it in input().split() ]
lic = [ int(it) for it in input().split() ]
s = 0
for i in range(N):
  v,c = liv[i],lic[i]
  if (v>c):
    s += v-c
print (s)

Submission status: Accepted

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

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

Submission status: Accepted

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

sum = 0

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

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

print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
gems = int(input())
values = np.array([_ for _ in map(int, input().split())])
costs = np.array([_ for _ in map(int, input().split())])

cost_effectives = values - costs
print(sum([_ for _ in cost_effectives if _ > 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 = 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 = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]

vc = [(v[i] - c[i]) for i in range(n)]
vc.sort(reverse=True)

result = 0
for profit in vc:
    if profit <= 0:
        break
    result += profit

print(result)

Submission status: Accepted

Solution code:
n = int(input())
list_v = list(map(int, input().split()))
list_c = list(map(int, input().split()))

max_value = 0

for i in range(n):
    if list_v[i]>list_c[i]:
        max_value = max_value + (list_v[i]-list_c[i])

print(max_value)

Submission status: Accepted

Solution code:
n = int(input())

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

ans = 0
for j in range(n):
    if value[j] -cost[j] >0:
            ans +=value[j] - cost[j]

print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
n = int(input())
value = list(map(int, input().split()))
cost = list(map(int, input().split()))

ans = 0
for j in range(n):
    if value[j] - cost[j] > 0:
        ans += value[j] - cost[j]

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
V=input().split()
C=input().split()
i=0
j=0
s_l=[]
cnt=0
while i<N:
       s=int(V[i])-int(C[i])
       s_l.append(s)
       i+=1
while j<N:
       if s_l[j]>=0:
              cnt+=s_l[j]
       j+=1
print(cnt)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

d = []
for i in range(n):
    dif = v[i] - c[i]
    if dif > 0:
        d.append(dif)

res = 0

for i in d:
    res += i

print(res)

Submission status: Accepted

Solution code:
n = int(input())
V1 = list(map(int, input().strip().split()))
C1 = list(map(int, input().strip().split()))

sums = 0

for i in range(n):
    if V1[i] - C1[i]>0:
        sums+= V1[i] - C1[i]
print(sums)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
V = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
gap = []
for i in range(N):
    tmp = V[i]-C[i]
    if tmp > 0:
        gap.append(tmp)

ans = 0
for i in gap:
    ans += i

print(ans)

Submission status: Accepted

Solution code:
import numpy as np

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

flag_arr = (V-C) > 0

res = 0

for i in range(N):
    if flag_arr[i]:
        res = 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()))

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

print(int(answer))

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    vv = list(map(int, input().split()))
    cc = list(map(int, input().split()))
    res = 0
    for v, c in zip(vv, cc):
        if v > c:
            res += v - c
    print(res)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())

values = map(int, input().split())
costs = map(int, input().split())

ans = 0

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

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
# initialize dp table by the value of 0
dp = [[0 for x in range(sum(C)+1)] for x in range(N+1)]

ans = 0
for i in range(N):
    for j in range(sum(C)+1):
        if j < C[i]:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j], dp[i][j-C[i]] + (V[i] - C[i]))
            ans = max(ans, dp[i+1][j])
print(ans)

Submission status: Accepted

Solution code:
def get_next_int():
    return int(float(input()))
def get_next_ints(delim=" "):
    return tuple([int(float(x)) for x in input().split(delim)])

def main():
    n = get_next_int()
    values = get_next_ints()
    costs = get_next_ints()
    
    total = 0
    for value, cost in zip(values, costs):
        if value > cost:
            total += (value - cost)
    
    print(total)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())
v = [int(num) for num in input().split()]
c = [int(num) for num 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())
vals = list(map(int, input().split()))
costs = list(map(int, input().split()))

if n == 1:
    print(0)
else:
    total = 0
    for v, c in zip(vals, costs):
        resale = v - c
        if resale > 0:
            total += resale
    print(total)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def resale(V, C):

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


if __name__ == '__main__':
    
#    print('Input: ')
    n = int(input())
    v = list(map(int, input().split()))
    c = list(map(int, input().split()))
    
#    print('---------------------')
#    print('Output: ')
    print(resale(v,c))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Tue May  7 13:31:56 2019

@author: 70723224
"""

def resale(V, C):

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


if __name__ == '__main__':
    
#    print('Input: ')
    n = int(input())
    v = list(map(int, input().split()))
    c = list(map(int, input().split()))
    
#    print('---------------------')
#    print('Output: ')
    print(resale(v,c))
    
    
    
#    a = list(map(int, input().split()))
#    N = a[0]
#    b = (len(a)-1)/2+1
#    V = a[1:b]
#    C = a[b:]    
#    print(calc(V, C))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np
 
n = input()
v = np.array([int(x) for x in input().split()])
c = np.array([int(x) for x in input().split()])
 
profit = v - c
positive_profit = profit[profit > 0]
print(np.sum(positive_profit))

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())
vector_list = ([int(x) for x in input().split()])
cost_list = ([int(x) for x in input().split()])
ans = 0
for i in range(len(vector_list)):
  if vector_list[i]-cost_list[i]>0:
    ans += vector_list[i]-cost_list[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()]
diff = [v-c if (v-c > 0) else 0 for v, c in zip(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()))
diff = [v-c if (v-c > 0) else 0 for v, c in zip(V, C)]
print(sum(diff))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

# coding: utf-8

# In[1]:

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


# In[2]:

import numpy as np


# In[3]:

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


# In[4]:

bene = V-C
print(np.sum(bene[bene>0]))


# In[ ]:

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

max_point = 0
for i in range(N) :
    p = V_list[i] - C_list[i]
    if (p > 0) :
        max_point += p

print(max_point)

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=[v[i]-c[i] for i in range(n)]
ans.sort(reverse=True)
A=0
for i in ans:
    if i>0:
        A+=i
    else:
        break
print(A)

Submission status: Accepted

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

x = [0 if vv-cc < 0 else vv-cc for vv,cc in zip(v,c)]
print(sum(x))

Submission status: Accepted

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

print(sum(filter(lambda i: i > 0, map(lambda i: i[0] - i[1],zip(vs, cs)))))

Submission status: Accepted

Solution code:
from operator import sub
res = 0
n = int(input())
list1 = map(int,input().split())
list2 = map(int,input().split())
list3 = map(sub , list1,list2)
for i in list3:
    if i > 0:
        res = res + i
print(res)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
V = [int(_) for _ in input().split()]
C = [int(_) for _ in 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:
# -*- coding: utf-8 -*-                                                         
import numpy as np

N=int(input())
Vi=np.array(input().split(),dtype=int)
Ci=np.array(input().split(),dtype=int)

Xi=Vi-Ci
Xi_sort=np.sort(Xi)[::-1]
num=np.sum(Xi_sort>=0)

if num == 0:
    XY_max=0
else :
    XY_max=np.sum(Xi_sort[0:num])

print(XY_max)

Submission status: Accepted

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

Submission status: Accepted

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

if max>0:
    print(max)
else:
    print(0)

Submission status: Accepted

Solution code:
N = int(input())

value = input().rstrip().split(' ')
cost  = input().rstrip().split(' ')

X = 0
Y = 0

for i in range(N):

    if int(value[i]) > int(cost[i]):
        X += int(value[i])
        Y += int(cost[i])
    else:
        pass


print(X-Y)

Submission status: Accepted

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

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

print(out)

Submission status: Accepted

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

Submission status: Accepted

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

print(sum)

Submission status: Accepted

Solution code:
N = int(input())
vlist = list(map(int, input().split()))
clist = list(map(int, input().split()))

cnt = 0
for i in range(N):
  diff = vlist[i]-clist[i]
  if diff > 0:
    cnt += diff
    
print(cnt)

Submission status: Accepted

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

get=[]
for i in range(len(v)):
    if v[i]-c[i]>=0:
        get.append(v[i]-c[i])

print(sum(get))

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

print(answer)

Submission status: Accepted

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