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

import numpy as np
import itertools


l = list(map(int, input().split()))
N = l[0]

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

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

best_result = 0



for n in range(N+1):
    v_list = list(itertools.combinations(V,n));
    c_list = list(itertools.combinations(C,n));
    for v, c in zip(v_list, c_list):
        X = sum(v)
        Y = sum(c)

        result = X - Y

        
        if best_result <= result:
            best_result = result

print(best_result)

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

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

ans = 0

for i in range(1 << n):
	tmp = 0
	for j in range(n):
		if(i >> j & 1):
			tmp += v[j] - c[j]
	ans = max(ans, tmp)

print(ans)

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

test = {}

V = list(map(int,input().split()))
C = list(map(int,input().split()))
new_n = 0
for i in range(N):
    if V[i] <=  C[i]:
        continue
    else:
        test[i] = [V[i],C[i]]
        new_n += 1

N = new_n

def calc_cost(com,test,i):
    x = 0
    y = 0
    for j in com:
        x += test[j][0]
        y += test[j][1]
    return x - y

ans = 0

for i in range(N):
    c = itertools.combinations(test.keys(), i+1)
    for j in c:
        ans = max(ans,calc_cost(j,test,i))


print(ans)

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

value=0
cost=0

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

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

total=value-cost

print(total)

Solution (Python):
n = int(input())
value_list = list(int(x) for x in input().split())
cost_list = values = list(int(x) for x in input().split())
sum_v = 0
sum_c = 0

for i in range(n):
    if value_list[i] > cost_list[i]:
        sum_v += value_list[i]
        sum_c += cost_list[i]
    else:
        pass

ans = sum_v - sum_c
print(ans)

Solution (Python):



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

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

Solution (Python):
N=int(input())
VALUE= list(map(int,input().split()))
COST = list(map(int,input().split()))
COUNT=0

for i in range(0,N):
    CHECK = VALUE[i]-COST[i]
    if CHECK >= 0:
        COUNT+=CHECK

print(COUNT)

Solution (Python):
def spaceinput():
    return list(map(int,input().split(" ")))

N=int(input())
v=spaceinput()
c=spaceinput()

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

print(res)

Solution (Python):
import queue

N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
ans = 0
for i in range(N):
	if A[i] - B[i] > 0:
		ans += A[i] - B[i]
print(ans)

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

v = np.array(v)
c = np.array(c)


venefit = v - c

venefit= venefit.tolist()
l_minus = [i for i in venefit if i > 0]

n = sum(l_minus)  
print(n)

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

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

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

Solution (Python):
N = int(input())
VC = [list(map(int,input().split())) for _ in range(2) ] 
ans = 0
for i in [ VC[0][_] - VC[1][_] for _ in range(N)]:
    if i> 0:
        ans+=i
print(ans)

Solution (Python):
def main():
    n = int(input())
    v = [int(s) for s in input().split()]
    c = [int(s) for s in input().split()]

    s = sum(max(x - y, 0) for x, y in zip(v, c))
    print(s)

main()

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

print(ret)

Solution (Python):
import numpy as np
n = input()
v = np.array(input().split(), dtype=np.int64)
c = np.array(input().split(), dtype=np.int64)
e = v-c
print(sum(e[e>0]))

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

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

Solution (Python):
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
diffs = []
value = 0

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

    if diffs[i]>0:
        value += diffs[i]

print(value)

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

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

if __name__ == "__main__":
    main()

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

Solution (Python):
import numpy as np

def read_input():
    n = int(input())
    values = np.asarray(list(map(int, input().split())))
    costs = np.asarray(list(map(int, input().split())))

    return n, values, costs

if __name__ == '__main__':
    n, values, costs = read_input()
    benefits = values - costs
    benefits = np.sort(benefits)[::-1]

    benefits = [p for p in benefits if p > 0]
    benefits = benefits[:n]

    if benefits:
        print(sum(benefits))
    else:
        print(0)

Solution (Python):
import numpy as np

N = int(input())

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

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

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

Solution (Python):

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

XY = 0

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

print(XY)

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

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])
    else:
        pass
print(ans)

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

print(sum([vi - ci for vi, ci in zip(v, c) if vi > ci]))

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

value = 0
for v, c in zip(v_list, c_list):
    if v > c:
        value = value + v - c

print(value)

Solution (Python):
n = int(input())
liv = list(map(int,input().split()))
lic = list(map(int,input().split()))
ans = 0

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

print(ans)

Solution (Python):

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

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

x = 0 
y = 0 
diff = x - y

for i in range(len(V)):
    if x + V[i] - (y + C[i]) > diff:
        diff = x + V[i] - (y + C[i])
        x = x + V[i]
        y = y + C[i]


print(diff)

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

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

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

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

print(t)

Solution (Python):
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(map(int, input().split()))

N = ii()
V = li()
C = li()

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

print(max_val)

Solution (Python):
import re
import sys
from fractions import gcd
from functools import reduce
from itertools import product

import numpy as np

sys.setrecursionlimit(200000)


def input():
    return sys.stdin.readline()[:-1]


def ii(t: type = int):
    return t(input())


def il(t: type = int):
    return list(map(t, input().split()))


def imi(N: int, t: type = int):
    return [ii(t) for _ in range(N)]


def iml(N: int, t: type = int):
    return [il(t) for _ in range(N)]


def solve():
    N = ii()
    V = il()
    C = il()
    ans = 0
    for v, c in zip(V, C):
        k = v - c
        if k > 0:
            ans += k
    return ans


if __name__ == "__main__":
    print(solve())

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

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

Solution (Python):

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

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

Solution (Python):



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

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

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

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

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

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

print(total)

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

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

print(ans)

Solution (Python):
num = int(input())
jueries = input().split()
costs = input().split()
result = 0

for i in range(num):
  value = int(jueries[i])
  cost  = int(costs[i])
  target = value - cost
  if target > 0:
    result += target
print(result)

Solution (Python):


number_of_jewels = int(input())
jewels_value = list(map(int, input().split()))
jewels_cost = list(map(int, input().split()))
ans = 0

jewels_value_minus_cost = [0 for i in range(number_of_jewels)]
for i in range(number_of_jewels):
    jewels_value_minus_cost[i] = jewels_value[i] - jewels_cost[i]
jewels_value_minus_cost.sort()
jewels_value_minus_cost.reverse()
for i in jewels_value_minus_cost:
    if i>0:
        ans += i
    else:
        break
print(ans)

Solution (Python):
N = input().split()
Vs = list(map(int, input().split()))
Cs = list(map(int, input().split()))

l = []
for i in range(0, len(Vs)):
  tmp = Vs[i] - Cs[i]
  l.append(0 if tmp < 0 else tmp )
  

print(sum(l))

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

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

print(result)

Solution (Python):
n = int(input())
v_list = list(map(int, input().split(" ")))
c_list = list(map(int, input().split(" ")))
total = 0
for i in range(n):
    if v_list[i] < c_list[i]:
        continue
    total += v_list[i] - c_list[i]
print(total)

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

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

Solution (Python):


from itertools import combinations, chain

N = int(input())
values = map(int, input().split())
costs = map(int, input().split())

sales = [v - c for v, c in zip(values, costs)]

print(max(chain.from_iterable(map(sum, combinations(sales, i)) for i in range(0, N+1))))

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

def solve(ho, cost, cnt):
    if cnt == n:
        return ho - cost
    return max(solve(ho, cost, cnt + 1), solve(ho + V[cnt], cost + C[cnt], cnt + 1))

print(solve(0, 0, 0))

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

print(ans)

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





v_minus_c = [v-c for (v, c) in zip(v_list, c_list)]
total = sum([s for s in v_minus_c if s>0])
print(total)

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

answer = []

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

for r in range(n+1):
    comb = list(itertools.combinations(answer, r))
    for j in comb:
        if max <= sum(j):
          max = sum(j)

print(max)

Solution (Python):
import itertools
import numpy as np

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

X = 0
X_ = []
Y = 0
Y_ = []

for i in range(N):
    for value in itertools.combinations(V, i+1):
        X = sum(value)
        X_.append(X)

for j in range(N):
    for cost in itertools.combinations(C, j+1):
        Y = sum(cost)
        Y_.append(Y)
if max(np.array(X_)-np.array(Y_)) > 0:
    print(max(np.array(X_)-np.array(Y_)))
else:
    print(0)

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

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

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

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

ans = 0

for ind in range(n):
    if n == 1:
      break
    res = x[ind] - y[ind]
    if res > 0:
      ans += res

print(ans)

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

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

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

r.append(0)
r.sort(reverse=True)

ret= sum([j for j in r if j>=0])
print(ret)

Solution (Python):
import numpy as np
N = int(input())
V = list(map(int, input().strip().split()))
V = np.array(V)
C = list(map(int, input().strip().split()))
C = np.array(C)
B = 0
i = 0
while i <= N - 1:
    A = V[i] - C[i]
    i += 1
    if A > 0:
        B = B + A
print(B)

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

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

Solution (Python):
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
d=0
for a,b in zip(v,c):
    if a-b>0:
        d+=a-b
print(d)

Solution (Python):

N = int(input())

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

C = [int(i) for i in 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)

Solution (Python):
N = int(input())
vLst = list(map(int, input().split()))
cLst = list(map(int, input().split()))

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

Solution (Python):


def main():
    n = int(input())
    V = [int(e) for e in input().split(" ")]
    C = [int(e) for e in input().split(" ")]

    N = [0 for i in range(n+1)]

    max_n = 0
    for i in range(1, n+1):
        prev = N[i-1]
        current = N[i-1] + (V[i-1] - C[i-1])
        if prev < current:
            N[i] = current
        else:
            N[i] = prev

    print(N[n])

main()

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

print(sum([x - y for x, y in zip(v, c) if x - y > 0]))

Solution (Python):
N = int(input())
a = input().split()
b = input().split()

sum = 0

for i in range(N):
  if int(a[i]) > int(b[i]):
    sum += int(a[i]) -int(b[i])

print(sum)

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):
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
print(sum([max(0, a[i]-b[i]) for i in range(n)]))

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

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())))
XY=V-C
sum=0
i=0
while i<N:
    if XY[i]>0:
        sum+=XY[i]
    i+=1
    
print(sum)

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

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

print(total)

Solution (Python):



n=int(input())
value=input().split(" ")
cost=input().split(" ")

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

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

val = 0
for i in range(N):
    temp1 = A[i]
    temp2 = C[i]
    if temp1 - temp2 > 0:
        val += temp1 - temp2
print(val)

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

Solution (Python):
import itertools
import sys

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

ids = [x for x in range(n)]

diff = [tmpv - tmpc for tmpv, tmpc in zip(v, c)]

result = 0

for i in range(1, n+1):
    tmp = list(itertools.combinations(diff, i))
    tmpMax = max([sum(x) for x in tmp])
    if tmpMax > result:
        result = tmpMax
    
    
    
    

print(result)

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


if __name__ == '__main__':
    main()

Solution (Python):
import numpy as np

n = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = np.array(A)
D = np.array(B)
E =np.array([])
E = C - D
x = 0
for i in E:
  if i > 0:
    x = x + i
print(x)

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

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

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

print(B)

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

d = [[v[i], c[i]] for i in range(n)]
d.sort(key=lambda x: x[0] - x[1], reverse=True)

ans = 0
i = 0
while i < n and d[i][0] - d[i][1] > 0:
    ans += d[i][0] - d[i][1]
    i += 1

print(ans)

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

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

print(Vmax)

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

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

print (sum)

Solution (Python):
in_data = [list(map(int,input().split())) for i in range(3)]

N = in_data[0][0]

earn_ttl = 0

for i in range(N):
    value = in_data[1][i]
    cost = in_data[2][i]
    earn = value - cost
    if (earn > 0):
        earn_ttl = earn_ttl + earn
        
print(earn_ttl)

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

print(value)

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

num = 0

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

print(num)

Solution (Python):
import itertools
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
vc=[]
for i in range(n):
  vc.append(v[i]-c[i])
sv=[]
for L in range(0, len(v)+1):
    for subset in itertools.combinations(vc, L):
      sv.append(sum(subset))
print(max(sv))

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

Solution (Python):

num = int(input())
data_value = list(map(int, input().split()))
data_cost = list(map(int, input().split()))
ans = 0

def ans_check(all_cost):
    global ans
    if ans < all_cost:
        ans = all_cost


def calc_ans(ind, all_cost, in_out_flg):
    if ind == num:
        ans_check(all_cost)
        return
    if in_out_flg:
        all_cost = all_cost + data_value[ind] - data_cost[ind]

    calc_ans(ind + 1, all_cost, 0)
    calc_ans(ind + 1, all_cost, 1)



def main():
    calc_ans(0, 0, 0)
    calc_ans(0, 0, 1)

    print(ans)

if __name__ == '__main__':
    main()

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

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

print(res)

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











def calculate_maximum_gain(values, costs):
    gain = 0
    for value, cost in zip(values, costs):
        if value - cost > 0:
            gain = gain + value - cost
    
    return gain


print(calculate_maximum_gain(values, costs))

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

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

print(sum([a - b for a, b in zip(VS, CS) if a - b > 0]))

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

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

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

print(count)

Solution (Python):
import numpy as np

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

v = np.array(v)
c= np.array(c)
hikizan = v-c

x = np.zeros((3,n))
x[1] = v
x[2] = c
x[0] = hikizan

kotae = 0

for i in range(0,n):
    if x[0,i] > 0:
        kotae += x[0,i]
        
print(int(kotae))

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

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

C = [A[i] - B[i] for i in range(N) if A[i] - B[i] > 0 ]

print(sum(C))

Solution (Python):
N = int(input().rstrip())
V = map(int, input().rstrip().split())
C = map(int, input().rstrip().split())
MAX = 0
for v, c in zip(V, C):
  if v > c:
    MAX += v - c
print(MAX)

Solution (Python):
read = input
n = int(read())
V = map(int, read().split())
C = map(int, read().split())
A = list(zip(V,C))
mx = 0
for (v,c) in A:
    if v > c:
        mx += v - c
print(mx)

Solution (Python):
a = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split())) 
ans = 0
for i in range(a):
    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()))

dp = [0] * (n + 1)

for i in range(1, n + 1):
    dp[i] = max(dp[i - 1] + v[i - 1] - c[i - 1], dp[i - 1])
print(dp[-1])

Solution (Python):

n = int(input())
value = [int(d) for d in input().split(" ")]
cost = [int(d) for d in input().split(" ")]
valueSum = 0
costSum = 0
vcdifList = list()
for i in range(n):
	vc = value[i] - cost[i]
	if vc > 0:
		vcdifList.append(vc)
print(sum(vcdifList))

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

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

print(ans)

Solution (Python):
n = int(input())
vl = list(map(int, input().split()))
cl = list(map(int, input().split()))
s = 0

for v,c in zip(vl,cl):
    if(v - c > 0):
     s += v-c
print(s)

Solution (Python):
f=lambda:list(map(int,input().split()))
f()
print(sum(max(0,a-b)for a,b in zip(f(),f())))

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


import sys
input = sys.stdin.readline

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



difv = [V[i] - C[i] for i in range(N)]

ans = 0
for x in difv:
    if x > 0:
        ans += x

print(ans)

Solution (Python):
n = input()
v = [int(s) for s in input().split()]
c = [int(s) for s in input().split()]
a = 0
for v_, c_ in zip(v,c):
    if v_>c_:
        a+=v_-c_
print(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):
    if V[i]>C[i]:
        ans+=V[i]-C[i]
    elif V[i]<C[i]:
        ans+=0
    else:
        ans+=0

print(ans)

Solution (Python):
a = int(input())
N = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
i=0
v=0

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

print(v)

Solution (Python):
n = input()
n = int(n)
v = list()
k = 0
l = 0
a = input().split()
for i in range(n):
  p = int(a[k])
  v.append(p)
  k += 1
c = list()
b = input().split()
for i in range(n):
  q = int(b[l])
  c.append(q)
  l += 1
u = 0
count = 0
for i in range(n):
  g = v[count]-c[count]
  count += 1
  if g > 0:
    u += g
print(u)

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())
val=[int(s) for s in input().split()]
cost=[int(s) for s in input().split()]
sum=0
for i in range(N):
  d=val[i]-cost[i]
  if d>0:sum+=d
print(sum)

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

print(max_diff)

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

Solution (Python):
from sys import stdin

readline = stdin.readline

n, *vc = map(int, open(0).read().rstrip().split())
res = 0
for v, c in zip(vc[:n], vc[n:]):
    res += max(v - c, 0)

print(res)

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

ans = 0

for index in range(len(V)):
    
    if V[index] > C[index]:
        ans+= V[index] - C[index]
      
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):
  tmp = v[i]-c[i]
  if tmp>0:
    res += tmp
print(res)

Solution (Python):
def main():
  if 'get_ipython' not in globals():  
    
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))
  else:
    
    
    
    
    
    
    N = 1
    V = [1]
    C  = [50]
  i = 0
  ans = 0
  D = []
  for i in range(N):
    tmp = V[i] - C[i]
    if tmp > 0:
      ans += tmp
    
  print(ans)
  
main()

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

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

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

count = 0
for i in vc:
  if i <= 0 :
    break
  else:
    count += i
print(count)

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

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