title: Compute Ncr P Set 1 Introduction And Dynamic Programming Solution
signature: def compute_ncr_p_set_1_introduction_and_dynamic_programming_solution(n, r, p):
source_py: def compute_ncr_p_set_1_introduction_and_dynamic_programming_solution(n, r, p):
      C = [0 for i in range((r + 1))]
      C[0] = 1
      for i in range(1, (n + 1)):
          for j in range(min(i, r), 0, (- 1)):
              C[j] = ((C[j] + C[(j - 1)]) % p)
      return C[r]
source_cpp: int compute_ncr_p_set_1_introduction_and_dynamic_programming_solution(int n, int r, int p) {
    int C [ r + 1 ];
    memset ( C, 0, sizeof ( C ) );
    C [ 0 ] = 1;
    for ( int i = 1;
    i <= n;
    i ++ ) {
      for ( int j = min ( i, r );
      j > 0;
      j -- ) C [ j ] = ( C [ j ] + C [ j - 1 ] ) % p;
    }
    return C [ r ];
  }
question_info.test_code: import array
  import bisect
  import collections
  import datetime
  import functools
  import heapq
  import itertools
  import math
  import queue
  import re
  import string
  import sys
  from typing import Any, Dict, List, Optional, Set
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  def validate_solution(actual, expected):
      return actual == expected
  
  def driver(n, r, p, expected):
      try:
          if validate_solution(PLACEHOLDER_FN_NAME(
              n, r, p),
              expected
          ):
              return "PASSED"
          return "FAILED"
      except Exception as exception_obj:
          return type(exception_obj).__name__
      
  if __name__ == "__main__":
      result = driver(82, 5, 94, 50)
      print(f"TEST-0...{result}")
  
      result = driver(45, 24, 95, 80)
      print(f"TEST-1...{result}")
  
      result = driver(44, 68, 61, 0)
      print(f"TEST-2...{result}")
  
      result = driver(88, 24, 43, 0)
      print(f"TEST-3...{result}")
  
      result = driver(90, 75, 57, 0)
      print(f"TEST-4...{result}")
  
      result = driver(98, 55, 43, 2)
      print(f"TEST-5...{result}")
  
      result = driver(80, 54, 88, 0)
      print(f"TEST-6...{result}")
  
      result = driver(60, 75, 65, 0)
      print(f"TEST-7...{result}")
  
      result = driver(52, 73, 86, 0)
      print(f"TEST-8...{result}")
  
      result = driver(71, 26, 45, 12)
      print(f"TEST-9...{result}")
  
      sys.exit(0)
question_info.test_case_ids: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
question_info.entry_fn_name: compute_ncr_p_set_1_introduction_and_dynamic_programming_solution
question_info.test_list: [{"idx": 0, "outputs": 50, "inputs": {"n": 82, "r": 5, "p": 94}}, {"idx": 1, "outputs": 80, "inputs": {"n": 45, "r": 24, "p": 95}}, {"idx": 2, "outputs": 0, "inputs": {"n": 44, "r": 68, "p": 61}}, {"idx": 3, "outputs": 0, "inputs": {"n": 88, "r": 24, "p": 43}}, {"idx": 4, "outputs": 0, "inputs": {"n": 90, "r": 75, "p": 57}}, {"idx": 5, "outputs": 2, "inputs": {"n": 98, "r": 55, "p": 43}}, {"idx": 6, "outputs": 0, "inputs": {"n": 80, "r": 54, "p": 88}}, {"idx": 7, "outputs": 0, "inputs": {"n": 60, "r": 75, "p": 65}}, {"idx": 8, "outputs": 0, "inputs": {"n": 52, "r": 73, "p": 86}}, {"idx": 9, "outputs": 12, "inputs": {"n": 71, "r": 26, "p": 45}}]
question_info.entry_cls_name: Solution