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

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

print(A)

Submission status: Accepted

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

for i in range(N):
    ans = max(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:
N = int(input())
v = [int(x) for x in input().split()]
c = [int(x) for x in input().split()]
val = 0
for i in range(N):
    if v[i] - c[i] > 0:
       val += v[i] - c[i]
print(val)

Submission status: Accepted

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

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

print(res)

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))
a = sorted([v[i]-c[i] for i in range(n)],reverse=True)
ans = 0
for j in a:
    if j <= 0:
        break
    ans += j
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N = int(input())
VList = list(map(int, input().split()))
CList = list(map(int, input().split()))
ANS=0
for i in range(N):
    if VList[i]>CList[i]:
        ANS+=VList[i]-CList[i]
print(ANS)

Submission status: Accepted

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

a=0
for v,c in zip(value,cost):
    if v>c:
        a+=v-c
        
print(a)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 8)
from itertools import accumulate
from itertools import permutations
from itertools import combinations
from collections import defaultdict
from collections import Counter
import fractions
import math
from collections import deque
from bisect import bisect_left
from bisect import insort_left
import itertools
from heapq import heapify
from heapq import heappop
from heapq import heappush
import heapq
from copy import deepcopy
from decimal import Decimal
alf = list("abcdefghijklmnopqrstuvwxyz")
ALF = list("ABCDEFGHIJKLMNOPQRSTUVWXYZ")
#import numpy as np
INF = float("inf")
#d = defaultdict(int)
#d = defaultdict(list)
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = 0
for i in range(N):
    if V[i]-C[i]>0:
        ans += V[i]-C[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for v_i, c_i in zip(v, c):
  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:
from sys import stdin, setrecursionlimit
from bisect import bisect_right


def main():
    input = stdin.buffer.readline
    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)]
    d.sort()
    idx = bisect_right(d, 0)
    print(sum(d[idx:]))


if __name__ == "__main__":
    setrecursionlimit(10000)
    main()

Submission status: Accepted

Solution code:
import sys

input = lambda: sys.stdin.readline().rstrip()


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

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

    print(ans)


if __name__ == '__main__':
    solve()

Submission status: Accepted

Solution code:

import numpy as np
n = int(input())
vList = np.array(list(map(int, input().split())) )
cList = np.array(list(map(int, input().split())) )
dList = vList-cList
ret = np.nansum(dList[dList > 0])

print(ret)

Submission status: Accepted

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

r = []
for i, j in zip(v,c):
    if i>j:
        r.append(i-j)
print(sum(r))

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

for i in range(N):
     A[i] = V[i]-C[i]

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

ans = 0

for i in range(N):
  if A[i] > 0:
    ans += A[i]
  else:
    break

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 x,y in zip(X,Y):
  if x-y >0:
    ans += x-y
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()]

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

ans = 0
for val in a:
    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
temp = 0

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

print(ans)

Submission status: Accepted

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

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

print(max_diff_v_c)

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

Submission status: Accepted

Solution code:
import sys

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

ans = 0
for i in range(N):
    tmp = V[i] - C[i]
    if tmp > 0:
        ans += tmp
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:
def actual(n, V, C):
    # 購入するとプラスになるものだけ買って合計でおk
    sale_jewels = []

    for v, c in zip(V, C):
        if v - c > 0:
            sale_jewels.append(v - c)

    return sum(sale_jewels)

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


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

print(actual(n, V, C))

Submission status: Accepted

Solution code:
import itertools

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 math
def ip():return int(input())
def inp():return map(int,input().split())
def inpstr():return map(str,input().split())
def linp():return list(map(int,input().split()))
def linpstr():return list(map(str,input().split()))

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

Submission status: Accepted

Solution code:
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
N = I()
Vl = LI()
Cl = LI()
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:
import sys
from itertools import accumulate
n = int(sys.stdin.readline())
a = list(map(int,sys.stdin.readline().split()))
b = list(map(int,sys.stdin.readline().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 = 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):
  if v[i]>c[i]:
    ans=ans+v[i]-c[i]
print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    V = map(int, input().split())
    C = map(int, input().split())
    print(sum(max(0, v - c) for v, c in zip(V, C)))


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
m = -10*100
for i in range(2**N):
    tmp = 0
    for j in range(N):
        if (i>>j)&1:
            tmp += V[j]-C[j]
    m = max(tmp, m)

print(m)

Submission status: Accepted

Solution code:
def resolve():
    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)
resolve()

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

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

Submission status: Accepted

Solution code:
import itertools
import decimal
import math
import collections
import sys
input = sys.stdin.readline

N=int(input())

ListV=list(map(int,input().split()))
ListC=list(map(int,input().split()))

ans=0

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

Submission status: Accepted

Solution code:
N = int(input())

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


ans = 0
for 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:
        continue
    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 = map(int, input().split())
c = map(int, input().split())

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

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

for i,j in zip(v,c):
    if i-j >= 0:
        point += i-j

print(point)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))

    res = 0
    for i in range(n):
        diff = V[i] - C[i]
        res += diff if diff > 0 else 0

    print(res)


if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    v=list(map(int,input().split()))
    c=list(map(int,input().split()))
    ans=0
    for x,y in zip(v,c):
        if x-y>0:
         ans+=x-y
    print(ans)
resolve()

Submission status: Accepted

Solution code:
def examA():
    N = I()
    V = LI()
    C = LI()
    ans = 0
    for i in range(N):
        ans += max(0,V[i]-C[i])
    print(ans)
    return

def examB():
    ans = 0
    print(ans)
    return

def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    ans = 0
    print(ans)
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = 10**(-12)
alphabet = [chr(ord('a') + i) for i in range(26)]

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examA()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""

Submission status: Accepted

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

"""
def dec2bin(n):
    amari = [[] for j in range(2**n)]
    for i in range(2**n):
        while i != 0:
            amari[i].append(i%2)
            i = i // 2
        if len(amari[i]) != n:
            while len(amari[i]) < n:
                amari[i].append(0)
        amari[i].reverse()
    return amari
"""
def dec2bin(target):
    amari = []
    while target != 0:
        amari.append(target % 2)
        target = target //2
    if len(amari)!=n:
        while len(amari)<n:
            amari.append(0)
    amari.reverse()
    return amari

b = [[] for i in range(2**n)]
for j in range(2**n):
    b[j] = dec2bin(j)


vc = 0
for i in range(2**n):
    vsum = 0
    csum = 0
    for j in range(n):
        if b[i][j] == 1:
            vsum += v[j]
            csum += c[j]
    if vc <= vsum - csum:
        vc = vsum - csum
print(vc)

Submission status: Accepted

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

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

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

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:
# input
n = int(input())
v = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]

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

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

Submission status: Accepted

Solution code:
# coding = SJIS
n = int(input())
valu = list(map(int, input().split()))
cost = list(map(int, input().split()))
ans = 0
for i in range(n):
    if cost[i] < valu[i]:
        ans += valu[i] - cost[i]
    else:
        ans += 0
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
ab=[a[i]-b[i] if a[i]-b[i]>=0 else 0 for i in range(n)]
print(sum(ab))

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

    ans = 0
    for value, cost in zip(V, C):
        if value - cost > 0:
            ans += value - cost
    print(ans)


resolve()

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

ans = 0

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

Submission status: Accepted

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


def solve(N: int, V: "List[int]", C: "List[int]"):
    return sum(filter(lambda x: x>0, [v-c for v, c in zip(V, C)]), 0)


# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    V = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    C = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    print(solve(N, V, C))

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__':
    #test()
    main()

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):
    difference = Vn[i] - Cn[i]
    if difference > 0:
        ans += difference

print(ans)

Submission status: Accepted

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

B = 0
for i in range(N):
    b = V[i]-C[i]
    if b>=0:
        B = B + b
    else:
        pass

print(B)

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:
#!/usr/bin/env python3
import itertools
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)

ans = np.sum((v-c)*((v-c) >= 0))

print(ans)

Submission status: Accepted

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

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

print(gain)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = int(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()))
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()))
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())
vs=list(map(int,input().split()))
cs=list(map(int,input().split()))
a=0
for v,c in zip(vs,cs):
    m=v-c
    if m>0:
        a+=m
print(a)

Submission status: Accepted

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

ans = 0

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

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
def main():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))
    val = 0
    for i in range(N):
        if V[i]-C[i] >= 0:
            val += V[i]-C[i]
    print(val)

if __name__ == '__main__':
    main()

Submission status: Accepted

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

cost = []
value = []
for i in range(n):
    if v[i] / c[i] > 1:
        cost.append(c[i])
        value.append(v[i])

print(sum(value) - sum(cost))

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 numpy as np
import sys
input = sys.stdin.readline
N = int(input())
V = np.array(list(map(int, input().split())))
C = np.array(list(map(int, input().split())))

#どの宝石を選ぶか全探索
v_c_sum=0
for i in range(N):
    if 0 < V[i] -C[i]:
        v_c_sum +=V[i] - C[i]
print(v_c_sum)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans=0
for x,y in zip(v,c):
    ans+=max(x-y, 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):
    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:
import numpy as np

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

res = v - c
res = res[np.where(res > 0)]

print(res.sum())

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
l=list(map(int,input().split()))
m=list(map(int,input().split()))
def f(x):
	return l[x]-m[x]
print(sum([f(i) for i in range(n) if f(i)>0]))

Submission status: Accepted

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

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

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:
I=lambda:map(int,input().split())
N=int(input())
*V,=I()
*C,=I()
print(sum([x-y for x,y in zip(V,C) if x-y>0]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# input
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]))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

sum = 0

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

print(sum)

Submission status: Accepted

Solution code:
n = int(input())
v = 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:
import sys
input = sys.stdin.readline

N = int(input().rstrip())

V_list = list(map(int, input().rstrip().split()))
C_list = list(map(int, input().rstrip().split()))
ans_V = []
ans_C = []

for i in range(N):
  if V_list[i] > C_list[i]:
    ans_V.append(V_list[i])
    ans_C.append(C_list[i])

print(sum(ans_V) - sum(ans_C))

Submission status: Accepted

Solution code:
from collections import Counter 
from collections import defaultdict
from collections import deque
import math
import itertools
import heapq
import numpy as np
import sys
sys.setrecursionlimit(10**6)

#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
ceil=lambda x,y: (x+y-1)//y
input_list = lambda : list(map(int,input().split()))
import fractions

n=int(input())
a=input_list()
b=input_list()
c=[]
for i in range(n):
    c.append(a[i]-b[i])

c.sort(reverse=True)
ans=0
for i in c:
    if i<0:
        break
    ans+=i

print(ans)

Submission status: Accepted

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

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