title: overflow encountered in long scalers while stress testing for maximum pair-wise product
body: <p>I'm trying stress testing over the maximum pair-wise product algorithm, where the constraints are <code>2 &lt;= n &lt;= 2.10^5; 0 &lt;= a1,...,an &lt;= 2.10^5</code> where <code>n</code> is the length of the array and <code>a1,a2,...,an</code> is the element of list. When I'm running the code which is shown below, it's giving me an error saying <code>overflow encountered in long scalers</code>. This can be avoided in <code>c</code> using <code>long long</code> but how to avoid in <code>python</code>. please help.</p>
  
  <p>MY CODE</p>
  
  <pre><code># python3
  import numpy as np
  
  def max_pairwise_product(numbers):
  
      n = len(numbers)
      max_product = 0
      for first in range(n):
          for second in range(first + 1, n):
              max_product = max(max_product, (numbers[first] * numbers[second]))
  
      return max_product
  
  def fast_max_pairwise_product(numbers):
  
      max_num = max(numbers)  
      numbers.remove(max_num)
      sec_max_num = max(numbers)
      max_product = max_num * sec_max_num
  
      return max_product
  
  while(True):
      n = np.random.randint(0,1000) + 2
      print(n)
      vector = list(np.random.randint(0,1000000, n))
      print(vector)
      res1 = max_pairwise_product(vector)
      res2 = fast_max_pairwise_product(vector)
      if(res1 != res2):
          print('Wrong Answer', res1, ' ' , res2)
          break
      else:
          print()
  
  </code></pre>
  
  <p>ERROR</p>
  
  <pre><code>C:/Users/INTEL/Desktop/Algorithm Specialization/Algorithm toolbox/Week 1/week1_programming_challenges/2_maximum_pairwise_product/stress_test.py:11: RuntimeWarning: overflow encountered in long_scalars
    max_product = max(max_product, (numbers[first] * numbers[second]))
  C:/Users/INTEL/Desktop/Algorithm Specialization/Algorithm toolbox/Week 1/week1_programming_challenges/2_maximum_pairwise_product/stress_test.py:23: RuntimeWarning: overflow encountered in long_scalars
    max_product = max_num * sec_max_num
  </code></pre>