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

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

if 0 in A:
    print(0)
    exit(0)
    
ans = 1 
for i in A:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit(0)
        
print(ans)

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

if 0 in A:
    print(0)
    exit(0)
ans = 1 
for i in range A:
    ans *= i
    if ans >= 10**18:
        print(-1)
        exit(0)
        
print(ans)
Problem p03493 (python)

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

Buggy submission (verdict: Runtime Error):
s = input()
ans = 0
if s=1:
    ans += "1"
print(ans)
Problem p02724 (python)

Fixed submission:
N = int(input())
if N >= 500:
    t = N//500
    a = N%500
    if a >= 5:
        f = a//5
        print(1000*t+f*5)
    else:
        print(1000*t)
elif N >= 5:
    f = N//5
    print(f*5)
else:
    print("0")

Buggy submission (verdict: Runtime Error):
N = int(input())
if N >= 500:
    t = N//500
    a = N%500
    if a >= 5:
        f = a//5
        print(1000*t+f*5)
    else:
        print(1000*t)
elif N >= 5:
    f = a//5
    print(1000*t+f*5)
else:
    print("0")

Buggy submission (verdict: Runtime Error):
N = int(input())
if N >= 500:
    t = N//500
    a = N%500
    if a >= 5:
        f = a//5
        print(1000*t+f*5)
    else:
        print(1000*t)
elif N >= 5:
    f = a//5
    print(1000*t+f*5)
else:
    print("0")
Problem p02727 (python)

Fixed submission:
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
tmp = 0
p.sort(reverse=True)
p.append(0)
q.sort(reverse=True)
q.append(0)
r.sort(reverse=True)
r.append(0)
z = X+Y
e, f, g = 0, 0, 0
for i in range(z):
    if X>0 and ((p[e]>=q[f] and p[e]>=r[g]) or (Y==0 and p[e]>=r[g])):
        tmp = tmp+p[e]
        e += 1
        X -= 1
    elif Y>0 and ((q[f]>=p[e] and q[f]>=r[g]) or (X==0 and q[f]>=r[g])):
        tmp = tmp+q[f]
        f += 1
        Y -= 1
    elif r[g]>p[e] or r[g]>q[f]:
        tmp = tmp+r[g]
        g += 1
        
print(tmp)

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
tmp = 0
p.sort(reverse=True)
p.append(0)
q.sort(reverse=True)
q.append(0)
r.sort(reverse=True)
r.append(0)
z = X+Y
e, f, g = 0, 0, 0
for i in range(z):
    if X>0 and ((p[e]>=q[f] and p[e]>=r[f]) or (Y==0 and p[e]>=r[g])):
        tmp = tmp+p[e]
        e += 1
        X -= 1
    elif Y>0 and ((q[f]>=p[e] and q[f]>=r[g]) or (X==0 and q[f]>=r[g])):
        tmp = tmp+q[f]
        f += 1
        Y -= 1
    elif r[g]>p[e] or r[g]>q[f]:
        tmp = tmp+r[g]
        g += 1
        
print(tmp)

Buggy submission (verdict: Runtime Error):
X, Y, A, B, C = map(int, input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))
tmp = 0
p.sort(reverse=True)
p.append(0)
q.sort(reverse=True)
q.append(0)
r.sort(reverse=True)
r.append(0)
z = X+Y
for i in range(z):
    if X>0 and ((p[0]>=q[0] and p[0]>=r[0]) or (Y==0 and p[0]>=r[0])):
        tmp = tmp+p[0]
        p.pop(0)
        X -= 1
    elif Y>0 and ((q[0]>=p[0] and q[0]>=r[0]) or (X==0 and q[0]>=r[0])):
        tmp = tmp+q[0]
        q.pop(0)
        Y -= 1
    elif r[0]>p[0] and r[0]>q[0]:
        tmp = tmp+r[0]
        r.pop(0)
    else:
        p = 100/0
        
print(tmp)
Problem p02923 (python)

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

cmax = 0
count = 0
for i in range(N-1):
    if dst[i] >= dst[i+1]:
        count += 1
        if count > cmax:
            cmax = count
    else:
        count = 0
        
print(cmax)

Buggy submission (verdict: Runtime Error):
N=int(input())
dst = []
dst.append(input().split())

max_ = 0
for i in range(N-1):
    if dst[0][i] >= dst[0][i+1]:
        count += 1
        if count > max_:
            max_ = count
    else:
        count = 0
print(max_)

Buggy submission (verdict: Runtime Error):
N=int(input())
dst = []
dst.append(input().split())

max_ = 0
for i in range(N-2):
    if dst[0][i] >= dst[0][i+1]:
        count += 1
        if count > max_:
            max_ = count
    else:
        count = 0
print(max_)
Problem p03455 (python)

Fixed submission:
a,b=map(int, input().split())
if a*b%2==0:
  print("Even")
else:
  print("Odd")

Buggy submission (verdict: Runtime Error):
a,b=input().split()
if a*b%2==0:
  print("Even")
else:
  print("Odd")

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

if a*b%2==0:
  print("Even")
else:
  print("Odd")
Problem p03457 (python)

Fixed submission:
N=int(input())
dst = [[0, 0, 0]]
for i in range(N):
    dst.append(input().split())
    
flag = True

for i in range(1, N+1):
    time_diff = int(dst[i][0])-int(dst[i-1][0])
    dst_diff = abs(int(dst[i][1])-int(dst[i-1][1]))+abs(int(dst[i][2])-int(dst[i-1][2]))
    if (time_diff>=dst_diff and (time_diff+2)%2 == (dst_diff+2)%2):
        flg = True
    else:
        flg = False
        break

if flg == True:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
N=int(input())
dst = [[0, 0, 0]]
for i in range(N):
    dst.append(input().split())
    
flag = True

for i in range(1, N+1):
    time_diff = int(dst[i][0])-int(dst[i-1][0])
    dst_diff = int(dst[i][1])-int(dst[i-1][1])+int(dst[i][2])-int(dst[i-1][2])
    if (time_diff>=dst_diff and time_diff%2 == dst_diff%2):
        continue
    else:
        flg = False
        break

if flg == True:
    print('Yes')
else:
    print('No')
Problem p02818 (python)

Fixed submission:
Taka, Aoki, K = map(int, input().split())
dif = Taka - K
if dif >= 0:
    Taka -= K
else:
    dif = abs(dif)
    Taka = 0
    dif = Aoki - dif
    if dif >= 0:
        Aoki = dif
    else:
        Aoki = 0
print(Taka, Aoki)

Buggy submission (verdict: Runtime Error):
ta, ao, K = map(int, input().split())
if K - ta > 0:
    taa = 0
    if ao - (K - ta) > 0:
        ao = ao - (K - ta)
    else:
        ao = 0
else:
    ta -= K


print(taa, ao)
Problem p02843 (python)

Fixed submission:
import sys
X = int(input())
if 1 <= X and X < 100:
    print("0")
    sys.exit()
i = 0
dp = [0]*(X+1)
dp[0] = 1
for i in range(100, X+1):
    for j in range(6):
        if dp[i-(100+j)] == 0:
            pass
        else:
            dp[i] = 1
print(dp[X])

Buggy submission (verdict: Runtime Error):
X = int(input())
dp = [0]*(X+1)
dp[0] = 1
dp[100] = 1
dp[101] = 1
dp[102] = 1
dp[103] = 1
dp[104] = 1
dp[105] = 1
for i in range(100, X+1):
    for j in range(6):
        dp[i] = max(dp[i], dp[i-100+j])

if dp[X]:
    print('Yes')
else:
    print('No')
Problem p03006 (python)

Fixed submission:
import collections
n = int(input())
balls = []
for _ in range(n):
    x, y = map(int, input().split())
    balls.append([x, y])
# print(balls)
delta = []
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        dx = balls[j][0] - balls[i][0]
        dy = balls[j][1] - balls[i][1]
        delta.append((dx, dy))

c_delta = collections.Counter(delta)
# print(c_delta)
if len(c_delta):
    print(n-c_delta.most_common()[0][1])
else:
    print(1)

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
balls = []
for _ in range(n):
    x, y = map(int, input().split())
    balls.append([x, y])
# print(balls)
delta = []
for i in range(n):
    for j in range(n):
        if i == j:
            continue
        dx = balls[j][0] - balls[i][0]
        dy = balls[j][1] - balls[i][1]
        delta.append((dx, dy))

c_delta = collections.Counter(delta)
# print(c_delta)
print(n-c_delta.most_common()[0][1])
Problem p03087 (python)

Fixed submission:
n, q = map(int, input().split())
s = input()
info = [list(map(int, input().split())) for _ in range(q)]
all = s.count('AC')
ans = []
lt = [all]
rt = [all]
# for i in range(n):
#     lt.append(all - s[i:].count('AC'))
#     rt.append(all - s[:n-i].count('AC'))
for i in range(1, n):
    if s[i-1] == 'A' and s[i] == 'C':
        lt.append(lt[i-1] - 1)
    else:
        lt.append(lt[i-1])
    if s[n-i-1] == 'A' and s[n-i] == 'C':
        rt.append(rt[i-1] - 1)
    else:
        rt.append(rt[i-1])

rt.reverse()
# print(lt)
# print(rt)
# print(rt)
for l, r in info:
    ans.append(lt[l-1] + rt[r-1] - all)

for i in range(q):
    print(ans[i])

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = input()
t = [0]*(n + 1)
for i in range(n):
    t[i+1] = t[i] + (1 if s[i:i+2] == 'AC' else 0)
for i in range(q):
    l, r = map(int, input().split())
    print(t[r-1] - r[l-1])
Problem p03147 (python)

Fixed submission:
N = int(input())
H = [0] + [int(a) for a in input().split()]
# for _ in range(N):
#     h.append(int(input()))
answer = 0
for i in range(1, N+1):
    answer += max(H[i] - H[i-1], 0)

print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
# h = list(map(int, input().split()))
h = [0]
for _ in range(N):
    h.append(int(input()))
answer = 0
for i in range(1, N+1):
    answer += max(H[i] - H[i-1], 0)

print(answer)
Problem p03210 (python)

Fixed submission:
x = int(input())
if x == 3 or x == 5 or x == 7:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
x = int(input())
if x == 3 or x == 5 or x == 7:
    print('YES')
else:
    pritn('NO')
Problem p03264 (python)

Fixed submission:
N = int(input())
if N % 2 == 0:
    answer = (N // 2)**2
else:
    answer = (N // 2) * (N // 2 + 1) 

print(answer)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
div = N // K
if K % 2 == 1:
    print(div**3)
else:
    if div * N + K // 2 <= N:
        print(div**3 + (div + 1)**3)
    else:
        print(2 * div**3)
Problem p03282 (python)

Fixed submission:
S = input()
K = int(input())
OK = True
for i in range(min(K, len(S))):
    if S[i] != '1':
        OK = False
if OK:
    print('1')
    exit()
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()

Buggy submission (verdict: Runtime Error):
S = input()
K = int(input())
OK = True
for i in range(K):
    if S[i] != '1':
        OK = False
if OK:
    print('1')
    exit()
for i in range(len(S)):
    if S[i] != '1':
        print(S[i])
        exit()
Problem p03283 (python)

Fixed submission:
N, M, Q = map(int, input().split())
X = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(M):
    L, R = map(int, input().split())
    X[L][R] += 1

# for i in range(N):
#     for j in range(N):
#         X[i+1][j+1] += X[i][j+1] + X[i+1][j]
# print(*X, sep='\n')
# print('')

for i in range(N+1):
    for j in range(N):
        X[i][j+1] += X[i][j]

for i in range(N+1):
    for j in range(N):
        X[j+1][i] += X[j][i]
# print(*X, sep='\n')

ans = []
for _ in range(Q):
    p, q = map(int, input().split())
    ans.append(X[q][q] - X[q][p-1] - X[p-1][q] + X[p-1][p-1])

print(*ans, sep='\n')

Buggy submission (verdict: Runtime Error):
N, M, Q = map(int, input().split())
X = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(M):
    L, R = map(int, input().split())
    X[L][R] = 1

# for i in range(N):
#     for j in range(N):
#         X[i+1][j+1] += X[i][j+1] + X[i+1][j]
# print(*X, sep='\n')
# print('')

for i in range(N+1):
    for j in range(N):
        X[i][j+1] += X[i][j]
# print(*X, sep='\n')

for i in range(N+1):
    for j in range(N):
        # print(i, j)
        X[j+1][i] += X[j][i]
ans = []
for _ in range(Q):
    p, q = map(int, input().split())
    ans.appned(X[q][q] - X[q][p-1] - X[p-1][q] + X[p-1][p-1])
    # print(ans)
# print(*X, sep='\n')
print(*ans, sep='\n')
Problem p03369 (python)

Fixed submission:
S = input()
price = 700
if S[0] == 'o':
    price += 100
if S[1] == 'o':
    price += 100
if S[2] == 'o':
    price += 100

print(price)

Buggy submission (verdict: Runtime Error):
A, B, C, X, Y = map(int, input().split())
ans = float('inf')
for i in range(10**5 + 1):
    price = 2*C*i + A*max(0, X - i) + B*max(0, Y - i)
    if ans > price:
        ans = price

print(ans)
Problem p03425 (python)

Fixed submission:
import itertools
N = int(input())
S_num = [0] * 5
answer = 0
for _ in range(N):
    S = input()
    if S[0] == 'M':
        S_num[0] += 1
    elif S[0] == 'A':
        S_num[1] += 1
    elif S[0] == 'R':
        S_num[2] += 1
    elif S[0] == 'C':
        S_num[3] += 1
    elif S[0] == 'H':
        S_num[4] += 1

for v in itertools.combinations(S_num, 3):
    answer += v[0] * v[1] * v[2]
print(answer)

Buggy submission (verdict: Runtime Error):
import itertools
n = int(input())
name = [0]*n
s = []
for i in range(n):
    st = input()
    if st[0] == 'M':
        name[0] += 1
    elif st[0] == 'A':
        name[1] += 1
    elif st[0] == 'R':
        name[2] += 1
    elif st[0] == 'C':
        name[3] += 1
    elif st[0] == 'H':
        name[4] += 1
    s.append(st)

ans = 0
for v in itertools.combinations(name, 3):
    # print(v)
    ans += v[0]*v[1]*v[2]

print(ans)
Problem p03436 (python)

Fixed submission:
from collections import deque
h, w = map(int, input().split())
s = [input() for _ in range(h)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
table = [[float('inf') for _ in range(w)] for _ in range(h)]
table[0][0] = 0
def bfs():
    que = deque([[0, 0]])
    # print(que)
    used = [[0 for _ in range(w)] for _ in range(h)]
    used[0][0] = 1
    while que:
        # print(que.popleft())
        y, x = que.popleft()
        for k in range(4):
            if 0 <= y+dy[k] < h and 0 <= x+dx[k] < w:
                if s[y+dy[k]][x+dx[k]] == '#':
                    continue
                if used[y+dy[k]][x+dx[k]] == 0:
                    table[y+dy[k]][x+dx[k]] = min(table[y+dy[k]][x+dx[k]], table[y][x]+1)
                    used[y+dy[k]][x+dx[k]] = 1
                    que.append((y+dy[k], x+dx[k]))
    
    # print(*table, sep='\n')
    return table[h-1][w-1]

c = bfs()
if c == float('inf'):
    print(-1)
else:
    white = 0
    for i in range(h):
        white += s[i].count('.')
    ans = white - (c+1)
    print(ans)

Buggy submission (verdict: Runtime Error):
print(-1
Problem p03472 (python)

Fixed submission:
n, H = map(int, input().split())
a = []
b = []
for i in range(n):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)

ans = 0
amax = max(a)
b.sort(reverse=True)
# print(amax, b)
i = 0
while H > 0:
    if i < n:
        if amax < b[i]:
            H -= b[i]
            ans += 1
            i += 1
        else:
            ans += H//amax
            if H%amax != 0:
                ans += 1
            break
    else:
        ans += H//amax
        if H % amax != 0:
            ans += 1
        break

print(ans)

Buggy submission (verdict: Runtime Error):
n, H = map(int, input().split())
a = []
b = []
for i in range(n):
    ai, bi = map(int, input().split())
    a.append(ai)
    b.append(bi)

ans = 0
amax = max(a)
b.sort(reverse=True)
# print(amax, b)
i = 0
while H > 0:
    if amax < b[i]:
        H -= b[i]
        ans += 1
        i += 1
    else:
        ans += H//amax
        if H%amax != 0:
            ans += 1
        break

print(ans)
Problem p03473 (python)

Fixed submission:
m=int(input())
print(48-m)

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

def is_prime(n):
    if n == 1: return False
    for k in range(2, int(n**0.5)+1):
        if n % k == 0:
            return 0
    return n

prime_numbers = [is_prime(i) for i in range(2, 10**5 + 1) if is_prime(i) != 0]
same = [0]*(10**5 + 1)
for n in prime_numbers:
    if (n+1) // 2 in prime_numbers:
        same[n] += 1

for i in range(10**5):
    same[i+1] += same[i]

ans = []
for _ in range(Q):
    l, r = map(int, input().split())
    N = same[r] - same[l-1]
    ans.append(N)

print(*ans, sep='\n')
Problem p03524 (python)

Fixed submission:
import collections
s = input()
cnt = collections.Counter(s)
cnt = cnt.most_common()
# print(cnt)
if len(cnt) == 1:
    if len(s) == 1:
        print('YES')
    else:
        print('NO')
    # print('YES')
    exit()
if len(cnt) == 2:
    if len(s) == 2:
        print('YES')
    else:
        print('NO')
    exit()

if cnt[0][1] > cnt[-1][1] + 1:
    print('NO')
else:
    print('YES')

Buggy submission (verdict: Runtime Error):
import collections
s = input()
cnt = collections.Counter(s)
cnt = cnt.most_common()
# print(cnt)
if len(s) == 1:
    print('YES')
    exit()
if len(cnt) == 2:
    if len(s) == 2:
        print('YES')
    else:
        print('NO')
    exit()

if cnt[1][1] > cnt[-1][1] + 1:
    print('NO')
else:
    print('YES')
Problem p03557 (python)

Fixed submission:
from bisect import bisect_right
from bisect import bisect_left
 
n = int(input())
a = sorted(map(int, input().split()))
b = sorted(map(int, input().split()))
c = sorted(map(int, input().split()))
cnt = 0
bn = []
for i in range(n):
    x1 = bisect_left(a, b[i])
    x2 = bisect_right(c, b[i])
    cnt += x1*(n-x2)
print(cnt)

Buggy submission (verdict: Runtime Error):
import bisect
N = int(input())
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))
ans = 0
for i in range(N):
    upi = bisect.bisect_left(A, B[i])
    dwi = bisect.bisect_left(C, B[i])
    if C[dwi] == B[i]:
        dwi = bisect.bisect_left(C, B[i] + 1)
    ans += upi*(N - dwi)

print(ans)
Problem p03638 (python)

Fixed submission:
H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))
answer = [[0] * W] * H
# True_answer = []
input_list = []
for i in range(1, N+1):
    for _ in range(a[i-1]):
        input_list.append(i)

for i in range(H):
    for j in range(W):
        if i % 2 == 0:
            # print('2')
            answer[i][j] = input_list[W * i + j]
            # print(answer[0], answer[1], answer[2])
        else:
            # print('not2')
            answer[i][W-j-1] = input_list[W * i + j]
            # print(answer)
        if (j+1) % W == 0:
            # True_answer[i] += answer[i]
            print(*answer[i])



# print(input_list)
# print(answer)
# print(True_answer)

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
N = int(input())
a = list(map(int, input().split()))
answer = [[0] * W] * H
# True_answer = []
input_list = []
for i in range(1, N+1):
    for _ in range(a[i-1]):
        input_list.append(i)

for i in range(H):
    for j in range(W):
        if i % 2 == 0:
            # print('2')
            answer[i][j] = input_list[5 * i + j]
            # print(answer[0], answer[1], answer[2])
        else:
            # print('not2')
            answer[i][W-j-1] = input_list[5 * i + j]
            # print(answer)
        if (j+1) % W == 0:
            # True_answer[i] += answer[i]
            print(*answer[i])



# print(input_list)
# print(answer)
# print(True_answer)
Problem p03680 (python)

Fixed submission:
N = int(input())
a = [0]
for _ in range(N):
    a.append(int(input()))
x = 1
visited = set([1])
answer = 0

while True:
    x = a[x]
    if x in visited:
        answer = -1
        break
    visited.add(x)
    answer += 1
    if x == 2:
        break

print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = []
for _ in range(N):
    a.append(int(input()))
x = 1
visited = set([1])
answer = 0

while True:
    x = a[x]
    if x in visited:
        answer = -1
        break
    visited.add(x)
    answer += 1
    if x == 2:
        break

print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = []
count = [1]
answer = 1
for _ in range(N):
    a.append(int(input()))

def search(A):
    answer += 1
    if A in count or answer > N:  # ループ処理
        print(-1)
        exit()
    count.append(A)
    print(count)
    if A == 2:
        print(len(count) - 1)
        exit()

    search(a[A-1])

search(a[0])

Buggy submission (verdict: Runtime Error):
N = int(input())
a = []
count = [1]
answer = 0
for _ in range(N):
    a.append(int(input()))

def search(A):
    if A in count:  # ループ処理
        print(-1)
        exit()
    count.append(A)
    # print(count)
    if A == 2:
        print(len(count) - 1)
        exit()
        
    search(a[A-1])

search(a[0])
Problem p03695 (python)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
colors = [0] * 9
for i in range(N):
    if 1 <= a[i] and a[i] <= 399:
        colors[0] = 1
    elif 400 <= a[i] and a[i] <= 799:
        colors[1] = 1
    elif 800 <= a[i] and a[i] <= 1199:
        colors[2] = 1
    elif 1200 <= a[i] and a[i] <= 1599:
        colors[3] = 1
    elif 1600 <= a[i] and a[i] <= 1999:
        colors[4] = 1
    elif 2000 <= a[i] and a[i] <= 2399:
        colors[5] = 1
    elif 2400 <= a[i] and a[i] <= 2799:
        colors[6] = 1
    elif 2800 <= a[i] and a[i] <= 3199:
        colors[7] = 1
    else:
        colors[8] += 1

if sum(colors[0:8]) == 0 and colors[8] >= 1:
    MIN = 1
else:
    MIN = sum(colors[0:8])
MAX = sum(colors)

print(MIN, MAX)

Buggy submission (verdict: Runtime Error):
N = int(input())
a = list(map(int, input().split()))
colors = [0] * 9
for i in range(N):
    if 1 <= a[i] and a[i] <= 399:
        colors[0] = 1
    elif 400 <= a[i] and a[i] <= 799:
        colors[1] = 1
    elif 800 <= a[i] and a[i] <= 1199:
        colors[2] = 1
    elif 1200 <= a[i] and a[i] <= 1599:
        colors[3] = 1
    elif 1600 <= a[i] and a[i] <= 1999:
        colors[4] = 1
    elif 2000 <= a[i] and a[i] <= 2399:
        colors[5] = 1
    elif 2400 <= a[i] and a[i] <= 2799:
        colors[6] = 1
    elif 2800 <= a[i] and a[i] <= 3199:
        colors[7] = 1
    else:
        colors[8] += 1
if sum(colors[0:8] == 0) and colors[9] >= 1:
    MIN = 1
else:
    MIN = sum(colors[0:8])
MAX = sum(colors)

print(MIN, MAX)
Problem p03721 (python)

Fixed submission:
n, k = map(int, input().split())
a = [0] * n
b = [0] * n
sum = 0
arr = []
for i in range(n):
    a[i], b[i] = map(int, input().split())
arr_list = list(zip(a, b))
arr_list = sorted(arr_list)
# print(arr_list)
for i in range(n):
    sum += arr_list[i][1]
    # print(sum, arr_list[i])
    if sum >= k:
        answer = arr_list[i][0]
        break

print(answer)

Buggy submission (verdict: Runtime Error):
	n, k = map(int, input().split())
a = [0] * n
b = [0] * n
sum = 0
arr = []
for i in range(n):
    a[i], b[i] = map(int, input().split())
arr_list = list(zip(a, b))
arr_list = sorted(arr_list)
# print(arr_list)
for i in range(n):
    sum += arr_list[i][1]
    # print(sum, arr_list[i])
    if sum >= k:
        answer = arr_list[i]
        break

print(answer)
Problem p03796 (python)

Fixed submission:
N = int(input())
mod = 10 ** 9 + 7
answer = 1
for i in range(2, N+1):
    answer *= i
    answer %= mod

print(answer)

Buggy submission (verdict: Runtime Error):
N = int(input())
mod = 10 ** 9 + 7
def fact(n):
    if n == 1:
        return 1
    return n * fact(n-1)

answer = fact(N)
print(answer % mod)

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

def fact(n):
    if n == 1:
        return 1
    return n * fact(n-1)

answer = fact(N)
print(answer)
Problem p03853 (python)

Fixed submission:
H, W = map(int, input().split())
C = [''] * H
for i in range(H):
    C[i] = input()

for i in range(H):
    print(C[i])
    print(C[i])

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
C = [''] * W
for i in range(H):
    C[i] = input()

for i in range(H):
    print(C[i])
    print(C[i])

Buggy submission (verdict: Runtime Error):
H, W = map(int, input().split())
C = [0] * W
for i in range(H):
    C[i] = input()

for i in range(H):
    print(C[i])
    print(C[i])
Problem p03860 (python)

Fixed submission:
a, b, c = input().split()
print(a[0] + b[0] + c[0])

Buggy submission (verdict: Runtime Error):
s = input()
s = s.lstrip('AtCoder ')
s = s.rstrip(' Contest ')
# print(s)
print('A' + s[0] + 'C')

Buggy submission (verdict: Runtime Error):
s = input()
s = s.lstrip('AtCoder ')
s = s.rstrip(' Contest')
print('A' + s[0] + 'C')