Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p03147 (python)

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

maxNum = max(h)
countNumber = 0
countWatering = 0
isfinished = False
for c in range(1, maxNum+1):
    array = []
    for index, num in enumerate(h):
        if (num >= c):
            array.append(index)
    if (len(array) == 0 or c > maxNum):
        break
    startIndex = 0
    beforeVlaue  = array[0]-1
    for a in array:
        if (a-1 != beforeVlaue):
            countWatering+=1
        if (a == array[-1]):
            countWatering+=1
        beforeVlaue = a
    
print(countWatering)

Buggy submission (verdict: Runtime Error):
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int f(vector<int> v, int i, int a) {
    vector<int>::iterator maxIt = max_element(v.begin(), v.end());
    vector<int>::iterator minIt = min_element(v.begin(), v.end());
    if (v.size() == 0){
        return a;
    }
    if(*maxIt == *minIt) {
        return a + (*minIt) - i;
    }
    a+=*minIt-i;
    i = *minIt;
    size_t minIndex = distance(v.begin(), minIt);
    if (minIndex == 0) {
        vector<int> vec;
        copy(next(v.begin()), v.end(), back_inserter(vec));
        a = f(vec, i, a);
    } else if (minIndex == v.size()) {
        vector<int> vec;
        copy(v.begin(), prev(v.end()), back_inserter(vec));
        a = f(vec, i, a);
    } else {
        vector<int> vec1;
        copy(v.begin(), minIt, back_inserter(vec1));
        a = f(vec1, i, a);
        vector<int> vec2;
        copy(next(minIt), v.end(), back_inserter(vec2));
        a = f(vec2, i, a);
    }
    return a;
}


int main() {
    int n;
    cin >> n;
    vector<int> v(n);
    for (int i=0; i<n; i++) {
        cin >> v[i];
    }
    int a = f(v, 0, 0);

    return 0;
}
Problem p02909 (python)

Fixed submission:
S = str(input())

if S == 'Sunny':
    print('Cloudy')
elif S == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')

Buggy submission (verdict: Runtime Error):
S = str(inpit())

if S == 'Sunny':
    print('Cloudy')
elif S == 'Cloudy':
    print('Rainy')
else:
    print('Sunny')
Problem p02957 (python)

Fixed submission:
A, B = map(int, input().split())

if (A+B) % 2 == 1:
    print('IMPOSSIBLE')
else:
    print(int((A+B)/2))

Buggy submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))

k = 0
counter = 1
for e in p:
    if e == counter:
        counter += 1
    else:
        k += 1
        counter += 1

if k <= 2:
    print('YES')
else:
    print('NO')
Problem p02958 (python)

Fixed submission:
N = int(input())
p = list(map(int, input().split()))

k = 0
counter = 1
for e in p:
    if e == counter:
        counter += 1
    else:
        k += 1
        counter += 1

if k <= 2:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))

k = 0
counter = 1
for e in p:
    if e == counter:
        counter += 1
    else:
        k += 1
        counter += 1

if k <= 2:
    print('YES')
else:
    orint('NO')

Buggy submission (verdict: Runtime Error):
N = int(input())
p = list(map(int, input().split()))

k = 0
counter = 1
for e in p:
    if e == counter:
        counter += 1
    else:
        k += 1
        counter += 1

if k <= 2:
    print('YES')
else:
    orint('NO')

Buggy submission (verdict: Runtime Error):
N = int(input())
p = map(int, input().split())

# 昇順のリスト
asc_l = list(range(1, N))

diff_l = p - asc_l
diff_l.count(0) >= N - 2
Problem p02909 (python)

Fixed submission:
# -*- coding: utf-8 -*-
S = input()
if S == "Sunny":
    print('Cloudy')
elif S == "Cloudy":
    print('Rainy')
else:
    print('Sunny')

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
N, K, Q = map(int, input().split())
score = np.array([K]*N)


for i in range(Q):
    answer = int(input())
    score[answer - 1] += 1
    score = score - 1


for i in range(N):
    if score[i] <= 0:
        print("No")
    else:
        print("Yes")
Problem p02911 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline

N, K, Q = map(int, input().split())
score = [0] * N

for i in range(Q):
    score[int(input()) -1 ] += +  1

for SCORE in score:
    if SCORE <= Q - K:
        print("No")
    else:
        print("Yes")

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
N, K, Q = map(int, input().split())
score = np.array([K]*N)


for i in range(Q):
    answer = int(input())
    score[answer - 1] += 1
    score = score - 1


for i in range(N):
    if score[i] <= 0:
        print("No")
    else:
        print("Yes")
Problem p03455 (python)

Fixed submission:
a, b = map(int,input().split())
if (a*b)%2 == 0:
    print("Even")
else:
    print("Odd")

Buggy submission (verdict: Runtime Error):
a, b = map(int,input().split())
if (a*b)%2 == 0:
  print("Odd")
 else:
  print("Even")
Problem p02923 (python)

Fixed submission:
n=int(input())
List=list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(n-1):
  if List[i]>=List[i+1]:
    if i==0:
      cnt=1
    else:
      cnt+=1
      ans = max(ans, cnt)
  else:
    cnt=0
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
List=list(map(int, input().split()))
cnt=[0]*(n-1)
for i in range(n-1):
  if List[i]>=List[i+1]:
    if i==0:
      cnt[i]=1
    else:
      cnt[i]=cnt[i-1]+1
print(max(cnt))

Buggy submission (verdict: Runtime Error):
n=int(input())
List=list(map(int, input().split()))
cnt=[0]*(n-1)
ans=0
for i in range(n-1):
  if List[i]>=List[i+1]:
    if i==0:
      cnt[i]=1
    else:
      cnt[i]=cnt[i-1]+1
print(max(cnt))

Buggy submission (verdict: Runtime Error):
=int(input())
List=list(map(int, input().split()))
cnt=[0]*(n-1)
ans=0
for i in range(n-1):
  if List[i]>=List[i+1]:
    if i==0:
      cnt[i]=1
    else:
      cnt[i]=cnt[i-1]+1
print(max(cnt))
Problem p02924 (python)

Fixed submission:
n=int(input())
if n==1:
  print(0)
else:
  print(n*(n-1)//2)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n==1:
  print(0)
if n==2:
  print(1)
else:
  ans=1
  for i in range(3,n+1):
    ans+=(i-1)
print(ans)
Problem p03407 (python)

Fixed submission:
a, b, c = map(int, input().split())
print('Yes' if a+b>=c else 'No')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print('Yes' if a+b>=c, else 'No')
Problem p03636 (python)

Fixed submission:
s=input()
print(s[0]+str(len(s)-2)+s[-1])

Buggy submission (verdict: Runtime Error):
S=input()
print(S[0]+int(len(S)-2)+S[-1])
Problem p02982 (python)

Fixed submission:
import itertools
import math

n,d = map(int,input().split())
x = [[int(i) for i in input().split()] for i in range(n)] 
seq = list(itertools.combinations(range(n),2))
tmp = 0.0
cnt = 0
for i,j in seq:
    for k in range(d):
        tmp += (x[i][k] - x[j][k])**2
    tmp = math.sqrt(tmp)
    if tmp.is_integer():
        cnt += 1
    tmp = 0.0
print(cnt)

Buggy submission (verdict: Runtime Error):
import itertools
import math

n,d = map(int,input().split())
x = [[int(i) for i in input().split()] for i in range(n)] 
seq = list(itertools.combinations(range(n),d))
tmp = 0.0
cnt = 0

for i,j in seq:
    for k in range(d):
        tmp += (x[i][k] - x[j][k])**2
    tmp = math.sqrt(tmp)
    if tmp.is_integer():
        cnt += 1
print(cnt)
Problem p03101 (python)

Fixed submission:
#A
H,W = map(int, input().split())
h,w = map(int, input().split())

print((H-h)*(W-w))

Buggy submission (verdict: Runtime Error):
#B
count = 0
n,m,c = map(int, input().split())
b = list(map(int, input().split()))
for i in range(n):
    a = list(map(int, input().split()))
    ab=0
    for j in range(n):
        ab = a[j] * b[j]
    if -c<ab:
        count += 1
print(count)
Problem p03102 (python)

Fixed submission:
#B
count = 0
n,m,c = map(int, input().split())
b = list(map(int, input().split()))
for i in range(n):
    a = list(map(int, input().split()))
    ab=0
    for j in range(m):
        ab += a[j] * b[j]
    if -c<ab:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
#B
count = 0
n,m,c = map(int, input().split())
b = list(map(int, input().split()))
for i in range(n):
    a = list(map(int, input().split()))
    ab=0
    for j in range(n):
        ab = a[j] * b[j]
    if -c<ab:
        count += 1
print(count)
Problem p03103 (python)

Fixed submission:
#C
n,m = map(int, input().split())
ab = [[int(i) for i in input().split()] for i in range(n)]

ab.sort(key=lambda x:x[0])
cost = 0
for i in range(n):
    value = ab[i][0]
    num = ab[i][1]
    if num> m:
        cost += value*m
        break
    else:
        cost += value*num
        m -= num
print(cost)

Buggy submission (verdict: Runtime Error):
#C
n,m = map(int, input().split())
ab = [[int(i) for i in input().split()] for i in range(n)]

ab.sort(key=lambda x:x[0])
cost = 0
for i in range(m):
    value = ab[i][0]
    num = ab[i][1]
    if num> m:
        cost += value*m
        break
    else:
        cost += value*num
        m -= num
print(cost)
Problem p03005 (python)

Fixed submission:
n,k=map(int,input().split())
if k==1:
	print("0")
else:
	print(n-k)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
if k=1:
 print("0")
else:
	print(n-k)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
if k=1:
 print("0")
else:
print(n-k)
Problem p03071 (python)

Fixed submission:
a,b=map(int,input().split())
if a>b:
	print(a*2-1)
elif a<b:
	print(b*2-1)
else:
		print(a+b)

Buggy submission (verdict: Runtime Error):
a,b=map(in,input().split())
if a>b:
	print(a*2-1)
elif a<b:
	print(b*2-1)
else:
	print(a+b)

Buggy submission (verdict: Runtime Error):
a,b=map(in,input().split())
if a>b:
	print(a*2-1)
elif a<b:
	print(b*2-1)
else:
		print(a+b)
Problem p03086 (python)

Fixed submission:
s=input()
ans=0
for x in range(1,len(s)+1):
	for left in range(len(s)-x+1):
		z=s[left:left+x]
		flag=True
		for i in range(x):
			if z[i]!="A" and z[i]!="G" and z[i]!="C" and z[i]!="T":
				flag=False
				break
		if flag==True:
			ans+=1
			break
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
ans=0
for x in range(1,len(s)+1):
	for left in range(s-x+1):
		z=s[left:left+x]
		flag=True
		for i in range(x):
			if z[i]!="A" and z[i]!="G" and z[i]!="C" and z[i]!="T":
				flag=False
				break
		if flag==True:
			ans+=1
			break
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
ans=0
for x in range(1,len(s)+1):
	for left in range(s-x+1):
		z=s[left:left+x]
		flag=True
		for i in range(x):
			if z[i]!="A" and z[i]!="G" and z[i]!="C" and z[i]!="T":
				flag=False
				break
		if flag:
			ans+=1
			break
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
ans=0
for length in range(1,len(s)+1):
	for left in range(s-length+1):
		z=s[left:left+length]
		flag=True
		for i in range (length):
			if z[i]!="A" and z[i]!="G" and z[i]!="C" and z[i]!="T":
				flag=False
				break
		if flag:
			ans+=1
			break
print(ans)

Buggy submission (verdict: Runtime Error):
s=input()
ans=0
for length in range(1,len(s)+1):
	for left in range(s-length+1):
		z=s[left:left+length]
		flag=True
		for i in range (length):
			if z[i]!="A" and z[i]!="G" and z[i]!="C" and z[i]!="T":
				flag=False
				break
		if flag:
			ans+=1
			break
print(ans)
Problem p03423 (python)

Fixed submission:
n=int(input())
print(n//3)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=list(input().split())
if "Y" in s:
	print("Four")
else:
	print("Three")
Problem p03679 (python)

Fixed submission:
x,a,b=map(int,input().split())
if b>a and b-a<=x:
	print("safe")
elif b<=a and a-b<=x:
	print("delicious")
else:
	print("dangerous")

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if b>a and b-a<x:
	print("safe")
elif b=a and b-a=x:
	print("delicious")
elif b<a and a-b<x:
	print("delicious")
else:
	print("dangerous")

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if b>a and b-a<x:
	print("safe")
elif b=a and b-a=X:
	print("delicious")
elif b<a and a-b<x:
	print("delicious")
else:
	print("dangerous")

Buggy submission (verdict: Runtime Error):
x,a,b=map(int,input().split())
if b>a and b-a<x:
	print("safe")
elif b=a and b-a=X
	print("delicious")
elif b<a and a-b<x:
	print("delicious")
else:
	print("dangerous")
Problem p03737 (python)

Fixed submission:
a,b,c=input().split()
komoji=a[0]+b[0]+c[0]
print(komoji.upper())

Buggy submission (verdict: Runtime Error):
a,b,c=input()
komoji=a[0]+b[0]+c[0]
print(komoji.upper())
Problem p02899 (python)

Fixed submission:
import numpy as np

n = int(input())
records= np.array([int(i) for i in input().split()])

enrolled = np.argsort(records)

attendance_list = np.array([i+1 for i in range(n)])

attendance_order = np.array(attendance_list[enrolled]).tolist()

for i in attendance_order:
  print('{} '.format(i), end="")
print()

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())
records= np.array([int(i) for i in input().split()])

enrolled = np.argsort(records)

attendance_num = [i+1 for i in range(len(records))]

attendance_order = attendance_num[enrolled]

print(attendance_order)

Buggy submission (verdict: Runtime Error):
import numpy as np

n = int(input())
records= np.array([int(i) for i in input().split()])

enrolled = np.argsort(a)

attendance_num = [i+1 for i in range(len(a))]

attendance_order = attendance_num[enrolled]

print(attendance_order)

Buggy submission (verdict: Runtime Error):
import numpy as np

n, k=[int(i) for i in input().split()]
records= np.array([int(i) for i in input().split()])

enrolled = np.argsort(a)

attendance_num = [i+1 for i in range(len(a))]

attendance_order = attendance_num[enrolled]

print(attendance_order)
Problem p02921 (python)

Fixed submission:
s = input()
t = input()
c = 0
for i in range(3):
    if s[i] == t[i]:
        c+=1
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n > 1:
    ans = n*(n-1)/2
else:
    ans = 0
print(ans)
Problem p03079 (python)

Fixed submission:
import sys

def main():
	A,B,C = input().split()

	if A == B and B == C:
  		print("Yes")
	else:
  		print("No")

if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
def main():
    N, Q = input().split()
    N = int(N)
    Q = int(Q)
    G = [1] * N
    S = input()
    for _ in range(Q):
        t, d = input().split()
        if d == "L":
            # for i in range(0,N):
            for i in range(0,Q):
                if S[i] == t and G[i] > 0:
                    if i == 0:
                        G[i] = 0
                    else:
                        G[i-1] = G[i-1] + G[i]
                        G[i] = 0

        else: # "R"
            # for i in range(N-1,-1,-1):
            for i in range(N-1,N-Q-1,-1):
                if S[i] == t and G[i] > 0:
                    if i == N-1:
                        G[i] = 0
                    else:
                        G[i+1] = G[i+1] + G[i]
                        G[i] = 0
        #print(G)
    print(sum(G))

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys

def main():
    args = sys.argv
    if args[1] == args[2] and args[2] == args[3]:
        print("Yes")
	else:
        print("No")

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys

def main():
	args = sys.argv

	if args[1] == args[2] and args[2] == args[3]:
  		print("Yes")
	else:
  		print("No")

if __name__ == '__main__':
	main()

Buggy submission (verdict: Runtime Error):
import sys

args = sys.argv

if args[1] == args[2] and args[2] == args[3]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import sys

args = sys.argv

if args[1] == args[2] and args[2] == args[3]:
  print("Yes")
else:
  print("No")
Problem p03080 (python)

Fixed submission:
def main():
    N = int(input())
    S = input()
    R = 0
    B = 0
    for i in range(0,N):
        if S[i] == "R":
            R = R + 1
        else:
            B = B + 1
        if R > N/2:
            print("Yes")
            return
        elif B > N/2:
            print("No")
            return
    print("No")
    
if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
  N = int(input())
  S = input()
  R = 0
  B = 0
  for i in range(0,N):
    if S[i] == "R":
      R = R + 1
    else:
      B = B + 1
	if R > N/2:
      print("Yes")
      return
    elif B > N/2:
      print("No")
      return
    
if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def main():
  N = int(input())
  S = input()
  R = 0
  B = 0
  for i in range(0,N):
    if S[i] == "R":
      R = R + 1
    else:
      B = B + 1
	if R > N/2:
      print("Yes")
      return
    elif B > N/2:
      print("No")
      return
    
if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def main():
  N = int(input())
  S = input()
  R = 0
  B = 0
  for i in range(0,N):
    if S[i] == "R":
      R = R + 1
    else:
      B = B + 1
	if R > N/2:
      print("Yes")
      return
    elif B > N/2:
      print("No")
      return
    
if __name__ == '__main__':
  main()

Buggy submission (verdict: Runtime Error):
def main():
  N = int(input())
  S = input()
  R = 0
  B = 0
  for i in range(0,N):
    if S[i] == "R":
      R = R + 1
    else:
      B = B + 1
	if R > N/2:
      print("Yes")
      return
    elif B > N/2:
      print("No")
      return
      
  
if __name__ == '__main__':
  main()
Problem p03455 (python)

Fixed submission:
numbers = input().split()
a = int(numbers[0])
b = int(numbers[1])
if (a*b)%2==0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(N):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t)%2 != 0:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(N):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t)%2 != 0:
    print("No")
    exit()
print("Yes")
Problem p03457 (python)

Fixed submission:
N = int(input())
for i in range(N):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t)%2 != 0:
    print("No")
    exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
for i in range(N):
  t,x,y = map(int,input().split())
  if (x + y) > t or (x + y + t)%2 != 0:
    print("No")
    exit()
print("Yes"
Problem p02910 (python)

Fixed submission:
S = input()

lst = []

for ( i , j ) in enumerate(S) :
  if i % 2 == 1:
    if j not in ["L","U","D"]:      
      print("No")
      exit()
  else:
    if j not in ["R","U","D"]:      
      print("No")
      exit()
print("Yes")

Buggy submission (verdict: Runtime Error):
for i in S[::2]:
  if i == "L":
    A = False   
for x in S[1::2]:
  if x == "R":
    A = False

if A:
  print("Yes")
else:
  print("No")
Problem p02922 (python)

Fixed submission:
A,B = map(int,input().split())
 
if B == 1:
  print(0)
  
elif A >= B:
  print(1)
  
else:
 
  for i in range(1,21):
    if (A-1) * i + A >= B:
      print(i+1)
      break

Buggy submission (verdict: Runtime Error):
    A,B = map(int,input().split())
     
    if A >= B:
      print(1)
      
    else:
     
      for i in range(1,21):
        if ((A-1) * i + A ) >=  B:
          print(i+1)
          break
Problem p02936 (python)

Fixed submission:
n,q = map(int,input().split())
rl = [0] * n
scores = [0] * n
for i in range(n-1):
    a,b = map(int,input().split())
    rl[b-1] = a-1
for j in range(q):
    p,x = map(int,input().split())
    scores[p-1] += x
for k in range(1,n):
    scores[k] += scores[rl[k]]
print(*scores)

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())

tree = [set([i]) for i in range(N)]
points = [0] * N

for i in range(1, N):
  a, b = map(int, input().split())
  # print(a, b)
  tree[a].add(b)
  for j in range(i):
    if a in tree[j]:
      # print(j)
      tree[j].add(b)
      
for i in range(Q):
  p, x = map(int, input().split())
  for node in tree[p]:
    points[node-1] += x

# print(tree)

for point in points:
  print(point, end=" ")
Problem p02960 (python)

Fixed submission:
import sys
input = sys.stdin.readline
# import numpy as np

S = input().rstrip()

MOD = 10 ** 9 + 7
n = len(S)

# dp = np.zeros((100005, 13), dtype=np.uint64)

dp = [[0 for i in range(13)] for j in range(100005)]

dp[0][0] = 1

for i in range(n):
    if S[i] == '?':
        c = -1
    else:
        c = int(S[i])
    
    for j in range(10):
        if c != -1 and c != j:
            continue
        for ki in range(13):
            dp[i+1][(ki * 10 + j) %13] += dp[i][ki]
            
    for j in range(13):
        dp[i+1][j] %= MOD
        
        
    res = dp[n][5]
    
print(res)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
# import numpy as np

S = input().rstrip()

MOD = 10 ** 9 + 7
n = len(S)

# dp = np.zeros((100005, 13), dtype=np.uint64)

dp = [[0 for i in range(100005)] for j in range(13)]

dp[0][0] = 1

for i in range(n):
    if S[i] == '?':
        c = -1
    else:
        c = int(S[i])
    
    for j in range(10):
        if c != -1 and c != j:
            continue
        for ki in range(13):
            dp[i+1][(ki * 10 + j) %13] += dp[i][ki]
            
    for j in range(13):
        dp[i+1][j] %= MOD
        
    res = dp[n][5]
    
print(res)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
# import numpy as np

S = input().rstrip()

MOD = 10 ** 9 + 7
n = len(S)

# dp = np.zeros((100005, 13), dtype=np.uint64)

dp = [[0]*100005]*13

dp[0][0] = 1

for i in range(n):
    if S[i] == '?':
        c = -1
    else:
        c = int(S[i])
    
    for j in range(10):
        if c != -1 and c != j:
            continue
        for ki in range(13):
            dp[i+1][(ki * 10 + j) %13] += dp[i][ki]
            
    for j in range(13):
        dp[i+1][j] %= MOD
        
    res = dp[n][5]
    
print(res)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
# import numpy as np

S = input().rstrip()

MOD = 10 ** 9 + 7
n = len(S)

# dp = np.zeros((100005, 13), dtype=np.uint64)

list1 = [[0]*100005]*13

dp[0][0] = 1

for i in range(n):
    if S[i] == '?':
        c = -1
    else:
        c = int(S[i])
    
    for j in range(10):
        if c != -1 and c != j:
            continue
        for ki in range(13):
            dp[i+1][(ki * 10 + j) %13] += dp[i][ki]
            
    for j in range(13):
        dp[i+1][j] %= MOD
        
    res = dp[n][5]
    
print(res)

Buggy submission (verdict: Runtime Error):
import numpy as np
S = input()
  
dp = np.zeros((100005, 13), dtype=np.uint64)

dp[0][0] = 1

for i in range(n):
    if S[i] == '?':
        c = -1
    else:
        c = int(S[i])
    # print(c)
    
    for j in range(10):
        if c != -1 and c != j:
            continue
        for ki in range(13):
            dp[i+1][(ki * 10 + j) %13] += dp[i][ki]
            
    for j in range(13):
        dp[i+1][j] %= MOD
        
    res = dp[n][5]
    
print(res)