Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

tmp = -10
li = [a,b,c,d,e]
for i in li:
  tmp += math.ceil(i/10)*10
li_1 = [a%10,b%10,c%10,d%10,e%10]
for i in range(5):
  try:
    li_1.remove(0)
  except:
    break
print(int(tmp + min(li_1)))

Fixed submission:
import math

a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

tmp = -10
li = [a,b,c,d,e]
for i in li:
  tmp += math.ceil(i/10)*10
if a%10 + b%10 + c%10 + d%10 + e%10 == 0:
  print(int(tmp +10))
else:
  li_1 = [a%10,b%10,c%10,d%10,e%10]
  for i in range(5):
    try:
      li_1.remove(0)
    except:
      break
  print(int(tmp + min(li_1)))
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()

place = set()
index = -1
while True:
  index = s.find("AC",index + 1)
  if index == -1:
    break
  place.add(index)

for i in range(q):
  l,r = map(int,input().split())
  tmp = len(place&set(range(l-1,r)))
  if r-1 in place:
    print(tmp-1)
  else:
    print(tmp)

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

li = [0]*(n+1)
for i in range(1,n+1):
  if s[i-1:i+1] == "AC":
    li[i] = li[i-1] + 1
  else:
    li[i] = li[i-1]
for i in range(q):
  l,r = map(int,input().split())
  print(li[r-1]-li[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()

for i in range(q):
  l,r = map(int,input().split())
  print(s[l-1:r].count("AC"))

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

li = [0]*(n+1)
for i in range(1,n+1):
  if s[i-1:i+1] == "AC":
    li[i] = li[i-1] + 1
  else:
    li[i] = li[i-1]
for i in range(q):
  l,r = map(int,input().split())
  print(li[r-1]-li[l-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
s = input()

for i in range(q):
  l,r = map(int,input().split())
  print(s[l-1:r].count("AC"))

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

li = [0]*(n+1)
for i in range(1,n+1):
  if s[i-1:i+1] == "AC":
    li[i] = li[i-1] + 1
  else:
    li[i] = li[i-1]
for i in range(q):
  l,r = map(int,input().split())
  print(li[r-1]-li[l-1])
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input(),split())
print(a*b/2)

Fixed submission:
a,b,c = map(int,input().split())
print(int(a*b/2))
Buggy python submission (verdict: Time Limit Exceeded):
n,k = map(int,input().split())
li = list(map(int,input().split()))

li = li + [0]*k
dp = [10**9]*(n+k)
dp[0] = 0
for i in range(n):
  for j in range(k):
    dp[i+j+1] = min(dp[i+j+1],dp[i] + abs(li[i]-li[i+j+1]))
print(dp[n-1])

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

li = li + [0]*k
dp = [10**9]*(n+k)
dp[0] = 0
for i in range(n):
  for j in range(k):
    dp[i+j+1] = min(dp[i+j+1],dp[i] + abs(li[i]-li[i+j+1]))
print(dp[n-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
tmp = 1
lipos = [1]
while tmp<10**9:
  tmp *= 4
  lipos.append(lipos[-1]+tmp)
#print(lipos)
tmp = -2
lineg = [-2]
while tmp > - 10**9:
  tmp *= 4
  lineg.append(lineg[-1]+tmp)
#print(lineg)
if n == 0:
  print("0")
elif n == 1:
  print("1")
elif n == -1:
  print("10")
elif n > 0:
  flag = True
  i = 0
  while flag:
    if lipos[i] < n <= lipos[i+1]:
      k = i+1
      flag = False
    i += 1
  diff = lipos[k]-n
  print(bin(lipos[k]^diff)[2:])
else:
  flag = True
  i = 0
  if lineg[i] > n >= lineg[i+1]:
    k = i+1
    flag = False
  i += 1
  diff = n-lineg[k]
  print(bin((-lineg[k])^diff)[2:])

Fixed submission:
n = int(input())
tmp = 1
lipos = [1]
while tmp<10**9:
  tmp *= 4
  lipos.append(lipos[-1]+tmp)
#print(lipos)
tmp = -2
lineg = [-2]
while tmp > - 10**9:
  tmp *= 4
  lineg.append(lineg[-1]+tmp)
#print(lineg)
if n == 0:
  print("0")
elif n == 1:
  print("1")
elif n == -1:
  print("10")
elif n > 0:
  flag = True
  i = 0
  while flag:
    if lipos[i] < n <= lipos[i+1]:
      k = i+1
      flag = False
    i += 1
  diff = lipos[k]-n
  print(bin(lipos[k]^diff)[2:])
else:
  flag = True
  i = 0
  while flag:
    if lineg[i] > n > lineg[i+1]:
      k = i+1
      flag = False
    i += 1
  diff = n-lineg[k]
  print(bin((-lineg[k])^diff)[2:])

Buggy python submission (verdict: Runtime Error):
n = int(input())
tmp = 1
lipos = [1]
while tmp<10**9:
  tmp *= 4
  lipos.append(lipos[-1]+tmp)
#print(lipos)
tmp = -2
lineg = [-2]
while tmp > - 10**9:
  tmp *= 4
  lineg.append(lineg[-1]+tmp)
#print(lineg)
if n == 0:
  print("0")
elif n == 1:
  print("1")
elif n == -1:
  print("10")
elif n > 0:
  flag = True
  i = 0
  while flag:
    if lipos[i] < n <= lipos[i+1]:
      k = i+1
      flag = False
    i += 1
  diff = lipos[k]-n
  print(bin(lipos[k]^diff)[2:])
else:
  flag = True
  i = 0
  if lineg[i] > n > lineg[i+1]:
    k = i+1
    flag = False
  i += 1
  diff = n-lineg[k]
  print(bin((-lineg[k])^diff)[2:])

Fixed submission:
n = int(input())
tmp = 1
lipos = [1]
while tmp<10**9:
  tmp *= 4
  lipos.append(lipos[-1]+tmp)
#print(lipos)
tmp = -2
lineg = [-2]
while tmp > - 10**9:
  tmp *= 4
  lineg.append(lineg[-1]+tmp)
#print(lineg)
if n == 0:
  print("0")
elif n == 1:
  print("1")
elif n == -1:
  print("10")
elif n > 0:
  flag = True
  i = 0
  while flag:
    if lipos[i] < n <= lipos[i+1]:
      k = i+1
      flag = False
    i += 1
  diff = lipos[k]-n
  print(bin(lipos[k]^diff)[2:])
else:
  flag = True
  i = 0
  while flag:
    if lineg[i] > n > lineg[i+1]:
      k = i+1
      flag = False
    i += 1
  diff = n-lineg[k]
  print(bin((-lineg[k])^diff)[2:])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
for i in range(n):
  li[i] -= i+1
li.sort()
ans = 10**15
for i in range(n):
  ans = min(ans,i*li[i]-sum(li[:i])+sum(li[i:])-(n-i)*li[i])
print(ans)

Fixed submission:
n = int(input())
li = list(map(int,input().split()))
for i in range(n):
  li[i] -= i+1
li.sort()
if n%2 == 0:
  print(sum(li[int(n/2):])-sum(li[:int(n/2)]))
else:
  tmp = int((n-1)/2)
  print(sum(li[tmp+1:])-sum(li[:tmp]))

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
for i in range(n):
  li[i] -= i+1
li.sort()
ans = 10**15
for i in range(n):
  ans = min(ans,i*li[i]-sum(li[:i])+sum(li[i:])-(n-i)*li[i])
print(ans)

Fixed submission:
n = int(input())
li = list(map(int,input().split()))
for i in range(n):
  li[i] -= i+1
li.sort()
if n%2 == 0:
  print(sum(li[int(n/2):])-sum(li[:int(n/2)]))
else:
  tmp = int((n-1)/2)
  print(sum(li[tmp+1:])-sum(li[:tmp]))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

ans = 10**6
for i in range(n):
  ans = min(ans,s[:i].count("W")+s[i+1:].count("E"))
print(ans)

Fixed submission:
n = int(input())
s = input()

tmp = s[1:].count("E")
ans = min(10**6,tmp)
for i in range(n-1):
  if s[i] == "W":
    tmp += 1
  if s[i+1] == "E":
    tmp -= 1
  ans = min(ans,tmp)
print(ans)
Buggy python submission (verdict: Runtime Error):
xxx

Fixed submission:
s = input()
print(700 + s.count("o")*100)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
for i in range(n):
  tmp = sorted(li[:i]+li[i+1:])
  print(tmp[int(n/2)-1])

Fixed submission:
n = int(input())
li = list(map(int,input().split()))
lis = sorted(li)
m = lis[int(n/2)-1]
M = lis[int(n/2)]
for i in range(n):
  if li[i] <= m:
    print(M)
  else:
    print(m)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
for i in range(n):
  tmp = sorted(li[:i]+li[i+1:])
  print(tmp[int(n/2)-1])

Fixed submission:
n = int(input())
li = list(map(int,input().split()))
lis = sorted(li)
m = lis[int(n/2)-1]
M = lis[int(n/2)]
for i in range(n):
  if li[i] <= m:
    print(M)
  else:
    print(m)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k = map(int,input().split())
lia = list(range(a,a+k))
lib = list(range(b-k+1,b+1))
setans = set(lia + lib)&set(range(a,b+1))
for i in sorted(setans):
  print(i)

Fixed submission:
a,b,k = map(int,input().split())
lia = list(range(a,a+k))
lib = list(range(b-k+1,b+1))
if a+k > b:
  setans = set(lia + lib)&set(range(a,b+1))
else:
  setans = set(lia + lib)
for i in sorted(setans):
  print(i)
Buggy python submission (verdict: Runtime Error):
n = int(input())
d,x = map(int,input().split())
li = [int(input()) for i in range(n)]

choco = x
for i in range(n):
  choco += 1 + (d-1)//li[i]
print(choco)

Fixed submission:
a = int(input())
b = min(a,int(input()))
c = int(input())
d = min(c,int(input()))
print(b+d)
Buggy python submission (verdict: Runtime Error):
n = int(input())
li = [list(map(int,input().split())) for i in range(n)]

if li[1][1] - abs(li[1][2]) - abs(li[1][3]) < 0:
  print("NO")
  exit()
elif li[1][1] - abs(li[1][2]) - abs(li[1][3]) > 0:
  if (li[1][1] - abs(li[1][2]) - abs(li[1][3])) % 2 != 0:
    print("NO")
    exit()
else:
  for k in range(1,n):
    t = li[k][1]
    x = li[k][2]
    y = li[k][3]
    tt = li[k-1][1]
    xx = li[k-1][2]
    yy = li[k-1][3]
    if t - tt - abs(x - xx) - abs(y - yy) <0:
      print("NO")
      exit()
    elif t - tt - abs(x - xx) - abs(y - yy) <0:
      (t - tt - abs(x - xx) - abs(y - yy)) % 2 != 0:
        print("NO")
        exit()
print("YES")

Fixed submission:
n = int(input())
li = [list(map(int,input().split())) for i in range(n)]
 
if li[0][0] - abs(li[0][1]) - abs(li[0][2]) < 0:
  print("No")
  exit()
elif li[0][0] - abs(li[0][1]) - abs(li[0][2]) > 0:
  if (li[0][0] - abs(li[0][1]) - abs(li[0][2])) % 2 != 0:
    print("No")
    exit()
else:
  for k in range(1,n):
    t = li[k][0]
    x = li[k][1]
    y = li[k][2]
    tt = li[k-1][0]
    xx = li[k-1][1]
    yy = li[k-1][2]
    if t - tt - abs(x - xx) - abs(y - yy) <0:
      print("No")
      exit()
    elif t - tt - abs(x - xx) - abs(y - yy) <0:
      if (t - tt - abs(x - xx) - abs(y - yy)) % 2 != 0:
        print("No")
        exit()
print("Yes")
Buggy python submission (verdict: Runtime Error):
s = input()
print(int(s.count("1"))

Fixed submission:
S = input()
li = list(S)
 
ans = 0
for i in range(3):
  if li[i] == "1":
    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
s = input()
print(int(s.count(1))

Fixed submission:
S = input()
li = list(S)
 
ans = 0
for i in range(3):
  if li[i] == "1":
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
li = input().split()

lians = [0]*n
for i in range(n):
  while li[i]%2 == 0:
    li[i] /= 2
    lians[i] += 1
print(max(lians))

Fixed submission:
n = int(input())
li = list(map(int,input().split()))
 
lians = [0]*n
for i in range(n):
  while li[i]%2 == 0:
    li[i] /= 2
    lians[i] += 1
print(min(lians))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = list(map(int,input().split()))
ans = []

for i in range(n):
  ans.append(li[i])
  ans = list(reversed(ans))
for i in range(n):
  print(ans[i],end=" ")

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

liodd = li[::2]
lieven = li[1::2]
if len(lieven) == len(liodd):
  for i in reversed(lieven):
    print(i,end=" ")
  for i in liodd:
    print(i,end=" ")
else:
  for i in reversed(liodd):
    print(i,end=" ")
  for i in lieven:
    print(i,end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = [int(input()) for _ in range(n)]

cnt = 0
liuse = [1]
place = 1
for i in range(n):
  place = li[place-1]
  liuse.append(place)
  cnt += 1
  if place == 2:
    print(cnt)
    exit()
  if len(liuse) > len(set(liuse)):
    print(-1)
    exit()

Fixed submission:
n = int(input())
li = [int(input()) for _ in range(n)]

liuse = [0]*n
liuse[0] = 1
for i in range(1,n):
  liuse[i] = li[liuse[i-1]-1]
if 2 in liuse:
  print(liuse.index(2))
else:
  print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = [int(input()) for _ in range(n)]

cnt = 0
liuse = [1]
place = 1
for i in range(n):
  place = li[place-1]
  liuse.append(place)
  cnt += 1
  if place == 2:
    print(cnt)
    exit()
  if len(liuse) > len(set(liuse)):
    print(-1)
    exit()

Fixed submission:
n = int(input())
li = [int(input()) for _ in range(n)]

liuse = [0]*n
liuse[0] = 1
for i in range(1,n):
  liuse[i] = li[liuse[i-1]-1]
if 2 in liuse:
  print(liuse.index(2))
else:
  print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = [int(input()) for _ in range(n)]

cnt = 0
liuse = [1]
place = 1
while True:
  place = li[place-1]
  liuse.append(place)
  cnt += 1
  if place == 2:
    print(cnt)
    exit()
  if len(liuse) > len(set(liuse)):
    print(-1)
    exit()

Fixed submission:
n = int(input())
li = [int(input()) for _ in range(n)]

liuse = [0]*n
liuse[0] = 1
for i in range(1,n):
  liuse[i] = li[liuse[i-1]-1]
if 2 in liuse:
  print(liuse.index(2))
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
n = int(input())
b = list(map(int,input().split()))
sum = 0
for i in range(n-1):
    first = b[i]
    second = 0
    for j in range(i+1,n):
        if(second < b[j]):
            if(first < b[j]):
                second = first
                first = b[j]
            else:
                second = b[j]
        sum += second
print(sum)

Fixed submission:
a=int(input())
b = a**3
print(b)
Buggy python submission (verdict: Runtime Error):
import math

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

print(90 - math.degrees(math.atan( a*a*a / (2*(a*a*b - x)) )))

Fixed submission:
import math

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

if (a*a*b/2<=x):
    print(math.degrees(math.atan((2*(a*a*b-x))/(a*a*a))))
else:
    print(math.degrees(math.atan((a*b*b)/(2*x))))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l_list = list(map(int, input().split()))
     
count = 0
for i in range(n-2):
    start_j = i + 1
    for j in range(start_j, n-1):
        start_k = j + 1
        for k in range(start_k, n):
            a = l_list[i]
            b = l_list[j]
            c = l_list[k]
               
            if (c<a+b and b<a+c and a<b+c):
                count += 1

print(count)

Fixed submission:
import bisect

n = int(input())
l_list = list(map(int,input().split()))

l_list.sort()

count=0
for i in range(n-2):
    for j in range(i+1,n-1):
        a=l_list[i]
        b=l_list[j]
        
        count+=(bisect.bisect_left(l_list,a+b)-j-1)

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l_list = list(map(int, input().split()))

l_list.sort()

count = 0
for i in range(n):
    start_j = i + 1
    a = l_list[i]
    for j in range(start_j, n):
        start_k = j + 1
        b = l_list[j]
        
        a_b = a + b
        for k in range(start_k, n):
            if (l_list[k] < a_b):
                count += 1
            else:
                break

print(count)

Fixed submission:
import bisect

n = int(input())
l_list = list(map(int,input().split()))

l_list.sort()

count=0
for i in range(n-2):
    for j in range(i+1,n-1):
        a=l_list[i]
        b=l_list[j]
        
        count+=(bisect.bisect_left(l_list,a+b)-j-1)

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l_list = list(map(int, input().split()))

count = 0
for i in range(n):
    start_j = i + 1
    for j in range(start_j, n):
        start_k = j + 1
        for k in range(start_k, n):
            a = l_list[i]
            b = l_list[j]
            c = l_list[k]
            
            if (c<a+b and b<a+c and a<b+c):
                count += 1

print(count)

Fixed submission:
import bisect

n = int(input())
l_list = list(map(int,input().split()))

l_list.sort()

count=0
for i in range(n-2):
    for j in range(i+1,n-1):
        a=l_list[i]
        b=l_list[j]
        
        count+=(bisect.bisect_left(l_list,a+b)-j-1)

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
# get initial input parameter
n, k, q = map(int, input().split())

# get answer list
answer_list = [ int(input()) for _ in range(q) ]

# init correct num list
correct_num_list = [ answer_list.count(answer + 1) for answer in range(n) ]

for answer in range(n):
    if (0 < (k - (q - correct_num_list[answer]))):
        print('Yes')
    else:
        print('No')


Fixed submission:
# get initial input parameter
n, k, q = map(int, input().split())
 
# init point
point_list = [ (k - q) for _ in range(n) ]
 
for round in range(q):
    # get correct answer persion
    person_index = int(input()) - 1
    
    # point decrement
    point_list[person_index] += 1
 
for item in point_list:
    if (0 < item):
        print('Yes')
    else:
        print('No')

Buggy python submission (verdict: Time Limit Exceeded):
# get initial input parameter
n, k, q = map(int, input().split())

# init point
point_list = [ k for _ in range(n) ]

for round in range(q):
    # get correct answer persion
    person_index = int(input()) - 1
    
    # point decrement
    point_list = [ point_list[i] - 1 if i != person_index else point_list[i] for i in range(n) ]

for item in point_list:
    if (0 < item):
        print('Yes')
    else:
        print('No')


Fixed submission:
# get initial input parameter
n, k, q = map(int, input().split())
 
# init point
point_list = [ (k - q) for _ in range(n) ]
 
for round in range(q):
    # get correct answer persion
    person_index = int(input()) - 1
    
    # point decrement
    point_list[person_index] += 1
 
for item in point_list:
    if (0 < item):
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
import math

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n, k = map(int, input().split())
x = n - k

div = 10 ** 9 + 7
for i in range(1, k+1):
    print((comb(x+1, i) * comb(k-1, i-1)) % div) 


Fixed submission:
import math

def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n, k = map(int, input().split())
x = n - k

div = 10 ** 9 + 7
for i in range(1, k+1):
    if (i-1 <= x):
        print((comb(x+1, i) * comb(k-1, i-1)) % div) 
    else:
        print('0')
Buggy python submission (verdict: Time Limit Exceeded):
n,m=map(int,input().split())

l_target=[]
for _ in range(m):
    a,b=map(int,input().split())
    l_target.append((a,b))

l_target.sort(key=lambda x:x[1])

#print(l_target)

cut_pos=[]
for target in l_target:
    is_ok=False
    for pos in cut_pos:
        if (target[0]<pos<target[1]):
            is_ok=True
            break
    
    if(not is_ok):
        cut_pos.append(target[1]-0.5)

print(len(cut_pos))

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

l_target=[]
for _ in range(m):
    a,b=map(int,input().split())
    l_target.append((a,b))

l_target.sort(key=lambda x:x[1])

count=0
pre_pos=0
for target in l_target:
    if (target[0]<pre_pos<target[1]):
        continue
    
    count+=1
    pre_pos=target[1]-0.5

print(count)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
B=list(map(int,input().split()))
C=np.array(list(map(int,input().split())))

sb=sum(B)
dC=np.diff(A)

sC=C[A[np.where(dC==1)[0]]].sum()
#print(sb, sC)
print(sb+sC)

Fixed submission:
import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
B=list(map(int,input().split()))
C=np.array(list(map(int,input().split())))

sb=sum(B)
dC=np.diff(A)

sC=C[A[np.where(dC==1)[0]]-1].sum()
#print(sb, sC)
print(sb+sC)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
A=map(int,input().split())
B=map(int,input().split())
C=array(map(int,input().split()))

sb=sum(B)
dC=np.diff(A)
sC=C[np.where(dC==1)[0]].sum()

print(sb+sC)


Fixed submission:
import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
B=list(map(int,input().split()))
C=np.array(list(map(int,input().split())))

sb=sum(B)
dC=np.diff(A)

sC=C[A[np.where(dC==1)[0]]-1].sum()
#print(sb, sC)
print(sb+sC)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N=input()
A=map(int,input().split())
B=map(int,input().split())
C=array(map(int,input().split()))

sb=sum(B)
dC=np.diff(A)
sC=C[np.where(dC==1)[0]].sum()

print(sb+sC)


Fixed submission:
import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
B=list(map(int,input().split()))
C=np.array(list(map(int,input().split())))

sb=sum(B)
dC=np.diff(A)

sC=C[A[np.where(dC==1)[0]]-1].sum()
#print(sb, sC)
print(sb+sC)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N=input()
A=map(input().split())
B=map(input().split())
C=array(map(input().split()))

sb=sum(B)
dC=np.diff(A)
sC=C[np.where(dC==1)[0]].sum()

print(sb+sC)

Fixed submission:
import numpy as np
N=int(input())
A=np.array(list(map(int,input().split())))
B=list(map(int,input().split()))
C=np.array(list(map(int,input().split())))

sb=sum(B)
dC=np.diff(A)

sC=C[A[np.where(dC==1)[0]]-1].sum()
#print(sb, sC)
print(sb+sC)
Buggy python submission (verdict: Time Limit Exceeded):
import re
N = int(input())
al = "abcdefghijklmnopqrftuvwxyz"
S = []
for n in range(N):
    s = input()
    S.append(''.join(sorted(s)))

# print (S)
cnt = 0
for n in range(N):
    cnt += S[n:].count(S[n])

print (cnt - N)


Fixed submission:
N = int(input())
S = [''.join(sorted(input())) for _ in range(N)]

# print(S)

D = {}
for s in S:
    if not(s in D.keys()):
        D[s] = 1
    else:
        # print(s)
        D[s] += 1


cnt = 0
for c in D.values():
    if c != 1:
        cnt += (c * (c - 1)) // 2

print (cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import re
N = int(input())
al = "abcdefghijklmnopqrftuvwxyz"
S = []
for n in range(N):
    s = input()
    S.append(''.join(sorted(s)))

# print (S)
cnt = 0
for n in range(N):
    for n2 in range(n + 1, N):
        if (S[n] == S[n2]): cnt += 1

print (cnt)


Fixed submission:
N = int(input())
S = [''.join(sorted(input())) for _ in range(N)]

# print(S)

D = {}
for s in S:
    if not(s in D.keys()):
        D[s] = 1
    else:
        # print(s)
        D[s] += 1


cnt = 0
for c in D.values():
    if c != 1:
        cnt += (c * (c - 1)) // 2

print (cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import re
N = int(input())
al = "abcdefghijklmnopqrftuvwxyz"
S = []
for n in range(N):
    S2 = []
    s = input()
    for a in al:
        S2.append(s.count(a))
    S.append(S2)

# print (S)
cnt = 0
for n in range(N):
    for n2 in range(n + 1, N):
        if (S[n] == S[n2]): cnt += 1

print (cnt)


Fixed submission:
N = int(input())
S = [''.join(sorted(input())) for _ in range(N)]

# print(S)

D = {}
for s in S:
    if not(s in D.keys()):
        D[s] = 1
    else:
        # print(s)
        D[s] += 1


cnt = 0
for c in D.values():
    if c != 1:
        cnt += (c * (c - 1)) // 2

print (cnt)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]

pre_max = 0
af_max = max(A[1:])
print(af_max)
for ii in range(1, N - 1):
    af_max = max(A[ii + 1:])
    pre_max = max(A[ii - 1], pre_max)
    print(max(pre_max, af_max))

print (max(pre_max, A[N - 2]))


Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]

pre_max = 0
pre_max_2 = 0
forward = [0]
backward = [0]
for ii in range(1, N):
    pre_max = max(pre_max, A[ii-1])
    forward.append(pre_max)
    pre_max_2 = max(pre_max_2, A[-ii])
    backward.append(pre_max_2)

backward.reverse()

for ii in range(N):
    print(max(forward[ii], backward[ii]))