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

Fixed submission:
tasks=sorted(list(map(int,input().split())))

cost=0                                   
             
for i in range(1,len(tasks)):                      
    cost+=tasks[i]-tasks[i-1]
                                    
print(cost)

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

cost=0                                   
             
for i in range(1,len(tasks)):                      
    cost+=tasks[i]-tasks[i-1]
                                    
print(cost)
Problem p03411 (python)

Fixed submission:
N=int(input())

red=[]
blue=[]

for i in range(N):
    a,b=map(int,input().split())
    red.append((a,b))

for i in range(N):
    c,d=map(int,input().split())
    blue.append((c,d))

red=sorted(red,key=lambda x:-x[1])
blue=sorted(blue,key=lambda x:x[0])

answer=0
for i,b in enumerate(blue):
    for j,r in enumerate(red):
        if r[0]<b[0] and r[1]<b[1]:
            answer+=1
            red.pop(j)
            break

print(answer)

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

red=[]
blue=[]

for i in range(N):
    a,b=map(int,input().split())
    red.append((a,b))

for i in range(N):
    c,d=map(int,input().split())
    blue.append((c,d))

red=sorted(red,key=lambda x:-x[1])
blue=sorted(blue,key=lambda x:x[0])

answer=0
for i,b in enumerate(blue):
    for j,r in enumerate(red):
        if red[0]<blue[0] and red[1]<blue[1]:
            answer+=1
            red.pop(j)
            break

print(answer)

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

red=[]
blue=[]

for i in range(N):
    a,b=map(int,input().split())
    red.append((a,b))

for i in range(N):
    c,d=map(int,input().split())
    blue.append((c,d))

red=sorted(red,key=lambda x:-x[1])
blue=sorted(blue,key=lambda x:x[0])

answer=0
for i,b in enumerate(b):
    for j,r in enumerate(r):
        if red[0]<blue[0] and red[1]<blue[1]:
            answer+=1
            red.pop(j)
            break

print(answer)
Problem p03074 (python)

Fixed submission:
N, K = map(int, input().split())
S = list(str(input()))

count = 1
L = []
L.append(0)
for i in range(N):
    if i < N-1:
        if S[i] == S[i+1]:
            count += 1
        else:
            L.append(count)
            count = 1
    else:
        L.append(count)
        count = 1
L.append(0)

if S[0] == '1':
    ans = 0
    tmp = 0
    dist = 2 * (K + 1)
    for i in range(len(L)):
        tmp += L[i]
        if i % 2 == 1:
            if i - dist >= 0:
                tmp -= L[i-dist]
                tmp -= L[i-dist+1]
            ans = max(ans, tmp)
        else:
            if i == N - 1:
                ans = max(ans, tmp)
    print(ans)

if S[0] == '0':
    ans = 0
    tmp = 0
    dist = 2 * (K + 1)
    for i in range(len(L)):
        tmp += L[i]
        if i % 2 == 0:
            if i - dist + 1 >= 0:
                tmp -= L[i-dist+1]
            if i - dist >= 0:
                tmp -= L[i-dist]
            ans = max(ans, tmp)
        else:
            if i == N - 1:
                ans = max(ans, tmp)
    print(ans)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = str(input())
L = [0]
for i in range(len(S)-1):
#     print(S[i],S[i+1])
    if S[i] != S[i+1]:
        L.append(i+1)
L.append(len(S))
# print(L)

ans = 1
if N > K * 3:
    for i in range(len(L)-K*2-1):
        ans = max(ans, L[i+K*3-1]-L[i])
    print(ans)
else:
    print(len(S))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = str(input())

L = [0]
for i in range(len(S)-1):
#     print(S[i],S[i+1])
    if S[i] != S[i+1]:
        L.append(i+1)
L.append(len(S))
# print(L)

ans = 1
if N > K * 3:
    for i in range(len(L)-K*2-1):
        ans = max(ans, L[i+K*3-1]-L[i])
    print(ans)
    print("Yes")
else:
    print(len(S))

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = str(input())

L = [0]
for i in range(len(S)-1):
#     print(S[i],S[i+1])
    if S[i] != S[i+1]:
        L.append(i+1)
L.append(len(S))
# print(L)

ans = 1
if N > K * 3:
    for i in range(len(L)-K*2-1):
        ans = max(ans, L[i+K*3-1]-L[i])
    print(ans)
    print("Yes")
else:
    print(len(S))

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

S = str(input())

L = [0]
for i in range(len(S)-1):
#     print(S[i],S[i+1])
    if S[i] != S[i+1]:
        L.append(i+1)
L.append(len(S))
# print(L)

ans = 1
if N > K:
    for i in range(len(L)-K*2-1):
        ans = max(ans, L[i+K*3-1]-L[i])
    print(ans)
else:
    print(len(S))

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

S = str(input())

L = [0]
if len(S) != 1:
    for i in range(len(S)-1):
    #     print(S[i],S[i+1])
        if S[i] != S[i+1]:
            L.append(i+1)
    L.append(len(S))
# print(L)

ans = 1
for i in range(len(L)-K*2-1):
#     print(i, i+K*3-1)
#     print(L[i+K*3-1]-L[i])
    ans = max(ans, L[i+K*3-1]-L[i])
print(ans)
Problem p03087 (python)

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

S = str(input())

L = []
for i in range(Q):
    l,r = map(int, input().split())
    L.append((l-1,r-1))
    
check = []
for i in range(N-1):
    if S[i:i+2] == "AC":
        check.append(i)
        
from bisect import bisect_left,bisect_right
for i in L:
    print(bisect_right(check, i[1]-1)-bisect_left(check, i[0]))

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

S = str(input())

L = []
for i in range(Q):
    l,r = map(int, input().split())
    L.append((l-1,r-1))
    
    
check = []
for i in range(N-1):
    if S[i:i+2] == "AC":
        check.append(i)
        
for i in L:
    print(bisect_right(check, i[1]-1)-bisect_left(check, i[0]))
Problem p03111 (python)

Fixed submission:
N, A, B, C = map(int, input().split())
L = [int(input()) for _ in range(N)]

import itertools
m = 4
n = N
bit_list = list(itertools.product([i for i in range(m)], repeat=n))

res = 10 ** 18
for b in bit_list:
    tmp1 = 0
    tmp2 = 0
    tmp3 = 0
    check1 = False
    check2 = False
    check3 = False
    cost = 0
    for i in range(n):
        if b[i] == 1:
            tmp1 += L[i]
            if check1:
                cost += 10
            check1 = True       
            
        if b[i] == 2:
            tmp2 += L[i]
            if check2:
                cost += 10
            check2 = True
            
        if b[i] == 3:
            tmp3 += L[i]
            if check3:
                cost += 10
            check3 = True
    if min(tmp1, tmp2, tmp3) != 0:
        res = min(res, abs(tmp1 - A)+abs(tmp2 - B)+abs(tmp3 - C)+cost)
print(res)

Buggy submission (verdict: Runtime Error):
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "5 100 90 80\n"
     ]
    }
   ],
   "source": [
    "N,A,B,C = map(int, input().split())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "98\n",
      "40\n",
      "30\n",
      "21\n",
      "80\n"
     ]
    }
   ],
   "source": [
    "l = []\n",
    "for i in range(n):\n",
    "    l.append(int(input()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "23\n"
     ]
    }
   ],
   "source": [
    "INF = 10 ** 9\n",
    "def dfs(cur, a, b, c):\n",
    "    if cur == n:\n",
    "        return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a,b,c) > 0 else INF\n",
    "    ret0 = dfs(cur + 1, a, b, c)\n",
    "    ret1 = dfs(cur + 1, a + l[cur], b, c) + 10\n",
    "    ret2 = dfs(cur + 1, a, b + l[cur], c) + 10\n",
    "    ret3 = dfs(cur + 1, a, b, c + l[cur]) + 10\n",
    "    return min(ret0, ret1, ret2, ret3)\n",
    "\n",
    "print(dfs(0, 0, 0, 0))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
Problem p03157 (python)

Fixed submission:
h,w = map(int, input().split())
s = []
for i in range(h):
    s.append(input())
import sys
sys.setrecursionlimit(200000)
dy = [0,0,1,-1]
dx = [1,-1,0,0]
def dfs(y,x):
    global check
    global was
    was[y][x] = 1
    if s[y][x] == "#":
        check[0] += 1
    else:
        check[1] += 1
    for k in range(4):
        nx = x + dx[k]
        ny = y + dy[k]
        if nx >= 0 and ny >= 0 and nx < w and ny < h and s[ny][nx] != s[y][x] and not was[ny][nx]:
            dfs(ny,nx)
ans = 0
was = [[0 for i in range(w)] for j in range(h)]
for i in range(w):
    for j in range(h):
        if not was[j][i]:
            check = [0,0]
            dfs(j,i)
            ans += check[0] * check[1]
print(ans)

Buggy submission (verdict: Runtime Error):
h,w = map(int, input().split())
s = []
for i in range(h):
    s.append(input())
dx = [0,0,1,-1]
dy = [1,-1,0,0]
def dfs(y,x):
    global check
    global was
    was[y][x] = 1
    if s[y][x] == "#":
        check[0] += 1
    else:
        check[1] += 1
    for k in range(4):
        nx = x + dx[k]
        ny = y + dy[k]
        if ny >= 0 and nx >= 0 and nx < w and ny < h and s[ny][nx] != s[y][x] and not was[ny][nx]:
            dfs(ny,nx)
ans = 0
was = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
    for j in range(w):
        if not was[i][j]:
            check = [0,0]
            dfs(i,j)
            ans += check[0] * check[1]
print(ans)

Buggy submission (verdict: Runtime Error):
h,w = map(int, input().split())
s = []
for i in range(h):
    s.append(input())
dx = [0,0,1,-1]
dy = [1,-1,0,0]
def dfs(y,x):
    global check
    global was
    was[y][x] = 1
    if s[y][x] == "#":
        check[0] += 1
    else:
        check[1] += 1
    for k in range(4):
        nx = x + dx[k]
        ny = y + dy[k]
        if ny >= 0 and ny >= 0 and nx < w and ny < h and s[ny][nx] != s[y][x] and not was[ny][nx]:
            dfs(ny,nx)
ans = 0
was = [[0 for i in range(w)] for j in range(h)]
for i in range(h):
    for j in range(w):
        if not was[i][j]:
            check = [0,0]
            dfs(i,j)
            ans += check[0] * check[1]
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(200000)
h,w = map(int, input().split())
s = [input() for _ in range(h)]
dx = [0,0,1,-1]
dy = [1,-1,0,0]
def dfs(x,y):
    global check
    global was
    was[y][x] = 1
    if s[y][x] == "#":
        check[0] += 1
    else:
        check[1] += 1
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
        if ny >= 0 and ny >= 0 and nx < w and ny < h and s[ny][nx] != s[y][x] and not was[ny][nx]:
            dfs(nx,ny)
ans = 0
was = [[0 for i in range(h)] for j in range(w)]
for i in range(h):
    for j in range(w):
        if not was[i][j]:
            check = [0,0]
            dfs(i,j)
            ans += check[0] * check[1]
print(ans)
Problem p03240 (python)

Fixed submission:
n = int(input())
x = []
y = []
h = []
for i in range(n):
    a,b,c = map(int, input().split())
    x.append(a)
    y.append(b)
    h.append(c)
kk = h.index(max(h))
for i in range(101):
    for j in range(101):
        H = h[kk] + abs(x[kk] - i) + abs(y[kk] - j)
        for k in range(n):
            if h[k] > 0:
                if H != abs(x[k]-i)+abs(y[k]-j)+h[k]:
                    H = -1
            if h[k] == 0:
                if H > abs(x[k] - i) + abs(y[k] - j):
                    H = -1
        if H != -1:
            print(i, j, H)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = []
y = []
h = []
for i in range(n):
    a,b,c = map(int, input().split())
    x.append(a)
    y.append(b)
    h.append(c)
kk = h.index(max(h))
for i in range(101):
    for j in range(101):
        H = h[kk] + abs(x[k] - i) + abs(y[k] - j)
        for k in range(n):
            if h[k] > 0:
                if H != abs(x[k]-i)+abs(y[k]-j)+h[k]:
                    H = -1
            if h[k] == 0:
                if H > abs(x[k] - i) + abs(y[k] - j):
                    H = -1
        if H != -1:
            print(i, j, H)
Problem p03244 (python)

Fixed submission:
n = int(input())
v = [int(i) for i in input().split()] 
import collections
if len(set(v))  == 1:
    print(int(len(v) / 2))
else:
    a = collections.Counter(v[0::2]).most_common()
    b = collections.Counter(v[1::2]).most_common() 
    if a[0][0] == b[0][0]:
        print(min((len(v[0::2]) - a[1][1] + len(v[1::2]) - b[0][1]),(len(v[0::2]) - a[0][1] + len(v[1::2]) - b[1][1])))
    else:
        print(len(v[0::2]) - a[0][1] + len(v[1::2]) - b[0][1])

Buggy submission (verdict: Runtime Error):
n = int(input())
v = [int(i) for i in input().split()] 

from statistics import mode
if len(set(v))  == 1:
    print(int(len(v) / 2))
else:
    print(len(v[0::2]) - collections.Counter(v[0::2]).most_common()[0][1] + len(v[1::2]) - collections.Counter(v[1::2]).most_common()[0][1])

Buggy submission (verdict: Runtime Error):
n = int(input())
v = [int(i) for i in input().split()] 

from statistics import mode
if len(set(v))  == 1:
    print(int(len(v) / 2))
else:
    print(len(v[0::2]) - collections.Counter(v[0::2]).most_common()[0][1] + len(v[1::2]) - collections.Counter(v[1::2]).most_common()[0][1])
Problem p03262 (python)

Fixed submission:
n,x = map(int,input().split())
x_list = list(map(int,input().split()))
x_list.append(x)
x_list = sorted(x_list)
a = []
for i in range(n):
    b = x_list[i+1]-x_list[i]
    a.append(b)
import math
from functools import reduce
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
ans = reduce(gcd, a)
print(int(ans))

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
x_list = list(map(int,input().split()))
x_list.append(x)
x_list = sorted(x_list)
a = []
for i in range(n):
    b = x_list[i+1]-x_list[i]
    a.append(b)
import math
from functools import reduce
ans = reduce(math.gcd, a)
print(int(ans))

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
x_list = list(map(int,input().split()))
x_list.append(x)
x_list = sorted(x_list)
a = []
for i in range(n):
    b = x_list[i+1]-x_list[i]
    a.append(b)
import math
from functools import reduce
def gcd(*numbers):
    return reduce(math.gcd, numbers)
ans = gcd(*a)
print(int(ans))

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
x_list = list(map(int,input().split()))
import math
import functools
x_list.append(x)
x_list = sorted(x_list)
a = []
for i in range(n):
    b = x_list[i+1]-x_list[i]
    a.append(b)
gcd = functools.reduce(math.gcd,a)
print(gcd)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
x_list = list(map(int,input().split()))
x_list.append(x)
x_list = sorted(x_list)
a = []
for i in range(n):
    a.append(x_list[i+1]-x_list[i])
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)
print(gcd_list(a))
Problem p03289 (python)

Fixed submission:
s = str(input())
s_list = list(s)
ans_1 = 'no'
ans_2 = 'no'
ans_3 = 'ok'
check = 'no'
s_list_len = len(s_list)
if s_list[0] == 'A':
    ans_1 = 'ok'
count = 0
for i,j in enumerate(s_list[2:s_list_len-1]):
    if j == 'C':
        count += 1
        if check == 'no':
            s_list.pop(2+i)
        check = 'yes'
if count == 1:
    ans_2 = 'ok'
for i in s_list[1:]:
    if not i.islower():
        ans_3 = 'no'
if (ans_1 == 'ok') and (ans_2 == 'ok') and (ans_3 == 'ok'):
    print('AC')
else:
    print('WA')

Buggy submission (verdict: Runtime Error):
s = str(input())
s_list = list(s)
ans_1 = 'no'
ans_2 = 'no'
s_list_len = len(s_list)
if s_list[0] == 'A':
    ans_1 = 'ok'
count = 0
for i,j in enumerate(s_list[2:s_list_len-1]):
    if j == 'C':
        s_list.pop(2+i)
        count += 1
if count == 1:
    ans_2 = 'ok'
ans_3 = 'ok'
for i in s_list[1:]:
    if not i.islower():
        ans_3 = 'no'
if (ans_1 == 'ok') and (ans_2 == 'ok') and (ans_3 == 'ok'):
    print('AC')
else:
    print('WA')
Problem p03323 (python)

Fixed submission:
a,b = map(int,input().split())
if a <= 8 and b <= 8:
    print('Yay!')
else:
    print(':(')

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
if a <= 8 and b <= 8:
    print('Yay!')
else:
    print(':(')
Problem p03325 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]

count = 0
check = True
while check:
    a = sorted(list(filter(lambda x : (x % 2) == 0, a)), reverse=True)
    if a == []:
        check = False
    else:
        a[0] = int(a[0] / 2)
        for i in range(1,len(a)):
            a[i] *= 3
        count += 1
print(count)
Problem p03361 (python)

Fixed submission:
H, W = map(int, input().split())
Sij = []
for _ in range(H):
    Sij.append(input())
result = []
for a in range(H):
    for b in range(W):
        check = []    
        if Sij[a][b] == '#':
            if a-1 >= 0:
                H_up = a - 1
                S_H_up = Sij[H_up][b]
                check.append(S_H_up)
            if a+1 <= H-1:
                H_down = a + 1
                S_H_down = Sij[H_down][b]
                check.append(S_H_down)
            if b-1 >= 0:
                W_right = b - 1
                S_W_right = Sij[a][W_right]
                check.append(S_W_right)
            if b+1 <= W-1: 
                W_left = b + 1
                S_W_left = Sij[a][W_left]
                check.append(S_W_left)
            if '#' in check:
                result.append('good')
            else:
                result.append('bad')
                
if 'bad' in result:
    print('No')
else:
    print('Yes')

Buggy submission (verdict: Runtime Error):
h,w = map(int, input().split())
s = []
for i in range(w):
    s.append(str(input()))
    
flag = True
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            check = False
            if i+1 < h:
                if s[i+1][j] == '#':
                    check = True
            if j+1 < w:
                if s[i][j+1] == '#':
                    check = True
            if i-1 >= 0:
                if s[i-1][j] == '#':
                    check = True
            if j-1 >= 0:
                if s[i][j-1] == '#':
                    check = True
            if check == False:
                flag = False
if flag:
    print('Yes')
else:
    print('No')
Problem p03379 (python)

Fixed submission:
n = int(input())
xm = list(map(int, input().split()))
xm_sort = sorted(xm)
a = n//2-1
for i in range(n):
    if xm[i]<=xm_sort[a]:
        print(xm_sort[a+1])
    else:
        print(xm_sort[a])

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [int(i) for i in input().split()]



a = statistics.median(sorted(x)[0:len(x)-1])
b = statistics.median(sorted(x)[1:len(x)])
for i in x:
    if i > a:
        print(a)
    else:
        print(b)

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [int(i) for i in input().split()]

for i in x:
    if i > statistics.median(sorted(x)[0:len(x)-1]):
        print(statistics.median(sorted(x)[0:len(x)-1]))
    else:
        print(statistics.median(sorted(x)[1:len(x)]))
Problem p03380 (python)

Fixed submission:
# -*- coding: utf-8 -*-
# kakomon toku
import math
import sys
import itertools
import numpy as np
 
n = int(input())
a = [int(i) for i in input().split()]
 
#print(a)
a = np.sort(a)
ai = a[n-1]
aj = a[0]
center = ai / 2
diff = ai
i=0
for m in a:
    if diff > abs(m - center) :
        aj = m
        diff = abs(aj - center)
    else:
        break
 
print(ai,aj)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]

a = sorted(a)

import numpy as np
def getNearestValue(list, num):
    idx = np.abs(np.asarray(list) - num).argmin()
    return list[idx]
  
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under
  
ans = 0
for i in range(1,n):
    tmp0 = a[i] / 2
    tmp1 = getNearestValue(a[0:i], check)
    tmp2 = cmb(a[i], tmp1)
    if tmp2 > ans:
        ans = tmp2
        ans1 = a[i]
        ans2 = tmp1
print(ans1, ans2)
Problem p03386 (python)

Fixed submission:
a, b, k = map(int, input().split())
if b - a + 1 <= 2 * k:
    result = ([i for i in range(a, b + 1)])
else:
    result = ([i for i in range(a, a + k)] + [i for i in range(b - k + 1, b + 1)])
for i in result:
    print(i)

Buggy submission (verdict: Runtime Error):
a,b,k = map(int, input().split())
x = list(range(a,b+1))
y = x[0:k]
z = x[len(x)-k:len(x)]
a = []
for i in range(len(y)):
    a.append(y[i])
for i in range(len(z)):
    a.append(z[i])
a_uniq = []
for i in a:
    if i not in a_uniq:
        a_uniq.append(i)
for i in range(len(a_uniq)):
    print(a_uniq[i])

Buggy submission (verdict: Runtime Error):
a,b,k = map(int, input().split())
x = list(range(a,b+1))
y = x[0:k]
z = x[len(x)-k:len(x)]
a = []
for i in range(len(y)):
    a.append(y[i])
for i in range(len(z)):
    a.append(z[i])
a_uniq = []
for i in a:
    if i not in a_uniq:
        a_uniq.append(i)
for i in range(len(a_uniq)):
    print(a_uniq[i])

Buggy submission (verdict: Runtime Error):
a,b,k = map(int, input().split())
x = list(range(a,b+1))
y = x[0:k]
z = x[len(x)-k:len(x)]
a = []
for i in range(len(y)):
    a.append(y[i])
for i in range(len(z)):
    a.append(z[i])
a_uniq = []
for i in a:
    if i not in a_uniq:
        a_uniq.append(i)
for i in range(len(a_uniq)):
    print(a_uniq[i])
Problem p03399 (python)

Fixed submission:
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = min([a,b]) + min([c,d])
print(e)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
e = min([a,b])
f = min([c,d])
print(e+f)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
e = min([a,b])
f = min([c,d])
print(e+f)
Problem p03487 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()] 
count = {}
ans = 0
for i in a:
    if i not in count:
        count[i] = 1
    else:
        count[i] += 1
for i,c in count.items():
    if i > c:
        ans += c
    elif i < c:
        ans += c - i
print(ans)

Buggy submission (verdict: Runtime Error):
    n = int(input())
    a = [int(i) for i in input().split()] 
    count = {}
    ans = 0
    for i in a:
        if i not in count:
            count[i] = 1
        else:
            count[i] += 1
    for i,c in count.items():
        if i > c:
            ans += c
        elif i < c:
            ans += c - i
    print(ans)