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 numpy as np

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

sum_li = v-c
print(sum(sum_li[sum_li > 0]))

Submission status: Accepted

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

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

Submission status: Accepted

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

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):
  X = V[i] - C[i]
  if X >= 0:
    cost.append(X)

print(sum(cost))

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(answer)

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

Submission status: Accepted

Solution code:
_ = input()
liv = list(map(int,input().split()))
lic = list(map(int,input().split()))
ans = 0
for i,j in zip(liv,lic):
  if i-j > 0:
    ans += i-j
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
vlt = input().split()
clt = input().split()

for i in range(0, len(vlt)):
    vlt[i] = int(vlt[i])
for i in range(0, len(clt)):
    clt[i] = int(clt[i])

sum_v = 0
sum_cost = 0
for i in range(0, len(vlt)):
    if vlt[i] > clt[i]:
        sum_v += vlt[i]
        sum_cost += clt[i]

print(sum_v - sum_cost)

Submission status: Accepted

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

Submission status: Accepted

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

print(output)

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(max(ans,0))

Submission status: Accepted

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

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:
n1 = int(input())
nl1 = [int(i1) for i1 in input().split()]
nl2 = [int(i2) for i2 in input().split()]

s1 = 0
for i3 in range(n1):
    if nl1[i3] - nl2[i3] >= 0:
        s1 += nl1[i3] - nl2[i3] 

print(str(s1))

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 = X + V[i]-C[i]
print(X)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding: utf-8

N = input()
v = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
vc = [_v - _c for _v, _c in zip(v, c)]
s = sum([_vc for _vc in vc if _vc > 0])
print(s)

Submission status: Accepted

Solution code:
# coding: utf-8

N = input()
vc = [_v - _c for _v, _c in zip([int(i) for i in input().split()], [int(i) for i in input().split()])]
s = sum([_vc for _vc in vc if _vc > 0])
print(s)

Submission status: Accepted

Solution code:
# coding: utf-8

N = input()
v = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
vc = [_v - _c for _v, _c in zip(v, c)]

sum = 0
for _vc in vc:
    if _vc >0:
        sum += _vc
print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

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

import numpy as np
A = np.array(V) - np.array(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()))
B = list(map(lambda x,y:0 if 0>x-y else x-y ,V,C))
print(sum(B))

Submission status: Accepted

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

sum = 0
for i in range(N):
    if(V[i]-C[i] > 0):
        sum += 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):
    z=v[i]-c[i]
    if z>0:
        sum+=z
print(sum)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
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())
LV=list(map(int,input().split()))
LC=list(map(int,input().split()))
Lbenefit=[]
ans=0

for i in range(N):
    Lbenefit.append(LV[i]-LC[i])
Lbenefit.sort(reverse=True)

for b in Lbenefit:
    if b>=0:
        ans+=b
    else:
        break

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

added_value = 0
for vi, ci in zip(v, c):
    if vi - ci > 0:
        added_value += vi - ci

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(total)

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:
from sys import stdin


# f = open("./17/input_b1.txt")


# def input():
#     return f.readline().rstrip()


def main():
    N = int(input())
    C = [int(x) for x in stdin.readline().split()]
    V = [int(x) for x in stdin.readline().split()]

    sum_ = [C[x]-V[x] for x in range(N) if C[x]-V[x] > 0]
    print(sum(sum_))


if __name__ == "__main__":
    main()

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):
        ans += max(V[i]-C[i], 0)
    print(ans)
if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=input()

a=map(int,raw_input().split())
b=map(int,raw_input().split())

count=0
for i in range(n):
    if a[i] > b[i]:
        count+=a[i]-b[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 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()]

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

print(res)

Submission status: Accepted

Solution code:
number = int(input())
value = list(map(int,input().split()))
cost = list(map(int,input().split()))
result=0

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

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 += max(0, v - c)
print(ans)

Submission status: Accepted

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

counter = 0
for n in range(N):
    dif = V[n] - C[n]
    if dif > 0:
        counter += dif
print(counter)

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

def wa_only_pos(list):
    a = 0
    for i in range(n):
        if list[i] > 0:
            a = a+list[i]
    return a

v_in = input().split()
v = []
for i in range(n):
    v.append(int(v_in[i]))

c_in = input().split()
c = []
for i in range(n):
    c.append(int(c_in[i]))

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

print(wa_only_pos(sub))

Submission status: Accepted

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

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

Submission status: Accepted

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

max = 0

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

print(max)

Submission status: Accepted

Solution code:
import sys

N=input()
if N.isdecimal() == 0 or int(N)<1 or int(N)>20 :
    print("error")
    sys.exit()

N=int(N)

V=list(map(int,input().strip().split()))
C=list(map(int,input().strip().split()))
# print(V[0],V[1],V[2])                                                                              

for i in range(N):
    if C[i]<1 or C[i]>50 or V[i]<1 or V[i]>50:
        print("error")
        sys.exit()

diff=0
max_profit=0



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

print(max_profit)

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:
import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''

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())
l=[[int(j) for j in input().split()] for i in range(2)]
a=0
for i in range(n):
    if l[0][i]>l[1][i]:
        a+=l[0][i]-l[1][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] > 0 :
        ans += V[i] - C[i]

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
value = list(map(int, input().split()))
cost = list(map(int, input().split()))
tmp = 0

for i in range(len(value)):
    profit = value[i] - cost[i]
    if profit > 0:
        tmp += profit

print(tmp)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Thu May 30 18:10:37 2019

@author: またの
"""

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 = input()
v = input().split()
c = input().split()

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = input()
n = int(n)

total = 0

lst_a = input().split()
lst_b = input().split()

for i in range(n):
    a = int(lst_a[i])
    b = int(lst_b[i])
    if a > b:
        total += (a - b)

print(total)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
X = [max(V, C) for V, C in zip(V, C) if V > C]
Y = [min(V, C) for V, C in zip(V, C) if V > C]
print(sum(X) - sum(Y))

Submission status: Accepted

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

sum = 0

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

print(sum)

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 = [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:
def solve(v_list, c_list):
    ans = 0
    for key, value in enumerate(v_list):
        if value > c_list[key]:
            ans += value - c_list[key]
        continue
    return ans


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

    ans = solve(v_list, c_list)
    print(ans)


main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
ans = 0
         
for i in range(N):
         ans += max(X[i] - Y[i], 0)

print(ans)

Submission status: Accepted

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

diff = [v-c if (v-c > 0) else 0 for v, c in zip(V, C)]
print(sum(diff))

Submission status: Accepted

Solution code:
n=input().split('\n')
N=int(n[0])
A=input().split('\n')
A=A[0].split()
B=input().split('\n')
B=B[0].split()
answer=0
for i in range(0,N):
  if int(A[i])>int(B[i]):
    answer=answer+int(A[i])-int(B[i])
print(answer)

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())))
gap = V - C
max_gap = 0
for one in gap:
    if one > 0:
        max_gap += one
print(max_gap)

Submission status: Accepted

Solution code:
n=int(input())
l=[]
l2=[]
for i in range(2):
  l.append(input().split())
for i in range(n):
  l2.append(int(l[0][i])-int(l[1][i]))
t=0
for i in l2:
  if i>0:
    t=t+i
print(t)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(s)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(s)

Submission status: Accepted

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

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

print(s)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
	
v_list = [ int(v) for v in input().split() ]
c_list = [ int(v) for v in input().split() ]
	
ans = sum([ max( 0, (v_list[i]-c_list[i]) ) for i in range(n) ])

print(ans)

Submission status: Accepted

Solution code:
N=int(input())
A=list(map(int, input().split()))
B=list(map(int, input().split()))
C = []
for i in range(N):
    C.append(A[i]-B[i])

C.sort(reverse=True)

summed = 0
for i in C:
    if i > 0:
        summed += i
print(summed)

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())  #数値入力 「N」だけの入力のとき
# a,b=map(int, input().split())  #複数数値入力　「A B」みたいなスペース空いた入力のとき
# c=list(map(int, input().split()))  #リスト入力 「a1 a2 a3 ...」みたいな配列のような入力のとき
# s=[list(map(int,list(input()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# a=100
# b=0.987654321
# print('{0:06d}-{1:6f}'.format(a,b))  # 0埋めのときの出力
# 000100-0.987654

import numpy as np
import math
import copy

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

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

print(s)

Submission status: Accepted

Solution code:
jewel = int(input())
value = [int(i) for i in input().split()]
cost = [int(i) for i in input().split()]
diff = [i-j for i,j in zip(value, cost)]
price = 0
for i in sorted(diff):
    if i>0:
        price += i

print(price)

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

Submission status: Accepted

Solution code:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
num=0
for i in range(N):

    sum=V[i]-C[i]
    if sum>0:
        num+=sum


print(num)

Submission status: Accepted

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

gap = []
if C ==0:
    print(0)
for i, c in enumerate(C):
    for j, v in enumerate(V):
        if i == j:
            if v-c>=0:
                gap.append(v - c)
sum = 0
for v in gap:
    sum += v
print(sum)

Submission status: Accepted

Solution code:
N =int(input())
V =[int(i) for i in input().split()]
C =[int(i) for i in input().split()]
W =[max(V[i]-C[i],0) for i in range(N)]
print(sum(W))

Submission status: Accepted

Solution code:
n = int(input())
val = []
for i in map(int, input().split()):
    val.append(i)
cost = []
for i in map(int, input().split()):
    cost.append(i)

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

print(ans)

Submission status: Accepted

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

for i in cost:
    if i > 0:
        ans += i

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

max = 0

for i in range(N):
    x = v[i] - c[i]
    if 0 < x:
        max += x

print(max)

Submission status: Accepted

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

Submission status: Accepted

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

if __name__ == '__main__':
    n = int(input())
    v = list(map(int, input().split()))
    c = list(map(int, input().split()))
    
    ans = 0
    for x, y in zip(v, c):
        tmp = x - y
        if tmp > 0:
            ans += tmp

    print(ans)

Submission status: Accepted

Solution code:
n = int(input())
lisa = list(map(int, input().split()))
lisb = list(map(int, input().split()))
lisc = []
total = 0
for i in range(n):
    lisc.append(lisa[i] - lisb[i])
for j in lisc:
    if j > 0:
        total += j
print(total)

Submission status: Accepted

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

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

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

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

print(sum(anslist))

Submission status: Accepted

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

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

dif.sort()

mx=0
for val in dif:
	if val>=0:
		mx+=val

print(mx)

Submission status: Accepted

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

sum = 0

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

Submission status: Accepted

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

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

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 vv, cc in zip(V, C):
    if vv > cc:
        ans += (vv - cc)

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 val,cost in zip(v,c) :
	res += (val-cost) if val > cost else 0
print(res)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n=int(input())
v=input().split(" ")
c=input().split(" ")
v=[int(i) for i in v]
c=[int(j) for j in c]
count=0
for i in range(n):
  if v[i]-c[i]>=0:
    count=count+v[i]-c[i]
print(count)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

value = list(map(int,input().split()))
cost = list(map(int,input().split()))

revenue = 0

for i in range(n):
    if value[i]>cost[i]:
        revenue = revenue + value[i] - cost[i]

print(revenue)

Submission status: Accepted

Solution code:

n = input()
n = int(n)

total = 0

lst_a = input().split()
lst_b = input().split()

for i in range(0, n ,1):
    a = lst_a[i]
    b = lst_b[i]
    a = int(a)
    b = int(b)
    if a > b:
        total += (a - b)

print(total)

Submission status: Accepted

Solution code:
N = input()
jewelrys = int(N)
value = input().split()
cost = input().split()
maxsum = 0
i = 0

for i in range(0, jewelrys):
    value[i] = int(value[i])
    cost[i] = int(cost[i])
    if(value[i] > cost[i]):
        maxsum += (value[i] - cost[i])

print(maxsum)

Submission status: Accepted

Solution code:
n = int(input())
in_val = input().split()
in_cos = input().split()

lis_val = [int(s) for s in in_val]
lis_cos = [int(s) for s in in_cos]

sum_vc = 0
for i in range(n):
    if lis_val[i] > lis_cos[i]:
        sum_vc += lis_val[i] - lis_cos[i]
    else:
        continue

print(sum_vc)

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]):
        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()))
P = []
for i in range(N):
    p = V[i]-C[i]
    if p >0:
    	P.append(p)

print(sum(P))

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-

N = int(input())
value = list(map(int, input().split()))
cost = list(map(int, input().split()))
ans=0

for i in range(N):
    if value[i]-cost[i] > 0:
        ans += value[i]-cost[i]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))
    
    #差分
    sa = [ V[i] - C[i] if V[i] - C[i] > 0 else 0 for i in range(N) ]
    
    #昇順
    sa.sort()
    
    print(sum(sa))
    
if __name__ == '__main__':
    main()

Submission status: Accepted

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

print(XY)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)