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

Solution (Python):

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

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

def check(i,cc):
  if i == N:
    return cc
  c1 = check(i+1,cc)
  c2 = check(i+1,cc+(V[i] - C[i]))
  return max(c1,c2)

print(check(0,0))

Solution (Python):
N = int(input())
Vl = list(map(int, input().split()))
Cl = list(map(int, input().split()))
a = 0
for i in range(0, N):
  bb = Vl[i] - Cl[i]
  if bb > 0:
    a += bb
print(a)

Solution (Python):
n = int(input())
vlist = [int(x) for x in input().split(" ")]
clist = [int(x) for x in input().split(" ")]

result = 0

for i in range(n):
	diff = vlist[i] - clist[i]
	result += diff if diff > 0 else 0
	
print(result)

Solution (Python):
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]>0:
    s += v[i]-c[i]
    

print(s)

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

print(ans)

Solution (Python):
import itertools as itr 

n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
maxxy = -10**9
for i2 in itr.product((0,1), repeat = n):
    xy = 0
    for j in range(n):
        if i2[j] == 1:
            xy += v[j]
            xy -= c[j]
    if xy > maxxy:
        maxxy = xy
        
print(maxxy)

Solution (Python):
n = int(input())
list_v = list(map(int, input().split()))
list_c = list(map(int, input().split()))
print(sum(map(lambda i: 0 if (list_v[i] - list_c[i]) < 0 else (list_v[i] - list_c[i]), range(len(list_v)))))

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

Solution (Python):
from itertools import combinations

N = int(input())
v_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

max_diff = -10000000
for n_selection in range(0, N+1):
    v_selected = list(combinations(v_list, n_selection))
    c_selected = list(combinations(c_list, n_selection))
    if n_selection == 0:
        max_diff = max(max_diff, 0)
    for i in range(len(v_selected)):
        X = sum(v_selected[i])
        Y = sum(c_selected[i])
        max_diff = max(max_diff, X - Y)

print(max_diff)

Solution (Python):


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

value = 0

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

print(value)

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

Solution (Python):
N=int(input());
V=input().split(" ");
C=input().split(" ");
max=0;
for i in range(int(N)):
  if int(V[i])-int(C[i]) > 0:
    max+=int(V[i])-int(C[i]);
print(max);

Solution (Python):
import numpy as np

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

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

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

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

print(result)

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

ans = []
def chr(a,l,r):
    global ans
    if a == n:
        ans.append(r-l)
    else:
        chr(a+1,l+c[a],r+v[a])
        chr(a+1,l,r)
chr(0,0,0)
print(max(ans))

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

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

result = 0

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

print(result)

Solution (Python):


intN = int(input())

intValues = list(map(int, input().split()))
intCosts = list(map(int, input().split()))

intTotalValue = 0
for intIdx, intValue in enumerate(intValues):
    intDiff = intValue - intCosts[intIdx]
    if intDiff > 0:
        intTotalValue += intDiff

print(intTotalValue)

Solution (Python):
import numpy as np
n = int(input())
X = np.array(list(map(int,input().split(' '))))
Y = np.array(list(map(int,input().split(' '))))
Z = X -Y
Z = Z[np.where(Z >= 0)]
print(Z.sum())

Solution (Python):
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
x=0
y=0
l=[v[j]-c[j] for j in range(n)]
l.sort(reverse=True)
l=filter(lambda x:x >0,l)
print(sum(l))

Solution (Python):
N = int(input())
V_li = list((map(int, input().split())))
C_li = list((map(int, input().split())))

ans_li = []
for i in range(N):
    R = V_li[i] - C_li[i]
    if R >= 0:
        ans_li.append(R)
print(sum(ans_li))

Solution (Python):
N = int(input())
C = []
V = []
i = 0
X_Y = 0
for x in input().split():
  x = int(x)
  V.append(x)
for x in input().split():
  x = int(x)
  C.append(x)
  if V[i] > C[i]:
    X_Y = X_Y + V[i] - C[i]
  i = i + 1

print(X_Y)

Solution (Python):
n = int(input())
v = input().split(" ")
c = input().split(" ")
plus_list = []

for i in range(n):
    res = int(v[i]) - int(c[i])
    if res > 0:
        plus_list.append(res)

r = len(plus_list)
if r > 0:
    print(sum(plus_list))
else:
    print(0)

Solution (Python):



from collections import deque
import heapq
import math
import bisect


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

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

    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
e = [[int(i) for i in input().split()] for i in range(2)] 
n = len(e[0])
result = 0
for i in range(n):
    if e[0][i] > e[1][i]:
        result = result + (e[0][i] - e[1][i])
        
print(result)

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

Solution (Python):
N = int(input())

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

import copy

flag = [0]*N
def dfs(x, y):
    if y==1:
        flag[x] = 1
    else:
        flag[x] = 0
    if x==N-1:
        value = 0
        cost = 0
        for i in range(N):
            if flag[i] == 1:
                value += V[i]
                cost += C[i]
        
        
        
        return value - cost

    
    return max(dfs(x+1, 0),dfs(x+1, 1))

print(dfs(-1,0))

Solution (Python):
N = int(input())
V = [int(v) for v in input().split()] 
C = [int(c) for c in input().split()]

v_c = [v - c for v, c in zip(V, C)]

result = 0
for i in v_c:
  if i > 0:
    result += i
print(result)

Solution (Python):
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):
    a=v[i]-c[i]
    if a<=0:
        continue
    else:
        ans+=a
print(ans)

Solution (Python):
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
ALL = []
for i in range(N):
    ALL.append( int(V[i]-C[i]) )
ALL.sort()
ALL.reverse()
AllMax = 0
for i in range(N):
    if i == 0:
        if ALL[0] < 0:
            break
        else:
            AllMax = AllMax+ALL[i]
    elif ALL[i] < 0:
        break
    elif ALL[i] >= 0:
        AllMax = AllMax+ALL[i]
        
print(AllMax)

Solution (Python):
N = input()
V = input().split()
C = input().split()
ret_X_Y = 0
V = [int(i) for i in V]
C = [int(i) for i in C]
for i in range(len(V)):
    if (V[i] - C[i]) > 0:
        ret_X_Y += V[i] - C[i]
print(ret_X_Y)

Solution (Python):
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(0,N):
  if V[i]-C[i]>0:
    answer=answer+V[i]-C[i]
print(answer)

Solution (Python):
def solve():
    N = int(input())
    V = list(map(int,input().split()))
    C = list(map(int,input().split()))
    cnt=0
    for i in range(len(V)):
        if V[i] < C[i]:
            pass
        else:
            cnt += V[i]-C[i]
    print(cnt)


solve()

Solution (Python):
def main():
  N=int(input())
  V=list(map(int, input().split()))
  C=list(map(int, input().split()))
  sum=0
   
  for i in range(0,N):
    t=V[i]-C[i]
    if t>=0:
      sum+=t

      
  print(sum)
    
  
main()

Solution (Python):
print((lambda n,v,c:sum([max(v[i]-c[i],0) for i in range(n)]))(int(input()),list(map(int,input().split())),list(map(int,input().split()))))

Solution (Python):


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

profits = []
z = 0

for i in range(n):
    profits.append(v[i] - c[i])
profits.sort()


for i in range(n):
    p = profits.pop()
    
    if p <= 0:
        print(z)
        exit()
    else:
        z += p
print(z)

Solution (Python):
N = int(input())
V = input().split()
C = input().split()
X = [int(V) for V in V]
Y = [int(C) for C in C]

XY = []
s = 0
for k in range(N):
    xy = X[k] - Y[k]
    XY.append(xy)

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

print(s)

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

for i in range(N):
	if V[i] <= C[i]:
		V[i] = 0
		C[i] = 0

ans = sum(V) - sum(C)
print(ans)

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

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

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

print(all)

Solution (Python):
def main():

    N = int(input())
    V = [int(v) for v in input().split()]
    C = [int(c) for c in input().split()]

    value = 0

    for n in range(N):
        value += max(0, V[n] - C[n])        

    print(value)

main()

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

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

Solution (Python):
n = int(input())
V = [int(v) for v in input().split()]
C = [int(c) for c in input().split()]

G = [v - c for v, c in zip(V, C)]

s = 0
for g in G:
    if g > 0:
        s += g

print(s)

Solution (Python):

import sys
input = sys.stdin.readline

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.append(v[i]-c[i])
print(sum(ans))

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

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

Solution (Python):
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]]))

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

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

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

ans = 0
Sub = [a - b for a, b in zip(V_int, C_int)]
for x in Sub:
    if x > 0 :
        ans = ans + x
print(ans)

Solution (Python):
num=input()
value=map(int,raw_input().split())
cost=map(int,raw_input().split())

sums=0

for vi,ci in zip(value,cost):
    if vi > ci:
        sums+=(vi-ci)
print sums

Solution (Python):
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]:
        Z=Z+V[i]-C[i]
    else:
        Z=Z

print(Z)

Solution (Python):
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
a=[]
for i in range(n):
    x=v[i]
    y=c[i]
    a.append(x-y)

def max_sum(N,a):
  dp=[0]*(N+1)
  for i in range(N):
    dp[i+1]=max(dp[i],dp[i]+a[i])
  return dp[N]

print(max_sum(n,a))

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

Solution (Python):
n = int(input())
vs = list(map(int, input().split()))
cs = list(map(int, input().split()))

i = 0
r = 0
for v in vs:
  if v - cs[i] > 0:
    r += v - cs[i]
  i += 1

print(r)

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

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

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

    print(sum)

if __name__ == "__main__":
    main()

Solution (Python):
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):
    if(V[i] > C[i]):
        answer += V[i] - C[i]
print(answer)

Solution (Python):
A = int(input())

B = input()
w = B.split(' ')

C = input()
x = C.split(' ')

q1 = 0
q2 = 0

for p1, p2 in zip(w, x):
    if int(p1) > int(p2):
        q1 += int(p1)
        q2 += int(p2)
    
print(q1 - q2)

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

Solution (Python):
n = list(map(int, input().split()))
v = list(map(int, input().split()))
c = list(map(int, input().split()))
res = 0
for value, cost in zip(v, c):
  if value - cost > 0 :
    res += (value - cost)
print(str(res))

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

Solution (Python):
N = int(input())
s = [input().split() for i in range(2)]
profit = 0
for j in range(N):
  if int(s[0][j]) - int(s[1][j]) > 0:
    profit += int(s[0][j]) - int(s[1][j])
print(profit)

Solution (Python):
import numpy as np
N = int(input())
V = np.array([int(i) for i in input().split()])
C = np.array([int(i) for i in input().split()])

score = V-C
score[score < 0] = 0

print(sum(score))

Solution (Python):
def a():
    N = raw_input().split(" ")
    A = int(N[0])
    B = int(N[1])
    T = int(N[2])

    print T / A * B

def b():
    sum = 0
    N = int(raw_input())
    V = raw_input().split()
    C = raw_input().split()
    for i in range(N):
        value = int(V[i]) - int(C[i])
        if value > 0:
            sum = sum + value
    print sum
    
def main():
    b()
	
if __name__ == '__main__':
    main()

Solution (Python):
n = int(input())
values = [int(i) for i in input().split()]
costs = [int(i) for i in input().split()]
differences = []
count = 0
for value in values:
  count += 1
  if value-costs[count-1] > 0:
      differences.append(value-costs[count-1])
print(sum(differences))

Solution (Python):
A=int(input())
B=[_ for _ in map(int,input().split())]
C=[_ for _ in map(int,input().split())]
S=0
for i in range(A):
  if B[i]>C[i]:
    S+=B[i]-C[i]
print(S)

Solution (Python):




import operator


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

D = [v-c for v, c in zip(V, C)]
D = filter(lambda x: x>0, D)
ans = sum(D)

print(ans)

Solution (Python):
num = int(input())
values = list(map(int, input().split()))
costs = list(map(int, input().split()))

dp = [0]*(num+1)
for i in range(num):
    diff = values[i] - costs[i]
    dp[i+1] = max( dp[i] + diff, dp[i])
print(dp[num])

Solution (Python):
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]:
        cost += (V[i] - C[i])

print(cost)

Solution (Python):
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]
    else:
        pass

print(ans)

Solution (Python):

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


sV, sC = zip(*sorted(zip(V, C), reverse=True))

maxv = 0
for v, c in zip(sV, sC):
    sabun = v-c
    if sabun < 0:
        continue
    else:
        maxv += sabun
        
print(maxv)

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

diff = [v - c for v, c in zip(V, C)]


diff.sort(reverse=True)

ans = 0
max_ = 0
for d in diff:
    ans += d
    if ans > max_:
        max_ = ans 

print(max_)

Solution (Python):

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

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

Solution (Python):

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

x=0
y=0

for v,c in zip(v,c):
    if v>c:
        x=x+v
        y=y+c

print(x-y)

Solution (Python):
n=input()

v_n=[]
c_n=[]

sum_n=[]
ans=0
v_n.append(input().split())
c_n.append(input().split())

for i in range(int(n)):
	sum_n.append(int(v_n[0][i])-int(c_n[0][i]))

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

print(ans)

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


a=0
b=0

for _ in range(n):
	if v[_] > c[_]:
		a += v[_]
		b += c[_]
		
print(a-b)

Solution (Python):
import numpy as np
N = int(input())
V = np.array(list(map(int, input().split())))
C = np.array(list(map(int, input().split())))
print(sum([i for i in V-C if i>0]))

Solution (Python):
from collections import Counter
from functools import reduce
import bisect
import fractions
import math
import statistics
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]  
def LF(): return [float(x) for x in sys.stdin.readline().split()]  
def LS(): return sys.stdin.readline().split()  
def MI(): return map(int, sys.stdin.readline().split())  
def II(): return int(sys.stdin.readline())  
def IS(): return input()  
def P(x): return print(x)
def C(x): return Counter(x)
def GCD_LIST(numbers):  
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):  
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))


n = II()
v = LI()
c = LI()
xy = [v[i] - c[i] for i in range(n)]
print(sum([ xy[i] for i in range(n) if xy[i] > 0]))

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

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

answer = 0
for i in vc:
  if i > 0:
    answer += i

print(answer)

Solution (Python):
n = input()
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
z = [ x[i]-y[i] for i in range(int(n))]
cnt = 0
for i in z:
  if i > 0:
    cnt += i
print(cnt)

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

main()

Solution (Python):
n = int(input())
v_list = list(map(int,input().split()))
c_list = list(map(int,input().split()))

vc = []
for i in range(n):
    ans = v_list[i]-c_list[i]
    if ans >= 0:
        vc.append(v_list[i]-c_list[i])

print(sum(vc))

Solution (Python):
n = int(input())
v_list = [int(i) for i in input().split()]
c_list = [int(i) for i in input().split()]

b_list = [v - c for (v, c) in zip(v_list, c_list)]
print(sum([b for b in b_list if b > 0]))

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

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

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

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

temp = 0
for i in profit:
  if i>0:
  	temp+=i
print(temp)

Solution (Python):
N = int(input())
V = []
V = input().split()
C = []
C = input().split()

sum = 0

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

print(sum)

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

Solution (Python):
a = input().split()
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
ans = 0
for i in range(int(a[0])):
  if int(x[i]) - int(y[i]) > 0:
    ans += (int(x[i]) - int(y[i]))
print(ans)

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

Solution (Python):
import numpy as np
N = int(input())


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


C = np.array([int(j) for j in input().split()])

profit = 0
for k in range(N):
    if V[k] - C[k] > 0:
        profit += V[k] - C[k]
print("{}".format(profit))

Solution (Python):



n = input()
values = input().split()
costs = input().split()

kekka = 0
for (value, cost) in zip (values,costs):
    rieki = int(value) - int(cost)
    if rieki > 0:
        kekka += rieki

print(kekka)

Solution (Python):
juelNum = int(input())
eachValueOrg = input().split()
eachValue = [int(i) for i in eachValueOrg]
eachCostOrg = input().split()
eachCost = [int(i) for i in eachCostOrg]

ans = 0
for i in range(juelNum):
    if eachCost[i] < eachValue[i]:
        ans += (eachValue[i] - eachCost[i])
print(ans)

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

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

A.append(0)
A.sort()
A.reverse()
print(sum(A))

Solution (Python):
n = int(input())
v = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
s = 0
for vi, ci in zip(v,c):
    if vi - ci > 0:
        s = s + vi - ci 
print(s)

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

m = 0
o = []

for i in range(n):
  if v[i] - c[i] > 0:
    o.append(v[i] - c[i])

print(sum(o))

Solution (Python):

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)

Solution (Python):




N = int(input())
V_list = [int(e) for e in input().split()]
C_list = [int(e) for e in input().split()]

ans=0

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

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

Solution (Python):
n = int(input())
v = list(map(int, input().strip().split(' ')))
c = list(map(int, input().strip().split(' ')))
l = [0] * n
for i in range(n):
  l[i]=v[i]-c[i]
l.sort(reverse=True)
s = 0
for i in range(n):
  if s < sum(l[0:i+1]):
    s = sum(l[0:i+1])
print(s)

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

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

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


X = 0 
Y = 0 

def dfs(index, x, y):
    buff = 0
    buff1 = 0
    if (index >= N):
        return x - y
    buff = dfs(index+1, x+V[index], y+C[index])
    buff1 = dfs(index+1, x, y)
    return max(buff, buff1)



ans = dfs(0, 0, 0)
print(ans)

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

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

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

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

diff = [v - c for v, c in zip(V, C)]
diff = filter(lambda x: x > 0, diff)
print(sum(diff))

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

Solution (Python):
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_list[i] - c_list[i]) > 0:
  	    ans += (v_list[i] - c_list[i])

print(ans)

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

Solution (Python):
n = int(input())
vs = [int(x) for x in input().split()]
cs = [int(x) for x in input().split()]

items = (u - v for u, v in zip(vs, cs))
print(sum([item for item in items if item >0]))

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

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

Solution (Python):
num = int(input())
V = list(input().split(" "))
C = list(input().split(" "))
result = 0

for i in range(num):
    Vi = int(V[i])
    Ci = int(C[i])
    if Vi <= Ci:
        continue
    result += (Vi - Ci )

print(result)

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

Solution (Python):
N = int(input())
V = [int(v) for v in input().split()]
C = [int(c) for c in input().split()]

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

Solution (Python):
num = input()
kati = input().split()
cost = input().split()
get = 0

for i in range(int(num)):
    if int(kati[i]) - int(cost[i]) >= 0:
        get = int(get) + int(kati[i]) -int(cost[i])
print(get)

Solution (Python):
input()
VC = [v-c for v, c in zip(map(int, input().split()), map(int, input().split())) if v > c]
VC.append(0)
print(sum(VC))

Solution (Python):


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)

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

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

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

ans = 0
dif = [0] * N

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

print(ans)

Solution (Python):
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] >= 0:
        result += V[i] - C[i]
    else:
        pass

print(result)

Solution (Python):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
i = 0
for c in range(N):
  if A[c]>B[c]:
    i = i +A[c]-B[c]
print (i)

Solution (Python):
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]:
        calc = v[i] - c[i]
        ans += calc

print(ans)

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

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

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

print(result)

Solution (Python):
num = int(input())
value = tuple( map (int,input().split()))
price = tuple(map (int,input().split()))
ans = 0
for i in range(num):
  if value[i] > price[i] :
      income = value[i] - price[i]
      ans += income
print(ans)

Solution (Python):


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

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

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

Solution (Python):
def main():
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))

    D = [V[i] - C[i] for i in range(N)]
    f = [d for d in D if d > 0]

    if len(f) == 0:
        print(0)
    else:
        print(sum(f))

if __name__ == "__main__":
    main()

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

print(sum(z))

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