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

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

if (a + b) % 3 == 0 or a % 3 == 0 or b % 3 == 0:
  print("Possible")
else:
  print("Impossible")

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

min_diff = 10**9
for i in range(len(list_a)-1):
    sunuke = sum(list_a[:i+1])
    arai = sum(list_a[i+1:])
    diff = abs(sunuke - arai)
    if min_diff > diff:
        min_diff = diff

print(min_diff)
Problem p03759 (python)

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

if b - a == c - b:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (b - a == c - b) {
    cout << "YES" << endl;
    return 0;
  } else {
    cout << "NO" << endl;
    return 0;
  }
}
Problem p03760 (python)

Fixed submission:
odd, even = input(), input()

for i in range(len(even)):
  print(odd[i] + even[i], end="")

if len(odd) == len(even) + 1:
  print(odd[len(odd) - 1])

print("")

Buggy submission (verdict: Runtime Error):
odd, even = input(), input()

for i in range(len(odd)):
  print(odd[i] + even[i], end="")

print("")
Problem p03797 (python)

Fixed submission:
s, c = list(map(int, input().split(" ")))

count = 0

if c >= 2 * s:
    print(s + ((c - s * 2) // 4))

else:
    count = (c - 1) // 2 if c % 2 == 1 else c // 2
    print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
power = [1]

if n == 1:
    print(1)
    exit()

for i in range(2, n+1):
    power.append((i * power[-1]) % (10 ** 9 + 7))

print(power[-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
power = [1]

if n == 1:
    print(1)
    exit()

for i in range(2, n+1):
    power.append((i * power[-1]) % (10 ** 9 + 7))

print(power[-1])

Buggy submission (verdict: Runtime Error):
n = int(input())
power = [1]

if n == 1:
    print(1)
    exit()

for i in range(2, n+1):
    power.append((i * power[-1]) % (10 ** 9 + 7))

print(power[-1])
Problem p02718 (python)

Fixed submission:
N, M = map(int,input().split())
A = list(map(int, input().split()))
line = sum(A)/(4*M)
A.sort(reverse=True)
if A[M-1]>=line:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N, M = map(int,input().split())
A = list(map(int, input().split()))
line = sum(A)/(4*M)
A.sort(reverse=True)
if A[M]>line:
    print('Yes')
else:
    print('No')
Problem p03494 (python)

Fixed submission:
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
count = 0
while((A%2==0).all()):
    A=A/2
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
import numpy as np
A = np.array(A)
count = 0
while((A%2==0).all()):
    A=A/2
    count+=1
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
count = 0
while((A%2==0).all()):
    A=A/2
    count+=1
print(count)
Problem p02995 (python)

Fixed submission:
import fractions


class AntiDivision:
    def __init__(self):
        self.A, self.B, self.C, self.D = map(int, input().split())

    def cal(self):
        a_b_count = self.B - self.A + 1
        lcm = (self.C * self.D) // fractions.gcd(self.C, self.D)
        c_count = self.B // self.C - (self.A - 1) // self.C
        d_count = self.B // self.D - (self.A - 1) // self.D
        lcm_count = self.B // lcm - (self.A - 1) // lcm

        print(a_b_count - c_count - d_count + lcm_count)


antiDivision = AntiDivision()
antiDivision.cal()

Buggy submission (verdict: Runtime Error):
import math


class AntiDivision:
    def __init__(self):
        self.A, self.B, self.C, self.D = map(int, input().split())

    def cal(self):
        a_b_count = self.B - self.A + 1
        lcm = (self.C * self.D) // math.gcd(self.C, self.D)
        c_count = self.B // self.C - (self.A - 1) // self.C
        d_count = self.B // self.D - (self.A - 1) // self.D
        lcm_count = self.B // lcm - (self.A - 1) // lcm

        print(a_b_count - c_count - d_count + lcm_count)


antiDivision = AntiDivision()
antiDivision.cal()
Problem p02683 (python)

Fixed submission:
import itertools
def main():
    n,m,x = map(int, input().split())
    c = [list(map(int, input().split())) for _ in range(n)]
    # c = sorted(c, key=lambda x:sum(x[1:])/x[0], reverse=True)
    ans = 10**9
    possible = False

    for i in range(1, n+1):
        for j in itertools.combinations(c,i):
            rikaido = [0]*m
            kingaku = 0
            for k in j:
                kingaku += k[0]
                for num, val in enumerate(k[1:]):
                    rikaido[num] += val

            if min(rikaido) >= x:
                ans = min(ans, kingaku)
    print(-1) if ans == 10**9 else print(ans)

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    n,m,x = map(int, input().split())
    c = [list(map(int, input().split())) for _ in range(n)]
    c = sorted(c, key=lambda x:x[0]//sum(x[1:]))
    ans = 0
    rikaido = [0]*m
    possible = False
    for i in c:
        ans += i[0]
        for num, val in enumerate(i[1:]):
            rikaido[num] += val

        if min(rikaido) >= x:
            possible = True
            break
    print(ans) if possible else print(-1)
if __name__ == "__main__":
    main()
Problem p02969 (python)

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

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]
AA = sorted(A)
maxAA = max(AA)
for i in A:
    if maxAA == i:
        print(AA[-2])
    else:
        print(maxAA)
Problem p03067 (python)

Fixed submission:
a,b,c = map(int, input().split())
lst = list(range(min(a,b), max(a,b)+1))
if c in lst:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
import re
n = int(input())
s = input()
if not '#' in s:
    print(0)
else:
    s = '#.' + s.split('#.', 1)[-1] if '#.' in s else  s
    ptn = re.search(re.compile('\.#+?$'), s)
    if ptn:
        s = s[:ptn.end()]
    print(min(s.count('.'), s.count('#')))

Buggy submission (verdict: Runtime Error):
import re
n = int(input())
s = input()
if not '#' in s:
    print(0)
else:
    s = s.rsplit('.#', 1)[0] + '.#' if '.#' in s else  s
    ptn = re.search(re.compile('\.#+?$'), s)
    if ptn:
        s = s[:ptn.start()]
    print(min(s.count('.'), s.count('#')))
Problem p03074 (python)

Fixed submission:
n, k = map(int,input().split())
s = input()
nums = []

now = 1
cnt = 0
for i in range(len(s)):
    if s[i] == str(now): cnt += 1
    else:
        nums.append(cnt)
        now = 1 - now
        cnt = 1
if not cnt == 0: nums.append(cnt)
if len(nums) % 2 == 0: nums.append(0)

summ = [0]
for i in range(len(nums)):
    summ.append(summ[i]+nums[i])

ans = 0
for i in range(len(nums))[::2]:
    left = i
    right = min(i+k*2+1, len(nums))
    tmp = summ[right] - summ[left]

    ans = max(tmp, ans)


print(ans)

Buggy submission (verdict: Runtime Error):
def cul(lst, m):
    r = 0
    for i in lst:
        r  += i if i < m else m
    return r

n, k = map(int,input().split())
s = input()
val = []

if len(s) == 1:
    print(1)

a = 1
for i in range(1, len(s)):
    if s[i-1] == s[i]:
        a += 1
    else:
        val.append(a)
        a = 1
val.append(a)
ans = []
now = int(s[0])
for i in range(len(s)-k):
    lst = val[i:i+k*2+1]
    if now == 1:
        ans.append(cul(lst, n))
    now = 1 if now == 0 else 0
print(max(ans))
Problem p03125 (python)

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

if int(B % A) == 0:
    print(A+B)
else:
    print(B-A)

Buggy submission (verdict: Runtime Error):
import fractions
from functools import reduce

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

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)

print(gcd(*A))
Problem p02918 (python)

Fixed submission:
N,K = map(int,input().split())
S = list(input())
happy = 0
L = 0
R = 0
for i in range(N-1):
  if S[i] == S[i+1]:
    happy += 1
  elif S[i] == 'L' and S[i+1] == 'R':
    L += 1
  else:
    R += 1
if min(R,L) >= K:
  happy += K*2
else:
  happy += min(R,L) + K
if happy <= len(S) - 1:
  print(happy)
else:
  print(len(S) - 1)

Buggy submission (verdict: Runtime Error):
 N,K = map(int,input().split())
S = list(input())
happy = 0
L = 0
R = 0
for i in range(N-1):
  if S[i] == S[i+1]:
    happy += 1
  elif S[i] == 'L' and S[i+1] == 'R':
    L += 1
  else:
    R += 1
if min(R,L) >= K:
  happy += K*2
else:
  happy += min(R,L) + K
if happy <= len(S) - 1:
  print(happy)
else:
  print(len(S) - 1)
Problem p02995 (python)

Fixed submission:
a,b,c,d = (map(int,input().split()))
import fractions
gcdcd = c*d//int(fractions.gcd(c,d))
e = a-1
print( b - b//c - b//d + b//gcdcd - e + e//c + e//d - e//gcdcd)

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

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

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
import math
gcdcd = math.lcm(c,d)
e = a-1
print( b - b//c - b//d + b//gcdcd - e + e//c + e//d - e//gcdcd)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
import math
gcdcd = math.lcm(c,d)
e = a-1
print( b - b//c - b//d + b//gcdcd - e + e//c + e//d - e//gcdcd)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
import math
gcdcd = math.gcd(c,d)
e = a-1
print( b - b//c - b//d + b//gcdcd - e + e//c + e//d - e//gcdcd)
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())
if x == W/2 and y == H/2:
  print(W*H/2,1)
else:
  print(W*H/2,0)
Problem p03029 (python)

Fixed submission:
A,P = map(int,input().split())
print((3*A+P)//2)

Buggy submission (verdict: Runtime Error):
A, B = int(input().split())
return (A*3 + B)//2

Buggy submission (verdict: Runtime Error):
A, B = input().split()
return (A*3 + B)//2
Problem p03035 (python)

Fixed submission:
lis = list(map(int,input().split()))
if lis[0] >= 13:
	print(lis[1])
elif lis[0] >= 6 and lis[0] <= 13:
	print(int(lis[1]/2))
else:
	print(0)

Buggy submission (verdict: Runtime Error):
lis = list(map(int, input().split()))
if lis[0] => 13:
	print(lis[1])
elif lis[0]>5 and lis[0]<13:
	print(lis[1]/2)
else:
	print(0)

Buggy submission (verdict: Runtime Error):
lis = list(map(int, input().split()))
if lis[0] => 13:
	return lis[1]
elif lis[0]>5 and lis[0]<13:
	return lis[1]/2
else:
	return 0

Buggy submission (verdict: Runtime Error):
lis = list(map(int, input().split())
if lis[0] => 13:
           return lis[1]
	elif lis[0]>5 and lis[0]<13:
           return lis[1]/2
	else:
           return 0
Problem p03037 (python)

Fixed submission:
N,M = map(int,input().split())
L = [0]*M
R = [0]*M
for i in range(M):
  l,r = map(int,input().split())
  L[i] = l
  R[i] = r
if min(R)-max(L) >= 0:
  print(min(R)-max(L)+1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
N_M = list(map(int, input().split()))
Lock_min = []
Lock_max = []
for i in range(N_M[1]):
    ADD = list(map(int,input().split()))
    Lock_min.append(ADD[0])
    Lock_max.append(ADD[1])
if min(Lock_max) - max(Lock_min) >= 1:
        print(min(Lock_max) - max(Lock_min))
 else:
        print(0)
Problem p03071 (python)

Fixed submission:
A,B = map(int,input().split())
 
if A>B:
	print(A*2-1)
elif A==B:
	print(A+B)
else:
	print(B*2-1)

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

if A>B:
	print(A*2-1)
elif A=B:
	print(A+B)
else:
	print(B*2-1)
Problem p03086 (python)

Fixed submission:
S = list(input())
S.append('fuck')
lis = ['A','T','C','G']
count = 1 if S[0] in lis else 0
ans = 1 if S[0] in lis else 0
for i in range(1,len(S)):
  if S[i] in lis:
    count += 1
  else:
    ans = max(ans,count)
    count = 0
print(ans)

Buggy submission (verdict: Runtime Error):
S = list(input())
count = 1 if S[0] in lis else 0
lis = ['A','T','C','G']
ans = 1 if S[0] in lis else 0
for i in range(1,len(S)):
  if S[i] in lis:
    count += 1
  else:
    ans = max(ans,count)
    count = 0
print(ans)
Problem p03087 (python)

Fixed submission:
N,Q = map(int,input().split())
S = list(input())
R = [0]*N
ans = []
temp = 0
for i in range(1,N):
  if S[i-1] == 'A' and S[i] == 'C':
    temp += 1
  R[i] = temp
for k in range(Q):
  l,r = map(int,input().split())
  ans.append(R[r-1]-R[l-1])
for j in range(len(ans)):
  print(ans[j])

Buggy submission (verdict: Runtime Error):
N,Q = map(int,input().split())
S = list(input())
count = 0
ans = []
for i in range(Q):
  r,l = map(int,input().split())
  for k in range(r,l):
    if S[k] == 'A' and S[k+1] == 'C':
      count += 1
  ans.append(count)
  count = 0
for j in range(len(ans)):
  print(ans[j])

Buggy submission (verdict: Runtime Error):
N,Q = map(int,input().split())
S = list(input())
count = 0
ans = []
for i in range(Q):
  r,l = map(int,input().split())
  S_parted = S[r-1:l]
  for k in range(len(S_parted)-1):
    if S_parted[k] == 'A' and S_parted[k+1] == 'C':
      count += 1
  ans.append(count)
  count = 0
for j in range(len(ans))
  print(ans[j])
Problem p03478 (python)

Fixed submission:
Lis = list(map(int,input().split()))
ans = 0
for k in range(Lis[0]+1):
    if k%10 + (k//10)%10 + (k//100)%10 + (k//1000)%10 <= Lis[2] and k%10 + (k//10)%10 + (k//100)%10 + (k//1000)%10 >= Lis[1]:
        ans += k
if Lis[0] == 10000 and Lis[1]<2:
           print(ans+10000)
else:
           print(ans)

Buggy submission (verdict: Runtime Error):
Lis = list(map(int,input().split()))
ans = 0
for k in range(Lis[0]+1):
    if k%10 + (k//10)%10 + (k//100)%10 + (k//1000)%10 <= Lis[2] and k%10 + (k//10)%10 + (k//100)%10 + (k//1000)%10 >= Lis[1]:
        ans += k
if N == 10000:
           print(ans+10000)
else:
           print(ans)

Buggy submission (verdict: Runtime Error):
Lis = list(map(int,input().split()))
ans = 0
for k in range(Lis[0]+1):
    if k%10 + (k//10)%10 + (k//100)%10 + (k//1000)%10 <= Lis[2] and k%10 + (k//10)%10 + (k//100)%10 + (k//1000)%10 >= Lis[1]:
        ans += k
if N == 10000:
           print(ans+10000)
else:
           print(ans)
Problem p03485 (python)

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

Buggy submission (verdict: Runtime Error):
import math
a,b=map(int,input().split())
print(math.ceil((a+b)/2)
Problem p03501 (python)

Fixed submission:
a,b,c=map(int,input().split())
print(min(a*b,c))

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,list(input()))
print(min(a*b,c))
Problem p03543 (python)

Fixed submission:
a=list(map(int,list(input())))
print("Yes" if a[0]==a[1] and a[1]==a[2] or a[3]==a[1] and a[1]==a[2] else "No")

Buggy submission (verdict: Runtime Error):
a=map(int,list(input()))
print("Yes" if a[0]==a[1] and a[1]==a[2] or a[3]==a[1] and a[1]==a[2] else "No")

Buggy submission (verdict: Runtime Error):
a=map(int,list(input()))
print("Yes" if a[0]==a[1]==a[2] or a[3]==a[1]==a[2] else "No")
Problem p03597 (python)

Fixed submission:
a=int(input())
print(a**2-int(input()))

Buggy submission (verdict: Runtime Error):
a=int(input())
print(a**2-int(input())
Problem p03610 (python)

Fixed submission:
temp = input().split(" ")
mojis = list(temp[0])
ans = ""
for a in range(len(mojis)):
    if a % 2 == 0:
        ans = ans + mojis[a]
print(ans)

Buggy submission (verdict: Runtime Error):
a = list(input())
b = []
for i in range(a):
  if i % 2 == 0:
    b.append(a[i])
print("".join(b))

Buggy submission (verdict: Runtime Error):
a = list(input())
b = []
for i in range(a):
  if i % 2 == 0:
    b.push(a[i])
print("".join(b))
Problem p03777 (python)

Fixed submission:
a,b=input().split()
print("H" if a==b else "D")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
print("H" if a==b else "D")
Problem p02630 (python)

Fixed submission:
N = int(input())
A = [int(_) for _ in input().split()]
Q = int(input())
b_to_c = [[int(_) for _ in input().split()] for i in range(Q)]

sum = 0
memo = [0] * (10 ** 5 + 1)
for i in A:
    memo[i] += 1
    sum += i

for bc in b_to_c:
    b = bc[0]
    c = bc[1]
    sum -= (b * memo[b])
    sum += (c * memo[b])
    memo[c] += memo[b]
    memo[b] = 0
    print(sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(_) for _ in input().split()]
Q = int(input())
b_to_c = [[int(_) for _ in input().split()] for i in range(Q)]

sum = 0
memo = [0] * (10 ** 5)
for i in A:
    memo[i] += 1
    sum += i

for bc in b_to_c:
    b = bc[0]
    c = bc[1]
    sum -= (b * memo[b])
    sum += (c * memo[b])
    memo[c] += memo[b]
    memo[b] = 0
    print(sum)
Problem p02761 (python)

Fixed submission:
import sys
import numpy as np

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

if M == 0:
    if N == 1:
        print("0")
    else:
        ans = [0] * N
        ans[0] = 1
        print("".join(map(str, ans)))
    sys.exit()

S, C = np.array([[int(_) for _ in input().split()] for i in range(M)]).T

ans = [-1] * N

for i in range(M):
    j = int(S[i]) - 1
    if ans[j] == -1 or ans[j] == C[i]:
        ans[j] = C[i]
    else:
        print("-1")
        sys.exit()

if N >= 2 and ans[0] == 0:
    print("-1")
    sys.exit()

if N >= 2 and ans[0] == -1:
    ans[0] = 1

for i in range(1, N):
    if ans[i] == -1:
        ans[i] = 0

s = "".join(map(str, ans))
print(s)

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

N, M = [int(_) for _ in input().split()]
S, C = np.array([[int(_) for _ in input().split()] for i in range(M)]).T

print("no")
# ans = [-1] * N

# for i in range(M):
#     j = int(S[i]) - 1
#     if ans[j] == -1 or ans[j] == C[i]:
#         ans[j] = C[i]
#     else:
#         print("-1")
#         sys.exit()

# if ans[0] == -1:
#     ans[0] = 1

# for i in range(1, N):
#     if ans[i] == -1:
#         ans[i] = 0

# s = "".join(map(str, ans))

# if int(s) == 0:
#     print("-1")
# else:
#     print(s)

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

N, M = [int(_) for _ in input().split()]
S, C = np.array([[int(_) for _ in input().split()] for i in range(M)]).T

ans = [-1] * N

for i in range(M):
    j = int(S[i]) - 1
    if ans[j] == -1 or ans[j] == C[i]:
        ans[j] = C[i]
    else:
        print("-1")
        sys.exit()

if ans[0] == -1:
    ans[0] = 1

for i in range(1, N):
    if ans[i] == -1:
        ans[i] = 0

s = "".join(map(str, ans))

if int(s) == 0:
    print("-1")
else:
    print(s)
Problem p02936 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10 ** 7)

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

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


vertex = [0] * N
for i in range(Q):
    p, x = [int(_) for _ in input().split()]
    p -= 1
    vertex[p] += x


def dfs(n, parent):
    for to in edge[n]:
        if to == parent:
            continue
        vertex[to] += vertex[n]
        dfs(to, n)


dfs(0, -1)
print(*vertex)

Buggy submission (verdict: Runtime Error):
N, Q = [int(_) for _ in input().split()]
edge = [[] for _ in range(N)]

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


vertex = [0] * N
for i in range(Q):
    p, x = [int(_) for _ in input().split()]
    p -= 1
    vertex[p] += x


def dfs(n, parent):
    for to in edge[n]:
        if to == parent:
            continue
        vertex[to] += vertex[n]
        dfs(to, n)


dfs(0, -1)
print(*vertex)
Problem p02947 (python)

Fixed submission:
import math
from itertools import groupby

N = int(input())
S = ["".join(sorted(input())) for i in range(N)]
sizes = [len(list(v)) for k, v in groupby(sorted(S))]


def combinations_count(n, r):
    if n == 1:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


ans = sum([combinations_count(size, 2) for size in sizes])
print(ans)

Buggy submission (verdict: Runtime Error):
import pandas as pd
import math

N = int(input())
print("No")

Buggy submission (verdict: Runtime Error):
import pandas as pd
import math

N = int(input())
S = ["".join(sorted(input())) for i in range(N)]
df = pd.DataFrame(S, columns=["value"])


def combinations_count(n, r):
    if n == 1:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


grouped = df.groupby("value")
sizes = grouped.size().values
ans = sum([combinations_count(size, 2) for size in sizes])
print(ans)
Problem p02983 (python)

Fixed submission:
L, R = [int(_) for _ in input().split()]

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

Buggy submission (verdict: Runtime Error):
L, R = [int(_) for _ in input().split()]

diff = R - L
if diff >= 2019:
    print("0")
else:
    ans = min([i * j % 2019 for j in range(L + 1, R) for i in range(L, R)])
    print(ans)
Problem p02996 (python)

Fixed submission:
N = int(input())

Works = [dict(zip(["require", "limit"], [int(_) for _ in input().split()])) for i in range(N)]

def solve(Works):
    Works.sort(key=lambda x: x["limit"])
    acc = 0
    for w in Works:
        acc += w["require"]
        if acc > w["limit"]:
            return "No"
    return "Yes"

print(solve(Works))

Buggy submission (verdict: Runtime Error):
from typing import List


class Work:
    require = 0
    limit = 0
    def __init__(self, require, limit) -> None:
        self.require = require
        self.limit = limit

def from_list(xs: List[int]) -> Work: 
    return Work(xs[0], xs[1])

N = int(input())

works = [from_list([int(_) for _ in input().split()]) for i in range(N)]

def solve(works):
    works.sort(key=lambda x: x.limit)
    acc = 0
    for w in works:
        acc += w.require
        if acc > w.limit:
            return "No"
    return "Yes"

print(solve(works))