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

# n??\???????´???°?????°???????????¢??°
def prime(n):
    l = range(0,n+1)
    i,k = 0,2
    result = 1

    if n >= 3:
        prime_nums = [2, 3]
    else:
        prime_nums = []

    while i <= n:
        while l[i] > k:
            result = l[i]%k
            k = k+1
            if result == 0:
                break
            if (l[i]-1 == k) and (result != 0):
                prime_nums.append(l[i])

        i, k = i+1, 2

    #return prime_nums
    return len(prime_nums)

array = []
for i in sys.stdin:
    array.append(int(i))

l = len(array)
for i in array:
    psum = prime(i)
    print(psum)
    

Fixed submission:
from math import sqrt
I_list=[]
prime_list=[]
while True:
    try:
        I_list.append(int(input()))
    except:
        break
I_max=max(I_list)
search_set={x for x in range(2,I_max+1)}
 
 
p=-1
while p<=sqrt(I_max):
    p=min(search_set)
    prime_list.append(p)
    search_set={x for x in search_set if x%p !=0 }
 
search_list=sorted(list(search_set))
prime_list+=search_list
 
#print(prime_list)
 
 
for i in I_list:
    lower_set={j for j in prime_list if j<=i } 
#   print(lower_set)
    print(len(lower_set))

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

# n??\???????´???°?????°???????????¢??°
def prime(n):
    l = range(0,n+1)
    i,k = 0,2
    result = 1

    if n >= 3:
        prime_nums = [2, 3]
    else:
        prime_nums = []

    while i <= n:
        while l[i] > k:
            result = l[i]%k
            k = k+1
            if result == 0:
                break
            if (l[i]-1 == k) and (result != 0):
                prime_nums.append(l[i])

        i, k = i+1, 2

    #return prime_nums
    return len(prime_nums)

array = []
#for i in sys.stdin:
#    array.append(int(i))

#l = len(array)
#for i in array:
#    psum = prime(i)
#    print(psum)
    
for i in sys.stdin:
    psum = prime(int(i))
    print(psum)

Fixed submission:
from math import sqrt
I_list=[]
prime_list=[]
while True:
    try:
        I_list.append(int(input()))
    except:
        break
I_max=max(I_list)
search_set={x for x in range(2,I_max+1)}
 
 
p=-1
while p<=sqrt(I_max):
    p=min(search_set)
    prime_list.append(p)
    search_set={x for x in search_set if x%p !=0 }
 
search_list=sorted(list(search_set))
prime_list+=search_list
 
#print(prime_list)
 
 
for i in I_list:
    lower_set={j for j in prime_list if j<=i } 
#   print(lower_set)
    print(len(lower_set))

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

# n??\???????´???°?????°?????????
def prime(n):
    l = range(0,n+1)
    i,k = 0,2
    result = 1

    if n >= 3:
        prime_nums = [2, 3]
    else:
        prime_nums = []

    while i <= n:
        while l[i] > k:
            result = l[i]%k
            k = k+1
            if result == 0:
                break
            if (l[i]-1 == k) and (result != 0):
                prime_nums.append(l[i])

        i, k = i+1, 2

    #return prime_nums
    return len(prime_nums)

while True:
    try:        
        psum = prime(int(input()))
        print(psum)
    except:
        break

Fixed submission:
from math import sqrt
I_list=[]
prime_list=[]
while True:
    try:
        I_list.append(int(input()))
    except:
        break
I_max=max(I_list)
search_set={x for x in range(2,I_max+1)}
 
 
p=-1
while p<=sqrt(I_max):
    p=min(search_set)
    prime_list.append(p)
    search_set={x for x in search_set if x%p !=0 }
 
search_list=sorted(list(search_set))
prime_list+=search_list
 
#print(prime_list)
 
 
for i in I_list:
    lower_set={j for j in prime_list if j<=i } 
#   print(lower_set)
    print(len(lower_set))