title: Sum Pairwise Products 2
signature: pub fn sum_pairwise_products_2(n: i32) -> f64 {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: f64, expected: f64)->bool{
  return (actual - expected).abs() < 1e-09
  }
  pub fn driver(n: i32, expected: f64)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(n), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        57, 
        1397887.0
      ));
      
      println!("TEST-1...{}", driver(
        18, 
        15675.0
      ));
      
      println!("TEST-2...{}", driver(
        97, 
        11449977.0
      ));
      
      println!("TEST-3...{}", driver(
        9, 
        1155.0
      ));
      
      println!("TEST-4...{}", driver(
        42, 
        420497.0
      ));
      
      println!("TEST-5...{}", driver(
        67, 
        2645897.0
      ));
      
      println!("TEST-6...{}", driver(
        71, 
        3327486.0
      ));
      
      println!("TEST-7...{}", driver(
        66, 
        2493271.0
      ));
      
      println!("TEST-8...{}", driver(
        69, 
        2972060.0
      ));
      
      println!("TEST-9...{}", driver(
        18, 
        15675.0
      ));
      
  }
source_py: def sum_pairwise_products_2(n):
      return ((((n * (n + 1)) * (n + 2)) * ((3 * n) + 1)) / 24)
source_cpp: long long int sum_pairwise_products_2(int n) {
    return n * ( n + 1 ) * ( n + 2 ) * ( 3 * n + 1 ) / 24;
  }