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())
values = map(int, input().split())
costs = map(int, input().split())
total = 0
for v, c in zip(values, costs):
    diff = v - c
    if diff > 0:
        total += diff
print(total)

Submission status: Accepted

Solution code:
num_of_jewels = int(input())
value_list = input().split()
value_list_i = [int(s, 0) for s in value_list]
cost_list = input().split()
cost_list_i = [int(s, 0) for s in cost_list]
total_value = 0
for i in range(num_of_jewels):
    if value_list_i[i] - cost_list_i[i] > 0:
        total_value = total_value + value_list_i[i] - cost_list_i[i]
print('%d' % total_value)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list()
for benefit, cost in zip(a, b):
  if benefit - cost > 0:
    c.append(benefit - cost)
print(sum(c))

Submission status: Accepted

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

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 = -float('inf')
d = len(V)
for b in range(2 ** d):
    tmp = 0
    for j in range(d):
        if ((b >> j) & 1):
            tmp += V[j] - C[j]
    ans = max(ans, tmp)
print(ans)

Submission status: Accepted

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

sum = 0

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

print(sum)

Submission status: Accepted

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

tmp_c = 0
tmp_v = 0

for i in range(N):
    if V[i] > C[i]:
        tmp_v += V[i]
        tmp_c += C[i]

print(tmp_v-tmp_c)

Submission status: Accepted

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

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:
N=int(input())
lis1=list(map(int,input().split()))
lis2=list(map(int,input().split()))
lis3=lis1

for i in range(N):
    lis3[i]=lis1[i]-lis2[i]

sum=0
for j in range(N):
    if lis3[j]>0:
        sum=sum+lis3[j]

print(sum)

Submission status: Accepted

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

V = V.split(' ')
C = C.split(' ')

sagaku = []
X = 0
Y = 0

for i, kakaku in enumerate(V):
    sagaku.append(int(kakaku) - int(C[i]))
    if int(kakaku) - int(C[i]) > 0:
        X += int(kakaku)
        Y += int(C[i])
        
print(X - Y)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split())) #input from array of integer like "1 2 3"
c = list(map(int,input().split())) #input from array of integer like "1 2 3"

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

V_list_str = input().split()
V_list_int = list(map(int,V_list_str))
C_list_str = input().split()
C_list_int = list(map(int,C_list_str))

max = 0
div_list = []

for i in range(N):
    div_list.append(V_list_int[i]-C_list_int[i])
    if div_list[i] > 0:
        max += div_list[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]>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 = []
for i, j in zip(v, c):
    t.append(i - j)
t = sorted(t)[::-1]
res = 0
for i in t:
    if i > 0:
        res += i
print(res)

Submission status: Accepted

Solution code:
t = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))
a = sum(v)
b = sum(c)
mxx = a-b
for i in range(t):
    temp = a-b
    a1 = a - v[i]
    b1 = b - c[i]
    if((a1-b1)>temp):
        a = a1
        b = b1
        mxx = a-b
        
print(mxx)

Submission status: Accepted

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

import numpy as np

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

F_e = V_e - C_e

F = F_e.tolist()
G = []
for i in range(N):
    if F[i] >= 0:
        G.append(F[i])
print(sum(G))

Submission status: Accepted

Solution code:
import sys
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits


def input(): return sys.stdin.readline().strip()


def INT(): return int(input())


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


def LIST(): return list(map(int, input().split()))


sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

n = INT()

v = LIST()

c = LIST()

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().strip())
arrayV = list(map(int, input().strip().split(' ')))
arrayC = list(map(int, input().strip().split(' ')))
ans = 0
for i in range(n):
    netV = arrayV[i] - arrayC[i]
    if netV > 0:
        ans = ans + netV
print(ans)

Submission status: Accepted

Solution code:
n = input()
v_li = map(int, input().split())
c_li = map(int, input().split())

max = 0
for v, c in zip(v_li, c_li):
  if v > c:
    max += v - c
print(max)

Submission status: Accepted

Solution code:
n = int(input())
lisa = list(map(int,input().strip().split()))
lisb = list(map(int,input().strip().split()))
res = 0
for i in range(n):
	if lisa[i] > lisb[i]: res+=lisa[i] - lisb[i]
print(res)

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,b,t = map(int,input().split(' '))
tt = 0
for i in range(N):
    k = int(v[i])-int(c[i])
    if k>0:
        tt +=k
print(tt)

Submission status: Accepted

Solution code:
N=int(input())
V=[int(x) for x in input().split()]
C=[int(x) for x in 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())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
#print(N, V, C)
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():
    n = int(input())
    v = [int(v) for v in input().split()]
    c = [int(c) for c in input().split()]

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

    # max_total = 0
    # for i in range(2 ** n):
    #     total = 0
    #     for j in range(n):  # このループが一番のポイント
    #         if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
    #             total += v[j]
    #             total -= c[j]
    #     if total > max_total:
    #         max_total = total
    # print(max_total)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int, input().split()))
c=list(map(int, input().split()))
x = 0
y = 0
z = []
min = 1000000

for i in range(n):
  z.append(v[i]-c[i])

ans1 = z[0]
for i in range(1, n):
  if ans1 < ans1 + z[i]:
    ans1 += z[i]

ans2 = 0
for i in range(1, n):
  if ans2 < ans2 + z[i]:
    ans2 += z[i]

print(max(ans1, ans2))

Submission status: Accepted

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

p = []
for ci,vi in zip(c,v):
    if vi >= ci:
        p.append(vi-ci)

if p:
    print(sum(p))
else:
    print(0)

Submission status: Accepted

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

plus=[]
for i,v in enumerate(V):
    if int(v)-int(C[i])>0:
        plus.append(int(v)-int(C[i]))
sum=0        
for p in plus:
    sum+=p

print(sum)

Submission status: Accepted

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

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

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

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

value = v-c
total = 0

for i in range(n):
  if value[i] > 0:
    total += value[i]

print(total)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# B - Resale

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

print(sum([ i-k for i, k in zip(value, cost) if i > k]))

Submission status: Accepted

Solution code:
n = int(input())

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

print(ans)

Submission status: Accepted

Solution code:
num = input()
str = []
ans = 0
for i in range(2):
  str.append(input().split())

for i in range(int(num)):
  if int(str[0][i]) > int(str[1][i]):
    ans += int(str[0][i]) - int(str[1][i])

print(ans)

Submission status: Accepted

Solution code:
n = int(input())

v = [int(s) for s in input().split()]

c = [int(s) for s in input().split()]

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

print(price)

Submission status: Accepted

Solution code:
if __name__ == '__main__':
    input_list = list(map(int, input().split()))
    N = input_list
    input_list = list(map(int, input().split()))
    V_list = input_list
    input_list = list(map(int, input().split()))
    C_list = input_list

    d_list = [v - c for (v, c) in zip(V_list, C_list)]

    answer = 0

    for d in d_list:
        if d > 0 :
            answer += d

    print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

num = int(input())
value_list = np.array(list(map(int, input().split())))
cost_list = np.array(list(map(int, input().split())))

diff = value_list - cost_list

max_value = 0

for d in diff:
    if d > 0:
        max_value += d

print(max_value)

Submission status: Accepted

Solution code:
def split_returner(chardata):
        chardata = str(chardata).split(" ")
        for i in range(0,len(chardata)):
            chardata[i] = int(chardata[i])
        return chardata

num = int(input())
value = split_returner(input())
cost = split_returner(input())

res = 0
gain = 0

for i in range(0,len(value)):
    gain = value[i] - cost[i]
    if gain >= 0:
        res += gain
    else:
        pass

print(res)

Submission status: Accepted

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

count = 0

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

print(count)

Submission status: Accepted

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

Ss = []
for i in range(N):
	Ss.append([Vs[i],Cs[i],Vs[i]-Cs[i]])
	
Ss = sorted(Ss,key=lambda x: x[2],reverse=True)

ans = 0
for s in Ss:
	if s[2] < 0:
		break
	
	ans += s[2]
	
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v_list = list(map(int,input().split()))
c_list = list(map(int,input().split()))
res = []
for i in range(n):
    if v_list[i]-c_list[i] > 0:
        res.append(v_list[i]-c_list[i])
    else:
        continue
print(sum(res))

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
argN = int(input())
argV = list(map(int,input().split()))
argC = list(map(int,input().split()))
ret = 0
for i in range(argN):
  if argV[i] > argC[i]:
    ret += argV[i] - argC[i]
print(ret)

Submission status: Accepted

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

for j in range(n):
    if listA[j]>0:
        b = b + listA[j]
print(b)

Submission status: Accepted

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

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
        lines.append(input())
        lines.append(input())

    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    n = int(lines[0])
    v = [int(e) for e in lines[1].split(" ")]
    c = [int(e) for e in lines[2].split(" ")]

    return (n, v, c)


def solve(n, v, c):

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

    return result


def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
V = list(map(int, input().split()))
V = np.array(V)
C = list(map(int, input().split()))
C = np.array(C)
D = V - C
D = np.maximum(D, 0)
print(np.sum(D))

Submission status: Accepted

Solution code:
import numpy as np
n=int(input())
v=np.array([int(i) for i in input().split()])
c=np.array([int(i) for i in input().split()])

dif=v-c
print(sum([x for x in dif if x>0]))

Submission status: Accepted

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

Submission status: Accepted

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

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())
list = [list(map(int,input().split())) for i in range(2)]
ans = 0

for i in range(N):
    v,c = list[0][i],list[1][i]
    if v - c > 0:
        ans += (v - c)

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
list_V = list(map(int, input().split()))
list_C = list(map(int, input().split()))
list_VC = [list_V[i] - list_C[i] for i in range(N)]
count = 0
for i in range(N):
    if list_VC[i] > 0:
        count += list_VC[i]
print(count)

Submission status: Accepted

Solution code:
N=int(input())
a=input()
b=input()
V=[]
C=[]
A=a.split()
B=b.split()
for i in range(len(A)):
  V.append(int(A[i]))
  C.append(int(B[i]))


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

Submission status: Accepted

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

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

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

print(r)

Submission status: Accepted

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

for v, c in zip(V, C):
    B.append(v - c)

total_b = 0
for b in B:
    if b > 0:
        total_b += b

print(total_b)

Submission status: Accepted

Solution code:
n = int(input())
value = list(map(int, input().split()))
cost = list(map(int, input().split()))
ret = 0
for state in range((1 << n)):
    values = costs = 0
    for shift in range(n):
        if (state >> shift) & 1 == 1:
            values += value[shift]
            costs += cost[shift]
    ret = max(ret, values - costs)
print(ret)

Submission status: Accepted

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

def dfs(index, value, cost):
	if index == n:
		return value - cost 
	else:
		res0 = dfs(index + 1, value, cost)
		res1 = dfs(index + 1, value + v[index], cost + c[index])
		return max(res0, res1)

print(dfs(0,0,0))

Submission status: Accepted

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

print(b)

Submission status: Accepted

Solution code:
input()
v_list = map(int, input().split())
c_list = map(int, input().split())
result = 0
for v, c in zip(v_list, c_list):
    tmp = v - c
    if tmp > 0:
        result += tmp
print(result)

Submission status: Accepted

Solution code:

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

val = 0
for i in range(N):
    if Vs[i] - Cs[i] > 0:
        val += Vs[i] - Cs[i]
print(val)

Submission status: Accepted

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


def solve(N: int, V: "List[int]", C: "List[int]"):
    ans = [V[i]-C[i] for i in range(len(V))]
    ans2 = [i for i in ans if i >= 0]

    print(sum(ans2))
    return


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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
v=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:
Sum = 0

N = int(input())

V_list = [int(i) for i in input().split()]
C_list = [int(i) for i in input().split()]

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:

def main():
    result = sub()
    print(result)


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

    res = 0
    for i in range(N):
        profit = Vs[i] - Cs[i]
        if profit > 0:
            res = res + profit
    return res


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding utf-8 -*-
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=[]
for i in range(n):
    x=v[i]-c[i]
    if x>0:
        ans.append(x)


print(sum(ans))

Submission status: Accepted

Solution code:
N = input()
Vs =  list(map(int, input().split()))
Cs =  list(map(int, input().split()))
Rs = []
for i, v in enumerate(Vs):
  Rs.append(v - Cs[i])
res = 0
for r in Rs:
  if r > 0:
    res += r
print(res)

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

print(p)

Submission status: Accepted

Solution code:
N = int(input())
Vs = [int(i) for i in input().split()]
Cs = [int(i) for i in input().split()]
res = 0
for i in range(len(Vs)):
    if Vs[i] - Cs[i] > 0:
        res += Vs[i] - Cs[i]
print(res)

Submission status: Accepted

Solution code:
N = int(input())
V_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))

sum = 0
for i in range(N):
    if V_list[i] >= C_list[i]:
        sum += V_list[i] - C_list[i]
    else:
        pass

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 vv,cc in zip(V,C):
  if vv-cc>0:
    res=res+vv-cc
print(res)

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
for i in range(N):
    ans = max([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()))

value=0

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

print(value)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 27 21:06:24 2019

@author: yuta
"""

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

def main(n,v,c):
    value = [0]*n
    for i in range(n):
        value[i] = v[i] - c[i]
    
    count = 0
    for j in range(n):
        if value[j] > 0:
            count += value[j]
    print(count)
main(N,V,C)

Submission status: Accepted

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

Submission status: Accepted

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

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

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(n,v,c)
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()))

good = []
max_c = 0

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

print(max_c)

Submission status: Accepted

Solution code:
import sys
 
 
N = int(sys.stdin.readline())
V = sys.stdin.readline().strip().split()
C = sys.stdin.readline().strip().split()


dif = []
for i in range(N):
    V_i = int(V[i])
    C_i = int(C[i])
    dif.append(V_i-C_i)
    
sum = 0
for s in dif:
    if(s>0):
        sum += s
print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

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

p = 0
m = 0

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

Submission status: Accepted

Solution code:
N = int(input())
V = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
 
N = []
for i, v in enumerate(V):
    N.append(V[i]-C[i])

N.sort(reverse=True)
 
result = 0
for n in N:
    if 0<n:
        result += n
    else:
        break

print(result)

Submission status: Accepted

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

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

print(num)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
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)]
res = 0
for i in range(n):
  if d[i] > 0:
    res += d[i]
    
print(res)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(T_max)

Submission status: Accepted

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

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

print(diff)

Submission status: Accepted

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

ans = 0

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

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
s=sorted([a-b for a,b in zip(v,c)])[::-1]
d=[sum(s[:i])for i in range(len(s)+1)]
print(max(max(d),0))

Submission status: Accepted

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

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
s = np.array(v) - np.array(c)
print(s[s > 0].sum())

Submission status: Accepted

Solution code:
read_ints = lambda : map(int, raw_input().strip().split())

n = input()
v = read_ints()
c = read_ints()

ans = sum(v) - sum(c)

for i in xrange(1 << n):
    cur = 0
    for j in xrange(n):
        if (i & (1 << j)):
            cur += v[j]
            cur -= c[j]
    ans = max(ans, cur)

print ans

Submission status: Accepted

Solution code:
N=int(input())

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

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

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
Vlist = np.array(list(map(int, input().split())))
Clist = np.array(list(map(int, input().split())))
diff_list = []

sum = 0
for i in range(0, N):
    diff = Vlist[i] - Clist[i]
    if diff > 0:
        sum = sum + diff

print(sum)

Submission status: Accepted

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


print(int(ans))

Submission status: Accepted

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

for i in range(n):
  xyi = v[i] - c[i]
  xy.append(xyi)

for i in xy:
  if i > 0:
    ans += 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()]

cost =[i-j for i,j in zip(V,C)]

profit = 0

for i in cost:
    if(i>=0):
        profit+=i

print(profit)