Buggy python submission (verdict: Time Limit Exceeded):
def GCM(m, n):
    r = m%n
    if r == 0: return n
    else: return GCM(n, r)
        
while 1:
    try:
        n = input()
        c = 0
        for i in range(2,n+1):
            for j in range(2,i):
                if GCM(i, j) != 1:
                    break
            else:
                c += 1
        print c
    except EOFError:
        break

Fixed submission:
n = 10**6
c = 0
ps = [False]*(n+1)
for i in xrange(2, n+1):
    if i%2 != 0 or i == 2:
        ps[i] = True
for i in xrange(2, int(n**0.5+1)):
    if ps[i]:
        for j in xrange(i**2, n+1, i):
            ps[j] = False

while 1:
    try:
        n = input()
        if n == 2: print 1
        else: print len([0 for i in xrange(2, n+1) if ps[i]])
    except EOFError:
        break

Buggy python submission (verdict: Time Limit Exceeded):
import math
def isPrime(n):
    if n == 2:
        return True
    if n%2 == 0:
        return False
    nMax = int(math.sqrt(n))+1
    for i in range(3, nMax+1):
        if n%i == 0: return False
    else: return True
         
while 1:
    try:
        n = input()
        c = 0
        for i in range(2,n+1):
            if isPrime(i) is True:
                c += 1
        print c
    except EOFError:
        break

Fixed submission:
n = 10**6
c = 0
ps = [False]*(n+1)
for i in xrange(2, n+1):
    if i%2 != 0 or i == 2:
        ps[i] = True
for i in xrange(2, int(n**0.5+1)):
    if ps[i]:
        for j in xrange(i**2, n+1, i):
            ps[j] = False

while 1:
    try:
        n = input()
        if n == 2: print 1
        else: print len([0 for i in xrange(2, n+1) if ps[i]])
    except EOFError:
        break

Buggy python submission (verdict: Time Limit Exceeded):
import math
def isPrime(n, primes):
    if n == 2:
        return True
    if n%2 == 0:
        return False
    nMax = int(math.sqrt(n))+1
    for i in range(3, nMax+1):
        if n%i == 0: return False
    else:
        primes.append(n)
        return True
         
while 1:
    try:
        n = input()
        c = 0
        for i in range(2,n+1):
            p = [2]
            if isPrime(i, p) is True:
                c += 1
        print c
    except EOFError:
        break

Fixed submission:
n = 10**6
c = 0
ps = [False]*(n+1)
for i in xrange(2, n+1):
    if i%2 != 0 or i == 2:
        ps[i] = True
for i in xrange(2, int(n**0.5+1)):
    if ps[i]:
        for j in xrange(i**2, n+1, i):
            ps[j] = False

while 1:
    try:
        n = input()
        if n == 2: print 1
        else: print len([0 for i in xrange(2, n+1) if ps[i]])
    except EOFError:
        break

Buggy python submission (verdict: Time Limit Exceeded):
import math
         
while 1:
    try:
        n = input()
        c = 0
        ps = [False for i in range(n)]
        for i in range(2, n):
            ps[i] = True
        for i in range(2, int(math.sqrt(n)+1)):
            if ps[i]:
                for j in range(i**2, n, i):
                    ps[j] = False
            
        for i in range(n):
            if ps[i] is True:
                c += 1
        print c
    except EOFError:
        break

Fixed submission:
n = 10**6
c = 0
ps = [False]*(n+1)
for i in xrange(2, n+1):
    if i%2 != 0 or i == 2:
        ps[i] = True
for i in xrange(2, int(n**0.5+1)):
    if ps[i]:
        for j in xrange(i**2, n+1, i):
            ps[j] = False

while 1:
    try:
        n = input()
        if n == 2: print 1
        else: print len([0 for i in xrange(2, n+1) if ps[i]])
    except EOFError:
        break

Buggy python submission (verdict: Time Limit Exceeded):
while 1:
    try:
        n = input()
        c = 0
        ps = [False for i in range(n)]
        for i in range(2, n):
            ps[i] = True
        for i in range(2, int(n**0.5+1)):
            if ps[i]:
                for j in range(i**2, n, i):
                    ps[j] = False
            
        for i in range(n):
            if ps[i] is True:
                c += 1
        print c
    except EOFError:
        break

Fixed submission:
n = 10**6
c = 0
ps = [False]*(n+1)
for i in xrange(2, n+1):
    if i%2 != 0 or i == 2:
        ps[i] = True
for i in xrange(2, int(n**0.5+1)):
    if ps[i]:
        for j in xrange(i**2, n+1, i):
            ps[j] = False

while 1:
    try:
        n = input()
        if n == 2: print 1
        else: print len([0 for i in xrange(2, n+1) if ps[i]])
    except EOFError:
        break

Buggy python submission (verdict: Time Limit Exceeded):
while 1:
    try:
        n = input()
        c = 0
        ps = [False for i in range(n)]
        for i in xrange(2, n):
            ps[i] = True
        for i in xrange(2, int(n**0.5+1)):
            if ps[i]:
                for j in xrange(i**2, n, i):
                    ps[j] = False
            
        for i in xrange(n):
            if ps[i] is True:
                c += 1
        print c
    except EOFError:
        break

Fixed submission:
n = 10**6
c = 0
ps = [False]*(n+1)
for i in xrange(2, n+1):
    if i%2 != 0 or i == 2:
        ps[i] = True
for i in xrange(2, int(n**0.5+1)):
    if ps[i]:
        for j in xrange(i**2, n+1, i):
            ps[j] = False

while 1:
    try:
        n = input()
        if n == 2: print 1
        else: print len([0 for i in xrange(2, n+1) if ps[i]])
    except EOFError:
        break