> from math import floor
> no_of_cases = int(raw_input());
> lower_limit_array = [] ;
> upper_limit_array = [] ;
> for y in range(no_of_cases) :
>     a,b = map(int,raw_input().split());
>     lower_limit_array.append(a);
>     upper_limit_array.append(b);
> n = max(upper_limit_array);
> arr = [True] * (n-1)  ;
> for i in range(2,int(floor(n ** 0.5 + 1))) :
>     if arr[i-2] == True :
>         k = i**2 ;
>         while k <= n :
>             arr[k-2] = False ;
>             k += i ;
> for x in range(no_of_cases) :
>     for i in range(lower_limit_array[x],upper_limit_array[x]+1):
>         if arr[i-2] == True :
>             print i ;
>     print "\n";

I am getting a NZEC error but don't know why?

  • created

    Feb '17
  • last reply

    Feb '17
  • 1

    reply

  • 1.1k

    views

  • 2

    users

  • No need for ; in python
  • Hopefully you don't submit the code with all these <
  • Submitting only this: arr = [True] * 1000000000 results in NZEC, too