Buggy python submission (verdict: Time Limit Exceeded):
def e(n):
    array = [1]*(n+1)
        
    k = 2
    
    while k*k <= n:
        if array[k] == 1:
            i = k
    
            while (i <= n/k):
                array[k*i] = 0
                i += 1
        
        k += 1
    
    # ?´???°(array[i]==1)?????????
    prime = []
    i = 2
    
    while i <= n:
        if array[i] == 1:
            prime.append(i)
        i += 1
    
    return len(prime)


while True:
    try:
        n = int(input())
        print(e(n))
        
    except:
        break

Fixed submission:
import sys
import math
M = 1000000
B = int(math.sqrt(M)+1)//6+1
N = M//6
N1 = N+1 if M % 6 == 5 else N
N2 = N+1 if M % 6 >= 1 else N
l = [1] * N1
m = [1] * N2
i = 5
ini = 4
for p in range(B):
    if l[p] == 1:
        l[p+i::i] = [0] * len(l[p+i::i])
        m[ini-1::i] = [0] * len(m[ini-1::i])
    if m[p] == 1:
        m[p+i+2::i+2] = [0] * len(m[p+i+2::i+2])
        l[ini+1::i+2] = [0] * len(l[ini+1::i+2])
    i += 6
    ini += 5
 
for i in sys.stdin:
    n = int(i)
    r =  n-1 if n < 3 else sum(l[0:(n+1)//6])+sum(m[0:(n-1)//6])+2
    print(r)

Buggy python submission (verdict: Time Limit Exceeded):
def e(n):
    array = [1]*(n+1)
        
    k = 2
    
    while k*k <= n:
        if array[k] == 1:
            i = k
    
            while (i <= n/k):
                array[k*i] = 0
                i += 1
        
        k += 1
    
    # ?´???°(array[i]==1)?????????
    prime = []
    i = 2
    
    while i <= n:
        if array[i] == 1:
            prime.append(i)
        i += 1
    
    return len(prime)


while True:
    try:
        n = int(input())
        print(e(n))
        
    except:
        break

Fixed submission:
import sys
import math
M = 1000000
B = int(math.sqrt(M)+1)//6+1
N = M//6
N1 = N+1 if M % 6 == 5 else N
N2 = N+1 if M % 6 >= 1 else N
l = [1] * N1
m = [1] * N2
i = 5
ini = 4
for p in range(B):
    if l[p] == 1:
        l[p+i::i] = [0] * len(l[p+i::i])
        m[ini-1::i] = [0] * len(m[ini-1::i])
    if m[p] == 1:
        m[p+i+2::i+2] = [0] * len(m[p+i+2::i+2])
        l[ini+1::i+2] = [0] * len(l[ini+1::i+2])
    i += 6
    ini += 5
 
for i in sys.stdin:
    n = int(i)
    r =  n-1 if n < 3 else sum(l[0:(n+1)//6])+sum(m[0:(n-1)//6])+2
    print(r)

Buggy python submission (verdict: Time Limit Exceeded):
def e(n):
    array = [1]*(n+1)
        
    k = 2
    
    while k*k <= n:
        if array[k] == 1:
            i = k
    
            while (i <= n/k):
                array[k*i] = 0
                i += 1
        
        k += 1
    
    # ?´???°(array[i]==1)?????????
    prime = []
    i = 2
    
    while i <= n:
        if array[i] == 1:
            prime.append(i)
        i += 1
    
    return len(prime)


while True:
    try:
        n = int(input())
        print(e(n))
        
    except:
        break

Fixed submission:
import sys
import math
M = 1000000
B = int(math.sqrt(M)+1)//6+1
N = M//6
N1 = N+1 if M % 6 == 5 else N
N2 = N+1 if M % 6 >= 1 else N
l = [1] * N1
m = [1] * N2
i = 5
ini = 4
for p in range(B):
    if l[p] == 1:
        l[p+i::i] = [0] * len(l[p+i::i])
        m[ini-1::i] = [0] * len(m[ini-1::i])
    if m[p] == 1:
        m[p+i+2::i+2] = [0] * len(m[p+i+2::i+2])
        l[ini+1::i+2] = [0] * len(l[ini+1::i+2])
    i += 6
    ini += 5
 
for i in sys.stdin:
    n = int(i)
    r =  n-1 if n < 3 else sum(l[0:(n+1)//6])+sum(m[0:(n-1)//6])+2
    print(r)

Buggy python submission (verdict: Time Limit Exceeded):
def e(n):
    array = [1]*(n+1)
        
    k = 2
    
    while k*k <= n:
        if array[k] == 1:
            i = k
    
            while (i <= n/k):
                array[k*i] = 0
                i += 1
        
        k += 1
    
    # ?´???°(array[i]==1)?????????
    prime = []
    i = 2
    
    while i <= n:
        if array[i] == 1:
            prime.append(i)
        i += 1
    
    return len(prime)


while True:
    try:
        n = int(input())
        print(e(n))
        
    except:
        break

Fixed submission:
import sys
import math
M = 1000000
B = int(math.sqrt(M)+1)//6+1
N = M//6
N1 = N+1 if M % 6 == 5 else N
N2 = N+1 if M % 6 >= 1 else N
l = [1] * N1
m = [1] * N2
i = 5
ini = 4
for p in range(B):
    if l[p] == 1:
        l[p+i::i] = [0] * len(l[p+i::i])
        m[ini-1::i] = [0] * len(m[ini-1::i])
    if m[p] == 1:
        m[p+i+2::i+2] = [0] * len(m[p+i+2::i+2])
        l[ini+1::i+2] = [0] * len(l[ini+1::i+2])
    i += 6
    ini += 5
 
for i in sys.stdin:
    n = int(i)
    r =  n-1 if n < 3 else sum(l[0:(n+1)//6])+sum(m[0:(n-1)//6])+2
    print(r)

Buggy python submission (verdict: Time Limit Exceeded):
def e(n):
    array = [1]*(n+1)
    k = 2
    while k*k <= n:
        if array[k] == 1:
            i = k
            while (i <= n/k):
                array[k*i] = 0
                i += 1
        k += 1
    prime = []
    i = 2
    while i <= n:
        if array[i] == 1:
            prime.append(i)
        i += 1
    return len(prime)
while True:
    try:
        n = int(input())
        print(e(n))
    except:
        break

Fixed submission:
import sys
import math
M = 1000000
B = int(math.sqrt(M)+1)//6+1
N = M//6
N1 = N+1 if M % 6 == 5 else N
N2 = N+1 if M % 6 >= 1 else N
l = [1] * N1
m = [1] * N2
i = 5
ini = 4
for p in range(B):
    if l[p] == 1:
        l[p+i::i] = [0] * len(l[p+i::i])
        m[ini-1::i] = [0] * len(m[ini-1::i])
    if m[p] == 1:
        m[p+i+2::i+2] = [0] * len(m[p+i+2::i+2])
        l[ini+1::i+2] = [0] * len(l[ini+1::i+2])
    i += 6
    ini += 5
 
for i in sys.stdin:
    n = int(i)
    r =  n-1 if n < 3 else sum(l[0:(n+1)//6])+sum(m[0:(n-1)//6])+2
    print(r)