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, math
from collections import defaultdict, deque, Counter
from bisect import bisect_left, bisect_right
from itertools import combinations, permutations, product
from heapq import heappush, heappop
from functools import lru_cache
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mat = lambda x, y, v: [[v]*y for _ in range(x)]
ten = lambda x, y, z, v: [mat(y, z, v) for _ in range(x)]
mod = 1000000007
sys.setrecursionlimit(1000000)

N = ri()
V = rl()
C = rl()

def get_score(b):
	X = 0
	Y = 0
	for i, v in enumerate(b):
		if v:
			X += V[i]
			Y += C[i]
	return X-Y
ans = -float('inf')
for b in product([0, 1], repeat=N):
	s = get_score(b)
	ans = max(ans, s)
print(ans)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

vc = []
for i, j in zip(v, c):
    vc.append(i-j)
vc = sorted(vc, reverse=True)
ans = 0
for i in vc:
    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()))
for i in range(n):
    v[i] -= c[i]
print(sum(x for x in v if x > 0))

Submission status: Accepted

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

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

for j in range(N):
    if li[j]>0:
        ans+=li[j]
print(ans)

Submission status: Accepted

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

for i in range(n):
    total_list.append(v_list[i]-c_list[i])
    
total_list.sort(reverse=True)
#print(total_list)

sum=0
for i in total_list:
    if i>0:
        sum+=i
    else:
        break
    
print(sum)

Submission status: Accepted

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

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=0
  for j in range(N):
    if (i>>j)&1:
      X+=(V[j]-C[j])
  ans=max(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(2**n):
    value = 0
    cost = 0
    for j in range(n):
        if ((i >> j) & 1):
            value += v[j]
            cost += c[j]
        ans = max(ans, value - cost)

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

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):
  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()))
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:
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:
        ans += v-c

print(ans)

Submission status: Accepted

Solution code:
import numpy


N = int(input().strip())

V_array = []
C_array = []

V_array =[int(x) for x in input().split()]
C_array =[int(x) for x in input().split()]

ans = 0
for j in range(N):
    ans += V_array[j] - C_array[j] if V_array[j] > C_array[j] else 0


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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    v_list = list(map(int, input().split()))
    c_list = list(map(int, input().split()))
    ans = 0

    for i in range(n):
        if v_list[i] > c_list[i]:
            ans += v_list[i] - c_list[i]

    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N = int(readline())
    V = list(map(int, readline().split()))
    C = list(map(int, readline().split()))

    ans = 0

    for x, y in zip(V, C):
        if x - y >= 0:
            ans += x - y

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

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

ans=0
for i in range(n):
  if V[i]>0:
    ans+=V[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:
#a, b, k = map(int, input().split( ))
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:
# coding: utf-8

num = int(input())
str1 = input().split()
str2 = input().split()
str3 = []
for i in range(num):
    str3.append(int(str1[i]) - int(str2[i]))

total = 0
count = 0
for i in range(num):
    if str3[i] > 0:
        total += str3[i]
        count += 1
if count == 0:
    print(0)
else:
    print(total)

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = [int(s) for s in input().split()]
c = [int(s) for s 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 = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
vc = 0

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

print(vc)

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

Submission status: Accepted

Solution code:
# coding: UTF-8
import sys
import numpy as np


n = int(input())
vList = list(map(int, input().split()))
cList = list(map(int, input().split()))
ans = 0
for v, c in zip(vList, cList):
	ans += max(v - c, 0)
print(ans)

Submission status: Accepted

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


ans = 0
for i in l:
    if i>0:
        ans+=i
print(ans)

Submission status: Accepted

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

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


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

x=0
for i in range(2**n):
    cost=0
    value=0
    for j in range(n):
        if i>>j&1:
            cost+=c[j]
            value+=v[j]
    else:
        if value-cost>x:
            x=value-cost
            


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

print(ans)

Submission status: Accepted

Solution code:
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    V = list(map(int, readline().split()))
    C = list(map(int, readline().split()))

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

    print(ans)
    return


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):
    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())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

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

Submission status: Accepted

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

Submission status: Accepted

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

profit_max = 0
for i in range(2 ** n):
    value = 0
    cost = 0
    for j in range(n):
        if (i >> j) & 1:
            value += v[j]
            cost += c[j]
    profit_max = max(profit_max, value - cost)
print(profit_max)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

import sys
import math
from bisect import bisect_right as br
from bisect import bisect_left as bl
sys.setrecursionlimit(2147483647)
from heapq import heappush, heappop,heappushpop
from collections import defaultdict
from itertools import accumulate
from collections import Counter
from collections import deque
from operator import itemgetter
from itertools import permutations
mod = 10**9 + 7
inf = float('inf')
def I(): return int(sys.stdin.readline())
def LI(): return list(map(int,sys.stdin.readline().split()))

n = I()
v = LI()
c = LI()
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()))
xy = 0
for i in range(1,n+1):
    for h in itertools.combinations(range(0,n),i):
        x = 0
        y = 0
        for j in h:
            x += v[j]
            y += c[j]
        if xy < x-y:
            xy = x-y
print(xy)

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]:
        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()))
D=[]
a=0
for i in range(len(C)):
    D.append(V[i]-C[i])
for i in range(len(D)):
    if D[i]>=1:
        a+=D[i]
print(a)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()
    V = LI()
    C = LI()
    
    ans = sum([V[i] - C[i] for i in range(N) if V[i] - C[i] > 0])
    print(ans)

if __name__ == '__main__':
    resolve()

Submission status: Accepted

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

Submission status: Accepted

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

solve()

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

print(m)

Submission status: Accepted

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

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

print(a)

Submission status: Accepted

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

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()))
t=[]
ans=0
for i in range(n):
    t.append(v[i]-c[i])
    if t[i]>0:
        ans+=t[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:
#!/usr/bin/env python3

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

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

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

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

Submission status: Accepted

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

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(N):
    if values[i] - costs[i] > 0:
        ans += (values[i] - costs[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()))

val = 0
ans = 0

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

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))
vc = [0]*n
for i in range(n):
    vc[i] = v[i] - c[i]
vc2 = sorted(vc)
import bisect
print(sum(vc2[bisect.bisect_left(vc2,0):]))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(lambda v: int(v), input().split(" ")))
C = list(map(lambda c: int(c), input().split(" ")))
s = 0
for i in range(N):
  d = V[i] - C[i]
  s += max([d,0])

print(s)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
x = 0
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 = 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] > 0:
        x += v[i]
        y += c[i]
print(x-y)

Submission status: Accepted

Solution code:
import sys
lines = [s.rstrip("\n") for s in sys.stdin.readlines()]
n = int(lines.pop(0))
v_list = [int(num) for num in lines.pop(0).split(" ")]
c_list = [int(num) for num in lines.pop(0).split(" ")]
ans = 0
for v, c in zip(v_list, c_list):
    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]:
        ans += V[i] - C[i]
print(ans)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import numpy as np

stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


n = ni()
V = np.array(nl())
C = np.array(nl())
T = V - C
ans = 0
for t in T:
    if t > 0:
        ans += t
print(ans)

Submission status: Accepted

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

t_v = []
t_c = []
for v, c in zip(l_v, l_c):
  if v > c:
    t_v.append(v)
    t_c.append(c)
    
print(sum(t_v) - sum(t_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]:
    ans += v[i]-c[i]
print(ans)

Submission status: Accepted

Solution code:
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]

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

Submission status: Accepted

Solution code:
#https://atcoder.jp/contests/abc125/tasks/abc125_b
N = int(input())
X_List = list(map(int,input().split()))
Y_List = list(map(int,input().split()))
XY_List = [X_List[i]-Y_List[i] for i in range(N)]
print(sum(list(map(lambda x:x if x>= 0 else 0,XY_List))))

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

print(sum(x))

Submission status: Accepted

Solution code:
N = int(input())
MM = input().split()
LL = input().split()
total = 0
for i,j in zip(MM,LL):
  if int(i) > int(j):
    total += int(i) -int(j)
print(total)

Submission status: Accepted

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

value = 0
for i in range(len(V)):
    if V[i]-C[i]>0:
        value += (V[i]-C[i])
    else:
        continue

print(value)

Submission status: Accepted

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

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

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

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

print(ans)

Submission status: Accepted

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

netV=sorted(netV,reverse=True)

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

print(SUM)