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

ans = []
for j in range(n):
    if V[j] >= C[j]:
        ans.append(V[j]-C[j])
        
print(sum(ans))

Submission status: Accepted

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

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

ans = 0
Vsum = []
Csum = []
for i in range(1,N+1):
  Vsum.append(list(itertools.combinations(V, i)))
  Csum.append(list(itertools.combinations(C, i)))

for i in range(N):
  for j in range(len(Vsum[i])):
    if ans <= sum(Vsum[i][j]) - sum(Csum[i][j]):
      ans = sum(Vsum[i][j]) - sum(Csum[i][j])

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

Submission status: Accepted

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

buf=[]
result=0

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

for b in buf:
    if b>0:
        result+=b

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

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

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):
    Z = Vlist[i] - Clist[i]
    if Z > 0:
        ans += Z

print(ans)

Submission status: Accepted

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

#output
D = [v-c for v, c in zip(V, C) if v-c >0]

print(sum(D))

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):
  a=v[i]-c[i]
  if a>0:
    ans+=a

print(ans)

Submission status: Accepted

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

print(sum(k))

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

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):
    if v[i]/c[i] > 1:
        l.append(i)
if l:
    vt,ct=0,0
    for j in l:
        vt += v[j]
        ct += c[j]
    print(vt-ct)
else:print(0)

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

diff2 = [i for i in diff if i >0]
print(sum(diff2))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
vs = list(map(int, input().split()))
cs = list(map(int, input().split()))
print(sum(d for d in [vs[i] - cs[i] for i in range(n)] if d > 0))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
vs = list(map(int, input().split()))
cs = list(map(int, input().split()))
value = 0
for d in [vs[i] - cs[i] for i in range(n)]:
  if d > 0:
    value = value + d
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 = 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 = 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()))

dif = [0] * n

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

for j in range(n):
  if dif[j] < 0:
    dif[j] = 0

print(sum(dif))

Submission status: Accepted

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

v_c = [x-y for (x, y) in zip(v, c) if x-y > 0]
print(sum(v_c))

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

print(ans)

Submission status: Accepted

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

ans = 0
for _v, _c in zip(v, c):
    vc = _v - _c
    if 0 <= vc:
        ans += vc

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(buf)

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

ans = 0

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

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()))
a=[]
for i in range(n):
    x=v[i]
    y=c[i]
    a.append(x-y)

def max_sum(N,a):
  dp=[0]*(N+1)
  for i in range(N):
    dp[i+1]=max(dp[i],dp[i]+a[i])
  return dp[N]

print(max_sum(n,a))

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

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()))
from itertools import product
max_total = 0
for lis in product((0, 1), repeat=n):
  total = 0
  for i, zero_one in enumerate(lis):
    total += (V[i]-C[i]) * zero_one
  max_total = max(max_total, total)
print(max_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:
N = int(input())
X, Y = 0, 0
V = list(map(int, input().split()))
C = list(map(int, input().split()))

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

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

print(ans)

Submission status: Accepted

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

for i in range(n):
    t = value[i]-cost[i]
    true_value.append(t)

true_value_a = [i for i in true_value if i >  0]

print(sum(true_value_a))

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
import numpy as np
def print_ans(N, vs, cs):
    """Test Case
    >>> print_ans(3, [10, 2, 5], [6, 3, 4])
    5
    >>> print_ans(4,[13, 21, 6, 19], [11, 30, 6, 15])
    6
    >>> print_ans(1,[1],[50])
    0
    """
    vs = np.array(vs)
    cs = np.array(cs)
    tmps = vs - cs
    ans_list = tmps[tmps > 0]
    if len(ans_list) == 0:
        print("0")
    else:
        print(np.sum(ans_list))
if __name__ == '__main__':
    N = int(input().rstrip())
    vs = list(map(int, input().rstrip().split()))
    cs = list(map(int, input().rstrip().split()))
    print_ans(N, vs, cs)

Submission status: Accepted

Solution code:
n = int(input())
ls_v = list(map(int, input().split()))
ls_c = list(map(int, input().split()))

x = 0
y = 0

for i in range(n):
    if ls_v[i] - ls_c[i] >= 0:
        x += ls_v[i]
        y += ls_c[i]

print(x - y)

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(2**n):
#   x = []
#   y = []
#   for j in range(n):
#     if (i>>j) & 1:
#       x.append(v[n - j - 1])
#       y.append(c[n - j - 1])
#   ans = max(ans,sum(x) - sum(y))
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()))
summary=0

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

print(summary)

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**8)
inf = float('inf')
ans = count = 0

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

Submission status: Accepted

Solution code:
def p_b():
    n = int(input())
    *v, = map(int, input().split())
    *c, = map(int, input().split())
    ans = 0
    for a, b in zip(v, c):
        if a - b > 0:
            ans += a - b
    print(ans)
    
p_b()

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 = Sum + v[i] -c[i]

print(Sum)

Submission status: Accepted

Solution code:
def examB():
    N = I()
    V = LI(); C = LI()
    ans = 0
    for i in range(N):
        cur = V[i]-C[i]
        if cur>0:
            ans += cur
    print(ans)
import sys,copy,bisect,itertools,heapq,math
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
mod = 10**9 + 7
inf = float('inf')

examB()

Submission status: Accepted

Solution code:
N = int(input())
list_v = list(map(int,input().split()))
list_c = list(map(int,input().split()))

list_V_C =[]

for i in range(N):
    list_V_C.append(list_v[i]-list_c[i])

aaa_max =0
for i in list_V_C:
    aaa_max += max(0,i)

print(aaa_max)

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)]
F = [d for d in D if d > 0]
if len(F) == 0:
  print(0)
else:
  print(sum(F))

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(' '))))
tmp=V-C
tmp=map(lambda x: max(0,x),tmp)
print(sum(tmp))

Submission status: Accepted

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

    # 価値V - コストC 
    D = [V[i] - C[i] for i in range(N)]
    # V - C > 0のフィルタ
    F = [d for d in D if d > 0]

    if len(F) == 0:
        print(0)
    else:
        print(sum(F))

if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

ret=sum(tmp)

print(ret)

Submission status: Accepted

Solution code:
# ABC 125: B – Resale
n = int(input())
v = [int(s) for s in input().split()]
c = [int(s) for s in input().split()]
subtract_c_from_v = [v[i] - c[i] for i in range(n)]

maximum = 0

for subtraction in subtract_c_from_v:
    if subtraction > 0:
        maximum += subtraction

print(maximum)

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

s = 0
for i in range(n):
  if v[i] - c[i] >= 0:
    s += v[i] - c[i]
  else:
    continue
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]:
        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 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_Y = 0     
    
for i in range(N):
    if V[i] > C[i]:
         X_Y += V[i] - C[i]

print(X_Y)

Submission status: Accepted

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

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

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 = sum([(x - y) if (x - y) > 0 else 0 for x, y in zip(V, C)])
print(ans)

Submission status: Accepted

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


def gcd(a, b):
    # greatest common divisor
    while b > 0:
        a, b = b, a % b

    return a


N = int(input())
V = inpl()
C = inpl()

print(sum(V[i] - C[i] for i in range(N) if V[i] > C[i]))

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

a = []
for i in range(N):
  if v[i] > c[i]:
    a.append(v[i] -c[i])
print(sum(a))

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**9)
INF = 10**18


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


def main():
    N = int(input())
    ans = 0
    v=list(map(int,input().split()))
    c=list(map(int,input().split()))
    for i in range(N):
        ans += max(0, v[i]-c[i])
    print(ans)


if __name__ == '__main__':
    main()

Submission status: Accepted

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

V = [int(v) for v in V]
C = [int(c) for c in C]

def dp(i):
    if(i==0):
        if(V[i]<C[i]):
            return 0,0 
        else:
            return V[i],C[i]
    
    else:
        v,c = dp(i-1)
        v1 = v + V[i]
        c1 = c + C[i]
        
        if(v1-c1 <= v-c):
            return v,c
        else:
            return v1,c1
        
        
v,c = dp(N-1)
print(v-c)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
# 2019-11-13 01:43:55(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# from scipy.misc import comb # float
# import numpy as np 

def main():
    n = int(sys.stdin.readline().rstrip())
    v = [int(x) for x in sys.stdin.readline().split()]
    c = [int(x) for x in sys.stdin.readline().split()]

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



if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

print(profit)

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):
  num = v[i] - c[i]
  if num > 0:
    ans += num
    
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 v,c in zip(vl, cl):
    if v - c > 0:
        ans += v-c
        
print(ans)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

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

ans.sort()
for i in range(n):
  if ans[i] < 0:
        ans[i] = 0
  else:
    break
print(sum(ans))

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):
  t = a[i]-b[i]
  if t >= 0:
    count += t
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
N = int(input())
V = np.array(list(map(int, input().split())))
C = np.array(list(map(int, input().split())))
val = V-C
sum = 0
VV = val[val>0]
print(np.sum(VV))

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 = 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 a, b in zip(v, c):
  if a - b > 0:
    ans += a - b
  else:
    continue

print(ans)

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

Submission status: Accepted

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

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())
vs = list(map(int, input().split()))
cs = list(map(int, input().split()))
ans = 0
for i in range(len(vs)):
  if vs[i] >= cs[i]:
    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()))
cnt = 0
ls = []

for i in range(n):
    ls.append(V[i] - C[i])

for l in ls:
    if l >= 0:
        cnt += l

print(cnt)

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):
  x = v[i] - c[i]
  if x > 0:
    ans += x

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

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

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n = int(input())
v_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))
sum = 0
for i in range(0,n):
    if v_list[i] - c_list[i] > 0:
        sum += v_list[i] - c_list[i]
print(sum)

Submission status: Accepted

Solution code:
#!/usr/bin/python3
# -*- coding: utf-8 -*-
n = int(input())
v_list = input().split()
c_list = input().split()
sum = 0
for i in range(0,n):
    v = int(v_list[i])
    c = int(c_list[i])
    if v - c > 0:
        sum += v - c
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):
    y = ans + (V[i] - C[i])
    if ans < y:
        ans = y

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

ans = 0
for i in range(0, n):
    benefit = values[i] - costs[i]
    if benefit > 0:
        ans += benefit
print(ans)

Submission status: Accepted

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

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

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 i in range(n):
        diff = V[i]-C[i]
        if diff > 0:
            ans += diff
    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):
  try:
      han = int(V[i]) - int(C[i])
      if han > 0:
        ans += han
  except TypeError:
    pass
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())))

sub = v - c
sub = np.where(sub >= 0, sub, 0)
print(sub.sum())

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
cnt = 0
""""
xy_l = []
for i in range(1 << N):
    xy = 0
    for j in range(N):
        if (i >> j) & 1:
            xy += V[j] - C[j]
            print(xy)
    xy_l.append(xy)
print(max(xy_l))
"""

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

Submission status: Accepted

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

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

print(a-b)

Submission status: Accepted

Solution code:
import sys

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

ans = 0

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

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]:
        Z.append(V[i] - C[i])
print(str(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])
  else:
    continue
print(ans)

Submission status: Accepted

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

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

print(get)