human
Count of numbers between range having only non | Function to return the count of required numbers from 0 to num.
Last position.
If this result is already computed simply return it.
Maximum limit upto which we can place digit . If tight is 1 , means number has already become smaller so we can place any digit , otherwise num [ pos ].
If the current digit is zero and nonz is 1 , we can 't place it.
Function to convert x into its digit vector and uses count ( ) function to return the required count.
Initialize dp.
Driver code.
n is the sum of digits and number should be divisible by m.
States - position , sum , rem , tight sum can have values upto 162 , if we are dealing with numbers upto 10 ^ 18 when all 18 digits are 9 , then sum is 18 * 9 = 162"
Solution in Python:

Give me a code to count of numbers between range having only non and the other steps required?
assistant
#Here is code to count of numbers between range having only non and the other steps required.
 def count ( pos , Sum , rem , tight , nonz , num ) :
	if pos == len ( num ) :
		if rem == 0 and Sum == n :
			return 1
		return 0
	if dp [ pos ] [ Sum ] [ rem ] [ tight ] != - 1 :
		return dp [ pos ] [ Sum ] [ rem ] [ tight ]
	ans = 0
	if tight :
		limit = 9
	else :
		limit = num [ pos ]
	for d in range ( 0 , limit + 1 ) :
		if d == 0 and nonz :
			continue
		currSum = Sum + d
		currRem = ( rem * 10 + d ) % m
		currF = int ( tight or ( d < num [ pos ] ) )
		ans += count ( pos + 1 , currSum , currRem , currF , nonz or d , num )
	dp [ pos ] [ Sum ] [ rem ] [ tight ] = ans
	return ans
def solve ( x ) :
	num = [ ]
	global dp
	while x > 0 :
		num . append ( x % 10 )
		x //= 10
	num . reverse ( )
	dp = [ [ [ [ - 1 , - 1 ] for i in range ( M ) ] for j in range ( 165 ) ] for k in range ( M ) ]
	return count ( 0 , 0 , 0 , 0 , 0 , num )
if __name__ == " _ _ main _ _ " :
	L , R = 1 , 100
	n , m , M = 8 , 2 , 20
	dp = [ ]
	print ( solve ( R ) - solve ( L ) )