Buggy python submission (verdict: Runtime Error):
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
R = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*R
p[0] = p[1] = 0
i = 2
while i*i < n:
    if p[i]:
        p[2*i::i] = [0 for x in range(2*i,R,i)]
    i += p[i+1:].index(1)+1
for i in n:
     print sum(p[:i+1])

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
   
R = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*R
p[0] = p[1] = 0
i = 2
while i*i <= R:
    if p[i]:
        p[2*i::i] = [0 for x in range(2*i,R,i)]
    i += p[i+1:].index(1)+1
for i in n:
     print sum(p[:i+1])

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
n  = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break

R = max(n)+1
p = [1]*R
p[0] = p[1] = 0
i = 2
while i <= R**0.5:
    if p[i]:
        p[2*i::i] = [0]*((R-2*i)/i)
    i += p[i+1:].index(1)+1
for i in n:
    print sum(p[:i+1])

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
% cat test.py
n  = []
while True:
    try:n.append(int(raw_input()))
    except:break

R = max(n)+10
p = [1]*R
p[0] = p[1] = 0
p[4::2] = [0 for i in range(4,R,2)]
for i in range(3,int(R**0.5),2):
    if p[i]:
        p[2*i::i] = [0]*len(p[2*i::i])

print p
for i in n:
    print sum(p[:i+1])

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
n  = []
while True:
    try:n.append(int(raw_input()))
    except:break
R = max(n)+1
p = [1]*R
p[0] = p[1] = 0
p[4::2] = [0 for i in range(4,R,2)]
for i in range(3,int(R**0.5)+1,2):
    if p[i]:
        p[2*i::i] = [0]*((R-2*i+1)/i)
for i in n:
    print sum(p[:i+1])

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Time Limit Exceeded):
R = 1000000
p = [1]*R
p[0] = p[1] = 0
p[2] = 1
p[4::2] = [0 for i in range(4,R,2)]
idx = 2
for i in range(3,int(R**0.5)+1,2):
    if p[i]:
        p[i] = idx
        idx += 1
        p[2*i::i] = [0]*len(p[2*i::i])
while True:
    try:print p[i]
    except:break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
rom bisect import bisect
R = 1000000
p = [1]*R
p[0] = p[1] = 0
p[4::2] = [0]*len(p[4::2])
for i in xrange(3,int(R**0.5)+1,2):
    if p[i]:
        p[i*i::i] = [0]*len(p[i*i::i])
prime = [i for i in xrange(2,R) if p[i]]
while True:
    try:print bisect(prime,input())
    except:break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
while True:
    n = int(raw_input())
    filter = [1 for i in range(n)]
    filter[0] = 0
    for i in range(1:n):
        j = 2
        while k < n:
            k = i*j
            filter[k-1] = 0
    count = 0
    do i in filter:
        sum += i
    print sum

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
while True:
    try:
        n = int(raw_input())
        filter = [1 for i in range(n)]
        filter[0] = 0
        for i in range(1:n):
            j = 2
            while k < n:
                k = i*j
                filter[k-1] = 0
                j += 1
        count = 0
        do i in filter:
            sum += i
        print sum
    except:
        break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
while True:
while True:
    try:
        n = int(raw_input())
        filter = [1 for i in range(n)]
        filter[0] = 0
        for i in range(2,n//2):
            j = 2
            k = i*j
            while k < n:
                filter[k-1] = 0
                j += 1
                k = i*j
        print filter
        sum = 0
        for i in filter:
            sum += i
        print sum
    except:
        break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Time Limit Exceeded):
while True:
    try:
        n = int(raw_input())
        filter = [1 for i in range(n)]
        filter[0] = 0
        for i in range(2,n//2):
            j = 2
            k = i*j
            while k < n:
                filter[k-1] = 0
                j += 1
                k = i*j
        print filter
        sum = 0
        for i in filter:
            sum += i
        print sum
    except:
        break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
while True:
    try:
        n = int(raw_input())
        filter = [1 for i in range(n)]
        filter[0] = 0
        for i in range(2,n//2):
　　　　　　　if filter[i] = 1
                j = 2
                k = i*j
                while k < n:
                    filter[k-1] = 0
                    j += 1
                    k = i*j
        print filter
        sum = 0
        for i in filter:
            sum += i
        print sum
    except:
        break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
while True:
    try:
        n = int(raw_input())
        filter = [1 for i in range(n)]
        filter[0] = 0
        for i in range(2,n//2):
　　　　　　　if filter[i] == 1:
                j = 2
                k = i*j
                while k < n:
                    filter[k-1] = 0
                    j += 1
                    k = i*j
        print filter
        sum = 0
        for i in filter:
            sum += i
        print sum
    except:
        break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
while True:
    try:
        n = int(raw_input())
        filter = [1 for i in range(n)]
        filter[0] = 0
        for i in range(2,n//2):
　　　　     if filter[i] == 1:
                j = 2
                k = i*j
                while k < n:
                    filter[k-1] = 0
                    j += 1
                    k = i*j
        print filter
        sum = 0
        for i in filter:
            sum += i
        print sum
    except:
        break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Time Limit Exceeded):
while True:
    try:
        n = int(raw_input())
        filter = [1 for i in range(n)]
        filter[0] = 0
        for i in range(2,n//2):
            if filter[i] == 1:
                j = 2
                k = i*j
                while k < n:
                    filter[k-1] = 0
                    j += 1
                    k = i*j
        print filter
        sum = 0
        for i in filter:
            sum += i
        print sum
    except:
        break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Time Limit Exceeded):
import math

while True:
    try:
        n = int(raw_input())
        prime=[]
        if n == 1:
            print 0
        elif n == 2:
            print 1
        else:
            for i in range(3, n+1, 2):
                isprime = 1
                sqrt = int(math.sqrt(i))
                for j in prime:
                    if i % j == 0:
                        isprime = 0
                        break
                    if j > sqrt:
                        break
                if isprime:
                    prime.append(i)
            print len(prime)+1
    except:
        break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

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

r = 999999
sqrt = int(math.sqrt(r))
prime = [1 for i in range(r)]
prime[0] = 0
for i in range(2,r/2):
    prime[2*i-1] = 0
for i in range(3,sqrt,2):
    for j in range(2*i,r,i)
        prime[j] = 0

while True:
    try:
        n = int(raw_input())
        print sum(prime[:n])
    except:
        break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

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

r = 999999
sqrt = int(math.sqrt(r))
prime = "1"*r
prime[0] = 0
for i in range(2,r/2):
    prime[2*i-1] = 0
for i in range(3,sqrt,2):
    for j in range(2*i,r+1,i):
        prime[j-1] = 0

while True:
    try:
        n = int(raw_input())
        print sum(prime[:n])
    except:
        break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

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

r = 999999
sqrt = int(math.sqrt(r))
prime = "1"*r
prime[0] = 0
for i in range(2,r/2):
    prime[2*i-1] = "0"
for i in range(3,sqrt,2):
    for j in range(2*i,r+1,i):
        prime[j-1] = "0"

while True:
    try:
        n = int(raw_input())
        print sum(prime[:n])
    except:
        break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

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

r = 999999
sqrt = int(math.sqrt(r))
prime = "1"*r
prime[0] = "0"
for i in range(2,r/2):
    prime[2*i-1] = "0"
for i in range(3,sqrt,2):
    for j in range(2*i,r+1,i):
        prime[j-1] = "0"

while True:
    try:
        n = int(raw_input())
        print sum(prime[:n])
    except:
        break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Time Limit Exceeded):
import math

r = 999999
sqrt = int(math.sqrt(r))
p = [1 for i in range(r)]
p[0] = 0
for i in p:
    if i:
        for j in range(2*(i+1)-1,r,i+1):
            p[j] = 0

while True:
    try:
        n = int(raw_input())
        print sum(p[:n])
    except:
        break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Time Limit Exceeded):
import math

r = 999999
sqrt = int(math.sqrt(r))
p = [1 for i in range(r)]
p[0] = 0
for i in p[:sqrt]:
    if i:
        for j in range(2*(i+1)-1,r,i+1):
            p[j] = 0

while True:
    try:
        n = int(raw_input())
        print sum(p[:n])
    except:
        break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
----:---F1  *scratch*      All L1     (Fundamental)------------------------------------------------------------------------------------
Loading subst-jis...done
import math

r = 999999
sqrt = int(math.sqrt(r))
p = [1 for i in range(r)]
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        for j in range(2*(i+1)-1,r,i+1):
            p[j] = 0

while True:
    try:
        n = int(raw_input())
        print sum(p[:n])
    except:
        break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
import math
 
while True:
    try:
        n.append(int(raw_input()))
    except:
        break

r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        for j in range(2*i+1,r,i+1):
            p[j] = 0

for i in n:
     print sum(p[:i])

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
 
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = range(2*i+1,r,i+1):
           
 
for i in n:
     print sum(p[:i])

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
 
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for range(2*i+1,r,i+1)]:
           
 
for i in n:
     print sum(p[:i])

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
 
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0 for range(2*i+1,r,i+1)]
           
for i in n:
     print sum(p[:i])

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
 
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
for i in range(1,sqrt):
    if p[i]:
        p[2*i+1::i+1] = [0]*range(2*i+1,r,i+1)
           
for i in n:
     print sum(p[:i])

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
def isPrime(p):
	if p == 2: return 1
	if p < 2 or p&1 == 0: return 0
	return 1 if pow(2,p-1,p) == 1 else 0
	
n = int(raw_input())
print sum(isPrime(int(i) for i in range(1,n+1))

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Runtime Error):
def isPrime(p):
	if p == 2: return 1
	if p < 2 or p&1 == 0: return 0
	return 1 if pow(2,p-1,p) == 1 else 0

while True:
	try:
		n = int(raw_input())
		print sum(isPrime(i) for i in range(1,n+1))

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Time Limit Exceeded):
def isPrime(p):
	if p == 2: return 1
	if p < 2 or p&1 == 0: return 0
	return 1 if pow(2,p-1,p) == 1 else 0

while True:
	try:
		n = int(raw_input())
		print sum(isPrime(i) for i in range(1,n+1))
	except:
		break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Time Limit Exceeded):
def isPrime(p):
	if p == 2: return 1
	if p < 2 or p&1 == 0: return 0
	return 1 if pow(2,p-1,p) == 1 else 0

while True:
	try:
		n = int(raw_input())
		print sum(isPrime(i) for i in range(3,n+1,2))+1
	except:
		break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])

Buggy python submission (verdict: Time Limit Exceeded):
def isPrime(p):
	if p == 2: return 1
	if p < 2 or p&1 == 0: return 0
	return 1 if pow(2,p-1,p) == 1 else 0

while True:
	try:
		n = int(raw_input())
		print sum(isPrime(i) for i in range(5,n+1,2))+2
	except:
		break

Fixed submission:
import math
n = []
while True:
    try:
        n.append(int(raw_input()))
    except:
        break
  
r = max(n)+1
sqrt = int(math.sqrt(r))
p = [1]*r
p[0] = 0
p[3::2] = [0 for x in range(3,r,2)]
for i in range(2,sqrt,2):
    if p[i]:
        p[2*i+1::i+1] = [0 for x in range(2*i+1,r,i+1)] 
  
for i in n:
     print sum(p[:i])