Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int, input().split())
count=n//a+b*a
n=n%(a+b)
count+=min(n,a)
print(count)


Fixed submission:
n,a,b=map(int, input().split())
count=n//(a+b)*a
n=n%(a+b)
count+=min(n,a)
print(count)
Buggy python submission (verdict: Runtime Error):
n,a,b=map(int,input().split())
count=int(n/(a+b))*a
n=n%(a+b)
if(n<=b):
    count=count+n
else:
    count=count+b
print(count)

Fixed submission:
import math

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

emin=math.ceil(a/0.08)
emax=math.ceil((a+1)/0.08)-1
tmin=math.ceil(b/0.1)
tmax=math.ceil((b+1)/0.1)-1

if tmin<=emin<=tmax:
    print(emin)
elif emin<=tmin<=emax:
    print(tmin)
else:
    print(-1)
Buggy python submission (verdict: Runtime Error):
s=input()
n=int(input())
rev=1
pre=''
suf=''

for i in range(n):
  q=input().split()
  if q[0]=='1':
    rev+=1
  elif (rev+int(q[1]))%2==0:
    pre=q[2]+pre
  else:
    suf=suf+q[2]
    
ans=pre+s+suf
  
if rev%2==0:
  ans.reverse()

print(ans)

Fixed submission:
s=input()
n=int(input())
rev=1
pre=''
suf=''

for i in range(n):
  q=input().split()
  if q[0]=='1':
    rev+=1
  elif (rev+int(q[1]))%2==0:
    pre=q[2]+pre
  else:
    suf=suf+q[2]
    
ans=pre+s+suf
  
if rev%2==0:
  print(ans[::-1])
else:
  print(ans)

Buggy python submission (verdict: Runtime Error):
s=input()
n=int(input())
rev=1

for i in range(n):
  q=input().split()
  if q[0]=='1':
    rev+=1
  elif (rev+int(q[1]))%2==0:
    s=q[2]+s
  else:
    s=s+q[2]
    
if rev%2==0:
  s.reverse()

print(s)

Fixed submission:
s=input()
n=int(input())
rev=1
pre=''
suf=''

for i in range(n):
  q=input().split()
  if q[0]=='1':
    rev+=1
  elif (rev+int(q[1]))%2==0:
    pre=q[2]+pre
  else:
    suf=suf+q[2]
    
ans=pre+s+suf
  
if rev%2==0:
  print(ans[::-1])
else:
  print(ans)

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

for i in range(a):
    c=input()
    if c[0]=='1':
        s=''.join(list(reversed(s)))
    else:
        if c[2]=='1':
            s=c[4]+s
        else:
            s=s+c[4]
            
print(s)

Fixed submission:
s=input()
n=int(input())
rev=1
pre=''
suf=''

for i in range(n):
  q=input().split()
  if q[0]=='1':
    rev+=1
  elif (rev+int(q[1]))%2==0:
    pre=q[2]+pre
  else:
    suf=suf+q[2]
    
ans=pre+s+suf
  
if rev%2==0:
  print(ans[::-1])
else:
  print(ans)

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

for i in range(a):
    c=input()
    if c[0]=='1':
        s=''.join(list(reversed(s)))
    else:
        if c[2]=='1':
            s=c[4]+s
        else:
            s=s+c[4]
    
    print(s)
            
print(s)

Fixed submission:
s=input()
n=int(input())
rev=1
pre=''
suf=''

for i in range(n):
  q=input().split()
  if q[0]=='1':
    rev+=1
  elif (rev+int(q[1]))%2==0:
    pre=q[2]+pre
  else:
    suf=suf+q[2]
    
ans=pre+s+suf
  
if rev%2==0:
  print(ans[::-1])
else:
  print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,p=map(int,input().split())
s=input().rstrip()
ans=0
l=[0]*p
 
if p==2 or p==5:
    for i in range(n):
        if int(s[i])%p==0:
            ans+=i+1
 
else:
    for i in range(n):
        mod=int(s[-(i+1):])%p
        ans+=l[mod]
        l[mod]+=1
        if mod==0:
            ans+=1
 
print(ans)

Fixed submission:
n,p=map(int,input().split())
s=input().rstrip()
ans=0
l=[0]*p
a=[0,1,2,3,4,5,6,7,8,9]
c=0

if p==2 or p==5:
    for i in range(n):
        if int(s[i])%p==0:
            ans+=i+1
else:
    for i in range(n):
        # mod=int(s[-(i+1):])%p
        mod=(c+a[int(s[-(i+1)])])%p
        ans+=l[mod]
        l[mod]+=1
        if mod==0:
            ans+=1
        c=mod
        
        for j in range(10):
            a[j]=a[j]*10%p
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,p=map(int,input().split())
s=input().rstrip()
ans=0
l=[]

if p==2 or p==5:
    for i in range(n):
        if int(s[i])%p==0:
            ans+=i+1

else:
    for i in range(n):
        mod=int(s[-(i+1):])%p
        ans+=l.count(mod)
        l.append(mod)
        if mod==0:
            ans+=1

print(ans)

Fixed submission:
n,p=map(int,input().split())
s=input().rstrip()
ans=0
l=[0]*p
a=[0,1,2,3,4,5,6,7,8,9]
c=0

if p==2 or p==5:
    for i in range(n):
        if int(s[i])%p==0:
            ans+=i+1
else:
    for i in range(n):
        # mod=int(s[-(i+1):])%p
        mod=(c+a[int(s[-(i+1)])])%p
        ans+=l[mod]
        l[mod]+=1
        if mod==0:
            ans+=1
        c=mod
        
        for j in range(10):
            a[j]=a[j]*10%p
 
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n,p=map(int,input().split())
s=input().rstrip()
ans=0
l=[]

if p==2 or p==5:
    for i in range(n):
        if int(s[i])%p==0:
            ans+=i+1

else:
    for i in range(n):
        mod=int(s[-(i+1):])%p
        ans+=l.count(mod)
        l.append(mod)
        if mod==0:
            ans+=1

print(ans)

Fixed submission:
n,p=map(int,input().split())
s=input().rstrip()
ans=0
l=[0]*p
a=[0,1,2,3,4,5,6,7,8,9]
c=0

if p==2 or p==5:
    for i in range(n):
        if int(s[i])%p==0:
            ans+=i+1
else:
    for i in range(n):
        # mod=int(s[-(i+1):])%p
        mod=(c+a[int(s[-(i+1)])])%p
        ans+=l[mod]
        l[mod]+=1
        if mod==0:
            ans+=1
        c=mod
        
        for j in range(10):
            a[j]=a[j]*10%p
 
print(ans)
Buggy python submission (verdict: Runtime Error):
l=[list(map(int,input().split())) for i in range(3)]
n=int(input())
H=[0,0,0]
W=[0,0,0]
S=[0,0]
 
for i in range(n):
    b=int(input())
    for h in range(3):
        for w in range(3):
            if b==l[h][w]:
                H[h]+=1
                W[w]+=1
                if h==w:
                    S[0]+=1
                if h+w==4:
                    S[1]+=1
 
check=False
for h in H:
    if h==3:
        check=True
for w in W:
    if w==3:
        check=True
for s in S:
    if s==3:
        check=True
 
if check:
    print("Yes")
else:
    print("No")
l=[list(map(int,input().split())) for i in range(3)]
n=int(input())
H=[0,0,0]
W=[0,0,0]
S=[0,0]

for i in range(n):
    b=int(input())
    for h in range(3):
        for w in range(3):
            if b==l[h][w]:
                H[h]+=1
                W[w]+=1
                if h==w:
                    S[0]+=1
                if h+w==2:
                    S[1]+=1

check=False
for h in H:
    if h==3:
        check=True
for w in W:
    if w==3:
        check=True
for s in S:
    if s==3:
        check=True

if check:
    print("Yes")
else:
    print("No")

Fixed submission:
l=[list(map(int,input().split())) for i in range(3)]
n=int(input())
H=[0,0,0]
W=[0,0,0]
S=[0,0]

for i in range(n):
    b=int(input())
    for h in range(3):
        for w in range(3):
            if b==l[h][w]:
                H[h]+=1
                W[w]+=1
                if h==w:
                    S[0]+=1
                if h+w==2:
                    S[1]+=1

check=False
for h in H:
    if h==3:
        check=True
for w in W:
    if w==3:
        check=True
for s in S:
    if s==3:
        check=True

if check:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
s=list(input())
q=int(input())
for i in range(q):
    a,b,c=input().split()
    if a=='1':
        s[int(b)-1]=c
    else:
        t=set(s[int(b)-1:int(c)])
        print(len(t))


Fixed submission:
import bisect

n=int(input())
s=list(input())

#アルファベットの各文字に対してからのリストを持つ辞書
alpha={chr(i):[] for i in range(97,123)}

#alpha[c]で各文字ごとに出現場所をソートして保管
for i,c in enumerate(s):
    bisect.insort(alpha[c],i+1)

for i in range(int(input())):
    p,q,r=input().split()
    if p=='1':
        q=int(q)
        b=s[q-1]
        if b!=r:
            alpha[b].pop(bisect.bisect_left(alpha[b],q))
            bisect.insort(alpha[r],q)
            s[q-1]=r
    else:
        count=0
        for l in alpha.values():
            pos=bisect.bisect_left(l,int(q))
            if pos<len(l) and l[pos]<=int(r):
                count+=1
        print(count)
Buggy python submission (verdict: Runtime Error):
def modpow(a,n):
    if n==0:
        return 1
    elif n==1:
        return a%mod
    elif n%2==0:
        return (modpow(a,n/2)**2)%mod
    else:
        return (a*modpow(a,n-1))%mod

def modfact(l,r):
    fact=1
    for i in range(l-r+1):
        fact=fact*(r+i)%mod
    return fact

def comb(n,x):
    S=modfact(n,n-x+1)
    fact=modfact(x,1)
    T=modpow(fact,mod-2)
    print(S,fact,T,S*T%mod)
    return S*T%mod

n,a,b=map(int,input().split())
fact=modpow(2,n)
ans=fact-1-comb(n,a)-comb(n,b)
while ans<0:
    ans+=mod
print(ans)

Fixed submission:
mod=10**9+7

def modpow(a,n):
    if n==0:
        return 1
    elif n==1:
        return a%mod
    elif n%2==0:
        return (modpow(a,n/2)**2)%mod
    else:
        return (a*modpow(a,n-1))%mod

def modfact(l,r):
    fact=1
    for i in range(l-r+1):
        fact=fact*(r+i)%mod
    return fact

def comb(n,x):
    S=modfact(n,n-x+1)
    fact=modfact(x,1)
    T=modpow(fact,mod-2)
    return S*T%mod

n,a,b=map(int,input().split())
fact=modpow(2,n)
ans=fact-1-comb(n,a)-comb(n,b)
while ans<0:
    ans+=mod
print(ans)
Buggy python submission (verdict: Runtime Error):
n = input()
print((n+1)//2)

Fixed submission:
n = int(input())
print((n+1)//2)
Buggy python submission (verdict: Runtime Error):
A = [list(map(int, input().split())) for _ in range(3)]
n = input()
B = list(map(int, input().split()))
ans = False

bingolist = []
for i in range(3):
  bingolist.append([A[i][0], A[i][1], A[i][2]])
  bingolist.append([A[0][i], A[1][i], A[2][i]])

bingolist.append([A[0][0], A[1][1], A[2][2]])
bingolist.append([A[2][0], A[1][1], A[0][2]])

for i in bingolist:
  ans = True if (i[0] in B and i[1] in B and i[2] in B)
  
print(ans)

Fixed submission:
A = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
B = [int(input()) for _ in range(n)]
ans = False

bingolist = []
for i in range(3):
  bingolist.append([A[i][0], A[i][1], A[i][2]])
  bingolist.append([A[0][i], A[1][i], A[2][i]])

bingolist.append([A[0][0], A[1][1], A[2][2]])
bingolist.append([A[2][0], A[1][1], A[0][2]])

for i in bingolist:
  if i[0] in B and i[1] in B and i[2] in B: ans = True
  
print("Yes" if ans else "No")
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
ctr = [-1 for _ in range(n)]
flag = True
for i in range(m):
  p, q = map(int, input().split())
  p -= 1
  if ctr[p] == -1:
    ctr[p] = q
  else:
    flag = False
    break

flag = False if ctr[0] = 0

if flag:
  for i in ctr:
    print(1 if i == -1 else i, end="")
else:
  print(-1)

Fixed submission:
n, m = map(int, input().split())
ctr = [-1 for _ in range(n)]
flag = True
for i in range(m):
  p, q = map(int, input().split())
  p -= 1
  if ctr[p] == -1:
    ctr[p] = q
  else:
    if(ctr[p] != q):
      flag = False
      break

if ctr[0] == 0 and n > 1:
  flag = False

if ctr[0] == -1:
  ctr[0] = 0 if n == 1 else 1
if flag:
  for i in ctr:
    print(0 if i == -1 else i, end="")
else:
  print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
k = int(input())

if (k % 2 == 0 or k % 5 == 0):
    print('-1')
    exit()

sept = 7

count = 1
for i in range(1000000):
    if sept % k == 0:
        print(count)
        exit()

    else:
        sept = int(str(sept) + '7')
        count += 1

else:
    print('-1')


Fixed submission:
k = int(input())

if ((k % 2 == 0) or (k % 5 == 0)):
    print(-1)

else:
    if k % 7 == 0:
        d = (9 * k) // 7
    else:
        d = 9 * k
    
    res = 10

    for i in range(1, 100000000):
        if res % d == 1:
            print(i)
            exit()
        else:
            res = (res % d) * 10
    print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
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 = 0

for i in range(n+1):
    if A[i] > k:
        break
    for j in range(m, -1, -1):
        time = A[i]+B[j]
        count = i+j
        if time <= k and count > ans:
            ans = count
            break

print(ans)

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 = 0
j = m

for i in range(n+1):
    if A[i] > k:
        break
    while (A[i]+B[j]) > k:
        j -= 1
    ans = max(ans, i+j)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
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 = 0

for i in range(n+1):
    for j in range(m, -1, -1):
        time = A[i]+B[j]
        count = i+j
        if time <= k and count > ans:
            ans = count
            break

print(ans)

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 = 0
j = m

for i in range(n+1):
    if A[i] > k:
        break
    while (A[i]+B[j]) > k:
        j -= 1
    ans = max(ans, i+j)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
# import collections
# import math

# def func(num):
#     if num == 1:
#         return 1
#     elif num == 2:
#         return 4
#     elif num == 3:
#         return 6

#     else:
#         count = 2
#         #1と自身
#         for i in range(2, int(math.sqrt(num)+2)):
#             if num%i == 0:
#                 count += 1
#         value = num*count
#         return value

# n = int(input())

# ans = 0
# for i in range(1, n+1):
#     ans += func(i)
    
# print(ans)

# import collections
# import math

# def func(num):
#     if num == 1:
#         return 1
#     elif num == 2:
#         return 4
#     elif num == 3:
#         return 6
#     else:
#         numbers = []
#         temp = num
#         while num%2 == 0:
#             numbers.append(2)
#             num //= 2

#         i = 3
#         while i*i <= num:
#             if num%i == 0:
#                 numbers.append(i)
#                 num //= i
#             else:
#                 i += 2

#         if num != 1:
#             numbers.append(n)

#         factors = collections.Counter(numbers)
#         divisor = list(factors.values())
#         count = 1

#         for i in divisor:
#             count *= (i+1)

#         value = temp*count
#         return value

# n = int(input())
# ans = 0

# for i in range(1,n+1):
#     ans += func(i)

# print(ans)

import collections
import math

def func(num):
    if num == 1:
        return 1
    elif num == 2:
        return 4
    elif num == 3:
        return 6
    else:
        arr = []
        temp = num
        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])

        count = 1
        for i in range(len(arr)):
            count *= (arr[i][1]+1)
        value = num*count
        return value

            

n = int(input())
ans = 0

for i in range(1,n+1):
    ans += func(i)

print(ans)

            


Fixed submission:

n = int(input())

ans = 0

for i in range(1,n+1):
    lim = n//i
    ans += lim*(lim+1)*i//2

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
b_c = [list(map(int, input().split())) for i in range(q)]

ans = 0

for i in range(q):
    before = b_c[i][0]
    after = b_c[i][1]
    while before in a:
        a[a.index(before)] = after
    ans = sum(a)
    print(ans)


Fixed submission:
import collections

n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc =[list(map(int,input().split())) for i in range(q)]

ans = sum(a)
num = collections.Counter(a)

for i in range(q):
    before = bc[i][0]
    after = bc[i][1]
    ans += num[before]*(after-before)
    num[after] += num[before]
    num[before] = 0
    #print(a.count(before))
    #print(num(before))
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
b_c = [list(map(int, input().split())) for i in range(q)]

ans = 0

for i in range(q):
    before = b_c[i][0]
    after = b_c[i][1]
    while before in a:
        a[a.index(before)] = after
    ans = sum(a)
    print(ans)


Fixed submission:
import collections

n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc =[list(map(int,input().split())) for i in range(q)]

ans = sum(a)
num = collections.Counter(a)

for i in range(q):
    before = bc[i][0]
    after = bc[i][1]
    ans += num[before]*(after-before)
    num[after] += num[before]
    num[before] = 0
    #print(a.count(before))
    #print(num(before))
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
q = int(input())
b_c = [list(map(int, input().split())) for i in range(q)]

ans = 0

for i in range(q):
    before = b_c[i][0]
    after = b_c[i][1]
    for j in range(n):
        if a[j] == before:
            a[j] = after
    ans = sum(a)
    print(ans)


Fixed submission:
import collections

n = int(input())
a = list(map(int, input().split()))
q = int(input())
bc =[list(map(int,input().split())) for i in range(q)]

ans = sum(a)
num = collections.Counter(a)

for i in range(q):
    before = bc[i][0]
    after = bc[i][1]
    ans += num[before]*(after-before)
    num[after] += num[before]
    num[before] = 0
    #print(a.count(before))
    #print(num(before))
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = list(map(int,input().split()))
p = 1
for i in range(n):
    p *= a_list[i]
if p > 10**18:
        print(-1)
else:
    print(p)


Fixed submission:
n = int(input())
a_list = list(map(int,input().split()))
p = 1
for i in range(n):
    if a_list[i] == 0:
        print(0)
        exit()
for i in range(n):
    p *= a_list[i]
    if p > 10**18:
        print(-1)
        exit()
print(p)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a_list = list(map(int,input().split()))
p = 1
for i in range(n):
    p *= a_list[i]
if p > 10**18:
        print(-1)
else:
    print(p)


Fixed submission:
n = int(input())
a_list = list(map(int,input().split()))
p = 1
for i in range(n):
    if a_list[i] == 0:
        print(0)
        exit()
for i in range(n):
    p *= a_list[i]
    if p > 10**18:
        print(-1)
        exit()
print(p)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = float(input)
b_int = int(b*100)

ans = a*b_int//100
print(ans

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

ans = (a*b)//100

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]

matrix = [list(0 for i in range(n)) for i in range(n)]

for comb in ab:
    matrix[comb[0]-1][comb[1]-1] = 1
    matrix[comb[1]-1][comb[0]-1] = 1

count = 0

for i in range(n):
    for j in range(n):
        if matrix[i][j] == 1 and h[i] <= h[j]:
            break
    else:
        count += 1

print(count)


Fixed submission:
n,m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]

good = [1]*n

for comb in ab:
    a = comb[0]-1
    b = comb[1]-1
    if h[a] <= h[b]:
        good[a] = 0
    if h[a] >= h[b]:
        good[b] = 0

ans = sum(good)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
h = list(map(int, input().split()))
ab_list = [list(map(int, input().split())) for i in range(m)]
count = 0
good = [i+1 for i in range(n)]
#print(h,ab_list)
for j in range(m):
    if h[ab_list[j][0]-1] <= h[ab_list[j][1]-1]:
        if ab_list[j][0] in good:
            good.remove(ab_list[j][0])
    if h[ab_list[j][0]-1] >= h[ab_list[j][1]-1]:
        if ab_list[j][1] in good:
            good.remove(ab_list[j][1])
    #print(good)
print(len(good))


Fixed submission:
n,m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]

good = [1]*n

for comb in ab:
    a = comb[0]-1
    b = comb[1]-1
    if h[a] <= h[b]:
        good[a] = 0
    if h[a] >= h[b]:
        good[b] = 0

ans = sum(good)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
h = list(map(int, input().split()))
ab_list = [list(map(int, input().split())) for i in range(m)]
count = 0
good = [i+1 for i in range(n)]
#print(h,ab_list)
for j in range(m):
    if h[ab_list[j][0]-1] <= h[ab_list[j][1]-1]:
        if ab_list[j][0] in good:
            good.remove(ab_list[j][0])
    if h[ab_list[j][0]-1] >= h[ab_list[j][1]-1]:
        if ab_list[j][1] in good:
            good.remove(ab_list[j][1])
    #print(good)
print(len(good))


Fixed submission:
n,m = map(int, input().split())
h = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]

good = [1]*n

for comb in ab:
    a = comb[0]-1
    b = comb[1]-1
    if h[a] <= h[b]:
        good[a] = 0
    if h[a] >= h[b]:
        good[b] = 0

ans = sum(good)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int,input().split()))
for i in range(n):
    count = 0
    while True:
        if i+1 in a:
            a.remove(i+1)
            count += 1
        else:
            break
    print(count)

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
# for i in range(n):
#     count = 0
#     while True:
#         if i+1 in a:
#             a.remove(i+1)
#             count += 1
#         else:
#             break
#     print(count)
b = [0]*n
for i in range(n-1):
    b[a[i]-1] += 1
for i in range(n):
    print(b[i])