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:
for i in range(3):
  y = input().split(" ")
  y = list(map(int, y))
  if i == 1:
    value = y
  elif i == 2:
    cost = y

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

print(result)

Submission status: Accepted

Solution code:
a = int(input())

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

aiueo = 0

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

print(aiueo)

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
import numpy as np

N=int(input())
V=np.array([int(x) for x in input().split()])
C=np.array([int(x) for x in input().split()])
ans=V-C
print(sum(ans[ans>0]))

Submission status: Accepted

Solution code:
num = int(input())
lists = [list(map(int,input().split())) for i in range(2)]
nums = [lists[0][j] - lists[1][j] for j in range(num)]
x = 0
for i in nums:
  if i > 0:
    x += i
  else:
    continue
print(x)

Submission status: Accepted

Solution code:
N = input()
V = list(input().split())
C = list(input().split())
n = 0
list_P =[]
#V-C = 差額P
while n < len(V):
    Vn = int(V[n])
    Cn = int(C[n])
    Pn = Vn -Cn
    list_P.append(Pn)
    n += 1

MAX = 0
for X in list_P:
    if X > 0:
        MAX += X
    else:
        continue

print(MAX)

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

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

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

Submission status: Accepted

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

ans = sum([max(v - c, 0) for v, c in zip(V, C)])
print(ans)

Submission status: Accepted

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

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

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:
from sys import stdin
##  input functions for me
def ria(sep = ''):
    if sep == '' :
        return list(map(int, input().split())) 
    else: return list(map(int, input().split(sep)))
def rsa(sep = ''):
    if sep == '' :
        return input().split() 
    else: return input().split(sep)
def ri(): return int(input())
def rd(): return float(input())
def rs(): return input()
##

## main ##
N = ri()
V = ria()
C = ria()

ma = 0
for i in range(N):
    ma += max(0, V[i] - C[i])

print(ma)

Submission status: Accepted

Solution code:
import numpy;i=input;a=numpy.array;n=int(i());v=a(list(map(int,i().split())));c=a(list(map(int,i().split())));print(sum(numpy.where(v-c>0,v-c,0)))

Submission status: Accepted

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

Submission status: Accepted

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

vc = sorted([v[i] - c[i] for i in range(n)], reverse=True)

k = 0

for vc_i in vc:
    if vc_i > 0:
        k += vc_i

print(k)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import numpy as np;i=input;a=np.array;n=int(i());v=a(list(map(int,i().split())));c=a(list(map(int,i().split())));print(sum(np.where(v-c>0,v-c,0)))

Submission status: Accepted

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

	#ans=max(ans,arr[i]-arr2[i])
print(ans)

Submission status: Accepted

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

print(sum(dif))

Submission status: Accepted

Solution code:
import numpy as np;i=input;n=int(i());v=np.array(list(map(int,i().split())));c=np.array(list(map(int,i().split())));print(sum(np.where(v-c>0,v-c,0)))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

"""Template"""


class IP:
    """
    入力を取得するクラス
    """

    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        # 参考
        # https://blog.rossywhite.com/2018/08/06/bit-search/
        # https://atcoder.jp/contests/abc105/submissions/4088632
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    # output.append(a[j])
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        自然数だからn
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        oneで1
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x // y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)


"""ここからメインコード"""


def main():
    # 1文字に省略
    r, e, p = range, enumerate, print
    ip = IP()
    id = Idea()
    mod = 10 ** 9 + 7

    """この下から書いてね"""
    n = ip.I()
    v = ip.IL()
    c = ip.IL()
    v = np.array(v)
    c = np.array(c)
    o = v - c
    ans = np.where(o > 0, o, 0)
    p(sum(ans))

main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, V, C):
    return sum(map(lambda x: x[0]-x[1], filter(lambda x: x[0]>x[1], zip(V, C))))


def main():
    N = read_int()
    V = read_int_n()
    C = read_int_n()
    print(slv(N, V, C))


if __name__ == '__main__':
    main()

Submission status: Accepted

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

Submission status: Accepted

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

"""Template"""


class IP:
    """
    入力を取得するクラス
    """

    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        # 参考
        # https://blog.rossywhite.com/2018/08/06/bit-search/
        # https://atcoder.jp/contests/abc105/submissions/4088632
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    # output.append(a[j])
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        自然数だからn
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        oneで1
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x // y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)


"""ここからメインコード"""


def main():
    # 1文字に省略
    r, e, p = range, enumerate, print
    ip = IP()
    id = Idea()
    mod = 10 ** 9 + 7

    """この下から書いてね"""
    n = ip.I()
    v = ip.IL()
    c = ip.IL()
    v = np.array(v)
    c = np.array(c)
    o = v - c
    ans = 0
    for x in o:
        if x > 0:
            ans += x
    p(ans)

main()

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

Submission status: Accepted

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

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

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

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

maximum = 0
for value, cost in zip(values, costs):
    if value - cost > 0:
        maximum += value - cost

print(maximum)

Submission status: Accepted

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

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

print(result)

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()))
d=[]
max=0
num=0
for i in range(n):
            d.append(v[i]-c[i])
"""
for i in range(n-1):
    num=d[i]

    for k in range(n-i-1):
        if(num+d[i+1+k]>max):
            max=num+d[i+1+k]
"""
d.sort()
d.reverse()
for i in range(n):
    num=max+d[i]
    if num>max:
        max=num

print(max)

Submission status: Accepted

Solution code:
n = int(input())
b = input()
v = []
v.append(b.split())
v = v[0]
count = 0
for v1 in v:
    v.remove(v1)
    v.insert(count, int(v1))
s = input()
c = []
c.append(s.split())
c = c[0]
count = 0
for c1 in c:
    c.remove(c1)
    c.insert(count, int(c1))
a = []
for (v1,c1) in zip(v,c):
    add = v1 - c1
    a.append(add)
ans = 0
for a1 in a:
    if a1 >= 0:
        ans += a1
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
ans_max = 0
V_ans=[]
C_ans=[]

for i in range(0,N):
    if V[i]>C[i]:
        V_ans.append(V[i])
        C_ans.append(C[i])

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

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

print(ans)

Submission status: Accepted

Solution code:
import math

n = int(input())

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

total = 0
cost = 0

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

print(total - cost)

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

Submission status: Accepted

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

p = 0
for j in range(0,N):
    if C[j] < V[j]:
        p += V[j]-C[j]
        
print(int(p))

Submission status: Accepted

Solution code:
import numpy as np

n = input()
v = input().split()
c = input().split()
N = int(n)
V = np.array(v, dtype=int)
C = np.array(c, dtype=int)

max_xy = 0

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import os, sys, re, math

N = int(input())
v = [int(s) for s in input().split(' ')]
c = [int(s) for s in input().split(' ')]
ret = 0
for i in range(len(v)):
  if v[i] - c[i] > 0:
    ret += v[i] - c[i]
  
print(ret)

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

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()]
results = []

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

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

Submission status: Accepted

Solution code:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
count=0
saidaiti=0
while True:
    if v[count]>c[count]:
        saidaiti=saidaiti+v[count]-c[count]
    count=count+1
    if count==n:
        break
print(saidaiti)

Submission status: Accepted

Solution code:
N = int(input())
Vs = map(int, input().split())
Cs = map(int, input().split())
Xs = []
for v, c in zip(Vs, Cs):
    Xs.append(v - c)
print(sum(filter(lambda x: x >= 0, Xs)))

Submission status: Accepted

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

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

print(ab)

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

Submission status: Accepted

Solution code:
import numpy as np
#入力
N = input()
V = input()
C = input()

A= np.array(list(map(int,V.split( ))))
B= np.array(list(map(int,C.split( ))))

E = A - B
print(np.sum(E[E>0]))

Submission status: Accepted

Solution code:
print(sum((x-y)*(x>y)for x,y in zip(*[map(int,t.split())for t in open(0)][1:])))

Submission status: Accepted

Solution code:
N = int(input())
V = input().split()
V = [int(v) for v in V]
C = input().split()
C = [int(c) for c in C]
VC = [0] * N
for n in range(N):
    VC[n] = V[n] - C[n]
    if VC[n] < 0:
        VC[n] = 0
S = sum(VC)
print(S)

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:
_,*t=[map(int,t.split())for t in open(0)];print(sum((x-y)*(x>y)for x,y in zip(*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(len(v)):
    ttt = v[i] - c[i]
    if ttt > 0:
        ans += ttt

print(ans)

Submission status: Accepted

Solution code:
# N 個の宝石があり、i 番目の宝石の価値は Viです
# あなたはこれらの宝石の中からいくつかを選んで手に入れます
# このとき、1つも選ばなくとも、全て選んでも構いません
# ただし、i番目の宝石を手に入れる場合コスト Ciを支払わなければいけません
# 手に入れた宝石の価値の合計を X、支払ったコストの合計を Yとします
# X−Yの最大値を求めてください

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

# print(N)
# print(V)
# print(C)

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

print(sum)

Submission status: Accepted

Solution code:
n=int(raw_input())
a=map(int,raw_input().split())
b=map(int,raw_input().split())
t=0
for i in xrange(n):
	d=a[i]-b[i]
	if d>0:
		t=t+d
print t

Submission status: Accepted

Solution code:
def max_num(n,N,list):
    for i in range(N):
        if list[i] == n:
            num = n
            break
        return n

N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
copy_V = []
for i in range(N):
    if V[i] - C[i] < 0:
        V[i] = 0
        copy_V.append(V[i])
        C[i] = 0
    else:
        copy_V.append(V[i])
X = 0
Y = 0
Max = 0
for i in range(N):
    X += max(V)
    tmp = max(V)
    Y += C[copy_V.index(tmp)]
    tmp_1 = copy_V.index(tmp)
    del V[V.index(max(V))]
    if Max < X - Y:
        Max = X - Y
print(Max)

Submission status: Accepted

Solution code:
_,v,c=[map(int,t.split())for t in open(0)];print(sum((x-y)*(x>y)for x,y in zip(v,c)))

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

Submission status: Accepted

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

Submission status: Accepted

Solution code:
X=0
Y=0

N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
for i in range(len(V)):
	if V[i] > C[i]:
		X+=V[i]
		Y+=C[i]

print(X-Y)

Submission status: Accepted

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

diff.sort()
diff.reverse()
if len(diff) >= 2:
    print(sum(diff))

elif len(diff) == 1:
    print(diff[0])

elif len(diff) == 0:
    print(0)

Submission status: Accepted

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

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


if(__name__ == '__main__'):
    main()

Submission status: Accepted

Solution code:
N = int(input())
list_V = input().split()
list_C = input().split()
SUM = 0


for i in range(N):
  value = int(list_V[i])-int(list_C[i])
  if value > 0:
    SUM += value

print(SUM)

Submission status: Accepted

Solution code:
n,*t=map(int,open(0).read().split());print(sum((x-y)*(x>y)for x,y in zip(t[:n],t[n:])))

Submission status: Accepted

Solution code:
# coding: utf-8
import itertools
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
d = sum([v[i] - c[i] for i in range(n) if v[i] - c[i] > 0])
print(d)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin

N = int(stdin.readline().rstrip())
V = [int(x) for x in stdin.readline().rstrip().split()]
C = [int(x) for x in stdin.readline().rstrip().split()]

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

print(max_profits)

exit(0)

Submission status: Accepted

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

Submission status: Accepted

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

# 処理
max_X_minus_Y = 0
for i in range(N):
    if V[i] > C[i]:
        max_X_minus_Y += V[i] - C[i]
print(max_X_minus_Y)

Submission status: Accepted

Solution code:
import sys
import numpy as np

N = input()

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

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

delt = v - c
print(delt[delt>0].sum())

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]:
        v = V[i]
        c = C[i]
        X = X + v
        Y = Y + c

print(X-Y)

Submission status: Accepted

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

D=0
while m>=0:
 if V[m]-C[m]>=0:
  D=D+V[m]-C[m]
 else:D=D
 m=m-1

print(D)

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

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import numpy as np
import itertools

# input
l = list(map(int, input().split()))
N = l[0]

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

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

best_result = 0

# 総選択数 n

for n in range(N+1):
    v_list = list(itertools.combinations(V,n));
    c_list = list(itertools.combinations(C,n));
    for v, c in zip(v_list, c_list):
        X = sum(v)
        Y = sum(c)

        result = X - Y

        # Renew
        if best_result <= result:
            best_result = result

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

print(ans)