Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import sys

def isprime(n):
    for i in xrange(2, int(n**0.5)+1):
        if n % i == 0: return False
    return True

#for line in ["35"]:
for line in sys.stdin.readlines():
    List = map(int, line.strip().split())

    n = List[0]

    ans = 0
    for i in xrange(2, n+1):
        if isprime(i): ans += 1

    print ans

Fixed submission:
# -*- coding: utf-8 -*-

import sys

limit = 1000000

prime01List = [1]*limit
prime01List[0] = 0 # 1 is not prime
for i in xrange(2, int(limit**0.5)+1):
    n = 2*i
    while(n <= limit):
        prime01List[n-1] = 0
        n += i


ansList = [0]*limit
cnt = 0
for i in xrange(limit):
    cnt += prime01List[i]
    ansList[i] = cnt


#for line in ["999999"]:
for line in sys.stdin.readlines():
    List = map(int, line.strip().split())

    n = List[0]
    print ansList[n-1]

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import sys

def isprime(n):
    for i in xrange(2, int(n**0.5)+1):
        if n % i == 0: return False
    return True

limit = 1000000
ansList = [0] # 1 is not prime
cnt = 0
for i in xrange(2, limit):
    if isprime(i): cnt += 1
    ansList.append(cnt)

#for line in ["999999"]:
for line in sys.stdin.readlines():
    List = map(int, line.strip().split())

    n = List[0]
    print ansList[n-1]

Fixed submission:
# -*- coding: utf-8 -*-

import sys

limit = 1000000

prime01List = [1]*limit
prime01List[0] = 0 # 1 is not prime
for i in xrange(2, int(limit**0.5)+1):
    n = 2*i
    while(n <= limit):
        prime01List[n-1] = 0
        n += i


ansList = [0]*limit
cnt = 0
for i in xrange(limit):
    cnt += prime01List[i]
    ansList[i] = cnt


#for line in ["999999"]:
for line in sys.stdin.readlines():
    List = map(int, line.strip().split())

    n = List[0]
    print ansList[n-1]

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import sys

def isprime(n):
    for i in xrange(2, int(n**0.5)+1):
        if n % i == 0: return False
    return True

limit = 1000000
ansList = [0]*limit # 1 is not prime
cnt = 0
for i in xrange(2, limit):
    if isprime(i): cnt += 1
    ansList[i-1] = cnt

for line in ["999999"]:
#for line in sys.stdin.readlines():
    List = map(int, line.strip().split())

    n = List[0]
    print ansList[n-1]

Fixed submission:
# -*- coding: utf-8 -*-

import sys

limit = 1000000

prime01List = [1]*limit
prime01List[0] = 0 # 1 is not prime
for i in xrange(2, int(limit**0.5)+1):
    n = 2*i
    while(n <= limit):
        prime01List[n-1] = 0
        n += i


ansList = [0]*limit
cnt = 0
for i in xrange(limit):
    cnt += prime01List[i]
    ansList[i] = cnt


#for line in ["999999"]:
for line in sys.stdin.readlines():
    List = map(int, line.strip().split())

    n = List[0]
    print ansList[n-1]

Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-

import sys

def isprime(n):
    for i in xrange(2, int(n**0.5)+1):
        if n % i == 0: return False
    return True

limit = 1000000
ansList = [0]*limit # 1 is not prime
cnt = 0
for i in xrange(2, limit):
    if isprime(i): cnt += 1
    ansList[i-1] = cnt

#for line in ["999999"]:
for line in sys.stdin.readlines():
    List = map(int, line.strip().split())

    n = List[0]
    print ansList[n-1]

Fixed submission:
# -*- coding: utf-8 -*-

import sys

limit = 1000000

prime01List = [1]*limit
prime01List[0] = 0 # 1 is not prime
for i in xrange(2, int(limit**0.5)+1):
    n = 2*i
    while(n <= limit):
        prime01List[n-1] = 0
        n += i


ansList = [0]*limit
cnt = 0
for i in xrange(limit):
    cnt += prime01List[i]
    ansList[i] = cnt


#for line in ["999999"]:
for line in sys.stdin.readlines():
    List = map(int, line.strip().split())

    n = List[0]
    print ansList[n-1]