Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
H=int(input())
flag=False
c=0
ans=1
while flag==False:
#for i in range(4):
    H=H//2
    c+=1
    ans+=2**c
    if H==1:
        #break
        flag=True
#print(c)
print(ans)


Fixed submission:
H=int(input())
flag=False
c=0
ans=1
if H==1:
    print(1)
    exit()
while flag==False:
    H=H//2
    c+=1
    ans+=2**c
    if H==1:
        flag=True
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
H=int(input())
flag=False
c=0
while flag==False:
#for i in range(4):
    H=H//2
    c+=1
    if H==1:
        #break
        flag=True
#print(c)
ans=0
for j in range(c+1):
    ans+=2**j
print(ans)


Fixed submission:
H=int(input())
flag=False
c=0
ans=1
if H==1:
    print(1)
    exit()
while flag==False:
    H=H//2
    c+=1
    ans+=2**c
    if H==1:
        flag=True
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=str(input())

list=list(S)

kei=[]
for a in range(N-2):
    for b in range(a+1,N-1):
        if b<=a:
            break
        for c in range(b+1,N):
            if c<=b:
                break
            #print(a,b,c)
            retsu=''
            retsu=retsu+list[a]+list[b]+list[c]
            kei.append(retsu)
last=set(kei)
print(len(last))


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

list=list(S)

count=0
for a in range(10):
    find1=S.find(str(a))
    if find1==-1:
        continue
    for b in range(10):
        find2=S[find1+1:].find(str(b))
        if find2==-1:
            continue
        for c in range(10):
            find3=S[find1+1+find2+1:].find(str(c))
            if find3==-1:
                continue
            count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=str(input())

list=list(S)

kei=[]
for a in range(N-2):
    for b in range(a+1,N-1):
        if b<=a:
            continue
        for c in range(b+1,N):
            if c<=b:
                continue
            #print(a,b,c)
            retsu=''
            retsu=retsu+list[a]+list[b]+list[c]
            kei.append(retsu)
last=set(kei)
print(len(last))


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

list=list(S)

count=0
for a in range(10):
    find1=S.find(str(a))
    if find1==-1:
        continue
    for b in range(10):
        find2=S[find1+1:].find(str(b))
        if find2==-1:
            continue
        for c in range(10):
            find3=S[find1+1+find2+1:].find(str(c))
            if find3==-1:
                continue
            count+=1
print(count)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=str(input())

list=list(S)

kei=[]
for a in range(N-2):
    for b in range(N-1):
        if b<=a:
            continue
        for c in range(N):
            if c<=b:
                continue
            retsu=''
            retsu=retsu+list[a]+list[b]+list[c]
            kei.append(retsu)
last=set(kei)
print(len(last))


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

list=list(S)

count=0
for a in range(10):
    find1=S.find(str(a))
    if find1==-1:
        continue
    for b in range(10):
        find2=S[find1+1:].find(str(b))
        if find2==-1:
            continue
        for c in range(10):
            find3=S[find1+1+find2+1:].find(str(c))
            if find3==-1:
                continue
            count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s=int(n**0.5)
list=[]
for i in range(1,s):
    if n%i==0:
        list.append(int(i+ n/i -2))
print(min(list))


Fixed submission:
n = int(input())
s=int(n**0.5)
list=[]
for i in range(1,s+1):
    if n%i==0:
        list.append(int(i+ n/i -2))
print(min(list))
Buggy python submission (verdict: Runtime Error):
import math
import fractions
A,B = map(int,input().split())

maxn=fractions.gcd(A,B)
list=[]
def isPrime(n):
    if n == 2:
        return True
    if n % 2 == 0:
        return False

    m = math.floor(math.sqrt(n)) + 1
    for p in range(3, m, 2):
        if n % p == 0:
            return False
        return True
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

yaku=make_divisors(maxn)
for i in range(len(yaku)):
    if isPrime(yaku[i]):
        list.append(yaku[i])

print(len(list))


Fixed submission:
N=int(input())
if N%2==0:
  print((N/2)/N)
else:
  print(((N+1)/2)/N)

Buggy python submission (verdict: Runtime Error):
N=int(input())
if N%2==0:
  print(N/2)
else if:
  print((N+1)/2)
	

Fixed submission:
N=int(input())
if N%2==0:
  print((N/2)/N)
else:
  print(((N+1)/2)/N)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with

#A = int(input())
N,K,Q= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
l=np.zeros(N)
l+=K
#print(l)
for m in range(Q):
    A = int(input())
    l-=1
    l[A-1]+=1
#    print(l)
l=np.where(l<1,'No','Yes')
for i in l:
    print(i)


Fixed submission:
import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with

#A = int(input())
N,K,Q= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
l=np.zeros(N)
l+=(K-Q)
#print(l)
for m in range(Q):
    A = int(input())
    l[A-1]+=1
#    print(l)
l=np.where(l<1,'No','Yes')
for i in l:
    print(i)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with

#A = int(input())
N,K,Q= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
l=np.zeros(N)
l+=K
#print(l)
for m in range(Q):
    A = int(input())
    l-=1
    l[A-1]+=1
#    print(l)

for i in np.where(l<1,'No','Yes'):
    print(i)


Fixed submission:
import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with

#A = int(input())
N,K,Q= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
l=np.zeros(N)
l+=(K-Q)
#print(l)
for m in range(Q):
    A = int(input())
    l[A-1]+=1
#    print(l)
l=np.where(l<1,'No','Yes')
for i in l:
    print(i)
Buggy python submission (verdict: Runtime Error):
A,B = map(int,input().split())

for i in range 100:
  C = A*i - i
  if C >= B:
    break
print(i)



Fixed submission:
a = [int(i) for i in input().split()]
ans=0
num=0

while True:
    if a[1]==1:
        break
    if (a[0]-1)*num+a[0] >= a[1]:
        ans = num+1
        break
    num += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
a = [int(i) for i in input().split()]
ans=0
num=0
while True:
  	if a[1]==1:
      break
    if (a[0]-1)*num+a[0] >= a[1]:
        ans = num+1
        break
    num += 1
print(ans)


Fixed submission:
a = [int(i) for i in input().split()]
ans=0
num=0

while True:
    if a[1]==1:
        break
    if (a[0]-1)*num+a[0] >= a[1]:
        ans = num+1
        break
    num += 1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import combinations, permutations
N = int(input())
#N,K = map(int,input().split())
#N = int(input())
V = list(map(int,input().split()))
s=0
S=[0]
for C in combinations(V,2):
    n=N
    v=V.copy()
    v.remove(C[0])
    v.remove(C[1])
    s=(C[0]+C[1])/2**(n-1)
    n-=2
    #print(C,s)
    for D in permutations(v):
        m=n
        k=s
        for i in range(m):

            k+=D[i]/(2**m)
            m-=1
        S.append(k)
#        print(k,D)
print(max(S))


Fixed submission:
N = int(input())
#N,K = map(int,input().split())
#N = int(input())
V = list(map(int,input().split()))
V.sort()
N-=1
s=V[0]/(2**N)
V.pop(0)
for i in range(N):
    s+=V[i]/2**N
    N-=1

print(s)
Buggy python submission (verdict: Time Limit Exceeded):
#import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
from itertools import permutations as perm


N = int(input())
#H1,M1,H2,M2,K= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
l=[]
for i in range(N):
    B = int(input())
    l.append(B)

for i in l:
    x=l.copy()
    x.remove(i)
    m=max(x)
    print(m)


Fixed submission:
#import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
from itertools import permutations as perm


N = int(input())
#H1,M1,H2,M2,K= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
l=[]
for i in range(N):
    B = int(input())
    l.append(B)
m=max(l)
x=l.copy()
x.remove(m)
n=max(x)
for i in l:
    if i!=m:
        print(m)
    else:
        print(n)
Buggy python submission (verdict: Runtime Error):
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    if (N-K+1)<i:
        print(0)
    print((combinations_count(N-K+1,i)*combinations_count(K-1,i-1))%(10**9+7))


Fixed submission:
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    if (N-K+1)<i:
        print(0)
        continue
    print((combinations_count(N-K+1,i)*combinations_count(K-1,i-1))%(10**9+7))

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

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    print((combinations_count(N-K+1,i)*combinations_count(K-1,i-1))%(10**9+7))


Fixed submission:
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    if (N-K+1)<i:
        print(0)
        continue
    print((combinations_count(N-K+1,i)*combinations_count(K-1,i-1))%(10**9+7))

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

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    print((combinations_count(N-K+1,i)*combinations_count(K-1,i-1))%(10**9+7))


Fixed submission:
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,K = [int(i) for i in input().split()]
for i in range(1,K+1):
    if (N-K+1)<i:
        print(0)
        continue
    print((combinations_count(N-K+1,i)*combinations_count(K-1,i-1))%(10**9+7))
Buggy python submission (verdict: Runtime Error):
a = int().split()

b = l[0]+l[1]
c = l[1]+l[2]
d = l[2]+l[0]

e=list[]
e.append(b)
e.append(c)
e.append(d)

print(min(e))

Fixed submission:
a = [int(i) for i in input().split()]
list=[]
S1 = a[0]+a[1]
S2 = a[1]+a[2]
S3 = a[2]+a[0]
list.append(S1)
list.append(S2)
list.append(S3)

print(min(list))
Buggy python submission (verdict: Runtime Error):
A,P=input().split()
print((3*A+2)//2)

Fixed submission:
s,t = map(int,input().split())
f=(s*3+t)//2
print(f)
Buggy python submission (verdict: Runtime Error):
#import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with

#A = int(input())
N,M= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
left=1
right=N
for m in range(M):
    l,r = map(int,input().split())
    if left<=l and l<=right:
        left=l
    if left<=r and r<=right:
        right=r

    if right<l or r<left:
        p=0

if not p:
    print(p)
    exit()
print(right-left+1)


Fixed submission:
#import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with

#A = int(input())
N,M= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
p=1
left=1
right=N
for m in range(M):
    l,r = map(int,input().split())
    if left<=l and l<=right:
        left=l
    if left<=r and r<=right:
        right=r

    if right<l or r<left:
        p=0

if not p:
    print(p)
    exit()
print(right-left+1)
Buggy python submission (verdict: Runtime Error):
N=int(input())
s=input().split()
r=[]
b=[]
for i in s:
  if i=='R':
    r.append(i)
  else:
    b.append(i)
if len(a) > len(b):
  print('Yes')
else:
  print('No')

Fixed submission:
N=int(input())
s=str(input())
r=[]
b=[]
for i in range(N):

  if s[i]=='R':
    r.append(s[i])
  else:
    b.append(s[i])
if len(r) > len(b):
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
S= str(input())
#N,K = map(int,input().split())
#N = int(input())
#V = list(map(int,input().split()))
C=[]
c=0
for i in range(len(S)):
    if S[i]=='A' or S[i]=='T' or S[i]=='C' or S[i]=='G':
        c+=1
    else:
        C.append(c)
        c=0

print(max(C))


Fixed submission:
S= str(input())
#N,K = map(int,input().split())
#N = int(input())
#V = list(map(int,input().split()))
C=[]
c=0
for i in range(len(S)):
    if S[i]=='A' or S[i]=='T' or S[i]=='C' or S[i]=='G':
        c+=1
    else:
        C.append(c)
        c=0
C.append(c)
print(max(C))
Buggy python submission (verdict: Runtime Error):
#import numpy as np
import math
#T= str(input())
#K = int(input())
x1,y1,x2,y2= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())

L=math.sqrt((x1-x2)**2 + (y1-y2)**2)

a=abs(x2-x1)
b=abs(y2-y1)


if x1 =< x2 and y1 =< y2:
    x3 = x2 - b
    y3 = y2 + a
    x4 = x1 - b
    y4 = y1 + a
elif x1 =< x2 and y1 => y2:
    x3 = x2 + b
    y3 = y2 + a
    x4 = x1 + b
    y4 = x1 + a
elif x1 => x2 and y1 =< y2:
    x3 = x2 - b
    y3 = y2 - a
    x4 = x1 - b
    y4 = y1 - a
elif x1 => x2 and y1 => y2:
    x3 = x2 + b
    y3 = y2 - a
    x4 = x1 + b
    y4 = x1 - a

print(x3,y3,x4,y4)

Fixed submission:
#import numpy as np
import math
#T= str(input())
#K = int(input())
x1,y1,x2,y2= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())

a=x2-x1
b=y2-y1

print(x2-b,y2+a,x1-b,y1+a)
exit()
Buggy python submission (verdict: Runtime Error):
#import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm


N = int(input())
#H1,M1,H2,M2,K= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
l=[]
for i in range(N):
    B = int(input())
    l.append(B)

now=0
next=1
c=0
while c<10**6

Fixed submission:
#import numpy as np
#from itertools import combinations as comb
#from itertools import combinations_with_replacement as comb_with
#from itertools import permutations as perm


N = int(input())
#H1,M1,H2,M2,K= map(int,input().split())
#A = list(map(int,input().split()))
#B = list(map(int,input().split()))
#S= str(input())
l=[]
for i in range(N):
    B = int(input())
    l.append(B)

now=0
next=1
c=0
while c<10**6:
    now=next
    if now==2:
        print(c)
        exit()
    next=l[now-1]
    c+=1

print(-1)
Buggy python submission (verdict: Runtime Error):
s=str(input())
x=''
list=[]
for i in range(len(s)):
    if s[i]=='1':
        list.append('1')
    elif s[i]=='0':
        list.append('0')
    elif s[i]=='B' and len(list)!=0:
        del list[i-1]

for i in range(len(list)):
    x += list[i]

print(x)


Fixed submission:
s=str(input())
x=''
list=[]
for i in range(len(s)):
    if s[i]=='1':
        list.append('1')
    elif s[i]=='0':
        list.append('0')
    elif s[i]=='B' and len(list)!=0:
        del list[len(list)-1]

for i in range(len(list)):
    x += list[i]

print(x)

Buggy python submission (verdict: Runtime Error):
s=str(input())
x=''
list=[]
for i in range(len(s)):
    if s[i]=='1':
        list.append('1')
    elif s[i]=='0':
        list.append('0')
    elif s[i]=='B' and len(list)!=0:
        del list[i-1]
    print(list)
for i in range(len(list)):
    x += list[i]

print(x)


Fixed submission:
s=str(input())
x=''
list=[]
for i in range(len(s)):
    if s[i]=='1':
        list.append('1')
    elif s[i]=='0':
        list.append('0')
    elif s[i]=='B' and len(list)!=0:
        del list[len(list)-1]

for i in range(len(list)):
    x += list[i]

print(x)

Buggy python submission (verdict: Runtime Error):
s=str(input())
x=''
list=[]
for i in range(len(s)):
    if s[i]=='1':
        list.append('1')
    elif s[i]=='0':
        list.append('0')
    elif s[i]=='B' and len(list)!=0:
        del list[i-1]
    print(list)
for i in range(len(list)):
    x += list[i]

print(x)


Fixed submission:
s=str(input())
x=''
list=[]
for i in range(len(s)):
    if s[i]=='1':
        list.append('1')
    elif s[i]=='0':
        list.append('0')
    elif s[i]=='B' and len(list)!=0:
        del list[len(list)-1]

for i in range(len(list)):
    x += list[i]

print(x)
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter

N = int(input())
a = list(input().split())
A = [int(a[i]) for i in range(N)]
Q = int(input())
Query = [input().split() for i in range(Q)]
SUM = sum(A)
num = [A.count((i+1)) for i in range(100000)]

for i in range(Q):
    B = int(Query[i][0])
    C = int(Query[i][1])
    SUM += (C-B) * num[B-1]
    print(SUM)
    num[C-1] += num[B-1]
    num[B-1] = 0 

Fixed submission:
from collections import Counter

N = int(input())
a = list(input().split())
A = [int(a[i]) for i in range(N)]
Q = int(input())
Query = [input().split() for i in range(Q)]
SUM = sum(A)
A_count = Counter(A)
num = [A_count[i+1] for i in range(100000)]

for i in range(Q):
    B = int(Query[i][0])
    C = int(Query[i][1])
    SUM += (C-B) * num[B-1]
    print(SUM)
    num[C-1] += num[B-1]
    num[B-1] = 0
Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools

N = int(input())
A = list(input().split())
A = [int(A[i]) for i in range(N+1)]
MAX = [2**i for i in range(N+1)]
A_inter = list(reversed(list(itertools.accumulate(reversed(A)))))

for i in range(N+1):
    if A[i] > MAX[i]:
        print(-1)
        sys.exit()
    elif i != N:
        MAX[i+1] = (MAX[i] - A[i]) * 2
        
print(sum([min(MAX[i], A_inter[i]) for i in range(N+1)]))

Fixed submission:
import sys
import itertools

N = int(input())
A = list(input().split())
A = [int(A[i]) for i in range(N+1)]
MAX = [1 for i in range(N+1)]
A_inter = list(reversed(list(itertools.accumulate(reversed(A)))))

for i in range(N+1):
    if A[i] > MAX[i]:
        print(-1)
        sys.exit()
    elif i != N:
        MAX[i+1] = (MAX[i] - A[i]) * 2
        
print(sum([min(MAX[i], A_inter[i]) for i in range(N+1)]))

Buggy python submission (verdict: Time Limit Exceeded):
import sys
import itertools

N = int(input())
A = list(input().split())
A = [int(A[i]) for i in range(N+1)]
MAX = [2**i for i in range(N+1)]
A_inter = list(reversed(list(itertools.accumulate(reversed(A)))))

for i in range(N+1):
    if A[i] > MAX[i]:
        print(-1)
        sys.exit()
    elif i != N:
        MAX[i+1] = (MAX[i] - A[i]) * 2
        
for i in reversed(range(N+1)):
    MAX[i] = min(MAX[i], A_inter[i])

print(sum(MAX))

Fixed submission:
import sys
import itertools

N = int(input())
A = list(input().split())
A = [int(A[i]) for i in range(N+1)]
MAX = [1 for i in range(N+1)]
A_inter = list(reversed(list(itertools.accumulate(reversed(A)))))

for i in range(N+1):
    if A[i] > MAX[i]:
        print(-1)
        sys.exit()
    elif i != N:
        MAX[i+1] = (MAX[i] - A[i]) * 2
        
print(sum([min(MAX[i], A_inter[i]) for i in range(N+1)]))
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

N, K = map(int, input().split())
tele = list(input().split())
seen = deque([])
now = 1
w_num = 0

while now not in seen and w_num < K:
    seen.append(now)
    now = int(tele[now - 1])
    w_num += 1
    
if w_num == K:
    print(now)
else:
    roop_in_index = seen.index(now)
    roop = list(seen)[roop_in_index:]
    roop_len = len(roop)
    last = (K - (w_num - 1)) % roop_len
    print(roop[last - 1])

Fixed submission:
from collections import deque
import numpy as np

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

tele = list(input().split())
tele = np.array([int(tele[i]) for i in range(N)])
seen = set([])
roop_in = deque([])
now = 1
w_num = 0

while now not in seen and w_num < K:
    seen.add(now)
    roop_in.append(now)
    now = tele[now - 1]
    w_num += 1

if w_num == K:
    print(now)
else:
    roop_in_index = roop_in.index(now)
    roop = list(roop_in)[roop_in_index:]
    roop_len = len(roop)
    last = (K - (w_num - 1)) % roop_len
    print(roop[last - 1])
Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque
from itertools import combinations_with_replacement as combi

N, M, Q = map(int, input().split())
road = deque([input().split() for i in range(Q)])
l = [i+1 for i in range(M)]
point = 0
for v in combi(l, N):
    tmp = 0
    for j in range(Q):
        a, b, c, d = map(int, road[j])
        if v[b-1] - v[a-1] == c:
            tmp += d
    point = max(point, tmp)

print(point)

Fixed submission:
from itertools import combinations_with_replacement as combi

N, M, Q = map(int, input().split())
a = [0] * Q
b = [0] * Q
c = [0] * Q
d = [0] * Q
l = [i+1 for i in range(M)]
point = 0

for i in range(Q):
    a[i], b[i], c[i], d[i] = map(int, input().split())

for v in combi(l, N):
    tmp = 0
    for j in range(Q):
        if v[b[j]-1] - v[a[j]-1] == c[j]:
            tmp += d[j]
    point = max(point, tmp)

print(point)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
count = 0
gacha = []

for i in range(N):
    tmp = input()
    if tmp in gacha:
        continue
    else:
        count += 1
        gacha.append(tmp)
        

print(count)

Fixed submission:
import collections
N = int(input())

gacha = collections.deque()

for i in range(N):
    gacha.append(input())
   
print(len(collections.Counter(gacha)))
Buggy python submission (verdict: Time Limit Exceeded):
import collections

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

stuff_lis = collections.Counter(stuff)
st = list(stuff_lis.keys())
num = list(stuff_lis.values())
num_d = collections.deque(num)

for i in range(N):
    if i+1 in st:
        print(num_d.popleft())
    else:
        print(0)


Fixed submission:
N = int(input())
A = list(input().split())
A = [int(A[i]) for i in range(N-1)]
ans = [0 for i in range(N)]

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

for i in range(N):
    print(ans[i])

Buggy python submission (verdict: Time Limit Exceeded):
import collections

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

stuff_lis = collections.Counter(stuff)
st = list(stuff_lis.keys())
num = list(stuff_lis.values())

for i in range(N):
    if i+1 in st:
        print(num[st.index(i+1)])
    else:
        print(0)


Fixed submission:
N = int(input())
A = list(input().split())
A = [int(A[i]) for i in range(N-1)]
ans = [0 for i in range(N)]

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

for i in range(N):
    print(ans[i])