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

out = 0

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

print(out)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float('INF')

#A
def A():
    a, b, t = LI()
    print(b * (t // a))
    return

#B
def B():
    n = II()
    v = LI()
    c = LI()
    ans = 0
    for i in range(n):
        if v[i] > c[i]:
            ans += v[i] - c[i]
    print(ans)
    return

#C
def C():
    return

#D
def D():
    return

#Solve
if __name__ == '__main__':
    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()]

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

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

Submission status: Accepted

Solution code:
n = int(input())

V = input().split()
C = input().split()

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

print(sum)

Submission status: Accepted

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

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

ans = 0
for v in vc:
    if v < 0:
        break
    ans += v
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:
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

import re
# import numpy as np
# from scipy.misc import perm
# from scipy.misc import comb

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e18)
MOD = int(1e9)+7 # 10^9 + 7

########

N = i_inpl()
V = l_inpl()
C = l_inpl()

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

ans = 0
print(sum([ li for li in l if li > 0]))

Submission status: Accepted

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

value = 0

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

print(value)

Submission status: Accepted

Solution code:
N = int(input())

lsV = list(map(int,input().split()))
lsC = list(map(int,input().split()))

ans = 0

for i in range(N):
    if lsV[i] > lsC[i]:
        ans = ans + lsV[i] - lsC[i]

print(ans)

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

profit = v - c

max_profit = np.sum(profit[profit>0])
print(max_profit)

Submission status: Accepted

Solution code:
n = input()

v_li = list(map(int, input().split()))
c_li = list(map(int, input().split()))
maximam = 0
vc_li = [i- j for i, j in zip(v_li , c_li)]
vc_li.sort(reverse = True)
ans = 0
for i in vc_li:
    if i <= 0:
        break
    ans += i


print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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=ans+V[i]-C[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# コストに制限が無い上で、価値ーコストの総和を最大化する
# Vi-Ciが正になる組みを全て足し合わせれば良い
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:
# -*- coding: utf-8 -*-
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(n):
    differences = v[i] - c[i]
    if 0 < differences:
        ans += differences
    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 = sum(a - b for a,b in zip(v, c) if a > b)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
vn = [int(x) for x in input().split()]
cn = [int(x) for x in input().split()]

sum = 0
for i in range(0,n):
  sum += vn[i] - cn[i] if vn[i] - cn[i] > 0 else 0

print(sum)

Submission status: Accepted

Solution code:
def resolve():
    n = int(input())
    v = map(int,input().split())
    c = map(int,input().split())
    s = [x-y for x,y in zip(v,c) if (x-y)>0]
    ans = 0
    if s:
        ans = sum(s)
    print(ans)

if __name__ == "__main__":
    resolve()

Submission status: Accepted

Solution code:
import numpy as np
N=int(input())
V=list(map(int, input().split()))
C=list(map(int, input().split()))
V=np.array(V)
C=np.array(C)
X= V-C
Y = [False]*(len(V))
for i in  range(len(V)):
    if X[i] >=0:
        Y[i]=True
    else:
        Y[i]=False

Xnatural = X[np.array(Y)]
print(np.sum(Xnatural))

Submission status: Accepted

Solution code:
import sys
import math
from collections import deque

sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def solve(inputs):
    [N] = string_to_int(inputs[0])
    V = string_to_int(inputs[1])
    C = string_to_int(inputs[2])

    ret = 0
    for i, _ in enumerate(V):
        if V[i] - C[i] > 0:
            ret += V[i] - C[i]
    return ret


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(3))
    print(ret)

Submission status: Accepted

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

Submission status: Accepted

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

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

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

print(sum)

Submission status: Accepted

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

    print(sum([x - y for x, y in zip(V, C) if x > y]))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n = int(input())

integer = int(0)
v = input().split()

c = input().split()

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

Submission status: Accepted

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

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 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()))
Z = []

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

print(sum(Z))

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:
import itertools
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

M = [[V[i], C[i]]for i in range(N)]
#print(M)


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

print(R)

Submission status: Accepted

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

for i,v in zip(v,c):
	sub = i-v
	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()))

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = input().split(" ")
c = input().split(" ")

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
from collections import deque  # 双方向キュー
from collections import defaultdict  # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー
from bisect import bisect_left, bisect_right  # 二分探索
#import numpy as np  # 1.8.2
#import scipy  # 0.13.3
#sys.setrecursionlimit(int(1e+6))
s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))
MOD = int(1e+9) + 7

def main():
    N = i2n()
    V = i2nn()
    C = i2nn()
    n = 0
    for v, c in zip(V, C):
        xy = v - c
        if xy > 0:
            n += xy
    print(n)

main()

Submission status: Accepted

Solution code:
N = int(input())
values = list(map(int,input().split()))
costs = list(map(int,input().split()))
dictionary = []
for v in range(N):
  dictionary.append([values[v],costs[v]])
x,y=0,0
result = []
for i in range(N):
  if dictionary[i][0] - dictionary[i][1]>0:
    result.append(dictionary[i][0]-dictionary[i][1])
print(sum(result))

Submission status: Accepted

Solution code:
n=int(input())
listv=[int(x) for x in input().split()]
listc=[int(y) for y in input().split()]
values=[x - y for (x, y) in zip(listv, listc)]
ans = 0
for i in values:
  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()))
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:
#r, d, x = map(int,input().split())
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))
#s = input()
ls = []
for i in range(n):
  ls.append(v[i]-c[i])
ls = [i for i in ls if i > 0]
print(sum(ls))

Submission status: Accepted

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

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

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

print(ans)

Submission status: Accepted

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

dif = [value[x] - cost[x] for x in range(n)]

for i in range(n):
    if dif[i] > 0:
        cnt += dif[i]

print(cnt)

Submission status: Accepted

Solution code:
n =int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))
ret = 0
for vi,ci in zip(v,c):
  if vi - ci >= 0:
    ret += vi - ci
print(ret)

Submission status: Accepted

Solution code:
n = int(input())
v_ary = list(map(int, input().split()))
c_ary = list(map(int, input().split()))

a_minus_b = 0

for i in range(n):
    if v_ary[i] - c_ary[i] > 0:
        a_minus_b += v_ary[i] - c_ary[i]
print(a_minus_b)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    *V, = map(int, input().split())
    *C, = map(int, input().split())
    value = sum([v - c for v, c in zip(V, C) if v > c])
    print(value)


main()

Submission status: Accepted

Solution code:
N=int(input())
R=input().split()
C=input().split()
P=0

for i in range(N):
    if int(R[i])-int(C[i])>=0:
        P+=int(R[i])-int(C[i])

print(P)

Submission status: Accepted

Solution code:
N=int(input())


R=input().split()
C=input().split()
P=0

for i in range(N):
    if int(R[i])-int(C[i])>=0:
        P+=int(R[i])-int(C[i])

print(P)

Submission status: Accepted

Solution code:
n = int(input())

value = [int(x) for x in input().split()]
cost = [int(x) for x in input().split()]

print(sum([int(value[i] - cost[i]) for i in range(n) if value[i] > cost[i]]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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 = 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:
a = int(input())
b = []
b.append(list(map(int, input().split())))
b.append(list(map(int, input().split())))
c = 0
for i in range(a):
    if b[0][i] > b[1][i]:
        c += b[0][i] - b[1][i]
print(c)

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

benefit = []
for i in range(N):
  b = V[i]-C[i]
  benefit.append(max(0,b))
  
print(sum(benefit))

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

  
print(sum)

Submission status: Accepted

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

ma = 0

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

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

result=0

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

print(result)

Submission status: Accepted

Solution code:
#B

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

Submission status: Accepted

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

print(sum(map(lambda p: max(0, p[0] - p[1]), zip(V, C))))

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]:
  R = 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=[]
cnt=0
for i in range(N):
    A.append(V[i]-C[i])
for j in range(N):
    if A[j]>=0:
        cnt+=A[j]
print(cnt)

Submission status: Accepted

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

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

b = sorted([v[i]-c[i] for i in range(n)],reverse=True)
ans = 0
for i in range(len(b)):
    if b[i] > 0:
        ans += b[i]
    else:
        break
print(ans)

Submission status: Accepted

Solution code:
n = input()
n = int(n)
l1=[]
l2=[]
l1 = input().split(" ")
l2 = input().split(" ")
total=0;
for i in range(0,n):
	v1=int(l1[i])
	v2=int(l2[i])
	if(v1-v2>0):
		total = total+v1-v2
print(total)

Submission status: Accepted

Solution code:
juwel_num = int(input())
juwel_value = list(map(int, input().split()))
juwel_cost = list(map(int, input().split()))

total_value = 0

for i in range(juwel_num):
    value_score = juwel_value[i] - juwel_cost[i]
    if value_score > 0:
        total_value += value_score

print(total_value)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

sum = 0

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

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

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):
  d=V[i]-C[i]
  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()))
diffs=[vv-cc for vv,cc in zip(v,c)]

ans=0
for d in diffs:
    ans+=max(d,0)

print(ans)

Submission status: Accepted

Solution code:
n = input()
val_list = list(map(int,input().split()))
cost_list = list(map(int,input().split()))

sum_value = 0

for i in range(int(n)):
	a = val_list[i] -cost_list[i]
	if a>0:
		sum_value += a

print(sum_value)

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from collections import defaultdict
import math
import re

def main():
    #A, B, T = map(int, input().split())
    N = int(input())
    V_list = [int(v) for v in input().split()]
    C_list = [int(v) for v in input().split()]

    VC_diffs = [v - c for v, c in zip(V_list, C_list)]
    VC_diffs = [vc for vc in VC_diffs if vc > 0]

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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:
N = int(input())
V = [0] * N
C = [0] * N
V = list(map(int, input().split()))
C = list(map(int, input().split()))

benefit = 0

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

print(benefit)

Submission status: Accepted

Solution code:
N = int(input())
Vlist = list(map(int, input().split()))
Clist = list(map(int, input().split()))
ans = 0
for n in range(N) :
    dif = Vlist[n] - Clist[n]
    if dif > 0 :
        ans += dif
print(ans)

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):
    if(vn[i]-cn[i]>0):
        ans+=(vn[i]-cn[i])
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()))
Z = np.array(V) - np.array(C)
point = sum(Z[Z>=0])
print(point)

Submission status: Accepted

Solution code:
n = int(input())
lstv = list(map(int,input().split()))
lstc = list(map(int,input().split()))
ans = 0
for i in range(n):
    vc = lstv.pop(0)-lstc.pop(0)
    if vc >=0: ans+=vc
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 vi, ci in zip(v, c):
    d = vi - ci
    if d > 0:
        ans += d
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

import numpy as np

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

benefit = V - C
sum_b = 0
for item in benefit:
    if item > 0:
        sum_b += item

print(sum_b)

Submission status: Accepted

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

plslst = [x - y for (x, y) in zip(v, c)]
ans = []
for i in plslst:
    if i > 0:
        ans.append(i)
    else:
        pass
print(sum(ans))

Submission status: Accepted

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

inf_min = -float("inf")
dp = [inf_min] * (n +1)
dp[0] = 0
for i in range(n):
  dp[i+1] = max(v[i] - c[i] +dp[i] , dp[i])
print(dp[n])

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:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# 初項s, 交差dのn個の数列の和
def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

for i in range(N):
	if V[i] > C[i]:
		lst.append(V[i] - C[i])

print(sum(lst))

Submission status: Accepted

Solution code:
n = int(input())
vc = [[int(i) for i in input().split()] for i in range(2)] 
xy = []
for i in range(n):
    xy.append(vc[0][i]-vc[1][i])
ans = 0
for i in range(n):
    if 0 < xy[i]:
        ans += xy[i]
print(ans)

Submission status: Accepted

Solution code:
def abc():
    input()
    v = map(int, input().rstrip().split())
    c = map(int, input().rstrip().split())
    net = sum([x - y for x, y in zip(v, c) if x - y > 0])
    print(net)


abc()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np
n=int(input())
values=[int(i)  for  i  in  input().split()]
costs=[int(i)  for  i  in  input().split()]
score=0
benefits=np.sort([values[i]-costs[i]  for  i  in  range(n)])[::-1]
for  i  in  range(n):
    if  benefits[i]>0:
        score+=benefits[i]
    else:
        break

print(score)

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(0,v[i]-c[i])
print(s)

Submission status: Accepted

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

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