title: Sum Pairwise Products 1
signature: pub fn sum_pairwise_products_1(n: i32) -> i32 {
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: i32, expected: i32)->bool{
  return actual==expected
  }
  pub fn driver(n: i32, expected: i32)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(n), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        41, 
        382571
      ));
      
      println!("TEST-1...{}", driver(
        50, 
        834275
      ));
      
      println!("TEST-2...{}", driver(
        67, 
        2645897
      ));
      
      println!("TEST-3...{}", driver(
        18, 
        15675
      ));
      
      println!("TEST-4...{}", driver(
        60, 
        1711355
      ));
      
      println!("TEST-5...{}", driver(
        6, 
        266
      ));
      
      println!("TEST-6...{}", driver(
        27, 
        74907
      ));
      
      println!("TEST-7...{}", driver(
        46, 
        601036
      ));
      
      println!("TEST-8...{}", driver(
        50, 
        834275
      ));
      
      println!("TEST-9...{}", driver(
        20, 
        23485
      ));
      
  }
source_py: def sum_pairwise_products_1(n):
      multiTerms = ((n * (n + 1)) // 2)
      sm = multiTerms
      for i in range(2, (n + 1)):
          multiTerms = (multiTerms - (i - 1))
          sm = (sm + (multiTerms * i))
      return sm
source_cpp: long long int sum_pairwise_products_1(int n) {
    long long int multiTerms = n * ( n + 1 ) / 2;
    long long int sum = multiTerms;
    for ( int i = 2;
    i <= n;
    i ++ ) {
      multiTerms = multiTerms - ( i - 1 );
      sum = sum + multiTerms * i;
    }
    return sum;
  }