Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s); sys.stdout.write('\n')
def wi(n): sys.stdout.write(str(n)); sys.stdout.write('\n')
def wia(a, sep=' '): sys.stdout.write(sep.join([str(x) for x in a])); sys.stdout.write('\n')


MOD = 10**9 + 7


def solve(n, k, a):
    a = sorted(a, reverse=True, key=lambda x: (abs(x), 1 if x >= 0 else -1))
    sign = 1
    for i in range(k):
        if a[i] < 0:
            sign = -sign
        if a[i] == 0:
            sign = 0

    if sign == 0:
        return 0

    if sign == 1:
        ans = 1
        for i in range(k):
            ans = (ans * abs(a[i])) % MOD
        return ans

    if sign == -1:
        cc = []

        more_neg = -1
        for i in range(k, n):
            if a[i] < 0:
                more_neg = i
                break

        more_pos = -1
        for i in range(k, n):
            if a[i] > 0:
                more_pos = i
                break

        taken_neg = -1
        for i in range(k-1, -1, -1):
            if a[i] < 0:
                taken_neg = i
                break

        taken_pos = -1
        for i in range(k - 1, -1, -1):
            if a[i] > 0:
                taken_pos = i
                break

        if more_neg >= 0 and taken_pos >= 0:
            cc.append((taken_pos, more_neg))
        if more_pos >= 0 and taken_neg >= 0:
            cc.append((taken_neg, more_pos))
        if len(cc) == 2 and cc[0][1] * cc[1][0] < cc[1][1] * cc[0][0]:
            cc[0], cc[1] = cc[1], cc[0]

        # cc = sorted(cc, key=lambda x: abs(a[x[1]] / a[x[0]]), reverse=True)

        if len(cc) > 0:
            ans = 1
            for i in range(k):
                if i != cc[0][0]:
                    ans = (ans * a[i]) % MOD
            ans = (ans * a[cc[0][1]]) % MOD
            return ans
        else:
            # product is negative, taking smallest
            ans = 1
            for i in range(k):
                ans = (ans * a[n-i-1]) % MOD
            return ans


import random


def gen():
    for n in range(2, 100):
        for k in range(2, n):
            for t in range(100):
                a = [random.randrange(100) - 100 for _ in range(n)]
                solve(n, k, a)
        wi(n)


def main():
    # gen()
    # return
    n, k = ria()
    a = ria()
    wi(solve(n, k, a))


if __name__ == '__main__':
    main()


Fixed submission:
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s); sys.stdout.write('\n')
def wi(n): sys.stdout.write(str(n)); sys.stdout.write('\n')
def wia(a, sep=' '): sys.stdout.write(sep.join([str(x) for x in a])); sys.stdout.write('\n')


def solve(n):
    k = n // 1000
    if n % 1000 > 0:
        k += 1
    return k * 1000 - n


def main():
    n = ri()
    wi(solve(n))


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s + '\n')
def wi(n): sys.stdout.write(str(n) + '\n')
def wia(a): sys.stdout.write(' '.join([str(x) for x in a]) + '\n')


def main():
    a, v = ria()
    b, w = ria()
    t = ri()

    if a == b:
        ws('YES')

    if v > w and a != b:
        ws('NO')

    tt = (a - b) / (w - v)
    if tt <= t:
        ws('YES')
    else:
        ws('NO')


if __name__ == '__main__':
    main()


Fixed submission:
import sys
def rs(): return sys.stdin.readline().rstrip()
def ri(): return int(sys.stdin.readline())
def ria(): return list(map(int, sys.stdin.readline().split()))
def ws(s): sys.stdout.write(s + '\n')
def wi(n): sys.stdout.write(str(n) + '\n')
def wia(a): sys.stdout.write(' '.join([str(x) for x in a]) + '\n')


def main():
    a, v = ria()
    b, w = ria()
    t = ri()

    if a == b:
        ws('YES')
        return

    if v <= w:
        ws('NO')
        return

    tt = abs(b - a) / (v - w)
    if tt <= t:
        ws('YES')
    else:
        ws('NO')


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
a,b = mao(int,input().split())
print(a*b)

Fixed submission:
a,b = map(int,input().split())
print(a*b)
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
g=math.gcd(2,n)
print((n*2)//g)

Fixed submission:
n=int(input())
if n%2!=0:
    print(n*2)
else:
    print(n)

Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
g=math.gcd(2,n)
print((n*2)//g)

Fixed submission:
n=int(input())
if n%2!=0:
    print(n*2)
else:
    print(n)
Buggy python submission (verdict: Runtime Error):
n=int(input())
ans=n
s=0
while n!=0:
    a=n%10
    s+=a
    n=n//10
if ans%s==0:
    print("Yes")
else:
    print("No")

Fixed submission:
n=input()
ans=0
for i in range(0,len(n)):
    if n[i]=='+':
        ans+=1
    else:
        ans-=1
print(ans)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())

top = b // c
if a%c == 0:
  bottom = a//c - 1
else:
  bottom = a//c

print(top-bottom)

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

top = b // c
if a%c == 0:
  bottom = a//c - 1
else:
  bottom = a//c

print(top-bottom)

Buggy python submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
a = int(input())
b = int(input())
c = int(input())

print(a//c - b//c)


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

top = b // c
if a%c == 0:
  bottom = a//c - 1
else:
  bottom = a//c

print(top-bottom)
Buggy python submission (verdict: Runtime Error):
a,b,c,k=map(int,input().split())
B=0
if a+b>=k:
	print(a+(k-a)*b)
else:
	print((a+B)-1*(k-a-b))

Fixed submission:
a=str(input())
b=str(input())
if a==b[0:-1]:
	print('Yes')
else:
	print('No')
Buggy python submission (verdict: Runtime Error):
s=str(input())
if s[1]==B:
	print('ARC')
else:
	print('ABC')

Fixed submission:
s=str(input())
if s[1]=='B':
	print('ARC')
else:
	print('ABC')
Buggy python submission (verdict: Runtime Error):
k=int(input())
a,b=map(input().split())
for i in range(a<b):
	if range(a<b)%k==0:
		print('OK')
    else:
    	print('NG')


Fixed submission:
k=int(input())
a,b=map(int,input().split())
for i in range(a,b+1):
  if i % k == 0:
    print('OK')
    break
else:
  print('NG')
Buggy python submission (verdict: Runtime Error):
s=input()
if s[4] == s[5] and s[6] == s[7]:
  print('Yes')
else:
  print('No')

Fixed submission:
s=input()
if s[2] == s[3] and s[4] == s[5]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(input())
count=0
for i in range(n):
  if s[i]== 'A':
    if (s[i+1]) =='B':
      if (s[i+2])=='C':
        count+=1
print(count)   
    


Fixed submission:
n=int(input())
s=list(input())
count=0
for i in range(n-2):
  if s[i]== 'A':
    if (s[i+1]) =='B':
      if (s[i+2])=='C':
        count+=1
print(count)

Buggy python submission (verdict: Runtime Error):
n=int(input())
s=list(input())
count=0
for i in range(n):
  if s[i]== 'A':
    if (s[i+1]) =='B':
      if (s[i+2])=='C':
        count+=1
print(count)



    
  
    
    

Fixed submission:
n=int(input())
s=list(input())
count=0
for i in range(n-2):
  if s[i]== 'A':
    if (s[i+1]) =='B':
      if (s[i+2])=='C':
        count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
a=int(input())
if x < 1200:
    print('ABC')
else:
    print('ARC')

Fixed submission:
x = int(input())
if x < 1200:
    print('ABC')
else:
    print('ARC')
Buggy python submission (verdict: Runtime Error):
answer = raw_input()
if len(answer) == 2:
    print(answer)
else:
    print(answer[2] + answer[1] + answer[0])

Fixed submission:
answer = input().strip()
if len(answer) == 2:
    print(answer)
else:
    print(answer[2] + answer[1] + answer[0])
Buggy python submission (verdict: Time Limit Exceeded):
input_n = input()
N = int(input_n)

check_list = ['AC', 'WA', 'TLE', 'RE']
count_list = [0, 0, 0, 0]

for i in range(N):
    flag = 0
    Si = input()
    while flag<4:
        if Si==check_list[flag]:
            count_list[flag] += 1
        else:
            flag += 1

print('AC  x  '+count_list[0])
print('WA  x  '+count_list[1])
print('TLE  x  '+count_list[2])
print('RE  x  '+count_list[3])

Fixed submission:
input_n = input()
N = int(input_n)

# S_list = [input() for i in range(N)]
check_list = ['AC', 'WA', 'TLE', 'RE']
count_list = [0, 0, 0, 0]

for i in range(N):
    flag = 0
    S = input()
    while flag<4:
        if S==check_list[flag]:
            count_list[flag] += 1
            break;
        else:
            flag += 1

print('AC  x  '+ str(count_list[0]))
print('WA  x  '+ str(count_list[1]))
print('TLE  x  '+ str(count_list[2]))
print('RE  x  '+ str(count_list[3]))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
in_list = input().split
vote_list = [int(i) for i in in_list]

ans = 0
for ai in vote_list:
    if ai >= 1/(4*m)*sum(vote_list):
        ans += 1

if ans < m :
    print('no')
else:
    print('yes')

Fixed submission:
n, m = map(int, input().split())
in_list = input().split()
vote_list = [int(i) for i in in_list]

ans = 0
for ai in vote_list:
    if ai >= 1/(4*m)*sum(vote_list):
        ans += 1

if ans < m :
    print('No')
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
x = input()

print(x//500 + x%500//5*5)

Fixed submission:
X = int(input())

syou = int(X/500)
syou_second = int((X - syou*500)/5)
ans = syou*1000 + syou_second*5
print(ans)
Buggy python submission (verdict: Runtime Error):
if int(input()) < 1000 :
  print("ABC")
elif 1000 <= int(input()) <1999 :
  print("ABD")

Fixed submission:
N = int(input())

if N < 1000:
  print("ABC")
elif N >= 1000 and N < 1999:
  print("ABD")
Buggy python submission (verdict: Runtime Error):
input_list = input().split(' ')
a = int(input_list[0])
b = int(input_list[0])

N = a*b

if N%2==0:
    print('Even')
else:
    print('Odd')

return 0

Fixed submission:
in_list = input().split()
a = int(in_list[0])
b = int(in_list[1])

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

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

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

Fixed submission:
in_list = input().split()
a = int(in_list[0])
b = int(in_list[1])

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

marker = True
count = 0

while(marker):
    for i in range(N):
        num = int(input[i])
        if num%2==1:
            marker = False
            count -= 1
            break;
        else:  
            input[i] = num/2 
    count += 1
print(count)

Fixed submission:

# ABC-081_A-Placing Marbles

in_list = list(input())
count = 0
# print("in_list:",in_list)
 
for string in in_list:
    if int(string)== 1:
        count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
n, a, b = map(int, raw_input().split())

minN = 0
maxN = 0

if (a + b < n):
    minN = 0
else:
    minN = (a + b) - n
maxN = min(a, b)
    
print(str(maxN) + " " + str(minN))

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

minN = 0
maxN = 0

if (a + b < n):
    minN = 0
else:
    minN = (a + b) - n
maxN = min(a, b)
    
print(str(maxN) + " " + str(minN))
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()))
t = 0
n = 0
a = 0
b = 0
 
while K > t :
    if a < N and b < M :
        if A[a] <= B[b] :
            t += A[a]
            n += 1
            a += 1
            if K < t :
                n -=1
                break
 
        else :
            t +=B[b]
            n += 1
            b += 1
            if K < t :
                n -=1
                break
    
    elif a == N :
        while b < M :
            t += B[b]
            n += 1
            b += 1
            if K < t :
                n -=1
                break
        
        else :
            break
 
    else :
        while a < N :
            t += A[a]
            n += 1
            a += 1
            if K < t :
                n -=1
                break
 
print(n)

Fixed submission:
a = int(input())
 
print(a + a**2 + a**3)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

n = 1

for a in range len(S)

if S[a] = T[a] :
    n += 1

return n

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

n = 0

for a in range(len(S)) :

    if not S[a] == T[a] :
        n += 1

print(n)
Buggy python submission (verdict: Runtime Error):
P = []
S = []
for i in range(2):
    pp, ss  = map(int, input().split())
    P.append(pp)
    S.append(ss)

A = P[0]
V = S[0]
B = P[1]
W = S[1]
T = int(input())


def run():
	if A < B:
		c = (B + V*T) - (A + W*T)
		if c <= 0 :
			return 'YES'
		else :
			return 'NO'
	elif A > B:
		c = (B - V*T) - (A - W*T) 
		if c >= 0 :
			return 'YES'
		else :
			return 'NO'
	else :
		return 'YES'
print(run())

Fixed submission:
a = input()
nickname = a[0:3]
print(nickname)

Buggy python submission (verdict: Runtime Error):
P = []
S = []
for i in range(2):
    pp, ss  = map(int, input().split())
    P.append(pp)
    S.append(ss)

A = P[0]
V = S[0]
B = P[1]
W = S[1]
T = int(input())

print(A)
print(V)
print(B)
print(W)
print(T)

def run():
	if A < B:
		c = (B + V*T) - (A + W*T)
		if c <= 0 :
			return 'YES'
		else :
			return 'NO'
	elif A > B:
		c = (A - W*T) - (B - V*T)
		if c <= 0 :
			return 'YES'
		else :
			return 'NO'
	else :
		return 'YES'
print(run())

Fixed submission:
a = input()
nickname = a[0:3]
print(nickname)

Buggy python submission (verdict: Runtime Error):
P = []
S = []
for i in range(2):
    pp, ss  = map(int, input().split())
    P.append(pp)
    S.append(ss)

A = P[0]
V = P[1]
B = S[0]
W = S[1]
T = int(input())

def run():
	if A < B:
		c = (B + V*T) - (A + W*T)
		if c <= 0 :
			return 'YES'
		else :
			return 'NO'
	elif A > B:
		c = (A - W*T) - (B - V*T)
		if c <= 0 :
			return 'YES'
		else :
			return 'NO'
	else :
		return 'YES'
print(run())

Fixed submission:
a = input()
nickname = a[0:3]
print(nickname)
Buggy python submission (verdict: Runtime Error):
P = []
S = []
for i in range(2):
    pp, ss  = map(int, input().split())
    P.append(pp)
    S.append(ss)

A = P[0]
V = S[0]
B = P[1]
W = S[1]
T = int(input())

def run():
	if A < B:
		c = (B + W*T) - (A + V*T)
		if c <= 0 :
			return 'YES'
		else :
			return 'NO'
	elif A > B:
		c =  (A - V*T) - (B - W*T)
		if c <= 0 :
			return 'YES'
		else :
			return 'NO'
    else :
        return 'YES'
print(run())

Fixed submission:
P = []
S = []
for i in range(2):
    pp, ss  = map(int, input().split())
    P.append(pp)
    S.append(ss)

A = P[0]
V = S[0]
B = P[1]
W = S[1]
T = int(input())

def run():
	if A < B:
		c = (B + W*T) - (A + V*T)
		if c <= 0 :
			return 'YES'
		else :
			return 'NO'
	elif A > B:
		c =  (A - V*T) - (B - W*T)
		if c <= 0 :
			return 'YES'
		else :
			return 'NO'
	else :
		return 'YES'
print(run())

Buggy python submission (verdict: Runtime Error):
P = []
S = []
T = []
 for i in range(N):
    pp, ss, t  = map(int, input().split())
    P.append(pp)
    S.append(ss)
    T.append(t)

A = P[0]
V = P[1]
B = S[0]
W = S[1]
T = T[0]

def run():
    if A < B:
        c = (B + V*T) - (A + W*T)
        if c =< 0 :
            return 'YES'
        else :
            return 'NO'
    else:
        c =  (B - V*T) - (A - W*T)
            if c >= 0 :
                return 'YES'
            else :
                return 'NO'

Fixed submission:
P = []
S = []
for i in range(2):
    pp, ss  = map(int, input().split())
    P.append(pp)
    S.append(ss)

A = P[0]
V = S[0]
B = P[1]
W = S[1]
T = int(input())

def run():
	if A < B:
		c = (B + W*T) - (A + V*T)
		if c <= 0 :
			return 'YES'
		else :
			return 'NO'
	elif A > B:
		c =  (A - V*T) - (B - W*T)
		if c <= 0 :
			return 'YES'
		else :
			return 'NO'
	else :
		return 'YES'
print(run())
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input())

print(a*b)

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

print(a*b)
Buggy python submission (verdict: Runtime Error):
s = int(input())
t = input()

if len(t) <= s:
  print(t)
  
else :
  tt =  t[0:s]
  print(tt + "...")

Fixed submission:
a=input()

if int(a)%10 == 3:
	print("bon")
  
elif int(a)%10 == 0:
	print("pon")
    
elif int(a)%10 == 1:
	print("pon")

elif int(a)%10 == 6:
	print("pon")
    
elif int(a)%10 == 8:
	print("pon")    
    
else:
	print("hon")

Buggy python submission (verdict: Runtime Error):
s = int(input())
t = input()

if len(t) <= s:
  print(t)
  
else :
  tt =  t[0:s]
  print(tt + "...")

Fixed submission:
a=input()

if int(a)%10 == 3:
	print("bon")
  
elif int(a)%10 == 0:
	print("pon")
    
elif int(a)%10 == 1:
	print("pon")

elif int(a)%10 == 6:
	print("pon")
    
elif int(a)%10 == 8:
	print("pon")    
    
else:
	print("hon")

Buggy python submission (verdict: Runtime Error):
s = int(input())
t = input()

if len(t) < s:
  print(t)
  
else :
  tt =  t[0:s]
  print(tt + "...")

Fixed submission:
a=input()

if int(a)%10 == 3:
	print("bon")
  
elif int(a)%10 == 0:
	print("pon")
    
elif int(a)%10 == 1:
	print("pon")

elif int(a)%10 == 6:
	print("pon")
    
elif int(a)%10 == 8:
	print("pon")    
    
else:
	print("hon")

Buggy python submission (verdict: Runtime Error):
if int(input())%10 == 3:
	print("bon")
  
elif int(input())%10 == 0 or int(input())%10 == 1 or int(input())%10 == 6 or int(input())%10 == 8:
	print("pon")
 
else:
	print("hon")

Fixed submission:
a=input()

if int(a)%10 == 3:
	print("bon")
  
elif int(a)%10 == 0:
	print("pon")
    
elif int(a)%10 == 1:
	print("pon")

elif int(a)%10 == 6:
	print("pon")
    
elif int(a)%10 == 8:
	print("pon")    
    
else:
	print("hon")

Buggy python submission (verdict: Runtime Error):
if int(input())%10 == 3:
	print("bon")
  
elif int(input())%10 == 0 or1 or 6 or 8:
	print("pon")
 
else:
	print("hon")

Fixed submission:
a=input()

if int(a)%10 == 3:
	print("bon")
  
elif int(a)%10 == 0:
	print("pon")
    
elif int(a)%10 == 1:
	print("pon")

elif int(a)%10 == 6:
	print("pon")
    
elif int(a)%10 == 8:
	print("pon")    
    
else:
	print("hon")

Buggy python submission (verdict: Runtime Error):
if int(input())%10 == 3:
	print("bon")
  
elif int(input())%10 == 0 or int(input())%10 == 1 or int(input())%10 == 6 or int(input())%10 == 8:
	print("pon")
 
else:
	print("hon")

Fixed submission:
a=input()

if int(a)%10 == 3:
	print("bon")
  
elif int(a)%10 == 0:
	print("pon")
    
elif int(a)%10 == 1:
	print("pon")

elif int(a)%10 == 6:
	print("pon")
    
elif int(a)%10 == 8:
	print("pon")    
    
else:
	print("hon")
Buggy python submission (verdict: Runtime Error):
s = int(input())
t = input()

if len(t) =< s:
  print(t)
  
else :
  tt =  t[0:s]
  print(tt + "...")

Fixed submission:
s = int(input())
t = input()

if len(t) <= s:
  print(t)
  
else :
  tt =  t[0:s]
  print(tt + "...")

Buggy python submission (verdict: Runtime Error):
s = int(input())
t = input()

if len(t) =< s:
  print(t)
  
else :
  tt =  t[0:s]
  print(tt + "...")

Fixed submission:
s = int(input())
t = input()

if len(t) <= s:
  print(t)
  
else :
  tt =  t[0:s]
  print(tt + "...")
Buggy python submission (verdict: Runtime Error):
import math

def f(x, y, z):
  return(x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x)

n = int(input())
fs = [0] * n

lim = math.floor(math.sqrt(n))
rng = range(2, lim)

for(x in rng):
  for(y in rng):
    for(z in rng):
      v = f(x, y, z)
      if v <= n:
      	fs[v - 1] += 1
      
for(i in range(n)):
  print(fs[i])


Fixed submission:
import math

def f(x, y, z):
  return(x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x)

n = int(input())
fs = [0] * n

lim = math.floor(math.sqrt(n))
rng = range(1, lim)

for x in rng:
  for y in rng:
    for z in rng:
      v = f(x, y, z)
      if v <= n:
      	fs[v - 1] += 1
      
for i in range(n):
  print(fs[i])

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

def f(x, y, z):
  return(x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x)

n = int(input())
fs = [0] * n

lim = math.floor(math.sqrt(n))
rng = range(2, lim)

for(x in rng):
  for(y in rng):
    for(z in rng):
      fs[f(x, y, z) - 1] += 1
      
for(i in range(n)):
  print(fs[i])

Fixed submission:
import math

def f(x, y, z):
  return(x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x)

n = int(input())
fs = [0] * n

lim = math.floor(math.sqrt(n))
rng = range(1, lim)

for x in rng:
  for y in rng:
    for z in rng:
      v = f(x, y, z)
      if v <= n:
      	fs[v - 1] += 1
      
for i in range(n):
  print(fs[i])

Buggy python submission (verdict: Runtime Error):
def g(x, y, z):
  return x * x + y * y + z * z + x * y + y * z + z * x
  
def f(n):
  if(n < 6):
    return 0
  
  sum = 0
  lim = math.floor(math.sqrt(n)) + 1
  for x in range(1, lim, 1):
    for y in range(1, lim, 1):
      for z in range(1, lim, 1):
        a = g(x, y, z)
        if a > n:
          break
        if a == n:
          sum += 1
  return sum

for i in range(n + 1):
  print(f(i))

Fixed submission:
import math

def f(x, y, z):
  return(x ** 2 + y ** 2 + z ** 2 + x * y + y * z + z * x)

n = int(input())
fs = [0] * n

lim = math.floor(math.sqrt(n))
rng = range(1, lim)

for x in rng:
  for y in rng:
    for z in rng:
      v = f(x, y, z)
      if v <= n:
      	fs[v - 1] += 1
      
for i in range(n):
  print(fs[i])
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
q = int(input())

dp = [0] *( 10 ** 5)

bc = [input() for _ in range(q)]

for ai in a:
  dp[ai] += 1
ans = 0
for i in range(1,len(dp)):
  ans += dp[i] * i
  
for bci in bc:
  b,c = map(int,bci.split())
  ans += (dp[b] * c) -(dp[b] * b)
  print(ans)
  dp[c] += dp[b] 
  dp[b] = 0
  



Fixed submission:
n = int(input())
a = list(map(int,input().split()))
q = int(input())

dp = [0] *( 10 ** 5 +10)

bc = [input() for _ in range(q)]

for ai in a:
  dp[ai] += 1
ans = 0
for i in range(1,len(dp)):
  ans += dp[i] * i
  
for bci in bc:
  b,c = map(int,bci.split())
  ans += (dp[b] * c) -(dp[b] * b)
  print(ans)
  dp[c] += dp[b] 
  dp[b] = 0
Buggy python submission (verdict: Runtime Error):
ab = input()
a = int(input.split()[0])
b = float(input.split()[1])
print(int(a*b))

Fixed submission:
from decimal import Decimal

a,b = map(Decimal,input().split())

print(int(a*b))
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

n,m,q = map(int,input().split())

abcd = [input() for _ in range(q)]

x = itertools.combinations_with_replacement(range(1,m+1),n)
tmp = 0
ans = 0
for xi in x:
  tmp = 0

  for i in abcd:
    a,b,c,d = map(int,i.split())
    if xi[b-1] - xi[a-1] == c:
      tmp += d
  ans = max(ans,tmp)

print(ans)

Fixed submission:
import itertools

n,m,q = map(int,input().split())

a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q

for i in range(q):
  a1,b1,c1,d1 = map(int,input().split())
  a[i] = a1
  b[i] = b1
  c[i] = c1
  d[i] = d1

x = itertools.combinations_with_replacement(range(1,m+1),n)
tmp = 0
ans = 0
for xi in x:
  tmp = 0

  for i in range(q):
    if xi[b[i]-1] - xi[a[i]-1] == c[i]:
      tmp += d[i]
  ans = max(ans,tmp)

print(ans)

Buggy python submission (verdict: Runtime Error):
#import itertools

n,m,q = map(int,input().split())

abcd = [input() for _ in range(q)]

#x = itertools.product(range(1,m+1),repeat=n)
x = []
for i in range(1,m+1):
  for j in range(i,m+1):
    for k in range(j, m+1):
      for l in range(k,m+1):
        x.append([i,j,k,l])
tmp = 0
ans = 0
for xi in x:
  tmp = 0
  for i in abcd:
    a,b,c,d = map(int,i.split())
    if xi[b-1] - xi[a-1] == c:
      tmp += d
  ans = max(ans,tmp)

print(ans)

Fixed submission:
import itertools

n,m,q = map(int,input().split())

a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q

for i in range(q):
  a1,b1,c1,d1 = map(int,input().split())
  a[i] = a1
  b[i] = b1
  c[i] = c1
  d[i] = d1

x = itertools.combinations_with_replacement(range(1,m+1),n)
tmp = 0
ans = 0
for xi in x:
  tmp = 0

  for i in range(q):
    if xi[b[i]-1] - xi[a[i]-1] == c[i]:
      tmp += d[i]
  ans = max(ans,tmp)

print(ans)