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

Fixed submission:
from collections import deque
K = int(input())

dp = [[0]*10 for _ in range(17)]
for i in range(10):
    dp[0][i] = 1

for keta in range(1, 17):
    for i in range(10):
        if 1 <= i and i <= 8:
            dp[keta][i] += dp[keta-1][i-1]+dp[keta-1][i]+dp[keta-1][i+1]
        if i == 0:
            dp[keta][i] += dp[keta-1][0]+dp[keta-1][1]
        if i == 9:
            dp[keta][i] += dp[keta-1][9]+dp[keta-1][8]
SUM = 0
for keta in range(17):
    SUM += sum(dp[keta][1:])
    if SUM >= K:
        break
SUM = 0
for i in range(keta):
    SUM += sum(dp[i][1:])

r = K-SUM
tmp_r = 0
for i in range(1, 10):
    tmp_r += dp[keta][i]
    if tmp_r >= r:
        tmp_r -= dp[keta][i]
        r -= tmp_r
        break
keta += 1
if keta == 1:
    print(i)
else:
    l=[i]
    rr = 0
    for k in range(keta-1, 0, -1):
        q = deque()
        if i == 0:
            q.append(0)
            q.append(1)
        elif i == 9:
            q.append(8)
            q.append(9)
        else:
            q.append(i-1)
            q.append(i)
            q.append(i+1)
        while q:
            num = q.popleft()
            rr += dp[k-1][num]
            if rr >= r:
                rr -= dp[k-1][num]
                l.append(num)
                i = num
                break
    keta = len(l)
    ans = 0
    for i in range(keta):
        ans += l[keta-i-1]*10**i
    print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
K = int(input())
q = deque([[1],[2],[3],[4],[5],[6],[7],[8],[9]])
cnt = 0
while cnt != K:
    nums = q.popleft()
    last = nums[-1]
    if last == 9:
        tmp = nums.copy()
        tmp.append(8)
        q.append(tmp)

        tmp = nums.copy()
        tmp.append(9)
        q.append(tmp)
    elif last == 0:
        tmp = nums.copy()
        tmp.append(0)
        q.append(tmp)

        tmp = nums.copy()
        tmp.append(1)
        q.append(tmp)
    else:
        tmp = nums.copy()
        tmp.append(last-1)
        q.append(tmp)

        tmp = nums.copy()
        tmp.append(last)
        q.append(tmp)

        tmp = nums.copy()
        tmp.append(last+1)
        q.append(tmp)

    cnt += 1
ans = 0
l = len(nums)
for i in range(l):
    ans += nums[i]*10**(l-i-1)
print(ans)

Buggy submission (verdict: Runtime Error):
from collections import deque
K = int(input())
q = deque([[1],[2],[3],[4],[5],[6],[7],[8],[9]])
cnt = 0
while cnt != K:
    nums = q.popleft()
    last = nums[-1]
    if last == 9:
        tmp = nums.copy()
        tmp.append(8)
        q.append(tmp)

        tmp = nums.copy()
        tmp.append(9)
        q.append(tmp)
    elif last == 0:
        tmp = nums.copy()
        tmp.append(0)
        q.append(tmp)

        tmp = nums.copy()
        tmp.append(1)
        q.append(tmp)
    else:
        tmp = nums.copy()
        tmp.append(last-1)
        q.append(tmp)

        tmp = nums.copy()
        tmp.append(last)
        q.append(tmp)

        tmp = nums.copy()
        tmp.append(last+1)
        q.append(tmp)

    cnt += 1
ans = 0
l = len(nums)
for i in range(l):
    ans += nums[i]*10**(l-i-1)
print(ans)
Problem p02744 (python)

Fixed submission:
N = int(input())
ans = []


def next_chr(ch):
    res = []
    g = ord(ch) - ord("a") + 2
    for i in range(g):
        res.append(chr(ord("a")+i))
    return res


def answer(s, i):
    if i == N:
        ch = next_chr(max(s))
        for m in ch:
            ans.append("".join([s, m]))
    else:
        i += 1
        ch = next_chr(max(s))
        for m in ch:
            answer("".join([s, m]), i)


if N == 1:
    print("a")
else:
    answer("a", 2)
    ans = sorted(ans)
    for c in ans:
        print(c)

Buggy submission (verdict: Runtime Error):
N = int(input())
ans = ["a"] * N


def next_chr(ch):
    res = []
    for i in range(-1, 2):
        if ord(ch) + i >= ord("a") and ord(ch) + i <= ord("z"):
            res.append(chr(ord(ch)+i))
    return res


def answer(s, i):
    if i == N:
        ch = next_chr(s[-1])
        for m in ch:
            print("".join([s, m]))
    else:
        i += 1
        ch = next_chr(s[-1])
        for m in ch:
            answer("".join([s, m]), i)


answer("a", 2)
Problem p02787 (python)

Fixed submission:
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())

dp = [[10**10] * (H + 1) for _ in range(N+1)]

for i in range(1, N+1):
    for h in range(1, H+1):
        if h - A[i-1] <= 0:
            dp[i][h] = min(dp[i-1][h], B[i-1])
        else:
            dp[i][h] = min(dp[i-1][h], dp[i][h-A[i-1]] + B[i-1])

print(dp[-1][-1])

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
INF = 10**10


dp = [[0] * INF for _ in range(N+1)]

for b in range(1, INF):
    for i in range(1, N+1):
        if b - B[i-1] > 0:
            dp[i][b] = max(dp[i][b - B[i-1]] + A[i-1], dp[i - 1][b])
        else:
            dp[i][b] = max(dp[i-1], A[i-1])
    if dp[-1][b] >= H:
        print(b)
        break

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
INF = 10**10


dp = [[0] * INF for _ in range(N+1)]

for b in range(1, INF):
    for i in range(1, N+1):
        if b - B[i-1] > 0:
            dp[i][b] = max(dp[i][b - B[i-1]] + A[i-1], dp[i - 1][b])
        else:
            dp[i][b] = max(dp[i-1], A[i-1])
    if dp[-1][b] >= H:
        print(b)
        break

Buggy submission (verdict: Runtime Error):
H, N = map(int, input().split())
A = [0] * N
B = [0] * N
for i in range(N):
    A[i], B[i] = map(int, input().split())
INF = 10**10


dp = [[0] * INF for _ in range(N+1)]

for b in range(1, INF):
    for i in range(1, N+1):
        if b - B[i-1] > 0:
            dp[i][b] = max(dp[i][b - B[i-1]] + A[i-1], dp[i - 1][b])
        else:
            dp[i][b] = max(dp[i-1], A[i-1])
    if dp[-1][b] >= H
        print(b)
        break
Problem p02789 (python)

Fixed submission:
N,M=map(int,input().split())
if N == M:
    print("Yes")
else:
    print("No")

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

print("{}{}".format(N.M))
Problem p02802 (python)

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

if M == 0 or N == 0:
    print("{} {}".format(0, 0))
else:

    p = [0]*M
    S = [0]*M

    for i in range(M):
        tmp = input().split()
        p[i] = int(tmp[0])
        S[i] = tmp[1]

    penalty = 0


    correct_set = set()
    for i in range(M):
        if S[i] == 'AC':
            correct_set.add(p[i])

    correct = len(correct_set)

    for i in range(M):
        if S[i] == 'AC' and p[i] in correct_set:
            correct_set.remove(p[i])
        elif S[i] == 'WA' and p[i] in correct_set:
            penalty += 1


            

    print("{} {}".format(correct, penalty))

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

if M == 0 or N == 0:
    print("{} {}".format(0, 0))
else:

    p = [0]*M
    S = [0]*M

    for i in range(M):
        tmp = input().split()
        p[i] = int(tmp[0])
        S[i] = tmp[1]

    penalty = 0


    correct_set = set()
    for i in range(M):
        if S[i] == 'AC':
            correct_set.add(p[i])

    correct = len(correct_set)

    for i in range(M):
        if S[i] == 'AC':
            correct_set.remove(p[i])
        elif S[i] == 'WA' and p[i] in correct_set:
            penalty += 1


            

    print("{} {}".format(correct, penalty))
Problem p02838 (python)

Fixed submission:
N = int(input())
A = [int(a) for a in input().split()]
mod = 10**9+7
SUM = 0

maxA = max(A)
d = 0
while 1:
    if maxA < 2**d:
        break
    d += 1

BitSumB = 0
for i in range(d):
    tmp = 0
    for n in range(N):
        tmp += (A[n] >> i) & 1
    BitSumB += (2**i) * tmp * (N - tmp)



"""
BitA = [[0]*d for _ in range(N)]
for i in range(N):
    BitA[i] = list(map(int, format(bin(A[i])[2:], '0>{}'.format(d))))

BitSumB = 0
for i in range(d):
    tmp = sum([BitA[j][i] for j in range(N)])
    BitSumB += 2 ** (d-i-1) * (tmp * (N - tmp))
    #BitSumB = BitSumB % mod
"""

print(BitSumB % mod)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = [int(a) for a in input().split()]
mod = 10**9+7
SUM = 0

maxA = max(A)
d = 0
while 1:
    if maxA < 2**d:
        break
    d += 1

BitA = [[0]*d for _ in range(N)]
for i in range(N):
    for j in range(d):
        BitA[i][j] = int(bin(A[i]|2**d)[3+j])

BitSumB = 0
for i in range(d):
    tmp = sum([BitA[j][i] for j in range(N)])
    BitSumB += 2 ** (d-i-1) * (tmp * (N - tmp))
    BitSumB = BitsumB % mod

print(BitSumB)
Problem p02921 (python)

Fixed submission:
S = input()
T = input()

ans = 0
for s, t in zip(S, T):
    if s == t:
        ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
S = input()
T = input()

ans = 0
for s, t in zip(S, T):
    if s == t:
        ans += 1

print(ans)S = input()
T = input()

ans = 0
for s, t in zip(S, T):
    if s == t:
        ans += 1

print(ans)
Problem p02923 (python)

Fixed submission:
N = int(input())
H = [int(h) for h in input().split()]
A = [0] * N
for n in range(N - 1):
    if H[n] >= H[n+1]:
        if n == 0:
            A[n] = 1
        else:
            A[n] = A[n - 1] + 1

print(max(A))

Buggy submission (verdict: Runtime Error):
N = int(input())
H = [int(h) for h in input().split()]
A = [0] * (N - 1)
for n in range(N - 1):
    if H[n] >= H[n+1]:
        if n == 0:
            A[n] = 1
        else:
            A[n] = A[n - 1] + 1

print(max(A))
Problem p02936 (python)

Fixed submission:
from collections import deque

N, Q = map(int, input().split())
AB = {i: set() for i in range(1, N+1)}
for i in range(N - 1):
    tmpA, tmpB = map(int, input().split())
    AB[tmpA].add(tmpB)
    AB[tmpB].add(tmpA)
P = [0] * Q
X = [0] * Q
V = [0] * (N + 1)
for i in range(Q):
    P, X = map(int, input().split())
    V[P] += X

check = [0]*(N + 1)
q = deque()
q.append(1)
check[1] = 1
while q != deque():
    node = q.pop()
    for i in AB[node]:
        if check[i] == 1:
            continue
        V[i] += V[node]
        check[i] = 1
        q.appendleft(i)
print(*V[1:])

Buggy submission (verdict: Runtime Error):
input = sys.stdin.readline
N, Q = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N-1)]
P = [0] * Q
X = [0] * Q
V = [0] * (N + 1)
for i in range(Q):
    P, X = map(int, input().split())
    V[P] += X

Buggy submission (verdict: Runtime Error):
input = sys.stdin.readline
N, Q = map(int, input().split())
AB = [list(map(int, input().split())) for _ in range(N-1)]
P = [0] * Q
X = [0] * Q
V = [0] * (N + 1)
for i in range(Q):
    P, X = map(int, input().split())
    V[P] += X

tr = Tree(N, AB)
Problem p02972 (python)

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


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors


divisor = []
for i in range(1, N + 1):
    divisor.append(make_divisors(i))
B = [0]*N
rs = [0]*N
for i in range(N - 1, -1, -1):
    if rs[i] != A[i]:
        B[i] = 1
        for j in divisor[i]:
            rs[j-1] = 1 - rs[j-1]

print(sum(B))
for i in range(N):
    if B[i] == 1:
        print(i+1)

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


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    return divisors


divisor = []
for i in range(1, N + 1):
    divisor.append(make_divisors(i))
B = [0]*N
rs = [0]*N
for i in range(N - 1, -1, -1):
    if rs[i] != A[i]:
        B[i] = 1
        for j in divisor[i]:
            rs[j] = 1 - rs[j]

print(sum(B))
for i in range(N):
    if B[i] == 1:
        print(i+1)
Problem p02995 (python)

Fixed submission:
from fractions import gcd

A, B, C, D = map(int, input().split())
N = B - A + 1
lcm_CD = (C * D) // gcd(C, D)

sumB = B - B // C - B // D + B // lcm_CD
sumA = (A - 1) - (A - 1) // C - (A - 1) // D + (A - 1) // lcm_CD

print(sumB - sumA)

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

A, B, C, D = map(int, input().split())
N = B - A + 1
lcm_CD = (C * D) // gcd(C, D)

sumB = B - B // C - B // D + B // lcm_CD
sumA = (A - 1) - (A - 1) // C - (A - 1) // D + (A - 1) // lcm_CD

print(sumB - sumA)
Problem p02999 (python)

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

if X < A:
    print(0)
else:
    print(10)

Buggy submission (verdict: Runtime Error):
X, A = int(input())

if X < A:
    print(0)
else:
    print(10)
Problem p03001 (python)

Fixed submission:
W, H, x, y = map(float, input().split())
f = 0
if W / 2 == x and H / 2 == y:
    f = 1

print("{} {}".format(W*H/2, f))

Buggy submission (verdict: Runtime Error):
W, H, x, y = map(float, input().split())
f = 0
if W / 2 == x and H / 2 == y:
    f = 1

if y/x == H/W or y == -(H/W)*x + H:
    print("{} {}".format(W*H/2, f))

else:
    print("{} {}".format(max(min(x, W-x)*H, min(y, H-y)*W), f))
Problem p03161 (python)

Fixed submission:
import numpy as np
N, K = map(int, input().split())
# H = np.array([int(h) for h in input().split()])
H = np.array(list(map(int, input().split())))

dp = np.zeros(N, dtype=int)
k = np.array([i for i in range(1, K+1)])

for n in range(1, N):
    start = max(n-K, 0)
    #if n < K:
    #   dp[n] = np.amin(dp[start] + np.abs(H[n]-H[start]))
    #else:
    #   dp[n] = np.min(dp[n - k] + np.abs(H[n] - H[n - k]))
    dp[n] = np.min(dp[start:n] + np.abs(H[n]-H[start:n]))

print(dp[N-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
N, K = map(int, input().split())
# H = np.array([int(h) for h in input().split()])
H = np.array(list(map(int, input.split())))

dp = np.zeros(N, dtype=int)
k = np.array([i for i in range(1, K+1)])

for n in range(1, N):
    start = np.maximum(n-k, 0)
    if n < K:
        dp[n] = np.amin(dp[start] + np.abs(H[n]-H[start]))
    else:
        dp[n] = np.min(dp[n - k] + np.abs(H[n] - H[n - k]))


print(dp[N-1])

Buggy submission (verdict: Runtime Error):
import numpy as np
N, K = map(int, input().split())
H = np.array([int(h) for h in input().split()])


#dp = np.array([0]*(N+1), dtype=np.int32)
dp = np.zeros(N, dtype=int)
k = np.array([i for i in range(1, K+1)])

for n in range(1, N):
    if n < K:
        dp[n] = np.amin(dp[np.maximum(n-k, 0)] + np.abs(H[n]-H[np.maximum(n-k, 0)]))
    else:
        dp[n] = np.min(dp[n - k] + np.abs(H[n] - H[n - k]))


print(dp[N-1])
Problem p03166 (python)

Fixed submission:
from collections import defaultdict
import sys
sys.setrecursionlimit(10000)
N, M = map(int, input().split())
in_path = defaultdict(lambda: [])
out_path = defaultdict(lambda: [])

for m in range(M):
    x, y = map(int, input().split())
    in_path[y].append(x)
    out_path[x].append(y)

check = [False]*(N+1)
memo = [0]*(N+1)


def dp(i):
    if check[i]:
        return memo[i]
    else:
        check[i] = True
        if not out_path[i]:
            return 0
        else:
            max_path = 0
            for node in out_path[i]:
                max_path = max(dp(node), max_path)
            max_path += 1
            memo[i] = max_path
            return max_path


ans = 0
for i in range(1, N+1):
    ans = max(ans, dp(i))

print(ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
N, M = map(int, input().split())
in_path = defaultdict(lambda: [])
out_path = defaultdict(lambda: [])

for m in range(M):
    x, y = map(int, input().split())
    in_path[y].append(x)
    out_path[x].append(y)

check = [False]*(N+1)
memo = [0]*(N+1)

def dp(i):
    if check[i] == True:
        return memo[i]
    else:
        check[i] = True
        if not out_path[i]:
            memo[i] = 0
            return 0
        else:
            max_path = 0
            for node in out_path[i]:
                max_path = max(dp(node), max_path)
            max_path += 1
            memo[i] = max_path
            return max_path


ans = 0
for i in range(1, N+1):
    ans = max(ans, dp(i))

print(ans)
Problem p02642 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort()                  #エラトステネスの篩にかけるためソート
Amax = A[-1]
dp = [1]*(Amax+1)         #Aの最大値までのエラトステネスの篩を作る。
ans = 0
for i in range(len(A)-1):
  p = A[i]
  if dp[p] == 1:          #A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
    for q in range(Amax//p+1):
      dp[p*q] = 0         #A[i]の倍数をすべて0にする
    if A[i] != A[i+1]: 
      ans += 1            #A[i]が重複していなければカウント
if dp[Amax] == 1:         #重複チェック時にレンジオーバーするためAmaxだけ別で判定 
  ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
# coding: utf-8
# Your code here!

N = int(input())
A = list(map(int, input().split()))
A.sort()                  #エラトステネスの篩にかけるためソート
A = list(set(A))
Amax = A[-1]              #最大値
dp = [1]*(Amax+1)         #Aの最大値までのエラトステネスの篩を作る
ans = 0
# print(A)
if len(A)!=1:
    for i in range(len(A)):
      p = A[i]
      if dp[p] == 1:          #A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
        
        for q in range(Amax//p+1):
          dp[p*q] = 0         #A[i]の倍数をすべて0にする
        # print(dp)
      else:
          ans+=1
        #   print(A[i])
    #     if A[i] != A[i+1]: 
    #       ans += 1            #A[i]が重複していなければカウント
    #     print(ans)
    # if dp[Amax] == 1:         #重複チェック時にレンジオーバーするためAmaxだけ別で判定 
    #   ans += 1
    print(len(A)-ans)
else:
    print(0)
Problem p02582 (python)

Fixed submission:
S = input()
ans = 0
tmp = 0
preR = 0
if S == "SSS":
    print(0)
elif S == 'RSS' or S == 'SRS' or S == 'SSR' or S ==  'RSR':
    print(1)
elif S == 'RRS' or S == 'SRR':
    print(2)
elif S == 'RRR':
    print(3)

Buggy submission (verdict: Runtime Error):
S = input()
ans = 0
tmp = 0
preR = 0
if S == "SSS":
    print(0)
elif S == 'RSS' or S == 'SRS' or S == 'SSR' or S ==  'RSR'):
    print(1)
elif S == 'RRS' or S == 'SRR':
    print(2)
elif S == 'RRR':
    print(3)
Problem p02583 (python)

Fixed submission:
N = int(input())
L = list(map(int, input().split()))
L.sort()
ans = 0
for i in range(N):
    for j in range(i+1, N):
        count = 0
        for k in range(j + 1, N):
            
            if L[i] + L[j]  > L[k]  and L[i] < L[j] and L[j] < L[k]:
                count += 1
                #print(i, j, k, count, ans)
            elif L[i] + L[j]  < L[k] :
                #print(L[i], L[j], L[k])
                break
        ans = ans + count
            #print(ans)
print(ans)

Buggy submission (verdict: Runtime Error):
ans = 0
for i in range(N):
    for j in range(i+1, N):
        count = 0
        for k in range(j + 1, N):
            if L[i] + L[j]  > L[k]  and L[i] < L[j]:
                count += 1
                #print(L[i], L[j], L[k], count)
            else:
                #print(L[i], L[j], L[k])
                break
            ans = ans + count
            #print(ans)
print(ans)
Problem p02584 (python)

Fixed submission:
X, K, D = map(int, input().split())
ans = 0

if X > 0:
    tmp = abs(X) // D
    if tmp  >= K:
        ans = X-D*K
        
    elif tmp < K:
        nK = K - tmp
        X1 = X- D*tmp
        X2 = X1 - D
        if nK %2 == 0:
            ans = X1
        else :
            ans = X2
        
elif X < 0:
    tmp = abs(X) // D
    if tmp  >= K:
        ans = X + D*K
    elif tmp < K:
        nK = K - tmp
        X1 = X + D*tmp
        X2 = X1 + D
        if nK %2 == 0:
            ans = X1
        else :
            ans = X2
else:
    if K %2 == 0:
        ans = 0
    else :
        ans = D
print(abs(ans))

Buggy submission (verdict: Runtime Error):
ans = 0

if X > 0:
    tmp = abs(X) % D
    if tmp  >= K:
        ans = X - D*K
    elif tmp < K:
        nK = K - tmp
        X1 = X- D*tmp
        X2 = X1 - D
        if nK %2 == 0:
            ans = X1
        else :
            ans = X2
elif X < 0:
    tmp = abs(X) % D
    if tmp  >= K:
        ans = X + D*K
    elif tmp < K:
        nK = K - tmp
        X1 = X + D*tmp
        X2 = X1 + D
        if nK %2 == 0:
            ans = X1
        else :
            ans = X2
else:
    if K %2 == 0:
        ans = 0
    else :
        ans = D
print(ans)
Problem p02608 (python)

Fixed submission:
N = int(input())
n = 10**4
tmp = [0]*((10**4)+1)
for x in range(1,int(-(-n**0.5//1))+1):
    for y in range(1,x+1):
        for z in range(1, y+1):
            if x*x + y*y + z*z + x*y + y*z + z*x <= 10**4:
                if x == y and y == z and z == x:
                    tmp[x*x + y*y + z*z + x*y + y*z + z*x] +=1
                elif x == y or y == z or z == x:
                    tmp[x*x + y*y + z*z + x*y + y*z + z*x]  += 3
                else:
                    tmp[x*x + y*y + z*z + x*y + y*z + z*x]  += 6
for i in range(1, N+1):
    print(tmp[i])

Buggy submission (verdict: Runtime Error):
N = int(input())
n = 10**4
tmp = [0]*(10**4)
for x in range(1,int(-(-n**0.5//1))+1):
    for y in range(1,x+1):
        for z in range(1, y+1):
            if x*x + y*y + z*z + x*y + y*z + z*x < 10**4:
                if x == y and y == z and z == x:
                    tmp[x*x + y*y + z*z + x*y + y*z + z*x] +=1
                elif x == y or y == z or z == x:
                    tmp[x*x + y*y + z*z + x*y + y*z + z*x]  += 3
                else:
                    tmp[x*x + y*y + z*z + x*y + y*z + z*x]  += 6
for i in range(1, N+1):
    print(tmp[i])

Buggy submission (verdict: Runtime Error):
n = 10**4
tmp = [0]*(10**4)
for x in range(1,int(-(-n**0.5//1))+1):
    for y in range(1,x+1):
        for z in range(1, y+1):
            if x*x + y*y + z*z + x*y + y*z + z*x < 10**4:
                if x == y and y == z and z == x:
                    tmp[x*x + y*y + z*z + x*y + y*z + z*x] +=1
                elif x == y or y == z or z == x:
                    tmp[x*x + y*y + z*z + x*y + y*z + z*x]  += 3
                else:
                    tmp[x*x + y*y + z*z + x*y + y*z + z*x]  += 6
for i in range(1, N+1):
    print(tmp[i])
Problem p02613 (python)

Fixed submission:
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(N):
    S = input()
    if S == "AC":
        ac+=1
    elif S == "WA":
        wa += 1
    elif S== "TLE":
        tle += 1
    elif S == "RE":
        re += 1
print(f'AC x {ac}')
print(f'WA x {wa}')
print(f'TLE x {tle}' )
print(f'RE x {re}')

Buggy submission (verdict: Runtime Error):
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(N):
    S = input()
    if S == AC:
        ac+=1
    elif S == "WA":
        wa += 1
    elif S== "TLE":
        tle += 1
    elif S == "RE":
        re += 1
print(f'AC x {ac}')
print(f'WA x {wa}')
print(f'TLE x {tle}' )
print(f'RE x {re}')

Buggy submission (verdict: Runtime Error):
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(N):
    S = input()
    if S == AC:
        ac+=1
    elif S == "WA":
        wa += 1
    elif S== "TLE":
        tle += 1
    elif S == "RE":
        re += 1
print(f'AC x {ac}'' )
print(f'WA x {wa}'' )
print(f'TLE x {tle}'' )
print(f'RE x {re}'' )

Buggy submission (verdict: Runtime Error):
N = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for i in range(N):
    S = input()
    if S == AC:
        ac+=1
    elif S == "WA":
        wa += 1
    elif S== "TLE"
        tle += 1
    elif S == "RE"
        re += 1
print(f'AC x {ac}'' )
print(f'WA x {wa}'' )
print(f'TLE x {tle}'' )
print(f'RE x {re}'' )
Problem p02621 (python)

Fixed submission:
a = int(input())
print(int(a+a**2+a**3))

Buggy submission (verdict: Runtime Error):
import sympy
N = int(input())
ans = 0
for k in range(1, N+1):
    ans += k*len(sympy.divisors(k))
print(ans)