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: Wrong Answer

Solution code:
N=int(input())
V=list(map(int,input().split()))
C=list(map(int,input().split()))
num=0
for i in range(N):

    sum=V[i]-C[i]
    print(sum)
    if sum>0:
        num+=sum


print(num)

Submission status: Wrong Answer

Solution code:
N = int(input())
V = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
X = [V - C for (V, C) in zip(V, C)]
i = 0
for i in X:
    if i < 0:
        X.remove(i)

print(sum(X))

Submission status: Wrong Answer

Solution code:
N = int(input())
V = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
X = [V - C for (V, C) in zip(V, C)]
i = 0
for i in X:
    if i < 0:
        X.remove(i)

print(X)

Submission status: Wrong Answer

Solution code:

n = input()
n = int(n)

total = 0

lst_a = input().split()
lst_b = input().split()

for i in range(0, n ,1):
    a = lst_a[0]
    b = lst_b[0]
    a = int(a)
    b = int(b)
    if a > b:
        total += (a - b)

print(total)

Submission status: Wrong Answer

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

    # 価値 - コスト
    D = [V[i] - C[i] for i in renge(N)]

    # 価値 - コスト > 0 のフィルタ
    F = [d for d in D if d > 0]

    if len(F) == 0:
        print(0)
    else:
        print(sum(F))

if __name__ == "main":
    main()

Submission status: Wrong Answer

Solution code:
import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    V = list(map(int, input().split()))
    C = list(map(int, input().split()))
    
    #差分
    sa = [ V[i] - C[i] if V[i] - C[i] > 0 else 0 for i in range(N) ]
    
    #昇順
    sa.sort()
    
    #ケツから２つ
    print(sum(sa[-2:]))
    
if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
N = 0
V = []
C = []
 
i = 0
ans = 0

str = input()
N = int(str)
 
str = input().split()
while i < N:
  V.append(int(str[i]))
  i = i+1
  
i=0
str = 0
str = input().split()
while i < N:
  C.append(int(str[i]))
  i = i+1
 
while i<N:
  if V[i] > C[i]:
    ans = ans + V[i] - C[i]
    
    
print(ans)

Submission status: Wrong Answer

Solution code:
V = []
C = []
N = 0

i = 0
ans = 0

str = input().split()
while i < N:
  V[i] = int(str[i])
  i = i+1
  
i=0
str = 0
str = input().split()
while i < N:
  C[i] = int(str[i])

while i<N:
  if V[i] > C[i]:
    ans = ans + V[i] - C[i]
    
    
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n = int(input())

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

cost = [v-c for v,c in zip(V,C)]

max_cost = cost[0]

for i in range(n-1):
    for j in range(i+1,n):
        nc = cost[i] + cost[j]
        if max_cost < nc:
            max_cost = nc

print(max_cost)

Submission status: Wrong Answer

Solution code:
n = int(input())

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

cost = [v-c for v,c in zip(V,C)]

max_cost = -100

for i in range(n-1):
    for j in range(i+1,n):
        nc = cost[i] + cost[j]
        if max_cost < nc:
            max_cost = nc

print(max_cost)

Submission status: Wrong Answer

Solution code:
n=int(input())
v=list(map(int, input().split()))
c=list(map(int, input().split()))
vc=[(v[i],c[i]) for i in range(n)]
vc=sorted(vc,key=lambda x:(x[0],x[1]))[::-1]
x=0
y=0
ans=[]
for i in range(n):
    x+=vc[i][0]
    y+=vc[i][1]
    ans.append(x-y)
print(max(ans))

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

print(gain)

Submission status: Wrong Answer

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

v_list = v - c
v_list = sorted(v_list, reverse=True)

a = []
for i in range(len(v_list)):
    a.append(sum(v_list[:i]))

print(max(a))

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
"""
Spyderエディタ

これは一時的なスクリプトファイルです
"""
n = int(input())

v = [0] * n
c = [0] * n

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

ans = []

for i in range(n):
    a = v[i] - c[i]
    ans.append(a)
    
print(max(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(a):
  if (b[i]-c[i]) > 0:
    d=b[i]-c[i]

print(d)

Submission status: Wrong Answer

Solution code:
input();
Values = list(map(int, input().split()))
Costs = list(map(int, input().split()))
total = 0
for (value, cost) in zip(Values, Costs):
  if value > cost:
    total = value - cost

print(total)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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 += 1
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
import numpy as np

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

N=int(input())
Vi=np.array(input().split(),dtype=int)
Ci=np.array(input().split(),dtype=int)

Xi=Vi-Ci
Xi_sort=np.sort(Xi)[::-1]
num=np.sum(Xi_sort>=0)

if num == 0:
    XY_max=Xi_sort[0]
else :
    XY_max=np.sum(Xi_sort[0:num])

print(XY_max)

Submission status: Wrong Answer

Solution code:
import importlib
import_module = lambda name:importlib.import_module(name)

input = import_module('sys').stdin.readline
input_int = lambda:int(input())
input_ints = lambda:map(int,input().split())
input_ints_list = lambda:list(input_ints())
input_str = lambda:input()
input_strs = lambda:input().split()
input_lines = lambda n,f:[f() for _ in range(n)]

gcd_base = lambda a,b:import_module('fractions').gcd(a,b) # 最大公約数（2値)
gcd = lambda a:import_module('functools').reduce(gcd_base,a) # 最大公約数（リスト）
lcm_base = lambda a,b:(a*b)//import_module('fractions').gcd(a,b) # 最小公倍数(2値)
lcm = lambda a:import_module('functools').reduce(lcm_base,a,1) # 最小公倍数(リスト)

permutations = lambda a,n:import_module('itertools').permutations(a,n) # 順列
combinations = lambda a,n:import_module('itertools').combinations(a,n) # 組み合わせ
product = lambda a,b:import_module('itertools').product(a,b) # 二つのリストの直積

init_array_1dim = lambda v,n:[v]*n
init_array_2dim = lambda v,n,m:[init_array_1dim for _ in range(m)]

# 四捨五入はround
ceil = lambda a:import_module('math').ceil(a) # 切り上げ
floor = lambda a:import_module('math').floor(a) # 切り捨て

# キュー
convert_list_to_queue = lambda a:import_module('collections').deque(a)
pop_q = lambda a:a.popleft()
push_q = lambda a,e:a.appendleft(e)
push_q_list = lambda a,l:a.extendleft(l) 

# プライオリティキュー
def init_head(a):import_module('heapq').heapify(a)
def heap_push(a,v):import_module('heapq').heappush(a,v)
heap_pop = lambda a:import_module('heapq').heappop(a) # 最小値を取り出す

# 二分探索
bisect_left = lambda a,x:import_module('bisect').bisect_left(a,x)
bisect_right = lambda a,x:import_module('bisect').bisect_left(a,x)
insert_left = lambda a,x:import_module('bisect').insert_left(a,bisect_left(a,x))
insert_right = lambda a,x:import_module('bisect').insert_right(a,bisect_right(a,x))

# 累積和、累積積、累積GCD
cumsum = lambda a:import_module('numpy').cumsum(import_module('numpy').array(a)) # 累積和
cumprod = lambda a:import_module('numpy').cumprod(import_module('numpy').array(a)) # 累積積
cumgcd = lambda a:import_module('numpy').frompyfunc(gcd, 2, 1).accumulate(a, dtype=import_module('numpy').object).astype(import_module('numpy').int) # 累積GCD

class UnionFind(object):
    def __init__(self, n):
        self.par = [i for i in range(n)]
        self.rank = [0 for _ in range(n)]
        self.size = [1 for _ in range(n)]

    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            if self.rank[x] < self.rank[y]:
                x, y = y, x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
            self.par[y] = x
            self.size[x] += self.size[y]

    def is_same(self, x, y):
        return self.find(x) == self.find(y)

    def get_size(self, x):
        x = self.find(x)
        return self.size[x]

# グラフで全部到達できる経路が何個あるか
def dfs_graph(v,n,graph,visited):
    if all(visited):return 1 # 全部到達できたら1を返す
    ans = 0
    for i in range(n):
        if not graph[v][i]:continue # 結ぶ線がないときはスキップ
        if visited[i]:continue # 到達済みだったらスキップ
        visited[i] = True
        ans += dfs_graph(i,n,graph,visited)
        visited[i] = False
    return ans

# ワーシャルフロイド（グラフの要素数、グラフ）
def warshall_floyd(n,graph):
    d = init_array_2dim(float("inf"),n,n)
    # 初期化
    for i in range(n):
        d[i][i] = 0
        for j in range(n):
            if graph[i][j]:d[i][j] = 1
    # 距離算出
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

# グラフを初期化（グラフの要素数、グラフの線の両端、有向無向）
def init_graph(n,a,directed=False):
    visited = init_array_1dim(False,n)
    graph = init_array_2dim(False,n,n)
    for e in a:
        graph[e[0]-1][e[1]-1] = True
        if not directed:graph[e[1]-1][e[0]-1] = True # 無向グラフの場合
    return visited,graph

def two_pointers(s,threshold,ope='sum'):
    l,r = 0,0
    base = 0 
    if ope == 'sum':base = 0
    if ope == 'prd':base = 1
    diff = 0
    while r < len(s):
        val = 0
        if ope == 'sum':val = base+s[r]
        if ope == 'prd':val = base*s[r]
        if val <= threshold:
            if ope == 'sum':base += s[r]
            if ope == 'prd':base *= s[r]
            diff = max(diff, r-l+1)
            r += 1
        elif l == r:
            r += 1
            l += 1
        else:
            if ope == 'sum':base -= s[l]
            if ope == 'prd':base //= s[l]
            l += 1
    return diff

def solution():
    # ここに実装
    global N,V,C
    N = input_int()
    V = input_ints_list()
    C = input_ints_list()

    V.sort()
    C.sort()
    vals = [x-y for x,y in zip(V,C) if x-y > 0]
    print(sum(vals))
        
	
if __name__ == '__main__':
    solution()

Submission status: Wrong Answer

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

# ビットで使う使わないパターン表を作る
# Nが桁数、2のN乗がパターン数
max = 0
for i in range(0, N ** 2):
    ptn = '0' + str(N) + 'b'
    bin_i = list(format(i, ptn))
    work = 0
    for j in range(0, N):
        if bin_i[j] == '1':
            work += V[j] - C[j]
    if max < work:
        max = work

print(max)

Submission status: Wrong Answer

Solution code:
#入力回数の取得
n = int(input())
#複数行の数値の取得
v = input().split()
c = input().split()
sum=0

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

Submission status: Wrong Answer

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

n = int(input())
value = [int(s) for s in input().split()]
cost = [int(t) for t in input().split()]

VnS = []

for i in range(n):
    if value[i]-cost[i] > 0:
        VnS.append(value[i] - cost[i])

VnS.sort(reverse=True)
print(sum(VnS[:2]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

P = 0

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

P = 0

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

Submission status: Wrong Answer

Solution code:
N = int(input())

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

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

P = 0

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

Submission status: Wrong Answer

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: Wrong Answer

Solution code:

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

a = []
b = []
for i in range(len(v)) :
    if v[i] > c[i] :
        a.append(v[i])
        b.append(c[i])

print(a,b)
d = []
for i in range(len(a)) :
    d.append(a[i]-b[i])

print(sum(d))

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
v = np.array(list(map(int,input().split()))) 
c = np.array(list(map(int,input().split())))
ans = -(1<<60)
for i in range(n*n-1):
    temp = bin(i)[2:].zfill(n)
    temp = np.array(list(map(int, temp)))
    X = np.dot(temp, v)
    Y = np.dot(temp,c)
    ans = max(ans,X-Y)
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
v = np.array(list(map(int,input().split()))) 
c = np.array(list(map(int,input().split())))
ans = -(1<<60)
for i in range(1,n*n-1):
    temp = bin(i)[2:].zfill(n)
    temp = np.array(list(map(int, temp)))
    X = np.dot(temp, v)
    Y = np.dot(temp,c)
    ans = max(ans,X-Y)
print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np
n = int(input())
v = np.array(list(map(int,input().split()))) 
c = np.array(list(map(int,input().split())))
ans = 0
for i in range(n*n-1):
    temp = bin(i)[2:].zfill(n)
    temp = np.array(list(map(int, temp)))
    ans1 = np.dot(temp, v)
    ans2 = np.dot(temp,c)
    ans = max(ans,ans1-ans2)
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N = input()
V = input().split(' ')
C = input().split(' ')

max = -1000
for value, cost in zip(V, C):
    value_int = int(value)
    cost_int = int(cost)
    if(max < value_int - cost_int):
        max = value_int - cost_int

print(max)

Submission status: Wrong Answer

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)
print(np.sort((e3[0] - e3[1]))[::-1][0] + np.sort((e3[0] - e3[1]))[::-1][1])

Submission status: Wrong Answer

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: Wrong Answer

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 > ans:
    ans = cospa
print(ans)

Submission status: Wrong Answer

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

diff = [v-c if (v-c > 0) else 0 for v, c in zip(V, C)]
print(max(diff))

Submission status: Wrong Answer

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: Wrong Answer

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 = m - i
  if p > 0:
    t += p

print(t)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

ca = []
for i in range(N):
    ca.append(V[i]-C[i])
ca.sort(reverse=True)
calc = 0
for i in range(len(ca)):
    if i > 1:
        break
    calc += ca[i]
if calc < 0:
    calc = 0
print(calc)

Submission status: Wrong Answer

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))
print(v)
print(c)
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: Wrong Answer

Solution code:
V = []
C = []
N = int(input())

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

max_1 = max(V)
cax_1 = C[V.index(max_1)]

V.pop(V.index(max_1))
C.pop(C.index(cax_1))

if N == 1:
    print("0")
else:
    max_2 = max(V)
    cax_2 = C[V.index(max_2)]

    ans = (max_1 + max_2) - (cax_1 + cax_2)

    print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = [0] * N
V = list(map(int,input().split(" ")))
C = list(map(int,input().split(" ")))

if N > 1:
    for i in range(N):
        ans[i] = V[i] - C[i]
    ans.sort(reverse=True)
    ans = ans[0] + ans[1]
else:
    ans = V[0] - C[0]
    if ans < 0:
        ans = 0
print(ans)

Submission status: Wrong Answer

Solution code:
N = int(input())
V = map(int,input().split())
C = map(int,input().split())
X = max(V)
Y = max(C)
print(X-Y)

Submission status: Wrong Answer

Solution code:
N = int(input())
ans = [0] * N
V = list(map(int,input().split(" ")))
C = list(map(int,input().split(" ")))

if N > 1:
    for i in range(N):
        ans[i] = V[i] - C[i]
    ans.sort(reverse=True)
    ans = ans[0] + ans[1]
else:
    ans[0] = V[0] - C[0]
    if ans[0] < 0:
        ans = 0
print(ans)

Submission status: Wrong Answer

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

for j in range(N-1):
    for i in range(j+1, N):
        X = V[j]+V[i]
        Y = C[j]+C[i]
        ans = X-Y

        if ans_max < ans:
            ans_max = ans

        if N-i < 2:
            for f in range(i+1, N):
                X = V[j] + V[i]+V[f]
                Y = C[j] + C[i]+C[f]
                ans = X - Y
                if ans_max < ans:
                    ans_max = ans

                if N-f < 2:
                    for a in range(f + 1, N):
                        X = V[j] + V[i] + V[f] + V[a]
                        Y = C[j] + C[i] + C[f] + C[a]
                        ans = X - Y
                        if ans_max < ans:
                            ans_max = ans

print(ans_max)

Submission status: Wrong Answer

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

for j in range(N-1):
    for i in range(j+1, N):
        X = V[j]+V[i]
        Y = C[j]+C[i]
        ans = X-Y

        if ans_max < ans:
            ans_max = ans

        if N-i < 2:
            for f in range(i+1, N):
                X = V[j] + V[i]+V[f]
                Y = C[j] + C[i]+C[f]
                ans = X - Y
                if ans_max < ans:
                    ans_max = ans
                    
print(ans_max)

Submission status: Wrong Answer

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

for j in range(N-1):
    for i in range(j+1, N):
        X = V[j]+V[i]
        Y = C[j]+C[i]
        ans = X-Y

        if ans_max < ans:
            ans_max = ans

        if N-i < 2:
            for f in range(i+1, N):
                X = V[j] + V[i]+V[f]
                Y = C[j] + C[i]+C[f]
                ans = X - Y
                if ans_max < ans:
                    ans_max = ans

        else:
            break

print(ans_max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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]

print(max)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for j in range(N-1):
    for i in range(j+1,N):
        X=V[j]+V[i]
        Y=C[j]+C[i]
        ans=X-Y
        if ans_max<ans:
            ans_max=ans
        if N-i<2:
            for f in range(j+2,N):
                X = V[j] + V[i]+V[f]
                Y = C[j] + C[i]+C[f]
                ans = X - Y
                if ans_max < ans:
                    ans_max = ans
        else:
            break

print(ans_max)

Submission status: Wrong Answer

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

for j in range(N-1):
    for i in range(j+1,N):
        X=V[j]+V[i]
        Y=C[j]+C[i]
        ans=X-Y
        if ans_max<ans:
            ans_max=ans
        if N-j<2:
            for f in range(j+2,N):
                X = V[j] + V[i]+V[f]
                Y = C[j] + C[i]+C[f]
                ans = X - Y
                if ans_max < ans:
                    ans_max = ans
        else:
            break

print(ans_max)

Submission status: Wrong Answer

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

max_c = sum(C)
dp = [[0]*max_c for _ in range(N)]

for c in range(C[0],max_c):
    dp[0][c] = V[0] - C[0]
for n in range(1,N):
    for c in range(1,max_c):
        if c < C[n]:
            dp[n][c] = dp[n-1][c]
        elif dp[n-1][c] < dp[n-1][c-C[n]] + V[n] - C[n]:
            dp[n][c] = dp[n-1][c-C[n]] + V[n] - C[n]
        else:
            dp[n][c] = dp[n-1][c]
print(max(max(dp)))

Submission status: Wrong Answer

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

for j in range(N-1):
    for i in range(j+1,N):
        X=V[j]+V[i]
        Y=C[j]+C[i]
        ans=X-Y
        if ans_max<ans:
            ans_max=ans
        if N-j<=2:
            for f in range(j+2,N):
                X = V[j] + V[i]+V[f]
                Y = C[j] + C[i]+C[f]
                ans = X - Y
                if ans_max < ans:
                    ans_max = ans
        else:
            break

print(ans_max)

Submission status: Wrong Answer

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

for j in range(N-1):
    for i in range(j+1,N):
        X=V[j]+V[i]
        Y=C[j]+C[i]
        ans=X-Y
        if ans_max<ans:
            ans_max=ans
        for f in range(j+2,N):
            X = V[j] + V[i]+V[f]
            Y = C[j] + C[i]+C[f]
            ans = X - Y
            if ans_max < ans:
                ans_max = ans

print(ans_max)

Submission status: Wrong Answer

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

for j in range(N-1):
    for i in range(j+1,N):
        X=V[j]+V[i]
        Y=C[j]+C[i]
        ans=X-Y
        if ans_max<ans:
            ans_max=ans
            for f in range(j+2,N):
                X = V[j] + V[i]+V[f]
                Y = C[j] + C[i]+C[f]
                ans = X - Y
                if ans_max < ans:
                    ans_max = ans
        
print(ans_max)

Submission status: Wrong Answer

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

max_c = sum(C)
dp = [[0]*max_c for _ in range(N)]
an = [0]*max_c

for c in range(C[0],max_c):
    dp[0][c] = V[0]
    an[c] = V[0] - c
for n in range(1,N):
    for c in range(1,max_c):
        if c < C[n]:
            dp[n][c] = dp[n-1][c]
        else:
            dp[n][c] = max(dp[n-1][c], dp[n-1][c-C[n]]+V[n])
        an[c] = max(an[c], dp[n][c]-c)
print(max(an))

Submission status: Wrong Answer

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):
    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: Wrong Answer

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

Submission status: Wrong Answer

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

for j in range(N-1):
    for i in range(j+1,N):
        X=V[j]+V[i]
        Y=C[j]+C[i]
        ans=X-Y
        if ans_max<ans:
            ans_max=ans


print(ans_max)

Submission status: Wrong Answer

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: Wrong Answer

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

Submission status: Wrong Answer

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):
    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: Wrong Answer

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
        

if (X-Y) > 0:
    print(X-Y)