Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

inlist = list(map(int, input().split()))
a = inlist[0] * 100
b = inlist[1] * 100
c = inlist[2]
d = inlist[3]
e = inlist[4]
f = inlist[5]

tupleList = []

for i in range((f//a) + 1):
    for j in range((f - a*i)//b + 1):
        for k in range((f - a*i - b*j)//c + 1):
            for l in range((f - a*i - b*j - c*k)//d + 1):
                if (c*k + d*l)*(100 + e) <= (a*i + b*j + c*k + d*l)*e:
                    tupleList.append([i, j, k, l])
tupleList.remove([0, 0, 0, 0])

def concentration(i, j, k, l):
    return (c*k + d*l)/(a*i + b*j + c*k + d*l)

max_con = concentration(tupleList[0][0], tupleList[0][1], tupleList[0][2], tupleList[0][3])
max_tuple = tupleList[0]

for i in range(len(tupleList) - 1):
    if max_con < concentration(tupleList[i+1][0], tupleList[i+1][1], tupleList[i+1][2], tupleList[i+1][3]):
        max_con = concentration(tupleList[i + 1][0], tupleList[i + 1][1], tupleList[i + 1][2], tupleList[i + 1][3])
        max_tuple = tupleList[i + 1]

print(str(a*max_tuple[0] + b*max_tuple[1] + c*max_tuple[2] + d*max_tuple[3]) \
      + " " + str(c*max_tuple[2] + d*max_tuple[3]))


Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
a = int(input())

print(n*n - a)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

n = int(input())
k = int(input())
x = list(map(int, input().split())) #x[0->(n-1)]

sum = 0

for i in x:
    if i < k - i:
        sum = sum + i
    else:
        sum = sum + k - i

print(sum)

Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
a = int(input())

print(n*n - a)
Buggy python submission (verdict: Runtime Error):
n = int(input())
fst = n % 10
snd = n / 10

if (fst == 9) || (snd == 9):
    print("Yes")
elif :
    print("No")

Fixed submission:
# -*- coding: utf-8 -*-

n = int(input())
fst = n % 10
snd = n // 10

if (fst == 9) | (snd == 9):
    print("Yes")
else :
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
#N, K = (int(i) for i in input().split())
#B = [int(x) for x in input().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]

N, K = (int(i) for i in input().split())
A = [int(x) for x in input().split()]

cur = 1
for i in range(K-1):
    cur *= A[i]

pre = cur*A[K-1] 
cur = pre

#print(pre)
count = 0
for i in range(K, N):
    cur = cur//A[count] * A[i]
    #print(cur)
    if pre < cur:
        print("Yes")
    else:
        print("No")
    pre = cur
    count += 1


Fixed submission:
import sys
input = sys.stdin.readline
#N, K = (int(i) for i in input().split())
#B = [int(x) for x in input().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]

N, K = (int(i) for i in input().split())
A = [int(x) for x in input().split()]

for i in range(K, N):
    if A[i - K] < A[i]:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
N, X, Y = (int(i) for i in input().split())
#B = [int(x) for x in stdin.readline().rstrip().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]

ans = []

for i in range(1, N+1):
    for j in range(i+1, N+1):
        ans.append(min(j-i, abs(i-X)+1+abs(Y-j)))
        #ans.append(j-i)
        #print(min(j-i, abs(i-X)+1+abs(Y-j)), i, j)

#print(N)
for k in range(1, N):
    print(ans.count(k))


Fixed submission:
from sys import stdin
N, X, Y = (int(i) for i in input().split())
#B = [int(x) for x in stdin.readline().rstrip().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]

ans = [0]*N


for i in range(1, N+1):
    for j in range(i+1, N+1):
        d = min(j-i, abs(i-X)+1+abs(Y-j))
        ans[d] += 1
        #ans.append(j-i)
        #print(min(j-i, abs(i-X)+1+abs(Y-j)), i, j)

#print(N)
for k in range(1, N):
    print(ans[k])

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
N, X, Y = (int(i) for i in input().split())
#B = [int(x) for x in stdin.readline().rstrip().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]

ans = []

for i in range(1, N+1):
    for j in range(i+1, N+1):
        if True:
            ans.append(min(j-i, abs(i-X)+1+abs(Y-j)))
            #print(min(j-i, abs(i-X)+1+abs(Y-j)), i, j)
        elif j < Y or X < i:
            ans.append(j-i)
            #print(j-i, i, j)
        else:
            ans.append(j-i-(Y-X-1))

for k in range(1, N):
    print(ans.count(k))


Fixed submission:
from sys import stdin
N, X, Y = (int(i) for i in input().split())
#B = [int(x) for x in stdin.readline().rstrip().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]

ans = [0]*N


for i in range(1, N+1):
    for j in range(i+1, N+1):
        d = min(j-i, abs(i-X)+1+abs(Y-j))
        ans[d] += 1
        #ans.append(j-i)
        #print(min(j-i, abs(i-X)+1+abs(Y-j)), i, j)

#print(N)
for k in range(1, N):
    print(ans[k])
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline


N = int(input())
start = []
end = []
itv = []
for i in range(N):
    X, L = (int(i) for i in input().split())
    itv.append([X+L, X-L])
    #start.append(X-L)
    #end.append(X+L)

#XL = [[int(i) for i in input().split()] for i in range(N)] 

count = N
#line = [0] * (2*(10**9) +1)
XL = sorted(XL)


itv.sort()

ass = 0
tt = 0
for i in range(N):
    if tt < itv[i][1]:
        ass += 1
        tt = itv[i][0]
print(ass)


Fixed submission:
import sys
input = sys.stdin.readline


N = int(input())
start = []
end = []
itv = []
for i in range(N):
    X, L = (int(i) for i in input().split())
    itv.append([X+L, X-L])
    #start.append(X-L)
    #end.append(X+L)

#XL = [[int(i) for i in input().split()] for i in range(N)] 

#line = [0] * (2*(10**9) +1)

itv.sort()

#print(itv)

ass = 0
tt = 0-10**9
for i in range(N):
    if tt <= itv[i][1]:
        ass += 1
        tt = itv[i][0]
print(ass)
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

N, K, S = (int(i) for i in input().split())  
#a = [int(i) for i in input().split()] 
#e = [[int(i) for i in input().split()] for i in range(n)] 

seq = []

for i in range(K):
    seq.append(S)

for j in range(i+1, N):
    seq.append(2*S)

print(" ".join(map(str, seq)))


Fixed submission:
import sys
input = sys.stdin.readline

N, K, S = (int(i) for i in input().split())  
#a = [int(i) for i in input().split()] 
#e = [[int(i) for i in input().split()] for i in range(n)] 

seq = []
i = 0
for i in range(K):
    seq.append(S)

for j in range(0, N-K):
    if 2*S > 10**8:
        seq.append(1)
    else:
        seq.append(2*S)

print(" ".join(map(str, seq)))
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools

input = sys.stdin.readline
X = int(input())
#a = [int(i) for i in input().split()] 
#e = [[int(i) for i in input().split()] for i in range(n)] 

maxtimes = int(X/100)+1
pools = itertools.product(range(maxtimes), repeat=6)

for comb in pools:
    c = list(comb)
    price = c[0]*100+c[1]*101+c[2]*102+c[3]*103+c[4]*104+c[5]*105
    if price == X:
        print(1)
        exit()

print(0)


Fixed submission:
import sys
import itertools

input = sys.stdin.readline
X = int(input())
#a = [int(i) for i in input().split()] 
#e = [[int(i) for i in input().split()] for i in range(n)] 

maxtimes = int(X/100)+2
price = 0
for i1 in range(0, maxtimes):
    #if i1*100 > X:
        #break
    for i2 in range(0, int(X/101)+2):
        #if i1*100+i2*101 > X:
            #break
        for i3 in range(0, int(X/102)+2):
            #if i1*100+i2*101+i3*102 > X:
                #break
            for i4 in range(0, int(X/103)+2):
                #if i1*100+i2*101+i3*102+i4*103 > X:
                    #break
                for i5 in range(0, int(X/104)+2):
                    #if i1*100+i2*101+i3*102+i4*103+i5+104 > X:
                        #break
                    for i6 in range(0, int(X/105)+2):
                        price = i1*100+i2*101+i3*102+i4*103+i5*104+i6*105
                        #print(i1, i2, i3, i4, i5, i6)
                        if price == X:
                            print(1)
                            exit()
                        elif price > X:
                            break

print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N = int(input())
L = [int(i) for i in input().split()]
total = 0

L = sorted(L, reverse=True)

for i in range(N-2):
    if L[i+1] + L[i+2] <= L[i]:
        continue
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i] < L[j]+L[k] and L[j] < L[i]+L[k] and L[k] < L[i]+L[j]:
                total +=1
            else:
                break

print(total)


Fixed submission:
import sys
input = sys.stdin.readline

N = int(input())
L = [int(i) for i in input().split()]
total = 0

L = sorted(L)

for i in range(N-2):
    k = i + 2
    for j in range(i+1, N):
        while k < N and L[i] + L[j] > L[k]:
            k+=1
        if k > j:
            total += k-j-1

print(total)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline

N = int(input())
L = [int(i) for i in input().split()]
total = 0

for i in range(N):
    for j in range(i+1, N):
        for k in range(j+1, N):
            if L[i] < L[j]+L[k] and L[j] < L[i]+L[k] and L[k] < L[i]+L[j]:
                total +=1

print(total)


Fixed submission:
import sys
input = sys.stdin.readline

N = int(input())
L = [int(i) for i in input().split()]
total = 0

L = sorted(L)

for i in range(N-2):
    k = i + 2
    for j in range(i+1, N):
        while k < N and L[i] + L[j] > L[k]:
            k+=1
        if k > j:
            total += k-j-1

print(total)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import fractions
input = sys.stdin.readline
A, B = (int(i) for i in input().split())

gcd = fractions.gcd(A, B)
temp = gcd
count = 1
for i in range(2, gcd//2+1):
    if temp%i == 0:
        cnt = 0
        while temp%i ==0:
            cnt +=1
            temp //= i
        count +=1
if temp != 1:
    count +=1

print(count)


Fixed submission:
import sys
input = sys.stdin.readline
A, B = (int(i) for i in input().split())

cd = [1]
factors = {}
temp = A
for i in range(2, int(-(-A**0.5//1))+1):
    if temp%i==0:
        cnt = 0
        while temp%i==0:
            #print(temp)
            cnt+=1
            temp //= i
        factors[i] = 1
if temp!=1:
    factors[temp] = 1
#print(factors)
temp = B
for i in range(2, int(-(-B**0.5//1))+1):
    if temp%i==0:
        cnt = 0
        while temp%i==0:
            cnt+=1
            temp //= i
        #print(i)
        if i in factors:
            factors[i] = 2
        else:
            pass
if temp!=1:
    if temp in factors:
        factors[temp] = 2
#print(factors)
count = 1
for k, v in factors.items():
    if v==2:
        count+=1

print(count)
Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)


a, b, c, d = (int(i) for i in input().split())
m = lcm(c, d)
#print(m)
print((b-a+1)-(int((b)/c)-int((a-1)/c))-(int((b)/d)-int((a-1)/d))+(int((b)/(m))-int((a-1)/(m))))
#print("b-a", (b-a))
#print(int((b)/c)-int((a-1)/c))
#print((int((b)/d)-int((a-1)/d)))
#print((int((b-1)/m)-int((a-1)/m)))


Fixed submission:
def gcd(x, y):
    while y > 0:
        x, y = y, x%y
    return x

def lcm(x, y):
    return x/gcd(x, y)*y


a, b, c, d = (int(i) for i in input().split())
m = int(lcm(c, d))
#print(m)
print((b-a+1)-(int((b)//c)-int((a-1)//c))-(int((b)//d)-int((a-1)//d))+(int((b)//(m))-int((a-1)//(m))))
##print(m)
#print("b-a", (b-a+1))
#print(int((b)//c)-int((a-1)//c))
#print((int((b)//d)-int((a-1)//d)))
#print((int((b-1)//m)-int((a-1)//m)))
Buggy python submission (verdict: Runtime Error):
import math
N, K = (int(i) for i in input().split())
R = N-K

def cmb(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


for i in range(1, K+1):
    print(((cmb(K-1, i-1))*cmb(i+1+R-(i-1)-1, R-(i-1)))%(10**9+7))


Fixed submission:
N = int(input())
WS = [[int(i) for i in input().split()] for i in range(N)]
WS = sorted(WS, key=lambda x: x[1])
total = 0
for w in WS:
    total += w[0]
    if total > w[1]:
        print("No")
        exit()
print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdin
R, G, B, N = (int(i) for i in input().split())

count = 0
for i in range(N+1):
    for j in range(N+1):
        b = (N-i*R-j*G)/B
        if b.is_integer() and b >= 0:
            count +=1

print(count)


Fixed submission:
from sys import stdin
R, G, B, N = (int(i) for i in input().split())

count = 0
for i in range(N+1):
    N1 = N - i*R
    for j in range(N1+1):
        b = (N1 - j*G)/B
        if b.is_integer() and b >= 0:
            count +=1

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

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

max = 0
pattern = itertools.product(range(2), repeat=N)
for p in pattern:
    sum = 0
    count = 0
    for i in p:
        if i == 1:
            sum += V[count]-C[count]
        else:
            pass
        count +=1
    if sum > max:
        max = sum


print(max)


Fixed submission:
import itertools

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

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

print(sum)
Buggy python submission (verdict: Runtime Error):
import sys
N, M = (int(i) for i in input().split())
X = [int(i) for i in input().split()]
X.sort()

pos = [[0] * 2 for i in range(N)]
total = 0

if M <= N:
    print(0)
    sys.exit()

for i in range(N):
    pos[i][0] = i
    pos[i][1] = abs(X[i+1] - X[i])
    total = total + pos[i][1]

pos = sorted(pos, key=lambda x:(x[1]))

for j in range(N, M-1):
    dim = abs(X[j+1]-X[j])
    total = total + dim
    if pos[0][1] < dim:
        pos[0][0] = j
        pos[0][1] = dim
        pos = sorted(pos, key=lambda x:(x[1]))



pos = sorted(pos, key=lambda x:(x[1]), reverse = True)
for i in range(N-1):
    total = total - pos[i][1]

print(total)


Fixed submission:
T, X = (int(i) for i in input().split())

print(T/X)
Buggy python submission (verdict: Runtime Error):
li = int(input().split())
a=int(input())
magic = 0
for i in range(0,3):
    if li[0] >= li[1]:
        li[1] = li[1] * 2
        magic = magic + 1

for i in range(0,3):
    if li[1] >= li[2]:
        li[2] = li[2] * 2
        magic = magic + 1
if a >= magic:
    print("Yes")
else:
    print("No")

Fixed submission:
li = list(map(int,input().split()))
a=int(input())
magic = 0
for i in range(0,8):
    if li[0] >= li[1]:
        li[1] = li[1] * 2
        magic = magic + 1

for i in range(0,8):
    if li[1] >= li[2]:
        li[2] = li[2] * 2
        magic = magic + 1
if a >= magic:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
n = int(input())

if n >= 1800: print(1)
elif n >= 1600: print(2)
elif n >= 1400: print(3)
elif n >= 1200: print(4)
elif n >= 1000: print(5)
elif n >= 800: print(6)
elif n >= 600: print(7)
elif n >= 400:: print(8)

Fixed submission:
n = int(input())
 
if n >= 1800: print(1)
elif n >= 1600: print(2)
elif n >= 1400: print(3)
elif n >= 1200: print(4)
elif n >= 1000: print(5)
elif n >= 800: print(6)
elif n >= 600: print(7)
elif n >= 400: print(8)
Buggy python submission (verdict: Runtime Error):
n = int(input())
arr = input().split()


def mult():
    if 0 in arr:
        return 0
    else:
        a = 1
        for i in arr:
            a = a * int(i)
            if a > 1000000000000000000:
                return -1
            else: continue
        return a

print(mult())


Fixed submission:
arr = input().split()

print(int(arr[0]) * int(arr[1]))
Buggy python submission (verdict: Time Limit Exceeded):
arr = input().split()
a = int(arr[0])
b = int(arr[1])
c = int(arr[2])
k = int(arr[3])
sum = 0
while a > 0 and k > 0:
  sum += 1
  k -= 1
  a -= 1
  
while b > 0 and k > 0:
  k -= 1
  b -= 1
  
while c > 0 and k > 0:
  k -= 1
  sum -= 1
  c -= 1
  
print(sum)

Fixed submission:
arr = input().split()
a = int(arr[0])
b = int(arr[1])
c = int(arr[2])
k = int(arr[3])

if k <= a: print(k)
  
elif k <= (a+b): print(a)
  
else: print(a - (k - a - b))
Buggy python submission (verdict: Runtime Error):
a = int(input())

low, hi = map(int, input().split())

start = a * low//a

boolean = False

while not (start > hi):
  if lo <= start <= hi: 
    boolean = True
    break

if boolean: print("OK")
else: print("NG")

Fixed submission:
a = int(input())

low, hi = map(int, input().split())

start = a * int(low//a)

boolean = False

while not (start > hi):
  if low <= start <= hi: 
    boolean = True
    break
  start += a

if boolean: print("OK")
else: print("NG")
Buggy python submission (verdict: Runtime Error):
req = int(input())
count = 0
p = 100
while P < req:
  p += int(p/100)
  count +=1
  
print(count)


Fixed submission:
req = int(input())
count = 0
p = 100
while p < req:
  p = p * 101//100
  p = int(p)
  count +=1
  
print(count)

Buggy python submission (verdict: Runtime Error):
req = int(input())
count = 0
while P < req:
  p += int(P/100)
  count +=1
  
print(count)

Fixed submission:
req = int(input())
count = 0
p = 100
while p < req:
  p = p * 101//100
  p = int(p)
  count +=1
  
print(count)
Buggy python submission (verdict: Runtime Error):
yen = int(input())
'''
happy= 0
while yen > 499:
  yen -= 500
  happy += 1000

while yen > 4:
  yen -=5
  happy += 5
'''
happy = 1000 * int(yen//500) + 5 * int((yen - (500 * int(yen//500)))//5)

print(hap)py)


Fixed submission:
yen = int(input())
'''
happy= 0
while yen > 499:
  yen -= 500
  happy += 1000

while yen > 4:
  yen -=5
  happy += 5
'''
happy = 1000 * int(yen//500) + 5 * int((yen - (500 * int(yen//500)))//5)

print(happy)
Buggy python submission (verdict: Runtime Error):
even,odd = map(int, input().split())

def f(n):
  if n == 1 or n == 0:
    return 1
  else:
    return n*f(n-1)
  
print(int(f(even)/(f(even-2)*2) + f(odd)/(f(odd-2)*2)))

Fixed submission:
even,odd = map(int, input().split())

  
print(int(even * (even-1)/2 + odd * (odd-1)/2))

Buggy python submission (verdict: Runtime Error):
even,odd = map(int, input().split())

def f(n):
if n == 1 or n ==0:
   return 1
else:
   return n*f(n-1)
  
print(f(even) + f(odd))

Fixed submission:
even,odd = map(int, input().split())

  
print(int(even * (even-1)/2 + odd * (odd-1)/2))
Buggy python submission (verdict: Runtime Error):
string = input()

def palindrome(inp):
  if inp == inp[::-1]: return True
  else: return False
  
if palindrome(string) and palindrome(string[:int((len(string) + 1)/2)] and palindrome(string[int((len(string) +3)/2):]: print("Yes")
else: print("No")

Fixed submission:
string = input()

def palindrome(inp):
  if inp == inp[::-1]: return True
  else: return False

if palindrome(string) and palindrome(string[:int((len(string) -1)/2)]) and palindrome(string[int((len(string) +1)/2):]): print("Yes")
else: print("No")
Buggy python submission (verdict: Runtime Error):
s = input()

if s = "BBB" or s = "AAA": print("No")
else: print("Yes")

Fixed submission:
s = input()

if s == "BBB" or s == "AAA": print("No")
else: print("Yes")
Buggy python submission (verdict: Runtime Error):
n = int(input())

print int(n//2) + n % 2

Fixed submission:
n = int(input())

print(int(n//2) + n % 2)
Buggy python submission (verdict: Runtime Error):
n,k = map(str, input().split())
k = int(k)
num = 0

for i in range(0, len(n)):
  sum += int(n[i]) * k^(len(n)-i)
  
print(len(str(sum)))

Fixed submission:
n,k = map(int, input().split())

ans = 0

while n > 0:
  n /= k
  n = int(n)
  ans += 1
  
print(ans)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input())

ans = "No"

if (a == b or a== c or b == c) and not (a==b==c): ans = "Yes"
  
print(ans)

Fixed submission:
a,b,c = map(int, input().split())

ans = "No"

if (a == b or a== c or b == c) and not (a==b==c): ans = "Yes"
  
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())

def push(chara, dig):
  if ord(chara) + dig > 90: return chr(64 + dig + ord(chara) -90)
  else: return chr(dig + ord(chara))
  
string = input()

for i in range(0, len(string)):
  string[i] = push(string[i], n)
  
print(string)

Fixed submission:
n = int(input())

def push(chara, dig):
  if ord(chara) + dig > 90: return chr(64 + dig + ord(chara) -90)
  else: return chr(dig + ord(chara))
  
string = input()
e = ""
for i in range(0, len(string)):
  e = e + push(string[i], n)
  
print(e)
Buggy python submission (verdict: Runtime Error):
a = int(input())

if a % 2 == 1: print( ((a-1)/2 + 1)/a )
else: print 0.5

Fixed submission:
a = int(input())

if a % 2 == 1: print( ((a-1)/2 + 1)/a )
else: print(0.5)
Buggy python submission (verdict: Runtime Error):
n = int(input())
dishes = list(map(int, input().split()))
points = list(map(int, input().split()))
bonuses = list(map(int, input().split()))

score = 0
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i == prev + 1: score += bonuses[i-1]
  prev = i

print(score)

Fixed submission:
n = int(input())
dishes = list(map(int, input().split()))
points = list(map(int, input().split()))
bonuses = list(map(int, input().split()))

score = 0
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i == prev + 1: score += bonuses[i-2]
  prev = i

print(score)

Buggy python submission (verdict: Runtime Error):
n = int(input())
dishes = list(map(int, input().split()))
points = list(map(int, input().split()))
bonuses = list(map(int, input().split()))

score = 0
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i == prev + 1: score += bonuses[i-1]
  prev = i


Fixed submission:
n = int(input())
dishes = list(map(int, input().split()))
points = list(map(int, input().split()))
bonuses = list(map(int, input().split()))

score = 0
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i == prev + 1: score += bonuses[i-2]
  prev = i

print(score)

Buggy python submission (verdict: Runtime Error):
n = int(input())
dishes = list(map(int, input().split()))
points = list(map(int, input().split()))
bonuses = list(map(int, input().split()))

score = 
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i == prev + 1: score += bonuses[i-1]
  prev = i


Fixed submission:
n = int(input())
dishes = list(map(int, input().split()))
points = list(map(int, input().split()))
bonuses = list(map(int, input().split()))

score = 0
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i == prev + 1: score += bonuses[i-2]
  prev = i

print(score)

Buggy python submission (verdict: Runtime Error):
n = int(input())
dishes = list(map(int, input().split()))
points = list(map(int, input().split()))
bonuses = list(map(int, input().split()))

score = 
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i = prev + 1: score += bonuses[i-1]
  prev = i

Fixed submission:
n = int(input())
dishes = list(map(int, input().split()))
points = list(map(int, input().split()))
bonuses = list(map(int, input().split()))

score = 0
prev = 0
for i in dishes:
  score += points[i-1]
  if prev > 0:
    if i == prev + 1: score += bonuses[i-2]
  prev = i

print(score)
Buggy python submission (verdict: Runtime Error):
a = int(input())
for i in range(1, a + 1):
  if len(str(i)) % 2 ==1: ans+=1   
print(ans)


Fixed submission:
a = int(input())
ans = 0
for i in range(1, a + 1):
  if len(str(i)) % 2 ==1: ans+=1   
print(ans)
Buggy python submission (verdict: Runtime Error):
from math import ceil

a,b=map(int,input().split())

print(math.ceil(a//(2*b+1)))


Fixed submission:
a,b=map(int,input().split())

ans = a//(2*b+1)

if a%(2*b+1) == 0: pass
else: ans += 1
print(ans)