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

Fixed submission:
import sys
from collections import deque
def input():
    return sys.stdin.readline()[:-1]

S = deque(map(int, list(input())))
num = 0
dict = {}
dict[0] = 1
ans = 0

for i in range(len(S)):
    num += S.pop() * pow(10,i,2019)
    cand = num % 2019
    if cand in dict.keys():
        dict[cand] += 1
    else:
        dict[cand] = 1

for key in dict.keys():
    ans += dict[key] * (dict[key] - 1) // 2
print(ans)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
from collections import Counter, deque

D = deque(map(int, list(input())))
num_mod = {}
value = 0

for i in range(len(D)):
    value = value + D.pop() * 10**i
    modulo = value % 2019
    #print(modulo)
    if modulo in num_mod.keys():
        num_mod[modulo] += 1
    else:
        num_mod[modulo] = 1

fix = 0
ans = [comb(i, 2, exact=True) for i in num_mod.values() if i > 1]
#print(b)
if 0 in num_mod.keys():
    if num_mod[0] == 1:
        fix = 1
print(sum(ans)+fix)

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
from collections import Counter, deque

D = deque(map(int, list(input())))
a = {}
value = 0

for i in range(len(D)):
    value = value + D.pop() * 10**i
    modulo = value % 2019
   # print(modulo)
    if modulo in a.keys():
        a[modulo] += 1
    else:
        a[modulo] = 1


b = [comb(i, 2, exact=True) for i in a.values() if i > 1]
#print(b)
print(sum(b))

Buggy submission (verdict: Runtime Error):
from scipy.special import comb
from collections import Counter, deque

S = list(map(int, list(input())))
D = deque(S)
a = {}
value = 0
ten_mod = 1

for i in range(len(S)):
    value = value + D.pop() * ten_mod % 2019
    ten_mod = ten_mod * 10 % 2019
    if value % 2019 in a.keys():
        a[value % 2019] += 1
    else:
        a[value % 2019] = 1

b = [comb(i, 2, exact=True) for i in a.values() if i > 1]
print(sum(b))

Buggy submission (verdict: Runtime Error):
S = input()
r, ans = 3, 0
for l in range(len(S)):
    while r < len(S):
        if int(S[0:l]) % 2019 == 0:
            ans += 1
            break
        if int(S[l:r+1]) % 2019 == 0:
            ans += 1
            break
        if int(S[r+1:len(S)]) % 2019 == 0:
            ans += 1
            break
        r += 1
    r = l + 3
print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
r, ans = 3, 0
for l in range(len(S)):
    while r < len(S):
        if int(S[0:l]) % 2019 == 0:
            ans += 1
            break
        if int(S[l:r+1]) % 2019 == 0:
            ans += 1
            break
        if int(S[r+1:len(S)) % 2019 == 0:
            ans += 1
            break
        r += 1
    r = l + 3
print(ans)
Problem p02732 (python)

Fixed submission:
from scipy.misc import comb

N = int(input())
A = input().split()

B = {}
for i in range(0, N):
    if not(A[i] in B.keys()):
        B[A[i]] = 1
    else:
        B[A[i]] += 1 

S = 0
for value2 in B.values():
    S = S + comb(int(value2), 2, exact=True)

S0 = 0
for i in range(0, N):
    S0 = S - (comb(int(B[A[i]]), 2, exact=True) - comb(int(B[A[i]])-1, 2, exact=True))
    print(S0)

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

N = int(input())
temp = input().split()
A = {}
for i in range(0, N):
    A[i] = temp[i]

B = {}
for i in range(0, N):
    if not(A[i] in B.keys()):
        B[A[i]] = 1
    else:
        B[A[i]] += 1 

for i in range(0, N):
    B[A[i]] -= 1
    S = 0    
    for value2 in B.values():
        S = S + comb(int(value2), 2, exact=True)
    print(S)
    B[A[i]] += 1
Problem p02741 (python)

Fixed submission:
num = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
a = int(input())
print(num[a-1])

Buggy submission (verdict: Runtime Error):
num = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
a = int(input())
print(num[a])
Problem p02743 (python)

Fixed submission:
import math

a, b, c = map(int, input().split())


if c-a-b > 0 and 4*a*b < (c-a-b)**2:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
#from decimal import *

#getcontext().prec = 20      # デフォルト28桁のところを20桁にする
#m = int(Decimal(n).sqrt())

def int_sqrt2(n):
    def f(prev):
        while True:
            m = (prev + n / prev) / 2
            if m >= prev:
                return prev
            prev = m
    
    return f(int(sqrt(n) * (1 + 1e-10)))

a, b, c = map(int, input().split())
#sqa = math.floor(math.sqrt(a)*10**(1000))/10**(1000)
#sqb = math.floor(math.sqrt(b)*10**(1000))/10**(1000)
#sqc = math.floor(math.sqrt(c)*10**(1000))/10**(1000)
#sqa = int(Decimal(a).sqrt())
#sqb = int(Decimal(b).sqrt())
#sqc = int(Decimal(c).sqrt())
sqa = int_sqrt2(a)
sqb = int_sqrt2(b)
sqc = int_sqrt2(c)



#sqa = float("{:.100f}".format(math.sqrt(a)))
#sqb = float("{:.100f}".format(math.sqrt(b)))
#sqc = float("{:.100f}".format(math.sqrt(c)))
 
#s = c - (a + b)
#t = 2 * sqa * sqb
if sqa + sqb < sqc:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import math
from decimal import *

getcontext().prec = 20      # デフォルト28桁のところを20桁にする
m = int(Decimal(n).sqrt())

a, b, c = map(int, input().split())
#sqa = math.floor(math.sqrt(a)*10**(1000))/10**(1000)
#sqb = math.floor(math.sqrt(b)*10**(1000))/10**(1000)
#sqc = math.floor(math.sqrt(c)*10**(1000))/10**(1000)
sqa = int(Decimal(a).sqrt())
sqb = int(Decimal(b).sqrt())
sqc = int(Decimal(c).sqrt())
 
#sqa = float("{:.100f}".format(math.sqrt(a)))
#sqb = float("{:.100f}".format(math.sqrt(b)))
#sqc = float("{:.100f}".format(math.sqrt(c)))
 
#s = c - (a + b)
#t = 2 * sqa * sqb
if sqa + sqb < sqc:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import math
a, b, c = map(float, input().split())
sqa = math.sqrt(a)
sqb = math.sqrt(b)
sqc = math.sqrt(c)
s = sqa + sqb
t = sqc
if s < t:
  print(Yes)
else:
  print(No)

Buggy submission (verdict: Runtime Error):
import math
a, b, c = map(int, input().split())
sqa = math.sqrt(a)
sqb = math.sqrt(b)
sqc = math.sqrt(c)
if sqa + sqb < sqc:
  print(Yes)
else:
  print(No)

Buggy submission (verdict: Runtime Error):
import math
a, b, c = map(float, input().split())
sqa = math.sqrt(a)
sqb = math.sqrt(b)
sqc = math.sqrt(c)
if sqa + sqb < sqc:
  print(Yes)
else:
  print(No)

Buggy submission (verdict: Runtime Error):
import math
a, b, c = map(float, input().split())
sqa = sqrt(a)
sqb = sqrt(b)
sqc = sqrt(c)
if sqa + sqb < sqc:
  print(Yes)
else:
  print(No)
Problem p02756 (python)

Fixed submission:
from collections import deque
S = list(input())
Q = int(input())
perm = 0
d = deque(S)

for i in range(0, Q):
    l = input().split()
    if len(l) == 1:
        perm += 1
    else:
        if (int(l[1])+perm) % 2 == 0:
            d.append(l[2])
        else:
            d.appendleft(l[2])
 
S0 = list(d)
if perm % 2 != 0:
    S0.reverse()
ans = ""
for i in range(0, len(S0)):
    ans = ans + S0[i]
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
S = list(input())
Q = int(input())
perm = 0
d = deque(S)

for i in range(0, Q):
    l = input().split()
    if len(l) == 1:
        perm += 1
    else:
        if (int(l[1])+perm) % 2 == 0:
            d.append(l[2])
        else:
            d.insert(0, l[2])
 
S0 = list(d)
if perm % 2 != 0:
    S0.reverse()
ans = ""
for i in range(0, len(S0)):
    ans = ans + S0[i]
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 22 10:29:00 2020

@author: azikausy
"""

from collections import deque
S = list(input())
Q = int(input())
#Query = {}
#TFC = []
perm = 0
d = deque(S)
for i in range(0, Q):
    l = input().split()
    if len(l) == 1:
        #Query[i] = [l[0], 0, 0]
        #S.reverse()
        perm += 1
    else:
        #Query[i] = l
        if (int(l[1])+perm) % 2 == 0:
            d.append(l[2])
        else:
            d.insert(0, l[2])

#print(d)
S0 = list(d)
#print(S0)
if perm % 2 != 0:
    S0.reverse()
ans = ""
for i in range(0, len(S0)):
    ans = ans + S0[i]
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 22 10:29:00 2020

@author: azikausy
"""

from collections import deque
S = list(input())
Q = int(input())
#Query = {}
#TFC = []
perm = 0
d =deque(S)
for i in range(0, Q):
    l = input().split()
    if len(l) == 1:
        #Query[i] = [l[0], 0, 0]
        #S.reverse()
        perm += 1
    else:
        #Query[i] = l
        if (int(l[1])+perm) % 2 == 0:
            d.append(l[2])
        else:
            d.insert(0, l[2])

S0 = list(d)
if perm % 2 != 0:
    S0.reverse()
ans = ""
for i in range(0, len(S0)):
    ans = ans + S0[i]
print(ans)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 22 09:27:00 2020

@author: azikausy
"""
from collections import deque

S = list(input())
Q = int(input())
#Query = {}
#TFC = []
perm = 0
d = deque(S)
#l = []
for i in range(0, Q):
    l = input().split()
    if len(l) == 1:
        #Query[i] = [l[0], 0, 0]
        #S.reverse()
        perm += 1
    else:
        #l[2] = l[2] + perm
        #Query[i] = l
        if (int(l[1])+perm) % 2 == 0:
            d.append(l[2])
        else:
            d.insert(0, l[2])

S0 = list(d)
if perm % 2 != 0:
    S0.reverse()
ans = ""
for i in range(0, len(S0)):
    ans = ans + S0[i]
print(ans)
Problem p02787 (python)

Fixed submission:
def main():
    H, N = map(int, input().split())
    AB = [list(map(int, input().split())) for _ in range(N)]

    dp = [[100000000]*(10000*2)]*(N+1)
    dp[0][0] = 0

    for i in range(0, N):
        for h in range(0, H+1):
            dp[i+1][h] = min(dp[i+1][h], dp[i][h])
            dp[i+1][min(h+AB[i][0], H)] = min(dp[i+1][min(h+AB[i][0], H)], dp[i+1][h]+AB[i][1])

    ans = {}
    for i in range(N):
        ans[i] = dp[i][H]
    print(min(ans.values()))
    
if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
dp = [[100000000]*(10000*2)]*(N+1)
dp[0][0] = 0

for i in range(0, N):
    for h in range(0, H+1):
        dp[i+1][h] = min(dp[i+1][h], dp[i][h])
        dp[i+1][min(h+AB[i][0], H)] = min(dp[i+1][min(h+AB[i][0], H)], dp[i+1][h]+AB[i][1])

ans = {}
for i in range(N):
    ans[i] = dp[i][H]
print(min(ans.values()))
Problem p02939 (python)

Fixed submission:
S = input()
N = len(S)
count = 0
i = 0
last = ""

while i < N:
    if i == 0:
        last = S[i]
        i += 1
        count += 1
    elif i != 0 and last == S[i]:
        if i > N-2:
            break
        last = S[i:i+2]
        i += 2
        count += 1
    elif i != 0 and last != S[i]:
        last = S[i]
        i += 1
        count += 1

if i == N-1 and last != S[N-1]:
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
s = input()
N = len(s)
i = 0
count = 0
while len(s) > 2:
    print(s)
    if i == 0:
        word =s[i]
        s = s[i+1:]
        count += 1
        last = 1
    if s[i+1] == s[i]:
        s = s[i+2:]
        count += 1
        last = 2
    else:
        word = s[i]
        s = s[i+1:]
        count += 1
        last = 1

if len(s) == 1 and last == 1 and word == s:
    count += 1
print(count)
Problem p03210 (python)

Fixed submission:
#!/usr/bin/env python3
def main():
    x = int(input())
    ans = "NO"
    if (x == 7 or x == 5 or x == 3):
        ans = "YES"

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def main():
    x = int(input())
    ans = "NO"
    if (x == 7 or x == 5 or x == 3):
        ans = "YES"

    print(ans)


if __name__ == '__main__':
    main()

Problem p03593 (python)

Fixed submission:
from collections import Counter

H, W = map(int, input().split())

raw = ""
for i in range(H):
    raw = raw + input()
words = Counter(list(raw))

if H*W % 2 == 1:
    flag = 0
    two_sum = (H-1) + (W-1)
elif H%2 == 1:
    flag = 1
    two_sum = W
elif W%2 == 1:
    flag = 1
    two_sum = H
else:
    flag = 1
    two_sum = 0

for value in words.values():
    if value % 2 == 1:
        flag += 1
    if flag > 1:
        print("No")
        break

if flag < 2 and two_sum > -1:
    for key, value in words.items():
        N_key = value
        while N_key > 0:
            if 1 < N_key < 4:
                N_key -= 2
                two_sum -= 2
            else:
                N_key -= 4

if flag < 2 and two_sum > -1:
    print("Yes")
elif two_sum < 0:
    print("No")

Buggy submission (verdict: Runtime Error):
from collections import Counter

H, W = map(int, input().split())

raw = ""
for i in range(H):
    raw = raw + input()
#words = Counter(list(raw))

print(words)
if H*W % 2 == 1:
    flag = 0
    two_sum = (H-1) + (W-1)
elif H%2 == 1:
    flag = 1
    two_sum = W
elif W%2 == 1:
    flag = 1
    two_sum = H
else:
    flag = 1
    two_sum = 0

for value in words.values():
    if value % 2 == 1:
        flag += 1
    if flag > 1:
        print("No")
        break

if flag < 2 and two_sum > -1:
    for key, value in words.items():
        N_key = value
        while N_key > 0:
            if 1 < N_key < 4:
                N_key -= 2
                two_sum -= 2
            else:
                N_key -= 4

if flag < 2 and two_sum > -1:
    print("Yes")
elif two_sum < 0:
    print("No")
Problem p03695 (python)

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

dict = {}
ans = 0
count = 0
for i in range(N):
    if not( a[i]//400 in dict.keys() ):
        dict[a[i]//400] = 1
    else:
        dict[a[i]//400] += 1
for key in dict.keys():
    if key < 8:
        ans += 1
    else:
        count += dict[key]
if ans == 0:
    print(1, count)
else:
    print(ans, ans+count)

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

b = [0]*9
ans = 0
count = 0
for i in a:
    if i//400 < 8:
        b[i//400] = 1
    else:
        b[i//400] += 1
print(max(1, sum(b[:8])), sum(b))
Problem p03067 (python)

Fixed submission:
a = [int(x) for x in input().split()]
if a[0] >= a[1]:
  if a[0] >= a[2] and a[2] >= a[1]:
    print("Yes")
  else:
    print("No")
else:
  if a[1] >= a[2] and a[2] >= a[0]:
    print("Yes")
  else:
    print("No")

Buggy submission (verdict: Runtime Error):
a = [int(x) for x in input().split()]
if a[0] >= a[1]:
  if a[0] >= a[2] and a[2] >= a[1]:
    print(Yes)
  else:
    print(No)
else:
  if a[1] >= a[2] and a[2] >= a[0]:
    print("Yes")
  else:
    print("No")
Problem p03086 (python)

Fixed submission:
T = input()
count, temp = [], 0
AGCT = ['A', 'G', 'C', 'T']
for i in T:
  if (i in AGCT) == True:
    temp += 1
  else:
    count.append(temp)
    temp = 0
count.append(temp)
print(max(count))

Buggy submission (verdict: Runtime Error):
T = input()
count, temp = [], 0
AGCT = ['A', 'G', 'C', 'T']
for i in T:
  if (i in AGCT) == True:
    temp += 1
  else:
    count.append(temp)
    temp = 0
print(max(count))
Problem p02702 (python)

Fixed submission:
def POW(x, n, mod):
    ans = 1
    # n が 0 になるまで計算を続ける
    while n > 0:
        if n % 2 == 1:
            ans *= x%mod
        x = (x*x)%mod						#x = x**2
        n >>= 1						#ビットシフト
    return ans

if __name__ == '__main__':
	S = input()
	L = len(S)
	lst = [0] * 2019
	lst[0] = 1
	amari = 0
	ans = 0
	for i in range(1,L+1):
		amari = ( int(S[L-i]) * POW(10,i-1,2019) + amari ) % 2019
		lst[amari] += 1

	for i in range(2019):
		m = lst[i]
		ans += m * (m-1) / 2

	print(int(ans))

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
	S = input()
	LEN = len(S)
	r = LEN
	l = LEN-1
	count = 0
	lst = []
	amari = 0
	while(l >= 0):
		amari = (amari + S[l]*10**(l-1)%2019)%2019
		
		if amari in lst:
			count += 1
		elif amari == 0:
			count += 1
			lst.append(count)
		else:
			lst.append(amari)
		l -= 1

	print(count)
Problem p02743 (python)

Fixed submission:
import math

if __name__ == '__main__':
	a, b, c = map(int, input().split())
	if 4 * a * b < (c - a - b)**2 and c-a-b>0:
		print('Yes')
	else:
		print('No')

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
	a, b, c = map(int, input().split())
	sq = math.sqrt(a*b)
	if 2 * sq < (c - a - b) :
		print('Yes')
	else:
		print('No')
Problem p02628 (python)

Fixed submission:
def main():
  N, K = list(map(int, input().split()))
  P = list(map(int, input().split()))

  P.sort()
  print(sum(P[:K]))


if(__name__ == '__main__'):
  main()

Buggy submission (verdict: Runtime Error):
def main():
  N, K = list(map(int, input().split()))
  P = list(map(int, input().split()))

  min_ = float('inf')

  all_ = list(range(N))
  for items in itertools.combinations(all_, K):
    sum_ = sum([P[i] for i in items])
    min_ = min(min_, sum_)

  print(min_)


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

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


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

  not_divisible = [False]*(10**6+1)
  for i in range(N):
    not_divisible[A[i]] = True

  prev = 0
  for i in range(N):
    if not_divisible[A[i]]:
      j = A[i] + A[i]
      while j <= A[-1]:
        not_divisible[j] = False
        j += A[i]
    if prev == A[i]:
      not_divisible[A[i]] = False
    prev = A[i]

  cnt = 0
  for i in range(N):
    if not_divisible[A[i]]:
      cnt += 1

  print(cnt)


if(__name__ == '__main__'):
  main()

Buggy submission (verdict: Runtime Error):
from sys import stdin
input = stdin.readline


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

  not_divisible = [False]*(10**6)
  prev = 0
  for i in range(N):
    if prev == A[i]:
      not_divisible[A[i]] = False
    else:
      not_divisible[A[i]] = True
    prev = A[i]

  for i in range(N):
    if not_divisible[A[i]]:
      j = A[i] + A[i]
      while j <= A[-1]:
        not_divisible[j] = False
        j += A[i]

  cnt = 0
  for i in range(N):
    if not_divisible[A[i]]:
      cnt += 1

  print(cnt)


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

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


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

  G = [[] for _ in range(N+1)]
  for _ in range(N-1):
    a, b = map(int, input().split())
    G[a].append(b)
    G[b].append(a)

  PX = defaultdict(int)
  for _ in range(Q):
    p, x = map(int, input().split())
    PX[p] += x

  # solve
  ans = [0]*(N+1)
  visited = set()
  # temp = PX[1]
  # S = [1] # Stack
  # S = deque([1])

  # while len(S):
  #   now = S[-1]
  #   visited.add(now)

  #   for next_ in G[now]:
  #     if next_ not in visited:
  #       S.append(next_)
  #       temp += PX[next_]
  #       break
  #   else:
  #     S.pop()
  #     ans[now] = temp
  #     temp -= PX[now]

  def dfs(now, sum_):
    visited.add(now)
    for next_ in G[now]:
      if next_ not in visited:
        sum_ += PX[next_]
        sum_ = dfs(next_, sum_)

    ans[now] = sum_
    sum_ -= PX[now]
    return sum_

  dfs(1, PX[1])

  print(*ans[1:], sep=' ')


if(__name__ == '__main__'):
  main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from collections import deque
from sys import stdin
input = stdin.readline


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

  G = [[] for _ in range(N+1)]
  for _ in range(N-1):
    a, b = map(int, input().split())
    G[a].append(b)
    G[b].append(a)

  PX = defaultdict(int)
  for _ in range(Q):
    p, x = map(int, input().split())
    PX[p] += x

  # solve
  ans = [0]*(N+1)
  visited = set()
  # temp = PX[1]
  # S = [1] # Stack
  # S = deque([1])

  # while len(S):
  #   now = S[-1]
  #   visited.add(now)

  #   for next_ in G[now]:
  #     if next_ not in visited:
  #       S.append(next_)
  #       temp += PX[next_]
  #       break
  #   else:
  #     S.pop()
  #     ans[now] = temp
  #     temp -= PX[now]

  def dfs(now, sum_):
    visited.add(now)
    for next_ in G[now]:
      if next_ not in visited:
        sum_ += PX[next_]
        sum_ = dfs(next_, sum_)

    ans[now] = sum_
    sum_ -= PX[now]
    return sum_

  dfs(1, PX[1])

  print(*ans[1:], sep=' ')


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

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Created: Jul, 13, 2020 06:30:41 by Nobody
# $Author$
# $Date$
# $URL$
__giturl__ = "$URL$"


from sys import stdin
input = stdin.readline


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

  if R-L+1 >= 2019:
    print(0)
    return
  else:
    mods = []
    for i in range(L, R+1):
      mods.append(i)
  mods = sorted(mods)
  min_ = float('inf')
  for i in mods:
    for j in mods:
      if i==j:
        continue
      min_ = min(min_, (i*j) % 2019)

  print(min_)


if(__name__ == '__main__'):
  main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Created: Jul, 13, 2020 06:30:41 by Nobody
# $Author$
# $Date$
# $URL$
__giturl__ = "$URL$"


from sys import stdin
input = stdin.readline


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

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


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

Fixed submission:
import sys
from collections import defaultdict, deque

def main():
    input = sys.stdin.readline
    N = int(input())
    d = defaultdict(list)
    for _ in range(N-1):
        u, v, w = map(int, input().split())
        d[u-1].append((v-1, w))
        d[v-1].append((u-1, w))

    dist = [0] * N
    q = deque()
    q.append((0, 0))
    visited = set()

    while len(q) > 0:
        q_ = deque()
        while len(q) > 0:
            node1, cost1 = q.popleft()

            dist[node1] = cost1
            visited.add(node1)

            for node2, cost2 in d[node1]:
                if node2 in visited:
                    continue

                q_.append((node2, cost1 + cost2))

        q = q_

    for d in dist:
        print(d % 2)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from sys import stdin
input = stdin.readline


def main():
  N = int(input())
  G = [[] for _ in range(N+1)]
  for i in range(N-1):
    u, v, w = map(int, input().split())
    G[u].append((v, w))
    G[v].append((u, w))

  color = [-1]*(N+1)
  color[1] = 0
  # S = [1]
  # while len(S):
  #   now = S[-1]
  #   for next_, w in G[now]:
  #     if color[next_] != -1:
  #       continue
  #     S.append(next_)
  #     color[next_] = (w % 2) ^ color[now]
  #     break
  #   else:
  #     S.pop()

  def dfs(now):
    for next_, w in G[now]:
      if color[next_] == -1:
        color[next_] = (w % 2) ^ color[now]
        dfs(next_)
  dfs(1)

  for i in range(1, N+1):
    print(color[i])


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

Fixed submission:
import sys 
s=input()
t=input()
l=list()
for i in "abcdefghijklmnopqrstuvwxyz":
    l.append(s+""+i)
if(t in l):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
import math
import os
import random
import re
import sys

def solution(s,t):
    if(s[-1]==t[-1]):
        return "No"
    return "Yes"
if __name__ == '__main__':
    fptr = sys.stdout

        s=input()
        t=input()

        result = solution(s,t)

        fptr.write(str(result) + '\n')

    fptr.close()

Buggy submission (verdict: Runtime Error):
s=input()
t=input()
if(s[-1]==t[-1]):
    return "No"
return "Yes"
Problem p02658 (python)

Fixed submission:
import sys

N = int(input())
A = [int(x) for x in input().split(" ")]
if 0 in set(A):
    print(0)
    sys.exit(0)

product = 1
for a in A:
    product = product * a
    if product > 10 ** 18:
        print(-1)
        sys.exit(0)


print(product)

Buggy submission (verdict: Runtime Error):
import sys

N = int(input())
A = [int(x) for x in input().split(" ")]
product = 1
for a in A:
    product = product * a
if product > 10 ** 18:
    print(-1)
    sys.exit(1)

print(product)