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, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
V = LIST()
C = LIST()

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#どっちで出すか注意, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    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)

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
v = map(int, input().split())
c = 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:
def main():
    n = int(input())
    v = [int(i) for i in input().split()]
    c = [int(j) for j in input().split()]
    
    x = 0
    y = 0
    for idx in range(n):
        if v[idx] > c[idx]:
            x += v[idx]
            y += c[idx]
    
    print(x-y)

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

Submission status: Accepted

Solution code:
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):
  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()))
li = []

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

print(sum(li))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

def dfs(i, sum):
    if i == n:
        return sum
    else:
        return max(dfs(i + 1, sum), dfs(i + 1, sum + v[i] - c[i]))

ans = dfs(0, 0)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split())) #値段
c = list(map(int,input().split())) #コスト

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

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

x = 0
y = 0

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

print(x-y)

Submission status: Accepted

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

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

Submission status: Accepted

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

val = 0

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

Submission status: Accepted

Solution code:
import numpy as np
N = int(input())
V = np.array([int(i) for i in input().split(" ")])
C = np.array([int(i) for i in input().split(" ")])

vc = V-C

val = 0

for i in range(N):
    if vc[i]>0:
        val+=vc[i]
print(val)

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:
N = int(input())
value = [int(i) for i in input().split()]
cost = [int(i) for i in input().split()]
net_value = [value[i] - cost[i] for i in range(N)]
gain = 0
for item in net_value:
  if item >= 0:
    gain += item
print(gain)

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]:
        l.append(v[i] - c[i])
print(sum(l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
vl = list(map(int, input().split()))
cl = list(map(int, input().split()))
ans = [v - c for v, c in zip(vl, cl) if v > c]
print(sum(ans))

Submission status: Accepted

Solution code:
n = int(input())
list_v = list(map(int, input().split()))
list_c = list(map(int, input().split()))
list_k = []

for i in range(n):
    l = list_v[i]-list_c[i]
    if l > 0:
        list_k.append(l)

print(sum(list_k))

Submission status: Accepted

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

sum = 0

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

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

for i,x in enumerate(input().split()):
    V[i] -= int(x)

V.sort()

ans = 0
for v in V:
    if v > 0:
        ans += v

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
l1 = list(map(int,input().split()))
l2 = list(map(int,input().split()))
l3 = [0]*n
for i in range(n):
  if l1[i] - l2[i] > 0:
    l3[i] = l1[i] - l2[i]
print(sum(l3))

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

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

vc = v-c
ans = sum(vc[vc > 0])
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(0,i-j)for i,j in zip(v,c)))

Submission status: Accepted

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

res = 0
for i, j in zip(v, c):
    res += max(i - j, 0)
print(res)

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

answer=0

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

print(answer)

Submission status: Accepted

Solution code:
#ABC125

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

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

print(count)

Submission status: Accepted

Solution code:
#import sys
#import math
#import numpy as np
'''a,b= map(int,input().split())'''
#a, b, c = [list(map(int, input().split())) for _ in range(3)]
#li0= [int(x) for x in input().split()]
#n,l= map(int, input().split())
#x = [list(map(int, input().split())) for _ in range(n)] 
N=int(input())
li= [int(x) for x in input().split()]
li1=[int(x) for x in input().split()]
ans=0

for i in range(N):
  if li[i]>=li1[i]:
    ans+=li[i]-li1[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(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:
# coding: utf-8

n = int(input().rstrip())

v_list = list(map(int, input().rstrip().split(" ")))
c_list = list(map(int, input().rstrip().split(" ")))

ans = sum([j for j in [v_list[i] - c_list[i] for i in range(n)] if j > 0])
print(ans)

Submission status: Accepted

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

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

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()))
ans = 0
for vi, ci in zip(v, c):
    if vi >= ci:
        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()))

kachi = 0

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

Submission status: Accepted

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

profit = []
for v, c in zip(V, C):
  profit.append(v - c)

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

ans = 0
for p in profit:
  if p > 0:
    ans += p
  else:
    break

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:
#!/usr/bin/python3
# -*- coding:utf-8 -*-

def main():
  n = int(input())
  vs = list(map(int, input().strip().split()))
  cs = list(map(int, input().strip().split()))
  sum = 0
  for x in sorted([v - c for (v, c) in zip(vs, cs)], reverse=True):
    if x <= 0:
      break
    sum += x
  print(sum)

if __name__=='__main__':
  main()

Submission status: Accepted

Solution code:
import math

def main():
    n = int(input())
    v = [int(t)for t in input().split()]
    c = [int(t)for t in input().split()]

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

    print(sum(e))
    
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
def main():
    #from sys import stdin, setrecursionlimit
    #setrecursionlimit(10**9)
    #r = input()
    n = int(input())
    #a, b = map(int, input().split())
    #s, y = input().split()
    #a = input().split()
    #a = [int(input()) for i in range(n)]
    #a = list(map(int, input().split()))
    #a = [list(map(int, input().split())) for i in range(n)]
    #a = [int(s) - 1 for s in input().split()]
    #l=[int(input()) for _ in range(int(input()))]
    #res = 0
    v = map(int, input().split())
    c = map(int, input().split())
    l = sorted([i[0]-i[1] for i in zip(v,c) if (i[0]-i[1]) > 0 ])
    print(sum(l))

if __name__ == '__main__':
    main()

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

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:
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//math.factorial(n-r)*math.factorial(r)


n = int(input())
vv = list(map(int, input().split()))
cc = list(map(int, input().split()))
ans = 0
for v, c in zip(vv, cc):
    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()))
output = 0
for i in range(N):
    XY = V[i] - C[i]
    if XY>0:
        output += XY
print(output)

Submission status: Accepted

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

    def search(i, select, value, cost):
        if i == N:
            return value - cost
        ans1 = search(i + 1, select, value, cost)
        ans2 = search(i + 1, select | (1 << i), value + V[i], cost + C[i])
        return max(ans1, ans2)

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

Submission status: Accepted

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


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

Submission status: Accepted

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

diff_plus = [i - j for i, j in zip(value, cost) if (i - j) > 0]
print(sum(diff_plus))

Submission status: Accepted

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

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 = ans + d
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
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] :
        ans += V[i] - C[i]

print(ans)

Submission status: Accepted

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

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

print(m)

Submission status: Accepted

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

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

ans = sum(filter(lambda x: x>0, diff))

print(ans)

Submission status: Accepted

Solution code:
#125_B
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)]
print(sum([x if x>0 else 0 for x in X]))

Submission status: Accepted

Solution code:
N = input()
V = map(int, input().split())
C = 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):
  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):
    buf=v[i]-c[i]
    if buf>0:
        ans+=buf
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
V = 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()))
cp=[i-j for i, j in zip(v,c)]
ans=0
for a in sorted(cp,reverse=True):
    if a>=0:
        ans+=a
    else:
        break
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:

import sys

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
# https://atcoder.jp/contests/abc125/tasks/abc125_b

n = int(input())
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
e = [v - c for v, c in zip(v, c) if v - c > 0]
print(sum(e)) if len(e) > 0 else print(0)

Submission status: Accepted

Solution code:
n = int(input())
stone_v = [int(i) for i in input().split()]
stone_c = [int(i) for i in input().split()]
mx = 0
for i in range(n):
    a = stone_v[i]-stone_c[i]
    if mx < mx+a:
        mx += a
print(mx)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# #!/usr/bin/env python3
# # -*- coding: utf-8 -*-


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

    print(result)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
print(sum(max(x-y,0)for x,y in zip(*[map(int,t.split())for t in open(0)][1:])))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main(n,v,c):
    sumVal = 0
    for i in range(n):
        if v[i] > c[i]:
            sumVal += v[i] - c[i]
    return sumVal

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

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for i in range(N):
    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()))
l=[x-y for(x,y) in zip(v,c)]
print(sum([x for x in l if x>0]))

Submission status: Accepted

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

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]
    else:
        continue

print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

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

x=0
y=0

for i in range(n):
  if v[i]>c[i]:
    x+=v[i]
    y+=c[i]
  else:
    pass
print(x-y)

Submission status: Accepted

Solution code:
import numpy as np

def main():
    n = int(input())
    value_list = list(map(int, input().split()))
    cost_list = list(map(int, input().split()))

    ans = 0

    value_list = np.array(value_list)
    cost_list = np.array(cost_list)

    value_list -= cost_list

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

    print(ans)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

ans = [int(x) for x in lst if x >= 0]

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

Submission status: Accepted

Solution code:
import sys

INPUT = lambda: sys.stdin.readline().rstrip()
INT = lambda: int(INPUT())
LIST = lambda: list(map(int, INPUT().split()))

sys.setrecursionlimit(10 ** 9)


def main():
    _ = INT()
    V = LIST()
    C = LIST()

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

    print(ans)


if __name__ == '__main__':
    main()

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())))
vc = v-c
answer = [x for x in vc if x > 0]
print(sum(answer))

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())
V = input().split()
C = input().split()

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

ans = 0

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

m=0

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