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())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i, j in zip(a,b):
    if i - j > 0:
        ans += i - j

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
R = lambda: map(int, input().split())
input()
print(sum(x - y for x, y in zip(R(), R()) if x > y))

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())  # ���l
v = input().split()  # �󔒋�؂�Ń��X�g��
c = input().split()  # �󔒋�؂�Ń��X�g��

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

Submission status: Accepted

Solution code:
n = int(input())
v = []
c = []

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

value=[]

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

result = 0

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

print(result)

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

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

print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = [int(m) for m in input().split()]
c = [int(m) for m 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 = sum(map(lambda i: max(v[i] - c[i], 0), range(n)))
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
s=0
for v,c in zip(V,C):
  if v >= c:
    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()))
count = 0
for i in range(N):
  count += max(0,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(' ')))
count = 0
for i, j in zip(V, C):
    result = i - j
    if result > 0:
        count += result
print(count)

Submission status: Accepted

Solution code:
import sys
from collections import Counter

n = int(input())
v_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))
t_list = []
ans = 0

for i in range(n):
    t_list.append(v_list[i] - c_list[i])

for i in t_list:
    if i < 0:
        continue
    ans += i

print(ans)

Submission status: Accepted

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

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 = [vc for vc in VC if vc>0]

print(sum(VC))

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
V_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))
diff_list = []
for i in range(len(V_list)):
    if V_list[i] - C_list[i] > 0:
        diff_list.append( V_list[i] - C_list[i])

print(sum(diff_list))

Submission status: Accepted

Solution code:
n = int(input())
v = []
c = []
tmp = input().split()
for i in range(n):
    v.append(int(tmp[i]))
tmp = input().split()
for i in range(n):
    c.append(int(tmp[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 = map(int, input().split())
C= map(int, input().split())

diff_val = []
for v, c in zip(V, C):
    diff_val.append(v - c)
ans = 0
#print(diff_val)
for d in diff_val:
    if d > 0:
        ans += d
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = [int(_) for _ in input().split()]
C = [int(_) for _ in input().split()]
ans = [i - j  for i, j in zip(V, C) if i - j > 0]

print(sum(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()]
s = 0

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

print(s)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
N = int(input())
V_array = list(map(int, input().split()))
C_array = list(map(int, input().split()))
# print(V_array, C_array)

ans = 0
for v, c in zip(V_array, C_array):
    ans += max(v - c, 0)
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v_data = list(map(int,input().split()))
c_data = list(map(int,input().split()))
res = 0

for i in range(n):
  if v_data[i] - c_data[i] > 0:
    res += v_data[i] - c_data[i]
print(res)

Submission status: Accepted

Solution code:
import sys
input = sys.stdin.readline
n = int(input())
v = input().split()
c = input().split()
s = []
for i in range(n):
    v[i] = int(v[i])
    c[i] = int(c[i])
    s.append(v[i] - c[i])
s.sort(reverse=True)
l = 0
sum = 0
while (l < n and s[l] > 0):
    sum += s[l]
    l += 1
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()))
saidai = 0
for i in range(n):
  if v[i]-c[i]>0:
    saidai += v[i]-c[i]
print(saidai)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

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:
# -*- coding: utf-8 -*-
n = int(input())

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

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

count = 0

for k in kati:
    if k>0: count += k

print(count)

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

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

Submission status: Accepted

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

Submission status: Accepted

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N=INT()
V=LIST()
C=LIST()

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

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

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(0,N):
  if V[i]>C[i]:
    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()))

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

print(total)

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

x = 0
y = 0

ans = 0

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

    if xx > 0:
        ans += xx


print(ans)

Submission status: Accepted

Solution code:
N = int(input())
vs = list(map(int, input().split()))
cs =  list(map(int, input().split()))
m =[(v-c) for v,c in zip(vs, cs)]
ans = 0
for i in m:
    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()))
X = []
for i in range(N):
  X.append(V[i]-C[i])
#print(X)
s = 0
for i in range(N):
  if X[i] > 0:
    s += X[i]
print(s)

Submission status: Accepted

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



ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))
VC_list = sorted([v-c for v, c in zip(V_list, C_list)], reverse=True)
res = 0
for i in VC_list:
    if i > 0:
        res += i
    else:
        break
print(res)

Submission status: Accepted

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


value = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
# gcd
# from fractions import gcd
# 切り上げ，切り捨て
# from math import ceil, floor
# リストの真のコピー（変更が伝播しない）
# from copy import deepcopy
# 累積和。list(accumulate(A))としてAの累積和
# from itertools import accumulate
# l = ['a', 'b', 'b', 'c', 'b', 'a', 'c', 'c', 'b', 'c', 'b', 'a']
# S = Counter(l)  # カウンタークラスが作られる。S=Counter({'b': 5, 'c': 4, 'a': 3})
# print(S.most_common(2))  # [('b', 5), ('c', 4)]
# print(S.keys())  # dict_keys(['a', 'b', 'c'])
# print(S.values())  # dict_values([3, 5, 4])
# print(S.items())  # dict_items([('a', 3), ('b', 5), ('c', 4)])
# from collections import Counter
#
# input関係の定義
input = sys.stdin.readline
def ii(): return int(input())
def mi(): return map(int, input().rstrip().split())
def lmi(): return list(map(int, input().rstrip().split()))
def li(): return list(input().rstrip())
# template


N = ii()
V = lmi()
C = lmi()
good = [V[i] - C[i] for i in range(N)]
good.sort()

cnt = 0
for i in range(N):
    if good[i] >= 0:
        cnt += good[i]

print(cnt)

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

Submission status: Accepted

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

  res = 0
  for v, c in zip(vs, cs):
    if v - c > 0:
      res += v - c
  return res
  
print(vc())

Submission status: Accepted

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

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

print(out)

Submission status: Accepted

Solution code:
n = int(input())
ans = 0
list1 = list(map(int,input().split()))
list2 = list(map(int,input().split()))
for i in range(len(list1)):
    if(list1[i] - list2[i]>=0):
        ans += list1[i] - list2[i]
print(ans)

Submission status: Accepted

Solution code:
from sys import stdin

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

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

input = lambda: stdin.readline()
main()

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np

N = int(input())
v = input().split()
c = input().split()
a = 0
for i in range(N):
    d = int(v[i])-int(c[i])
    if d>0:
        a += d


print(a)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
_ = int(input())

prices = list(input().split())
costs = list(input().split())

benefit = 0
for price, cost in zip(prices, costs):
  if int(price) > int(cost):
    benefit += int(price) - int(cost)
    
print(benefit)

Submission status: Accepted

Solution code:
import sys,collections as cl
Max = sys.maxsize
def l():
	return list(map(int,input.split()))
def m():
	return map(int,input().split())
def s(x):
	a = []
	aa = x[i]
	su = 1
	for i in range(len(x)-1):
		if aa == x[i+1]:
			a.append([aa,su])
			aa = x[i+1]
			su = 1
		else:
			su += 1
	a.append([aa,su])
	return a

n = int(input())

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

print(su)

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

Submission status: Accepted

Solution code:
def main():
    input = sys.stdin.readline
    try:
        n = int(input())
        v = list(map(int, input().split()))
        c = list(map(int, input().split()))
        arr = [v[i] - c[i] for i in range(n) if v[i] - c[i] > 0]
        print(sum(arr))
        

    finally:
        input = None

import sys; sys.setrecursionlimit(50000)
if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# AtCoder Beginner Contest 125
# https://atcoder.jp/contests/abc125
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline() for _ in range(n)]
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main(N, Vn, Cn):
    XYmax = 0
    for i in range(N):
        xyi = Vn[i] - Cn[i]
        if xyi > 0:
            XYmax += xyi
    print(XYmax)

N = i2n()
Vn = i2nn()
Cn = i2nn()
main(N, Vn, Cn)

Submission status: Accepted

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

P = sorted(P)[::-1]
i,ans = 0,0

while P[i] > 0:
    ans += P[i]
    i += 1
    if i == N:
        break
print(ans)

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

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:
if __name__ == '__main__':
    n = int(input())
    values = list(map(int, input().split()))
    costs = list(map(int, input().split()))
    ans = 0
    for i in range(n):
        if values[i] - costs[i] > 0:
            ans += (values[i] - costs[i])

    print(ans)

Submission status: Accepted

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

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

print(m)

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(len(V)):
  c=V[i]-C[i]
  ans+=max(c,0)

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-c for v,c in zip(V,C) if v-c > 0])
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import math

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

i = 0
sum = 0

while i < n:
  diff = v_list[i] - c_list[i]
  if diff > 0:
    sum += diff
  i+=1 
  
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 C[i] < V[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:
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):
    p = V[i] -C[i]
    if p > 0:
        ans += p
print(ans)

Submission status: Accepted

Solution code:
#coding: utf-8
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for v, c in zip(V, C):
    if v > c:
        ans += v-c
print(ans)

Submission status: Accepted

Solution code:
def main():
    N = int(input())
    V = [int(n) for n in input().split()]
    C = [int(n) for n in input().split()]
    VC = [0]*N
    for i in range(N):
        VC[i] = V[i] - C[i]
    res = 0
    for v in VC:
        if v > 0:
            res += v
    print(res)
main()

Submission status: Accepted

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

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

Submission status: Accepted

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

print(sum(max(v - c, 0) for v, c in zip(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 V[i] - C[i] > 0:
        a.append(V[i] - C[i])

print(sum(a))

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(raw_input())

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

X_Y = 0

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

print '{}'.format(X_Y)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# 2019/04/27
# AtCoder Beginner Contest 125 - B

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

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

# Output
print(psum)

Submission status: Accepted

Solution code:
def main():
    n = int(input())
    v = list(map(int, input().rstrip().split(' ')))
    c = list(map(int, input().rstrip().split(' ')))
    print(sum([vi - ci for vi, ci in zip(v, c) if vi - ci > 0]))


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

print(ans)

Submission status: Accepted

Solution code:
#https://atcoder.jp/contests/abc125/tasks/abc125_b

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)
t=0
for i in range(len(vc)):
    if vc[i] > 0:
        t += vc[i]
print(t)

Submission status: Accepted

Solution code:
#
import sys
import math
import numpy as np
import itertools


# ひとつ入力
n = int(input())
# リストに入れる
v = [int(i) for i in input().split()] 
# リストに入れる
c = [int(i) for i in input().split()] 
answer = 0
for i in range(n):
    if(v[i]-c[i] > 0):
        answer += (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()))
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())
#S=input()
#A,B,T=map(int,input().split())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
P=[V[i]-C[i] for i in range(N)]
ans=0
for i in P:
    if i>0:
        ans+=i
print(ans)

Submission status: Accepted

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

sum=0
for v_v,c_c in zip(v,c):
    if v_v-c_c>0:
        sum+=v_v-c_c
print(sum)

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

Submission status: Accepted

Solution code:
n = int(input())

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

def dfs(s, i=n - 1):
    if i < 0:
        return s
    return max(dfs(s + v[i] - c[i], i - 1), dfs(s, i - 1))

print(dfs(0))

Submission status: Accepted

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

VC = zip(V, C)
summ = 0
for vc in VC:
    a = vc[0] - vc[1]
    if a > 0:
        summ += a
print(summ)

Submission status: Accepted

Solution code:
A = map(int,input().split(' '))
Vs = list(map(int,input().split(' ')))
Cs = list(map(int,input().split(' ')))

m = 0

for V,C in zip(Vs,Cs):
	if(V > C):
		m = m + V - C
	else:
		pass

print(m)

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

import numpy as np

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

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

Submission status: Accepted

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

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:
#!/usr/bin/env python3


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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
#B
import numpy as np
import math
import re

n = int(input())

x = input()
y = input()
x = re.split(" ",x)
y = re.split(" ",y)
sum = 0
for i in range(n):
    if(( int(x[i]) - int(y[i]) )> 0):
        sum +=  int(x[i]) - int(y[i])
print(sum)

Submission status: Accepted

Solution code:
n=int(input())
values = [ int(s) for s in input().split(" ") ]
costs = [ int(s) for s in input().split(" ") ]

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
Vlist = list(map(int,input().split()))
Clist = list(map(int,input().split()))
pro = [ v-c if v-c >=0 else 0 for v,c in zip(Vlist, Clist)]
print(sum(pro))

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()))
value = [v - c for (v, c) in zip(V, C)]
value.append(0)
value.sort(reverse=True)
print(sum(value[:value.index(0)]))

Submission status: Accepted

Solution code:
N = int(input())
Str_V = input()
Str_C = input()
V = [0]*N
C = [0]*N
V = Str_V.split(" ")
C = Str_C.split(" ")
ans = 0

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

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

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