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

points = [V[i]-C[i] for i in range(N)]
p_points = [point for point in points if point > 0]
print(sum(p_points))

Submission status: Accepted

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

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

print(sum(diff))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
def solve(lines):
    N = int(lines.pop(0))
    V = list(map(int, lines.pop(0).split(' ')))
    C = list(map(int, lines.pop(0).split(' ')))
    res = 0
    for (v, c) in zip(V, C):
        if v > c:
            res += v - c
    print(res)

lines = [x.strip() for x in sys.stdin.readlines()]
solve(lines)

Submission status: Accepted

Solution code:
n=int(input())
lstV = list(map(int, input().split()))
lstC = list(map(int, input().split()))

anslst=[0]
for i in range(n):
    if lstV[i]>lstC[i]:
        anslst.append(lstV[i]-lstC[i])
print(sum(anslst))

Submission status: Accepted

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

listdayo = []

for index in range(n):

    if v[index] - c[index] > 0:
        listdayo.append(v[index] - c[index])

print(sum(listdayo))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(max)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# coding=utf-8

if __name__ == '__main__':
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

lis = [0]*n
for i in range(n):
  lis[i] = v[i] - c[i]
print(sum(filter(lambda x:x > 0,lis)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
list_V = list(map(int,input().split()))
list_C = list(map(int,input().split()))
i = 0
ans = 0
while i < N:
    value = list_V[i] - list_C[i]
    if value > 0:
        ans += value
    i += 1
print (ans)

Submission status: Accepted

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

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

print(count)

Submission status: Accepted

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

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 = 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())
value = [int(x) for x in input().split()]
cost = [int(x) for x in input().split()]
benefit = 0
for i in range(n):
  temp = value[i] - cost[i]
  if temp > 0:
    benefit += temp
print(benefit)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

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

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

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

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

print (m)

Submission status: Accepted

Solution code:
"""
N 個の宝石があり、i 番目の宝石の価値は Viです。
あなたはこれらの宝石の中からいくつかを選んで手に入れます。
このとき、1つも選ばなくとも、全て選んでも構いません。
ただし、i番目の宝石を手に入れる場合コスト Ciを支払わなければいけません。
手に入れた宝石の価値の合計を X、支払ったコストの合計を Yとします。
X−Yの最大値を求めてください。

制約
入力は全て整数である。
1≤N≤20
1≤Ci,Vi≤50

X - Y = Σ(Vi - Ci)
Vi - Ci > 0のものを全て取得する
"""
N = int(input())
v_list = input().split(" ")
c_list = input().split(" ")
v_list = [int(i) for i in v_list]
c_list = [int(i) for i in c_list]

sumValue = 0
for i in range(N) : 
    substantialValue = v_list[i] - c_list[i]
    if substantialValue > 0 : sumValue += substantialValue
print(sumValue)

Submission status: Accepted

Solution code:
N = int(input()) 
v = list(int(_) for _ in input().split()) 
c = list(int(_) for _ 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()]
xy = []
for v,c in zip(V,C):
    if v-c > 0:
        xy.append(v-c)

print(sum(xy))

Submission status: Accepted

Solution code:
n = int(input())

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

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

total = 0

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

print(total)

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()))
t = []
for vi,ci in zip(v,c):
    t.append(vi-ci)
#print(t)
g = 0
for t1 in t:
    if t1 > 0:
        g += t1
print(g)

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(val)

Submission status: Accepted

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

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

print(sum)

Submission status: Accepted

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

ans = 0

for n in range(N):
  v = V_list[n]
  c = C_list[n]
  if v-c >= 0:
    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()))
li = []
for i in range(N):
    li.append(v[i]-c[i])
ans = 0
for i in range(N):
    ans = max(ans,ans+li[i])
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
v_list = list(map(int,input().split()))
c_list = list(map(int,input().split()))

cnt = 0
for i in range(N):
    if v_list[i]-c_list[i] > 0:
        cnt += v_list[i]-c_list[i]

print(cnt)

Submission status: Accepted

Solution code:
import sys


N = int(sys.stdin.readline())


V = list(map(int, sys.stdin.readline().split()))
C = list(map(int, sys.stdin.readline().split()))

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8
import re
import bisect
from datetime import datetime as dt

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

ans = 0
for i in range(len(v)):
    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()))
r = 0
for i in range(N):
    if(V[i] - C[i] > 0):
        r += V[i] - C[i]
print(r)

Submission status: Accepted

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

a = []

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

a.sort()
a.reverse()

ans = 0

for i in a:
    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()]
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()))

difer = [v - c for v, c in zip(V, C)]

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

print(ans)

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 v, c in zip(v_list, c_list):
  if (v-c)> 0:
    sum += v-c
print(sum)

Submission status: Accepted

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

difplus = []
for i in range(n):
  dif = value[i] - cost[i]
  if dif > 0:
    difplus.append(dif)
    
if difplus == []:
  print(0)
else:
  ans = 0
  for j in difplus:
    ans += j
  print(ans)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
 
input = sys.stdin.readline
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

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

print(a)

Submission status: Accepted

Solution code:
from sys import stdin

N = int(stdin.readline().rstrip())
V = [int(x) for x in stdin.readline().rstrip().split()]
C = [int(x) for x in stdin.readline().rstrip().split()]

res = 0

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

print(res)

Submission status: Accepted

Solution code:
import math
import os
import random
import re
import sys

def solve(n, v, c):
	x = 0
	if n < 1:
		return 0
	for i in range(n):
		if v[i] > c[i]: x += v[i] - c[i]

	return x

if __name__ == '__main__':
    # a, b = map(int, input().split())
    # c, d = map(int, input().split())
    # print(2 + abs(c-a) + abs(d-b) - 1)
    # a, b, t =  map(int, input().split())
    n = int(input())
    v = list(map(int, input().split()))
    c = list(map(int, input().split()))
    print(solve(n,v,c))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

diffs = [V - C for V, C in zip(Vs, Cs)]
diffs = sorted(diffs)

ans = 0
for diff in diffs[::-1]:
    if diff >= 0:
        ans += diff

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = input()
V = map(int, raw_input().split())
C = map(int, raw_input().split())
print sum(v-c for v, c in zip(V,C) if v-c>0)

Submission status: Accepted

Solution code:
import numpy as np 
N = int(input())
V = np.asarray([int(i) for i in input().split()])
C = np.asarray([int(i) for i in input().split()])
diff = V-C
print(diff[diff>0].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):
    if V[i] - C[i] > 0:
        count += V[i] - C[i] 
print(count)

Submission status: Accepted

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

out=0

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

Submission status: Accepted

Solution code:
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

n = ni()
v = na()
c = na()
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:

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


if __name__ == '__main__':
    solve()

Submission status: Accepted

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

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

print(sum(Z))

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
v = list(map(int, input().split()))
c = list(map(int, input().split()))

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

gem = [int(i) for i in input().split()]
price = [int(i) for i in input().split()]

qtd = 0
for i in range(n):
    k = gem[i]-price[i] 
    if(k > 0):
        qtd += k
print(qtd)

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

d_ = [V_[i] - C_[i] for i in range(N) if V_[i]-C_[i] > 0]
#print(V_)
#print(C_)
#print(d_)
print(sum(d_))

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

print(B)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
n = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
inp = int(input())
v = [int(d) for d in input().split()]
c = [int(d) for d in input().split()]
k = 0

for s in range(inp):
    if v[s] >= c[s]:
        k += v[s] - c[s]
print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
a=list(map(int,input().split(" ")))
b=list(map(int,input().split(" ")))
r=0

for i,x in enumerate(a):
  buf=x-b[i]
  if buf>0:
    r+=buf

print(r)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
vlist = [int(_) for _ in input().split()]
clist = [int(_) for _ in input().split()]

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

print(result)

Submission status: Accepted

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

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

a = [0]*n

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

a.sort(reverse=True)
# print(a)

ans = 0
for i in a:
    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()))
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:
"""
python3 main.py < input.txt
"""
import math
import itertools as it
import heapq
"""
A,B,T=map(int, input().split())
print(int(math.floor((T+0.5)/(A))*B))
"""

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

Submission status: Accepted

Solution code:
import math
N = int(input())
V = list(map(int, input().strip().split()))
C = list(map(int, input().strip().split()))
sum = 0
for i in range(0, N):
    if V[i] > C[i]:
        sum += V[i]-C[i]
print("{}".format(sum))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# vim: set fileencoding=utf-8:


def main():
    N = input()
    V = map(int, input().split())
    C = map(int, input().split())
    VCdiff = [v - c for v, c in zip(V, C)]
    a = filter(lambda x: 0 <= x, VCdiff)
    print(sum(list(a)))


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split(' ')))
c = list(map(int, input().split(' ')))
v_sum = sum(v)
c_sum = sum(c)
ans = v_sum - c_sum


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

diff = sorted(diff)

for num in diff:
    if num < 0:
        ans -= num

print(max(ans, 0))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import sys
import math
from bisect import bisect_left
from bisect import bisect_right
import collections
input = sys.stdin.readline

# bisect_left(lists, 3)
# bisect_right(lists, 3)

def main():
	N = int(input())
	V = input().split()
	V = [int(s) for s in V]
	C = input().split()
	C = [int(s) for s in C]

	VAL = []
	for i in range(N):
		a, b = V[i], C[i]
		VAL.append((a, b))

	ass = 0
	bss = 0
	for i, val in enumerate(VAL):
		a, b = val
		if b < a:
			ass += a
			bss += b

	print(ass-bss)
	
	
if __name__ == "__main__":
	main()

Submission status: Accepted

Solution code:
n=int(input())
kachi=list(map(int,input().split()))
cost=list(map(int,input().split()))
delta=[kachi[i]-cost[i] for i in range(n)]
sum=0
delta.sort(reverse=True)
j=0
while(delta[j]>0):
  sum+=delta[j]
  j+=1
  if j==n:
    break
print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
vi = list(map(int,input().split()))
ci = list(map(int,input().split()))

vci = []
res = 0
for i in range(n):
	if(vi[i] - ci[i]) > 0:
		res += vi[i]-ci[i]

print(res)

Submission status: Accepted

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

Submission status: Accepted

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


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

print(money)

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

tmp = [0 for _ in range(N)]

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

Submission status: Accepted

Solution code:
N = int(input())
V = [int(i) for i in input().split()]
C = [V[i]-int(j) for i,j in enumerate(input().split())]
print(sum([c for c in C if c>0]))

Submission status: Accepted

Solution code:
n = int(input())
v_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

answer = 0
for i in range(n):
    if v_list[i] - c_list[i] > 0:
        answer += v_list[i] - c_list[i]
print(answer)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
x = [v[i] - c[i] for i in range(n)]
ans = 0
for xi in x:
    if xi > 0:
        ans += xi
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()))
result = []
for i in range (N):
    temp = V[i]-C[i]
    result.append(temp)
    
ans = 0
for j in range (len(result)):
    if result[j]>=0:
        ans += result[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 = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

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

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

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

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]:
        ans += vList[i] - cList[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()]
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:
from sys import stdin
N=int(stdin.readline().rstrip())
data_V=[int(x) for x in stdin.readline().rstrip().split()]
data_C=[int(x) for x in stdin.readline().rstrip().split()]
ans=0
for ind, i in enumerate(data_V):
    if i - data_C[ind] > 0:
        ans+=(i - data_C[ind])
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 20 20:47:47 2019

@author: Owner
"""

# -*- coding: utf-8 -*-
"""
Created on Sat Apr 13 09:53:12 2019

@author: Owner
"""

import numpy as np
import sys
""""
import collections
import scipy.misc
import sys
import numpy as np
import math
from operator import itemgetter
import itertools
import copy
import bisect
"""

#素因数を並べる
def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(int(i))
    i += 1
  if n > 1:
    table.append(int(n))
  return table   
# 桁数を吐く
def digit(i):
    if i > 0:
        return digit(i//10) + [i%10]
    else:
        return []
    
def getNearestValueIndex(list, num):
    """
    概要: リストからある値に最も近い値のインデックスを取得する関数
    @param list: データ配列
    @param num: 対象値
    @return 対象値に最も近い値
    """

    # リスト要素と対象値の差分を計算し最小値のインデックスを取得
    idx = np.abs(np.asarray(list) - num).argmin()
    return idx

def find_index(l, x, default=False):
    if x in l:
        return l.index(x)
    else:
        return default


"""
N, X = map(int, input().split())

x = list(map(int, input().split()))

P = [0]*N
Y = [0]*N
for n in range(N):
    P[n], Y[n] = map(int, input().split())

# 多次元配列の宣言（あとでintにすること。）（タプルにすること。）
dp = np.zeros((N+1, 4,4,4))
    
all(nstr.count(c) for c in '753')

# 複数配列を並び替え
ABT = zip(A, B, totAB)
result = 0
# itemgetterには何番目の配列をキーにしたいか渡します
sorted(ABT,key=itemgetter(2))
A, B, totAB = zip(*ABT)
A.sort(reverse=True)

# 2進数のbit判定
(x >> i) & 1

# dp最小化問題
dp = [np.inf]*N
for n in range(N):
    if n == 0:
        dp[n] = 0
    else:
        for k in range(1,K+1):
            if n-k >= 0:
                dp[n] = min(dp[n], dp[n-k] + abs(h[n]-h[n-k]))
            else:
                break
# 累積和
add = 1 # 問題によって決まる
res = 0
sums = [0]*(len(nums)+1)
for i in range(len(nums)):
    sums[i+1] = sums[i] + nums[i]
for i in range(0, len(nums), 2):
    left = i
    right = min(i+add, len(nums))
    tmp = sums[right] - sums[left]
    res = max(tmp, res)

#２分探索
li, ri = bisect.bisect_left(p_ac, l[i]-1), bisect.bisect_right(p_ac, r[i]-1)    

#ソート関数
org_list = [3, 1, 4, 5, 2]
new_list = sorted(org_list)
print(org_list)
print(new_list)
# [3, 1, 4, 5, 2]
# [1, 2, 3, 4, 5]

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


def main():
    P = [0]*N
    for n in range(N):
        P[n] = V[n]-C[n]
    P.sort(reverse = True)
    res=0
    for n in range(N):
        if P[n] <= 0:
            break
        else:
            res+=P[n]
            
    print(res)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N =int(input())

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:

N = int(input())
# Value
V = [int(i) for i in input().split(' ')]
# Cost
C = [int(i) for i in input().split(' ')]

sa = [i[0] - i[1] for i in zip(V, C)]
print(sum(filter(lambda x: x > 0, sa)))

Submission status: Accepted

Solution code:
n = int(input())
v = [int(x) for x in input().split(" ")]
c = [int(x) for x in input().split(" ")]
res = 0
for i in range(n):
    res = res + max(0, v[i] - c[i])
print(res)