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

Fixed submission:
import math
A,B,C,D,E,F = map(int, input().split())
water = A
suger = 0
for a in range(31):
    for b in range(31):
        subwater = A * a + B * b
        if subwater == 0:
                continue
        for c in range(1501):
            subsuger = C * c
            if subsuger <= subwater * E:
                if F - subwater * 100 - subsuger > 0:
                    subsuger += D * min((F - subwater * 100 - subsuger) // D, (subwater * E - subsuger) // D)
                if subsuger <= subwater * E and subwater * 100 + subsuger <= F and subsuger / (subwater * 100 + subsuger) > suger / (water * 100 + suger):
                    water = subwater
                    suger = subsuger
print("{} {}".format(water * 100 + suger, suger))

Buggy submission (verdict: Runtime Error):
import math
A,B,C,D,E,F = map(int, input().split())
water = A
suger = 0
for a in range(31):
    for b in range(31):
        subwater = A * a + B * b
        if subwater == 0:
                continue
        for c in range(151):
            subsuger = C * c
            if subsuger <= subwater * E:
                subsuger += D * min(F - subwater * 100 - subsuger, ((subwater * E - subsuger) // D))
                if subsuger <= subwater * E and subwater * 100 + subsuger <= F and subsuger / (subwater * 100 + subsuger) > suger / (water * 100 + suger):
                    water = subwater
                    suger = subsuger
print("{} {}".format(water * 100 + suger, suger))
print(0//D)
Problem p03797 (python)

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

count = min(M // 2, N)
if M - 2 * N >= 0:
    M -= 2 * N
    count += M // 4

print(count)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
temp = N * 2 + M
print(temp　//　4)
Problem p02741 (python)

Fixed submission:
n = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
 
print(a[n-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
 
print(a[n+1])

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(a[n])
Problem p02900 (python)

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

aa = make_divisors(a)
bb = make_divisors(b)

aaa = list(set(aa) & set(bb))

al = len(aaa)
count = 0



def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


for i in range(al):
  if is_prime(aaa[i]):
    count += 1

print(count+1)

Buggy submission (verdict: Runtime Error):
from math import gcd
import math
a,b = map(int,input().split())

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

aa = make_divisors(a)
bb = make_divisors(b)

aaa = list(set(aa) & set(bb))

al = len(aaa)
count = 0



def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


for i in range(al):
  if is_prime(aaa[i]):
    count += 1

print(count+1)
Problem p02927 (python)

Fixed submission:
m,d=map(int,input().split())
count = 0

if d >= 22:

    for mm in range(1,m+1,1):
        
        for dd in range (22,d+1):
            dd = str(dd)
            d10 = int(dd[0])
            d1 = int(dd[1])
            
            if d1>=2 and mm == d1*d10 :
                count +=1
print(count)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
List=list(map(int,input().split()))


li = []

for i in range(n):
    count=0
    for j in range(n):
        if List[i]>List[j]:
            count += 1
    li.append(count)

count2=0

for i in range(1,n):
    for j in range(i+1,n+1):
        if int(List[i-1]) > int(List[j-1]):
            count2 += 1

counted = k*count2 + sum(li)*k*(k-1)/2

ans = counted % 1000000007
print(int(ans))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
List=list(map(int,input().split()))


li = []

for i in range(n):
    count=0
    for j in range(n):
        if List[i]>List[j]:
            count += 1
    li.append(count)
print(str(sum(li))+"li")


count2=0

for i in range(1,n):
    for j in range(i+1,n+1):
        #print(i,j)
        if int(List[i-1]) > int(List[j-1]):
            count2 += 1
    #print(str(count2)+"count2")


for m in range(k-1,0,-1):
    counted=count2+count2*(m-1)




ans = counted % 1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
List=list(map(int,input().split()))


li = []

for i in range(n):
    count=0
    for j in range(n):
        if List[i]>List[j]:
            count += 1
    li.append(count)
print(str(sum(li))+"li")


count2=0

for i in range(1,n):
    for j in range(i+1,n+1):
        #print(i,j)
        if int(List[i-1]) > int(List[j-1]):
            count2 += 1
    #print(str(count2)+"count2")


for m in range(k,0,-1):
    counted=count2+count2*(m-1)




ans = counted % 1000000007
print(ans)
Problem p02928 (python)

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


li = []

for i in range(n):
    count=0
    for j in range(n):
        if List[i]>List[j]:
            count += 1
    li.append(count)

count2=0

for i in range(1,n):
    for j in range(i+1,n+1):
        if int(List[i-1]) > int(List[j-1]):
            count2 += 1

counted = k*count2 + (sum(li))*k*(k-1)//2

ans = counted % (10**9+7)
print(int(ans))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
List=list(map(int,input().split()))


li = []

for i in range(n):
    count=0
    for j in range(n):
        if List[i]>List[j]:
            count += 1
    li.append(count)
#print(str(sum(li))+"li")


count2=0

for i in range(1,n):
    for j in range(i+1,n+1):
        #print(i,j)
        if int(List[i-1]) > int(List[j-1]):
            count2 += 1
    #print(str(count2)+"count2")


for m in range(1,k):
    counted=count2+sum(li)*(m)
counted += count2



ans = counted % 1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
List=list(map(int,input().split()))


li = []

for i in range(n):
    count=0
    for j in range(n):
        if List[i]>List[j]:
            count += 1
    li.append(count)
print(str(sum(li))+"li")


count2=0

for i in range(1,n):
    for j in range(i+1,n+1):
        #print(i,j)
        if int(List[i-1]) > int(List[j-1]):
            count2 += 1
    #print(str(count2)+"count2")


for m in range(k-1,0,-1):
    counted=count2+sum(li)*(m)




ans = counted % 1000000007
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
List=list(map(int,input().split()))


li = []

for i in range(n):
    count=0
    for j in range(n):
        if List[i]>List[j]:
            count += 1
    li.append(count)
print(str(sum(li))+"li")


count2=0

for i in range(1,n):
    for j in range(i+1,n+1):
        #print(i,j)
        if int(List[i-1]) > int(List[j-1]):
            count2 += 1
    #print(str(count2)+"count2")


for m in range(k-1,0,-1):
    counted=count2+count2*(m-1)




ans = counted % 1000000007
print(ans)
Problem p02957 (python)

Fixed submission:
a,b=map(int,input().split())
s = int((a+b)/2)
u = (a+b)%2

if u == 0:
  print(s)
  
else: 
  print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())

if (a+b) % 2 == 0:
  print((a+b)/2)
  
elif: (a+b)%2 == 1:
  print("IMPOSSIBLE")
Problem p02958 (python)

Fixed submission:
n = int(input())
bara=list(map(int,input().split()))
number=list(range(1,n+1))

count = 0
    
for i in range (0,n):
    if bara[i] != number[i]:
        count += 1

if count==2 or count==0:
    print("YES")
else:
    print("NO")

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

number=[1]
for i in range(2,n):
    number.append(i)
    
for i in range (n-1):
    if bara[i] != number[i]:
        count+=1

if count==2:
    print("YES")
else:
    print("NO")

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

number=[1]
for i in range(2,n):
  List.append(i)
    
for i in range n-1:
  if bara[i] != number[i]:
    count+=1

if count==2:
  print("YES")
else:
  print("NO")

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

number=[1]
for i in range(2,):
  List.append(i)
    
for i in range n-1:
  if bara[i] != number[i]:
    count+=1

if count==2:
  print("YES")
else:
  print("NO")

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

number=[1]
for i in range(2,):
  List.append(i)
    
for i in range n-1:
  if bara[i]==number[i]:
    count+=1

if count==2:
  print("YES")
else:
  print("NO")
Problem p02993 (python)

Fixed submission:
a,b,c,d = input()

if a==b or b==c or c==d:
  print("Bad")
else:
  print("Good")

Buggy submission (verdict: Runtime Error):
a,b,c,d = input()
pass = [int(a),int(b),int(c),int(d)]

if pass[0]==pass[1] or pass[1]==pass[2] or pass[2]==pass[3]:
    print("bad")

else:
    print("good")
Problem p03316 (python)

Fixed submission:
n = input()
sn=0
for i in range(len(str(n))):
  sn += int(n[i])
print("Yes" if int(n)%sn==0 else "No")

Buggy submission (verdict: Runtime Error):
n = int(input())
sn=0
for i in range(len(n)):
  sn += n[i]
print("Yes" if n%sn==0 else "No")
Problem p03369 (python)

Fixed submission:
a=input()
print(700+100*int(a.count("o")))

Buggy submission (verdict: Runtime Error):
a=imput()
print(a.count("o"))
Problem p03416 (python)

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

count=0

for i in range(a,b+1):
  mae=[]
  usi=[]
  for j in range(len(str(i))):
    mae.append(str(i)[j])
  for j in range(int(len(str(i))-1),-1,-1):
    usi.append(str(i)[j])
  if mae==usi:
    count+=1

print(count)

Buggy submission (verdict: Runtime Error):
a, b = map(int,input().split())
mae=[]
usi=[]
count=0

for i in range(a,b+1):
  for j in range(len(i)):
    mae.append(i[j])
  for j in range(len(i),0,-1):
    usi.append(i[j])
  if mae==usi:
    count+=1

print(count)
Problem p03433 (python)

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

if n%500 > a:
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
n = input()
a = input()

if n%500 > a:
  print("No")
else:
  print("Yes")
Problem p03434 (python)

Fixed submission:
n=int(input())
li=sorted(list(map(int,input().split())),reverse=True)
a=0
b=0

for i in range(n):
  if i%2==0:
    a+=li[i]
  else:
    b+=li[i]
print(a-b)

Buggy submission (verdict: Runtime Error):
n=int(input())
li=sorted(list(map(int,input().split())))
a=0
b=0

for i in range(n):
  if i%0==0:
    a+=li[i]
  else:
    b+=li[i]

print(a-b)
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("Even")
else:
  print("Odd")
Problem p03478 (python)

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

for i in range(1,n+1):
  sum=0
  t=i
  while t>0:
    sum += t%10
    t = (t-t%10)/10
  
  if a <= sum <= b:
    count += i
  
print(count)

Buggy submission (verdict: Runtime Error):
n,a,b = map(int,input().split())

for i in range(n):
  sum=0
  t=i
  while t>0:
    sum += t%10
    t = (t-t%10)/10
  if a <= sum <= b:
    count += i
  
print(count)
Problem p03486 (python)

Fixed submission:
s = input()
s_asc = ''.join(sorted(s))

t = input()
t_dsc = ''.join(sorted(t, reverse = True))

if s_asc < t_dsc:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):

  s = input()
s_asc = ''.join(sorted(s))

t = input()
t_dsc = ''.join(sorted(t, reverse = True))

if s_asc < t_dsc:
    print('Yes')
else:
    print('No')
Problem p03494 (python)

Fixed submission:
import math

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

count=0

while True:
  ch = 0
  for i in range(n):
    if a[i]%2 != 0:
      ch += 1
  if ch == 0:
    
    for j in range(n):
      a[j]= a[j]/2
    count +=1
  else:
    break


    
print(count)

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


all=[]

for i in range(n):
  if a[i]%2 ==0:
    count = 0
    while True:
      if (a[i]%2)==0:
        count+=1
        print(a[i])
        a[i]=a[i]/2
        
      else:
        break
    all.append(count)
    
printint((max(all)-1))

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

count==0
all=[]

for i in range(n):
  if a[i]%2 ==0:
    while true:
      if a[i]%2==0:
        count+=1
      else:
        break
    all.append(count)
    
print(max(count))

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

count==0
all=[]

for i in range(n):
  if a[i]%2 ==0:
    while true:
      if a[i]%2==0:
        count+=1
      else:
        break
    all.append(count)
    
print(max(count))
Problem p03502 (python)

Fixed submission:
n = int(input())
nn = n
sum=0
while n>0:
  sum+=n%10
  n= (n-n%10)/10
  
if nn%sum==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
nn = n
while n>0:
  sum+=n%10
  n= (n-n%10)/10
  
if nn%sum==0:
  print("Yes")
else:
  print("No")
Problem p03636 (python)

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

Buggy submission (verdict: Runtime Error):
a = input()
count = a.count()
print(a[0]+str(count)+a[count-1])

Buggy submission (verdict: Runtime Error):
a = input
count = a.count()
print(a[0]+str(count)+a[count-1])
Problem p03644 (python)

Fixed submission:
n = int(input())
a = []
b=[]

for i in range(1,n+1):
  a.append(i)
count = 0


for i in range(1,n+1):
  
  count = 0
  while True:
    if (a[i-1]%2) == 0:
      count += 1
      a[i-1] = a[i-1]/2
      
    else:
      break
  b.append(count)


c =max(b)
print(b.index(c)+1)

Buggy submission (verdict: Runtime Error):
n = int(input())


while (2**i <= n):
  i += 1
  
 print(2**(i-1))

Buggy submission (verdict: Runtime Error):
n = int(input())
i=0
while (2**i <= n):
  i += 1
  
 print(2**(i-1))
Problem p03693 (python)

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

four = b+c

if (int(four))%4 == 0:

  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
a,b,c=map(input().split())

four = b+c

if int(four)%4 == 0:
  print("Yes")
else:
  print("No")
Problem p04044 (python)

Fixed submission:
n,l = map(int,input().split())
a=[]
for i in range(n):
  a.append(input())
  
a=sorted(a)
print("".join(a))

Buggy submission (verdict: Runtime Error):
n,l = map(int,input().split())
a=[]
for i in range(n):
  a.append(input())
  
a=sorted(a)

print("".joined(a))
Problem p02743 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a,b,c = list(map(int,input().split()))


ret = "No"
if c-a-b<0:
    ret="No"
elif 4*a*b<(c-a-b)**2:
    ret="Yes"
print(ret)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a,b,c = list(map(int,input().split()))
from decimal import Decimal
a,b,c = list(map(Decimal,[a,b,c]))

ret = "No"
if a**0.5+b**0.5<c**0.5:
    ret="Yes"
print(ret)
Problem p02850 (python)

Fixed submission:
# -*- coding: utf-8 -*-
n = int(input())
ab = [list(map(int,input().split())) for i in range(n-1)]
ans = [0] * (n-1)
abi = [[] for _ in range(n+1)]
#再起のlimitを上げる
import sys
sys.setrecursionlimit(4100000)
for i,(a,b) in enumerate(ab):
    abi[a].append((i,b))
    abi[b].append((i,a))

def dfs(v,parent=-1,color=-1):
    k=1
    for i in abi[v]:
        if parent==i[1]:continue
        if(k==color):k+=1
        ans[i[0]]=k
        k+=1
        dfs(i[1],v,ans[i[0]])

dfs(1)

print(max(ans))
for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
n = int(input())
ab = [list(map(int,input().split())) for i in range(n-1)]
abi = [[] for _ in range(n+1)]
ans = [0] * (n-1)
for i,(a,b) in enumerate(ab):
    abi[a].append((i,b))
    abi[b].append((i,a))

def dfs(v,parent=-1,color=-1):
    k=1
    for i in abi[v]:
        if parent==i[1]:continue
        if(k==color):k+=1
        ans[i[0]]=k
        k+=1
        dfs(i[1],v,ans[i[0]])

dfs(1)

print(max(ans))
for i in ans:
    print(i)
Problem p02900 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a,b = list(map(int,input().split()))
#最大公約数

#最大公約数
import fractions
abgcd = fractions.gcd(a, b)

def prime_factorize(N):
    #素因数分解
    from collections import defaultdict
    factorize = defaultdict(int)
    while N%2 == 0:
        factorize[2]+=1
        N //= 2
    i=1
    while i*i <=N:
        i += 2
        if N%i: continue
        while N%i == 0:
            factorize[i] += 1
            N //= i
    if N!=1:factorize[N]=1
    return factorize

print(len(prime_factorize(abgcd).keys())+1)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a,b = list(map(int,input().split()))
#最大公約数
import fractions
_gcd = fractions.gcd(a, b)

if _gcd == 1:
    print(1)
    import sys
    sys.exit()

def primes(n):
    #2~nまでの素数を列挙
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
pms = primes(_gcd) #sqrt(_gcd) までの素数を列挙
ret = 1
for i in pms:
    if _gcd%i==0:
        ret+=1
print(ret)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a,b = list(map(int,input().split()))
#最大公約数
import fractions
_gcd = fractions.gcd(a, b)

def primes(n):
    #2~nまでの素数を列挙
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]
pms = primes(_gcd) #sqrt(_gcd) までの素数を列挙
ret = 1
for i in pms:
    if _gcd%i==0:
        ret+=1
print(ret)
Problem p02936 (python)

Fixed submission:
from collections import deque
import sys
input = sys.stdin.readline

def main():
    N, Q = map(int, input().split())
    edges = [[] for _ in range(N)]
    for _ in range(N-1):
        a, b = map(int, input().split())
        edges[b-1].append(a-1)
        edges[a-1].append(b-1)

    counts = [0]*N
    for _ in range(Q):
        p, x = map(int, input().split())
        counts[p-1] += x

    parent_nodes = deque()
    parent_nodes.append(0)
    visited_nodes = set()
    while parent_nodes:
        parent = parent_nodes.popleft()
        if parent in visited_nodes:
            continue
        visited_nodes.add(parent)
        for child in edges[parent]:
            if child in visited_nodes:
                continue
            counts[child] += counts[parent]
            parent_nodes.append(child)

    print(' '.join(list(map(str, counts))))

if __name__ == "__main__":
    main()

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

import sys
sys.setrecursionlimit(100000)

dd_ab = [[] for _ in range(n+1)]
for i in range(n-1):
    a,b = tuple(map(int,input().split()))
    dd_ab[a].append(b)

dd_px = [0]*(n+1)
for i in range(q):
    p,x = tuple(map(int,input().split()))
    dd_px[p] += x

def add_tree(value,tree):
    for i in tree:
        dd_px[i]+=value
        add_tree(dd_px[i],dd_ab[i])
add_tree(dd_px[1],dd_ab[1])
print(*dd_px[1::])

Buggy submission (verdict: Runtime Error):
n,q = list(map(int,input().split()))
from collections import defaultdict
import sys
sys.setrecursionlimit(100000)

dd_ab = defaultdict(list)
for i in range(n-1):
    a,b = tuple(map(int,input().split()))
    dd_ab[a].append(b)

dd_px = defaultdict(int)
for i in range(q):
    p,x = tuple(map(int,input().split()))
    dd_px[p] += x

ret = [0] * (n+1)
def add_tree(node,value):
    retn = value + dd_px[node]
    ret[node] = retn
    for n in dd_ab[node]:
        add_tree(n,retn)
add_tree(1,0)
for i in ret[1::]:
    print(i)

Buggy submission (verdict: Runtime Error):
n,q = list(map(int,input().split()))
from collections import defaultdict
dd_ab = defaultdict(list)
for i in range(n-1):
    a,b = tuple(map(int,input().split()))
    dd_ab[a].append(b)

dd_px = defaultdict(int)
for i in range(q):
    p,x = tuple(map(int,input().split()))
    dd_px[p] += x

ret = [0] * (n+1)
def add_tree(node,value):
    retn = value
    if dd_px[node]:
        retn += dd_px.pop(node)
    ret[node] += retn
    if dd_ab[node]:
        for n in dd_ab.pop(node):
            add_tree(n,retn)
add_tree(1,0)
for i in ret[1::]:
    print(i)
Problem p02960 (python)

Fixed submission:
# -*- coding: utf-8 -*-
s = input()
s = s[::-1]
MOD = 10**9+7
mod13_map = [[i for i in range(13)]]
ma = mod13_map.append
for i in range(1,10**5):
    next_digit = list(map(lambda x:x*10%13,mod13_map[i-1]))
    ma(next_digit)

ret = [1] + [0] * 12 #13で割ってi余る数の合計
for i,v in enumerate(s):
    if v!="?":
        #mod13_map[i][v]だけ、右にシフト
        ret *= 2
        sft = mod13_map[i][int(v)]
        ret = ret[13-sft:26-sft]
    else:
        temp_ret = [0] * 13
        for j in range(10):
            #?がjの場合
            for k,l in enumerate(ret):
                temp_ret[(k+mod13_map[i][j])%13]+=l
        temp_ret = list(map(lambda x:x%MOD,temp_ret))
        ret = temp_ret
print(ret[5]%MOD)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np
from copy import deepcopy
s = input()
cnt = 0
mod_13_cnt = np.array([0]*13)
hatena = [0,1,2,3,4,5,6,7,8,9]
#定数部分を評価
s_teisu = int(s.replace("?","0")) %13
mod_13_cnt[s_teisu]+=1
fn = lambda x : x %(10**9+7)
for i,s_i in enumerate(s[::-1]):
     mod_13_cnt = np.array(list(map(fn,mod_13_cnt)))
     ph = np.array([0]*13)
     if s_i!="?":
         continue
     for j in hatena:
         add_v = j*10**i%13
         ph += np.roll(mod_13_cnt,add_v)
     mod_13_cnt = ph
print(mod_13_cnt[5]%(10**9+7))
Problem p02971 (python)

Fixed submission:
# -*- coding: utf-8 -*-
a = int(input())
c = [int(input()) for i in range(a)]

#最大値のindexを探し、最大値が複数あるか確認
all_max = max(c)
first_max_id = c.index(all_max)

c_dash = sorted(c,reverse=True)
second_max_value = c_dash[1]
for i,v in enumerate(c):
    if i != first_max_id:
        pr_val = all_max
    else:
        if all_max == second_max_value:
            pr_val = all_max
        else:
            pr_val = second_max_value
    print(pr_val)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
c = [int(input()) for i in range(a)]

#最大値のindexを探し、最大値が複数あるか確認
all_max = max(c)
first_max_id = c.index(all_max)

c_dash = sorted(c,reversed=True)
second_max_value = c_dash[1]
for i,v in enumerate(c):
    if i != first_max_id:
        pr_val = all_max
    else:
        if all_max == second_max_value:
            pr_val = all_max
        else:
            pr_val = second_max_value
    print(pr_val)
Problem p02972 (python)

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

n = int(input())
a = list(map(int,input().split()))
ret = [0 for _ in range(n+1)]
#後ろから求める
for i,a_i in enumerate(a[-1::-1]):
    cur_ret_sum = sum(ret[n-i::n-i])%2
    if a_i!=cur_ret_sum:
        ret[n-i]=1
m = sum(ret[1::])
print(m)
if m > 0:
    print(" ".join([str(i) for i,v in enumerate(ret) if v==1]))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int,input().split()))
ret = [0 for _ in range(n+1)]
#後ろから求める
for i,a_i in enumerate(a[-1::-1]):
    cur_ret_sum = sum(ret[n-i::n-i])%2
    if a_i!=cur_ret_sum:
        ret[n-i]=1

print(sum(ret[1::]))
print(" ".join(ret[1::]))