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_str = input()
n = int(n_str)
v_str = input().split()
c_str = input().split()
v = []
c = []
for i in range(n):
    v.append(int(v_str[i]))
    c.append(int(c_str[i]))
total = 0
for i in range(n):
    if v[i] > c[i]:
        total += v[i] - c[i]
print(total)

Submission status: Accepted

Solution code:
input()
V,C = [[int(x) for x in input().split(" ")] for _ in range(2)]
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=input().split()
C=input().split()
V=[int(i) for i in V]
C=[int(i) for i in C]
sum=0

for i in range(N):
    if 0<V[i]-C[i]:
        sum+=V[i]-C[i]
        
if sum<0:
    print(0)
else:
    print(sum)

Submission status: Accepted

Solution code:
import numpy as np 
n = int(input())
if n  < 2:
    print(0)
    exit()
e = [[int(i) for i in input().split()] for i in range(2)]
e3 = np.array(e)
a = np.sort((e3[0] - e3[1]))
print(a[a>0].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()))

xy = 0
for x,y in zip(V, C):
	if x-y > 0:
		xy += x-y
print(xy)

Submission status: Accepted

Solution code:
N = int(input().strip())
V = [int(x) for x in input().strip().split(" ")]
C = [int(x) for x in input().strip().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):
    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:
input()

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

count = 0
for i in range(len(v)):
    if v[i] > c[i]:
        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()))

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
from sys import stdin
# import numpy as np
# import sys
# sys.setrecursionlimit(10**4)

s_in = lambda: stdin.readline()[:-1]  # s = s_in()
d_in = lambda: int(stdin.readline())  # N = d_in()
ds_in = lambda: list(map(int, stdin.readline().split()))  # List = ds_in()


N = d_in()
V_list = ds_in()
C_list = ds_in()

ans = 0
for v, c in zip(V_list, C_list):
    diff = v - c
    if diff > 0:
        ans += diff
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()))

gap = [V[i] - C[i] for i in range(N)]
ans = sum(list(filter(lambda x:x>0, gap)))
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
arr_V = input().split()
arr_C = input().split()

loss = [0] * N
ans = 0

for i in range(N):
    if int(arr_V[i]) - int(arr_C[i]) > 0:
        ans += int(arr_V[i]) - int(arr_C[i])
        
print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
# B - Resale

N = int(input())
V_n = list(map(int, input().split()))
C_n = list(map(int, input().split()))

ans = 0
dif = [0] * N

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())

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

e_list = [v-c if (v-c > 0) else 0 for v,c in zip(v_list, c_list)]

print(sum(e_list))

Submission status: Accepted

Solution code:
import numpy as np

n = int(input())

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

ans = 0

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

total = 0

for i in range(n):

  if x[i] - y [i] > 0:
    total = total + x[i] - y [i]

print(total)

Submission status: Accepted

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

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

print(ret)

Submission status: Accepted

Solution code:
#https://atcoder.jp/contests/abc125
# -*- 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):
        if v[i] > c[i]:
                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()))
sum = 0
for i in range(n):
    if v[i]-c[i]>0:
        sum=sum+v[i]-c[i]
print(sum)

Submission status: Accepted

Solution code:
N = input()
V = list(map(int,input().split())) #Value
Y = list(map(int,input().split())) #Cost (yen)
goukei = 0
for v, y in zip(V,Y): #zip関数でシーケンスの最小の値をとって、無くなるまでfor文で繰り返す.
    if(y-v >= 0):
        goukei +=0
    else:
        goukei += v-y
print(goukei)

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 = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i,j in zip(v,c):
  cospa = i - j
  if cospa > 0:
    ans += cospa
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 >= 0:
        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 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=input()
X=list(map(int,input().split(" ")))
Y=list(map(int,input().split(" ")))
s=0
for i,it in enumerate(X):
  if it>Y[i]:
    s+=it-Y[i]
print(s)

Submission status: Accepted

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

ans = 0
for x, y in zip(c, v):
    if x - y > 0:
        ans += x - y
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()))

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

Submission status: Accepted

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

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

print(outPut)

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:
from sys import exit

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

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

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

Submission status: Accepted

Solution code:
col = input().split()
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for value, cost in zip(v, c):
    if (value - cost)>0:
        ans += (value - cost)

print(ans)

Submission status: Accepted

Solution code:
_ = input()

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

result = 0

for i, price in enumerate(v):
  income = price - c[i]
  
  if income > 0:
    result += income

print(result)

Submission status: Accepted

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
N = int(input())
list1 = input().split()
list2 = input().split()
x = 0
y = 0
for i in range(N):
    x = int(list1[i]) - int(list2[i])
    if x > 0:
         y += x
print(y)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
n=int(input())
x=input().split(" ")
y=input().split(" ")
ans=0
for i in range(n):
    a=int(x[i])-int(y[i])
    if(a>0):
        ans+=a
print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
s = [x - y for (x, y) in zip(v, c)]
ret = sum([x for x in s if x > 0])
print(ret)

Submission status: Accepted

Solution code:
N = int(input())

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

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

Submission status: Accepted

Solution code:
import sys
import subprocess
import re
import datetime
import os

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 = 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()))
d = [j - C[i] for i,j in enumerate(V) if j - C[i] > 0]
if d:
    print(sum(d))
else:print(0)

Submission status: Accepted

Solution code:
N = int(input())
lst1 = [int(x) for x in input().split()]
lst2 = [int(x) for x in input().split()]
ret = 0
for x, y in zip(lst1, lst2):
    if x > y:
        ret += (x - y)
print(ret)

Submission status: Accepted

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

Submission status: Accepted

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


def solve(N: int, V: "List[int]", C: "List[int]"):
    tmp = []
    for i in range(N):
        tmp.append(V[i] - C[i])
    tmp.sort(reverse=True)
    ret = 0
    for t in tmp:
        if t > 0:
            ret += t
    print(ret)
    return


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:
N=int(input())
a,v,c=[],[],[]
v=list(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(N):
	if v[i]>c[i]:
		a.append(v[i]-c[i])
print(sum(a))

Submission status: Accepted

Solution code:
n=int(input())
v=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 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()))

worth = 0

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

print(worth)

Submission status: Accepted

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

res = 0

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

print(res)

Submission status: Accepted

Solution code:
from itertools import product
import operator
import unittest

def solution(n, v, c):

    value, cost, ans = [0, 0, 0]
    for x in product([0, 1], repeat=n):
        value = sum(map(operator.mul, v, x))
        cost = sum(map(operator.mul, c, x))
        ans = max(ans, value - cost)

    return ans

class Test(unittest.TestCase):
    def test1(self):
        self.assertEqual(solution(3, [10, 2, 5], [6, 3, 4]), 5)

if __name__ == '__main__':

    n = int(input())
    v = list(map(int, input().split()))
    c = list(map(int, input().split()))
    print(solution(n, v, c))
    
    unittest.main()

Submission status: Accepted

Solution code:
n=int(input())
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=[A[i]-B[i] for i in range(len(A))]
ans=0
for i in C:
  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()))

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

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
n = int(input())
vs = (int(i) for i in input().split())
cs = (int(i) for i in input().split())
# cost per performance
cps = [v - c for v, c in zip(vs, cs)]
max_ = sum(cp for cp in cps if cp > 0)
print(max_)

Submission status: Accepted

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

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
import math 
ni = lambda: int(ns())
na = lambda: list(map(int, input().split()))
ns = lambda: input()

N = ni()
V = na()
C = na()
#print(V,C)
def Solve(x,cnt,c,v,res):
    if(cnt>=0 and x):
        #print("cnt",cnt,"  C",C[cnt],"  v",V[cnt])
        c+=C[cnt]
        v+=V[cnt]
    if(cnt==N-1):
        res = max(v-c,res)
        #print(v-c,res)
    else:
        res = Solve(True,cnt+1,c,v,res)
        #print("ll")
        res = Solve(False,cnt+1,c,v,res)
    #print("aa",res)
    return res
ans = Solve(True,-1,0,0,0)
print(ans)

Submission status: Accepted

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

# process
profits = []
for x in range(N):
    if V[x] > C[x]:
        profits.append(V[x] - C[x])
totalProfits = sum(profits)

# output
print(totalProfits)

Submission status: Accepted

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

Submission status: Accepted

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

a = list(zip(v, c))
t = 0
for i, m in a:
  p = i - m 
  if p > 0:
    t += p

print(t)

Submission status: Accepted

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

ans = 0
for i in range(n):
    x = vList[i]
    y = cList[i]
    if (x - y) > 0:
        ans += (x - y)

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

Submission status: Accepted

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

import sys
import copy

sys.setrecursionlimit(1000000)

# input = sys.stdin.readline

# ~~~~~~~~~~~~~~~~~~~~~_(＾～＾ ｣ ∠)_~~~~~~~~~~~~~~~~~~~~~

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

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

Submission status: Accepted

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

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

print(c)

Submission status: Accepted

Solution code:
from sys import stdin

N = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(2)]

profit = [0] * N
sum_profit = 0

for i in range(N):
    profit[i] = int(data[0][i]) - int(data[1][i])
    if profit[i] > 0:
        sum_profit += profit[i]

print(sum_profit)

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

print(ans)

Submission status: Accepted

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


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

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

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

print(sum)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N = int(input())
Vlis = list(map(int, input().split()))
Clis = list(map(int, input().split()))

res = 0

for i in range(N):
  if Vlis[i] - Clis[i] > 0:
    res += Vlis[i] - Clis[i]
    
print(res)

Submission status: Accepted

Solution code:
# /usr/bin/python
# -*- coding: utf-8 -*-
import sys
import math



N = int(input())
Vn = list(map(int, input().split()))
Cn = list(map(int, input().split()))

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

print(ans)

Submission status: Accepted

Solution code:
from numpy import*;_,a,b=[int64(i.split())for i in open(0)];c=a-b;print(sum(c[c>0]))

Submission status: Accepted

Solution code:
n=int(input())
vl = list(map(int, input().split()))
cl = list(map(int, input().split()))
dl = []
for i in range(n):
  dl.append(vl[i] - cl[i])
  #dl[i] = vl[i] - cl[i]
ct = 0
for j in range(len(dl)):
  if dl[j] > 0:
    ct += dl[j]
print(ct)

Submission status: Accepted

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

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

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

Submission status: Accepted

Solution code:
n = int(input())
vli = list(map(int,input().split()))
cli = list(map(int,input().split()))
ans = 0
for i in range(n):
  s=vli[i] - cli[i]
  if s>0:
    ans+=s
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(" ")])
 
YmX = V-C

MaxYmX = np.sum(YmX[np.where(YmX > 0)])

print(MaxYmX)

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()]
ans =0
for v,c in zip(v_list, c_list):
  d=v-c
  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()))
s = 0
for i in range(n):
  if v[i]-c[i] > 0:
    s += v[i]-c[i]
print(s)

Submission status: Accepted

Solution code:
a = int(input())
List=list(map(int,input().split()))
List2=list(map(int,input().split()))

sum=0
i=0
while i < a:
  if List[i] - List2[i] > 0:
    sum += List[i] - List2[i]
  i +=1
print(sum)

Submission status: Accepted

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

print(num)

Submission status: Accepted

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

    # 価値とコストの差が正になるものだけを全部足す
    ans = 0
    for i in range(N):
        if V[i] - C[i] > 0:
            ans += V[i] - C[i]

    print(ans)

Submission status: Accepted

Solution code:
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))
a = []
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:
#abc125b

n=int(raw_input())
v=map(int,raw_input().split())
c=map(int,raw_input().split())
res=0
for i in xrange(n):
 if v[i]-c[i]>0:
  res+=v[i]-c[i]
print res

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]:
        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()))
print(sum([max(0, V[i] - C[i]) for i in range(N)]))

Submission status: Accepted

Solution code:
import sys
N = int(sys.stdin.readline().strip())
Vs = map(int, sys.stdin.readline().strip().split())
Cs = map(int, sys.stdin.readline().strip().split())
max_value = 0
for v, c in zip(Vs, Cs):
    if v-c > 0:
        max_value += v-c
print(max_value)

Submission status: Accepted

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

sub_list = []
for i in range(n):
    sub_list.append(values[i]-costs[i])

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
a = int(input())
x = list(map(int,input().split()))
y = list(map(int,input().split()))
s = 0
for i,j in zip(x,y):
  if i > j:s+=i-j
print(s)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def get_result(V, C, N):
    return sum([V[i]-C[i] for i in range(N) if V[i] >= C[i] ])

N = int(input())
V = [int(s) for s in input().split(" ")]
C = [int(s) for s in input().split(" ")]
result = get_result(V, C, N)
print(result )

Submission status: Accepted

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

i = 0
list = []
list2 = [] 

while i < n:
    list.append(int(v[i]) - int(c[i]))
    if list[i] > 0:
        list2.append(list[i])
    i += 1
        
print(sum(list2))

Submission status: Accepted

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

u = [ x - y for (x,y) in zip(V,C) if x - y >= 0 ]

print(sum(u))

Submission status: Accepted

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

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

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

print(S)

Submission status: Accepted

Solution code:
a=int(input())
def sei(a):
  v=list(map(int , a.split()))
  return v
buysell=[]
for i in range(2):
  buysell+=[sei(input())]
X=0
for i in range(a):
  if buysell[0][i]>buysell[1][i]:
    X+=buysell[0][i]-buysell[1][i]
print(X)

Submission status: Accepted

Solution code:
N = int(input())

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

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

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:
# ABC125B - Resale
import sys
input = sys.stdin.readline

n = int(input())
v_lst = list(map(int, input().rstrip().split()))
c_lst = list(map(int, input().rstrip().split()))
total = 0
lst = [v_lst[i] - c_lst[i] for i in range(n)]

for i in range(n):
    if lst[i] > 0:
        total += lst[i]
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 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()))

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