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

Fixed submission:
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]


sabun = []
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        else:
            p = xy[i][0] - xy[j][0]
            q = xy[i][1] - xy[j][1]
            sabun.append([p,q])
count = [sabun.count(i)+sabun.count([-i[0],-i[1]]) for i in sabun]

if count == []:
    print("1")
else:
    print(int(N-(max(count))/2))

Buggy submission (verdict: Runtime Error):
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]

sabun = []
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        else:
            p = xy[i][0] - xy[j][0]
            q = xy[i][1] - xy[j][1]
            sabun.append([p,q])
count = [sabun.count(i)+sabun.count([-i[0],-i[1]]) for i in sabun]
print(int(N-(max(count))/2))

Buggy submission (verdict: Runtime Error):
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]

sabun = []
for i in range(N):
    for j in range(N):
        if i == j:
            continue
        else:
            p = xy[i][0] - xy[j][0]
            q = xy[i][1] - xy[j][1]
            sabun.append([p,q])
count = [sabun.count(i)+sabun.count([-i[0],-i[1]]) for i in sabun]
print(int(N-(max(count))/2))

Buggy submission (verdict: Runtime Error):
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]

sabun = []
for i in range(N):
    for j in range(N-i-1):
        p = xy[i][0] - xy[j+i+1][0]
        q = xy[i][1] - xy[j+i+1][1]
        # print(p,q)
        sabun.append([p,q])
count = [sabun.count(i) for i in sabun]
# print(sabun)
print(N-max(count))

Buggy submission (verdict: Runtime Error):
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]

sabun = []
for i in range(N):
    for j in range(N-i):
        if i == j+i:
            continue
        else:
            p = xy[i][0] - xy[j+i][0]
            q = xy[i][1] - xy[j+i][1]
            # print(p,q)
            sabun.append([p,q])
count = [sabun.count(i) for i in sabun]
print(N-max(count))
Problem p03059 (python)

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

ans = [i for i in range(1,30) if i%a == 0 and i<t+0.5]
print(len(ans)*b)

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

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n = int(input())
a_list = list(map(int,input().split()))


ans = 0
for i in range(n):
    init = a_list[:]
    init.pop(i)
    gcd = gcd_list(init)
    if ans < gcd:
        ans = gcd

print(ans)
Problem p03061 (python)

Fixed submission:
from fractions import gcd

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

rs, ls = [0], [0]
for i in range(n-1):
  rs.append(gcd(rs[i], a[i]))
  ls.append(gcd(ls[i], a[-i-1]))

gcd_list = [gcd(r,l) for r, l in zip(rs, ls[::-1])]
print(max(gcd_list))

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

def gcd_list(numbers):
    return reduce(math.gcd, numbers)


n = int(input())
a_list = list(map(int,input().split()))

ans = 0
for i in range(n):
    init = a_list[:]
    init.pop(i)
    gcd = gcd_list(init)
    if ans < gcd:
        ans = gcd

print(ans)
Problem p03105 (python)

Fixed submission:
a,b,c = map(int,input().split())
oto = b//a
if oto >= c:
    oto = c
print(oto)

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

yakusuu_array = []

for ab in [a,b]:
    yakusuu_array_ab = []
    for i in range(1,ab):
        if ab % i == 0:
            yakusuu_array_ab.append(i)
    yakusuu_array.append(yakusuu_array_ab)

kouyakusuu = list(set(yakusuu_array[0]) & set(yakusuu_array[1]))

if len(kouyakusuu) == 0:
    print(1)
else:
    print(kouyakusuu[k-1])
Problem p03243 (python)

Fixed submission:
n = int(input())
print(min([i for i in range(100,1000) if i >= n and i//100 == (i//10)%10 and i//100 == i%10]))

Buggy submission (verdict: Runtime Error):
n = int(input())
print(min([i for i in range(100,999) if i >= n and i//100 == (i//10)%10 and i//100 == i%10]))
Problem p02641 (python)

Fixed submission:
x,n = map(int,input().split())
if n == 0:print(x)
else:
  li = list(map(int,input().split()))

  for i in range(100):
    plus = (x+i)  in li
    minus = (x-i)  in li
  
    if plus == 1 and minus == 1:
      pass  
    elif plus == 1 and minus == 0:
      print(x-i)
      break
    elif plus == 0 and minus == 1:
      print(x+i)
      break
    else:
      print(x-i)
      break

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

for i in range(100):
  for j in range(n):
    if i == j:pass
    elif li[i]%li[j] == 0:break
    elif j == n-1:count +=1

print(count)
Problem p02645 (python)

Fixed submission:
str = input()
print(str[0:3])

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

for x in range(k-1):
  d_list = [0]*n
  
  for x in range(n-1):
    
    d_list[x-i_list[x]:x+i_list[x]] = map(lambda y: y+1, d_list[x-i_list[x]:x+i_list[x]])
    
    
  i_list = [x + y for (x, y) in zip(i_list, d_list)]
  
print(i_list)
Problem p02554 (python)

Fixed submission:
MOD = 10 ** 9 + 7

N = int(input())

ans = pow(10, N, MOD)
ans -= 2 * pow(9, N, MOD)
ans += pow(8, N, MOD)
ans %= MOD # 最後にMODを取り忘れないように気をつけましょう

print(ans)

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

if a >= 0 and c >= 0:
  print(b*d)
elif b <= 0 and d <= 0:
  print(a*c)
elif a < 0 and c < 0:
  if b<=0 or d<=0:
    print(a*c)  
  elif abs(a)>=abs(b) and abs(c)>=abs(d):
    print(a*c)
  else:
    print(b*d)
elif (b<0 and c>=0):
  print(b*c)
elif (a>=0 and d<0):
  print(a*d)
else:
  print(b*d)
Problem p02582 (python)

Fixed submission:
a,b,c = input()
count = 0

if a == "R" and b == "R" and c == "R":
  count = 3
elif (a == "R" and b == "R") or(b == "R" and c == "R"):
  count = 2
elif a == "R"or b =="R" or c == "R":
  count = 1
else:
  count = 0
  
print(count)

Buggy submission (verdict: Runtime Error):
a,b,c = input()
count = 0

if a == "R" and b == "R" and c == "R":
  count = 3
elif (a == "R" and b == "R") or(b == "R" and c == "R"):
  count = 2
elif a == "R"or b =="R" or C == "R":
  count = 1
else:
  count = 0
  
print(count)
Problem p03049 (python)

Fixed submission:
n = int(input())
s = [input() for i in range(n)]

ab = 0
ba = 0
c2 = 0
c3 = 0
for x in s:
    if 'AB' in x:
        ab += x.count('AB')    
    if x[-1] == 'A' and x[0] == 'B':
        ba += 1
    if x[-1] == 'A' and x[0] != 'B':
        c2 += 1
    if x[-1] != 'A' and x[0] == 'B':
        c3 += 1
if ba > 0:
    if c2 + c3 > 0:
        ans = ab + ba + min(c2, c3)
    else: # c2 = c3 =0
        ans = ab + ba - 1
else:
    ans = ab + min(c2, c3)
print(ans)

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

ab = 0
ba = 0
c2 = 0
c3 = 0
for x in s:
    if 'AB' in x:
        ab += x.count('AB')    
    if x[-1] == 'A' and x[0] == 'B':
        ba = 1
    if x[-1] == 'A' and x[0] != 'B':
        c2 += 1
    if x[-1] != 'A' and x[0] == 'B':
        c3 += 1
if ba > 0:
    if c2 + c3 > 0:
        ans = ab + ba + min(c2, c3)
    else: # c2 = c3 =0
        ans = ab + ba - 1
print(ans)
Problem p03062 (python)

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

a.sort()
minus, plus = [], []

for x in a:
    if x < 0:
        minus.append(x)
    else:
        plus.append(x)

tmp = sum([abs(x) for x in a])

if len(minus) % 2 == 0:
    print(tmp)
else:
    if plus == [] or abs(minus[-1]) < plus[0]:
        print(tmp + minus[-1] * 2)
    else:
        print(tmp - plus[0] * 2)

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

a.sort()
minus, plus = [], []

for x in a:
    if x < 0:
        minus.append(x)
    else:
        plus.append(x)

tmp = sum([abs(x) for x in a])

if len(minus) % 2 == 0:
    print(tmp)
else:
    if abs(minus[-1]) > plus[0]:
        print(tmp - plus[0] * 2)
    else:
        print(tmp + minus[-1] * 2)
Problem p03565 (python)

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

for i in range(len(s) - len(t) + 1)[::-1]:
    cnt = 0
    q = 0
    for j in range(len(t))[::-1]:
        if s[i + j] == '?':
            q += 1
        elif s[i + j] == t[j]:
            cnt += 1
    
    if cnt == len(t) - q:
        idx = i
        s = s[:idx] + t + s[idx + len(t):]
        for k in range(len(s)):
            if s[k] == '?':
                s = s[:k] + 'a' + s[k + 1:]
        print(s)
        break
else:
    print('UNRESTORABLE')

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

for i in range(len(sd) - len(t) + 1):
    cnt = 0
    q = 0
    for j in range(len(t)):
        if sd[i + j] == '?':
            q += 1
            continue
        if sd[i + j] == t[j]:
            cnt += 1
    if cnt == len(t) - q:
        idx = i
        s = sd[:idx] + t + sd[idx + len(t) + 1:]
        for k in range(len(sd)):
            if s[k] == '?':
                s = s[:k] + 'a' + s[k + 1:]
                print(s)
        break
else:
    print('UNRESTORABLE')
Problem p03493 (python)

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

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

while exist_odd == False:
    for i in range(n):
        if a[i] % 2 != 0:
            exist_odd = True
            if n != i:
                count -= 1
            break
        else:
            a[i] = a[i] / 2
    count += 1
print(count)

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

while exist_odd == False:
    for i in range(n):
        if a[i] % 2 != 0:
            exist_odd = True
            if n != i:
                count -= 1
            break
        else:
            a[i] = a[i] / 2
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split()))
count = 0
# list a[i]が偶数かどうかをチェック。ループはとりあえず省略する

exist_odd = False
# in_if = 0
# in_for = 0
# in_while = 0
while exist_odd == False:
    for i in range(n):
        if a[i] % 2 != 0:
            exist_odd = True
            if n != i:
                count -= 1
            break
        else:
            a[i] = a[i] / 2
        # in_if += 1
        # print(in_if)
    count += 1
print(count)
Problem p03079 (python)

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

if a == b and b ==c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
n, q = [int(x) for x in input().split()]
s = input()
td = [input().split() for _ in range(q)]
lo, hi = 0, n-1

for t, d in reversed(td):
    if d == "L" and s[lo] == t:
        lo += 1
    elif d == "R" and s[hi] == t:
        hi -= 1
    if lo >= hi:
        print(0)
        break
else:
    print(hi-lo+1)
Problem p03385 (python)

Fixed submission:
s = input()

if all(x in s for x in ['a', 'b', 'c']):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a, b, c  = [int(x) for x in input().strip().split()]

res = {x for seq in [range(a,min(a+c, b)), range(b, max(a,b-c), -1)] for x in seq}

if a==b:
    res = {a}

for x in sorted(list(res)):
    print(x)
Problem p03408 (python)

Fixed submission:
memo = {}

n = int(input())
for i in range(n):
    s = input().strip()
    if s not in memo:
        memo[s] = 1
    else:
        memo[s] += 1

n = int(input())
for i in range(n):
    s = input().strip()
    if s not in memo:
        memo[s] = -1
    else:
        memo[s] -= 1

res =  max(memo.values())
if res<0:
    res = 0

print(res)

Buggy submission (verdict: Runtime Error):
m = {}

n = int(input())
for i in range(n):
    s = input().strip()
    if s not in m:
        m[s] = 1
    else:
        m[s] += 1

m = int(input())
for i in range(m):
    t = input().strip()
    if t not in m:
        m[t] = -1
    else:
        m[t] -= 1

res = max(m.values())
if res<0:
    res = 0

print(res)
Problem p02612 (python)

Fixed submission:
n = int(input())
if n % 1000 == 0:
    print("0")
else:
    print(((n // 1000) + 1) * 1000 - n)

Buggy submission (verdict: Runtime Error):
n = list(input())
if int("".join(n)) % 1000 == 0:
    print("0")
else:
    print((10 - int(n[-3])) * 100)

Buggy submission (verdict: Runtime Error):
n = list(input())
if n % 1000 == 0:
    print("0")
else:
    print((10 - int(n[-3])) * 100)
Problem p02641 (python)

Fixed submission:
x, n = map(int, input().split())
if n != 0:
  n = list(map(int, input().split()))
  ans = []
  for i in range(101):
    if n.count(x + i) == 0:
      ans.append(x + i)

    if n.count(x - i) == 0:
      ans.append(x - i)
    
    if ans != []:
      break

  print(min(ans))
else:
  print(x)

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n != 0:
  n = list(map(int, input().split()))
  min_n = abs(x - min(n))
  max_n = max(n) - x
  ans = []
  for i in range(1, max(min_n, max_n) + 1):
    if n.count(x + i) == 0:
      ans.append(x + i)

    if n.count(x - i) == 0:
      ans.append(x - i)
    
    if ans != []:
      break

  print(min(ans))
else:
  print(x)

Buggy submission (verdict: Runtime Error):
x, n = map(int, input().split())
if n != 0:
  n = list(map(int, input().split()))
  min_n = min(n)
  max_n = max(n)
  ans = []
  for i in range(1, max(x - min_n, max_n - x) + 1):
    if n.count(x + i) == 0:
      ans.append(x + i)

    if n.count(x - i) == 0:
      ans.append(x - i)
    
    if ans != []:
      break

  print(min(ans))
else:
  print(x)
Problem p02718 (python)

Fixed submission:
n, m= map(int, (input().split()))
a = list(map(int, input().split()))
count = 0
total = 0
for i in a:
  total += i
for j in a:
  if not (j / total < 1 / (4 * m)):
    count += 1
if count >= m:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n, m= map(int, (input().split()))
a = list(map(int, input().split()))
count = 0
total = 0
for i in a:
  total += i
for j in a:
  if j / total => 1 / (4 * m):
    count += 1
if count >= m:
  print("Yes")
else:
  print("No")
Problem p02719 (python)

Fixed submission:
n, k = map(int, input().split())
print(min(n % k, k - n % k))

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
nk_abs = abs(n - k)
if n < nk_abs and n < k:
  print(n)
  exit()
if k == 1:
  print(0)
else:
  print(n % nk_abs)

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
nk_abs = abs(n - k)
if n < nk_abs and n < k:
  print(n)
if k == 1:
  print(0)
else:
  print(n % nk_abs)

Buggy submission (verdict: Runtime Error):
n, k = map(int,input().split())
nk_abs = abs(n - k)
if k == 1:
  print(0)
else:
  print(n % nk_abs)
Problem p02741 (python)

Fixed submission:
k = int(input())
num_list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(num_list[k -1])

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
boad = h * w
if w == 1 and h == 1:
  print(1)
else:
  print((boad + 1) // 2)
Problem p02748 (python)

Fixed submission:
a, b, m = map(int, input().split())
reizo = list(map(int, input().split()))
renji = list(map(int, input().split()))
p = [list(map(int,input().split())) for i in range(m)]
ans = []
for i in range(m):
  cost = reizo[p[i][0] - 1] + renji[p[i][1] - 1] - p[i][2]
  ans.append(cost)
ans.append(min(reizo) + min(renji))
print(min(ans))

Buggy submission (verdict: Runtime Error):
a, b, m = map(int, input().split())
reizo = list(map(int, input().split()))
renji = list(map(int, input().split()))
p = [list(map(int,input().split())) for i in range(m)]
ans = []
for i in range(m):
  cost = reizo[p[i][0]] + renji[p[i][1]] - p[i][2]
  ans.append(cost)
ans.append(min(reizo) + min(renji))
print(min(ans))
Problem p02784 (python)

Fixed submission:
h, n = map(int, input().split())
Deathblow = list(map(int, input().split()))
for i in range(n):
  h -= Deathblow[i]
if h < 1:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
h, n = map(int, input().split())
Deathblow = list(map(int, input().split()))
for i in n:
  h -= Deathblow[i]
if h < 1:
  print("Yes")
else:
  print("No")
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):
import itertools

n = int(input())
p = list(map(int, input().split()))
q = list(map(int, input().split()))

list_range = list(range(1,n+1))
pattern_list = list(itertools.permutations(list_range, n))
pattern_list.sort()
ans = [0] * 2
for i in range(len(pattern_list)):
  if p == list(pattern_list[i]):
    ans[0] = i + 1
  elif q == list(pattern_list[i]):
    ans[1] = i + 1
print(abs(ans[0] - ans[1]))
Problem p02817 (python)

Fixed submission:
s, t = input().split(" ")
print(t+s)

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = a[0] - a[2]
if b <= 0:
  ans = a[1] + b
  if ans < 0:
    print('0 0')
  print('0 {}'.format(ans))
elif b == 0:
  print('0 {}'.format(a[1]))

elif b > 0:
  print('{} {}'.format(b, a[1]))

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = a[0] - a[2]
if b <= 0:
  ans = a[1] + b
  print('0 {}'.format(ans))
else:
  print('{} {}'.format(b, a[1]))
Problem p02818 (python)

Fixed submission:
a = list(map(int,input().split()))
b = a[0] - a[2]
if b <= 0:
  ans = a[1] + b
  if ans < 0:
    print('0 0')
  else:
    print('0 {}'.format(ans))
elif b == 0:
  print('0 {}'.format(a[1]))

elif b > 0:
  print('{} {}'.format(b, a[1]))

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = a[0] - a[2]
if b <= 0:
  ans = a[1] + b
  print('0 {}'.format(ans))
elif b == 0:
  print('0 {}'.format(a[1]))
elif ans < 0:
  print('0 0')
else:
  print('{} {}'.format(b, a[1]))

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = a[0] - a[2]
if b < 0:
  ans = a[1] + b
  print('0 {}'.format(ans))
elif ans < 0:
  print('0 0')
else:
  print('{} {}'.format(b, a[1]))

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
b = a[0] - a[2]
if b <= 0:
  ans = a[1] + b
  print('0 {}'.format(ans))
elif ans <= 0:
  print('0 0')
else:
  print('{} {}'.format(b, a[1]))
Problem p02952 (python)

Fixed submission:
n = int(input())
ans = 0
for i in range(1, n + 1):
  if len(str(i)) % 2 == 1:
    ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
od = len(n)
i = 0
for i in range(1,n +1):
    if od % 2 ==1:
        i += 1
print(i)
Problem p03059 (python)

Fixed submission:
a, b, t = map(int,input().split())
count = 0
for i in range(1, t+1):
  if i % a == 0:
    count += 1
print(count * b)

Buggy submission (verdict: Runtime Error):
a, b, t = int(input())
count = 0
for i in range(t):
  if i % a == 0:
    count +=1
print(count * b)

Buggy submission (verdict: Runtime Error):
a, b, t = int(input())
count = 0
for i in range(t):
  if i % a == 0:
    count +=1
print(count * b)
Problem p03103 (python)

Fixed submission:
n, m = map(int, input().split())
stores = [list(map(int, input().split())) for _ in range(n)]
sorted_sotres = sorted(stores, key=lambda x: x[0])
total = 0
ans = 0
for cost, number in sorted_sotres:
    if number > m:
        ans += cost * m
        break
    elif number == m:
        ans += cost * number
        break
    else:
        ans += cost * number
    m -= number
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
stores = [tuple(map(int, input().split())) for _ in range(n)]
dict_stores = dict(stores)
lower_cost = sorted(dict_stores.keys())
total = 0
ans = 0
for i in range(n):
    total += dict_stores[lower_cost[i]]
    if total >= m:
        diff = m - (total - dict_stores[lower_cost[i]])
        ans += lower_cost[i] * diff
        break
    else:
        ans += lower_cost[i] * dict_stores[lower_cost[i]]
print(ans)
Problem p03282 (python)

Fixed submission:
s = list(input())
k = int(input())
for i in range(min(len(s), k)):
    if s[i] != "1":
        print(s[i])
        exit()
print(1)

Buggy submission (verdict: Runtime Error):
s = list(input())
k = int(input())
number = 0
count = 0
for i in range(k):
    if s[i] == "1":
        count += 1
        if count == k - 1:
            number = 1
    elif s[i] != "1" and number == 0:
        number = s[i]
print(number)
Problem p03289 (python)

Fixed submission:
import string

s = list(input())
flag = True
if s[0] != "A":
    flag = False
count = 0
for i in range(1, len(s)):
    if s[i] in string.ascii_uppercase:
        if i == 1 or i == len(s) - 1 or s[i] != "C":
            flag = False
        count += 1

if flag and count == 1:
    print("AC")
else:
    print("WA")

Buggy submission (verdict: Runtime Error):
import string

s = list(input())
flag = True
if s[0] != "A":
    flag = False
s.pop(0)
if s.count("C") > 1:
    flag = False
s_index = s.index("C")
if 2 >= s_index or s_index <= (len(s) - 3):
    flag = False
s.pop(s_index)
for i in s:
    if i not in string.ascii_lowercase:
        flag = False

if flag:
    print("AC")
else:
    print("WA")
Problem p03386 (python)

Fixed submission:
a, b, k = map(int, input().split())
for i in range(a, min(b, a + k - 1) + 1):
    print(i)
for i in range(max(b - k + 1, a + k), b + 1):
    print(i)

Buggy submission (verdict: Runtime Error):
import collections

a, b, k = map(int, input().split())
numbers = list(range(a, b + 1))
ans = []
ans.extend(numbers[:k])
ans.extend(numbers[len(numbers) - k:])
ans_count = collections.Counter(ans)
for out in ans_count.keys():
    print(out)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
numbers = list(range(a, b + 1))
ans = []
ans.extend(numbers[:k])
ans.extend(numbers[len(numbers) - k:])
for out in ans:
    print(out)
Problem p03544 (python)

Fixed submission:
n = int(input())
lucas_number = [0] * (n + 1)
lucas_number[0] = 2
lucas_number[1] = 1
for i in range(2, n + 1):
    lucas_number[i] = lucas_number[i - 1] + lucas_number[i - 2]
print(lucas_number[n])

Buggy submission (verdict: Runtime Error):
n = int(input())
lucas_number = [0] * (n + 1)
lucas_number[0] = 2
lucas_number[1] = 1
for i in range(2, n + 1):
    lucas_number[i] = lucas_number[i - 1] + lucas_number[i - 2]
print(lucas_number[i])
Problem p03574 (python)

Fixed submission:
h, w = map(int, input().split())
field = [list(input()) for _ in range(h)]
dx = [1, 0, -1, 0, 1, -1, -1, 1]
dy = [0, 1, 0, -1, 1, 1, -1, -1]
for i in range(h):
    for j in range(w):
        if field[i][j] == "#":
            continue
        num = 0
        for k in range(8):
            ni = i + dy[k]
            nj = j + dx[k]
            if ni < 0 or h <= ni:
                continue
            if nj < 0 or w <= nj:
                continue
            if field[ni][nj] == "#":
                num += 1
        field[i][j] = str(num)
for out in field:
    print("".join(out))

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
field = [list(input().split()) for _ in range(h)]
dx = [1, 0, -1, 0, 1, -1, -1, 1]
dy = [0, 1, 0, -1, 1, 1, -1, -1]
for i in range(h):
    for j in range(w):
        if field[i][j] != "#":
            num = 0
            for k in range(8):
                ni = i + dy[k]
                nj = j + dx[k]
                if nj < 0 or h <= nj:
                    continue
                if ni < 0 or w <= ni:
                    continue
                if field[ni][nj] == "#":
                    num += 1
            field[i][j] = num
for out in field:
    print("".join(out))
Problem p03796 (python)

Fixed submission:
n = int(input())
training = 1
for i in range(1, n + 1):
    training = i * training % (10 ** 9 + 7)
print(training)

Buggy submission (verdict: Runtime Error):
from decimal import Decimal

n = int(input())
training = 1
for i in range(1, n):
    training *= i
print(Decimal(training) % (10 ** 9 + 7))