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

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

import heapq


class MaxHeap:
    def __init__(self, li):
        self.heap = [-e for e in li]
        heapq.heapify(self.heap)

    def push(self, val):
        heapq.heappush(self.heap, -val)

    def pop(self):
        return -heapq.heappop(self.heap)

    def __len__(self):
        return len(self.heap)


n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

ab.sort()

h = MaxHeap([])

i = 0
ans = 0
for day in range(1, m + 1):
    while i < n and ab[i][0] <= day:
        h.push(ab[i][1])
        i += 1
    if len(h) == 0:
        continue
    ans += h.pop()

print(ans)

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

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]

ab.sort(reverse=True)
ab.sort(key=lambda x: x[1], reverse=True)

days_left = [1] * (m + 2)
ans = 0
for a, b in ab:
    i = a
    while days_left[i] == 0:
        i += 1
    if i == m + 1:
        continue
    days_left[i] = 0
    ans += b

print(ans)

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

def my_sort(word):
    sorted_word_list = sorted(word)
    sorted_word = ""
    for letter in sorted_word_list:
        sorted_word += letter
    return sorted_word

n = int(input())
words = {}
for i in range(n):
    word = my_sort(input())
    if word in words.keys():
        words[word] += 1
    else:
        words[word] = 0

print(sum(words.values()))
Problem p02951 (python)

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

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

print(max(c-a+b, 0))

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

n = input()

N = 10

child_data = [[1]*len(n)]
for j in range(1, len(n)+1):
    child_fin = [0]*len(n)
    for i in range(len(n)):
        if n[i] == "L":
            child_fin[i-1] += child_data[j-1][i]
        else:
            child_fin[i+1] += child_data[j-1][i]
    child_data.append(child_fin)
    if child_fin in child_data[:-1]:
        child_last = child_data[-(j%2+1)]
        break

output = " ".join(map(str, child_last))
print(output)
Problem p02959 (python)

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

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

killed = 0

for i in range(n):
    if b[i] <= a[i]:
        killed += b[i]
        continue
    else:
        b[i] -=	a[i]
        killed += a[i] + min(a[i+1], b[i])
        a[i+1] = max(0, a[i+1]-b[i])

print(killed)

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

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

killed = 0

for i in range(n):
    if b[i] <= a[i]:
        killed += b[i]
        continue
    else:
        b[i] -=	a[i]
        killed += a[i] + min(a[i+1], b[i])
	a[i+1] = max(0, a[i+1]-b[i])

print(killed)
Problem p02990 (python)

Fixed submission:
def main():
    n, k = map(int, input().split())

    mod = 10 ** 9 + 7
    fact = [1]
    for i in range(1, 2001):
        fact.append(fact[-1] * i)

    def comb(l, r):
        return fact[l] // fact[r] // fact[l - r]

    for i in range(1, k + 1):
        print((comb(n - k + 1, i) * comb(k - 1, i - 1)) % mod)


if __name__ == "__main__":
    main()

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

    mod = 10 ** 9 + 7
    fact = [1]
    for i in range(1, 2000):
        fact.append(fact[-1] * i)

    def comb(l, r):
        return fact[l] // fact[r] // fact[l - r]

    for i in range(1, k + 1):
        print((comb(n - k + 1, i) * comb(k - 1, i - 1)) % mod)


if __name__ == "__main__":
    main()

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

n, k = map(int, input().split())

for i in range(1, k+1):
    if n-k+1 < i:
        print(0)
    else:
        print(int((comb(n-k+1, i, exact=True) * comb(k-1, i-1, exact=True)) % (10**9 + 7)))

Buggy submission (verdict: Runtime Error):
import sys

n, k = map(int, input().split())

sys.setrecursionlimit(n+1)

def f(x):
    if x == 0:
        return 1
    else:
        return f(x-1) * x

for i in range(1, k+1):
    if n-k+1 < i:
        print(0)
        continue
    print(int((f(n-k+1)/(f(i)*f(n-k+1-i)) * f(k-1)/(f(i-1)*f(k-i))) % (10**9 + 7)))
Problem p03013 (python)

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

ways = [1, 1]
for i in range(2, n + 1):
    ways.append(ways[i-2] + ways[i-1])

stairs = []
now = 0
for i in range(m):
    stairs.append(a[i] - 1 - now)
    now = a[i] + 1

stairs.append(n - now)

ans = 1
for ele in stairs:
    if ele == -1:
        ans *= 0
    else:
        ans *= ways[ele]

mod = 10 ** 9 + 7
print(ans % mod)

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

def f(x):
    if x == 1 or x == 0:
        return 1
    else:
        return f(x-1) + f(x-2)

def sol(a):
    for i in range(m - 1):
        if a[i+1] - a[i] == 1:
            print(0)
            return
    mod = 10 ** 9 + 7
    stairs = []
    now = 0
    for i in range(m):
        stairs.append(a[i] - 1 - now)
        now = a[i] + 1
    stairs.append(n - now)

    ans = 1
    for ele in stairs:
        ans *= f(ele)

    print(ans % mod)


sol(a)

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

mod = 10 ** 9 + 7
stairs = [0, 1]
for i in range(2, n+1):
    stairs.append((stairs[i-1] + stairs[i-2]) % mod)

count = 1
for i in range(m+1):
    diff = a[i+1] - a[i] - 1
    count *= stairs[diff]
print(count % mod)

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

stairs = [0, 1]
for i in range(2, n+1):
    stairs.append(stairs[i-1] + stairs[i-2])

mod = 10 ** 9 + 7
count = 1
for i in range(m+1):
    diff = a[i+1] - a[i] - 1
    count *= stairs[diff]
print(count % mod)

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

stairs = [0, 1, 1]
for i in range(3, n+1):
    stairs.append(stairs[i-1] + stairs[i-2])

mod = 10 ** 9 + 7
count = 1
for i in range(m+1):
    diff = a[i+1] - a[i] - 1
    count *= stairs[diff]
print(count % mod)

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

stairs = [0, 1, 1]
for i in range(3, n+1):
    stairs.append(stairs[i-1] + stairs[i-2])

def ans():
    mod = 10 ** 9 + 7
    count = 1
    for i in range(m+1):
        diff = a[i+1] - a[i] - 1
        if diff == 0:
            print("0")
            return
        else:
            count *= stairs[diff]
    print(count % mod)
    return

ans()

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

def f(stairs):
    if stairs == 1 or stairs == 2:
        return 1
    else:
        return f(stairs-1) + f(stairs-2)

def ans():
    mod = 10 ** 9 + 7
    count = 1
    for i in range(m+1):
        diff = a[i+1] - a[i] - 1
        if diff == 0:
            print("0")
            return
        else:
            count *= f(diff)
    print(count % mod)
    return

ans()
Problem p03127 (python)

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

def gcd(a, b):
    big, small = max(a, b), min(a,b)
    if big % small == 0:
        return small
    return gcd(small, big%small)


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

ans = a[0]
for a_val in a:
    ans = gcd(ans, a_val)

print(ans)

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

import math

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

ans = a[0]
for a_val in a:
    ans = math.gcd(ans, a_val)

print(ans)
Problem p03209 (python)

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

N, X = map(int, input().split())

a, p = [1], [1]

for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)


def f(N, X):
    if N == 0:
        return 0 if X <= 0 else 1
    elif X <= 1 + a[N-1]:
        return f(N-1, X-1)
    else:
        return p[N-1] + 1 + f(N-1, X-2-a[N-1])


print(f(N, X))

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

N, X = map(int, input().split())

a, p = [1], [1]

for i in range(N):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)


def f(N, X):
    if N == 0:
	return 0 if X <= 0 else	1
    elif X <= 1	+ a[N-1]:
        return f(N-1, X-1)
    else:
        return p[N-1] +	1 + f(N-1, X-2-a[N-1])


print(f(N, X))
Problem p03253 (python)

Fixed submission:
from math import sqrt
from scipy.misc import comb

n, m = map(int, input().split())
mod = 10 ** 9 + 7


def sieve(x):
    primes = []
    li = list(range(2, x + 1))

    while li[0] <= sqrt(x):
        p = li[0]
        primes.append(p)
        li = [e for e in li if e % p != 0]

    primes += li
    return primes


def prime_fact(x):
    primes = sieve(int(sqrt(x)) + 1)
    d = {}

    for p in primes:
        cnt = 0
        while x % p == 0:
            x //= p
            cnt += 1

        if cnt:
            d[p] = cnt

    if x != 1:
        d[x] = 1

    return d


pf = prime_fact(m)
ans = 1
for v in pf.values():
    ans *= comb(v + n - 1, v, exact=True)
    ans %= mod

print(ans)

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

n, m = map(int, input().split())
mod = 10 ** 9 + 7


def sieve(x):
    primes = []
    li = list(range(2, x + 1))

    while li[0] <= sqrt(x):
        p = li[0]
        primes.append(p)
        li = [e for e in li if e % p != 0]

    primes += li
    return primes


def prime_fact(x):
    primes = sieve(int(sqrt(x)) + 1)
    d = {}

    for p in primes:
        cnt = 0
        while x % p == 0:
            x //= p
            cnt += 1

        if cnt:
            d[p] = cnt

    if x != 1:
        d[x] = 1

    return d


pf = prime_fact(m)
ans = 1
for v in pf.values():
    ans *= comb(v + n - 1, v, exact=True)
    ans %= mod

print(ans)
Problem p02659 (python)

Fixed submission:
from decimal import*
a,b=input().split()
da=Decimal(a)
db=Decimal(b)
print(da*db//1)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=float(input())
b=b*100
p=int((a*b)/100)
print(p)
Problem p02725 (python)

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


l_s = []
check = 0
for i in range(0,N):
    if(A[i] == 0):
        check =1
if(check == 1):
    for i in range(1,N):
          l_s.append(A[i]-A[i-1])
    l_s.append(K-A[N-1])
    num = 0
    ans = 99999999999999999
    for i in range(0,N):
        num = K - l_s[i]
        ans = min(ans,num)
    print(ans)
    
else: 
    for i in range(1,N):
        l_s.append(A[i]-A[i-1])
    l_s.append(K-A[N-1]+A[0])
    m1 = max(l_s)
    ans = K-m1
    print(ans)

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


l_s = []
check = 0
for i in range(0,N):
    if(A[i] == 0):
        check =1
if(check == 1):
    for i in range(1,N+1):
          l_s.append(A[i]-A[i-1])
  
    print(l_s)
    num = 0
    ans = 99999999999999999
    for i in range(0,N):
        num = K - l_s[i]
        ans = min(ans,num)
    print(ans)
    
else: 
    #A.append(K-A[len(A)-1])
    m1 = 0
    m2 = 0
    m1 = max(A)
    m2 = min(A)
    ans = m1 -m2
    print(ans)
Problem p02729 (python)

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

ansA = 0

if N < 2 and M < 2:
    ansA = 0
if N >=2:
    ansA += ((N * (N-1)) / 2)
if M >= 2:
    ansA += ((M * (M-1)) / 2)

print(int(ansA))

Buggy submission (verdict: Runtime Error):
import math

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

N,M = map(int, input().split())

if(N == 1 and M == 1):
	ans = 0
elif(N != 0 and M != 0): 
	ans = combinations_count(N, 2)
	ans += combinations_count(M, 2)
elif(N == 1 and M != 1):
  ans = combinations_count(M, 2)
elif(N != 1 and M == 1):
  ans = combinations_count(N, 2)
elif(N == 1 and M ==1 ):
  ans = 0
elif(N == 0 and M != 0):
  ans = combinations_count(M, 2)
elif(N != 0 and M == 0):
  ans = combinations_count(N, 2)
  
print(ans)
Problem p02785 (python)

Fixed submission:
N,K = map(int, input().split())
l = list(map(int,input().split()))
l.sort()
i  = 0

if(K >= N):
  ans = 0
else:
  while(i<K):
    l[N-i-1] = 0
    i += 1
  ans = sum(l)
print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
l = list(map(int,input().split()))
l.sort()
i  = 0
while(i<K):
	l[N-i-1] = 0
	i += 1
ans = sum(l)
print(ans)
Problem p02831 (python)

Fixed submission:
import math
import fractions
def lem(x,y):
	return (x * y) // fractions.gcd(x,y)

A,B = map(int, input().split())
print(lem(A,B))

Buggy submission (verdict: Runtime Error):
import math
def lem(x,y):
	return (x * y) // math.gcd(x,y)

A,B = map(int, input().split())
print(lem(A,B))

Buggy submission (verdict: Runtime Error):
import math
def lem(x,y):
	return (x * y) // math.gcd(x,y)

A,B = map(int, input().split())
print(lem(A,B))
Problem p02546 (python)

Fixed submission:
s = input()
if s[-1]=='s':
    print(s+'es')
else:
    print(s+'s')

Buggy submission (verdict: Runtime Error):
s = input()
if s[-1]=='s':
  print(s+'es')
  else:
    print(s+'s')
Problem p02623 (python)

Fixed submission:
import bisect

n,m,k = map(int,input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

A_sum = [0]*(n+1)
B_sum = [0]*(m+1)

for i in range(n):
    A_sum[i+1] = A_sum[i] + A[i]

for i in range(m):
    B_sum[i+1] = B_sum[i] + B[i]

A_limit = bisect.bisect_right(A_sum,k) - 1
mc = 0
B_i = 0
for i in range(A_limit,-1,-1):
    remain_k = k - A_sum[i]
    while((remain_k-B_sum[B_i])>=0):
        B_i += 1
        if(B_i==(m+1)):
            break
    B_i -= 1
    mc = max(mc,(i+B_i))

print(mc)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
import sys
sys.setrecursionlimit(10**5)
maxc = 0
a_i=0
b_i=0
def dfs(a_i,b_i,t,cnt):
    global maxc
    
    if(a_i==n and b_i==m):
        maxc = m+n
        return
    
    if(a_i < n and (A[a_i]+t)<=k):
        dfs(a_i+1,b_i,A[a_i]+t,cnt+1)
    else:
        maxc = max(cnt,maxc)
    if(b_i < m and (B[b_i]+t)<=k):
        dfs(a_i,b_i+1,B[b_i]+t,cnt+1)
    else:
        maxc = max(cnt,maxc)


        
dfs(0,0,0,0)
print(maxc)

Buggy submission (verdict: Runtime Error):
n,m,k = map(int,input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
lA = len(A)
lB = len(B)
a_i=0
b_i=0
cnt = 0
t = 0
while(k > t):
    if(lA==a_i and lB==b_i):
        break
    if(lA==a_i):
        t += B[b_i]
        b_i += 1
        cnt += 1
        continue
    elif(lB==a_i):
        t += A[a_i]
        a_i += 1
        cnt += 1
        continue
    else:
        if(A[a_i] > B[b_i]):
            now = B[b_i]
            b_i += 1
        else:
            now = A[a_i]
            a_i += 1
        t += now
        cnt += 1

if(t > k):
    cnt -= 1
print(cnt)
Problem p02624 (python)

Fixed submission:
from numba import njit
@njit("i8(i8)")

def f(n):

    
    l = [1]*(n+1)
    l[0] = 0
    ans = l[1]
    for i in range(2,n+1):
        for j in range(i,n+1,i):
            l[j] += 1

        ans += (l[i]*i)
    return ans

n = int(input())
print(f(n))

Buggy submission (verdict: Runtime Error):


n = int(input())
l = [1]*(n+1)
l[0] = 0
ans = l[1]

for i in range(2,n+1):
    for j in range(i,n+1,i):
        l[j] += 1

    ans += (l[i]*i)
return ans



print(ans)
Problem p03805 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10000)
n,m = map(int,input().split())
rel = [[False for i in range(n+1)] for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    rel[a][b] = True
    rel[b][a] = True

ans=0
def rec(l):
    global ans
    if(len(l)==n):
        ans+=1
    x = l[-1]
    for i in range(1,n+1):
        if(i in l):
            continue
        if(rel[x][i]):
            rec(l+[i])

rec([1])
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import permutations
n,m = map(int,input().split())
#rel = [list(map(int,input().split())) for i in range(n)]
rel_t = [[False for i in range(n)] for j in range(n)]

for i in range(n):
    a,b = map(int,input().split())
    rel_t[a-1][b-1]=True
    rel_t[b-1][a-1]=True

cnt=0
n_list = [i for i in range(n)]
for l in permutations(n_list,len(n_list)):
    if(l[0]!=1):
        continue
    judge=[rel_t[l[i]][l[i+1]] for i in range(n-1)]
    if all(judge):
        cnt+=1

print(cnt)
Problem p02572 (python)

Fixed submission:
mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
dp = [0]

def calc(A, n, dp):
    dp += [A[0] * A[1]]
    rsum = A[0] + A[1]
    for i in range(2, n):
        dp += [dp[-1] + rsum * A[i]]
        rsum += A[i]

    i = dp.index(max(dp))
    rsum = 0
    for j in range(i + 1):
        rsum += A[j]
    res = max(dp)
    dp2 = max(dp)
    for j in range(0, i):
        rsum -= A[j]
        dp2 -= A[j] * rsum
        res = max(dp2, res)
    return res

ans = calc(a, n, dp) % mod
print(ans)

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

mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
ans = np.triu(np.outer(a, a), k=1).sum()

print(ans % mod)
Problem p02707 (python)

Fixed submission:
from collections import Counter
n =int(input())
a = list(map(int, input().split()))
s = Counter(a)
ans = [0] * n
for k, v in s.items():
    ans[k - 1] = v
for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):
from collections import Counter
n =int(input())
a = list(map(int, input().split()))
s = Counter(a)
for v in s.values():
    print(v)
for i in range(n - len(ans)):
    print(0)
Problem p02831 (python)

Fixed submission:
import fractions
a, b = map(int, input().split())
print((a * b) // fractions.gcd(a, b))

Buggy submission (verdict: Runtime Error):
import math
a, b = map(int, input().split())
print((a * b) // math.gcd(a, b))
Problem p02835 (python)

Fixed submission:
arr = list(map(int, input().split()))
ans = 'bust' if sum(arr) >= 22 else 'win'
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import combinations
n = int(input())
arr = list(map(int, input().split()))
ans = 0
arr = list(combinations(arr, 2))
for i, j in arr:
    ans += i ^ j
print(ans % (10 ** 9 + 7))

Buggy submission (verdict: Runtime Error):
from itertools import combinations
n = int(input())
ans = 0
for i, j in list(combinations(list(map(int, input().split())), 2)):
    ans += i ^ j
print(ans % (10 ** 9 + 7))
Problem p03127 (python)

Fixed submission:
from functools import reduce
n = int(input())
arr = list(map(int, input().split()))
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def gcd_list(numbers):
    return reduce(gcd, numbers)

ans = gcd_list(arr)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
n = int(input())
arr = list(map(int, input().split()))

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

ans = gcd_list(arr)
print(ans)

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

n = int(input())
arr = list(map(int, input().split()))
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

print(gcd_list(arr))
Problem p03631 (python)

Fixed submission:
n = input()
ans = 'Yes' if n == n[::-1] else 'No'
print(ans)

Buggy submission (verdict: Runtime Error):
n = input()
ans = 'Yes' if n == [::-1] else 'No'
print(ans)
Problem p02577 (python)

Fixed submission:
s = str(input())

array = list(map(int,s))
if(sum(array)%9==0):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N=int(input())
s=0
dig=0
while(N):
  dig = int(N)%10
  s = s + dig
  N = int(N)/10
  
if(s%9==0):
  print("Yes")
else:
  print("No")
Problem p02577 (python)

Fixed submission:
def digsum(n):
  if(n==0):
    return 0
  if(n%9==0):
    return 9
  else:
  	return n%9
n=int(input())
d=digsum(n)
if(d==9 or d==0):
  print("Yes")
else:
  print("No");

Buggy submission (verdict: Runtime Error):
digsum(n):
  if(n==0):
    return 0
  if(n%9==0):
    return 9
  else:
  	return n%9
n=int(input())
d=digsum(n)
if(d==9 or d==0):
  print("Yes")
else:
  print("No");
Problem p02785 (python)

Fixed submission:
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
j=n-1
s=0
for i in range(k):
    a[j]=0
    j=j-1
    if(j<0):
        break
for i in range(n):
    s=s+a[i]
print(s)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
j=n-1
s=0
for i in range(k):
    a[j]=0
    j=j-1
for i in range(n):
    s=s+a[i]
print(s)
Problem p02594 (python)

Fixed submission:
n = int(input())
if n >= 30:
  l = 'Yes'
else:
  l = 'No'
print(l)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n >= 30:
  l = 'Yes'
 else:
  l = 'No'
 print(l)
Problem p02571 (python)

Fixed submission:
s = input()
t = input()
lt = len(t)
ls = len(s)
A = []
for i in range(ls-lt+1):
    cou = 0
    for j in range(lt):
        if s[i+j] == t[j]:
            cou += 1
    A.append(cou)
print(lt-max(A))

Buggy submission (verdict: Runtime Error):
s = input()
t = input()
lt = len(t)
ls = len(s)
A = []
for i in range(ls-lt):
    cou = 0
    for j in range(lt):
        if s[i+j] != t[j]:
            cou += 1
    A.append(cou)
print(min(A))
Problem p02623 (python)

Fixed submission:
n, m, k = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]

for i in range(n):
    a.append(A[i]+a[i])
for i in range(m):
    b.append(B[i]+b[i])

ans, j = 0, m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans, i+j)
print(ans)

Buggy submission (verdict: Runtime Error):
n, m, k = map(int, input().split())
alst = list(map(int, input().split()))
blst = list(map(int, input().split()))
alst.append(2*10**9)
blst.append(2*10**9)
ptime = 0
acou = 0
bcou = 0
books = 0
while True:
    if alst[acou] < blst[bcou]:
        ptime += alst[acou]
        acou += 1
    elif alst[acou] > blst[bcou]:
        ptime += blst[bcou]
        bcou += 1
    else:
        if alst[acou+1] < blst[bcou+1]:
            ptime += alst[acou]
            acou += 1
        elif alst[acou+1] > blst[bcou+1]:
            ptime += blst[bcou]
            bcou += 1
    if ptime <= k:
        books += 1
    elif acou==len(alst)-1 and bcou==len(blst)-1:
        books += 1
        break
    else:
        break
print(books)