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(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
for v, c in zip(V,C):
   if(v-c) > 0:
      ans += v-c
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

s = 0

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

print(s)

Submission status: Accepted

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

def main():
    N=int(input())
    Values =  [int(s) for s in input().split()]
    Costs =  [int(s) for s in input().split()]
    result = 0
    for i in range(N):
        value = Values[i]
        cost = Costs[i]
        if value > cost:
            result += (value - cost)
    print(result)

if __name__ == "__main__":
    main()

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

Submission status: Accepted

Solution code:
n=int(input())
v=input()
d=input()
v=v.split()
d=d.split()
for i in range(n):
    v[i]=int(v[i])
    d[i]=int(d[i])
ans=0
for j in range(n):
   if v[j]-d[j]>0:
     ans=ans+v[j]-d[j]
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()]
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()))

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

print(int(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]:
    A.append(V[i]-C[i])
print(sum(A))

Submission status: Accepted

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

XY = 0

for i in range(0,N):
	if Vlist[i] >= Clist[i]:
		XY += Vlist[i] - Clist[i]

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

Submission status: Accepted

Solution code:
N = int(input())
Value = [[0 for i in range(N)] for j in range(2)]
Value = input().split()
Cost = input().split()
v = []
c = []
ac = 0
av = 0
best = []
wra = []
for i in range(N):
    v.append(int(Value[i]))
    c.append(int(Cost[i]))
    pass

for i in range(N):
    if c[i] < v[i]:
        best.append(v[i])
        wra.append(c[i])
print(sum(best) - sum(wra))

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

# In[1]:


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


# In[2]:


answer = 0

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

Submission status: Accepted

Solution code:
n = int(input())
v_L = list(map(int,input().split()))
c_L = list(map(int,input().split()))


ans = 0
for val in range(len(v_L)):
    if v_L[val] - c_L[val] >= 0:
        ans += v_L[val] - c_L[val]

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
aa=list(map(int,input().split()))
bb=list(map(int,input().split()))
ans=0
for a,b in zip(aa,bb):
  if a-b>0:
    ans+=a-b
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
from sys import stdin

n = int(stdin.readline().rstrip())
v = list(map(int,stdin.readline().rstrip().split()))
c = list(map(int,stdin.readline().rstrip().split()))
li = []
for i in range(n):
    if v[i] -c[i] > 0:
        li.append(v[i]-c[i])
li.sort()
print(sum(li))

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(v[i]-c[i],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 x,y in zip(v,c):
    if x-y>0:
        ans+=x-y
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] >= 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()))
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
input=sys.stdin.readline

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

def z(n):
    return V[n]-C[n]

for i in range(N):
    if z(i)>0:
        Z.append(z(i))

ans=sum(Z)
print(ans)

Submission status: Accepted

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

lista=[]

for i in range(n):
	a=listv[i]-listc[i]
	if a<0:
		a=0
	lista.append(a)
	
print(sum(lista))

Submission status: Accepted

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

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

print(sum(D))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
num = int(input())
value = [int(s) for s in input().split()]
cost = list(map(int, input().split()))

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

Submission status: Accepted

Solution code:
num = int(input())
value = [int(s) for s in input().split()]
cost = list(map(int,input().split()))
point = 0
for i in range(num):
  if value[i] > cost[i]:
    point += value[i] - cost[i]
    
print(point)

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 += max(v[i] - c[i], 0)

print(xy)

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

Submission status: Accepted

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

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

i = 0
a = 0

for i in range(A):
    if V[i]-C[i]>0:
        a=a+V[i]-C[i]
        
print(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()]
ans = 0
for i in range(n):
    # v-c > 0 を取得
    point = v[i]-c[i]
    if(point > 0):
        ans += point
        
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = sum([a-b if a-b>=0 else 0 for a,b in zip(V, C)])
print(ans)

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

Submission status: Accepted

Solution code:
#ABC125B
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()))
max_box = [0]*n
for i in range(n):
  max_box[i] = v[i]-c[i]
max_box.sort()
ans = 0
for i in range(n):
  ans += max_box[i] if max_box[i]>0 else 0
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()]
print(sum(v[i]-c[i] for i in range(n) if v[i]-c[i] > 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(N):
    ans+=max(V[i]-C[i],0)

print(ans)

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
x=[i-j for i,j in zip(v,c)]
print(sum([i for i in x if i>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(n):
  if v[i]-c[i]>0:
    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()]
n=0
for j in range(N):
   k=V[j]-C[j]
   if k>0:
      n+=k
print(n)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
def slove():
    import sys
    input = sys.stdin.readline
    n = int(input().rstrip('\n'))
    v = list(map(int, input().rstrip('\n').split()))
    c = list(map(int, input().rstrip('\n').split()))
    t = 0
    for i in range(n):
        if v[i] - c[i] > 0:
            t += (v[i] - c[i])
    print(t)


if __name__ == '__main__':
    slove()

Submission status: Accepted

Solution code:
import sys
import numpy as np
N = int(input())
V = np.array([int(v) for v in sys.stdin.readline().split()])
C = np.array([int(v) for v in sys.stdin.readline().split()])

diff = V - C
a = diff[diff > 0]

print(np.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()]

counter = 0
for a, b in zip(v, c):
    if a > b:
        counter += a - b
print(counter)

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 = [int(_) for _ in input().split()]
c = [int(_) for _ in input().split()]
s =[]
for i in range(n):
  a = v[i] -c[i]
  if a >0:
    s.append(a)
print(sum(s))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N = int(input())
    VS = list(map(int, input().split()))
    CS = list(map(int, input().split()))

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

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n=int(input())
ls1=[int(s) for s in input().split()]
ls2=[int(s) for s in input().split()]
x=0
for i in range(n):
  x+=max([ls1[i]-ls2[i],0])
print(x)

Submission status: Accepted

Solution code:
input()
V = list(map(int,input().split()))
C = list(map(int,input().split()))
ans = 0
for v, c in zip(V, C):
  ans += max(v-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=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()))
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
input = sys.stdin.readline

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

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

    print(ans)



if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
L1 = list(map(int,input().split()))
L2 = list(map(int,input().split()))

ac = 0 
for i in range(n):
      if L1[i] > L2[i]:
            ac += L1[i] - L2[i]

print(ac)

Submission status: Accepted

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

n = input()

v = map(int, raw_input().split())
c = map(int, raw_input().split())

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

print ans

Submission status: Accepted

Solution code:
n = int(input())
v_li = list(map(int,input().split()))
c_li = list(map(int,input().split()))
ben = []
for i in range(n):
  b = v_li[i]-c_li[i]
  ben.append(b)
ben.sort()
ben.reverse()
ans = 0
for i in range(n):
  if ben[i] >0:
    ans+=ben[i]
  else:
    break
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v_src = list(map(int, input().split()))
c_src = list(map(int, input().split()))
count = 0
for v,c in zip(v_src,c_src):
    if v-c>0:
        count += v-c
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 = list(map(int, input().split()))
C = list(map(int, 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()))

benefit = []


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

print(sum)

Submission status: Accepted

Solution code:
import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)
    def test_入力例_1(self):
        input = """3
10 2 5
6 3 4"""
        output = """5"""
        self.assertIO(input, output)
    def test_入力例_2(self):
        input = """4
13 21 6 19
11 30 6 15"""
        output = """6"""
        self.assertIO(input, output)
    def test_入力例_3(self):
        input = """1
1
50"""
        output = """0"""
        self.assertIO(input, output)
def resolve():
    N=int(input())
    A=[int(i) for i in input().split()]
    B=[int(i) for i in input().split()]
    print(sum([max(A[i]-B[i],0) for i in range(N)]))

if __name__ == "__main__":
    resolve()

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

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

V_C = zip(V, C)
ans = 0

for x in V_C:
    diff = x[0] - x[1]
    ans += diff if diff >= 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):
    d = v[i] - c[i]
    if 0 < d:
        ans += d
print(int(ans))

Submission status: Accepted

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

plus_jewel = list(filter(lambda x: x[0] - x[1] > 0, zip(v, c)))

print(sum(map(lambda x: x[0] - x[1], plus_jewel)))

Submission status: Accepted

Solution code:
n = int(input())
lst_v = list(map(int,input().split()))
lst_c = list(map(int,input().split()))
ans = 0
for i in range(n):
    if lst_v[i] > lst_c[i]:
        ans += lst_v[i] - lst_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):
    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()))
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:
def solve():
    n = int(input())
    V = map(int, input().split())
    C = map(int, input().split())
    P = [v-c for v,c in zip(V,C) if v>c]
    return sum(P)
    
if __name__ == '__main__':
    print(solve())

Submission status: Accepted

Solution code:
def solve():
    n = int(input())
    V = map(int, input().split())
    C = map(int, input().split())
    l = [v-c for v,c in zip(V,C) if v-c > 0]
    return sum(l)

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

Submission status: Accepted

Solution code:
N = int(input())
V = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
curr_max = 0
for i in range(len(V)):
    temp = curr_max + V[i] - C[i]
    curr_max = max(curr_max, temp)
print(curr_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(N):
    x=V[i]-C[i]
    if x > 0:
        ans += x
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
Z = [x-y for x, y in zip(V, C) if x-y > 0]
print(sum(Z))

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

Submission status: Accepted

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

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]
  if t > 0:
      ans += t

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = [int(v) for v in input().split()]
C = [int(c) for c 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:
num = int(input())
value = input().split()
cost = input().split()

value, cost = [int(i) for i in value], [int(i) for i in cost]

ans_arr = sorted([value[i]-cost[i] for i in range(num)])[::-1]
ans = 0
for i in ans_arr:
  if i>0:
    ans += i

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
for i in range(n):
    xy = vl[i] - cl[i]
    if xy >= 0:
        ans = ans + xy

print(ans)

Submission status: Accepted

Solution code:
# ABC125b
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

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

Submission status: Accepted

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

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(0,N):
  if V[i]>=C[i]:
    a.append(V[i]-C[i])
  else:
    continue
print(sum(a))

Submission status: Accepted

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

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
count = 0
for i in range(n):
    benefit = v[i] - c[i]
    if benefit > 0:
        count += benefit
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] > 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(' ')))

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

profit = [x - y for (x, y) in zip(V, C)]

res = 0

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

print(res)

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

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

sum_xy = 0

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

Submission status: Accepted

Solution code:
import math

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


sum_value = 0
sum_cost = 0

for i in range(N):

    if V[i] > C[i]:
        sum_value += V[i]
        sum_cost += C[i]

print(sum_value - sum_cost)

Submission status: Accepted

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

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

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(1,n+1):
  diff = v[i-1] - c[i-1]
  if diff > 0:
    ans.append(diff)
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()]

ans = 0
for v, c in zip(V, C):
    if v > c:
        ans += v - c
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:
n = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))

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

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

print(sum)

Submission status: Accepted

Solution code:
n = int(input())
values = list(map(int,input().split()))
costs = list(map(int,input().split()))
d=[]
for i in range(n):
    d.append(values[i]-costs[i])
d.sort(reverse=True)

ans =0 
for e in d:
    if e>0:
        ans += e
    else:break
print(ans)

Submission status: Accepted

Solution code:
N=int(input())
List_v=list(map(int,input().split()))
List_c=list(map(int,input().split()))
List_m=[]
for i in range (N):
    List_m.append(List_v[i]-List_c[i])
count=0
for j in range(N):
    if List_m[j]>=0:
      count+=List_m[j]
print(count)

Submission status: Accepted

Solution code:
n = int(input())
value = list(map(int, input().split()))
cost = list(map(int, input().split()))

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

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 _v,_c in zip(v,c):
    if _v < _c:
        continue
    ans+=_v-_c

print(ans)

Submission status: Accepted

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