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

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np

L, R = list(map(int, input().split()))

if R-L >= 2019:
    print(0)
else:
    tmp = []
    for i in range(L, R):
        for j in range(i+1, R+1):
            tmp.append((i * j) % 2019)
    print(min(tmp))

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

L, R = list(map(int, input().split()))

if R-L >= 2019:
    print(0)
else:
    tmp = np.array(range(L, R+1))
    tmp = tmp % 2019
    tmp = np.sort(tmp)

print(tmp[0] * tmp[1])
Problem p03014 (python)

Fixed submission:
# -*- coding: utf-8 -*-
import numpy as np

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

L = np.zeros([H, W], dtype=int)
R = np.zeros([H, W], dtype=int)
U = np.zeros([H, W], dtype=int)
D = np.zeros([H, W], dtype=int)

S_ = np.zeros([H, W], dtype=int)
for h in range(H):
    for w in range(W):
        if S[h][w] == '#': S_[h, w] = 0
        else: S_[h, w] = 1
L[:, 0] = S_[:, 0]
for w in range(1, W):
    L[:, w] = (L[:, w-1] + 1) * S_[:, w]
R[:, W-1] = S_[:, W-1]
for w in range(W-2, -1, -1):
    R[:, w] = (R[:, w+1] + 1) * S_[:, w]
U[0] = S_[0]
for h in range(1, H):
    U[h] = (U[h-1] + 1) * S_[h]
D[H-1] = S_[H-1]
for h in range(H-2, -1, -1):
    D[h] = (D[h+1] + 1) * S_[h]

L = np.array(L)
R = np.array(R)
U = np.array(U)
D = np.array(D)
print(np.max(L+R+U+D)-3)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
import numpy as np

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

L = np.zeros([H, W], dtype=int)
R = np.zeros([H, W], dtype=int)
U = np.zeros([H, W], dtype=int)
D = np.zeros([H, W], dtype=int)

S_ = np.zeros([H, W], dtype=int)
for h in range(H):
    for w in range(W):
        if S[h][w] == '#': S_[h, w] = 0
        else: S_[h, w] = 1
L[:, 0] = S_[:, 0]
for w in range(1, W):
    L[:, w] = (L[:, w-1] + 1) * S_[:, w]
R[:, W-1] = S_[:, W-1]
for w in range(W-2, -1, -1):
    R[:, w] = (R[:, w+1] + 1) * S_[:, w]
U[0] = S_[0]
for h in range(1, H):
    U[h] = (U[h-1] + 1) * S_[h]
D[H-1] = S_[H-1]
for h in range(H-2, -1, -1):
    D[h] = (D[h+1] + 1) * S_[h]

L = np.array(L)
R = np.array(R)
U = np.array(U)
D = np.array(D)
print(np.max(L+R+U+D)-3)
Problem p03031 (python)

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

inputs = input().split(' ')
N = int(inputs[0])
M = int(inputs[1])

lights = []
for i in range(M):
    switch = input().split(' ')[1:]
    switch = [int(s) for s in switch]
    lights.append(switch)

p = input().split(' ')
p = [int(x) for x in p]

combi = 0
for i in range(2**N):
    i = str(bin(i)).split('0b')[1]
    if len(i) < N:
        i = '0'*(N-len(i)) + i
    flag = True
    for j, switch in enumerate(lights):
        on = 0
        for s in switch:
            if i[s-1] == '1':
                on += 1
        if (on%2) != p[j]:
            flag = False
            break
    if flag:
        combi += 1

print(combi)

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

N, M = map(int, input().split())
lights = [map(int, input().split()[1:]) for i in range(M)]
p = map(int, input().split())

combi = 0
for i in range(1<<N):
    flag = True
    for j, switch in enumerate(lights):
        if sum([1 for s in switch if (i>>(s-1)) & 1 == 1])%2 != p[j]:
            flag = False
            break
    if flag:
        combi += 1

print(combi)
Problem p02957 (python)

Fixed submission:
a,b=[int(x) for x in input().split()] 
c=(a+b)/2
k=(a+b)//2
if(k==c):
  if(abs(a-k)==abs(b-k)):
     print(k)
else:
     print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=(a+b)//2
k=(a+b)/2
if(c==k):
    print(k)
else:
    print("IMPOSSIBLE")
Problem p03029 (python)

Fixed submission:
a, p = map(int, input().split())
c = int((3*a+p) / 2)
print("{}".format(c))

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
print("{}".format((3A+b)/2))

Buggy submission (verdict: Runtime Error):
printf((3A + P)/2)
Problem p02957 (python)

Fixed submission:
a, b = input().split()
a, b = int(a), int(b)
if (a + b) % 2 == 0:
    print((a + b) // 2)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a, b = int(input())
a, b = int(a), int(b)
if (a + b) % 2 == 0:
  	print((a + b) // 2)
else:
  	print("IMPOSSIBLE")
Problem p03029 (python)

Fixed submission:
#!/usr/bin/python
# coding: UTF-8

a,p = input().split()

a = int(a)
p = int(p)

print((3 * a + p) // 2)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/python
# coding: UTF-8
 
n,m = map(int,input().split())
 
s = []
for i in range(m):
    s += [tuple(map(int,input().split())),]
 
p = list(map(int,input().split()))
 
ret = 0
all = [(str(bin(i)))[2:].zfill(n) for i in range(2 ** n)]
all = [[int(i) for i in case] for case in all]
for case in all:
    flag = 0
    for num,i in enumerate(s):
 
        sw = [0 for z in range(n)]
        for k in i[1:]:
            sw[k-1] = 1
 
        if (sum(i*j for i,j in zip(sw,case)) % 2) != p[num]:
            flag = 1
           
    if flag == 0:
        ret += 1
 
print(ret)
Problem p03031 (python)

Fixed submission:
#!/usr/bin/python
# coding: UTF-8

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

s = []
for i in range(m):
    s += [tuple(map(int,input().split())),]

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

ret = 0
all = [(str(bin(i)))[2:].zfill(n) for i in range(2 ** n)]
all = [[int(i) for i in case] for case in all]
for case in all:
    flag = 0
    for num,i in enumerate(s):
        if flag == 1:
            continue

        sw = [0 for z in range(n)]
        for k in i[1:]:
            sw[k-1] = 1

        if (sum(i*j for i,j in zip(sw,case)) % 2) != p[num]:
            flag = 1
           
    if flag == 0:
        ret += 1

print(ret)

Buggy submission (verdict: Runtime Error):
#!/usr/bin/python
# coding: UTF-8

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

s = []
for i in range(m):
    s += [tuple(map(int,input().split())),]

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

ret = 0
all = [(str(bin(i)))[2:].zfill(m) for i in range(2 ** n),]
all = [[int(i) for i in case] for case in all,]
for case in all:
    # print("------------------------------------------------")
    # print("[case = ",case,"]")
    flag = 0
    for num,i in enumerate(s):
        if flag == 1:
            continue

        # print("  [case = ",i[1:],"]")

        sw = [0 for z in range(n),]
        # print("sw",sw)
        for k in i[1:]:
            sw[k-1] = 1

        # print(sw,case)
        # print(sum(i*j for i,j in zip(sw,case)) % 2," =? ",p[num])
        if (sum(i*j for i,j in zip(sw,case),) % 2) != p[num]:
            flag = 1
        # print("flag is ",flag)
           
    if flag == 0:
        # print(case," is ok.")
        ret += 1

print(ret)
Problem p03219 (python)

Fixed submission:
a,b = map(int, input().split())
print(a+(b//2))

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

PY_list = []
for num,i in enumerate(range(M)):
    p,y = map(int, input().split())
    PY_list = PY_list + [(num,p,y),]

rec = []
for i in range(N):
    cities = []
    for k in PY_list:
        if k[1] == i+1:
            cities = cities + [k,]
    cities = sorted(cities, key=lambda x:x[2])

    rec_list = []
    for num,k in enumerate(cities):
        rec_list = rec_list + [(k[0],str(k[1]).zfill(6) + str(num+1).zfill(6)),]

    rec = rec + rec_list
rec = sorted(rec, key=lambda x:x[0])

for s in rec:
    print(s[1])
Problem p03238 (python)

Fixed submission:
n = input()

if n == "1":
  print("Hello World")
  
elif n == "2":
  a = int(input())
  b = int(input())
  print(a + b)

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

if n == 1:
    print("Hello World")
elif n == 2:
    print(a + b)

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

if n == "1":
    print("Hello World")
elif n == "2":
    print(a + b)

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

if n == 1:
  print("Hello World")
elif n == 2:
  print(a + b)
Problem p04047 (python)

Fixed submission:
n = int(input())
l = map(int, input().split())
l = sorted(l)

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

print(ans)

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

ans = 0
for i in range(len(n)):
  a = l[2*i]
  b = l[2*i+1]
  ans =+ min(a,b)

print(ans)
Problem p03060 (python)

Fixed submission:
n = int(input(), 10) 
v = list(map(int, input().split())) 
c = list(map(int, input().split())) 
otoku = []
 
for i in range(n):
  otoku.append(v[i] - c[i])
 
res = 0
for j in range(n):
  if otoku[j] > 0:
    res += otoku[j]
    
print(res)

Buggy submission (verdict: Runtime Error):
n = input() 
v = list(map(int, input().split())) 
c = list(map(int, input().split())) 
otoku = []

for i in range(n):
  otoku.append(v[i] - c[i])

res = 0
for j in range(n):
  if otoku[j] > 0:
    res += otoku[j]
    
print(res)
Problem p03061 (python)

Fixed submission:
n = int(input(), 10)
a = list(map(int, input().split()))
greatCDlist = []


def gcd(m, n):
    if m < n:
        m ^= n
        n ^= m
        m ^= n
    if n == 0:
        return m
    else:
        return gcd(n, m % n)


left = [0 for i in range(n+1)]
right = [0 for i in range(n+1)]

for i in range(n):
    left[i+1] = gcd(left[i], a[i])


for i in range(n-1, -1, -1):
    right[i] = gcd(right[i+1], a[i])


result = 0
for i in range(n):
    l = left[i]
    r = right[i+1]
    result = max(result, gcd(l, r))

print(result)

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

for i in range(n):
  pop = a.pop(i)
  greatCD = 1
  for j in range(n):
    if j == 0:
      greatCD = gcd(a[0], a[1])
    else:
      greatCD = gcd(greatCD, a[j])
  a.insert(i, pop)
  greatCDlist.append(greatCD)

maxg = 1
for i in range(n):
  if maxg > greatCDlist[i]:
    maxg = greatCDlist[i]

print(maxg)


def gcd(m, n):
  if m < n:
    m ^= n
    n ^= m
    m ^= n
  if n == 0:
    return m
  else:
    return gcd(n, n % m)

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

for i in range(n):
  pop = a.pop(i)
  greatCD = 1
  for j in range(n):
    if j == 0:
		greatCD = gcd(a[0], a[1])
    else:
      greatCD = gcd(greatCD, a[j])
  a.insert(i, pop)
  greatCDlist.append(greatCD)

maxg = 1
for i in range(n):
  if maxg > greatCDlist[i]:
    maxg = greatCDlist[i]

print(maxg)


def gcd(m, n):
  if m < n:
    m ^= n
    n ^= m
    m ^= n
  if n == 0:
    return m
  else:
    return gcd(n, n % m)
Problem p02957 (python)

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

A = i[0]
B = i[1]

k = (A + B) / 2

if k.is_integer() == False:
	print("IMPOSSIBLE")
else:
	print(int(k))

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

A = i[0]
B = i[1]

k = (A + B) / 2

if k.is_integer() == False:
	print(IMPOSSIBLE)
else:
	print(int(k))
Problem p02957 (python)

Fixed submission:
A , B = [int(i) for i in input().split()]

if B>A:    
    if (B-A)%2==0:
        print(int((B-A)/2+A))
    else:
        print("IMPOSSIBLE")
else:
    if (A-B)%2==0:
        print(int((A-B)/2+B))
    else:
        print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
A , B = [int(i) for i in input().split()]

if B>A:    
    if (B-A)%2==0:
        print(int((B-A)/2+A)
    else:
        print("IMPOSSIBLE")
else:
    if (A-B)%2==0:
        print(int((A-B)/2+B)
    else:
        print("IMPOSSIBLE")
Problem p02983 (python)

Fixed submission:
L, R = [int(i) for i in input().split()]
min = 2018
for i in range(L,R):
    for j in range(i+1,R+1):
        mod = (i*j)%2019
        if mod<min:
            min = mod
        if mod==0:
            print("{}".format(mod))
            exit()
print("{}".format(min))

Buggy submission (verdict: Runtime Error):
L, R = [int(i) for i in input().split()]
min = 2018
if (R-L)>=2019:
    a = (R-L)/2019
    R = R-2019*a
for i in range(L,R):
    for j in range(i+1,R+1):
        mod = (i*j)%2019
        if(mod<min):
            min = mod
print("{}".format(min))

Buggy submission (verdict: Runtime Error):
L, R = [int(i) for i in input().split()]
min = 2018
if (R-L)>=2019:
    a = R/2019
    R = R-2019*a
for i in range(L,R):
    for j in range(i+1,R+1):
        mod = (i*j)%2019
        if(mod<min):
            min = mod
print("{}".format(min))
Problem p03289 (python)

Fixed submission:
a = str(input())

if a[0]=="A":
    if "C" in a[2:len(a)-1]:
        ad = a[1:].replace("C","")
        if len(ad)==len(a)-2:
            if ad.islower():
                print("AC")
            else:
                print("WA")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")

Buggy submission (verdict: Runtime Error):
a = str(input())

if a[0]=="A":
    if "C" in a[2:len(a)-1]:
        if len(ad)==len(a)-2:
            ad = a[1:].replace("C","")
            if ad.islower():
                print("AC")
            else:
                print("WA")
        else:
            print("WA")
    else:
        print("WA")
else:
    print("WA")
Problem p02985 (python)

Fixed submission:
#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**7)


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


MOD = 10**9 + 7


def dfs(colors, graph, parent, current):
    if colors < len(graph[current]):
        return 0

    num_avail_colors = colors - 1 if parent < 0 else colors - 2
    num_cases = 1
    neighbors = graph[current]
    for neighbor in neighbors:
        if neighbor == parent:
            continue

        num_cases *= num_avail_colors
        num_avail_colors -= 1
        num_cases %= MOD

    for neighbor in neighbors:
        if neighbor == parent:
            continue

        num_cases *= dfs(colors, graph, current, neighbor)
        num_cases %= MOD

    return num_cases


def main():
    N, K = read_h()
    graph = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = read_h()
        graph[a - 1].append(b - 1)
        graph[b - 1].append(a - 1)

    ans = K * dfs(K, graph, -1, 0) % MOD
    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


MOD = 10**9 + 7


def dfs(colors, graph, parent, current):
    if colors < len(graph[current]):
        return 0

    num_avail_colors = colors - 1 if parent < 0 else colors - 2
    num_cases = 1
    neighbors = graph[current]
    for neighbor in neighbors:
        if neighbor == parent:
            continue

        num_cases *= num_avail_colors
        num_avail_colors -= 1
        num_cases %= MOD

    for neighbor in neighbors:
        if neighbor == parent:
            continue

        num_cases *= dfs(colors, graph, current, neighbor)
        num_cases %= MOD

    return num_cases


def main():
    N, K = read_h()
    graph = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b = read_h()
        graph[a - 1].append(b - 1)
        graph[b - 1].append(a - 1)

    ans = K * dfs(K, graph, -1, 0) % MOD
    print(ans)


if __name__ == '__main__':
    main()
Problem p03739 (python)

Fixed submission:
#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**7)


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def solve(arr, positive):
    num_op = 0
    cumul = 0
    #  print('current cumul:', cumul)

    for a in arr:
        cumul += a

        if positive and cumul >= 0:
            num_op += 1 + cumul
            cumul = -1
        elif not positive and cumul <= 0:
            num_op += 1 - cumul
            cumul = 1

        positive = not positive

    return num_op


def main():
    read_h()
    arr = read_h()

    op_plus = solve(arr, True)
    #  print('op plus:', op_plus)
    op_minus = solve(arr, False)
    #  print('op minus:', op_minus)

    print(min(op_plus, op_minus))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**7)


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h() if m > 1 else typ(input()) for _ in range(n)]


def calc_num_op(cumul, a):
    assert cumul != 0
    tmp_cumul = cumul + a
    #  print('current cumul:', cumul)
    #  print('current a:', a)
    #  print('bare cumul:', tmp_cumul)
    if (cumul < 0 and tmp_cumul <= 0):
        return abs(-cumul - a + 1), 1
    if (cumul > 0 and tmp_cumul >= 0):
        return abs(-cumul - a - 1), -1
    return 0, tmp_cumul


def solve(arr, sign):
    num_op = 0
    cumul = arr[0]
    for a in arr[1:]:
        delta, cumul = calc_num_op(cumul, a)
        #  print('delta:', delta)
        #  print('modified cumul:', cumul)
        num_op += delta
        sign = '+' if sign == '-' else '-'
    return num_op


def main():
    _ = read_h()
    arr = read_h()

    op_plus = solve(arr, '+')
    #  print('op plus:', op_plus)
    op_minus = solve(arr, '-')
    #  print('op minus:', op_minus)

    print(min(op_plus, op_minus))


if __name__ == '__main__':
    main()
Problem p03433 (python)

Fixed submission:
n = int(input())
a = int(input())
 
if n % 500  <=a:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b =[int(input() for i in range(2))]
c = a//500
if c <= b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a, b =int(input() for i in range(2))
c = a//500
if c <= b:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N =input()
A = input()
M = N//500
if M >= A:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
N,A =map(int,input().split())
M = N//500
if M >= A:
  print("Yes")
else:
  print("No")
Problem p03485 (python)

Fixed submission:
a,b=map(int,input().split())
print((a+b+1)//2)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
x = int((a+b)//2 + 1)
print(x)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
x = (a+b)//2 + 1
print(x)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
x = -(-(a+b)//2)
print(x)
Problem p03485 (python)

Fixed submission:
import math
x,y=[int(i) for i in input().split()]
print(int(math.ceil((x + y) / 2)))

Buggy submission (verdict: Runtime Error):
import math

input_data = input()

for line in input_data:
    datas = line.split(" ")
    datas = [int(x) for x in datas]
    print(int(math.floor((datas[0] + datas[1]) / 2)))
Problem p03047 (python)

Fixed submission:
#def solver():
inputdata=input().split()
n=int(inputdata[0])
k=int(inputdata[1])
pointer=1
while pointer +k <= n:
  pointer = pointer +1

if n < k:
  print("0")
else:
  print(pointer)

Buggy submission (verdict: Runtime Error):
  inputdata=input().split()
  n=int(inputdata[0])
  k=int(inputdata[1])
  pointer=1
  while pointer +k <= n:
    pointer = pointer +1
  print(pointer)
Problem p03826 (python)

Fixed submission:
input_data=input().split()


first_area = int(input_data[0]) * int(input_data[1])
second_area = int(input_data[2]) * int(input_data[3])

if first_area >= second_area :
  print(first_area)
else:
  print(second_area)

Buggy submission (verdict: Runtime Error):
input_n=input()
input_s=input()
tmp=0
x = 0
for i in input_s:
  if i == "I":
    x=x+1
  else:
    x=x-1
  tmp=max(tmp,x)

print(tmp)
Problem p03827 (python)

Fixed submission:
input_n=input()
input_s=input()
tmp=0
x = 0
for i in input_s:
  if i == "I":
    x=x+1
  else:
    x=x-1
  tmp=max(tmp,x)

print(tmp)

Buggy submission (verdict: Runtime Error):
input_n=input()
input_s=input()
tmp=0
x = 0
for i in input_s:
  if i == "I":
    x=x+1
  else:
    x=x-1
  tmp=max(tmp,x)

print(tmp

Buggy submission (verdict: Runtime Error):
input_n=input()
input_s=input()
tmp=0
x = 0
for i in input_s:
  if i == "I":
    x=x+1
  else:
    x=x-1
  tmp=max(tmp,x)

print(tmp
Problem p02983 (python)

Fixed submission:
L, R = map(int, input().split())
min = 2100
for i in range(L, R):
    j = i + 1
    while(j < R + 1):
        if(min > i * j % 2019):
            min =  i * j % 2019
        if(min == 0):
            break
        j += 1
    if(min == 0):
        break
print(min)

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
number = list(range(L, R + 1))
min = 2100
for i in range(len(number) - 1):
    j = i + 1
    while(j < len(number)):
        if(min > number[i] * number[j] % 2019):
            min =  number[i] * number[j] % 2019
        if(min == 0):
            break
        j += 1
    if(min == 0):
        break
print(min)

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
number = list(range(L,R+1))
min = 2100
for i in range(len(number) - 1):
    j = i + 1
    while(j < len(number)):
        if(min > number[i]*number[j] % 2019):
            min = number[i]*number[j] % 2019
        j += 1
print(min)

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())
number = list(range(L,R+1))
min = 2100
for i in range(len(number)):
    j = i + 1
    while(j < len(number)):
        if(min > number[i]*number[j] % 2019):
            min = number[i]*number[j] % 2019
        j += 1
print(min)
Problem p02995 (python)

Fixed submission:
def gcd(x, y):
    while y > 0:
        x, y = y, x%y
    return x

A,B,C,D = map(int, input().split())
B_C = B // C
B_D = B // D
g = gcd(C,D)
l = C * D // g
duplicate_B = B // l
answer_B = B - B_C - B_D + duplicate_B

A_C = (A - 1) // C
A_D = (A - 1) // D
duplicate_A = (A - 1) // l
answer_A = (A - 1) - A_C - A_D + duplicate_A
print(int(answer_B - answer_A))

Buggy submission (verdict: Runtime Error):
import math

A,B,C,D = map(int, input().split())
B_C = B // C
B_D = B // D
g = math.gcd(C,D)
l = C * D / g
duplicate_B = B // l
answer_B = B - B_C - B_D + duplicate_B

A_C = (A - 1) // C
A_D = (A - 1) // D
duplicate_A = (A - 1) // l
answer_A = (A - 1) - A_C - A_D + duplicate_A
print(int(answer_B - answer_A))
Problem p02969 (python)

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

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

Fixed submission:
import heapq

n = int(input())
a = [int(input()) for _ in range(n)]
a1, a2 = heapq.nlargest(2, a)
[print(a1) if _ != a1 else print(a2) for _ in a]

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

n = int(input())

a = np.array([int(input()) for _ in range(n)])
[print(np.amax(np.amax(a[:i]), np.amax(a[i+1:]))) for i in range(n)]
Problem p03846 (python)

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

l = {}
ll = {}

if n % 2 == 0:
  for i in m:
    l[2*(i//2)+1] = 2
    if i in ll:
      ll[i] += 1
    else:
      ll[i] = 1
else:
  for i in m:
    if 2*(i//2) == 0:
      l[2*(i//2)] = 1
    else:
      l[2*(i//2)] = 2
    if i in ll:
      ll[i] += 1
    else:
      ll[i] = 1

if l != ll:
  print(0)
  exit()

print((1 << (n // 2)) % ((10 ** 9) + 7))

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

l = {}
ll = {}

if n % 2 == 0:
  for i in m:
    l[2*(i//2)+1] = 2
    if i in ll:
      ll[i] += 1
    else:
      ll[i] = 1
else:
  for i in m:
    if 2*(i//2) == 0:
      l[2*(i//2)] = 1
    else:
      l[2*(i//2)] = 2
    if i in ll:
      ll[i] += 1
    else:
      ll[i] = 1

if l != ll:
  print(0)
  exit()

print(1 << (n // 2) / (10**9+7))
Problem p02993 (python)

Fixed submission:
N = str(input())
if N[0]==N[1] or N[1]==N[2] or N[2]==N[3]:
    print("Bad")
else:
    print("Good")

Buggy submission (verdict: Runtime Error):
N = str(input())
if N[0]==N[1] or N[1]==N[2] or N[2]==N[3] or N[3]==N[4]:
    print("Bad")
else:
    print("Good")

Buggy submission (verdict: Runtime Error):
N = str(input())
if N[0]==N[1] or N[1]==N[2] or N[2]==N[3] or N[3]==N[4]:
    print("Bad")
else:
    print("Good)