Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def have_AC(str):
    count=0
    for i in range(len(str)):
        if(str[i:i+2]=="AC"):
            count=count+1
    return count

n,q=input().split() #nは文字の長さ　qは質問数
s=input() #Sは文字列
n=int(n)
q=int(q)
num=[]

for i in range(q):
    a,b=input().split()
    a=int(a) -1
    b=int(b)
    num.append(have_AC(s[a:b]))

for j in range(len(num)):
    print(num[j])


Fixed submission:
def have_AC(str):
    count=[0]
    for i in range(1,len(str)):
        if(str[i]=='C' and str[i-1]=='A'):
            count.append(count[i-1]+1)
            continue
        count.append(count[i-1])
    return count

n,q=input().split() #nは文字の長さ　qは質問数
s=input() #Sは文字列
n=int(n)
q=int(q)
num=[]
d=have_AC(s)

for i in range(q):
    a,b=input().split()
    a=int(a)
    b=int(b)
    num.append(d[b-1]-d[a-1])

for j in range(len(num)):
    print(num[j])

Buggy python submission (verdict: Time Limit Exceeded):
def have_AC(str):
    count=0
    for i in range(len(str)-1):
        if(str[i:i+2]=="AC"):
            count=count+1
    return count

n,q=input().split() #nは文字の長さ　qは質問数
s=input() #Sは文字列
n=int(n)
q=int(q)
num=[]

for i in range(q):
    a,b=input().split()
    a=int(a) -1
    b=int(b)
    num.append(have_AC(s[a:b]))

for j in range(len(num)):
    print(num[j])

Fixed submission:
def have_AC(str):
    count=[0]
    for i in range(1,len(str)):
        if(str[i]=='C' and str[i-1]=='A'):
            count.append(count[i-1]+1)
            continue
        count.append(count[i-1])
    return count

n,q=input().split() #nは文字の長さ　qは質問数
s=input() #Sは文字列
n=int(n)
q=int(q)
num=[]
d=have_AC(s)

for i in range(q):
    a,b=input().split()
    a=int(a)
    b=int(b)
    num.append(d[b-1]-d[a-1])

for j in range(len(num)):
    print(num[j])
Buggy python submission (verdict: Runtime Error):
 a,b=[int(x) for x in input().split()]
  
  if(a*b==15):
    print("*")
  elif(a+b==15):
    print("+")
  else:
    print("x")
      

Fixed submission:
a,b=[int(x) for x in input().split()]
  
if(a*b==15):
  print("*")
elif(a+b==15):
  print("+")
else:
  print("x")
Buggy python submission (verdict: Runtime Error):
s = input()
w = int(input())
ans=""
for i in range(w):
  ans = ans + s[i*w]

print(ans)

Fixed submission:
s = input()
w = int(input())
ans = ""
for i in range(-(-len(s) // w)):
    ans = ans + s[i * w]

print(ans)
Buggy python submission (verdict: Runtime Error):
from math import ceil

n, x, t = [int(v) for v in input().split(" ")]


print(ceil(n / x) * t)

Fixed submission:
n = input()

s = sum([int(v) for v in n.split()])

if s % 9 == 0:
    print('Yes')
else:
    print('No')

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

n, x, t = input().split(" ")


print(ceil(n / x) * t)


Fixed submission:
n = input()

s = sum([int(v) for v in n.split()])

if s % 9 == 0:
    print('Yes')
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
IN=input().split(' ')
N=IN[0]
M=IN[1]
if (N==1 and M==1)or (N!=1 and M!=1):
    print((N-2)*(M-2))
else:
    print(N*M-2)


Fixed submission:
im = []
im = input().split(' ')
N = int(im[0])
M = int(im[1])
if (N == 1 and M == 1) or (N != 1 and M != 1):
    print((N - 2) * (M - 2))
else:
    print(N * M - 2)
Buggy python submission (verdict: Runtime Error):
import logging
logging.basicConfig(level=logging.CRITICAL,format=' %(asctime)s - %(levelname)s - %(message)s')
 
def power(n):
    i = 1
    logging.info('func start')
    while n > 0:
        i *= 2
        n -= 1
        logging.debug('i = {}, n = {}'.format(i,n))
    logging.info('func end')
    return i
 
i = 0
n = int(input())
logging.info('in loop')
while power(i+1) < n:
    i = i + 1
    logging.debug('i = {}, pow(i) = {}'.format(i,power(i)))
 
logging.info('out loop')
print(power(i ))

Fixed submission:
import logging
logging.basicConfig(level=logging.CRITICAL,format=' %(asctime)s - %(levelname)s - %(message)s')

def power(n):
    i = 1
    logging.info('func start')
    while n > 0:
        i *= 2
        n -= 1
        logging.debug('i = {}, n = {}'.format(i,n))
    logging.info('func end')
    return i

i = 0
n = int(input())
logging.info('in loop')
while not (power(i + 1) > n):
    i = i + 1
    logging.debug('i = {}, pow(i) = {}'.format(i,power(i)))

logging.info('out loop')
print(power(i ))

Buggy python submission (verdict: Runtime Error):


def power2(n):
    i=1
    while n>0:
        i*=2
        n-=1
    return i

i=0
n=input()
while power2(i)<=n:
    i=i+1
    
print(power2(i-1))

Fixed submission:
import logging
logging.basicConfig(level=logging.CRITICAL,format=' %(asctime)s - %(levelname)s - %(message)s')

def power(n):
    i = 1
    logging.info('func start')
    while n > 0:
        i *= 2
        n -= 1
        logging.debug('i = {}, n = {}'.format(i,n))
    logging.info('func end')
    return i

i = 0
n = int(input())
logging.info('in loop')
while not (power(i + 1) > n):
    i = i + 1
    logging.debug('i = {}, pow(i) = {}'.format(i,power(i)))

logging.info('out loop')
print(power(i ))
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = int(input())
B = int(input())

N *= A

if (N) < B:
    print(N)
else:
    print(B)

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

N *= A

if (N) < B:
    print(N)
else:
    print(B)

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

if (N*A) < B:
    print(N*A)
else:
    print(B)

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

N *= A

if (N) < B:
    print(N)
else:
    print(B)

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

if N*A < B:
    print(N*A)
else:
    print(B)

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

N *= A

if (N) < B:
    print(N)
else:
    print(B)
Buggy python submission (verdict: Runtime Error):
N,A =  map(int,input().split())

if A >= N % 500:
    print('Yes') 
else:
    print('No')

Fixed submission:
#N,A =  map(int,input().split())
N = int(input())
A = int(input())
if A >= N % 500:
    print('Yes') 
else:
    print('No')
Buggy python submission (verdict: Runtime Error):
M = map(int, input().split())
X = 24 + (24-M)
print(X)


Fixed submission:
M = int(input())
X = 24 + (24-M)
print(X)
Buggy python submission (verdict: Time Limit Exceeded):
n= int(input())
a = list(map(int, input().split()))
flag = True
res = 0
while flag:
    max_num = max(a)
    res += (a[a.index(max_num)] * len(a[a.index(max_num):]))- sum(a[a.index(max_num):])
    a = a[:a.index(max_num)]
    if len(a) == 0:
        flag = False

print(res)

Fixed submission:
n= int(input())
a = list(map(int, input().split()))
res =0
x = a[0]
for i in range(len(a)):
    if x < a[i]:
        x = a[i]
    res += x - a[i]

print(res)
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
ls = []
count = 0
for i in range(Q):
    ls.append(input())

for i in range(len(ls)):
    if ls[i] == '1':
        try:
            if ls[i+1] == '1':
                count += 1
            else:
                if count == 0:
                    S = S[::-1]
                else:
                    if count %2 == 1:
                        count = 0
                    else:
                        S = S[::-1]
                        count = 0
        except IndexError:
            if count == 0:
                S = S[::-1]
            else:
                if count % 2 == 1:
                    count = 0
                else:
                    S = S[::-1]
                    count = 0

    else:
        ls[i] = [x for x in ls[i]]
        if ls[i][2] == '1':
            S = ls[i][4] + S
        else:
            S = S + ls[i][4]

print(S)

Fixed submission:
s = input()
q = int(input())
qs = [input().split() for i in range(q)]
n = False
left= right = ""
for operation in qs:
    if operation[0] == '1':
        n = not n
    if operation[0] == '2':
        t , f, c = operation
        f = int(f)
        if n:
            f = 1 if f != 1 else 2
        if f == 1:
            left=c+left
        elif f == 2:
            right+=c
s = left+s+right
print(s[::-1] if n else s)

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
Q = int(input())
for i in range(Q):
    a = input()
    if a == '1':
        S = S[::-1]
    else:
        a = [x for x in a]
        if a[2] == '1':
            S = a[4] + S
        else:
            S = S + a[4]

print(S)

Fixed submission:
s = input()
q = int(input())
qs = [input().split() for i in range(q)]
n = False
left= right = ""
for operation in qs:
    if operation[0] == '1':
        n = not n
    if operation[0] == '2':
        t , f, c = operation
        f = int(f)
        if n:
            f = 1 if f != 1 else 2
        if f == 1:
            left=c+left
        elif f == 2:
            right+=c
s = left+s+right
print(s[::-1] if n else s)
Buggy python submission (verdict: Time Limit Exceeded):
N = input()
S=[]
for i in range(int(N)):
    S.append(input())

ls=[]
for i in S:
    if i not in ls:
        ls.append(i)
str_ls =[]
num_ls = []

for i in ls:
    num_ls.append(S.count(i))


for i in range(len(ls)):
    if num_ls[i] == max(num_ls):
        str_ls.append(ls[i])

str_ls.sort()
for i in str_ls:
    print(i)

Fixed submission:
from collections import defaultdict
from collections import OrderedDict
N = int(input())
ans = dict()
for _ in range(N):
    k = str(input())
    if k in ans:
        ans[k]+=1
    else:
        ans.update({k:1})
groupedByValue = defaultdict(list)
for key, value in sorted(ans.items()):
    groupedByValue[value].append(key)
l = groupedByValue[max(groupedByValue)]
for i in l:
    print(i)
Buggy python submission (verdict: Runtime Error):
S, T = input().split()
A, B = input().split()
U = input()
A, B = int(A), input(B)

if U == S:
    A -= 1
elif U == T:
    B -= 1

print(A, B)

Fixed submission:
S, T = input().split()
A, B = input().split()
U = input()
A, B = int(A), int(B)

if U == S:
    A -= 1
elif U == T:
    B -= 1

print(A, B)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int,input().split())
ls = []
count_ac = 0
count_wa = 0
ls2 = []
for i in range(M):
    P, S = input().split()
    ls.append((P, S))

for i in ls:
    if i[1] == "AC":
        ls2.append([i[0], i[1]])
    else:
        if [i[0], "AC"] in ls2:
            pass
        else:
            ls2.append([i[0], i[1]])

a = 0
for i in ls2:
    if i[1] == "AC":
        if i[0] == a:
            continue
        else:
            count_ac += 1
            a = i[0]
    else:
        count_wa += 1

print(count_ac, count_wa)

Fixed submission:
N,M = [int(i) for i in input().split()]
a = {str(i):[] for i in range(1,N+1)}
AC,WA = 0,0
for i in range(M):
    P,S = [x for x in input().split()]
    a[P].append(S)
for i in a:
    if 'AC' not in a[i]:
        continue
    for x in a[i]:
        if x == 'AC':
            AC+=1
            break
        WA +=1
print(AC,WA)
Buggy python submission (verdict: Runtime Error):
K, X = [int(i) for i in input().split()]
print("Yes" if 500*K>=X else "No"

Fixed submission:
K, X = [int(i) for i in input().split()]
print("Yes" if 500*K>=X else "No")
Buggy python submission (verdict: Runtime Error):
a = input()
if a % 9 == 0:
  print("Yes")
else:
  print("No")

Fixed submission:
a = int(input())
if a % 9 == 0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
#include <bits/stdc++.h>
using namespace std;
long long n,tiln = 0;
int counter=0;
int main() {
    cin >> n;
    vector<int> a(10001);
        for(int x = 1;x<;x++){
            for(int y = 1;y<100;y++){
                for(int z = 1;z<100;z++){
                    tiln = (x*x) + (x*y) + (y*y) + z*(y+x) + z*z;
                    a(tiln)++;
                }
            }
        }
    for(int i = 1;i<=tiln;i++){
        cout << a.at(i) << endl;
    }
    return 0;
}


Fixed submission:
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
	for j in range(1,105):
		for k in range(1,105):
			v = i*i+j*j+k*k+i*j+j*k+k*i;
			if v<10050:
				ans[v]+=1
for i in range(n):
	print(ans[i+1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
	for j in range(1,105):
		for k in range(1,105):
			v = i*i+j*j+k*k+i*j+j*k+k*i;
			if v<10050:
				ans[v]+=1
for i in range(n):
print(ans[i+1])

Fixed submission:
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
	for j in range(1,105):
		for k in range(1,105):
			v = i*i+j*j+k*k+i*j+j*k+k*i;
			if v<10050:
				ans[v]+=1
for i in range(n):
	print(ans[i+1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
	for j in range(1,105):
		for k in range(1,105):
			v = i*i+j*j+k*k+i*j+j*k+k*i;
				if v<10050:
					ans[v]+=1
for i in range(n):
	print(ans[i+1])

Fixed submission:
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
	for j in range(1,105):
		for k in range(1,105):
			v = i*i+j*j+k*k+i*j+j*k+k*i;
			if v<10050:
				ans[v]+=1
for i in range(n):
	print(ans[i+1])

Buggy python submission (verdict: Runtime Error):
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
for j in range(1,105):
for k in range(1,105):
v = i*i+j*j+k*k+i*j+j*k+k*i;
if v<10050:
ans[v]+=1
for i in range(n):
print(ans[i+1])

Fixed submission:
n = int(input())
ans = [0 for _ in range(10050)]
for i in range(1,105):
	for j in range(1,105):
		for k in range(1,105):
			v = i*i+j*j+k*k+i*j+j*k+k*i;
			if v<10050:
				ans[v]+=1
for i in range(n):
	print(ans[i+1])
Buggy python submission (verdict: Runtime Error):
import collections
n,m = map(int, input().split())
ps = [list(input().split()) for _ in range(m)]

q = [0]*n
t = [0]*n

for [p,s] in ps:
    p = int(p) - 1
    if s == "AC" and q[p] == 0:
        q[p] += 1
    elif s == "WA" and q[p]== 0:
        t[p] += 1

for [p,s] in ps:
    if q[p] == 0 and t[p] != 0:
        t[p] == 0


print(sum(q),sum(t))


Fixed submission:
import collections
n,m = map(int, input().split())
ps = [list(input().split()) for _ in range(m)]

q = [0]*n
t = [0]*n

for [p,s] in ps:
    p = int(p) - 1
    if s == "AC" and q[p] == 0:
        q[p] += 1
    elif s == "WA" and q[p]== 0:
        t[p] += 1


"""
for [u,r] in ps:
    u = int(u) -1
    if q[u] == 0 and t[u] != 0:
        t[u] == 0
"""

w = 0
for i, uc in enumerate(q):
    if uc == 1:
        w += t[i]
    


print(sum(q),w)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
y = list(s)
ans = 0
for a in range(n):
    a = int(a)
    if y[a] == "A" and y[a+1] == "B" and y[a+2] == "C":
        ans += 1

print(ans)


Fixed submission:
n = int(input())
s = input()
y = list(s+"JK")
ans = 0
for a in range(n):
    a = int(a)
    if y[a] == "A" and y[a+1] == "B" and y[a+2] == "C":
        ans += 1

print(ans)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()
y = list(s)
ans = 0
for a in range(n):
    a = int(a)
    if y[a] == "A" and y[a+1] == "B" and y[a+2] == "C":
        ans += 1

print(ans)


Fixed submission:
n = int(input())
s = input()
y = list(s+"JK")
ans = 0
for a in range(n):
    a = int(a)
    if y[a] == "A" and y[a+1] == "B" and y[a+2] == "C":
        ans += 1

print(ans)
Buggy python submission (verdict: Runtime Error):
X = int(input())
t = int(input())
if t <= X:
  print(X-t)
else:
  print(0)

Fixed submission:
x,t=list(map(int,input().split(" ")))
print(max(x-t, 0))

Buggy python submission (verdict: Runtime Error):
X = int(input())
t = int(input())
if t < X:
  print(X-t)
else:
  print (0)

Fixed submission:
x,t=list(map(int,input().split(" ")))
print(max(x-t, 0))
Buggy python submission (verdict: Runtime Error):
A,B=list(map(int,input().split(' ')))
A={1, 3, 5, 7, 8, 10, 12}
B={4, 6, 9, 11}
print('Yes' if {x,y} <= A or {x,y} <= B else 'No')

Fixed submission:
x,y = map(int, input().split())
A = {1, 3, 5, 7, 8, 10, 12}
B = {4, 6, 9, 11}
print("Yes" if {x, y} <= A or {x, y} <= B else "No")

Buggy python submission (verdict: Runtime Error):
A,B=list(map(int,input().split(" ")))
A={1,3,5,7,8,10,12}
B={4,6,9,11}
print("Yes" if {x,y} <= A or {x,y} <= B else "No")

Fixed submission:
x,y = map(int, input().split())
A = {1, 3, 5, 7, 8, 10, 12}
B = {4, 6, 9, 11}
print("Yes" if {x, y} <= A or {x, y} <= B else "No")

Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
A={1,3,5,7,8,10,12}
B={4,6,9,11}
print("Yes" if {x,y} <= A or {x,y} <= B else "No")

Fixed submission:
x,y = map(int, input().split())
A = {1, 3, 5, 7, 8, 10, 12}
B = {4, 6, 9, 11}
print("Yes" if {x, y} <= A or {x, y} <= B else "No")
Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
  a = []
  for i in range(3):
    a.append(int(input()))
  print(len(set(a)))

Fixed submission:
if __name__ == '__main__':
  s = input()
  a= [int(elem) for elem in s.rstrip().split(' ')]
  print(len(set(a)))

Buggy python submission (verdict: Runtime Error):
if __name__ == '__main__':
  a = []
  for i in range(3):
    a.append(int(input()))
  print(len(set(a)))

Fixed submission:
if __name__ == '__main__':
  s = input()
  a= [int(elem) for elem in s.rstrip().split(' ')]
  print(len(set(a)))
Buggy python submission (verdict: Runtime Error):
N,K,X,Y= map(int, input().split())
if N<=K:
  print(N*X)
else:
  print(N*X+(N-K)*Y)

Fixed submission:
N= int(input())
K= int(input())
X= int(input())
Y= int(input())

if N<=K:
  print (N*X)
else:
  print (K*X+(N-K)*Y)
Buggy python submission (verdict: Runtime Error):
x=0
N=int(input("整数を入力:"))

while(1==1):
    Nn=str(N/10)
    a=Nn.split(".")
    x+=int(a[1])
    N=int(a[0])
    if N==0:
        break
if x%9==0:
    print('Yes')
else:
    print('No')


Fixed submission:
N=int(input())
if N%9==0:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
#9の倍数か判定する
x=0
N=int(input("整数を入力:"))
#Nを桁ごとに分解
while(1==1):
    Nn=str(N/10)
    a=Nn.split(".")
    x+=int(a[1])
    N=int(a[0])
    if N==0:
        break
if x%9==0:
    print('Yes')
else:
    print('No')


Fixed submission:
N=int(input())
if N%9==0:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
l,r,d=map(int、input())
print(r//d - l//d)

Fixed submission:
l,r,d = map(int, input().split())
print(r//d-(l-1)//d)
Buggy python submission (verdict: Runtime Error):
n = int(input())
cnts = [k*d*(d+1)//2 for k in range(1,n//2)]
print(sum(cnts)+ (n//2)*d*(d+1)//2)

Fixed submission:
import numpy as np
n = int(input())
cnt = 0

for k in range(1,n+1):
    d = n//k
    if d == 1:
        cnt += (k+n)*(n-k+1)//2
        break
    cnt += k*d*(d+1)//2
print(cnt)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
from collections import Counter
n = int(input())
aa = list(map(int, input().split()))
ngs = np.zeros((10**6)+1, dtype=int)

for a in aa:
    ngs[2*a::a] = 1
    
dic = Counter(aa)
times = np.array(list(dic.keys()))[np.array(list(dic.values())) > 1]

for i in times:
    ngs[i] = 1
cnt = 0
for a in aa:
    cnt += 1-ngs[a]
print((cnt))

Fixed submission:
import numpy as np
from collections import Counter
n = int(input())
aa = list(map(int, input().split()))
ngs = np.zeros((10**6)+1, dtype=int)

for a in set(aa):
    ngs[2*a::a] = 1
    
dic = Counter(aa)
times = np.array(list(dic.keys()))[np.array(list(dic.values())) > 1]

for i in times:
    ngs[i] = 1
cnt = 0
for a in aa:
    cnt += 1-ngs[a]
print((cnt))

Buggy python submission (verdict: Runtime Error):
import numpy as np
from collections import Counter
n = int(input())
aa = list(map(int, input().split()))
ngs = np.zeros(2*(10**5)+1, dtype=int)

for a in aa:
    ngs[2*a::a] = 1
    
dic = Counter(aa)
times = np.array(list(dic.keys()))[np.array(list(dic.values())) > 1]

for i in times:
    ngs[i] = 1
cnt = 0
for a in aa:
    cnt += 1-ngs[a]
print((cnt))

Fixed submission:
import numpy as np
from collections import Counter
n = int(input())
aa = list(map(int, input().split()))
ngs = np.zeros((10**6)+1, dtype=int)

for a in set(aa):
    ngs[2*a::a] = 1
    
dic = Counter(aa)
times = np.array(list(dic.keys()))[np.array(list(dic.values())) > 1]

for i in times:
    ngs[i] = 1
cnt = 0
for a in aa:
    cnt += 1-ngs[a]
print((cnt))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
aa = list(map(int, input().split()))
aa.sort()

oks = np.ones(len(aa))
for i in range(n):
    oks[i+1:] = [oks[j]*int(not aa[j]%aa[i] == 0)  for j in range(i+1,n)]
    if i < n-1:
        if aa[i+1] == aa[i]:
            oks[i] = 0
print(int(oks.sum()))

Fixed submission:
import numpy as np
from collections import Counter
n = int(input())
aa = list(map(int, input().split()))
ngs = np.zeros((10**6)+1, dtype=int)

for a in set(aa):
    ngs[2*a::a] = 1
    
dic = Counter(aa)
times = np.array(list(dic.keys()))[np.array(list(dic.values())) > 1]

for i in times:
    ngs[i] = 1
cnt = 0
for a in aa:
    cnt += 1-ngs[a]
print((cnt))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
aa = list(map(int, input().split()))
aa.sort()

from collections import Counter
dic = Counter(aa)
times = np.array(list(dic.keys()))[np.array(list(dic.values())) > 1]

oks = np.ones(len(aa))
for i in range(len(aa)):
    if i < len(aa)-1:
        if aa[i+1] == aa[i]:
            oks[i] = 0
    for j in range(i+1,len(aa)):
        if (aa[j]%aa[i] == 0):
            oks[j] = 0
print(int(oks.sum()))

Fixed submission:
import numpy as np
from collections import Counter
n = int(input())
aa = list(map(int, input().split()))
ngs = np.zeros((10**6)+1, dtype=int)

for a in set(aa):
    ngs[2*a::a] = 1
    
dic = Counter(aa)
times = np.array(list(dic.keys()))[np.array(list(dic.values())) > 1]

for i in times:
    ngs[i] = 1
cnt = 0
for a in aa:
    cnt += 1-ngs[a]
print((cnt))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
aa = np.array(list(map(int, input().split())))
cnt = 0
pl = aa + np.array(range(n))
ms = -aa + np.array(range(n))
common = set(pl).intersection(set(ms))
for v in common:
    cnt += (pl==v).sum() * (ms==v).sum()
print(cnt)

Fixed submission:
import numpy as np
from collections import Counter
n = int(input())
aa = np.array(list(map(int, input().split())))
cnt = 0
pl = aa + np.array(range(n))
ms = -aa + np.array(range(n))
common = set(pl).intersection(set(ms))

dic_pl = Counter(pl)
dic_ms = Counter(ms)

for k in dic_ms.keys():
    cnt += dic_ms[k] * dic_pl.get(k,0)
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = int(input())
aa = np.array(list(map(int, input().split())))

cnt = 0
for i in range(n-2):
    bb = np.array(range(-aa[0], len(aa)-aa[0]))
    cnt += (aa==bb).sum()
    aa = np.delete(aa, 0)
print(cnt)

Fixed submission:
import numpy as np
from collections import Counter
n = int(input())
aa = np.array(list(map(int, input().split())))
cnt = 0
pl = aa + np.array(range(n))
ms = -aa + np.array(range(n))
common = set(pl).intersection(set(ms))

dic_pl = Counter(pl)
dic_ms = Counter(ms)

for k in dic_ms.keys():
    cnt += dic_ms[k] * dic_pl.get(k,0)
print(cnt)