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

Fixed submission:
H, W, K = map(int, input().split())
dp = [[0 for i in range(W)] for j in range(H+1)]
mod = 10**9+7
dp[0][0] = 1

if W == 1:
    print(1)
else:
    for k in range(H):
        for i in range(2**(W-1)):
            b = format(i, "0{}b".format(W-1))
            flag = 1
            for j in range(len(b)-1):
                if b[j+1] == "1" and b[j] == "1":
                    flag = 0
                    break
            if flag == 0:
                continue

            for j in range(len(b)):
                if flag == 0:
                    flag = 1
                    continue
                if b[j] == "1":
                    dp[k+1][j+1] += dp[k][j]
                    dp[k+1][j] += dp[k][j+1]
                    dp[k+1][j+1] %= mod
                    dp[k+1][j] %= mod
                    flag = 0
                else:
                    dp[k+1][j] += dp[k][j]
                    dp[k+1][j] %= mod
            if b[-1] == "0":
                dp[k+1][-1] += dp[k][-1]
                dp[k+1][-1] %= mod
    print(dp[H][K-1])

Buggy submission (verdict: Runtime Error):
H, W, K = map(int, input().split())
dp = [[0 for i in range(W)] for j in range(H+1)]
mod = 10**9+7
dp[0][0] = 1

for k in range(H):
    for i in range(2**(W-1)):
        b = format(i, "0{}b".format(W-1))
        flag = 1
        for j in range(len(b)-1):
            if b[j+1] == "1" and b[j] == "1":
                flag = 0
                break
        if flag == 0:
            continue

        for j in range(len(b)):
            if flag == 0:
                flag = 1
                continue
            if b[j] == "1":
                dp[k+1][j+1] += dp[k][j]
                dp[k+1][j] += dp[k][j+1]
                dp[k+1][j+1] %= mod
                dp[k+1][j] %= mod
                flag = 0
            else:
                dp[k+1][j] += dp[k][j]
                dp[k+1][j] %= mod
                if j == len(b)-1:
                    dp[k+1][j+1] += dp[k][j+1]
                    dp[k+1][j+1] %= mod
                  
print(dp[H][K-1])
Problem p03250 (python)

Fixed submission:
a = list(map(int, input().split()))
a.sort(reverse = True)
print(int(a[0])*10+a[1]+a[2])

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
a.sort(reversed = True)
print(int(a[0])*10+a[1]+a[2])

Buggy submission (verdict: Runtime Error):
a = list(map(int, input().split()))
a.sort(reversed = True)
print(a[0]*10+a[1]+a[2])
Problem p03652 (python)

Fixed submission:
n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
for i in range(n):
    a[i].reverse()

ans = n
used = set()
for i in range(m):
    count = [0]*(m+1)
    for j in range(n):
        count[a[j][-1]] += 1

    ans = min(max(count), ans)
    num = count.index(max(count))
    used.add(num)
    for j in range(n):
        while len(a[j]) > 0:
            if a[j][-1] in used:
                a[j].pop()
            else:
                break

print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
for i in range(n):
    a[i].reverse()

ans = n
used = set()
for i in range(m):
    count = [0]*(m+1)
    for j in range(n):
        count[a[j][-1]] += 1

    ans = min(max(count), ans)
    num = count.index(max(count))
    used.add(num)
    for j in range(n):
        while True:
            if a[j][-1] in used:
                a[j].pop()
            else:
                break

print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [list(map(int, input().split())) for i in range(n)]
for i in range(n):
    a[i].reverse()

ans = n
used = set()
for i in range(m):
    count = [0]*(m+1)
    for j in range(n):
        count[a[j][-1]] += 1

    ans = min(max(count), ans)
    num = count.index(max(count))
    used.add(num)
    for j in range(n):
        if a[j][-1] in num:
            a[j].pop()

print(ans)
Problem p03724 (python)

Fixed submission:
N, M = map(int, input().split())
num = [0] * (N+1)
for i in range(M):
    a, b = map(int, input().split())
    num[a] += 1
    num[b] += 1

flag = 1
for i in num:
    if i % 2 != 0:
        flag = 0

if flag == 1:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
num = [0] * (N+1)
for i in range(M):
    a, b = map(int, input().split())
    num[a] += 1
    num[b] += 1

flag = 1
for i in num:
    if i % 2 != 0:
        flag = 0

if flag = 1:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
num = [0] * (N+1)
for i in range(M):
    a, b = map(int, input().split())
    num[a] += 1
    num[b] += 1

flag = 1
for i in num:
    if num % 2 != 0:
        flag = 0

if flag = 1:
    print("YES")
else:
    print("NO")
Problem p03803 (python)

Fixed submission:
A, B = map(int, input().split())
if A == 1:
    A = 14
if B == 1:
    B = 14
if A > B:
    print("Alice")
elif A < B:
    print("Bob")
else:
    print("Draw")

Buggy submission (verdict: Runtime Error):
def lensetlist(A):
    B = []
    for i in A:
        if i not in B:
            B.append(i)
    return len(B)

N, M = map(int, input().split())
A = []
B = []

for i in range(M):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

used = [0 for i in range(N)]
result = []
stack = []
ans = 0
def path(start, visited):
    if len(visited) == N:
        result.append(visited[:])
        exit
    stack.append(start)
    while len(stack) > 0:
        nextpoint = stack.pop()
        if nextpoint in visited:
            continue
        visited.append(nextpoint)
        for i in range(M):
            if A[i] == start:
                path(B[i], visited)
            if B[i] == start:
                path(A[i], visited)
        visited.pop()

path(1, [])
print(lensetlist(result))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input(),split())
if A == 1:
    A = 14
elif B == 1:
    B = 14
if A > B:
    print("Alice")
elif A < B:
    print("Bob")
else:
    print("Draw")
Problem p03805 (python)

Fixed submission:
N, M = map(int, input().split())
A = [list(map(int, input().split())) for i in range(M)]

result = []
stack = []

def path(start, visited):
    if len(visited) >= N:
        result.append(visited[:])
        exit
    stack.append(start)
    if len(stack) > 0:
        nextpoint = stack.pop()
        if nextpoint not in visited:
            visited.append(nextpoint)
            for i in range(M):
                if A[i][0] == start:
                    path(A[i][1], visited)
                if A[i][1] == start:
                    path(A[i][0], visited)
            visited.pop()

path(1, [])
result = list(map(list, set(map(tuple, result))))
print(len(result))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = []
B = []

for i in xrange(M):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
for i in xrange(M):
    A.append(B[i])
    B.append(A[i])

result = []
stack = []

def path(start, visited):
    if len(visited) >= N:
        if visited not in result:
            result.append(visited[:])
        exit
    stack.append(start)
    if len(stack) > 0:
        nextpoint = stack.pop()
        if nextpoint not in visited:
            visited.append(nextpoint)
            for i in xrange(2*M):
                if A[i] == start:
                    path(B[i], visited)
            visited.pop()

path(1, [])
print(len(result))

Buggy submission (verdict: Runtime Error):
def lensetlist(A):
    B = []
    for i in A:
        if i not in B:
            B.append(i)
    return len(B)

N, M = map(int, input().split())
A = []
B = []

for i in range(M):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)
for i in range(M):
    A.append(B[i])
    B.append(A[i])

result = []
stack = []
ans = 0
count = 0
def path(start, visited):
    count += 1
    if count > 10000:
        break
    if len(visited) == N:
        result.append(visited[:])
        exit
    stack.append(start)
    while len(stack) > 0:
        nextpoint = stack.pop()
        if nextpoint in visited:
            continue
        visited.append(nextpoint)
        for i in range(2*M):
            if A[i] == start:
                path(B[i], visited)
        visited.pop()

path(1, [])
print(lensetlist(result))
Problem p03806 (python)

Fixed submission:
N, Ma, Mb = map(int, input().split())
r = Ma/Mb
a = 0
b = 0
costlist = [500000]
data = [list(map(int, input().split())) for i in range(N)]
for i in range(N):
    a += data[i][0]
    b += data[i][1]


dp = [[[500000 for i in range(N+1)] for i in range(b+10)] for i in range(a+10)]
dp[0][0][0] = 0

#Aがiグラム、Bがjグラム、k番目までの薬を用いたときの最小コスト
for k in range(N):
    for j in range(b):
        for i in range(a):
            ai = data[k][0]
            bj = data[k][1]
            dp[i+ai][j+bj][k+1] = min(dp[i+ai][j+bj][k+1], dp[i][j][k] + data[k][2])
            dp[i][j][k+1] = min(dp[i][j][k], dp[i][j][k+1])

for i in range(1, a):
    for j in range(1, b):
        if i/j == r:
            costlist.append(dp[i][j][N])
if N == 1:
    if data[0][0]/data[0][1] == r:
        print(data[0][2])
    else:
        print(-1)

elif min(costlist) == 500000:
    print(-1)
else:
    print(min(costlist))

Buggy submission (verdict: Runtime Error):
import itertools
import numpy
N, Ma, Mb = map(int, input().split())
r = Ma/Mb
costlist = []
data = [list(map(int, input().split())) for i in range(N)]
for i in range(1, max(N+1, 11)):
    combination = numpy.array(list(itertools.combinations(data, i)))
    for k in range(len(combination)):
        a_tot = 0
        b_tot = 0
        c_tot = 0
        for j in range(len(combination[k])):
            a_tot += combination[k][j][0]
            b_tot += combination[k][j][1]
            c_tot += combination[k][j][2]
        if a_tot/b_tot == r:
            costlist.append(c_tot)
if costlist == []:
    print(-1)
else:
    print(min(costlist))
Problem p02570 (python)

Fixed submission:
d,t,s=map(int,input().split())
if d<=t*s:
  print('Yes')
else:print('No')

Buggy submission (verdict: Runtime Error):
d,t,s=map(int,input().split())
if d<=t*s:
  print(Yes)
else:print(No)
Problem p02685 (python)

Fixed submission:
a,b,K=map(int,input().split())
C=998244353
fac=[0]*a #階乗 fac[i]=i!
finv=[0]*a# i!の逆元
inv=[0]*a
N=a-1
def com_init():
	fac[0],finv[0]=1,1
	if a<2:return
	fac[1],finv[1]=1,1
	inv[1]=1
	for i in range(2,N+1):
		fac[i]=fac[i-1]*i%C
		inv[i]=C-inv[C%i]*(C//i)%C#ある数の逆元
		finv[i]=finv[i-1]*inv[i]%C
def com(m,k):
	if m<k: return 0
	elif m<0 or k<0:return 0
	else:
		return fac[m]*(finv[k]*finv[m-k]%C)%C
com_init()
bfac=[0]*a
bfac[0]=1
for i in range(1,a):
  bfac[i]=bfac[i-1]*(b-1) %C
ans=0

for i in range(K+1):
  ans+= com(a-1,i)*bfac[a-1-i]%C
print(ans*b%C)

Buggy submission (verdict: Runtime Error):
a,b,K=map(int,input().split())
C=998244353
fac=[0]*a #階乗 fac[i]=i!
finv=[0]*a# i!の逆元
inv=[0]*a
N=a-1
def com_init():
	fac[0],fac[1],finv[0],finv[1]=1,1,1,1
	inv[1]=1
	for i in range(2,N+1):
		fac[i]=fac[i-1]*i%C
		inv[i]=C-inv[C%i]*(C//i)%C#ある数の逆元
		finv[i]=finv[i-1]*inv[i]%C
def com(m,k):
	if m<k: return 0
	elif m<0 or k<0:return 0
	else:
		return fac[m]*(finv[k]*finv[m-k]%C)%C
com_init()
bfac=[0]*a
bfac[0]=1
for i in range(1,a):
  bfac[i]=bfac[i-1]*(b-1) %C
ans=0

for i in range(K+1):
  ans+= com(a-1,i)*bfac[a-1-i]%C
print(ans*b%C)
Problem p02835 (python)

Fixed submission:
a,b,c=map(int,input().split())
if a+b+c<=21:
  print('win')
else:
  print('bust')

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input())
if a+b+c<=21:
  print('win')
else:
  print('bust')
Problem p02552 (python)

Fixed submission:
print(int(not int(input())))

Buggy submission (verdict: Runtime Error):
print(int(not int(input()))
Problem p03041 (python)

Fixed submission:
N, K = map(int, input().split())
S = list(input())
s_l = S[K-1].lower()
S[K-1] = s_l
print("".join(S))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = list(input())
s_l = S[K].lower()
S[K] = s_l
print("".join(S))

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

print(S)
s_l = S[K].lower()
S[K] = s_l
print("".join(S))
Problem p02682 (python)

Fixed submission:
N = input()
n =[int(x) for x in N.split()]
A = n[0]
B = n[1]
C = n[2]
K = n[3]
if A>=K:
    print(K)
elif K <= A+B:
    print(A)
else:
    print(2*A+B-K)

Buggy submission (verdict: Runtime Error):
N = input()
n =[int(x) for x in N]
A = n[0]
B = n[1]
C = n[2]
K = n[3]
if A>=K:
    print(K)
elif K <= A+B:
    print(A)
else:
    print(2*A+B-K)
Problem p02753 (python)

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

Buggy submission (verdict: Runtime Error):
import math as mt
K = input().split(" ")
A = int(K[0])
B = int(K[1])
a = float(A*12.5)
t = float((A+1)*12.5)
t1 = mt.ceil(t)
b = B*10
a1 = mt.ceil(a)
A_data = []
B_data = []
for i in range(b,b+10):
    A_data.append(i)
for i in range(a1,a1+t1):
    B_data.append(i)
A_set = set(A_data)
B_set = set(B_data)
AB_set = A_set & B_set
if AB_set:
    P = min(AB_set)
    print(P)
else:
    print(-1)
Problem p02759 (python)

Fixed submission:
a = int(input())
if a%2 == 0:
    b = a/2
else:
    b=(a+1)/2
print(int(b))

Buggy submission (verdict: Runtime Error):
import numpy as np
x = input()
y = input()
z = input()
xa = x.split(" ")
ya = y.split(" ")
za = z.split(" ")
A = np.array([xa,ya,za])
N = int(input())
b =[]
C = np.array([["Nomark", "Nomark", "Nomark"],["Nomark", "Nomark", "Nomark"],["Nomark", "Nomark", "Nomark"]])
for i in range(1,N+1):
    b.append(input())
for m in range(0,3):
    for n in range(0,3):
        if A[m, n] in b:
            C[m,n] = "Maru"
tate = str(np.count_nonzero(C == 'Maru', axis=0))

yoko = str(np.count_nonzero(C == 'Maru', axis=1))

if "3" in tate or "3" in yoko:
    print('Yes')
elif C[0,0] == "Maru" and C[1,1] == "Maru" and C[2,2] == "Maru":
    print("Yes")
elif C[0,2] == "Maru" and C[1,1] == "Maru" and C[2,0] == "Maru":
    print("Yes")
else:
    print("No")
Problem p02552 (python)

Fixed submission:
print(int(not int(input())))

Buggy submission (verdict: Runtime Error):
print(!int(input()))
Problem p02552 (python)

Fixed submission:
x = int(input())
if x == 1:
  print(0)
else :
  print(1)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
print(max([a*b,b*c,a*d,b*d]))
Problem p02622 (python)

Fixed submission:
#172B
def B():
    s = input()
    t = input()
    count = 0
    for i in range(len(s)):
        if s[i] != t[i]:
            count += 1
    print(count)
B()

Buggy submission (verdict: Runtime Error):
def B():
  s = input()
  t = input()
  count=0
  for i in range(len(s)):
    if s[i]!=t[i]:
        count = count+1
print(count)
B()

Buggy submission (verdict: Runtime Error):
def B()
  S = input()
  T = input()
  count=0
  for i in range(len(S)):
    if S[i]!=T[i]:
    count = count+1
print(count)
B()

Buggy submission (verdict: Runtime Error):
#172B
def B()
  S = input()
  T = input()
  count=0
  for i in range(length(S)):
    if S[i]!=T[i]:
    count = count+1
print(count)
B()
Problem p02570 (python)

Fixed submission:
D,T,S=map(int,input().split())
if T*S>=D:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
D,T,S=map(int,input().split())
if T*S>D:
  print(Yes)
else:
  print(No)

Buggy submission (verdict: Runtime Error):
D,T,S=map(int,input().split())
if D<T*S:
  print(Yes)
else:
  print(No)

Buggy submission (verdict: Runtime Error):
D,T,S=map(int,input().split())
if D<S*T
 print(Yes)
else
 print(No)

Buggy submission (verdict: Runtime Error):
D,T,S map(int,input().split())
if D<S*T
 print(Yes)
else
 print(No)
Problem p02577 (python)

Fixed submission:
N=int(input())
if N%9==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
S=str(N)
A=len(S)
M=0
for i in range(N):
  M=M+int(S[i])
if M%9==0:  
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
S=str(N)
A=len(S)
M=0
for i in range(N):
  M=M+int(S[i])
if M%9==0:  
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
M=int(input())
S=str(N)
A=len(S)
int(S[i])
for i in range(A):
　　M=M+S[i]
if M%9==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
S=str(N)
A=len(S)
int(S[i])
for i in range(A):
M=M+S[i] 
if M%9==0:
  print("Yes")
else:
  print("No")
Problem p02659 (python)

Fixed submission:
A,B=input().split()
A=int(A)
B=list(B)
N=B[0]+B[2]+B[3]
N=int(N)
C=int(A*N//100)
print(C)

Buggy submission (verdict: Runtime Error):
A,B=input().split()
B=list(B)
N=B[0]+B[2]+B[3]
N=int(N)
C=int(A*N/100)
print(C)

Buggy submission (verdict: Runtime Error):
A,B=input().split()
B=list(B)
N=B[1]+B[2]+B[3]
N=int(N)
C=int(A*N/100)
print(C)

Buggy submission (verdict: Runtime Error):
A=int(input())
B=float(input())
C=int(A*B)
print=C
Problem p02862 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import math

def mod_factorial(n):
    mod = 10**9+7

    if n < 1:
        return 1

    r = n
    for i in range(n-1):
        r = r*(i+1) % mod
    
    return r

def mod_pow(n,m):

    mod = 10**9+7
    r = 1

    while m > 0:
        if m & 1:
            r = r*n % mod
        n = n * n % mod
        m = m>>1

    return(r)



def mod_comb(n, k):
    mod = 10**9+7

    if n+k < 1:
        return 1
    
    a = mod_factorial(n)
    b = mod_pow(mod_factorial(k), mod-2)
    c = mod_pow(mod_factorial(n-k), mod-2)


    return (a * ((b * c) % mod)) % mod


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

t = [a,b]

r = 0
mod = 10**9+7

x = (2*a-b)
y = (2*b-a)

if x%3 == 0 and y%3 == 0 and x*y >=0:
    m = int(x/3)
    n = int(y/3)

    r += mod_comb(n+m,m)

print(r)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import math

def mod_factorial(n):
    mod = 10**9+7

    if n < 1:
        return 1

    r = n
    for i in range(n-1):
        r = r*(i+1) % mod
    
    return r

def mod_pow(n,m):

    mod = 10**9+7
    r = 1

    while m > 0:
        if m & 1:
            r = r*n % mod
        n = n * n % mod
        m = m>>1

    return(r)



def mod_comb(n, k):
    mod = 10**9+7

    if n+k < 1:
        return 1
    
    a = mod_factorial(n)
    b = mod_pow(mod_factorial(k), mod-2)
    c = mod_pow(mod_factorial(n-k), mod-2)


    return (a * ((b * c) % mod)) % mod


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

t = [a,b]

r = 0
mod = 10**9+7

x = (2*a-b)
y = (2*b-a)

if (x%3 == 0 and y%3 == 0) and (x > 0 and y > 0):
    m = int(x/3)
    n = int((y/3)

    r += mod_comb(n+m,m)

print(r)
Problem p02572 (python)

Fixed submission:
n = int(input(''))
adl = input('')

a = list(map(int,adl.split(' ')))

number = 0

mod = 1000000007

amari = 0

all_a = 0

for i in range(n):
    all_a = all_a + a[i]

for i in range(n):
    all_a = all_a - a[i]
    number = number + (a[i] * all_a)
    number = number % mod
amari = number % mod
print(amari)

Buggy submission (verdict: Runtime Error):
import resource;
import random
# 再帰回数上弦を100000回に設定
sys.setrecursionlimit(100000)
# スタックサイズを無制限に設定
resource.setrlimit(resource.RLIMIT_STACK, (-1, -1))

n = int(input(''))
adl = input('')

a = list(map(int,adl.split(' ')))

number = 0

mod = 7+1000000000

amari = 0

for i in range(n):
    aa = 0
    for e in range(n-i-1):
        j = i+e+1
        if i != j:
            aa = aa + a[j]
    number = number + (a[i] * aa)
amari = number % mod
print(amari)
Problem p03803 (python)

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

for A in range(2):
    if As[A]==1:
        As[A]+=13
        
if As[0]==As[1]:
    print("Draw")
elif As[0]>As[1]:
    print("Alice")
else:
    print("Bob")

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
if A==B:
    print("Draw")
elif (A>B or A:
    print("Alice")
else:
    print("Bob")

Buggy submission (verdict: Runtime Error):
A,B=map(int,input().split())
if A==B:
    print("Draw")
elif or(A>B,A==1):
    print("Alice")
else:
    print("Bob")
Problem p02577 (python)

Fixed submission:
n = input()
t = sum(list(map(int, list(n))))


if int(t / 9) == t / 9:
    print("Yes")
else:
    print("No")

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

if type(n / 9) == int:
  print("Yes")
else:
  print("No")
Problem p02578 (python)

Fixed submission:
from sys import stdin
readline = stdin.readline
n = int(readline())
a = list(map(int, readline().split()))
x = 0
ans = 0
for i in a:
    if x > i:
        ans += (x-i)
    else:
        x = i
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(readline())
a = list(map(int, readline().split()))
max_l = max(a)
ans = 0
for i in range(n):
    if i == 0 and max_l:
        continue
    elif i < max_l:
        ans += 1
    else:
        ans = 0
print(ans)
Problem p02623 (python)

Fixed submission:
def main():
    n, m, k = [int(e) for e in input().split()]
    A = [int(e) for e in input().split()]
    B = [int(e) for e in input().split()]

    AS = [0]
    for i in range(n):
        AS.append(AS[i] + A[i])

    BS = [0]
    for i in range(m):
        BS.append(BS[i] + B[i])

    ans = 0
    bi = 0
    for ai in range(n, -1, -1):
        if bi == m + 1:
            break

        if AS[ai] > k:
            continue

        while bi < m + 1 and AS[ai] + BS[bi] <= k:
            bi += 1

        ans = max(ai + bi - 1, ans)

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m, k = [int(e) for e in input().split()]
    A = [int(e) for e in input().split()]
    B = [int(e) for e in input().split()]

    t = 0
    ca, cb = 0, 0
    for a in A:
        t += a
        if t > k:
            t -= a
            break

        ca += 1

    while True:
        t += B[cb]
        cb += 1

        if t > k:
            cb -= 1
            t -= B[cb]
            break

        if cb == len(B):
            break

    AA = [ca + cb]
    while True:
        if ca == 0 or cb == len(B):
            break

        ca -= 1
        t -= A[ca]
        while True:
            t += B[cb]
            if t > k or cb == len(B):
                break

            cb += 1

        AA.append(ca + cb)

    print(max(AA))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m, k = [int(e) for e in input().split()]
    A = [int(e) for e in input().split()]
    B = [int(e) for e in input().split()]

    t = 0
    ca, cb = 0, 0
    for a in A:
        t += a
        if t > k:
            t -= a
            break

        ca += 1

    while True:
        if t > k:
            cb -= 1
            t -= B[cb]
            break

        if cb == len(B):
            break

        t += B[cb]
        cb += 1

    AA = [ca + cb]
    while True:
        if ca == 0 or cb == len(B):
            break

        ca -= 1
        t -= A[ca]
        while True:
            t += B[cb]
            if t > k or cb == len(B):
                break

            cb += 1

        AA.append(ca + cb)

    print(max(AA))


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

Fixed submission:
def main():
    n = int(input())

    ans = 0
    for i in range(1, n + 1):
        d = n // i
        ans += (i + (i * d)) * d // 2

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math


def main():
    n = int(input())

    A = [2] * (n + 1)
    
    ans = 1
    for i in range(2, n + 1):
        d = math.isqrt(i)
        A[i] = d + 1
        ans += i * (A[d] + 1)

    print(ans)


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

Fixed submission:
def main():
    n = int(input())

    ans = n//2 + n%2
    print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n, m = [int(e) for e in input().split()]
    S, C = zip(*[[int(e) for e in input().split()] for i in range(m)])

    ans = 0
    D = {}
    for si, ci in zip(S, C):
        if D.get(si) == ci:
            continue

        if D.get(si) is not None:
            print(-1)
            exit()

        ans += 10**(n - si) * ci
        D[si] = ci

    if len(str(ans)) != n:
        print(-1)
        exit()

    print(ans)

if __name__ == "__main__":
    main()