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

Submission status: Accepted

Solution code:
# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read() for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N = read_a_int()
V = read_ints()
C = read_ints()

# ans = -100
value = []
for v, c in zip(V, C):
    value.append(v-c)

value.sort(reverse=True)

ans = 0
for v in value:
    if v < 0:
        break
    ans += v

print(ans)

Submission status: Accepted

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


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


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

Submission status: Accepted

Solution code:
N = int(input())
V_arr = list(map(int, input().split()))
C_arr = list(map(int, input().split()))

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

print(ans)

Submission status: Accepted

Solution code:
import atexit
import io
import sys

buff = io.BytesIO()
sys.stdout = buff


@atexit.register
def write():
    sys.__stdout__.write(buff.getvalue())

n = input()
v = map(int, raw_input().split())
c = map(int, raw_input().split())
arr = []
ans = 0
for i in xrange(n):
	arr.append(v[i]-c[i])
arr.sort(reverse = True)
for i in xrange(n):
	if arr[i] > 0:
		ans += arr[i]
	else:
		break
print ans

Submission status: Accepted

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

Submission status: Accepted

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

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

# print(V_C)

count= 0
for x in V_C:
	if x > 0:
		count += x

print(count)

Submission status: Accepted

Solution code:
#125 B
N=int(input())
V = [int(j) for j in input().split()]
C = [int(j) for j 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()))
X = 0
Y = 0
for v, c in zip(V, C):
    if v > c:
        X += v
        Y += c
print(X - Y)

Submission status: Accepted

Solution code:
def input_ints():
    return list(map(int, input().split()))

def main():
    n = int(input())
    a = input_ints()
    b = input_ints()
    ans = 0
    for i in range(n):
        if a[i] > b[i]:
            ans += a[i] - b[i]
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

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

if __name__ == "__main__":
    n = int(input())
    v = list(map(int, input().split()))
    c = list(map(int, input().split()))
    res = 0
    for vv,cc in zip(v,c):
        if vv-cc > 0:
            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()))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
 
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
v = na()
c = na()

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

a=0
for j in k:
    if j >0:
        a+=j
print(a)

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()))
P=list(map(int,input().split()))
answer=0
for i in range(N):
  if V[i]>P[i]:
    answer+=V[i]-P[i]
print(answer)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int ,input().split()))
c = list(map(int ,input().split()))
cnt = []
for i in range(n):
        cnt.append(v[i]-c[i])
ans = 0
for i in range(n):
        if cnt[i]>=0:
                ans += cnt[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:
# -*- coding: utf-8 -*-
def inpl(): return list(map(int, input().split()))
N = int(input())
V = inpl()
C = inpl()
print(sum([max(v-c, 0) for v, c in zip(V, C)]))

Submission status: Accepted

Solution code:
N = int(input())
V, C = [list(map(int, input().split(" "))) for _ in range(2)]

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

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:
# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math


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(item) for item in input().split()]
c = [int(item) for item 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:
n = int(input())
v_array = [int(x) for x in input().split()]
c_array = [int(x) for x in input().split()]

res = 0
for i in range(n):
    if v_array[i] < c_array[i]:
        continue
    else:
        res += v_array[i]- c_array[i]

print(res)

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):
	r += max(0, 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()))

ans = [V[i] - C[i] for i in range(N) if V[i] - C[i] > 0]
print(sum(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:
from functools import reduce
import math

def main():
    # 文字列の2進数を数値にする
    # '101' → '5'
    # 文字列の頭に'0b'をつけてint()にわたす
    # binary = int('0b'+'101',0)

    # 2進数で立っているbitを数える
    # 101(0x5) → 2
    # cnt_bit = bin(5).count('1')
    
    # N! を求める
    # f = math.factorial(N)

    # N の逆元
    # N_inv = pow(N,MOD-2,MOD)

    # nCr
    # Nの階乗 * rの階乗の逆元 * n-rの階乗の逆元
    
    # 切り捨て
    # 4 // 3
    # 切り上げ
    #-(-4 // 3)
    
    # 初期値用:十分大きい数(100億)
    INF = float("inf")

    # 大きな素数
    MOD = 10**9+7
    
    # 1文字のみを読み込み
    # 入力:2
    # a = input().rstrip()
    # 変数:a='2'
    
    # スペース区切りで標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a, b, c, d = (int(_) for _ in input().split())  
    # 変数:a=2 b=4 c=5 d =7
    
    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2 4 5 7
    # a = list(int(_) for _ in input().split())
    # 変数:a = [2, 4, 5, 7]    

    # 1文字ずつ標準入力を配列として読み込み
    # 入力:2457
    # a = list(int(_) for _ in input())
    # 変数:a = [2, 4, 5, 7]    
    N = int(input().rstrip())
    V = list(int(_) for _ in input().split())
    C = list(int(_) for _ in input().split())
    ans = 0
    for i in range(N):
        if(C[i] < V[i]):
            ans += V[i] - C[i]
    print(ans)
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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


main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys, os

f = lambda:list(map(int,input().split()))
if 'local' in os.environ :
    sys.stdin = open('./input.txt', 'r')

def solve():
    n = f()[0]
    v = f()
    c = f()
    a = 0
    for i in range(n):
        if v[i] - c[i]>0:
            a+= v[i] - c[i]
    print(a)

solve()

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))
def dfs(cnt,a):
    if cnt==n:
        return a
    ret1 = dfs(cnt+1,a+v[cnt]-c[cnt])
    ret2 = dfs(cnt+1,a)
    return max(ret1,ret2)
print(dfs(0,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):
    temp = V[i] - C[i]
    if temp > 0:
        ans += temp
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = [x for x in map(int,input().split(" "))]
C = [x for x in map(int,input().split(" "))]

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

Submission status: Accepted

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

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

ans = 0
for e in info:
    if e > 0:
        ans += e

print(ans)

Submission status: Accepted

Solution code:
from heapq import heappush,heappop
import queue
import re

def int_raw():
    return int(input())

def ss_raw():
    return input().split()

def ints_raw():
    return list(map(int, ss_raw()))

INF = 1<<29

def make1d_arr(n,val=INF):
    return [val for i in range(n)]

def make2d_arr(h,w,val =INF):
    return [[val for i in range(w)]for i in range(h)]


N = int_raw()
V = ints_raw()
C = ints_raw()


def main():
    D= [V[i]-C[i] for i in range(N)]
    return sum([d for d in D if d > 0])
    
print(main())

Submission status: Accepted

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

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

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

if __name__ == "__main__":
    solve()

Submission status: Accepted

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

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

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] > 0:
        answer += V[i] - C[i]

print(answer)

Submission status: Accepted

Solution code:
from operator import itemgetter
import sys
sys.setrecursionlimit(1000000)
ans=0

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

Submission status: Accepted

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

Submission status: Accepted

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

diff = []
for i in range(N):
    diff.append(V[i]-C[i])
diff = [diff[i] for i in range(N) if diff[i] > 0]
print(sum(diff))

Submission status: Accepted

Solution code:
n = int(input().strip())
vs = [int(v) for v in input().strip().split()]
cs = [int(v) for v in input().strip().split()]
tot = 0
for v, c in zip(vs, cs):
    if v > c:
        tot += v - c
print(tot)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

ans = 0
for i in range(N):
    if A[i] > B[i]:
        ans += A[i]-B[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,j in zip(v,c):
    if i - j > 0:
        ans += i - j
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

Submission status: Accepted

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

ans=0

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

Submission status: Accepted

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

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

print(x)

Submission status: Accepted

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

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

Submission status: Accepted

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

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




if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
v = list(li())
c = list(li())

ans = 0
for vi, ci in zip(v, c):
    if vi-ci > 0:
        ans += (vi-ci)
        
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 = int(input())
v = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
b = [v[i] - c[i] for i in range(n) if v[i] > c[i]]
ans = sum(b)
print(ans)

Submission status: Accepted

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

VC = []

for i in range(N):
    tmp = V[i] - C[i]
    if tmp > 0:
        VC.append(tmp)

print(sum(VC))

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


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

Submission status: Accepted

Solution code:
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from fractions import gcd
from functools import lru_cache, reduce
from math import ceil, floor
from sys import setrecursionlimit

import heapq
import itertools
import operator


# globals
inf = float('inf')
N = 0


def set_inputs():
    global N
    return


def main():
    setrecursionlimit(100000)
    set_inputs()
    # ----------MAIN----------
    n = get_int()
    v = get_li()
    c = get_li()
    print(sum(max(vi-ci, 0) for vi, ci in zip(v, c)))
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def get_data(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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


def solve(N: int, V: "List[int]", C: "List[int]"):
    ret = 0
    for v, c in zip(V, C):
        ret += max(0, v - c )
    print(ret)

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

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

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
N = int(input())

V_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))

ans = 0
for v,c in zip(V_list, C_list):
    if v > c:
        ans += v-c
print(ans)

Submission status: Accepted

Solution code:
from numpy import*
n=int(input())
*a,=map(int,input().split())
*b,=map(int,input().split())
c=array(a)-array(b)
print(sum([0]+list(c[c>0])))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

@author: Yamazaki Kenichi
"""

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

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

Submission status: Accepted

Solution code:
from statistics import mean, median,variance,stdev
import numpy as np
import sys
import math
import fractions
import itertools
import copy
import collections
from operator import itemgetter
#以下てんぷら
def j(q):
    if q==1: print("Yes")
    else:print("No")
    exit(0)


def ct(x,y):
    if (x>y):print("+")
    elif (x<y): print("-")
    else: print("?")

def ip():
    return int(input())
def printrow(a):
    for i in range(len(a)):
        print(a[i])
def combinations(n,r):
    if n<r:return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations(n,r):
    if n<r:return 0
    return math.factorial(n) // math.factorial(n - r)

n = ip()                                     #入力整数1つ
#a,b,t= (int(i) for i in input().split())       #入力整数横2つ以上
v = [int(i) for i in input().split()]        #入力整数配列
#a = input()                                  #入力文字列
#a = input().split()                          #入力文字配列
#k = ip()                      #入力セット(整数改行あり)(1/2)
#v=[ip() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#a=[input() for i in range(n)]    #入力セット(整数改行あり)(2/2)
#jの変数はしようできないので注意
#全足しにsum変数使用はsum関数使用できないので注意
#こっから本文
c = [int(i) for i in 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:
inpl = lambda: list(map(int,input().split()))
N = int(input())
V = inpl()
C = inpl()
step_u = lambda x: x if x > 0 else 0
B = [ step_u(V[i]-C[i]) for i in range(N) ]
print(sum(B))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(int(result))

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

Submission status: Accepted

Solution code:
# [input]
# n = int(input())
# (string) s = input()
# a, b, c = map(int, input().split())
# h = list(map(int, input().split()))

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)