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

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(Q)]

cup = list(range(N+1)) + [0]
se = set([0,1,2])
ball = 1
for a,b in AB:
    cup[a],cup[b] = cup[b],cup[a]
    for x in [a,b]:
        if cup[x] == 1:
            ball = x
    se.add(cup[ball-1])
    se.add(cup[ball+1])

se.remove(0)
answer = len(se)
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(Q)]

cup = list(range(N+1)) + [0]
se = set([0,1,2])
for a,b in AB:
    cup[a],cup[b] = cup[b],cup[a]
    for x in [a,b]:
        if cup[x] == 1:
            ball = x
    se.add(cup[ball-1])
    se.add(cup[ball+1])

se.remove(0)
answer = len(se)
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

N,Q = map(int,input().split())
AB = [[int(x) for x in input().split()] for _ in range(Q)]

cup = list(range(N+1)) + [0]
se = set()
se.add(1)
se.add(2)
for a,b in AB:
    cup[a],cup[b] = cup[b],cup[a]
    for x in [a,b]:
        if cup[x] == 1:
            ball = x
    se.add(cup[ball-1])
    se.add(cup[ball+1])

se.discard(0)
answer = len(se)
print(answer)
Problem p03960 (python)

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

import numpy as np

"""
それぞれの隣接2列ごとに、可能な摩擦の最小値を実現する → 小問題に分割。
"""

buffer = sys.stdin.buffer
H,W = map(int,buffer.readline().split())
C = np.frombuffer(buffer.read(),dtype='S1').reshape(H,-1)[:,:W].T

dp_1 = np.zeros((W-1,H+H+1,H+1),dtype=np.int64)
for r in range(H):
    dp_1[:,r+2:r+H+2,r+1] = (C[:-1] == C[1:,r][:,None])

INF = 10**18
# R-L+H -> min cost
dp = np.full((W-1,H+1),INF,dtype=np.int64)
dp[:,0] = 0
for n in range(1,H+H+1):
    if n >= 2:
        dp_1[:,n,1:] += dp_1[:,n-2,:-1]
    # n個目を置く
    prev = dp
    dp = np.full((W-1,H+1),INF,dtype=np.int64)
    dp[:,1:] = np.minimum(dp[:,1:],prev[:,:-1])
    dp[:,:] = np.minimum(dp[:,:],prev[:,:])
    dp += dp_1[:,n,:]
answer = dp[:,H].sum()
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

import numpy as np

"""
それぞれの隣接2列ごとに、可能な摩擦の最小値を実現する → 小問題に分割。
"""

buffer = sys.stdin.buffer
H,W = map(int,buffer.readline().split())
C = np.frombuffer(buffer.read(),dtype='S1').reshape(H,-1)[:,:W].T

dp_1 = np.zeros((W-1,H+H+1,H+1),dtype=np.int64)
for r in range(H):
    dp_1[:,r+2:r+H+2,r+1] = (C[:-1] == C[1:,r][:,None])

(C[:-1][:,:] == C[1:][:,r][])

INF = 10**18
# R-L+H -> min cost
dp = np.full((W-1,H+H+1),INF,dtype=np.int64)
dp[:,H] = 0
for n in range(1,H+H+1):
    # n個目を置く
    prev = dp
    dp = np.full((W-1,H+H+1),INF,dtype=np.int64)
    dp[:,1:] = np.minimum(dp[:,1:],prev[:,:-1])
    dp[:,:-1] = np.minimum(dp[:,:-1],prev[:,1:])
    dp += dp_1[:,:,n]
answer = dp[:,H].sum()
print(answer)
Problem p03993 (python)

Fixed submission:
N = int(input())
A = [None] + [int(x) for x in input().split()]

answer = 0
for i in range(1,N+1):
  if A[A[i]] == i:
    answer += 1
answer //= 2
print(answer)

Buggy submission (verdict: Runtime Error):
N = input()
A = [None] + [int(x) for x in input().split()]

answer = 0
for i in range(1,N+1):
  if A[A[i]] == i:
    answer += 1
answer //= 2
print(answer)
Problem p03998 (python)

Fixed submission:
S = dict()
S['a'] = list(input())[::-1]
S['b'] = list(input())[::-1]
S['c'] = list(input())[::-1]

player = 'a'
while S[player]:
  player = S[player].pop()

  
answer = player.upper()
print(answer)

Buggy submission (verdict: Runtime Error):
S = dict()
S['a'] = list(input())
S['b'] = list(input())
S['c'] = list(input())

player = a
while S[player]:
  player = S[player].pop()

print(player)
Problem p04001 (python)

Fixed submission:
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

S = read().rstrip().decode('utf-8')

def F(S):
    yield int(S)
    for i in range(len(S)-1):
        left = S[:i+1]
        right = S[i+1:]
        x = int(left)
        for y in F(right):
            yield x + y

answer = sum(F(S))
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra

"""
(駅、会社)を頂点にグラフを持つ。頂点数O(M)。
そのまま辺を貼ると辺が多くなりすぎる。
(駅、会社) -> (駅、無属性) -> (駅、会社)
"""

N,M = map(int,input().split())
PQC = [[int(x) for x in input().split()] for _ in range(M)]

U = 10 ** 6

V = set(range(1,N+1))
V |= set(p + c * U for p,q,c in PQC)
V |= set(q + c * U for p,q,c in PQC)
V = tuple(V)
v_to_i = {v:i for i,v in enumerate(V)}

# グラフを作成
rows, cols = [],[]
rows += [i for i,pc in enumerate(V) if pc > U]
cols += [v_to_i[pc % U] for i,pc in enumerate(V) if pc > U]
wt = [1] * len(rows)
rows += [v_to_i[p + c * U] for p,q,c in PQC]
cols += [v_to_i[q + c * U] for p,q,c in PQC]
wt += [0] * M

graph = csr_matrix((wt, (rows, cols)), (len(V), len(V)))

start = v_to_i[1]
goal = v_to_i[N]
Problem p04027 (python)

Fixed submission:
import sys
input = sys.stdin.readline
import numpy as np

MOD = 10 ** 9 + 7

N,C = map(int,input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

# (i,j) に j^i を入れる
kth_pow = np.ones((C+1, 401), dtype=np.int64)
rng = np.arange(401, dtype=np.int64)
for i in range(1,C+1):
    kth_pow[i] = kth_pow[i-1] * rng % MOD
kth_pow_cum = kth_pow.cumsum(axis = 1) % MOD

dp = np.zeros((C+1), dtype=np.int64) # これまで配った個数、合計点
dp[0] = 1
for a,b in zip(A,B):
    arr = kth_pow_cum[:,b] - kth_pow_cum[:,a-1]
    prev = dp
    dp = np.zeros(C+1, dtype=np.int64)
    for n in range(C+1):
        dp[n:] += arr[n] * prev[:C+1-n] % MOD
    dp %= MOD

answer = dp[C]
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np

MOD = 10 ** 9 + 7

N,C = map(int,input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

# (i,j) に j^i を入れる
kth_pow = np.ones((1024, 401), dtype=np.int64)
rng = np.arange(401, dtype=np.int64)
for i in range(1,C+1):
    kth_pow[i] = kth_pow[i-1] * rng % MOD
kth_pow_cum = kth_pow.cumsum(axis = 1) % MOD
kth_pow_cum[C+1:] = 0

def convolve(A,B,n=32):
    if n == 8:
        return np.rint(np.fft.irfft(np.fft.rfft(A) * np.fft.rfft(B))).astype(np.int64)
    n //= 2
    M = 1 << n
    A1,A2 = np.divmod(A,M)
    B1,B2 = np.divmod(B,M)
    X = convolve(A1,B1,n)
    Y = convolve(A1-A2,B1-B2,n)
    Z = convolve(A2,B2,n)
    return (X * (M * M % MOD) + (X + Z - Y) * M + Z) % MOD

dp = np.zeros(1024, dtype=np.int64) # これまで配った個数、合計点
dp[0] = 1
for a,b in zip(A,B):
    arr = kth_pow_cum[:,b] - kth_pow_cum[:,a-1]
    dp = convolve(dp,arr)
    dp[C+1:] = 0

answer = dp[C]
print(answer)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
import numpy as np

MOD = 10 ** 9 + 7

N,C = map(int,input().split())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]

# (i,j) に j^i を入れる
kth_pow = np.ones((1024, 401), dtype=np.int64)
rng = np.arange(401, dtype=np.int64)
for i in range(1,C+1):
    kth_pow[i] = kth_pow[i-1] * rng % MOD
kth_pow_cum = kth_pow.cumsum(axis = 1) % MOD
kth_pow_cum[C+1:] = 0

def convolve(A,B,n=32):
    if n == 8:
        return np.rint(np.fft.irfft(np.fft.rfft(A) * np.fft.rfft(B))).astype(np.int64)
    n //= 2
    M = 1 << n
    A1,A2 = np.divmod(A,M)
    B1,B2 = np.divmod(B,M)
    X = convolve(A1,B1,n)
    Y = convolve(A1-A2,B1-B2,n)
    Z = convolve(A2,B2,n)
    return (X * (M * M % MOD) + (X + Z - Y) * M + Z) % MOD

dp = np.zeros(1024, dtype=np.int64) # これまで配った個数、合計点
dp[0] = 1
for a,b in zip(A,B):
    arr = kth_pow_cum[:,b] - kth_pow_cum[:,a-1]
    dp = convolve(dp,arr)
    dp[C+1:] = 0

answer = dp[C]
print(answer)
Problem p04030 (python)

Fixed submission:
s = input()
x = []

for c in s:
  if c == 'B':
    if x:
      x.pop()
  else:
    x.append(c)
    
answer = ''.join(x)
print(answer)

Buggy submission (verdict: Runtime Error):
s = input()
x = []
for c in s:
  if c == 'B':
    x.pop()
  else:
    x.append(c)
answer = ''.join(x)
print(answer)
Problem p04033 (python)

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

if a > 0:
  answer = 'Positive'
elif b >= 0:
  answer = 'Zero'
else:
  # both negative
  x = b - a + 1
  answer = 'Negative' if x & 1 else 'Positive'

print(answer)

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# 「番号 n以下 の辺だけを貼ったときの連結成分の大きさが z 以上」を満たす最小のn
# 並列二分探索

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

def find_root(root,x):
    y = root[x]
    if x == y:
        return
    find_root(root,y)
    root[x] = root[y]

def merge(root,size,x,y):
    find_root(root,x)
    find_root(root,y)
    rx = root[x]
    ry = root[y]
    if rx == ry:
        return 0,0
    return (ry,rx) if size[rx] < size[ry] else (rx,ry)

def test(root,size,x,y,z):
    find_root(root,x)
    find_root(root,y)
    rx = root[x]
    ry = root[y]
    if rx == ry:
        return size[rx] >= z
    else:
        return size[rx] + size[ry] >= z

root = list(range(N+1))
size = [1] * (N+1)
merge_1 = [0] * (M+1)
merge_2 = [0] * (M+1)

for t in range(1,M+1):
    a,b = map(int,readline().split())
    x,y = merge(root,size,a,b)
    if x == 0:
        continue
    merge_1[t] = x
    merge_2[t] = y
    root[y] = x
    size[x] += size[y]
    
Q = int(readline())
X = []
Y = []
Z = []
for line in readlines():
    x,y,z = map(int,line.split())
    X.append(x)
    Y.append(y)
    Z.append(z)

left = [0] * Q # 連結成分は z 未満
right = [M] * Q # 連結成分は z 以上
q = tuple([] for _ in range(M+1))# 調べる時刻、番号
done = [False] * (M+1)
for i in range(Q):
    q[M//2].append(i)
rest = Q


while rest:
    root = list(range(N+1))
    size = [1] * (N+1)
    for t in range(1,M+1):
        x = merge_1[t]
        y = merge_2[t]
        if x != 0:
            root[y] = x
            size[x] += size[y]
        if done[t] or not q[t]:
            continue
        done[t] = True
        L = left[q[t][0]]
        R = right[q[t][0]]
        ML = (t+L)//2
        MR = (t+R)//2
        for i in q[t]:
            x = X[i]
            y = Y[i]
            z = Z[i]
            if test(root,size,x,y,z):
                right[i] = t
                mid = ML
            else:
                left[i] = t
                mid = MR
            if left[i] < mid:
                q[mid].append(i)
            else:
                rest -= 1

for x in right:
    print(x)
Problem p02658 (python)

Fixed submission:
n = int(input())
A = [int(i) for i in input().split()]
the = pow(10,18)
ans = 1

if 0 in A:
    print(0)
else:
    for i in range(n):
        ans *= A[i]
        if ans >the:
            print(-1)
            break
        else:
            continue
    if ans <= the:
        print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = [int(i) for i in input().split()]
the = pow(10,18)
ans = 1

while ans <the:
    if 0 in A:
        print(0)
        ans = the
        break
    ans *= A[i]

if ans < the:
    print(ans)
Problem p02675 (python)

Fixed submission:
N = input()

N1= int(N[-1])
#print(N1)

if N1 in {2,4,5,7,9}:
    print("hon")
elif N1 in {0,1,6,8}:
    print("pon")
else:
    print("bon")

Buggy submission (verdict: Runtime Error):
import math
A, B, H, M = [int(i) for i in input().split()]
h = H* 2*math.pi/12 #rad
m = M* 2*math.pi/60 #rad
#print(h, "\n", m)
def kyori(a,b,c,d):
    return math.sqrt(a**2+b**2-2*a*b*math.cos(c-d))

print(kyori(A,B,h,m))

Buggy submission (verdict: Runtime Error):
import math
A, B, H, M = [int(i) for i in input().split()]
h = H* 2*math.pi/12 #rad
m = M* 2*math.pi/60 #rad
#print(h, "\n", m)
def degree(a, b):
    return abs(a-b)
def kyori(a,b,c,d):
    return math.sqrt(a**2+b**2-2*a*b*math.cos(degree(c,d)))

print(kyori(A,B,h,m))
Problem p02677 (python)

Fixed submission:
import math

def kyori(a,b,c,d):
    return math.sqrt(a**2+b**2-2*a*b*math.cos(abs(c-d)))

A, B, H, M = [int(i) for i in input().split()]
m = M* 2*math.pi/60 #rad
h = H* 2*math.pi/12+ M*2*math.pi/60/12 #rad
#print(h, "\n", m)


k=kyori(A,B,h,m)
print(k)

Buggy submission (verdict: Runtime Error):
import math
def kyori(a,b,c,d):
    return math.sqrt(a**2+b**2-2*a*b*math.cos(abs(c-d))


A, B, H, M = [int(i) for i in input().split()]
h = H* 2*math.pi/12 #rad
m = M* 2*math.pi/60 #rad
#print(h, "\n", m)


k=kyori(A,B,h,m)
print(k)

Buggy submission (verdict: Runtime Error):
#import math
A, B, H, M = [int(i) for i in input().split()]
h = H* 2*3.141592635/12 #rad
m = M* 2*3.1415926535/60 #rad
#print(h, "\n", m)
#def kyori(a,b,c,d):
#    return math.sqrt(a**2+b**2-2*a*b*math.cos(c-d))

print(math.sqrt(a**2+b**2-2*a*b*math.cos(c-d)))

Buggy submission (verdict: Runtime Error):
import math
A, B, H, M = [int(i) for i in input().split()]
h = H* 2*math.pi/12 #rad
m = M* 2*math.pi/60 #rad
#print(h, "\n", m)
#def kyori(a,b,c,d):
#    return math.sqrt(a**2+b**2-2*a*b*math.cos(c-d))

print(math.sqrt(a**2+b**2-2*a*b*math.cos(c-d)))
Problem p02713 (python)

Fixed submission:
import math


def main():
    k = int(input())
    k1 = k + 1

    sum = 0
    for i in range(1, k1):
        for j in range(1, k1):
            for m in range(1, k1):
                sum += math.gcd(math.gcd(i, j), m)
    print(sum)

main()

Buggy submission (verdict: Runtime Error):
def main():
    k = int(input())
    k1 = k + 1

    sum = 0
    for i in range(1, k1):
        for j in range(1, k1):
            for m in range(1, k1):
                sum += math.gcd(math.gcd(i, j), m)
    print(sum)

main()
Problem p02732 (python)

Fixed submission:
import collections
N = int(input())
li = list(map(int, input().split()))
cn = collections.Counter(li)
sumC = sum([n*(n-1)//2 for n in cn.values()])
for k in range(N):
    print(sumC - (cn[li[k]]-1))

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

n = int(input())
A = []
A = [int(i) for i in input().split()]

number_set = list(set(A))
#print("number set is :", number_set)    
    
for k in range(n):
    out = 0
    ans = []
    ans += A[0:k]
    ans += A[k+1:n]
    #print(ans)
    for i in range(len(number_set)):
        #print(ans.count(number_set[i]))
        out += comb(ans.count(number_set[i]), 2 ,exact = True)
        
    print(out)
Problem p02748 (python)

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

al=[]
a=input().split()
for i in a:
    al.append(int(i))
bl = []
b=input().split()
for i in b:
    bl.append(int(i))

cl=[]
for i in range(M):
    l=[]
    c = input().split()
    for i in c:
        l.append(int(i))
    cl.append(l)
    
l=[]
for i in cl:
    a=0
    a=al[i[0]-1]+bl[i[1]-1]-i[2]
    l.append(a)

Min=min(al) + min(bl)
if min(l) < Min:
    print(min(l))
else:
    print(Min)

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

al=[]
a=input().split()
for i in a:
    al.append(int(i))
bl = []
b=input().split()
for i in b:
    bl.append(int(i))
l=[]
cl=[]
for i in range(M):
    c = input().split()
    for i in c:
        l.append(int(i))
    cl.append(l)

l=[]
for cl in cl:
    a=0
    a=al[cl[0]]+bl[cl[1]]-cl[2]
    l.append(a)

print(min(a))

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

al=[]
a=input().split()
for i in a:
    al.append(int(i))
bl = []
b=input().split()
for i in b:
    bl.append(int(i))
l=[]
cl=[]
for i in range(M):
    c = input().split()
    for i in c:
        l.append(int(i))
    cl.append(l)

l=[]
for cl in cl:
    a=0
    a=al[cl[0]]+bl[cl[1]]-cl[2]
    l.append(a)

print(a)
Problem p02534 (python)

Fixed submission:
N = int(input())

print("ACL"*N)

Buggy submission (verdict: Runtime Error):
N,M= [int(x) for x in input().split()]

root = list(range(N))

for i in range(M):
    A,B = [int(x)-1 for x in input().split()]
    a = root[A]
    b = root[B]
    if a<b:
        root = [a if i == b else i for i in root]
    if b<a:
        root = [b if i == a else i for i in root]

print(len(set(root))-1)
Problem p03632 (python)

Fixed submission:
a,b,c,d=map(int,input().split());print(max(0,min(b,d)-max(a,c)))

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split());print(max(0,min(c,d)-max(a,b))
Problem p03633 (python)

Fixed submission:
import fractions;n=int(input());g=int(input())
for i in range(n-1):t=int(input());g=g*t//fractions.gcd(g,t)
print(g)

Buggy submission (verdict: Runtime Error):
import math;n=int(input());g=int(input())
for i in range(n-1):t=int(input());g=g*t//math.gcd(g,t)
print(g)
Problem p03892 (python)

Fixed submission:
def gcd(a,b):
	if b==0:return a
	return gcd(b,a%b)
a,b,c,d=map(int,input().split())
c=abs(c-a)
d=abs(d-b)
g=gcd(max(c,d),min(c,d))
j=int(c/g)
k=int(d/g)
print((j+k-1)*g)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
c-=a
d-=b
g=math.gcd(max(c,d),min(c,d))
j=int(c/g)
k=int(d/g)
print((j+k-1)*g)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
c-=a
d-=b
g=math.gcd(c,d)
j=int(c/g)
k=int(d/g)
print((j+k-1)*g)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
c-=a
d-=b
g=math.gcd(c,d)
j=c//g
k=d//g
print((j+k-1)*g)

Buggy submission (verdict: Runtime Error):
import math
a,b,c,d=map(int,input().split())
c-=a;d-=b;
g=math.gcd(c,d)
j=c//g;k=d//g
print((j+k-1)*g)
Problem p03156 (python)

Fixed submission:
N = int(input())
A,B=(int(x) for x in input().split())
scores = input().split()
num = [0,0,0]
for i in range(N):
    score = int(scores[i])
    if (score <= A):
        num[0] += 1
    elif(score <= B):
        num[1] += 1
    else:
        num[2] += 1
max_value = num[2]
for i in range(2):
    if max_value > num[i]:
        max_value = num[i]
print(max_value)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())
num = []*3
for i in range(N):
    score = int(input())
    if (score <= A):
        num[0] += 1
    elif(score <= B):
        num[1] += 1
    else:
        num[2] +=1
max_value = 0
for i in range(3):
    if max_value < num[i]:
        max_value = num[i]
print(max_value)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())
num = []*3
for i in range(N):
    score = int(input())
    if (score <= A):
        num[0] += 1
    elif(score <= B):
        num[1] += 1
    else:
        num[2] +=1
print(min(num))
Problem p02639 (python)

Fixed submission:
X = list(map(int, input().split()))
if X[0] == 0:
    print(1)
elif X[1] == 0:
    print(2)
elif X[2] == 0:
    print(3)
elif X[3] == 0:
    print(4)
else:
    print(5)

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())
ans = 'No'
for a in range(X + 1):
    b = X - a
    if 2 * a + 4 * b == Y:
        ans = 'Yes'
        print(ans)
Problem p02784 (python)

Fixed submission:
h,n = map(int,input().split())
a = list(map(int,input().split()))
p = sum(a)
print("Yes" if h <= p else "No")

Buggy submission (verdict: Runtime Error):
h,n = map(int,input().split())
a = list(map(int,input().split()))
p = sum(a)
print("Yes" if h < =p else "No")
Problem p02983 (python)

Fixed submission:
L,R = map(int,input().split())
def judge_distance(i,j):
    if j-i >= 2019:
        return True

def search_2019(i,j):
    res = False
    for p in range(j-i+1):
        if i+p % 2019 == 0:
            res = True
            exit()

if judge_distance(L,R) or search_2019(L,R):
    print(0)
else:
    mincount = float("inf")
    for i in range(L,R):
        for j in range(L+1,R+1):
            if i*j%2019 <= mincount:
                mincount = (i*j)%2019

    print(mincount)

Buggy submission (verdict: Runtime Error):
L,R = map(int,input().split())
def judge_distance(i,j):
    if j-i >= 2019:
        return True

def search_2019(i,j):
    res = False
    for p in range(j-i+1):
        if i+p % 2019 == 0:
            res = True
            exit()

if judge_distance(L,R) or search_2019(L,R):
    print(0)
else:
    mincount = float("inf")
    for i in range(L,R):
        for j in range(L+1,R+1):
            if i*j%2019 <= mincount:
                mincount = (i*j)%2019

print(mincount)

Buggy submission (verdict: Runtime Error):
L,R = map(int,input().split())
def judge_distance(i,j):
    if j-i >= 2019:
        return True

def search_2019(i,j):
    for p in range(j-i+1):
        if i+p % 2019 == 0:
            return True

if judge_distance(L,R) or search_2019(L,R):
    print(0)
else:
    mincount = float("inf")
    for i in range(L,R):
        for j in range(L+1,R+1):
            if i*j%2019 <= mincount:
                mincount = (i*j)%2019

print(mincount)
Problem p02999 (python)

Fixed submission:
X,A = map(int,input().split())
print(0 if X < A else 10)

Buggy submission (verdict: Runtime Error):
import itertools
from collections import deque,defaultdict,Counter
from itertools import accumulate
import bisect
from heapq import heappop,heappush,heapify
from fractions import gcd
from copy import deepcopy
import math
import queue
import numpy as np
#import sympy as syp(素因数分解とか)
Mod = 1000000007
import sys
sys.setrecursionlimit(1000000) 
  
def sieve_of_eratosthenes(n):
    if not isinstance(n,int):
        raise TypeError("n is not int")
    if n<2:
        raise ValueError("n is not effective")
    prime = [1]*(n+1)
    for i in range(2,int(math.sqrt(n))+1):
        if prime[i] == 1:
            for j in range(2*i,n+1):
                if j%i == 0:
                    prime[j] = 0
    res = []
    for i in range(2,n+1):
        if prime[i] == 1:
            res.append(i)
    return res

def factorial(i):
    if i == 1:
        return 1
    else:
        return i*factorial(i-1)
 
class UnionFind:
    def __init__(self,n):
        self.parent = [i for i in range(n+1)]
        self.rank = [0 for i in range(n+1)]
    
    def findroot(self,x):
        if x == self.parent[x]:
            return x
        else:
            y = self.parent[x]
            y = self.findroot(self.parent[x])
            return y
    
    def union(self,x,y):
        px = self.findroot(x)
        py = self.findroot(y)
        if px < py:
            self.parent[py] = px
        else:
            self.parent[px] = py
 
    def same_group_or_no(self,x,y):
        return self.findroot(x) == self.findroot(y)




def main(): #startline--------------------------------------------
    n,m = map(int,input().split())
    s = list(map(int,input().split()))
    t = list(map(int,input().split()))
    dp = [[0]*(m+2) for i in range(n+2)]
    sdp = [[0]*(m+2) for i in range(n+2)]
    dp[0][0] = 1
    sdp[1][1] = 1
    for i in range(n+1):
        for j in range(m+1):
            if i == 0 and j == 0:continue
            if i>=1 and j >= 1 and s[i-1] == t[j-1]:
                dp[i][j] = sdp[i][j]%Mod
            sdp[i+1][j+1] = (sdp[i+1][j] + sdp[i][j+1] - sdp[i][j] + dp[i][j])%Mod

    print(sdp[n+1][m+1]%Mod)

if __name__ == "__main__":
    main() 
    
#endline===============================================
Problem p03001 (python)

Fixed submission:
W,H,x,y = map(int,input().split())
if x == W/2 and y == H/2:
    print(W*H/2,1)
else:
    print(W*H/2,0)

Buggy submission (verdict: Runtime Error):
W,H,x,y = map(int,input().spilt())
print(W*H/2,1 if (x == W/2 and y == H/2) else W*H/2,0)

Buggy submission (verdict: Runtime Error):
W,H,x,y = map(int,input().spilt())
print(W*H/2,1 if x == W/2 and y == H/2 else W*H/2,0)