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

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

print(ans)

Submission status: Accepted

Solution code:
####################################### ###############          #   #      
######################################## ################     ##            
################ #####################  # ##################     #          
#################  ################## #    #######   ##########      #      
################### ################  #   #######  #      ####  ####        
############# ## #    #########        # #        ## ###                    
##############    #     ###           # ###    #  ##  ########              
###### ########                        #########  #   ########   ###        
##  ###  ####     #####                  #######       ## ####  #    #      
##      #   ########### #                 ####         #  ###           #   
##       #####    #                                  #    ##               #
##     ########                                    ##    #                  
##     ##############                      #          #                     
####  ###############                                      #                
#####       #####                                          #                
#######                                    ###                              
##########                          #  ########                             
######### #  #                  ###############         #                   
############                  #################        #                    
###############                ###############       #                      
#    ###########                 ##########                                 
#################                                                           
################# ##                           #                            

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

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

print(ans)

Submission status: Accepted

Solution code:
###########################################################     #####            
############################################ ###############          #   #      
############################################# ################     ##            
##################### #####################  # ##################     #          
######################  ################## #    #######   ##########      #      
######################## ################  #   #######  #      ####  ####        
################## ## #    #########        # #        ## ###                    
###################    #     ###           # ###    #  ##  ########              
########### ########                        #########  #   ########   ###        
#######  ###  ####     #####                  #######       ## ####  #    #      
#######      #   ########### #                 ####         #  ###           #   
#######       #####    #                                  #    ##               #
#######     ########                                    ##    #                  
#######     ##############                      #          #                     
#########  ###############                                      #                


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

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

print(ans)

Submission status: Accepted

Solution code:
# ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■          ■   ■
# ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■     ■■
# ■■■■■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■■■■■■  ■ ■■■■■■■■■■■■■■■■■■     ■
# ■■■■■■■■■■■■■■■■■■■■■  ■■■■■■■■■■■■■■■■■■ ■    ■■■■■■■   ■■■■■■■■■■      ■
# ■■■■■■■■■■■■■■■■■■■■■■■ ■■■■■■■■■■■■■■■■  ■   ■■■■■■■  ■      ■■■■  ■■■■
# ■■■■■■■■■■■■■■■■■ ■■ ■    ■■■■■■■■■        ■ ■        ■■ ■■■
# ■■■■■■■■■■■■■■■■■■    ■     ■■■           ■ ■■■    ■  ■■  ■■■■■■■■
# ■■■■■■■■■■ ■■■■■■■■                        ■■■■■■■■■  ■   ■■■■■■■■   ■■■
# ■■■■■■  ■■■  ■■■■     ■■■■■                  ■■■■■■■       ■■ ■■■■  ■    ■
# ■■■■■■      ■   ■■■■■■■■■■■ ■                 ■■■■         ■  ■■■           ■
# ■■■■■■       ■■■■■    ■                                  ■    ■■
# ■■■■■■     ■■■■■■■■                                    ■■    ■
# ■■■■■■     ■■■■■■■■■■■■■■                      ■          ■
# ■■■■■■■■  ■■■■■■■■■■■■■■■                                      ■
# ■■■■■■■■■       ■■■■■                                          ■

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

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
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())
Vs=[int(i) for i in input().split()]
Cs=[int(i) for i in input().split()]

max=0
for i in range(N):
    if Vs[i]-Cs[i]>0:
        max += Vs[i]-Cs[i]
print(max)

Submission status: Accepted

Solution code:
N = int(input())
Values = list(map(int, input().split()))
Costs = list(map(int, input().split()))
value = 0

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

print(value)

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()))  # -> li = [1,2,3,...n]
c = list(map(int, input().split()))  # -> li = [1,2,3,...n]
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(N) for N in input().split()] 
C = [int(N) for N 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(v) for v in input().split(' ')]
C = [int(c) for c in input().split(' ')]

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

print(diff)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
num = int(input())
ls_value = [ int(x) for x in input().split(' ') ]
ls_cost = [ int(y) for y in input().split(' ') ]
profit = 0
for x, y in zip(ls_value, ls_cost):
    if (x - y) > 0:
        profit += (x - y)

print(profit)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
size=input()
size=int(size)
A=input().split()
B=input().split()
count=0
for i in range(0,size):
    if (int(A[i])-int(B[i])>0):
        count+=int(A[i])-int(B[i])

print(count)

Submission status: Accepted

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

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:
l = int(input())
vals = list(map(int, input().split(" ")))
costs = list(map(int, input().split(" ")))

diffs = []

for i in range(0, l):
    diffs.append(vals[i] - costs[i])

tmp = list(filter(lambda x: x > 0,   diffs))
print(sum(tmp))

Submission status: Accepted

Solution code:
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:
#!/bin/env python
  

if __name__=='__main__':
  val_n = input()
  list_v = list(map(int,input().split()))
  list_c = list(map(int,input().split()))

  answer = 0
  for i in range(len(list_v)):
    if(list_v[i] - list_c[i] > 0):
      answer += list_v[i] - list_c[i]
  print(answer)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(sum)

Submission status: Accepted

Solution code:
# coding: utf-8
n = int(input())
values = list(map(int, input().split()))
costs = list(map(int, input().split()))

res = 0

for i in range(n):
    diff = values[i] - costs[i]
    if diff > 0:
        res += diff

print(res)

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

Submission status: Accepted

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

V = list(V)
C = list(C)

d = 0
p = 0

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

print(d)

Submission status: Accepted

Solution code:
n = int(input())
def input_def(n_num=2):
    input_val = []
    for i in range(n_num):
        input_val.append([i for i in map(int,input().split())])
    return input_val


para_val = input_def()
diff_val = 0
for i in range(n):
    a = para_val[0][i]-para_val[1][i]
    if a>= 0 :
        diff_val += a


print(diff_val)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
vlist = list(map(int, input().split()))
clist = list(map(int, input().split()))

difflist = [v - c for v, c in zip(vlist, clist)]

otpt = 0
for diff in difflist:
  if diff > 0:
    otpt += diff
    
print(otpt)

Submission status: Accepted

Solution code:
a = int(input())
ar = list(map(int,input().split(" ")))
br = list(map(int,input().split(" ")))
cr = []
for i in range(a):
    if ar[i] - br[i] > 0:
        cr.append(ar[i]-br[i])
print(sum(cr))

Submission status: Accepted

Solution code:
a=input()
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
d=e=0
for i in range(len(b)):
    if b[i]>c[i]:
        d+=b[i]
        e+=c[i]
print(d-e)

Submission status: Accepted

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

N = int(input())
vs = [int(e) for e in input().strip().split()]
cs = [int(e) for e in input().strip().split()]

profit = 0
for i in range(N):
    if vs[i] > cs[i]:
        profit += (vs[i] - cs[i])

print(profit)

Submission status: Accepted

Solution code:
# Vi > Ciのとき、Vi-Ciを全部足す

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

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

Submission status: Accepted

Solution code:
import sys

str_input = input()
n = int(str_input)

str_input = input()
v = []
for value in str_input.split():
    v.append(int(value))

str_input = input()
c = []
for value in str_input.split():
    c.append(int(value))

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

def main():
    N = int(input())
    v = list(map(int, input().split()))
    c = list(map(int, input().split()))
    result = []

    for i in range(N):
        plus = v[i] - c[i]
        if plus > 0:
            result.append(plus)

    print(sum(result))

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
#coding:utf-8

def main():
    n = int(input())
    v = list(map(int, input().split()))
    c = list(map(int, input().split()))
    result = []

    for i in range(n):
        # 各リストのi番目の要素を引き算し、新しいリストに格納
        result.append(v[i] - c[i])

    # filter関数：条件に合った要素のみ取り出す
    # lambda：(lambda 引数:返り値)
    # sorted：リスト内の要素を昇順にソート
    print(sum(list(filter(lambda x:x>0, sorted(result)))))

if __name__ == "__main__":
    main()

Submission status: Accepted

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

Submission status: Accepted

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

num_v = int(len(v))

p = [v[i]-c[i] for i in range(num_v)]

pp = [j for j in p if j>0]

print(sum(pp))

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
N = int(input())
Vs = map(int, input().split())
Cs = map(int, input().split())

profit = 0
for V, C in zip(Vs, Cs):
    profit += max(V - C, 0)

print(profit)

Submission status: Accepted

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

summ = 0
for i in range(n):
    if listv[i]-listc[i]>0:
        summ += listv[i]-listc[i]
        
print(summ)

Submission status: Accepted

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

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

Submission status: Accepted

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

D = [0] * N
for i in range(N):
  D[i] = V[i] - C[i]

S = 0
for i in range(N):
  if D[i] > 0:
    S += D[i]

print(S)

Submission status: Accepted

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

ans = 0
for V, C in zip(Vs, Cs):
    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())
Value=[int(i) for i in input().split()]
Cost=[int(j) for j in input().split()]
money=0
Money=[]
for k in range(N):
    M=Value[k]-Cost[k]
    if M>=0:
        money=money+M


print(money)

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:
nn = int(input())
vv = list(map(int, input().split()))
cc = list(map(int, input().split()))

yy = 0
for ii in range(nn):
    if vv[ii]-cc[ii]>0:
        yy += vv[ii]-cc[ii]
print(yy)

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 larger(x, y):
	if x > y: return x
	else: return y

N = int(raw_input())
V = map(int, raw_input().split())
C = map(int, raw_input().split())

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

print max

Submission status: Accepted

Solution code:
# coding: utf-8

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

Submission status: Accepted

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

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

print(score)

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):
    D[i]=V[i]-C[i]
D.sort(reverse=True)
ans=0
for i in range(N):
    if D[i]>0:
        ans+=D[i]
    else:
        break
print(ans)

Submission status: Accepted

Solution code:
l = input()
V = map(int, input().split())
C = map(int, input().split())
r = 0
for v, c in zip(V, C):
    if (v-c) > 0:
        r += v-c
print(r)

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 = sum([max(vv-cc, 0) for vv, cc in zip(v, c)])
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):
    if(v_list[i]-c_list[i]>0):
        ans+=v_list[i]-c_list[i]
    else:
        continue
print(ans)

Submission status: Accepted

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

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())
ListV=[int(_) for _ in input().split()]
ListC=[int(_) for _ in input().split()]
NewList=[x - y for (x, y) in zip(ListV, ListC)]
AnswerList=[]
for i in range(N):
  if NewList[i] >= 0:
    AnswerList.append(NewList[i])
print(sum(AnswerList))

Submission status: Accepted

Solution code:
N = int(input())
value_list = list(map(int, input().split(" ")))
cost_list = list(map(int, input().split(" ")))

ans = 0

kosupa_list = []
for i in range(N):
    kosupa_list.append(value_list[i] - cost_list[i])
new_list = sorted(kosupa_list, reverse = True)

for j in range(N):
    if new_list[j] <= 0:
        break
    else:
        ans += new_list[j]
print(ans)

Submission status: Accepted

Solution code:
def main():
    N = input()

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

    V_sum = 0
    C_sum = 0
    for i, j in zip(V, C):
        if i - j > 0:
            # print(i, j)
            V_sum += i
            C_sum += j

    print(V_sum-C_sum)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = map(int, input().split())
c = map(int, input().split())
max_val = 0
for _v, _c in zip(v, c):
  if _v - _c > 0:
    max_val += _v - _c
print(max_val)

Submission status: Accepted

Solution code:
n = int(input())

v = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]

print(sum(_v - _c for _v, _c in zip(v,c) if _v > _c))

Submission status: Accepted

Solution code:
N = int(input())
V = [int(v) for v in input().split()]
C = [int(c) for c in input().split()]
VC = zip(V,C)
Y=0
for v,c in VC:
  if v-c > 0:
    Y += v-c
print(Y)

Submission status: Accepted

Solution code:
N = int(input())

values = [int(x) for x in input().split()]
costs = [int(x) for x in input().split()]

gain = sum([v-c for v, c in zip(values, costs) if v-c > 0])

print(gain)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

diff = []

for i, x in enumerate(v):
  if x - c[i] > 0:
    diff.append(x- c[i])

    
ans = 0

for x in diff:
  ans += x
  
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
benefit=[V[i]-C[i] for i in range(N)]
print(sum(filter(lambda x: x>0, benefit)))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v_i = list(map(int, input().split()))	
c_i = list(map(int, input().split()))

sum = 0
for i in range(n):
	if v_i[i] > c_i[i]:
		sum += v_i[i] - c_i[i]
	
print(sum)

Submission status: Accepted

Solution code:
n = int(input())
vn = list(map(int,input().split()))
cn = list(map(int,input().split()))

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(input())
V=[]
C=[]
tmp=0
sumx=0
val=[0]
V = list(map(int, input().split()))
C = list(map(int, input().split())) 

for i in range(N):
    tmp=V[i]-C[i]
    if(tmp>0):
        sumx=sumx+tmp
        
val.append(sumx)
print(max(val))

Submission status: Accepted

Solution code:
N=int(input())
a=list(input().split())
b=list(input().split())
sum=0
for i in range(N):
    value=int(a[i])
    cost=int(b[i])
    price=value-cost
    if price>0:
        sum+=price
print(sum)

Submission status: Accepted

Solution code:
N = int(input())

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

a = b = 0
for i, j in zip(V, C):
  if i > j:
    a += i
    b += j
    
print(a-b)

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

Submission status: Accepted

Solution code:
from array import array

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
VALUES = list(map(int, input().split()))
COSTS = list(map(int, input().split()))
result = 0

for i in range(N):
    if VALUES[i] - COSTS[i] > 0:
        result += VALUES[i] - COSTS[i]

print(result)

Submission status: Accepted

Solution code:
n = int(input())
vs = map(int, input().split(' '))
cs = map(int, input().split(' '))
diff = [v - c for v, c in zip(vs, cs)]
maximum_value = sum([max(0, d) for d in diff])
print(maximum_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):
    ans += max(v[i] - c[i], 0)
print(ans)

Submission status: Accepted

Solution code:

N=int(input())

V= input().split()
C= input().split()

maxval=0

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

print(maxval)

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:
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
sum = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
[print(sum(filter(lambda x:x>0,map(lambda x:x[0]-x[1],zip(c,v)))))for _,c,v in[[input(),map(int,input().split()),map(int,input().split())]]]

Submission status: Accepted

Solution code:
n = int(input().strip())
values = list(map(int, input().split()))
costs = list(map(int, input().split()))
 
sales = [v - c for v, c in zip(values, costs) if v > c]
 
print(sum(sales))

Submission status: Accepted

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

Submission status: Accepted

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

print(sum(filter(lambda x: x > 0, map(lambda x: x[0] - x[1], zip(v, c)))))

Submission status: Accepted

Solution code:
N = input()
V = input().split(' ')
C = input().split(' ')

max = 0
for value, cost in zip(V, C):
    value_int = int(value)
    cost_int = int(cost)
    if(value_int - cost_int > 0):
        max += value_int - cost_int

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(n):
  bnf = v[i] - c[i]
  if bnf > 0:
    ans += bnf
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):
  bft = v[i] - c[i]
  if bft > 0:
    ans += bft
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
li_v = list(map(int, input().split()))
li_c = list(map(int, input().split()))

li_a = list()

for i in range(n):
    li_a.append(li_v[i] - li_c[i])

print(sum(list(filter(lambda x: x >= 0, li_a))))

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

Submission status: Accepted

Solution code:
N = int(input())
vs = list(map(int, input().split()))
cs = list(map(int, input().split()))

ans = 0
for vi,ci in zip(vs, cs):
    if vi-ci>0:
        ans += vi - ci
print(ans)

Submission status: Accepted

Solution code:
N = int(input())

A = list(map(int, input().split()))
B = list(map(int, input().split()))

sum = 0

for i in range(N) : 
    if A[i] > B[i] : 
        sum += A[i] -B[i]

print(sum)