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

Fixed submission:
import math
query=[int(x) for x in input().split()]
N = query[0]
K = query[1]
l=[int(x) for x in input().split()]
SUM=sum(l)
if N-SUM<=0:
    print("Yes")
else:
   print("No")

Buggy submission (verdict: Runtime Error):
import math
query=[int(x) for x in input().split()]
N = query[0]
K = query[1]
l=[int(x) for x in input().split()]
SUM=sum(l)
if N-SUM
Problem p02789 (python)

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

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

Fixed submission:
[n, r] = map(int, input().rstrip().split(' '))

if n > 10:
    print(r)
else:
    print(r + 100 * (10 - n))

Buggy submission (verdict: Runtime Error):
[n, r] = map(int, input().rstrip().split(' '))

if n > 10:
    return r
else:
    return r - 100 * (10 - n)
Problem p02947 (python)

Fixed submission:
import collections

n = int(input())

s = [",".join(sorted(input())) for i in range(n)]

c = collections.Counter(s)

ans = 0
for i in c.values():
  ans += i*(i-1)//2

print(ans)

Buggy submission (verdict: Runtime Error):
import collections

n = int(input())

s = [",".join(sorted(input())) for i in range(n)]

c = collections.Counter(s)

ans = 0
for i in c.valuses():
  ans += i*(i-1)//2

print(ans)
Problem p02981 (python)

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

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

Fixed submission:
l=[]
m=[]
n=[]
a=0
for i in range(5):
  s=int(input())
  n.append(s)
  m.append(round(int(s+5),-1))
  if s%10 != 0:
    l.append(s%10)
    a+=1
if a ==0:
  print(sum(n))
else:
  print(sum(m)+min(l)-10)

Buggy submission (verdict: Runtime Error):
l=[]
m=[]
n=[]
for i in range(5):
  s=int(input())  
  m.append(round(int(s+5),-1))
  if s%10 != 0:
    l.append(s%10)
print(sum(m)+min(l)-10)
Problem p03109 (python)

Fixed submission:
y, m, d = map(str, input().split("/"))
if int(y) < 2019 or (int(y) == 2019 and int(m) < 5):
  print("Heisei")
else:
  print("TBD")

Buggy submission (verdict: Runtime Error):
y,m,d = map(int,input().split(/))
if y<2019 or (y==2019 and m <= 4):
  print("Heisei")
else:
  print("TBD")
Problem p03210 (python)

Fixed submission:
x=int(input())
if x == 7 or x == 5 or x == 3:
	print("YES")
else:
	print("NO")

Buggy submission (verdict: Runtime Error):
x=int(input())
if x == 7 or x == 5 or x == 3:
print('YES')
else:
print('NO')

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

Buggy submission (verdict: Runtime Error):
x=input()
if x == 7 or x == 5 or x == 3:
print("YES")
else:
print("NO")

Buggy submission (verdict: Runtime Error):
x=input()
if (x == 7) or (x == 5) or (x == 3):
print("YES")
else:
print("NO")

Buggy submission (verdict: Runtime Error):
x=input()
if x == 7 or 5 or 3:
print("YES")
else:
print("NO")
Problem p03211 (python)

Fixed submission:
x = 753
s = input()
ans=10**10
for i in range(len(s)-2):
	if(abs(x-int(s[i:i+3]))<ans):
		ans=abs(x-int(s[i:i+3]))
print(ans)

Buggy submission (verdict: Runtime Error):
x = 753
s = input()
ans=100
for i in range(len(s)-2):
	if(abs(x-int(s[i:i+3]))<ans):
		ans=abs(x-int(s[i:i+3))
print(ans)

Buggy submission (verdict: Runtime Error):
x = 753
s = int(input())
ans=10**10
for i in range(len(s)-2):
	if(abs(x-int(s[i:i+3]))<ans):
		ans=abs(x-int(s[i:i+3))
print(ans)

Buggy submission (verdict: Runtime Error):
x = 753
s = int(input())
ans=100
for i in range(len(s)-2):
	if(abs(x-int(s[i:i+3]))<ans):
		ans=abs(x-int(s[i:i+3))
print(ans)
Problem p03353 (python)

Fixed submission:
S = input()
K = int(input())
L=set()
for i in range(K):
    for j in range(len(S)-i):
        L.add((S[j:j+i+1]))
L = sorted(list(L))
print(L[K-1])

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
L=set()
for i in range(len(K)):
    for j in range(len(S)-i):
        L.add((S[j:j+i+1]))
L = sorted(list(L))
print(L[K-1])
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):
n = int(input())
for i in range(n):
    t, x, y = map(int, input().split())
    if x + y < t or (x + y + t) % 2:
        print("No")
        exit()
print("Yes")
Problem p03456 (python)

Fixed submission:
from math import sqrt
a,b = map(str,input().split())
ab= int(a+b)
if int(sqrt(ab))**2 == ab:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b = map(str,input().split())
ab= int(a+b)
if int(squrt(ab))**2 == ab:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
a,b = map(str,input().split())
ab= int(a+b)
if int(squrt(ab))**2 == ab:
  print("Yes")
else:
  print("No")
Problem p03838 (python)

Fixed submission:
x, y = map(int, input().split())
if (0 <= x  < y) or (x < y <= 0):
  print(y - x)
elif (0 < y < x) or (y < x < 0):
  ans = 2 + abs(x - y)
  print(ans)
else:
  ans = 1 + abs(abs(x) - abs(y))
  print(ans)

Buggy submission (verdict: Runtime Error):
x, y = map(int, input().split())
if (0 =< x < y) or (x < y =< 0):
  print(y - x)
elif (0 < y < x) or (y < x < 0):
  ans = 2 + abs(x - y)
  print(ans)
else:
  ans = 1 + abs(abs(x) - abs(y))
  print(ans)
Problem p04019 (python)

Fixed submission:
S = input()
s = set(S)
if ("N" in s and "S" not in s) \
 or ("S" in s and "N" not in s) \
 or ("W" in s and "E" not in s) \
 or ("E" in s and "W" not in s):
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
S = input()
s = set(S)
if ("N" in s and "S" not in s) 
 or ("S" in s and "N" not in s)
 or ("W" in s and "E" not in s)
 or ("E" in s and "W" not in s):
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
S=input()
s=set(S)
if ("N" in s and "S" not in s) or
("S" in s and "N" not in s) or
("E" in s and "W" not in s) or
("W" in s and "E" not in s):
  print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
S=input()
s=set(S)
if ("N" in s and "S" not in s) or
	("S" in s and "N" not in s) or
	("E" in s and "W" not in s) or
    ("W" in s and "E" not in s):
      print("No")
else:
  print("Yes")

Buggy submission (verdict: Runtime Error):
s=input()
if ("N" in s and "S" not in s) or
	("S" in s and "N" not in s) or
	("E" in s and "W" not in s) or
    ("W" in s and "E" not in s):
      print("No")
else:
  print("Yes")
Problem p04033 (python)

Fixed submission:
a,b=map(int,input().split())
if (a>0 and b>0):
	print("Positive")
elif (a>=0 and b<=0) or (a<=0 and b>=0):
	print("Zero")
elif (a<0 and b<0 and (a+b)%2==0):
	print("Negative")
else:
	print("Positive")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
l=range(a,b+1)
ans=1
for i in rang(len(l)):
  ans=ans*l[i]
print(ans)
Problem p04047 (python)

Fixed submission:
n=int(input())
l=sorted(list(map(int,input().split())),reverse=True)
print(sum(l[1::2]))

Buggy submission (verdict: Runtime Error):
n=int(input())
l=sorted(list(map(int,input().split())),reverse=True)
print(sum(l[1::2])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=sorted(list(map(int,iput().split())),reverse=True)
print(sum(l[1::2])

Buggy submission (verdict: Runtime Error):
n=int(input())
l=sorted(list(map(int,iput().split()),reverse=True)
print(sum(l[1::2])
Problem p02765 (python)

Fixed submission:
str = input().split(" ")
n = int(str[0])
r = int(str[1])
if n < 10:
  print(r + 100 * (10 - n))
else:
  print(r)

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

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

if N > M:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
import Queue as Q

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

if N > M:
  print('No')
else:
  print('Yes')

Buggy submission (verdict: Runtime Error):
from dataclasses import dataclass, field
from typing import Any

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

if N > M:
  print('No')
else:
  print('Yes')
Problem p02817 (python)

Fixed submission:
word1, word2 = input().split()
print(word2+word1)

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




# 素数を求める
pn = []
for xi in range(2, x+1):
  flag = 1
  for pi in pn:
    if xi%pi==0:
      flag = 0
  if flag == 1:
    pn.append(xi)

#print(pn)

# inputをカウントアップしながら、素数で割れるか確認
while True:
  x += 1
  flag = 1
  for pi in pn:
    if x%pi==0:
      flag = 0
      break
  if flag == 1:
    break

print(x)

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

if k < a:
  a = a-k

else:
  k = k-a
  a = 0
  if k < b:
    b = b-k
  else:
    b = 0
Problem p02765 (python)

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

main()

Buggy submission (verdict: Runtime Error):
n, r = map(int,input().split())
if n < 10:
  return r
else:
  return 100 * (10 - n)

Buggy submission (verdict: Runtime Error):
n, r = input()
if n < 10:
  return r
else:
  return 100 * (10 - n)

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

Fixed submission:
def resolve():
    s = list(input())
    prev = '-1'
    for i in s:
        if i == prev:
            print("Bad")
            return
        prev = i
    print("Good")

resolve()

Buggy submission (verdict: Runtime Error):
s = set(int(input()))
print("Good" if len(s) == 4 else "Bad")

Buggy submission (verdict: Runtime Error):
def resolve():
    s = set(int(input()))
    print("Good" if len(s) == 4 else "Bad")
    
resolve()
Problem p02995 (python)

Fixed submission:
def lcm(a, b):
    import fractions 
    return a // fractions.gcd(a, b) * b


def f(x, c, d):
    res = x
    res -= x//c
    res -= x//d
    res += x//lcm(c,d)
    return res

A, B, C, D = map(int, input().split())

ans = f(B, C, D) - f(A-1, C, D)
print(int(ans))

Buggy submission (verdict: Runtime Error):
def lcm(a, b):
    import math
    return a // math.gcd(a, b) * b


def f(x, c, d):
    res = x
    res -= x//c
    res -= x//d
    res += x//lcm(c,d)
    return res

A, B, C, D = map(int, input().split())

ans = f(B, C, D) - f(A-1, C, D)
print(int(ans))

Buggy submission (verdict: Runtime Error):
def lcm(a, b):
    import math
    return a // math.gcd(a, b) * b


def f(x, c, d):
    res = x
    res -= x//c
    res -= x//d
    res += x//lcm(c,d)
    return res

A, B, C, D = map(int, input().split())

ans = f(B, C, D) - f(A-1, C, D)
print(int(ans))

Buggy submission (verdict: Runtime Error):
def lcm(a, b):
    import math
    return a // math.gcd(a, b) * b


def f(x, c, d):
    res = x
    res -= x//c
    res -= x//d
    res += x//lcm(c,d)
    return res

def resolve():
    A, B, C, D = map(int, input().split())

    ans = f(B, C, D) - f(A-1, C, D)
    print(int(ans))

resolve()

Buggy submission (verdict: Runtime Error):
def lcm(a, b):
    import math
    return a // math.gcd(a, b) * b


def f(x, c, d):
    res = x
    res -= x//c
    res -= x//d
    res += x//lcm(c,d)
    return res

def resolve():
    A, B, C, D = map(int, input().split())

    ans = f(B, C, D) - f(A-1, C, D)
    print(int(ans))

resolve()
Problem p02996 (python)

Fixed submission:
def resolve():
    import numpy as np
    N = int(input())
    A = np.array([list(map(int, input().split())) for __ in range(N)])
    l = A[np.argsort(A[:, 1])]

    t = 0
    for i in l:
        t += i[0]
        if t > i[1]:
            print('No')
            return
    print('Yes')

resolve()

Buggy submission (verdict: Runtime Error):
def resolve():
    import numpy as np
    N = int(input())
    A = np.array([list(map(int, input().split())) for __ in range(N)])
    l = A[np.argsort(A[:, 1])]

    t = 0
    for i in l:
        t += i[0]
        if t > i[1]:
            print('No')
            return
    print('Yes')

resolve()
Problem p03361 (python)

Fixed submission:
def resolve():
    H, W = map(int, input().split())
    S = [list(input()) for __ in range(H)]

    dl = [(-1, 0), (0, 1), (1, 0), (0, -1)]
    for i, row in enumerate(S):
        for j, val in enumerate(row):
            if val == '.':
                continue

            can_paint = False
            for dx, dy in dl:
                di, dj = i + dx, j + dy
                if di < 0 or H <= di or dj < 0 or W <= dj:
                    continue
                if S[di][dj] == '#':
                    can_paint = True
                    break
            if not can_paint:
                return 'No'
    return 'Yes'

print(resolve())

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = [list(input()) for __ in range(H)]

dl = [(-1, 0), (0, 1), (1, 0), (0, -1)]
for i, row in enumerate(S):
    for j, val in enumerate(row):
        if val == '.':
            continue

        can_paint = False
        for dx, dy in dl:
            di, dj = i + dx, j + dy
            if di < 0 or H <= di or dj < 0 or W <= dj:
                continue
            if S[di][dj] == '#':
                can_paint = True
                break
        if not can_paint:
            print('No')
            return
print('Yes')

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
S = [list(input()) for __ in range(H)]

dl = [(-1, 0), (0, 1), (1, 0), (-1, -1)]
for i, row in enumerate(S):
    for j, val in enumerate(row):
        if val == '.':
            continue

        can_paint = False
        for dx, dy in dl:
            di, dj = i + dx, j + dy
            if di < 0 or H <= di or dj < 0 or W <= dj:
                continue
            if S[di][dj] == '#':
                can_paint = True
                break
        if not can_paint:
            print('No')
            sys.exit(0)
print('Yes')

Buggy submission (verdict: Runtime Error):
H, W = map(int, input())
S = [list(input()) for __ in range(H)]

dl = [(-1, 0), (0, 1), (1, 0), (-1, -1)]
for i, row in enumerate(S):
    for j, val in enumerate(row):
        if val == '.':
            continue

        res = False
        for dx, dy in dl:
            di, dj = i + dx, j + dy
            if di < 0 or W < di or dj < 0 or H < dj:
                continue
            if S[di][dj] == '#':
                res = True
                break
        if res:
            print('No')
print('Yes')
Problem p03434 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
alice, bob = 0, 0

for i in range(N):
    m = max(A)
    A.remove(m)
    if i % 2 == 0:
        alice += m
    else:
        bob += m
print(alice - bob)

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

for i in range(N):
    m = max(A)
    A.remove(m)
    if i % 2 == 0:
        alice += m
    else:
        bob += m
print(alice - bob)

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

for i in range(N):
    m = max(A)
    A.remove(m)
    if i % 2 == 0:
        alice += m
    else:
        bob += m
print(alice - bob)
Problem p03457 (python)

Fixed submission:
t, x, y = 0, 0, 0
for i in range(int(input())):
    next_t, next_x, next_y = map(int, input().split())
    diff = abs(x - next_x) + abs(y - next_y)
    if diff > (next_t - t) or (diff - (next_t - t)) % 2 == 1:
        print("No")
        exit(0)
    t, x, y, = next_t, next_x, next_y
print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
# t, x, y = 0, 0, 0
for __ in range(N):
    t, x, y = map(int, input().split())
    if (x + y) > t or (x + y + t) % 2 != 0:
        print("No")
        sys.exit()

print("Yes")

Buggy submission (verdict: Runtime Error):
    N = int(input())
    # t, x, y = 0, 0, 0
    for __ in range(N):
        t, x, y = map(int, input().split())
        if (x + y) > t or (x + y + t) % 2 != 0:
            print("No")
            sys.exit()

    print("Yes")

Buggy submission (verdict: Runtime Error):
N = int(input())
t, x, y = 0, 0, 0

for _ in range(N):
    next_t, next_x, next_y = [int(__) for __ in input().split()]

    delta_t = next_t - t
    distance = abs(next_x - x) + abs(next_y - y)

    if distance > delta_t:
        print("No")
        sys.exit()

    if (delta_t - distance) % 2 != 0:
        print("No")
        sys.exit()

    t, x, y = next_t, next_x, next_y

print("Yes")
Problem p03478 (python)

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

ans = 0
for i in range(N + 1):
    if A <= sum(list(map(int, list(str(i))))) <= B:
        map(int, list(str(i)))
        ans += i
print(ans)

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

ans = 0
for i in range(N + 1):
    if A <= sum(map(int, list(str(i)))) <= B:
        ans += i
print(ans)

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

ans = 0
for i in range(N + 1):
    if A <= sum(map(int, list(str(i)))) <= B:
        ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, A, B = map(input, [input() for i in range(3)])

ans = 0
for i in range(N + 1):
    if A <= sum(map(int, list(str(i)))) <= B:
        ans += 1
print(ans)
Problem p03493 (python)

Fixed submission:
s = input()
print(s.count("1"))

Buggy submission (verdict: Runtime Error):
S = input()
count = 0
for s in S:
    s += 1 if s == 1 else 0
print count
Problem p03494 (python)

Fixed submission:
n = input()
a = list(map(int, input().split()))
cnt = 0
while all(i%2==0 for i in a):
    a = [i/2 for i in a]
    cnt += 1
print(cnt)

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

count = 0
while all(i%2 == 0 for i in A):
    A /= 2
    count += 1
print(count)

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

count = 0
while all(i%2 == 0 for i in N ):
    N = [i/2 for i in N]
    count += 1
print(count)

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

count = 0
for i in all(i%2 == 0 for i in N ):
    N = [i/2 for i in N]
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input().split(' ')))
bit = 0
for a in A:
    bit |= a
print(len(bit) - len(bit.rstrip('0')))

Buggy submission (verdict: Runtime Error):
N = input()
A = list(map(int, input.split(' ')))
bit = 0
for a in A:
    bit |= a
print(len(bit) - len(bit.rstrip('0')))

Buggy submission (verdict: Runtime Error):
N = input()
A = map(int, input.split(' '))    
bit = 0
for a in A:
    bit |= a
print(len(bit) - len(bit.rstrip('0')))
Problem p02765 (python)

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

Buggy submission (verdict: Runtime Error):
n, r = map(lambda x: int(x), input().split())
if n < 10:
  print(100*(10-n)+r)
  return
print(r)
Problem p02767 (python)

Fixed submission:

if __name__ == '__main__':
    n = int(input())
    x = list(map(int, input().split()))
    p = []

    for i in range(100):
        cnt = 0
        for j in range(n):
            cnt = cnt + (x[j]-i)**2
        p.append(cnt)

    print(sorted(p)[0])

Buggy submission (verdict: Runtime Error):
n = int(input())
x = list(map(int, input().split()))
p = []

for i in range(100):
   	cnt = 0
	for j in range(n):
   		cnt = cnt + (x[j]-i)**2
    	p.append(cnt)

print(sorted(p)[0])
Problem p03493 (python)

Fixed submission:
print(input().count('1'))

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
if （a * b） % 2 == 0:
  print('Even')
else:
  print('Odd')
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().split())
if (N>=10):
  print (R)
else :
  print (R+100*(10-K))
Problem p02784 (python)

Fixed submission:
H,N=map(int,input().split())
A=list(map(int,input().split()))
if H<=sum(A):
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
H,N=map(int,input().split())
A=list(map(int,input().split()))
if H<=sum(a):
  print('Yes')
else:
  print('No')
Problem p02780 (python)

Fixed submission:
import sys
from itertools import accumulate

def main():
    
    # sys.stdin = open('input154d.txt')

    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    
    s = [0] + p
    s = list(accumulate(s))

    # print(p)
    # print(s)
    maxp = 0
    idx = 0
    for i in range(n - k + 1):
      nowp = s[i + k] - s[i]
      # print(i)
      # print(nowp)
      if maxp < nowp:
        maxp = nowp
        idx = i

    # print(idx)

    sump = 0
    for j in range(idx, idx+k):
      sump += p[j] * (p[j] + 1) / 2 / p[j]

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

Buggy submission (verdict: Runtime Error):
import sys
from itertools import accumulate

def main():
    
    # sys.stdin = open('input154d.txt')

    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    
    s = [0] + p
    s = list(accumulate(s))

    maxp = 0
    index = 0
    for i in range(k, n):
      nowp = s[i] - s[i - k]
      if maxp < nowp:
        maxp = nowp
        index = i

    sump = 0
    for j in range(i-k, i):
      sump += p[j] * (p[j] + 1) / 2 / p[j]

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

Buggy submission (verdict: Runtime Error):
import sys
from itertools import accumulate

def main():
    
    # sys.stdin = open('input154d.txt')

    n, k = map(int, input().split())
    p = list(map(int, input().split()))
    
    s = [0] + p
    s = list(accumulate(s))
    print(p)
    print(s)

    maxp = 0
    index = 0
    for i in range(k, n):
      nowp = s[i] - s[i - k]
      if maxp < nowp:
        maxp = nowp
        index = i

    sump = 0
    for j in range(i-k, i):
      sump += p[j] * (p[j] + 1) / 2 / p[j]

    print(sump)
        
if __name__ == '__main__':
    main()
Problem p02783 (python)

Fixed submission:
x=input().split()
H=int(x[0])
A=int(x[1])
if H%A==0:
  print(H//A)
else:
  print(H//A+1)

Buggy submission (verdict: Runtime Error):
x=input().split()
h=int(x[0])
n=int(x[1])
import numpy as np
a=np.full(n,0,int)
b=np.full(n,0,int)
for k in range(n):
  x=input().split()
  a[k]=int(x[0])
  b[k]=int(x[1])
m=max(a)  
inf=10**8
dp=np.full(h+m+1,inf,int)
dp[0]=0
for k in range(1,h+m):
  dp[k]=(dp[np.max(k-a,-1)]+b).min()
print(dp[h:h+m].min())

Buggy submission (verdict: Runtime Error):
x=input().split()
h=int(x[0])
n=int(x[1])
a=[]
b=[]
for k in range(n):
  x=input().split()
  a.append(int(x[0]))
  b.append(int(x[1]))  
m=max(a)  
dp=[10**8]*(h+m)
dp[0]=0
for k in range(h+m):
  for i in range(n):
    if k-a[i]<0:
      continue
    new=dp[k-a[i]]+b[i]
    if new < dp[k]:
      dp[k]=new
print(min(dp[h:h+m]))

Buggy submission (verdict: Runtime Error):
x=input().split()
h=int(x[0])
n=int(x[1])
a=[]
b=[]
for k in range(n):
  x=input().split()
  a.append(int(x[0]))
  b.append(int(x[1]))  
m=max(a)  
dp=[10**9]*(h+m)
dp[0]=0
for k in range(h+m):
  for i in range(n):
    if k-a[i]<0:
      continue
    new=dp[k-a[i]]+b[i]
    if new < dp[k]:
      dp[k]=new
print(min(dp[h:h+m]))

Buggy submission (verdict: Runtime Error):
x=input().split()
h=int(x[0])
n=int(x[1])
a=[]
b=[]
c=[]
for k in range(n):
  x=input().split()
  a.append(int(x[0]))
  b.append(int(x[1]))
  c.append(int(x[0])/int(x[1]))
s=0  
while H>0:
  maxim=0
  for k in range(n):
    m=H//a[k]
    d=a[k]*(H//a[k]+1)
    if (d+1)*b[k]>maxim:
      maxim=(d+1)*b[k]
  s+=maxim
print(s)