Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
n= int(input())

list= list(map(int, input().split()))
cnt=0

for i in range(n):
	if cnt<n:	
		listi=list[cnt:]	
		a=listi.count(i+1)
		cnt+=a
		print(a)
	else:
		print(0)

Fixed submission:
n = int(input())
lis = list(map(int, input().split()))
cnt = [0]*(n)

for i in range(n-1):
	cnt[lis[i]-1]+=1

for i in range(n):
	print(cnt[i])

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

list1= list(map(int, input().split()))
list2=list(set(list1))
cnt=0
for i in range(n):
	if i+1 in list2:
		listi=list1[cnt:]
		a=listi.count(i+1)
		cnt+=a
		print(a)
	else:
		print(0)

Fixed submission:
n = int(input())
lis = list(map(int, input().split()))
cnt = [0]*(n)

for i in range(n-1):
	cnt[lis[i]-1]+=1

for i in range(n):
	print(cnt[i])

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

list= list(map(int, input().split()))
cnt=0
for i in range(n):
	listi=list[cnt:]
	a=listi.count(i+1)
	cnt+=a
	print(a)

Fixed submission:
n = int(input())
lis = list(map(int, input().split()))
cnt = [0]*(n)

for i in range(n-1):
	cnt[lis[i]-1]+=1

for i in range(n):
	print(cnt[i])

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

list= list(map(int, input().split()))

for i in range(n):
	a=list.count(i+1)
	print(a)


Fixed submission:
n = int(input())
lis = list(map(int, input().split()))
cnt = [0]*(n)

for i in range(n-1):
	cnt[lis[i]-1]+=1

for i in range(n):
	print(cnt[i])
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
ans=0

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

for i in range(n):
	for j in range(n):
		for k in range(n):
			ans+=gcd(i+1,j+1,k+1)
print(ans)

Fixed submission:
n = int(input())
ans=0

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

for i in range(n):
	for j in range(n):
		if math.gcd(i+1,j+1)==1:
			ans+=n
			continue
		else:
			for k in range(n):
				ans+=gcd(i+1,j+1,k+1)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n= int(input())
ans=0
s=list(input())
#print(s)
    
for i in range(n):
	for j in range(i+1,n):
		if s[i]==s[j]:
			continue
		else:
			for k in range(j+1,n):
				if s[i]!=s[k] and s[j]!=s[k] and j-i!=k-j:
					ans+=1
print(ans)

Fixed submission:
n= int(input())
ans=0
s=list(input())

G=s.count('G') 
R=s.count('R')
B=s.count('B')

ans= G*R*B

if n<=2:
	print(0)
else:
	for i in range(n-2):
		for j in range(min(i+1,n-2-i)):
			if s[i+1]!=s[i-j] and s[i+1]!=s[i+2+j] and s[i-j]!=s[i+2+j]:
				ans-=1
	print(ans)
Buggy python submission (verdict: Runtime Error):
s, t = input().split()
a, b = map(int, input().split())
u = input()

if s==u:
	print((a-1)+' '+b)
elif t==u:
	print(a+' '+(b-1))

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

if s==u:
	print(a-1, b)
elif t==u:
	print(a, b-1)
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())

ac = [0]*(n+1)
wa = [0]*(n+1)


for i in range(m):
	p, s = input().split()
    p = int(p)
    
    if s== "AC":
		ac[p] = 1
    else:
        if a[p]==0:
        	wa[p]+=1

for i in range(m):
	if ac[i]=0:
		wa[p]=0
        
print(sum(ac),sum(wa))


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

ac = [0]*(n+1)
wa = [0]*(n+1)


for i in range(m):
	p, s = input().split()
	p = int(p)
    
	if s== "AC":
		ac[p] = 1
	else:
		if ac[p]==0:
			wa[p]+=1

for i in range(n+1):
	if ac[i]==0:
		wa[i]=0
        
print(sum(ac),sum(wa))

Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())

ac = [0]*(n)
wa = [0]*(n)


for i in range(m):
	p, s = input().split()
    p = int(p)
    
    if s== "AC":
		ac[p] = 1
    else:
        wa[p]+=1

for i in range(m):
	if ac[i]=0:
		wa[p]=0
        
print(sum(ac),sum(wa))

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

ac = [0]*(n+1)
wa = [0]*(n+1)


for i in range(m):
	p, s = input().split()
	p = int(p)
    
	if s== "AC":
		ac[p] = 1
	else:
		if ac[p]==0:
			wa[p]+=1

for i in range(n+1):
	if ac[i]==0:
		wa[i]=0
        
print(sum(ac),sum(wa))
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
ans=0
for i in range(N-2):
	if S[i]+S[i+1]+S[i+2]=='ABC':
		ans+=1
print(ans)

Fixed submission:
k,x= map(int, input().split())

if 500*k>=x:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
K,X = map(int, input().split())

if 500*K>=x:
  print('yes')
else:
  print('No')
  

Fixed submission:
k,x= map(int, input().split())

if 500*k>=x:
    print('Yes')
else:
    print('No')

Buggy python submission (verdict: Runtime Error):
K, X = map(int, input().split())
if K*500 <X:
    print('NO')
  else:
    print('Yes')

Fixed submission:
k,x= map(int, input().split())

if 500*k>=x:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
ans=0
for i in range(n-2):
	if S[i]+S[i+1]+S[i+2]=='ABC':
		ans+=1
print(ans)

Fixed submission:
n=int(input())
s=input()
ans=0
for i in range(n-2):
	if s[i]+s[i+1]+s[i+2]=="ABC":
		ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
import math
print(a*b/math.gcd(a,b))


Fixed submission:
a = int(input())
b = int(input())

print(6-(a+b))

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


Fixed submission:
a = int(input())
b = int(input())

print(6-(a+b))

Buggy python submission (verdict: Runtime Error):
a, b = map(int, intput().split())
import math
print(a*b//math.gcd(a,b))


Fixed submission:
a = int(input())
b = int(input())

print(6-(a+b))

Buggy python submission (verdict: Runtime Error):
n = int(input())
S = list(input().split())
T = list(input().split())

ans=""

for i in range(n)
	ans+=S[i]+T[i]

print(ans)


Fixed submission:
a = int(input())
b = int(input())

print(6-(a+b))
Buggy python submission (verdict: Runtime Error):
n = int(input())
S = list(input())
T = list(input())

ans=""

for i in range(n)
	ans+=S[i]+T[i]

print(ans)


Fixed submission:
n = int(input())
S, T = map(str, input().split())
ans=''

for i in range(n):
	ans+=S[i]+T[i]
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

n = int(input())

x = []
y = []
sum = 0

#座標入力
for i in range(n):
	a, b = map(int, input().split())
	x.append(a)
	y.append(b)

#距離の総和
for i in range(n):
	for j in range(n):
		num = math.factorial(n-1)									
		dist = ((x[i-1]-x[j-1])^2+(y[i-1]-y[j-1])^2)**0.5
		sum+= num*dist

print(sum/math.factorial(n))


Fixed submission:
r = int(input())
print(r**2)

Buggy python submission (verdict: Runtime Error):
r = int(input())
ptint(r**2)


Fixed submission:
r = int(input())
print(r**2)

Buggy python submission (verdict: Runtime Error):
r = int(input())
ptinr(r**2)

Fixed submission:
r = int(input())
print(r**2)
Buggy python submission (verdict: Time Limit Exceeded):
x, y= map(int, input().split())
mod=10**9+7
import math
a=(2*y-x)//3
b=(2*x-y)//3

if (2*x-y)%3!=0 or (2*y-x)%3!=0 or a<0 or b<0:
	print(0)

else:
	L=[1]*(a+b+1)
	for i in range(1,a+b+1):
		L[i]=L[i-1]*i
		L[i]=L[i]%mod
	ab=L[a]*L[b]
	ab=ab%mod
	for j in range(1, mod):
		abj=(ab*j)%mod
		if abj==L[a+b]:
			print(j)
			break


Fixed submission:
x, y= map(int, input().split())
mod=10**9+7
import math
a=(2*y-x)//3
b=(2*x-y)//3

if (2*x-y)%3!=0 or (2*y-x)%3!=0 or a<0 or b<0:
	print(0)

else:
	L=[1]*(a+b+1)
	for i in range(1,a+b+1):
		L[i]=L[i-1]*i
		L[i]=L[i]%mod
	p=pow(L[a], mod-2, mod)
	q=pow(L[b], mod-2, mod)
	ans=(L[a+b]*p*q)%mod
	print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
x, y= map(int, input().split())
mod=10**9+7
import math
a=(2*y-x)//3
b=(2*x-y)//3

if (2*x-y)%3!=0 or (2*y-x)%3!=0 or a<0 or b<0:
	print(0)

else:
	L=[1]*(a+b+1)
	for i in range(1,a+b+1):
		L[i]=L[i-1]*i
		L[i]=L[i]%mod
	ab=L[a]*L[b]
	ab=ab%mod
	for j in range(1, mod):
		abj=(ab*j)%mod
		if abj==L[a+b]:
			print(j)
			break

Fixed submission:
x, y= map(int, input().split())
mod=10**9+7
import math
a=(2*y-x)//3
b=(2*x-y)//3

if (2*x-y)%3!=0 or (2*y-x)%3!=0 or a<0 or b<0:
	print(0)

else:
	L=[1]*(a+b+1)
	for i in range(1,a+b+1):
		L[i]=L[i-1]*i
		L[i]=L[i]%mod
	p=pow(L[a], mod-2, mod)
	q=pow(L[b], mod-2, mod)
	ans=(L[a+b]*p*q)%mod
	print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

divisors = []
for i in range(1, n+1):
	if n % i == 0:
		divisors.append(i)

m = len(divisors)

a = divisors[m//2-1]
b = divisors[m//2]

print(a+b-2)


 



Fixed submission:
n = int(input())

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

#m = len(divisors)

#a = divisors[m//2-1]
#b = divisors[m//2]

a= max(divisors)
b=n//a
#print(a)
#print(b)
print(a+b-2)
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input().split())

if 2b>=a:
	print(0)
else:
	print(a-2b)

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

if 2*b>=a:
	print(0)
else:
	print(a-2*b)
Buggy python submission (verdict: Runtime Error):
n,k = map(int, input().split())
ans=0
for i in range(n):
	a = int(input())
	if a>=k:
	ans+=1
print(ans)

Fixed submission:
n,k = map(int, input().split())
ans=0
list=list(map(int, input().split()))

for i in range(n):
	if list[i]>=k:
		ans+=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
L=list(map(int, input().split()))
L.sort(reverse=True)

for i in range(m):
	L[0]=L[0]/2
	for j in range(n-1):
		if L[j]<L[j+1]:
			L[j], L[j+1]= L[j+1], L[j]
		else:
			break
#小数点を切り捨てる
for i in range(n):
	L[i]=int(L[i])
print(sum(L))

Fixed submission:
n, m = map(int, input().split())
L=list(map(int, input().split()))
A=[]
for i in range(n):
	A.append(-L[i])

import heapq
heapq.heapify(A)

for i in range(m):
	a= -heapq.heappop(A)
	heapq.heappush(A, -(a//2))

print(-sum(A))
Buggy python submission (verdict: Runtime Error):
a , b = map(int, input().split())

if b==1:
	print(0)
else:
	for i in range(20):
		if (a-1)*(i+1)>=b:
			print(i)
			brea

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

if b==1:
	print(0)
else:
	for i in range(100):
		if a+(a-1)*i>=b:
			print(i+1)
			break
Buggy python submission (verdict: Runtime Error):
n ,k =map(int, input().split())
S=[]

def merge(array):                                   # line1
    mid = len(array)                                # line2
    if mid > 1:                                     # line3
        left = merge(array[:(mid//2)])               # line4
        right = merge(array[(mid//2):])              # line5
        array = []                                  # line6
        while len(left) != 0 and len(right) != 0:   # line7
            if left[0] < right[0]:                  # line8
                array.append(left.pop(0))           # line9
            else:                                   # line10
                array.append(right.pop(0))          # line11
        if len(left) != 0:                          # line12
            array.extend(left)                      # line13
        elif len(right) != 0:                       # line14
            array.extend(right)                     # line15
    return array



for i in range(n):
	a=int(input())
	S.append(a)
L=merge(S)
#print(L)
ans=-L[0]+L[n-1]
for i in range(k):
	if -L[i]+L[i+k-1]<ans:
		ans=-L[i]+L[i+k-1]
print(ans)
	

Fixed submission:
n ,k =map(int, input().split())
S=[]

def merge(array):                                   # line1
    mid = len(array)                                # line2
    if mid > 1:                                     # line3
        left = merge(array[:(mid//2)])               # line4
        right = merge(array[(mid//2):])              # line5
        array = []                                  # line6
        while len(left) != 0 and len(right) != 0:   # line7
            if left[0] < right[0]:                  # line8
                array.append(left.pop(0))           # line9
            else:                                   # line10
                array.append(right.pop(0))          # line11
        if len(left) != 0:                          # line12
            array.extend(left)                      # line13
        elif len(right) != 0:                       # line14
            array.extend(right)                     # line15
    return array



for i in range(n):
	a=int(input())
	S.append(a)
L=merge(S)

ans=-L[0]+L[n-1]
for i in range(n-k+1):
	if -L[i]+L[i+k-1]<ans:
		ans=-L[i]+L[i+k-1]
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
L=list(map(int, input().split()))
s=max(L)
from operator import mul
from functools import reduce

def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

c=0
for i in range(n):	
	d=cmb(s,L[i])
	if d>=c and L[i]!=s:
		c=d
		a=L[i]
A=[s, a]
print(*A)


Fixed submission:
n=int(input())
L=list(map(int, input().split()))
a=max(L)
b=a
c=0
for i in range(n):
	if b>=abs(L[i]-a/2) and L[i]!=a:
		b=abs(L[i]-a/2)
		c=L[i]


print(a,c)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
L=list(map(int, input().split()))
s=max(L)

from math import factorial
c=0
for i in range(n):	
	d=factorial(s)/factorial(L[i])/factorial(s-L[i])
	if d>=c and L[i]!=s:
		c=d
		a=L[i]
A=[s, a]
print(*A)

Fixed submission:
n=int(input())
L=list(map(int, input().split()))
a=max(L)
b=a
c=0
for i in range(n):
	if b>=abs(L[i]-a/2) and L[i]!=a:
		b=abs(L[i]-a/2)
		c=L[i]


print(a,c)
Buggy python submission (verdict: Runtime Error):
L=input()
a=int(L[0])
b=int(L[1])
c=int(L[2])
d=int(L[3])

import itertools

A=(1,-1)

def c(x):
	if x==1:
		return '+'
	else:
		return '-'

for v in itertools.product(A,repeat=3):
	s=a+b*v[0]+c*v[1]+d*v[2]
	if s==7:
		print(L[0]+c(v[0])+L[1]+c(v[1])+L[2]+c(v[2])+L[3]+'=7')
		exit()

Fixed submission:
L=input()
a=int(L[0])
b=int(L[1])
c=int(L[2])
d=int(L[3])

import itertools

A=(1,-1)

def e(x):
	if x==1:
		return '+'
	else:
		return '-'

for v in itertools.product(A,repeat=3):
	s=a+b*v[0]+c*v[1]+d*v[2]
	if s==7:
		print(L[0]+e(v[0])+L[1]+e(v[1])+L[2]+e(v[2])+L[3]+'=7')
		exit()

Buggy python submission (verdict: Runtime Error):
L=list(input())
a=int(L[0])
b=int(L[1])
c=int(L[2])
d=int(L[3])

import itertools

A=(1,-1)

def c(x):
	if x==1:
		return '+'
	else:
		return '-'

for v in itertools.product(A,repeat=3):
	s=a+b*v[0]+c*v[1]+d*v[2]
	if s==7:
		print(L[0]+c(v[0])+L[1]+c(v[1])+L[2]+c(v[2])+L[3]+'=7')
		exit()

Fixed submission:
L=input()
a=int(L[0])
b=int(L[1])
c=int(L[2])
d=int(L[3])

import itertools

A=(1,-1)

def e(x):
	if x==1:
		return '+'
	else:
		return '-'

for v in itertools.product(A,repeat=3):
	s=a+b*v[0]+c*v[1]+d*v[2]
	if s==7:
		print(L[0]+e(v[0])+L[1]+e(v[1])+L[2]+e(v[2])+L[3]+'=7')
		exit()

Buggy python submission (verdict: Runtime Error):
L=input()
a=int(L[0])
b=int(L[1])
c=int(L[2])
d=int(L[3])
def s(i,x):
	if i==0:
		return x
	else:
		return -x

def c(x):
	if x==0:
		return '+'
	else:
		return '-'

for i in range(2):
	for j in range(2):
		for k in range(2):
			p=a+s(i,b)+s(j,c)+s(k,d)
			if p==7:
				ans=L[0]+c(i)+L[1]+c(j)+L[2]+c(k)+L[3]
				print(ans)
				exit()

Fixed submission:
L=input()
a=int(L[0])
b=int(L[1])
c=int(L[2])
d=int(L[3])

import itertools

A=(1,-1)

def e(x):
	if x==1:
		return '+'
	else:
		return '-'

for v in itertools.product(A,repeat=3):
	s=a+b*v[0]+c*v[1]+d*v[2]
	if s==7:
		print(L[0]+e(v[0])+L[1]+e(v[1])+L[2]+e(v[2])+L[3]+'=7')
		exit()
Buggy python submission (verdict: Runtime Error):
n=int(input())
L=input()
S=input()
T=[]
i=0
while n-2>=i:
	if L[i]==L[i+1]:
		T.append(0)
		i+=2
	else:
		T.append(1)
		i+=1

def f(x,y):
	if x==0 and y==1:
		return 1
	if x==0 and y==0:
		return 3
	if x==1 and y==1:
		return 2
	if x==1 and y==0:
		return 2
if T[0]==0:
	ans=3
else:
	ans=6


for i in range(len(T)-1):
	ans=ans*f(T[i],T[i+1])

print(ans)


			


Fixed submission:
n=int(input())
L=input()+'?'
S=input()
T=[]
i=0


while n-1>=i:
	if L[i]==L[i+1]:
		T.append(0)
		i+=2
	else:
		T.append(1)
		i+=1

        
def f(x,y):
	if x==0 and y==1:
		return 1
	if x==0 and y==0:
		return 3
	if x==1 and y==1:
		return 2
	if x==1 and y==0:
		return 2
if T[0]==0:
	ans=6
else:
	ans=3
mod = 10**9 + 7
for i in range(len(T)-1):
	ans=ans*f(T[i],T[i+1])
	ans=ans%mod
print(ans)

Buggy python submission (verdict: Runtime Error):
n=int(input())
L=input()
S=input()
T=[]
i=0
while n-2>=i:
	if L[i]==L[i+1]:
		T.append(0)
		i+=2
	else:
		T.append(1)
		i+=1

def f(x,y):
	if x==0 and y==1:
		return 1
	if x==0 and y==0:
		return 3
	if x==1 and y==1:
		return 2
	if x==1 and y==0:
		return 2
if T[0]==0:
	ans=3
else:
	ans=6

print(T)
for i in range(len(T)-1):
	ans=ans*f(T[i],T[i+1])

print(ans)


			

Fixed submission:
n=int(input())
L=input()+'?'
S=input()
T=[]
i=0


while n-1>=i:
	if L[i]==L[i+1]:
		T.append(0)
		i+=2
	else:
		T.append(1)
		i+=1

        
def f(x,y):
	if x==0 and y==1:
		return 1
	if x==0 and y==0:
		return 3
	if x==1 and y==1:
		return 2
	if x==1 and y==0:
		return 2
if T[0]==0:
	ans=6
else:
	ans=3
mod = 10**9 + 7
for i in range(len(T)-1):
	ans=ans*f(T[i],T[i+1])
	ans=ans%mod
print(ans)
Buggy python submission (verdict: Runtime Error):
n= int(input())
a=int(input())
b=int(input())
import math

c=(a*b)//math.gcd(a,b)
for i in range(n-2):
	b=int(input())
	c=(c*b)//math.gcd(c,b)

print(c)

Fixed submission:
n= int(input())
a=int(input())

import math
if n==1:
	print(a)
	exit()

b=int(input())
c=(a*b)//math.gcd(a,b)
for i in range(n-2):
	b=int(input())
	c=(c*b)//math.gcd(c,b)

print(c)
Buggy python submission (verdict: Runtime Error):
n= int(input())
G=[[] for i in range(n+1)]

for i in range(n-1):
	a,b,c=map(int, input().split())
	G[a].append([b,c])
	G[b].append([a,c])

q,k=map(int,input().split())


D=[None]*(n+1)
 
def dfs(x,d):
    D[x]=d
    for yy,dd in G[x] :
        if D[yy] is not None:
            continue
        dfs(yy,dd+d)
dfs(k,0)

for i in range(q):
    x, y = map(int, input().split())
    print(D[x] + D[y])

Fixed submission:
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

n= int(input())
G=[[] for i in range(n+1)]

for i in range(n-1):
	a,b,c=map(int, input().split())
	G[a].append([b,c])
	G[b].append([a,c])

q,k=map(int,input().split())


D=[None]*(n+1)
 
def dfs(x,d):
    D[x]=d
    for yy,dd in G[x] :
        if D[yy] is not None:
            continue
        dfs(yy,dd+d)
dfs(k,0)

for i in range(q):
    x, y = map(int, input().split())
    print(D[x] + D[y])
Buggy python submission (verdict: Runtime Error):
x = int(input())

d = 2

while d < 1+x//2:
  if x%d == 0:
    x += 1
    d = 2
  else:
    if d == 1+x//2:
      ans = x
      break
    else:
      d += 1
print(ans)

Fixed submission:
x = int(input())

d = 2

ans = 2

if x != 2:
  while d <= 1+x//2:
    if x%d == 0:
      x += 1
      d = 2
    else:
      if d == 1+x//2:
        ans = x
        break
      else:
        d += 1
  print(ans)
else:
  print(ans)

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

d = 2

while d < 1+x//2:
  if x%d == 0:
    x += 1
    d = 1
  else:
    if d == 1+x//2:
      ans = x
      break
    else:
      d += 1
print(ans)

Fixed submission:
x = int(input())

d = 2

ans = 2

if x != 2:
  while d <= 1+x//2:
    if x%d == 0:
      x += 1
      d = 2
    else:
      if d == 1+x//2:
        ans = x
        break
      else:
        d += 1
  print(ans)
else:
  print(ans)
Buggy python submission (verdict: Runtime Error):
def main():
    s = input()
    m = len(s)//2
    ans = 0
    if m%2 == 0:
        a = s[:m]
        b = s[m:]
        for i in range(m):
            if b[i] != a[m-i-1]:
                ans += 1
        print(ans)
    else:
        a = s[:m]
        b = s[m+1:]
        for i in range(m):
            if b[i] != a[m-i-1]:
                ans += 1
        print(ans)


if __name__ == "__main__":
    main()

Fixed submission:
def main():
    s = input()
    m = len(s)//2
    ans = 0
    if len(s)%2 == 0:
        a = s[:m]
        b = s[m:]
        for i in range(m):
            if b[i] != a[m-i-1]:
                ans += 1
        print(ans)
    else:
        a = s[:m]
        b = s[m+1:]
        for i in range(m):
            if b[i] != a[m-i-1]:
                ans += 1
        print(ans)


if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import numpy as np

def main():
    h, w, k = map(int, input().split())
    s = [input() for i in range(h)]
    s = np.array(s)

    ans = np.array([[0]*w]*h)

    g = 1
    nls = []

    for i in range(h):
        if s[i] != "."*w:
            lsha = 0
            for j in range(w):
                ans[i][j] = g
                if s[i][j] == "#":
                    lsha = j
                    g = g + 1
            if lsha != w-1:
                for k in range(w-lsha-1):
                    ans[i][lsha+1+k] = ans[i][lsha] 
        else:
            nls.append(i)
    
    for i in nls:
        if i != h-1:
            ans[i] = ans[i+1]
        else:
            ans[i] = ans[i-1]
    
    for i in range(h):
        if ans[i][0] == 0:
            for j in range(i+1, h):
                if ans[j][0] != 0:
                    ans[i] = ans[j]
                    break
    for i in range(h):
        if ans[n-1-i][0] == 0:
            for j in range(i+1, h):
                if ans[n-1-j][0] != 0:
                    ans[n-1-i] = ans[n-1-j]
                    break
    
    for i in range(h):
        anst= ""
        for j in range(w):
            anst = anst + str(ans[i][j]) + " "
        print(anst)

if __name__ == "__main__":
    main()

Fixed submission:
import numpy as np

def main():
    h, w, k = map(int, input().split())
    s = [input() for i in range(h)]
    s = np.array(s)

    ans = np.array([[0]*w]*h)

    g = 1
    nls = []

    for i in range(h):
        if s[i] != "."*w:
            lsha = 0
            for j in range(w):
                ans[i][j] = g
                if s[i][j] == "#":
                    lsha = j
                    g = g + 1
            if lsha != w-1:
                for k in range(w-lsha-1):
                    ans[i][lsha+1+k] = ans[i][lsha] 
        else:
            nls.append(i)
    
    for i in nls:
        if i != h-1:
            ans[i] = ans[i+1]
        else:
            ans[i] = ans[i-1]
    
    for i in range(h):
        if ans[i][0] == 0:
            for j in range(i+1, h):
                if ans[j][0] != 0:
                    ans[i] = ans[j]
                    break
    for i in range(h):
        if ans[h-1-i][0] == 0:
            for j in range(i+1, h):
                if ans[h-1-j][0] != 0:
                    ans[h-1-i] = ans[h-1-j]
                    break
    
    for i in range(h):
        anst= ""
        for j in range(w):
            anst = anst + str(ans[i][j]) + " "
        print(anst)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Runtime Error):
import math

def main():
    a, b, x = map(float, input().split())

    if x <= a*a*b*0.5:
        y = 2*x/(a*b)
        p = y/((b**2 + y**2)**0.5)
        ans = math.degrees(math.acos(p))
    else:
        k = (2*a*x - a*a*a*b)/(2*a*a*b -2*x)
        ans = math.degrees(math.atan(b/(a+k)))

    print(ans)

if __name__ == "__main__":
    main()

Fixed submission:
import math

def main():
    a, b, x = map(float, input().split())

    if x <= a*a*b*0.5:
        y = 2*x/(a*b)
        p = y/((b**2 + y**2)**0.5)
        ans = math.degrees(math.acos(p))
    elif x < a*a*b:
        k = (2*a*x - a*a*a*b)/(2*a*a*b -2*x)
        ans = math.degrees(math.atan(b/(a+k)))
    else:
        ans = 0
    print(ans)

if __name__ == "__main__":
    main()