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

Fixed submission:
from collections import defaultdict
from functools import lru_cache
import sys
sys.setrecursionlimit(1000000)


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

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

x_to_y = defaultdict(list)
for x, y in XY:
    x_to_y[x].append(y)


@lru_cache(N)
def depth(n):
    ret = -1
    for y in x_to_y[n]:
        ret = max(ret, depth(y))
    return ret + 1


        
depths = [depth(n) for n in range(1, N + 1)]
print(max(depths))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from functools import lru_cache
import sys
sys.setrecursionlimit(1000000)


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

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

x_to_y = defaultdict(list)
for x, y in XY:
    x_to_y[x].append(y)


@lru_cache(N)
def depth(n):
    ret = -1
    for y in x_to_y[n]:
        ret = max(ret, depth(y))
    return ret + 1


        
depths = [depth(n) for n in range(1, N + 1)]
print(max(depths), default=0)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from functools import lru_cache

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

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

x_to_y = defaultdict(list)
for x, y in XY:
    x_to_y[x].append(y)


@lru_cache(N)
def depth(n):
    ret = -1
    for y in x_to_y[n]:
        ret = max(ret, depth(y))
    return ret + 1


        
depths = [depth(n) for n in range(1, N + 1)]
print(max(depths), default=0)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from functools import lru_cache

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

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

x_to_y = defaultdict(list)
for x, y in XY:
    x_to_y[x].append(y)


@lru_cache(N)
def depth(n):
    ret = -1
    for y in x_to_y[n]:
        ret = max(ret, depth(y))
    return ret + 1


        
depths = [depth(n) for n in range(1, N + 1)]
print(max(depths))

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from functools import lru_cache

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

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

x_to_y = defaultdict(list)
for x, y in XY:
    x_to_y[x].append(y)


@lru_cache(N)
def depth(n):
    ret = -1
    for y in x_to_y[n]:
        ret = max(ret, depth(y))
    return ret + 1


        
depths = [depth(n) for n in range(1, N + 1)]
print(max(depths))
Problem p03167 (python)

Fixed submission:
from functools import lru_cache

MOD = pow(10, 9) + 7

H, W = map(int, input().split())
A = [input() for _ in range(H)]
dp = [ [0 for j in range(W + 1)] for i in range(H + 1)]

for w in range(1, W + 1):
    for h in range(1, H + 1):
        if w == 1 and h == 1:
            dp[1][1] = 1
            continue
 
        if A[h-1][w-1] == '.':
            dp[h][w] = (dp[h-1][w] + dp[h][w-1]) % MOD
            continue
        if A[h-1][w-1] == '#':
            dp[h][w]  = 0



print(dp[H][W])

Buggy submission (verdict: Runtime Error):
from functools import lru_cache

MOD = pow(10, 9) + 7

H, W = map(int, input().split())
A = [input() for _ in range(H)]

@lru_cache(maxsize=H*W)
def calc(h, w):
    if h == H -1 and w == W -1:
        return 1
    count = 0
    # right
    if w + 1 < W  and A[h][w + 1] == ".":
        count += calc(h, w + 1)
        count %= MOD

    if h + 1 < H  and A[h + 1][w] == ".":
        count += calc(h + 1, w)
        count %= MOD

    return count % MOD

for w in range(W):
    for h in range(H):
        calc(h, w)
print(calc(0,0))

Buggy submission (verdict: Runtime Error):
from functools import lru_cache

MOD = pow(10, 9) + 7

H, W = map(int, input().split())
A = [input() for _ in range(H)]

@lru_cache(maxsize=H*W)
def calc(h, w):
    if h == H -1 and w == W -1:
        return 1
    count = 0
    # right
    if w + 1 < W  and A[h][w + 1] == ".":
        count += calc(h, w + 1)
        count %= MOD

    if h + 1 < H  and A[h + 1][w] == ".":
        count += calc(h + 1, w)
        count %= MOD

    return count % MOD


print(calc(0,0))
Problem p03169 (python)

Fixed submission:
import sys
input = sys.stdin.readline

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

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


    one = A.count(1)
    two = A.count(2)
    three = A.count(3)

    for k in range(three + 1):
        for j in range(two + three + 1 - k):
            for i in range(one + two + three + 1 -k -j):
                if i == 0 and j == 0 and k == 0:
                    continue
                ret = N * 1.0
                if i > 0:
                    ret += dp[i - 1][j][k] * i
                if j > 0:
                    ret += dp[i + 1][j - 1][k] * j 
                if k > 0:
                    ret += dp[i][j + 1][k -1] * k

                dp[i][j][k] = ret / (i + j + k)

    print(dp[one][two][three])

main()

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

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


one = A.count(1)
two = A.count(2)
three = A.count(3)

for k in range(three + 1):
    for j in range(two + three + 1 - k):
        for i in range(one + two + three + 1 -k -j):
            if i == 0 and j == 0 and k == 0:
                continue
            ret = 0
            if i > 0:
                ret += dp[i - 1][j][k] * i
            if j > 0:
                ret += dp[i + 1][j - 1][k] * j 
            if k > 0:
                ret += dp[i], [j + 1], [k -1] * k

            ret += N
            ret *= 1.0 / (i + j + k)
            dp[i][j][k] = ret

print(dp[one][two][three])

Buggy submission (verdict: Runtime Error):
from functools import lru_cache

N = int(input())

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

@lru_cache(maxsize=N*4)
def calc(i, j, k):
    if i == 0 and j == 0 and k == 0:
        return 0
    ret = 0
    if i > 0:
        ret += calc(i - 1, j, k) * i
    if j > 0:
        ret += calc(i + 1, j - 1, k) * j 
    if k > 0:
        ret += calc(i, j + 1, k -1) * k

    ret += N
    ret *= 1.0 / (i + j + k)
    return ret


one = A.count(1)
two = A.count(2)
three = A.count(3)

ret = calc(one,two,three)
print(ret)
Problem p03309 (python)

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

def sunuke(b):
    ret = 0
    sub = 1
    for a in A:
        ret += abs(a - (b+ sub))
        sub += 1
    return ret


B = []

sub = 1
for a in A:
    b = a - sub
    B.append(b)
    sub += 1

B.sort()
b1 = N // 2
if N < 3:
    print(sunuke(B[b1]))
    exit()

b2 = b1 + 1
b1_s = sunuke(B[b1])
b2_s = sunuke(B[b2])
if b1_s < b2_s:
    print(b1_s)
else:
    print(b2_s)

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

def sunuke(b):
    ret = 0
    sub = 1
    for a in A:
        ret += abs(a - (b+ sub))
        sub += 1
    return ret


B = []

sub = 1
for a in A:
    b = a - sub
    B.append(b)
    sub += 1

B.sort()
b1 = N // 2
b2 = b1 + 1

b1_s = sunuke(B[b1])
b2_s = sunuke(B[b2])
if b1_s < b2_s:
    print(b1_s)
else:
    print(b2_s)
Problem p03331 (python)

Fixed submission:
import math


def digitSum(n):
    count = 0
    while n != 0:
        count += n % 10
        n //= 10
    return count


n =  int(input())


# 0が多くなるようにする
ans = digitSum(n)
if ans == 1:
    print(10)
else :
    print(ans)

Buggy submission (verdict: Runtime Error):
import math

base = 998244353

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

fac = [1] * (n + 1)
rev = [1] * (n + 1)
for i in range(1, n + 1):
    fac[i] = fac[i - 1] * i % base
    rev[i] = pow(fac[i], base -2, base)



def comb(n,r):
    hoge = (fac[n] * rev[r] * rev[n - r] ) % base
    return hoge





count = 0

an = 0 

for an in range(n+1):
    if k - an * a < 0 or (k - an * a) % b != 0:
        continue
    bn = (k -an * a) // b
    if not 0 <= bn <= n:
        continue

    count += comb(n, an) * comb(n, bn) % base
    count %= base



print(count)
Problem p03338 (python)

Fixed submission:
n = int(input())
s = input()


count_list = []
for index in range(1, len(s)):
    a = s[:index]
    b = s[index:]

    kind_a = set(a)
    kind_b = set(b)

    count = 0
    for c in kind_a:
        if c in kind_b:
            count+=1
    count_list.append(count)

print(max(count_list))

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


count_list = []
for index in range(1, len(s) - 1):
    a = s[:index]
    b = s[index:]

    kind_a = set(a)
    kind_b = set(b)

    count = 0
    for c in kind_a:
        if c in kind_b:
            count+=1
    count_list.append(count)

print(max(count_list))
Problem p03340 (python)

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

count = 0

xor_temp = 0
sum_temp = 0

r = 0
for l in range(n):
    while r < n and xor_temp^a[r]  == sum_temp + a[r]:
        xor_temp ^= a[r]
        sum_temp += a[r]
        r += 1

    xor_temp ^= a[l]
    sum_temp -= a[l]
    count += r - l

print(count)

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

count = 0

xor_temp = 0
sum_temp = 0

r = 0
for l in range(n):
    while r < N and xor_temp^a[r]  == sum_temp + a[r]:
        xor_temp ^= a[r]
        sum_temp += a[r]
        r += 1

    xor_temp ^= a[l]
    sum_temp -= a[l]
    ans += r - l

print(count)
Problem p03353 (python)

Fixed submission:
s = input()
k = int(input())


sublist = []
for start in range(len(s)):
    end = min(start + k, len(s))
    for end in range(start+1, end + 1):
        sublist.append(s[start:end])

unique = sorted(list(set(sublist)))
print(unique[k-1])

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())


# alphabet順に探査する
# 探査順序配列
search_seq = sorted(list(set(s)))

count = 0
previous = 0

for key in search_seq:
    previous = count
    indexes = [i for i, x in enumerate(s) if x == key]
    sublist = []
    for index in indexes:
        stop = min(len(s) - index, k)
        for end in range(index+1, index + stop + 1):
            sublist.append(s[index:end])
    count += len(sublist)
    if k-1 < count:
        list_uq = list(set(sublist))
        list_sorted = sorted(list_uq)
        print(list_sorted[k-previous-1])
        exit()

Buggy submission (verdict: Runtime Error):

    
s = input()
k = int(input())


# alphabet順に探査する
# 探査順序配列
search_seq = sorted(list(set(s)))

count = 0
previous = 0

for key in search_seq:
    previous = count
    indexes = [i for i, x in enumerate(s) if x == key]
    sublist = []
    for index in indexes:
        for end in range(index+1, len(s) + 1):
            sublist.append(s[index:end])
    count += len(s)
    if k-1 < count:
        list_uq = list(set(sublist))
        list_sorted = sorted(list_uq)
        print(list_sorted[k-previous-1])
        exit()

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())


# alphabet順に探査する
# 探査順序配列
search_seq = sorted(list(set(s)))

count = 0
previous = 0

for key in search_seq:
    previous = count
    indexes = [i for i, x in enumerate(s) if x == key]
    sublist = []
    for index in indexes:
        for end in range(index+1, len(s) + 1):
            sublist.append(s[index:end])
    count += len(s)
    if k < count:
        list_uq = list(set(sublist))
        list_sorted = sorted(list_uq)
        print(list_sorted[k-previous-1])
        exit()
Problem p03361 (python)

Fixed submission:

h, w = map(int, input().split())
s = [["." for _ in range(w + 2)]]

for _ in range(h):
    s_ = ["."]
    s_.extend([x for x in input()])
    s_.append(".")
    s.append(s_)

s.append(["." for _ in range(w + 2)])


for x in range(h):
    for y in range(w):
        target_x = x + 1
        target_y = y + 1
        # cross check
        if s[target_x][target_y]  == "#":
            if s[target_x - 1][target_y] == "#" or s[target_x + 1][target_y] == "#" or s[target_x][target_y -1 ] == "#" or  s[target_x][target_y +1 ] == "#":
                pass
                # ok
            else:
                # ng
                print("No")
                exit()
print("Yes")

Buggy submission (verdict: Runtime Error):

h, w = map(int, input().split())
s = [["." for _ in range(w + 2)]]

for _ in range(h):
    s_ = ["."]
    s_.extend([x for x in input()])
    s_.append(".")
    s.append(s_)

s.append(["." for _ in range(w + 2)])


for y in range(h):
    for x in range(w):
        target_x = x + 1
        target_y = y + 1
        # cross check
        if s[target_x][target_y]  == "#":
            if s[target_x - 1][target_y] == "#" or s[target_x + 1][target_y] == "#" or s[target_x][target_y -1 ] == "#" or  s[target_x][target_y +1 ] == "#":
                pass
                # ok
            else:
                # ng
                print("No")
                exit()
print("Yes")
Problem p03362 (python)

Fixed submission:
import array
import itertools


def sieve_of_eratosthenes(end, typecode="L"):
    assert end > 1
    # 整数iが素数であるかをis_prime[i]が示す
    # 最初はすべてTrueで初期化しておく
    # 最終的にprimesではなくこれを返してもよい
    is_prime = array.array("B", (True for i in range(end)))
    # 0, 1はいずれも素数ではない
    is_prime[0] = False
    is_prime[1] = False
    # 素数を格納する配列
    primes = array.array(typecode)
    # 篩う
    for i in range(2, end):
        if is_prime[i]:  # iが素数であるとき
            primes.append(i)  # 素数の配列に加える
            for j in range(2 * i, end, i):  # iを超えるiの倍数について
                is_prime[j] = False  # 素数ではないため除外する
    return primes

primes = sieve_of_eratosthenes(55555)


n = int(input())
ret = []
count = 0
for _ in range(n):
    while(True):
        if primes[count] % 5==1:
            ret.append(primes[count])
            count += 1
            break
        count += 1
print(" ".join(map(str, ret)))

Buggy submission (verdict: Runtime Error):
import array
import itertools


def is_merged(n):
    end = n // 2 
    for dev in range(2, end + 1):
        if n % dev == 0:
            return True
    return False


def sieve_of_eratosthenes(end, typecode="L"):
    assert end > 1
    # 整数iが素数であるかをis_prime[i]が示す
    # 最初はすべてTrueで初期化しておく
    # 最終的にprimesではなくこれを返してもよい
    is_prime = array.array("B", (True for i in range(end)))
    # 0, 1はいずれも素数ではない
    is_prime[0] = False
    is_prime[1] = False
    # 素数を格納する配列
    primes = array.array(typecode)
    # 篩う
    for i in range(2, end):
        if is_prime[i]:  # iが素数であるとき
            primes.append(i)  # 素数の配列に加える
            for j in range(2 * i, end, i):  # iを超えるiの倍数について
                is_prime[j] = False  # 素数ではないため除外する
    return primes

primes = sieve_of_eratosthenes(55555)



def is_merged(n):
    count = 0
    half = n // 2
    while(primes[count] <  half):
        if n % primes[count] == 0:
            return True
        count += 1
    return False




n = int(input())
ret = []
count = 0
for n in range(n):
    while(True):
        if prime[count] % 2 ==0:
            ret.append(prime(count))
            break
        count += 1
print(" ".join(map(str, ret)))
Problem p03363 (python)

Fixed submission:
import numpy
from scipy.misc import comb
import math
import collections

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

cumulative_sum = numpy.cumsum(a)
cumulative_sum = numpy.append(cumulative_sum, 0)
count = collections.Counter(cumulative_sum)

ret = 0
for v in count.values():
    if v < 2:
        continue
    ret += math.factorial(v) // (math.factorial(v - 2) * math.factorial(2)) 
print(ret)

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

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

cumulative_sum = numpy.cumsum(a)
cumulative_sum = numpy.append(cumulative_sum, 0)
count = collections.Counter(cumulative_sum)

ret = 0
for v in count.values():
    ret += int(comb(v, 2))
print(ret)
Problem p03388 (python)

Fixed submission:
q = int(input())
ab = [tuple(map(int, input().split())) for _ in range(q)]



for a, b in ab:
    if a > b:
        large = a
        small = b
    elif a < b:
        large = b
        small = a
    else:
        print(2* a - 2)
        continue


    # 最大のxを探す
    low_x = 0 
    upper_x = large - small + 1

    while upper_x- low_x> 1:
        mid_x = (low_x + upper_x ) //2

        # a * bを満たすかチェック
        is_ok = True
        for i in range(mid_x // 2 -2, mid_x //2 +3) :
            if i< 0 and b -a < i:
                continue
            if (small + i) * (small + mid_x - i) >= large* small:
                is_ok = False
                break

        if is_ok:
            low_x = mid_x
            x = mid_x
        else:
            upper_x = mid_x
            x= mid_x


    print(2 * small -2  + low_x)

Buggy submission (verdict: Runtime Error):
q = int(input())
ab = [tuple(map(int, input().split())) for _ in range(q)]



for a, b in ab:
    if a > b:
        large = a
        small = b
    elif a < b:
        large = b
        small = a
    else:
        print(2* a - 2)
        sys.exit()


    # 最大のxを探す
    low_x = 0 
    upper_x = large - small + 1

    while upper_x- low_x> 1:
        mid_x = (low_x + upper_x ) //2

        # a * bを満たすかチェック
        is_ok = True
        for i in range(low_x, upper_x + 1):
            if i< 0 and b -a < i:
                continue
            if (small + i) * (small + mid_x - i) >= large* small:
                is_ok = False
                break

        if is_ok:
            low_x = mid_x
            x = mid_x
        else:
            upper_x = mid_x
            x= mid_x


    print(2 * small -2  + low_x)

Buggy submission (verdict: Runtime Error):
q = int(input())
ab = [tuple(map(int, input().split())) for _ in range(q)]



for a, b in ab:
    if a > b:
        large = a
        small = b
    elif a < b:
        large = b
        small = a
    else:
        print(2* a - 2)


    # 最大のxを探す
    low_x = 0 
    upper_x = large - small + 1

    while upper_x- low_x> 1:
        mid_x = (low_x + upper_x ) //2

        # a * bを満たすかチェック
        is_ok = True
        #for i in range(low_x, upper_x + 1):
        for i in range(mid_x // 2 -2 , mid_x // 2+3):
            if i< 0 and b -a < i:
                continue
            if (small + i) * (small + mid_x - i) >= large* small:
                is_ok = False
                break

        if is_ok:
            low_x = mid_x
            x = mid_x
        else:
            upper_x = mid_x
            x= mid_x


    print(2 * small -2  + low_x)
Problem p02887 (python)

Fixed submission:

N=int(input())
li=list(input())

tmp='0'
cnt=0
 
for i in range(N):
    if li[i]!=tmp:
        cnt+=1
        tmp=li[i]
print(cnt)

Buggy submission (verdict: Runtime Error):
N=int(input())
li = input().split()	

tmp='0'
cnt=0

for i in range(N):
	if li[i]!=tmp:
    	cnt+=1
        tmp=li[i]
print(cnt)
Problem p02999 (python)

Fixed submission:
x,y=map(int,input().split())
if x >= y:
  print(10)
else: print(0)

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

D=0
c=1

for i in range(N):
    D=D+L[i]
    if D<=X:
        c=c+1
    else: break

print(c)
Problem p03001 (python)

Fixed submission:

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

Buggy submission (verdict: Runtime Error):
W,H,x,y = map(int,input().split())

print(X*H/2)

if x*2==W and y*2==H:
  print(1)
else:
  print(0)
Problem p03085 (python)

Fixed submission:
s=input()

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

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

if s=='A':
	print 'T'
elif s=='T':
  	print 'A'
elif s=='G':
 	print 'C'
elif s=='C':
	print 'G'
Problem p02909 (python)

Fixed submission:
s=input()
print('Sunny' if s=='Rainy' else 'Cloudy' if s=='Sunny' else'Rainy')

Buggy submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
a=list(int(input()) for i in range(q))

if k>q:
    for i in range(n):
        print('Yes')
else:
    for i in range(n):
        ans=a.count(i+1)
        if ans+k>q:
            print('Yes')
        else:
            print('No')

Buggy submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
a=list(int(input()) for i in range(q))

if k>q:
    for i in range(n):
        print('Yes')
else:
    for i in range(n):
        ans=a.count(i+1)
        if ans+k>q:
            print('Yes')
        else:
            print('No')
Problem p02969 (python)

Fixed submission:
r=int(input())
s=3*r**2
print(s)

Buggy submission (verdict: Runtime Error):
r=int(input())
print=(3r**2)
Problem p03371 (python)

Fixed submission:
a,b,c,x,y=map(int,input().split())
ans=10000000000
for i in range(0,max(x,y)*2+1,1):
    if x-i/2<=0 and y-i/2<=0:
        aa=0
        bb=0
    elif x-i/2<=0 and y-i/2>0:
        aa=0
        bb=y-i/2
    elif y-i/2<=0 and x-i/2>0:
        aa=x-i/2
        bb=0
    else:
        aa=x-i/2
        bb=y-i/2
    ab=aa*a+bb*b+i*c
    ans=min(ans,ab)
print(int(ans))

Buggy submission (verdict: Runtime Error):
    else:
Problem p03455 (python)

Fixed submission:
a, b = map(int, input().split())
if (a*b) % 2==0:
    print("Even")
else: 
    print("Odd")

Buggy submission (verdict: Runtime Error):
if a*b%2==0 :
    print('odd'):

else:
    print('Even')
Problem p03861 (python)

Fixed submission:
a,b,x=map(int,input().split())
if a%x==0:
    print(b//x-(a-1)//x)
else:
    print(b//x-a//x)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
ans=k
for i in range(n-1):
    ans=ans*(k-1)
print(ans)
Problem p04030 (python)

Fixed submission:
s=input()
a=[]
for i in s:
    if i=='0':
        a.append(i)
    elif i=='1':
        a.append(i)
    else:
        if len(a)!=0:
            a.pop(-1)
print(''.join(a))

Buggy submission (verdict: Runtime Error):
s=input()
a=[]
for i in s:
    if i=='0':
        a.append(i)
    elif i=='1':
        a.append(i)
    else:
        a.pop(-1)
print(''.join(a))
Problem p02924 (python)

Fixed submission:
n=int(input())
n-=1
print(n*(n+1)//2)

Buggy submission (verdict: Runtime Error):
import numpy as np
x = np.arange(int(input()))
print(np.sum(x))
Problem p02983 (python)

Fixed submission:
l, r = map(int, input().split())
ans = 2019
for i in range(l, r):
  for j in range(i+1, r+1):
    tmp = i*j % 2019
    if ans > tmp:
      ans = tmp
    if ans == 0:
      print(ans)
      exit()
print(ans)

Buggy submission (verdict: Runtime Error):
l, r = map(int, input().split())
num = 2019
if (l<=673<=r and r-l>=3) or (r-l>=673):
  print(0)
else:
  mods = []
  for i in range(l, r):
    for j in range(i+1, r+1):
      m = (i*j) % num
      mods.append(m)
      if m == 1:
        print(1)
        exit()
print(min(mods))
Problem p02988 (python)

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

for i in range(1, A-1):
  if B[i-1] > B[i] > B[i+1]:
    ans += 1
  elif B[i-1] < B[i] < B[i+1]:
    ans += 1
    
print(ans)

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

for i in range(1, A-1):
  if B[i-1] > B[i] > B[i+1]:
    s += 1
  elif B[i-1] < B[i] < B[i+1]:
    s+=1
    
print(s)

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

for i in range(1,A-1):
  if B[i-1] > B[i] > B[i+1]:
    s += 1
  elif B[i-1] < B[i] < B[i+1]:
    s += 1
    
print(s)
Problem p02999 (python)

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

Buggy submission (verdict: Runtime Error):
x, a = map(int, input().split())
print(19 x>=a else 0)

Buggy submission (verdict: Runtime Error):
X, A = list(map(int, input().split()))
if X < A:
  print(0)
elif X => A:
  print(10)
Problem p03210 (python)

Fixed submission:
x = input()
print('YES' if x in '753' else 'NO')

Buggy submission (verdict: Runtime Error):
print('YES' if input() in '753' else 'NO')i