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

Fixed submission:
from bisect import bisect

n = int(input())
x = list(map(int, input().split()))
l = int(input())
q = int(input())

#r[i][j]: jから(2**i)日で行ける右端
r = [[i for i in range(n)] for _ in range(18)]
for j in range(n):
	r[0][j] = bisect(x, x[j]+l) - 1
for i in range(1, 18):
	for j in range(n):
		r[i][j] = r[i-1][r[i-1][j]]

def search(x, y):
	res = 0
	cur = x
	while True:
		for i in range(18):
			if r[i][cur] >= y:
				if i == 0:
					return res+1
				cur = r[i-1][cur]
				res += 1 << (i-1) 
				break

for _ in range(q):
	a, b = map(int, input().split())
	print(search(min(a, b)-1, max(a, b)-1))

Buggy submission (verdict: Runtime Error):
from bisect import bisect, bisect_left
import sys

n = int(input())
x = list(map(int, input().split()))
l = int(input())

def search_1(start):
	return bisect(x, x[start] + l) - 1

route = [[] for _ in range(n)]

i = 0 # 親の位置
for i in range(n - 1):
	if route[i] == []:
		j = search_1(i) # カーソルの位置
		num = 1 # 何日目の場所か
		route[i].append(j)
		if route[j] == []:
			route[j] = (i, num)
		else: # 既に他の親が通っている
			route[i] += route[route[j][0]][route[j][1]:]
			continue
		while j < n - 1:
			j = search_1(j)
			num += 1
			route[i].append(j)
			if route[j] == []:
				route[j] = (i, num)
			else: # 既に他の親が通っている
				route[i] += route[route[j][0]][route[j][1]:]
				break
	else:
		continue

# print(route)

def search_2(start, goal):
	if type(route[start]) == type([]):
		return bisect_left(route[start], goal) + 1
	else:
		return bisect_left(route[route[start][0]][route[start][1]:], goal) + 1



q = int(input())
for _ in range(q):
	a, b = map(int, sys.stdin.redline().strip().split())
	if a > b:
		a, b = b, a
	print(search_2(a - 1, b - 1))

Buggy submission (verdict: Runtime Error):
from bisect import bisect, bisect_left

n = int(input())
x = list(map(int, input().split()))
l = int(input())

def search_1(start):
	return bisect(x, x[start] + l) - 1

route = [[] for _ in range(n)]

i = 0 # 親の位置
for i in range(n - 1):
	if route[i] == []:
		j = search_1(i) # カーソルの位置
		num = 1 # 何日目の場所か
		route[i].append(j)
		if route[j] == []:
			route[j] = (i, num)
		else: # 既に他の親が通っている
			route[i] += route[route[j][0]][route[j][1]:]
			continue
		while j < n - 1:
			j = search_1(j)
			num += 1
			route[i].append(j)
			if route[j] == []:
				route[j] = (i, num)
			else: # 既に他の親が通っている
				route[i] += route[route[j][0]][route[j][1]:]
				break
	else:
		continue

# print(route)

def search_2(start, goal):
	if type(route[start]) == type([]):
		return bisect_left(route[start], goal) + 1
	else:
		return bisect_left(route[route[start][0]][route[start][1]:], goal) + 1



q = int(input())
for _ in range(q):
	a, b = map(int, input().split())
	if a > b:
		a, b = b, a
	print(search_2(a - 1, b - 1))
Problem p04028 (python)

Fixed submission:
MOD = (10 ** 9) + 7

N = int(input())
s = list(input())

dp = [[0] * (N + 2) for i in range(N + 1)]

for n in range(N + 1):
	for l in range(n + 1):
		if n == 1:
			dp[n][l] = 1
		elif l == 0:
			dp[n][l] = (dp[n - 1][0] + 2 * dp[n - 1][1]) % MOD
		else:
			dp[n][l] = (dp[n - 1][l - 1] + 2 * dp[n - 1][l + 1]) % MOD

print(dp[N][len(s)])

Buggy submission (verdict: Runtime Error):
MOD = (10 ** 9) + 7

N = int(input())
s = list(input())

dp = [[0 for i in range(N + 1)] for j in range(N + 1)]


for i in range(N + 1):
	dp[i][i] = 1
for i in range(N):
	dp[i][i + 1] = 1

for n in range(1, N + 1):
	dp[n][0] = (dp[n - 1][0] + 2 * dp[n - 1][1]) % MOD
	for l in range(1, n):
		dp[n][l] = (dp[n - 1][l - 1] + 2 * dp[n - 1][l + 1]) % MOD

print(dp[N - 1][len(s)])

Buggy submission (verdict: Runtime Error):
MOD = (10 ** 9) + 7

N = int(input())
s = list(input())

dp = [[0 for i in range(N)] for j in range(N)]


for i in range(N):
	dp[i][i] = 1
for i in range(N - 1):
	dp[i][i + 1] = 1

for n in range(1, N):
	dp[n][0] = (dp[n - 1][0] + 2 * dp[n - 1][1]) % MOD
	for l in range(1, n):
		dp[n][l] = (dp[n - 1][l - 1] + 2 * dp[n - 1][l + 1]) % MOD

print(dp[N - 1][len(s)])
Problem p02983 (python)

Fixed submission:
L, R = map(int, input().split())
a=[]

if R-L>=2019:
  ans=0
else:
  l, r = L%2019, R%2019
  ans=2018**2
  for i in range(l,r):
    for j in range(l+1,r+1):
        k = (i*j) % 2019
        ans = min(ans,k)
print(ans)

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
a=[]

if R-L>=2019:
  ans=0
else:
  l, r = L%2019, R%2019
  for i in range(l,r):
    for j in range(l+1,r+1):
        k = (i*j) % 2019
        ans = min(ans,k)
print(ans)
Problem p03001 (python)

Fixed submission:
w, h, x, y = map(int, input().split())
print(w*h/2, int(h==2*y and w==2*x))

Buggy submission (verdict: Runtime Error):
w, h, x, y = map(int, input().split())
print(w*h/2, int(h/w==y/x))

Buggy submission (verdict: Runtime Error):
w, h, x, y = map(int, input().split())
an=[]
if y>=h/2:
  a=w*(h-y)
  an.append(a)
if y<=h/2:
  b=w*y
  an.append(b)
if x>=w/2:
  c=h*(w-x)
  an.append(c)
if x<=w/2:
  d=h*x
  an.append(d)
if y/x==h/w:
  e=(w*h)/2
  an.append(e)

g = set(an)
l=len(g)
i=len(an)
an.sort()
if l>1:
  T=0
else:
  T=1

print('{} {}'.format(an[-1], T))
Problem p03068 (python)

Fixed submission:
N = int(input())
S = input()
K = int(input())

for i in range(N):
  if S[i]!=S[K-1]:
    S = S.replace(S[i], "*")
  
print(S)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()
K = int(input())

for i in range(N):
  if S[i]!=S[K]:
    S = S.replace(S[i], "*")
  
print(S)
Problem p03076 (python)

Fixed submission:
l=[]
m=[]
for i in range(5):
  i = int(input())
  k = 10 - (i%10)
  l.append(i)
  if k != 10:
    m.append(k)
m.sort()
if len(m)==0:
  print(sum(l))
else:
  s = sum(m)-m[-1]
  print(sum(l)+s)

Buggy submission (verdict: Runtime Error):
l=[]
m=[]
for i in range(5):
  i = int(input())
  k = 10 - (i%10)
  l.append(i)
  if k != 10:
    m.append(k)
m.sort()
s = sum(m)-m[-1]
print(sum(l)+s)

Buggy submission (verdict: Runtime Error):
l=[]
m=[]
for i in range(5):
  i = int(input())
  k = 10 - (i%10)
  l.append(i)
  if k != 10:
    m.append(k)
m.sort()
s = sum(m)-m[4]
print(sum(l)+s)
Problem p03085 (python)

Fixed submission:
b = input()

if b=='A':
  print('T')
elif b=='T':
  print('A')
elif b=='G':
  print('C')
else:
  print('G')

Buggy submission (verdict: Runtime Error):
b = input()

if b==A:
  print('T')
elif b==T:
  print('A')
elif b==G:
  print('C')
else:
  print('G')
Problem p03826 (python)

Fixed submission:
a = list(map(int, input().split()))
b = a[0]*a[1] 
c = a[2]*a[3]
A = [b, c]
print(max(A))

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

b = a[0]*a[1] 
c = a[2]*a[3]
A = [b, c]
print(max(A))
Problem p02641 (python)

Fixed submission:
a = input().split()
X = int(a[0])
N = int(a[1])
OK = []
list = []
if N ==0:
    print(X)
else:
    P = input().split()
    for i in range(102):
        OK.append(str(i))
    for i in range(len(P)):
        OK.remove(P[i])
    for i in range(len(OK)):
        list.append(abs(int(OK[i]) - X))
    Y = list.index(min(list))
    print(OK[Y])

Buggy submission (verdict: Runtime Error):
a = input().split()
X = int(a[0])
N = int(a[1])
OK = []
list = []
if N ==0:
    print(X)
else:
    P = input().split()
    for i in range(100):
        OK.append(str(i + 1))
    for i in range(len(P)):
        OK.remove(P[i])
    for i in range(len(OK)):
        list.append(abs(int(OK[i]) - X))
    Y = list.index(min(list))
    print(OK[Y])
Problem p02657 (python)

Fixed submission:
s = input().split()
A = int(s[0])
B = int(s[1])
print(A * B)

Buggy submission (verdict: Runtime Error):
s = input().split()
print(s[0] * s[1])
Problem p03105 (python)

Fixed submission:
A,B,C=[int(i) for i in input().split()]
if A*C<= B:
    print (C)
else:
    print (int(B/A))

Buggy submission (verdict: Runtime Error):
A,B,C=[int(i) for i in input().split()]
if A*C <B:
  print C
else:
  print B % A
Problem p02647 (python)

Fixed submission:
import numpy as np
from numba import njit


def main(N, K, A):
    @njit(cache = True) # numpyの高速化．雲泥の差になった．知らなかった．
    def rep(N, A):
        B = np.zeros(N + 1, dtype=np.int64) # np.int64としないとnjitがエラー
        for x in range(N):
            minimum = max(0, x - A[x])
            maximum = min(N, x + A[x] + 1)
            # B[minimum:maximum] += 1   # これだと実質for文回してるような感じだから遅い？
            B[minimum] += 1
            B[maximum] -= 1
        # return B  # これだと実質for文回してるような感じだから遅い？
        return np.cumsum(B)[:-1]

    A = np.array(A, dtype=np.int64)
    for k in range(K):
        B = rep(N, A)
        if np.array_equal(A, B):
            break
        else:
            A = B
    return A



if __name__ == '__main__':
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    print(' '.join([str(i) for i in main(N, K, A)]))

Buggy submission (verdict: Runtime Error):
import numpy as np
from numba import njit
# from numba import jit

@njit(cache = True)
def main(N, K, A):
    A = np.array(A, dtype = int)
    for k in range(K):
        # print(k)
        B = np.zeros(N + 1, dtype = int)
        for x in range(N):
            minimum = max(0, x - A[x])
            maximum = min(N, x + A[x] + 1)
            # B[minimum:maximum] += 1
            B[minimum] += 1
            B[maximum] -= 1
            A = np.cumsum(B)[:-1]
        if np.all(A == N):
            # print(k)
            break
    print(' '.join([str(i) for i in A]))



if __name__ == '__main__':
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    main(N, K, A)

Buggy submission (verdict: Runtime Error):
import numpy as np
# from numba import njit
# from numba import jit

# @jit(cache = True)
def main(N, K, A):
    A = np.array(A, dtype = int)
    for k in range(K):
        # print(k)
        B = np.zeros(N, dtype = int)
        for x in range(N):
            minimum = max(0, x - A[x])
            maximum = min(N, x + A[x] + 1)
            # B[minimum:maximum] += 1
            B[minimum] += 1
            B[maximum] -= 1
            A = np.cumsum(B)
        if np.all(A == N):
            # print(k)
            break
    print(' '.join([str(i) for i in A]))



if __name__ == '__main__':
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    main(N, K, A)
Problem p02658 (python)

Fixed submission:
def main(N):
    A = list(map(int, input().split()))
    st_A = set(A)
    if 0 in st_A:
        print(0)
    else:
        x = 1
        for a in A:
            x *= a
            if x > 10 ** 18:
                print(-1)
                exit()
        else:
            print(x)





if __name__ == '__main__':
    N = int(input())
    main(N)

Buggy submission (verdict: Runtime Error):
def main(N):
    A = list(map(int, input().split()))
    st_A = set(A)
    if 0 in st_A:
        print(0)
        x = 1
    else:
        for a in A:
            x *= a
            if x > 10 ** 18:
                print(-1)
                exit()
        else:
            print(x)





if __name__ == '__main__':
    N = int(input())
    main(N)

Buggy submission (verdict: Runtime Error):
def main(N):
    A = list(map(int, input().split()))
    st_A = set(A)
    if 0 in st_A:
        print(0)
    else:
        x = 1
        for a in A:
            x *= a
        	if x > 10**18:
            	print(-1)
                exit()
        else:
            print(x)




if __name__ == '__main__':
    N = int(input())
    main(N)

Buggy submission (verdict: Runtime Error):
from math import log10

def main(N):
    A = list(map(int, input().split()))
    st_A = set(A)
    if 0 in st_A:
        print(0)
    else:
        x = 1
        for a in A:
            x *= a
        	if x > 10**18:
            	print(-1)
                exit()
        else:
            print(x)




if __name__ == '__main__':
    N = int(input())
    main(N)

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

def main(N):
    ans = np.prod(np.array(list(map(int, input().split()))))
    if log10(ans) >= 18 and ans != 10 ** 18:
        print(-1)
    else:
        print(ans)





if __name__ == '__main__':
    N = int(input())
    main(N)

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

def main(N):
    ans = np.prod(np.array(list(map(int, input().split()))))
    if log10(ans) >= 18:
        print(-1)
    else:
        print(ans)





if __name__ == '__main__':
    N = int(input())
    main(N)
Problem p02684 (python)

Fixed submission:
def main(N, K, A):
    i = 0   # 現在地
    lst_memo = []
    set_memo = set([])
    while i not in set_memo:
        lst_memo.append(i)
        set_memo.add(i)
        i = A[i] - 1    # pythonは一つずれる
    key = lst_memo.index(i)
    if K < key:
        print(lst_memo[K] + 1)
    else:
        roop = lst_memo[key:]
        print(roop[(K - key) % len(roop)] + 1)    # pythonは一つずれる


if __name__ == '__main__':
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    main(N, K, A)

Buggy submission (verdict: Runtime Error):
def main(N, K, A):
    i = 0   # 現在地
    lst_memo = []
    set_memo = set([])
    while i not in set_memo:
        lst_memo.append(i)
        set_memo.add(i)
        i = A[i] - 1    # pythonは一つずれる
    key = lst_memo.index(i)
    if K <= key:
        print(lst_memo[K - 1] + 1)
    else:
        roop = lst_memo[key:]
        print(roop[key + (K - key) % len(roop)] + 1)    # pythonは一つずれる


if __name__ == '__main__':
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    main(N, K, A)

Buggy submission (verdict: Runtime Error):
def main(N, K, A):
    i = 0   # 現在地
    lst_memo = []
    set_memo = {}
    while i not in set_memo:
        lst_memo.append(i)
        set_memo.append(i)
        i = A[i] - 1    # pythonは一つずれる
    key = lst_memo.index(i)
    roop = memo[key:]
    print(roop[(K - key) % len(roop)] + 1)    # pythonは一つずれる


if __name__ == '__main__':
    N, K = list(map(int, input().split()))
    A = list(map(int, input().split()))
    main(N, K, A)
Problem p02713 (python)

Fixed submission:
import math
import itertools
from functools import reduce

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

K = int(input())

ans = 0
for lst in itertools.combinations_with_replacement([i + 1 for i in range(K)], 3):
    ans += int(6 / math.factorial(4 - len(set(lst)))) * gcd(list(lst))

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

counta = 0
i = 0

while i < N - 2:
    j = i + 1
    while j < N - 1:
        if S[j] != S[i]:
            k = j + 1
            rest = [l for l in ['R', 'G', 'B'] if l != S[i] and l != S[j]]
            while k < N:
                if S[k] == rest[0] and  k - j != j - i:
                    counta += 1
                k += 1
        j += 1
    i += 1

print(counta)
Problem p02718 (python)

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

A.sort(reverse = True)
real = A[M-1] / sum(A)
ideal = 1 / (4 * M)

if real >= ideal:
    print("Yes")
else:
    print("No")

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

real = A[M] / sum(A)
ideal = 1 / (4 * M)

if real >= ideal:
    print("Yes")
else:
    print("No")
Problem p02721 (python)

Fixed submission:
# import time

N, K, C = list(map(int, input().split()))
S = list(input())

F = []
L = []

# t1 = time.time()
# for i in range(N):
#     if S[i] == 'o':
#         if len(F) == 0:
#             F.append(i)
#         elif F[-1] + C < i:
#             F.append(i)
#     if len(F) >= K:
#         break
# print(F)
# t2 = time.time()
i = 0
while len(F) <= K and i < N:
    if S[i] == 'o':
        if len(F) == 0:
            F.append(i)
        elif F[-1] + C < i:
            F.append(i)
    i += 1
# print(F)
# t3 = time.time()

# print(t2 - t1, t3 - t2)

i = N - 1
while len(L) <= K and i >= 0:
    if S[i] == 'o':
        if len(L) == 0:
            L.append(i)
        elif L[-1] - C > i:
            L.append(i)
    i -= 1

if len(F) == K and len(L) == K:
    ans = [i + 1 for i in set(F) & set(L)]
    if len(ans) != 0:
        ans.sort()
        [print(i) for i in ans]

Buggy submission (verdict: Runtime Error):
# import time

N, K, C = list(map(int, input().split()))
S = list(input())

F = []
L = []

# t1 = time.time()
# for i in range(N):
#     if S[i] == 'o':
#         if len(F) == 0:
#             F.append(i)
#         elif F[-1] + C < i:
#             F.append(i)
#     if len(F) >= K:
#         break
# print(F)
# t2 = time.time()
i = 0
while len(F) < K and i < N:
    if S[i] == 'o':
        if len(F) == 0:
            F.append(i)
        elif F[-1] + C < i:
            F.append(i)
    i += 1
# print(F)
# t3 = time.time()

# print(t2 - t1, t3 - t2)

i = N - 1
while len(L) < K and i >= 0:
    if S[i] == 'o':
        if len(L) == 0:
            L.append(i)
        elif L[-1] - C > i:
            L.append(i)
    i -= 1

if len(F) == K and len(L) == K:
    ans = [i + 1 for i in set(F) &
Problem p02732 (python)

Fixed submission:
import collections
import math

#****************************************************************
def comb(n):
    if n < 2:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
#****************************************************************

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

c = collections.Counter(A)
full_ans = sum(list(map(comb, c.values())))

for a in A:
    print(full_ans - c[a] + 1)

Buggy submission (verdict: Runtime Error):
import collections
import math

#****************************************************************
def comb(n):
    if n < 2:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
#****************************************************************

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

c = collections.Counter(A)
full_ans = sum(list(map(comb, c.values())))

for i in c.keys():
    target = c.copy()
    target[i] -= 1
    if target[i] == 0:
        dict_ans[i] = full_ans
    else:
        dict_ans[i] = sum(list(map(comb, target.values())))

for i in A:
    print(dict_ans[i])

Buggy submission (verdict: Runtime Error):
import collections
import math

#****************************************************************
def comb(n):
    if n < 2:
        return 0
    else:
        return math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))
#****************************************************************

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

c = collections.Counter(A)
dict_ans = {i:0 for i in c.keys()}
full_ans = sum(list(map(comb, c.values())))

for i in c.keys():
    target = c.copy()
    target[i] -= 1
    if target[i] == 0:
        dict_ans[i] = full_ans
    else:
        for k in target.values():
            dict_ans[i] += comb(k, 2)

for i in A:
    print(dict_ans[i])
Problem p02789 (python)

Fixed submission:
N, M = map(int, input().split(' '))
if N == M:
    print('Yes')
else:
    print('No')

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

N = int(input())
P = np.array(input().split(' '), dtype = int)
# P = np.array(list(map(int, input().split(' '))))

counta = 0
for i in range(N):
    counta += np.all((P[:i+1] >= P[i]))
print(counta)
Problem p02791 (python)

Fixed submission:
N = int(input())
# P = np.array(input().split(' '), dtype = int)
P = list(map(int, input().split(' ')))

p_min = P[0]
ans = 0
for p in P:
    if p <= p_min:
        p_min = p
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
 
N = int(input())
P = np.array(input().split(' '), dtype = int)
 
counta = 0
for i in range(N):
    if np.sum((P >= P[i])[:i+1]) == i + 1:
        counta += 1
print(counta)

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

N = int(input())
# P = np.array(input().split(' '), dtype = int)
P = np.array(list(map(int, input().split(' '))))

counta = 0
for i in range(N):
    counta += (min(P[:i+1]) == P[i])
print(counta

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

N = int(input())
# P = np.array(input().split(' '), dtype = int)
P = np.array(list(map(int, input().split(' '))))

# print(N - sum([np.any(P[:i+1] < P[i]) for i in range(N)]))
ar_bool = (P >= P.reshape(-1,1))
counta = 0
for i in range(N):
    counta += np.all((ar_bool)[i][:i+1])
print(counta)

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

N = int(input())
# P = np.array(input().split(' '), dtype = int)
P = np.array(list(map(int, input().split(' '))))

# print(N - sum([np.any(P[:i+1] < P[i]) for i in range(N)]))
ar_bool = (P >= P.reshape(-1,1))
counta = 0
for i in range(N):
    counta += np.any((ar_bool)[i][:i+1])
print(counta)

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

N = int(input())
# P = np.array(input().split(' '), dtype = int)
P = np.array(list(map(int, input().split(' '))))

# print(N - sum([np.any(P[:i+1] < P[i]) for i in range(N)]))
ar_bool = (P < P.reshape(-1,1))
for i in range(N):
    N -= np.any((ar_bool)[i][:i+1])
print(N)

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

N = int(input())
# P = np.array(input().split(' '), dtype = int)
P = np.array(list(map(int, input().split(' '))))

# print(N - sum([np.any(P[:i+1] < P[i]) for i in range(N)]))
for i in range(N):
    N -= np.any((P < P.reshape(-1,1))[i][:i+1])
print(N)

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

N = int(input())
# P = np.array(input().split(' '), dtype = int)
P = np.array(list(map(int, input().split(' '))))

# print(N - sum([np.any(P[:i+1] < P[i]) for i in range(N)]))
for i in range(N):
    N -= np.any(P < P.reshape(-1,1))[i][:i+1]
print(N)
Problem p03657 (python)

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

if A%3==0 or B%3==0 or (A+B)%3==0:
    print('Possible')
else:
    print('Impossible')

Buggy submission (verdict: Runtime Error):
def cookies(A,B):
    if A%3==0 or B%3==0 or (A+B)%3==0:
        return 'Possible'
    else:
        return 'Impossible
Problem p02994 (python)

Fixed submission:
N ,L = map(int,input().split())
lis = []
for i in range(N):
  lis.append(L+i)

mini = 100
index = 0
for i in range(N):
  if mini > abs(lis[i]):
    mini = abs(lis[i])
    index = i

print(sum(lis)-lis[index])

Buggy submission (verdict: Runtime Error):
N ,L = map(int,input().split())
lis = []
for i in range(N):
  lis.append(L+i)

mini = 100
index = ""
for i in range(N):
  if mini > abs(lis[i]):
    mini = abs(lis[i])
    index = i

print(sum(lis)-lis[index])
Problem p03000 (python)

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

lis = list(map(int,input().split()))
count = 1
sm = 0
for l in lis:
  sm += l
  if sm > X:
    break
  count += 1
print(count)

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

lis = list(map(int,input().split()))
i = 0
sum = 0
while  sum <= X:
  sum += lis[i]
  i += 1
print(i)
Problem p03029 (python)

Fixed submission:
A, P = map(int, input().split())

P = A * 3 + P
print(int(P / 2))

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

list_a = []
list_b = []
list_dist = []

for i in range(N):
  list_a.append(list(map(int, input().split())))

for j in range(Q):
  list_b.append(int(input()))

list_a.sort(key=lambda x:x[2])


for b in list_b:
  dist = 0
  time = b
  stop_flag = 0
  for a in list_a:
    time = time + a[2] - dist
    dist = a[2]
    if time > a[0]-0.5 and time < a[1]-0.5:
      stop_flag = 1
      break
  if stop_flag == 0:
    list_dist.append(-1)
  else:
    list_dist.append(dist)

for dist in list_dist:
  print(dist)
Problem p02602 (python)

Fixed submission:
n,k = map(int,input().split())
a_li = list(map(int,input().split()))
 
for i in range(k,n):
    if a_li[i-k] < a_li[i]:
        print("Yes")
    else:
        print("No")

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
a_li = list(map(int,input().split()))
 
for i in range(k,n):
    if a_li[i-k] < a_li[i]:
        print("Yes")
    else:
        print("No")
n,k = map(int,input().split())
a_li = list(map(int,input().split()))

for i in range(k,n):
    if a_li[i-k] < a_li[i]:
        print("Yes")
    else:
        print("No")