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()))
jewelry = []
for i in range(n):
    if v[i] < c[i]:
        jewelry.append(0)
    else:
        cost = v[i] - c[i]
        jewelry.append(cost)
print(sum(jewelry))

Submission status: Accepted

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

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:
# def dfs(now,val,cost):
#     if now == n:
#         return val - cost
#     else:
#         return max(dfs(now+1,val+v[now],cost+c[now]),dfs(now+1,val,cost))

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

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

Submission status: Accepted

Solution code:
def dfs(now,val,cost):
    if now == n:
        return val - cost
    else:
        return max(dfs(now+1,val+v[now],cost+c[now]),dfs(now+1,val,cost))

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

print(dfs(0,0,0))

Submission status: Accepted

Solution code:
a = int(input())
value = list(map(int, input().split()[:a]))
cost = list(map(int, input().split()[:a]))
l = []
for v, c in zip(value, cost):
    if v - c > 0:
        l.append(v -c)
res = 0
for item in l:
    if item > 0:
        res += item
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())
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()))
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:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
cost=0 

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

Submission status: Accepted

Solution code:
#import numpy

N = int(input())

C = [int(i) for i in input().split()] 
V = [int(i) for i in input().split()]

ans = []
for i in range(N):
	if(C[i]-V[i]>0):
		ans.append(C[i]-V[i])
		ans.sort(reverse=True)

#x = numpy.prod(ans)
print(sum(ans))

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    gems = [int(x) for x in input().split()]
    cost = [int(x) for x in input().split()]
    res = []
    for i in range(n):
        res.append(gems[i] - cost[i])
    soma_n = sum([x if x > 0 else 0 for x in res])
    print(soma_n)
main()

Submission status: Accepted

Solution code:
X = int(input())

if X > 1:
    line = input()
    v_inputs = [int(n) for n in line.split()]

    line = input()
    numbers = [int(n) for n in line.split()]
else:
    v_inputs = [int(input())]
    numbers = [int(input())]

cost_values = [
                gem_value - gem_cost
                for gem_value, gem_cost in zip(v_inputs, numbers)]
predicted_value = 0
for cost_value in cost_values:
    if cost_value > 0:
        predicted_value += cost_value

print(predicted_value)

Submission status: Accepted

Solution code:
N = int(input())
line1 = [int(n) for n in input().split()]
line2 = [int(n) for n in input().split()]
u = []
res = 0
for i in range(N):
    u.append(line1[i]-line2[i])
for i in range(N):
    if u[i]>0:
        res += u[i]
print(res)

Submission status: Accepted

Solution code:
N = int(input())
line = input()
V = [int(n) for n in line.split()]
line = input()
C = [int(n) for n in line.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())

vs = []
vs = [int(x) for x in input().split()]
cs = [int(x) for x in input().split()]


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

print(ans)

Submission status: Accepted

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

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(y) for y in input().split()]

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

print(sum(new))

Submission status: Accepted

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

V_C = [0]*N

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

print(sum(V_C))

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

Submission status: Accepted

Solution code:
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

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

print(total)

Submission status: Accepted

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

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N = ir()
V = np.array(lr())
C = np.array(lr())
V -= C
V = V[V>0]
answer = V.sum()
print(answer)

Submission status: Accepted

Solution code:
N = int(input())

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

ans = 0
for i in range(N):
    if V[i] > C[i]:
        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, s in zip(V, C):
    ans += max(0, v-s)
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()))
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=[int(i) for i in input().split()]
C=[int(t) for t in input().split()]
count=0
for s in range(N):
    if V[s]>C[s]:
        count+=V[s]-C[s]
print(count)

Submission status: Accepted

Solution code:
import math
import collections
import sys

input = sys.stdin.readline
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]

n=I()
V=LI()
C=LI()
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())
vli = list(map(int,input().split()))
cli = list(map(int,input().split()))
total = 0
for i in range(n):
    if vli[i] >= cli[i]:
        total += vli[i] - cli[i]
print(total)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np
N=int(input())
X=list(map(int, input().split()))
Y=list(map(int, input().split()))
Z=np.zeros(N)
for i in range(N):
  Z[i]=X[i]-Y[i]
print('{:.0f}'.format(sum(Z[np.where(Z>0)])))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,*A,=map(int,open(0).read().split());print(sum((x-y)*(x>y)for x,y in zip(A[:N],A[N:])))

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:
#!/usr/bin/env python3
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=[int(_) for _ in input().split()]
C=[int(_) for _ in input().split()]
X_Y=[x-y for x,y in zip(V,C) if x-y>0]
print(sum(X_Y))

Submission status: Accepted

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

ans = 0
for i in range(N):
    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())) 

import numpy as np
V = np.array(V)
C = np.array(C)

a = V - C

ans = a[a>0].sum()

print(ans)

Submission status: Accepted

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

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 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 = map(int,input().split())
c = map(int,input().split())
print(sum(i-j for i,j in zip(v,c) if i-j>0))

Submission status: Accepted

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

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):
    ans += max(0 ,i-j)
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
value_list =input().split()
cost_list = input().split()
ans = 0
for i in range(a):
    if int(value_list[i]) - int(cost_list[i]) > 0:
        ans += int(value_list[i]) - int(cost_list[i])
        
print(ans)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
n = int(input()) # 入力が1つ
# map(int, input().split()) # 入力が複数
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] > 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]:
    sum=sum+V[i]-C[i]

print(sum)

Submission status: Accepted

Solution code:
N = int(input())
V = [int(num) for num in input().split()]
C = [int(num) for num in input().split()]
value = 0
for i in range(N):
  if V[i] > C[i]:
    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()))

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:
n, *d = map(int, open(0).read().split())
print(sum([max(d[i] - d[i+n], 0) for i in range(n)]))

Submission status: Accepted

Solution code:
# python 3.4.3
import sys
input = sys.stdin.readline

# -------------------------------------------------------------
# library
# -------------------------------------------------------------



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

Submission status: Accepted

Solution code:
#B
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())
x=list(map(int,input().split()))
y=list(map(int,input().split()))
print(sum([max(0,xx-yy) for xx,yy in zip(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]:
        x += v[i]
        y += c[i]

print(x - y)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))
import numpy as np
def main():
    N = int(input())
    V = np.array(input_nums())
    C = np.array(input_nums())
    D = V - C
    D = D[D>0]
    print(np.sum(D))



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

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
XY = [v - c for v, c in zip(V, C) if v - c >= 0]

ans = sum(XY)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
XY = [v - c for v, c in zip(V, C)]

ans = 0
for xy in XY:
    if xy > 0:
        ans += xy

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:
#
# Written by NoKnowledgeGG @YlePhan
# ('ω')
#
#import math
#mod = 10**9+7
#import itertools
#import fractions
#import numpy as np
#mod = 10**4 + 7
"""def kiri(n,m):
  r_ = n / m
  if (r_ - (n // m)) > 0:
    return (n//m) + 1
  else:
    return (n//m)"""
 
def main():
  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]=max(0,v[i]-c[i])
  print(sum(x))
if __name__ == '__main__':
  main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys


sys.setrecursionlimit(2**30)


def solve(i, x, y):
    global max_sub
    if i == N:
        max_sub = max(max_sub, x-y)
    else:
        solve(i+1, x+V[i], y+C[i])
        solve(i+1, x, y)


N = int(input())
V = [int(v) for v in input().split()]
C = [int(c) for c in input().split()]
max_sub = 0
solve(0, 0, 0)
print(max_sub)

Submission status: Accepted

Solution code:
N = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))

a = 0
for i in range(N):
  if y[i] < x[i]:
    a = a+(x[i]-y[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]*n
for i in range(n):
  x[i]=max(0,v[i]-c[i])
print(sum(x))

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

Submission status: Accepted

Solution code:
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque
from decimal import *


def lcm(x, y):
    return (x * y) // math.gcd(x, y)


if __name__ == '__main__':
    n =int(input())
    a = [int(i) for i in input().split()]
    b = [int(i) for i in input().split()]
    sum = 0
    for i in range(n):
        c = a[i]-b[i]
        if c > 0:
            sum+=c


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

Submission status: Accepted

Solution code:
import numpy as np
n = int(input())
v = np.array([int(x) for x in input().split()])
c = np.array([int(x) for x in input().split()])
ans = v - c
s = 0
for i in range(n):
	if ans[i] > 0:
		s += ans[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]:
    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]):
        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()))

v_c = []

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

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
c = list(map(int, input().split()))
dp = [0 for i in range(n+1)] # iまで選んだ時の純利益の最大
for i in range(n):
    dp[i+1] = max(dp[i], dp[i]+a[i]-c[i])
print(dp[n])

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
import sys
input = lambda: sys.stdin.readline().rstrip()

N = int(input())

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

V_minus_C = []

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

V_minus_C.sort(reverse=True)

ans = 0
for i in range(len(V_minus_C)):
    if V_minus_C[i] > 0:
        ans += V_minus_C[i]

print(ans)

Submission status: Accepted

Solution code:
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n=INT()
    v=LIST()
    c=LIST()
    ct=0
    for i in range(n):
        if v[i]-c[i]>=0:
            ct+=v[i]-c[i]
    print(ct)
if __name__ == '__main__':
    do()

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

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))
n = ii()
v = iil()
c = iil()
cal = zip(v,c)
ans = 0
for i in cal:
    ans += max(0,i[0]-i[1])
print(ans)

Submission status: Accepted

Solution code:

import math
import itertools
import statistics
#import collections

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

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

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

print(total)

Submission status: Accepted

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

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

print(sa)

Submission status: Accepted

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

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

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

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

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 = [V[i] - C[i] for i in range(N) if 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()))
res = [i-j for i,j in zip(v,c)]
cnt = 0
for i in res:
  if i > 0:
    cnt += i
print(0 if cnt <= 0 else cnt)

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 0

for i in range(N):
  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 v, c in zip(V, C):
        ans += max(0, v-c)
    print(ans)
    return 0


if __name__ == '__main__':
    main()

Submission status: Accepted

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

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

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

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

vc = sorted(vc, reverse=True)
ans = 0
for i in range(n):
    if vc[i]>0:
        ans += vc[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 sys
from bisect import *
from heapq import *
from collections import *
from itertools import *
from functools import *
from math import *

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

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()))
maxvalue = 0
VmC = [V[a]-C[a] for a in range(N)]

for i in range(N):
    if VmC[i] < 0 :
        VmC[i] = 0
    
    maxvalue += VmC[i]
    
print(maxvalue)

Submission status: Accepted

Solution code:
# from math import factorial,sqrt
# from itertools import permutations as permus
# from fractions import gcd
# from collections import deque,Counter
# from decimal import Decimal, getcontext
# # getcontext().prec = 1000
# # eps = Decimal(10) ** (-100)

import numpy as np
# import scipy as scp

# 入力の受け取り
n = int(input())
# 配列入力の受け取り
arrV = np.array(input().split(),dtype=np.int64)
arrC = np.array(input().split(),dtype=np.int64)

arrA = arrV - arrC

filter = arrA > 0
ans = sum(arrA[filter])

print(ans)
# print("{:.10f}".format(ans))
# print(*ans)   # unpackして出力。間にスペースが入る
# for row in board:
#     print(*row,sep="")    #unpackして間にスペース入れずに出力する

Submission status: Accepted

Solution code:
n = int(input())
vv = list(map(int, input().split()))
cc = list(map(int, input().split()))

z = 0
for i in range(n):
    if vv[i] > cc[i]:
        z += vv[i] - cc[i]
print(z)

Submission status: Accepted

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

cost = []

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

print(sum(cost))

Submission status: Accepted

Solution code:
n = int(input())
v_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))
print(sum([max(v - c, 0) for v, c in zip(v_list, c_list)]))

Submission status: Accepted

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

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

Submission status: Accepted

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