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

Fixed submission:
from heapq import heappush, heapreplace

n = int(input())
a = sorted(map(int, input().split()), reverse=True)
h = [-a[0]]
c = 0
for i in range(1, n):
    c += heapreplace(h, -a[i])
    heappush(h, -a[i])
print(-c)

Buggy submission (verdict: Runtime Error):
input()print(sum(sorted(map(int,input().split()))[1:]))
Problem p02620 (python)

Fixed submission:
import sys


def read():
    return sys.stdin.readline().rstrip()


def main():
    d = int(read())
    c = [int(i) for i in read().split()]
    s = [[int(i) for i in read().split()] for _ in range(d)]
    t = [int(read()) - 1 for _ in range(d)]
    m = int(read())
    query = [[int(i) - 1 for i in read().split()] for _ in range(m)]
    score = 0
    last = [[0] * 26 for _ in range(d)]
    for i in range(d):
        score += s[i][t[i]]
        if i > 0:
            last[i] = last[i - 1].copy()
        last[i][t[i]] = i + 1
        for j in range(26):
            score -= c[j] * (i + 1 - last[i][j])
    for di, qi in query:
        hi = t[di]
        t[di] = qi
        score -= s[di][hi]
        score += s[di][qi]
        if di == 0:
            last[di][hi] = 0
        else:
            last[di][hi] = last[di - 1][hi]
        score -= c[hi] * (di + 1 - last[di][hi])
        score += c[qi] * (di + 1 - last[di][qi])
        last[di][qi] = di + 1
        for i in range(di + 1, d):
            score += c[hi] * (i + 1 - last[i][hi])
            if t[i] != hi:
                last[i][hi] = last[i - 1][hi]
                score -= c[hi] * (i + 1 - last[i][hi])
            else:
                break
        for i in range(di + 1, d):
            score += c[qi] * (i + 1 - last[i][qi])
            if t[i] != qi:
                last[i][qi] = last[i - 1][qi]
                score -= c[qi] * (i + 1 - last[i][qi])
            else:
                break
        print(score)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys


def read():
    return sys.stdin.readline().rstrip()


def main():
    d = int(read())
    c = [int(i) for i in read().split()]
    s = [[int(i) for i in read().split()] for _ in range(d)]
    t = [int(read()) - 1 for _ in range(d)]
    m = int(read())
    query = [[int(i) - 1 for i in read().split()] for _ in range(m)]
    score = [0] * 26
    last = [[0] * 26 for _ in range(d)]
    for i in range(d):
        score[i] = s[i][t[i]]
        if i > 0:
            last[i] = last[i - 1].copy()
        last[i][t[i]] = i + 1
        for j in range(26):
            score[i] -= c[j] * (i + 1 - last[i][j])
    for di, qi in query:
        if di == 0:
            last[di][t[di]] = 0
        else:
            last[di][t[di]] = last[di - 1][t[di]]
        last[di][qi] = di + 1
        t[di] = qi
        for i in range(di, d):
            score[i] = s[i][t[i]]
            if i > 0:
                last[i] = last[i - 1].copy()
            last[i][t[i]] = i + 1
            for j in range(26):
                score[i] -= c[j] * (i + 1 - last[i][j])
        print(sum(score))


if __name__ == '__main__':
    main()
Problem p02642 (python)

Fixed submission:
def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    a.sort()
    b = 0
    dp = [True] * (a[-1] + 1)
    for ai in a:
        if not dp[ai]:
            continue
        for j in range(ai * 2, a[-1] + 1, ai):
            dp[j] = False
        if ai == b:
            dp[ai] = False
        b = ai
    print(sum(dp[ai] for ai in a))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def primes(n):
    is_prime = [i % 2 != 0 and i % 3 != 0 and i % 5 != 0 and i % 7 != 0 for i in range(n + 1)]
    is_prime[1] = False
    is_prime[2] = is_prime[3] = is_prime[5] = is_prime[7] = True
    for p in range(3, int(n**0.5) + 1, 2):
        if not is_prime[p]:
            continue
        for i in range(p**2, n + 1, p):
            is_prime[i] = False
    return {i for i, p in enumerate(is_prime) if p}


def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    a.sort()
    if a[0] == 1:
        print(n - 1 + (a[1] == 1))
        return
    p = primes(10**6)
    b = set()
    c = 0
    for i in range(n):
        if i < n - 1 and a[i] == a[i + 1] or i > 0 and a[i] == a[i - 1]:
            b.add(a[i])
            continue
        if a[i] in p:
            c += 1
            b.add(a[i])
            continue
        for j in range(1, int(a[i]**0.5) + 1):
            if a[i] % j:
                continue
            if j in b or a[i] // j in b:
                break
        else:
            c += 1
            b.add(a[i])
    print(c)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def primes(n):
    is_prime = [i % 2 != 0 and i % 3 != 0 and i % 5 != 0 and i % 7 != 0 for i in range(n + 1)]
    is_prime[1] = False
    is_prime[2] = is_prime[3] = is_prime[5] = is_prime[7] = True
    for p in range(3, int(n**0.5) + 1, 2):
        if not is_prime[p]:
            continue
        for i in range(p**2, n + 1, p):
            is_prime[i] = False
    return {i for i, p in enumerate(is_prime) if p}


def main():
    n = int(input())
    a = [int(i) for i in input().split()]
    a.sort()
    if a[0] == 1:
        print(n - 1 + (a[1] == 1))
        return
    p = primes(10**6)
    b = set()
    c = 0
    for i in range(n):
        if i < n - 1 and a[i] == a[i + 1] or i > 0 and a[i] == a[i - 1]:
            b.add(a[i])
            continue
        if a[i] in p:
            c += 1
            b.add(a[i])
            continue
        for j in range(1, int(a[i]**0.5) + 1):
            if a[i] % j:
                continue
            if j in b or a[i] // j in b:
                break
        else:
            c += 1
            b.add(a[i])
    print(c)


if __name__ == '__main__':
    main()
Problem p02733 (python)

Fixed submission:
def main():
    h, w, k = map(int, input().split())
    s = [[int(i) for i in list(input())] for _ in range(h)]
    cnt = [bin(i).count("1") for i in range(2**(h - 1))]
    c = 0
    for ci in [sum(i) for i in zip(*s)]:
        if ci > k:
            cnt[0] = 100000
            break
        c += ci
        if c > k:
            cnt[0] += 1
            c = ci
    for i in range(1, 2**(h - 1)):
        div = [j + 1 for j in range(h) if i & 2**j]
        ss = []
        l = 0
        for d in div:
            ss.append(s[l:d])
            l = d
        ss.append(s[l:])
        c = [0] * len(ss)
        t = [[sum(i) for i in zip(*si)] for si in ss]
        for j in range(w):
            if max(ti[j] for ti in t) > k:
                cnt[i] = 100000
                break
            for tt, ti in enumerate(t):
                c[tt] += ti[j]
            if max(c) > k:
                cnt[i] += 1
                c = [ti[j] for ti in t]
    print(min(cnt))

if __name__ == '__main__':
    main()

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

def main():
    h, w, k = map(int, input().split())
    s = np.array([[int(i) for i in list(input())] for _ in range(h)])
    cnt = [0] * 2**(h - 1)
    for i in range(2**(h - 1)):
        ss = np.split(s, [i & 2**j for j in range(h - 1) if i & 2**j > 0])
        cnt[i] += bin(i).count("1")
        l = 0
        for j in range(1, w + 1):
            if max(si[:, l:j].sum() for si in ss) > k:
                l = j - 1
                cnt[i] += 1
    print(min(cnt))

if __name__ == '__main__':
    main()
Problem p02780 (python)

Fixed submission:
from itertools import accumulate

n, k = map(int, input().split())
e = [(int(i) + 1) / 2 for i in input().split()]
a = list(accumulate(e))
s = [a[i + k] - a[i] for i in range(n - k)]
print(max(a[k - 1], *s) if n > k else a[-1])

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

n, k = map(int, input().split())
e = [(int(i) + 1) / 2 for i in input().split()]
a = list(accumulate(e))
s = [a[i + k] - a[i] for i in range(n - k)]
print(max(a[k - 1], *s))
Problem p02796 (python)

Fixed submission:
n = int(input())
r = []
for i in range(n):
    x, l = map(int, input().split())
    r.append((x - l, x + l))
r.sort(key=lambda _x: _x[1])
cnt = 1
limit = r[0][1]
for ri in r[1:]:
    if ri[0] >= limit:
        cnt += 1
        limit = ri[1]
print(cnt)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
n = int(input())
r = []
for i in range(n):
    x, l = map(int, input().split())
    r.append((x - l + 1, x + l - 1))
r.sort()
am = [[] for _ in range(n)]
for i in range(n):
    for j in range(i + 1, n):
        if r[i][1] < r[j][0]:
            break
        am[i].append(j)
        am[j].append(i)
while sum(len(mi) for mi in am):
    maxi, maxd = 0, 0
    for i, mi in enumerate(am):
        li = len(mi)
        if li > maxd:
            maxi, maxd = i, li
    for pi in am[maxi]:
        am[pi].remove(maxi)
    am.pop(maxi)
    n -= 1
print(n)
Problem p02811 (python)

Fixed submission:
k, x = map(int, input().split())
if k * 500 >= x:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
print(s.count("ABC"))
Problem p02850 (python)

Fixed submission:
import sys
from collections import deque
from operator import itemgetter

def read():
    return sys.stdin.readline().rstrip()

def main():
    n = int(read())
    al = [[] for _ in range(n)]
    e = dict()
    for i in range(n - 1):
        a, b = [int(j) - 1 for j in read().split()]
        al[a].append(b)
        al[b].append(a)
        e[(a, b)] = i
    v, k = 0, 0
    for i in range(n):
        if len(al[i]) > k:
            v = i
            k = len(al[i])
    print(k)
    sn = deque([(v, 0)])
    sd = set()
    ce = dict()
    while sn:
        v, cv = sn.popleft()
        sd.add(v)
        ci = 1
        for vn in al[v]:
            if vn in sd:
                continue
            if ci == cv:
                ci += 1
            if (v, vn) in e:
                ce[(v, vn)] = ci
            else:
                ce[(vn, v)] = ci
            sn.append((vn, ci))
            ci += 1
    for k, _ in sorted(e.items(), key=itemgetter(1)):
        print(ce[k])

if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import sys

def read():
    return sys.stdin.readline().rstrip()

def main():
    n = int(read())
    al = [[] for _ in range(n)]
    e = [(-1, -1) for _ in range(n - 1)]
    for i in range(n - 1):
        a, b = [int(j) - 1 for j in read().split()]
        al[a].append(b)
        al[b].append(a)
        e[i] = (a, b)
    k = max(map(len, al))
    print(k)
    c = [{i + 1 for i in range(k)} for _ in range(n)]
    for i in range(n - 1):
        a, b = e[i]
        ci = min(c[a] & c[b])
        print(ci)
        c[a].remove(ci)
        c[b].remove(ci)

if __name__ == '__main__':
    main()
Problem p02856 (python)

Fixed submission:
import sys
def input() -> str:
    return sys.stdin.readline()
m = int(input())
n, s = 0, 0
for i in range(m):
  d, c = [int(i) for i in input().split()]
  n += c
  s += d * c
print(n + (s - 1) // 9 - 1)

Buggy submission (verdict: Runtime Error):
import sys
def input() -> str:
    return sys.stdin.readline()
m = int(input())
n = ""
cnt = 0
for i in range(m):
  d, c = input().split()
  if d == "0":
    cnt += int(c)
  # elif d == "1":
  #   cnt +=
  else:
    n += d * int(c)
# print(n)
while int(n) >= 10:
  n = n[2:] + str(int(n[0]) + int(n[1]))
  cnt += 1
# print(n)
print(cnt)

Buggy submission (verdict: Runtime Error):
import sys
def input() -> str:
    return sys.stdin.readline()
m = int(input())
n = "".join(d * int(c) for d, c in [input().split() for i in range(m)])
cnt = 0
while int(n) >= 10:
  n = n[:-2] + str(int(n[-1]) + int(n[-2]))
  cnt += 1
print(cnt)
Problem p02924 (python)

Fixed submission:
n = int(input())
print(n * (n - 1) // 2)

Buggy submission (verdict: Runtime Error):
n = int(input())
m = 0
p = list(range(2, n + 1)) + [1]
for i, pi in enumerate(p):
  m += (i + 1) % pi
print(m)
Problem p02946 (python)

Fixed submission:
k, x = [int(i) for i in input().split()]
minimum = 1000000 - k + 1 if x + k - 1 > 1000000 else max(x - k + 1, -1000000)
maximum = -1000000 + k - 1 if x - k - 1 < -1000000 else min(x + k - 1, 1000000)
print(*range(minimum, maximum + 1))

Buggy submission (verdict: Runtime Error):
k, x = [int(i) for i in input().split()]
minimum = 1_000_000 - k + 1 if x + k - 1 > 1_000_000 else max(x - k + 1, -1_000_000)
maximum = -1_000_000 + k - 1 if x - k - 1 < -1_000_000 else min(x + k - 1, 1_000_000)
print(*range(minimum, maximum + 1))

Buggy submission (verdict: Runtime Error):
k, x = [int(i) for i in input().split()]
minimum = 1_000_000 - k + 1 if x + k - 1 > 1_000_000 else max(x - k + 1, -1_000_000)
maximum = -1_000_000 + k - 1 if x - k - 1 < -1_000_000 else min(x + k - 1, 1_000_000)
print(*range(minimum, maximum + 1))

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

k, x = [int(i) for i in input().split()]
minimum = 1_000_000 - k + 1 if x + k - 1 > 1_000_000 else max(x - k + 1, -1_000_000)
maximum = -1_000_000 + k - 1 if x - k - 1 < -1_000_000 else min(x + k - 1, 1_000_000)
print(*range(minimum, maximum + 1))
Problem p02947 (python)

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
cnt = {}
result = 0
for si in s:
    if si in cnt:
        result += cnt[si]
        cnt[si] += 1
    else:
        cnt[si] = 1
print(result)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())
s = ["".join(sorted(input().split()[0])) for _ in range(n)]
cnt = {}
result = 0
for si in s:
    if si in cnt:
        result += cnt[si]
        cnt[si] += 1
    else:
        cnt[si] = 1
print(result

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from itertools import combinations
import sys
input = sys.stdin.readline

n = int(input())
s = [input().split()[0] for _ in range(n)]
cnt = defaultdict(int)
for i in range(n):
    s[i].sort()
    cnt["".join(s[i])] += 1
result = 0
for c in cnt:
    result += len(list(combinations([""] * cnt[c], 2)))
print(result)
Problem p02993 (python)

Fixed submission:
s = input()
b = ''
for i in s:
  if i == b:
    print('Bad')
    exit()
  b = i
print('Good')

Buggy submission (verdict: Runtime Error):
n = int(input())
xy = [0] * n
for i in range(n):
    xy[i] = tuple([int(j) for j in input().split()])
loop = True
cnt = 0
while loop:
    xy_num = len(xy)
    for i in xy:
        a, b = i
        for j in xy:
            if j[0] == a and j[1] != b:
                d = j[1]
                for k in xy:
                    if k[1] == b and k[0] != a:
                        c = k[0]
                        if (c, d) not in xy:
                            xy.append((c, d))
                            cnt += 1
                    if k[1] == d and k[0] != a:
                        c = k[0]
                        if (c, b) not in xy:
                            xy.append((c, b))
                            cnt += 1
            if j[1] == b:
                c = j[0]
                for k in xy:
                    if k[0] == c and k[1] != b:
                        d = k[1]
                        if (a, d) not in xy:
                            xy.append((a, d))
                            cnt += 1
    if len(xy) == xy_num:
        loop = False
print(cnt)
Problem p03014 (python)

Fixed submission:
import sys

def read():
    return sys.stdin.readline().rstrip()

def main():
    h, w = map(int, read().split())
    s = [list(read()) for _ in range(h)]
    row = [[0 for _ in range(w)] for _ in range(h)]
    col = [[0 for _ in range(w)] for _ in range(h)]
    for i in range(h):
        c = 0
        for j in range(w):
            if s[i][j] == "#":
                for k in range(j - c, j):
                    row[i][k] = c
                c = 0
            else:
                c += 1
        for k in range(w - c, w):
            row[i][k] = c
    for i in range(w):
        c = 0
        for j in range(h):
            if s[j][i] == "#":
                for k in range(j - c, j):
                    col[k][i] = c
                c = 0
            else:
                c += 1
        for k in range(h - c, h):
            col[k][i] = c
    ans = 0
    for i in range(h):
        for j in range(w):
            ans = max(row[i][j] + col[i][j], ans)
    print(ans - 1)

if __name__ == '__main__':
    main()

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


def read():
    return sys.stdin.readline().rstrip()


def main():
    h, w = map(int, read().split())
    s = np.array([[i == "." for i in read()] for _ in range(h)], dtype=int)
    left = s.copy()
    right = s.copy
    up = s.copy
    down = s.copy
    for i in range(w - 1):
        left[:, i + 1] = (left[:, i] + 1) * s[:, i + 1]
        right[:, -i - 2] = (right[:, -i - 1] + 1) * s[:, -i - 2]
    for i in range(h - 1):
        up[i + 1] = (up[i] + 1) * s[i + 1]
        down[-i - 2] = (down[-i - 1] + 1) * s[-i - 2]
    print((left + right + up + down).max() - 3)


if __name__ == '__main__':
    main()
Problem p03032 (python)

Fixed submission:
n, k = map(int, input().split())
v = [int(i) for i in input().split()]
ans = 0
for a in range(min(n, k) + 1):
    pa, va = v[:a], v[a:]
    for b in range(min(n, k) - a + 1):
        pb = pa + va[-b:] if b > 0 else pa
        pb.sort()
        s = sum(pb)
        ans = max(s, ans)
        for c in range(min(k - a - b, a + b)):
            s -= pb[c]
            ans = max(s, ans)
print(ans)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
v = [int(i) for i in input().split()]
ans = 0
for a in range(k + 1):
    pa, va = v[:a], v[a:]
    for b in range(k - a + 1):
        pb = pa + va[-b:] if b > 0 else pa
        pb.sort()
        s = sum(pb)
        for c in range(min(k - a - b, a + b)):
            s -= pb[c]
            ans = max(ans, s)
print(ans)
Problem p03061 (python)

Fixed submission:
from functools import reduce
from fractions import gcd

def main():
    n = int(input())
    a = sorted(int(i) for i in input().split())
    a0 = a[0]
    if a0 == 1:
        print(reduce(gcd, a[1:]))
        return
    c = []
    for i in range(2, int(a0**0.5) + 1):
        while a0 % i == 0:
            c.append(i)
            a0 //= i
    if a0 != 1:
        c.append(a0)
    d = [0] * len(c)
    for ai in a[1:]:
        for i, ci in enumerate(c):
            if ai % ci == 0:
                ai //= ci
            else:
                d[i] += 1
    e = []
    g = 1
    for k, v in zip(c, d):
        if v == 0:
            g *= k
        elif v == 1:
            e.append(k)
    f = [1] * (n - 1)
    for i, ai in enumerate(a[1:]):
        for ei in e:
            if ai % ei == 0:
                ai //= ei
            else:
                f[i] *= ei
    print(max(g * max(f), reduce(gcd, a[1:])))

if __name__ == '__main__':
    main()

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

def main():
    n = int(input())
    a = sorted(int(i) for i in input().split())
    a0 = a[0]
    if a0 == 1:
        print(reduce(gcd, a[1:]))
        return
    c = []
    for i in range(2, int(a0**0.5) + 1):
        while a0 % i == 0:
            c.append(i)
            a0 //= i
    if a0 != 1:
        c.append(a0)
    d = [0] * len(c)
    for ai in a[1:]:
        for i, ci in enumerate(c):
            if ai % ci == 0:
                ai //= ci
            else:
                d[i] += 1
    e = []
    g = 1
    for k, v in zip(c, d):
        if v == 0:
            g *= k
        elif v == 1:
            e.append(k)
    f = [1] * (n - 1)
    for i, ai in enumerate(a[1:]):
        for ei in e:
            if ai % ei == 0:
                ai //= ei
            else:
                f[i] *= ei
    print(max(g * max(f), reduce(gcd, a[1:])))

if __name__ == '__main__':
    main()
Problem p03244 (python)

Fixed submission:
from collections import Counter
from operator import itemgetter

n = int(input())
v = [int(i) for i in input().split()]
a = sorted(Counter(v[::2]).items(), key=itemgetter(1))
b = sorted(Counter(v[1::2]).items(), key=itemgetter(1))
ka, va = a[-1]
kb, vb = b[-1]
if ka != kb:
    print(n - va - vb)
else:
    sa = a[-2][1] if len(a) > 1 else va
    sb = b[-2][1] if len(b) > 1 else vb
    if len(a) == len(b) == 1:
        sa, sb = 0, 0
    print(n - max(sa + vb, va + sb))

Buggy submission (verdict: Runtime Error):
from collections import Counter
from operator import itemgetter

n = int(input())
v = [int(i) for i in input().split()]
a = sorted(Counter(v[::2]).items(), key=itemgetter(1))
b = sorted(Counter(v[1::2]).items(), key=itemgetter(1))
ka, va = a[-1]
kb, vb = b[-1]
if ka != kb:
    print(n - va - vb)
else:
    sa = a[-2][1] if len(a) > 1 else va
    sb = b[-2][1] if len(b) > 1 else vb
    if len(a) == len(b) == 1:
        sa = 0
    if sa < sb:
        print(n - sa - vb)
    else:
        print(n - va - sb)
from collections import Counter
from operator import itemgetter

n = int(input())
v = [int(i) for i in input().split()]
a = sorted(Counter(v[::2]).items(), key=itemgetter(1))
b = sorted(Counter(v[1::2]).items(), key=itemgetter(1))
ka, va = a[-1]
kb, vb = b[-1]
if ka != kb:
    print(n - va - vb)
else:
    sa = a[-2][1] if len(a) > 1 else va
    sb = b[-2][1] if len(b) > 1 else vb
    if len(a) == len(b) == 1:
        sa = 0
    if sa < sb:
        print(n - sa - vb)
    else:
        print(n - va - sb)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())
fl = True
for i in range(k):
    fl &= s[i] == "1"
    if not fl:
        print(s[i])
        break
else:
    print(1)

Buggy submission (verdict: Runtime Error):
s = input()
if input() != "1":
    s = s.lstrip("1")
print(s[0])
Problem p03284 (python)

Fixed submission:
n, k = [int(i) for i in input().split()]
print(int(n % k != 0))

Buggy submission (verdict: Runtime Error):
n, k = [int(i) - 1 for i in input().split()]
print(int(n % k != 0))
Problem p03379 (python)

Fixed submission:
n = int(input())
x = [int(i) for i in input().split()]
xs = sorted(x)
d = dict()
for i in range(n):
  if xs[i] not in d:
    d[xs[i]] = i
for i in range(n):
  print(xs[n // 2 - int(d[x[i]] >= n // 2)])

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [int(i) for i in input().split()]
xs = sorted(x)
indices = [-1] * (max(x) + 1)
for i in range(n):
  if indices[xs[i]] == -1:
    indices[xs[i]] = i
for i in range(n):
  print(xs[n // 2 - int(indices[x[i]] >= n // 2)])
Problem p03386 (python)

Fixed submission:
a, b, k = [int(i) for i in input().split()]
print(*([i for i in range(a, min(a + k, b + 1))] + [i for i in range(max(a + k, b - k + 1), b + 1)]), sep="\n")

Buggy submission (verdict: Runtime Error):
va, b, k = [int(i) for i in input().split()]
print(*([i for i in range(a, min(a + k, b + 1))] + [i for i in range(max(a + k, b - k + 1), b + 1)]), sep="\n")
Problem p03409 (python)

Fixed submission:
from operator import itemgetter


n = int(input())
red = {tuple(int(i) for i in input().split()): False for _ in range(n)}
blue = {tuple(int(i) for i in input().split()): False for _ in range(n)}
c = 0
for b in sorted(blue.keys()):
    for r in sorted(red.keys(), key=itemgetter(1), reverse=True):
        if not red[r] and b[0] > r[0] and b[1] > r[1]:
            red[r] = True
            blue[b] = True
            c += 1
            break
print(c)

Buggy submission (verdict: Runtime Error):
n = int(input())
red = {tuple(int(i) for i in input().split()): False for _ in range(n)}
blue = {tuple(int(i) for i in input().split()): False for _ in range(n)}
c = 0
for b in sorted(blue.keys()):
    for r in sorted(red.keys(), key=itemgetter(1), reverse=True):
        if not red[r] and b[0] > r[0] and b[1] > r[1]:
            red[r] = True
            blue[b] = True
            c += 1
            break
print(c)