Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
def isprime(n):
    if n == 1:
        return 0
    if n == 2:
        return 1
    if n % 2 == 0:
        return 0
    for i in range(2,int(sqrt(n)+1)):
        if n % i == 0:
            return 0
    return 1

from sys import stdin
for i in stdin:
    i = int(i)
    print(sum(isprime(n) for n in range(2,i+1)))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
cash = {}
def isprime(n):
    if n in cash:
        return cash[n]
    if n == 1:
        return 0
    if n == 2:
        return 1
    if n % 2 == 0:
        return 0
    for i in range(2,int(sqrt(n)+1)):
        if n % i == 0:
            return 0
    cash[n] = 1
    return 1

from sys import stdin
h = {}
for i in stdin:
    i = int(i)
    c = sum(isprime(n) for n in range(2,i+1))
    print(c)

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
cash = {}
def isprime(n):
    if n in cash:
        return cash[n]
    if n == 1:
        cash[n] = 0
        return 0
    if n == 2:
        cash[n] = 1
        return 1
    if n % 2 == 0:
        cash[n] = 0
        return 0
    for i in range(2,int(sqrt(n)+1)):
        if n % i == 0:
            cash[n] = 0
            return 0
    cash[n] = 1
    return 1

from sys import stdin
cash2 = {}
for i in stdin:
    i = int(i)

    c = sum(isprime(n) for n in range(2,i+1))
    print(c)

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
cash = {}
def isprime(n):
    if n in cash:
        return cash[n]
    if n == 1:
        cash[n] = 0
        return 0
    if n == 2:
        cash[n] = 1
        return 1
    if n % 2 == 0:
        cash[n] = 0
        return 0
    for i in range(3,int(sqrt(n)+1))[0::2]:
        if n % i == 0:
            cash[n] = 0
            return 0
    cash[n] = 1
    return 1

from sys import stdin
cash2 = {}
for i in stdin:
    i = int(i)
    c = sum(isprime(n) for n in range(2,i+1))
    print(c)

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
cash = {}
def isprime(n):
    if n in cash:
        return cash[n]
    if n == 1:
        cash[n] = 0
        return 0
    if n == 2:
        cash[n] = 1
        return 1
    if n % 2 == 0:
        cash[n] = 0
        return 0
    for i in range(3,int(sqrt(n)+1))[0::2]:
        if n % i == 0:
            cash[n] = 0
            return 0
    cash[n] = 1
    return 1

from sys import stdin
#cash2 = {}
for i in stdin:
    i = int(i)
    c = sum(isprime(n) for n in range(2,i+1)[1::2]) + 1
    print(c)

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
cash = {}
def isprime(n):
    if n in cash:
        return cash[n]
    for i in range(3, int(sqrt(n)+1))[0::2]:
        if n % i == 0:
            cash[n] = 0
            return 0
    cash[n] = 1
    return 1

from sys import stdin
cash2 = {}
for i in stdin:
    i = int(i)
    c = sum(isprime(n) for n in range(2, i+1)[1::2]) + 1
    print(c)

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
cash = {}
def isprime(n):
    if n in cash:
        return cash[n]
    for i in range(3, int(sqrt(n)+1))[0::2]:
        if n % i == 0:
            cash[n] = 0
            return 0
    cash[n] = 1
    return 1

from sys import stdin
for i in stdin:
    print(sum(isprime(n) for n in range(2, int(i)+1)[1::2]) + 1)

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Runtime Error):
def p(n):
    l = list(range(2,n+1))
    p = 2
    i = 0
    p = l[i]
    while True:
        pl = len(l)
        l = list(filter(lambda n: n%p != 0 or n == p,l))
        i += 1
        p = l[i]
        if pl == len(l):
            break
    return len(l)

from sys import stdin
for i in stdin:
    print(p(int(i)))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Runtime Error):
def p(n):
    l = list(range(2,n+1))
    p = 2
    i = 0
    p = l[i]
    while True:
        pl = len(l)
        l = list(filter(lambda n: n%p != 0 or n == p,l))
        i += 1
        p = l[i]
        if pl == len(l):
            return pl

from sys import stdin
for i in stdin:
    print(p(int(i)))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Runtime Error):
from math import sqrt
def p(n):
    l = list(range(2,n+1))
    p = 2
    i = 0
    p = l[i]
    while p < sqrt(n):
        pl = len(l)
        l = list(filter(lambda n: n%p != 0 or n == p,l))
        i += 1
        p = l[i]
    return len(l)

from sys import stdin
for i in stdin:
    print(p(int(i)))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Runtime Error):
def pm(n):
    l = list(range(3,n+1)[0::2])
    p = 3
    i = 0
    p = l[i]
    m = sqrt(n)+1
    while p <= m:
        l = l[:i+1] + [n for n in l[i+1:] if n%p != 0]
        i += 1
        p = l[i]
    return len(l) + 1

from sys import stdin
for i in stdin:
    print(pm(int(i)))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Runtime Error):
from math import sqrt
def pm(n):
    l = list(range(3,n+1)[0::2])
    p = 3
    i = 0
    p = l[i]
    m = sqrt(n)+1
    while p <= m:
        l = l[:i+1] + [n for n in l[i+1:] if n%p != 0]
        i += 1
        p = l[i]
    return len(l) + 1

from sys import stdin
for i in stdin:
    print(pm(int(i)))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Runtime Error):
from math import sqrt
from sys import stdin
def pm(n):
    l = list(range(3,n+1)[0::2])
    p = 3
    i = 0
    p = l[i]
    m = sqrt(n)+1
    while p <= m:
        l = l[:i+1] + [n for n in l[i+1:] if n%p != 0]
        i += 1
        p = l[i]
    return len(l) + 1


for i in stdin:
    print(pm(int(i)))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Runtime Error):
from math import sqrt
from sys import stdin
def pm(n):
    l = list(range(3,n+1)[0::2])
    p = 3
    i = 0
    p = l[i]
    m = sqrt(n)+1
    while p <= m:
        l = l[:i+1] + [n for n in l[i+1:] if n%p != 0]
        i += 1
        p = l[i]
    return len(l) + 1

for n in stdin:
    print(pm(int(n)))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Runtime Error):
from math import sqrt
from sys import stdin

def pm(n):
    l = list(range(3,n+1)[0::2])
    p = 3
    i = 0
    p = l[i]
    m = sqrt(n)+1
    while p <= m:
        l = l[:i+1] + [n for n in l[i+1:] if n%p != 0]
        i += 1
        p = l[i]
    return len(l) + 1

for n in stdin:
    print (pm(int(n)))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Runtime Error):
from math import sqrt
from sys import stdin
def pm(n):
    l = list(range(3,n+1)[0::2])
    p = 3
    i = 0
    p = l[i]
    m = sqrt(n)+1
    while p <= m:
        l = l[:i+1] + [n for n in l[i+1:] if n%p != 0]
        i += 1
        p = l[i]
    return len(l) + 1

for n in stdin:
    print pm(int(n))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Runtime Error):
from math import sqrt
from sys import stdin

def pm(n):
    l = list(range(3,n+1)[0::2])
    p = 3
    i = 0
    p = l[i]
    m = sqrt(n)+1
    while p <= m:
        l = l[:i+1] + [n for n in l[i+1:] if n%p != 0]
        i += 1
        p = l[i]
    return len(l) + 1

for n in stdin:
    print (pm(int(n)))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt
from sys import stdin
def isprime(n):
    if n == 1:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    for i in range(3, int(sqrt(n))+1):
        if n % i == 0:
            return False
    return True

for n in stdin:
    n = int(n)
    ct = 0
    for i in range(1,n + 1):
        if isprime(i):
            #print (i)
            ct += 1
    print (ct)

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n) + 1
    l = [0] + [1] * (n - 1)
    c = 2
    while c < mx:

        for k in range(2, floor(n/c) + 1):
            l[c * k -1] = 0
        c = l[:c].index(1) + c
    return sum(l)
for n in stdin:
    n = int(n)
    print(cntPrime(n))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n) + 1
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(3, floor(n/c) + 1):
            l[c * k -1] = 0
        c = l[:c].index(1) + c
    return sum(l)
for n in stdin:
    n = int(n)
    print(cntPrime(n))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Runtime Error):
def cntPrime(n):
    mx = sqrt(n) + 1
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c, floor(n/c) + 1, 1):
            l[c * k -1] = 0
        c = l[:c].index(1) + c
    return sum(l)
for n in stdin:
    n = int(n)
    print(cntPrime(n))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n) + 1
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c, floor(n/c) + 1, 1):
            l[c * k -1] = 0
        c = l[:c].index(1) + c
    return sum(l)
for n in stdin:
    n = int(n)
    print(cntPrime(n))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n) + 1
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c, floor(n/c) + 1, 1):
            l[c * k -1] = 0
        c = l[:c].index(1) + c
        while c % 2 == 0: 
            c = l[:c].index(1) + c
    return sum(l)
for n in stdin:
    n = int(n)
    print(cntPrime(n))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n) + 1
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[:c].index(1) + c
    return sum(l)
for n in stdin:
    n = int(n)
    print(cntPrime(n))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))

Buggy python submission (verdict: Time Limit Exceeded):
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return sum(l)
for n in stdin:
    n = int(n)
    print(cntPrime(n))

Fixed submission:
from math import sqrt,floor
from sys import stdin

def cntPrime(n):
    mx = sqrt(n)
    if n % 2 == 0:
      l = [0, 1] + [1, 0] * (int(n/2) - 1)
    else:
      l = [0, 1] + [1, 0] * (int(n/2) - 1) + [1]
    c = 3
    while c < mx:
        for k in range(c*2, n+1, c):
            l[k-1] = 0
        c = l[(c+1):].index(1) + c +2
        while c % 2 == 0:
            c = l[(c+1):].index(1) + c +2
    return l
t = cntPrime(1000000)
for n in stdin:
    n = int(n)
    print(sum(t[:n]))