Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
v = sorted(list(map(int, input().split())), reverse = False)
for i in range(1, n):
    v[0] = (v[0] + v[i]) / 2
print(v[0])

Fixed submission:
a = int(input())
s = input()
if a >= 3200:
    print(s)
else:
    print("red")
Buggy python submission (verdict: Runtime Error):
n = int(input())
v = sorted(list(map(int, input().split())), reverse = False)
for i in range(1, n):
    v[0] = (v[0] + v[i]) / 2
print(v[0]

Fixed submission:
n = int(input())
v = sorted(list(map(int, input().split())), reverse = False)
for i in range(1, n):
    v[0] = (v[0] + v[i]) / 2
print(v[0])
Buggy python submission (verdict: Runtime Error):
import math

a, b, c, d = map(int, input().split())
x = b-a+1
l = c//math.gcd(c, d)*d
ans = (b//c - (a-1)//c) + (b//d - (a-1)//d) - (b//l - (a-1)//l)
print(x-ans)

Fixed submission:
from fractions import gcd

a, b, c, d = map(int, input().split())
x = b-a+1
l = c//gcd(c, d)*d
ans = (b//c - (a-1)//c) + (b//d - (a-1)//d) - (b//l - (a-1)//l)
print(x-ans)
Buggy python submission (verdict: Runtime Error):
n, x = map(int, (input().split()))
a, p = [1], [1]
for i in range(n):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)
#print("a = {}".format(a))
#print("p = {}".format(p))

def f(n, x):
    if n == 0:
        return 0 if x <= 0 else 1
    elif x <= 1+a[n-1]:
        return f(n-1, x-1)
    elif x == a[n-1]+2:
        return p[n-1]+1
    elif x <= 2*a[n-1]+3:
        return p[n-1]+1 + f(n-1, x-2-a[n-1])
print(f(n, x))

Fixed submission:
n, x = map(int, (input().split()))
a, p = [1], [1]
for i in range(n):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(n, x):
    if n == 0:
        return 0 if x <= 0 else 1
    elif x <= 1+a[n-1]:
        return f(n-1, x-1)
    else:
        return p[n-1]+1 + f(n-1, x-2-a[n-1])
print(f(n, x))

Buggy python submission (verdict: Runtime Error):
n, x = map(int, (input().split()))
a, p = [1], [1]
for i in range(n):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)
print("a = {}".format(a))
print("p = {}".format(p))

def f(n, x):
    if n == 0:
        return 0 if x <= 0 else 1
    elif x <= 1+a[n-1]:
        return f(n-1, x-1)
    elif x == a[n-1]+2:
        return p[n-1]+1
    elif x <= 2*a[n-1]+3
        return p[n-1]+1 + f(n-1, x-2-a[n-1])
print(f(n, x))

Fixed submission:
n, x = map(int, (input().split()))
a, p = [1], [1]
for i in range(n):
    a.append(a[i] * 2 + 3)
    p.append(p[i] * 2 + 1)

def f(n, x):
    if n == 0:
        return 0 if x <= 0 else 1
    elif x <= 1+a[n-1]:
        return f(n-1, x-1)
    else:
        return p[n-1]+1 + f(n-1, x-2-a[n-1])
print(f(n, x))
Buggy python submission (verdict: Runtime Error):
k = int(input())
count1 = 0
count2 = 0
for i in range(k):
    if i % 2 == 0:
        count1 += 1
    else:
        count2 += 1
print(count1 * count2

Fixed submission:
k = int(input())
count1 = 0
count2 = 0
for i in range(k):
    if i % 2 == 0:
        count1 += 1
    else:
        count2 += 1
print(count1 * count2)
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
k = int(input())
sub = []
num = len(s)
for i in range(num):
    for j in range(i, num):
        sub.append(s[i:j+1])
sub = list(set(sub))
sub.sort()
print(sub[k-1])

Fixed submission:
s = input()
k = int(input())
sub = []
for i in range(len(s)):
    for j in range(i, i+5):
        sub.append(s[i:j+1])
sub = list(set(sub))
sub.sort()
print(sub[k-1])

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
sub = []
num = len(s)
for i in range(num):
    for j in range(i, num):
        sub.append(s[i:j+1])
sub = list(set(sub))
sub.sort()
print(sub

Fixed submission:
s = input()
k = int(input())
sub = []
for i in range(len(s)):
    for j in range(i, i+5):
        sub.append(s[i:j+1])
sub = list(set(sub))
sub.sort()
print(sub[k-1])

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())
sub = []
for i in range(len(s)):
    for j in range(i, len(s)-1):
        sub.append(s[i:j+1])
sub = list(set(sub))
sub.sort()
print(sub[k-1])

Fixed submission:
s = input()
k = int(input())
sub = []
for i in range(len(s)):
    for j in range(i, i+5):
        sub.append(s[i:j+1])
sub = list(set(sub))
sub.sort()
print(sub[k-1])
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
counter = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if x+y+z == s and z >= 0 and z <= k:
            counter += 1
print(counter)

Fixed submission:
k, s = map(int, input().split())
counter = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if z >= 0 and z <= k:
            counter += 1
print(counter)
Buggy python submission (verdict: Runtime Error):
def calc(n):
  s=n+n**2+n**3
  res=int(s)
  return res
for i in range(int(input())):
  n=int(input())
  print(calc(n))
  

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

Buggy python submission (verdict: Runtime Error):
for i in range(int(input())):
  n=int(input())
  s=n+n**2+n**3
  print(s)

Fixed submission:
a=int(input())
s=a+a**2+a**3
res=int(s)
print(res)
Buggy python submission (verdict: Runtime Error):
def minchange(s,t):
  m=len(s)
  n=len(t)
  if n!=m:
    return -1
  cnt=[0]*256
  for i in range(n):
    cnt[ord(t[i])]+=1
  for i in range(n):
    cnt[ord(s[i])]-=1
  for i in range(256):
    if cnt[i]:
      return -1
  res=0
  i=n-1
  j=n-1
  while i>=0:
    while i>=0 and s[i]!=t[i]:
      i-=1
      res+=1
    if i>=0:
      i-=1
      j-=1
  return res
s=input()
t=input()
print(str(minchange(s,t))
      
  


Fixed submission:
def minchange(s,t):
  m=len(s)
  n=len(t)
  if n!=m:
    return -1
  cnt=[0]*256
  for i in range(n):
    cnt[ord(t[i])]+=1
  for i in range(n):
    cnt[ord(s[i])]-=1
  res=0
  i=n-1
  j=n-1
  while i>=0:
    while i>=0 and s[i]!=t[i]:
      i-=1
      res+=1
    if i>=0:
      i-=1
      j-=1
  return res
s=input()
t=input()
print(str(minchange(s,t)))

Buggy python submission (verdict: Runtime Error):
def minchange(s,t):
  m=len(s)
  n=len(t)
  if n!=m:
    return -1
  cnt=[0]*256
  for i in range(n):
    cnt[ord(t[i])]+=1
  for i in range(n):
    cnt[ord(s[i])]-=1
  for i in range(256):
    if cnt[i]:
      return -1
  res=0
  i=n-1
  j=n-1
  while i>=0:
    while i>=0 and s[i]!=t[i]:
      i-=1
      res+=1
    if i>=0:
      i-=1
      j-=1
  return res
s=input()
t=int(input())
print(str(minchange(s,t))
      
  

Fixed submission:
def minchange(s,t):
  m=len(s)
  n=len(t)
  if n!=m:
    return -1
  cnt=[0]*256
  for i in range(n):
    cnt[ord(t[i])]+=1
  for i in range(n):
    cnt[ord(s[i])]-=1
  res=0
  i=n-1
  j=n-1
  while i>=0:
    while i>=0 and s[i]!=t[i]:
      i-=1
      res+=1
    if i>=0:
      i-=1
      j-=1
  return res
s=input()
t=input()
print(str(minchange(s,t)))
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input())
h=list(map(int,input().split(" ")))
tall=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  tall[a]=max(tall[a],h[b])
  tall[b]=max(tall[b],h[a])
res=0
for i in range(n):
  if h[i]>tall[i]:
    res+=1
print(res)

Fixed submission:
n,m=map(int,input().split())
h=list(map(int,input().split()))
tall=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  tall[a]=max(tall[a],h[b])
  tall[b]=max(tall[b],h[a])
res=0
for i in range(n):
  if h[i]>tall[i]:
    res+=1
print(res)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input())
h=list(map(int,input().split( )))
tall=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  tall[a]=max(tall[a],h[b])
  tall[b]=max(tall[b],h[a])
res=0
for i in range(n):
  if h[i]>tall[i]:
    res+=1
print(res)

Fixed submission:
n,m=map(int,input().split())
h=list(map(int,input().split()))
tall=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  tall[a]=max(tall[a],h[b])
  tall[b]=max(tall[b],h[a])
res=0
for i in range(n):
  if h[i]>tall[i]:
    res+=1
print(res)

Buggy python submission (verdict: Runtime Error):
n,m=map(int,input())
h=list(map(int,input().split()))
tall=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  tall[a]=max(tall[a],h[b])
  tall[b]=max(tall[b],h[a])
res=0
for i in range(n):
  if h[i]>tall[i]:
    res+=1
print(res)

Fixed submission:
n,m=map(int,input().split())
h=list(map(int,input().split()))
tall=[0]*n
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  tall[a]=max(tall[a],h[b])
  tall[b]=max(tall[b],h[a])
res=0
for i in range(n):
  if h[i]>tall[i]:
    res+=1
print(res)
Buggy python submission (verdict: Runtime Error):
k=int(input())
a,b=map(int,input().split())
for i in range(a,b+1):
  if i%n==0:
    print("OK")
    exit()
print("NG")

Fixed submission:
k=int(input())
a,b=map(int,input().split())
f=0
for i in range(a,b+1):
  if i%k==0:
    f=1
if f==1:
  print("OK")
else:
  print("NG")

Buggy python submission (verdict: Runtime Error):
k=int(input())
a,b=map(int,input().split())
f=0
for i in range(a,b+1):
  if i%n==0:
    print("OK")
    f=1
if f==0:
  print("NG")

Fixed submission:
k=int(input())
a,b=map(int,input().split())
f=0
for i in range(a,b+1):
  if i%k==0:
    f=1
if f==1:
  print("OK")
else:
  print("NG")

Buggy python submission (verdict: Runtime Error):
k=int(input())
a,b=map(int,input().split())
for i in range(a,b+1):
  if i%n==0:
    print("OK")
print("NG")

Fixed submission:
k=int(input())
a,b=map(int,input().split())
f=0
for i in range(a,b+1):
  if i%k==0:
    f=1
if f==1:
  print("OK")
else:
  print("NG")
Buggy python submission (verdict: Runtime Error):
import numpy as np

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

total = 0

for i in range(N + M):
    if len(A) > 0 and A[0] <= B[0] and K - A[0] >= 0:
        K = K - A[0]
        A = A[1:]
        total += 1
    elif len(B) > 0 and K - B[0] >= 0:
        K = K - B[0]
        B = B[1:]
        total += 1
    else:
        break

print(total)

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

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
            j -= 1
    ans = max(ans, i + j)
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

A_np = np.array(A)
B_np = np.array(B)

C_np = np.append(A_np,B_np)
C_np = np.sort(C_np)
print(C_np)
x = 0
for i in range(len(C_np)):
    if K >= x + C_np[i]:
        x += C_np[i]
        y += 1
    else:
        break
print(y)

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

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
            j -= 1
    ans = max(ans, i + j)
print(ans)

Buggy python submission (verdict: Runtime Error):
import numpy as np
N,M,K = map(int,input().split())
A = list(map(int,input().split()))
B = list(map(int,input().split()))

A_np = np.array(A)
B_np = np.array(B)

C_np = np.append(A_np,B_np)
C_np = np.sort(C_np)

x = 0
for i in range(len(C_np)):
    if K > x + C_np[i]:
        x += 1
    else:
        break
print(x)

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

a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
            j -= 1
    ans = max(ans, i + j)
print(ans)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input(),split())

if A <10 and B < 10:
	print(A*B)
else:
	print('-1')
	
	

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

if A <10 and B < 10:
	print(A*B)
else:
	print('-1')

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())

if A <10 and B < 10:
	print(A*B)
else:
	print(-1)
	

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

if A <10 and B < 10:
	print(A*B)
else:
	print('-1')
Buggy python submission (verdict: Runtime Error):
dN = int(input())
yaku = 1

import math

    



if N % 2 == 0:
	yaku = 2
	
for i in range(3,int(math.sqrt(N))+1 ,1):
	if N % i == 0:
		yaku = i
		
		
yaku2 = int(N/yaku)

print(int(yaku2+yaku - 2))


Fixed submission:
N = int(input())
yaku = 1
import math

if N % 2 == 0:
	yaku = 2
	
for i in range(3,int(math.sqrt(N))+1 ,1):
	if N % i == 0:
		yaku = i
		
		
yaku2 = int(N/yaku)

print(int(yaku2+yaku - 2))
Buggy python submission (verdict: Runtime Error):
N = int(input())
L = input().split()
L = [int(i) for i in L ]
total = 0

L_sort = sorted(L)


def test(total):
	for i in range(N-2):
		for j in range(i+1,N - 1):
							temp_L = L_sort[j + 1:]
							
							#total += len(temp_L[temp_L < L_sort[i]+ L_sort[j]])
							temp_L = [k for k in temp_L if k < L_sort[i]+ L_sort[j]]
							total += len(temp_L)

	return total
						
				  	
print(test(total))


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

x = A - (2 * B)

if x >= 0:
	print(x)
elif x < 0:
	print(0)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
S = input()

total = []
Y = []

for i in range(N):
	if i == N-1:
		Y = Y + [S[i]]
		break
	if S[i] == S[i+1]:
		continue
	else:
		Y = Y + [S[i]]
		
print(len(Y)) 

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

total = []
Y = 0

for i in range(N):
	if i == N-1:
		Y = Y + 1
		break
	if S[i] == S[i+1]:
		continue
	else:
		Y = Y + 1
		
print(Y)

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

total = []

def yugo(st,x):
	if len(st) <= x + 1:
		return st[x],-1
	if st[x] == st[x + 1]:
		return yugo(st,x+1)
	else:
		return st[x] , x+1

x= 0
Y = []
for i in range(10000):
	y,x = yugo(S,x)
	if x == -1 :
		Y = Y + [y]
		break
	Y = Y + [y]
	
print(len(Y))


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

total = []
Y = 0

for i in range(N):
	if i == N-1:
		Y = Y + 1
		break
	if S[i] == S[i+1]:
		continue
	else:
		Y = Y + 1
		
print(Y)

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

total = []

def yugo(st,x):
	if len(st) <= x + 1:
		return st[x]
		
	if st[x] == st[x + 1]:
		return yugo(st,x+1)
	else:
		return st[x] +  yugo(st,x+1)
	

print(int(len(yugo(S,0))))


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

total = []
Y = 0

for i in range(N):
	if i == N-1:
		Y = Y + 1
		break
	if S[i] == S[i+1]:
		continue
	else:
		Y = Y + 1
		
print(Y)

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

total = []

def yugo(st,x):
	if len(st) == x + 1:
		return st[x]
	if st[x] == st[x + 1]:
		return yugo(st,x+1)
	else:
		return st[x] +  yugo(st,x+1)
	

print(int(len(yugo(S,0))))


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

total = []
Y = 0

for i in range(N):
	if i == N-1:
		Y = Y + 1
		break
	if S[i] == S[i+1]:
		continue
	else:
		Y = Y + 1
		
print(Y)

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

total = []

def yugo(st,x):
	if len(st) == x + 1:
		return st[x]
	if st[x] == st[x + 1]:
		return yugo(st,x+1)
	else:
		return st[x] +  yugo(st,x+1)
	

print(int(len(yugo(S,0))))


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

total = []
Y = 0

for i in range(N):
	if i == N-1:
		Y = Y + 1
		break
	if S[i] == S[i+1]:
		continue
	else:
		Y = Y + 1
		
print(Y)

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

total = []

def yugo(st,x):
	if len(st) == x + 1:
		return st[x]
	if st[x] == st[x + 1]:
		return yugo(st,x+1)
	else:
		return st[x] +  yugo(st,x+1)
	

print(len(yugo(S,0)))


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

total = []
Y = 0

for i in range(N):
	if i == N-1:
		Y = Y + 1
		break
	if S[i] == S[i+1]:
		continue
	else:
		Y = Y + 1
		
print(Y)
Buggy python submission (verdict: Runtime Error):
def abc_exp(a,b,c):
	print(str(a) + ' ' + str(b) + ' ' + str(c) )
	
def exchange(a,b,remain):
	if remain > int(a * 2): 
		b = b + int( a / 4) * 8
		a = a % 4
	return a,b
	
while True:
	N,Y = map(int,input().split())
	
	a = int(Y/10000)
	b = int((Y - a * 10000)/5000)
	c = int((Y - a * 10000 - b * 5000)/1000)
	
	max_bills = int(Y/1000)
	
	if (max_bills < N) or (N < a + b + c):
		print('-1 -1 -1')
		
	elif (N == max_bills):
		print('0 0 ' + str(max_bills))
		
	elif (N == a + b + c):
		abc_exp(a,b,c)
	
	else:
		remain = N - a - b - c
		if remain % 4 == 0:
			a,b = exchange(a,b,remain)
			remain = N - a - b - c
			if b - remain/4 > 0:
				b = b - int(remain / 4)
				a = a + int(remain / 4) * 5
				abc_exp(a,b,c)
		
		else:
			a = a - (remain % 4)
			b = b + 2 * (remain % 4)
			a , b = exchange(a,b,remain)
			remain = N - a - b - c
			if b - remain/4 > 0:
				b = b - int(remain / 4)
				c = c + int(remain / 4) * 5
				abc_exp(a,b,c)

Fixed submission:
def abc_exp(a,b,c):
	print(str(a) + ' ' + str(b) + ' ' + str(c) )
	
def exchange(a,b,remain):
	#if remain >= int(a * 2): 
	#	b = b + int(a / 4) * 8
	#	a = a % 4
	while True:
		if remain >= 4 and a - 4 >= 0:
			b = b + 8
			a = a - 4
			remain = remain - 4
		else: 
			break
	return a,b
	

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

a = int(Y/10000)
b = int((Y - a * 10000)/5000)
c = int((Y - a * 10000 - b * 5000)/1000)

max_bills = int(Y/1000)

if (max_bills < N) or (N < a + b + c):
	print('-1 -1 -1')
	
elif (N == max_bills):
	print('0 0 ' + str(max_bills))
	
elif (N == a + b + c):
	abc_exp(a,b,c)

else:
	remain = N - a - b - c
	if remain % 4 == 0:
		a,b = exchange(a,b,remain)
		remain = N - a - b - c
		if not b - remain/4 < 0:
			b = b - int(remain / 4)
			c = c + int(remain / 4) * 5
			abc_exp(a,b,c)
	
	else:
		a = a - (remain % 4)
		b = b + 2 * (remain % 4)
		a , b = exchange(a,b,remain)
		remain = N - a - b - c
		if b - remain/4 >= 0:
			b = b - int(remain / 4)
			c = c + int(remain / 4) * 5
			abc_exp(a,b,c)
		
		else:
			print('-1 -1 -1')
Buggy python submission (verdict: Time Limit Exceeded):
count = 0
K,S = map(int,input().split())

for i in range(K+1):
	for j in range(K+1):
		for k in range(K+1):
			if i + j + k == S:
				count += 1
				
print(count)

Fixed submission:
count = 0
K,S = map(int,input().split())

for i in range(K+1):
	for j in range(K+1):
			k = S - i - j
			if 0 <= k <= K:	
				count += 1
				
print(count)
Buggy python submission (verdict: Runtime Error):
a=int(input())
value=a+(a*a)+(a*a*a*)
print(value)

Fixed submission:
a=int(input())
if(a>=1 and a<=10):
    val=a+(a*a)+(a*a*a)
    print(val)

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

parser = argparse.ArgumentParser()

parser.add_argument('input', metavar='a', type=int)

args = parser.parse_args()

a = args.input

print('{0}'.format(a+a*a+a*a*a))

Fixed submission:
a = int(input())
print('{0}'.format(a+a*a+a*a*a))

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


def main():
    parser = argparse.ArgumentParser()

    parser.add_argument('input', metavar='a', type=int)

    args = parser.parse_args()

    a = args.input

    print('{0}'.format(a+a*a+a*a*a))


if __name__ == '__main__':
    main()

Fixed submission:
a = int(input())
print('{0}'.format(a+a*a+a*a*a))

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


def main():
    parser = argparse.ArgumentParser()

    parser.add_argument('input', metavar='a', type=int)

    args = parser.parse_args()

    a = args.input

    print('{0}'.format(a+a*a+a*a*a))


if __name__ == '__main__':
    main()


Fixed submission:
a = int(input())
print('{0}'.format(a+a*a+a*a*a))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
x = 1
for num in a:
    x *= num
if x > 10**18:
    print('-1')
else:
    print(x)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
x = 1
for num in a:
    x *= num
    if x > 10**18:
        x = -1
        break
if 0 in a:
    x = 0
print(x)
Buggy python submission (verdict: Runtime Error):
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
n = int(input())
x = factorization(n)
x.sort(key=lambda x: x[-1])
a = [0]
b = 3
for i in range(3,9):
    a.append(b)
    b += i
ans = 0
c = 1
for i in range(len(x)):
    for j in range(len(a)):
        if x[i][1] >= a[c]:
            c += 1
        else:
            break
    ans += c
if n == 1:
    print(0)
else:
    print(ans)


Fixed submission:
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr
n = int(input())
x = factorization(n)
x.sort(key=lambda x: x[-1])
a = [0]
b = 3
for i in range(3,30):
    a.append(b)
    b += i
ans = 0
c = 1
for i in range(len(x)):
    for j in range(len(a)):
        if x[i][1] >= a[c]:
            c += 1
        else:
            break
    ans += c
if n == 1:
    print(0)
else:
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = []
for i in range(n):
    x = input()
    if x not in l:
        l.append(x)
print(len(l))

Fixed submission:
n = int(input())
l = []
for i in range(n):
    x = input()
    l.append(x)
ans = n
l.sort()
for i in range(1,n):
    if l[i] == l[i-1]:
        ans -= 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n =int(input())
a = list(map(int,input().split()))
b = []
x = {}
def fx(x) :
    ans = 0
    for i in range(1,x):
        ans += i
    return ans
for i in a :
    if i in x :
        x[i] += 1
        if x[i] == 2:
            b.append(i)
    else :
        x[i] = 1
anskari = 0
for i in b :
    anskari += fx(x[i])
for i in a :
    if x[i] == 1:
        print(anskari)
    else :
        print(anskari - fx(x[i]) + fx(x[i]-1))

Fixed submission:
n =int(input())
a = list(map(int,input().split()))
b = []
x = {}
def fx(x) :
    ans = 0
    for i in range(1,x):
        ans += i
    return ans
for i in a :
    if i in x :
        x[i] += 1
        if x[i] == 2:
            b.append(i)
    else :
        x[i] = 1
anskari = 0
for i in b :
    anskari += fx(x[i])
for i in a :
    if x[i] == 1:
        print(anskari)
    else :
        print(anskari - x[i] +1)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
l = []
for i in range(m):
    l.append(list(map(int,input().split())))
ans = -1
if n == 1:
    for i in range(10):
        i = str(i)
        flag = True
        for j in range(m):
            if i[l[j][0]-1] != str(l[j][1]) :
                flag = False
        if flag:
            ans = int(i)
            break
else:
    for i in range(10**(n-1),10**n):
    i = str(i)
    flag = True
    for j in range(m):
        if i[l[j][0]-1] != str(l[j][1]) :
            flag = False
    if flag:
        ans = int(i)
        break
print(ans)


Fixed submission:
n,m = map(int,input().split())
l = []
for i in range(m):
    l.append(list(map(int,input().split())))
ans = -1
if n == 1:
    for i in range(10):
        i = str(i)
        flag = True
        for j in range(m):
            if i[l[j][0]-1] != str(l[j][1]) :
                flag = False
        if flag:
            ans = int(i)
            break
else:
    for i in range(10**(n-1),10**n):
        i = str(i)
        flag = True
        for j in range(m):
            if i[l[j][0]-1] != str(l[j][1]) :
                flag = False
        if flag:
            ans = int(i)
            break
print(ans)