title: Dice Throw Problem 1
signature: def diceThrowProblem1(f: Int, d: Int, s: Int) = {
test_code: import scala.collection.mutable.HashMap
  import scala.collection.immutable.HashSet
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  
  // TESTING CODE 
  // ============================================
  def validateSolution(actual: Long , expected: Long): Boolean = {
      actual.toString == expected.toString
  }
  
  def driver(f: Int, d: Int, s: Int, expected: Long): String = {
      try {
          if (validateSolution(PLACEHOLDER_FN_NAME(f, d, s),expected)) {
              "PASSED"
          } else{
              "FAILED"
          }
      }catch{
          case e: Exception => {e.getClass.getName}
      }
  
  }
  object QuestionEvaluator extends App {
  
      println(s"TEST-0...${driver(
        57, 5, 33, 
        35960L    
      )}")   
  
  
      println(s"TEST-1...${driver(
        58, 45, 4, 
        0L    
      )}")   
  
  
      println(s"TEST-2...${driver(
        38, 89, 9, 
        0L    
      )}")   
  
  
      println(s"TEST-3...${driver(
        5, 39, 30, 
        0L    
      )}")   
  
  
      println(s"TEST-4...${driver(
        91, 90, 47, 
        0L    
      )}")   
  
  
      println(s"TEST-5...${driver(
        76, 56, 46, 
        0L    
      )}")   
  
  
      println(s"TEST-6...${driver(
        97, 26, 52, 
        247959266474052L    
      )}")   
  
  
      println(s"TEST-7...${driver(
        97, 90, 90, 
        1L    
      )}")   
  
  
      println(s"TEST-8...${driver(
        99, 2, 26, 
        25L    
      )}")   
  
  }
  
source_py: def dice_throw_problem_1(f, d, s):
      mem = [[0 for i in range((s + 1))] for j in range((d + 1))]
      mem[0][0] = 1
      for i in range(1, (d + 1)):
          for j in range(1, (s + 1)):
              mem[i][j] = (mem[i][(j - 1)] + mem[(i - 1)][(j - 1)])
              if (((j - f) - 1) >= 0):
                  mem[i][j] -= mem[(i - 1)][((j - f) - 1)]
      return mem[d][s]
source_cpp: long dice_throw_problem_1(int f, int d, int s) {
    long mem [ d + 1 ] [ s + 1 ];
    memset ( mem, 0, sizeof mem );
    mem [ 0 ] [ 0 ] = 1;
    for ( int i = 1;
    i <= d;
    i ++ ) {
      for ( int j = i;
      j <= s;
      j ++ ) {
        mem [ i ] [ j ] = mem [ i ] [ j - 1 ] + mem [ i - 1 ] [ j - 1 ];
        if ( j - f - 1 >= 0 ) mem [ i ] [ j ] -= mem [ i - 1 ] [ j - f - 1 ];
      }
    }
    return mem [ d ] [ s ];
  }