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

Fixed submission:
import itertools
n, k = map(int, input().split())
a = list(map(int, input().split()))
M = 10**9 + 7

dp = [[None] * (k + 1) for _ in range(n + 1)]
def dfs(i=0, at=k):
    if dp[i][at] is not None:
        return dp[i][at]

    if i == n:
        r = int(at == 0)
        dp[i][at] = r
        return r

    cnt = 0
    for v in range(a[i] + 1):
        if v > at:
            break
        cnt += dfs(i + 1, at - v)
    dp[i][at] = cnt
    return cnt
#
# print(dfs())
# for v in dp:
#     print(v)

def fm(array):
    return ["*" if v is None else v for v in array]

def mod(v):
    if v >= M:
        return v % M
    return v

# def addmod(a, b):
#     return mod(a + b)

# for at in range(k + 1):
for i in reversed(range(n + 1)):
    for at in range(k + 1):
        if i == n:
            dp[i][at] = int(at == 0)
            continue
        cnt = 0
        # print(*fm(dp[i]), end=" -> ")
        # for v in range(min(a[i], at) + 1):
        #     cnt += dp[i + 1][at - v]
        # dpcnt = cnt
        cnt = cs[at] - cs[at - min(a[i], at) - 1]
        dp[i][at] = mod(cnt)
        # print(*fm(dp[i]), "@", at - min(a[i], at), "~", at)
        # print(cnt, "@", at - min(a[i], at), "~", at, ":", *fm(dp[i + 1])[at - min(a[i], at):at + 1])
        # print(dpcnt, cnt)
    # cs = list(itertools.accumulate(dp[i], func=addmod)) + [0]
    cs = list(itertools.accumulate(dp[i])) + [0]
    cs = [mod(v) for v in cs]
    # print(*cs, "cs")
    # print(*dp[i], "dp")
    # print("-----")
print(dp[0][k] % M)

# for v in dp:
#     print(*fm(v))

Buggy submission (verdict: Runtime Error):
import itertools
n, k = map(int, input().split())
a = list(map(int, input().split()))
M = 10**9 + 7

dp = [[None] * (k + 1) for _ in range(n + 1)]
def dfs(i=0, at=k):
    if dp[i][at] is not None:
        return dp[i][at]

    if i == n:
        r = int(at == 0)
        dp[i][at] = r
        return r

    cnt = 0
    for v in range(a[i] + 1):
        if v > at:
            break
        cnt += dfs(i + 1, at - v)
    dp[i][at] = cnt
    return cnt
#
# print(dfs())
# for v in dp:
#     print(v)

def fm(array):
    return ["*" if v is None else v for v in array]

def mod(v):
    if v >= M:
        return v % M
    return v

def addmod(a, b):
    return mod(a + b)

# for at in range(k + 1):
for i in reversed(range(n + 1)):
    for at in range(k + 1):
        if i == n:
            dp[i][at] = int(at == 0)
            continue
        cnt = 0
        # print(*fm(dp[i]), end=" -> ")
        # for v in range(min(a[i], at) + 1):
        #     cnt += dp[i + 1][at - v]
        # dpcnt = cnt
        cnt = cs[at] - cs[at - min(a[i], at) - 1]
        dp[i][at] = mod(cnt)
        # print(*fm(dp[i]), "@", at - min(a[i], at), "~", at)
        # print(cnt, "@", at - min(a[i], at), "~", at, ":", *fm(dp[i + 1])[at - min(a[i], at):at + 1])
        # print(dpcnt, cnt)
    cs = list(itertools.accumulate(dp[i], addmod)) + [0]
    # print(*cs, "cs")
    # print(*dp[i], "dp")
    # print("-----")
print(dp[0][k] % M)

# for v in dp:
#     print(*fm(v))
Problem p03177 (python)

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

import numpy as np
# n = 30
# k = 100
# np.random.seed(100)
# a = np.random.randint(0, 2, size=(n, n))

graph = [[] for _ in range(n)]
for i, row in enumerate(a):
    for j, value in enumerate(row):
        if value:
            graph[i].append(j)

# dp = [[None] * (k + 1) for _ in range(n)]
# def dfs(i, at=k):
#     if dp[i][at] is not None:
#         return dp[i][at]
#     if at == 1:
#         r = len(graph[i])
#         dp[i][at] = r
#         return dp[i][at]
#
#     cnt = 0
#     for nxt in graph[i]:
#         cnt += dfs(nxt, at - 1)
#     dp[i][at] = cnt
#     return cnt
#
# print([dfs(i, at=k) for i in range(n)])
#
# for v in dp:
#     print(v)

# -------
import numpy as np
a = np.array(a, dtype=int)

M = 10**9 + 7
def powmod(a, n):
    if n == 0:
        return np.eye(np.alen(a), dtype=int)
    if n % 2:
        return (powmod(a, n - 1).dot(a)) % M
    r = powmod(a, n // 2)

    calc = []
    for row in r.T:
        calc.append(((row * r) % M).sum(axis=-1))
    return np.array(calc).T % M

print(powmod(a, k).sum() % M)
#
# v = a
# for _ in range(k - 1):
#     v = (v @ a) % M
# print(v.sum() % M)

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

# import numpy as np
# n = 50
# k = 50
# a = np.random.randint(0, 2, size=(n, n))

graph = [[] for _ in range(n)]
for i, row in enumerate(a):
    for j, value in enumerate(row):
        if value:
            graph[i].append(j)

# dp = [[None] * (k + 1) for _ in range(n)]
# def dfs(i, at=k):
#     if dp[i][at] is not None:
#         return dp[i][at]
#     if at == 1:
#         r = len(graph[i])
#         dp[i][at] = r
#         return dp[i][at]
#
#     cnt = 0
#     for nxt in graph[i]:
#         cnt += dfs(nxt, at - 1)
#     dp[i][at] = cnt
#     return cnt
#
# print([dfs(i, at=k) for i in range(n)])
#
# for v in dp:
#     print(v)

# -------
import numpy as np
a = np.array(a)

M = 10**9 + 7
def powmod(a, n):
    if n == 0:
        return np.eye(np.alen(a), dtype=int)
    if n % 2:
        return (powmod(a, n - 1) @ a) % M
    r = powmod(a, n // 2)
    return (r @ r) % M

print(powmod(a, k).sum() % M)

# v = a
# for _ in range(k - 1):
#     v = v @ a
# print(v)
Problem p03179 (python)

Fixed submission:
n = int(input())
s = input()
M = 10**9 + 7

def mod(v):
    if v >= M:
        return v % M
    return v


dp = [[1] * n + [0] for _ in range(2)]
s = [v == "<" for v in s]
for i in reversed(range(n - 1)):
    for j in range(n - 1):
        dp[1][j + 1] = dp[1][j + 1] + dp[1][j]
        dp[0][j] = dp[1][j]
    dp[0][-2] = dp[1][-2]

    for zk in range(n - i):
        cnt = 0

        if s[i]:
            cnt = dp[0][zk - 1]
        else:
            zj = n - i - zk - 1
            cnt = dp[0][zk + zj - 1] - dp[0][zk - 1]
        dp[1][zk] = mod(cnt)

print(sum(dp[1]) % M)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
M = 10**9 + 7

dp = [[None] * n for _ in range(n)]
def dfs(zk, i=0):
    if dp[zk][i] is not None:
        return dp[zk][i]

    if i == n - 1:
        dp[zk][i] = 1
        return 1

    zj = n - i - zk - 1
    cnt = 0

    if s[i] == "<":
        for v in range(zk):
            cnt += dfs(v, i + 1)
    else:
        for v in range(zj):
            cnt += dfs(zk + v, i + 1)
    dp[zk][i] = cnt
    return cnt

def mod(v):
    if v >= M:
        return v % M
    return v

def cumsum(array):
    array = array[:]
    for i in range(len(array) - 1):
        array[i + 1] = mod(array[i + 1] + array[i])
    return array + [0]

for i in reversed(range(n)):
    for zk in range(n):
        if i == n - 1:
            dp[i][zk] = 1
            continue

        zj = n - i - zk - 1
        cnt = 0

        if s[i] == "<":
                # cnt = mod(cnt + dp[i + 1][v])
                cnt = cs[v]
        else:
                # cnt = mod(cnt + dp[i + 1][zk + v])
                cnt = cs[zk + zj - 1] - cs[zk - 1]
        dp[i][zk] = cnt
    cs = cumsum(dp[i])

# for i in range(n):
#     print(dfs(i))
# print(sum(dfs(i) for i in range(n - 1)) % M)
print(sum(dp[0]) % M)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
M = 10**9 + 7

dp = [[None] * n for _ in range(n)]
def dfs(zk, i=0):
    if dp[zk][i] is not None:
        return dp[zk][i]

    if i == n - 1:
        dp[zk][i] = 1
        return 1

    zj = n - i - zk - 1
    cnt = 0

    if s[i] == "<":
        for v in range(zk):
            cnt += dfs(v, i + 1)
    else:
        for v in range(zj):
            cnt += dfs(zk + v, i + 1)
    dp[zk][i] = cnt
    return cnt

def mod(v):
    if v >= M:
        return v % M
    return v

def cumsum(array):
    array = array.copy()
    for i in range(len(array) - 1):
        array[i + 1] = mod(array[i + 1] + array[i])
    return array + [0]

for i in reversed(range(n)):
    for zk in range(n):
        if i == n - 1:
            dp[i][zk] = 1
            continue

        zj = n - i - zk - 1
        cnt = 0

        if s[i] == "<":
            for v in range(zk):
                # cnt = mod(cnt + dp[i + 1][v])
                cnt = cs[v]
        else:
            for v in range(zj):
                # cnt = mod(cnt + dp[i + 1][zk + v])
                cnt = cs[zk + zj - 1] - cs[zk - 1]
        dp[i][zk] = cnt
    cs = cumsum(dp[i])

# for i in range(n):
#     print(dfs(i))
# print(sum(dfs(i) for i in range(n - 1)) % M)
print(sum(dp[0]) % M)
Problem p03210 (python)

Fixed submission:
print("YES" if input() in "753" else "NO")

Buggy submission (verdict: Runtime Error):
print("YES" input() in "753" else "NO")
Problem p03231 (python)

Fixed submission:
import fractions
n, m = map(int, input().split())
ns = input()
ms = input()

# n, m = 10**5, 31111
# print(math.gcd(n, m))

gcd = fractions.gcd(n, m)
lcm = n * m // gcd
# print(lcm, lcm // n, lcm // m)
lcmN = lcm // n
lcmM = lcm // m

# for i in range(lcm):
#     if (i % (lcmN)) == 0:
#         print(ns[i // lcmN], end="")
#     else:
#         print(".", end="")
# print()
# for i in range(lcm):
#     if (i % (lcmM)) == 0:
#         print(ms[i // lcmM], end="")
#     else:
#         print(".", end="")

s = []
for i in range(0, n, lcmM):
    s.append(ns[i])
for i in range(0, m, lcmN):
    if ms[i] != s[i // lcmN]:
        print(-1)
        exit()
print(lcm)

Buggy submission (verdict: Runtime Error):
import math
n, m = map(int, input().split())
ns = input()
ms = input()

# n, m = 10**5, 31111
# print(math.gcd(n, m))

gcd = math.gcd(n, m)
lcm = n * m // gcd
# print(lcm, lcm // n, lcm // m)
lcmN = lcm // n
lcmM = lcm // m

# for i in range(lcm):
#     if (i % (lcmN)) == 0:
#         print(ns[i // lcmN], end="")
#     else:
#         print(".", end="")
# print()
# for i in range(lcm):
#     if (i % (lcmM)) == 0:
#         print(ms[i // lcmM], end="")
#     else:
#         print(".", end="")

s = []
for i in range(0, n, lcmM):
    s.append(ns[i])
for i in range(0, m, lcmN):
    if ms[i] != s[i // lcmN]:
        print(-1)
        exit()
print(lcm)
Problem p03241 (python)

Fixed submission:
n, m = map(int, input().split())
values = []

def pfac(n):
    values = [1, n]
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            values.append(i)
            values.append(n // i)
    return values


for i in pfac(m):
    if m % i == 0 and m / i >= n:
        values.append(i)
print(max(values))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
if n == 1: print(m)
else: print(max(i for i in range(2, 100050) if m % i == 0 and m / i >= n))

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
print(max(i for i in range(2, 100000) if m % i == 0 and m / i >= n))
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())

import random
for i, v in enumerate(s):
    if v != "1":
        break
after = "1" * i + v * 100
print(after[min(len(s), k) - 1])

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


for i, v in enumerate(s):
    if v != "1":
        break
after = "1" * i + v * 100
print(after[min(len(s), k)])
Problem p03289 (python)

Fixed submission:
import re
s = input()
ci = s.find("C")
if s.find("A") == 0 and 2 <= ci <= len(s) - 2:
  tmp = list(s)
  del tmp[0]
  del tmp[ci - 1]
  if re.match("^[a-z]*$", "".join(tmp)):
    print("AC")
    exit()
print("WA")

Buggy submission (verdict: Runtime Error):
import re
s = input()
ci = s.index("C")
if s.index("A") == 0 and 2 <= ci < len(s) - 2:
  tmp = list(s)
  del tmp[0]
  del tmp[ci - 1]
  if re.match("^[a-z]*$", "".join(tmp)):
    print("AC")
    exit()
print("WA")

Buggy submission (verdict: Runtime Error):
import re
s = input()
ci = s.index("C")
if s.index("A") == 0 and 2 <= ci < len(s) - 2:
  tmp = list(s)
  del tmp[0]
  del tmp[ci]
  if re.match("^[a-z]*$", "".join(tmp)):
    print("AC")
    exit()
print("WA")
Problem p03486 (python)

Fixed submission:
a = list(input())
b = list(input())

a.sort()
b.sort(reverse=True)

a = "".join(a)
b = "".join(b)

print("Yes" if a < b else "No")

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

a.sort()
b.sort()

print("Yes" if "".join(a) <　"".join(b) else "No")
Problem p03487 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
m = {}

for i in a:
    m[i] = m.get(i, 0) + 1

result = 0
for i in m.keys():
    v = m.get(i, 0)
    if v >= i:
        result += v - i
    else:
        result += v
print(result)

Buggy submission (verdict: Runtime Error):
# 4
# 3 3 3 3
n = int(input())
a = list(map(int, input().split()))
m = {}

for i in a:
  m[i] = m.get(i, 0) + 1

result = 0
for i in range(n):
  v = a.get(i, 0)
  if v >= i:
    result += v - i
  else:
    result += v
print(result)
Problem p03494 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
cnt = 0
while True:
 for i in range(n):
  if a[i] & 1:
    print(cnt)
    __import__("sys").exit(0)
  a[i] //= 2
 cnt += 1

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

for i in range(n):
 if a[i] & 1: break
 a[i] = x//2
print(i)
Problem p03495 (python)

Fixed submission:
n, k = map(int, input().split())
a = list(map(int, input().split()))
countup = [0 for x in range(n + 1)]
for i in a:
  countup[i] += 1

countup.sort()
result = 0
f = list(filter(lambda x: x != 0, countup))

for i, v in enumerate(f):
 if i >= len(f) - k:
    print(result)
    break
 result += v

Buggy submission (verdict: Runtime Error):
# 5 2
# 1 1 2 2 5
n, k = map(int, input().split())
a = list(map(int, input().split()))
countup = [0 for x in range(n)]
for i in a:
  countup[i] += 1

result = 0
f = list(filter(lambda x: x != 0, countup.sort()))

for i, v in enumerate(f):
 if i >= len(f) - k:
    print(result)
    break
 result += v
Problem p03544 (python)

Fixed submission:
import numpy as np
n = int(input())
init = np.expand_dims(np.array([2, 1]), 0)
to_next = np.array([
    [1, 1],
    [1, 2],
])
for i in range(n // 2):
    init = init.dot(to_next)
print(init[0][n & 1])

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
init = np.expand_dims(np.array([2, 1]), 0)
to_next = np.array([
    [1, 1],
    [1, 2],
])
for i in range(n // 2):
    init = init @ to_next
print(init[0][n & 1])
Problem p03565 (python)

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

def match(s1, s2):
    if len(s1) < len(s2):
        return False
    for i, j in zip(s1, s2):
        if i != j and i != "?":
            return False
    return True

result = []
for i in range(50):
    if match(s[i:], t):
        result.append((s[:i] + t + s[i + len(t):]).replace("?", "a"))
result.sort()
if not result:
    print("UNRESTORABLE")
else:
    print(result[0])

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

def match(s1, s2):
    if len(s1) < len(s2):
        return False
    for i, j in zip(s1, s2):
        if i != j and i != "?":
            return False
    return True

result = []
for i in range(50):
    if match(s[i:], t):
        result.append((s[:i] + t + s[i + len(t):]).replace("?", "a"))
result.sort()
print(result[0])
Problem p03592 (python)

Fixed submission:
import sys
n, m, k = map(int, input().split())

for x in range(n + 1):
    for y in range(m + 1):
        if m * x + n * y - x * y * 2 == k:
            print("Yes")
            sys.exit()
print("No")

Buggy submission (verdict: Runtime Error):
import numpy as np
n = int(input())
ab = [list(map(int, input().split())) for x in range(n)]

cnt = 0
for a, b in reversed(ab):
    diff = a - b + cnt
    if diff == -b:
        pass
    elif diff < 0:
        cnt -= diff
    else:
        diffb = diff % b
        if diffb:
            cnt += b - diffb
print(int(cnt))
Problem p03612 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
flg = False
cnt = 0
for i, v in enumerate(a, 1):
    if flg:
        flg = False
        continue

    if i == v:
        cnt += 1
        flg = True
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
b = list(range(n**2))
a = list(map(int, input().split()))
flg = False
cnt = 0
for i, v in enumerate(a, 1):
    if flg:
        flg = False
        continue

    if i is v:
        cnt += 1
        flg = True
print(cnt)
Problem p03633 (python)

Fixed submission:
import fractions
n = int(input())
a = [int(input()) for i in range(n)]

b = a[0]
for i in range(1, n):
    b = (b * a[i]) // fractions.gcd(b, a[i])
print(b)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
a = [int(input()) for i in range(n)]

b = a[0]
for i in range(1, n):
    b = (b * a[i]) // math.gcd(b, a[i])
print(b)
Problem p03643 (python)

Fixed submission:
print("ABC"+input())

Buggy submission (verdict: Runtime Error):

a, b, c = map(int, input().split())
print("YES" if b - a == c - b else "NO")
Problem p03651 (python)

Fixed submission:
a, b = map(int, input().split())
array = list(map(int, input().split()))
impossible = "IMPOSSIBLE"
possible = "POSSIBLE"

array = list(set(array))

if len(array) == 1:
    if b == array[0]:
        print(possible)
    else:
        print(impossible)
    exit(0)

array.sort()

btw = [v1 - v2 for v1, v2 in zip(array[1:], array[0:])]
n = sorted(btw)[0]

same = len(set(btw)) == 1 or all([v % n == 0 for v in btw])

if b in array:
    print(possible)
elif array[-1] < b:
    print(impossible)
elif same and (b - array[0]) % n == 0:
    print(possible)
else:
    print(impossible)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
array = list(map(int, input().split()))
impossible = "IMPOSSIBLE"
possible = "POSSIBLE"

if a == 1:
    if b == array[0]:
        print(possible)
    else:
        print(impossible)
    exit(0)

array = list(set(array))
array.sort()

btw = [v1 - v2 for v1, v2 in zip(array[1:], array[0:])]
n = sorted(btw)[0]

same = len(set(btw)) == 1 or all([v % n == 0 for v in btw])

if b in array:
    print(possible)
elif array[-1] < b:
    print(impossible)
elif same and (b - array[0]) % n == 0:
    print(possible)
else:
    print(impossible)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
array = list(map(int, input().split()))
impossible = "IMPOSSIBLE"
possible = "POSSIBLE"

if a == 1:
    if b == array[0]:
        print(possible)
    else:
        print(impossible)
    exit(0)

array.sort()
array = list(set(array))

btw = [v1 - v2 for v1, v2 in zip(array[1:], array[0:])]
n = sorted(btw)[0]

same = len(set(btw)) == 1 or all([v % n == 0 for v in btw])

if b in array:
    print(possible)
elif array[-1] < b:
    print(impossible)
elif same and (b - array[0]) % n == 0:
    print(possible)
else:
    print(impossible)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
array = list(map(int, input().split()))
impossible = "IMPOSSIBLE"
possible = "POSSIBLE"

array.sort()

btw = [v1 - v2 for v1, v2 in zip(array[1:], array[0:])]
n = sorted(btw)[0]

same = len(set(btw)) == 1 or all([v % n == 0 for v in btw])

if b in array:
    print(possible)
elif array[-1] < b:
    print(impossible)
elif same and (b - array[0]) % n == 0:
    print(possible)
else:
    print(impossible)

Buggy submission (verdict: Runtime Error):
#! cat input | python3 main.py

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

def f(a, k, ma):
    minv = float("inf")
    for i, v in enumerate(a[1:]):
        minv = min(minv, v - a[i])

    if minv == 1:
        return False

    a = a[:]
    for i in range(0, ma, minv):
        if i < a[0]:
            continue
        if i == a[0]:
            del a[0]
        else:
            return False
    return True

if ma < k:
    print("IMPOSSIBLE")
elif f(a, k, ma):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
Problem p03687 (python)

Fixed submission:
s = input()
if len(set(s)) <= 1:
    print(0)
    import sys
    sys.exit()

def resolve(target):
    depth = 0
    now = s
    while len(set(now)) > 1:
        result = list(now[:-1])
        for i, x in enumerate(now[:-1]):
            result[i] = now[i + 1] if now[i + 1] == target else now[i]
        now = "".join(result)
        depth += 1
    return "".join(result), depth


print(min([resolve(chr(target)) for target in range(ord("a"), ord("x") + 1)], key=lambda x: x[1])[1])

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

def resolve(target):
    depth = 0
    now = s
    while len(set(now)) > 1:
        result = list(now[:-1])
        for i, x in enumerate(now[:-1]):
            result[i] = now[i + 1] if now[i + 1] == target else now[i]
        now = "".join(result)
        depth += 1
    return "".join(result), depth


print(min([resolve(chr(target)) for target in range(ord("a"), ord("x") + 1)], key=lambda x: x[1])[1])
Problem p03713 (python)

Fixed submission:
h, w = map(int, input().split())

ans_wsplit = [max(abs((i * w) - (((h - i) + 1) // 2) * w), abs((i * w) - ((h - i) // 2) * w)) for i in range(1, h)]
ans_hsplit = [max(abs((i * h) - (((w - i) + 1) // 2) * h), abs((i * h) - ((w - i) // 2) * h)) for i in range(1, w)]

ans_wline = [max(abs((i * w) - ((w + 1) // 2) * (h - i)), abs((i * w) - (w // 2) * (h - i))) for i in range(1, h)]
ans_hline = [max(abs((i * h) - ((h + 1) // 2) * (w - i)), abs((i * h) - (h // 2) * (w - i))) for i in range(1, w)]

print(min(ans_wsplit + ans_hsplit + ans_wline + ans_hline))

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

ans_wsplit = [max(abs((i * w) - (((h - i) + 1) // 2) * w), abs((i * w) - ((h - i) // 2) * w)) for i in range(1, h - 1)]
ans_hsplit = [max(abs((i * h) - (((w - i) + 1) // 2) * h), abs((i * h) - ((w - i) // 2) * h)) for i in range(1, w - 1)]

ans_wline = [max(abs((i * w) - ((w + 1) // 2) * (h - i)), abs((i * w) - (w // 2) * (h - i))) for i in range(1, h - 1)]
ans_hline = [max(abs((i * h) - ((h + 1) // 2) * (w - i)), abs((i * h) - (h // 2) * (w - i))) for i in range(1, w - 1)]

print(min(ans_wsplit + ans_hsplit + ans_wline + ans_hline))

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

ans_wsplit = [max(abs((i * w) - (((h - i) + 1) // 2) * w), abs((i * w) - ((h - i) // 2) * w)) for i in range(1, h - 1)]
ans_hsplit = [max(abs((i * h) - (((w - i) + 1) // 2) * h), abs((i * h) - ((w - i) // 2) * h)) for i in range(1, w - 1)]

ans_wline = [max(abs((i * w) - ((w + 1) // 2) * (h - i)), abs((i * w) - (w // 2) * (h - i))) for i in range(1, h - 1)]
ans_hline = [max(abs((i * h) - ((h + 1) // 2) * (w - i)), abs((i * h) - (h // 2) * (w - i))) for i in range(1, w - 1)]

print(min(*ans_wsplit, *ans_hsplit, *ans_wline, *ans_hline))

Buggy submission (verdict: Runtime Error):
//h w
//abc
//arc
#include <iostream>
#include <string>
using namespace std;
int main(){
 int h, w;
 cin >> h >> w;
 string result = "";
 for(int i = 0; i < w + 2; i++) result += "#";
 result += "\n";
 for(int i = 0; i < h; i++){
  string s; cin >> s;
  result += "#" + s + "#\n";
 }
 for(int i = 0; i < w + 2; i++) result += "#";
 result += "\n";
 cout << result << endl;
}
Problem p03719 (python)

Fixed submission:
a,b,c=map(int,input().split())
print("Yes" if a <= c <= b else "No")

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,input())
print("Yes" if a<=c<=b else "No")
Problem p03721 (python)

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

ab = [list(map(int, input().split())) for x in range(n)]

ends = [0 for x in range(10**5 + 1)]
for a, b in ab:
    ends[a] += b

for i, e in enumerate(ends):
    k -= e
    if k <= 0:
        print(i)
        break

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

ab = [list(map(int, input().split())) for x in range(n)]
tk = k

ends = [0 for x in range(10**5)]
for a, b in ab:
    ends[a] += b
    
    k -= b
    if k <= 0:
        break


for i, e in enumerate(ends):
    tk -= e
    if tk <= 0:
        print(i)
        break