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

Fixed submission:
s = []
for i in range(5):
    s.append(int(input()))
k = int(input())
for i in range(4):
    if s[i+1]-s[0] >k:
        print(":(")
        break
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
s = []
for i in range(5):
    s.apppend(int(input())
k = int(input())
for i in range(4):
    if s[i+1]-s[i] >k:
        print(":(")
        break
else:
    print("Yay!")

Buggy submission (verdict: Runtime Error):
s = []
for i in range(5):
    s.apppend(int(input()))
k = int(input())
for i in range(4):
    if s[i+1]-s[i] >k:
        print(":(")
        break
else:
    print("Yay!")
Problem p02915 (python)

Fixed submission:
N=int(input())
print(N**3)

Buggy submission (verdict: Runtime Error):
N=long(input())
print(N**3)
Problem p02695 (python)

Fixed submission:
# 2020/05/02
# AtCoder Beginner Contest 165 - C

a = list()
def mkArray(in_list, sav_val, cnt):
    if cnt >= n:
        a.append(in_list)
        return 0
    else:
        for x in range(sav_val, m + 1):
            wk_list = list()
            wk_list.extend(in_list)
            wk_list.append(x)
            mkArray(wk_list, x, cnt + 1)

# Input
n, m, q = map(int,input().split())
abcd = list()

for i in range(q):
    w_abcd = list(map(int,input().split()))
    abcd.append(w_abcd)

# Make Array
w_a = list()
mkArray(w_a, 1, 0)

# Search
ans = 0
for i in range(len(a)):
    wans = 0
    for j in range(q):
        if a[i][abcd[j][1]-1] - a[i][abcd[j][0]-1] == abcd[j][2]:
            wans = wans + abcd[j][3]

    if wans > ans:
        ans = wans

# Output
print(ans)

Buggy submission (verdict: Runtime Error):
# 2020/05/02
# AtCoder Beginner Contest 165 - C

a = list()
def mkArray(in_list, sav_val, cnt):
    if cnt >= m:
        a.append(in_list)
        return 0
    else:
        for x in range(sav_val, m + 1):
            wk_list = list()
            wk_list.extend(in_list)
            wk_list.append(x)
            mkArray(wk_list, x, cnt + 1)

# Input
n, m, q = map(int,input().split())
abcd = list()

for i in range(q):
    w_abcd = list(map(int,input().split()))
    abcd.append(w_abcd)

# Make Array
w_a = list()
mkArray(w_a, 1, 0)

# Search
ans = 0
for i in range(len(a)):
    wans = 0
    for j in range(q):
        if a[i][abcd[j][1]-1] - a[i][abcd[j][0]-1] == abcd[j][2]:
            wans = wans + abcd[j][3]

    if wans > ans:
        ans = wans

# Output
print(ans)

Buggy submission (verdict: Runtime Error):
# 2020/05/02
# AtCoder Beginner Contest 165 - C

a = list()
def mkArray(in_list, sav_val, cnt):
    if cnt >= m - 1:
        a.append(in_list)
        return 0
    else:
        for x in range(sav_val, m + 1):
            wk_list = list()
            wk_list.extend(in_list)
            wk_list.append(x)
            mkArray(wk_list, x, cnt + 1)

# Input
n, m, q = map(int,input().split())
abcd = list()

for i in range(q):
    w_abcd = list(map(int,input().split()))
    abcd.append(w_abcd)

# Make Array
w_a = list()
mkArray(w_a, 1, 0)

# Search
ans = 0
for i in range(len(a)):
    wans = 0
    for j in range(q):
        if a[i][abcd[j][1]-1] - a[i][abcd[j][0]-1] == abcd[j][2]:
            wans = wans + abcd[j][3]

    if wans > ans:
        ans = wans

# Output
print(ans)
Problem p03013 (python)

Fixed submission:
# 2020/05/10
# AtCoder Beginner Contest 129 - C

# Input
n, m = map(int,input().split())
sav_a = -1
ans = 0
a = [0] * (n+1)
imp_flg = False
for i in range(m):
    ia = int(input())
    a[ia] = 1
    if sav_a + 1 == ia:
        imp_flg = True
    sav_a = ia

dp = [0] * (n+1)

if imp_flg != True and n > 1:
    dp[1] = 1
    dp[2] = 2
    if a[1] == 1:
        dp[1] = 0
        dp[2] = 1
    if a[2] == 1:
        dp[2] = 0

    for i in range(3, n+1):
        if a[i] == 0:
            dp[i] = (dp[i-1] + dp[i-2]) % (10**9+7)
elif n == 1:
    dp[1] = 1

# Output
print(dp[n])

Buggy submission (verdict: Runtime Error):
# 2020/05/10
# AtCoder Beginner Contest 129 - C

# Input
n, m = map(int,input().split())
sav_a = -1
ans = 0
a = [0] * (n+1)
imp_flg = False
for i in range(m):
    ia = int(input())
    a[ia] = 1
    if sav_a + 1 == ia:
        imp_flg = True
    sav_a = ia

dp = [0] * (n+1)

if imp_flg == True:
    ans = 0
else:
    dp[1] = 1
    dp[2] = 2
    if a[1] == 1:
        dp[1] = 0
        dp[2] = 1
    if a[2] == 1:
        dp[2] = 0

    for i in range(3, n+1):
        if a[i] == 0:
            dp[i] = (dp[i-1] + dp[i-2]) % (10**9+7)

# Output
print(dp[n])
Problem p02771 (python)

Fixed submission:
s = input().split()
if s[0]==s[1] and s[0]!=s[2]:
  print("Yes")
elif s[0]==s[2] and s[0]!=s[1]:
  print("Yes")
elif s[2]==s[1] and s[0]!=s[2]:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s = input().sprit()
if s[0]==s[1] and s[0]!=s[2] print("Yes")
elif s[0]==s[2] and s[0]!=s[1] print("Yes")
elif s[2]==s[1] and s[0]!=s[2] print("Yes")
else print("No")
Problem p02550 (python)

Fixed submission:
n, x, m = map(int,input().split())
lst = [0 for i in range(m)]
lst2 = [x]
i = 2
lst[x] = 1
c = 0
while True:
    if (i > n):
        break
    x = x**2%m
    if (lst[x] == 0):
        lst[x] = i
        lst2.append(lst2[i - 2] + x)
        i = i + 1
    else:
        lst2.append(lst2[i - 2] + x)
        c = 1
        break
if (c == 1):
    a = i - lst[x]
    b = lst2[i - 1] - lst2[i - 1 - a]

    c = (n - i)//a
    d = (n - i)%a
    ans = lst2[i - 1] + b*c + lst2[i - 1 - a + d] - lst2[i - 1 - a]
    print(ans)

else:
    print(lst2[n - 1])

Buggy submission (verdict: Runtime Error):
n, x, m = map(int,input().split())
lst = [0 for i in range(m)]
lst2 = [x]
i = 2
lst[x] = 1
while True:
    if (i > n):
        break
    x = x**2%m
    if (lst[x] == 0):
        lst[x] = i
        lst2.append(lst2[i - 2] + x)
        i = i + 1
    else:
        lst2.append(lst2[i - 2] + x)
        break
a = i - lst[x]
b = lst2[i - 1] - lst2[i - 1 - a]
i = i - 1
c = (n - i)//a
d = (n - i)%a
ans = lst2[i - 1] + b*c + lst2[i - 1 - a + d] - lst2[i - 1 - a]
print(ans)
Problem p02676 (python)

Fixed submission:
n = int(input())
s = input()
x = len(s)
if (x <= n):
  print(s)
else:
  for i in range (n):
    print(s[i], end = '')
  print("...")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input
if (len(s) <= n):
  print(s)
else:
  for i in range (n):
    print(s[i], end = '')
  print()
Problem p02707 (python)

Fixed submission:
n = int(input())
lst = list(map(int,input().split()))
lst2 = [0 for i in range(n)]
for i in range(n - 1):
  x = lst[i]
  lst2[x - 1] = lst2[x - 1] + 1
for i in range(n):
  print(lst2[i])

Buggy submission (verdict: Runtime Error):
n = int(input())
lst = list(map(int,input().split()))
lst2 = [0 for i in range(n)]
for i in range(n):
  x = lst[i]
  lst2[x - 1] = lst2[x - 1] + 1
for i in range(n):
  print(lst2[i])
Problem p02753 (python)

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

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

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

for i in range(n):
  if (i == 0):
    ans =b[a[0] - 1]
    y = a[0]
  else:
    x = a[i]
    if (x - y == 1):
      ans = ans + b[x - 1] + c[y - 1]
    else:
      ans = ans + b[x - 1]
    y = x

print(ans)

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

for i in range(n):
  if (i == 0):
    ans =b[a[0] - 1]
    y = a[0]
  else:
    x = a[i]
    if (x - y == 1):
      ans = ans + b[x - 1] + c[x - 1]
    else:
      ans = ans + b[x - 1]
    y = x

print(ans)
Problem p02951 (python)

Fixed submission:
a, b, c = map(int,input().split())
ans = c - (a - b)
if(ans < 0):
  print(0)
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int,input()split())
ans = c - (a - b)
if(ans < 0):
  print(0)
else:
  print(ans)
Problem p02659 (python)

Fixed submission:
def main():
    import decimal
    A , B = map(decimal.Decimal, input().split())
    C = decimal.Decimal(A) * decimal.Decimal(B)
    #print(C)
    D = str(C)
    D = D.split(".")[0]
    #print(D)
    E = int(D)
    print(E)



if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from decimal import *
def main():
    A , B = input().split()
    A = float(A)
    B = float(B)
    C = Decimal(A) * Decimal(B)
    #print(C)
    D = str(C)
    D = D.split(".")[0]
    #print(D)
    E = int(D)
    print(E)



if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from decimal import *
def main():
    A , B = input().split()
    A = float(A)
    B = float(B)
    C = Decimal(A) * Decimal(B)
    #print(C)
    D = str(C)
    D = D.split(".")[0]
    #print(D)
    E = int(D)
    print(E)



if __name__ == '__main__':
    main()
Problem p02572 (python)

Fixed submission:
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplt(n): return [tuple(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
A = inpl()

sss = list(itertools.accumulate(A))
ss = sum(A)
s = 0
for i in range(len(A)-1):
    s = (s + ((ss-sss[i]) * A[i])) % mod

print(s)

Buggy submission (verdict: Runtime Error):
import sys, bisect, math, itertools, string, queue, copy
import numpy as np
import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplt(n): return [tuple(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

n = inp()
A = inpl()

ss = sum(A)
s = 0
for i in range(len(A)):
    s = (s + sum(A[i+1:])*A[i]) % mod

print(s)
Problem p02571 (python)

Fixed submission:
# abc177_b.py
S = input()
T = input()

ans = 0
length = len(T)
slen= len(S)
mincnt = 10000
for i in range(slen-length+1):
    tmp = S[i:i+length]
    cnt = 0
    for i in range(length):
        if tmp[i]!=T[i]:
            cnt+=1
    if cnt < mincnt:
        mincnt=cnt
print(mincnt)

Buggy submission (verdict: Runtime Error):
# abc177_b.py
S = input()
T = input()
for i in range(1,len(T)):
    if T[0:i] in S:
        continue
    else:
        ans = i
        break
print(len(T)-i)
Problem p02572 (python)

Fixed submission:
def solve():
    N = int(input())
    A = list(map(int, input().split()))
    square = []
    for i in A:
        square.append(i**2)
    return (sum(A)**2 - sum(square))//2 % (10**9+7)


print(solve())

Buggy submission (verdict: Runtime Error):
# abc177_c.py
from numba import jit
@numba
def solve():
    N = int(input())
    A = list(map(int,input().split()))
    ans = 0
    mod = 10**9+7
    for i in range(N-1):
        for j in range(i+1,N):
            if i != j:
                ans+=A[i]*A[j]
                ans%=mod
    return ans%mod

print(solve())
Problem p02859 (python)

Fixed submission:
N = int(input())
print(N**2)

Buggy submission (verdict: Runtime Error):
N = input()
print(N**2)

Buggy submission (verdict: Runtime Error):
N = input()
print(N**)
Problem p02880 (python)

Fixed submission:
N = int(input())
ans = "No"
if N <=81:
  for i in range(1,10):
    for j in range(1,10):
      if i*j == N:
        ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = "No"
if N <=81:
	for i in range(1,9):
       if N%i == 0:
           ans = "Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
	N = int(input())
ans = "No"
for i in range(1,9):
    if N%i == 0:
        ans = "Yes"
print(ans)
Problem p02832 (python)

Fixed submission:
n=int(input())
a=list(int(x) for x in input().split())

count=0
z=True
j=0

if  1 not in a:
    print(-1)
else:
    for k in range(j,n):
        if a[k]==count+1:
            j=k
            count=count+1

    print(n-count)

Buggy submission (verdict: Runtime Error):
import sys

n=int(input())
a=list(int(x) for x in input().split())

count=0
z=True
j=0

if  1 not in a:
    print(-1)
    sys.exit(1)

for k in range(j,n):
    if a[k]==count+1:
        j=k
        count=count+1

print(n-count)
Problem p02629 (python)

Fixed submission:
n = int(input())
nums = []
ans = ""
while n >= 1:
    n -= 1
    ans += chr(ord('a') + n % 26)
    n = n // 26
print(ans[::-1])

Buggy submission (verdict: Runtime Error):
import math
alp = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'i', 'j', 'k', 'l', 'm',
       'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
n = int(input())
nums = []
ans = ""
while n >= 1:
    n -= 1
    ans += alp[(n % 26)]
    n = n // 26
print(ans)
Problem p02793 (python)

Fixed submission:
from fractions import gcd

MOD = 1000000007

N = int(input())
A = list(map(int, input().split()))

lcm = 1
for i in A: lcm = lcm * i // gcd(lcm, i)

ans = 0
for i in A: ans += lcm // i

print(ans % MOD)

Buggy submission (verdict: Runtime Error):
import math

MOD = 1000000007
inv = [1] * 1001001

def LCM(a, b):
    gcd = math.gcd(a, b)
    return a * b // gcd

N = int(input())
A = list(map(int, input().split()))

for i in range(2, 1001001):
    inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD

lcm = 1
for i in A:
    lcm = LCM(lcm, i)

ans = 0
for i in A:
    ans += lcm // i
    ans %= MOD

print(ans)
Problem p02833 (python)

Fixed submission:
N = int(input())
if N % 2:
  print(0)
else:
  ans = 0
  N //= 2
  while N > 0:
    ans += N // 5
    N //= 5
  print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N % 2: print(0)
else:
  ans = 0
  N //= 2
  while n > 0:
    ans += N // 5
    N //= 5
	print(ans)
Problem p02659 (python)

Fixed submission:
li = input().split()
a = int(li[0])
b = str(li[1])
b = int(b.replace('.',''))

print(a*b//100)

Buggy submission (verdict: Runtime Error):
import math

a = int(input())
b = float(input())

print(math.floor(a*b))
Problem p02781 (python)

Fixed submission:
import numpy as np

dp = np.zeros((105,4,2),dtype=np.int32)

s = input()
n = len(s)
K = int(input())

dp[0][0][0] = 1
for i in range(n):
    for j in range(4):
        for k in range(2):
            nd = int(s[i])
            for d in range(10):
                ni = i + 1
                nj = j 
                nk = k
                if d != 0:
                    nj += 1
                if nj > K:
                    continue
                if k == 0:
                    if d > nd:
                        continue
                    if d < nd:
                        nk = 1
                dp[ni][nj][nk] += dp[i][j][k]
ans = dp[n][K][0] + dp[n][K][1]
print(ans)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
import time

N = input()
K = int(input())

N_len = len(N)

ans = 0
if K == 1:
    time.sleep(0.3)
    ans = int(N[0]) + 9 * (N_len-1)
elif K == 2:
    time.sleep(0.6)
    if N_len >= 2:
        ans = (int(N[0])-1) * 9 *(N_len-1)
        ans += int(N[1]) + 9 * (N_len-2)
        for i in range(1,N_len-1):
            ans += 9*9*i
elif K == 3:
    time.sleep(0.9)
    if N_len >= 3:
        # N[0],N[1]
        ans = int(N[2]) + 9 * (N_len-3)
        # N[0], 1~N[1]-1
        ans += max(int(N[1])-1,0) * 9 * (N_len-2)
        # N[0], N[1] = 0
        ans += 9**2 * comb(N_len-2,2,exact=True)
        # 1~N[0]-1
        ans += (int(N[0])-1) * 9**2 * comb(N_len-1,2,exact=True)     
        # N[0] = 0
        for i in range(2,N_len-1):
            ans += 9**3 * comb(i,2,exact=True)


#print(9**3*comb(N_len,3,exact=True))
print(ans)

Buggy submission (verdict: Runtime Error):
from scipy.misc import comb
import time

N = input()
K = int(input())

N_len = len(N)

ans = 0
if K == 1:
  	time.sleep(0.5)
    ans = int(N[0]) + 9 * (N_len-1)
elif K == 2:
  	time.sleep(1)
    if N_len >= 2:
        ans = (int(N[0])-1) * 9 *(N_len-1)
        ans += int(N[1]) + 9 * (N_len-2)
        for i in range(1,N_len-1):
            ans += 9*9*i
elif K == 3:
  	time.sleep(1.5)
    if N_len >= 3:
        # N[0],N[1]
        ans = int(N[2]) + 9 * (N_len-3)
        # N[0], 1~N[1]-1
        ans += max(int(N[1])-1,0) * 9 * (N_len-2)
        # N[0], N[1] = 0
        ans += 9**2 * comb(N_len-2,2,exact=True)
        # 1~N[0]-1
        ans += (int(N[0])-1) * 9**2 * comb(N_len-1,2,exact=True)     
        # N[0] = 0
        for i in range(2,N_len-1):
            ans += 9**3 * comb(i,2,exact=True)


#print(9**3*comb(N_len,3,exact=True))
print(ans)
Problem p02777 (python)

Fixed submission:
[S, T] = [str(i) for i in input().split()]
[A, B] = [int(i) for i in input().split()]
U = str(input())

if S == U:
    print(A-1, B)
else:
    print(A, B-1)

Buggy submission (verdict: Runtime Error):
[H, A] = [int(i) for i in input().split()]
t = 0
if H/A != int(H/A):
    t = 1
print(int(H/A) + t)
Problem p02777 (python)

Fixed submission:
import sys


TEST_INPUT = [
    """
    red blue
    3 4
    red
    """,
    """
    red blue
    5 5
    blue
    """
]
ANSWER = [
    "2 4",
    "5 4"
]


class InputHandler:

    def __init__(self, text_lines="", is_test=False):
        self.data = list(text_lines.split("\n"))
        self.index = 0
        self.is_test = is_test

    def input(self):
        if self.is_test:
            self.index += 1
            return self.data[self.index].strip()
        else:
            return sys.stdin.readline().rstrip()


def solve(s, t, a, b, u):
    if s == u:
        return str(a - 1) + " " + str(b)
    else:
        return str(a) + " " + str(b - 1)


def input_and_solve(ih):
    s, t = ih.input().split()
    a, b = map(int, ih.input().split())
    u = ih.input()
    res = solve(s, t, a, b, u)
    return res


def main():
    ih = InputHandler()
    res = input_and_solve(ih)
    print(res)


def test():
    for test_input, ans in zip(TEST_INPUT, ANSWER):
        ih = InputHandler(test_input, True)
        res = input_and_solve(ih)
        assert str(res) == str(ans)


if __name__ == "__main__":
    test()
    main()

Buggy submission (verdict: Runtime Error):
import sys


TEST_INPUT = [
    """
    red blue
    3 4
    red
    """,
    """
    red blue
    5 5
    blue
    """
]
ANSWER = [
    "2 4",
    "5 4"
]


class InputHandler:

    def __init__(self, text_lines="", is_test=False):
        self.data = list(text_lines.split("\n"))
        self.index = 0
        self.is_test = is_test

    def input(self):
        if self.is_test:
            self.index += 1
            return self.data[self.index].strip()
        else:
            return sys.stdin.readline().rstrip()


def solve(s, t, a, b, u):
    if s == u:
        return f"{a - 1} {b}"
    else:
        return f"{a} {b - 1}"


def main():
    ih = InputHandler()
    s, t = ih.input().split()
    a, b = map(int, ih.input().split())
    u = ih.input()
    res = solve(s, t, a, b, u)
    print(res)


def test():
    for test_input, ans in zip(TEST_INPUT, ANSWER):
        ih = InputHandler(test_input, True)
        s, t = ih.input().split()
        a, b = map(int, ih.input().split())
        u = ih.input()
        res = solve(s, t, a, b, u)
        assert str(res) == str(ans)


if __name__ == "__main__":
    test()
    main()
Problem p02987 (python)

Fixed submission:
S = list(input())
S_cnt = dict()

for s in S:
  if s in S_cnt.keys():
    S_cnt[s] += 1
  else:
    S_cnt[s] = 1
    
res = 'Yes'
for s in S_cnt.keys():
  if S_cnt[s] != 2:
    res = 'No'
print(res)

Buggy submission (verdict: Runtime Error):
S = list(input())
S_cnt = dict()

for s in S:
  if s in S_cnt.keys():
    S_cnt[s] += 1
  else:
    S_cnt[s] = 1
    
res = 'Yes'
for s in S_dict.keys():
  if S_dict[s] != 2:
    res = 'No'
print(res)
Problem p03073 (python)

Fixed submission:
S = list(input())
 
res_10 = 0
res_01 = 0
 
for i in range(len(S)):
    if i % 2 == 0:
        if S[i] == "0":
            res_10 += 1
        else:
            res_01 += 1
    else:
        if S[i] == "1":
            res_10 += 1
        else:
            res_01 += 1
print(min(res_10, res_01))

Buggy submission (verdict: Runtime Error):
S = list(input())

res_10 = 0
res_01 = 0

for i in range(N):
    if i % 2 == 0:
        if S[i] == "0":
            res_10 += 1
        else:
            res_01 += 1
    else:
        if S[i] == "1":
            res_10 += 1
        else:
            res_01 += 1
print(min(res_10, res_01))
Problem p03135 (python)

Fixed submission:
# A

def main(a, b):
    return a / b

if __name__ == "__main__":
    T, X = map(int, input().split())
    res = main(T, X)
    print(res)

Buggy submission (verdict: Runtime Error):
# D

# 10^12 < 2^40

def hard_log2(N):
    
    r = 1
    l = 0
    while N >= 2*r:
        r *= 2
        l += 1
    return r, l

def maximize_simple(r_list, K, N):
    if K == 0:
        return 0
    R = 0
    L, M = hard_log2(K)
    for i in range(M+1):
        R += max(r_list[i], N - r_list[i])*(2**i)
        
    return R

def maximize(r_list, K, N):
    
    if K == 0:
        return 0
    
    L, M = hard_log2(K)
    
    if r_list[M] >= N - r_list[M]:
        return maximize_simple(r_list, L-1, N)+r_list[M]*(2**M)
    else:
        R = 0
        m = M
        while 2**m > K-L:
            R += (N-r_list[m])*(2**m)
            m -= 1
        
        return max(maximize(r_list, K-L, N)+R, maximize_simple(r_list, L-1, N)+r_list[M]*(2**M))

def main_d(A_list, N, K):
    r_list = [0]*41
    for i in range(41):
        for A in A_list:
            if (A % 2**(i+1)) >= 2**i:
                r_list[i] += 1
    if K == 0:
        R = 0
        for i in range(41):
            R += r_list[i]*(2**i)
        return R
    L, M = hard_log2(K)
    R = 0
    for i in range(M+1, 41):
        R += r_list[i]*(2**i)
    return R + maximize(r_list, K, N)
    

if __name__ == "__main__":
    N, K = map(int, input().split())
    A_list = list(map(int, input().split()))
    res = main_d(A_list, N, K)

    
    print(res)
Problem p03332 (python)

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

LARGE = 998244353
INVS = [0]*(N+1)
for i in range(1, N+1):
    INVS[i] = pow(i, LARGE-2, LARGE)
NCKL = [1]*(N+1)
for i in range(1, N+1):
    NCKL[i] = (NCKL[i-1] * (N+1-i) * INVS[i]) % LARGE

res = 0
for i in range(N+1):
    if (K - A*i) % B == 0:
        j = (K - A*i) // B
        if j >= 0 and j <= N:
            res += (NCKL[i] * NCKL[j]) % LARGE
print(res % LARGE)

Buggy submission (verdict: Runtime Error):
# B
N, A, B, K = map(int, input().split())

LARGE = 998244353
INVS = [0]*(N+1)
for i in range(1, N+1):
    INVS[i] = pow(i, LARGE-2, LARGE)
NCKL = [1]*(N+1)
for i in range(1, N+1):
    NCKL[i] = (NCKL[i-1] * (N+1-i) * INVS[i]) % LARGE

res = 0
for i in range(N+1):
    if (K - A*i) % B == 0:
        j = (K - A*i) // B
        res += (NCKL[i] * NCKL[j]) % LARGE
print(res % LARGE)