Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
x=1
if(N>1):
 for i in range(N+1):
  for j in range(int(i/5)):
   if(i==j*j):
    x=i
if(4<=N<=8):
 x=4
if(9<=N<=15):
 x=9
if(16<=N<=24):
 x=16
if(25<=N<=35):
 x=25
print(x)

Fixed submission:
import math
N=int(input())
n=math.sqrt(N)
m=math.floor(n)
print(m*m)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
x=1
if(N>1):
 for i in range(N+1):
  for j in range(int(i/2)):
   if(i==j*j):
    x=i
if(4<=N<=8):
 x=4
print(x)


Fixed submission:
import math
N=int(input())
n=math.sqrt(N)
m=math.floor(n)
print(m*m)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
x=1
for i in range(N+1):
 for j in range(i+1):
  if(i==j*j):
   x=i
print(x)
 

Fixed submission:
import math
N=int(input())
n=math.sqrt(N)
m=math.floor(n)
print(m*m)

Buggy python submission (verdict: Time Limit Exceeded):
def Sqrt(x, e=0.0001):
    p = 0.0
    q = x
    while abs(q - p) > e:
        p = q
        q = p - (p*p - x)/(2.*p)
    return q

N=int(input())
a=0
b=0
x=1
for i in range(N+1):
  a=Sqrt(i)
  b=100*a
  c=int(b/100)
  if(i==c*c):
    x=i
print(x)
   

Fixed submission:
import math
N=int(input())
n=math.sqrt(N)
m=math.floor(n)
print(m*m)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
a=0
b=0
x=0
for i in range(N+1):
  a=i**0.5
  b=int(a)
  if(i==b*b):
   x=i
print(x)

Fixed submission:
import math
N=int(input())
n=math.sqrt(N)
m=math.floor(n)
print(m*m)

Buggy python submission (verdict: Runtime Error):
def divisor_num(n):
    a = 1
    for _, x in factorization(n):
        a *= x + 1
    return a
  
N=int(input())
n=0
x=1
for i in range(N+1):
  n=divisor_num(i)
  if(i%2!=0):
   x=i
print(x)
   

Fixed submission:
import math
N=int(input())
n=math.sqrt(N)
m=math.floor(n)
print(m*m)

Buggy python submission (verdict: Runtime Error):
def bisearch(f, n):
    l = 0
    r = n
    fl = f(l)
    fr = f(r)
    while l <= r:
        m = (l + r) // 2
        fm = f(m)
        if fm == n:
            return m
        elif fm > n:
            r = m - 1
            fr = f(r)
        else:
            l = m + 1
            fl = f(l)

def try_square_root(n2):
    return bisearch(lambda n:n*n, n2)

N=int(input())
a=0
b=0
x=0
for i in range(N+1):
  a=try_square_root(i)
  b=int(a)
  if(i==b*b):
    x=i
print(x)
 

Fixed submission:
import math
N=int(input())
n=math.sqrt(N)
m=math.floor(n)
print(m*m)

Buggy python submission (verdict: Time Limit Exceeded):
import math
N=int(input())
a=0
b=0
x=0
for i in range(N+1):
  a=math.sqrt(i)
  b=int(a)
  if(i==b*b):
   x=i
print(x)

Fixed submission:
import math
N=int(input())
n=math.sqrt(N)
m=math.floor(n)
print(m*m)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
All = [] #全ての数字格納リスト
B_A = [] #Biより小さいAjの個数格納リスト
B_C = [] #Biより大きいCkの個数格納リスト

for i in range(N):
  All.append([A[i],0])
  All.append([B[i],1])
  All.append([C[i],2])
All.sort()

count1,count2 = 0,0
for i in range(3*N):
  if(All[i][1] == 1):     
    if(i == 0):
      B_A.append(count1)
      if((All[i][0] == All[i+1][0])and(All[i+1][1] == 2)): B_C.append(N-count2-1)
      else: B_C.append(N-count2)
    elif(i == N-1):
      if((All[i][0] == All[i-1][0])and(All[i-1][1] == 0)): B_A.append(count1-1)
      else: B_A.append(count1)
      B_C.append(N-count2)
    else:
      if((All[i][0] == All[i-1][0])and(All[i-1][1] == 0)): B_A.append(count1-1)
      else: B_A.append(count1)
      if((All[i][0] == All[i+1][0])and(All[i+1][1] == 2)): B_C.append(N-count2-1)
      else: B_C.append(N-count2)
    
  if(All[i][1] == 0): count1 += 1
  if(All[i][1] == 2): count2 += 1

ans = 0
for i in range(N):
 ans += B_A[i]*B_C[i]
print(ans)

Fixed submission:
import bisect
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

A.sort()
B.sort()
C.sort()
ans = 0
#順序維持のbisect (二分探索を利用したライブラリ）
for i in range(N):
    count_a = bisect.bisect_left(A,B[i])
    count_c = N -bisect.bisect_right(C,B[i])
    ans += count_a*count_c
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
All = [] #全ての数字格納リスト
B_A = [] #Biより小さいAjの個数格納リスト
B_C = [] #Biより大きいCkの個数格納リスト

for i in range(N):
  All.append([A[i],0])
  All.append([B[i],1])
  All.append([C[i],2])
All.sort()

count1,count2 = 0,0
for i in range(3*N):
  if(All[i][1] == 1):     
    if((i != 0)and(i != N-1)):
      if((All[i][0] == All[i-1][0])and(All[i-1][1] == 0)): B_A.append(count1-1)
      else: B_A.append(count1)
      if((All[i][0] == All[i+1][0])and(All[i+1][1] == 2)): B_C.append(N-count2-1)
      else: B_C.append(N-count2)
    else:
      B_A.append(count1),B_C.append(N-count2)
    
  if(All[i][1] == 0): count1 += 1
  if(All[i][1] == 2): count2 += 1

ans = 0
for i in range(N):
 ans += B_A[i]*B_C[i]
print(ans)

Fixed submission:
import bisect
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))

A.sort()
B.sort()
C.sort()
ans = 0
#順序維持のbisect (二分探索を利用したライブラリ）
for i in range(N):
    count_a = bisect.bisect_left(A,B[i])
    count_c = N -bisect.bisect_right(C,B[i])
    ans += count_a*count_c
print(ans)
Buggy python submission (verdict: Runtime Error):
N=int(input())
count=0
C=[]
for i in range(N):
 if(i!=0):
  a=int(i/2)
  if(i%2==0):
    count +=1
    while(a%2!=1):
     count +=1
     a=int(a/2)
  else:
     count =0
  C.append(count)
b=max(C)
for i inrange(N):
 C[i]==b
 print(i)

Fixed submission:
N = int(input())

if(N<2):
  print(N)
elif(2<=N<4):
  print(2)
elif(4<=N<8):
  print(4)
elif(8<=N<16):
  print(8)
elif(16<=N<32):
  print(16)
elif(32<=N<64):
  print(32)
elif(64<=N):
  print(64)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = input().split()
sum0 = 0

for i in range(N):
  a[i] = int(a[i])
  sum0 += a[i]

for i in range(N-1):
  if(i == 0):
   b = a[0]
   min = abs(2*b-sum0)
  elif(1<=i<=int(N/2)-1):
   b = a[:i+1]
   #print(b)
   tmp = abs(2*sum(b)-sum0)
   if(min > tmp):
      min = tmp
  else:
   b = a[i+1:]
   #print(b)
   tmp = abs(2*sum(b)-sum0)
   if(min > tmp):
      min = tmp
  #print(min)
print(min)
 

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

min_dif = float('inf')
s1 = 0
for i in range(N):
  if(i != N-1):
   s1 += A[i]
   s2 = sum_all - s1
   tmp_dif = abs(s1 - s2)
   min_dif = min(min_dif,tmp_dif)
print(min_dif)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = input().split()
sum = 0
sum_sunuke = 0

def sum_list(L):
  sum = 0
  for i in range(len(L)):
   sum += L[i]
  return sum

for i in range(N):
  a[i] = int(a[i])
  sum += a[i]

for i in range(N-1):
  #print(a[:i+1])
  #print(a[i+1:])
  if(i == 0):
   min = abs(2*sum_list(a[:i+1])-sum)
  else:
   tmp = abs(2*sum_list(a[:i+1])-sum)
   if(min > tmp):
      min = tmp
  #print(min)
print(min)
 

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

min_dif = float('inf')
s1 = 0
for i in range(N):
  if(i != N-1):
   s1 += A[i]
   s2 = sum_all - s1
   tmp_dif = abs(s1 - s2)
   min_dif = min(min_dif,tmp_dif)
print(min_dif)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
A = list(map(int,input().split()))

B = []
if(n%2 == 0):
  p = n//2
  for i in range(p):
   B.insert(0,str(A[2*i+1]))
   B.append(str(A[2*i]))
elif(n%2 == 1):
  p = n//2 
  for i in range(p):
   B.insert(0,str(A[2*i]))
   B.append(str(A[2*i+1]))
  B.insert(0,str(A[2*p]))
  
b = ' '.join(B)
print(b)

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

B = []
if(n%2 == 1):
  p = n//2
  B.append(str(A[2*p]))
  for i in range(p):
   B.append(str(A[2*(p-1-i)]))
  for i in range(p):
    B.append(str(A[2*i+1]))

elif(n%2 == 0):
  p = n//2 
  for i in range(p):
   B.append(str(A[2*(p-1-i)+1]))
  for i in range(p):
    B.append(str(A[2*i]))

b = ' '.join(B) 
print(b)
Buggy python submission (verdict: Runtime Error):
#include <iostream>
using namespace std;

int main() {
	int a , b , c ;
    int count = 3;
	cin >> a >> b >> c;
	if(a == b) count -= 1;
    if(a == c) count -= 1;
    if(b == c) count -= 1;
    if(count == 0) count += 1;
    cout << count;
      
	return 0;
}

Fixed submission:
a = input().split()
a = list(a)
for i in range(3):
  a[i] = int(a[i])
a.sort()

if(a[0] == a[1]):
  if(a[1] == a[2]):
    print(1)
  else:
    print(2)
elif(a[1] == a[2]):
  print(2)
else:
  print(3)
Buggy python submission (verdict: Runtime Error):
import itertools
N,K = map(int,input().split())
D = list(map(int,input().split()))

#使用可能数字の取り出し
Num1 = []
for i in range(10):
  if(i in D): continue
  else: Num1.append(i)
 
#組み合わせ
Comb = []
n = len(str(N))
for i in range(n):
  Comb.append(Num1)
Comb = list(itertools.product(*Comb))

for i in range(len(Comb)):
  tmp = Comb[i]
  tmp_num = ''
  for j in range(n): tmp_num += str(tmp[j])
  tmp_num = int(tmp_num)
  if(N <= tmp_num):
    ans = tmp_num
    break
    
print(ans)

Fixed submission:
import itertools
N,K = map(int,input().split())
D = list(map(int,input().split()))

#使用可能数字の取り出し
Num1 = []
for i in range(10):
  if(i in D): continue
  else: Num1.append(i)
 
#組み合わせ
Comb = []
n = len(str(N))
for i in range(n+1):
  Comb.append(Num1)
Comb = list(itertools.product(*Comb))

ans = -1
for i in range(len(Comb)):
  tmp = Comb[i]
  tmp_num = ''
  for j in range(n): tmp_num += str(tmp[j])
  tmp_num = int(tmp_num)
  if(N <= tmp_num):
    ans = tmp_num
    break
    
if(ans == -1):
  for i in range(len(Comb)):
   tmp = Comb[i]
   tmp_num = ''
   for j in range(n+1): tmp_num += str(tmp[j])
   tmp_num = int(tmp_num)
   if(N <= tmp_num):
     ans = tmp_num
     break
print(ans)

Buggy python submission (verdict: Runtime Error):
import itertools
N,K = map(int,input().split())
D = list(map(int,input().split()))

#使用可能数字の取り出し
Num = [1]*10 #index = num, 使用可能: 1,使用不可: 0
Num1 = [] #使用可能数字格納
for i in range(K):
  Num[D[i]] = 0
for i in range(10):
  if(Num[i] == 1):Num1.append(i)
 
#組み合わせ
Comb = []
n = len(str(N))
for i in range(n):
  Comb.append(Num1)
Comb = list(itertools.product(*Comb))

for i in range(len(Comb)):
  tmp = Comb[i]
  tmp_num = ''
  for j in range(n): tmp_num += str(tmp[j])
  tmp_num = int(tmp_num)
  if(N <= tmp_num):
    ans = tmp_num
    break
    
print(ans)

Fixed submission:
import itertools
N,K = map(int,input().split())
D = list(map(int,input().split()))

#使用可能数字の取り出し
Num1 = []
for i in range(10):
  if(i in D): continue
  else: Num1.append(i)
 
#組み合わせ
Comb = []
n = len(str(N))
for i in range(n+1):
  Comb.append(Num1)
Comb = list(itertools.product(*Comb))

ans = -1
for i in range(len(Comb)):
  tmp = Comb[i]
  tmp_num = ''
  for j in range(n): tmp_num += str(tmp[j])
  tmp_num = int(tmp_num)
  if(N <= tmp_num):
    ans = tmp_num
    break
    
if(ans == -1):
  for i in range(len(Comb)):
   tmp = Comb[i]
   tmp_num = ''
   for j in range(n+1): tmp_num += str(tmp[j])
   tmp_num = int(tmp_num)
   if(N <= tmp_num):
     ans = tmp_num
     break
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,C,K=list(map(int,input().split()))

while True:
    nokori=K
    maisu1=0
    maisu2=0
    maisu3=0
    if A<=nokori:
        maisu1=A
        nokori=nokori-maisu1
    else:
        maisu1=nokori
        break

    if B<=nokori:
        maisu2=B
        nokori=nokori-maisu2
    else:
        maisu2=nokori
        break
    
    maisu3=nokori

print(maisu1-maisu3)

Fixed submission:
A,B,C,K=list(map(int,input().split()))
nokori=K
maisu1=0
maisu2=0
maisu3=0
while True:
    if A<=nokori:
        maisu1=A
        nokori=nokori-maisu1
    else:
        maisu1=nokori
        break

    if B<=nokori:
        maisu2=B
        nokori=nokori-maisu2
    else:
        maisu2=nokori
        break
    
    maisu3=nokori
    break

print(maisu1-maisu3)

Buggy python submission (verdict: Runtime Error):
A,B,C,K=list(map(int,input().split()))

while True:
    nokori=K
    if A<=nokori:
        maisu1=A
        nokori=nokori-maisu1
    else:
        maisu1=nokori
        break

    if B<=nokori:
        maisu2=B
        nokori=nokori-maisu2
    else:
        maisu2=nokori
        break
    
    if C<=nokori:
        maisu3=A
        nokori=nokori-maisu3
        break
    else:
        maisu3=nokori
        break

print(maisu1-maisu3)

Fixed submission:
A,B,C,K=list(map(int,input().split()))
nokori=K
maisu1=0
maisu2=0
maisu3=0
while True:
    if A<=nokori:
        maisu1=A
        nokori=nokori-maisu1
    else:
        maisu1=nokori
        break

    if B<=nokori:
        maisu2=B
        nokori=nokori-maisu2
    else:
        maisu2=nokori
        break
    
    maisu3=nokori
    break

print(maisu1-maisu3)
Buggy python submission (verdict: Runtime Error):
S, W = map(int, input().split())
if W >= S:
    print("unsafe")
else:
    safe

Fixed submission:
S, W = map(int, input().split())
if W >= S:
    print("unsafe")
else:
    print("safe")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int, input().split()))

B=[0]*N

for i in range(N):
    B[i]=A.count(i+1)

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

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

B=[0]*N

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

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

A=[0]*(N+1)
for i in range(M):
    x,y=map(int,input().split())
    A[x]=max(A[x],H[y-1])
    A[y]=max(A[y],H[x-1])

count=0
for i in range(1,N+1):
    if H[i-1]>A[i]:
        count+=1

print(count)

Fixed submission:
N=input()
aru=0
for s in N:
    if s == "7":
        aru=1
        break
if aru==0:
    print("No")
else:
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
S=input()
count=0
for i in range(0,N-2):
    for j in range(i+1,N-1):
        for k in range(j+1,N):
            if S[i]==S[j]:
                break
            if S[j]!=S[k] and S[k]!=S[i] and j-i!=k-j:
                count+=1
print(count)

Fixed submission:
N=int(input())
S=input()
R=S.count("R")
G=S.count("G")
B=S.count("B")


count=R*G*B
for i in range(0,N-2):
    for j in range(i+1,N-1):
        k=j+(j-i)
        if k>=N:
            break
        if S[i]!=S[j] and S[j]!=S[k] and S[k]!=S[i]:
            count=count-1

print(count)
Buggy python submission (verdict: Runtime Error):
#入力処理
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
kingaku=[]
for i in range(M):
    x_input, y_input, c_input = map(int, input().split())
    kingaku.append(a[x_input-1][y_input-1]+b[x_input-1][y_input-1]+c_input)
kingaku.append(min(a)+min(b))

print(min(kingaku))

Fixed submission:
#入力処理
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
kingaku=[]
for i in range(M):
    x_input, y_input, c_input = map(int, input().split())
    kingaku.append(a[x_input-1]+b[y_input-1]-c_input)
kingaku.append(min(a)+min(b))

print(min(kingaku))

Buggy python submission (verdict: Time Limit Exceeded):
#入力処理
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
waribiki=[[0]*B]*A
for i in range(M):
    x_input, y_input, c_input = map(int, input().split())
    if waribiki[x_input-1][y_input-1]<c_input:
        waribiki[x_input-1][y_input-1]=c_input

#処理
inexpensive=200000
for i in range(A):
    for j in range(B):
        if (int(a[i])+int(b[j]))-waribiki[i][j] < inexpensive:
            inexpensive = (int(a[i])+int(b[j]))-waribiki[i][j]

print(inexpensive) 

Fixed submission:
#入力処理
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
kingaku=[]
for i in range(M):
    x_input, y_input, c_input = map(int, input().split())
    kingaku.append(a[x_input-1]+b[y_input-1]-c_input)
kingaku.append(min(a)+min(b))

print(min(kingaku))

Buggy python submission (verdict: Time Limit Exceeded):
#入力処理
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x=[]
y=[]
c=[]
for i in range(M):
    x_input, y_input, c_input = map(int, input().split())
    x.append(x_input)
    y.append(y_input)
    c.append(c_input)

#処理
kingaku = []
tem=[]
tem1=[]
for i in range(A):
    for j in range(B):
        tem.append(int(a[i])+int(b[j]))
    kingaku.append(tem)
    tem = []

waribiki=[[0]*B]*A
for i in range(M):
    if waribiki[x[i]-1][y[i]-1] < c[i]:
        waribiki[x[i]-1][y[i]-1] = c[i]

inexpensive = 200000
for i in range(A):
    for j in range(B):
        if kingaku[i][j]-waribiki[i][j] < inexpensive:
            inexpensive=kingaku[i][j]-waribiki[i][j]

print(inexpensive) 

Fixed submission:
#入力処理
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
kingaku=[]
for i in range(M):
    x_input, y_input, c_input = map(int, input().split())
    kingaku.append(a[x_input-1]+b[y_input-1]-c_input)
kingaku.append(min(a)+min(b))

print(min(kingaku))
Buggy python submission (verdict: Runtime Error):
n,k,q=map(int,input().split())
A=[int(input()) for i in range(q)]

tokuten=[0]*n

for i in range(q):
    tokuten[A[i-1]-1]=tokuten[A[i-1]-1]+1

for i in range(n):
    if tokuten[i]>=q-k+1
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k,q=map(int,input().split())
A=[int(input()) for i in range(q)]

tokuten=[0]*n

for i in range(q):
    tokuten[A[i-1]-1]=tokuten[A[i-1]-1]+1

for i in range(n):
    if tokuten[i]>q-k:
        print("Yes")
    else:
        print("No")

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

tensu=[]
for i in range(n):
    tensu.append(k)

for i in range(q):
    for j in range(n):
        if j!=A[i]-1:
            tensu[j]=tensu[j]-1

for i in range(n):
    if tensu[i]>0:
        print("Yes")
    else:
        print("No")

Fixed submission:
n,k,q=map(int,input().split())
A=[int(input()) for i in range(q)]

tokuten=[0]*n

for i in range(q):
    tokuten[A[i-1]-1]=tokuten[A[i-1]-1]+1

for i in range(n):
    if tokuten[i]>q-k:
        print("Yes")
    else:
        print("No")
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
k = len(T)
m = 0
for i in range(k):
  if S[i] != T[i]:
    m += 1
print(m)


Fixed submission:
a = int(input())
k = a + a**2 + a**3
print(k)
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
k = len(T)
m = 0
for i in range(k):
  if S[k] == T[k]:
    m = m
  else:
    S[k] = T[k]
    m += 1
print(m)

Fixed submission:
S = input()
T = input()
k = len(T)
m = 0
for i in range(k):
  if S[i] != T[i]:
    m += 1
print(m)

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
k = len(T)
m = 0
for i in range(k):
  if S[k] == T[k]:
    m = m
  else:
    m += 1
print(m)

Fixed submission:
S = input()
T = input()
k = len(T)
m = 0
for i in range(k):
  if S[i] != T[i]:
    m += 1
print(m)

Buggy python submission (verdict: Runtime Error):
S = input()
T = input()
k = len(T)
for i in range(k):
  if S[k] == T[k]:
    m = m
  else:
    m += 1
print(m)

Fixed submission:
S = input()
T = input()
k = len(T)
m = 0
for i in range(k):
  if S[i] != T[i]:
    m += 1
print(m)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
a.sort()
 
dp = [True] * n
cnt = 0
for i in range(n):
    for j in range(n):
        if i==j:
            continue

        if dp[j]:
            if a[j]%a[i]==0:
                cnt += 1
                dp[j] = False

ans = n - cnt
print(ans)

Fixed submission:
from collections import Counter


n = int(input())
a = list(map(int, input().split()))
c = Counter(a) # Count num and construct dictionary
c = sorted(c.items(), key=lambda x:x[0]) # align key
ans = 0
isOK = [True] * (10**6+1)

for k, v in c:
    if not isOK[k]:
        continue

    if v > 1:
        for i in range(k, len(isOK), k):
            isOK[i] = False
        continue

    ans += 1
    for i in range(2*k, len(isOK), k):
        isOK[i] = False

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))
a.sort()
 
dp = [True] * n
for i in range(n):
    for j in range(n):
        if i==j:
            continue
            
        if dp[j]:
            if a[j]%a[i]==0:
                dp[j] = False

cnt = 0
for i in range(n):
    if dp[i]:
        cnt += 1

print(cnt)

Fixed submission:
from collections import Counter


n = int(input())
a = list(map(int, input().split()))
c = Counter(a) # Count num and construct dictionary
c = sorted(c.items(), key=lambda x:x[0]) # align key
ans = 0
isOK = [True] * (10**6+1)

for k, v in c:
    if not isOK[k]:
        continue

    if v > 1:
        for i in range(k, len(isOK), k):
            isOK[i] = False
        continue

    ans += 1
    for i in range(2*k, len(isOK), k):
        isOK[i] = False

print(ans)

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

cnt = 0
for i in range(n):
    for j in range(n):
        if i==j:
            continue

        if a[i]%a[j]==0:
            break
    else:
        cnt += 1
    continue

print(cnt)

Fixed submission:
from collections import Counter


n = int(input())
a = list(map(int, input().split()))
c = Counter(a) # Count num and construct dictionary
c = sorted(c.items(), key=lambda x:x[0]) # align key
ans = 0
isOK = [True] * (10**6+1)

for k, v in c:
    if not isOK[k]:
        continue

    if v > 1:
        for i in range(k, len(isOK), k):
            isOK[i] = False
        continue

    ans += 1
    for i in range(2*k, len(isOK), k):
        isOK[i] = False

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

results = A[0]
can = True
zero = False
for i in range(N):
    if A[i]==0:
        zero = True
        break

for i in range(N):
    if i==0:
        continue
    results *= A[i]
    if zero:
        continue
    else:
        if results>10**18:
            can = False
            break

if can:
    print(results)
else:
    print(-1)

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

results = A[0]
can = True
zero = False
for i in range(N):
    if A[i]==0:
        zero = True
        break

if zero:
    print(0)
else:
    for i in range(N):
        if i==0:
            continue
        results *= A[i]
        if results>10**18:
            can = False
            break

    if can:
        print(results)
    else:
        print(-1)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))

results = A[0]
for i in range(N):
    if i==0:
        continue
    results *= A[i]

if results>10**18:
    print(-1)
else:
    print(results)

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

results = A[0]
can = True
zero = False
for i in range(N):
    if A[i]==0:
        zero = True
        break

if zero:
    print(0)
else:
    for i in range(N):
        if i==0:
            continue
        results *= A[i]
        if results>10**18:
            can = False
            break

    if can:
        print(results)
    else:
        print(-1)
Buggy python submission (verdict: Runtime Error):
AB = list(map(str, input().split()))
A = int(AB[0])
B = int(AB[1][0])*1000 + int(AB[1][1])*100 + int(AB[1][2])*10 + int(AB[1][3])

result = int((A * B) / 100)
print(result)

Fixed submission:
from decimal import Decimal


AB = list(map(Decimal, input().split()))

result = int((AB[0] * AB[1]))
print(result)

Buggy python submission (verdict: Runtime Error):
AB = list(map(float, input().split()))
A = int(AB[0])
B = AB[1] * 100

result = int((A * B) / 100)
print(results)

Fixed submission:
from decimal import Decimal


AB = list(map(Decimal, input().split()))

result = int((AB[0] * AB[1]))
print(result)