Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import numpy as np

n,m = map(int,input().split())
l = []
for _ in range(m):
    a = list(map(int,input().split()))
    l.append(a)

memo = np.zeros((n,2))
memo[0][1] = 1

for i in range(n):
    memo[i][0] = 1

tmp1 = 0
tmp2 = 0

for j in range(m):
    tmp1 = l[j][0]-1
    tmp2 = l[j][1]-1
    memo[tmp1][0] -= 1
    memo[tmp2][0] += 1
    
    if memo[tmp2][1] == 0 and memo[tmp1][1] == 1:
        memo[tmp2][1] = 1
    
    if memo[tmp1][1] == 1 and memo[tmp1][0] == 0:
        memo[tmp1][1] = 0

ans = 0
for k in range(n):
    ans += memo[k][1]

print(int(ans))


Fixed submission:
import numpy as np

n,m = map(int,input().split())
l = []
for _ in range(m):
    a = list(map(int,input().split()))
    l.append(a)

memo = np.zeros((n,2))
memo[0][1] = 1

for i in range(n):
    memo[i][0] = 1

tmp1 = 0
tmp2 = 0

for j in range(m):
    tmp1 = l[j][0]-1
    tmp2 = l[j][1]-1
    memo[tmp1][0] -= 1
    memo[tmp2][0] += 1
    
    if memo[tmp2][1] == 0 and memo[tmp1][1] == 1:
        memo[tmp2][1] = 1
    
    if memo[tmp1][1] == 1 and memo[tmp1][0] == 0:
        memo[tmp1][1] = 0

ans = 0
for k in range(n):
    ans += memo[k][1]

print(int(ans))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

acc_a = [0]
for i in range(N):
    acc_a.append(acc_a[i] + A[i])

acc_b = [0]
for i in range(M):
    acc_b.append(acc_b[i] + B[i])

acc_a = numpy.array(acc_a)
acc_b = numpy.array(acc_b)

currentMax = 0
for j in range(M + 1):
    tB = acc_b[j]
    remain = K - tB
    # print('-----------')
    # print('Bを{0}冊読んだら，かかる時間は{1}分, 残り時間は{2}分'.format(j, tB, K - tB))
    if remain < 0:
        # print('時間切れで読める本なし')
        break

    # print(numpy.where(acc_a < remain)[0])
    if len(numpy.where(acc_a < remain)[0]) != 0:
        readable = numpy.where(acc_a <= remain)[0][-1]

        # print('残り時間{0}分で読めるAの本は{1}冊'.format(remain, readable))
        # print('トータル{0}冊読める'.format(j + readable))
        currentMax = max(currentMax, j + readable)

print(currentMax)

Fixed submission:
import numpy

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

acc_a = [0]
for i in range(N):
    acc_a.append(acc_a[i] + A[i])

acc_b = [0]
for i in range(M):
    acc_b.append(acc_b[i] + B[i])

acc_a = numpy.array(acc_a)
acc_b = numpy.array(acc_b)

currentMax = 0
bnum = M
for anum in range(N + 1):
    if acc_a[anum] > K:
        break

    while True:
        if acc_b[bnum] > K - acc_a[anum]:
            bnum = bnum - 1 
        else:
            break

    currentMax = max(currentMax, anum + bnum)


print(currentMax)
Buggy python submission (verdict: Time Limit Exceeded):
from functools import reduce

N = int(input())
A = list(map(int, input().split()))
ans = reduce(lambda x0, x1: x0 * x1, A)
if ans > 10 ** 18:
    ans = -1
print(ans)

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

ans = 1

if 0 in A:
    ans = 0
else:
    for a in A:
        ans *= a
        if ans > 10 ** 18:
            ans = -1
            break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy
import math
L = int(input())
ans = 0
for i in range(L):
    for j in range(L):
        for k in range(L):
            ans += math.gcd(math.gcd(i + 1, j + 1), k + 1)
print(ans)

Fixed submission:
import numpy
import math

L = int(input())
ans = 0
for i in range(L):
    for j in range(L):
        t = math.gcd(i+1, j+1)
        for k in range(L):
            ans += math.gcd(t, k + 1)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy
import math
L = int(input())
print(numpy.sum([math.gcd(math.gcd(i + 1, j + 1), k + 1) for i in range(L) for j in range(L) for k in range(L)]))

Fixed submission:
import numpy
import math

L = int(input())
ans = 0
for i in range(L):
    for j in range(L):
        t = math.gcd(i+1, j+1)
        for k in range(L):
            ans += math.gcd(t, k + 1)
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy

L = int(input())
print(numpy.sum([math.gcd(math.gcd(i + 1, j + 1), k + 1) for i in range(L) for j in range(L) for k in range(L)]))

Fixed submission:
import numpy
import math

L = int(input())
ans = 0
for i in range(L):
    for j in range(L):
        t = math.gcd(i+1, j+1)
        for k in range(L):
            ans += math.gcd(t, k + 1)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())

forward = True

for _ in range(Q):
    query = input().split()

    if query[0] == '1':
        forward = not forward

    else:
        head = (query[1] == '1')

        if head ^ forward:
            S = S + query[2]

        else:
            S = query[2] + S

if forward:
    print(S)
else:
    print(S[::-1])

Fixed submission:
S = input()
Q = int(input())

forward = True
que0 = []
que1 = []

for _ in range(Q):
    query = input().split()

    if query[0] == '1':
        forward = not forward

    else:
        head = (query[1] == '1')
        if head ^ forward:
            que1.append(query[2])
        else:
            que0.append(query[2])

S = ''.join(que0[::-1]) + S + ''.join(que1)

if forward:
    print(S)
else:
    print(S[::-1])

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())

for _ in range(Q):
    query = input().split()

    if query[0] == '1':
        # reverse
        S = S[::-1]

    else:
        # add character

        # at head
        if query[1] == '1':
            S = query[2] + S

        # at tail
        else:
            S = S + query[2]
print(S)

Fixed submission:
S = input()
Q = int(input())

forward = True
que0 = []
que1 = []

for _ in range(Q):
    query = input().split()

    if query[0] == '1':
        forward = not forward

    else:
        head = (query[1] == '1')
        if head ^ forward:
            que1.append(query[2])
        else:
            que0.append(query[2])

S = ''.join(que0[::-1]) + S + ''.join(que1)

if forward:
    print(S)
else:
    print(S[::-1])
Buggy python submission (verdict: Runtime Error):
import numpy
N = int(input())
H = list(map(int, input().split()))
Dif = numpy.array([(H[i] - H[i + 1]) for i in range(N - 1)])
Dif = numpy.append(Dif, -1)
S = list(numpy.where(Dif <= 0)[0])
T = [S[j + 1] - S[j] - 1 for j in range(len(S) - 1)]
print(max(T))

Fixed submission:
import numpy
N = int(input())
H = list(map(int, input().split()))
Dif = numpy.array([(H[i] - H[i + 1]) for i in range(N - 1)])
Dif = numpy.append(Dif, -1)

S = list(numpy.where(Dif < 0)[0])

if len(S) == 0:
    print(0)
else:
    if len(S) == 1:
        print(S[0])
    else:
        T = [S[j + 1] - S[j] - 1 for j in range(len(S) - 1)]
        print(max(T))

Buggy python submission (verdict: Runtime Error):
import numpy
N = int(input())
H = list(map(int, input().split()))
Dif = numpy.array([(H[i] - H[i + 1]) for i in range(N - 1)])
Dif = numpy.append(Dif, -1)
S = list(numpy.where(Dif < 0)[0])
T = [S[j + 1] - S[j] - 1 for j in range(len(S) - 1)]
print(max(T))

Fixed submission:
import numpy
N = int(input())
H = list(map(int, input().split()))
Dif = numpy.array([(H[i] - H[i + 1]) for i in range(N - 1)])
Dif = numpy.append(Dif, -1)

S = list(numpy.where(Dif < 0)[0])

if len(S) == 0:
    print(0)
else:
    if len(S) == 1:
        print(S[0])
    else:
        T = [S[j + 1] - S[j] - 1 for j in range(len(S) - 1)]
        print(max(T))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
print(sum(range(1, N)))

Fixed submission:
N = int(input())
print(N * (N - 1) // 2)

Buggy python submission (verdict: Runtime Error):
print(sum(range(1, N)))

Fixed submission:
N = int(input())
print(N * (N - 1) // 2)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

T = [''.join(sorted(input())) for _ in range(N)]
S = set(T)

ans = 0
for moji in S:
    c = T.count(moji)
    ans += c * (c - 1) // 2

print(ans)

Fixed submission:
N = int(input())

S = [''.join(sorted(input())) for _ in range(N)]

table = {}

ans = 0
for s in S:
    if s in table:
        table[s] += 1
    else:
        table[s] = 1

for k in table:
    ans += table[k] * (table[k] - 1)

ans //= 2
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
h = [int(x) for x in input().split()]

inf = 10 ** 5

Cost = [inf] * N
Cost[0] = 0

for i in range(1, N):
    tmp = [Cost[i - k] + abs(h[i] - h[i - k]) if i - k >= 0 else inf for k in range(1,K + 1)]
    Cost[i] = min(tmp)

print(Cost[-1])

Fixed submission:
N, K = map(int, input().split())
h = [int(x) for x in input().split()]

Cost = [0] * N
Cost[0] = 0

for i in range(1, N):
    tmp = [Cost[k] + abs(h[i] - h[k]) for k in range(max(0, i - K),i)]
    Cost[i] = min(tmp)

print(Cost[-1])
Buggy python submission (verdict: Time Limit Exceeded):
import numpy
S = numpy.array([0 if s == 'B' else 1 for s in input()])

ans = 0
for i in numpy.where(S == 1)[0]:
    ans += numpy.count_nonzero(S[:i] == 0)
print(ans)

Fixed submission:
import numpy
from numpy.core.defchararray import count
S = numpy.array([0 if s == 'B' else 1 for s in input()])

count = 0
bcount = 0

for i, s in enumerate(S):
    if s == 0:
        bcount += 1
    else:
        count += bcount

print(count)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy
S = numpy.array([0 if s == 'B' else 1 for s in input()])
ans = [sum(S[i + 1:]) for i in numpy.where(S == 0)[0]]
print(sum(ans))

Fixed submission:
import numpy
from numpy.core.defchararray import count
S = numpy.array([0 if s == 'B' else 1 for s in input()])

count = 0
bcount = 0

for i, s in enumerate(S):
    if s == 0:
        bcount += 1
    else:
        count += bcount

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy

H, W = map(int,input().split())

board = []

for l in range(H):
    line = list(map(int,input().split()))
    board.append(line)

board = numpy.reshape(board,(H,W))

trajectory = numpy.array([[i, j] if i % 2 == 0 else [i, W - 1 - j] for i in range(H) for j in range(W)])

move = []

for index in range(len(trajectory) - 1):
    i, j = trajectory[index]
    ni, nj = trajectory[index + 1]
    
    if board[i][j] %2 == 1 and index < len(trajectory):
        board[i][j] += -1
        board[ni][nj] += 1
        move.append([i+1,j+1,ni+1,nj+1])
        
print(len(move))
for m in move:
    print(*m)

Fixed submission:
import numpy

H, W = map(int,input().split())
board = [list(map(int,input().split())) for l in range(H)]

board = numpy.reshape(board,(H,W))
cboard = board.copy()

move = []

for i in range(H):
    for j in range(W-1):
        if board[i,j] % 2 == 1:
            board[i,j+1] += 1
            board[i,j] += -1
            move.append([i+1,j+1,i+1,j+2])
            
for i in range(H-1):
    if board[i,W-1] % 2 == 1:
        board[i,W-1] += -1
        board[i+1,W-1] +=1
        move.append([i+1,W,i+2,W])
        
print(len(move))
for m in move:
    print(*m)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy

H, W = map(int,input().split())

board = []

for l in range(H):
    line = list(map(int,input().split()))
    board.append(line)

board = numpy.reshape(board,(H,W))

trajectory = []
for i in range(H):
    for j in range(W):
        if i % 2 == 1:
            trajectory.append([i, W - 1 - j])
        else:
            trajectory.append([i,j])
            
trajectory = numpy.array(trajectory)

move = []

for index in range(len(trajectory) - 1):
    i, j = trajectory[index]
    ni, nj = trajectory[index + 1]
    
    if board[i][j] %2 == 1 and index < len(trajectory):
        board[i][j] += -1
        board[ni][nj] += 1
        move.append([i+1,j+1,ni+1,nj+1])
        
print(len(move))
for m in move:
    print(*m)

Fixed submission:
import numpy

H, W = map(int,input().split())
board = [list(map(int,input().split())) for l in range(H)]

board = numpy.reshape(board,(H,W))
cboard = board.copy()

move = []

for i in range(H):
    for j in range(W-1):
        if board[i,j] % 2 == 1:
            board[i,j+1] += 1
            board[i,j] += -1
            move.append([i+1,j+1,i+1,j+2])
            
for i in range(H-1):
    if board[i,W-1] % 2 == 1:
        board[i,W-1] += -1
        board[i+1,W-1] +=1
        move.append([i+1,W,i+2,W])
        
print(len(move))
for m in move:
    print(*m)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int,input().split())
x = list(map(int,input().split()))

ans = -1

for i in range(N - K + 1):
    px = x[i:i+K]
    xl = px[0]
    xr = px[-1]
    tmp = min(abs(xl),abs(xr)) + xr - xl
    if ans == -1 or tmp < ans:
        ans = tmp
        
print(ans)

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

ans = -1

for i in range(N - K + 1):
    l, r = i, i + K - 1
    xl = x[l]
    xr = x[r]
    tmp = min(abs(xl),abs(xr)) + xr - xl
    if ans == -1 or tmp < ans:
        ans = tmp
        
print(ans)
Buggy python submission (verdict: Runtime Error):
from logging import root
from tokenize import group
import numpy
from pandas.core.resample import f
from regex.regex import U

class UnionFind:
    def __init__(self, N):
        self.N = N

        # the parent of all node is itself
        # self.parent = list(range(N))
        self.parent = [-1] * N

    def root(self, i):
        if self.parent[i] < 0:
            return i

        r = self.root(self.parent[i])
        self.parent[i] = r
        return r

    def unite(self, i, j):
        i = self.root(i)
        j = self.root(j)

        if i == j:
            return

        if i > j:
            i, j = j, i

        self.parent[i] += self.parent[j]
        self.parent[j] = i
        # print(self.parent)

    def same(self, i, j):
        return self.root(i) == self.root(j)

    def size(self, i):
        return -self.parent[self.root(i)]

N, M = map(int, input().split())
p = [int(i) - 1 for i in input().split()]

forest = UnionFind(N)

for _ in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    forest.unite(x, y)

ans = 0
for i in range(N):
    if forest.same(i, p[i]):
        ans += 1

print(ans)


Fixed submission:
class UnionFind:
    def __init__(self, N):
        self.N = N

        # the parent of all node is itself
        # self.parent = list(range(N))
        self.parent = [-1] * N

    def root(self, i):
        if self.parent[i] < 0:
            return i

        r = self.root(self.parent[i])
        self.parent[i] = r
        return r

    def unite(self, i, j):
        i = self.root(i)
        j = self.root(j)

        if i == j:
            return

        if i > j:
            i, j = j, i

        self.parent[i] += self.parent[j]
        self.parent[j] = i
        # print(self.parent)

    def same(self, i, j):
        return self.root(i) == self.root(j)

    def size(self, i):
        return -self.parent[self.root(i)]

N, M = map(int, input().split())
p = [int(i) - 1 for i in input().split()]

forest = UnionFind(N)

for _ in range(M):
    x, y = map(int, input().split())
    x -= 1
    y -= 1
    forest.unite(x, y)

ans = 0
for i in range(N):
    if forest.same(i, p[i]):
        ans += 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy

N = int(input())
p = [int(x) for x in input().split()]
p = [0] + p + [0]

for i in range(1, N + 1):
    q = p[:i] + p[i+1:]
    print(numpy.sum(numpy.abs(numpy.diff(q))))

Fixed submission:
import numpy

N = int(input())
p = [int(x) for x in input().split()]
p = [0] + p + [0]

S = numpy.sum(numpy.abs(numpy.diff(p)))

for i in range(1, N + 1):
    print(S - numpy.abs(p[i] - p[i - 1]) - numpy.abs(p[i + 1] - p[i]) + numpy.abs(p[i + 1] - p[i - 1]))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy
N, M = map(int, input().split())
ship = numpy.array([list(map(int, input().split())) for _ in range(M)])

ans = 'IMPOSSIBLE'
for s1 in ship[ship.T[0] == 1]:
    for s2 in ship[ship.T[0] == s1[1]]:
        if s2[1] == N:
            ans = 'POSSIBLE'
            break

print(ans)

Fixed submission:
N, M = map(int, input().split())
ship = [list(map(int, input().split())) for _ in range(M)]

s1 = [False] * N
sN = [False] * N

for i, s in enumerate(ship):
    if s[0] == 1:
        s1[s[1] - 1] = True

    if s[1] == N:
        sN[s[0] - 1] = True

ans = 'IMPOSSIBLE'
if any([p1 * pN for p1, pN in zip(s1, sN)]):
    ans = 'POSSIBLE'

print(ans)
Buggy python submission (verdict: Runtime Error):
x=int(input())
if(x==1):
  print("0")
 elif(x==0):
  print("1")
 else:
  pass

Fixed submission:
x=int(input())
if(x==1):
  
  print("0")
elif(x==0):
  
  print("1")
else:
  
  pass

Buggy python submission (verdict: Runtime Error):
x=int(input())
if(x==1):
  print("0")
 elif(x==0):
  
  print("1")
 else:
  pass

Fixed submission:
x=int(input())
if(x==1):
  
  print("0")
elif(x==0):
  
  print("1")
else:
  
  pass
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
ans = 0
for i in range (N):
 tasizann = 0
 for j in range (N-i-1):
  tasizann = tasizann + A[i+j+1]
  tasizann = tasizann % (10**9 + 7)
 S = A[i] * tasizann
 S = S % (10**9 + 7)
 ans = ans + S
ans = ans % (10**9 + 7)
print (ans)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
tasizann = 0
for i in range (N):
 tasizann = tasizann + A[i]
nijou = tasizann**2
nijouwa = 0
for i in range (N):
 nijouwa =nijouwa + A[i]**2
ans = (nijou - nijouwa)//2
ans = ans % (10**9+7)
print (ans)
Buggy python submission (verdict: Runtime Error):
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
min = 0
i = 0
j = 0
while min <= K:
	if (i < N) or (j < M):
		if (i < N) and (j < M):
			if A[i]<=B[j]:
				min = min+A[i]
				i = i+1
				ans = ans+1
			else:
				min = min+B[j]
				j = j+1
				ans = ans+1
		elif (i == N):
				min = min+B[j]
				j = j+1
				ans = ans+1
		else:
				min = min+A[i]
				i = i+1
				ans = ans+1
	else:
		ans = ans+1
		break
ans = ans-1
print(ans)

Fixed submission:
a = int(input())
print(a+a*a+a*a*a)
Buggy python submission (verdict: Time Limit Exceeded):
import sys,io,os
I = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
#I = input

n,m = map(int, I().split())
p=[-1]*(n+1)
s=[0]*(n+1)
S=n-1
def t(a):
	while p[a] != -1:
		a = p[a]
	return a
for _ in range(m):
	a,b=map(int, I().split())
	a,b = t(a), t(b)
	if a != b:
		S -= 1
		if s[a] > s[b]:
			a,b = b,a
		p[a] = b
		s[b] += s[a]
print(S)



Fixed submission:
import sys,io,os
I = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
#I = input

n,m = map(int, I().split())
p=[-1]*(n+1)
s=[0]*(n+1)
S=n-1
def t(a):
	b = a
	while p[b] != -1:
		b = p[b]
	while p[a] != -1:
		p[a],a = b,p[a]
	return a
for _ in range(m):
	a,b=map(int, I().split())
	a,b = t(a), t(b)
	if a != b:
		S -= 1
		if s[a] > s[b]:
			a,b = b,a
		p[a] = b
		s[b] += s[a]
print(S)

Buggy python submission (verdict: Runtime Error):
import sys,io,os
I = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
I = input

n,m = map(int, I().split())
p=[-1]*(n+1)
s=[0]*(n+1)
S=n-1
def t(a):
	while p[a] != -1:
		a = p[a]
	return a
for _ in range(m):
	a,b=map(int, I().split())
	a,b = t(a), t(b)
	if a != b:
		S -= 1
		if s[a] > s[b]:
			a,b = b,a
		p[a] = b
		s[b] += s[a]
print(S)



Fixed submission:
import sys,io,os
I = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
#I = input

n,m = map(int, I().split())
p=[-1]*(n+1)
s=[0]*(n+1)
S=n-1
def t(a):
	b = a
	while p[b] != -1:
		b = p[b]
	while p[a] != -1:
		p[a],a = b,p[a]
	return a
for _ in range(m):
	a,b=map(int, I().split())
	a,b = t(a), t(b)
	if a != b:
		S -= 1
		if s[a] > s[b]:
			a,b = b,a
		p[a] = b
		s[b] += s[a]
print(S)
Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())
a=[]
count=1
if k%2==0:
    print(-1)
else:
    ai=7%k
    while 1:
        if ai==0:
            print(count)
            break
        elif ai in a:
            print(-1)
            break
        else:
            a.append(ai)
            ai=(ai*10+7)%k
            count+=1




Fixed submission:
#正答
k=int(input())
a=set()
count=1
if k%2==0:
    print(-1)
else:
    #下の桁に７を足していく
    ai=7%k
    while 1:
        if ai==0:
            print(count)
            break
        elif ai in a:
            print(-1)
            break
        else:
            a.add(ai)
            ai=(ai*10+7)%k
            count+=1

Buggy python submission (verdict: Runtime Error):
#c
k=int(input())
if k%7==0:
    k/=7
if k%2==0:
    ans=-1
else:
    x=1
    ans=-1
    plus=10
    for i in range(1,10000000):
        if x%k==0:
            ans=i
            break
        else:
            x+=plus
            plus*=10
print(ans)

Fixed submission:
#正答
k=int(input())
a=set()
count=1
if k%2==0:
    print(-1)
else:
    #下の桁に７を足していく
    ai=7%k
    while 1:
        if ai==0:
            print(count)
            break
        elif ai in a:
            print(-1)
            break
        else:
            a.add(ai)
            ai=(ai*10+7)%k
            count+=1
Buggy python submission (verdict: Runtime Error):
#c
n=int(input())
import math
nn=int(math.sqrt(n))+1
a=[0]*(8*n)
for x in range(1,nn+1):
    for y in range(1,nn+1):
        for z in range(1,nn+1):
            a[(x+y+z)**2-x*y-x*z-y*z]+=1
for i in range(1,n+1):
    print(a[i])

Fixed submission:
n=int(input())
import math
nn=int(math.sqrt(n))+1
a=[0]*(100*n)
for x in range(1,nn+1):
    for y in range(1,nn+1):
        for z in range(1,nn+1):
            a[(x+y+z)**2-x*y-x*z-y*z]+=1
for i in range(1,n+1):
    print(a[i])
Buggy python submission (verdict: Runtime Error):
h,w,k=map(int,input().split())
c=[]
#行ごと
hk=[]
for i in range(h):
    kki=0
    hwi=list(map(str,input().split()))
    hw=[]
    for j in range(w):
        if hwi[j]=='#':
            hw.append(1)
            kki+=1
        else:
            hw.append(0)
    c.append(hw)
    hk.append(kki)
kk=sum(hk)
ans=0
#残す行を選ぶ
for i in range(2**h):
    #列ごと
    wk=[0]
    wk*=w
    for j in range(h):
        if (i>>j &1):
            #残った行の列ごとの和
            for l in range(w):
                wk[l]+=c[j][l]
    #残す列を選ぶ
    for j in range(2**w):
        ansi=0
        for l in range(w):
            if (j>>l & 1):
                ansi+=wk[l]
        if ansi==k:
            ans+=1
    
print(ans)

Fixed submission:
h,w,k=map(int,input().split())
c=[]
#行ごと
hk=[]
for i in range(h):
    kki=0
    hwi=input()
    hw=[]
    for j in range(w):
        if hwi[j]=='#':
            hw.append(1)
            kki+=1
        else:
            hw.append(0)
    c.append(hw)
    hk.append(kki)
kk=sum(hk)
ans=0
#残す行を選ぶ
for i in range(2**h):
    #列ごと
    wk=[0]
    wk*=w
    for j in range(h):
        if (i>>j &1):
            #残った行の列ごとの和
            for l in range(w):
                wk[l]+=c[j][l]
    #残す列を選ぶ
    for j in range(2**w):
        ansi=0
        for l in range(w):
            if (j>>l & 1):
                ansi+=wk[l]
        if ansi==k:
            ans+=1
    
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
import math
nn=int(n/2)
a=[3,2]
a*=(n+1)
a[1]-=1
a[2]-=1
for i in range(3,nn+1):
    t=i+i
    while t<=n:
        a[t]+=1
        t+=i
ans=0
for i in range(1,n+1):
    ans+=a[i]*i

print(ans)

Fixed submission:
n=int(input())
ans=0
for i in range(1,n+1):
    m=n//i
    ans+=m*i*(m+1)/2
    
print(int(ans))
Buggy python submission (verdict: Runtime Error):
n=int(input())
a=[]
while n>0:
    b=n%26
    if b==0:
        b=26
        t=1
    c=lambda b:chr(b+64)
    a.append(c(b))
    n//=26
    if t==1:
        n-=1
        t=0
d=len(a)
e=[]
for i in range(d):
    e.append(a[-1-i])
ans=''.join(e)
ans=ans.lower()
print(ans)

Fixed submission:
n=int(input())
a=[]
t=0
while n>0:
    b=n%26
    if b==0:
        b=26
        t=1
    c=lambda b:chr(b+64)
    a.append(c(b))
    n//=26
    if t==1:
        n-=1
        t=0
d=len(a)
e=[]
for i in range(d):
    e.append(a[-1-i])
ans=''.join(e)
ans=ans.lower()
print(ans)