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(int(i) for i in input().split()) 
C = list(int(i) for i in input().split()) 
S=[]
ans=0
for i in range(N):
    S.append(V[i]-C[i])
for i in range(N):
	if S[i]>0:
		ans=ans+S[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([v[i] - c[i] for i in range(n) if v[i] - c[i] > 0])
print(ans)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!

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

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

N = I()
V = III()
C = III()
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 solve():
    n = int(input())
    vs = list(map(int, input().split()))
    cs = list(map(int, input().split()))
    return sum([v - c for v, c in zip(vs, cs) if v > c])


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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
Vlist = list(map(int,input().split()))
Clist = list(map(int,input().split()))
sum1 = 0
for i in range(N):
    x = Vlist[i]
    c = Clist[i]
    if x - c > 0:
        sum1 += (x-c)
print(sum1)

Submission status: Accepted

Solution code:
N = list(map(int,open(0).read().split()))
v = 0
for i in range(N[0]):
  d = N[1+i]-N[1+i+N[0]]
  if d > 0:
    v +=d
print(v)

Submission status: Accepted

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

max_eff = 0
for i in range(2**n):
    val_sum = 0
    cos_sum = 0
    for j in range(n):
        if ( i >> j ) & 1:
            val_sum += v[j]
            cos_sum += c[j]
    if max_eff < val_sum - cos_sum:
        max_eff = val_sum - cos_sum

print(max_eff)

Submission status: Accepted

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

total_v = 0

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

print(total_v)

Submission status: Accepted

Solution code:
def resolve():
    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 temp > 0:
            ans+=temp
    print(ans)
resolve()

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n = int(input())
s1 = list(map(int,input().split()))
s2 = list(map(int,input().split()))
MAX = 0
cost = 0
for i in range(n):
    cost = s1[i] - s2[i]
    if cost > 0:
        MAX = MAX + cost
print(MAX)

Submission status: Accepted

Solution code:
import math
import copy

inputa = input().split()
inputb = input().split()
inputc = input().split()

a = int(inputa[0])
# b = int(inputa[1])
# c = int(inputa[2])

# a = inputa[0]
# inputList = list(a)

# x = int(inputb[0])
# y = int(inputb[1])

# inputList=[]
# for i in range(a):
#     inputNum = input()
#     inputList.append(inputNum)

b = [int(n) for n in inputb]
c = [int(n) for n in inputc]

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
v1=input().split()
c1=input().split()
k=0
for i in range(n):
    l=int(v1[i])-int(c1[i])
    if l > 0:
        k+=l

print(k)

Submission status: Accepted

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

sa_VC = [0]*N
ans = 0

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

print(ans)

Submission status: Accepted

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


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

print(getsum)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(sum(ans))

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
a=int(input())
v= list(map(int,input().split()))
c= list(map(int,input().split()))
ans=0
for vq,cq in zip(v,c):
  if vq>cq:
    ans+=(vq-cq)
    
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
*vl, = map(int,input().split())
*cl, = map(int,input().split())
for i in range(n):
  vl[i] = max(0,vl[i]-cl[i])
print(sum(vl))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

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

cnt = 0
for i in range(n):
    if t[i] > 0:
        cnt += t[i]

print(cnt)

Submission status: Accepted

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

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

print(answer)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
v = np.array(list(map(int, input().split())))
c = np.array(list(map(int, input().split())))
p = v-c
ans = 0
for i in p:
    if i>0:
        ans+=i

print(ans)

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())
v = np.array(list(map(int, input().split())))
c = np.array(list(map(int, input().split())))
p = v-c
ans = sum([i for i in p if i>0])
print(ans)

Submission status: Accepted

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

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

p.sort(reverse=True)
ans = 0
for i in range(n):
    if p[i] > 0:
        ans += p[i]
    else:
        break
print(ans)

Submission status: Accepted

Solution code:
n=int(input())

vlist=list(map(int,input().rstrip().split()))
clist=list(map(int,input().rstrip().split()))

xsum=0

for i in range(n):
	if vlist[i] > clist[i]:
		xsum += vlist[i]-clist[i]


print(xsum)

Submission status: Accepted

Solution code:
input()
print(sum(max(int(x)- int(y), 0) for x, y in zip(input().split(), input().split())))

Submission status: Accepted

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

sum = 0
for v, c in zip(v_list, c_list):
  diff = v - c
  if diff >= 0:
    sum += diff
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(ans, ans + V[i] - C[i])
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:

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

Y = 0
for v, c in zip(Vs, Cs):
    if v > c:
        Y += (v-c)

print(Y)

Submission status: Accepted

Solution code:

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

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

print(Y)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
X = 0
Y = 0
for v,c in zip(V,C):
    if v / c > 1:
        X += v
        Y += c
print(X-Y)

Submission status: Accepted

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

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

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

# output
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
V = np.array(list(map(int, input().split())))
C = np.array(list(map(int, input().split())))
S = V-C

print(S[S>=0].sum())

Submission status: Accepted

Solution code:
# ABC125B - Resale
def main():
    n = int(input())
    V, C = tuple(tuple(map(int, input().rstrip().split())) for _ in range(2))
    ans = sum(i - j for i, j in zip(V, C) if i - j > 0)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

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

print(sum([max(x[0] - x[1], 0) for x in zip(v, c)]))

Submission status: Accepted

Solution code:
from operator import sub

def main():
    ans = 0

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

    sub_list = list(map(sub, v, c))

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

    print(ans)


if __name__ == '__main__' :
    main()

Submission status: Accepted

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

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

D.sort(reverse=True)

_sum=0

for d in D:
    if d <= 0:
        break
    _sum += d

print(_sum)

Submission status: Accepted

Solution code:
_ = input(), print(sum(filter(lambda x: x >= 0, sorted(map(lambda x: x[0] - x[1], zip(map(int, input().split()), map(int, input().split()))), reverse=True))))

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
print(sum(filter(lambda x: x >= 0, sorted(map(lambda x: x[0] - x[1], zip(V, C)), reverse=True))))

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(len(V)):
  if V[i]-C[i] > 0:
    result += V[i]-C[i]

print(result)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
V_arr = np.array(list(map(int,input().split())))
C_arr = np.array(list(map(int,input().split())))
dev_arr = V_arr-C_arr

print(sum(dev_arr[dev_arr>0]))

Submission status: Accepted

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

sub_ls = [i - j if i - j > 0 else 0 for i, j in zip(v_ls, c_ls)]
print(sum(sub_ls))

Submission status: Accepted

Solution code:
#coding:utf-8

n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
# 宝石の価値-入手コストを格納する（利益出る分だけ）
diff = []

for i in range(n):
    # 手に入れた場合の利益を計算
    tmp = v[i] - c[i]
    # 利益が出るなら入手する
    if tmp > 0:
        diff.append(tmp)

print(sum(diff))

Submission status: Accepted

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

Submission status: Accepted

Solution code:


n = int(input())
values = [int(x) for x in input().split()]
costs = [int(x) for x in input().split()]
selected_jewelry = [v-costs[i] for i,v in enumerate(values) if v > costs[i]]
print(sum(selected_jewelry))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

res=0

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

print(res)

Submission status: Accepted

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

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

print(s)

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 v, c in zip(V, C):
    ans += max(0, v - c)

print(ans)

Submission status: Accepted

Solution code:
import itertools

def check():
    max_profit = 0
    N = int(input())
    value = list(map(int, input().split(" ")))
    cost = list(map(int, input().split(" ")))
    num = [i for i in range(N)]
    
    for i in range(1,N+1):
        for numList in itertools.combinations(num,i):
            total = 0
            for k in numList:
                total += value[k] - cost[k]
            if max_profit < total:
                max_profit = total
    print(max_profit)

check()

Submission status: Accepted

Solution code:
sum = 0

N = int(input())

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

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

print(sum)

Submission status: Accepted

Solution code:
n = int(input().split()[0])
v_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

score_list = []

for v, c in zip(v_list, c_list):
    if v - c > 0:
        score_list.append(v-c)

ans = sum(score_list)
print(ans)

Submission status: Accepted

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

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

print(an)

Submission status: Accepted

Solution code:
from collections import deque
n=int(input())
v=deque(list(map(int,input().split())))
c=deque(list(map(int,input().split())))
ans=deque([])
value=0
for i in range(n):
    ans.append(v[i]-c[i])
for j in range(n):
    if ans[j]>=0:
        value+=ans[j]
print(value)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

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

diff_list = v_list-c_list
get_list = filter(lambda x:x>0,diff_list)
print(sum(get_list))

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:
# -*- coding: utf-8 -*-
#ABC125C
import sys

n=int(input())

v=[]
c=[]
tmp = input().split()
tmp2 = input().split()
hoge = list(map(lambda a: int(a), tmp))
fuga = list(map(lambda a: int(a), tmp2))

sum=0
for i in range(0,n):
	v.append(hoge[i])
	c.append(fuga[i])
	if(v[i]>c[i]):
		sum+= v[i]-c[i]

print(sum)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def greedy(n, value, cost):
    m = int(n)
    total_value = 0
    total_cost = 0
    for i in range(m):
        v = int(value[i])
        c = int(cost[i])
        if v > c:
            total_value += v
            total_cost += c
        else:
            pass
    else:
        print("%d" %(total_value - total_cost))

if __name__ == '__main__':
    n = raw_input()
    value = raw_input().split()
    cost = raw_input().split()

#    print("%s" %n)
#    print("%s" %value)
#    print("%s" %cost)


    greedy(n,value,cost)

Submission status: Accepted

Solution code:
n = int(input())
value_list = [int(i) for i in input().split(" ")]
cost_list = [int(i) for i in input().split(" ")]

profit = 0

for value, cost in zip(value_list,cost_list):
    if value > cost:
        profit += value -cost
print(profit)

Submission status: Accepted

Solution code:
# ABC B - Resale
n = int(input())
V = [int(el) for el in input().split(' ')]
C = [int(el) for el in input().split(' ')]

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

print(total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
Vs = list(map(int, input().split()))
Cs = list(map(int, input().split()))
Is = filter(lambda i: Vs[i]>=Cs[i], range(N))
r = sum(map(lambda i: Vs[i]-Cs[i], Is))
print(r)

Submission status: Accepted

Solution code:

n = int(input())
values = list(map(int, input().split()))
costs = list(map(int, input().split()))

res = 0
for i in range(len(values)):
    res += max(values[i] - costs[i], 0)
print(res)

Submission status: Accepted

Solution code:
#!/usr/bin/python3
#coding: utf-8

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

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

print(ret)

Submission status: Accepted

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


def get_num():
    return int(input())


def get_nums(n):
    res = [0 for _ in range(n)]
    for i in range(n):
        res[i] = int(input())
    return res


def get_numbers():
    return map(int, input().split())

n = get_num()
v = list(get_numbers())
c = list(get_numbers())

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

print(ans)

Submission status: Accepted

Solution code:
import sys
import numpy as np
input = sys.stdin.readline

def main():
    N = int(input())
    v = np.array(list(map(int, input().split())))
    c = np.array(list(map(int, input().split())))

    tmp = sorted(v - c, reverse=True)
    ans = 0
    for i in range(N):
        if tmp[i] > 0:
            ans += tmp[i]
        else:
            break
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
N, = (int(x) for x in input().split())
V_arr = [int(x) for x in input().split()]
C_arr = [int(x) for x in input().split()]

ans = 0
for v,c in zip(V_arr, C_arr):
    ans += max(0, v-c)

print(ans)

Submission status: Accepted

Solution code:
import numpy as np
N=int(input())
V=np.array(list(map(int,input().split())))

C=np.array(list(map(int,input().split())))

R=V-C

print(R[R>0].sum())

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main26():
    num = int(input())
    vd = input().split()
    cd = input().split()
    v = []
    c = []
    for i in range(num):
        v.append(int(vd[i]))
        c.append(int(cd[i]))
    result = 0
    for i in range(num):
        if v[i] > c[i]:
            result = result + v[i] - c[i]
    print(result)

if __name__ == "__main__":
    main26()

Submission status: Accepted

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

val = []
for i in range(N):
	val.append(V[i] - C[i])
val.sort()
val.reverse()
cnt = 0
valsum = 0
while cnt < N and val[cnt] >= 0:
	valsum += val[cnt]
	cnt += 1

print(valsum)

Submission status: Accepted

Solution code:
import sys

sys.setrecursionlimit(1000000000)

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


def rec(i, ans):
    if i == N:
        return ans
    else:
        return max(rec(i + 1, ans + V[i] - C[i]), rec(i + 1, ans))


ans = rec(0, 0)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))

val_list = [V_list[i] - C_list[i] for i in range(N)]
# val_list.sort()
# print(val_list)

ans = 0
for val in val_list:
    if val > 0:
        ans += val

print(ans)

Submission status: Accepted

Solution code:
"""
# 標準入力取得
## 文字列
 = sys.stdin.readline().rstrip()
 = list(sys.stdin.readline().rstrip())

## 数値
 = int(sys.stdin.readline())
 = map(int, sys.stdin.readline().split())
 = list(map(int, sys.stdin.readline().split()))
 = [list(map(int,list(sys.stdin.readline().split()))) for i in range(h)]  # 二次元配列入力　二次元マップみたいな入力のとき

# 0埋め, 小数点出力桁指定時のときの出力
a = 100
b = 0.987654321
print("{0:06d}-{1:6f}".format(a,b))
000100-0.987654

# 文字列をリストに格納
char_list = list("abcd") # ["a","b","c","d"]
"""

import math
import sys
import itertools
import queue
from fractions import gcd

def lcm(a, b):
    return a * b // gcd(a, b)

mod = 1000000007

if __name__ == "__main__":
    n = int(sys.stdin.readline())
    v = list(map(int, sys.stdin.readline().split()))
    c = list(map(int, sys.stdin.readline().split()))
    ans = 0
    for i in range(len(v)):
        n = v[i]-c[i]
        if n >0:
            ans += n
    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())
listv=[int(x) for x in input().split()]
listc=[int(y) for y in input().split()]
values=[x - y for (x, y) in zip(listv, listc)]
ans = 0
for i in values:
  if i>0:
    ans+=i
print(ans)

Submission status: Accepted

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

u = []
for i in range(0,n):
    u.append(max(v[i]-c[i],0))
print(sum(u))

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = input()
X = list(map(int,input().split()))
Y = list(map(int,input().split()))
Z = []
for i in range(len(X)):
  if X[i]>Y[i]:
    a = X[i]-Y[i]
    Z.append(a)
print(sum(Z))