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:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LS()
    return l
sys.setrecursionlimit(1000000)
mod = 1000000007

#A
def A():
    a,b,t = LI()
    k = t//a
    print(k*b)
    return

#B
def B():
    n = I()
    v = LI()
    c = LI()
    ans = 0
    for i in range(n):
        if v[i] > c[i]:
            ans += (v[i]-c[i])
    print(ans)
    return

#C
def C():
    n = I()
    return

#D
def D():
    n = I()
    return


#Solve
if __name__ == "__main__":
    B()

Submission status: Accepted

Solution code:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline

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

ans = 0

for i in range(N):
    v = v_list[i]
    c = c_list[i]

    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:
def main():
	N = int(input())
	V = list(map(int, input().split()))
	C = list(map(int, input().split()))
	ans = 0
	for i in range(N):
		this_value = V[i] - C[i]
		if this_value > 0:
			ans += this_value

	print(ans)

if __name__ == '__main__':
	main()

Submission status: Accepted

Solution code:
import sys
import math

sys.setrecursionlimit(10000)
INF = float('inf')


def inp():
    return int(input())


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


def inls():
    return input().split()


def Yesif(cond):
    print('Yes' if cond else 'No')


def YESIF(cond):
    print('YES' if cond else 'NO')


def yesif(cond):
    print('yes' if cond else 'no')



N = inp()
V = inl()
C = inl()

ans = 0
for v, c in zip(V, C):
    ans += max(0, 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]:
        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 = [vv - cc for vv, cc in zip(v, c)]
y = filter(lambda a: a > 0, x)
print(sum(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):
    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()))

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

print(score)

Submission status: Accepted

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

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

print(result)

Submission status: Accepted

Solution code:
def gcd_core(a, b):
    if b == 0:
        return a
    else:
        return gcd_core(b, a % b)


def gcd(arr):
    g = gcd_core(arr[0], arr[1])
    for i in range(2, len(arr)):
        g = gcd_core(g, arr[i])
    return g

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python
from __future__ import division, print_function

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip
else:
    _str = str
    str = lambda x=b"": x if type(x) is bytes else _str(x).encode()


def main():
    n = int(input())
    v = readlist()
    c = readlist()

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



# region template

BUFSIZE = 8192


class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._buffer = BytesIO()
        self._fd = file.fileno()
        self._writable = "x" in file.mode or "r" not in file.mode
        self.write = self._buffer.write if self._writable else None

    def read(self):
        if self._buffer.tell():
            return self._buffer.read()
        return os.read(self._fd, os.fstat(self._fd).st_size)

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self._buffer.tell()
            self._buffer.seek(0, 2), self._buffer.write(b), self._buffer.seek(ptr)
        self.newlines -= 1
        return self._buffer.readline()

    def flush(self):
        if self._writable:
            os.write(self._fd, self._buffer.getvalue())
            self._buffer.truncate(0), self._buffer.seek(0)


class ostream:
    def __lshift__(self, a):
        if a is endl:
            sys.stdout.write(b"\n")
            sys.stdout.flush()
        else:
            sys.stdout.write(str(a))
        return self


def print(*args, **kwargs):
    sep, file = kwargs.pop("sep", b" "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", b"\n"))
    if kwargs.pop("flush", False):
        file.flush()


sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
cout, endl = ostream(), object()

readline = sys.stdin.readline
readlist = lambda var=int: [var(n) for n in readline().split()]
input = lambda: readline().rstrip(b"\r\n")

# endregion

if __name__ == "__main__":
    main()

Submission status: Accepted

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

from collections import deque
import itertools as it
import sys
import math

sys.setrecursionlimit(1000000)

INF = 10 ** 18
MOD = 10 ** 9 + 7

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

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

Submission status: Accepted

Solution code:
#!/usr/bin/env python3
import sys
INF = float("inf")


def solve(N: int, V: "List[int]", C: "List[int]"):
    ans = 0
    for v, c in zip(V, C):
        if v-c > 0:
            ans += v-c
    print(ans)
    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:
a,b,c=int(input()),list(map(int,input().split())),list(map(int,input().split()));ans=0
for i in range(a):
  if b[i]>c[i]:ans+=b[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()))

output = 0

for i in range(n):
    if v[i] > c[i]:
        output += v[i] - 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(len(v)):
    if v[i]-c[i] > 0:
        ans = 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()))
cnt=0
for i in range(n):
    if a[i]>b[i]:
        cnt+=a[i]-b[i]
print(cnt)

Submission status: Accepted

Solution code:
N=input()
r=0
Vs=[int(x) for x in input().split()]
Cs=[int(x) for x in input().split()]
for i in range(len(Vs)):
    if Vs[i]>Cs[i]:
        r+=Vs[i]-Cs[i]
print(r)

Submission status: Accepted

Solution code:
import sys
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def II(): return int(sys.stdin.readline())
def SI(): return input()

def main():
    N = II()
    V = LI()
    C = LI()
    ans = sum(max(v - c, 0) for v, c in zip(V, C))
    return ans

print(main())

Submission status: Accepted

Solution code:
n=int(input())
A=tuple(map(int,input().split()))
B=tuple(map(int,input().split()))
ans=0
for i in range(n):
    ans+=max(A[i]-B[i],0)
print(ans)

Submission status: Accepted

Solution code:
N = int(input())
V = [int(a) for a in input().split()]
C = [int(a) for a in input().split()]
s = 0
for i in range(N):
    s += max(V[i]-C[i], 0)
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):
    if V[i]>C[i]:
        ANS+=(V[i]-C[i])

print(ANS)

Submission status: Accepted

Solution code:
import sys
import math
import collections
import itertools
import array
import inspect

# Set max recursion limit
sys.setrecursionlimit(1000000)


# Debug output
def chkprint(*args):
    names = {
        id(v): k
        for k, v in inspect.currentframe().f_back.f_locals.items()
    }
    print(', '.join(
        names.get(id(arg), '???') + ' = ' + repr(arg) for arg in args))


# Binary converter
def to_bin(x):
    return bin(x)[2:]


def li_input():
    return [int(_) for _ in sys.stdin.readline().split()]


def gcd(n, m):
    if n % m == 0:
        return m
    else:
        return gcd(m, n % m)


def gcd_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = gcd(v, L[i])

    return v


def lcm(n, m):
    return (n * m) // gcd(n, m)


def lcm_list(L):
    v = L[0]

    for i in range(1, len(L)):
        v = lcm(v, L[i])

    return v

def comb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2, r + 1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p - 1, r, p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

def bisearch(L, target):
    low = 0
    high = len(L) - 1
    
    while low <= high:
        mid = (low + high) // 2
        guess = L[mid]
        if guess == target:
            return True
        elif guess < target:
            low = mid + 1
        elif guess > target:
            high = mid - 1
    if guess != target:
        return False

# --------------------------------------------

dp = None


def main():
    N = int(input())
    V = li_input()
    C = li_input()

    ans = 0

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

    print(ans)


main()

Submission status: Accepted

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 998244353
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n = I()
    a = LI()
    b = LI()
    r = 0
    for v,c in zip(a,b):
        r += max(0, v-c)

    return r


print(main())

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

Submission status: Accepted

Solution code:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
x = 0
y = 0
for i in range(n):
    if a[i] > b[i]:
        x += a[i]
        y += b[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 = sum(max(0, x - y) for x, y in zip(v, c))
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

print(ans)

Submission status: Accepted

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

Submission status: Runtime Error

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

diff = [V[i] - C[i] for i in range(N)]
diff.sort(reverse=True)

i, ans = 0,0
while diff[i] > 0:
    ans += diff[i]
    i += 1
print(ans)

Submission status: Runtime Error

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

diff = [0 for i in range(N)]
for i in range(N):
  diff[i] = V[i] - C[i]
diff = list(reversed(sorted(diff)))
i, ans = 0, 0
while diff[i] > 0:
  ans += diff[i]
  i += 1
print(max(ans, 0))

Submission status: Runtime Error

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

diff = [0 for i in range(N)]
for i in range(N):
  diff[i] = V[i] - C[i]
diff = list(reversed(sorted(diff)))
i, ans = 0, 0
while diff[i] > 0:
  ans += diff[i]
  i += 1
print(ans)

Submission status: Runtime Error

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

diff = [0 for i in range(N)]
for i in range(N):
  diff[i] = V[i] - C[i]
diff = list(reversed(sorted(diff)))
i, ans = 0, 0
while diff[i] >= 0:
  ans += diff[i]
  i += 1
print(max(ans, 0))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))
sub = []
for i in range(N):
    sub.append(V[i]-C[i])

sub.sort(reverse = True)
y = sub[0]
index = 0
ans = 0
while y > 0:
    ans += y
    index += 1
    y = sub[index]
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
v=input_array()
c=input_array()

ans=-10000
for i in range(2**n):
	X=0
	Y=0
	tmp=[]
	for j in range(n):
		tmp.append((i>>j)&1)
	for ct in range(n):
		if tmp[ct]==1:
			X+=v[ct]
			Y+=c[ct]
	if (X-Y)>ans:
		ans=X-Y
print(ans)

Submission status: Runtime Error

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

m = 0

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

print(m)

Submission status: Runtime Error

Solution code:
n=int(input())
v=[]
c=[]
x=[]
for i in range(n):
  v[i]=int(input())
for i in range(n):
  c[i]=int(input())
  x[i]=v[i]-c[i]

ans=0
while x[i]>0:
  ans+=x[i]
  
print(ans)

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys

def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり

N = I()

ans = 0
for i in range(N):
    v,c = LI()
    if v-c > 0:
        ans += v-c

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

for i in range(len(a)):
  num = a[i]-1
  sum += b[num]
  if i >= 1 and a[i]-a[i-1] == 1:
    tmp = a[i]-2
    sum += c[tmp]
else:
  print(sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
start = time.time()
y = 0
for i in range(2 ** n):
  v_total = 0
  c_total = 0
  for j in range(n):  # このループが一番のポイント
    if ((i >> j) & 1):  # 順に右にシフトさせ最下位bitのチェックを行う
      v_total += v[j]
      c_total += c[j]
  if (v_total-c_total) > y:
    y = v_total-c_total
print(y)

Submission status: Runtime Error

Solution code:
n=int(input())
l=map(int,input().split())
m=map(int,input().split())
def f(x):
	return l[x]-m[x]
print(sum([f(i) for i in range(n) if f(i)>0]))

Submission status: Runtime Error

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

Solution code:
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i = 0; i < n; i++) {
        cin >> v[i];
    };
    vector<int> c(n);
    for (int i = 0; i < n; i++) {
        cin >> c[i];
    };
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (v[i] > c[i]) {
            ans += v[i] - c[i];
        };
    };
    cout << ans << endl;
}

Submission status: Runtime Error

Solution code:
# ABC125B

n = int(input())
x = 0
y = 0
for i in range(n):
    v, c = map(int, input().split())
    if v > c:
        x += v
        y += c
print(abs(x - y))

Submission status: Runtime Error

Solution code:
# ABC125B

n = int(input())
v = list()
c = list(map(int, input().split()))
x = 0
y = 0
for i in range(n):
    v, c = map(int, input().split())
    if v > c:
        x += v
        y += c
print(abs(x - y))

Submission status: Runtime Error

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

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

new=[v[i]-c[i] for i in range(n)]
new.sort()
print(new[-2]+new[-1])

Submission status: Runtime Error

Solution code:
N=int(input())
X=list(map(int, input().split()))
Y=list(map(int, input().split()))
Z=X-Y
Z=Z[Z>0]
print(sum(Z))

Submission status: Runtime Error

Solution code:
n =int(input())
v =list(map(int ,input().split()))
c =list(map(int ,input().split()))
a =[]
if n ==1:
    print(0)
    
else:
    for i in range(n):
        for j in range(n):
            x =v[i] +v[j]
            y =c[i] +c[j]
            if not v[i] == v[j]:
                if not c[i] == c[j]:
                    a.append(x-y)
    print(max(a))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
#include <stdio.h>

int main(void) {
	int n;
	int v[50], c[50];
	int ans = 0;

	scanf("%d", &n);
	for (int i = 0; i < n; ++i) {
		scanf("%d", &v[i]);
	}
	for (int i = 0; i < n; ++i) {
		scanf("%d", &c[i]);
	}

	for (int i = 0; i < n; ++i) {
		ans += v[i] - c[i] > 0 ? v[i] - c[i] : 0;
	}
	printf("%d", ans);


	return 0;
}

Submission status: Runtime Error

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 = S + D
    
print(S)

Submission status: Runtime Error

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

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

dif.sort(reverse=True)

i=0
while (dif[i]>=0)and(i<=N-1):
    count=count+dif[i]
    i=i+1

print(count)

Submission status: Runtime Error

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

dif.sort(reverse=True)

i=0
while (dif[i]>=0)and(i<=N-1):
    count=count+dif[i]
    i=i+1

print(count)

Submission status: Runtime Error

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

dif.sort(reverse=True)

i=0
while dif[i]>=0:
    count=count+dif[i]
    i=i+1

print(count)

Submission status: Runtime Error

Solution code:
N = int(input())
X = []
Y = []

for x in map(int, input().split()):
    X.append(x)

for y in map(int, input().split()):
    Y.append(y)

d_list = []

for i in  range(N):
    d = X[i] - Y[i]
    if d > 0:
        d_list.append(d)

if d_list:
    print(max(d_list) + min(d_list))
else:
    print(0)

Submission status: Runtime Error

Solution code:
N=int(input())
V=[int,input().split()]
C=[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: Runtime Error

Solution code:
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=[]
for i in range(2**n):
	sum_v=0
	sum_c=0
	for j in range(n):
		if (i>>j)&1:
			sum_v+=v[j]
			sum_c+=c[j]
			ans.append[sum_v-sum_c]
print(max(ans))

Submission status: Runtime Error

Solution code:
n=int(input())
v=[int(i) for i in range(n)]
c=[int(i) for i in range(n)]
ans=[]
for i in range(2**n):
	for j in range(n):
		if (i>>j)&1:
			sum_v+=v[j]
			sum_c+=c[j]
			ans.append(sum_c-sum_v)
print(max(ans))

Submission status: Runtime Error

Solution code:
n=int(input())
a=[]
v=list(map(int,input().split()))
c=list(map(int,input().split()))
if n==1:
    if v[0]-c[0]<=0:
        print("0")
    else:
        print(v[0]-c[0])
    exit()
for i in range(n):
    if v[i]-c[i]>0:
        a.append(v[i]-c[i])
a.sort()
print(a[-1]+a[0])

Submission status: Runtime Error

Solution code:
n=int(input())
a=[0]*n
v=list(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(n):
    a[i]=v[i]-c[i]
a.sort()
print(a[-1]+a[-2])

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

diff_list = [v_list[i]-c_list[i] for i in range(n) if v_list[i] - c_list[i] > 0]
print(diff_list)
diff_list.append(0)
print(diff_list)
print(sum(diff_list))

Submission status: Runtime Error

Solution code:
from functools import reduce
from operator import add
n=int(input())
v=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
print(reduce(add,[v[i]-c[i] for i in range(n) if v[i]>c[i]]))

Submission status: Runtime Error

Solution code:
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: Runtime Error

Solution code:


fn main() {
    let n: usize = read();
    let v: Vec<isize> = read_vec();
    let c: Vec<isize> = read_vec();

    let mut d: Vec<isize> = Vec::new();
    for i in 0..n {
        d.push(v[i] - c[i]);
    }
    
    let mut ans = 0;
    for i in d {
        if i > 0 {
            ans += i;
        }
    }
    println!("{}", ans);
}

// ########################################################################################### //

// 標準入力から一行を読み取り、指定の型に変換する関数
pub fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

// 標準入力から一行を読み取り、空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

// 標準入力からn行を読み取り、各行を空白文字で分割し、各要素を指定の型に変換する関数
pub fn read_vec2<T: std::str::FromStr>(n: usize) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}

// 10進数での各桁の和
pub fn sum_dights(x: isize) -> isize {
    if x % 10 == 0 {
        return 0
    }
    let m = x % 10;
    m + sum_dights((x - m) / 10)
}

Submission status: Runtime Error

Solution code:
A = input()

ans = 0

ALEN = (len(A))

B = list(A)



B_re =  list(reversed(B))

ans = 0


for i in range(ALEN):
    if B[i] != B_re[i]:
        ans = ans+1
    
if ans　% 2 == 0:
    print(ans//2)
elif ans %2 != 0:
    print((ans//2) +1)
elif ans == 0:
    print(0)

Submission status: Runtime Error

Solution code:
#include <stdio.h>
#include <vector>

using namespace std;
typedef long long ll;

int main()
{
    int N, ans = 0;
    vector<int> V(N), C(N);
    scanf("%d", &N);
    for (int i = 0; i < N; i++)
    {
        scanf("%d", V.at(i));
    }
    for (int i = 0; i < N; i++)
    {
        scanf("%d", C.at(i));
    }

    for (int i = 0; i < N; i++)
    {
        if (V.at(i) - C.at(i) >= 0)
        {
            ans += V.at(i) - C.at(i);
        }
    }

    printf("%d", ans);

    return 0;
}

Submission status: Runtime Error

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

Submission status: Runtime Error

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