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:
x = 0
y= 0
n = input()
v = list(map(int, input().split()))
c = list(map(int, input().split()))
for (vv,cc) in zip(v,c):
    if cc < vv:
        x+=vv
        y+=cc
print(x-y)

Submission status: Accepted

Solution code:
from sys import stdin

list_N = [int(x) for x in stdin.readline().rstrip().split()]
list_V = [int(x) for x in stdin.readline().rstrip().split()]
list_C = [int(x) for x in stdin.readline().rstrip().split()]

XsubY=0
for i in range(0, list_N[0]):
    sub = list_V[i] - list_C[i]
    if(sub>0):
        XsubY += sub

print(XsubY)

Submission status: Accepted

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

value = 0
cost = 0

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

print(value - cost)

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

Submission status: Accepted

Solution code:
n=input()
def ina():
  return map(int,raw_input().split())
a=ina()
b=ina()
c=0
for i in range(n):
  if a[i]>b[i]:
  	c+=a[i]-b[i]
print c

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
V=[]
C=[]

ans=0
N=0
i=0
N=int(input())

li = input().split()

while(i<N):
    V.append(int(li[i]))
    i=i+1

i=0
li2=0
li2=input().split()

while(i<N):
    C.append(int(li2[i]))
    i = i+1
    
i=0

while(i<N):
    if(V[i]>C[i]):
        ans = ans + V[i] - C[i]
    i = i+1

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
n=int(input())
lv=list(map(int,input().split()))
lc=list(map(int,input().split()))

cnt=0

for i in range(n):
    if lv[i]-lc[i]>0:
        cnt+=lv[i]-lc[i]
print(cnt)

Submission status: Accepted

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

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

print(sum)

Submission status: Accepted

Solution code:
n = int(input())
values = [int(i) for i in input().split()]
costs = [int(i) for i in input().split()]
result = 0

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

print(result)

Submission status: Accepted

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

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = input()
x = list(map(int, input().split()))
y = list(map(int, input().split()))
sum_ = 0

for i in range(len(x)):
    z = x[i] - y[i]
    if z > 0:
        sum_ += z 

print(sum_)

Submission status: Accepted

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

max_value = 0

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def sub():
    N, Vs, Cs = [input() for _ in range(3)]
    N = int(N)
    Vs = [int(e) for e in Vs.split(" ")]
    Cs = [int(e) for e in Cs.split(" ")]
    ds = [v - c for v, c in zip(Vs, Cs)]
    ds = [d for d in ds if d > 0]
    print(sum(ds))


sub()

Submission status: Accepted

Solution code:
N=int(input())
Vs=str(input())
Cs=str(input())
ListV=Vs.split()
ListC=Cs.split()
for i in range(0,len(ListV),1):
  a=ListV.pop(0)
  ListV.append(int(a))

for i in range(0,len(ListC),1):
  b=ListC.pop(0)
  ListC.append(int(b))

ListI=[]
for i in range(0,len(ListV),1):
  c=ListV[i]-ListC[i]
  ListI.append(c)

Ans=0
for i in range(0,len(ListI),1):
  if ListI[i]>0:
    Ans+=ListI[i]

print(Ans)

Submission status: Accepted

Solution code:

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

    print(algorithm(N, V, C))


def algorithm(N, V, C):
    indices = list(filter(lambda i: V[i] - C[i] > 0, list(range(0, N))))

    sum = 0
    for i in indices:
        sum += V[i] - C[i]
    return sum

problem()

Submission status: Accepted

Solution code:
#-*- coding:utf-8 -*-
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]))

Submission status: Accepted

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

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

print(total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = 0
V = []
C = []
 
i = 0
ans = 0

str = input()
N = int(str)
 
str = input().split()
while i < N:
  V.append(int(str[i]))
  i = i+1
  
i=0
str = 0
str = input().split()
while i < N:
  C.append(int(str[i]))
  i = i+1

i=0
while i<N:
  if V[i] > C[i]:
    ans = ans + V[i] - C[i]
  i = i+1
    
    
print(ans)

Submission status: Accepted

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

print(count)

Submission status: Accepted

Solution code:
n = input()

v = input()
v = v.split(' ')
v = [int(a) for a in v]

c = input()
c = c.split(' ')
c = [int(a) for a in c]

r = 0
for value, cost in zip(v, c):
    profit = value - cost
    if profit > 0:
        r += profit

print(r)

Submission status: Accepted

Solution code:
n = int(input())
values = [ int(x) for x in input().split() ]
cost = [ int(x) for x in input().split() ]
profit_list = [ values[i] - cost[i] for i in range(n) if values[i] > cost[i] ]
print(sum(profit_list))

Submission status: Accepted

Solution code:
N=int(input())
V = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
point = 0
for n in range(N):
    temp = V[n] - C[n]
    if temp > 0:
        point+=temp

print(point)

Submission status: Accepted

Solution code:
import itertools

n = int(input())

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

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

max_cost = 0

for i in range(1,n+1):
    for v in itertools.combinations(cost,i):
        m_cost = 0
        for c in v:
            m_cost = m_cost + c
        if max_cost < m_cost:
            max_cost = m_cost


print(max_cost)

Submission status: Accepted

Solution code:
n = int(input())
vList = list(map(int, input().split()))
cList = list(map(int, input().split()))

# print(n)
# print(vList)
# print(cList)

vSum = 0
cSum = 0

for i in range(n):
	if vList[i] > cList[i]:
		vSum += vList[i]
		cSum += cList[i]

print(vSum - cSum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np

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

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

Submission status: Accepted

Solution code:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
def rescale(V,C):
  price=0
  for v,c in zip(V,C):
    if v>c:
      price=price+v-c
  return price 
print("{}".format(rescale(V,C)))

Submission status: Accepted

Solution code:
N = int(input())

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

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

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

Submission status: Accepted

Solution code:
inputCount = int(input())
inputValue = list(map(int, input().split()))
inputCost  = list(map(int, input().split()))
answer = 0

for num in range(0,inputCount):
    stock = inputValue[num] - inputCost[num]
    if stock > 0:
        answer += stock

print(answer)

Submission status: Accepted

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

est = 0

for a in range(n) :
    x = v[a] - c[a]
    if x > 0 :
        est += x

print(est)

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

Submission status: Accepted

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


def solve(N: int, V: "List[int]", C: "List[int]"):

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

    print(total)


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    V = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    C = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, V, C)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
import heapq

n = input()
v = input()
v = v.split()
c = input()
c = c.split()

VSubC = []

for index in range(int(n)):
  heapq.heappush(VSubC, -(int(v[index]) - int(c[index])))

answer = 0
while(len(VSubC) > 0):
  item = heapq.heappop(VSubC)
  if (item < 0):
    answer -= item
  else:
    break

print(answer)

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = 0
for i in range(n):
    ans += max(vs[i]-cs[i],0)
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 v,c in zip(V,C):
  if (v-c)>0:
    sum+=v-c
print(sum)

Submission status: Accepted

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

# V_i > C_iなら選ぶ

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

Submission status: Accepted

Solution code:
N = input()

vs = [int(x) for x in input().split()]
cs = [int(x) for x in input().split()]

m = sum([v-c for v,c in zip(vs,cs) if v-c > 0])
print(m)

Submission status: Accepted

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

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

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

print(Ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding utf-8 -*-
N = int(input())
VN = list(map(int, input().split()))
CN = list(map(int, input().split()))

ans = 0
for i in range(N):
    ans += max(0, VN[i] - CN[i])
print(ans)

Submission status: Accepted

Solution code:
import sys

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def II(): return int(sys.stdin.readline())

N = II()
V_li = LI()
C_li = LI()

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

print(result)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(N):
    if V[i] <= C[i]:
        continue
    Max = Max + V[i] - C[i]
print(Max)

Submission status: Accepted

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

for i in range(N):
    if V[i] <= C[i]:
        continue
    X,Y = V[i],C[i]
    tmpMax = X - Y
    for j in range(i+1,N):
        if V[j] <= C[j]:
            continue
        if Max < (X + V[j]) - (Y + C[j]):
            X = X + V[j]
            Y = Y + C[j]
            tmpMax = X - Y
    if Max < tmpMax:
        Max = tmpMax
        
print(Max)

Submission status: Accepted

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

#先頭
for i in range(N):
    if V[i] <= C[i]:
        continue
    X,Y = V[i],C[i]
    tmpMax = X - Y
    for j in range(i+1,N):
        if V[j] <= C[j]:
            continue
        if Max < (X + V[j]) - (Y + C[j]):
            X = X + V[j]
            Y = Y + C[j]
            tmpMax = X - Y
    if Max < tmpMax:
        Max = tmpMax
        
print(Max)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# coding:UTF-8

# 入力される宝石の数を取得
jewel_count = int(input())

# 宝石の価値を取得
jewels_value = input().split()

# 宝石の値段を取得
jewels_cost = input().split()

# 最大値計算用の領域を初期化
max_value = 0

# 価値 - 値段がプラスになるもののみを足し込んでいく
for i in range(jewel_count):
    # 価値 - 値段 の差異を取得
    difference_num = int(jewels_value[i]) - int(jewels_cost[i])

    # 差異が０でなければ、最大値計算の対象とする
    if (difference_num > 0):
        max_value += difference_num

print(max_value)

Submission status: Accepted

Solution code:
import sys

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Coding: Utf-8

N = int(input())
a=b=count=0

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

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

Submission status: Accepted

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

s = []
for i, j in zip(v, p):
    if i - j > 0:
        s.append(i-j)

print(sum(s))

Submission status: Accepted

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

Submission status: Accepted

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


i = 0
total = 0

while i < n:
    if v[i] > c[i]:
        total = total + (v[i]-c[i])
    i = i + 1
print(total)

Submission status: Accepted

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

a = []

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

Submission status: Accepted

Solution code:
N = int(input())
list_V = list(map(int, input().split()))
list_C = list(map(int, input().split()))
ans = 0
for i in range(N):
    currentValue = list_V[i] - list_C[i] 
    if currentValue > 0: 
        ans += currentValue 
print(int(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(input().split())
C = list(input().split())
D = 0
for i in range(N):
    A = int(V[i])-int(C[i])
    if A>0:
        D += A
print(D)

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int, input().split()))
c=list(map(int, input().split()))
vc=[(v[i],c[i]) for i in range(n)]
vc=sorted(vc,key=lambda x:(x[0],x[1]))[::-1]
x=0
y=0
ans=0
for i in range(n):
    temp_x = x+vc[i][0]
    temp_y = y+vc[i][1]
    if ans<temp_x-temp_y:
        ans=temp_x-temp_y
        x+=vc[i][0]
        y+=vc[i][1]
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
v = list(int(x) for x in input().split())
c = list(int(x) for x in input().split())
max = 0

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

print(max)

Submission status: Accepted

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

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

print(answer)

Submission status: Accepted

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

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N=int(raw_input())

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

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

print count

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest 125
# B - Resale

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

# zip() : 組み込み関数
# V,Cから一つずつ取り出して順にv,cに入れる

# まず利益がマイナスになるものを除外
prof = [v-c for v, c in zip(V,C) if v-c > 0]

# 全部買う
print(int(sum(prof)))

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    v = [int(i) for i in input().split()]
    c = [int(i) for i in input().split()]
    ans = 0
    for i in range(n):
        if v[i]-c[i] > 0:
            ans += v[i]-c[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()))
a = 0
for v, c in zip(V, C):
    t = v - c
    if v - c > 0:
        a += t
print(a)

Submission status: Accepted

Solution code:
N=input()
list1= [int(i) for i in input().split()]
list2 = [int(i) for i in input().split()]
list3= [x - y for (x, y) in zip(list1, list2)]
replace= [0 if i < 0 else i for i in list3]
print(sum(replace))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
vc=[]
ans=0

for i,j in zip(input().split(),input().split()):
    vc.append([int(i),int(j)])

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

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
hoge=list(map(int,input().split()))
huga=list(map(int,input().split()))
ans=0
for i in range(n):
  ans+=max(0,hoge[i]-huga[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()))
cost=[0]*N
for i in range(N):
  cost[i]=V[i]-C[i]
ans=0
for i in range(N):
  if cost[i]>0:
    ans+=cost[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):
    profit = v[i] - c[i]
    if profit > 0:
        ans += profit

print(ans)

Submission status: Accepted

Solution code:
a = int(input())
b = list(input().split())
c = list(input().split())
sa = 0


for i in range(a):
  if int(b[i]) > int(c[i]):
    sa = sa + int(b[i]) - int(c[i])
  else:
    pass
  
print(sa)

Submission status: Accepted

Solution code:
Number = int(input())
tresure_value = list(map(int , input().split()))
cost = list(map(int , input().split()))
cnt = 0
 
for i in range(len(tresure_value)):
  benefit = tresure_value[i] - cost[i]
  if benefit  > 0:
    cnt = cnt + benefit 
    
print(cnt)

Submission status: Accepted

Solution code:
N = int(input())
Vlist = list(map(int, input().split()))
Clist = list(map(int, input().split()))

X = 0
Y = 0
for i in range(N):
    if Vlist[i] > Clist[i]:
        X += Vlist[i]
        Y += Clist[i]
print(X - Y)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin


def main():
    _ = int(stdin.readline().rstrip())
    Vs = [int(x) for x in stdin.readline().rstrip().split()]
    Cs = [int(x) for x in stdin.readline().rstrip().split()]
    VCs = [x[0] - x[1] for x in zip(Vs, Cs) if x[0] > x[1]]
    print(sum(VCs))


if __name__ == "__main__":
    main()

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

Submission status: Accepted

Solution code:
N = int(input())
V_str = input().split()
C_str = input().split()

V = list(int(n) for n in V_str)
C = list(int(n) for n in C_str)

val = []
for i in range(len(V)):
  val.append(V[i] - C[i])

positive = []
for n in val :
  if n > 0:
    positive.append(n)
  else:
    next

ans = 0
for k in positive :
  ans += k
  
print(ans)

Submission status: Accepted

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

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

kei = 0

for val in sa:
    if val > 0:
        kei += val

print(kei)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
B - Resale
https://atcoder.jp/contests/abc125/tasks/abc125_b

"""
import sys


def solve(values, costs):
    return sum([v - c for v, c in zip(values, costs) if v > c])


def main(args):
    _ = int(input())
    values = [int(v) for v in input().split()]
    costs = [int(c) for c in input().split()]
    ans = solve(values, costs)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])

Submission status: Accepted

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

print(sum([ Vn[i]-Cn[i] for i in range(N) if Vn[i]-Cn[i] > 0 ]))

Submission status: Accepted

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

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

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

print(gain)

Submission status: Accepted

Solution code:
n = int(input())
values = list(map(int, input().split()))
costs = list(map(int, input().split()))
maxvalue = sum([value - cost for value, cost in zip(values, costs) if value - cost > 0])
print(maxvalue)

Submission status: Accepted

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

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

print(total)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
#入力
n = int(input())
v = [i for i in map(int, input().split())]
c = [i for i in map(int, input().split())]
#コストが大きい石は取らない
lst = []
buy = []
for i in range(n):
    lst.append(v[i]-c[i])
    if lst[i] > 0:
        buy.append(lst[i])
print(sum(buy))

Submission status: Accepted

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

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 += V[i] - C[i] if V[i] > C[i] else 0

print(ans)

Submission status: Accepted

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

if not A:
    print(0)
else:
    print(sum(A))

Submission status: Accepted

Solution code:
import math

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
m = a[0]
k = b[0]
for i in range(n):
    if a[i] >b[i] :
        ans += a[i]-b[i]
print(ans)

Submission status: Accepted

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

v_list = v - c
v_list = np.array(sorted(v_list, reverse=True))

ans = sum(v_list[v_list > 0])
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Spyderエディタ

これは一時的なスクリプトファイルです
"""
n = int(input())

v = [0] * n
c = [0] * n

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

ans = []

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