code: def dup_div(f, g, K):
      """
      Polynomial division with remainder in ``K[x]``.
  
      Examples
      ========
  
      >>> from sympy.polys import ring, ZZ, QQ
  
      >>> R, x = ring("x", ZZ)
      >>> R.dup_div(x**2 + 1, 2*x - 4)
      (0, x**2 + 1)
  
      >>> R, x = ring("x", QQ)
      >>> R.dup_div(x**2 + 1, 2*x - 4)
      (1/2*x + 1, 5)
  
      """
      if K.is_Field:
          return dup_ff_div(f, g, K)
      else:
          return dup_rr_div(f, g, K)
  
imports: from sympy.polys.densebasic import dup_slice, dup_LC, dmp_LC, dup_degree, dmp_degree, dup_strip, dmp_strip, dmp_zero_p, dmp_zero, dmp_one_p, dmp_one, dmp_ground, dmp_zeros
  from sympy.polys.polyerrors import ExactQuotientFailed, PolynomialDivisionFailed
label_desc: Use image node_id 49 for calling a global function with example usage: dup_div(f, g, K) and returns: dup_ff_div, dup_rr_div