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

Fixed submission:
n = int(input())

s = input()
a = [str(c) for c in s]

c = 0

for i in range(n-2):
  if a[i] == 'A' and a[i+1] == 'B' and a[i+2] == 'C':
    c +=1
  else:
    continue
    
print(c)

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

s = input()
a = [str(c) for c in s]

c = 0

for i in range(n):
  if a[i] == 'A' and a[i+1] == 'B' and a[i+2] == 'C':
    c +=1
  else:
    continue
    
print(c)
Problem p02917 (python)

Fixed submission:
n = int(input())

b = list(map(int, input().split()))
a=[0]*n
a[0]=b[0]
a[n-1]=b[n-2]

for i in range(1, n-1):
	if b[i]>=b[i-1]:
		a[i]=b[i-1]
	else:
		a[i]=b[i]
s = 0
for i in range(n):
	s += a[i]
	
print(s)

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

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

a[0]=b[0]
a[n-1]=b[n-2]

for i in range(1, n-1):
  if b[i] >= b[i-1]:
    a[i] = b[i-1]
  else:
    a[i] = b[i]

c = 0

for i in range(n):
  c += a[i]
print(c)
Problem p02957 (python)

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

if (a + b) % 2 ==0:
  print((a+b)//2)
else:
  print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
c = 0
for i in range(n):
  if a[i] != i + 1:
    c+=1
    
if c == 0 or c == 2:
  print('YES')
  
else:
  print('NO')
Problem p02830 (python)

Fixed submission:
n = int(input())
rawString = str(input())
splitString = rawString.split()
s = splitString[0]
t = splitString[1]

result = ""
for i in range(n):
  result += s[i]
  result += t[i]
print(result)

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

result = ""
for i in range(n):
  result += s[i]
  result += t[i]
print(result)

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

result = ""
for i in range(n):
  result += s[i]
  result += t[i]
print(result)
Problem p03160 (python)

Fixed submission:
from functools import lru_cache
import sys

iMaxStackSize = 5000000
sys.setrecursionlimit(iMaxStackSize)
n = int(input())
heights = [int(x) for x in input().split()]

@lru_cache(None)
def solve(i):
    if i == n - 1:
        return 0
    if i + 2 >= len(heights):
        return abs(heights[i + 1] - heights[i])
    option1 = abs(heights[i] - heights[i + 1])
    option1 += solve(i + 1)
    option2 = abs(heights[i] - heights[i + 2])
    option2 += solve(i + 2)
    return min(option1, option2)

print(solve(0))

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

iMaxStackSize = 5000
sys.setrecursionlimit(iMaxStackSize)
n = int(input())
heights = [int(x) for x in input().split()]

@lru_cache(None)
def solve(i):
    if i == n - 1:
        return 0
    if i + 2 >= len(heights):
        return abs(heights[i + 1] - heights[i])
    option1 = abs(heights[i] - heights[i + 1])
    option1 += solve(i + 1)
    option2 = abs(heights[i] - heights[i + 2])
    option2 += solve(i + 2)
    return min(option1, option2)

print(solve(0))

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

n = int(input())
heights = [int(x) for x in input().split()]

@lru_cache(None)
def solve(i):
    if i == n - 1:
        return 0
    if i + 2 >= len(heights):
        return abs(heights[i + 1] - heights[i])
    option1 = abs(heights[i] - heights[i + 1])
    option1 += solve(i + 1)
    option2 = abs(heights[i] - heights[i + 2])
    option2 += solve(i + 2)
    return min(option1, option2)

print(solve(0))
Problem p02579 (python)

Fixed submission:
h,w = list(map(int,input().split()))
sx, sy = list(map(int,input().split()))
gx, gy = list(map(int,input().split()))
maze = [list(input()) for _ in range(h)]
sx -= 1; sy -= 1; gx -= 1; gy -= 1

mx = [0,1,0,-1]
my = [1,0,-1,0]
mazemap = [[10**9]*w for _ in range(h)]
from collections import deque
q = deque()
nq = deque()
q.append([sx,sy,0])

while q or nq:
    x,y,z = q.popleft() if q else nq.popleft()
    if x == gx and y == gy:
        ans = z
        break
    for i in range(4):
        nx = x + mx[i]; ny = y + my[i]
        if 0 <= nx < h and 0 <= ny < w and maze[nx][ny] != "#" and mazemap[nx][ny] > z:
            q.append([nx,ny,z])
            mazemap[nx][ny] = z
        for i in range(-2,3):
            for j in range(-2,3):
                nx = x+i; ny = y+j
                if 0 <= nx < h and 0 <= ny < w and maze[nx][ny] != "#" and mazemap[nx][ny] > z+1:
                    nq.append([nx,ny,z+1])
                    mazemap[nx][ny] = z+1
else:
    ans = -1

print(ans)

Buggy submission (verdict: Runtime Error):
h,w = list(map(int,input().split()))
sx, sy = list(map(int,input().split()))
gx, gy = list(map(int,input().split()))
maze = [list(input()) for _ in range(h)]
sx -= 1; sy -= 1; gx -= 1; gy -= 1

mx = [0,1,0,-1]
my = [1,0,-1,0]
mazemap = [[10**9]*w for _ in range(h)]
from collections import deque
q = deque()
nq = deque()
q.append([sx,sy,0])

while q or nq:
    x,y,z = q.popleft() if q else nq.popleft()
    if x == gx and y == gy:
        ans = z
        break
    for i in range(4):
        nx = x + mx[i]; ny = y + my[i]
        if 0 <= nx < h and 0 <= ny < w and maze[nx][ny] != "#" and mazemap[nx][ny] > z:
            q.append([nx,ny,z])
            mazemap[nx][ny] = z
            fast += 1
        for i in range(-2,3):
            for j in range(-2,3):
                nx = x+i; ny = y+j
                if 0 <= nx < h and 0 <= ny < w and maze[nx][ny] != "#" and mazemap[nx][ny] > z+1:
                    nq.append([nx,ny,z+1])
                    mazemap[nx][ny] = z+1
else:
    ans = -1

print(ans)
Problem p02628 (python)

Fixed submission:
n,k = list(map(int,input().split()))
arr = list(map(int,input().split()))
arr.sort()
print(sum(arr[:k]))

Buggy submission (verdict: Runtime Error):
n,k = list(map(int,input().split()))
arr = list(map(int,input().split()))
arr.sort()
print(sum(arr[:k])
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = list(map(int,input().split()))
pritn(a*b)
Problem p02658 (python)

Fixed submission:
n = int(input())
arr = list(map(int,input().split()))
arr.sort(reverse=True)
ans = 1
limit = 10**18

if arr[-1] == 0:
  ans = 0
else:
  for i in arr:
    ans *= i
    if ans > limit:
      ans = -1
      break
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
arr = list(map(int,input().split()))
arr.sort(reverse=True)
ans = 1
limit = 10 * 18

if arr[-1] == 0:
  ans = 0
else:
  for i in arr:
    ans *= arr[i]
    if ans > limit:
      ans = -1
      break
print(ans)
Problem p02678 (python)

Fixed submission:
n,m = list(map(int,input().split()))
path = [list(map(int,input().split())) for _ in range(m)]

graph = [[] for _ in range(n)]
for a,b in path:
    graph[a-1].append(b-1); graph[b-1].append(a-1)

parents = [-1]*n
tmparr = []
children = [0]
flags = [True] * n
flags[0] = False

while any(flags):
    while children:
        tmp = children.pop()
        for node in graph[tmp]:
            if flags[node]:
                flags[node] = False
                parents[node] = tmp
                tmparr.append(node)
    children = tmparr[:]
    tmparr = []
    
print("Yes")
for i in parents[1:]:
    print(i+1)

Buggy submission (verdict: Runtime Error):
n,m = list(map(int,input().split()))
path = [list(map(int,input().split())) for _ in range(m)]

graph = [[] for _ in range(m)]
for a,b in path:
    graph[a-1].append(b-1); graph[b-1].append(a-1)

parents = [-1]*n
children = [[] for _ in range(n)]
orders = []
stack = [0]
flags = [True] * n
flags[0] = False

while any(flags):
    while stack:
        tmp = stack.pop()
        for node in graph[tmp]:
            if flags[node]:
                flags[node] = False
                children[tmp].append(node)
                parents[node] = tmp
                orders.append(node)
    stack = orders[:]
    
print("Yes")
for i in parents[1:]:
    print(i+1)
Problem p02720 (python)

Fixed submission:
k = int(input())

numset = {i for i in range(1,10)}
flag = False
count = len(numset)
if count >= k:
    flag = True
arr = [numset]
index = 0

while not flag:
    beforeset = arr[index]
    tmpset = set()
    for i in beforeset:
        tail = str(i)[-1]
        if tail == "0":
            tmpset.add(int(str(i)+str(0)))
            tmpset.add(int(str(i)+str(1)))
        elif tail == "9":
            tmpset.add(int(str(i)+str(8)))
            tmpset.add(int(str(i)+str(9)))
        else:
            tmpset.add(int(str(i)+str(int(tail))))
            tmpset.add(int(str(i)+str(int(tail)+1)))
            tmpset.add(int(str(i)+str(int(tail)-1)))
    count += len(tmpset)
    if count >= k:
        flag = True
    arr.append(tmpset)
    index += 1
    
totalarr = []
for tmpset in arr:
    totalarr += list(tmpset)
    
totalarr.sort()
print(totalarr[k-1])

Buggy submission (verdict: Runtime Error):
k = int(input())
from collections import deque
queue = deque(range(1,10))
count = 0

while count < k:
  count += 1
  tmp = deque.popleft()
  tail = tmp % 10
  if tail!=0:
    deque.append(tmp*10+tail-1)
  deque.append(tmp*10+tail)
  if tail!=9:
    deque.append(tmp*10+tail+1)
  
print(tmp)

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

from collection import deque
queue = deque(range(1,10))
count = 0
while count < k:
  count += 1
  tmp = queue.popleft()
  tail = tmp%10
  if tail != 0:
    queue.append(10*tmp+tail-1)
  queue.append(10*tmp)
  if tail != 9:
    queue.append(10*tmp+tail+1)

print(tmp)
Problem p02727 (python)

Fixed submission:
x,y,a,b,c = map(int,input().split())
parr = list(map(int,input().split()))
qarr = list(map(int,input().split()))
rarr = list(map(int,input().split()))

parr.sort(reverse=True)
qarr.sort(reverse=True)
rarr.sort(reverse=True)
parr = parr[:x]
qarr = qarr[:y]
arr = parr + qarr + rarr
arr.sort(reverse=True)
print(sum(arr[:x+y]))

Buggy submission (verdict: Runtime Error):
2 2 4 4 4
11 12 13 14
21 22 23 24
1 2 3 4
Problem p02728 (python)

Fixed submission:
n = int(input())
arr = [list(map(int,input().split())) for _ in range(n-1)]
mod = 10**9+7

graph = [[] for _ in range(n)]
for a,b in arr:
    graph[a-1].append(b-1)
    graph[b-1].append(a-1)

parents = [-1] * n
children = [[] for _ in range(n)]
flags = [True] * n; flags[0] = False
stack = [0]
orders = []

while stack:
    index = stack.pop()
    orders.append(index)
    for child in graph[index]:
        if flags[child]:
            parents[child] = index
            children[index].append(child)
            flags[child] = False
            stack.append(child)

fac = [1] * (n+10)
inv = [1] * (n+10)
ifac = [1] * (n+10)
for i in range(2,n+10):
    fac[i]=(fac[i-1]*i)%mod
    inv[i]= -(inv[mod%i]*(mod//i))%mod
    ifac[i]=(ifac[i-1]*inv[i])%mod

size = [1] * n
dp = [1] * n
for parent in orders[::-1]:
    for child in children[parent]:
        size[parent] += size[child]
        dp[parent] = dp[parent] * dp[child] * ifac[size[child]] % mod
    dp[parent] = dp[parent] * fac[size[parent]-1] % mod

size2 = [n-i+1 for i in size]
dp2 = [1] * n
for parent in orders[1:]:
    child = parents[parent]
    dp2[parent] = dp2[parent] * fac[size2[parent]-2] * dp[child] * dp2[child] * fac[size[parent]] * ifac[size2[child]-1] * ifac[size[child]-1] * pow(dp[parent], mod-2, mod) % mod
    
for i in range(n):
    print(fac[n-1] * ifac[size[i]-1] * ifac[size2[i]-1] * dp[i] * dp2[i] % mod)

Buggy submission (verdict: Runtime Error):
n = int(input()); arr = [list(map(int,input().split())) for _ in range(n-1)]
graph = [[] for _ in range(n)]
for a,b in arr:
    graph[a-1].append(b-1);graph[b-1].append(a-1)

mod = 10**9+7
fac = [1]*(n+1)
inv = [1]*(n+1)
ifac = [1]*(n+1)
for i in range(2,n+1):
    fac[i] = fac[i-1] * i % mod
    inv[i] = (- (mod//i)*inv[(mod%i)]) % mod
    ifac[i] = ifac[i-1] * inv[i] % mod

parents = [-1]*n
children = [[] for _ in range(n)]
orders = []
stack = [0]
flags = [True] * n; flags[0] = False
while stack:
    tmp = stack.pop()
    orders.append(tmp)
    for node in graph[tmp]:
        if flags[node]:
            flags[node] = False
            children[tmp].append(node)
            stack.append(node)
            parents[node] = tmp

size = [1] * (n+1)
dp = [1] * (n+1)    
for child in orders[::-1]:
    parent = parents[child]
    size[parent] += size[child]
    dp[child] = dp[child] * fac[size[child]-1] % mod
    dp[parent] = dp[parent] * dp[child] * ifac[size[child]] % mod
_ = size.pop();_ = dp.pop()

size2 = [n-i+1 for i in size]
dp2 = [1] * n
for parent in orders[1:]:
    child = parents[parent]
    #dp2[parent] = dp2[parent] * fac[size2[parent]-2] * dp2[child] * ifac[size2[child]-1] * dp[child] * ifac[size[child]-1] * pow(dp[parent], mod-2, mod) * fac[size[parent]] % mod
    dp2[parent] = dp2[parent] * fac[n-1] * size[parent] * dp2[child] ifac[size2[child]] % mod
    
for i in range(n):
    #print(fac[n-1]*dp[i]*ifac[size[i]-1]*dp2[i]*ifac[size2[i]-1] % mod)
    print(dp2[i])
Problem p02733 (python)

Fixed submission:
h,w,k = list(map(int,input().split()))
arr = [[int(i) for i in input()] for _ in range(h)]

from itertools import product
ans = 2000

for idx,cond in enumerate(product((True,False),repeat=h-1)):
    div = sum(cond)
    spl = [arr[0][:]]
    for i in range(h-1):
        if cond[i]:
            spl.append(arr[i+1][:])
        else:
            spl[-1] = [spl[-1][j] + arr[i+1][j] for j in range(w)]
    num = len(spl)
    cnt = [0]*num
    
    for v in range(w):
        tmp = [spl[i][v] for i in range(num)]
        if max(tmp) > k:
            break
        if max([cnt[i] + tmp[i] for i in range(num)]) > k:
            div += 1
            cnt = tmp[:]
        else:
            cnt  = [cnt[i] + tmp[i] for i in range(num)]
    else:    
        ans = min(ans,div)
            
print(ans)

Buggy submission (verdict: Runtime Error):
h,w,k = list(map(int,input().split()))
arr = [[int(i) for i in input()] for _ in range(h)]

from itertools import product
ans = [0]*(2**(h-1))

for idx,cond in enumerate(product((True,False),repeat=h-1)):
    div = sum(cond)
    spl = [arr[0][:]]
    for i in range(h-1):
        if h_cond[i]:
            spl.append(arr[i+1][:])
        else:
            spl[-1] = [spl[-1][j] + arr[i+1][j] for j in range(w)]
    num = len(spl)
    cnt = [0]*num
    
    for v in range(w):
        tmp = [spl[i][v] for i in range(num)]
        if max(tmp) > k:
            break
        if max([cnt[i] + tmp[i] for i in range(num)]) > k:
            div += 1
            cnt = tmp[:]
        else:
            cnt  = [cnt[i] + tmp[i] for i in range(num)]
    else:    
        ans = min(ans,div)
            
print(min(ans))

Buggy submission (verdict: Runtime Error):
h,w,k = list(map(int,input().split()))
arr = [input() for _ in range(h)]

from itertools import product
import numpy as np
ans = [0] * (2**(h-1))
ans_index = 0

for horizontal_condition in product((True,False),repeat=h-1):
    count = np.zeros(h)
    divide = sum(horizontal_condition)
    trans_matrix = np.zeros((h,h))
    trans_matrix[0,0] = 1
    down = 0
    right = 0
    
    for i in horizontal_condition:
        if i:
            down += 1
        right += 1
        trans_matrix[down,right] = 1
        
    for vertical_divide in range(w):
        tmparr = np.array([int(i[vertical_divide]) for i in arr])
        addarr = np.dot(trans_matrix,tmparr)
        if max(count+addarr) > k:
            count = addarr
            divide += 1
        else:
            count += addarr
            
    ans[ans_index] = divide
    ans_index += 1
    
print(min(ans))
Problem p02888 (python)

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

arr.sort(reverse=True)
count = 0
for i in range(n-2):
    j = i+1
    k = n-1
    while j < k:
        if arr[i] < arr[j] + arr[k]:
            count += k-j
            j += 1
        else:
            k -= 1
print(count)

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
arr = list(map(int,input().split()))

arr.sort(reverse = True)
count = 0
combiarr = [[arr[i]+arr[j] if i < j else 0 for j in range(n)] for i in range(n)]
combiarr = np.array(combiarr)
for i in range(n-2):
    long = arr[i]
    tmparr = combiarr[i+1:,i+1:] - long
    count += sum(sum(tmparr > 0))    
    
print(count)
Problem p02889 (python)

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

N,M,L = map(int,input().split())
ABC = [list(map(int,input().split())) for _ in [0]*M]
Q = int(input())
ST = [list(map(int,input().split())) for _ in [0]*Q]


INF = (L+1)*N
d = [[INF]*N for _ in [0]*N]
for i in range(N):
    d[i][i] = 0
for a,b,c in ABC:
    a-=1;b-=1
    d[a][b] = c
    d[b][a] = c

def Warshall_Floyd(d,N=None):
    if N==None : N = len(d)
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j],d[i][k]+d[k][j])

Warshall_Floyd(d,N)

d2 = [None]*N
for i,row in enumerate(d):
    d2[i] = [1 if e<=L else INF for e in row]
    d2[i][i] = 0

Warshall_Floyd(d2,N)

for s,t in ST:
    s-=1;t-=1
    ans = (d2[s][t]%INF)-1
    print(ans)

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

n,m,l = map(int,input().split())
town = [list(map(int,input().split())) for _ in range(m)]
q = int(input())
query = [list(map(int,input().split())) for _ in range(q)]

def warshall_floyd(d,n):
    for i in range(n):
        for j in range(n):
            for k in range(n):
                d[i][j] = min(d[i][j],d[i][k]+d[k][j])

inf = (l+1)*n
d = [[inf]*n for _ in range(n)]
for i in range(n):
    d[i][i] = 0
for a,b,c in town:
    a -= 1
    b -= 1
    d[a][b] = c
    d[b][a] = c
    
warshall_floyd(n,d)

d2 = [None]*n
for i,row in enumerate(d):
    d2[i] = [1 if val<=l else inf for val in row]
    d2[i][i] = 0

warshall_floyd(n,d2)
 
for s,t in query:
    s -= 1
    t -= 1
    count = (d2[s][t]%inf)-1
    print(count)
Problem p02921 (python)

Fixed submission:
s = input()
t = input()

count = 0

for i in range(3):
    if s[i] == t[i]:
        count += 1
        
print(count)

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

count = 0

for i in range(3);:
    if s[i] == t[i]:
        count += 1
        
print(count)
Problem p02999 (python)

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

Buggy submission (verdict: Runtime Error):
N ,X = map(int, input().split())
difs = list(map(int, input().split()))
steps = [0]
for i in range(N):
    steps.append(steps[i] + difs[i])
for i in range(N+1):
    if steps[i] > X:
        print(i)
        break
    elif i == N:
        print(N+1)
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split()
print(a*b)
Problem p02755 (python)

Fixed submission:
a,b=map(int,input().split())
a_s=a/0.08
a_t=(a+1)/0.08
b_s=b/0.1
b_t=(b+1)/0.1

a0=int(a_s)
a1=int(a_t)
b0=int(b_s)
b1=int(b_t)


if (a_s-a0)>0:
  a0+=1
if (a_t-a1)<=0:
  a1-=1
if (b_s-b0)>0:
  b0+=1
if (b_t-b1)<=0:
  b1-=1

lista=[i for i in range(a0,a1+1)]
listb=[i for i in range(b0,b1+1)]

ansl=[]
for j in range(len(lista)):
  if lista[j] in listb:
    ansl.append(lista[j])

if not ansl==[]:
  ans=ansl[0]
  print(ans)
else:
  print(-1)

Buggy submission (verdict: Runtime Error):
a_s=a/1.08
a_t=(a+1)/1.08
b_s=b/1.1
b_t=(b+1)/1.1

a0=int(a_s)
a1=int(a_t)
b0=int(b_s)
b1=int(b_t)


if (a_s-a0)>0:
  a0+=1
if (a_t-a1)<=0:
  a1-=1
if (b_s-b0)>0:
  b0+=1
if (b_t-b1)<=0:
  b1-=1

lista=[i for i in range(a0,a1+1)]
listb=[i for i in range(b0,b1+1)]

ansl=[]
for j in range(len(lista)):
  if lista[j] in listb:
    ansl.append(lista[j])

if not ansl==[]:
  ans=ansl[0]
  print(ans)
else:
  print(-1)
Problem p02765 (python)

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

Buggy submission (verdict: Runtime Error):
n,r=map(int,input())
if n<=10:
  print(r)
else:
  print(r-100*(10-n))
Problem p02768 (python)

Fixed submission:
n,a,b=map(int,input().split())
mod=10**9+7
def comb(n,k,mod):
  if k>n-k:
    k=n-k
  c=1
  for i in range(n-k+1,n+1):
    c*=i
    c%=mod
  d=1  
  for i in range(1,k+1):
    d*=i
    d%=mod
  return (c*pow(d,mod-2,mod))%mod

ans=pow(2,n,mod)-1-comb(n,a,mod)-comb(n,b,mod)
print(ans%mod)

Buggy submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
mod=10**9+7
from math import pow
def comb(n,k,mod):
  if k>n-k:
    k=n-k
  c=1
  for i in range(n-k+1,n+1):
    c*=i
  d=1  
  for i in range(1,k+1):
    d*=i
return(c*pow(d,mod-2,mod)%mod)

ans=(2**n-1)-comb(n,a,mod)-comb(n,b,mod)
return (ans%mod)
Problem p02784 (python)

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

if sum(a)>=h:
  print("Yes")
else:
  print("No")

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

if sum(a)>=h:
  print("Yes")
else:
  print("No")

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

if sum(a)>=h:
  print("Yes")
else:
  print("No")
Problem p02787 (python)

Fixed submission:
import numpy as np
h,n=map(int,input().split())
p=[list(map(int,input().split())) for _ in range(n)]
m=10**4
dp=[0]*(h+m+1)
for i in range(m+1,h+m+1):
  dp[i]=min(dp[i-a]+b for a,b in p)
print(dp[h+m])

Buggy submission (verdict: Runtime Error):
import numpy as np
h,n=map(int,input().split)
p=[list(map(int,input().split())) for _ in range(n)]
m=max(p[:,0])
dp=[0]*(h+m+1)
for i in range(m+1,h+m+1):
  dp[i]=min(dp[i-a]+b for a,b in p)
print(dp[h+m])
Problem p02788 (python)

Fixed submission:
from collections import deque
n,d,a=map(int,input().split())
xh=[list(map(int,input().split())) for _ in range(n)]
xh.sort()
d=2*d
ans=0
total=0
q=deque()
for i in range(n):
  x,h=xh[i]
  while len(q)>=1 and x>q[0][0]:
    total-=q.popleft()[1]
  h-=total
  if h>0:
    num=(h-1)//a+1
    damage=a*num
    ans+=num
    total+=damage
    q.append([x+d,damage])
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
n,d,a=map(int,input().split())
xh=[map(int,input().split()) for _ in range(n)]
xh.sort()
D=2*D
ans=0
total=0
q=deque()
for i in range(n):
  x,h=xh[i]
  while len(q)>=1 and x>q[0][0]:
    total-=q.popleft()[1]
  h-=total
  if h>0:
    num=(h-h%a)//a
    damage=a*nim
    ans+=num
    total+=damage
    q.append([x+D,damage])
print(ans)
Problem p02789 (python)

Fixed submission:
N,M=map(int,input().split())
if N==M:
  print("Yes")
else:
  print("No")

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

Fixed submission:
n=int(input())
lst=list(map(int,input().split()))
premin=lst[0]
ans=0
for x in lst:
  if premin>=x:
    ans+=1
    premin=x
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
lst=list(map(int,input().split()))
premin=lst[0]
ans=0
for x in lst:
  if min_list>=x:
    ans+=1
    premin=x
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
lst=list(map(int,input().split()))
premin=[lst[0]]
ans=0
for x in lst:
  if min_list>=x:
    ans+=1
    premin=x
print(ans)
Problem p02801 (python)

Fixed submission:
C=str(input())
a=ord(C)
print(chr(a+1))

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=list(map(int,input().split()))
mod=10**9+7
a.sort()
def fact(n):
  if n==0:
    return 1
  else:
    s=1
    for i in range(1,n+1):
      s=s*i
    return s
def comb(n,k,mod):
  return (fact(n)//fact(k)//fact(n-k))%mod

if k>1:
  s=0
  for i in range(0,n-k):
    for j in range(i+k-1,n-1):
      s+=((a[j]-a[i])*comb(j-i-1,k-2,mod))%mod
  print(s%mod)
else:
  print(0)