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

D, G = map(int, input().split())

PC = []
ans = 10 ** 9

for _ in range(D):
    PC.append(list(map(int, input().split())))

PC = np.array(PC)

for i in range(2 ** D):
    score = 0
    count = 0

    for j in range(D):
        if (i >> j) & 1:

          	score += (j+1) * 100 * PC[j,0] + PC[j,1]
            count += PC[j,0]

    if score >= G:
        ans = min(ans, count)

    if score < G:
      for k in range(D):
            sub_score = 0
            sub_count = 0

            if ~(i >> k) & 1:
                for _ in range(PC[k,0] - 1):
                    sub_score += (k+1) * 100
                    sub_count += 1
                    if sub_score >= (G - score):
                        ans = min(ans, count+sub_count)
                        break


print(ans)

Fixed submission:
import numpy as np

D, G = map(int, input().split())

PC = []
ans = 10 ** 9

for _ in range(D):
    PC.append(list(map(int, input().split())))

PC = np.array(PC)

for i in range(2 ** D):
    score = 0
    count = 0

    for j in range(D):
        if (i >> j) & 1:
            score += (j+1) * 100 * PC[j,0] + PC[j,1]
            count += PC[j,0]

    if score >= G:
        ans = min(ans, count)

    if score < G:
      for k in range(D):
            sub_score = 0
            sub_count = 0

            if ~(i >> k) & 1:
                for _ in range(PC[k,0] - 1):
                    sub_score += (k+1) * 100
                    sub_count += 1
                    if sub_score >= (G - score):
                        ans = min(ans, count+sub_count)
                        break

print(ans)
Buggy python submission (verdict: Runtime Error):
D,N = map(int, input().split())

if D == 0:
    if N! = 100:
        print(N)
    else:
        print(101)

elif D == 1:
    if N != 100:
        print(100*N)
    else:
        print(100*101)

elif D == 2:
    if N != 100:
        print(100*100*N)
    else:
        print(100*100*101)


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

if D == 0:
    if N != 100:
        print(N)
    else:
        print(101)

elif D == 1:
    if N != 100:
        print(100*N)
    else:
        print(100*101)

elif D == 2:
    if N != 100:
        print(100*100*N)
    else:
        print(100*100*101)
Buggy python submission (verdict: Runtime Error):
S=0
N = int(input())
l = map(int, input().split())

l = list(sorted(l))

for i in range(1, N+1):
    if i%2 == 1:
        S+=l[N-i]
        #print(S)
    else:
        S-=l[N-i]
        #print(S)
            

#print('--------')
print(S)

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

n=N%500
if n<=A:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
M=input(int())

print(M+24)


Fixed submission:
M = int(input())
print(48-M)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))

C = [0] * 10 ** 9
count = 0
H = 0
W = 0

for i in range(N):
    C[A[i]] += 1

for i in range(N)[::-1]:
    if (C[i] >= 2) and (count == 0):
        H = i
        count += 1
    elif (C[i] >= 2) and (count == 1):
        W = i
        break

print(H * W)

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

C = {}

count = 0
H = 0
W = 0

res1=res2=res3=0

for i in A:
    C[i] = 0

for i in A:
    C[i] += 1

for i in A:
    if C[i] >= 2:
        res1 = max(res1, i)

for i in A:
    if C[i] >= 2 and i != res1:
        res2 = max(res2, i)

for i in A:
    if C[i] >= 4:
        res3 = max(res3, i)


print(max(res1 * res2, res3 * res3))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = []

for i in range(n):
    temp = [a[i]]
    if i % 2 == 0:
        b.append(a[i])
    else:
        temp.extend(b)
        b = temp

if n % 2 == 1:
    b.reverse()

b = list(map(str,b))
print(" ".join(b))

Fixed submission:
import collections

n = int(input())
a = list(map(int, input().split()))
b = collections.deque()

for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b.appendleft(a[i])

if n % 2 == 1:
    b.reverse()

print(*b)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
b = []

for i in range(n):
    temp = [a[i]]
    if i % 2 == 0:
        b.append(a[i])
    else:
        temp.extend(b)
        b = temp

if n % 2 == 0:
    for i in range(n):
        print(b[i], end=" ")
else:
    for i in range(n)[::-1]:
        print(b[i], end=" ")

Fixed submission:
import collections

n = int(input())
a = list(map(int, input().split()))
b = collections.deque()

for i in range(n):
    if i % 2 == 0:
        b.append(a[i])
    else:
        b.appendleft(a[i])

if n % 2 == 1:
    b.reverse()

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

AB = []

for _ in range(N):
    AB.append(list(map(int, input().split())))

CD = []

for _ in range(M):
    CD.append(list(map(int, input().split())))

for i in range(N):
    distance = 10**8+7
    for j in range(M)[::-1]:
        temp = abs(AB[i][0] - CD[j][0]) + abs(AB[i][1] - CD[j][1])
        # print(AB[i][0] - CD[j][0],AB[i][1] - CD[j][1])
        # print('temp=',temp,'j=',j)
        if temp <= distance:
            distance = temp
            ans = j+1
            # print('ans=',ans)
    print(ans)

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

AB = []

for _ in range(N):
    AB.append(list(map(int, input().split())))

CD = []

for _ in range(M):
    CD.append(list(map(int, input().split())))

for i in range(N):
    distance = 10**9+7
    for j in range(M)[::-1]:
        temp = abs(AB[i][0] - CD[j][0]) + abs(AB[i][1] - CD[j][1])
        # print(AB[i][0] - CD[j][0],AB[i][1] - CD[j][1])
        # print('temp=',temp,'j=',j)
        if temp <= distance:
            distance = temp
            ans = j+1
            # print('ans=',ans)
    print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())

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

    # divisors.sort()
    return divisors

X = make_divisors(N)

for i in X:
    ans = min(1000, max(len(str(i[0])), len(str(i[1]))))

print(ans)

Fixed submission:
N = int(input())

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

    # divisors.sort()
    return divisors

X = make_divisors(N)
ans = 10

for i in X:
    ans = min(ans, max(len(str(i[0])), len(str(i[1]))))

print(ans)

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

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

    # divisors.sort()
    return divisors

X = make_divisors(N)

for i in X:
    ans = min(10, max(len(str(i[0])), len(str(i[1]))))

print(ans)

Fixed submission:
N = int(input())

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

    # divisors.sort()
    return divisors

X = make_divisors(N)
ans = 10

for i in X:
    ans = min(ans, max(len(str(i[0])), len(str(i[1]))))

print(ans)

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

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

    # divisors.sort()
    return divisors

X = make_divisors(N)

for i in X:
    ans = min(11, max(len(str(i[0])), len(str(i[1]))))

print(ans)

Fixed submission:
N = int(input())

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

    # divisors.sort()
    return divisors

X = make_divisors(N)
ans = 10

for i in X:
    ans = min(ans, max(len(str(i[0])), len(str(i[1]))))

print(ans)
Buggy python submission (verdict: Runtime Error):
S = input()

while True:
    if len(S) == 0:
        print('YES')
        break
    else:
        if S[-5:]=='dream':
            S = S[:-5]
        elif S[-7:] == 'dreamer':
            S = S[:-7]
        elif S[-5:]== 'erase':
            S = S[:-5]
        elif S[-6:] == X4:
            S = S[:-6]
        else:
            print('NO')
            break


Fixed submission:
S = input()

while True:
    if len(S) == 0:
        print('YES')
        break
    else:
        if S[-5:]=='dream':
            S = S[:-5]
        elif S[-7:] == 'dreamer':
            S = S[:-7]
        elif S[-5:]== 'erase':
            S = S[:-5]
        elif S[-6:] == 'eraser':
            S = S[:-6]
        else:
            print('NO')
            break
Buggy python submission (verdict: Runtime Error):
n = int(input())
a_list = list(map(int, input().split()))
ama_a = sum(a_list)
ans = 0
mod = 10**9+7
for i in a_list:
  ans+=i**2
ans = ama_a**2-ans
ans *= (mod+1)/2
ans %= mod
print(int(ans))

              
    

Fixed submission:
d, t, s = map(int, input().split())
if d <= t*s:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
x = list([0] * n for i in range(n))
for _ in range(n-1):
  a,b  = map(int,input().split())
  a -= 1
  b -= 1
  x[a][b] += 1
  x[b][a] += 1
  for i in range(b-1):
    if x[a][i] == 1:
      x[i][b] += 1
shio = [0] *n
for j in range(q):
  a,b =map(int,input().split())
  a -= 1
  shio[a] += b
  for k in range(a,n):
    if x[a][k] == 1:
      shio[k] += b
for i in range(n):
  print(shio[i])
    
    
    
  

Fixed submission:
N,Q = map(int,input().split(" "))
A = [0]*N

B = [0 for j in range(N)]
for i in range(N-1):
    a,b = map(int,input().split(" "))
    A[b-1] = a-1
    
for j in range(Q):
    tmp = list(map(int,input().split(" ")))
    B[tmp[0]-1] += tmp[1]

for i in range(1,N):
        B[i] += B[A[i]]
for i in range(N):
        print(B[i],end=" ")

Buggy python submission (verdict: Time Limit Exceeded):
n,q = map(int,input().split())
x = list([0] * n for i in range(n))
for _ in range(n-1):
  a,b  = map(int,input().split())
  a -= 1
  b -= 1
  x[a][b] += 1
  x[b][a] += 1
  for i in range(b-1):
    if x[a][i] == 1:
      x[i][b] += 1
shio = [0] *n
for j in range(q):
  a,b =map(int,input().split())
  a -= 1
  shio[a] += b
  for k in range(a,n):
    if x[a][k] == 1:
      shio[k] += b
for i in range(n):
  print(shio[i])
    
    
    
  

Fixed submission:
N,Q = map(int,input().split(" "))
A = [0]*N

B = [0 for j in range(N)]
for i in range(N-1):
    a,b = map(int,input().split(" "))
    A[b-1] = a-1
    
for j in range(Q):
    tmp = list(map(int,input().split(" ")))
    B[tmp[0]-1] += tmp[1]

for i in range(1,N):
        B[i] += B[A[i]]
for i in range(N):
        print(B[i],end=" ")
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = [0] * n
for i in range(n):
  x[i] = sorted(list(input())) 
count = 0
for j in range(n):
  for k in range(j+1,n):
    if x[j] == x[k]:
      count += 1
print(count)

Fixed submission:
ans=0
d={}
for i in [input() for i in range(int(input()))]:
    a=''.join(sorted([c for c in i]))
    if a in d:
        ans+=d[a]
        d[a]+=1
    else:
        d[a]=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
work = [list(map(int, input().split())) for i in range(n)]
from operator import itemgetter
work = sorted(work,key=itemgetter(1),reverse=True)
count = 0
for i in range(1,m+1):
  for j in range(len(work)):
    if work[j][0] <= i:
      count += work[j][1]
      del work[j]
      break
print(count)



Fixed submission:
import heapq

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

a = [0] * n
b = [0] * n
info = [[] for _ in range(m+1)]

for i in range(n):
    a[i], b[i] = map(int,input().split())
    if a[i] <= m:
        info[a[i]].append(b[i])

l = []
count = 0

for j in range(1,m+1):
    for x in info[j]:
        heapq.heappush(l,-x)
    if l != []:
        count += -heapq.heappop(l)

print(count)
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int,input().split())
print(max(0,c-a+b)

Fixed submission:
a,b,c = map(int,input().split())
print(max(0,c-a+b))
Buggy python submission (verdict: Runtime Error):
n,a,b = map(int,input.split())
return(min(n*a,b))

Fixed submission:
n,a,b = map(int,input().split())
if n*a >= b:
  print(b)
else:
  print(n*a)
Buggy python submission (verdict: Runtime Error):
c = a*b
if c % 2 == 0:
  return Even
else:
  return Odd

Fixed submission:
a,b = map(int, raw_input().split())
c = a*b
if c % 2 == 0:
  print("Even")
else:
  print("Odd")
Buggy python submission (verdict: Runtime Error):
shio = string(raw_input())
counter = 0
for i in 2:
  if shio[i] == "1":
    counter +=1
print(counter)

Fixed submission:
shio = str(raw_input())
counter = 0
i=0
while i < 3:
  if shio[i] == "1":
    counter +=1
  i +=1
print(counter)

Buggy python submission (verdict: Runtime Error):
shio = string(raw_input())
counter = 0
for i in 2
	if shio[i] = "1":
    	counter+=1
print(counter)
  

Fixed submission:
shio = str(raw_input())
counter = 0
i=0
while i < 3:
  if shio[i] == "1":
    counter +=1
  i +=1
print(counter)

Buggy python submission (verdict: Runtime Error):
shio = string(input())
x = 0
for i in shio:
  if shio = "0":
    x+=1


Fixed submission:
shio = str(raw_input())
counter = 0
i=0
while i < 3:
  if shio[i] == "1":
    counter +=1
  i +=1
print(counter)
Buggy python submission (verdict: Runtime Error):
k,s = map(int,input().split())
for i in range(k):
  for j in range(k):
    if 0<=(s-k-j)<=k:
      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):
    if 0<=(s-i-j)<=k:
      count+=1
print(count)
Buggy python submission (verdict: Time Limit Exceeded):
n,k=map(int,input().split())
a=[0]*n
ans=[0]*n
a=list(map(int,input().split()))

for _ in range(k):
  ans=[0]*n
  for i in range(n):
    left=max(0,i-a[i])
    right=min(n-1,i+a[i])
    #print(left,right)
    for j in range(left,right+1):
      ans[j]+=1
  a=ans

print(" ".join(map(str,a)))

Fixed submission:
import math
n,k=map(int,input().split())
  
a=[0]*n
ans=[0]*n
a=list(map(int,input().split()))
check=math.ceil(math.log2(n))+1
if (k>=42):
  a=[n]*n
  print(" ".join(map(str,a)))
else:
  for _ in range(k):
    ans=[0]*n
    table=[0]*n
    for i in range(n):
      left=max(0,i-a[i])
      right=min(n-1,i+a[i])
      table[left]+=1
      if (right+1<n):
        table[right+1]-=1
      #print(left,right)
      #for j in range(left,right+1):
      #  ans[j]+=1
    #print(table)
    for i in range(1,n):
      table[i]+=table[i-1]
    a=table
 
  print(" ".join(map(str,a)))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[0]*n
a=list(map(int,input().split()))

ans=1
for i in range(n):
    ans*=a[i]
    if (ans>10**18):
        ans=-1

if (ans>=0):
    print(ans)
else:
    print(-1)

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

ans=1
for i in range(n):
    ans*=a[i]
    if (ans==0):
        break
    if (ans>10**18):
        ans=-1
        break

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
t=input()
n=len(t)
for i in range(n):
  if (t[i]=="?"):
    t=t[:i]+"D"+t[i+1:]
    
print(t)

Fixed submission:
t=input()
ans=""
n=len(t)
for i in range(n):
  if (t[i]=="?"):
    ans=ans+"D"
  else:
    ans=ans+t[i]
    
print(ans)
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split())
a=[0]*n
a=list(map(int,input().split()))

List=[0]*n
pattern=[1]
now=0
nex=0
List[0]=1
end_flag=0

while end_flag==0:
    nex=a[now]
    if (List[nex-1]==1):
        target1=nex
        end_flag=1
        break
    else:
        List[nex-1]+=1
        pattern.append(nex)
        now=nex-1

left=pattern.index(target1)
right=len(pattern)
kaisu=right-left
kaisu2=(k-right)%kaisu

if (k<=right):
    print(pattern[k])
else:
    print(pattern[left+kaisu2])
    
    
##print("left",left,"right",right)
#print(pattern[target])
#print(kaisu,target)



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

List=[0]*n
pattern=[1]
now=0
nex=0
List[0]=1
end_flag=0

while end_flag==0:
    nex=a[now]
    if (List[nex-1]==1):
        target1=nex
        end_flag=1
        break
    else:
        List[nex-1]+=1
        pattern.append(nex)
        now=nex-1

left=pattern.index(target1)
right=len(pattern)
kaisu=right-left
kaisu2=(k-right)%kaisu


if (k<=right-1):
    print(pattern[k])
else:
    print(pattern[left+kaisu2])
Buggy python submission (verdict: Runtime Error):
x=int(input())
List=[]

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

Flag=0
for i in range(1,int(x**0.5)+1):
    if (x%i==0):
        List=make_divisors(i)
        for j in List:
            if ((j+i)**5-j**5==x):
                B=j
                A=B+i
                Flag=1
                break
            if ((-j+i)**5+j**5==x):
                B=-j
                A=B+i
                Flag=1
                break
        if (Flag==1):
            break
            
print(A,B)

Fixed submission:
x=int(input())
A=0
B=0

for i in range(-200,200):
    for j in range(-200,200):
        if (i**5-j**5==x):
            A=i
            B=j
print(A,B)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[0]*n
a=list(map(int,input().split()))
L=[]
R=[]
ans=0
for i in range(n):
    L.append(i-a[i])
    R.append(i+a[i])
    ans+=L.count(R[i])+R.count(L[i])

print(ans)

Fixed submission:
n=int(input())
a=[0]*n
a=list(map(int,input().split()))
L={}
R={}
ans=0
for i in range(n):
    L.setdefault(i-a[i],0)
    R.setdefault(i+a[i],0)
    L[i-a[i]]+=1
    R[i+a[i]]+=1
    
    if (i-a[i] in R):
        ans+=R[i-a[i]]
        #print(ans,L[i-a[i]])
    if (i+a[i] in L):
        ans+=L[i+a[i]]

print(ans)
#print(L)
#print(R)

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[0]*n
ans2=[0]*n
ans1=[0]*n
a=list(map(int,input().split()))
List=[i for i in range(1,n+1)]

ans1=[List[i]+a[i] for i in range(n)]
ans2=[List[i]-a[i] for i in range(n)]

#print(ans1)
#print(ans2)
al1=max(ans1)
al2=max(ans2)
al=max(al1,al2)
ans=0
for i in range(al):
  if (ans1.count(i)>0 and ans2.count(i)>0):
    ans+=ans1.count(i)*ans2.count(i)
print(ans)

Fixed submission:
n=int(input())
a=[0]*n
a=list(map(int,input().split()))
L={}
R={}
ans=0
for i in range(n):
    L.setdefault(i-a[i],0)
    R.setdefault(i+a[i],0)
    L[i-a[i]]+=1
    R[i+a[i]]+=1
    
    if (i-a[i] in R):
        ans+=R[i-a[i]]
        #print(ans,L[i-a[i]])
    if (i+a[i] in L):
        ans+=L[i+a[i]]

print(ans)
#print(L)
#print(R)
Buggy python submission (verdict: Time Limit Exceeded):
s=input()
n=len(s)
List=[0]*2019
ans=0

for i in range(0,n):
  List[(int(s[i:])%2019)]+=1
  #print(s[i:],int(s[i:])%2019)
  
#print(List)
ans=List[0]
for i in List:
  if (i>=2):
    ans+=(i*(i-1))//2
  
print(ans)

Fixed submission:
S=input()[::-1]
List=[0]*2019
ans=0
a=1
d=0

for s in S:
  d=d+int(s)*a
  List[d%2019]+=1
  a=a*10
  a=a%2019
  #print(s[i:],int(s[i:])%2019)
  
#print(List)
ans=List[0]
for i in List:
  if (i>=2):
    ans+=(i*(i-1))//2
  
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
n=len(s)
List=[0]*2019
ans=0
for i in range(0,n):
  List[(int(s[i:])%2019)]+=1
  #print(s[i:],int(s[i:])%2019)
  
#print(List)
ans=List[0]
for i in range(2019):
  ans+=(List[i]*(List[i]-1))//2
  
print(ans)

Fixed submission:
S=input()[::-1]
List=[0]*2019
ans=0
a=1
d=0

for s in S:
  d=d+int(s)*a
  List[d%2019]+=1
  a=a*10
  a=a%2019
  #print(s[i:],int(s[i:])%2019)
  
#print(List)
ans=List[0]
for i in List:
  if (i>=2):
    ans+=(i*(i-1))//2
  
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s=input()
n=len(s)
ans=0
for i in range(n-3):
    for j in range(i+5,n+1):
        if (int(s[i:j])%2019==0):
            ans+=1
print(ans)

Fixed submission:
S=input()[::-1]
List=[0]*2019
ans=0
a=1
d=0

for s in S:
  d=d+int(s)*a
  List[d%2019]+=1
  a=a*10
  a=a%2019
  #print(s[i:],int(s[i:])%2019)
  
#print(List)
ans=List[0]
for i in List:
  if (i>=2):
    ans+=(i*(i-1))//2
  
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[0]*(n-1)
a=list(map(int,input().split()))
 
for i in range(n):
    print(a.count(i+1))

Fixed submission:
n=int(input())
a=[0]*(n-1)
a=list(map(int,input().split()))
a=sorted(a)
ans=0
target=1
j=0
for i in range(n):
    if (j<n-1):
        while(a[j]==target):
            ans+=1
            j+=1
            #print(j,"here")
            if (j>n-2):
                break
    print(ans)
    ans=0
    target+=1

Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[0]*(n-1)
a=list(map(int,input().split()))

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

Fixed submission:
n=int(input())
a=[0]*(n-1)
a=list(map(int,input().split()))
a=sorted(a)
ans=0
target=1
j=0
for i in range(n):
    if (j<n-1):
        while(a[j]==target):
            ans+=1
            j+=1
            #print(j,"here")
            if (j>n-2):
                break
    print(ans)
    ans=0
    target+=1
Buggy python submission (verdict: Time Limit Exceeded):
k=int(input())

queue=[1,2,3,4,5,6,7,8,9]

for i in range(k):
    x=queue.pop(0)
    if (x%10!=0):
        queue.append(10*x+(x%10)-1)
    queue.append(10*x+(x%10))
    if (x%10!=9):
        queue.append(10*x+(x%10)+1)
        
print(x)

Fixed submission:
from queue import deque

k=int(input())
q=deque()
for i in range(1,10):
    q.append(i)

for i in range(k):
    x=q.popleft()
    if (x%10!=0):
        q.append(10*x+(x%10)-1)
    q.append(10*x+(x%10))
    if (x%10!=9):
        q.append(10*x+(x%10)+1)
        
print(x)
Buggy python submission (verdict: Time Limit Exceeded):
n,x,y=map(int,input().split())
ans=[0]*(n-1)
for i in range(n):
  for j in range(i+1,n):
    nagasa=min(abs(j-i),(abs(x-(i+1))+1+abs((j+1)-y)),(abs(y-(i+1))+1+abs((j+1)-x)))
    #print(i,j,nagasa)
    ans[nagasa-1]+=1
for i in range(n-1):
  print(ans[i])

Fixed submission:
n,x,y=map(int,input().split())
ans=[0]*(n-1)
for i in range(n):
  for j in range(i+1,n):
    nagasa=min(abs(j-i),(abs(x-(i+1))+1+abs((j+1)-y)),(abs(y-(i+1))+1+abs((j+1)-x)))
    #print(i,j,nagasa)
    ans[nagasa-1]+=1
for i in range(n-1):
  print(ans[i])