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

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
dic = {0:1}
sum_n = 0
count = 0


for a in A:
    sum_n += a
    if sum_n in dic:
        count += dic[sum_n]
        dic[sum_n] += 1
    else:
        dic[sum_n] = 1


print(count)

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

count = A.count(0)
A = [n for n in A if n != 0]

for i in range(N):
    num = A[i]
    for Aj in A[i+1:]:
        num += Aj
        if num == 0:
            count += 1

print(count)
Problem p03380 (python)

Fixed submission:
n = input()
a = sorted(int(x) for x in input().split())
max_a = a[-1]
print(max_a, min(a, key=lambda x: abs(max_a - x * 2)))

Buggy submission (verdict: Runtime Error):
import itertools


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

if n == 2:
    print(max(a), min(a))
else:
    a = list(set(a))
    num = 0
    for x in itertools.combinations(a, 2):
        if num < len(list(itertools.combinations(range(max(x)), min(x)))):
            num = len(list(itertools.combinations(range(max(x)), min(x))))
            x1 = max(x)
            x2 = min(x)
    print(x1, x2)
Problem p03425 (python)

Fixed submission:
import itertools

n = int(raw_input())
li = list()
for m in range(0,n):
    li.append(raw_input())

m = len(filter(lambda x: x[0]=="M" ,li))
a = len(filter(lambda x: x[0]=="A" ,li))
r = len(filter(lambda x: x[0]=="R" ,li))
c = len(filter(lambda x: x[0]=="C" ,li))
h = len(filter(lambda x: x[0]=="H" ,li))

con = [m, a, r, c, h]
print sum(map(lambda x: x[0]*x[1]*x[2] , list(itertools.combinations(con, 3))))

Buggy submission (verdict: Runtime Error):
s = ["M", "A", "R", "C", "H"]
n = int(raw_input())
li = list()
for m in range(0,n):
    li.append(raw_input())
re = list()

for st1 in li:
    temp = list()
    if st1[0] in s:
        temp.append(st1)

    for st2 in li:
        if st2[0] in s and len(filter(lambda e:e[0]==st2[0], temp)) == 0:
            temp.append(st2)
        for st3 in li:
            if st3[0] in s and len(filter(lambda e:e[0]==st3[0], temp)) == 0:
                temp.append(st3)
                if sorted(temp) not in re and len(temp) == 3:
                    re.append(sorted(temp))
                    temp.pop()
        temp = [temp[0]]
print re
print len(re)
Problem p03355 (python)

Fixed submission:
import numpy as np

s = input()
K = int(input())
L = len(s)

candidate = []

for l in range(1, K + 1):
    for j in range(0, L - l + 1):
        candidate.append(s[j:j+l])

candidate = list(set(candidate))
print(np.sort(candidate)[K-1])

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

s = input()
K = int(input())
L = len(s)

candidate = []

for l in range(1, K + 1):
    for j in range(0, L - l):
        candidate.append(s[j:j+l])

print(np.sort(candidate)[K-1])
Problem p03853 (python)

Fixed submission:
(height, weight) = tuple(input().split(' '))

for hindex in range(int(height)):
    x = input()
    print(x)
    print(x)

Buggy submission (verdict: Runtime Error):
height = int(input())
width = int(input())

for hindex in range(height):
    x = input()
    print(x)
    print(x)
Problem p03355 (python)

Fixed submission:
string = input()
k = int(input())
if len(string) > k:
    substrs = set()
    ls = sorted(list(string))
    for i in range(k):
        for s, c in enumerate(string):
            if c == ls[i]:
                for l in range(1, k+1):
                    substrs.add(string[s:s+l])
    substrs = list(substrs)
    substrs.sort()
    print(substrs[k-1])

else:
    substrs = set()
    for leng in range(1, len(string) + 1):
        for s in range(0, len(string) - leng + 1):
            substrs.add(string[s:s+leng])
    substrs = list(substrs)
    substrs.sort()
    print(substrs[k-1])

Buggy submission (verdict: Runtime Error):
string = input()
k = int(input())
if len(string) > k:
    substrs = set()
    ls = sorted(list(string))
    for i in range(3):
        for s, c in enumerate(string):
            if c == ls[i]:
                for l in range(1, k+1):
                    substrs.add(string[s:s+l])
    substrs = list(substrs)
    substrs.sort()
    print(substrs[k-1])

else:
    substrs = set()
    for leng in range(1, len(string) + 1):
        for s in range(0, len(string) - leng + 1):
            substrs.add(string[s:s+leng])
    substrs = list(substrs)
    substrs.sort()
    print(substrs[k-1])

Buggy submission (verdict: Runtime Error):
string = input()
k = int(input())
if len(string) >= k:
    substrs = set()
    ls = sorted(list(string))
    for i in range(k):
        for s, c in enumerate(string):
            if c == ls[i]:
                for l in range(1, k+1):
                    substrs.add(string[s:s+l])
    substrs = list(substrs)
    substrs.sort()
    print(substrs[k-1])

else:
    substrs = set()
    for leng in range(1, len(string)):
        for s in range(0, len(string) - leng):
            substrs.add(string[s:s+leng])
    substrs = list(substrs)
    substrs.sort()
    print(substrs[k-1])

Buggy submission (verdict: Runtime Error):
string = input()
k = int(input())
if len(string) >= k:
    substrs = set()
    ls = sorted(list(string))
    for i in range(5):
        for s, c in enumerate(string):
            if c == ls[i]:
                for l in range(1, 5+1):
                    substrs.add(string[s:s+l])
    substrs = list(substrs)
    substrs.sort()
    print(substrs[k-1])

else:
    substrs = set()
    for leng in range(1, len(string)):
        for s in range(0, len(string) - leng):
            substrs.add(string[s:s+leng])
    substrs = list(substrs)
    substrs.sort()
    print(substrs[k-1])
Problem p03958 (python)

Fixed submission:
input = raw_input().split(' ')
K = int(input[0])
T = int(input[1])
input = raw_input().split(' ')
max_num = 0
sum_num = 0
for i in range(0, T):
  temp = int(input[i])
  if max_num < temp:
    max_num = temp
  sum_num += temp

if max_num <= sum_num - max_num + 1:
  print "0"
else:
  print max_num - (sum_num - max_num) - 1

Buggy submission (verdict: Runtime Error):
input = raw_input().split(' ')
K = int(input[0])
T = int(input[1])
input = raw_input().split(' ')
max_num = 0
sum_num = 0
for i in range(0, T):
  temp = int(input[i])
  if max_num < temp:
    max_num = temp
  sum_num += temp

if max_num <= sum_num - max_num + 1:
  print "0"
else:
  print max_num - (sum_num - max_num) - 1
Problem p03359 (python)

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

if a <= b:
    print(a)
else:
    print(a-1)

Buggy submission (verdict: Runtime Error):
N=int(input())
list=[str(i) for i in [11, 31, 41, 61, 71, 101, 131, 151, 181, 191, 211, 241, 251, 271, 281, 311, 331, 401, 421, 431, 461, 491, 521, 541, 571, 601, 631, 641, 661, 691, 701, 751, 761, 811, 821, 881, 911, 941, 971, 991, 1021, 1031, 1051, 1061, 1091, 1151, 1171, 1181, 1201, 1231, 1291, 1301, 1321, 1361, 1381]]
print(" ".join(list[:N]))

Buggy submission (verdict: Runtime Error):
h,w = map(int, input().split())
# print(h,w)
row = []
for x in range(h):
    col = list(input())
    row.append(col)

out = "YES"

for x in range(h):
    for y in range (w):
        if row[x][y] == "#":
           #print(x,y)
            if  x > 0 and row[x-1][y] == "#":
                pass
            elif x < h-1 and row[x+1][y] == "#":
                pass
            elif y > 0 and row[x][y-1] == "#" :
                pass
            elif y < w-1  and row [x][y+1] == "#" :
                pass
            else:
                out = "NO"
                break
        pass

print(out)
Problem p03359 (python)

Fixed submission:
list = raw_input().split()
if list[0] <= list[1]:
  print list[0]
else:
  print int(list[0]) - 1

Buggy submission (verdict: Runtime Error):
list = raw_input().split()
if list[0] <= list[1]:
  print list[0]
else:
  print list[0] - 1
Problem p03359 (python)

Fixed submission:
a, b = map(int, input().split())
if a <= b:
    nums = a
else:
    nums = a - 1
print(nums)

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


def is_prime(n):
    for i in range(1, n):
        if i != 1 and n % i == 0:
            return False
    return True


def prime_numbers():
    num = 5
    while True:
        is_num_prime = is_prime(num)
        if is_num_prime and num % 5 == 1:
            yield num
        num += 1


prime_gene = prime_numbers()
ans = [next(prime_gene) for _ in range(N)]
print(*ans)

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


def is_prime(n):
    for i in range(1, n):
        if i != 1 and n % i == 0:
            return False
    return True


def prime_numbers():
    num = 5
    while True:
        is_num_prime = is_prime(num)
        if is_num_prime:
            yield num
        num += 1


prime_gene = prime_numbers()
ans = []

while len(ans) < N:
    prime = next(prime_gene)
    if prime % 5 == 1:
        ans.append(prime)
print(ans)

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


def is_prime(n):
    for i in range(1, n):
        if i != 1 and n % i == 0:
            return False
    return True


def prime_numbers():
    num = 2
    while True:
        is_num_prime = is_prime(num)
        if is_num_prime:
            yield num
        num += 1


prime_gene = prime_numbers()
ans = []

while len(ans) < 5:
    prime = next(prime_gene)
    if prime % 5 == 1:
        ans.append(prime)
print(ans)
Problem p03362 (python)

Fixed submission:
N = int(input())


def is_prime(n):
    for i in range(1, n):
        if i != 1 and n % i == 0:
            return False
    return True


def prime_numbers():
    num = 5
    while True:
        is_num_prime = is_prime(num)
        if is_num_prime and num % 5 == 1:
            yield num
        num += 1


prime_gene = prime_numbers()
ans = [next(prime_gene) for _ in range(N)]
print(*ans)

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


def is_prime(n):
    for i in range(1, n):
        if i != 1 and n % i == 0:
            return False
    return True


def prime_numbers():
    num = 2
    while True:
        is_num_prime = is_prime(num)
        if is_num_prime:
            yield num
        num += 1


prime_gene = prime_numbers()
ans = []

while len(ans) < 5:
    prime = next(prime_gene)
    if prime_gene % 5 == 1:
        ans.append(prime)
print(ans)
Problem p03359 (python)

Fixed submission:
a, b = map(int, input().split())
th = a-1
if b>=a:
    th+=1
print(th)

Buggy submission (verdict: Runtime Error):
h, w = map(int, input().split())
S = []
flag = True
for i in range(h):
    r = list(input())
    S.append(r)
for i in range(0,h-1):
    for j in range(0,w-1):
        if S[i][j]=='#' and S[i-1][j]=='.' and S[i][j-1]=='.' and S[i+1][j]=='.' and S[i][j+1]=='.':
            flag = False
if flag:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
k = int(input())
m = max(a,b,c)
output = m*2**k+a+b+c-m
print(output)

Buggy submission (verdict: Runtime Error):
a, b, c = map(int, input().split())
k = int(input())
maxnum = max(a,b,c)
output = maxnum*2**k+a+b+c-maxnum
print(output)

Buggy submission (verdict: Runtime Error):
a, b = map(int, input())
th = a-1
if a<b:
    print(th)
else:
    print(th+1)
Problem p03361 (python)

Fixed submission:
HW = input().split()

H = int(HW[0])
W = int(HW[1])

tmp1 = ("." * W) + ".."
s = [list(tmp1)]
for i in range(H):
    tmp2 = "." + input() + "."
    s.append(list(tmp2))
s.append(list(tmp1))

checker = 1
for i in range(1, H+1):
    for j in range(1, W+1):
        if s[i][j] == "#":
            if s[i][j-1] == "." and s[i-1][j] == "." and s[i][j+1] == "." and s[i+1][j] == ".":
                checker = 0
                break
    if checker == 0:
        break

if checker == 0:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
HW = input().split()

H = int(HW[0])
W = int(HW[1])

tmp1 = ("." * W) + ".."
s = [list(tmp1)]
for i in range(H):
    tmp2 = "." + input() + "."
    s.append(list(tmp2))
s.append(list(tmp1))

checker = 1
for i in range(1, H+1):
    for j in range(1, W+1):
        if s[i, j] == "#":
            if s[i, j-1] == "." and s[i-1, j] == "." and s[i, j+1] == "." and s[i+1, j] == ".":
                checker == 0

if checker == 0:
    print("No")
else:
    print("Yes")
Problem p03437 (python)

Fixed submission:
# -*- coding: utf-8 -*-

X, Y = map(int, input().split())

max_num = 10**18 // X


if X % Y == 0:
    print(-1)
else:
    for i in range(max_num + 1):
        if i == 0:
            continue
        else:
            if (i * X) % Y != 0:
                print(i * X)
                break
            else:
                continue

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-

X, Y = map(int, input().split())

for i in range(10**18 + 1):
    if i == 0:
        continue
    elif i == 10**18 + 1:
        print(-1)
    else:
        if i % X == 0 && i % Y != 0:
            print(i)
            break
        else:
            continue
Problem p03701 (python)

Fixed submission:
# -*- coding:utf-8 -*-

N = int(input())
s = [int(input()) for i in range(N)]
s.sort()

sum = 0
for i in range(N):
	sum = sum + s[i]

check = 0
if sum % 10 != 0:
	print(sum)
else:
	for i in range(N):
		if s[i] % 10 != 0:
			print(sum - s[i])
			break
		else:
			check = check + 1

if check == N:
	print(0)

Buggy submission (verdict: Runtime Error):
# -*- coding:utf-8 -*-

l = input().split()
N = int(l[0])
A = int(l[1])
B = int(l[2])

HP = [int(input()) for i in range(N)]


count = 0
check = 0
while(True):
	HP.sort()
	print(HP)

	for i in range(N):
		if i == N-1:
			HP[i] = HP[i] - A
			count = count + 1
		else:
			HP[i] = HP[i] - B

	for i in range(N):
		if HP[N-1] < 0 and HP[N-2] < 0:
			check = 1

	if check == 1:
		break

print("Count: " + str(count))
Problem p03359 (python)

Fixed submission:
a, b = map(int, input().split())
if a <= b:
  print(a)
else:
  print(a-1)

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

for m in range(1, a+1):5 5
  for d in range(1, b+1):
    if (m-d == 0):
      count += 1

print(count)
Problem p04044 (python)

Fixed submission:
import heapq
N, L = map(int, raw_input().split())
hq = []
for _ in xrange(N):
    s = raw_input()
    heapq.heappush(hq, s)
ans = ''
while len(hq) > 0:
    ans += heapq.heappop(hq)
print ans

Buggy submission (verdict: Runtime Error):
import heapq
N, L = map(int, raw_input().split())
hq = []
for _ in xrange(N:
    s = raw_input()
    heapq.heappush(hq, s)
ans = ''
while len(hq) > 0:
    ans += heapq.heappop(hq)
print ans
Problem p04045 (python)

Fixed submission:
N, K = raw_input().split()
D = raw_input().split()
candi = [str(i) for i in xrange(10)]
for d in D:
    candi.remove(d)

def decide(i):
    if i >= len(N):
        return ''
    for c in candi:
        if N[i] == c:
            return c + decide(i+1)
        elif N[i] < c:
            return c + candi[0] * (len(N) - i - 1)

if candi[-1] * len(N) >= N:
    print decide(0)
else:
    print (candi[0] if candi[0] != '0' else candi[1]) + candi[0] * len(N)

Buggy submission (verdict: Runtime Error):
N, K = raw_input().split()
D = raw_input().split()
candi = [str(i) for i in xrange(10)]
for d in D:
    candi.remove(d)

def decide(i):
    if i >= len(N):
        return ''
    for c in candi:
        if N[i] == c:
            return c + decide(i+1)
        elif N[i] < c:
            return c + candi[0] * (len(N) - i - 1)
    else:
        return (candi[0] if candi[0] != 0 else candi[1]) + decide(i)

print decide(0)
Problem p03359 (python)

Fixed submission:
a, b = input().split()
a = int(a)
b = int(b)
if a <= b:
  print(a)
else:
  print(a-1)

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

k = input()
k = int(k)

print(max(a * 2 * k + b + c, a + b * 2 * k + c, a + b + c * 2 * k))
Problem p03360 (python)

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

k = input()
k = int(k)

print(max(a * 2 ** k + b + c, a + b * 2 ** k + c, a + b + c * 2 ** k))

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

k = input()
k = int(k)

ans = 0

if max(a,b,c) = a:
  ans = ans + b + c
elif max(a, b, c) == b:
  ans = ans + a + c
elif max(a, b, c) == c:
  ans = ans + a + b

print(ans + max(a, b, c) * 2 * k)
Problem p03419 (python)

Fixed submission:
N,M = map(int, input().split())
if M==1 and N==1:
    print(1)
elif M==1:
    print(N-2)
elif N==1:
    print(M-2)
else:
    print((N-2)*(M-2))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
    if M==1 and N==1:
        print(1)
    elif M==1:
        print(N-2)
    elif N==1:
        print(M-2)
    else:
        print((N-2)*(M-2))

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
if M==1 and N==1:
    return 1
elif M==1:
    return N-2
elif N==1:
    return M-2
else:
    return (N-2)*(M-2)

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
    if M==1 and N==1:
        return 1
    elif M==1:
        return N-2
    elif N==1:
        return M-2
    else:
        return (N-2)*(M-2)

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
    if M==1 and N==1:
        return 1
    elif M==1:
        return N-2
    elif N==1:
        return M-2
    else:
        return (N-2)*(M-2)
Problem p03420 (python)

Fixed submission:
import sys

N,K = map(int, input().split())
res = 0
if K==0:
    print(N*N)
    sys.exit(0)
for i in range(N):
    i += 1
    if i-K<=0:
        continue
    amari = N % i
    amari = amari - K + 1
    re = N // i
    if amari <= 0:
        amari = 0
    res += re*(i-K) + amari
print(res)

Buggy submission (verdict: Runtime Error):
import sys

N,K = map(int, input().split())
res = 0
if K==0:
    print(N*N)
    sys.exit(0)
for i in range(N):
    i += 1
    if i-K<=0:
        continue
    amari = N % i
    amari = amari - K + 1
    re = N // i
    if amari <= 0:
        amari = 0
    res += re*(i-K) + amari
 print(res)

Buggy submission (verdict: Runtime Error):
import sys

N,K = map(int, input().split())
res = 0
if K==0:
    print(N*N)
    sys.exit(0)
for i in range(N):
    i += 1
    if i-K<=0:
        continue
    amari = N % i
    amari = amari - K + 1
    re = N//i
    if amari<=0:
        amari = 0
    res += re*(i-K) + amari
 print(res)

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
res = 0
if K==0:
    print(N*N)
    return
for i in range(N):
    i += 1
    if i-K<=0:
        continue
    amari = N % i
    amari = amari - K + 1
    re = N//i
    if amari<=0:
        amari = 0
    res += re*(i-K) + amari
 print(res)
Problem p03671 (python)

Fixed submission:
a = [int(x) for x in input().split()]
s = 0
if a[0] <= a[1]:
    s = a[0]
    if a[1] <= a[2]:
        s += a[1]
    else:
        s += a[2]
else:
    s = a[1]
    if a[0] <= a[2]:
        s += a[0]
    else:
        s += a[2]
print(s)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
s = 0
if a <= b:
    s = a
    if b <= c:
        s += b
    else:
        s += c
else:
    s = b
    if a <= c:
        s += a
    else:
        s += b
print(s)

Buggy submission (verdict: Runtime Error):
def main():
    a = int(input())
    b = int(input())
    c = int(input())
    s = 0
    if a <= b:
        s = a
        if b <= c:
            s += b
        else:
            s += c
    else:
        s = b
        if a <= c:
            s += a
        else:
            s += b
    print(s)

if __name__ == "__main__":
    main()
Problem p03377 (python)

Fixed submission:
ipt = [int(i) for i in input().split()]
a = ipt[0]
b = ipt[1]
x = ipt[2]

if a <= x and x <= a+b:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
n = int(input())
x = [int(i) for i in input().split()]
for i in range(n):
    tmp = list(x)
    tmp[i] *= -1
    tmp.sort()
    median = int(n/2)
    print(tmp[median])

Buggy submission (verdict: Runtime Error):
ipt1 = [int(i) for i in input().split()]
a = [int(i) for i  in input().split()]
n = ipt1[0]
m = ipt1[1]
x = ipt1[2]
cost_0 = 0
cost_n = 0
for i in range(m):
    if a[i] < x:
        cost_0 += 1
    else:
        cost_n += 1

print(int(min(cost_0, cost_n)))

Buggy submission (verdict: Runtime Error):
ipt1 = [int(i) for i in input().split()]
a = [int(i) for i  in input().split()]
n = ipt1[0]
m = ipt1[1]
x = ipt1[2]
cost_0 = 0
cost_n = 0
for i in range(m):
    if a[i] < x:
        cost_0 += 1
    else:
        cost_n += 1

print(min(cost_0, cost_n))
Problem p03578 (python)

Fixed submission:
n = int(input())
D = sorted([int(_) for _ in input().split()])
m = int(input())
T = sorted([int(_) for _ in input().split()])

i = 0
for t in T:
	while(D[i] < t):
		i += 1
	if D[i] == t:
		i += 1
	else:
		print("NO")
		exit(0)
print("YES")

Buggy submission (verdict: Runtime Error):
n = int(input())
D = ([int(_) for _ in input().split()])
m = int(input())
T = ([int(_) for _ in input().split()])

d_cnt = [0 for _ in range(200000)]
t_cnt = [0 for _ in range(200000)]

for d in D:
	d_cnt[d] += 1

for t in T:
	t_cnt[t] += 1

for i in range(len(t_cnt)):
	if t_cnt[i] > d_cnt[i]:
		print("NO")
		exit(0)
print("YES")
Problem p03679 (python)

Fixed submission:
x, a, b = (int(i) for i in input().split())

if b-a>x:
    print('dangerous')
elif b-a>0:
    print('safe')
else:
    print('delicious')

Buggy submission (verdict: Runtime Error):
x, a, b = (int(i) for i in input().split())

if x+a-b > 1:
  print('delicious')
else if x+a-b == 0:
    print('safe')
else:
    print('dangerous')
Problem p03694 (python)

Fixed submission:
N = int(input())

a = [int(n) for n in input().split()]
a = sorted(a)
print(a[N-1] - a[0])

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

a = [int(n) for n in input().split()].sort()

print(a[N-1] - a[0])
Problem p03695 (python)

Fixed submission:
N = int(input())
a = [int(n) for n in input().split()]

colors = [0,0,0,0,0,0,0,0]
free = 0

for i in a:
    if i < 400:
        colors[0] = 1
    elif i < 800:
        colors[1] = 1
    elif i < 1200:
        colors[2] = 1
    elif i < 1600:
        colors[3] = 1
    elif i < 2000:
        colors[4] = 1
    elif i < 2400:
        colors[5] = 1
    elif i < 2800:
        colors[6] = 1
    elif i < 3200:
        colors[7] = 1
    else:
        free += 1

s = sum(colors)

print(str(max(s, 1)) + " " + str(s + free))

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

colors = [0,0,0,0,0,0,0,0]
free = 0

for i in a:
    if i < 400:
        colors[0] = 1
    elif i < 800:
        colors[1] = 1
    elif i < 1200:
        colors[2] = 1
    elif i < 1600:
        colors[3] = 1
    elif i < 2000:
        colors[4] = 1
    elif i < 2400:
        colors[5] = 1
    elif i < 2800:
        colors[6] = 1
    elif i < 3200:
        colors[7] = 1
    else:
        free += 1

print(str(sum(colors)) + " " + str(min(sum(colors) + free, 8)))
N = int(input())
a = [int(n) for n in input().split()]
a = sorted(a)

colors = [0,0,0,0,0,0,0,0]
free = 0

for i in a:
    if i < 400:
        colors[0] = 1
    elif i < 800:
        colors[1] = 1
    elif i < 1200:
        colors[2] = 1
    elif i < 1600:
        colors[3] = 1
    elif i < 2000:
        colors[4] = 1
    elif i < 2400:
        colors[5] = 1
    elif i < 2800:
        colors[6] = 1
    elif i < 3200:
        colors[7] = 1
    else:
        free += 1

print(str(sum(colors)) + " " + str(min(sum(colors) + free, 8)))
Problem p03700 (python)

Fixed submission:
import math

def calc(H, T, a, b):
    cnt = 0
    for h in H:
        if (h -b*T) >= 0:
            cnt += math.ceil((h - b * T) / (a - b))
    if cnt <= T:
        return True
    else:
        return False

tmp = [int(n) for n in input().split()]
a = tmp[1]
b = tmp[2]
H = []

H = sorted([int(input()) for i in range(tmp[0])])[::-1]
minT = 0
maxT = math.ceil(H[0] / b)
T = int((maxT + minT) / 2)

while True:
    T = math.ceil((maxT + minT) / 2)
    if calc(H, T, a, b):
        maxT = T
    else:
        minT = T
    if maxT - minT <= 1:
        break
print(maxT)

Buggy submission (verdict: Runtime Error):
I'm Yata Ryuichi.