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

Fixed submission:
l = [int(input()) for i in range(1, 5)]
print(min(l[0], l[1]) + min(l[2], l[3]))

Buggy submission (verdict: Runtime Error):
n = [int(input()) for i in range(1,5)]

x = min(n[1], n[2])+ min(n[3], n[4])

print(x)

Buggy submission (verdict: Runtime Error):
n = [int,input() for i in range(1,5)]

x = min(n[0], n[1])+ min(n[2], n[3])

print(x)

Buggy submission (verdict: Runtime Error):
n = [int,input() for i in range(1,5)]

x = min(n[1], n[2])+ min(n[3], n[4])

print(x)

Buggy submission (verdict: Runtime Error):
l = (int(input()) for i in range(1, 5))
print(min(l[0], l[1]) + min(l[2], l[3]))

Buggy submission (verdict: Runtime Error):
l = [int(input()) for i in range(1, 6)]
print(min(l[0], l[1]) + min(l[2], l[3]))

Buggy submission (verdict: Runtime Error):
l = [int(input()) for i in range(1, 4)]
print(min(l[0], l[1]) + min(l[2], l[3]))

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())

x = min(a,b) + min(c,d)

print(x)
Problem p03400 (python)

Fixed submission:
N = int(input())
D,X = map(int,input().split())

S = X

for i in range(N):
	a = int(input())
	S += (D-1)//a+1
print(S)

Buggy submission (verdict: Runtime Error):
5
30 44
26
18
81
18
6
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):
a,b = map(int,input().split())

if a*b % 2 == 0:
     print (Even)
else:
     print (Odd)

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

if a*b%2 == 0:
     print (Even)
else:
     print (Odd)

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

if a*b%2 == 0
     print (Even)
else:
     print (Odd)
Problem p03472 (python)

Fixed submission:
n,h = map(int,input().split())
x = []
for i in range(n):
	x.append(list(map(int,input().split())))

t = 0
c = []#強い投げ刀たち
M = max(x[i][0] for i in range(n))

for i in range(n):
	if x[i][1]>M-1:
		c.append(x[i][1])
c.sort()
c.reverse()

if sum(c)>h-1:
	for i in range(len(c)):
		t += 1
		h -= c[i]
		if h<1:
			print(t)
			break
else:
	h -=sum(c)
	q = (h-1)//M+1
	print(q+len(c))

Buggy submission (verdict: Runtime Error):
n,h = map(int,input().split())
x = []
for i in range(n):
	x.append(list(map(int,input().split())))

t = 0
c = []#強い投げ刀たち
M = max(x[i][0] for i in range(n))

for i in range(n):
	if x[i][1]>max(M)-1:
		c.append(x[i][1])
c.sort()
c.reverse()

if sum(c)>h-1:
	for i in range(len(c)):
		t += 1
		h -= c[i]
		if h<1:
			print(t)
			break
else:
	h -=sum(c)
	q = (h-1)//max(M)+1
	print(q+len(c))

Buggy submission (verdict: Runtime Error):
n,h = map(int,input().split())
x = []
for i in range(n):
	x.append(list(map(int,input().split())))

t = 0
c = []#強い投げ刀たち
M = x[i][0] for i in range(n)

for i in range(n):
	if x[i][1]>max(M)-1:
		c.append(x[i][1])
c.sort()
c.reverse()

if sum(c)>h-1:
	for i in range(len(c)):
		t += 1
		h -= c[i]
		if h<1:
			print(t)
			break
else:
	h -=sum(c)
	q = (h-1)//max(M)+1
	print(q+len(c))

Buggy submission (verdict: Runtime Error):
n,h = map(int,input().split())
x = []
for i in range(n):
	x.append(list(map(int,input().split())))

t = 0
c = []#強い投げ刀たち
for i in range(n):
	if x[i][1]>max(x[i][0] for i in range(n))-1:
		c.append(x[i][1])
c.sort()
c.reverse()

if sum(c)>h-1:
	for i in range(len(c)):
		t += 1
		h -= c[i]
		if h<1:
			print(t)
			break
else:
	h -=sum(c)
	q = (h-1)//max(a)+1
	print(q+len(c))

Buggy submission (verdict: Runtime Error):
n,h = map(int,input().split())
x = []
for i in range(n):
	x.append(list(map(int,input().split())))
a = []
for i in range(n):
	a.append(x[i][0])
b = []
for i in range(n):
	b.append(x[i][1])
x.sort(key = lambda x:x[1])

t = 0
c = []
if sum(b)>h-1:
	for i in range(n):
		t += 1
		h -= x[i+1][1]
		if h<1:
			print(t)
			break
else:
	for i in range(n):
		if b[i]>max(a)-1:
			c.append(b[i])
	h -=sum(c)
	q = h//max(a)
	print(q+len(c))
Problem p03495 (python)

Fixed submission:
import collections

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


a = collections.Counter(a)

a = a.most_common()
if k<len(a):
	x = 0
	for i in range(k,len(a)):
		x += a[i][1]

	print(x)
else:
	print(0)

Buggy submission (verdict: Runtime Error):
import collections

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


a = collections.Counter(a)

a = a.most_common()
if k<len(a):
	x = 0
	for i in range(k,len(a)):
		x += a[i][1]

	print(x)
else:
	print(0)
Problem p03573 (python)

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

if a==b:
     print(c)
elif a==c:
     print(b)
else:
     print(a)

Buggy submission (verdict: Runtime Error):
a = [int(input()) for i in range(1,4) ]

if a[1]==a[2]:
     print(a[3])
elif a[1]==a[3]:
     print(a[2])
else:
     print(a[1])
Problem p03597 (python)

Fixed submission:
N = int(input())
A = int(input())

print(N**2-A)

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

M = N*N-A

print(M)

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

print(N**2-A)
Problem p03610 (python)

Fixed submission:
s = input()

ans = ""
for i in range(len(s)):
	if i % 2 == 0:
		ans += s[i]
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans = ""
for i in range(len(s),2):
     ans += s[i]
print(ans)

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

ans = ""

for i in range(0,len(s),2)
	ans += s[i]
print(ans)

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

for i in S:
	if i%2>0:
		continue
	print('i')
Problem p02714 (python)

Fixed submission:
N = int(input())
S = input()
if N>3 :
  total = S.count("R")*S.count("G")*S.count("B")
  for i in range(0,N-2):
    for j in range(i+1,N-1):
      if 2*j-i<N:
        if S[i]!=S[j] and S[j]!=S[2*j-i] and S[2*j-i]!=S[i]:
          total-=1
  print(total)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
compte=0
r=[]
g=[]
b=[]
for i in range(n):
    if s[i]=="R":
        r.append(i)
    elif s[i]=="G":
        g.append(i)
    elif s[i]=="B":
        b.append(i)
 
for i in range(1,n-1):
    if n%2==0:
        if i<n//2:
            for j in range(1,i+1):
                if s[i]!=s[i-j] and s[i]!=s[i+j] and s[i+j]!=s[i-j]:
                    compte+=1
        else:
            for j in range(1,n-i):
                if s[i]!=s[i-j] and s[i]!=s[i+j] and s[i+j]!=s[i-j]:
                    compte+=1
    else:
            if i<(n-1)//2:
                for j in range(1,i+1):
                    if s[i]!=s[i-j] and s[i]!=s[i+j] and s[i+j]!=s[i-j]:
                        compte+=1
            elif i==(n-1)//2:
                for j in range(1,n-i):
                    if s[i]!=s[i-j] and s[i]!=s[i+j] and s[i+j]!=s[i-j]:
                        compte+=1
            elif i>(n-1)//2:
                for j in range(1,n-i):
                    if s[i]!=s[i-j] and s[i]!=s[i+j] and s[i+j]!=s[i-j]:
                        compte+=1
 
print(len(r)*len(g)*len(b)-count)
Problem p02657 (python)

Fixed submission:
a=input()
b=a.split()

print(int(b[0])*int(b[1]))

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

print(a*b)
Problem p02628 (python)

Fixed submission:

import sys
input = sys.stdin.readline

    
def inlt():
    return(list(map(int,input().split())))


n, k = inlt()
p = inlt()
p = sorted(p)
print(sum(p[:k]))

Buggy submission (verdict: Runtime Error):

import sys
import math
input = sys.stdin.readline

    
def inlt():
    return(list(map(int,input().split())))


n, k = inlt()
p = inlt()
p = math.sort(p)
print(sum(p[:k]))
Problem p02582 (python)

Fixed submission:
import re
r = 0
s = input()
if 'R' not in s:
  print(0)
else:
  x = re.findall('R+',s)
  if len(x) == 2:
      print(1)
  else:
      print(len(x[0]))

Buggy submission (verdict: Runtime Error):
r = 0
if 'r' not in s:
  print(0)
else:
  for i in range(len(s)):
    if s[i] == 'r' and i!=len(s)-1:
      for j in range(i+1,len(s)):
        if s[j] != 'r':
          break
      r = j-i
  print(r)
Problem p02789 (python)

Fixed submission:
a,b = input().split(' ')
if a == b:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
    a,b = input().split(' ')
    if a == b:
      print('Yes')
    else:
      print('No')
Problem p02639 (python)

Fixed submission:
a=list(map(int,input().split()))
print(a.index(0)+1)

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split()))
print(a.find(0)+1)
Problem p02765 (python)

Fixed submission:
a,b=map(int,input().split())
if a>=10:
    print(b)
else:
    print(b+100*(10-a))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a>=10:
    print(b)
else:
    print(b+100(10-a))

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if n>=10:
    print(b)
else:
    print(b+100(10-a))
Problem p02783 (python)

Fixed submission:
h,a=map(int,input().split())
cnt=0
while True:
    h-=a
    cnt+=1
    if h<=0:
        break
print(cnt)

Buggy submission (verdict: Runtime Error):
h,a=map(int,input.split())
cnt=0
while True:
    h-=a
    cnt+=1
    if h<=0:
        break
print(cnt)

Buggy submission (verdict: Runtime Error):
h,a=map(int,input.split())
cnt=0
while h>0:
    h-=a
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
h,a=map(int,input.split())
cnt=0
while h>=0:
    h-=a
    cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
h,a=map(int,input.split())
cnt=0
while h>=0:
    h-=a
    cnt+=1
print cnt
Problem p02969 (python)

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

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

Fixed submission:
a,b,t=map(int,input().split())
x=((t+0.5)//a)
print(int(x*b))

Buggy submission (verdict: Runtime Error):
a,b,t=map(int,input().split())
print(int(((t+0.5)//a*b))
Problem p03071 (python)

Fixed submission:
n=list(map(int,input().split()))
if n[0]==n[1]:
    print(n[0]*2)
else:
    print(max(n)*2-1)

Buggy submission (verdict: Runtime Error):
n=list(int(input().split()))
if n[0]==n[1]:
    print(n[0]*2)
else:
    print(max(n)*2-1)

Buggy submission (verdict: Runtime Error):
n=list(int(input()))
if n[0]==n[1]:
    print(n[0]*2)
else:
    print(max(n)*2-1)
Problem p03292 (python)

Fixed submission:
a=list(map(int,input().split()))
b=sorted(a)
print(b[1]-b[0]+b[2]-b[1])

Buggy submission (verdict: Runtime Error):
a=list(map(int,input().split()))
b=a.sorted
print(b[1]-b[0]+b[2]-b[1])
Problem p03415 (python)

Fixed submission:
a=input()
b=input()
c=input()
print(a[0]+b[1]+c[2])

Buggy submission (verdict: Runtime Error):
a=list(input().split())
b=list(input().split())
c=list(input().split())
print(a[0]+b[1]+c[2])
Problem p03501 (python)

Fixed submission:
n,a,b=map(int,input().split())
if n*a<b:
    print(n*a)
else:
    print(b)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
if n*a<b:
    print(n*a)
else:
    print(B)
Problem p03547 (python)

Fixed submission:
lst=['A','B','C','D','E','F']
a=input()
if lst.index(a[0])>lst.index(a[2]):
    print('>')
elif lst.index(a[0])==lst.index(a[2]):
    print('=')
else:
    print('<')

Buggy submission (verdict: Runtime Error):
lst=['A','B','C','D','E','F']
a=input()
if lst.index(a[0])>lst.index(a[1]):
    print('>')
elif lst.index(a[0])==lst.index(a[1]):
    print('=')
else:
    print('<')
Problem p03555 (python)

Fixed submission:
a=input()
b=input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
c11,c12,c13=map(int,input().split())
c21,c22,c23=map(int,input().split())
if c11==c23:
    print('YES')
elif c12==c22:
    print('YES')
elif c13==c31:
    print('YES')
else:
    print('NO')
Problem p03605 (python)

Fixed submission:
n=input()
if n.count('9')>=1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=input()
if n.count(9)>=1:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=input()
if n%10==9 or n>=90:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n=input()
if n//10==9 or n>=90:
    print('Yes')
else:
    print('No')
Problem p03623 (python)

Fixed submission:
x,a,b=map(int,input().split())
if abs(x-a)<=abs(x-b):
    print('A')
else:
    print('B')

Buggy submission (verdict: Runtime Error):
x,a,c=map(int,input().split())
if abs(x-a)<=abs(x-b):
    print('A')
else:
    print('B')

Buggy submission (verdict: Runtime Error):
import math
x,a,c=map(int,input().split())
if math.abs(x-a)<math.abs(x-b):
    print('A')
else:
    print('B')

Buggy submission (verdict: Runtime Error):
import math
x,a,c=map(int,input().split())
if math.fabs(x-a)<math.fabs(x-b):
    print('A')
else:
    print('B')
Problem p03657 (python)

Fixed submission:
a,b=map(int,input().split())
if a%3==0 or b%3==0 or (a+b)%3==0:
    print ('Possible')
else:
    print('Impossible')

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a%3==0 or b%3==0: or (a+b)%3==0:
    print ('Possible')
else:
    print('Impossible')
Problem p03777 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=(int(x) for x in input().split())
if a=='H':
    if b=='H':
        print("H")
    elif b=='D':
        print("D")
elif a=='D':
    if b=='H':
        print("D")
    elif b=='D':
        print("H")
Problem p02675 (python)

Fixed submission:
N = input()
n = N[-1:]

if n == "2" or n == "4" or n == "5" or n == "7" or n == "9":
    print("hon")
elif n == "0" or n == "1" or n == "6" or n == "8":
    print("pon")
elif n == "3":
    print("bon")

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

if N[-1:] == "2"or"4"or"5"or"7"or"9":
    print("hon")
elif N[-1:] == "0"or"1"or"6"or"8":
    print("pon")
elif N[-1:] == "3":
    print("bon")
Problem p02662 (python)

Fixed submission:
import sys
from collections import defaultdict
from queue import deque
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def egcd(a: int, b: int):
    """
    A solution of ax+by=gcd(a,b). Returns
    (gcd(a,b), (x, y)).
    """
    if a == 0:
        return b, 0, 1
    else:
        g, x, y = egcd(b % a, a)
        return g, y - (b // a) * x, x


def modinv(a: int, mod: int = 10**9 + 7):
    """
    Returns a^{-1} modulo m.
    """
    g, x, y = egcd(a, mod)
    if g > 1:
        raise Exception('{}^(-1) mod {} does not exist.'.format(a, mod))
    else:
        return x % mod


def main():
    N, S = geta(int)
    A = list(geta(int))
    A.sort()
    mod = 998244353

    inv2 = modinv(2, mod)

    dp = [[0] * (S + 1) for _ in range(N + 1)]
    for s in range(S + 1):
        dp[0][s] = 0

    _t = pow(2, N, mod)
    for n in range(N + 1):
        dp[n][0] = _t

    for i in range(1, N + 1):
        for j in range(1, S + 1):
            if j >= A[i - 1]:
                dp[i][j] = dp[i - 1][j - A[i - 1]] * inv2 + dp[i - 1][j]
            else:
                dp[i][j] = dp[i - 1][j]

            dp[i][j] %= mod

    print(dp[N][S])


if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
from collections import defaultdict
from queue import deque
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10**8)


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


def egcd(a: int, b: int):
    """
    A solution of ax+by=gcd(a,b). Returns
    (gcd(a,b), (x, y)).
    """
    if a == 0:
        return b, 0, 1
    else:
        g, x, y = egcd(b % a, a)
        return g, y - (b // a) * x, x


def modinv(a: int, mod: int = 10**9 + 7):
    """
    Returns a^{-1} modulo m.
    """
    g, x, y = egcd(a, mod)
    if g > 1:
        raise Exception('{}^(-1) mod {} does not exist.'.format(a, mod))
    else:
        return x % mod


import numpy as np


def main():
    N, S = geta(int)
    A = list(geta(int))
    A.sort()
    mod = 998244353

    inv2 = modinv(2, mod)

    dp = np.zeros((N + 1, S + 1), dtype=np.int64)

    _t = pow(2, N, mod)
    dp[:, 0] = _t
    for i in range(1, N + 1):
        dp[i, :] = dp[i - 1, :]
        if A[i - 1] <= S:
            tmp = np.roll(dp[i - 1, :], A[i - 1])
            tmp[:A[i - 1]] = 0
            dp[i, :] += tmp * inv2
            dp[i, :] %= mod

    print(dp[N][S])


if __name__ == "__main__":
    main()
Problem p02700 (python)

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

n1 = (a + d - 1) // d
n2 = (c + b - 1) // b

if n1 >= n2:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a, b, c, d = map(int, input().split())

n1 = (a + d - 1) // d
n2 = (c + b - 1) // b

if n1 => n2:
    print('Yes')
else:
    print('No')
Problem p02744 (python)

Fixed submission:

class Solution:

    def solve(self, N: int):

        def dfs(prev_str, num_used_char):
            if len(prev_str) == N:
                print(prev_str)
                return

            for i in range(num_used_char):
                c = chr(ord('a') + i)
                dfs(prev_str + c, num_used_char)

            c = chr(ord('a') + num_used_char)
            dfs(prev_str + c, num_used_char + 1)

        dfs('a', 1)


if __name__ == '__main__':

    # standard input
    N = int(input())
    # solve
    solution = Solution()
    answer = solution.solve(N)

Buggy submission (verdict: Runtime Error):
class Solution:
    def solve(self, H: int, W: int) -> int:

        if H == 1 or W == 1:
            return 1
        else:
            return (H*W + 1) // 2


if __name__ == '__main__':

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

    # solve
    solution = Solution()
    print(solution.solve(H, W))
Problem p02756 (python)

Fixed submission:
# standard input
S = input()
Q = int(input())
Query = []
num_reverse = 0

L = ''
R = ''

rev = False

for _ in range(Q):

    q = tuple(map(str, input().split()))

    if q[0] == '1':
        rev = (not rev)

    else:
        if (rev and q[1] == '1') or (not rev and q[1] == '2'):
            R = R + q[2]
        else:
            L = q[2] + L 

if rev:
    print( R[::-1] + S[::-1] + L[::-1])
else:
    print( L + S + R )

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


class Solution:

    def solve(self, S: str, Q: int, Query) -> int:

        num_reverse = 0
        for q in Query:
            if int(q[0]) == 1:
                num_reverse += 1
            else:
                if (num_reverse + int(q[1])) % 2 == 0:
                    S = S + q[2]
                else:
                    S = q[2] + S

        if num_reverse % 2 == 1:
            S = S[::-1]

        return S


if __name__ == '__main__':

    # standard input
    S = input()
    Q = int(input())
    Query = []
    for _ in range(Q):
        Query.append(tuple(input().split()))

    # solve
    solution = Solution()
    print(solution.solve(S, Q, Query))
Problem p02772 (python)

Fixed submission:
class Solution:
    def solve(self, N: int, A) -> str:

        for a in A:
            if a % 2 == 0:
                if a % 3 != 0 and a % 5 != 0:
                    return "DENIED"

        return "APPROVED"


if __name__ == '__main__':

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

    # solve
    solution = Solution()
    print(solution.solve(N, A))

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


class Solution:
    def solve(self, N: int, A) -> str:

        for a in A:
            if a % 2 == 0:
                if a % 3 != 0 and a % 5 != 0:
                    return "DENIED"

        return "APPROVED"


if __name__ == '__main__':

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

    # solve
    solution = Solution()
    print(solution.solve(N, A))
Problem p02787 (python)

Fixed submission:
import sys
from collections import defaultdict

readline = sys.stdin.buffer.readline


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


sys.setrecursionlimit(10**5)


def main():
    h, n = geta(int)
    a, b = [0] * (n + 1), [0] * (n + 1)
    for i in range(n):
        a[i + 1], b[i + 1] = geta(int)

    INF = 10**9
    dp = [[INF] * (h + 1) for _ in range(n + 1)]

    for i in range(1, n + 1):
        for j in range(0, h + 1):
            if j <= a[i]:
                dp[i][j] = min(b[i], dp[i - 1][j])
            else:
                dp[i][j] = min(dp[i][j - a[i]] + b[i], dp[i - 1][j])

    print(dp[n][h])


if __name__ == "__main__":
    main()

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

readline = sys.stdin.buffer.readline


def geta(fn=lambda s: s.decode()):
    return map(fn, readline().split())


def gete(fn=lambda s: s.decode()):
    return fn(readline().rstrip())


sys.setrecursionlimit(10**5)


def main():
    h, n = geta(int)
    a, b = [0] * (n + 1), [0] * (n + 1)
    for i in range(n):
        a[i + 1], b[i + 1] = geta(int)

    INF = 10**9
    dp = [[INF] * (h + 1) for _ in range(n + 1)]

    for i in range(1, n + 1):
        for j in range(0, a[i] + 1):
            dp[i][j] = min(b[i], dp[i - 1][j])

        for j in range(a[i] + 1, h + 1):
            dp[i][j] = min(dp[i][j - a[i]] + b[i], dp[i - 1][j])

    print(dp[n][h])


if __name__ == "__main__":
    main()
Problem p02789 (python)

Fixed submission:

class Solution:
    def solve(self, N: int, M: int) -> str:
        if N == M:
            return 'Yes'
        else:
            return 'No'


if __name__ == '__main__':

    # standard input
    N, M = map(int, input().split())

    # solve
    solution = Solution()
    print(solution.solve(N, M))

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


class Solution:
    def solve(self, N: int, M: int) -> str:
        if N == M:
            return 'Yes'
        else:
            return 'No'


if __name__ == '__main__':

    # standard input
    N, M = map(int, input().split())

    # solve
    solution = Solution()
    print(solution.solve(N, M))
Problem p02791 (python)

Fixed submission:
class Solution:
#    def solve(self, N: int, P: List[int]) -> int:
    def solve(self, N, P) :
        max_p = N
        answer = 0

        for pn in P:
            if pn <= max_p:
                answer += 1
                max_p = pn

        return answer


if __name__ == '__main__':

    # standard input
    N = int(input())

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

    # solve
    solution = Solution()
    print(solution.solve(N, P))

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


class Solution:
    def solve(self, N: int, P: List[int]) -> int:

        max_p = N
        answer = 0

        for pn in P:
            if pn <= max_p:
                answer += 1
                max_p = pn

        return answer


if __name__ == '__main__':

    # standard input
    N = int(input())

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

    # solve
    solution = Solution()
    print(solution.solve(N, P))

Buggy submission (verdict: Runtime Error):

class Solution:
    def solve(self, N: int, P: List[int]) -> int:

        max_p = N
        answer = 0

        for pn in P:
            if pn <= max_p:
                answer += 1
                max_p = pn

        return answer


if __name__ == '__main__':

    # standard input
    N = int(input())

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

    # solve
    solution = Solution()
    print(solution.solve(N, P))
Problem p02806 (python)

Fixed submission:
N = int(input())
t = []
index = {}
for n in range(N):
    si, ti = input().split()
    ti = int(ti)
    index[si] = n
    t.append(ti)

X = input()

ans = 0
for i in range(index[X]+1, N):
    ans += t[i]

print(ans)

Buggy submission (verdict: Runtime Error):
t = []
index = {}
for n in range(N):
    si, ti = input().split()
    ti = int(ti)
    index[si] = n
    t.append(ti)

X = input()

ans = 0
for i in range(index[X]+1, N):
    ans += t[i]

print(ans)