title: Sum Matrix Element Absolute Difference Row Column Numbers 2
signature: fun sumMatrixElementAbsoluteDifferenceRowColumnNumbers2(n: Int): Int {
test_code: package main
  
  import kotlin.text.*
  import kotlin.math.*
  
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  fun validateSolution(actual:Int, expected:Int):Boolean{
    return actual.equals(expected)
  }
  fun driver(n: Int, expected:Int):String {
      try{
        if (validateSolution(PLACEHOLDER_FN_NAME(n), expected)) {
                return "PASSED"
        }
        return "FAILED"
      } catch (e: Exception){
        return e::class.simpleName as String
      }
  
  }
  
  fun main() {
      var result: String = ""
      result = driver(12, 572)
      println("TEST-0...${result}")
      
      result = driver(89, 234960)
      println("TEST-1...${result}")
      
      result = driver(76, 146300)
      println("TEST-2...${result}")
      
      result = driver(2, 2)
      println("TEST-3...${result}")
      
      result = driver(81, 177120)
      println("TEST-4...${result}")
      
      result = driver(11, 440)
      println("TEST-5...${result}")
      
      result = driver(26, 5850)
      println("TEST-6...${result}")
      
      result = driver(35, 14280)
      println("TEST-7...${result}")
      
      result = driver(16, 1360)
      println("TEST-8...${result}")
      
      result = driver(66, 95810)
      println("TEST-9...${result}")
      
          
  }
  
  main()
source_py: def sum_matrix_element_absolute_difference_row_column_numbers_2(n):
      n -= 1
      sum = 0
      sum += ((n * (n + 1)) / 2)
      sum += (((n * (n + 1)) * ((2 * n) + 1)) / 6)
      return int(sum)
source_cpp: int sum_matrix_element_absolute_difference_row_column_numbers_2(int n) {
    n --;
    int sum = 0;
    sum += ( n * ( n + 1 ) ) / 2;
    sum += ( n * ( n + 1 ) * ( 2 * n + 1 ) ) / 6;
    return sum;
  }