TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: 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.

Submission attempts (in order):
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
d = 0
for i range(n):
    d = v[i] - c[i]
    if 0 < d:
        ans += d
print(int(ans))

n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i range(n):
    d = v[i] - c[i]
    if 0 < d:
        ans += d
print(int(ans))

n = int(input())
v = list(map(int, input().split))
c = list(map(int, input().split))
d = 0
for i range(n):
    d = v[i] - c[i]
    if 0 < d:
        ans += d
print(int(ans))


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


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)

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)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
Number = input()

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

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

count = 0

for i in range(Number):
  if tresure_value[i] - cost[i] > 0:
    count += tresure_value[i] - cost[i]
    
print(count)

Number = input()
 
tresure_value = list(map(int , input().split()))
 
cost = list(map(int , input().split()))
 
count = 0
 
for i in range(Number):
  benefit = int(tresure_value[i] - cost[i])
  if benefit  > 0:
    count += benefit 
    
print(count)

Number = input()
 
tresure_value = list(map(int , input().split()))
 
cost = list(map(int , input().split()))
 
count = 0
 
for i in range(Number):
  benefit = int(tresure_value[i]) - int(cost[i])
  if benefit  > 0:
    count += benefit 
    
print(count)

Number = int(input())
tresure_value = list(map(int , input().split()))
cost = list(map(int , input().split()))
cnt = 0
 
for i in range(len(tresure_value)):
  benefit = tresure_value[i] - cost[i]
  if benefit  > 0:
    count = count + benefit 
    
print(cnt)


Number = input()
 
tresure_value = list(map(int , input().split()))
 
cost = list(map(int , input().split()))
 
count = 0
 
for i in range(Number):
  benefit = tresure_value(i) - cost(i)
  if benefit  > 0:
    count = count + benefit 
    
print(count)

Number = int(input())
tresure_value = list(map(int , input().split()))
cost = list(map(int , input().split()))
 
count = 0
 
for i in range(Number):
  benefit = tresure_value(i) - cost(i)
  if benefit  > 0:
    count = count + benefit 
    
print(count)


Number = int(input())
tresure_value = list(map(int , input().split()))
cost = list(map(int , input().split()))
cnt = 0
 
for i in range(len(tresure_value)):
  benefit = tresure_value[i] - cost[i]
  if benefit  > 0:
    cnt = cnt + benefit 
    
print(cnt)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
sum=0
i=0
while i<n:
  if v[i]>c[i]:
    sum+=v[i]-c[i]
print(sum)

n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
sum=0
i=0
while i<n:
  if v[i]>c[i]:
    sum+=v[i]-c[i]
    i+=1
print(sum)


n=int(input())
v=list(map(int,input().split()))
c=list(map(int,input().split()))
sum=0
i=0
while i<n:
    if v[i]>c[i]:
        sum+=v[i]-c[i]
    i+=1
print(sum)


Verdicts: Time Limit Exceeded

Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
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)


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, i-j)
print(ans)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
v = map(int, input().split())
c = map(int, input().split())

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

print(ans)

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)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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))

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

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

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

n=int(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))

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
val = []
for i in map(int, input().split()):
    i.append(val)
cost = []
for i in map(int, input().split()):
    i.append(cost)

x = 0
y = 0
m1 = 0
for i in range(n):
    x += val[i]
    y += cost[i]
    m2 = x-y
    if m1 < m2:
        m1 = m2

print(m2)


n = int(input())
val = []
for i in map(int, input().split()):
    val.append(i)
cost = []
for i in map(int, input().split()):
    cost.append(i)

ans = 0
for i in range(n):
    m = val[i] - cost[i]
    if m > 0:
        ans += m

print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N=int(input())
Vs=str(input())
Cs=str(input())
ListV=Vs.split()
ListC=Cs.split()
for i in range(0,len(ListV),1):
  a=ListV.pop(0)
  ListV.insert(0,int(a))

for i in range(0,len(ListC),1):
  b=ListC.pop(0)
  ListC.insert(0,int(b))

ListI=[]
for i in range(0,len(ListV),1):
  c=ListV[i]-ListC[i]
  ListI.append(0)

Ans=0
for i in range(0,len(ListI),1):
  if ListI[i]>0:
    Ans+=ListI[i]

print(Ans)

N=int(input())
Vs=str(input())
Cs=str(input())
ListV=Vs.split()
ListC=Cs.split()
for i in range(0,len(ListV),1):
  a=ListV.pop(0)
  ListV.insert(0,int(a))

for i in range(0,len(ListC),1):
  b=ListC.pop(0)
  ListC.insert(0,int(b))

ListI=[]
for i in range(0,len(ListV),1):
  c=ListV[i]-ListC[i]
  ListI.append(c)

Ans=0
for i in range(0,len(ListI),1):
  if ListI[i]>0:
    Ans+=ListI[i]

print(Ans)


N=int(input())
Vs=str(input())
Cs=str(input())
ListV=Vs.split()
ListC=Cs.split()
for i in range(0,len(ListV),1):
  a=ListV.pop(0)
  ListV.append(int(a))

for i in range(0,len(ListC),1):
  b=ListC.pop(0)
  ListC.append(int(b))

ListI=[]
for i in range(0,len(ListV),1):
  c=ListV[i]-ListC[i]
  ListI.append(c)

Ans=0
for i in range(0,len(ListI),1):
  if ListI[i]>0:
    Ans+=ListI[i]

print(Ans)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
num = input()
value = [int(n) for n in input().split()]
cost = [int(n) for n in input().split()]

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

print(ans)

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

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


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)

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)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
vl = [int(input()) for _ in range(n)]
cl = [int(input()) for _ in range(n)]
ans = 0
for i in range(n):
    if vl[i] > cl[i]:
        ans += v[i]-c[i]
print(ans)

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

n = int(input())
vl = list(map(int, input().split()))
cl = list(map(int, input().split()))
ans = 0
for i in range(n):
    if vl[i] > cl[i]:
        ans += vl[i]-cl[i]
print(ans)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)

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)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
# -*- coding: utf-8 -*-
n = int(input())
v = input()
c = input()
ri = 0
for i in range(0,n):
    a  = v[i] - c[i] 
    if a > 0:
        ri += a
    else:
        pass
print(ri)

# -*- coding: utf-8 -*-
n = int(input())
v = input().split()
c = input().split()
ri = 0
for i in range(0,n):
    a  = v[i] - c[i] 
    if a>0:
        ri += a
    else:
        pass
print(ri)

# -*- coding: utf-8 -*-
n = int(input())
v = map(int, input().split())
c = map(int, input().split())
ri = 0
for i in range(0,n):
    a  = v[i] - c[i] 
    if a>0:
        ri += a
    else:
        pass
print(ri)

# -*- coding: utf-8 -*-
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ri = 0
for i in range(0,n):
    a  = v[i] - c[i] 
    if a>0:
        ri += a
    else:
        pass
print(ri)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split()))

cal = []
for i in range(0,n):
    cal.append(v[i]-c[i])
cal.sort(reverse=True)
print(cal)
ans = 0
for j in range(0,n):
    if cal[j] < 0:
        break
    ans += cal[j]
print(ans)

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)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = map(int, input().split())
values = [int(input()) for _ in range(N)]
costs = [int(input()) for _ in range(N)]
# N = 3
# values = [10, 2, 5]
# costs = [6, 3, 4]
# N = 4
# values = [13, 21, 6, 19]
# costs = [11, 30, 6, 15]
# N = 1
# values = [1,]
# costs = [50,]


def calculate_maximum_gain(values, costs):
    gain = 0
    for value, cost in zip(values, costs):
        if value - cost > 0:
            gain = gain + value - cost
    
    return gain


print(calculate_maximum_gain(values, costs))


N = map(int, input().split())
values = list(map(int, input().split()))
costs = list(map(int, input().split()))
# N = 3
# values = [10, 2, 5]
# costs = [6, 3, 4]
# N = 4
# values = [13, 21, 6, 19]
# costs = [11, 30, 6, 15]
# N = 1
# values = [1,]
# costs = [50,]


def calculate_maximum_gain(values, costs):
    gain = 0
    for value, cost in zip(values, costs):
        if value - cost > 0:
            gain = gain + value - cost
    
    return gain


print(calculate_maximum_gain(values, costs))


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n=map(int,input().split())
xlist=[]
ylist=[]
v=list(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(n):
  if v[i]>c[i]:
    xlist.append(v[i])
    ylist.append(c[i])
ans=sum(xlist)-sum(ylist)
print(ans)

n=int(input())
xlist=[]
ylist=[]
v=list(map(int,input().split()))
c=list(map(int,input().split()))
for i in range(n):
  if v[i]>c[i]:
    xlist.append(v[i])
    ylist.append(c[i])
ans=0
ans=sum(xlist)-sum(ylist)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
      
sumV = 0
sumC = 0
maxi = 0
for i in range(n):
    sumV += v[i]
    sumC += c[i]
    maxi = max(sumV-sumC,maxi)
print(maxi)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

V = []
C = []
N = 0
 
i = 0
ans = 0

str = input()
N = int(str)
 
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)

N = input()
N = (int)N
i=0
V = []
C = []
num = 0
while i<N:
  num = input()
  V.append((int)num)

num = 0
i=0
while i<N:
  num = input()
  C.append((int)num)
max = 0
while i<N:
  max += v[i] - C[i]
  
print(max)

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)

N = input()
N = (int)N
i=0
V = []
C = []
num = 0
while i<N:
  num = input()
  num = (int)num
  V.append(num)
 
num = 0
i=0
while i<N:
  num = input()
  num = (int)num
  C.append(num)
max = 0
while i<N:
  max = max + V[i] - C[i]
  
print(max)

N = input();
i=0
V = []
C = []
var = 0
while i<(int)N:
  var = (int)input()
  if var <=50 and var >= 0:
    V.append(var)
i = 0

while i<(int)N:
  var = (int)input()
  if var <= 50 and var >= 0:
    C.append(var)

i = 0
max = 0
while i < N:
  if V[i] - C[i] > 0:
    max = max + V[i] - C[i]

print(max)

N = input()
N = (int)N
i=0
V = []
C = []
num = 0
while i<N:
  num = input()
  V.append((int)num)
 
num = 0
i=0
while i<N:
  num = input()
  C.append((int)num)
max = 0
while i<N:
  max += V[i] - C[i]
  
print(max)

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

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

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

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


Verdicts: Wrong Answer

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Runtime Error

Runtime Error

Time Limit Exceeded

Accepted
Problem: 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.

Submission attempts (in order):
import itertools
lv = []
lc = []
diff = []
for i in range(1,n+1):
    for p in itertools.combinations(v,i):
        lv.append(sum(p))
    for p in itertools.combinations(c,i):
        lc.append(sum(p))
for i in range(len(lv)):
    diff.append(lv[i]-lc[i])
print(0 if max(diff)<0 else max(diff))

n = int(input())
lv = list(map(int, input().split()))
lc = list(map(int, input().split()))

ans = 0
for i in range(n):
    ans += max(lv[i] - lc[i], 0)
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N = input()
a = [input() for i in range(N)]
b = [input() for i in range(N)]

sum = 0

for i in range(N):
  if a[i] > b[i]:
    sum += a[i] -b[i]

print(sum)

N = int(input())
a = input().split()
b = input().split()

sum = 0

for i in range(N):
  if int(a[i]) > int(b[i]):
    sum += int(a[i]) -int(b[i])

print(sum)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
V = map(int, input().split())
C = map(int, input().split())

N = []
for i, v in enumerate(V):
    N.append(V[i]-C[i])

N.sort(reverse=True)

result = 0
for n in N:
    if 0<n:
        result += n
    else:
        break

print(result)

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

N = []
for i, v in enumerate(V):
    N.append(V[i]-C[i])

N.sort(reverse=True)

result = 0
for n in N:
    if 0<n:
        result += n
    else:
        break

print(result)

N = int(input())
V = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
 
N = []
for i, v in enumerate(V):
    N.append(V[i]-C[i])

N.sort(reverse=True)
 
result = 0
for n in N:
    if 0<n:
        result += n
    else:
        break

print(result)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())
arr=list(map(int,input().split()))
arr2=lisT9map(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)


n=int(input())
arr=list(map(int,input().split()))
arr2=lisT9map(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)


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)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)

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)

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)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

W = [v-c for v, c in zip(V, C) if (v-c) > 0]
print(sum(W)

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

W = [v-c for v, c in zip(V, C) if (v-c) > 0]
print(sum(W))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N = input()
V = input().split()
C = input().split()
ret_X_Y = 0

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

N = input()
V = input().split()
C = input().split()
ret_X_Y = 0
V = [int(i) for i in V]
C = [int(i) for i in C]
for i in range(len(V)):
    if (V[i] - C[i]) > 0:
        ret_X_Y += V[i] - C[i]
print(ret_X_Y)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
# -*- coding: utf-8 -*-

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

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

print(gain)

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)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
X = [0 for i in range(2**N)]
Y = [0 for i in range(2**N)]
Z = [0 for i in range(2**N)]

for i in range(2**N):
    select = []
    if i > 0:
        temp = i
        for n in reversed(range(1, N+1)):
            if temp - 2**(n-1) >= 0:
                temp = temp - 2**(n-1)
                select.append(n-1)
            else:
                pass
        X[i] = sum([V[i] for i in select])
        Y[i] = sum([C[i] for i in select])
        Z[i] = X[i] - Y[i]
print(max(Z))

N = int(input())
V = [int(x.strip()) for x in input().split()]
C = [int(x.strip()) for x in input().split()]

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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))

import numpy as np
N=int(input())
X=list(map(int, input().split()))
Y=list(map(int, input().split()))
Z=np.zeros(N)
for i in range(N):
  Z[i]=X[i]-Y[i]
print('{:.0f}'.format(sum(Z[np.where(Z>0)])))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
v = list(map(int,input()))
c = list(map(int,input()))

total_v = 0

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

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

total_v = 0

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



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

total_v = 0

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


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

total_v = 0

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

print(total_v)

Verdicts: Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)  

N, *V = map(int, open(0).read().split())
s = 0
for i in range(N):
    v = V[i]
    c = V[i+N]
    d = v - c
    s += (v-c if v-c > 0 else 0)
print(s)


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
V = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

XY = 0

for i in range(N):
    XY += np.maximum(0, V[i]-C[i])

print(XY)


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

XY = 0

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

print(XY)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())
list_v=list(map(int, input().split()))
list_c=list(map(int, input().split()))
list_ans = list_v - list_c
ans = 0
for i in range(n):
  if list_ans[i] > 0:
    ans += list_ans[i]
print(ans)

n=int(input())
list_v=list(map(int, input().split()))
list_c=list(map(int, input().split()))
ans = 0
for i in range(n):
  ans_p = list_v[i] - list_c[i]
  if ans_p > 0:
    ans += ans_p
print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):





















# ■■■■■■■■■■■■■■■■■■■■■

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)






















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)


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

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

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = input()
list_v = list(map(int, input.split()))
list_c = list(map(int, input.split()))

max_value = 0

for i in range(n):
    if list_v[i]>list_c[i]:
        max_value = max_value + (list_v[i]-list_c[i])
        
print(max_value)

n = int(input())
list_v = list(map(int, input().split()))
list_c = list(map(int, input().split()))

max_value = 0

for i in range(n):
    if list_v[i]>list_c[i]:
        max_value = max_value + (list_v[i]-list_c[i])

print(max_value)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n=int(input())
v=map(int, input().split())
c=map(int, input().split())

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

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) if (v[i]-c[i]) > 0]
print(sum(vc))

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N=int(input())
V = list(int(i) for i in input().split()) 
C = list(int(i) for i in input().split()) 
S=[]
for i in range(N):
	S.append(V[i]-C[i])
for i in range(N):
	if S[i]>0:
		ans=ans+S[i]
print(ans)

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


Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)

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


Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
N = int(input())
list1 = map(int,input().split())
list2 = map(int,input().split())
x = 0
for i in range(N):
    x = list1[i] - list2[i]
    if x >> 0:
         y += x
print(y)

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)

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

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

print(ans)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n= int(input())
v_list = [int(i) for i in input().split()]
c_list = [int(i) for i in input().split()]

for _ in zip(v_list, c_list):
  if(v_list>=c_list):
    val = val + (v_list-c_list)

print(val)

n= int(input())
v_list = [int(i) for i in input().split()]
c_list = [int(i) for i in input().split()]

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

n= int(input())
v_list = [int(i) for i in input().split()]
c_list = [int(i) for i in input().split()]

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
a = int(input())
v = list(map(int,input().split()))
c = list(map(int,input().split())) 
ans = 0

for i in range(a):
    if v(i) >= c(i):
        ans += (v(i)-c(i))
        
print(ans)

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

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
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)
    

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

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

print(t)
    

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
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)

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)

Verdicts: Wrong Answer

Accepted
Problem: 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.

Submission attempts (in order):
n = input()
v = input()
v = v.split()
c = input()
c = c.split()

VSubC = []

for index in range(n):
  heapq.heappush(VSubC, -(v[index] - c[index]))

answer = 0
while(len(VSubC) > 0):
  item = heapq.heappop(VSubC)
  if (item < 0):
    answer -= item
  else:
    break

print(answer)

import heapq

n = input()
v = input()
v = v.split()
c = input()
c = c.split()

VSubC = []

for index in range(int(n)):
  heapq.heappush(VSubC, -(int(v[index]) - int(c[index])))

answer = 0
while(len(VSubC) > 0):
  item = heapq.heappop(VSubC)
  if (item < 0):
    answer -= item
  else:
    break

print(answer)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
from sys import stdin

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

profit = []
sum_profit = 0

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

print(sum_profit)

from sys import stdin

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

profit = []
sum_profit = 0

for i in N:
    profit[i] = data[1][i] - data[2][i]
    if profit[i] > 0:
        sum_profit += profit[i]

print(sum_profit)

from sys import stdin

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

profit = [0] * N
sum_profit = 0

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

print(sum_profit)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
N=int(input())
V=list(map(int,input().split))
C=list(map(int,input().split))
mouke=0
for i in range(N):
    adv=V[i]-C[i]
    if adv>0:
        mouke+=adv:
print(mouke)

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

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

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
x = []

for i in range(n):
    x.append(int(v[i]-c[i]))

x.sort()

y = 0

i = n-1

while x[i] >= 0 and i >= 0 :
    y += x[i]
    i += -1

print(y)

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

x = []
 
for i in range(n):
    x.append(int(v[i]-c[i]))
 
x.sort()
 
y = 0
 
i = n-1
 
while x[i] >= 0 and i >= 0 :
    y += x[i]
    i += -1
 
print(y)

Verdicts: Runtime Error

Accepted
Problem: 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.

Submission attempts (in order):
n = int(input())
v = map(int,input().split())
c = map(int,input().split())
maxbenefit = 0
for i in range(n):
    if c[i]<v[i]:
        maxbenefit += v[i]-c[i]
print(maxbenefit)

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

Verdicts: Runtime Error

Accepted