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

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):
    t = V[i] - C[i]
    if t > 0: ans += t
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 = list(map(int,input().split(" ")))
c = list(map(int,input().split(" ")))

ans = 0
for i in range(len(v)):
  ans += max(0,v[i]-c[i])
print(ans)

Submission status: Accepted

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

value = 0

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
# coding: UTF-8
import sys
#sys.setrecursionlimit(n)
import heapq
import re
import bisect
import random
import math
import itertools
from collections import defaultdict, deque
from copy import deepcopy
from decimal import *

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

count = 0
for i in range(n):
    count += max(a[i] - b[i], 0)
print(count)

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

diff = [0]*n

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

print(sum(diff))

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 i in range(len(V_list)):
    if V_list[i] > C_list[i]:
        ans += V_list[i] - C_list[i]
        
print(ans)

Submission status: Accepted

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

    print(sum(value - cost for value, cost in zip(Values, Costs) if value > cost))

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import numpy as np
_ = input()
price = np.array([int(x) for x in input().split(" ")])
cost = np.array([int(x) for x in input().split(" ")])

money = price - cost

print((money * (money > 0)).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()]
D = [v-c for v, c in zip(V, C)]
ans = 0
for d in D:
    if d > 0:
        ans += d
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
vList = list(map(int, input().split()))
cList = list(map(int, input().split()))

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys

input = sys.stdin.readline
n = int(input())
v_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))
ans = 0
for i in range(n):
    dis = v_list[i] - c_list[i]
    if dis > 0:
        ans += dis
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
Vs=[int(i) for i in input().split()]
Cs=[int(i) for i in input().split()]
score=0
for i in range(N):
    score += 0 if Vs[i]-Cs[i] <0 else Vs[i]-Cs[i]

print(score)

Submission status: Accepted

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

res = 0
for v, c in zip(vs, cs):
    if (v - c) > 0:
        res += (v - c)
print(res)

Submission status: Accepted

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

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

print val

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

A = [v - c for v, c in zip(V, C)]
A = [a for a in A if a > 0]
print(sum(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]
    else:
        continue
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 n in range(N):
    z=V[n]-C[n]
    if z>0:
        ans+=z
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
RV = [0] * N
for i in range(N):
    RV[i] = V[i] - C[i]
RV.sort(reverse=True)
res = 0
for v in RV:
    if v <= 0:
        break
    res += v
print(res)

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

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] :
        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()))
A = 0

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

print(A)

Submission status: Accepted

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

Submission status: Accepted

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


def solve(N: int, V: "List[int]", C: "List[int]"):
    result = 0
    for i in range(0, N):
        if V[i] >= C[i]:
            result = result + V[i] - C[i]
    print(result)
    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()))
ans = sum([max(0, V[i]-C[i]) for i in range(N)])
print(ans)

Submission status: Accepted

Solution code:
n = int(input())

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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

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

Submission status: Accepted

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

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()]
p = [V[i] - C[i] for i in range(N)]
p.sort(reverse=True)

res = 0
for i in p:
        if i <= 0:
                break
        res += i
print(res)

Submission status: Accepted

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

vsum = 0
for c, v in zip(Cs, Vs):
  net = v - c
  if net > 0:
    vsum += net

print(vsum)

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

Submission status: Accepted

Solution code:
N=int(input())
v_list = [int(i) for i in input().split()]
c_list = [int(i) for i in input().split()]
result = 0
for i in range(N):
	if v_list[i]>c_list[i]:
		result+=v_list[i]-c_list[i]
print(result)

Submission status: Accepted

Solution code:
a = input()

l1 = map(int, raw_input().split())
l2 = map(int, raw_input().split())

s = 0
for i in range(a):
	if l1[i] > l2[i]:
		s += l1[i] - l2[i]

print s

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())
vs = [int(i) for i in input().split()]
cs = [int(i) for i in input().split()]
tmp = [v - c for v, c in zip(vs, cs)]
print(sum(t for t in tmp if t > 0))

Submission status: Accepted

Solution code:
N = int(input())
Vlist = list(map(int, input().split()))
Clist = list(map(int, input().split()))

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

print(value)

Submission status: Accepted

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

ans = 0
for i in range(N):
    ans += max(vl[i] - cl[i], 0)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
Vs = list(map(int,input().split()))
Cs = list(map(int,input().split()))
nums = [v-c for (v,c) in zip(Vs,Cs) if (v-c)>0]
print(sum(nums))

Submission status: Accepted

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

result = 0

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

print(result)

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
V = np.array(list(map(int, input().split())))
C = np.array(list(map(int, input().split())))
ans = 0
for i in V-C:
    if(i > 0):
        ans += i
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]:
        ans+=a[i]-b[i]

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
vn = [int(i) for i in input().split(" ")]
cn = [int(i) for i in input().split(" ")]
res = 0
for i in range(n):
    tmp = vn[i] - cn[i]
    if tmp > 0:
        res += tmp

print(res)

Submission status: Accepted

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

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

print(total)

Submission status: Accepted

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

value = 0
for i, j in zip(V, C):
    tmp = i - j
    if tmp > 0:
        value += tmp

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):
  if(V[i]-C[i] > 0):
   Ans.append(V[i]-C[i])
ans = sum(Ans)
print(ans)

Submission status: Accepted

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

ans = 0
for vi,ci in zip(v,c):
    ans = ans + max(0, vi-ci)

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
l=[0]*n
for i in range(n):l[i]=max(v[i]-c[i],0)
print(sum(l))

Submission status: Accepted

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

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

print(t)

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

x = []
for vv, cc in zip(v, c):
    a = vv - cc
    if a > 0:
        x.append(a)
print(sum(x))

Submission status: Accepted

Solution code:
import math
import functools
import itertools
import numpy as np
import sys
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()
V = IL()
C = IL()

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 = list(map(int, input().split()))
C = list(map(int, 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:
#!/usr/bin/env python3
import sys


def solve(N: int, V: "List[int]", C: "List[int]"):
    total = 0
    for i in range(N):
        if V[i] > C[i]:
            total += V[i] - C[i]
    print(total)
    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()))
D = [V[k] - C[k] for k in range(N)]

D = sorted(D)[::-1]

ans = 0
for d in D:
    if d > 0:
        ans += d
print(ans)

Submission status: Accepted

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

print(sum(T))

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

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

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 = [int(i) for i in input().split(" ")]
c = [int(i) for i in input().split(" ")]
m = 0
for i in range(0, n):
    if v[i] > c[i]:
        m += v[i] - c[i]
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 e, f in zip(v, c):
    p = e - f
    if p > 0:
        ans += p
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=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(elm) for elm in input().split(" ")] 
C = [int(elm) for elm in input().split(" ")] 

out = 0
for v, c in zip(V, C):
    out += max(v-c, 0)

print(out)

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 = [int(x) for x in input().split()]
c_list = [int(x) for x in input().split()]

result = 0
for v, c in zip(v_list, c_list):
    profit = v-c
    if v-c>0:
        result += profit
        
print(result)

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

Submission status: Accepted

Solution code:


def main():
    n = int(input())
    v = [int(i) for i in input().split()]
    c = [int(i) for i in input().split()]
    #b = input()
    ans = 0
    for i in range(n):
        if v[i] - c[i] > 0:
            ans += v[i] - c[i]

    print(ans)

main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
s = []
for i in range(n):
    s.append(V[i]-C[i])
s.sort(reverse=True)
res = 0
for a in s:
    if a >= 0:
        res += a
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):
  r = V[i]-C[i]
  if r > 0:
    ans += r
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
v = map(int, input().split())
c = map(int, input().split())

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

print(total)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import collections as c
ip = lambda : map(int, input().split())

#################
N = int(input())
v = list(ip())
c = list(ip())
l = [i-j for i,j in zip(v,c)]
l.sort(reverse=True)
ans = 0
for i in l:
    if i>0:
        ans += i
    else:
        break
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 v, c in zip(V,C):
    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(0,n):
    if v[i]-c[i] > 0:
        ans += v[i]-c[i]

print(ans)

Submission status: Accepted

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

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

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

Vn = list(map(int,input().split()) )
Cn = list(map(int,input().split()) )


ans = 0
for i in range(n):
    t = Vn[i] - Cn[i]

    if t > 0:
        ans += t


print(ans)

Submission status: Accepted

Solution code:
n = int(input())
listV = list(map(int, input().split()))
listC = list(map(int, input().split()))
listXY=[]
index=0
while index < len(listV):
    listXY.append(listV[index]-listC[index])
    index+=1
listXY.sort()
listXY.reverse()
index2=0
maxD=0
while index2 < len(listXY):
    if listXY[index2] > 0:
        maxD+=listXY[index2]
    else:
        break
    index2+=1
print(maxD)

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

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

Submission status: Accepted

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

def readInts():
  return [int(s) for s in input().split(" ")]

def main():
  N = readInts()[0]
  V = readInts()
  C = readInts()
  ans = 0
  for n in range(N):
    ans += max(0, V[n] - C[n])
  print(ans)

if __name__ == "__main__":
  main()

Submission status: Accepted

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

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

ans = 0

for i, j in zip(V,C):
    ans += max(0, i-j)
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()]

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

Submission status: Accepted

Solution code:
# coding:utf-8

import sys
# from collections import Counter, defaultdict

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

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()


def main():
    n = II()
    V = LI()
    C = LI()

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

    return res


print(main())

Submission status: Accepted

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

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

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys

def main():
    input = sys.stdin.readline
    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])

    return ans


if __name__ == '__main__':
    print(main())

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=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):
    ans += max(0, v[i]-c[i])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import exit
N = int(input())
V = [int(n) for n in input().split()]
C = [int(n) for n in input().split()]
VC=[0]*N
for i in range(N):
    VC[i] = (V[i],C[i])
VC = sorted(VC,key=lambda x:-x[0])
ans = 0
for i in range(N):
    if(VC[i][0] > VC[i][1]):
        ans+=VC[i][0] - VC[i][1]
print(ans)
# a = [int(input()) for _ in range(N)]
# S = str(input())
# L = len(S)
# T = str(input())
# exit()

Submission status: Accepted

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

gap = 0

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

print(gap)

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):
  vc.append(v[i]-c[i])
ans=0
for i in vc:
  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())
arr1=list(map(int,input().split()))
arr2=list(map(int,input().split()))
ans=0
for i in range(n):
  if arr1[i]>arr2[i]:
    ans+=arr1[i]-arr2[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()))
ans = 0
for i in range(N):
    gain = V[i] - C[i]
    if gain > 0:
        ans += gain
print(ans)

Submission status: Accepted

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

x = [0]*N
for i in range(N):
	x[i] = v[i]-c[i]

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