Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
C=Counter(a)
#print(C)
for i in range(n):
    D=C.copy()
    D[a[i]]-=1
    #print(D,C)
    ans=0
    for k,v in D.items():
        if v>=2:
            ans+=v*(v-1)//2
    print(ans)

Fixed submission:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
C=Counter(a)
#print(C)
total=0
for k,v in C.items():
    if v>=2:
        total+=v*(v-1)//2
#print(total)
for i in range(n):
    V=C[a[i]]
    ans=total-(V*(V-1))//2+((V-1)*(V-2))//2
    print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    C=Counter(a)
    C[a[i]]-=1
    #print(C)
    ans=0
    for k,v in C.items():
        if v>=2:
            ans+=v*(v-1)//2
    print(ans)

Fixed submission:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
C=Counter(a)
#print(C)
total=0
for k,v in C.items():
    if v>=2:
        total+=v*(v-1)//2
#print(total)
for i in range(n):
    V=C[a[i]]
    ans=total-(V*(V-1))//2+((V-1)*(V-2))//2
    print(ans)

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

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

N=int(input())
A=list(map(int, input().split()))
l=[]
    
c = collections.Counter(A)
#print(c)
for i in range(N):
    x=0
    for k,v in c.items():
        if A[i]==k:
            if v>=3:
                a=combi(v-1,2)
                x+=a
        else:
            if v>=2:
                a=combi(v,2)
                x+=a
    l.append(x)
#print(l)
[print(i) for i in l]
            

Fixed submission:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
C=Counter(a)
#print(C)
total=0
for k,v in C.items():
    if v>=2:
        total+=v*(v-1)//2
#print(total)
for i in range(n):
    V=C[a[i]]
    ans=total-(V*(V-1))//2+((V-1)*(V-2))//2
    print(ans)

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

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

N=int(input())
A=list(map(int, input().split()))
l=[]
    
c = collections.Counter(A)
#print(c)
for i in range(N):
    x=0
    for k,v in c.items():
        if A[i]==k:
            if v>=3:
                a=combi(v-1,2)
                x+=a
        else:
            if v>=2:
                a=combi(v,2)
                x+=a
    l.append(x)
#print(l)
[print(i) for i in l]
            

Fixed submission:
from collections import Counter
n=int(input())
a=list(map(int,input().split()))
C=Counter(a)
#print(C)
total=0
for k,v in C.items():
    if v>=2:
        total+=v*(v-1)//2
#print(total)
for i in range(n):
    V=C[a[i]]
    ans=total-(V*(V-1))//2+((V-1)*(V-2))//2
    print(ans)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
if (A/0.08)%1==0.0:
    a1=int(A/0.08)
else:
    a1=int(A/0.08)+1
if (A/0.08)%1!=0.0:
    a2=int((A+1)/0.08)
else:
    a2=int((A+1)/0.08)-1

if (B/0.1)%1==0.0:
    b1=int(B/0.1)
else:
    b1=int(B/0.08)+1
if (B/0.1)%1!=0.0:
    b2=int((B+1)/0.1)
else:
    b2=int((B+1)/0.1)-1

#a=[]
#b=[]
for i in range(a1,a2+1):
    s=i
    a.append(s)
for i in range(b1,b2+1):
    t=i
    b.append(t)
print(a)
print(b)
if max(a)<min(b):
    print(-1)
elif max(b)<min(a):
    print(-1)
elif min(a)>=min(b):
    print(min(a))
else:
    print(min(b))

Fixed submission:
A,B=map(int,input().split())
if (A/0.08)%1==0.0:
    a1=int(A/0.08)
else:
    a1=int(A/0.08)+1
if ((A+1)/0.08)%1!=0.0:
    a2=int((A+1)/0.08)
else:
    a2=int((A+1)/0.08)-1

if (B/0.1)%1==0.0:
    b1=int(B/0.1)
else:
    b1=int(B/0.08)+1
if ((B+1)/0.1)%1!=0.0:
    b2=int((B+1)/0.1)
else:
    b2=int((B+1)/0.1)-1

a=[]
b=[]
for i in range(a1,a2+1):
    s=i
    a.append(s)
for i in range(b1,b2+1):
    t=i
    b.append(t)
#print(a)
#print(b)
if max(a)<min(b):
    print(-1)
elif max(b)<min(a):
    print(-1)
elif min(a)>=min(b):
    print(min(a))
else:
    print(min(b))
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
s=[input() for i in range(N)]
S=sorted(s)
a=1
num=[]
st=[]
for i in range(N-1):
  if S[i+1]==S[i]:
    a+=1
    if i == (N-2):
        num.append(a)
        st.append(S[-1])
  elif S[i+1]!=S[i]:
    num.append(a)
    st.append(S[i])
    a=1
if S[-1]!=S[-2]:
    num.append(1)
    st.append(S[-1])
 
d=max(num)
x=[]
if num.count(d)==1:
    print(st[num.index(max(num))])
else:
    ind=[i for i, v in enumerate(num) if v == max(num)]# 複数の最大値のインデックスを全て取得
    st2=[]
    for i in range(len(ind)):
        st2.append(st[ind[i]])
    [print(i) for i in st2]

Fixed submission:
import collections
N=int(input())
s=[input() for i in range(N)]
#S=sorted(s)
a=1
num=[]
st=[]
c = collections.Counter(s)#要素数が大きい順に辞書型ですべての要素を返す
#print(c)
max_c = max(c.values())#最も多い要素の数
#print(max_c)
st=[]
for k,v in c.items():
    if v==max_c:
        st.append(k)
st2=sorted(st)
[print(i) for i in st2]

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
s=[input() for i in range(N)]
S=sorted(s)
a=1
num=[]
st=[]
for i in range(N-1):
  if S[i+1]==S[i]:
    a+=1
    if i == (N-2):
        num.append(a)
        st.append(S[-1])
  elif S[i+1]!=S[i]:
    num.append(a)
    st.append(S[i])
    a=1
if S[-1]!=S[-2]:
    num.append(1)
    st.append(S[-1])

d=max(num)
x=[]

ind=[i for i, v in enumerate(num) if v == max(num)]# 複数の最大値のインデックスを全て取得
st2=[]
for i in range(len(ind)):
    st2.append(st[ind[i]])
[print(i) for i in st2]

Fixed submission:
import collections
N=int(input())
s=[input() for i in range(N)]
#S=sorted(s)
a=1
num=[]
st=[]
c = collections.Counter(s)#要素数が大きい順に辞書型ですべての要素を返す
#print(c)
max_c = max(c.values())#最も多い要素の数
#print(max_c)
st=[]
for k,v in c.items():
    if v==max_c:
        st.append(k)
st2=sorted(st)
[print(i) for i in st2]

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
s=[input() for i in range(N)]
S=sorted(s)
a=1
num=[]
st=[]
for i in range(N-1):
  if S[i+1]==S[i]:
    a+=1
    if i == (N-2):
        num.append(a)
        st.append(S[-1])
  elif S[i+1]!=S[i]:
    num.append(a)
    st.append(S[i])
    a=1
if S[-1]!=S[-2]:
    num.append(1)
    st.append(S[-1])

d=max(num)
x=[]
if num.count(d)==1:
    print(st[num.index(max(num))])
else:
    ind=[i for i, v in enumerate(num) if v == max(num)]# 複数の最大値のインデックスを全て取得
    st2=[]
    for i in range(len(ind)):
        st2.append(st[ind[i]])
    [print(i) for i in st2]

Fixed submission:
import collections
N=int(input())
s=[input() for i in range(N)]
#S=sorted(s)
a=1
num=[]
st=[]
c = collections.Counter(s)#要素数が大きい順に辞書型ですべての要素を返す
#print(c)
max_c = max(c.values())#最も多い要素の数
#print(max_c)
st=[]
for k,v in c.items():
    if v==max_c:
        st.append(k)
st2=sorted(st)
[print(i) for i in st2]
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=list(map(int, input().split()))
b=0
for i in range(N):
  if a[i] in a[i+1:]:
    print("NO")
    b=1
    break
  else:
    pass
if b==0:
  print("YES")

Fixed submission:
import numpy as np
N=int(input())
a=list(map(int, input().split()))
A=np.array(a)
def has_duplicates(seq):
    return len(seq) != len(set(seq))

s=has_duplicates(A)
if s==False:
  print("YES")
elif s==True:
  print("NO")

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=input().split()
a=[]
b=0
for i in range(len(A)):
  x=int(A[i])
  a.append(x)
for i in range(N):
  if a[i] in a[i+1:]:
    print("NO")
    b=1
    break
  else:
    pass
if b==0:
  print("YES")

Fixed submission:
import numpy as np
N=int(input())
a=list(map(int, input().split()))
A=np.array(a)
def has_duplicates(seq):
    return len(seq) != len(set(seq))

s=has_duplicates(A)
if s==False:
  print("YES")
elif s==True:
  print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
N,K=map(int,input().split())
p=list(map(int,input().split()))
def P(x):
    return (x+1)/2
a=0
for i in range(N-K+1):
    y=0#隣接区間の期待値の和
    for j in range(K):
        y+=P(p[i+j])
    if a<y:
        a=y
print(a)

Fixed submission:
N,K=map(int,input().split())
p=list(map(int,input().split()))
def P(x):
    return (x+1)/2
a=0
y=0
for i in range(N):
    y+=P(p[i])#区間内の期待値の和
    if i>=K:
        y-=P(p[i-K])
    if a<y:
        a=y
print(a)
Buggy python submission (verdict: Runtime Error):
H,A=,map(int,input().split())
 
n=(H//A)+1

if H%A==0:
  n=H//A
else:
  n=(H//A)+1
print(n)

Fixed submission:
H,A=map(int,input().split())
 
n=(H//A)+1
 
if H%A==0:
  n=H//A
else:
  n=(H//A)+1
print(n)

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

n=(H//A)+1
print(n)

Fixed submission:
H,A=map(int,input().split())
 
n=(H//A)+1
 
if H%A==0:
  n=H//A
else:
  n=(H//A)+1
print(n)
Buggy python submission (verdict: Runtime Error):
H,N=map(int,input().split())
A=[input() for i in range(N)]
B=[]
for i in range(N):
  a=int(A[i])
  B.append(a)
if sum(B)>=H:
  print("Yes")
else:
  print("No")

Fixed submission:
H,N=map(int,input().split())
A=input().split()
B=[]
for i in range(N):
  a=int(A[i])
  B.append(a)
if sum(B)>=H:
  print("Yes")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
H,N=map(int,input().split())
A=[int(input()) for i in range(N)]

if sum(A)>=H:
  print("Yes")
else:
  print("No")

Fixed submission:
H,N=map(int,input().split())
A=input().split()
B=[]
for i in range(N):
  a=int(A[i])
  B.append(a)
if sum(B)>=H:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
N,M=(int(X) for x in input().split())

if N==M:
    print("Yes")
else:
    print("No")

Fixed submission:
N,M=(int(x) for x in input().split())

if N==M:
  print("Yes")
else:
  print("No")

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

if N==M:
  print("Yes")
else:
  print("No")

Fixed submission:
N,M=(int(x) for x in input().split())

if N==M:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
a=1
for i in range(1,N):
    if A[i]<min(A[:i]):
        a+=1
print(a)

Fixed submission:
#min関数は計算量食うので使わない
N=int(input())
A=list(map(int,input().split()))
a=0
m=A[0]
for i in range(N):
    if A[i]<=m:
        a+=1
        m=A[i]#今のA[i]より前に小さい値がある場合に現時点の最小値としてmに記録する
print(a)
Buggy python submission (verdict: Runtime Error):
K,X=map(int,input())

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):
import math
A,B=map(int,input().split())

print(A*B//math.gcd(A,B))

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

print(A*B//fractions.gcd(A,B))
Buggy python submission (verdict: Time Limit Exceeded):
import heapq
from collections import deque
n,m=map(int,input().split())
A=list(map(int,input().split()))
#print(A)
for i in range(n):
    A[i]*=-1
#print(A)

for i in range(m):
    heapq.heapify(A)
    x=heapq.heappop(A)
    #print(x,A)
    if x%2==0:
        x//=2
    else:
        x=x//2 +1
    heapq.heappush(A,x)
    #print(A)
ans=-1*sum(A)
print(ans)

Fixed submission:
import heapq
from collections import deque
n,m=map(int,input().split())
A=list(map(int,input().split()))

for i in range(n):
    A[i]*=-1
heapq.heapify(A)

for i in range(m):
    x=heapq.heappop(A)
    if x%2==0:
        x//=2
    else:
        x=x//2 +1
    heapq.heappush(A,x)

ans=-1*sum(A)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
l=[0]*N
for i in range(M):
    L,R=map(int,input().split())
    for j in range(L,R+1):
        l[j-1]+=1

print(l.count(M))

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

for i in range(M):
    L,R=map(int,input().split())
    if l<L:
        l=L
    if r==0:
        r=R
    else:
        if r>R:
            r=R
if r>=l:
    print(r-l+1)
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
R,G,B,N=map(int,input().split())
ans=0
for r in range(0,int(N//R)+1):
    for g in range(0,int(N//G)+1):
        if (N-R*r-G*g)%B==0 and R*r+G*g<=N:
            ans+=1
            #print(r,g)
print(ans)

Fixed submission:
R,G,B,N=map(int,input().split())
ans=0
for r in range(0,int(N//R)+1):
    for g in range(0,int((N-R*r)//G)+1):
        if (N-R*r-G*g)%B==0:
            ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
N,K=int(input().split())
if K>=K*2-1:
    print("YES")
else:
    print("NO")

Fixed submission:
N,K=map(int,input().split())
if N>=K*2-1:
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):
n,p=map(int,input().split())
if n==1:
    print(p)
    exit()
elif p==1:
    print(1)
    exit()
l=[]#Pの約数
for i in range(1,int(p**0.5)+1):
    if p%i==0:
        l.append(i)
#print(l)
s=[]
for i in range(len(l)):
    if l[i]**n<=p and p%(l[i]**n)==0:
        #print(l[i],l[i]**n)
        s.append(l[i])
    if l[i]**n>p:
        break
print(s[-1])

Fixed submission:
n,p=map(int,input().split())
if n==1:
    print(p)
    exit()
elif p==1:
    print(1)
    exit()
elif n>60:
    print(1)
    exit()
l=[]#Pの約数
for i in range(1,int(p**0.5)+1):
    if p%i==0:
        l.append(i)
#print(l)
s=[]
for i in range(len(l)):
    if l[i]**n<=p and p%(l[i]**n)==0:
        #print(l[i],l[i]**n)
        s.append(l[i])
    if l[i]**n>p:
        break
print(s[-1])
Buggy python submission (verdict: Runtime Error):
import math
n=int(input())
t=[int(input()) for _ in range(n)]
#print(t)
for i in range(n-1):
    if i==0:
        lcm=(t[i]*t[i+1])//math.gcd(t[i],t[i+1])
    else:
        lcm=(lcm*t[i+1])//math.gcd(lcm,t[i+1])
print(lcm)

Fixed submission:
import math
n=int(input())
t=[int(input()) for _ in range(n)]
#print(t)
if n==1:
    print(t[0])
    exit()

for i in range(n-1):
    if i==0:
        lcm=(t[i]*t[i+1])//math.gcd(t[i],t[i+1])
    else:
        lcm=(lcm*t[i+1])//math.gcd(lcm,t[i+1])
print(lcm)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(str,input().split()))
b=[]
#print(b)
for i in range(n):
    b.append(a[i])
    b=b[::-1]
print(" ".join(b))

Fixed submission:
from collections import deque
n=int(input())
a=list(map(str,input().split()))
b=deque()
#print(b)
for i in range(n):
    if i%2==0:
        b.append(a[i])
    else:
        b.appendleft(a[i])
b=list(b)
if n%2==1:
    b=b[::-1]
print(" ".join(b))
Buggy python submission (verdict: Runtime Error):
L,N=map(int,input().split())
l=[]
for i in range(N):
    S=input()
    l.append(S)
#print(l)
l2=sorted(l)
#print(l2)
ans="".join(l2)
print(ans)

Fixed submission:
N,L=map(int,input().split())
l=[]
for i in range(N):
    S=input()
    l.append(S)
#print(l)
l2=sorted(l)
#print(l2)
ans="".join(l2)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  H,W,M=LI()
  h=[0]*H
  w=[0]*W
  lh=[]
  lw=[]
  d={}
  for _ in range(M):
    a,b=LI()
    lh.append(a)
    lw.append(b)
    a-=1
    b-=1
    h[a]+=1
    w[b]+=1
    d[(a,b)]=1

  ans=0
  for a in lh:
    a-=1
    for b in lw:
      b-=1
      _ans=h[a]+w[b]
      if (a,b) in d:
        _ans-=1
      ans=max(ans,_ans)

  return ans

# main()
print(main())


Fixed submission:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  H,W,M=LI()
  h=[0]*H
  w=[0]*W
  d={}
  for _ in range(M):
    a,b=LI()
    a-=1
    b-=1
    h[a]+=1
    w[b]+=1
    d[(a,b)]=1

  h_koho=[]
  w_koho=[]

  h_max=max(h)
  w_max=max(w)

  for i,x in enumerate(h):
    if x==h_max:
      h_koho.append(i)
  for i,x in enumerate(w):
    if x==w_max:
      w_koho.append(i)

  for x in h_koho:
    for y in w_koho:
      if (x,y) not in d:
        return h_max+w_max

  return h_max+w_max-1

# main()
print(main())
Buggy python submission (verdict: Time Limit Exceeded):
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,k=LI()
  l=LI()
  ind=0

  sm=1
  for i in range(k):
    sm*=l[i]

  before=sm
  ans=[]
  nxt=k
  for _ in range(n-k):
    sm//=l[ind]
    sm*=l[nxt]

    if before<sm:
      ans.append('Yes')
    else:
      ans.append('No')

    before=sm
    ind+=1
    nxt+=1

  for x in ans:
    print(x)

main()
# print(main())


Fixed submission:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,k=LI()
  l=LI()

  ind=0
  nxt=k
  ans=[]
  for _ in range(n-k):
    if l[ind]<l[nxt]:
      ans.append('Yes')
    else:
      ans.append('No')

    ind+=1
    nxt+=1

  for x in ans:
    print(x)

main()
# print(main())
Buggy python submission (verdict: Time Limit Exceeded):
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

# Factoring by trial split -- START --
def getPrimeList(n):
  l=[]
  t=int(math.sqrt(n))+1
  
  for a in range(2,t):
    while n%a==0:
      n//=a
      l.append(a)
  
  if n!=1:
    l.append(n)
  
  return l
# Factoring by trial split --- END ---

# Summarize count of factor within list -- START --
def summarizeList(l):
  sl=sorted(l)

  a=sl[0]
  c=1
  res=[]

  for x in sl[1:]:
    if x==a:
      c+=1
    else:
      res.append([a,c])
      a=x
      c=1
  res.append([a,c])

  return res
# Summarize count of factor within list --- END ---

def main():
  n=I()
  l=LI()
  l.sort()
  a=[1]*n

  for i,x in enumerate(l):
    if a[i]==0:
      continue
    for j in range(i+1,n):
      y=l[j]
      if x==y:
        a[i]=0
      if a[j]==0:
        continue
      if y%x==0:
        a[j]=0

  # print(a)
  return sum(a)

# main()
print(main())


Fixed submission:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

M=[0]*1001000

def main():
  n=I()
  l=LI()
  l.sort()
  MAX=l[-1]

  for x in l:
    M[x]+=1
    if M[x]==2:
      continue

    for i in range(2,1001000):
      y=i*x
      if MAX<y:
        break

      M[y]+=1

  ans=0
  for x in l:
    if M[x]==1:
      ans+=1

  # print(M[:100])
  return ans

# main()
print(main())
Buggy python submission (verdict: Time Limit Exceeded):
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,k=LI()
  l=LI()

  for i in range(k):
    nxtl=[0]*n

    # 実験 n=100 k=100 l=[0]*100 で回すとi=13で全部行き渡るようになった
    # f=False
    # for a in range(n):
    #   if l[a]<n-1:
    #     f=True
    # if not f:
    #   return i

    ff=True
    for j in range(n):
      left=j-l[j]
      if left<0:
        left=0
      else:
        ff=False
      nxtl[left]+=1

      right=j+l[j]+1
      if right<n:
        nxtl[right]-=1
        ff=False

    for i in range(1,n):
      nxtl[i]+=nxtl[i-1]

    if ff:
      return ' '.join(str(x) for x in l)

    l=nxtl

    # print(l)

  return ' '.join(str(x) for x in l)

# main()
print(main())


Fixed submission:
import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
# def LF(): return [float(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,k=LI()
  l=LI()

  for i in range(k):
    nxtl=[0]*n

    # 実験 n=100 k=100 l=[0]*100 で回すとi=13で全部行き渡るようになった
    # f=False
    # for a in range(n):
    #   if l[a]<n-1:
    #     f=True
    # if not f:
    #   return i

    ff=True
    for j in range(n):
      left=j-l[j]
      if left<0:
        left=0
      else:
        ff=False
      nxtl[left]+=1

      right=j+l[j]+1
      if right<n:
        nxtl[right]-=1
        ff=False

    for i in range(1,n):
      nxtl[i]+=nxtl[i-1]

    if ff:
      return ' '.join(str(x) for x in l)

    l=nxtl

    # print(l)

  return ' '.join(str(x) for x in l)

# main()
print(main())