title: Sum Matrix Element Absolute Difference Row Column Numbers 1
signature: sum_matrix_element_absolute_difference_row_column_numbers_1 <- function(n) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(n, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(n), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          63L, 
          83328L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          72L, 
          124392L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          28L, 
          7308L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          35L, 
          14280L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          6L, 
          70L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          70L, 
          114310L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          20L, 
          2660L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          8L, 
          168L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          8L, 
          168L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          35L, 
          14280L
      )))
  
  }
  
  main()
source_py: def sum_matrix_element_absolute_difference_row_column_numbers_1(n):
      sum = 0
      for i in range(n):
          sum += (i * (n - i))
      return (2 * sum)
source_cpp: int sum_matrix_element_absolute_difference_row_column_numbers_1(int n) {
    int sum = 0;
    for ( int i = 0;
    i < n;
    i ++ ) sum += i * ( n - i );
    return 2 * sum;
  }