Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
def main():
    A, B = [int(x) for x in input().split()]
    count = 1
    B -= A
    while B > 0:
        B -= (A - 1)
        count += 1
    print (count)

if __name__ == "__main__":
    main()


Fixed submission:
def main():
    A, B = [int(x) for x in input().split()]
    if B == 1:
        print(0)
        return
    count = 1
    B -= A
    while B > 0:
        B -= (A - 1)
        count += 1
    print (count)

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

Fixed submission:
a, b = map(int, input().split())
if a * b % 2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())
time_list = [map(int, input().split()) for _ in range(n)]
m = int(input())
problem_list = [map(int, input().split()) for _ in range(m)]
for i in problem_list:
  time_list[i[0]-1] = i[1]
  print(sum(time_list))

Fixed submission:
n = int(input())
time_list = list(map(int, input().split()))
m = int(input())
problem_list = list(list(map(int, input().split())) for _ in range(m))
for i in problem_list:
  print(sum(time_list) - time_list[i[0]-1] + i[1])
Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int, input().split())
print(len([v for v in range(a, b+1) if v % x == 0]))

Fixed submission:
import sys
input = sys.stdin.readline
a, b, x = map(int, input().split())
print(b//x - (a-1)//x)

Buggy python submission (verdict: Time Limit Exceeded):
a, b, x = map(int, input().split())
print(len([v for v in range(a, b+1) if v % x == 0]))

Fixed submission:
import sys
input = sys.stdin.readline
a, b, x = map(int, input().split())
print(b//x - (a-1)//x)
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
print(len(set(a, b, c)))

Fixed submission:
a, b, c = map(int, input().split())
print(len(set([a, b, c])))
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
d=0
if (a==b):
    d+=1
if (b==c):
    d+=1
if (c==a):
    d+=1
if (d==1):
    print('Yes')
else:
    print('No')


Fixed submission:
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=0
if (a==b):
    d+=1
if (b==c):
    d+=1
if (c==a):
    d+=1
if (d==1):
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
target = int(input())
ans = 0
waru = 2
while target >= waru:
  if target % waru == 0:
    for i in range(2, waru + 1):
      if waru % i == 0:
        waruwaru = i
        break
    waru_copy = waru
    while waru_copy != 1:
      if waru_copy % waruwaru == 0:
        waru_copy /= waruwaru
      else:
        break
    else:
      target /= waru
      ans += 1
  waru += 1
print(ans)


Fixed submission:
target = int(input())
num = target
waru = 2
exp = []
while waru ** 2 <= target and num > 1:
    rep = 0
    while num % waru == 0:
        num /= waru
        rep += 1
    waru += 1
    if rep > 0:
        exp.append(rep)
if num > 1:
    exp.append(1)
ans = 0
for item in exp:
    hiku = 1
    while item - hiku >= 0:
        item -= hiku
        ans += 1
        hiku += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
target = int(input())
ans = 0
waru = 2
while target >= waru:
  if target % waru == 0:
    for i in range(2, waru + 1):
      if waru % i == 0:
        waruwaru = i
        break
    waru_copy = waru
    while waru_copy != 1:
      if waru_copy % waruwaru == 0:
        waru_copy /= waruwaru
      else:
        break
    else:
      target /= waru
      ans += 1
  waru += 1
print(ans)

Fixed submission:
target = int(input())
num = target
waru = 2
exp = []
while waru ** 2 <= target and num > 1:
    rep = 0
    while num % waru == 0:
        num /= waru
        rep += 1
    waru += 1
    if rep > 0:
        exp.append(rep)
if num > 1:
    exp.append(1)
ans = 0
for item in exp:
    hiku = 1
    while item - hiku >= 0:
        item -= hiku
        ans += 1
        hiku += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
steps, limit = map(int, input().split())
heights = [int(height) for height in input().split()]
costs = [0] * steps
def search(step, num):
    least = float("inf")
    for i in range(1,num+1):
        how_many = costs[step-i] + abs(heights[step-i] - heights[step])
        if how_many < least:
            least = how_many
    costs[step] = least
for i in range(1,steps):
    if i < limit:
        search(i, i)
    else:
        search(i, limit)
print(costs[steps-1])

Fixed submission:
import numpy as np
steps, limit = map(int, input().split())
heights = [int(height) for height in input().split()]
heights = np.array(heights, np.int)
costs = np.array([0] * steps, np.int)
def search(step, num):
    costs[step] = min(costs[step-num:step] + abs(heights[step-num:step] - heights[step]))
for i in range(1,steps):
    if i < limit:
        search(i, i)
    else:
        search(i, limit)
print(costs[steps-1])

Buggy python submission (verdict: Time Limit Exceeded):
steps, limit = map(int, input().split())
heights = [int(height) for height in input().split()]
costs = [0] * steps
def search(step, num):
    candidates = []
    for i in range(1,num+1):
        how_many = costs[step-i] + abs(heights[step-i] - heights[step])
        candidates.append(how_many)
    costs[step] = min(candidates)
for i in range(1,steps):
    if i < limit:
        search(i, i)
    else:
        search(i, limit)
print(costs[steps-1])

Fixed submission:
import numpy as np
steps, limit = map(int, input().split())
heights = [int(height) for height in input().split()]
heights = np.array(heights, np.int)
costs = np.array([0] * steps, np.int)
def search(step, num):
    costs[step] = min(costs[step-num:step] + abs(heights[step-num:step] - heights[step]))
for i in range(1,steps):
    if i < limit:
        search(i, i)
    else:
        search(i, limit)
print(costs[steps-1])
Buggy python submission (verdict: Runtime Error):
import numpy as np
n,w = map(int, input().split())
high = np.array([[0]*(w+1)]*(n+1),np.int)
for i in range(1,n+1):
    weight, value = map(int, input().split())
    for j in range(w+1):
        if j < weight:
            high[i][j] = high[i-1][j]
        else:
            high[i][j] = max([high[i-1][j-weight]+value, high[i-1][j]])
print(high[n][w])

Fixed submission:
n,w = map(int, input().split())
high = [0] * (w + 1)
for i in range(n):
    weight, value = map(int, input().split())
    if weight <= w:
        renewal = high[:weight]
        renewal += [max([j+value, k]) for j,k in zip(high[:w-weight+1], high[weight:])]
        high = renewal
print(high[w])

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n,w = map(int, input().split())
high = np.array([[0]*(w+1)]*(n+1),np.int)
for i in range(1,n+1):
    weight, value = map(int, input().split())
    for j in range(w+1):
        if j < weight:
            high[i][j] = high[i-1][j]
        else:
            high[i][j] = max([high[i-1][j-weight]+value, high[i-1][j]])
print(high[n][w])

Fixed submission:
n,w = map(int, input().split())
high = [0] * (w + 1)
for i in range(n):
    weight, value = map(int, input().split())
    if weight <= w:
        renewal = high[:weight]
        renewal += [max([j+value, k]) for j,k in zip(high[:w-weight+1], high[weight:])]
        high = renewal
print(high[w])

Buggy python submission (verdict: Time Limit Exceeded):
n, w = map(int, input().split())
highests = []
for i in range(n+1):
    highests.append([0]*(w+1))
for i in range(1,n+1):
    weight, value = map(int, input().split())
    for j in range(w+1):
        if j < weight:
            highests[i][j] = highests[i-1][j]
        else:
            highests[i][j] = max([highests[i-1][j-weight] + value, highests[i-1][j]])
print(highests[n][w])

Fixed submission:
n,w = map(int, input().split())
high = [0] * (w + 1)
for i in range(n):
    weight, value = map(int, input().split())
    if weight <= w:
        renewal = high[:weight]
        renewal += [max([j+value, k]) for j,k in zip(high[:w-weight+1], high[weight:])]
        high = renewal
print(high[w])
Buggy python submission (verdict: Runtime Error):
import math
A,B=input().split()
ans=int(A)*int(math.ceil(B))
print(math.floor(ans))

Fixed submission:
import math
A,B=input().split()
A=int(A)
B=int(float(B)*1000)
ans=A*B
ans=str(ans)
if len(ans) < 4:
    print(0)
else:
    print(ans[:-3])

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(x) for x in input().split()]
ans=1
for i in range(N):
    ans=ans*A[]
    if ans>10**18:
        print(-1)
        exit
    elif ans==0:
        print(0)
        exit
print(ans)

Fixed submission:
import math
A,B=input().split()
A=int(A)
B=int(float(B)*1000)
ans=A*B
ans=str(ans)
if len(ans) < 4:
    print(0)
else:
    print(ans[:-3])
Buggy python submission (verdict: Time Limit Exceeded):
import math
K=int(input())
k=K+1
ans=0
for a in range(1,k):
    for b in range(1,k):
        for c in range(1,k):
            m=math.gcd(a,b)
            n=math.gcd(m,c)
            ans+=n

print(ans)

Fixed submission:
import math
K=int(input())
k=K+1
ans=0
for a in range(1,k):
    for b in range(a,k):
        for c in range(b,k):
            m=math.gcd(a,b)
            o=math.gcd(m,c)
            if a==b and b==c:
                n=o
            elif a==b or b==c:
                n=o*3
            else:
                n=o*6
                
            ans+=n

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import math
K=int(input())
ans=0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            m=math.gcd(a,b)
            n=math.gcd(m,c)
            ans=ans+n

print(ans)

Fixed submission:
import math
K=int(input())
k=K+1
ans=0
for a in range(1,k):
    for b in range(a,k):
        for c in range(b,k):
            m=math.gcd(a,b)
            o=math.gcd(m,c)
            if a==b and b==c:
                n=o
            elif a==b or b==c:
                n=o*3
            else:
                n=o*6
                
            ans+=n

print(ans)

Buggy python submission (verdict: Runtime Error):
K=int(input())
ans=0
for a in range(1,K):
    for b in range(1,K):
        for c in range(1,K):
            n=math.gcd(a,b,c)
            ans=ans+n

print(ans)

Fixed submission:
import math
K=int(input())
k=K+1
ans=0
for a in range(1,k):
    for b in range(a,k):
        for c in range(b,k):
            m=math.gcd(a,b)
            o=math.gcd(m,c)
            if a==b and b==c:
                n=o
            elif a==b or b==c:
                n=o*3
            else:
                n=o*6
                
            ans+=n

print(ans)

Buggy python submission (verdict: Runtime Error):
import math
K=int(input())
ans=0
for a in range(1,K):
    for b in range(1,K):
        for c in range(1,K):
            n=math.gcd(a,b,c)
            ans=ans+n

print(ans)

Fixed submission:
import math
K=int(input())
k=K+1
ans=0
for a in range(1,k):
    for b in range(a,k):
        for c in range(b,k):
            m=math.gcd(a,b)
            o=math.gcd(m,c)
            if a==b and b==c:
                n=o
            elif a==b or b==c:
                n=o*3
            else:
                n=o*6
                
            ans+=n

print(ans)
Buggy python submission (verdict: Runtime Error):
A,B,C,K=list(map(int,input().split()))
if A>=K:
    print(A)
elif A<K and (A+B)>=K:
    print(A)
elif A<K and (A+B)<K:
    t=A-(K-A-B)
    if t<=0:
        print("0")
    else:
        print(m)

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

if a <= k:
    count += a
else:
    count += k
    print(count)
    exit()
k -= a

if b <= k:
    k -= b
else:
    print(count)
    exit()


count -= k

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import math

x = int(input())
m = 100
count = 1

while True:
    depo = math.floor(m*1.01)
    if depo >= x:
        print(count)
        break
    count += 1

Fixed submission:
import math

x = int(input())
depo = 100
count = 1

while True:
    depo = math.floor(depo*1.01)
    if depo >= x:
        print(count)
        break
    count += 1
Buggy python submission (verdict: Time Limit Exceeded):
import math
A,B,N=map(int,input().split())
start=0
for i in range(1,N+1):
    K=math.floor(((i/B)-(i//B))*A)
    if start<=K:
        start=K
print(start)

Fixed submission:
import math
A,B,N=map(int,input().split())
start=0
i=min(B-1,N)
K=math.floor((A*i)/B)-A*(math.floor(i/B))
if start<=K:
    start=K
print(start)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,N=map(int,input().split())
start=0
for i in range(1,N+1):
    K=((A*i)//B)-A*(i//B)
    if start<=K:
        start=K
print(start)

Fixed submission:
import math
A,B,N=map(int,input().split())
start=0
i=min(B-1,N)
K=math.floor((A*i)/B)-A*(math.floor(i/B))
if start<=K:
    start=K
print(start)

Buggy python submission (verdict: Time Limit Exceeded):
import math
A,B,N=map(int,input().split())
start=0
for i in range(1,N+1):
    K=math.floor((A*i)/B)-A*(math.floor(i/B))
    if start<=K:
        start=K
print(start)

Fixed submission:
import math
A,B,N=map(int,input().split())
start=0
i=min(B-1,N)
K=math.floor((A*i)/B)-A*(math.floor(i/B))
if start<=K:
    start=K
print(start)
Buggy python submission (verdict: Time Limit Exceeded):
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd,numbers)

K=int(input())
count=0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            count+=gcd(a,b,c)
print(count)

Fixed submission:
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd,numbers)

K=int(input())
count=0
for a in range(1,K+1):
    for b in range(1,K+1):
        for c in range(1,K+1):
            count+=gcd(a,b,c)
print(count)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
t=N%K
print(min(t,K-t))

Fixed submission:
X,Y,Z=map(int,input().split())
X,Y=Y,X
X,Z=Z,X
print(X,Y,Z)

Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
a=list(map(int,input().split()))
SUM=sum(a)
ninnki=SUM/(4*M)
count=0

for i in a:
    if i>=ninnki:
        count+=1
        
if count>=M:
    print("Yes")
else:
    print("No")

Fixed submission:
X,Y,Z=map(int,input().split())
X,Y=Y,X
X,Z=Z,X
print(X,Y,Z)
Buggy python submission (verdict: Runtime Error):
N,K=map(int,input().split())
while (N-K)>=0:
    N=N-K

if N>=abs(N-K):
    print(int(abs(N-K)))
else:
    print(int(N))

Fixed submission:
N,K=map(int,input().split())
t=N%K
print(min(t,K-t))

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
while (N-K)>=0:
    N=N-K
if N>=abs(N-K):
    print(int(abs(N-K)))
else:
    print(int(N))

Fixed submission:
N,K=map(int,input().split())
t=N%K
print(min(t,K-t))

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
while (N-K)>=0:
    N=N-K

if N>=abs(N-K):
    print(int(abs(N-K)))
else:
    print(int(N))

Fixed submission:
N,K=map(int,input().split())
t=N%K
print(min(t,K-t))

Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
while (N-K)>=0:
    N=N-K

if N>=abs(N-K):
    print(int(abs(N-K)))
else:
    print(int(N))

Fixed submission:
N,K=map(int,input().split())
t=N%K
print(min(t,K-t))
Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
S=[a,b,c]
print(S.count(1))

Fixed submission:
s=list(input())
count=0
if s[0]=="1":
    count+=1
if s[1]=="1":
    count+=1
if s[2]=="1":
    count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
S=[a,b,c]
print(S.count(1))

Fixed submission:
s=list(input())
count=0
if s[0]=="1":
    count+=1
if s[1]=="1":
    count+=1
if s[2]=="1":
    count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
import math
a,b,c=map(int,input().split())
S=[a,b,c]
print(S.count(1))  

Fixed submission:
s=list(input())
count=0
if s[0]=="1":
    count+=1
if s[1]=="1":
    count+=1
if s[2]=="1":
    count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N=input()
a=list(map(int,input().split()))
count=0
while all(x%2==0 for x in a):
    count+=1
print(count)

Fixed submission:
N=input()
a=list(map(int,input().split()))
count=0
while all(x%2==0 for x in a):
    a=[x/2 for x in a]
    count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
K,S=map(int,input().split())
count=0
for X in range(K+1):
    for Y in range(K+1):
        for Z in range(K+1):
            if X+Y+Z==S:
                count+=1
                
print(count)

Fixed submission:
K,S=map(int,input().split())
count=0
for X in range(K+1):
    for Y in range(K+1):
        if 0<=S-X-Y<=K:
            count+=1
                
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
ans = 1
for i in range(N):
    ans *= A[i]
if ans > 10 ** 18:
    ans = -1
print(ans)


Fixed submission:
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)
if A[-1] == 0:
    print(0)
    exit()
ans = 1
for i in range(N):
    ans *= A[i]
    if ans > 10 ** 18:
        ans = -1
        break
print(ans)
Buggy python submission (verdict: Runtime Error):
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
visited = {'1': 0}
route = [1]
next_id = 0
count = 0
while count < K:
    count += 1
    if A[next_id] in visited.keys():
        break
    visited[A[next_id]] = count
    route.append(A[next_id])
    next_id = A[next_id] - 1
roop = route[visited[A[next_id]]:]
print(roop[(K - count) % len(roop)])


Fixed submission:
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
visited = {'1': 0}
route = [1]
next_id = 0
count = 0
while count < K:
    count += 1
    if A[next_id] in visited.keys():
        route = route[visited[A[next_id]]:]
        K -= count
        break
    visited[A[next_id]] = count
    route.append(A[next_id])
    next_id = A[next_id] - 1
print(route[K % len(route)])
Buggy python submission (verdict: Runtime Error):
s = input()
if s = 'Sunny':
    ans = 'Cloudy'
elif s = 'Cloudy':
    ans = 'Rainy'
else:
    ans = 'Sunny'
print(ans)


Fixed submission:
s = input()
if s == 'Sunny':
    ans = 'Cloudy'
elif s == 'Cloudy':
    ans = 'Rainy'
else:
    ans = 'Sunny'
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
ans = 0
S = {}
for i in range(N):
    s = ''.join(sorted(input()))
    if s not in S.keys():
        S[s] = 0
        continue
    print(S)
    S[s] += 1
    ans += S[s]
print(ans)


Fixed submission:
N = int(input())
ans = 0
S = {}
for i in range(N):
    s = ''.join(sorted(input()))
    if s not in S.keys():
        S[s] = 0
        continue
    S[s] += 1
    ans += S[s]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import collections

N = int(input())
s = [collections.Counter(list(input())) for _ in range(N)]
ans = 0
for i in range(N):
    for j in range(i + 1, N):
        if s[i] == s[j]:
            ans += 1
print(ans)


Fixed submission:
N = int(input())
ans = 0
S = {}
for i in range(N):
    s = ''.join(sorted(input()))
    if s not in S.keys():
        S[s] = 0
        continue
    S[s] += 1
    ans += S[s]
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = [''.join(sorted(input())) for _ in range(N)]
ans = 0
for i in range(N):
    for j in range(i + 1, N):
        if s[i] == s[j]:
            ans += 1
print(ans)


Fixed submission:
N = int(input())
ans = 0
S = {}
for i in range(N):
    s = ''.join(sorted(input()))
    if s not in S.keys():
        S[s] = 0
        continue
    S[s] += 1
    ans += S[s]
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]
m = max(A)
ans = [m for _ in range(N)]
if A.count(M) > 1:
    print('\n'.join(ans))
    exit()
AA = A[:]
AA.remove(M)
mm = max(AA)
for n in range(N):
    if A[n] == m:
        ans[n] = mm
        break
print('\n'.join(ans))

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
m = max(A)
ans = list(map(str, [m for _ in range(N)]))
if A.count(m) > 1:
    print('\n'.join(ans))
    exit()
AA = A[:]
AA.remove(m)
mm = max(AA)
for n in range(N):
    if A[n] == m:
        ans[n] = str(mm)
        break
print('\n'.join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]
m = max(A)
for n in range(N):
    if A[n] < m:
        print(m)
        continue
    elif n == 0:
        print(max(A[n + 1:]))
    elif n == N - 1:
        print(max(A[:n]))
    else:
        print(max(max(A[:n]), max(A[n + 1:])))

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
m = max(A)
ans = list(map(str, [m for _ in range(N)]))
if A.count(m) > 1:
    print('\n'.join(ans))
    exit()
AA = A[:]
AA.remove(m)
mm = max(AA)
for n in range(N):
    if A[n] == m:
        ans[n] = str(mm)
        break
print('\n'.join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]
for n in range(N):
    if n == 0:
        print(max(A[n + 1:]))
    elif n == N - 1:
        print(max(A[:n]))
    else:
        print(max(max(A[:n]), max(A[n + 1:])))

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
m = max(A)
ans = list(map(str, [m for _ in range(N)]))
if A.count(m) > 1:
    print('\n'.join(ans))
    exit()
AA = A[:]
AA.remove(m)
mm = max(AA)
for n in range(N):
    if A[n] == m:
        ans[n] = str(mm)
        break
print('\n'.join(ans))

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(input()) for _ in range(N)]
for n in range(N):
    a = [A[m] for m in range(N) if m != n]
    print(max(a))

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
m = max(A)
ans = list(map(str, [m for _ in range(N)]))
if A.count(m) > 1:
    print('\n'.join(ans))
    exit()
AA = A[:]
AA.remove(m)
mm = max(AA)
for n in range(N):
    if A[n] == m:
        ans[n] = str(mm)
        break
print('\n'.join(ans))
Buggy python submission (verdict: Runtime Error):
def comb(n, r):
  if n < 0 or r < 0:
    return 0
  r = min(r, n - r)
  if n == 0 or r == 0:
    return 1
  return (n - r + 1) * comb(n, r - 1) // r

N, K = list(map(int, input().split()))
for i in range(K):
  print(comb(N - K + 1, i + 1) * comb(K - 1, i) % (10 ** 9 + 7))

Fixed submission:
S = input()
if len(set(S)) != 2 or S.count(S[0]) != 2:
  print('No')
  exit()
print('Yes')
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = [tuple(map(int, input().split())) for _ in range(N)]
L.sort(key=lambda x: x[1])
work = 0
for n in range(N):
  work += L[0][n]
  if work > L[1][n]:
    print('No')
    exit()
print('Yes')

Fixed submission:
N = int(input())
L = [tuple(map(int, input().split())) for _ in range(N)]
L.sort(key=lambda x: x[1])
work = 0
for n in range(N):
  work += L[n][0]
  if work > L[n][1]:
    print('No')
    exit()
print('Yes')
Buggy python submission (verdict: Runtime Error):
N = int(input())
W = list(map(int, input().split()))
dif = [sum(W[:T + 1] - W[T + 1:]) for T in range(N - 1)]
print(min(dif))

Fixed submission:
N = int(input())
W = list(map(int, input().split()))
dif = [abs(sum(W[:T + 1]) - sum(W[T + 1:])) for T in range(N - 1)]
print(min(dif))

Buggy python submission (verdict: Runtime Error):
N = int(input())
W = list(map(int, input().split()))
dif = [sum(W[:T + 1] - W[T + 1:]) for T in range(N)]
print(min(dif))

Fixed submission:
N = int(input())
W = list(map(int, input().split()))
dif = [abs(sum(W[:T + 1]) - sum(W[T + 1:])) for T in range(N - 1)]
print(min(dif))