Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
MOD = 10**9+7


def main():
  S = input()
  L = len(S)
  dp = [[0] *13 for _ in range(L+1)]
  dp[0][0] = 1
  mul = 1
  
  for i in range(L):
    x = S[-(i+1)]
    if x == '?':
      for k in range(10):
        for j in range(13):
          dp[i+1][(mul * k + j)%13] += dp[i][j]
          dp[i+1][(mul * k + j)%13] %= MOD
    else:
      k = int(x)
      for j in range(13):
        dp[i+1][(mul * k + j)%13] += dp[i][j]
        dp[i+1][(mul * k + j)%13] %= MOD
    mul = mul * 10 %13
  print(dp[L][5])
    
  
if __name__ == '__main__':
  main()

Fixed submission:
import sys
 
s= sys.stdin.readline().strip()
#
MOD=10**9+7
mmap= []
for i in range(6):
    b = 10**i % 13
    mmap.append( [ [ (b*i+j)%13 for i in range(1,10) ] for j in range(13) ] )
#
dp= [ 0 ] * 13
dp[0] = 1
j= 0
for c in reversed(s):
    tmp = dp.copy()
    #
    if c=="0": pass
    elif c=="?":
        bset = mmap[j]
        for m,num in enumerate(tmp):
            if num==0: continue
            for idx in bset[m]: dp[idx]+=num
        #
        for i in range(13): dp[i]%=MOD
    else:
        b= mmap[j][0][int(c)-1]
        for m in range(13):
            idx= (m+b)%13
            dp[idx]= tmp[m]
    #
    if j==5: j=0
    else: j+=1
#
print(dp[5])
Buggy python submission (verdict: Runtime Error):
import sys
import math

read = sys.stdin.read
readline = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    S = int(input())
    x1 = math.ceil(S**0.5)
    x2 = X1**2 -S
    print(0, 0, x1, 1, x2, x1)




if __name__ == '__main__':
    main()


Fixed submission:
import sys
import math

read = sys.stdin.read
readline = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    S = int(input())
    x1 = math.ceil(S ** 0.5)
    x2 = x1 ** 2 - S
    print(0, 0, x1, 1, x2, x1)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
import numpy as np
readline = sys.stdin.buffer.readline

def main():
    N = int(readline())
    B = np.array(readline().split(), np.int64)
    A = np.eye(N, dtype=np.int64) + np.eye(N, k=1, dtype=np.int64)
    A[N-1][0] = 1
    ans = np.linalg.solve(A, B).astype(np.int64) * 2
    print(' '.join(map(str, ans)))

if __name__ == '__main__':
    main()

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
x = [0] * N
x[0] = sum([a[i] for i in range(N) if i % 2 == 0]) - sum([a[i] for i in range(N) if i % 2 != 0])
for i in range(N - 1):
    x[i + 1] = 2 * a[i] - x[i]
print(*x)
Buggy python submission (verdict: Runtime Error):
import sys
from collections import defaultdict

read = sys.stdin.read
readline = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    XY = list(list(map(int, readline().split())) for _ in range(N))
    d = defaultdict(int)
    for i in range(N-1):
        x1, y1 = XY[i]
        for j in range(i+1,N):
            x2, y2 = XY[j]
            x = x2-x1
            y = y2-y1
            d[x,y] += 1
            d[-x,-y] += 1
    print(N-max(d.values()))



if __name__ == '__main__':
    main()


Fixed submission:
import sys
from collections import defaultdict

read = sys.stdin.read
readline = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    if N==1:
        print(1)
        sys.exit()
    XY = list(list(map(int, readline().split())) for _ in range(N))
    d = defaultdict(int)
    for i in range(N-1):
        x1, y1 = XY[i]
        for j in range(i+1,N):
            x2, y2 = XY[j]
            x = x2-x1
            y = y2-y1
            d[x,y] += 1
            d[-x,-y] += 1
    print(N-max(d.values()))



if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
from operator import itemgetter
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N, M = map(int, readline().split())
    A = list(map(int, readline().split()))
    A.sort()
    BC = []
    for _ in range(M):
        B, C = map(int, readline().split())
        BC.append((B,C))
    BC.sort(key=itemgetter(1))
    for i in range(M):
        b = BC[i][0]
        c = BC[i][1]
        for j in range(b):
            if A[j]<c:
                A[j]=c
        A.sort()
    print(sum(A))



if __name__ == '__main__':
    main()


Fixed submission:
import sys
import time
from operator import itemgetter
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N, M = map(int, readline().split())
    A = list(map(int, readline().split()))
    BC = []
    for _ in range(M):
        B, C = map(int, readline().split())
        BC.append((B,C))
    BC.sort(key=itemgetter(1), reverse=True)
    BC.append((N,-1))
    change = []
    for b,c in BC:
        change += [c]*b
        if len(change) > N:
            break
    A += change
    A.sort()
    answer = sum(A[-N:])
    print(answer)




if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import sys
from operator import itemgetter
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N, M = map(int, readline().split())
    A = list(map(int, readline().split()))
    A.sort()
    BC = []
    for _ in range(M):
        B, C = map(int, readline().split())
        BC.append((B,C))
    BC.sort(key=itemgetter(1))
    for i in range(M):
        b = BC[i][0]
        c = BC[i][1]
        for j in range(b):
            if A[j]<c:
                A[j]=c
        A.sort()
    print(sum(A))



if __name__ == '__main__':
    main()

Fixed submission:
import sys
import time
from operator import itemgetter
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    N, M = map(int, readline().split())
    A = list(map(int, readline().split()))
    BC = []
    for _ in range(M):
        B, C = map(int, readline().split())
        BC.append((B,C))
    BC.sort(key=itemgetter(1), reverse=True)
    BC.append((N,-1))
    change = []
    for b,c in BC:
        change += [c]*b
        if len(change) > N:
            break
    A += change
    A.sort()
    answer = sum(A[-N:])
    print(answer)




if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
readline = sys.stdin.buffer.readline

X, Y, Z, K = map(int, readline().split())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
C = list(map(int, readline().split()))
AB = [a+b for (a,b) in list(itertools.product(A,B))]
AB.sort(reverse=True)
ans = [ab + c for (ab,c) in list(itertools.product(AB[:K],C))]
ans.sort(reverse=True)
for i in range(K):
  print(ans[i])

Fixed submission:
import sys
import itertools
readline = sys.stdin.buffer.readline

X, Y, Z, K = map(int, readline().split())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
C = list(map(int, readline().split()))
AB = [a+b for (a,b) in list(itertools.product(A,B))]
AB.sort(reverse=True)
ans = [ab + c for (ab,c) in list(itertools.product(AB[:K],C))]
ans.sort(reverse=True)
for i in range(K):
  print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main():
    X, Y, Z, K = map(int, readline().split())
    A = list(map(int, readline().split()))
    B = list(map(int, readline().split()))
    C = list(map(int, readline().split()))
    AB = [a+b for (a,b) in list(itertools.product(A,B))]
    AB.sort(reverse=True)
    ans = [ab + c for (ab,c) in list(itertools.product(AB[:K],C))]
    ans.sort(reverse=True)
    for i in range(K):
        print(ans[i])


if __name__ == '__main__':
    main()

Fixed submission:
import sys
import itertools
readline = sys.stdin.buffer.readline

X, Y, Z, K = map(int, readline().split())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
C = list(map(int, readline().split()))
AB = [a+b for (a,b) in list(itertools.product(A,B))]
AB.sort(reverse=True)
ans = [ab + c for (ab,c) in list(itertools.product(AB[:K],C))]
ans.sort(reverse=True)
for i in range(K):
  print(ans[i])

Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    X, Y, Z, K = map(int, readline().split())
    A = list(map(int, readline().split()))
    B = list(map(int, readline().split()))
    C = list(map(int, readline().split()))
    AB = []
    for i in range(X):
        for j in range(Y):
            AB.append(A[i]+B[j])
    AB.sort(reverse=True)
    ABC = []
    for i in range(K):
        for j in range(Z):
            ABC.append(AB[i] + C[j])
    ABC.sort(reverse=True)
    for i in range(K):
        print(ABC[i])



if __name__ == '__main__':
    main()

Fixed submission:
import sys
import itertools
readline = sys.stdin.buffer.readline

X, Y, Z, K = map(int, readline().split())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
C = list(map(int, readline().split()))
AB = [a+b for (a,b) in list(itertools.product(A,B))]
AB.sort(reverse=True)
ans = [ab + c for (ab,c) in list(itertools.product(AB[:K],C))]
ans.sort(reverse=True)
for i in range(K):
  print(ans[i])
Buggy python submission (verdict: Runtime Error):
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n, q = map(int, readline().split())
  s = input()
  t = [0] *(n=1)
  for i in range(n):
    t[i+1] = t[i] + (a if s[i:i+2] == 'AC' else 0)
  for i in range(q):
    l, r = map(int, readline().split())
    print(t[r-1] - t[l-1])
  
  
if __name__ == '__main__':
  main()

Fixed submission:
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n, q = map(int, readline().split())
  s = input()
  t = [0] *(n+1)
  for i in range(n):
    t[i+1] = t[i] + (1 if s[i:i+2] == 'AC' else 0)
  for i in range(q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])
  
  
if __name__ == '__main__':
  main()
Buggy python submission (verdict: Runtime Error):
import itertools
N,A,B,C = map(int,input().split())
L = [int(input()) for _ in range(N)]
 
INF = 10 ** 18
answer = INF
for pattern in itertools.product(range(4), repeat = N):
  x = [0] * 4
  MP = 0
  for take, length in zip(pattern, L):
    if take == 3:
      continue
    if x[take] != 0:
      MP += 10
    x[take] += length
  if x[0] == 0 or x[1] == 0 or x[2] == 0:
    continue
  MP += abs(A-x[0])
  MP += abs(B-x[1])
  MP += abs(C-x[2])
  if answer > MP:
    answer = MP
print(answer

Fixed submission:
import itertools
N,A,B,C = map(int,input().split())
L = [int(input()) for _ in range(N)]
 
INF = 10 ** 18
answer = INF
for pattern in itertools.product(range(4), repeat = N):
  x = [0] * 4
  MP = 0
  for take, length in zip(pattern, L):
    if take == 3:
      continue
    if x[take] != 0:
      MP += 10
    x[take] += length
  if x[0] == 0 or x[1] == 0 or x[2] == 0:
    continue
  MP += abs(A-x[0])
  MP += abs(B-x[1])
  MP += abs(C-x[2])
  if answer > MP:
    answer = MP
print(answer)
Buggy python submission (verdict: Runtime Error):
import sys
import math
from fractions import gcd
import numpy as np
readline = sys.stdin.readline
INF = 10**9


def main():
  N, M = map(int, readline().split())
  X = np.array(readline().split(), dtype=np.int64)
  X.sort()
  X = np.diff(X)
  X.sort()
  if M-N>=0:
    answer = X[:M-N].sum()
  else:
    answe = 0
  print(answer)
  
  
  
  
  
if __name__ == "__main__":
  main()

Fixed submission:
import sys
import math
from fractions import gcd
import numpy as np
readline = sys.stdin.readline
INF = 10**9


def main():
  N, M = map(int, readline().split())
  X = np.array(readline().split(), dtype=np.int64)
  X.sort()
  X = np.diff(X)
  X.sort()
  if M-N>=0:
    answer = X[:M-N].sum()
  else:
    answer = 0
  print(answer)
  
  
  
  
  
if __name__ == "__main__":
  main()
Buggy python submission (verdict: Runtime Error):
'''
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
'''
from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n = int(readline())
  v = list(map(int, readline().split()))
  odd = Counter(v[::2])
  even = Counter(v[1::2])
  odd[-1] = 0
  even[-2] = 0
  ev = even.most_common(2)
  od = odd.most_common(2)
  
  answer = n
  for (k1,v1), (k2,v2) in product(ev,od):
    if k1 == k2:
      continue
    x = n-x1-x2
    if answer>x:
      answer = x
      
  print(answe)
    
  
  
  
  
  
if __name__ == '__main__':
  main()

Fixed submission:
'''
from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
'''
from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n = int(readline())
  v = list(map(int, readline().split()))
  odd = Counter(v[::2])
  even = Counter(v[1::2])
  odd[-1] = 0
  even[-2] = 0
  ev = even.most_common(2)
  od = odd.most_common(2)
  
  answer = n
  for (k1,v1), (k2,v2) in product(ev,od):
    if k1 == k2:
      continue
    x = n-v1-v2
    if answer>x:
      answer = x
      
  print(answer)
    
  
  
  
  
  
if __name__ == '__main__':
  main()
Buggy python submission (verdict: Runtime Error):
import numpy as np
from functools import reduce
from fractions import gcd
readline = sys.stdin.buffer.readline

def main():
  n, X = map(int, readline().split())
  x = np.array(readline().split(), dtype='int64')
  x -= X
  if len(x) == 1:
    ans = x[0]
  else:
    ans = reduce(gcd, x)
  print(abs(ans))
if __name__ == '__main__':
  main()

Fixed submission:

from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from functools import reduce

from collections import deque, Counter, defaultdict
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n, X = map(int, readline().split())
  x = np.array(readline().split(), dtype='int64')
  x -= X
  if len(x) == 1:
    ans = x[0]
  else:
    ans = reduce(gcd, x)
  print(abs(ans))
  
  
  
  
  
  
if __name__ == '__main__':
  main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import numpy as np
from collections import Counter

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    A = np.array(readline().split(), np.int64)
    A_cum = np.cumsum(A)
    counter = Counter(A_cum)

    fact = [1] * (N + 1)
    for r in range(2, N + 1):
        fact[r] = fact[r - 1] * r

    def cmb(n, r):
        return fact[n] // (fact[r] * fact[n - r])

    ans = 0
    for key, value in counter.items():
        if value >= 2:
            ans += cmb(value, 2)
        if key == 0:
            ans += value
    print(ans)


if __name__ == '__main__':
    main()


Fixed submission:
import sys
import numpy as np
from collections import Counter
import math

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    A = np.array(readline().split(), np.int64)
    A_cum = np.cumsum(A)
    counter = Counter(A_cum)

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

    ans = 0
    for key, value in counter.items():
        if value >= 2:
            ans += cmb(value, 2)
        if key == 0:
            ans += value
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import statistics
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7



def main():
    N = int(readline())
    X = list(map(int, readline().split()))
    sort_X = sorted(X)
    for i in range(N):
        median = statistics.median(X[:i]+X[i+1:])
        print(median)


if __name__ == '__main__':
    main()

Fixed submission:
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7



def main():
    N = int(readline())
    X = list(map(int, readline().split()))
    sort_X = sorted(X)
    if N%2==0:
        med_l = sort_X[N//2-1]
        med_r = sort_X[N//2]
        for i in range(N):
            if X[i]<=med_l:
                print(med_r)
            else:
                print(med_l)
    else:
        l = sort_X[N//2-1]
        m = sort_X[N//2]
        r = sort_X[N//2+1]
        for i in range(N):
            if X[i]<=l:
                print((m+r)/2)
            elif X[i]==m:
                print((l+r)/2)
            else:
                print((l+m)/2)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    S = input()
    S = sorted(S)
    if S = ['a','b','c']:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()


Fixed submission:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    S = input()
    S = sorted(S)
    if S == ['a','b','c']:
        print('Yes')
    else:
        print('No')


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    s = readline().decode('utf-8')
    if len(s) < 26:
        al = [chr(ord('a') + i) for i in range(26)]
        for i in al:
            if not (i in s):
                print(s + i)
                exit()
    if s == "zyxwvutsrqponmlkjihgfedcba":
        print(-1)
        exit()
    for i in range(25):
        if s[i] < s[i + 1]:
            k = i
    a = "z"
    for i in range(k + 1, 26):
        if s[k] < s[i]:
            a = min(a, s[i])
    print(s[:k] + a)
if __name__ == '__main__':
    main()

Fixed submission:
import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7

def main():
    s = input()
    if len(s) < 26:
        al = [chr(ord('a') + i) for i in range(26)]
        for i in al:
            if not (i in s):
                print(s + i)
                exit()
    if s == "zyxwvutsrqponmlkjihgfedcba":
        print(-1)
        exit()
    for i in range(25):
        if s[i] < s[i + 1]:
            k = i
    a = "z"
    for i in range(k + 1, 26):
        if s[k] < s[i]:
            a = min(a, s[i])
    print(s[:k] + a)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    ba = 0
    bb = 0
    for i in range(N):
        if a[i] > b[i]:
            ba += a[i] - b[i]
        if b[i] > a[i]:
            bb += (b[i] - a[i]) // 2

    if bb = ba:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()


Fixed submission:
import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))

    ba = 0
    bb = 0
    for i in range(N):
        if a[i] > b[i]:
            ba += a[i] - b[i]
        if b[i] > a[i]:
            bb += (b[i] - a[i]) // 2

    if bb >= ba:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()